@elvis1513/auto-coding-skill 3.0.4 → 4.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/README.md +159 -328
- package/cli/assets/agents/explorer.toml +1 -1
- package/cli/assets/agents/fixer.toml +4 -4
- package/cli/assets/agents/reviewer.toml +12 -12
- package/cli/assets/skill/SKILL.md +135 -234
- package/cli/assets/skill/data/policies/workflow-migrations-v1.json +291 -5
- package/cli/assets/skill/data/templates/ENGINEERING.md +164 -292
- package/cli/assets/skill/data/templates/bridges/AGENTS.md +133 -14
- package/cli/assets/skill/scripts/ap.py +884 -221
- package/cli/assets/skill/scripts/scaffold_templates.py +40 -5
- package/cli/src/index.js +180 -93
- package/cli/tests/ap_concurrency_test.py +109 -24
- package/cli/tests/ap_profiles_test.py +81 -41
- package/cli/tests/index.test.js +114 -77
- package/package.json +2 -2
- package/cli/assets/skill/data/templates/docs/tasks/closure-log.md +0 -17
- package/cli/assets/skill/data/templates/docs/tasks/taskbook.md +0 -30
|
@@ -5,6 +5,41 @@ from __future__ import annotations
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
TEMPLATES: dict[str, dict[str, str]] = {
|
|
8
|
+
"project": {
|
|
9
|
+
"docs/project/overview.md": """# Project Overview
|
|
10
|
+
|
|
11
|
+
Record durable project facts, not workflow rules.
|
|
12
|
+
|
|
13
|
+
## Product scope and non-goals
|
|
14
|
+
## Domain boundaries and invariants
|
|
15
|
+
## Users, roles, and critical journeys
|
|
16
|
+
## External systems and safety boundaries
|
|
17
|
+
## Current contracts and decision links
|
|
18
|
+
""",
|
|
19
|
+
"docs/project/repository-map.md": """# Repository Map
|
|
20
|
+
|
|
21
|
+
Map existing ownership and reuse points. Keep behavior details in code/tests.
|
|
22
|
+
|
|
23
|
+
| Area | Paths | Responsibility | Generated / source | Validation route |
|
|
24
|
+
| --- | --- | --- | --- | --- |
|
|
25
|
+
|
|
26
|
+
## Cross-module dependencies
|
|
27
|
+
## Shared components and helpers
|
|
28
|
+
## Files or directories with special ownership
|
|
29
|
+
""",
|
|
30
|
+
"docs/project/runtime.md": """# Runtime And Deployment Facts
|
|
31
|
+
|
|
32
|
+
Record current environment topology and operating constraints, not normal
|
|
33
|
+
development gate rules.
|
|
34
|
+
|
|
35
|
+
## Local runtime
|
|
36
|
+
## Shared services and dependencies
|
|
37
|
+
## Jenkins and artifact flow
|
|
38
|
+
## Deployment topology
|
|
39
|
+
## External-device / production-write safeguards
|
|
40
|
+
## Fixtures, simulators, and repeatable diagnostic entry points
|
|
41
|
+
""",
|
|
42
|
+
},
|
|
8
43
|
"api": {
|
|
9
44
|
"docs/interfaces/api.md": """# API Contract
|
|
10
45
|
|
|
@@ -23,10 +58,10 @@ Record only current, externally relevant endpoints or events.
|
|
|
23
58
|
""",
|
|
24
59
|
},
|
|
25
60
|
"design": {
|
|
26
|
-
"docs/design/_TEMPLATE-DD.md": """# DD — <
|
|
61
|
+
"docs/design/_TEMPLATE-DD.md": """# DD — <Decision ID> <Title>
|
|
27
62
|
|
|
28
63
|
- Status: Draft | Reviewed | Approved
|
|
29
|
-
- Related
|
|
64
|
+
- Related requirement / commit:
|
|
30
65
|
|
|
31
66
|
## Context and goal
|
|
32
67
|
## Scope and non-goals
|
|
@@ -56,7 +91,7 @@ Project conventions are authoritative. The generic checker is advisory unless
|
|
|
56
91
|
|
|
57
92
|
- Status: Proposed | Accepted | Superseded
|
|
58
93
|
- Date: YYYY-MM-DD
|
|
59
|
-
- Related
|
|
94
|
+
- Related requirement / commit:
|
|
60
95
|
|
|
61
96
|
## Context
|
|
62
97
|
## Decision
|
|
@@ -67,7 +102,7 @@ Project conventions are authoritative. The generic checker is advisory unless
|
|
|
67
102
|
""",
|
|
68
103
|
},
|
|
69
104
|
"review": {
|
|
70
|
-
"docs/reviews/_TEMPLATE-REVIEW.md": """# Review — <
|
|
105
|
+
"docs/reviews/_TEMPLATE-REVIEW.md": """# Review — <Change ID>
|
|
71
106
|
|
|
72
107
|
- Scope:
|
|
73
108
|
- Evidence:
|
|
@@ -79,7 +114,7 @@ List P0/P1/P2/P3 findings with impact, evidence, and remediation.
|
|
|
79
114
|
|
|
80
115
|
## Verdict
|
|
81
116
|
|
|
82
|
-
|
|
117
|
+
approved | changes-requested
|
|
83
118
|
""",
|
|
84
119
|
},
|
|
85
120
|
"testing": {
|
package/cli/src/index.js
CHANGED
|
@@ -111,11 +111,8 @@ function validateCommandArgs(args){
|
|
|
111
111
|
if (invalid.length) {
|
|
112
112
|
die(`${invalid.map(name => ARG_FLAGS[name] || name).join(", ")} not valid for '${args.cmd}'`);
|
|
113
113
|
}
|
|
114
|
-
if (args.cmd === "sync" &&
|
|
115
|
-
die("--components
|
|
116
|
-
}
|
|
117
|
-
if (args.cmd === "sync" && args.components === "skill" && args.resetAgentModels) {
|
|
118
|
-
die("--reset-agent-models cannot be used with --components skill");
|
|
114
|
+
if (args.cmd === "sync" && args.components !== "all") {
|
|
115
|
+
die("partial Skill sync was removed in 4.1; use --components all so Skill, AGENTS.md, ENGINEERING.md, agents, and runtime converge together");
|
|
119
116
|
}
|
|
120
117
|
}
|
|
121
118
|
|
|
@@ -172,7 +169,7 @@ function compareDirs(src, dst, options = {}){
|
|
|
172
169
|
return diffs;
|
|
173
170
|
}
|
|
174
171
|
|
|
175
|
-
const CORE_DOCS = [
|
|
172
|
+
const CORE_DOCS = [];
|
|
176
173
|
|
|
177
174
|
function isEscapedAt(text, index){
|
|
178
175
|
let slashes = 0;
|
|
@@ -380,7 +377,7 @@ function inferredGateCommands(project){
|
|
|
380
377
|
const scripts = parsed?.scripts;
|
|
381
378
|
if (!scripts || typeof scripts !== "object") return {};
|
|
382
379
|
return typeof scripts["test:changed"] === "string" && scripts["test:changed"].trim()
|
|
383
|
-
? {
|
|
380
|
+
? { project_fast: "npm run test:changed" }
|
|
384
381
|
: {};
|
|
385
382
|
} catch {
|
|
386
383
|
return {};
|
|
@@ -393,7 +390,7 @@ function renderEngineeringTemplate(templateText, project){
|
|
|
393
390
|
`project:\n name: ${JSON.stringify(path.basename(path.resolve(project)))}`,
|
|
394
391
|
);
|
|
395
392
|
for (const [key, gate] of Object.entries(inferredGateCommands(project))) {
|
|
396
|
-
rendered = rendered.replace(` ${key}: "
|
|
393
|
+
rendered = rendered.replace(` ${key}: ""`, ` ${key}: ${JSON.stringify(gate)}`);
|
|
397
394
|
}
|
|
398
395
|
return rendered;
|
|
399
396
|
}
|
|
@@ -493,7 +490,33 @@ function applyKnownOfficialFragments(text, documentPath, policy){
|
|
|
493
490
|
for (const fragment of policy.known_official_fragments) {
|
|
494
491
|
if (!fragment.paths?.includes(documentPath) || !fragment.text) continue;
|
|
495
492
|
let pattern;
|
|
496
|
-
if (fragment.match === "
|
|
493
|
+
if (fragment.match === "heading-section") {
|
|
494
|
+
const lines = output.match(/.*(?:\r?\n|$)/g).filter(Boolean);
|
|
495
|
+
const offsets = [];
|
|
496
|
+
let cursor = 0;
|
|
497
|
+
for (const line of lines) {
|
|
498
|
+
offsets.push(cursor);
|
|
499
|
+
cursor += line.length;
|
|
500
|
+
}
|
|
501
|
+
const spans = [];
|
|
502
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
503
|
+
const heading = lines[index].replace(/\r?\n$/, "").match(/^(\s*)(#{1,6})\s+(.+?)\s*#*\s*$/);
|
|
504
|
+
if (!heading || heading[3].trim() !== fragment.text.trim()) continue;
|
|
505
|
+
const level = heading[2].length;
|
|
506
|
+
let end = index + 1;
|
|
507
|
+
while (end < lines.length) {
|
|
508
|
+
const next = lines[end].replace(/\r?\n$/, "").match(/^\s*(#{1,6})\s+/);
|
|
509
|
+
if (next && next[1].length <= level) break;
|
|
510
|
+
end += 1;
|
|
511
|
+
}
|
|
512
|
+
spans.push([offsets[index], end < lines.length ? offsets[end] : output.length]);
|
|
513
|
+
}
|
|
514
|
+
if (spans.length) {
|
|
515
|
+
for (const [start, end] of spans.reverse()) output = output.slice(0, start) + output.slice(end);
|
|
516
|
+
migrations.push(fragment.id);
|
|
517
|
+
}
|
|
518
|
+
continue;
|
|
519
|
+
} else if (fragment.match === "exact-line") {
|
|
497
520
|
pattern = new RegExp(`^[\\t ]*${escapeRegExp(fragment.text.trim())}[\\t ]*(?:\\r?\\n|$)`, "gm");
|
|
498
521
|
} else if (fragment.match === "exact-block") {
|
|
499
522
|
const source = fragment.text.split("\n").map(escapeRegExp).join("\\r?\\n");
|
|
@@ -656,6 +679,8 @@ function planEngineeringSync(project, assetSkill, policy = loadWorkflowMigration
|
|
|
656
679
|
detail: "unknown workflow directives conflict with the managed fast-gate policy",
|
|
657
680
|
};
|
|
658
681
|
}
|
|
682
|
+
const sectionMigration = migrated.migrations.some(item => item.startsWith("engineering-section-"));
|
|
683
|
+
const archive = sectionMigration ? engineeringArchivePlan(root, current, templateRegion.version) : {};
|
|
659
684
|
return {
|
|
660
685
|
state: "legacy-custom",
|
|
661
686
|
version: templateRegion.version,
|
|
@@ -664,6 +689,7 @@ function planEngineeringSync(project, assetSkill, policy = loadWorkflowMigration
|
|
|
664
689
|
engineering,
|
|
665
690
|
migrations: migrated.migrations,
|
|
666
691
|
conflicts: [],
|
|
692
|
+
...archive,
|
|
667
693
|
};
|
|
668
694
|
}
|
|
669
695
|
const beforeParts = splitEngineeringDocument(current.slice(0, currentRegion.start));
|
|
@@ -689,6 +715,8 @@ function planEngineeringSync(project, assetSkill, policy = loadWorkflowMigration
|
|
|
689
715
|
const migratedRegion = inspectManagedWorkflow(migratedCurrent);
|
|
690
716
|
const output = replaceManagedBlock(migratedCurrent, migratedRegion, templateRegion.block);
|
|
691
717
|
if (current === output) return { state: "current", version: templateRegion.version, output, engineering, migrations: [], conflicts: [] };
|
|
718
|
+
const sectionMigration = migrations.some(item => item.startsWith("engineering-section-"));
|
|
719
|
+
const archive = sectionMigration ? engineeringArchivePlan(root, current, templateRegion.version) : {};
|
|
692
720
|
return {
|
|
693
721
|
state: "stale",
|
|
694
722
|
version: templateRegion.version,
|
|
@@ -697,6 +725,34 @@ function planEngineeringSync(project, assetSkill, policy = loadWorkflowMigration
|
|
|
697
725
|
engineering,
|
|
698
726
|
migrations,
|
|
699
727
|
conflicts: [],
|
|
728
|
+
...archive,
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
function engineeringArchivePlan(root, current, version){
|
|
733
|
+
const archiveHeader = [
|
|
734
|
+
`# Archived ENGINEERING.md before auto-coding-skill ${version} docs convergence`,
|
|
735
|
+
"",
|
|
736
|
+
"This file is historical and non-authoritative. Known duplicate workflow sections",
|
|
737
|
+
"were removed from docs/ENGINEERING.md. Move any still-current project facts into",
|
|
738
|
+
"docs/ENGINEERING.md project-fact sections or docs/project/.",
|
|
739
|
+
"",
|
|
740
|
+
"---",
|
|
741
|
+
"",
|
|
742
|
+
].join("\n");
|
|
743
|
+
const archiveOutput = `${archiveHeader}${current}`;
|
|
744
|
+
const archiveDir = path.join(root, "docs", "archive", "workflow");
|
|
745
|
+
let archiveDocument = path.join(archiveDir, `ENGINEERING.pre-${version}.md`);
|
|
746
|
+
if (exists(archiveDocument) && fs.readFileSync(archiveDocument, "utf8") !== archiveOutput) {
|
|
747
|
+
archiveDocument = path.join(
|
|
748
|
+
archiveDir,
|
|
749
|
+
`ENGINEERING.pre-${version}-${engineeringBodyHash(current).slice(0, 12)}.md`,
|
|
750
|
+
);
|
|
751
|
+
}
|
|
752
|
+
return {
|
|
753
|
+
archiveDocument,
|
|
754
|
+
archiveOutput,
|
|
755
|
+
archiveRequired: !exists(archiveDocument),
|
|
700
756
|
};
|
|
701
757
|
}
|
|
702
758
|
|
|
@@ -713,71 +769,39 @@ function planAgentsDocumentSync(project, assetSkill, policy = loadWorkflowMigrat
|
|
|
713
769
|
return { state: "missing", version: templateRegion.version, output: template, agentsDocument, migrations: [], conflicts: [] };
|
|
714
770
|
}
|
|
715
771
|
const current = fs.readFileSync(agentsDocument, "utf8");
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
return {
|
|
719
|
-
state: "legacy-official",
|
|
720
|
-
version: templateRegion.version,
|
|
721
|
-
output: template,
|
|
722
|
-
agentsDocument,
|
|
723
|
-
migrations: [`agents-sha256:${currentHash}`],
|
|
724
|
-
conflicts: [],
|
|
725
|
-
};
|
|
772
|
+
if (current === template) {
|
|
773
|
+
return { state: "current", version: templateRegion.version, output: template, agentsDocument, migrations: [], conflicts: [] };
|
|
726
774
|
}
|
|
727
|
-
const
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
preservedCustom: true,
|
|
746
|
-
output: `${templateRegion.block}${separator}${migrated.output}`,
|
|
747
|
-
agentsDocument,
|
|
748
|
-
migrations: migrated.migrations,
|
|
749
|
-
conflicts: [],
|
|
750
|
-
};
|
|
775
|
+
const archiveHeader = [
|
|
776
|
+
`# Archived AGENTS.md before auto-coding-skill ${templateRegion.version}`,
|
|
777
|
+
"",
|
|
778
|
+
"This file is historical and non-authoritative. The root AGENTS.md is fully managed.",
|
|
779
|
+
"Move any still-current project facts into docs/ENGINEERING.md or docs/project/",
|
|
780
|
+
"without copying workflow rules back into the root AGENTS.md.",
|
|
781
|
+
"",
|
|
782
|
+
"---",
|
|
783
|
+
"",
|
|
784
|
+
].join("\n");
|
|
785
|
+
const archiveOutput = `${archiveHeader}${current}`;
|
|
786
|
+
const archiveDir = path.join(root, "docs", "archive", "workflow");
|
|
787
|
+
let archiveDocument = path.join(archiveDir, `AGENTS.pre-${templateRegion.version}.md`);
|
|
788
|
+
if (exists(archiveDocument) && fs.readFileSync(archiveDocument, "utf8") !== archiveOutput) {
|
|
789
|
+
archiveDocument = path.join(
|
|
790
|
+
archiveDir,
|
|
791
|
+
`AGENTS.pre-${templateRegion.version}-${engineeringBodyHash(current).slice(0, 12)}.md`,
|
|
792
|
+
);
|
|
751
793
|
}
|
|
752
|
-
const
|
|
753
|
-
const migratedAfter = migrateDocumentText(current.slice(currentRegion.endExclusive), "AGENTS.md", policy);
|
|
754
|
-
const conflicts = [
|
|
755
|
-
...migratedBefore.conflicts,
|
|
756
|
-
...offsetConflicts(migratedAfter.conflicts, lineCount(current.slice(0, currentRegion.endExclusive))),
|
|
757
|
-
];
|
|
758
|
-
const migrations = [...migratedBefore.migrations, ...migratedAfter.migrations];
|
|
759
|
-
if (conflicts.length) {
|
|
760
|
-
return {
|
|
761
|
-
state: "conflict",
|
|
762
|
-
version: templateRegion.version,
|
|
763
|
-
previousVersion: currentRegion.version,
|
|
764
|
-
agentsDocument,
|
|
765
|
-
migrations,
|
|
766
|
-
conflicts,
|
|
767
|
-
detail: "unknown workflow directives conflict with the managed fast-gate policy",
|
|
768
|
-
};
|
|
769
|
-
}
|
|
770
|
-
const migratedCurrent = `${migratedBefore.output}${currentRegion.block}${migratedAfter.output}`;
|
|
771
|
-
const migratedRegion = inspectManagedAgentsDocument(migratedCurrent);
|
|
772
|
-
const output = replaceManagedBlock(migratedCurrent, migratedRegion, templateRegion.block);
|
|
773
|
-
if (current === output) return { state: "current", version: templateRegion.version, output, agentsDocument, migrations: [], conflicts: [] };
|
|
794
|
+
const currentRegion = inspectManagedAgentsDocument(current);
|
|
774
795
|
return {
|
|
775
|
-
state: "stale",
|
|
796
|
+
state: currentRegion.state === "present" ? "stale" : "legacy-custom",
|
|
776
797
|
version: templateRegion.version,
|
|
777
|
-
previousVersion: currentRegion.version,
|
|
778
|
-
output,
|
|
798
|
+
...(currentRegion.state === "present" ? { previousVersion: currentRegion.version } : {}),
|
|
799
|
+
output: template,
|
|
779
800
|
agentsDocument,
|
|
780
|
-
|
|
801
|
+
archiveDocument,
|
|
802
|
+
archiveOutput,
|
|
803
|
+
archiveRequired: !exists(archiveDocument),
|
|
804
|
+
migrations: ["agents-whole-file-replacement"],
|
|
781
805
|
conflicts: [],
|
|
782
806
|
};
|
|
783
807
|
}
|
|
@@ -797,13 +821,14 @@ function publicEngineeringPlan(plan){
|
|
|
797
821
|
...(plan.previousVersion ? { previousVersion: plan.previousVersion } : {}),
|
|
798
822
|
...(plan.previousBodyHash ? { previousBodyHash: plan.previousBodyHash } : {}),
|
|
799
823
|
...(plan.preservedCustom ? { preservedCustom: true } : {}),
|
|
824
|
+
...(plan.archiveDocument ? { archive: plan.archiveDocument } : {}),
|
|
800
825
|
...(plan.migrations?.length ? { migrations: plan.migrations } : {}),
|
|
801
826
|
...(plan.conflicts?.length ? { conflicts: plan.conflicts } : {}),
|
|
802
827
|
...(plan.detail ? { detail: plan.detail } : {}),
|
|
803
828
|
};
|
|
804
829
|
}
|
|
805
830
|
|
|
806
|
-
function
|
|
831
|
+
function registeredTasks(project){
|
|
807
832
|
const root = path.resolve(project);
|
|
808
833
|
let commonDir;
|
|
809
834
|
try {
|
|
@@ -817,7 +842,7 @@ function registeredLegacyTasks(project){
|
|
|
817
842
|
}
|
|
818
843
|
const tasksDir = path.join(commonDir, "auto-coding-skill", "tasks");
|
|
819
844
|
if (!exists(tasksDir)) return [];
|
|
820
|
-
const
|
|
845
|
+
const registered = [];
|
|
821
846
|
for (const entry of fs.readdirSync(tasksDir, { withFileTypes: true })) {
|
|
822
847
|
if (!entry.isFile() || !entry.name.endsWith(".json")) continue;
|
|
823
848
|
const manifestPath = path.join(tasksDir, entry.name);
|
|
@@ -825,25 +850,23 @@ function registeredLegacyTasks(project){
|
|
|
825
850
|
try {
|
|
826
851
|
manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
827
852
|
} catch {
|
|
828
|
-
|
|
853
|
+
registered.push({ project: root, manifest: entry.name, schema: "invalid" });
|
|
829
854
|
continue;
|
|
830
855
|
}
|
|
831
856
|
const schema = Number(manifest?.schema ?? 0);
|
|
832
|
-
|
|
833
|
-
legacy.push({ project: root, manifest: entry.name, schema: Number.isFinite(schema) ? schema : "invalid" });
|
|
834
|
-
}
|
|
857
|
+
registered.push({ project: root, manifest: entry.name, schema: Number.isFinite(schema) ? schema : "invalid" });
|
|
835
858
|
}
|
|
836
|
-
return
|
|
859
|
+
return registered;
|
|
837
860
|
}
|
|
838
861
|
|
|
839
|
-
function
|
|
840
|
-
const
|
|
841
|
-
if (!
|
|
842
|
-
const locations =
|
|
862
|
+
function assertNoRegisteredTasks(projects){
|
|
863
|
+
const active = projects.flatMap(project => registeredTasks(project));
|
|
864
|
+
if (!active.length) return;
|
|
865
|
+
const locations = active.map(item => `${item.project}:${item.manifest}(schema=${item.schema})`).join(", ");
|
|
843
866
|
die(
|
|
844
|
-
"refusing the entire sync batch because registered auto-coding tasks
|
|
845
|
-
+ `${locations}\nFinish, integrate,
|
|
846
|
-
+ "sync will not
|
|
867
|
+
"refusing the entire sync batch because registered auto-coding tasks are still active: "
|
|
868
|
+
+ `${locations}\nFinish, integrate, or clean these tasks with the currently installed runtime before upgrading. `
|
|
869
|
+
+ "sync will not change the lifecycle semantics of an in-flight task.",
|
|
847
870
|
);
|
|
848
871
|
}
|
|
849
872
|
|
|
@@ -884,6 +907,36 @@ function frontmatterPathState(text, keyPath){
|
|
|
884
907
|
return { present: false, value: "" };
|
|
885
908
|
}
|
|
886
909
|
|
|
910
|
+
function frontmatterSequenceHasItems(text, keyPath){
|
|
911
|
+
const frontmatter = extractFrontmatter(text);
|
|
912
|
+
if (!frontmatter) return false;
|
|
913
|
+
const lines = frontmatter.split(/\r?\n/);
|
|
914
|
+
const stack = [];
|
|
915
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
916
|
+
const rawLine = lines[index];
|
|
917
|
+
if (!rawLine.trim() || rawLine.trim().startsWith("#")) continue;
|
|
918
|
+
const match = rawLine.match(/^(\s*)(["']?[^:"']+["']?)\s*:(.*)$/);
|
|
919
|
+
if (!match) continue;
|
|
920
|
+
const indent = match[1].replace(/\t/g, " ").length;
|
|
921
|
+
const key = match[2].replace(/^["']|["']$/g, "").trim();
|
|
922
|
+
while (stack.length && stack[stack.length - 1].indent >= indent) stack.pop();
|
|
923
|
+
const currentPath = [...stack.map(item => item.key), key];
|
|
924
|
+
if (currentPath.length === keyPath.length && currentPath.every((part, pathIndex) => part === keyPath[pathIndex])) {
|
|
925
|
+
const inline = match[3].trim();
|
|
926
|
+
if (/^\[(?:\s*[^\]])/.test(inline)) return true;
|
|
927
|
+
for (let child = index + 1; child < lines.length; child += 1) {
|
|
928
|
+
if (!lines[child].trim() || lines[child].trim().startsWith("#")) continue;
|
|
929
|
+
const childIndent = lines[child].match(/^\s*/)[0].replace(/\t/g, " ").length;
|
|
930
|
+
if (childIndent <= indent) return false;
|
|
931
|
+
if (/^\s*-\s+\S/.test(lines[child])) return true;
|
|
932
|
+
}
|
|
933
|
+
return false;
|
|
934
|
+
}
|
|
935
|
+
stack.push({ indent, key });
|
|
936
|
+
}
|
|
937
|
+
return false;
|
|
938
|
+
}
|
|
939
|
+
|
|
887
940
|
function legacyGateEscalationTokens(text){
|
|
888
941
|
const frontmatter = extractFrontmatter(text);
|
|
889
942
|
if (!frontmatter) return [];
|
|
@@ -1017,6 +1070,7 @@ function projectStatus(project, assetSkill, assetAgents){
|
|
|
1017
1070
|
const managedWorkflow = publicEngineeringPlan(engineeringPlan);
|
|
1018
1071
|
const managedAgentsDocument = publicEngineeringPlan(agentsDocumentPlan);
|
|
1019
1072
|
const requiredConfigPaths = [
|
|
1073
|
+
{ label: "workflow.skill_version", path: ["workflow", "skill_version"] },
|
|
1020
1074
|
{ label: "workflow.mode", path: ["workflow", "mode"] },
|
|
1021
1075
|
{ label: "workflow.profile", path: ["workflow", "profile"] },
|
|
1022
1076
|
{ label: "workflow.completion", path: ["workflow", "completion"] },
|
|
@@ -1028,6 +1082,10 @@ function projectStatus(project, assetSkill, assetAgents){
|
|
|
1028
1082
|
{ label: "concurrency.cleanup_merged", path: ["concurrency", "cleanup_merged"] },
|
|
1029
1083
|
{ label: "concurrency.delete_remote_branch", path: ["concurrency", "delete_remote_branch"] },
|
|
1030
1084
|
{ label: "concurrency.disposable_ignored", path: ["concurrency", "disposable_ignored"] },
|
|
1085
|
+
{ label: "validation.on_unmapped", path: ["validation", "on_unmapped"] },
|
|
1086
|
+
{ label: "validation.routes", path: ["validation", "routes"], sequence: true },
|
|
1087
|
+
{ label: "risk.rules", path: ["risk", "rules"] },
|
|
1088
|
+
{ label: "docs.framework", path: ["docs", "framework"], filled: true },
|
|
1031
1089
|
{ label: "project.name", path: ["project", "name"], filled: true },
|
|
1032
1090
|
{ label: "access.project.frontend.url", path: ["access", "project", "frontend", "url"], filled: true },
|
|
1033
1091
|
{ label: "access.project.frontend.username", path: ["access", "project", "frontend", "username"], filled: true },
|
|
@@ -1047,11 +1105,6 @@ function projectStatus(project, assetSkill, assetAgents){
|
|
|
1047
1105
|
{ label: "access.nexus.frontend.url", path: ["access", "nexus", "frontend", "url"], filled: true },
|
|
1048
1106
|
{ label: "access.nexus.frontend.username", path: ["access", "nexus", "frontend", "username"], filled: true },
|
|
1049
1107
|
{ label: "access.nexus.frontend.password", path: ["access", "nexus", "frontend", "password"], filled: true },
|
|
1050
|
-
{ label: "docs.taskbook", path: ["docs", "taskbook"] },
|
|
1051
|
-
{ label: "docs.closure_log", path: ["docs", "closure_log"] },
|
|
1052
|
-
{ label: "docs.active_task_dir", path: ["docs", "active_task_dir"] },
|
|
1053
|
-
{ label: "docs.task_closure_dir", path: ["docs", "task_closure_dir"] },
|
|
1054
|
-
{ label: "docs.task_evidence_dir", path: ["docs", "task_evidence_dir"] },
|
|
1055
1108
|
];
|
|
1056
1109
|
let missingConfigPaths = requiredConfigPaths.map(item => item.label);
|
|
1057
1110
|
let unfilledConfigTokens = [];
|
|
@@ -1061,7 +1114,10 @@ function projectStatus(project, assetSkill, assetAgents){
|
|
|
1061
1114
|
const states = requiredConfigPaths.map(item => ({ item, state: frontmatterPathState(text, item.path) }));
|
|
1062
1115
|
missingConfigPaths = states.filter(({ state }) => !state.present).map(({ item }) => item.label);
|
|
1063
1116
|
unfilledConfigTokens = states
|
|
1064
|
-
.filter(({ item, state }) => state.present &&
|
|
1117
|
+
.filter(({ item, state }) => state.present && (
|
|
1118
|
+
(item.filled === true && !frontmatterValueIsFilled(state.value))
|
|
1119
|
+
|| (item.sequence === true && !frontmatterSequenceHasItems(text, item.path))
|
|
1120
|
+
))
|
|
1065
1121
|
.map(({ item }) => item.label);
|
|
1066
1122
|
const isolationState = frontmatterPathState(text, ["concurrency", "isolation"]);
|
|
1067
1123
|
if (isolationState.present && !["adaptive", "worktree"].includes(frontmatterScalarValue(isolationState.value).toLowerCase())) {
|
|
@@ -1082,7 +1138,7 @@ function projectStatus(project, assetSkill, assetAgents){
|
|
|
1082
1138
|
for (const rel of CORE_DOCS) {
|
|
1083
1139
|
if (!exists(path.join(root, "docs", rel))) missingDocs.push(path.join("docs", rel));
|
|
1084
1140
|
}
|
|
1085
|
-
const skillDiffs = exists(skillDir) ? compareDirs(assetSkill, skillDir, { includeExtra:
|
|
1141
|
+
const skillDiffs = exists(skillDir) ? compareDirs(assetSkill, skillDir, { includeExtra: true }) : [{ path: ".agents/skills/auto-coding-skill", status: "missing" }];
|
|
1086
1142
|
const agentStatus = exists(agentsDir)
|
|
1087
1143
|
? compareManagedAgents(assetAgents, agentsDir)
|
|
1088
1144
|
: { diffs: [{ path: ".agents/agents", status: "missing" }], bindings: [] };
|
|
@@ -1174,6 +1230,15 @@ function syncProject(project, assetSkill, assetAgents, dryRun, resetAgentModels
|
|
|
1174
1230
|
fs.copyFileSync(path.join(assetSkill, "data", "templates", "tools", "ap.py"), path.join(toolDir, "ap.py"));
|
|
1175
1231
|
for (const copied of copyMissingDocs(assetSkill, root)) actions.push({ action: "create", path: copied });
|
|
1176
1232
|
if (plan.state !== "current") {
|
|
1233
|
+
if (plan.archiveRequired) {
|
|
1234
|
+
fs.mkdirSync(path.dirname(plan.archiveDocument), { recursive: true });
|
|
1235
|
+
fs.writeFileSync(plan.archiveDocument, plan.archiveOutput);
|
|
1236
|
+
actions.push({
|
|
1237
|
+
action: "archive",
|
|
1238
|
+
path: path.relative(root, plan.archiveDocument),
|
|
1239
|
+
detail: "previous ENGINEERING.md before duplicate workflow cleanup",
|
|
1240
|
+
});
|
|
1241
|
+
}
|
|
1177
1242
|
fs.mkdirSync(path.dirname(plan.engineering), { recursive: true });
|
|
1178
1243
|
fs.writeFileSync(plan.engineering, plan.output);
|
|
1179
1244
|
actions.push({
|
|
@@ -1183,6 +1248,15 @@ function syncProject(project, assetSkill, assetAgents, dryRun, resetAgentModels
|
|
|
1183
1248
|
});
|
|
1184
1249
|
}
|
|
1185
1250
|
if (agentsDocumentPlan.state !== "current") {
|
|
1251
|
+
if (agentsDocumentPlan.archiveRequired) {
|
|
1252
|
+
fs.mkdirSync(path.dirname(agentsDocumentPlan.archiveDocument), { recursive: true });
|
|
1253
|
+
fs.writeFileSync(agentsDocumentPlan.archiveDocument, agentsDocumentPlan.archiveOutput);
|
|
1254
|
+
actions.push({
|
|
1255
|
+
action: "archive",
|
|
1256
|
+
path: path.relative(root, agentsDocumentPlan.archiveDocument),
|
|
1257
|
+
detail: "previous root AGENTS.md; historical and non-authoritative",
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1186
1260
|
fs.writeFileSync(agentsDocumentPlan.agentsDocument, agentsDocumentPlan.output);
|
|
1187
1261
|
actions.push({
|
|
1188
1262
|
action: agentsDocumentPlan.state === "missing" ? "create" : "update",
|
|
@@ -1195,6 +1269,13 @@ function syncProject(project, assetSkill, assetAgents, dryRun, resetAgentModels
|
|
|
1195
1269
|
if (!exists(path.join(root, "docs", rel))) actions.push({ action: "would-create", path: path.join("docs", rel) });
|
|
1196
1270
|
}
|
|
1197
1271
|
if (plan.state !== "current") {
|
|
1272
|
+
if (plan.archiveRequired) {
|
|
1273
|
+
actions.push({
|
|
1274
|
+
action: "would-archive",
|
|
1275
|
+
path: path.relative(root, plan.archiveDocument),
|
|
1276
|
+
detail: "previous ENGINEERING.md before duplicate workflow cleanup",
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1198
1279
|
actions.push({
|
|
1199
1280
|
action: plan.state === "missing" ? "would-create" : "would-update",
|
|
1200
1281
|
path: path.join("docs", "ENGINEERING.md"),
|
|
@@ -1202,6 +1283,13 @@ function syncProject(project, assetSkill, assetAgents, dryRun, resetAgentModels
|
|
|
1202
1283
|
});
|
|
1203
1284
|
}
|
|
1204
1285
|
if (agentsDocumentPlan.state !== "current") {
|
|
1286
|
+
if (agentsDocumentPlan.archiveRequired) {
|
|
1287
|
+
actions.push({
|
|
1288
|
+
action: "would-archive",
|
|
1289
|
+
path: path.relative(root, agentsDocumentPlan.archiveDocument),
|
|
1290
|
+
detail: "previous root AGENTS.md; historical and non-authoritative",
|
|
1291
|
+
});
|
|
1292
|
+
}
|
|
1205
1293
|
actions.push({
|
|
1206
1294
|
action: agentsDocumentPlan.state === "missing" ? "would-create" : "would-update",
|
|
1207
1295
|
path: "AGENTS.md",
|
|
@@ -1275,13 +1363,12 @@ autocoding - install auto-coding-skill into generic .agents paths
|
|
|
1275
1363
|
Usage:
|
|
1276
1364
|
autocoding init [--mode project|global] [--dest <repo-root|.agents-dir|skill-dir>] [--force] [--reset-agent-models]
|
|
1277
1365
|
autocoding status --projects <path[,path...]> [--json]
|
|
1278
|
-
autocoding sync --projects <path[,path...]> [--
|
|
1366
|
+
autocoding sync --projects <path[,path...]> [--dry-run] [--json] [--reset-agent-models]
|
|
1279
1367
|
|
|
1280
1368
|
Examples:
|
|
1281
1369
|
autocoding init
|
|
1282
1370
|
autocoding status --projects /Users/elvis/Product/xjmate,/Users/elvis/Product/geesight
|
|
1283
1371
|
autocoding sync --projects /Users/elvis/Product/xjmate --dry-run
|
|
1284
|
-
autocoding sync --projects /Users/elvis/Product/geesight --components skill
|
|
1285
1372
|
|
|
1286
1373
|
Compatibility:
|
|
1287
1374
|
--ai <value> is accepted for old scripts and ignored.
|
|
@@ -1316,7 +1403,7 @@ Compatibility:
|
|
|
1316
1403
|
|
|
1317
1404
|
if (args.cmd === "sync") {
|
|
1318
1405
|
const projects = args.projects.length ? args.projects : [projectRoot()];
|
|
1319
|
-
|
|
1406
|
+
assertNoRegisteredTasks(projects);
|
|
1320
1407
|
const controlledPlans = new Map();
|
|
1321
1408
|
for (const project of projects) {
|
|
1322
1409
|
const root = path.resolve(project);
|