@elvis1513/auto-coding-skill 5.0.3 → 5.0.5

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 CHANGED
@@ -1,10 +1,12 @@
1
1
  # auto-coding-skill
2
2
 
3
- `auto-coding-skill` 5.x provides detailed general engineering guidance plus a
3
+ `auto-coding-skill` 5.x provides lightweight general engineering guidance plus a
4
4
  small documentation layout. It is not a workflow engine.
5
5
 
6
- It does not require a Gate, classification, task lifecycle, worktree, Reviewer,
7
- test route, design record, Jenkins check, or deployment check.
6
+ The guidance preserves task authorization, scales verification to risk, and
7
+ defines completion by the user's requested outcome. It leaves model choice,
8
+ reasoning effort, and execution strategy to the user and runtime; it ships no
9
+ fixed agent profiles or mandatory task protocol.
8
10
 
9
11
  ## Install
10
12
 
@@ -27,13 +29,15 @@ docs/product/
27
29
  ```
28
30
 
29
31
  `docs/ENVIRONMENT.md` is managed shared context and is refreshed on each
30
- `init`/`sync`. It records common endpoints, ports, and local credential variable
31
- names. `docs/PROJECT.md` is project-owned and never overwritten; use it for
32
- project-specific configuration. Keep actual passwords only in the local,
33
- untracked credential source referenced by the environment document.
32
+ `init`/`sync`. It records common endpoints and ports without empty project
33
+ credential fields. `docs/PROJECT.md` is project-owned and never overwritten;
34
+ use it for project-specific configuration and project-approved credential
35
+ records.
34
36
 
35
- Only `AGENTS.md` and `docs/ENVIRONMENT.md` are refreshed by later `init` or
36
- `sync` runs. Project documents are created only when missing and are never
37
+ The installed `.agents/skills/auto-coding-skill/` tree, `AGENTS.md`, and
38
+ `docs/ENVIRONMENT.md` are managed and refreshed by later `init` or `sync` runs.
39
+ Put custom guidance in project-owned documents, not managed files.
40
+ Project documents are created only when missing and are never
37
41
  overwritten. Documentation is optional: record durable facts only when the user
38
42
  asks or when they will help future work. Do not create a document for every task,
39
43
  review, test, or commit.
@@ -49,3 +53,38 @@ autocoding status --projects . --json
49
53
  These commands only install, preserve, and report documentation. They never run
50
54
  project tests, validation, Gates, reviews, builds, Jenkins jobs, deployment, or
51
55
  other external-system operations.
56
+
57
+ `status` checks both install-time integrity (`integrity`) and alignment with the
58
+ running CLI's version and packaged assets (`current`). It also reports unexpected
59
+ installed skill files and recognizable legacy workflow files. `ok` is true only
60
+ when both checks pass and no leftovers need review; otherwise status exits with
61
+ code 1. This is a local comparison, not an npm registry update check or an
62
+ engineering gate. Project-owned document contents are not inspected for drift.
63
+
64
+ During upgrades, unchanged manifest-owned legacy files can be retired; the old
65
+ `docs/ENGINEERING.md` policy is archived first. Modified legacy files outside the
66
+ managed skill tree are preserved and reported across subsequent upgrades.
67
+ Unowned legacy candidates are reported, never automatically deleted. Review
68
+ their useful content before moving or removing them. Existing `docs/PROJECT.md`
69
+ is always preserved verbatim; a pre-managed environment document migrates intact
70
+ to `PROJECT.md` only when that project document is missing.
71
+
72
+ ## Developing this skill
73
+
74
+ Edit `src/auto-coding-skill/`. The repository's discoverable skill at
75
+ `.agents/skills/auto-coding-skill` links directly to this source. Keep that symlink
76
+ intact; `autocoding init` and `sync` reject this source repository so they cannot
77
+ overwrite its own development instructions. Here, `status` reports source
78
+ discovery, packaged asset alignment, and legacy leftovers instead of expecting a
79
+ project install manifest.
80
+
81
+ ```bash
82
+ npm run sync-assets
83
+ npm run release:check
84
+ ```
85
+
86
+ Before changing shared instructions, try representative requests with the
87
+ intended models: a read-only diagnosis, a focused fix, an already-authorized
88
+ delivery, and a blocked external job. Compare scope adherence, verification,
89
+ completion evidence, and unnecessary questions or repeated work. These are
90
+ evaluation scenarios, not required steps for every consuming project task.
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "schema_version": 2,
3
- "skill_version": "5.0.3",
3
+ "skill_version": "5.0.5",
4
4
  "asset_files": [
5
5
  {
6
6
  "path": "SKILL.md",
7
- "sha256": "7747fb2619f6a7f7eb1ad0a0fbcc0e09d1bc084681ab9eb61489ba894615ab0c"
7
+ "sha256": "54c28a7a3a147460b96e11d3da92e7722690e2836db3e5c35fa28dfc46c2860c"
8
8
  },
9
9
  {
10
10
  "path": "data/templates/ENVIRONMENT.md",
11
- "sha256": "daf360b44b2bb68315a201de2f82eaf2fce8e6f1e58ceefe91190c6f8916c125"
11
+ "sha256": "480b0f1095138fff10e066e06ee29b306c6fcf7e3722a798767f9dbc09e72017"
12
12
  },
13
13
  {
14
14
  "path": "data/templates/PROJECT.md",
15
- "sha256": "9e6bb774677b5d752453c09f0c22771b3075fc81969e564ee7c12bdc1310b143"
15
+ "sha256": "f311a02d02bd6a924f94cbf341ff90dba839bf70a1f97d83500a7d2660dad6c1"
16
16
  },
17
17
  {
18
18
  "path": "data/templates/architecture/.gitkeep",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  {
22
22
  "path": "data/templates/bridges/AGENTS.md",
23
- "sha256": "e46deaf34d30690a0f242a2e4c668edc9b213099cb8c37310c90400f6ba5d6d8"
23
+ "sha256": "6f3c5a2881d0b0252c7b7512f5783e9c06346656e2415be9bcec3f2070025755"
24
24
  },
25
25
  {
26
26
  "path": "data/templates/deployment/.gitkeep",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: auto-coding-skill
3
- description: General project guidance and a lightweight documentation layout. It provides context files and optional places to record durable project knowledge, without imposing a development workflow.
3
+ description: Use when a project opts into auto-coding-skill or the user asks to initialize, refresh, or inspect its project guidance and documentation. Provides context without imposing a fixed engineering workflow.
4
4
  ---
5
5
 
6
6
  # Auto Coding Skill
@@ -14,8 +14,9 @@ current request:
14
14
  - `docs/architecture/`, `docs/design/`, `docs/interfaces/`, and
15
15
  `docs/deployment/` for existing topic-specific knowledge.
16
16
 
17
- This Skill has no required task protocol. It does not require classification,
18
- Gates, Reviews, worktrees, designs, tests, commits, or deployment checks.
17
+ Use the project's guidance to choose an approach and enough verification for the
18
+ requested outcome. This Skill adds context, not a fixed task protocol or model
19
+ profile; it does not narrow existing authorization or redefine completion.
19
20
 
20
21
  Write documentation only when the user asks for it or when a durable fact,
21
22
  contract, decision, test strategy, or operating procedure would otherwise be
@@ -16,7 +16,6 @@ It contains only common endpoints, ports, and credential lookup guidance.
16
16
 
17
17
  ## Credential lookup
18
18
 
19
- Actual usernames and passwords are not stored in this document or any tracked
20
- project documentation. Read them only from the local, untracked credential source
21
- referenced by `docs/PROJECT.md`. Do not copy credentials into a repository, chat
22
- transcript, build log, or deployment artifact.
19
+ Actual usernames and passwords are project-specific information. Read them from
20
+ the credential records in `docs/PROJECT.md`; this managed environment document
21
+ intentionally contains no blank or project-specific credential fields.
@@ -4,8 +4,9 @@
4
4
  > create it only when missing and never overwrite it.
5
5
 
6
6
  Record only durable, project-specific information that helps later development
7
- or diagnosis. Do not put plaintext passwords, tokens, private keys, or other
8
- credentials here; use the local credential source reference below.
7
+ or diagnosis. This project-owned document may contain project-approved plaintext
8
+ usernames and passwords for development and diagnosis. Keep each credential next
9
+ to its system, address, and purpose; do not echo it in chat or logs.
9
10
 
10
11
  ## Project services and ports
11
12
 
@@ -16,13 +17,13 @@ credentials here; use the local credential source reference below.
16
17
  ## Shared-access overrides
17
18
 
18
19
  - Backend host or URL:
19
- - Local credential source path:
20
- - Required credential variable names:
20
+ - Credential records:
21
21
  - Access constraints:
22
22
 
23
23
  ## Runtime and operations
24
24
 
25
25
  - Local start and diagnostic entry points:
26
+ - Relevant verification commands and acceptance criteria:
26
27
  - Deployment topology:
27
28
  - Logs and metrics:
28
29
 
@@ -1,9 +1,9 @@
1
- <!-- auto-coding-skill:managed-agents:start version=5.0.0 -->
1
+ <!-- auto-coding-skill:managed-agents:start version=5.0.5 -->
2
2
  # General Engineering Guidance
3
3
 
4
4
  ## Authority and scope
5
5
 
6
- Use the current user request as the primary authority. Treat the current source,
6
+ Follow the user's current goal and applicable instructions. Treat the current source,
7
7
  tests, schemas, runtime configuration, and deployment configuration as the truth
8
8
  for existing behavior. Documentation describes durable intent and operating
9
9
  context; it must not override working code without an explicit decision.
@@ -13,16 +13,28 @@ Jenkins, production data, credentials, infrastructure, or another developer's
13
13
  work. When a shared checkout contains unrelated changes, preserve them and avoid
14
14
  reset, clean, overwrite, or bulk formatting operations.
15
15
 
16
+ Carry forward earlier authorization that still applies to this task, unless the
17
+ user changes or revokes it. Act on clear, reversible steps within that scope;
18
+ ask when missing information or new authority would materially change the result.
19
+ An assessment or diagnosis alone does not authorize implementation or deployment.
20
+
16
21
  ## Development approach
17
22
 
18
- Choose the smallest useful approach for the request. Work directly for ordinary
19
- changes. Use a branch, worktree, tests, review, design note, or diagnostic only
20
- when the task or repository makes it useful; none is required by this guidance.
23
+ Choose an approach suited to the request's complexity and risk. Work directly
24
+ for ordinary changes; use isolation, design, review, or parallel work when useful
25
+ and allowed by the task and runtime. Model choice and reasoning effort belong to
26
+ the user and runtime, not to a fixed profile in this Skill.
27
+
28
+ Verify the changed behavior and relevant failure paths with evidence proportionate
29
+ to the risk. Start with focused checks and broaden when impact or findings justify
30
+ it. Honor required project checks; avoid repeating an unchanged check without a
31
+ reason. State what was verified and any remaining uncertainty.
21
32
 
22
- Do not treat a test, build, lint, review, commit, push, Jenkins run, deployment,
23
- or target check as mandatory completion ceremony. Run a check when the user asks,
24
- when the project explicitly needs it, or when it is the proportionate way to
25
- answer a technical question. State clearly what was and was not verified.
33
+ Completion follows the requested outcome. Editing, committing, pushing, CI, and
34
+ deployment are distinct results: complete the authorized parts the goal requires
35
+ and report the evidence for each. A launched command or background job is not a
36
+ successful result; follow required work to its terminal state. If that is not
37
+ possible, report the specific blocker or pending state without claiming completion.
26
38
 
27
39
  ## Documentation
28
40
 
@@ -46,9 +58,8 @@ of creating parallel summaries.
46
58
 
47
59
  `docs/ENVIRONMENT.md` is shared managed context: it names endpoint ports and
48
60
  credential lookup guidance, but never contains plaintext credentials. Project
49
- specific configuration belongs in `docs/PROJECT.md`; it may name the local,
50
- untracked credential source and required variable names, but never stores the
51
- values. It is preserved across Skill upgrades. Never invent credentials, copy
52
- them into chat output, or expose them in logs.
61
+ specific configuration belongs in `docs/PROJECT.md`; it is preserved across
62
+ Skill upgrades and may hold project-approved plaintext credential records. Never
63
+ invent credentials, copy them into chat output, or expose them in logs.
53
64
 
54
65
  <!-- auto-coding-skill:managed-agents:end -->
package/cli/src/index.js CHANGED
@@ -60,102 +60,87 @@ function parseArgs(argv) {
60
60
  }
61
61
 
62
62
  function readManifest(project) {
63
- const file = path.join(project, ".agents", "managed-install.json");
64
- if (!exists(file)) return null;
63
+ const file = managedTarget(project, ".agents/managed-install.json");
64
+ if (!file || !exists(file)) return null;
65
65
  try { return JSON.parse(fs.readFileSync(file, "utf8")); } catch { return null; }
66
66
  }
67
67
 
68
+ function safeRelativePath(relative) {
69
+ return typeof relative === "string" && relative.length > 0
70
+ && !relative.includes("\\") && !relative.includes("\0")
71
+ && !relative.includes(":")
72
+ && relative.split("/").every(part => part && part !== "." && part !== "..");
73
+ }
74
+
75
+ // Managed paths must stay inside the project, including through parent symlinks.
76
+ function managedTarget(project, relative) {
77
+ if (!safeRelativePath(relative)) return null;
78
+ let target = project;
79
+ for (const part of relative.split("/")) {
80
+ target = path.join(target, part);
81
+ try { if (fs.lstatSync(target).isSymbolicLink()) return null; }
82
+ catch (error) { if (error.code !== "ENOENT") return null; }
83
+ }
84
+ return target;
85
+ }
86
+
87
+ function sourceRepository(project) {
88
+ return exists(path.join(project, "src/auto-coding-skill/SKILL.md"))
89
+ && exists(path.join(project, "cli/src/index.js"));
90
+ }
91
+
68
92
  function legacyManagedPath(relative) {
69
- return relative.startsWith(".agents/skills/auto-coding-skill/")
93
+ return safeRelativePath(relative) && (relative.startsWith(".agents/skills/auto-coding-skill/")
70
94
  || relative.startsWith(".agents/agents/")
71
95
  || relative === "docs/tools/autopipeline/ap.py"
72
- || relative === "docs/ENGINEERING.md";
96
+ || relative === "docs/ENGINEERING.md");
73
97
  }
74
98
 
75
99
  function retireExactLegacyFiles(project) {
76
100
  const previous = readManifest(project);
77
101
  const retired = [];
78
- if (!Array.isArray(previous?.entries)) return retired;
79
- for (const entry of previous.entries) {
102
+ const retained = [];
103
+ const entries = [...(Array.isArray(previous?.entries) ? previous.entries : []),
104
+ ...(Array.isArray(previous?.legacy_entries) ? previous.legacy_entries : [])];
105
+ for (const entry of entries) {
80
106
  if (!legacyManagedPath(entry?.path) || typeof entry.sha256 !== "string") continue;
81
- const target = path.join(project, ...entry.path.split("/"));
107
+ const target = managedTarget(project, entry.path);
108
+ if (!target) continue;
82
109
  if (exists(target) && fs.statSync(target).isFile() && sha256(target) === entry.sha256) {
83
110
  if (entry.path === "docs/ENGINEERING.md") {
84
111
  const version = String(previous.skill_version || "legacy").replace(/[^0-9A-Za-z._-]/g, "_");
85
- const archive = path.join(project, ".agents", "archive", "auto-coding-skill", version, "docs", "ENGINEERING.md");
112
+ const archive = managedTarget(project, `.agents/archive/auto-coding-skill/${version}/docs/ENGINEERING.md`);
113
+ if (!archive) fail("unsafe legacy archive path; no policy file was removed");
86
114
  copyFile(target, archive);
87
115
  }
88
116
  fs.rmSync(target);
89
117
  retired.push(entry.path);
118
+ } else if (exists(target) && !entry.path.startsWith(".agents/skills/auto-coding-skill/")) {
119
+ retained.push(entry);
90
120
  }
91
121
  }
92
- return retired;
122
+ return { retired, retained };
93
123
  }
94
124
 
95
125
  function isManaged(previous, relative) {
96
126
  return Array.isArray(previous?.entries) && previous.entries.some(entry => entry?.path === relative && entry?.ownership === "managed");
97
127
  }
98
128
 
99
- function stripLegacyAccessConfiguration(text) {
100
- return text.replace(/\n?## Migrated access configuration\s*\n```yaml\n[\s\S]*?\n```\s*/g, "\n").trim();
101
- }
102
-
103
- function stripCredentialMaterial(text) {
104
- const lines = stripLegacyAccessConfiguration(text).split(/\r?\n/);
105
- const output = [];
106
- let noted = false;
107
- const note = () => {
108
- if (!noted) output.push("> Credential values are local-only; see the credential source reference below.");
109
- noted = true;
110
- };
111
- for (let index = 0; index < lines.length; index += 1) {
112
- const line = lines[index];
113
- if (/^\|.*\b(password|token|secret|credential|private[ _-]?key)\b/i.test(line)) {
114
- while (index < lines.length && /^\|/.test(lines[index])) index += 1;
115
- index -= 1;
116
- note();
117
- continue;
118
- }
119
- if (/^```/.test(line)) {
120
- const block = [line];
121
- while (index + 1 < lines.length) {
122
- index += 1;
123
- block.push(lines[index]);
124
- if (/^```/.test(lines[index])) break;
125
- }
126
- if (block.some(item => /\b(password|token|secret|private[ _-]?key)\b\s*[:=]/i.test(item))) note();
127
- else output.push(...block);
128
- continue;
129
- }
130
- if (/\b(password|token|secret|private[ _-]?key)\b.*(?:[:=]|\|)/i.test(line)) {
131
- note();
132
- continue;
133
- }
134
- output.push(line);
135
- }
136
- return output.join("\n").replace(/\n{3,}/g, "\n\n").trim();
137
- }
138
-
139
129
  function migrateLegacyEnvironment(project) {
140
130
  const previous = readManifest(project);
141
131
  const environment = path.join(project, "docs", "ENVIRONMENT.md");
142
132
  const projectConfig = path.join(project, "docs", "PROJECT.md");
143
- if (exists(projectConfig)) {
144
- const existing = fs.readFileSync(projectConfig, "utf8");
145
- const cleaned = stripCredentialMaterial(existing);
146
- if (cleaned !== existing.trim()) fs.writeFileSync(projectConfig, `${cleaned}\n`);
147
- return false;
148
- }
133
+ if (exists(projectConfig)) return false;
149
134
  if (!exists(environment) || isManaged(previous, "docs/ENVIRONMENT.md")) return false;
150
- const legacy = stripCredentialMaterial(fs.readFileSync(environment, "utf8"));
151
- if (!legacy) return false;
135
+ const legacy = fs.readFileSync(environment, "utf8");
136
+ if (!legacy.trim()) return false;
152
137
  const template = fs.readFileSync(path.join(assetSkill, "data", "templates", "PROJECT.md"), "utf8").trimEnd();
153
138
  mkdirFor(projectConfig);
154
139
  fs.writeFileSync(projectConfig, `${template}\n\n## Migrated pre-5.0.1 environment context\n\n${legacy}\n`);
155
140
  return true;
156
141
  }
157
142
 
158
- function buildManifest(project) {
143
+ function buildManifest(project, retained) {
159
144
  const entries = [];
160
145
  const installedSkill = path.join(project, ".agents", "skills", "auto-coding-skill");
161
146
  for (const relative of listFiles(installedSkill)) {
@@ -170,6 +155,7 @@ function buildManifest(project) {
170
155
  schema_version: 3,
171
156
  skill_version: pkg.version,
172
157
  entries,
158
+ legacy_entries: retained,
173
159
  managed_documents: managedDocs.map(([, target]) => target),
174
160
  project_documents: projectDocs.map(([, target]) => target),
175
161
  note: "AGENTS.md and docs/ENVIRONMENT.md are refreshed by init/sync. Project documents are bootstrap-only and are never overwritten.",
@@ -179,7 +165,11 @@ function buildManifest(project) {
179
165
  function init(project) {
180
166
  const root = path.resolve(project);
181
167
  if (!exists(root)) fail(`project directory does not exist: ${root}`);
182
- const retired = retireExactLegacyFiles(root);
168
+ if (sourceRepository(root)) fail("this is the skill source repository; use npm run sync-assets and npm run release:check, not init/sync");
169
+ for (const relative of [".agents/skills/auto-coding-skill", ".agents/managed-install.json", "AGENTS.md", ...bootstrapDocs.map(([, target]) => target)]) {
170
+ if (!managedTarget(root, relative)) fail(`unsafe install path (symlink or invalid path): ${relative}`);
171
+ }
172
+ const { retired, retained } = retireExactLegacyFiles(root);
183
173
  const installedSkill = path.join(root, ".agents", "skills", "auto-coding-skill");
184
174
  fs.rmSync(installedSkill, { recursive: true, force: true });
185
175
  copyTree(assetSkill, installedSkill);
@@ -198,26 +188,116 @@ function init(project) {
198
188
  created.push(targetRelative);
199
189
  }
200
190
  }
201
- const manifest = buildManifest(root);
191
+ const manifest = buildManifest(root, retained);
202
192
  const manifestPath = path.join(root, ".agents", "managed-install.json");
203
193
  mkdirFor(manifestPath);
204
194
  fs.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
205
- return { project: root, version: pkg.version, created, retired, migrated_environment: migratedEnvironment, managed: manifest.entries.length };
195
+ return { project: root, version: pkg.version, created, retired, legacy_files: legacyFiles(root, manifest), migrated_environment: migratedEnvironment, managed: manifest.entries.length };
196
+ }
197
+
198
+ function expectedEntries() {
199
+ return [...listFiles(assetSkill).map(relative => ({
200
+ path: `.agents/skills/auto-coding-skill/${relative}`, sha256: sha256(path.join(assetSkill, relative)),
201
+ })), { path: "AGENTS.md", sha256: sha256(assetAgents) },
202
+ ...managedDocs.map(([source, target]) => ({ path: target, sha256: sha256(path.join(assetSkill, "data/templates", source)) }))];
203
+ }
204
+
205
+ function legacyFiles(project, manifest) {
206
+ const candidates = new Set(["docs/tools/autopipeline/ap.py"]);
207
+ for (const entry of Array.isArray(manifest?.legacy_entries) ? manifest.legacy_entries : []) {
208
+ if (legacyManagedPath(entry?.path)) candidates.add(entry.path);
209
+ }
210
+ const agents = managedTarget(project, ".agents/agents");
211
+ const scan = ["docs/ENGINEERING.md"];
212
+ if (agents && exists(agents) && fs.statSync(agents).isDirectory()) {
213
+ scan.push(...fs.readdirSync(agents).filter(file => file.endsWith(".toml")).map(file => `.agents/agents/${file}`));
214
+ }
215
+ for (const relative of scan) {
216
+ const target = managedTarget(project, relative);
217
+ if (!target || !exists(target) || !fs.statSync(target).isFile()) continue;
218
+ const text = fs.readFileSync(target, "utf8");
219
+ if (/orchestration-v1\.schema\.json|ap\.py classify|docs\/tools\/autopipeline\//.test(text)
220
+ || (relative === "docs/ENGINEERING.md" && text.includes("auto-coding-skill"))) candidates.add(relative);
221
+ }
222
+ return [...candidates].filter(relative => {
223
+ const target = managedTarget(project, relative);
224
+ return target && exists(target);
225
+ }).sort();
226
+ }
227
+
228
+ function sourceStatus(root) {
229
+ const errors = [];
230
+ const source = path.join(root, "src/auto-coding-skill");
231
+ const packaged = path.join(root, "cli/assets/skill");
232
+ const discovery = path.join(root, ".agents/skills/auto-coding-skill");
233
+ if (!exists(discovery) || fs.realpathSync(discovery) !== fs.realpathSync(source)) {
234
+ errors.push("source skill discovery must link to src/auto-coding-skill");
235
+ }
236
+ const sources = listFiles(source);
237
+ const assets = exists(packaged) ? listFiles(packaged) : [];
238
+ if (JSON.stringify(sources) !== JSON.stringify(assets)
239
+ || sources.some(relative => !exists(path.join(packaged, relative)) || sha256(path.join(source, relative)) !== sha256(path.join(packaged, relative)))) {
240
+ errors.push("packaged skill differs from source; run npm run sync-assets");
241
+ }
242
+ let version = "";
243
+ try {
244
+ version = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8")).version;
245
+ const assetManifest = JSON.parse(fs.readFileSync(path.join(root, "cli/assets/managed-install.json"), "utf8"));
246
+ const expected = sources.map(relative => ({ path: relative, sha256: sha256(path.join(source, relative)) }));
247
+ if (assetManifest.schema_version !== 2 || assetManifest.skill_version !== version
248
+ || JSON.stringify(assetManifest.asset_files) !== JSON.stringify(expected)) {
249
+ errors.push("packaged asset manifest differs from source; run npm run sync-assets");
250
+ }
251
+ } catch { errors.push("source package or asset manifest is missing or invalid"); }
252
+ const legacy = legacyFiles(root, null);
253
+ errors.push(...legacy.map(file => `legacy workflow file requires review: ${file}`));
254
+ return { project: root, mode: "source", version, ok: errors.length === 0, errors, legacy_files: legacy };
206
255
  }
207
256
 
208
257
  function status(project) {
209
258
  const root = path.resolve(project);
259
+ if (sourceRepository(root)) return sourceStatus(root);
210
260
  const manifest = readManifest(root);
211
- const errors = [];
212
- if (!manifest) errors.push("managed install manifest is missing");
261
+ const integrityErrors = [];
262
+ const currentErrors = [];
263
+ if (!manifest) integrityErrors.push("managed install manifest is missing or invalid");
213
264
  const entries = Array.isArray(manifest?.entries) ? manifest.entries : [];
265
+ if (!entries.length) integrityErrors.push("managed install manifest has no entries");
266
+ const seen = new Set();
267
+ for (const entry of entries) {
268
+ const target = managedTarget(root, entry?.path);
269
+ if (!target || !/^[a-f0-9]{64}$/.test(entry?.sha256) || seen.has(entry.path)) {
270
+ integrityErrors.push("invalid, duplicate, or unsafe managed manifest entry");
271
+ continue;
272
+ }
273
+ seen.add(entry.path);
274
+ if (!exists(target) || !fs.statSync(target).isFile()) integrityErrors.push(`missing managed file: ${entry.path}`);
275
+ else if (sha256(target) !== entry.sha256) integrityErrors.push(`modified managed file: ${entry.path}`);
276
+ }
277
+ if (manifest?.skill_version !== pkg.version) currentErrors.push(`installed version ${manifest?.skill_version || "unknown"} differs from CLI ${pkg.version}`);
278
+ if (manifest?.schema_version !== 3) currentErrors.push("managed manifest schema needs refresh");
279
+ const expected = expectedEntries();
280
+ const expectedPaths = new Set(expected.map(entry => entry.path));
281
+ for (const entry of expected) {
282
+ const recorded = entries.find(item => item?.path === entry.path);
283
+ if (!recorded || recorded.sha256 !== entry.sha256 || recorded.ownership !== "managed") currentErrors.push(`manifest differs from current asset: ${entry.path}`);
284
+ const target = managedTarget(root, entry.path);
285
+ if (!target || !exists(target) || !fs.statSync(target).isFile() || sha256(target) !== entry.sha256) currentErrors.push(`installed file differs from current asset: ${entry.path}`);
286
+ }
214
287
  for (const entry of entries) {
215
- const target = path.join(root, ...entry.path.split("/"));
216
- if (!exists(target)) errors.push(`missing managed file: ${entry.path}`);
217
- else if (sha256(target) !== entry.sha256) errors.push(`modified managed file: ${entry.path}`);
288
+ if (safeRelativePath(entry?.path) && !expectedPaths.has(entry.path)) currentErrors.push(`obsolete managed entry: ${entry.path}`);
218
289
  }
290
+ const skill = managedTarget(root, ".agents/skills/auto-coding-skill");
291
+ const extra = skill && exists(skill) && fs.statSync(skill).isDirectory()
292
+ ? listFiles(skill).map(file => `.agents/skills/auto-coding-skill/${file}`).filter(file => !expectedPaths.has(file)) : [];
293
+ currentErrors.push(...extra.map(file => `unexpected installed skill file: ${file}`));
294
+ const legacy = legacyFiles(root, manifest);
295
+ currentErrors.push(...legacy.map(file => `legacy workflow file requires review: ${file}`));
296
+ const errors = [...integrityErrors, ...currentErrors];
219
297
  const documents = Object.fromEntries(bootstrapDocs.map(([, target]) => [target, exists(path.join(root, target))]));
220
- return { project: root, version: manifest?.skill_version || "", ok: errors.length === 0, errors, documents };
298
+ return { project: root, version: manifest?.skill_version || "", expected_version: pkg.version,
299
+ integrity: integrityErrors.length === 0, current: currentErrors.length === 0, ok: errors.length === 0,
300
+ errors, legacy_files: legacy, unexpected_files: extra, documents };
221
301
  }
222
302
 
223
303
  function help() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elvis1513/auto-coding-skill",
3
- "version": "5.0.3",
4
- "description": "CLI installer for project-owned engineering constitution, environment, and change-record documentation.",
3
+ "version": "5.0.5",
4
+ "description": "Lightweight engineering guidance and a managed installer that preserves project-owned documentation.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "autocoding": "cli/src/index.js"
@@ -31,9 +31,9 @@
31
31
  "agents",
32
32
  "skill",
33
33
  "documentation",
34
- "engineering-constitution",
34
+ "engineering-guidance",
35
35
  "environment-notes",
36
- "change-log"
36
+ "project-context"
37
37
  ],
38
38
  "repository": {
39
39
  "type": "git",