@sicilianwildcat/aiready 0.1.0
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/LICENSE +21 -0
- package/dist/cli.d.ts +5 -0
- package/dist/cli.js +488 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 harikrishn4a
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/cli.ts
|
|
22
|
+
var cli_exports = {};
|
|
23
|
+
__export(cli_exports, {
|
|
24
|
+
program: () => program
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(cli_exports);
|
|
27
|
+
var import_commander = require("commander");
|
|
28
|
+
|
|
29
|
+
// src/audit/index.ts
|
|
30
|
+
var import_path2 = require("path");
|
|
31
|
+
|
|
32
|
+
// src/audit/loader.ts
|
|
33
|
+
var import_path = require("path");
|
|
34
|
+
|
|
35
|
+
// src/utils/fs.ts
|
|
36
|
+
var import_fs = require("fs");
|
|
37
|
+
function readFile(filePath) {
|
|
38
|
+
try {
|
|
39
|
+
return (0, import_fs.readFileSync)(filePath, "utf8");
|
|
40
|
+
} catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function listDirs(dirPath) {
|
|
45
|
+
try {
|
|
46
|
+
return (0, import_fs.readdirSync)(dirPath, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
|
|
47
|
+
} catch {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function listFiles(dirPath) {
|
|
52
|
+
try {
|
|
53
|
+
return (0, import_fs.readdirSync)(dirPath, { withFileTypes: true }).filter((f) => f.isFile()).map((f) => f.name);
|
|
54
|
+
} catch {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function statMtime(filePath) {
|
|
59
|
+
try {
|
|
60
|
+
return (0, import_fs.statSync)(filePath).mtime;
|
|
61
|
+
} catch {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/audit/loader.ts
|
|
67
|
+
function loadRepo(targetDir) {
|
|
68
|
+
const read = (name) => readFile((0, import_path.join)(targetDir, name));
|
|
69
|
+
const packageJsonRaw = read("package.json");
|
|
70
|
+
let packageJson = null;
|
|
71
|
+
if (packageJsonRaw) {
|
|
72
|
+
try {
|
|
73
|
+
packageJson = JSON.parse(packageJsonRaw);
|
|
74
|
+
} catch {
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const agentsMd = read("AGENTS.md") ?? read("agents.md") ?? read(".agents.md");
|
|
78
|
+
const architectureMd = read("ARCHITECTURE.md") ?? read("architecture.md");
|
|
79
|
+
const constraintsMd = read("CONSTRAINTS.md") ?? read("constraints.md");
|
|
80
|
+
const progressMd = read("PROGRESS.md") ?? read("progress.md");
|
|
81
|
+
const sessionHandoffMd = read("SESSION-HANDOFF.md") ?? read("session-handoff.md");
|
|
82
|
+
const progressMdModifiedAt = statMtime((0, import_path.join)(targetDir, "PROGRESS.md")) ?? statMtime((0, import_path.join)(targetDir, "progress.md"));
|
|
83
|
+
return {
|
|
84
|
+
agentsMd,
|
|
85
|
+
architectureMd,
|
|
86
|
+
constraintsMd,
|
|
87
|
+
progressMd,
|
|
88
|
+
sessionHandoffMd,
|
|
89
|
+
packageJsonRaw,
|
|
90
|
+
packageJson,
|
|
91
|
+
srcDirs: listDirs((0, import_path.join)(targetDir, "src")),
|
|
92
|
+
rootFiles: listFiles(targetDir),
|
|
93
|
+
progressMdModifiedAt,
|
|
94
|
+
targetDir
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// src/audit/scorer.ts
|
|
99
|
+
function scoreIdentity(files) {
|
|
100
|
+
const gaps = [];
|
|
101
|
+
if (!files.agentsMd) {
|
|
102
|
+
return {
|
|
103
|
+
score: 0,
|
|
104
|
+
gaps: ["No AGENTS.md \u2014 agents have no entry point for this repository"]
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
let score = 20;
|
|
108
|
+
const wordCount = files.agentsMd.split(/\s+/).filter(Boolean).length;
|
|
109
|
+
if (wordCount >= 50) {
|
|
110
|
+
score += 20;
|
|
111
|
+
} else {
|
|
112
|
+
gaps.push(`AGENTS.md description too short (${wordCount} words, need 50+)`);
|
|
113
|
+
}
|
|
114
|
+
if (/^##\s+stack/im.test(files.agentsMd)) {
|
|
115
|
+
score += 20;
|
|
116
|
+
} else {
|
|
117
|
+
gaps.push("No ## Stack section in AGENTS.md");
|
|
118
|
+
}
|
|
119
|
+
const hasVersion = typeof files.packageJson?.["version"] === "string" || /v?\d+\.\d+\.\d+/.test(files.agentsMd);
|
|
120
|
+
if (hasVersion) {
|
|
121
|
+
score += 20;
|
|
122
|
+
} else {
|
|
123
|
+
gaps.push("No version number found in AGENTS.md or package.json");
|
|
124
|
+
}
|
|
125
|
+
if (/^##\s+repo\s+structure/im.test(files.agentsMd) || /src\//m.test(files.agentsMd)) {
|
|
126
|
+
score += 20;
|
|
127
|
+
} else {
|
|
128
|
+
gaps.push("No repo structure section in AGENTS.md");
|
|
129
|
+
}
|
|
130
|
+
return { score, gaps };
|
|
131
|
+
}
|
|
132
|
+
function scoreVerification(files) {
|
|
133
|
+
const gaps = [];
|
|
134
|
+
let score = 0;
|
|
135
|
+
const hasVerificationSection = files.agentsMd != null && (/^##\s+verification/im.test(files.agentsMd) || /```(?:bash|sh)/.test(files.agentsMd));
|
|
136
|
+
if (hasVerificationSection) {
|
|
137
|
+
score += 30;
|
|
138
|
+
} else {
|
|
139
|
+
gaps.push("No verification commands section in AGENTS.md");
|
|
140
|
+
}
|
|
141
|
+
const npmCommandMatches = files.agentsMd?.match(/npm\s+(?:run\s+\w+|test|install|ci)/g) ?? [];
|
|
142
|
+
if (npmCommandMatches.length >= 2) {
|
|
143
|
+
score += 20;
|
|
144
|
+
} else {
|
|
145
|
+
gaps.push("Fewer than 2 verification commands documented in AGENTS.md");
|
|
146
|
+
}
|
|
147
|
+
const scripts = files.packageJson?.["scripts"];
|
|
148
|
+
const scriptNames = scripts != null && typeof scripts === "object" ? Object.keys(scripts) : [];
|
|
149
|
+
if (scriptNames.length >= 2) {
|
|
150
|
+
score += 30;
|
|
151
|
+
} else {
|
|
152
|
+
gaps.push("package.json missing scripts (need at least 2)");
|
|
153
|
+
}
|
|
154
|
+
if (scriptNames.includes("build") && scriptNames.includes("test")) {
|
|
155
|
+
score += 20;
|
|
156
|
+
} else {
|
|
157
|
+
gaps.push("package.json missing build or test script");
|
|
158
|
+
}
|
|
159
|
+
return { score, gaps };
|
|
160
|
+
}
|
|
161
|
+
function scoreState(files) {
|
|
162
|
+
const gaps = [];
|
|
163
|
+
let score = 0;
|
|
164
|
+
if (files.progressMd) {
|
|
165
|
+
score += 30;
|
|
166
|
+
if (/^##\s+(?:completed|in\s+progress|current)/im.test(files.progressMd)) {
|
|
167
|
+
score += 20;
|
|
168
|
+
} else {
|
|
169
|
+
gaps.push("PROGRESS.md lacks structured sections (## Completed / ## In progress)");
|
|
170
|
+
}
|
|
171
|
+
} else {
|
|
172
|
+
gaps.push("No PROGRESS.md \u2014 agents cannot resume sessions without project state");
|
|
173
|
+
}
|
|
174
|
+
if (files.sessionHandoffMd) {
|
|
175
|
+
score += 30;
|
|
176
|
+
} else {
|
|
177
|
+
gaps.push("No SESSION-HANDOFF.md \u2014 agents start blind each session");
|
|
178
|
+
}
|
|
179
|
+
if (files.progressMdModifiedAt) {
|
|
180
|
+
const ageMs = Date.now() - files.progressMdModifiedAt.getTime();
|
|
181
|
+
const ageDays = ageMs / (1e3 * 60 * 60 * 24);
|
|
182
|
+
if (ageDays <= 7) {
|
|
183
|
+
score += 20;
|
|
184
|
+
} else {
|
|
185
|
+
gaps.push(`PROGRESS.md last updated ${Math.round(ageDays)} days ago (threshold: 7)`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return { score, gaps };
|
|
189
|
+
}
|
|
190
|
+
function scoreMemory(files) {
|
|
191
|
+
const gaps = [];
|
|
192
|
+
if (!files.architectureMd) {
|
|
193
|
+
return {
|
|
194
|
+
score: 0,
|
|
195
|
+
gaps: ["No ARCHITECTURE.md \u2014 agents cannot navigate the codebase without exploring"]
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
let score = 30;
|
|
199
|
+
const annotatedLines = (files.architectureMd.match(/←/g) ?? []).length;
|
|
200
|
+
if (annotatedLines >= 3) {
|
|
201
|
+
score += 30;
|
|
202
|
+
} else {
|
|
203
|
+
gaps.push("ARCHITECTURE.md has few module annotations (add \u2190 comments to explain modules)");
|
|
204
|
+
}
|
|
205
|
+
if (files.architectureMd.length > 300) {
|
|
206
|
+
score += 20;
|
|
207
|
+
} else {
|
|
208
|
+
gaps.push("ARCHITECTURE.md too short \u2014 add module responsibilities and data flow");
|
|
209
|
+
}
|
|
210
|
+
if (/src\//m.test(files.architectureMd)) {
|
|
211
|
+
score += 20;
|
|
212
|
+
} else {
|
|
213
|
+
gaps.push("ARCHITECTURE.md does not reference src/ directory structure");
|
|
214
|
+
}
|
|
215
|
+
return { score, gaps };
|
|
216
|
+
}
|
|
217
|
+
function scoreConstraints(files) {
|
|
218
|
+
const gaps = [];
|
|
219
|
+
let score = 0;
|
|
220
|
+
const hasSection = files.constraintsMd != null || /^##\s+constraints/im.test(files.agentsMd ?? "");
|
|
221
|
+
const constraintContent = files.constraintsMd ?? files.agentsMd ?? "";
|
|
222
|
+
if (hasSection) {
|
|
223
|
+
score += 30;
|
|
224
|
+
} else {
|
|
225
|
+
gaps.push("No CONSTRAINTS.md and no ## Constraints section in AGENTS.md");
|
|
226
|
+
}
|
|
227
|
+
if (/\bMUST\b/.test(constraintContent)) {
|
|
228
|
+
score += 40;
|
|
229
|
+
} else {
|
|
230
|
+
gaps.push("No MUST language in constraints \u2014 use imperative MUST / MUST NOT");
|
|
231
|
+
}
|
|
232
|
+
if (/\bMUST NOT\b/.test(constraintContent)) {
|
|
233
|
+
score += 30;
|
|
234
|
+
} else {
|
|
235
|
+
gaps.push("No MUST NOT language in constraints");
|
|
236
|
+
}
|
|
237
|
+
return { score, gaps };
|
|
238
|
+
}
|
|
239
|
+
function scoreRepo(files) {
|
|
240
|
+
const identity = scoreIdentity(files);
|
|
241
|
+
const verification = scoreVerification(files);
|
|
242
|
+
const state = scoreState(files);
|
|
243
|
+
const memory = scoreMemory(files);
|
|
244
|
+
const constraints = scoreConstraints(files);
|
|
245
|
+
const overall = Math.round(
|
|
246
|
+
(identity.score + verification.score + state.score + memory.score + constraints.score) / 5
|
|
247
|
+
);
|
|
248
|
+
return { identity, verification, state, memory, constraints, overall };
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// src/audit/cross-ref.ts
|
|
252
|
+
function extractNpmRunCommands(content) {
|
|
253
|
+
const commands = [];
|
|
254
|
+
const bashBlockRegex = /```(?:bash|sh|shell)\n([\s\S]*?)```/g;
|
|
255
|
+
let match;
|
|
256
|
+
while ((match = bashBlockRegex.exec(content)) !== null) {
|
|
257
|
+
const block = match[1] ?? "";
|
|
258
|
+
const runMatches = block.match(/npm\s+run\s+(\w[\w-]*)/g) ?? [];
|
|
259
|
+
for (const cmd of runMatches) {
|
|
260
|
+
const name = cmd.replace(/^npm\s+run\s+/, "");
|
|
261
|
+
commands.push(name);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return [...new Set(commands)];
|
|
265
|
+
}
|
|
266
|
+
function extractDocumentedModules(content) {
|
|
267
|
+
const moduleRegex = /^\s{2,}(\w[\w-]*)\/\s.*←/gm;
|
|
268
|
+
const modules = [];
|
|
269
|
+
let match;
|
|
270
|
+
while ((match = moduleRegex.exec(content)) !== null) {
|
|
271
|
+
modules.push(match[1]);
|
|
272
|
+
}
|
|
273
|
+
return [...new Set(modules)];
|
|
274
|
+
}
|
|
275
|
+
function checkCommands(files) {
|
|
276
|
+
if (!files.agentsMd) {
|
|
277
|
+
return [
|
|
278
|
+
{
|
|
279
|
+
name: "commands-in-agents-exist-in-package",
|
|
280
|
+
passed: false,
|
|
281
|
+
detail: "No AGENTS.md to extract commands from"
|
|
282
|
+
}
|
|
283
|
+
];
|
|
284
|
+
}
|
|
285
|
+
const commands = extractNpmRunCommands(files.agentsMd);
|
|
286
|
+
if (commands.length === 0) {
|
|
287
|
+
return [
|
|
288
|
+
{
|
|
289
|
+
name: "commands-in-agents-exist-in-package",
|
|
290
|
+
passed: true,
|
|
291
|
+
detail: "No npm run commands found in AGENTS.md bash blocks"
|
|
292
|
+
}
|
|
293
|
+
];
|
|
294
|
+
}
|
|
295
|
+
const scripts = files.packageJson?.["scripts"];
|
|
296
|
+
const scriptNames = scripts != null && typeof scripts === "object" ? Object.keys(scripts) : [];
|
|
297
|
+
const missing = commands.filter((cmd) => !scriptNames.includes(cmd));
|
|
298
|
+
if (missing.length === 0) {
|
|
299
|
+
return [
|
|
300
|
+
{
|
|
301
|
+
name: "commands-in-agents-exist-in-package",
|
|
302
|
+
passed: true,
|
|
303
|
+
detail: `All ${commands.length} npm run command(s) in AGENTS.md found in package.json scripts`
|
|
304
|
+
}
|
|
305
|
+
];
|
|
306
|
+
}
|
|
307
|
+
return missing.map((cmd) => ({
|
|
308
|
+
name: "commands-in-agents-exist-in-package",
|
|
309
|
+
passed: false,
|
|
310
|
+
detail: `\`npm run ${cmd}\` in AGENTS.md not found in package.json scripts`
|
|
311
|
+
}));
|
|
312
|
+
}
|
|
313
|
+
function checkModules(files) {
|
|
314
|
+
if (!files.architectureMd) {
|
|
315
|
+
return {
|
|
316
|
+
name: "architecture-modules-match-src",
|
|
317
|
+
passed: false,
|
|
318
|
+
detail: "No ARCHITECTURE.md to extract documented modules from"
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
const documented = extractDocumentedModules(files.architectureMd);
|
|
322
|
+
if (documented.length === 0) {
|
|
323
|
+
return {
|
|
324
|
+
name: "architecture-modules-match-src",
|
|
325
|
+
passed: true,
|
|
326
|
+
detail: "No annotated module directories found in ARCHITECTURE.md"
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
const missing = documented.filter((mod) => !files.srcDirs.includes(mod));
|
|
330
|
+
if (missing.length === 0) {
|
|
331
|
+
return {
|
|
332
|
+
name: "architecture-modules-match-src",
|
|
333
|
+
passed: true,
|
|
334
|
+
detail: `All ${documented.length} documented module(s) found in src/`
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
return {
|
|
338
|
+
name: "architecture-modules-match-src",
|
|
339
|
+
passed: false,
|
|
340
|
+
detail: `Module(s) in ARCHITECTURE.md not found in src/: ${missing.join(", ")}`
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
function checkProgressFreshness(files) {
|
|
344
|
+
if (!files.progressMdModifiedAt) {
|
|
345
|
+
return {
|
|
346
|
+
name: "progress-md-is-fresh",
|
|
347
|
+
passed: false,
|
|
348
|
+
detail: "No PROGRESS.md found"
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
const ageDays = (Date.now() - files.progressMdModifiedAt.getTime()) / (1e3 * 60 * 60 * 24);
|
|
352
|
+
if (ageDays <= 7) {
|
|
353
|
+
return {
|
|
354
|
+
name: "progress-md-is-fresh",
|
|
355
|
+
passed: true,
|
|
356
|
+
detail: `PROGRESS.md updated ${Math.round(ageDays)} day(s) ago`
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
return {
|
|
360
|
+
name: "progress-md-is-fresh",
|
|
361
|
+
passed: false,
|
|
362
|
+
detail: `PROGRESS.md last updated ${Math.round(ageDays)} days ago (threshold: 7)`
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
function crossRef(files) {
|
|
366
|
+
return {
|
|
367
|
+
checks: [
|
|
368
|
+
...checkCommands(files),
|
|
369
|
+
checkModules(files),
|
|
370
|
+
checkProgressFreshness(files)
|
|
371
|
+
]
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// src/audit/reporter.ts
|
|
376
|
+
function bar(score) {
|
|
377
|
+
const filled = Math.round(score / 10);
|
|
378
|
+
return "\u2588".repeat(filled) + "\u2591".repeat(10 - filled);
|
|
379
|
+
}
|
|
380
|
+
function subsystemLine(name, score, gaps) {
|
|
381
|
+
const scoreStr = String(score).padStart(3);
|
|
382
|
+
const summary = gaps.length > 0 ? gaps[0] : "All checks passed";
|
|
383
|
+
return `${name.padEnd(14)} ${bar(score)} ${scoreStr} ${summary}`;
|
|
384
|
+
}
|
|
385
|
+
function getRecommendation(scored) {
|
|
386
|
+
const subsystems = [
|
|
387
|
+
{ name: "identity", score: scored.identity.score },
|
|
388
|
+
{ name: "verification", score: scored.verification.score },
|
|
389
|
+
{ name: "state", score: scored.state.score },
|
|
390
|
+
{ name: "memory", score: scored.memory.score },
|
|
391
|
+
{ name: "constraints", score: scored.constraints.score }
|
|
392
|
+
];
|
|
393
|
+
const lowest = subsystems.reduce((a, b) => a.score <= b.score ? a : b);
|
|
394
|
+
const messages = {
|
|
395
|
+
identity: "Add or expand AGENTS.md so agents understand what this project is.",
|
|
396
|
+
verification: "Document verification commands so agents can confirm their work is correct.",
|
|
397
|
+
state: "Add PROGRESS.md and SESSION-HANDOFF.md so agents can resume without starting blind.",
|
|
398
|
+
memory: "Add ARCHITECTURE.md with module map so agents can navigate without exploring.",
|
|
399
|
+
constraints: "Add MUST / MUST NOT constraints so agents know what they must never do."
|
|
400
|
+
};
|
|
401
|
+
if (lowest.score >= 80) {
|
|
402
|
+
return "Repository is well-harnessed. Run `npx aiready audit` regularly to catch drift.";
|
|
403
|
+
}
|
|
404
|
+
return messages[lowest.name] ?? "Run `npx aiready init` to generate missing artifacts.";
|
|
405
|
+
}
|
|
406
|
+
function collectCriticalGaps(scored, xref) {
|
|
407
|
+
const gaps = [];
|
|
408
|
+
for (const [, value] of Object.entries(scored)) {
|
|
409
|
+
if (typeof value === "object" && "score" in value && "gaps" in value) {
|
|
410
|
+
const sub = value;
|
|
411
|
+
if (sub.score < 50) {
|
|
412
|
+
gaps.push(...sub.gaps.slice(0, 1));
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
for (const check of xref.checks) {
|
|
417
|
+
if (!check.passed) {
|
|
418
|
+
gaps.push(check.detail);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
return gaps;
|
|
422
|
+
}
|
|
423
|
+
function report(scored, xref, opts) {
|
|
424
|
+
if (opts.json) {
|
|
425
|
+
const out = {
|
|
426
|
+
overall: scored.overall,
|
|
427
|
+
subsystems: {
|
|
428
|
+
identity: scored.identity,
|
|
429
|
+
verification: scored.verification,
|
|
430
|
+
state: scored.state,
|
|
431
|
+
memory: scored.memory,
|
|
432
|
+
constraints: scored.constraints
|
|
433
|
+
},
|
|
434
|
+
crossReference: xref,
|
|
435
|
+
recommendation: getRecommendation(scored)
|
|
436
|
+
};
|
|
437
|
+
process.stdout.write(JSON.stringify(out, null, 2) + "\n");
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
const lines = [];
|
|
441
|
+
lines.push(`AI Readiness: ${scored.overall}/100`);
|
|
442
|
+
lines.push("");
|
|
443
|
+
lines.push(subsystemLine("identity", scored.identity.score, scored.identity.gaps));
|
|
444
|
+
lines.push(subsystemLine("verification", scored.verification.score, scored.verification.gaps));
|
|
445
|
+
lines.push(subsystemLine("state", scored.state.score, scored.state.gaps));
|
|
446
|
+
lines.push(subsystemLine("memory", scored.memory.score, scored.memory.gaps));
|
|
447
|
+
lines.push(subsystemLine("constraints", scored.constraints.score, scored.constraints.gaps));
|
|
448
|
+
const criticalGaps = collectCriticalGaps(scored, xref);
|
|
449
|
+
if (criticalGaps.length > 0) {
|
|
450
|
+
lines.push("");
|
|
451
|
+
lines.push("Critical gaps:");
|
|
452
|
+
for (const gap of criticalGaps) {
|
|
453
|
+
lines.push(` \u2717 ${gap}`);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
lines.push("");
|
|
457
|
+
lines.push(getRecommendation(scored));
|
|
458
|
+
process.stdout.write(lines.join("\n") + "\n");
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// src/audit/index.ts
|
|
462
|
+
function runAudit(target, opts) {
|
|
463
|
+
const targetDir = (0, import_path2.resolve)(target);
|
|
464
|
+
const files = loadRepo(targetDir);
|
|
465
|
+
const scored = scoreRepo(files);
|
|
466
|
+
const xref = crossRef(files);
|
|
467
|
+
report(scored, xref, { json: opts.json });
|
|
468
|
+
if (scored.overall < opts.minScore) {
|
|
469
|
+
process.exit(1);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// src/cli.ts
|
|
474
|
+
var program = new import_commander.Command();
|
|
475
|
+
program.name("aiready").description("Audit repositories for AI agent readiness").version("0.1.0");
|
|
476
|
+
program.command("audit").description("Score a repository against the 5 AI-readiness subsystems").option("-t, --target <dir>", "target directory to audit", ".").option("--json", "output results as JSON", false).option("--min-score <n>", "exit 1 if overall score is below this threshold", "70").action((opts) => {
|
|
477
|
+
runAudit(opts.target, {
|
|
478
|
+
json: opts.json,
|
|
479
|
+
minScore: parseInt(opts.minScore, 10)
|
|
480
|
+
});
|
|
481
|
+
});
|
|
482
|
+
if (require.main === module) {
|
|
483
|
+
program.parse(process.argv);
|
|
484
|
+
}
|
|
485
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
486
|
+
0 && (module.exports = {
|
|
487
|
+
program
|
|
488
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sicilianwildcat/aiready",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Audit repositories for AI agent readiness",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "harikrishn4a",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/harikrishn4a/aiready.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/harikrishn4a/aiready#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/harikrishn4a/aiready/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"ai",
|
|
17
|
+
"agents",
|
|
18
|
+
"cli",
|
|
19
|
+
"audit",
|
|
20
|
+
"harness",
|
|
21
|
+
"cursor",
|
|
22
|
+
"claude"
|
|
23
|
+
],
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=20"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"bin": {
|
|
31
|
+
"aiready": "./dist/cli.js"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsup",
|
|
35
|
+
"prepublishOnly": "npm run build && npm run typecheck && npm test",
|
|
36
|
+
"typecheck": "tsc --noEmit",
|
|
37
|
+
"lint": "eslint src/",
|
|
38
|
+
"test": "vitest run",
|
|
39
|
+
"dev": "tsup --watch"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"commander": "^12.0.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "^20.0.0",
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
47
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
48
|
+
"eslint": "^9.0.0",
|
|
49
|
+
"tsup": "^8.0.0",
|
|
50
|
+
"typescript": "^5.0.0",
|
|
51
|
+
"vitest": "^2.0.0"
|
|
52
|
+
}
|
|
53
|
+
}
|