@elvis1513/auto-coding-skill 2.1.0 → 2.1.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/README.md +88 -35
- package/cli/assets/agents/explorer.toml +1 -1
- package/cli/assets/agents/fixer.toml +1 -1
- package/cli/assets/agents/reviewer.toml +7 -6
- package/cli/assets/skill/SKILL.md +37 -24
- package/cli/assets/skill/data/templates/ENGINEERING.md +67 -36
- package/cli/assets/skill/data/templates/bridges/{CLAUDE.md → AGENTS.md} +3 -2
- package/cli/assets/skill/data/templates/docs/architecture/structure-standard.md +8 -0
- package/cli/assets/skill/data/templates/docs/deployment/deploy-records/_TEMPLATE-DEPLOY-RECORD.md +1 -1
- package/cli/assets/skill/data/templates/docs/deployment/deploy-runbook.md +1 -1
- package/cli/assets/skill/data/templates/docs/reviews/_TEMPLATE-REVIEW.md +4 -4
- package/cli/assets/skill/data/templates/docs/reviews/optimization-backlog.md +1 -0
- package/cli/assets/skill/data/templates/docs/reviews/project-health-baseline.md +4 -1
- package/cli/assets/skill/data/templates/docs/tasks/closure-log.md +6 -6
- package/cli/assets/skill/data/templates/docs/tasks/summaries/_TEMPLATE-TASK-SUMMARY.md +2 -2
- package/cli/assets/skill/data/templates/docs/tasks/taskbook.md +6 -6
- package/cli/assets/skill/scripts/ap.py +743 -91
- package/cli/src/index.js +137 -74
- package/cli/tests/index.test.js +146 -0
- package/package.json +7 -7
- package/cli/assets/skill/data/templates/bridges/CODEX.md +0 -11
package/cli/src/index.js
CHANGED
|
@@ -76,7 +76,8 @@ function listFiles(root, base = root){
|
|
|
76
76
|
return out.sort();
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
function compareDirs(src, dst){
|
|
79
|
+
function compareDirs(src, dst, options = {}){
|
|
80
|
+
const includeExtra = options.includeExtra ?? true;
|
|
80
81
|
const diffs = [];
|
|
81
82
|
const srcFiles = listFiles(src);
|
|
82
83
|
const dstFiles = listFiles(dst);
|
|
@@ -91,8 +92,10 @@ function compareDirs(src, dst){
|
|
|
91
92
|
const dstBuf = fs.readFileSync(path.join(dst, rel));
|
|
92
93
|
if (!srcBuf.equals(dstBuf)) diffs.push({ path: rel, status: "stale" });
|
|
93
94
|
}
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
if (includeExtra) {
|
|
96
|
+
for (const rel of dstFiles) {
|
|
97
|
+
if (!srcSet.has(rel)) diffs.push({ path: rel, status: "extra" });
|
|
98
|
+
}
|
|
96
99
|
}
|
|
97
100
|
return diffs;
|
|
98
101
|
}
|
|
@@ -123,24 +126,62 @@ function readPackageVersion(){
|
|
|
123
126
|
}
|
|
124
127
|
}
|
|
125
128
|
|
|
129
|
+
function extractFrontmatter(text){
|
|
130
|
+
const match = text.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
|
|
131
|
+
return match ? match[1] : "";
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function frontmatterHasPath(text, keyPath){
|
|
135
|
+
const frontmatter = extractFrontmatter(text);
|
|
136
|
+
if (!frontmatter) return false;
|
|
137
|
+
|
|
138
|
+
const stack = [];
|
|
139
|
+
for (const rawLine of frontmatter.split(/\r?\n/)) {
|
|
140
|
+
if (!rawLine.trim() || rawLine.trim().startsWith("#")) continue;
|
|
141
|
+
const match = rawLine.match(/^(\s*)(["']?[^:"']+["']?)\s*:/);
|
|
142
|
+
if (!match) continue;
|
|
143
|
+
|
|
144
|
+
const indent = match[1].replace(/\t/g, " ").length;
|
|
145
|
+
const key = match[2].replace(/^["']|["']$/g, "").trim();
|
|
146
|
+
while (stack.length && stack[stack.length - 1].indent >= indent) stack.pop();
|
|
147
|
+
const currentPath = [...stack.map(item => item.key), key];
|
|
148
|
+
if (currentPath.length === keyPath.length && currentPath.every((part, index) => part === keyPath[index])) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
stack.push({ indent, key });
|
|
152
|
+
}
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
|
|
126
156
|
function projectStatus(project, assetSkill, assetAgents){
|
|
127
157
|
const root = path.resolve(project);
|
|
128
158
|
const skillDir = path.join(root, ".agents", "skills", "auto-coding-skill");
|
|
129
159
|
const agentsDir = path.join(root, ".agents", "agents");
|
|
130
160
|
const toolDir = path.join(root, "docs", "tools", "autopipeline");
|
|
131
161
|
const engineering = path.join(root, "docs", "ENGINEERING.md");
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
162
|
+
const engineeringMissing = !exists(engineering);
|
|
163
|
+
const requiredConfigPaths = [
|
|
164
|
+
{ label: "structure", path: ["structure"] },
|
|
165
|
+
{ label: "optimization", path: ["optimization"] },
|
|
166
|
+
{ label: "verification.target_env_required", path: ["verification", "target_env_required"] },
|
|
167
|
+
{ label: "verification.jenkins_required", path: ["verification", "jenkins_required"] },
|
|
168
|
+
{ label: "docs.evidence_log", path: ["docs", "evidence_log"] },
|
|
169
|
+
{ label: "docs.task_archive_dir", path: ["docs", "task_archive_dir"] },
|
|
170
|
+
{ label: "docs.design_archive_dir", path: ["docs", "design_archive_dir"] },
|
|
171
|
+
{ label: "docs.archive_index", path: ["docs", "archive_index"] },
|
|
172
|
+
{ label: "docs.active_taskbook_max_lines", path: ["docs", "active_taskbook_max_lines"] },
|
|
173
|
+
{ label: "docs.active_closure_log_max_lines", path: ["docs", "active_closure_log_max_lines"] },
|
|
174
|
+
{ label: "docs.active_design_max_files", path: ["docs", "active_design_max_files"] },
|
|
175
|
+
{ label: "docs.health_baseline", path: ["docs", "health_baseline"] },
|
|
176
|
+
{ label: "docs.optimization_backlog", path: ["docs", "optimization_backlog"] },
|
|
177
|
+
{ label: "docs.structure_standard", path: ["docs", "structure_standard"] },
|
|
139
178
|
];
|
|
140
|
-
let missingConfigTokens =
|
|
141
|
-
if (
|
|
179
|
+
let missingConfigTokens = requiredConfigPaths.map(item => item.label);
|
|
180
|
+
if (!engineeringMissing) {
|
|
142
181
|
const text = fs.readFileSync(engineering, "utf8");
|
|
143
|
-
missingConfigTokens =
|
|
182
|
+
missingConfigTokens = requiredConfigPaths
|
|
183
|
+
.filter(item => !frontmatterHasPath(text, item.path))
|
|
184
|
+
.map(item => item.label);
|
|
144
185
|
}
|
|
145
186
|
const scriptDiffs = [];
|
|
146
187
|
for (const name of ["ap.py", "core.py", "http_checks.py"]) {
|
|
@@ -155,8 +196,18 @@ function projectStatus(project, assetSkill, assetAgents){
|
|
|
155
196
|
if (!exists(path.join(root, "docs", rel))) missingDocs.push(path.join("docs", rel));
|
|
156
197
|
}
|
|
157
198
|
const skillDiffs = exists(skillDir) ? compareDirs(assetSkill, skillDir) : [{ path: ".agents/skills/auto-coding-skill", status: "missing" }];
|
|
158
|
-
const agentDiffs = exists(agentsDir) ? compareDirs(assetAgents, agentsDir) : [{ path: ".agents/agents", status: "missing" }];
|
|
199
|
+
const agentDiffs = exists(agentsDir) ? compareDirs(assetAgents, agentsDir, { includeExtra: false }) : [{ path: ".agents/agents", status: "missing" }];
|
|
159
200
|
const ok = skillDiffs.length === 0 && agentDiffs.length === 0 && scriptDiffs.length === 0 && missingDocs.length === 0 && missingConfigTokens.length === 0;
|
|
201
|
+
let next = "";
|
|
202
|
+
if (!exists(skillDir) || !exists(agentsDir)) {
|
|
203
|
+
next = "run autocoding init --force";
|
|
204
|
+
} else if (skillDiffs.length || agentDiffs.length) {
|
|
205
|
+
next = "run autocoding sync --projects <repo>";
|
|
206
|
+
} else if (engineeringMissing || scriptDiffs.length || missingDocs.length) {
|
|
207
|
+
next = "run autocoding sync --projects <repo> or python3 .agents/skills/auto-coding-skill/scripts/ap.py --repo . install";
|
|
208
|
+
} else if (missingConfigTokens.length) {
|
|
209
|
+
next = "run project-local ap.py upgrade --write to merge docs/ENGINEERING.md safely";
|
|
210
|
+
}
|
|
160
211
|
return {
|
|
161
212
|
project: root,
|
|
162
213
|
ok,
|
|
@@ -165,7 +216,7 @@ function projectStatus(project, assetSkill, assetAgents){
|
|
|
165
216
|
scriptDiffs,
|
|
166
217
|
missingDocs,
|
|
167
218
|
missingConfigTokens,
|
|
168
|
-
next
|
|
219
|
+
next,
|
|
169
220
|
};
|
|
170
221
|
}
|
|
171
222
|
|
|
@@ -176,7 +227,7 @@ function printProjectStatus(result){
|
|
|
176
227
|
for (const item of items) console.log(`[autocoding] ${label} ${item.status}: ${item.path}`);
|
|
177
228
|
}
|
|
178
229
|
for (const item of result.missingDocs) console.log(`[autocoding] doc missing: ${item}`);
|
|
179
|
-
for (const item of result.missingConfigTokens) console.log(`[autocoding] config missing
|
|
230
|
+
for (const item of result.missingConfigTokens) console.log(`[autocoding] config missing path: ${item}`);
|
|
180
231
|
if (result.next) console.log(`[autocoding] next: ${result.next}`);
|
|
181
232
|
}
|
|
182
233
|
|
|
@@ -186,6 +237,9 @@ function syncProject(project, assetSkill, assetAgents, dryRun){
|
|
|
186
237
|
const skillDir = path.join(root, ".agents", "skills", "auto-coding-skill");
|
|
187
238
|
const agentsDir = path.join(root, ".agents", "agents");
|
|
188
239
|
const toolDir = path.join(root, "docs", "tools", "autopipeline");
|
|
240
|
+
const engineering = path.join(root, "docs", "ENGINEERING.md");
|
|
241
|
+
const engineeringWasMissing = !exists(engineering);
|
|
242
|
+
const templateEngineering = path.join(assetSkill, "data", "templates", "ENGINEERING.md");
|
|
189
243
|
actions.push({ action: dryRun ? "would-sync" : "sync", path: path.relative(root, skillDir) });
|
|
190
244
|
actions.push({ action: dryRun ? "would-sync" : "sync", path: path.relative(root, agentsDir) });
|
|
191
245
|
for (const name of ["ap.py", "core.py", "http_checks.py"]) {
|
|
@@ -194,54 +248,74 @@ function syncProject(project, assetSkill, assetAgents, dryRun){
|
|
|
194
248
|
if (!dryRun) {
|
|
195
249
|
rmrf(skillDir);
|
|
196
250
|
copyDir(assetSkill, skillDir);
|
|
197
|
-
rmrf(agentsDir);
|
|
198
251
|
copyDir(assetAgents, agentsDir);
|
|
199
252
|
fs.mkdirSync(toolDir, { recursive: true });
|
|
200
253
|
for (const name of ["ap.py", "core.py", "http_checks.py"]) {
|
|
201
254
|
fs.copyFileSync(path.join(assetSkill, "scripts", name), path.join(toolDir, name));
|
|
202
255
|
}
|
|
203
256
|
for (const copied of copyMissingDocs(assetSkill, root)) actions.push({ action: "create", path: copied });
|
|
257
|
+
if (engineeringWasMissing) {
|
|
258
|
+
fs.mkdirSync(path.dirname(engineering), { recursive: true });
|
|
259
|
+
fs.copyFileSync(templateEngineering, engineering);
|
|
260
|
+
actions.push({ action: "create", path: path.join("docs", "ENGINEERING.md") });
|
|
261
|
+
}
|
|
204
262
|
} else {
|
|
205
263
|
const srcDocs = path.join(assetSkill, "data", "templates", "docs");
|
|
206
264
|
for (const rel of listFiles(srcDocs)) {
|
|
207
265
|
if (!exists(path.join(root, "docs", rel))) actions.push({ action: "would-create", path: path.join("docs", rel) });
|
|
208
266
|
}
|
|
267
|
+
if (engineeringWasMissing) actions.push({ action: "would-create", path: path.join("docs", "ENGINEERING.md") });
|
|
268
|
+
}
|
|
269
|
+
if (!engineeringWasMissing) {
|
|
270
|
+
actions.push({ action: "manual", path: "docs/ENGINEERING.md", detail: "merge existing files with ap.py upgrade --write" });
|
|
209
271
|
}
|
|
210
|
-
actions.push({ action: "manual", path: "docs/ENGINEERING.md", detail: "merge with ap.py upgrade --write" });
|
|
211
272
|
return { project: root, dryRun, actions };
|
|
212
273
|
}
|
|
213
274
|
|
|
214
275
|
function projectRoot(){ return process.cwd(); }
|
|
215
276
|
|
|
216
|
-
function
|
|
217
|
-
if (destOverride) return destOverride;
|
|
277
|
+
function resolveInstallDirs(mode, destOverride){
|
|
218
278
|
if (mode !== "project" && mode !== "global") die(`--mode must be 'project' or 'global'`);
|
|
219
279
|
|
|
220
|
-
if (ai === "claude") {
|
|
221
|
-
return mode === "project"
|
|
222
|
-
? path.join(projectRoot(), ".claude", "skills", "auto-coding-skill")
|
|
223
|
-
: path.join(os.homedir(), ".claude", "skills", "auto-coding-skill");
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
if (ai === "codex") {
|
|
227
|
-
return mode === "project"
|
|
228
|
-
? path.join(projectRoot(), ".agents", "skills", "auto-coding-skill")
|
|
229
|
-
: path.join(os.homedir(), ".agents", "skills", "auto-coding-skill");
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
die(`unknown ai: ${ai}`);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
function resolveAgentsDir(mode, destOverride, multiTarget){
|
|
236
280
|
if (destOverride) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
281
|
+
const dest = path.resolve(destOverride);
|
|
282
|
+
const parent = path.dirname(dest);
|
|
283
|
+
const grandparent = path.dirname(parent);
|
|
284
|
+
if (path.basename(dest) === "auto-coding-skill" && path.basename(parent) === "skills" && path.basename(grandparent) === ".agents") {
|
|
285
|
+
return {
|
|
286
|
+
skillDir: dest,
|
|
287
|
+
agentsDir: path.join(grandparent, "agents"),
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
if (path.basename(dest) === "skills" && path.basename(parent) === ".agents") {
|
|
291
|
+
return {
|
|
292
|
+
skillDir: path.join(dest, "auto-coding-skill"),
|
|
293
|
+
agentsDir: path.join(parent, "agents"),
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
if (path.basename(dest) === "agents" && path.basename(parent) === ".agents") {
|
|
297
|
+
return {
|
|
298
|
+
skillDir: path.join(parent, "skills", "auto-coding-skill"),
|
|
299
|
+
agentsDir: dest,
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
if (path.basename(dest) === ".agents") {
|
|
303
|
+
return {
|
|
304
|
+
skillDir: path.join(dest, "skills", "auto-coding-skill"),
|
|
305
|
+
agentsDir: path.join(dest, "agents"),
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
return {
|
|
309
|
+
skillDir: path.join(dest, ".agents", "skills", "auto-coding-skill"),
|
|
310
|
+
agentsDir: path.join(dest, ".agents", "agents"),
|
|
311
|
+
};
|
|
240
312
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
: path.join(
|
|
313
|
+
|
|
314
|
+
const root = mode === "project" ? projectRoot() : os.homedir();
|
|
315
|
+
return {
|
|
316
|
+
skillDir: path.join(root, ".agents", "skills", "auto-coding-skill"),
|
|
317
|
+
agentsDir: path.join(root, ".agents", "agents"),
|
|
318
|
+
};
|
|
245
319
|
}
|
|
246
320
|
|
|
247
321
|
function main(){
|
|
@@ -249,20 +323,20 @@ function main(){
|
|
|
249
323
|
|
|
250
324
|
if (args.cmd === "help" || !args.cmd) {
|
|
251
325
|
console.log(`
|
|
252
|
-
autocoding - install auto-coding-skill
|
|
326
|
+
autocoding - install auto-coding-skill into generic .agents paths
|
|
253
327
|
|
|
254
328
|
Usage:
|
|
255
|
-
autocoding init
|
|
329
|
+
autocoding init [--mode project|global] [--dest <repo-root|.agents-dir|skill-dir>] [--force]
|
|
256
330
|
autocoding status --projects <path[,path...]> [--json]
|
|
257
331
|
autocoding sync --projects <path[,path...]> [--dry-run] [--json]
|
|
258
332
|
|
|
259
333
|
Examples:
|
|
260
|
-
autocoding init
|
|
261
|
-
autocoding init --ai codex
|
|
262
|
-
autocoding init --ai all --mode project
|
|
263
|
-
autocoding init --ai all --dest /tmp/skills
|
|
334
|
+
autocoding init
|
|
264
335
|
autocoding status --projects /Users/elvis/Product/xjmate,/Users/elvis/Product/geesight
|
|
265
336
|
autocoding sync --projects /Users/elvis/Product/xjmate --dry-run
|
|
337
|
+
|
|
338
|
+
Compatibility:
|
|
339
|
+
--ai <value> is accepted for old scripts and ignored.
|
|
266
340
|
`);
|
|
267
341
|
process.exit(0);
|
|
268
342
|
}
|
|
@@ -304,32 +378,21 @@ Examples:
|
|
|
304
378
|
|
|
305
379
|
if (args.cmd !== "init") die(`unknown command: ${args.cmd}`);
|
|
306
380
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
if (exists(dst)) {
|
|
317
|
-
if (!args.force) die(`target exists: ${dst}\nRe-run with --force to overwrite.`);
|
|
318
|
-
rmrf(dst);
|
|
319
|
-
}
|
|
320
|
-
copyDir(assetSkill, dst);
|
|
321
|
-
console.log(`[autocoding] installed skill to: ${dst}`);
|
|
322
|
-
|
|
323
|
-
if (t === "codex") {
|
|
324
|
-
const agentsDst = resolveAgentsDir(args.mode, args.dest, targets.length > 1);
|
|
325
|
-
if (exists(agentsDst)) {
|
|
326
|
-
if (!args.force) die(`target exists: ${agentsDst}\nRe-run with --force to overwrite.`);
|
|
327
|
-
rmrf(agentsDst);
|
|
328
|
-
}
|
|
329
|
-
copyDir(assetAgents, agentsDst);
|
|
330
|
-
console.log(`[autocoding] installed Codex agents to: ${agentsDst}`);
|
|
331
|
-
}
|
|
381
|
+
if (args.ai) console.warn("[autocoding] --ai is deprecated and ignored; installing generic .agents.");
|
|
382
|
+
|
|
383
|
+
const { skillDir, agentsDir } = resolveInstallDirs(args.mode, args.dest);
|
|
384
|
+
const existingTargets = [skillDir, agentsDir].filter(target => exists(target));
|
|
385
|
+
if (existingTargets.length && !args.force) {
|
|
386
|
+
die(`target exists: ${existingTargets.join(", ")}\nRe-run with --force to overwrite managed templates.`);
|
|
387
|
+
}
|
|
388
|
+
if (exists(skillDir)) {
|
|
389
|
+
rmrf(skillDir);
|
|
332
390
|
}
|
|
391
|
+
copyDir(assetSkill, skillDir);
|
|
392
|
+
console.log(`[autocoding] installed skill to: ${skillDir}`);
|
|
393
|
+
|
|
394
|
+
copyDir(assetAgents, agentsDir);
|
|
395
|
+
console.log(`[autocoding] installed agents to: ${agentsDir}`);
|
|
333
396
|
|
|
334
397
|
console.log("[autocoding] done.");
|
|
335
398
|
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { spawnSync } from "node:child_process";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
8
|
+
const cli = path.join(repoRoot, "cli", "src", "index.js");
|
|
9
|
+
const assetAp = path.join(repoRoot, "cli", "assets", "skill", "scripts", "ap.py");
|
|
10
|
+
|
|
11
|
+
function assert(condition, message) {
|
|
12
|
+
if (!condition) throw new Error(message);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function exists(p) {
|
|
16
|
+
return fs.existsSync(p);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function tmpdir(name) {
|
|
20
|
+
return fs.mkdtempSync(path.join(os.tmpdir(), `autocoding-${name}.`));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function run(command, args, options = {}) {
|
|
24
|
+
const result = spawnSync(command, args, {
|
|
25
|
+
cwd: options.cwd ?? repoRoot,
|
|
26
|
+
encoding: "utf8",
|
|
27
|
+
stdio: "pipe",
|
|
28
|
+
});
|
|
29
|
+
if (options.check !== false && result.status !== 0) {
|
|
30
|
+
throw new Error([
|
|
31
|
+
`command failed: ${command} ${args.join(" ")}`,
|
|
32
|
+
`cwd=${options.cwd ?? repoRoot}`,
|
|
33
|
+
`status=${result.status}`,
|
|
34
|
+
result.stdout,
|
|
35
|
+
result.stderr,
|
|
36
|
+
].join("\n"));
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function writeFile(file, text) {
|
|
42
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
43
|
+
fs.writeFileSync(file, text);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function assertStatusOk(repo) {
|
|
47
|
+
const result = run("node", [cli, "status", "--projects", repo, "--json"]);
|
|
48
|
+
const parsed = JSON.parse(result.stdout);
|
|
49
|
+
assert(parsed.results[0].ok === true, `status should be ok: ${result.stdout}`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function testPreflightAvoidsPartialInstall() {
|
|
53
|
+
const repo = tmpdir("partial-init");
|
|
54
|
+
writeFile(path.join(repo, ".agents", "agents", "custom.toml"), 'name = "custom"\n');
|
|
55
|
+
const result = run("node", [cli, "init"], { cwd: repo, check: false });
|
|
56
|
+
assert(result.status !== 0, "init should fail when agents target exists without --force");
|
|
57
|
+
assert(!exists(path.join(repo, ".agents", "skills", "auto-coding-skill")), "failed init must not leave a partial skill copy");
|
|
58
|
+
assert(exists(path.join(repo, ".agents", "agents", "custom.toml")), "existing custom agent should remain");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function testDestVariants() {
|
|
62
|
+
const variants = [
|
|
63
|
+
{
|
|
64
|
+
name: "repo-root",
|
|
65
|
+
dest(root) { return root; },
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "agents-root",
|
|
69
|
+
dest(root) { return path.join(root, ".agents"); },
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "skills-dir",
|
|
73
|
+
dest(root) { return path.join(root, ".agents", "skills"); },
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "agents-dir",
|
|
77
|
+
dest(root) { return path.join(root, ".agents", "agents"); },
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "direct-skill",
|
|
81
|
+
dest(root) { return path.join(root, ".agents", "skills", "auto-coding-skill"); },
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
for (const variant of variants) {
|
|
86
|
+
const root = tmpdir(`dest-${variant.name}`);
|
|
87
|
+
const dest = variant.dest(root);
|
|
88
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
89
|
+
run("node", [cli, "init", "--dest", dest, "--force"]);
|
|
90
|
+
assert(exists(path.join(root, ".agents", "skills", "auto-coding-skill", "SKILL.md")), `${variant.name}: missing skill`);
|
|
91
|
+
assert(exists(path.join(root, ".agents", "agents", "explorer.toml")), `${variant.name}: missing agent`);
|
|
92
|
+
assert(!exists(path.join(root, ".agents", ".agents")), `${variant.name}: nested .agents should not be created`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function testSyncCreatesScaffoldAndStatusConverges() {
|
|
97
|
+
const repo = tmpdir("sync-converges");
|
|
98
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
99
|
+
const before = run("node", [cli, "status", "--projects", repo, "--json"], { check: false });
|
|
100
|
+
assert(before.status !== 0, "status should fail before docs/tooling scaffold exists");
|
|
101
|
+
assert(before.stdout.includes("autocoding sync"), "status should point to sync for missing scaffold");
|
|
102
|
+
run("node", [cli, "sync", "--projects", repo]);
|
|
103
|
+
assert(exists(path.join(repo, "docs", "ENGINEERING.md")), "sync should create docs/ENGINEERING.md when missing");
|
|
104
|
+
assertStatusOk(repo);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function testForcePreservesCustomAgents() {
|
|
108
|
+
const repo = tmpdir("custom-agent");
|
|
109
|
+
run("node", [cli, "init", "--force"], { cwd: repo });
|
|
110
|
+
const custom = path.join(repo, ".agents", "agents", "custom-local.toml");
|
|
111
|
+
writeFile(custom, 'name = "custom-local"\ndescription = "custom"\nmodel = "gpt-5.5"\n');
|
|
112
|
+
run("node", [cli, "init", "--force"], { cwd: repo });
|
|
113
|
+
assert(exists(custom), "custom agent should be preserved");
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function testBridgeIsGeneric() {
|
|
117
|
+
const repo = tmpdir("bridge");
|
|
118
|
+
run("node", [cli, "init", "--force"], { cwd: repo });
|
|
119
|
+
const ap = path.join(repo, ".agents", "skills", "auto-coding-skill", "scripts", "ap.py");
|
|
120
|
+
run("python3", [ap, "--repo", repo, "install", "--bridges"]);
|
|
121
|
+
assert(exists(path.join(repo, "AGENTS.md")), "generic bridge should be created");
|
|
122
|
+
for (const filename of [`CO${"DEX.md"}`, `CLA${"UDE.md"}`]) {
|
|
123
|
+
assert(!exists(path.join(repo, filename)), "client-named bridge should not be created");
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function testUpgradeCleansManagedBridgeExtrasOnly() {
|
|
128
|
+
const repo = tmpdir("upgrade-extra");
|
|
129
|
+
run("git", ["init", "-q"], { cwd: repo });
|
|
130
|
+
run("node", [cli, "init", "--force"], { cwd: repo });
|
|
131
|
+
run("node", [cli, "sync", "--projects", repo]);
|
|
132
|
+
writeFile(path.join(repo, ".agents", "skills", "auto-coding-skill", "data", "templates", "bridges", "OLD.md"), "old\n");
|
|
133
|
+
writeFile(path.join(repo, ".agents", "skills", "auto-coding-skill", "custom.txt"), "custom\n");
|
|
134
|
+
run("python3", [assetAp, "--repo", repo, "upgrade", "--write"]);
|
|
135
|
+
assert(!exists(path.join(repo, ".agents", "skills", "auto-coding-skill", "data", "templates", "bridges", "OLD.md")), "managed bridge extra should be removed");
|
|
136
|
+
assert(exists(path.join(repo, ".agents", "skills", "auto-coding-skill", "custom.txt")), "non-managed extra should remain");
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
testPreflightAvoidsPartialInstall();
|
|
140
|
+
testDestVariants();
|
|
141
|
+
testSyncCreatesScaffoldAndStatusConverges();
|
|
142
|
+
testForcePreservesCustomAgents();
|
|
143
|
+
testBridgeIsGeneric();
|
|
144
|
+
testUpgradeCleansManagedBridgeExtrasOnly();
|
|
145
|
+
|
|
146
|
+
console.log("cli-installer-regression-ok");
|
package/package.json
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elvis1513/auto-coding-skill",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"description": "CLI installer for
|
|
3
|
+
"version": "2.1.1",
|
|
4
|
+
"description": "CLI installer for a generic .agents engineering workflow with optional CI/Jenkins and target-environment verification.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"autocoding": "cli/src/index.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"cli/src",
|
|
11
|
+
"cli/tests",
|
|
11
12
|
"cli/assets/skill",
|
|
12
13
|
"cli/assets/agents",
|
|
13
14
|
"README.md",
|
|
14
15
|
"LICENSE"
|
|
15
16
|
],
|
|
16
17
|
"scripts": {
|
|
17
|
-
"test": "node -c cli/src/index.js && node -c cli/src/sync-assets.js && python3 -c \"import ast, pathlib; files = ['
|
|
18
|
+
"test": "node -c cli/src/index.js && node -c cli/src/sync-assets.js && node -c cli/tests/index.test.js && node cli/tests/index.test.js && python3 -c \"import ast, pathlib; files = ['cli/assets/skill/scripts/ap.py', 'cli/assets/skill/scripts/core.py', 'cli/assets/skill/scripts/http_checks.py']; [ast.parse(pathlib.Path(rel).read_text(encoding='utf-8'), filename=rel, feature_version=(3, 11)) for rel in files]; print('python311-asset-grammar-ok')\" && python3 -m py_compile cli/assets/skill/scripts/ap.py cli/assets/skill/scripts/core.py cli/assets/skill/scripts/http_checks.py && python3 -c \"import pathlib, tomllib; files = sorted(pathlib.Path('cli/assets/agents').glob('*.toml')); [tomllib.loads(path.read_text(encoding='utf-8')) for path in files]; print('asset-agent-toml-ok')\" && find cli -type d -name '__pycache__' -prune -exec rm -rf {} +",
|
|
19
|
+
"test:src": "python3 -c \"import ast, pathlib; files = ['src/auto-coding-skill/scripts/ap.py', 'src/auto-coding-skill/scripts/core.py', 'src/auto-coding-skill/scripts/http_checks.py']; [ast.parse(pathlib.Path(rel).read_text(encoding='utf-8'), filename=rel, feature_version=(3, 11)) for rel in files]; print('python311-src-grammar-ok')\" && python3 -m py_compile src/auto-coding-skill/scripts/ap.py src/auto-coding-skill/scripts/core.py src/auto-coding-skill/scripts/http_checks.py && python3 -c \"import pathlib, tomllib; files = sorted(pathlib.Path('src/agents').glob('*.toml')); [tomllib.loads(path.read_text(encoding='utf-8')) for path in files]; print('src-agent-toml-ok')\" && find src -type d -name '__pycache__' -prune -exec rm -rf {} +",
|
|
18
20
|
"check:assets": "node cli/src/sync-assets.js --check",
|
|
19
21
|
"sync-assets": "node cli/src/sync-assets.js",
|
|
20
|
-
"release:check": "npm run sync-assets && npm run test && npm pack --dry-run"
|
|
22
|
+
"release:check": "npm run sync-assets && npm run check:assets && npm run test:src && npm run test && npm pack --dry-run"
|
|
21
23
|
},
|
|
22
24
|
"license": "MIT",
|
|
23
25
|
"publishConfig": {
|
|
24
26
|
"access": "public"
|
|
25
27
|
},
|
|
26
28
|
"keywords": [
|
|
27
|
-
"
|
|
28
|
-
"codex",
|
|
29
|
+
"agents",
|
|
29
30
|
"skill",
|
|
30
31
|
"automation",
|
|
31
32
|
"engineering",
|
|
32
33
|
"workflow",
|
|
33
34
|
"ci",
|
|
34
35
|
"jenkins",
|
|
35
|
-
"go",
|
|
36
36
|
"monorepo",
|
|
37
37
|
"docker",
|
|
38
38
|
"local-testing"
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
Follow `docs/ENGINEERING.md` strictly. Source of truth: `docs/ENGINEERING.md`.
|
|
2
|
-
At task start, use `ap.py classify --scope auto` when changed-file impact is not obvious.
|
|
3
|
-
Before code changes, read the configured structure standard and place new code in the correct layer; do not add new responsibilities to already-large files.
|
|
4
|
-
Obey `structure.layer_rules` import boundaries unless a DD/ADR explicitly records the exception.
|
|
5
|
-
Before optimization reviews, read the project health baseline and optimization backlog, and report only new, worsened, unrecorded P0/P1, or upgraded-priority items.
|
|
6
|
-
Route work through already available MCP servers, installed skills, plugins, and app connectors when they provide current docs, design context, browser evidence, GitHub/CI state, security review, or artifact rendering.
|
|
7
|
-
Use the `.agents/agents` role model when available: explorer, docs_researcher, browser_debugger, fixer, reviewer. If the client cannot run subagents, execute the same roles sequentially in the main agent.
|
|
8
|
-
Default to the lightweight local gate first; when `structure.enabled` is true, the gate includes `structure-check`.
|
|
9
|
-
Keep `docs/tasks/evidence.jsonl` and closure Markdown aligned with actual executed checks.
|
|
10
|
-
Use Jenkins build verification and real target-environment verification as the primary completion gate in verify mode.
|
|
11
|
-
Local Docker Compose and full local regression are on-demand diagnostic tools, not the default gate for every small change.
|