@aipper/aiws 0.0.15 → 0.0.16
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/package.json +2 -2
- package/src/commands/update.js +13 -2
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aipper/aiws",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "AI Workspace CLI (init/update/validate) for Claude Code / OpenCode / Codex / iFlow.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"aiws": "./bin/aiws.js"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@aipper/aiws-spec": "0.0.
|
|
10
|
+
"@aipper/aiws-spec": "0.0.16"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"bin",
|
package/src/commands/update.js
CHANGED
|
@@ -25,17 +25,28 @@ export async function updateCommand(options) {
|
|
|
25
25
|
const stored = JSON.parse(await readText(manifestPath));
|
|
26
26
|
const templateId = String(stored.template_id || "workspace");
|
|
27
27
|
const tpl = await loadTemplate(templateId);
|
|
28
|
+
const storedManagedByPath = new Map(
|
|
29
|
+
(Array.isArray(stored.managed) ? stored.managed : [])
|
|
30
|
+
.filter((entry) => entry && typeof entry === "object")
|
|
31
|
+
.map((entry) => [normalizeRel(String(entry.path || "")), entry]),
|
|
32
|
+
);
|
|
28
33
|
|
|
29
34
|
const update = tpl.manifest.update || {};
|
|
30
35
|
const replaceFiles = (update.replace_file || []).map(normalizeRel);
|
|
31
36
|
const managedBlocks = update.managed_blocks && typeof update.managed_blocks === "object" ? update.managed_blocks : {};
|
|
32
37
|
|
|
33
|
-
// Preflight: managed
|
|
38
|
+
// Preflight: existing managed-block files must be intact.
|
|
39
|
+
// Missing files that were not previously managed are treated as newly introduced
|
|
40
|
+
// template surfaces and will be created during applyManagedBlocksFromTemplate.
|
|
34
41
|
for (const [fileRelRaw, blockIdsRaw] of Object.entries(managedBlocks)) {
|
|
35
42
|
const fileRel = normalizeRel(fileRelRaw);
|
|
36
43
|
const abs = joinRel(workspaceRoot, fileRel);
|
|
44
|
+
const hadManagedBefore = storedManagedByPath.has(fileRel);
|
|
37
45
|
if (!(await pathExists(abs))) {
|
|
38
|
-
|
|
46
|
+
if (hadManagedBefore) {
|
|
47
|
+
throw new UserError("Managed block file missing; run `aiws init` or restore the file.", { details: `Missing: ${fileRel}` });
|
|
48
|
+
}
|
|
49
|
+
continue;
|
|
39
50
|
}
|
|
40
51
|
const text = normalizeNewlines(await readText(abs));
|
|
41
52
|
const ids = Array.isArray(blockIdsRaw) ? blockIdsRaw.map(String) : [];
|