@aipper/aiws 0.0.29 → 0.0.30
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/bin/aiws.js +2 -2
- package/dist/aiws-package.d.ts +4 -0
- package/dist/aiws-package.js +11 -0
- package/dist/aiws-package.js.map +1 -0
- package/dist/aiws-paths.d.ts +48 -0
- package/dist/aiws-paths.js +129 -0
- package/dist/aiws-paths.js.map +1 -0
- package/dist/backup.d.ts +27 -0
- package/dist/backup.js +125 -0
- package/dist/backup.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +773 -0
- package/dist/cli.js.map +1 -0
- package/dist/codex-prompts.d.ts +17 -0
- package/dist/codex-prompts.js +49 -0
- package/dist/codex-prompts.js.map +1 -0
- package/dist/codex-skills.d.ts +17 -0
- package/dist/codex-skills.js +75 -0
- package/dist/codex-skills.js.map +1 -0
- package/dist/commands/change-advice.d.ts +25 -0
- package/dist/commands/change-advice.js +197 -0
- package/dist/commands/change-advice.js.map +1 -0
- package/dist/commands/change-evidence-command.d.ts +29 -0
- package/dist/commands/change-evidence-command.js +213 -0
- package/dist/commands/change-evidence-command.js.map +1 -0
- package/dist/commands/change-evidence-entry.d.ts +16 -0
- package/dist/commands/change-evidence-entry.js +35 -0
- package/dist/commands/change-evidence-entry.js.map +1 -0
- package/dist/commands/change-evidence.d.ts +108 -0
- package/dist/commands/change-evidence.js +341 -0
- package/dist/commands/change-evidence.js.map +1 -0
- package/dist/commands/change-finish.d.ts +71 -0
- package/dist/commands/change-finish.js +387 -0
- package/dist/commands/change-finish.js.map +1 -0
- package/dist/commands/change-git-status.d.ts +22 -0
- package/dist/commands/change-git-status.js +50 -0
- package/dist/commands/change-git-status.js.map +1 -0
- package/dist/commands/change-lifecycle-entry.d.ts +29 -0
- package/{src → dist}/commands/change-lifecycle-entry.js +21 -28
- package/dist/commands/change-lifecycle-entry.js.map +1 -0
- package/dist/commands/change-lifecycle.d.ts +56 -0
- package/dist/commands/change-lifecycle.js +211 -0
- package/dist/commands/change-lifecycle.js.map +1 -0
- package/dist/commands/change-metrics-command.d.ts +12 -0
- package/dist/commands/change-metrics-command.js +110 -0
- package/dist/commands/change-metrics-command.js.map +1 -0
- package/dist/commands/change-next-command.d.ts +18 -0
- package/dist/commands/change-next-command.js +138 -0
- package/dist/commands/change-next-command.js.map +1 -0
- package/dist/commands/change-review-gates.d.ts +107 -0
- package/dist/commands/change-review-gates.js +329 -0
- package/dist/commands/change-review-gates.js.map +1 -0
- package/dist/commands/change-scope-gate.d.ts +21 -0
- package/dist/commands/change-scope-gate.js +32 -0
- package/dist/commands/change-scope-gate.js.map +1 -0
- package/dist/commands/change-start.d.ts +30 -0
- package/dist/commands/change-start.js +91 -0
- package/dist/commands/change-start.js.map +1 -0
- package/dist/commands/change-state-command.d.ts +3 -0
- package/dist/commands/change-state-command.js +32 -0
- package/dist/commands/change-state-command.js.map +1 -0
- package/dist/commands/change-status-command.d.ts +13 -0
- package/dist/commands/change-status-command.js +126 -0
- package/dist/commands/change-status-command.js.map +1 -0
- package/dist/commands/change-status-context.d.ts +58 -0
- package/dist/commands/change-status-context.js +166 -0
- package/dist/commands/change-status-context.js.map +1 -0
- package/dist/commands/change-task-stats.d.ts +24 -0
- package/dist/commands/change-task-stats.js +66 -0
- package/dist/commands/change-task-stats.js.map +1 -0
- package/dist/commands/change-validate-entry.d.ts +17 -0
- package/dist/commands/change-validate-entry.js +44 -0
- package/dist/commands/change-validate-entry.js.map +1 -0
- package/dist/commands/change-validate.d.ts +32 -0
- package/dist/commands/change-validate.js +128 -0
- package/dist/commands/change-validate.js.map +1 -0
- package/dist/commands/change.d.ts +322 -0
- package/dist/commands/change.js +1731 -0
- package/dist/commands/change.js.map +1 -0
- package/dist/commands/codex-install-prompts.d.ts +4 -0
- package/dist/commands/codex-install-prompts.js +68 -0
- package/dist/commands/codex-install-prompts.js.map +1 -0
- package/dist/commands/codex-install-skills.d.ts +4 -0
- package/dist/commands/codex-install-skills.js +74 -0
- package/dist/commands/codex-install-skills.js.map +1 -0
- package/dist/commands/codex-status-prompts.d.ts +4 -0
- package/dist/commands/codex-status-prompts.js +44 -0
- package/dist/commands/codex-status-prompts.js.map +1 -0
- package/dist/commands/codex-status-skills.d.ts +4 -0
- package/dist/commands/codex-status-skills.js +54 -0
- package/dist/commands/codex-status-skills.js.map +1 -0
- package/dist/commands/codex-uninstall-prompts.d.ts +4 -0
- package/dist/commands/codex-uninstall-prompts.js +51 -0
- package/dist/commands/codex-uninstall-prompts.js.map +1 -0
- package/dist/commands/codex-uninstall-skills.d.ts +4 -0
- package/dist/commands/codex-uninstall-skills.js +59 -0
- package/dist/commands/codex-uninstall-skills.js.map +1 -0
- package/dist/commands/dashboard.d.ts +222 -0
- package/dist/commands/dashboard.js +193 -0
- package/dist/commands/dashboard.js.map +1 -0
- package/dist/commands/hooks-install.d.ts +4 -0
- package/dist/commands/hooks-install.js +90 -0
- package/dist/commands/hooks-install.js.map +1 -0
- package/dist/commands/hooks-status.d.ts +4 -0
- package/dist/commands/hooks-status.js +89 -0
- package/dist/commands/hooks-status.js.map +1 -0
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.js +100 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/opencode-auto.d.ts +11 -0
- package/dist/commands/opencode-auto.js +158 -0
- package/dist/commands/opencode-auto.js.map +1 -0
- package/dist/commands/opencode-status.d.ts +4 -0
- package/dist/commands/opencode-status.js +75 -0
- package/dist/commands/opencode-status.js.map +1 -0
- package/dist/commands/opencode-supervise.d.ts +24 -0
- package/dist/commands/opencode-supervise.js +188 -0
- package/dist/commands/opencode-supervise.js.map +1 -0
- package/dist/commands/rollback.d.ts +4 -0
- package/dist/commands/rollback.js +12 -0
- package/dist/commands/rollback.js.map +1 -0
- package/dist/commands/update.d.ts +4 -0
- package/dist/commands/update.js +212 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/validate.d.ts +4 -0
- package/dist/commands/validate.js +222 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/commands/ws-commit.d.ts +5 -0
- package/dist/commands/ws-commit.js +39 -0
- package/dist/commands/ws-commit.js.map +1 -0
- package/dist/commands/ws-deliver.d.ts +5 -0
- package/dist/commands/ws-deliver.js +59 -0
- package/dist/commands/ws-deliver.js.map +1 -0
- package/dist/commands/ws-finish.d.ts +5 -0
- package/dist/commands/ws-finish.js +142 -0
- package/dist/commands/ws-finish.js.map +1 -0
- package/dist/commands/ws-handoff.d.ts +5 -0
- package/dist/commands/ws-handoff.js +35 -0
- package/dist/commands/ws-handoff.js.map +1 -0
- package/dist/commands/ws-migrate.d.ts +5 -0
- package/dist/commands/ws-migrate.js +41 -0
- package/dist/commands/ws-migrate.js.map +1 -0
- package/dist/commands/ws-plan-verify.d.ts +5 -0
- package/dist/commands/ws-plan-verify.js +38 -0
- package/dist/commands/ws-plan-verify.js.map +1 -0
- package/dist/commands/ws-pull.d.ts +5 -0
- package/dist/commands/ws-pull.js +26 -0
- package/dist/commands/ws-pull.js.map +1 -0
- package/dist/commands/ws-push.d.ts +5 -0
- package/dist/commands/ws-push.js +68 -0
- package/dist/commands/ws-push.js.map +1 -0
- package/dist/commands/ws-submodule-setup.d.ts +5 -0
- package/dist/commands/ws-submodule-setup.js +55 -0
- package/dist/commands/ws-submodule-setup.js.map +1 -0
- package/dist/commands/ws-verify-before-complete.d.ts +5 -0
- package/dist/commands/ws-verify-before-complete.js +35 -0
- package/dist/commands/ws-verify-before-complete.js.map +1 -0
- package/dist/dashboard/app.d.ts +1 -0
- package/dist/dashboard/app.js +370 -0
- package/dist/dashboard/app.js.map +1 -0
- package/dist/delegation/cli.d.ts +6 -0
- package/dist/delegation/cli.js +14 -0
- package/dist/delegation/cli.js.map +1 -0
- package/dist/delegation/index.d.ts +35 -0
- package/dist/delegation/index.js +118 -0
- package/dist/delegation/index.js.map +1 -0
- package/dist/errors.d.ts +8 -0
- package/dist/errors.js +11 -0
- package/dist/errors.js.map +1 -0
- package/dist/exec.d.ts +9 -0
- package/dist/exec.js +22 -0
- package/dist/exec.js.map +1 -0
- package/dist/fs.d.ts +9 -0
- package/dist/fs.js +62 -0
- package/dist/fs.js.map +1 -0
- package/dist/governance.d.ts +10 -0
- package/dist/governance.js +135 -0
- package/dist/governance.js.map +1 -0
- package/dist/hash.d.ts +3 -0
- package/dist/hash.js +13 -0
- package/dist/hash.js.map +1 -0
- package/dist/hooks/deploy-claude.d.ts +13 -0
- package/dist/hooks/deploy-claude.js +67 -0
- package/dist/hooks/deploy-claude.js.map +1 -0
- package/dist/journal.d.ts +22 -0
- package/dist/journal.js +112 -0
- package/dist/journal.js.map +1 -0
- package/dist/json-schema-lite.d.ts +22 -0
- package/dist/json-schema-lite.js +148 -0
- package/dist/json-schema-lite.js.map +1 -0
- package/dist/managed-blocks.d.ts +24 -0
- package/dist/managed-blocks.js +84 -0
- package/dist/managed-blocks.js.map +1 -0
- package/dist/manifest.d.ts +24 -0
- package/dist/manifest.js +145 -0
- package/dist/manifest.js.map +1 -0
- package/dist/opencode-env.d.ts +62 -0
- package/dist/opencode-env.js +178 -0
- package/dist/opencode-env.js.map +1 -0
- package/dist/path-utils.d.ts +2 -0
- package/dist/path-utils.js +8 -0
- package/dist/path-utils.js.map +1 -0
- package/dist/spec.d.ts +17 -0
- package/dist/spec.js +174 -0
- package/dist/spec.js.map +1 -0
- package/dist/template.d.ts +20 -0
- package/dist/template.js +123 -0
- package/dist/template.js.map +1 -0
- package/dist/workspace.d.ts +4 -0
- package/dist/workspace.js +19 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +11 -3
- package/src/aiws-package.js +0 -15
- package/src/backup.js +0 -149
- package/src/cli.js +0 -760
- package/src/codex-prompts.js +0 -74
- package/src/codex-skills.js +0 -111
- package/src/commands/change-advice.js +0 -181
- package/src/commands/change-evidence-command.js +0 -242
- package/src/commands/change-evidence-entry.js +0 -40
- package/src/commands/change-evidence.js +0 -340
- package/src/commands/change-finish.js +0 -413
- package/src/commands/change-git-status.js +0 -53
- package/src/commands/change-lifecycle.js +0 -236
- package/src/commands/change-metrics-command.js +0 -110
- package/src/commands/change-next-command.js +0 -133
- package/src/commands/change-review-gates.js +0 -331
- package/src/commands/change-scope-gate.js +0 -34
- package/src/commands/change-start.js +0 -85
- package/src/commands/change-state-command.js +0 -40
- package/src/commands/change-status-command.js +0 -125
- package/src/commands/change-status-context.js +0 -173
- package/src/commands/change-task-stats.js +0 -64
- package/src/commands/change-validate-entry.js +0 -45
- package/src/commands/change-validate.js +0 -127
- package/src/commands/change.js +0 -1829
- package/src/commands/codex-install-prompts.js +0 -68
- package/src/commands/codex-install-skills.js +0 -74
- package/src/commands/codex-status-prompts.js +0 -55
- package/src/commands/codex-status-skills.js +0 -63
- package/src/commands/codex-uninstall-prompts.js +0 -55
- package/src/commands/codex-uninstall-skills.js +0 -62
- package/src/commands/dashboard.js +0 -205
- package/src/commands/hooks-install.js +0 -92
- package/src/commands/hooks-status.js +0 -95
- package/src/commands/init.js +0 -101
- package/src/commands/opencode-auto.js +0 -167
- package/src/commands/opencode-status.js +0 -103
- package/src/commands/opencode-supervise.js +0 -200
- package/src/commands/rollback.js +0 -13
- package/src/commands/update.js +0 -145
- package/src/commands/validate.js +0 -228
- package/src/commands/ws-commit.js +0 -44
- package/src/commands/ws-deliver.js +0 -67
- package/src/commands/ws-finish.js +0 -83
- package/src/commands/ws-handoff.js +0 -40
- package/src/commands/ws-migrate.js +0 -41
- package/src/commands/ws-plan-verify.js +0 -44
- package/src/commands/ws-pull.js +0 -30
- package/src/commands/ws-push.js +0 -71
- package/src/commands/ws-submodule-setup.js +0 -65
- package/src/commands/ws-verify-before-complete.js +0 -39
- package/src/dashboard/app.js +0 -371
- package/src/errors.js +0 -15
- package/src/exec.js +0 -34
- package/src/fs.js +0 -91
- package/src/governance.js +0 -159
- package/src/hash.js +0 -25
- package/src/json-schema-lite.js +0 -164
- package/src/managed-blocks.js +0 -131
- package/src/manifest.js +0 -177
- package/src/opencode-env.js +0 -208
- package/src/path-utils.js +0 -20
- package/src/spec.js +0 -195
- package/src/template.js +0 -187
- package/src/workspace.js +0 -23
- /package/{src → dist}/dashboard/index.html +0 -0
- /package/{src → dist}/dashboard/style.css +0 -0
package/src/template.js
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import fs from "node:fs/promises";
|
|
3
|
-
import { listFilesRecursive, pathExists, copyFile, readText, writeText, ensureDir } from "./fs.js";
|
|
4
|
-
import { normalizeRel, joinRel } from "./path-utils.js";
|
|
5
|
-
import { normalizeNewlines } from "./hash.js";
|
|
6
|
-
import { extractTemplateBlock, upsertManagedBlock } from "./managed-blocks.js";
|
|
7
|
-
import { UserError } from "./errors.js";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Extract a leading YAML frontmatter chunk when present.
|
|
11
|
-
*
|
|
12
|
-
* @param {string} text normalized
|
|
13
|
-
* @returns {{ chunk: string, rest: string } | null}
|
|
14
|
-
*/
|
|
15
|
-
function extractLeadingFrontmatter(text) {
|
|
16
|
-
const t = normalizeNewlines(text);
|
|
17
|
-
if (!t.startsWith("---\n")) return null;
|
|
18
|
-
const end = t.indexOf("\n---\n", 4);
|
|
19
|
-
if (end === -1) return null;
|
|
20
|
-
const closeEnd = end + "\n---\n".length;
|
|
21
|
-
return {
|
|
22
|
-
chunk: t.slice(0, closeEnd),
|
|
23
|
-
rest: t.slice(closeEnd),
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Keep command metadata in sync without overwriting managed-block files wholesale.
|
|
29
|
-
*
|
|
30
|
-
* @param {string} currentText normalized
|
|
31
|
-
* @param {string} templateText normalized
|
|
32
|
-
* @returns {{ nextText: string, changed: boolean }}
|
|
33
|
-
*/
|
|
34
|
-
function syncLeadingFrontmatter(currentText, templateText) {
|
|
35
|
-
const templateFm = extractLeadingFrontmatter(templateText);
|
|
36
|
-
if (!templateFm) return { nextText: currentText, changed: false };
|
|
37
|
-
|
|
38
|
-
const currentFm = extractLeadingFrontmatter(currentText);
|
|
39
|
-
if (!currentFm) {
|
|
40
|
-
const nextText = `${templateFm.chunk}${currentText}`;
|
|
41
|
-
return { nextText, changed: nextText !== currentText };
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const nextText = `${templateFm.chunk}${currentFm.rest}`;
|
|
45
|
-
return { nextText, changed: nextText !== currentText };
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Template file candidates for a given manifest/workspace path.
|
|
50
|
-
*
|
|
51
|
-
* NOTE: npm excludes files named `.gitignore` from published tarballs, even when placed under templates/.
|
|
52
|
-
* We store it as `gitignore` in templates and map it back at runtime.
|
|
53
|
-
*
|
|
54
|
-
* @param {string} relPosix
|
|
55
|
-
* @returns {string[]}
|
|
56
|
-
*/
|
|
57
|
-
function templateRelCandidates(relPosix) {
|
|
58
|
-
const rel = normalizeRel(relPosix);
|
|
59
|
-
if (!rel) return [];
|
|
60
|
-
/** @type {string[]} */
|
|
61
|
-
const out = [rel];
|
|
62
|
-
if (rel === ".gitignore" || rel.endsWith("/.gitignore")) {
|
|
63
|
-
out.push(rel.replace(/(^|\/)\.gitignore$/, "$1gitignore"));
|
|
64
|
-
}
|
|
65
|
-
return Array.from(new Set(out));
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Resolve a template source file path for a given workspace-relative path.
|
|
70
|
-
*
|
|
71
|
-
* @param {string} templateDir
|
|
72
|
-
* @param {string} relPosix
|
|
73
|
-
*/
|
|
74
|
-
async function resolveTemplateSourcePath(templateDir, relPosix) {
|
|
75
|
-
for (const cand of templateRelCandidates(relPosix)) {
|
|
76
|
-
const abs = templatePath(templateDir, cand);
|
|
77
|
-
if (await pathExists(abs)) return abs;
|
|
78
|
-
}
|
|
79
|
-
return templatePath(templateDir, relPosix);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Expand manifest paths, supporting patterns ending with `/**`.
|
|
84
|
-
*
|
|
85
|
-
* @param {string} templateDir
|
|
86
|
-
* @param {string[]} entries
|
|
87
|
-
*/
|
|
88
|
-
export async function expandManifestEntries(templateDir, entries) {
|
|
89
|
-
/** @type {Set<string>} */
|
|
90
|
-
const out = new Set();
|
|
91
|
-
|
|
92
|
-
for (const raw of entries) {
|
|
93
|
-
const e = normalizeRel(raw);
|
|
94
|
-
if (!e) continue;
|
|
95
|
-
if (e.includes("**")) {
|
|
96
|
-
const idx = e.indexOf("**");
|
|
97
|
-
const prefix = e.slice(0, idx).replace(/\/+$/, "");
|
|
98
|
-
if (!prefix) continue;
|
|
99
|
-
const files = await listFilesRecursive(templateDir, prefix);
|
|
100
|
-
for (const f of files) out.add(normalizeRel(f));
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
out.add(e);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return Array.from(out).sort();
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* @param {string} templateDir
|
|
111
|
-
* @param {string} relPosix
|
|
112
|
-
*/
|
|
113
|
-
export function templatePath(templateDir, relPosix) {
|
|
114
|
-
const rel = normalizeRel(relPosix);
|
|
115
|
-
return path.join(templateDir, ...rel.split("/"));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Copy a template file to workspace, creating parent directories.
|
|
120
|
-
*
|
|
121
|
-
* @param {{ templateDir: string, workspaceRoot: string, relPosix: string, chmod?: number }} options
|
|
122
|
-
*/
|
|
123
|
-
export async function copyTemplateFileToWorkspace(options) {
|
|
124
|
-
const rel = normalizeRel(options.relPosix);
|
|
125
|
-
const src = await resolveTemplateSourcePath(options.templateDir, rel);
|
|
126
|
-
const dest = joinRel(options.workspaceRoot, rel);
|
|
127
|
-
if (!(await pathExists(src))) {
|
|
128
|
-
const tried = templateRelCandidates(rel).map((c) => templatePath(options.templateDir, c));
|
|
129
|
-
throw new UserError(`Template file missing: ${options.relPosix}`, { details: `Tried:\n- ${tried.join("\n- ")}` });
|
|
130
|
-
}
|
|
131
|
-
await copyFile(src, dest, typeof options.chmod === "number" ? { chmod: options.chmod } : undefined);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Upsert one or more managed blocks from template into an existing workspace file.
|
|
136
|
-
*
|
|
137
|
-
* @param {{ templateDir: string, workspaceRoot: string, fileRel: string, blockIds: string[], insertIfMissing: boolean }} options
|
|
138
|
-
* @returns {Promise<{ changed: boolean }>}
|
|
139
|
-
*/
|
|
140
|
-
export async function applyManagedBlocksFromTemplate(options) {
|
|
141
|
-
const fileRel = normalizeRel(options.fileRel);
|
|
142
|
-
const dest = joinRel(options.workspaceRoot, fileRel);
|
|
143
|
-
const src = await resolveTemplateSourcePath(options.templateDir, fileRel);
|
|
144
|
-
|
|
145
|
-
if (!(await pathExists(src))) {
|
|
146
|
-
const tried = templateRelCandidates(fileRel).map((c) => templatePath(options.templateDir, c));
|
|
147
|
-
throw new UserError(`Template file missing: ${fileRel}`, { details: `Tried:\n- ${tried.join("\n- ")}` });
|
|
148
|
-
}
|
|
149
|
-
const templateText = normalizeNewlines(await readText(src));
|
|
150
|
-
|
|
151
|
-
if (!(await pathExists(dest))) {
|
|
152
|
-
await ensureDir(path.dirname(dest));
|
|
153
|
-
await writeText(dest, templateText);
|
|
154
|
-
return { changed: true };
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const currentText = normalizeNewlines(await readText(dest));
|
|
158
|
-
const syncedFrontmatter = syncLeadingFrontmatter(currentText, templateText);
|
|
159
|
-
let nextText = syncedFrontmatter.nextText;
|
|
160
|
-
let anyChanged = syncedFrontmatter.changed;
|
|
161
|
-
|
|
162
|
-
for (const blockId of options.blockIds) {
|
|
163
|
-
const { blockChunk, innerText } = extractTemplateBlock(templateText, blockId);
|
|
164
|
-
const res = upsertManagedBlock(nextText, blockId, innerText, {
|
|
165
|
-
insertIfMissing: options.insertIfMissing,
|
|
166
|
-
templateBlockChunk: blockChunk,
|
|
167
|
-
});
|
|
168
|
-
nextText = res.nextText;
|
|
169
|
-
if (res.changed) anyChanged = true;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (anyChanged) {
|
|
173
|
-
await writeText(dest, nextText);
|
|
174
|
-
}
|
|
175
|
-
return { changed: anyChanged };
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Ensure workspace has a directory.
|
|
180
|
-
*
|
|
181
|
-
* @param {string} workspaceRoot
|
|
182
|
-
* @param {string} relPosix
|
|
183
|
-
*/
|
|
184
|
-
export async function ensureWorkspaceDir(workspaceRoot, relPosix) {
|
|
185
|
-
const abs = joinRel(workspaceRoot, relPosix);
|
|
186
|
-
await fs.mkdir(abs, { recursive: true });
|
|
187
|
-
}
|
package/src/workspace.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import fs from "node:fs/promises";
|
|
3
|
-
import { pathExists } from "./fs.js";
|
|
4
|
-
import { UserError } from "./errors.js";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @param {string} targetPath
|
|
8
|
-
* @param {{ create?: boolean }=} options
|
|
9
|
-
*/
|
|
10
|
-
export async function resolveWorkspaceRoot(targetPath, options) {
|
|
11
|
-
const abs = path.resolve(process.cwd(), targetPath || ".");
|
|
12
|
-
if (await pathExists(abs)) {
|
|
13
|
-
const st = await fs.stat(abs);
|
|
14
|
-
if (!st.isDirectory()) throw new UserError(`Not a directory: ${abs}`);
|
|
15
|
-
return abs;
|
|
16
|
-
}
|
|
17
|
-
if (options?.create) {
|
|
18
|
-
await fs.mkdir(abs, { recursive: true });
|
|
19
|
-
return abs;
|
|
20
|
-
}
|
|
21
|
-
throw new UserError(`Path does not exist: ${abs}`);
|
|
22
|
-
}
|
|
23
|
-
|
|
File without changes
|
|
File without changes
|