ccsniff 1.1.13 → 1.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cli.js +5 -1
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -436,6 +436,9 @@ if (opts['glyph-discipline']) {
|
|
|
436
436
|
const includeSubagents = opts['include-subagents'];
|
|
437
437
|
const GLYPH = /[←-⇿⌀-⏿■-◿☀-➿⬀-⯿]|[\u{1F000}-\u{1FAFF}]/u;
|
|
438
438
|
const GLYPH_G = /[←-⇿⌀-⏿■-◿☀-➿⬀-⯿]|[\u{1F000}-\u{1FAFF}]/gu;
|
|
439
|
+
// Glyphs inside a regex char-class (e.g. /[←-⇿]/) are a detector/range DEFINITION, not decorative
|
|
440
|
+
// prose — blank those bracket bodies before testing so a glyph-rule definition does not flag itself.
|
|
441
|
+
const stripGlyphCharClass = (s) => s.replace(/\[[^\]\n]*\]/g, (m) => GLYPH.test(m) ? '[]' : m);
|
|
439
442
|
const violations = [];
|
|
440
443
|
for (const ev of all) {
|
|
441
444
|
if (!filter(ev)) continue;
|
|
@@ -445,7 +448,8 @@ if (opts['glyph-discipline']) {
|
|
|
445
448
|
if (name !== 'Write' && name !== 'Edit' && name !== 'NotebookEdit') continue;
|
|
446
449
|
const inp = ev.block?.input || {};
|
|
447
450
|
const filePath = inp.file_path || inp.notebook_path || '';
|
|
448
|
-
const
|
|
451
|
+
const rawContent = [inp.content, inp.new_string, inp.new_source].filter(s => typeof s === 'string').join('\n');
|
|
452
|
+
const content = stripGlyphCharClass(rawContent);
|
|
449
453
|
if (!content || !GLYPH.test(content)) continue;
|
|
450
454
|
const glyphs = [...new Set((content.match(GLYPH_G) || []))].slice(0, 10).join(' ');
|
|
451
455
|
violations.push({ ts: ev.timestamp, sid: ev.conversation?.id || '', project: path.basename(ev.conversation?.cwd || ''), kind: 'glyph-written', file: path.basename(filePath), glyphs });
|