chorus-codes 0.8.41 → 0.8.43
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +1 -1
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/connect/page_client-reference-manifest.js +1 -1
- package/.next/server/app/demo/[scenario]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/new/page_client-reference-manifest.js +1 -1
- package/.next/server/app/new.html +1 -1
- package/.next/server/app/new.rsc +1 -1
- package/.next/server/app/new.segments/_full.segment.rsc +1 -1
- package/.next/server/app/new.segments/_head.segment.rsc +1 -1
- package/.next/server/app/new.segments/_index.segment.rsc +1 -1
- package/.next/server/app/new.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/new.segments/new/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/new.segments/new.segment.rsc +1 -1
- package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
- package/.next/server/app/onboarding.html +1 -1
- package/.next/server/app/onboarding.rsc +1 -1
- package/.next/server/app/onboarding.segments/_full.segment.rsc +1 -1
- package/.next/server/app/onboarding.segments/_head.segment.rsc +1 -1
- package/.next/server/app/onboarding.segments/_index.segment.rsc +1 -1
- package/.next/server/app/onboarding.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/onboarding.segments/onboarding.segment.rsc +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/personas/page_client-reference-manifest.js +1 -1
- package/.next/server/app/personas.html +1 -1
- package/.next/server/app/personas.rsc +1 -1
- package/.next/server/app/personas.segments/_full.segment.rsc +1 -1
- package/.next/server/app/personas.segments/_head.segment.rsc +1 -1
- package/.next/server/app/personas.segments/_index.segment.rsc +1 -1
- package/.next/server/app/personas.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/personas.segments/personas/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/personas.segments/personas.segment.rsc +1 -1
- package/.next/server/app/runs/[runId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/runs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/permissions/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings.html +1 -1
- package/.next/server/app/settings.rsc +1 -1
- package/.next/server/app/settings.segments/_full.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_index.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/settings.segments/settings.segment.rsc +1 -1
- package/.next/server/app/templates/page_client-reference-manifest.js +1 -1
- package/.next/server/app/templates.html +1 -1
- package/.next/server/app/templates.rsc +1 -1
- package/.next/server/app/templates.segments/_full.segment.rsc +1 -1
- package/.next/server/app/templates.segments/_head.segment.rsc +1 -1
- package/.next/server/app/templates.segments/_index.segment.rsc +1 -1
- package/.next/server/app/templates.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/templates.segments/templates/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/templates.segments/templates.segment.rsc +1 -1
- package/.next/server/app-paths-manifest.json +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/trace +20 -20
- package/.next/trace-build +1 -1
- package/dist/cli/commands/audit.js +201 -0
- package/dist/cli/commands/audit.js.map +1 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/lib/audit-pack.js +408 -0
- package/dist/lib/audit-pack.js.map +1 -0
- package/package.json +1 -1
- /package/.next/static/{hNDhJ2gNUy75Ma2IxRu3j → 4hHxZHWTDLJU0ZZPkLRz-}/_buildManifest.js +0 -0
- /package/.next/static/{hNDhJ2gNUy75Ma2IxRu3j → 4hHxZHWTDLJU0ZZPkLRz-}/_ssgManifest.js +0 -0
package/.next/trace-build
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"name":"run-webpack","duration":
|
|
1
|
+
[{"name":"run-webpack","duration":10832690,"timestamp":7806834919587,"id":14,"parentId":1,"tags":{},"startTime":1779198205346,"traceId":"f204945893d550b9"},{"name":"run-typescript","duration":5891330,"timestamp":7806845755201,"id":2118,"parentId":1,"tags":{},"startTime":1779198216181,"traceId":"f204945893d550b9"},{"name":"static-check","duration":420785,"timestamp":7806851694323,"id":2121,"parentId":1,"tags":{},"startTime":1779198222120,"traceId":"f204945893d550b9"},{"name":"static-generation","duration":1348831,"timestamp":7806852286026,"id":2161,"parentId":1,"tags":{},"startTime":1779198222712,"traceId":"f204945893d550b9"},{"name":"collect-build-traces","duration":6088026,"timestamp":7806852115523,"id":2158,"parentId":1,"tags":{},"startTime":1779198222542,"traceId":"f204945893d550b9"},{"name":"telemetry-flush","duration":30,"timestamp":7806858205164,"id":2170,"parentId":1,"tags":{},"startTime":1779198228631,"traceId":"f204945893d550b9"},{"name":"next-build","duration":23369493,"timestamp":7806834835710,"id":1,"tags":{"buildMode":"default","version":"16.2.4","bundler":"webpack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1779198205262,"traceId":"f204945893d550b9"}]
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports._testing = void 0;
|
|
37
|
+
exports.registerAuditCommand = registerAuditCommand;
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const daemon_discovery_js_1 = require("../../lib/daemon-discovery.js");
|
|
40
|
+
const audit_pack_js_1 = require("../../lib/audit-pack.js");
|
|
41
|
+
const ui_js_1 = require("../ui.js");
|
|
42
|
+
const DEFAULT_TEMPLATE = 'review-only';
|
|
43
|
+
const VALID_FOCUS = new Set(['security', 'correctness', 'performance', 'maintainability', 'all']);
|
|
44
|
+
/**
|
|
45
|
+
* Daemon HTTP timeout. Audit POSTs to /chats with the assembled
|
|
46
|
+
* artifact — if the daemon stalls (libsql lock, OOM, etc.) the CLI
|
|
47
|
+
* should fail fast with a clear message rather than hang. 30s matches
|
|
48
|
+
* the project's "every external call has a timeout" rule.
|
|
49
|
+
*/
|
|
50
|
+
const DAEMON_FETCH_TIMEOUT_MS = 30_000;
|
|
51
|
+
async function runAudit(targetPath, opts) {
|
|
52
|
+
console.log('');
|
|
53
|
+
console.log(` ${ui_js_1.sym.rocket} ${ui_js_1.c.bold('chorus audit')} ${ui_js_1.c.dim('— multi-LLM review of existing code')}`);
|
|
54
|
+
console.log('');
|
|
55
|
+
// 1. Daemon up?
|
|
56
|
+
const info = (0, daemon_discovery_js_1.readDaemonInfo)();
|
|
57
|
+
if (!info) {
|
|
58
|
+
console.log(` ${ui_js_1.c.red('✗')} daemon not running`);
|
|
59
|
+
console.log(` run ${ui_js_1.c.bold('chorus start')} first, then re-run audit`);
|
|
60
|
+
process.exitCode = 1;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const healthy = await (0, daemon_discovery_js_1.isDaemonHealthy)(info.daemonPort, 1500);
|
|
64
|
+
if (!healthy) {
|
|
65
|
+
console.log(` ${ui_js_1.c.red('✗')} daemon not responding on :${info.daemonPort}`);
|
|
66
|
+
console.log(` run ${ui_js_1.c.bold('chorus stop && chorus start')} to recycle`);
|
|
67
|
+
process.exitCode = 1;
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const baseUrl = opts.daemonUrl ?? `http://127.0.0.1:${info.daemonPort}`;
|
|
71
|
+
// 2. Validate --focus before doing any filesystem work. A bad
|
|
72
|
+
// --focus value should fail in milliseconds, not after a slow walk.
|
|
73
|
+
const focus = opts.focus ?? 'all';
|
|
74
|
+
if (!VALID_FOCUS.has(focus)) {
|
|
75
|
+
console.log(` ${ui_js_1.c.red('✗')} --focus must be one of: ${[...VALID_FOCUS].join(', ')}`);
|
|
76
|
+
process.exitCode = 1;
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
// 3. Resolve + validate path.
|
|
80
|
+
const rootAbs = path.resolve(process.cwd(), targetPath);
|
|
81
|
+
let files;
|
|
82
|
+
try {
|
|
83
|
+
files = (0, audit_pack_js_1.walkAuditPath)(rootAbs);
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
if (err instanceof audit_pack_js_1.AuditPackError) {
|
|
87
|
+
console.log(` ${ui_js_1.c.red('✗')} ${err.message}`);
|
|
88
|
+
}
|
|
89
|
+
else if (err instanceof Error && 'code' in err && err.code === 'ENOENT') {
|
|
90
|
+
console.log(` ${ui_js_1.c.red('✗')} path not found: ${rootAbs}`);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
console.log(` ${ui_js_1.c.red('✗')} ${err instanceof Error ? err.message : String(err)}`);
|
|
94
|
+
}
|
|
95
|
+
process.exitCode = 1;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
// 4. Assemble the artifact.
|
|
99
|
+
const scope = opts.scope ?? path.basename(rootAbs);
|
|
100
|
+
const focusPara = (0, audit_pack_js_1.focusParagraph)(focus);
|
|
101
|
+
let pack;
|
|
102
|
+
try {
|
|
103
|
+
pack = (0, audit_pack_js_1.assembleAuditArtifact)(rootAbs, files, { scope, focusParagraph: focusPara });
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
if (err instanceof audit_pack_js_1.AuditPackError) {
|
|
107
|
+
console.log(` ${ui_js_1.c.red('✗')} ${err.message}`);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
console.log(` ${ui_js_1.c.red('✗')} ${err instanceof Error ? err.message : String(err)}`);
|
|
111
|
+
}
|
|
112
|
+
process.exitCode = 1;
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
console.log(` ${ui_js_1.c.green('✓')} packed ${ui_js_1.c.bold(String(pack.filesIncluded.length))} file${pack.filesIncluded.length === 1 ? '' : 's'} ${ui_js_1.c.gray(`(${pack.totalBytes} bytes)`)}`);
|
|
116
|
+
if (pack.filesSkipped.length > 0) {
|
|
117
|
+
console.log(` ${ui_js_1.c.gray('·')} skipped ${pack.filesSkipped.length} (extension / read failure)`);
|
|
118
|
+
}
|
|
119
|
+
// 5. Resolve template — must be review-only kind so audit framing
|
|
120
|
+
// composes. Daemon will reject artifact on full-pipeline templates
|
|
121
|
+
// anyway; this is a friendlier upfront message.
|
|
122
|
+
const templateId = opts.template ?? DEFAULT_TEMPLATE;
|
|
123
|
+
console.log(` ${ui_js_1.c.gray('·')} template: ${ui_js_1.c.bold(templateId)}`);
|
|
124
|
+
// 6. Build the audit-framed work brief.
|
|
125
|
+
const work = (0, audit_pack_js_1.buildAuditWork)(scope, focusPara);
|
|
126
|
+
// 7. Fire the chat. AbortSignal.timeout closes the connection if the
|
|
127
|
+
// daemon hangs — failing fast beats blocking the terminal forever.
|
|
128
|
+
let chatRes;
|
|
129
|
+
try {
|
|
130
|
+
chatRes = await fetch(`${baseUrl}/chats`, {
|
|
131
|
+
method: 'POST',
|
|
132
|
+
headers: { 'Content-Type': 'application/json' },
|
|
133
|
+
body: JSON.stringify({
|
|
134
|
+
work,
|
|
135
|
+
templateId,
|
|
136
|
+
artifact: pack.artifact,
|
|
137
|
+
}),
|
|
138
|
+
signal: AbortSignal.timeout(DAEMON_FETCH_TIMEOUT_MS),
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
143
|
+
const timedOut = err instanceof Error && (err.name === 'TimeoutError' || err.name === 'AbortError');
|
|
144
|
+
if (timedOut) {
|
|
145
|
+
console.log(` ${ui_js_1.c.red('✗')} chat create timed out after ${DAEMON_FETCH_TIMEOUT_MS}ms (daemon hung?)`);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
console.log(` ${ui_js_1.c.red('✗')} chat create failed: ${msg}`);
|
|
149
|
+
}
|
|
150
|
+
process.exitCode = 1;
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (!chatRes.ok) {
|
|
154
|
+
const text = await chatRes.text().catch(() => '');
|
|
155
|
+
console.log(` ${ui_js_1.c.red('✗')} chat create failed: ${chatRes.status} ${text.slice(0, 400)}`);
|
|
156
|
+
if (chatRes.status === 400 && text.includes('review-only')) {
|
|
157
|
+
console.log('');
|
|
158
|
+
console.log(` ${ui_js_1.c.gray('hint: --template must point at a review_only template')}`);
|
|
159
|
+
console.log(` ${ui_js_1.c.gray('the default ')}${ui_js_1.c.bold(DEFAULT_TEMPLATE)}${ui_js_1.c.gray(' is review_only; full-pipeline templates with a doer slot are not audit-compatible')}`);
|
|
160
|
+
}
|
|
161
|
+
process.exitCode = 1;
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const chatEnv = (await chatRes.json());
|
|
165
|
+
const chatId = chatEnv.data?.id;
|
|
166
|
+
if (!chatId) {
|
|
167
|
+
console.log(` ${ui_js_1.c.red('✗')} chat create returned no id`);
|
|
168
|
+
process.exitCode = 1;
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const cockpitUrl = `http://127.0.0.1:${info.cockpitPort}`;
|
|
172
|
+
console.log('');
|
|
173
|
+
console.log(` ${ui_js_1.c.green('✓')} audit fired ${ui_js_1.c.gray('(id: ' + chatId + ')')}`);
|
|
174
|
+
console.log(` watch live: ${ui_js_1.c.cyan(`${cockpitUrl}/runs/${chatId}`)}`);
|
|
175
|
+
console.log('');
|
|
176
|
+
console.log(` ${ui_js_1.c.gray('reviewers run in the background — close this terminal and check the cockpit later')}`);
|
|
177
|
+
console.log('');
|
|
178
|
+
}
|
|
179
|
+
function registerAuditCommand(program) {
|
|
180
|
+
program
|
|
181
|
+
.command('audit')
|
|
182
|
+
.description('Multi-LLM review of existing production code. Reads <path>, packs source files, fires a review-only chat.')
|
|
183
|
+
.argument('<path>', 'file or directory to audit')
|
|
184
|
+
.option('--scope <name>', 'human label for the audit scope (defaults to path basename)')
|
|
185
|
+
.option('--focus <area>', 'audit focus: security | correctness | performance | maintainability | all', 'all')
|
|
186
|
+
.option('--template <id>', 'override the review-only template used for the fleet', DEFAULT_TEMPLATE)
|
|
187
|
+
.action(async (targetPath, options) => {
|
|
188
|
+
try {
|
|
189
|
+
await runAudit(targetPath, options);
|
|
190
|
+
}
|
|
191
|
+
catch (err) {
|
|
192
|
+
console.error('audit failed:', err instanceof Error ? err.message : err);
|
|
193
|
+
process.exit(1);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
exports._testing = {
|
|
198
|
+
DEFAULT_TEMPLATE,
|
|
199
|
+
VALID_FOCUS,
|
|
200
|
+
};
|
|
201
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../src/cli/commands/audit.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC,gBAAgB,EAAE,6DAA6D,CAAC;SACvF,MAAM,CACL,gBAAgB,EAChB,2EAA2E,EAC3E,KAAK,CACN;SACA,MAAM,CAAC,iBAAiB,EAAE,sDAAsD,EAAE,gBAAgB,CAAC;SACnG,MAAM,CAAC,KAAK,EAAE,UAAkB,EAAE,OAAqB,EAAE,EAAE;QAC1D,IAAI,CAAC;YACH,MAAM,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACtC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACzE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AAEY,QAAA,QAAQ,GAAG;IACtB,gBAAgB;IAChB,WAAW;CACZ,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -9,6 +9,7 @@ const open_browser_js_1 = require("./open-browser.js");
|
|
|
9
9
|
const os_1 = __importDefault(require("os"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const daemon_discovery_js_1 = require("../lib/daemon-discovery.js");
|
|
12
|
+
const audit_js_1 = require("./commands/audit.js");
|
|
12
13
|
const diagnose_js_1 = require("./commands/diagnose.js");
|
|
13
14
|
const doctor_js_1 = require("./commands/doctor.js");
|
|
14
15
|
const init_js_1 = require("./commands/init.js");
|
|
@@ -65,6 +66,7 @@ program.addHelpText('beforeAll', () => {
|
|
|
65
66
|
(0, diagnose_js_1.registerDiagnoseCommand)(program);
|
|
66
67
|
(0, update_js_1.registerUpdateCommand)(program);
|
|
67
68
|
(0, quickstart_js_1.registerQuickstartCommand)(program);
|
|
69
|
+
(0, audit_js_1.registerAuditCommand)(program);
|
|
68
70
|
program
|
|
69
71
|
.command('ui')
|
|
70
72
|
.description('Open the Chorus web UI in default browser')
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;AAAA,yCAAoC;AACpC,4CAAoB;AACpB,uDAAgD;AAChD,4CAAoB;AACpB,gDAAwB;AACxB,oEAA+D;AAC/D,wDAAiE;AACjE,oDAA6D;AAC7D,gDAAyD;AACzD,4DAAqE;AACrE,kDAA2D;AAC3D,oDAA6D;AAC7D,gDAAyD;AACzD,oDAA6D;AAC7D,qDAA2E;AAC3E,2CAAkC;AAClC,mCAAsC;AAEtC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,0DAA0D,CAAC;KACvE,OAAO,CAAC,eAAG,CAAC,OAAO,CAAC,CAAC;AAExB,mEAAmE;AACnE,oEAAoE;AACpE,uEAAuE;AACvE,mEAAmE;AACnE,WAAW;AACX,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,GAAG,EAAE;IACpC,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACjD,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,YAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,YAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAEzC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO;YACL,EAAE;YACF,KAAK,WAAG,CAAC,MAAM,IAAI,SAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,SAAC,CA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BAAiB,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,OAAO,CAAC,UAAU,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AuditPackError = exports.AUDIT_MAX_FILE_LINES = exports.AUDIT_MAX_TOTAL_BYTES = exports.AUDIT_MAX_FILES = void 0;
|
|
37
|
+
exports.walkAuditPath = walkAuditPath;
|
|
38
|
+
exports.assembleAuditArtifact = assembleAuditArtifact;
|
|
39
|
+
exports.focusParagraph = focusParagraph;
|
|
40
|
+
exports.buildAuditWork = buildAuditWork;
|
|
41
|
+
/**
|
|
42
|
+
* Audit-pack assembly.
|
|
43
|
+
*
|
|
44
|
+
* Pure helpers for `chorus audit <path>`. Walk a path, read files,
|
|
45
|
+
* concatenate into a single artifact string the existing review-only
|
|
46
|
+
* substrate can consume.
|
|
47
|
+
*
|
|
48
|
+
* No HTTP, no daemon, no subprocess — only fs reads from a user-supplied
|
|
49
|
+
* path with the same defence-in-depth checks used by `packAttachedFiles`
|
|
50
|
+
* (no symlinks, no traversal, regular files only).
|
|
51
|
+
*
|
|
52
|
+
* Caps are intentionally aggressive. Audit's job is to narrow scope
|
|
53
|
+
* enough that a 5-reviewer fleet can produce useful findings on a
|
|
54
|
+
* single subsystem — not to scan a whole repo. Refuse early with a
|
|
55
|
+
* clear "narrow scope further" message when limits are exceeded.
|
|
56
|
+
*/
|
|
57
|
+
const fs = __importStar(require("fs"));
|
|
58
|
+
const path = __importStar(require("path"));
|
|
59
|
+
/** Max number of files surveyed in one audit. */
|
|
60
|
+
exports.AUDIT_MAX_FILES = 50;
|
|
61
|
+
/** Max total bytes (across all files) emitted into the artifact. */
|
|
62
|
+
exports.AUDIT_MAX_TOTAL_BYTES = 200 * 1024;
|
|
63
|
+
/** Max lines retained per file before head+tail truncation kicks in. */
|
|
64
|
+
exports.AUDIT_MAX_FILE_LINES = 2000;
|
|
65
|
+
/** Lines retained from the head when a file is truncated. */
|
|
66
|
+
const TRUNCATION_HEAD_LINES = 1500;
|
|
67
|
+
/** Lines retained from the tail when a file is truncated. */
|
|
68
|
+
const TRUNCATION_TAIL_LINES = 500;
|
|
69
|
+
/**
|
|
70
|
+
* Extensions audit will read. Everything else is skipped silently and
|
|
71
|
+
* surfaced in the trailing "skipped" section. Lockfiles and binary
|
|
72
|
+
* formats are never useful in an audit artifact.
|
|
73
|
+
*/
|
|
74
|
+
/**
|
|
75
|
+
* Filename-based exclusions that run after the extension check.
|
|
76
|
+
* Lockfiles pass the .json / .yaml / .yml extension filter but are
|
|
77
|
+
* spec-banned ("Lockfiles and binary formats are never useful in an
|
|
78
|
+
* audit artifact" — planning/audit-mode.md). Convergent self-review
|
|
79
|
+
* (3/8 reviewers on PR #58) caught the divergence between spec and
|
|
80
|
+
* implementation. Match case-insensitively for cross-platform safety.
|
|
81
|
+
*/
|
|
82
|
+
const LOCKFILE_NAMES = new Set([
|
|
83
|
+
'package-lock.json',
|
|
84
|
+
'yarn.lock',
|
|
85
|
+
'pnpm-lock.yaml',
|
|
86
|
+
'cargo.lock',
|
|
87
|
+
'composer.lock',
|
|
88
|
+
'gemfile.lock',
|
|
89
|
+
'poetry.lock',
|
|
90
|
+
'go.sum',
|
|
91
|
+
]);
|
|
92
|
+
const ALLOWED_EXTENSIONS = new Set([
|
|
93
|
+
'.ts',
|
|
94
|
+
'.tsx',
|
|
95
|
+
'.js',
|
|
96
|
+
'.jsx',
|
|
97
|
+
'.mjs',
|
|
98
|
+
'.cjs',
|
|
99
|
+
'.py',
|
|
100
|
+
'.go',
|
|
101
|
+
'.rs',
|
|
102
|
+
'.java',
|
|
103
|
+
'.kt',
|
|
104
|
+
'.swift',
|
|
105
|
+
'.rb',
|
|
106
|
+
'.php',
|
|
107
|
+
'.c',
|
|
108
|
+
'.cpp',
|
|
109
|
+
'.h',
|
|
110
|
+
'.hpp',
|
|
111
|
+
'.cs',
|
|
112
|
+
'.sql',
|
|
113
|
+
'.sh',
|
|
114
|
+
'.bash',
|
|
115
|
+
'.yaml',
|
|
116
|
+
'.yml',
|
|
117
|
+
'.toml',
|
|
118
|
+
'.json',
|
|
119
|
+
'.md',
|
|
120
|
+
]);
|
|
121
|
+
/**
|
|
122
|
+
* Directories pruned at walk time. Keeps node_modules and build output
|
|
123
|
+
* out of the artifact even when the user points audit at a project
|
|
124
|
+
* root.
|
|
125
|
+
*/
|
|
126
|
+
const PRUNE_DIRS = new Set([
|
|
127
|
+
'node_modules',
|
|
128
|
+
'.git',
|
|
129
|
+
'dist',
|
|
130
|
+
'build',
|
|
131
|
+
'.next',
|
|
132
|
+
'__pycache__',
|
|
133
|
+
'.venv',
|
|
134
|
+
'venv',
|
|
135
|
+
'target',
|
|
136
|
+
'vendor',
|
|
137
|
+
'.turbo',
|
|
138
|
+
'coverage',
|
|
139
|
+
'.cache',
|
|
140
|
+
]);
|
|
141
|
+
/** Pure-error class for distinguishable failure modes in tests + callers. */
|
|
142
|
+
class AuditPackError extends Error {
|
|
143
|
+
code;
|
|
144
|
+
constructor(code, message) {
|
|
145
|
+
super(message);
|
|
146
|
+
this.code = code;
|
|
147
|
+
this.name = 'AuditPackError';
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.AuditPackError = AuditPackError;
|
|
151
|
+
/**
|
|
152
|
+
* Walk a path and return absolute file paths under it. Resolves a single
|
|
153
|
+
* file to a one-element list; a directory is recursively walked with
|
|
154
|
+
* PRUNE_DIRS removed. Symlinks are rejected. Never crosses out of the
|
|
155
|
+
* input root.
|
|
156
|
+
*/
|
|
157
|
+
function walkAuditPath(rootAbs) {
|
|
158
|
+
const stat = fs.lstatSync(rootAbs);
|
|
159
|
+
if (stat.isSymbolicLink()) {
|
|
160
|
+
throw new AuditPackError('symlink_root', `audit path is a symlink — refusing to follow: ${rootAbs}`);
|
|
161
|
+
}
|
|
162
|
+
if (stat.isFile())
|
|
163
|
+
return [rootAbs];
|
|
164
|
+
if (!stat.isDirectory()) {
|
|
165
|
+
throw new AuditPackError('not_a_file_or_dir', `audit path is not a file or directory: ${rootAbs}`);
|
|
166
|
+
}
|
|
167
|
+
const out = [];
|
|
168
|
+
const stack = [rootAbs];
|
|
169
|
+
while (stack.length > 0) {
|
|
170
|
+
const dir = stack.pop();
|
|
171
|
+
let entries;
|
|
172
|
+
try {
|
|
173
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
for (const entry of entries) {
|
|
179
|
+
const full = path.join(dir, entry.name);
|
|
180
|
+
if (entry.isSymbolicLink())
|
|
181
|
+
continue;
|
|
182
|
+
if (entry.isDirectory()) {
|
|
183
|
+
// PRUNE_DIRS match is case-insensitive — Windows / macOS have
|
|
184
|
+
// case-insensitive filesystems and a folder named `Node_modules`
|
|
185
|
+
// should still get pruned. readdirSync never returns `.` or `..`
|
|
186
|
+
// as Dirent.name, so no `!== '.'` guard is needed.
|
|
187
|
+
if (PRUNE_DIRS.has(entry.name.toLowerCase()))
|
|
188
|
+
continue;
|
|
189
|
+
if (entry.name.startsWith('.'))
|
|
190
|
+
continue;
|
|
191
|
+
stack.push(full);
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
if (entry.isFile()) {
|
|
195
|
+
if (entry.name.startsWith('.'))
|
|
196
|
+
continue;
|
|
197
|
+
if (LOCKFILE_NAMES.has(entry.name.toLowerCase()))
|
|
198
|
+
continue;
|
|
199
|
+
out.push(full);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
out.sort();
|
|
204
|
+
return out;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Read a file safely (O_NOFOLLOW on POSIX, lstat-then-read on Windows).
|
|
208
|
+
* Returns null on any failure or skip condition — callers decide whether
|
|
209
|
+
* to surface that as a skipped file or hard error.
|
|
210
|
+
*
|
|
211
|
+
* TOCTOU note: the read goes through the same fd we opened with
|
|
212
|
+
* O_NOFOLLOW, not the path string. A prior revision opened a fd, ran
|
|
213
|
+
* fstat, then re-read via readFileSync(path) — convergent self-review
|
|
214
|
+
* (5/8 reviewers on PR #58) flagged that a symlink swap between the
|
|
215
|
+
* stat and the re-read would defeat the O_NOFOLLOW guard. Reading from
|
|
216
|
+
* the fd closes the window.
|
|
217
|
+
*/
|
|
218
|
+
function readFileSafe(abs) {
|
|
219
|
+
try {
|
|
220
|
+
if (process.platform !== 'win32') {
|
|
221
|
+
let fd = -1;
|
|
222
|
+
try {
|
|
223
|
+
fd = fs.openSync(abs, fs.constants.O_RDONLY | fs.constants.O_NOFOLLOW);
|
|
224
|
+
const stat = fs.fstatSync(fd);
|
|
225
|
+
if (!stat.isFile())
|
|
226
|
+
return null;
|
|
227
|
+
return fs.readFileSync(fd, 'utf-8');
|
|
228
|
+
}
|
|
229
|
+
finally {
|
|
230
|
+
if (fd >= 0)
|
|
231
|
+
fs.closeSync(fd);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
// Windows fallback: lstat-then-read. The race window here is wider
|
|
236
|
+
// (no atomic O_NOFOLLOW equivalent) but Windows isn't the primary
|
|
237
|
+
// target for chorus audits. Documented as best-effort.
|
|
238
|
+
const lstat = fs.lstatSync(abs);
|
|
239
|
+
if (lstat.isSymbolicLink() || !lstat.isFile())
|
|
240
|
+
return null;
|
|
241
|
+
return fs.readFileSync(abs, 'utf-8');
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/** Truncate a file's content head+tail with an elision marker. */
|
|
249
|
+
function truncateFileBody(body) {
|
|
250
|
+
const lines = body.split('\n');
|
|
251
|
+
if (lines.length <= exports.AUDIT_MAX_FILE_LINES) {
|
|
252
|
+
return { body, truncated: false, originalLines: lines.length };
|
|
253
|
+
}
|
|
254
|
+
const head = lines.slice(0, TRUNCATION_HEAD_LINES).join('\n');
|
|
255
|
+
const tail = lines.slice(lines.length - TRUNCATION_TAIL_LINES).join('\n');
|
|
256
|
+
const elided = lines.length - TRUNCATION_HEAD_LINES - TRUNCATION_TAIL_LINES;
|
|
257
|
+
return {
|
|
258
|
+
body: `${head}\n\n... [${elided} lines elided] ...\n\n${tail}`,
|
|
259
|
+
truncated: true,
|
|
260
|
+
originalLines: lines.length,
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
/** Strip leading dot from extension; empty extension returns ''. */
|
|
264
|
+
function extLangHint(ext) {
|
|
265
|
+
return ext.startsWith('.') ? ext.slice(1) : ext;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Build the audit artifact from a list of absolute file paths under a
|
|
269
|
+
* root. Files outside `rootAbs` are rejected. Enforces all caps and
|
|
270
|
+
* surfaces both included and skipped files in the result.
|
|
271
|
+
*/
|
|
272
|
+
function assembleAuditArtifact(rootAbs, files, opts) {
|
|
273
|
+
if (files.length === 0) {
|
|
274
|
+
throw new AuditPackError('no_files_matched', `no files matched under ${rootAbs} — check the path or extension allowlist`);
|
|
275
|
+
}
|
|
276
|
+
// Filter by extension allowlist + lockfile blocklist; keep the
|
|
277
|
+
// rejected ones for surfacing. Also enforces root-containment:
|
|
278
|
+
// every file must live under `rootAbs` (closing the docstring
|
|
279
|
+
// promise that a prior revision left unimplemented — 4/8 reviewers
|
|
280
|
+
// on PR #58 flagged this as a path-traversal hole when callers
|
|
281
|
+
// bypass walkAuditPath).
|
|
282
|
+
const eligible = [];
|
|
283
|
+
const skipped = [];
|
|
284
|
+
for (const abs of files) {
|
|
285
|
+
if (!abs.startsWith(rootAbs + path.sep) && abs !== rootAbs) {
|
|
286
|
+
throw new AuditPackError('outside_root', `file is outside the audit root (rootAbs=${rootAbs}, file=${abs})`);
|
|
287
|
+
}
|
|
288
|
+
const base = path.basename(abs).toLowerCase();
|
|
289
|
+
if (LOCKFILE_NAMES.has(base)) {
|
|
290
|
+
skipped.push(abs);
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
if (ALLOWED_EXTENSIONS.has(path.extname(abs).toLowerCase())) {
|
|
294
|
+
eligible.push(abs);
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
skipped.push(abs);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (eligible.length === 0) {
|
|
301
|
+
throw new AuditPackError('no_files_matched', `no files matched the extension allowlist under ${rootAbs} — audit reads source code only`);
|
|
302
|
+
}
|
|
303
|
+
if (eligible.length > exports.AUDIT_MAX_FILES) {
|
|
304
|
+
throw new AuditPackError('too_many_files', `audit matched ${eligible.length} files; cap is ${exports.AUDIT_MAX_FILES}. Narrow the scope (point at a subdirectory or specific file).`);
|
|
305
|
+
}
|
|
306
|
+
// Read + truncate. Build content blocks and tally bytes.
|
|
307
|
+
const blocks = [];
|
|
308
|
+
const includedRel = [];
|
|
309
|
+
const skippedRel = skipped.map((abs) => toDisplay(rootAbs, abs));
|
|
310
|
+
let totalBytes = 0;
|
|
311
|
+
for (const abs of eligible) {
|
|
312
|
+
const display = toDisplay(rootAbs, abs);
|
|
313
|
+
const body = readFileSafe(abs);
|
|
314
|
+
if (body === null) {
|
|
315
|
+
skippedRel.push(`${display} (read failed)`);
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
const { body: bodyOut, truncated, originalLines } = truncateFileBody(body);
|
|
319
|
+
// Build the full markdown block before measuring. Counting only the
|
|
320
|
+
// raw file body underestimated the artifact size by header + fence
|
|
321
|
+
// overhead (~80-120 bytes per file). Convergent self-review (3/8 on
|
|
322
|
+
// PR #58) flagged that AuditPackResult.totalBytes — documented as
|
|
323
|
+
// "bytes of file content emitted into the artifact" — must reflect
|
|
324
|
+
// what actually gets POSTed, not just the body, so the cap and the
|
|
325
|
+
// reported number stay apples-to-apples.
|
|
326
|
+
const ext = extLangHint(path.extname(display));
|
|
327
|
+
const header = truncated
|
|
328
|
+
? `## \`${display}\` (${originalLines} lines, truncated)`
|
|
329
|
+
: `## \`${display}\` (${originalLines} lines)`;
|
|
330
|
+
const block = `${header}\n\n\`\`\`${ext}\n${bodyOut}\n\`\`\``;
|
|
331
|
+
const bytes = Buffer.byteLength(block, 'utf-8');
|
|
332
|
+
if (totalBytes + bytes > exports.AUDIT_MAX_TOTAL_BYTES) {
|
|
333
|
+
const after = includedRel.length === 0
|
|
334
|
+
? 'before including any files'
|
|
335
|
+
: `after ${includedRel.length} file${includedRel.length === 1 ? '' : 's'}`;
|
|
336
|
+
throw new AuditPackError('too_many_bytes', `audit content would exceed ${exports.AUDIT_MAX_TOTAL_BYTES}-byte cap ${after}. Narrow the scope.`);
|
|
337
|
+
}
|
|
338
|
+
blocks.push(block);
|
|
339
|
+
totalBytes += bytes;
|
|
340
|
+
includedRel.push(display);
|
|
341
|
+
}
|
|
342
|
+
if (includedRel.length === 0) {
|
|
343
|
+
throw new AuditPackError('all_files_unreadable', `every candidate file under ${rootAbs} failed to read — check permissions or symlink layout`);
|
|
344
|
+
}
|
|
345
|
+
const heading = `# Audit: ${opts.scope}`;
|
|
346
|
+
const intro = opts.focusParagraph ? `\n${opts.focusParagraph.trim()}\n` : '';
|
|
347
|
+
const skipNote = skippedRel.length > 0
|
|
348
|
+
? `\n---\n\n**Skipped (${skippedRel.length} file${skippedRel.length === 1 ? '' : 's'} — extension not in allowlist or read failed):**\n${skippedRel.map((p) => `- \`${p}\``).join('\n')}\n`
|
|
349
|
+
: '';
|
|
350
|
+
const artifact = `${heading}\n${intro}\n---\n\n${blocks.join('\n\n')}\n${skipNote}`;
|
|
351
|
+
return {
|
|
352
|
+
artifact,
|
|
353
|
+
filesIncluded: includedRel,
|
|
354
|
+
filesSkipped: skippedRel,
|
|
355
|
+
totalBytes,
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
/** Display path: relative to root if under it, else basename. */
|
|
359
|
+
function toDisplay(rootAbs, fileAbs) {
|
|
360
|
+
const rel = path.relative(rootAbs, fileAbs);
|
|
361
|
+
if (!rel || rel.startsWith('..'))
|
|
362
|
+
return path.basename(fileAbs);
|
|
363
|
+
return rel;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Focus-paragraph map. Pure data so the CLI flag handler and tests
|
|
367
|
+
* stay aligned. `all` returns undefined — no paragraph injected.
|
|
368
|
+
*/
|
|
369
|
+
function focusParagraph(focus) {
|
|
370
|
+
switch (focus) {
|
|
371
|
+
case 'security':
|
|
372
|
+
return 'Focus on: authentication, authorization, input validation, secret handling, injection vectors, SSRF, race conditions, and any place the code trusts external input.';
|
|
373
|
+
case 'correctness':
|
|
374
|
+
return 'Focus on: off-by-one errors, null/undefined handling, race conditions, error swallowing, and edge cases the happy path obscures.';
|
|
375
|
+
case 'performance':
|
|
376
|
+
return 'Focus on: N+1 patterns, unnecessary work in hot paths, blocking I/O on event loops, and unbounded memory growth.';
|
|
377
|
+
case 'maintainability':
|
|
378
|
+
return 'Focus on: code that future maintainers will struggle with — unclear naming, hidden coupling, missing types, dead branches, and abstractions that do not pay rent.';
|
|
379
|
+
case 'all':
|
|
380
|
+
case '':
|
|
381
|
+
case undefined:
|
|
382
|
+
return undefined;
|
|
383
|
+
default:
|
|
384
|
+
// Unknown focus value — caller validates upstream; here we just
|
|
385
|
+
// pass it through as a free-form paragraph so power users can
|
|
386
|
+
// pipe arbitrary framing in if they want.
|
|
387
|
+
return focus;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Build the audit `work` brief — the framing reviewers see in their
|
|
392
|
+
* ask.md before the artifact. This is what turns review-only into
|
|
393
|
+
* audit-mode without any runner changes.
|
|
394
|
+
*/
|
|
395
|
+
function buildAuditWork(scope, focusPara) {
|
|
396
|
+
const lines = [];
|
|
397
|
+
lines.push(`You are auditing existing production code (scope: ${scope}).`);
|
|
398
|
+
lines.push('');
|
|
399
|
+
lines.push('This code already ships. Your job is to find real bugs, security risks, and correctness issues — not style nits. Be specific: file:line, what is wrong, what would fix it.');
|
|
400
|
+
if (focusPara) {
|
|
401
|
+
lines.push('');
|
|
402
|
+
lines.push(focusPara);
|
|
403
|
+
}
|
|
404
|
+
lines.push('');
|
|
405
|
+
lines.push('List your findings as a markdown list sorted high → low severity, then end your review with "approve" if you found nothing high-severity, or "request changes" if you did.');
|
|
406
|
+
return lines.join('\n');
|
|
407
|
+
}
|
|
408
|
+
//# sourceMappingURL=audit-pack.js.map
|