ccsniff 1.1.12 → 1.1.13
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 +41 -1
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -30,7 +30,7 @@ const FLAGS = {
|
|
|
30
30
|
string: ['since', 'until', 'before', 'after', 'grep', 'igrep', 'cwd', 'project', 'role', 'type', 'tool', 'session', 'sid', 'sess', 'parent', 'rollup', 'format', 'sort', 'unsloth', 'unsloth-format', 'exclude-sess', 'exclude-sid', 'exclude-cwd', 'exclude-project'],
|
|
31
31
|
multi: ['grep', 'igrep', 'role', 'type', 'tool', 'session', 'sid', 'project', 'cwd', 'exclude-sess', 'exclude-sid', 'exclude-cwd', 'exclude-project'],
|
|
32
32
|
number: ['limit', 'head', 'tail-n', 'ctx', 'truncate', 'days'],
|
|
33
|
-
bool: ['json', 'ndjson', 'tail', 'f', 'full', 'reverse', 'invert', 'no-subagents', 'only-subagents', 'no-meta', 'only-meta', 'list-sessions', 'list-projects', 'list-tools', 'bash-discipline', 'git-discipline', 'search-discipline', 'learning-xref', 'include-subagents', 'stats', 'count', 'help', 'h'],
|
|
33
|
+
bool: ['json', 'ndjson', 'tail', 'f', 'full', 'reverse', 'invert', 'no-subagents', 'only-subagents', 'no-meta', 'only-meta', 'list-sessions', 'list-projects', 'list-tools', 'bash-discipline', 'git-discipline', 'search-discipline', 'glyph-discipline', 'learning-xref', 'include-subagents', 'stats', 'count', 'help', 'h'],
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
function parseArgs(argv) {
|
|
@@ -67,6 +67,7 @@ USAGE
|
|
|
67
67
|
ccsniff --learning-xref [--sess <id>] [--days N] join transcript turns to rs-learn recall/memorize
|
|
68
68
|
ccsniff --git-discipline [--stats] git push from a dirty/unwitnessed tree
|
|
69
69
|
ccsniff --search-discipline [--stats] native search (Grep/Glob/Explore/find) instead of codesearch/recall
|
|
70
|
+
ccsniff --glyph-discipline [--stats] decorative glyphs (arrows/box/star/dot/check/emoji) written into files
|
|
70
71
|
(excludes subagents by default — --include-subagents to opt in;
|
|
71
72
|
excludes 'echo > .gm/exec-spool/in/...' as canonical spool-write)
|
|
72
73
|
ccsniff --stats [filters]
|
|
@@ -426,6 +427,45 @@ if (opts['search-discipline']) {
|
|
|
426
427
|
process.exit(0);
|
|
427
428
|
}
|
|
428
429
|
|
|
430
|
+
// ---------- glyph-discipline (flag decorative graphical symbols written into files)
|
|
431
|
+
// The gm SKILL.md rule forbids decorative glyphs (arrows, box/geometric glyphs, stars, dots,
|
|
432
|
+
// bullets, checkmarks, crosses, emojis) in output and source; they must convert to ASCII on sight.
|
|
433
|
+
// A glyph written into a file via Write/Edit is invisible to the spool ledger, so ccsniff reading
|
|
434
|
+
// the tool-call stream is the surface that catches it. Functional operators are ASCII and never match.
|
|
435
|
+
if (opts['glyph-discipline']) {
|
|
436
|
+
const includeSubagents = opts['include-subagents'];
|
|
437
|
+
const GLYPH = /[←-⇿⌀-⏿■-◿☀-➿⬀-⯿]|[\u{1F000}-\u{1FAFF}]/u;
|
|
438
|
+
const GLYPH_G = /[←-⇿⌀-⏿■-◿☀-➿⬀-⯿]|[\u{1F000}-\u{1FAFF}]/gu;
|
|
439
|
+
const violations = [];
|
|
440
|
+
for (const ev of all) {
|
|
441
|
+
if (!filter(ev)) continue;
|
|
442
|
+
if (ev.block?.type !== 'tool_use') continue;
|
|
443
|
+
if (!includeSubagents && ev.conversation?.isSubagent) continue;
|
|
444
|
+
const name = ev.block?.name || '';
|
|
445
|
+
if (name !== 'Write' && name !== 'Edit' && name !== 'NotebookEdit') continue;
|
|
446
|
+
const inp = ev.block?.input || {};
|
|
447
|
+
const filePath = inp.file_path || inp.notebook_path || '';
|
|
448
|
+
const content = [inp.content, inp.new_string, inp.new_source].filter(s => typeof s === 'string').join('\n');
|
|
449
|
+
if (!content || !GLYPH.test(content)) continue;
|
|
450
|
+
const glyphs = [...new Set((content.match(GLYPH_G) || []))].slice(0, 10).join(' ');
|
|
451
|
+
violations.push({ ts: ev.timestamp, sid: ev.conversation?.id || '', project: path.basename(ev.conversation?.cwd || ''), kind: 'glyph-written', file: path.basename(filePath), glyphs });
|
|
452
|
+
}
|
|
453
|
+
if (opts.stats || opts.count) {
|
|
454
|
+
if (opts.count) { process.stdout.write(`${violations.length}\n`); process.exit(0); }
|
|
455
|
+
process.stdout.write(`# ${violations.length} glyph-discipline violations (decorative glyphs written to files)\n`);
|
|
456
|
+
const byProj = new Map();
|
|
457
|
+
for (const v of violations) byProj.set(v.project, (byProj.get(v.project) || 0) + 1);
|
|
458
|
+
process.stdout.write(`# by project\n`);
|
|
459
|
+
for (const [p, c] of [...byProj.entries()].sort((a, b) => b[1] - a[1])) process.stdout.write(` ${String(c).padStart(6)} ${p}\n`);
|
|
460
|
+
process.exit(0);
|
|
461
|
+
}
|
|
462
|
+
for (const v of violations) {
|
|
463
|
+
process.stdout.write(`${new Date(v.ts).toISOString().slice(0, 19)} ${v.sid.slice(0, 8)} ${v.kind.padEnd(14)} [${v.project}] ${v.file} ${v.glyphs}\n`);
|
|
464
|
+
}
|
|
465
|
+
process.stderr.write(`# ${violations.length} violations — convert decorative glyphs to ASCII (-> for arrow, - or * for bullet, [x]/[ ] for check/cross)\n`);
|
|
466
|
+
process.exit(0);
|
|
467
|
+
}
|
|
468
|
+
|
|
429
469
|
// ---------- learning-xref (join transcript turns to gm-log rs_learn signals)
|
|
430
470
|
if (opts['learning-xref']) {
|
|
431
471
|
const days = opts.days || 1;
|