open-wiki-spec 0.2.4 → 0.3.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/CHANGELOG.md +54 -0
- package/README.md +50 -3
- package/dist/cli/commands/apply.d.ts.map +1 -1
- package/dist/cli/commands/apply.js +96 -4
- package/dist/cli/commands/apply.js.map +1 -1
- package/dist/cli/commands/archive.d.ts.map +1 -1
- package/dist/cli/commands/archive.js +19 -5
- package/dist/cli/commands/archive.js.map +1 -1
- package/dist/cli/commands/bulk-archive.d.ts +15 -0
- package/dist/cli/commands/bulk-archive.d.ts.map +1 -0
- package/dist/cli/commands/bulk-archive.js +97 -0
- package/dist/cli/commands/bulk-archive.js.map +1 -0
- package/dist/cli/commands/continue.d.ts.map +1 -1
- package/dist/cli/commands/continue.js +15 -2
- package/dist/cli/commands/continue.js.map +1 -1
- package/dist/cli/commands/error-handler.d.ts +1 -5
- package/dist/cli/commands/error-handler.d.ts.map +1 -1
- package/dist/cli/commands/error-handler.js +48 -3
- package/dist/cli/commands/error-handler.js.map +1 -1
- package/dist/cli/commands/init.d.ts +0 -3
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +22 -4
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/list.d.ts +2 -17
- package/dist/cli/commands/list.d.ts.map +1 -1
- package/dist/cli/commands/list.js +15 -3
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/migrate.d.ts.map +1 -1
- package/dist/cli/commands/migrate.js +6 -9
- package/dist/cli/commands/migrate.js.map +1 -1
- package/dist/cli/commands/propose.d.ts.map +1 -1
- package/dist/cli/commands/propose.js +46 -6
- package/dist/cli/commands/propose.js.map +1 -1
- package/dist/cli/commands/query.d.ts.map +1 -1
- package/dist/cli/commands/query.js +99 -4
- package/dist/cli/commands/query.js.map +1 -1
- package/dist/cli/commands/retrieve.d.ts +7 -0
- package/dist/cli/commands/retrieve.d.ts.map +1 -0
- package/dist/cli/commands/retrieve.js +70 -0
- package/dist/cli/commands/retrieve.js.map +1 -0
- package/dist/cli/commands/revert.d.ts +18 -0
- package/dist/cli/commands/revert.d.ts.map +1 -0
- package/dist/cli/commands/revert.js +109 -0
- package/dist/cli/commands/revert.js.map +1 -0
- package/dist/cli/commands/status.d.ts +2 -19
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +42 -3
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/verify.d.ts.map +1 -1
- package/dist/cli/commands/verify.js +12 -1
- package/dist/cli/commands/verify.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +68 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/init-engine.d.ts.map +1 -1
- package/dist/cli/init/init-engine.js +19 -6
- package/dist/cli/init/init-engine.js.map +1 -1
- package/dist/cli/init/meta-files.d.ts +2 -1
- package/dist/cli/init/meta-files.d.ts.map +1 -1
- package/dist/cli/init/meta-files.js +167 -8
- package/dist/cli/init/meta-files.js.map +1 -1
- package/dist/cli/init/skill-generator.d.ts +3 -0
- package/dist/cli/init/skill-generator.d.ts.map +1 -1
- package/dist/cli/init/skill-generator.js +184 -3
- package/dist/cli/init/skill-generator.js.map +1 -1
- package/dist/cli/json-envelope.d.ts +15 -0
- package/dist/cli/json-envelope.d.ts.map +1 -0
- package/dist/cli/json-envelope.js +86 -0
- package/dist/cli/json-envelope.js.map +1 -0
- package/dist/cli/schema-check.d.ts +27 -0
- package/dist/cli/schema-check.d.ts.map +1 -0
- package/dist/cli/schema-check.js +33 -0
- package/dist/cli/schema-check.js.map +1 -0
- package/dist/cli/vault-discovery.d.ts.map +1 -1
- package/dist/cli/vault-discovery.js +16 -2
- package/dist/cli/vault-discovery.js.map +1 -1
- package/dist/core/embedding/cache.d.ts +12 -3
- package/dist/core/embedding/cache.d.ts.map +1 -1
- package/dist/core/embedding/cache.js +42 -5
- package/dist/core/embedding/cache.js.map +1 -1
- package/dist/core/embedding/embedder.d.ts.map +1 -1
- package/dist/core/embedding/embedder.js +73 -6
- package/dist/core/embedding/embedder.js.map +1 -1
- package/dist/core/index/build.d.ts.map +1 -1
- package/dist/core/index/build.js +54 -6
- package/dist/core/index/build.js.map +1 -1
- package/dist/core/index/resolve.d.ts.map +1 -1
- package/dist/core/index/resolve.js +27 -12
- package/dist/core/index/resolve.js.map +1 -1
- package/dist/core/index/scan.d.ts +10 -1
- package/dist/core/index/scan.d.ts.map +1 -1
- package/dist/core/index/scan.js +59 -10
- package/dist/core/index/scan.js.map +1 -1
- package/dist/core/index/schema-version.d.ts +28 -0
- package/dist/core/index/schema-version.d.ts.map +1 -1
- package/dist/core/index/schema-version.js +47 -0
- package/dist/core/index/schema-version.js.map +1 -1
- package/dist/core/migrate/change-converter.d.ts.map +1 -1
- package/dist/core/migrate/change-converter.js +52 -5
- package/dist/core/migrate/change-converter.js.map +1 -1
- package/dist/core/migrate/migrate.d.ts.map +1 -1
- package/dist/core/migrate/migrate.js +115 -1
- package/dist/core/migrate/migrate.js.map +1 -1
- package/dist/core/migrate/spec-converter.js +5 -0
- package/dist/core/migrate/spec-converter.js.map +1 -1
- package/dist/core/migrate/types.d.ts +9 -0
- package/dist/core/migrate/types.d.ts.map +1 -1
- package/dist/core/parser/frontmatter-parser.d.ts +0 -6
- package/dist/core/parser/frontmatter-parser.d.ts.map +1 -1
- package/dist/core/parser/frontmatter-parser.js +59 -2
- package/dist/core/parser/frontmatter-parser.js.map +1 -1
- package/dist/core/parser/requirement-parser.js +4 -0
- package/dist/core/parser/requirement-parser.js.map +1 -1
- package/dist/core/parser/task-parser.d.ts.map +1 -1
- package/dist/core/parser/task-parser.js +19 -0
- package/dist/core/parser/task-parser.js.map +1 -1
- package/dist/core/parser/wikilink-parser.d.ts.map +1 -1
- package/dist/core/parser/wikilink-parser.js +21 -5
- package/dist/core/parser/wikilink-parser.js.map +1 -1
- package/dist/core/retrieval/classify.d.ts +11 -4
- package/dist/core/retrieval/classify.d.ts.map +1 -1
- package/dist/core/retrieval/classify.js +76 -14
- package/dist/core/retrieval/classify.js.map +1 -1
- package/dist/core/retrieval/lexical.d.ts.map +1 -1
- package/dist/core/retrieval/lexical.js +31 -12
- package/dist/core/retrieval/lexical.js.map +1 -1
- package/dist/core/retrieval/retrieve.d.ts.map +1 -1
- package/dist/core/retrieval/retrieve.js +45 -5
- package/dist/core/retrieval/retrieve.js.map +1 -1
- package/dist/core/retrieval/scoring.d.ts.map +1 -1
- package/dist/core/retrieval/scoring.js +37 -12
- package/dist/core/retrieval/scoring.js.map +1 -1
- package/dist/core/schema/change.schema.d.ts.map +1 -1
- package/dist/core/schema/change.schema.js +6 -1
- package/dist/core/schema/change.schema.js.map +1 -1
- package/dist/core/schema/feature.schema.d.ts +1 -1
- package/dist/core/schema/feature.schema.d.ts.map +1 -1
- package/dist/core/schema/feature.schema.js +1 -0
- package/dist/core/schema/feature.schema.js.map +1 -1
- package/dist/core/schema/frontmatter.d.ts +15 -0
- package/dist/core/schema/frontmatter.d.ts.map +1 -1
- package/dist/core/schema/index.d.ts +15 -0
- package/dist/core/schema/index.d.ts.map +1 -1
- package/dist/core/schema/query.schema.d.ts +15 -0
- package/dist/core/schema/query.schema.d.ts.map +1 -1
- package/dist/core/schema/query.schema.js +5 -0
- package/dist/core/schema/query.schema.js.map +1 -1
- package/dist/core/schema/templates.d.ts +0 -4
- package/dist/core/schema/templates.d.ts.map +1 -1
- package/dist/core/schema/templates.js +25 -7
- package/dist/core/schema/templates.js.map +1 -1
- package/dist/core/sequencing/analyze.d.ts.map +1 -1
- package/dist/core/sequencing/analyze.js +3 -1
- package/dist/core/sequencing/analyze.js.map +1 -1
- package/dist/core/sequencing/priority-queue.d.ts +9 -3
- package/dist/core/sequencing/priority-queue.d.ts.map +1 -1
- package/dist/core/sequencing/priority-queue.js +10 -4
- package/dist/core/sequencing/priority-queue.js.map +1 -1
- package/dist/core/sequencing/stale-detector.d.ts.map +1 -1
- package/dist/core/sequencing/stale-detector.js +5 -0
- package/dist/core/sequencing/stale-detector.js.map +1 -1
- package/dist/core/workflow/apply/apply.d.ts.map +1 -1
- package/dist/core/workflow/apply/apply.js +429 -25
- package/dist/core/workflow/apply/apply.js.map +1 -1
- package/dist/core/workflow/apply/delta-parser.d.ts.map +1 -1
- package/dist/core/workflow/apply/delta-parser.js +43 -9
- package/dist/core/workflow/apply/delta-parser.js.map +1 -1
- package/dist/core/workflow/apply/feature-updater.d.ts.map +1 -1
- package/dist/core/workflow/apply/feature-updater.js +27 -11
- package/dist/core/workflow/apply/feature-updater.js.map +1 -1
- package/dist/core/workflow/apply/types.d.ts +9 -0
- package/dist/core/workflow/apply/types.d.ts.map +1 -1
- package/dist/core/workflow/continue/continue.d.ts +18 -0
- package/dist/core/workflow/continue/continue.d.ts.map +1 -1
- package/dist/core/workflow/continue/continue.js +134 -15
- package/dist/core/workflow/continue/continue.js.map +1 -1
- package/dist/core/workflow/continue/next-action.d.ts.map +1 -1
- package/dist/core/workflow/continue/next-action.js +16 -3
- package/dist/core/workflow/continue/next-action.js.map +1 -1
- package/dist/core/workflow/continue/types.d.ts +12 -0
- package/dist/core/workflow/continue/types.d.ts.map +1 -1
- package/dist/core/workflow/propose/note-creator.d.ts +2 -2
- package/dist/core/workflow/propose/note-creator.d.ts.map +1 -1
- package/dist/core/workflow/propose/note-creator.js +89 -12
- package/dist/core/workflow/propose/note-creator.js.map +1 -1
- package/dist/core/workflow/propose/propose.d.ts.map +1 -1
- package/dist/core/workflow/propose/propose.js +189 -47
- package/dist/core/workflow/propose/propose.js.map +1 -1
- package/dist/core/workflow/propose/query-normalizer.d.ts.map +1 -1
- package/dist/core/workflow/propose/query-normalizer.js +37 -5
- package/dist/core/workflow/propose/query-normalizer.js.map +1 -1
- package/dist/core/workflow/propose/types.d.ts +15 -0
- package/dist/core/workflow/propose/types.d.ts.map +1 -1
- package/dist/core/workflow/propose/types.js +6 -1
- package/dist/core/workflow/propose/types.js.map +1 -1
- package/dist/core/workflow/query/query-note-creator.js +4 -0
- package/dist/core/workflow/query/query-note-creator.js.map +1 -1
- package/dist/core/workflow/verify/coherence.d.ts +10 -0
- package/dist/core/workflow/verify/coherence.d.ts.map +1 -1
- package/dist/core/workflow/verify/coherence.js +91 -4
- package/dist/core/workflow/verify/coherence.js.map +1 -1
- package/dist/core/workflow/verify/completeness.d.ts +1 -1
- package/dist/core/workflow/verify/completeness.d.ts.map +1 -1
- package/dist/core/workflow/verify/completeness.js +53 -10
- package/dist/core/workflow/verify/completeness.js.map +1 -1
- package/dist/core/workflow/verify/correctness.d.ts +1 -1
- package/dist/core/workflow/verify/correctness.d.ts.map +1 -1
- package/dist/core/workflow/verify/correctness.js +95 -14
- package/dist/core/workflow/verify/correctness.js.map +1 -1
- package/dist/core/workflow/verify/vault-integrity.d.ts +11 -0
- package/dist/core/workflow/verify/vault-integrity.d.ts.map +1 -1
- package/dist/core/workflow/verify/vault-integrity.js +80 -3
- package/dist/core/workflow/verify/vault-integrity.js.map +1 -1
- package/dist/core/workflow/verify/verify.d.ts +0 -5
- package/dist/core/workflow/verify/verify.d.ts.map +1 -1
- package/dist/core/workflow/verify/verify.js +54 -3
- package/dist/core/workflow/verify/verify.js.map +1 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/types/cli-contracts.d.ts +78 -0
- package/dist/types/cli-contracts.d.ts.map +1 -0
- package/dist/types/cli-contracts.js +2 -0
- package/dist/types/cli-contracts.js.map +1 -0
- package/dist/types/error-codes.d.ts +25 -0
- package/dist/types/error-codes.d.ts.map +1 -0
- package/dist/types/error-codes.js +27 -0
- package/dist/types/error-codes.js.map +1 -0
- package/dist/types/frontmatter.d.ts +9 -2
- package/dist/types/frontmatter.d.ts.map +1 -1
- package/dist/types/next-action.d.ts +21 -0
- package/dist/types/next-action.d.ts.map +1 -1
- package/dist/types/retrieval.d.ts +17 -0
- package/dist/types/retrieval.d.ts.map +1 -1
- package/dist/types/verify.d.ts +58 -1
- package/dist/types/verify.d.ts.map +1 -1
- package/dist/types/verify.js +58 -1
- package/dist/types/verify.js.map +1 -1
- package/dist/utils/conventions.d.ts +9 -0
- package/dist/utils/conventions.d.ts.map +1 -0
- package/dist/utils/conventions.js +22 -0
- package/dist/utils/conventions.js.map +1 -0
- package/dist/utils/id-generator.d.ts.map +1 -1
- package/dist/utils/id-generator.js +8 -0
- package/dist/utils/id-generator.js.map +1 -1
- package/dist/utils/normalize.d.ts +7 -4
- package/dist/utils/normalize.d.ts.map +1 -1
- package/dist/utils/normalize.js +43 -6
- package/dist/utils/normalize.js.map +1 -1
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-engine.js","sourceRoot":"","sources":["../../../src/cli/init/init-engine.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC1G,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;CAiB3B,CAAC;AAEF,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;CAgB3B,CAAC;AAEF,MAAM,UAAU,GAAG;IACjB,MAAM;IACN,cAAc;IACd,iBAAiB;IACjB,iBAAiB;IACjB,kBAAkB;IAClB,iBAAiB;IACjB,mBAAmB;IACnB,iBAAiB;IACjB,iBAAiB;CACT,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAoB;IAClD,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,IAAI,CAAC,I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AG,KAAK;IAC7D,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,MAAM,KAAK,GAAqD;QAC9D,EAAE,YAAY,EAAE,4BAA4B,EAAE,OAAO,EAAE,mBAAmB,EAAE;QAC5E,EAAE,YAAY,EAAE,8BAA8B,EAAE,OAAO,EAAE,mBAAmB,EAAE;KAC/E,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACxD,IAAI,YAAY,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5C,SAAS;QACX,CAAC;QACD,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAClD,OAAO,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -4,6 +4,7 @@ export declare function createLogFile(wikiPath: string): void;
|
|
|
4
4
|
export declare function createConventionsFile(wikiPath: string): void;
|
|
5
5
|
/**
|
|
6
6
|
* Append an entry to the vault operation log.
|
|
7
|
+
* Validates that the log path is inside the vault (rejects symlinks escaping the vault).
|
|
7
8
|
*/
|
|
8
|
-
export declare function appendLogEntry(
|
|
9
|
+
export declare function appendLogEntry(wikiPath: string, operation: string, target: string, agent?: string, vaultRoot?: string): void;
|
|
9
10
|
//# sourceMappingURL=meta-files.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta-files.d.ts","sourceRoot":"","sources":["../../../src/cli/init/meta-files.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"meta-files.d.ts","sourceRoot":"","sources":["../../../src/cli/init/meta-files.ts"],"names":[],"mappings":"AA2DA,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAiCvD;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAgCtD;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAepD;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CA8C5D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,MAAc,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,IAAI,CA2GN"}
|
|
@@ -4,6 +4,62 @@
|
|
|
4
4
|
import * as fs from 'node:fs';
|
|
5
5
|
import * as path from 'node:path';
|
|
6
6
|
const SCHEMA_VERSION = '2026-04-06-v1';
|
|
7
|
+
/**
|
|
8
|
+
* Block the current thread for `ms` milliseconds without spinning the event loop.
|
|
9
|
+
* Primary path uses `Atomics.wait` on a SharedArrayBuffer. If Atomics.wait is
|
|
10
|
+
* unavailable (very old Node or restricted sandbox), falls back to a blocking
|
|
11
|
+
* child_process.execSync sleep which is also O(ms) wall time. Only used as a
|
|
12
|
+
* last resort because it forks a subprocess.
|
|
13
|
+
*/
|
|
14
|
+
function blockingSleep(ms) {
|
|
15
|
+
try {
|
|
16
|
+
const sab = new SharedArrayBuffer(4);
|
|
17
|
+
Atomics.wait(new Int32Array(sab), 0, 0, ms);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
// Fall through to child_process fallback
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
25
|
+
const { execSync } = require('node:child_process');
|
|
26
|
+
// Use `sleep` on POSIX; on Windows use `timeout` which waits in seconds.
|
|
27
|
+
// We intentionally cap at one second of resolution loss to avoid fork
|
|
28
|
+
// overhead dominating the delay.
|
|
29
|
+
if (process.platform === 'win32') {
|
|
30
|
+
execSync(`timeout /T 1 /NOBREAK > NUL`, { stdio: 'ignore' });
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
execSync(`sleep ${(ms / 1000).toFixed(3)}`, { stdio: 'ignore' });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
// Last-resort: busy-wait as an absolute worst case. This should never
|
|
38
|
+
// execute in normal Node environments.
|
|
39
|
+
const end = Date.now() + ms;
|
|
40
|
+
while (Date.now() < end) { /* spin */ }
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Atomic write: write to a temp file in the same directory, then rename.
|
|
45
|
+
* If the process crashes mid-write, only the temp file is left behind
|
|
46
|
+
* (and gets cleaned up by the next apply's recoverFromCrash()).
|
|
47
|
+
*/
|
|
48
|
+
function atomicWriteFile(filePath, content) {
|
|
49
|
+
const tmpPath = `${filePath}.ows-tmp-${process.pid}-${Date.now()}`;
|
|
50
|
+
try {
|
|
51
|
+
fs.writeFileSync(tmpPath, content, 'utf-8');
|
|
52
|
+
fs.renameSync(tmpPath, filePath);
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
// Best-effort cleanup of temp file on write/rename failure
|
|
56
|
+
try {
|
|
57
|
+
fs.unlinkSync(tmpPath);
|
|
58
|
+
}
|
|
59
|
+
catch { /* ignore */ }
|
|
60
|
+
throw err;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
7
63
|
export function createSchemaFile(wikiPath) {
|
|
8
64
|
const content = `---
|
|
9
65
|
type: meta
|
|
@@ -36,7 +92,7 @@ effective_date: "${formatDate(new Date())}"
|
|
|
36
92
|
|
|
37
93
|
- None.
|
|
38
94
|
`;
|
|
39
|
-
|
|
95
|
+
atomicWriteFile(path.join(wikiPath, '00-meta', 'schema.md'), content);
|
|
40
96
|
}
|
|
41
97
|
export function createIndexFile(wikiPath) {
|
|
42
98
|
const content = `---
|
|
@@ -69,7 +125,7 @@ This file is a manual entry point. Use \`ows list\` for the current vault conten
|
|
|
69
125
|
|
|
70
126
|
### Queries
|
|
71
127
|
`;
|
|
72
|
-
|
|
128
|
+
atomicWriteFile(path.join(wikiPath, '00-meta', 'index.md'), content);
|
|
73
129
|
}
|
|
74
130
|
export function createLogFile(wikiPath) {
|
|
75
131
|
const date = formatDate(new Date());
|
|
@@ -85,7 +141,7 @@ Chronological log of vault operations performed by \`ows\`.
|
|
|
85
141
|
|------|-----------|--------|-------|
|
|
86
142
|
| ${date} | init | vault | ows |
|
|
87
143
|
`;
|
|
88
|
-
|
|
144
|
+
atomicWriteFile(path.join(wikiPath, '00-meta', 'log.md'), content);
|
|
89
145
|
}
|
|
90
146
|
export function createConventionsFile(wikiPath) {
|
|
91
147
|
const content = `---
|
|
@@ -132,16 +188,119 @@ type: meta
|
|
|
132
188
|
- Apply order: RENAMED -> REMOVED -> MODIFIED -> ADDED.
|
|
133
189
|
- MODIFIED/REMOVED/RENAMED entries should include \`[base: <content_hash>]\`.
|
|
134
190
|
`;
|
|
135
|
-
|
|
191
|
+
atomicWriteFile(path.join(wikiPath, '00-meta', 'conventions.md'), content);
|
|
136
192
|
}
|
|
137
193
|
/**
|
|
138
194
|
* Append an entry to the vault operation log.
|
|
195
|
+
* Validates that the log path is inside the vault (rejects symlinks escaping the vault).
|
|
139
196
|
*/
|
|
140
|
-
export function appendLogEntry(
|
|
141
|
-
const logPath = path.join(
|
|
197
|
+
export function appendLogEntry(wikiPath, operation, target, agent = 'ows', vaultRoot) {
|
|
198
|
+
const logPath = path.join(wikiPath, '00-meta', 'log.md');
|
|
199
|
+
// Security: reject if log.md is a symlink pointing outside the vault
|
|
200
|
+
try {
|
|
201
|
+
const stat = fs.lstatSync(logPath);
|
|
202
|
+
if (stat.isSymbolicLink()) {
|
|
203
|
+
const realPath = fs.realpathSync.native(logPath);
|
|
204
|
+
const boundary = vaultRoot ?? path.dirname(wikiPath);
|
|
205
|
+
const realBoundary = fs.realpathSync.native(boundary);
|
|
206
|
+
if (!realPath.startsWith(realBoundary + path.sep) && realPath !== realBoundary) {
|
|
207
|
+
throw new Error(`log.md symlink escapes vault boundary: ${logPath}`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
catch (err) {
|
|
212
|
+
if (err.code !== 'ENOENT') {
|
|
213
|
+
// Re-throw security errors; only swallow "file doesn't exist yet"
|
|
214
|
+
if (err instanceof Error && err.message.includes('symlink escapes vault')) {
|
|
215
|
+
throw err;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// Sanitize markdown-table-breaking characters: pipe, newline, carriage return.
|
|
220
|
+
// This prevents log poisoning via crafted change IDs or targets.
|
|
221
|
+
const sanitize = (s) => s.replace(/\|/g, '\\|').replace(/[\r\n]+/g, ' ');
|
|
142
222
|
const date = formatDate(new Date());
|
|
143
|
-
const entry = `| ${date} | ${operation} | ${target} | ${agent} |`;
|
|
144
|
-
|
|
223
|
+
const entry = `| ${sanitize(date)} | ${sanitize(operation)} | ${sanitize(target)} | ${sanitize(agent)} |`;
|
|
224
|
+
// Serialize parallel appenders via an exclusive-create lock file.
|
|
225
|
+
// Two simultaneous `ows archive`/`ows apply` runs would otherwise race on
|
|
226
|
+
// `appendFileSync`. The lock is a per-vault mutex held only for the duration
|
|
227
|
+
// of this single append (ms). Stale locks are reclaimed by either:
|
|
228
|
+
// - time-based TTL (older than 30s → abandoned)
|
|
229
|
+
// - PID-based liveness (writer PID no longer exists → abandoned)
|
|
230
|
+
// The PID check is important because a crashed process leaves a fresh
|
|
231
|
+
// lock timestamp that the TTL alone would wait on for the full 30s.
|
|
232
|
+
const lockPath = path.join(wikiPath, '00-meta', 'log.md.lock');
|
|
233
|
+
const LOCK_STALE_MS = 30_000;
|
|
234
|
+
const MAX_RETRIES = 50;
|
|
235
|
+
let acquired = false;
|
|
236
|
+
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
|
237
|
+
try {
|
|
238
|
+
const fd = fs.openSync(lockPath, 'wx');
|
|
239
|
+
fs.writeSync(fd, `${process.pid}|${Date.now()}`);
|
|
240
|
+
fs.closeSync(fd);
|
|
241
|
+
acquired = true;
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
catch (err) {
|
|
245
|
+
if (err.code !== 'EEXIST') {
|
|
246
|
+
// Unexpected error (permissions, missing dir, etc.) — fall
|
|
247
|
+
// through to best-effort append without locking to avoid
|
|
248
|
+
// blocking the workflow. This preserves behavior on read-only
|
|
249
|
+
// or otherwise constrained filesystems.
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
// Try to detect a stale lock (time OR dead-PID based)
|
|
253
|
+
try {
|
|
254
|
+
const lockContent = fs.readFileSync(lockPath, 'utf-8');
|
|
255
|
+
const [pidStr, ts] = lockContent.split('|');
|
|
256
|
+
const lockAge = Date.now() - Number(ts);
|
|
257
|
+
const staleByAge = Number.isFinite(lockAge) && lockAge > LOCK_STALE_MS;
|
|
258
|
+
let staleByPid = false;
|
|
259
|
+
const pid = Number(pidStr);
|
|
260
|
+
if (Number.isFinite(pid) && pid > 0 && pid !== process.pid) {
|
|
261
|
+
try {
|
|
262
|
+
// Signal 0 checks liveness without delivering a signal
|
|
263
|
+
process.kill(pid, 0);
|
|
264
|
+
}
|
|
265
|
+
catch {
|
|
266
|
+
staleByPid = true;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (staleByAge || staleByPid) {
|
|
270
|
+
fs.unlinkSync(lockPath);
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
// ignore
|
|
276
|
+
}
|
|
277
|
+
// Block the thread for ~10ms without spinning the event loop.
|
|
278
|
+
// Atomics.wait on a SharedArrayBuffer is a true blocking sleep in Node,
|
|
279
|
+
// unlike `while (Date.now() < x) {}` which burns CPU and starves timers.
|
|
280
|
+
blockingSleep(10);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
// If acquisition failed after all retries, abort rather than append
|
|
284
|
+
// without the mutex. Previously we'd silently proceed and risk
|
|
285
|
+
// corrupting log.md with interleaved writes from parallel processes.
|
|
286
|
+
// The caller catches this and surfaces a clear error so the user
|
|
287
|
+
// can inspect the lock file.
|
|
288
|
+
if (!acquired && fs.existsSync(lockPath)) {
|
|
289
|
+
throw new Error(`Could not acquire log.md lock at ${lockPath} after ${MAX_RETRIES} retries. ` +
|
|
290
|
+
'Another process may be holding it. Inspect the lock file (contains pid|timestamp) ' +
|
|
291
|
+
'and delete it manually if you have confirmed the holder is dead.');
|
|
292
|
+
}
|
|
293
|
+
try {
|
|
294
|
+
fs.appendFileSync(logPath, '\n' + entry);
|
|
295
|
+
}
|
|
296
|
+
finally {
|
|
297
|
+
if (acquired) {
|
|
298
|
+
try {
|
|
299
|
+
fs.unlinkSync(lockPath);
|
|
300
|
+
}
|
|
301
|
+
catch { /* best-effort */ }
|
|
302
|
+
}
|
|
303
|
+
}
|
|
145
304
|
}
|
|
146
305
|
function formatDate(date) {
|
|
147
306
|
const y = date.getFullYear();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta-files.js","sourceRoot":"","sources":["../../../src/cli/init/meta-files.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,MAAM,cAAc,GAAG,eAAe,CAAC;AAEvC,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,MAAM,OAAO,GAAG;;mBAEC,cAAc;mBACd,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC;;;;;;;IAOrC,cAAc;;;;;;;;;;;;;;;;;;;;CAoBjB,CAAC;IACA,
|
|
1
|
+
{"version":3,"file":"meta-files.js","sourceRoot":"","sources":["../../../src/cli/init/meta-files.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,S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7B,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CACb,oCAAoC,QAAQ,UAAU,WAAW,YAAY;YAC3E,oFAAoF;YACpF,kEAAkE,CACrE,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,GAAG,KAAK,CAAC,CAAC;IAC3C,CAAC;YAAS,CAAC;QACT,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC;gBAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAAC,CAAC;YAAC,MAAM,CAAC,CAAC,iBAAiB,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,IAAU;IAC5B,MAAM,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAC7B,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACvD,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAClD,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -6,6 +6,9 @@ export declare const WORKFLOW_SKILLS: Record<string, SkillDefinition>;
|
|
|
6
6
|
export declare function generateSkillFile(skillDef: SkillDefinition): string;
|
|
7
7
|
/**
|
|
8
8
|
* Write all skill files to the Claude Code commands directory.
|
|
9
|
+
* If a user has customized an existing skill file (contents differ from the
|
|
10
|
+
* previously-generated version), back it up before overwriting so users
|
|
11
|
+
* never lose their customizations.
|
|
9
12
|
*/
|
|
10
13
|
export declare function writeAllSkillFiles(projectPath: string): string[];
|
|
11
14
|
//# sourceMappingURL=skill-generator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-generator.d.ts","sourceRoot":"","sources":["../../../src/cli/init/skill-generator.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"skill-generator.d.ts","sourceRoot":"","sources":["../../../src/cli/init/skill-generator.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CA+6B3D,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAQnE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CA2BhE"}
|
|
@@ -207,6 +207,8 @@ Use this context to inform section writing (especially Why and Delta Summary).
|
|
|
207
207
|
- \`--json\`: Output structured JSON result
|
|
208
208
|
- \`--dry-run\`: Validate without writing any files (use this to preview)
|
|
209
209
|
- \`--force-stale\`: Apply even when stale base fingerprints are detected
|
|
210
|
+
- \`--no-auto-transition\`: Keep status as \`in_progress\` after writing (use when ADDED/MODIFIED markers need manual content before finalizing)
|
|
211
|
+
- \`--no-log\`: Skip appending to \`wiki/00-meta/log.md\`
|
|
210
212
|
|
|
211
213
|
**Steps**
|
|
212
214
|
|
|
@@ -238,6 +240,15 @@ Use this context to inform section writing (especially Why and Delta Summary).
|
|
|
238
240
|
---
|
|
239
241
|
|
|
240
242
|
4. **Execute the apply (if confirmed)**
|
|
243
|
+
|
|
244
|
+
**CRITICAL: If the Change has ADDED or MODIFIED operations, use \`--no-auto-transition\` on the first apply** so the status stays in \`in_progress\` until you've filled in the marker contents. Example:
|
|
245
|
+
\`\`\`bash
|
|
246
|
+
# First apply: insert markers without transitioning to applied
|
|
247
|
+
ows apply <changeId> --no-auto-transition --json
|
|
248
|
+
\`\`\`
|
|
249
|
+
Without this flag, the change will transition to \`applied\` while the Feature note still contains unfilled \`<!-- ADDED ... -->\` marker comments, and \`ows verify\` will then report \`UNFILLED_APPLY_MARKER\` errors.
|
|
250
|
+
|
|
251
|
+
For changes with ONLY programmatic ops (RENAMED/REMOVED), a single plain apply is fine:
|
|
241
252
|
\`\`\`bash
|
|
242
253
|
ows apply <changeId> --json
|
|
243
254
|
\`\`\`
|
|
@@ -252,7 +263,17 @@ Use this context to inform section writing (especially Why and Delta Summary).
|
|
|
252
263
|
- **MODIFIED**: Inserts a \`<!-- MODIFIED by change: <changeId> -->\` marker after the requirement heading. The agent must then update the requirement text.
|
|
253
264
|
- **ADDED**: Inserts a \`<!-- ADDED by change: <changeId>. Fill in normative statement (SHALL/MUST) and scenarios (WHEN/THEN). -->\` marker in the Requirements section. The agent must then write the new requirement content.
|
|
254
265
|
|
|
255
|
-
5. **
|
|
266
|
+
5. **Fill marker contents (if using --no-auto-transition)**
|
|
267
|
+
|
|
268
|
+
Open each Feature note listed in \`result.modifiedFiles\`, find the \`<!-- ADDED ... -->\` and \`<!-- MODIFIED ... -->\` marker comments, and replace them with real requirement text (SHALL/MUST normative + WHEN/THEN scenarios). Then remove the marker comment itself.
|
|
269
|
+
|
|
270
|
+
6. **Finalize apply**
|
|
271
|
+
\`\`\`bash
|
|
272
|
+
# Second apply: now that markers are filled, transition to applied
|
|
273
|
+
ows apply <changeId> --json
|
|
274
|
+
\`\`\`
|
|
275
|
+
|
|
276
|
+
7. **Show final state**
|
|
256
277
|
\`\`\`bash
|
|
257
278
|
ows status <changeId>
|
|
258
279
|
\`\`\`
|
|
@@ -703,6 +724,150 @@ In extend mode, existing seed notes are never overwritten. Use \`--skip-seed\` t
|
|
|
703
724
|
- Never destroy existing vault content
|
|
704
725
|
- Encourage the user to edit seed-context.md after init — it improves retrieval quality
|
|
705
726
|
- Show warnings if any files were skipped`,
|
|
727
|
+
},
|
|
728
|
+
explore: {
|
|
729
|
+
name: 'ows-explore',
|
|
730
|
+
description: 'Enter exploration mode — investigate the codebase without implementing.',
|
|
731
|
+
instructions: `Enter thinking/exploration mode. Investigate the codebase, architecture, and existing behavior without making any code changes.
|
|
732
|
+
|
|
733
|
+
**Input**: The argument after \`/ows-explore\` is a topic, question, or area to investigate (e.g., \`/ows-explore "how does the auth flow work?"\`).
|
|
734
|
+
|
|
735
|
+
**Purpose**: This is a safe space to investigate before committing to any plan. Unlike \`/ows-propose\`, this does NOT create any vault notes or changes. Use this to build understanding before proposing work.
|
|
736
|
+
|
|
737
|
+
**Steps**
|
|
738
|
+
|
|
739
|
+
1. **Understand the investigation scope**
|
|
740
|
+
|
|
741
|
+
Parse the user's question and identify:
|
|
742
|
+
- What system/feature area is involved
|
|
743
|
+
- What kind of answer is needed (architecture overview, data flow, bug root cause, etc.)
|
|
744
|
+
- What files/modules are likely relevant
|
|
745
|
+
|
|
746
|
+
2. **Search the vault for existing knowledge**
|
|
747
|
+
\`\`\`bash
|
|
748
|
+
ows query "<topic>" --json
|
|
749
|
+
\`\`\`
|
|
750
|
+
Check if the vault already has relevant Feature, System, Decision, or Query notes.
|
|
751
|
+
|
|
752
|
+
3. **Explore the codebase**
|
|
753
|
+
|
|
754
|
+
Read code, trace call paths, examine data flows. Use whatever tools are available:
|
|
755
|
+
- File reading and search
|
|
756
|
+
- Symbol navigation
|
|
757
|
+
- Dependency tracing
|
|
758
|
+
- Architecture visualization (ASCII diagrams)
|
|
759
|
+
|
|
760
|
+
4. **Document findings**
|
|
761
|
+
|
|
762
|
+
Present findings with:
|
|
763
|
+
- Architecture diagrams (ASCII) where helpful
|
|
764
|
+
- Key files and their roles
|
|
765
|
+
- Data flow descriptions
|
|
766
|
+
- Relevant existing vault notes
|
|
767
|
+
- Questions that remain unanswered
|
|
768
|
+
|
|
769
|
+
5. **Suggest next steps**
|
|
770
|
+
|
|
771
|
+
Based on findings:
|
|
772
|
+
- "This is well-understood. No action needed."
|
|
773
|
+
- "Consider creating a Decision note to record this rationale."
|
|
774
|
+
- "This reveals work to do. Run \`/ows-propose\` to formalize it."
|
|
775
|
+
- "Save these findings as a Query note? Run \`ows query '<topic>' --save\`"
|
|
776
|
+
|
|
777
|
+
**Rules**
|
|
778
|
+
- **NO code changes** — this is read-only investigation
|
|
779
|
+
- **NO vault modifications** — don't create notes (suggest it, but don't do it)
|
|
780
|
+
- **Be thorough** — read actual code, don't guess from file names
|
|
781
|
+
- **Visualize** — use ASCII diagrams for architecture, data flows, component relationships
|
|
782
|
+
- **Connect to vault** — reference existing vault notes when relevant
|
|
783
|
+
- **Capture for later** — if findings are substantial, suggest saving as a Query note`,
|
|
784
|
+
},
|
|
785
|
+
onboard: {
|
|
786
|
+
name: 'ows-onboard',
|
|
787
|
+
description: 'Guided tutorial for first-time open-wiki-spec users.',
|
|
788
|
+
instructions: `Guide a first-time user through a complete open-wiki-spec cycle using their actual codebase.
|
|
789
|
+
|
|
790
|
+
**Purpose**: Help new users learn ows by doing — not by reading docs. Walk them through a real (small) cycle from propose to archive.
|
|
791
|
+
|
|
792
|
+
**Steps**
|
|
793
|
+
|
|
794
|
+
1. **Check vault state**
|
|
795
|
+
\`\`\`bash
|
|
796
|
+
ows list --json
|
|
797
|
+
ows verify --json
|
|
798
|
+
\`\`\`
|
|
799
|
+
Determine if the vault is freshly initialized or already has content.
|
|
800
|
+
|
|
801
|
+
2. **Explain the vault structure**
|
|
802
|
+
|
|
803
|
+
Give a quick orientation:
|
|
804
|
+
\`\`\`
|
|
805
|
+
wiki/
|
|
806
|
+
00-meta/ — Vault metadata and conventions
|
|
807
|
+
01-sources/ — External references (PRDs, docs)
|
|
808
|
+
02-systems/ — System/component boundaries
|
|
809
|
+
03-features/ — Feature specifications (the "what is")
|
|
810
|
+
04-changes/ — Active work units (the "what's changing")
|
|
811
|
+
05-decisions/ — Design decisions and rationale
|
|
812
|
+
06-queries/ — Investigation notes
|
|
813
|
+
99-archive/ — Completed changes
|
|
814
|
+
\`\`\`
|
|
815
|
+
|
|
816
|
+
3. **Pick a small real task**
|
|
817
|
+
|
|
818
|
+
Help the user identify a small, concrete task from their project:
|
|
819
|
+
- A simple feature addition
|
|
820
|
+
- A bug fix
|
|
821
|
+
- A small refactor
|
|
822
|
+
|
|
823
|
+
The task should be completable in ~15 minutes. Ask the user what they'd like to work on.
|
|
824
|
+
|
|
825
|
+
4. **Walk through the full cycle**
|
|
826
|
+
|
|
827
|
+
Guide the user step by step (pausing for confirmation at each stage):
|
|
828
|
+
|
|
829
|
+
**a. Propose** (\`/ows-propose\`)
|
|
830
|
+
- Show how retrieval scans for existing work
|
|
831
|
+
- Explain the classification result
|
|
832
|
+
- Create the Feature + Change notes
|
|
833
|
+
|
|
834
|
+
**b. Fill sections** (\`/ows-continue\`)
|
|
835
|
+
- Help write the Why section
|
|
836
|
+
- Help write the Delta Summary
|
|
837
|
+
- Help write Tasks
|
|
838
|
+
- Help write Validation
|
|
839
|
+
- Show the proposed → planned transition
|
|
840
|
+
|
|
841
|
+
**c. Implement** (\`/ows-continue\`)
|
|
842
|
+
- Work through the tasks
|
|
843
|
+
- Show how tasks are tracked
|
|
844
|
+
|
|
845
|
+
**d. Apply** (\`/ows-apply\`)
|
|
846
|
+
- Show how the Feature note gets updated
|
|
847
|
+
- Explain the two-phase commit
|
|
848
|
+
|
|
849
|
+
**e. Verify** (\`/ows-verify\`)
|
|
850
|
+
- Run the 4-dimension check
|
|
851
|
+
- Explain what each dimension means
|
|
852
|
+
|
|
853
|
+
**f. Archive** (\`/ows-archive\`)
|
|
854
|
+
- Move the completed change
|
|
855
|
+
- Show the clean state
|
|
856
|
+
|
|
857
|
+
5. **Wrap up**
|
|
858
|
+
|
|
859
|
+
Summarize what they learned:
|
|
860
|
+
- 6 note types and their purposes
|
|
861
|
+
- The lifecycle: propose → plan → implement → apply → verify → archive
|
|
862
|
+
- Key commands they'll use daily
|
|
863
|
+
- Where to find help (README, \`/ows-status\`, \`/ows-query\`)
|
|
864
|
+
|
|
865
|
+
**Guardrails**
|
|
866
|
+
- Pause after EACH major step for user confirmation
|
|
867
|
+
- Keep explanations concise — show, don't lecture
|
|
868
|
+
- Use the user's actual project, not hypothetical examples
|
|
869
|
+
- If the user gets confused, simplify — don't add complexity
|
|
870
|
+
- The goal is confidence, not completeness`,
|
|
706
871
|
},
|
|
707
872
|
migrate: {
|
|
708
873
|
name: 'ows-migrate',
|
|
@@ -796,6 +961,9 @@ ${skillDef.instructions}
|
|
|
796
961
|
}
|
|
797
962
|
/**
|
|
798
963
|
* Write all skill files to the Claude Code commands directory.
|
|
964
|
+
* If a user has customized an existing skill file (contents differ from the
|
|
965
|
+
* previously-generated version), back it up before overwriting so users
|
|
966
|
+
* never lose their customizations.
|
|
799
967
|
*/
|
|
800
968
|
export function writeAllSkillFiles(projectPath) {
|
|
801
969
|
const claudeDir = path.join(projectPath, '.claude', 'commands');
|
|
@@ -803,8 +971,21 @@ export function writeAllSkillFiles(projectPath) {
|
|
|
803
971
|
const generated = [];
|
|
804
972
|
for (const [workflowName, skillDef] of Object.entries(WORKFLOW_SKILLS)) {
|
|
805
973
|
const skillPath = path.join(claudeDir, `ows-${workflowName}.md`);
|
|
806
|
-
const
|
|
807
|
-
|
|
974
|
+
const newContent = generateSkillFile(skillDef);
|
|
975
|
+
// If file exists and differs from what we're about to write, back it up
|
|
976
|
+
if (fs.existsSync(skillPath)) {
|
|
977
|
+
try {
|
|
978
|
+
const existingContent = fs.readFileSync(skillPath, 'utf-8');
|
|
979
|
+
if (existingContent !== newContent) {
|
|
980
|
+
const backupPath = `${skillPath}.bak`;
|
|
981
|
+
fs.writeFileSync(backupPath, existingContent);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
catch {
|
|
985
|
+
// Best-effort backup — don't block init if read fails
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
fs.writeFileSync(skillPath, newContent);
|
|
808
989
|
generated.push(skillPath);
|
|
809
990
|
}
|
|
810
991
|
return generated;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-generator.js","sourceRoot":"","sources":["../../../src/cli/init/skill-generator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,MAAM,CAAC,MAAM,eAAe,GAAoC;IAC9D,OAAO,EAAE;QACP,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,4CAA4C;QACzD,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yEAsGuD;KACtE;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,sCAAsC;QACnD,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iFA4E+D;KAC9E;IACD,KAAK,EAAE;QACL,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,4CAA4C;QACzD,YAAY,EAAE
|
|
1
|
+
{"version":3,"file":"skill-generator.js","sourceRoot":"","sources":["../../../src/cli/init/skill-generator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,MAAM,CAAC,MAAM,eAAe,GAAoC;IAC9D,OAAO,EAAE;QACP,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,4CAA4C;QACzD,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,KAAK,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;QACvE,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,YAAY,KAAK,CAAC,CAAC;QACjE,MAAM,UAAU,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAE/C,wEAAwE;QACxE,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC;gBACH,MAAM,eAAe,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;gBAC5D,IAAI,eAAe,KAAK,UAAU,EAAE,CAAC;oBACnC,MAAM,UAAU,GAAG,GAAG,SAAS,MAAM,CAAC;oBACtC,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;gBAChD,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,sDAAsD;YACxD,CAAC;QACH,CAAC;QAED,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACxC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Envelope schema version. Bump on breaking changes to the envelope
|
|
3
|
+
* shape (adding fields is non-breaking; renaming/removing/semantic
|
|
4
|
+
* changes are breaking). Consumers pin against this to detect drift.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ENVELOPE_VERSION = "1";
|
|
7
|
+
/**
|
|
8
|
+
* Wrap a command's success payload in the standard CLI JSON envelope
|
|
9
|
+
* and return the serialized JSON string (pretty-printed).
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* console.log(jsonEnvelope('propose', result));
|
|
13
|
+
*/
|
|
14
|
+
export declare function jsonEnvelope(command: string, data: unknown): string;
|
|
15
|
+
//# sourceMappingURL=json-envelope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-envelope.d.ts","sourceRoot":"","sources":["../../src/cli/json-envelope.ts"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAiDpC;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CASnE"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common JSON envelope for all CLI --json output.
|
|
3
|
+
*
|
|
4
|
+
* Every CLI command wraps its success payload in:
|
|
5
|
+
* { ok: true, command: "<name>", version: "<pkg version>", data: <payload> }
|
|
6
|
+
*
|
|
7
|
+
* Error output is handled separately by handleCliError and keeps its
|
|
8
|
+
* existing { error: true, code, message } shape.
|
|
9
|
+
*
|
|
10
|
+
* Uses a JSON.stringify replacer (single-pass) to normalize Map instances
|
|
11
|
+
* to plain objects. This preserves native Date → toISOString() behavior
|
|
12
|
+
* and avoids the 2-pass cost of deep-cloning + stringify.
|
|
13
|
+
*/
|
|
14
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
15
|
+
import { fileURLToPath } from 'node:url';
|
|
16
|
+
import { dirname, join } from 'node:path';
|
|
17
|
+
/**
|
|
18
|
+
* Envelope schema version. Bump on breaking changes to the envelope
|
|
19
|
+
* shape (adding fields is non-breaking; renaming/removing/semantic
|
|
20
|
+
* changes are breaking). Consumers pin against this to detect drift.
|
|
21
|
+
*/
|
|
22
|
+
export const ENVELOPE_VERSION = '1';
|
|
23
|
+
let _version;
|
|
24
|
+
function getVersion() {
|
|
25
|
+
if (_version)
|
|
26
|
+
return _version;
|
|
27
|
+
try {
|
|
28
|
+
// ESM-safe: derive directory from import.meta.url
|
|
29
|
+
const thisDir = dirname(fileURLToPath(import.meta.url));
|
|
30
|
+
// Walk up from dist/cli/ (or src/cli/) to find package.json
|
|
31
|
+
let dir = thisDir;
|
|
32
|
+
for (let i = 0; i < 5; i++) {
|
|
33
|
+
const pkgPath = join(dir, 'package.json');
|
|
34
|
+
if (existsSync(pkgPath)) {
|
|
35
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
36
|
+
_version = pkg.version ?? 'unknown';
|
|
37
|
+
return _version;
|
|
38
|
+
}
|
|
39
|
+
dir = dirname(dir);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// fall through
|
|
44
|
+
}
|
|
45
|
+
_version = 'unknown';
|
|
46
|
+
return _version;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* JSON.stringify replacer that converts Map → plain object and
|
|
50
|
+
* Set → array. Handles nested structures via the natural recursion
|
|
51
|
+
* of JSON.stringify — no manual deep-walk needed.
|
|
52
|
+
*
|
|
53
|
+
* Date, RegExp, and other built-ins are left to their default
|
|
54
|
+
* JSON.stringify behavior (Date → toISOString string, others → {}).
|
|
55
|
+
*/
|
|
56
|
+
function envelopeReplacer(_key, value) {
|
|
57
|
+
if (value instanceof Map) {
|
|
58
|
+
const obj = {};
|
|
59
|
+
for (const [k, v] of value) {
|
|
60
|
+
obj[String(k)] = v;
|
|
61
|
+
}
|
|
62
|
+
return obj;
|
|
63
|
+
}
|
|
64
|
+
if (value instanceof Set) {
|
|
65
|
+
return Array.from(value);
|
|
66
|
+
}
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Wrap a command's success payload in the standard CLI JSON envelope
|
|
71
|
+
* and return the serialized JSON string (pretty-printed).
|
|
72
|
+
*
|
|
73
|
+
* Usage:
|
|
74
|
+
* console.log(jsonEnvelope('propose', result));
|
|
75
|
+
*/
|
|
76
|
+
export function jsonEnvelope(command, data) {
|
|
77
|
+
const envelope = {
|
|
78
|
+
ok: true,
|
|
79
|
+
command,
|
|
80
|
+
envelope_version: ENVELOPE_VERSION,
|
|
81
|
+
version: getVersion(),
|
|
82
|
+
data,
|
|
83
|
+
};
|
|
84
|
+
return JSON.stringify(envelope, envelopeReplacer, 2);
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=json-envelope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-envelope.js","sourceRoot":"","sources":["../../src/cli/json-envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEpC,IAAI,QAA4B,CAAC;AAEjC,SAAS,UAAU;IACjB,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9B,IAAI,CAAC;QACH,kDAAkD;QAClD,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACxD,4DAA4D;QAC5D,IAAI,GAAG,GAAG,OAAO,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;YAC1C,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;gBACxB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAyB,CAAC;gBAC/E,QAAQ,GAAG,GAAG,CAAC,OAAO,IAAI,SAAS,CAAC;gBACpC,OAAO,QAAQ,CA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