mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-03-30 13:43:26 +08:00
refactor: address reviewer feedback
- Add options={} parameter to run() to match run-with-flags.js contract
- Remove case-insensitive flag from extension pre-filter for consistency
with ADHOC_FILENAMES regex (both now case-sensitive)
- Expand warning text to list more structured paths
- Add test cases for uppercase extensions (TODO.MD, NOTES.TXT)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Lidang-Jiang <lidangjiang@gmail.com>
This commit is contained in:
@@ -28,8 +28,8 @@ function isSuspiciousDocPath(filePath) {
|
||||
const normalized = filePath.replace(/\\/g, '/');
|
||||
const basename = path.basename(normalized);
|
||||
|
||||
// Only inspect .md and .txt files
|
||||
if (!/\.(md|txt)$/i.test(basename)) return false;
|
||||
// Only inspect .md and .txt files (case-sensitive, consistent with ADHOC_FILENAMES)
|
||||
if (!/\.(md|txt)$/.test(basename)) return false;
|
||||
|
||||
// Only flag known ad-hoc filenames
|
||||
if (!ADHOC_FILENAMES.test(basename)) return false;
|
||||
@@ -44,7 +44,7 @@ function isSuspiciousDocPath(filePath) {
|
||||
* Exportable run() for in-process execution via run-with-flags.js.
|
||||
* Avoids the ~50-100ms spawnSync overhead when available.
|
||||
*/
|
||||
function run(inputOrRaw) {
|
||||
function run(inputOrRaw, options = {}) {
|
||||
let input;
|
||||
try {
|
||||
input = typeof inputOrRaw === 'string'
|
||||
@@ -61,7 +61,7 @@ function run(inputOrRaw) {
|
||||
stderr:
|
||||
'[Hook] WARNING: Ad-hoc documentation filename detected\n' +
|
||||
`[Hook] File: ${filePath}\n` +
|
||||
'[Hook] Consider using structured paths: docs/, .claude/commands/, skills/',
|
||||
'[Hook] Consider using a structured path (e.g. docs/, .claude/, skills/, .github/, benchmarks/, templates/)',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user