chill-agent 1.7.0 → 1.8.1

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/src/cli.js CHANGED
@@ -5,20 +5,22 @@ import { parseArgs } from 'node:util';
5
5
  import { banner, c, select, multiselect, confirm } from './prompts.js';
6
6
  import { detectAgents } from './detector.js';
7
7
  import { AVAILABLE_SKILLS, copySkillsToProject, generatePointerBlock, injectPointerIntoFile } from './installer.js';
8
- import { scanDirectory, printAuditReport } from './auditor.js';
8
+ import { scanDirectory, printAuditReport, auditAllPages, generateAuditReport, autoFixFile } from './auditor.js';
9
9
  import { DESIGN_PRESETS } from './presets.js';
10
+ import { configureMode } from '../cli/lib/settings.mjs';
10
11
 
11
12
  export async function runCli() {
12
13
  const rawArgs = process.argv.slice(2);
13
14
  const command = rawArgs[0] || 'wizard';
14
15
 
15
- if (command === 'help' || command === '--help' || command === '-h') {
16
+ if (command === 'help' || rawArgs.includes('--help') || rawArgs.includes('-h')) {
16
17
  banner();
17
18
  console.log(`
18
19
  ${c.bold}USAGE:${c.reset}
19
20
  npx chill-agent Launch interactive setup wizard
20
21
  npx chill-agent install [--all] [--agent <name>] Install anti-slop skills non-interactively
21
- npx chill-agent audit [dir] [--json] Scan code & copy for AI slop cliches
22
+ npx chill-agent audit [dir] [--fix] [--report] [--all-pages] Scan & audit all pages for AI slop
23
+ npx chill-agent mode [during|after|ask] Configure global anti-slop usage mode
22
24
  npx chill-agent init-design [preset] Generate a high-craft DESIGN.md specification
23
25
  npx chill-agent doctor Inspect detected coding agents and rule health
24
26
  npx chill-agent rewind [subcommand] Run deterministic time-travel debugger & proxy
@@ -33,6 +35,17 @@ ${c.bold}PRESETS FOR init-design:${c.reset}
33
35
  return;
34
36
  }
35
37
 
38
+ if (command === 'mode' || rawArgs.includes('--mode')) {
39
+ const modeArgs = command === 'mode' ? rawArgs.slice(1) : rawArgs.slice(rawArgs.indexOf('--mode') + 1);
40
+ try {
41
+ console.log(configureMode(modeArgs));
42
+ } catch (err) {
43
+ console.error(`antislop: ${err.message}`);
44
+ process.exit(1);
45
+ }
46
+ return;
47
+ }
48
+
36
49
  if (command === 'doctor') {
37
50
  banner();
38
51
  console.log(`${c.bold}ChillAgent Environment Diagnostics${c.reset}\n`);
@@ -47,32 +60,45 @@ ${c.bold}PRESETS FOR init-design:${c.reset}
47
60
 
48
61
  if (command === 'audit' || command === 'lint' || command === 'scan') {
49
62
  const isFix = rawArgs.includes('--fix');
63
+ const isReport = rawArgs.includes('--report');
64
+ const isAllPages = rawArgs.includes('--all-pages') || rawArgs.includes('--pages');
65
+ const isJson = rawArgs.includes('--json');
50
66
  const targetDir = rawArgs[1] && !rawArgs[1].startsWith('--')
51
67
  ? path.resolve(process.cwd(), rawArgs[1])
52
68
  : process.cwd();
53
69
 
70
+ const auditData = auditAllPages(targetDir);
71
+
54
72
  if (isFix) {
55
- const { autoFixFile } = await import('./auditor.js');
56
73
  let fixCount = 0;
57
- function walkFix(dir) {
58
- const entries = fs.readdirSync(dir, { withFileTypes: true });
59
- for (const e of entries) {
60
- if (e.isDirectory() && !['node_modules', '.git', '.chillrewind', 'dist'].includes(e.name)) {
61
- walkFix(path.join(dir, e.name));
62
- } else if (e.isFile() && ['.js', '.jsx', '.ts', '.tsx', '.html', '.css', '.md'].some(ext => e.name.endsWith(ext))) {
63
- if (autoFixFile(path.join(dir, e.name))) fixCount++;
64
- }
74
+ for (const pr of auditData.pageResults) {
75
+ if (pr.findings.length > 0 && autoFixFile(pr.page.file)) {
76
+ fixCount++;
65
77
  }
66
78
  }
67
- walkFix(targetDir);
68
- console.log(`\n${c.emerald}✔ Anti-Slop Auto-Fix Completed:${c.reset} Remedied slop patterns in ${c.bold}${fixCount}${c.reset} files.`);
79
+ console.log(`\n${c.emerald}✔ Anti-Slop Auto-Fix Completed:${c.reset} Remedied slop patterns across ${c.bold}${fixCount}${c.reset} audited files.`);
69
80
  }
70
81
 
71
- const findings = scanDirectory(targetDir);
72
- if (rawArgs.includes('--json')) {
73
- console.log(JSON.stringify(findings, null, 2));
82
+ if (isReport) {
83
+ const rep = generateAuditReport(auditData, targetDir);
84
+ console.log(`\n${c.emerald}✔ Anti-Slop Mode 2 Report Generated:${c.reset} ${c.bold}${rep.reportPath}${c.reset}`);
85
+ }
86
+
87
+ if (isJson) {
88
+ console.log(JSON.stringify(auditData, null, 2));
74
89
  } else {
75
- printAuditReport(findings, targetDir);
90
+ if (isAllPages) {
91
+ console.log(`\n${c.bold}Discovered ${auditData.totalPages} Pages & Component Entrypoints:${c.reset}`);
92
+ console.log(`--------------------------------------------------------------------------------`);
93
+ for (const pr of auditData.pageResults) {
94
+ const statusIcon = pr.status === 'PASS' ? `${c.green}✔ PASS${c.reset}` : `${c.coral}✖ FAIL${c.reset}`;
95
+ console.log(` ${statusIcon} [${c.bold}${String(pr.score).padStart(3)}/100${c.reset}] \`${pr.page.relPath}\` (${pr.page.type}) — ${pr.counts.high} High, ${pr.counts.medium} Med, ${pr.counts.low} Low`);
96
+ }
97
+ console.log(`--------------------------------------------------------------------------------`);
98
+ }
99
+ const allFindings = [];
100
+ for (const pr of auditData.pageResults) allFindings.push(...pr.findings);
101
+ printAuditReport(allFindings, targetDir, auditData);
76
102
  }
77
103
  return;
78
104
  }