@grant-vine/wunderkind 0.10.1 → 0.10.4
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/.claude-plugin/plugin.json +1 -1
- package/README.md +3 -3
- package/commands/docs-index.md +7 -4
- package/dist/agents/docs-config.d.ts.map +1 -1
- package/dist/agents/docs-config.js +11 -4
- package/dist/agents/docs-config.js.map +1 -1
- package/dist/agents/docs-index-plan.d.ts +7 -2
- package/dist/agents/docs-index-plan.d.ts.map +1 -1
- package/dist/agents/docs-index-plan.js +40 -11
- package/dist/agents/docs-index-plan.js.map +1 -1
- package/dist/cli/config-manager/index.d.ts +7 -0
- package/dist/cli/config-manager/index.d.ts.map +1 -1
- package/dist/cli/config-manager/index.js +111 -60
- package/dist/cli/config-manager/index.js.map +1 -1
- package/dist/cli/docs-output-helper.d.ts +4 -0
- package/dist/cli/docs-output-helper.d.ts.map +1 -1
- package/dist/cli/docs-output-helper.js +44 -0
- package/dist/cli/docs-output-helper.js.map +1 -1
- package/dist/cli/gitignore-manager.d.ts +1 -1
- package/dist/cli/gitignore-manager.d.ts.map +1 -1
- package/dist/cli/gitignore-manager.js +5 -3
- package/dist/cli/gitignore-manager.js.map +1 -1
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +59 -0
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/personality-meta.js +2 -2
- package/dist/cli/personality-meta.js.map +1 -1
- package/dist/cli/tui-installer.d.ts.map +1 -1
- package/dist/cli/tui-installer.js +27 -82
- package/dist/cli/tui-installer.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -176,8 +176,8 @@ If `prdPipelineMode` is absent in an older project config, Wunderkind treats it
|
|
|
176
176
|
| Mode | Description |
|
|
177
177
|
|---|---|
|
|
178
178
|
| `overwrite` | Replaces the file contents each time (default) |
|
|
179
|
-
| `append-dated` | Appends a
|
|
180
|
-
| `new-dated-file` | Creates a
|
|
179
|
+
| `append-dated` | Appends a UTC-timestamped section like `## Update 2026-03-12T18-37-52Z` to the canonical file |
|
|
180
|
+
| `new-dated-file` | Creates a UTC-timestamped file like `marketing-strategy--2026-03-12T18-37-52Z.md` beside the canonical file |
|
|
181
181
|
| `overwrite-archive` | Overwrites the current file and archives the old one |
|
|
182
182
|
|
|
183
183
|
### JSON Schema
|
|
@@ -264,7 +264,7 @@ When enabled, agents can persist their decisions and strategies to your project'
|
|
|
264
264
|
|
|
265
265
|
1. **Enable** via interactive `wunderkind init`, or non-interactively with `wunderkind init --no-tui --docs-enabled=yes --docs-path ./docs`
|
|
266
266
|
2. **Configure** in `.wunderkind/wunderkind.config.jsonc` via `docsEnabled`, `docsPath`, and `docHistoryMode`.
|
|
267
|
-
3. **Refresh or bootstrap** via `/docs-index`. This
|
|
267
|
+
3. **Refresh or bootstrap** via `/docs-index`. This executable plugin command uses one shared UTC token per run (`YYYY-MM-DDTHH-mm-ssZ`, for example `2026-03-12T18-37-52Z`). In `append-dated`, it updates canonical files with headings like `## Update 2026-03-12T18-37-52Z`. In `new-dated-file`, it writes managed family files like `marketing-strategy--2026-03-12T18-37-52Z.md` beside the canonical file. Existing date-only artifacts are preserved unchanged.
|
|
268
268
|
|
|
269
269
|
---
|
|
270
270
|
|
package/commands/docs-index.md
CHANGED
|
@@ -22,8 +22,8 @@ This command is invoked as `/docs-index`.
|
|
|
22
22
|
## Constraints
|
|
23
23
|
|
|
24
24
|
- Only docs-eligible Wunderkind agents should participate.
|
|
25
|
-
- Use canonical filenames from Wunderkind's built-in ownership map
|
|
26
|
-
- Do not let individual agents invent output paths
|
|
25
|
+
- Use canonical filenames from Wunderkind's built-in ownership map. Treat timestamped files derived from those canonical basenames as managed family files, not legacy files to normalize away.
|
|
26
|
+
- Do not let individual agents invent output paths. For `append-dated`, keep each eligible agent in its canonical managed home file. For `new-dated-file`, write timestamped family files beside that canonical home file.
|
|
27
27
|
- Treat the current working directory as the trust boundary. Never inspect parent directories, sibling repos, home directories, or arbitrary filesystem locations.
|
|
28
28
|
- Never glob or search outside the configured docs directory, `.wunderkind/`, `AGENTS.md`, `.sisyphus/`, and this shipped `/docs-index` command asset.
|
|
29
29
|
- Surface partial failures clearly, but still keep the docs index aligned with the successfully refreshed or created outputs.
|
|
@@ -32,8 +32,11 @@ This command is invoked as `/docs-index`.
|
|
|
32
32
|
|
|
33
33
|
- This command is shipped as `/docs-index`.
|
|
34
34
|
- Use the configured docs path and history mode from project-local Wunderkind config. The docs path must remain relative to the current project root.
|
|
35
|
-
- The coordinator owns the docs index and overall summary; individual agents own their own canonical managed home files.
|
|
36
|
-
-
|
|
35
|
+
- The coordinator owns the docs index and overall summary; individual agents own their own canonical managed home files and any timestamped managed family files derived from them.
|
|
36
|
+
- Use one shared UTC token per `/docs-index` run. Timestamp format: `YYYY-MM-DDTHH-mm-ssZ`, for example `2026-03-12T18-37-52Z`.
|
|
37
|
+
- `append-dated` appends canonical headings like `## Update 2026-03-12T18-37-52Z`; collisions use `## Update 2026-03-12T18-37-52Z (2)`.
|
|
38
|
+
- `new-dated-file` writes family files like `marketing-strategy--2026-03-12T18-37-52Z.md`; collisions use `marketing-strategy--2026-03-12T18-37-52Z--2.md`.
|
|
39
|
+
- Existing date-only sections and files remain valid history and must not be rewritten or normalized away.
|
|
37
40
|
- Partial success is acceptable for docs refresh.
|
|
38
41
|
- After the run, ask the user whether to run `init-deep` as an optional follow-up.
|
|
39
42
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-config.d.ts","sourceRoot":"","sources":["../../src/agents/docs-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAErD,MAAM,WAAW,eAAe;IAC9B,iBAAiB,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,yBAAyB;;;;CAI5B,CAAA;AAEV,wBAAgB,wBAAwB,IAAI,MAAM,EAAE,CAInD;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAyB7D,CAAA;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,cAAc,GAC7B,MAAM,
|
|
1
|
+
{"version":3,"file":"docs-config.d.ts","sourceRoot":"","sources":["../../src/agents/docs-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAErD,MAAM,WAAW,eAAe;IAC9B,iBAAiB,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,yBAAyB;;;;CAI5B,CAAA;AAEV,wBAAgB,wBAAwB,IAAI,MAAM,EAAE,CAInD;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAyB7D,CAAA;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,cAAc,GAC7B,MAAM,CAsCR"}
|
|
@@ -39,25 +39,32 @@ export function buildDocsInstruction(agentKey, docsPath, docHistoryMode) {
|
|
|
39
39
|
if (!config) {
|
|
40
40
|
throw new Error(`Unknown agent key: ${agentKey}`);
|
|
41
41
|
}
|
|
42
|
+
const managedOutputInstruction = docHistoryMode === "new-dated-file"
|
|
43
|
+
? "Within `/docs-index`, treat the canonical unsuffixed file as your managed home lane. Do not rewrite that canonical file for this mode. Instead, create or refresh a UTC-timestamped managed family file alongside it, using the shared run token and the configured collision suffix rules."
|
|
44
|
+
: "Within `/docs-index`, treat this file as your managed home file. Refresh its contents if it already exists, or create it if missing.";
|
|
42
45
|
return `When docs output is enabled, write to: ${docsPath}/${config.canonicalFilename}
|
|
43
46
|
|
|
44
47
|
History mode: ${docHistoryMode}
|
|
45
48
|
- overwrite: Replace the file contents each time.
|
|
46
|
-
- append-dated: Append a
|
|
47
|
-
- new-dated-file: Create a
|
|
49
|
+
- append-dated: Append a UTC-timestamped section heading like \`## Update 2026-03-12T18-37-52Z\` to the canonical home file.
|
|
50
|
+
- new-dated-file: Create a UTC-timestamped managed family file like \`marketing-strategy--2026-03-12T18-37-52Z.md\` alongside the canonical home file.
|
|
48
51
|
- overwrite-archive: Overwrite the current file and archive the old one.
|
|
49
52
|
|
|
50
53
|
UTC Timestamp Contract:
|
|
51
54
|
- Always use the exact ISO 8601 UTC format: YYYY-MM-DDTHH-mm-ssZ
|
|
52
55
|
- Example: 2026-03-12T18-37-52Z
|
|
56
|
+
- Use one shared base UTC token per \`/docs-index\` run.
|
|
53
57
|
- Within a single \`/docs-index\` run, all participating agents reuse the same shared base timestamp token provided in the prompt context.
|
|
54
|
-
-
|
|
58
|
+
- Append collisions use headings like \`## Update 2026-03-12T18-37-52Z (2)\`.
|
|
59
|
+
- New dated-file collisions use filenames like \`marketing-strategy--2026-03-12T18-37-52Z--2.md\`.
|
|
60
|
+
- Timestamped files derived from canonical basenames are managed family files, not legacy artifacts.
|
|
61
|
+
- Existing date-only sections and files should remain untouched.
|
|
55
62
|
- Existing date-only files or sections (e.g. YYYY-MM-DD) remain untouched; do not migrate them.
|
|
56
63
|
|
|
57
64
|
Use the configured docs path exactly as provided: ${docsPath}
|
|
58
65
|
The docs path is always relative to the current project root. Do not inspect or write outside that root.
|
|
59
66
|
|
|
60
|
-
|
|
67
|
+
${managedOutputInstruction}
|
|
61
68
|
|
|
62
69
|
Each eligible docs agent owns its own canonical document output and should stay within that managed lane unless the user explicitly asks for something broader.
|
|
63
70
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-config.js","sourceRoot":"","sources":["../../src/agents/docs-config.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,UAAU,EAAE,aAAa;IACzB,UAAU,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5I,OAAO,0CAA0C,QAAQ,IAAI,MAAM,CAAC,iBAAiB;;gBAEvE,cAAc;;;;;;;;;;;;;;;;;oDAiBsB,QAAQ;;;EAG1D,wBAAwB;;;;0MAIgL,CAAA;AAC1M,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import type { DocHistoryMode } from "../cli/types.js";
|
|
2
|
+
export type DocsIndexOutputStrategy = "in-place" | "dated-file-family";
|
|
1
3
|
export interface DocsIndexPlanEntry {
|
|
2
4
|
agentKey: string;
|
|
3
5
|
canonicalFilename: string;
|
|
4
|
-
|
|
6
|
+
managedLanePath: string;
|
|
7
|
+
outputStrategy: DocsIndexOutputStrategy;
|
|
8
|
+
writePathPattern: string;
|
|
5
9
|
}
|
|
6
10
|
export interface DocsIndexPlan {
|
|
7
11
|
docsPath: string;
|
|
@@ -17,8 +21,9 @@ export interface DocsIndexSummaryInput {
|
|
|
17
21
|
existingBefore: string[];
|
|
18
22
|
existingAfter: string[];
|
|
19
23
|
skippedAgentKeys?: string[];
|
|
24
|
+
outputPathsAfterByAgentKey?: Record<string, string[]>;
|
|
20
25
|
}
|
|
21
|
-
export declare function buildDocsIndexPlan(docsPath: string, cwd?: string): DocsIndexPlan;
|
|
26
|
+
export declare function buildDocsIndexPlan(docsPath: string, cwd?: string, docHistoryMode?: DocHistoryMode): DocsIndexPlan;
|
|
22
27
|
export declare function validateDocsIndexPlan(plan: DocsIndexPlan): string[];
|
|
23
28
|
export declare function summarizeDocsIndexResults(plan: DocsIndexPlan, input: DocsIndexSummaryInput): DocsIndexSummary;
|
|
24
29
|
//# sourceMappingURL=docs-index-plan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-index-plan.d.ts","sourceRoot":"","sources":["../../src/agents/docs-index-plan.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"docs-index-plan.d.ts","sourceRoot":"","sources":["../../src/agents/docs-index-plan.ts"],"names":[],"mappings":"AAEA,OAA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
|
|
3
|
-
export function buildDocsIndexPlan(docsPath, cwd = process.cwd()) {
|
|
3
|
+
export function buildDocsIndexPlan(docsPath, cwd = process.cwd(), docHistoryMode = "overwrite") {
|
|
4
4
|
const normalizedDocsPath = resolveProjectLocalDocsPath(docsPath, cwd).docsPath;
|
|
5
5
|
const entries = getDocsEligibleAgentKeys().map((agentKey) => {
|
|
6
6
|
const config = AGENT_DOCS_CONFIG[agentKey];
|
|
7
7
|
if (!config) {
|
|
8
8
|
throw new Error(`Unknown docs agent key: ${agentKey}`);
|
|
9
9
|
}
|
|
10
|
+
const managedLanePath = `${normalizedDocsPath}/${config.canonicalFilename}`;
|
|
11
|
+
const outputStrategy = docHistoryMode === "new-dated-file" ? "dated-file-family" : "in-place";
|
|
12
|
+
const canonicalBasename = config.canonicalFilename.endsWith(".md")
|
|
13
|
+
? config.canonicalFilename.slice(0, -3)
|
|
14
|
+
: config.canonicalFilename;
|
|
15
|
+
const writePathPattern = outputStrategy === "dated-file-family"
|
|
16
|
+
? `${normalizedDocsPath}/${canonicalBasename}--<UTC_TOKEN>.md`
|
|
17
|
+
: managedLanePath;
|
|
10
18
|
return {
|
|
11
19
|
agentKey,
|
|
12
20
|
canonicalFilename: config.canonicalFilename,
|
|
13
|
-
|
|
21
|
+
managedLanePath,
|
|
22
|
+
outputStrategy,
|
|
23
|
+
writePathPattern,
|
|
14
24
|
};
|
|
15
25
|
});
|
|
16
26
|
return {
|
|
@@ -22,12 +32,12 @@ export function validateDocsIndexPlan(plan) {
|
|
|
22
32
|
const seen = new Map();
|
|
23
33
|
const duplicates = [];
|
|
24
34
|
for (const entry of plan.entries) {
|
|
25
|
-
const existing = seen.get(entry.
|
|
35
|
+
const existing = seen.get(entry.managedLanePath);
|
|
26
36
|
if (existing) {
|
|
27
|
-
duplicates.push(`${existing} <-> ${entry.agentKey} => ${entry.
|
|
37
|
+
duplicates.push(`${existing} <-> ${entry.agentKey} => ${entry.managedLanePath}`);
|
|
28
38
|
continue;
|
|
29
39
|
}
|
|
30
|
-
seen.set(entry.
|
|
40
|
+
seen.set(entry.managedLanePath, entry.agentKey);
|
|
31
41
|
}
|
|
32
42
|
return duplicates;
|
|
33
43
|
}
|
|
@@ -35,27 +45,46 @@ export function summarizeDocsIndexResults(plan, input) {
|
|
|
35
45
|
const existingBefore = new Set(input.existingBefore);
|
|
36
46
|
const existingAfter = new Set(input.existingAfter);
|
|
37
47
|
const skippedAgentKeys = new Set(input.skippedAgentKeys ?? []);
|
|
48
|
+
const outputPathsAfterByAgentKey = input.outputPathsAfterByAgentKey ?? {};
|
|
38
49
|
const created = [];
|
|
39
50
|
const refreshed = [];
|
|
40
51
|
const skipped = [];
|
|
41
52
|
const failed = [];
|
|
42
53
|
for (const entry of plan.entries) {
|
|
43
54
|
if (skippedAgentKeys.has(entry.agentKey)) {
|
|
44
|
-
skipped.push(entry.
|
|
55
|
+
skipped.push(entry.managedLanePath);
|
|
45
56
|
continue;
|
|
46
57
|
}
|
|
47
|
-
|
|
48
|
-
|
|
58
|
+
if (entry.outputStrategy === "dated-file-family") {
|
|
59
|
+
const outputPaths = outputPathsAfterByAgentKey[entry.agentKey] ?? [];
|
|
60
|
+
const existingOutputPaths = outputPaths.filter((path) => existingAfter.has(path));
|
|
61
|
+
if (existingOutputPaths.length > 0) {
|
|
62
|
+
for (const outputPath of existingOutputPaths) {
|
|
63
|
+
const existedBefore = existingBefore.has(outputPath);
|
|
64
|
+
if (existedBefore) {
|
|
65
|
+
refreshed.push(outputPath);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
created.push(outputPath);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
failed.push(entry.managedLanePath);
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const existedBefore = existingBefore.has(entry.managedLanePath);
|
|
77
|
+
const existsAfter = existingAfter.has(entry.managedLanePath);
|
|
49
78
|
if (existsAfter) {
|
|
50
79
|
if (existedBefore) {
|
|
51
|
-
refreshed.push(entry.
|
|
80
|
+
refreshed.push(entry.managedLanePath);
|
|
52
81
|
}
|
|
53
82
|
else {
|
|
54
|
-
created.push(entry.
|
|
83
|
+
created.push(entry.managedLanePath);
|
|
55
84
|
}
|
|
56
85
|
continue;
|
|
57
86
|
}
|
|
58
|
-
failed.push(entry.
|
|
87
|
+
failed.push(entry.managedLanePath);
|
|
59
88
|
}
|
|
60
89
|
return { created, refreshed, skipped, failed };
|
|
61
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-index-plan.js","sourceRoot":"","sources":["../../src/agents/docs-index-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"docs-index-plan.js","sourceRoot":"","sources":["../../src/agents/docs-index-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAA;AAgC1E,MAAM,UAAU,kBAAkB,CAChC,QAAgB,EAChB,MAAc,OAAO,CAAC,GAAG,EAAE,EAC3B,iBAAiC,WAAW;IAE5C,MAAM,kBAAkB,GAAG,2BAA2B,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAA;IAC9E,MAAM,OAAO,GAAG,wBAAwB,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC1D,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAA;QAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,2BAA2B,QAAQ,EAAE,CAAC,CAAA;QACxD,CAAC;QAED,MAAM,eAAe,GAAG,GAAG,kBAAkB,IAAI,M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C,IAAI,CAAC,UAAU,CAAC,CAAA;oBAC5B,CAAC;yBAAM,CAAC;wBACN,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;oBAC1B,CAAC;gBACH,CAAC;gBACD,SAAQ;YACV,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;YAClC,SAAQ;QACV,CAAC;QAED,MAAM,aAAa,GAAG,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;QAC/D,MAAM,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;QAE5D,IAAI,WAAW,EAAE,CAAC;YAChB,IAAI,aAAa,EAAE,CAAC;gBAClB,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;YACvC,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;YACrC,CAAC;YACD,SAAQ;QACV,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;IACpC,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;AAChD,CAAC"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { ConfigMergeResult, DetectedConfig, GlobalConfig, InstallConfig, InstallScope, BaselineConfigKey, PluginVersionInfo, ProjectConfig } from "../types.js";
|
|
2
|
+
interface ConfigManagerPathOverride {
|
|
3
|
+
cwd?: string;
|
|
4
|
+
home?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function __setConfigManagerPathOverrideForTests(override: ConfigManagerPathOverride): void;
|
|
7
|
+
export declare function __resetConfigManagerPathOverrideForTests(): void;
|
|
2
8
|
export declare function getDefaultInstallConfig(): InstallConfig;
|
|
3
9
|
export declare function getDefaultGlobalConfig(): GlobalConfig;
|
|
4
10
|
export declare function getDefaultProjectConfig(): ProjectConfig;
|
|
@@ -65,4 +71,5 @@ export declare function removeNativeAgentFiles(scope: InstallScope): ConfigMerge
|
|
|
65
71
|
export declare function removeNativeCommandFiles(): ConfigMergeResult;
|
|
66
72
|
export declare function removeNativeSkillFiles(scope: InstallScope): ConfigMergeResult;
|
|
67
73
|
export declare function removeGlobalWunderkindConfig(): ConfigMergeResult;
|
|
74
|
+
export {};
|
|
68
75
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/config-manager/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAGV,iBAAiB,EAGjB,cAAc,EAEd,YAAY,EACZ,aAAa,EAEb,YAAY,EAGZ,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EAId,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/config-manager/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAGV,iBAAiB,EAGjB,cAAc,EAEd,YAAY,EACZ,aAAa,EAEb,YAAY,EAGZ,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EAId,MAAM,aAAa,CAAA;AAyBpB,UAAU,yBAAyB;IACjC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAiDD,wBAAgB,sCAAsC,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI,CAchG;AAED,wBAAgB,wCAAwC,IAAI,IAAI,CAE/D;AAiED,wBAAgB,uBAAuB,IAAI,aAAa,CAEvD;AAED,wBAAgB,sBAAsB,IAAI,YAAY,CAErD;AAED,wBAAgB,uBAAuB,IAAI,aAAa,CAEvD;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,YAAY,GAAG;IAC9D,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,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E,GAAG,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAO1I;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAsB7E;AAED,wBAAgB,wBAAwB,IAAI,iBAAiB,CAsB5D;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAsB7E;AAED,wBAAgB,4BAA4B,IAAI,iBAAiB,CAgBhE"}
|
|
@@ -8,23 +8,60 @@ import { WUNDERKIND_AGENT_IDS, WUNDERKIND_AGENT_DEFINITIONS } from "../../agents
|
|
|
8
8
|
import { renderNativeAgentMarkdown } from "../../agents/render-markdown.js";
|
|
9
9
|
const PACKAGE_NAME = "@grant-vine/wunderkind";
|
|
10
10
|
const WUNDERKIND_SCHEMA_URL = "https://raw.githubusercontent.com/grant-vine/wunderkind/main/schemas/wunderkind.config.schema.json";
|
|
11
|
-
const CONFIG_DIR = join(homedir(), ".config", "opencode");
|
|
12
|
-
const CONFIG_JSON = join(CONFIG_DIR, "opencode.json");
|
|
13
|
-
const CONFIG_JSONC = join(CONFIG_DIR, "opencode.jsonc");
|
|
14
|
-
const LEGACY_CONFIG_JSON = join(CONFIG_DIR, "config.json");
|
|
15
|
-
const LEGACY_CONFIG_JSONC = join(CONFIG_DIR, "config.jsonc");
|
|
16
|
-
const GLOBAL_WUNDERKIND_DIR = join(homedir(), ".wunderkind");
|
|
17
|
-
const GLOBAL_WUNDERKIND_CONFIG = join(GLOBAL_WUNDERKIND_DIR, "wunderkind.config.jsonc");
|
|
18
|
-
const GLOBAL_OPENCODE_AGENTS_DIR = join(CONFIG_DIR, "agents");
|
|
19
|
-
const GLOBAL_OPENCODE_COMMANDS_DIR = join(CONFIG_DIR, "commands");
|
|
20
|
-
const GLOBAL_OPENCODE_SKILLS_DIR = join(CONFIG_DIR, "skills");
|
|
21
|
-
const GLOBAL_OPENCODE_NODE_MODULES = join(CONFIG_DIR, "node_modules");
|
|
22
|
-
const GLOBAL_CACHE_DIR = join(homedir(), ".cache", "opencode");
|
|
23
|
-
const WUNDERKIND_DIR = join(process.cwd(), ".wunderkind");
|
|
24
|
-
const WUNDERKIND_CONFIG = join(WUNDERKIND_DIR, "wunderkind.config.jsonc");
|
|
25
|
-
const LEGACY_WUNDERKIND_CONFIG = join(process.cwd(), "wunderkind.config.jsonc");
|
|
26
11
|
const OMO_CANONICAL_PACKAGE_NAME = "oh-my-openagent";
|
|
27
12
|
const OMO_LEGACY_PACKAGE_NAME = "oh-my-opencode";
|
|
13
|
+
const CONFIG_MANAGER_PATH_OVERRIDE_KEY = Symbol.for("wunderkind.configManagerPathOverride");
|
|
14
|
+
function getConfigManagerPathOverride() {
|
|
15
|
+
return globalThis[CONFIG_MANAGER_PATH_OVERRIDE_KEY] ?? null;
|
|
16
|
+
}
|
|
17
|
+
function resolveConfigManagerRuntimeContext() {
|
|
18
|
+
const override = getConfigManagerPathOverride();
|
|
19
|
+
return {
|
|
20
|
+
cwd: override?.cwd ?? process.cwd(),
|
|
21
|
+
home: override?.home ?? homedir(),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function resolveConfigManagerPaths(cwd, home) {
|
|
25
|
+
const runtimeContext = resolveConfigManagerRuntimeContext();
|
|
26
|
+
const resolvedCwd = cwd ?? runtimeContext.cwd;
|
|
27
|
+
const resolvedHome = home ?? runtimeContext.home;
|
|
28
|
+
const configDir = join(resolvedHome, ".config", "opencode");
|
|
29
|
+
const globalWunderkindDir = join(resolvedHome, ".wunderkind");
|
|
30
|
+
const wunderkindDir = join(resolvedCwd, ".wunderkind");
|
|
31
|
+
return {
|
|
32
|
+
configDir,
|
|
33
|
+
configJson: join(configDir, "opencode.json"),
|
|
34
|
+
configJsonc: join(configDir, "opencode.jsonc"),
|
|
35
|
+
legacyConfigJson: join(configDir, "config.json"),
|
|
36
|
+
legacyConfigJsonc: join(configDir, "config.jsonc"),
|
|
37
|
+
globalWunderkindDir,
|
|
38
|
+
globalWunderkindConfig: join(globalWunderkindDir, "wunderkind.config.jsonc"),
|
|
39
|
+
globalOpenCodeAgentsDir: join(configDir, "agents"),
|
|
40
|
+
globalOpenCodeCommandsDir: join(configDir, "commands"),
|
|
41
|
+
globalOpenCodeSkillsDir: join(configDir, "skills"),
|
|
42
|
+
globalOpenCodeNodeModules: join(configDir, "node_modules"),
|
|
43
|
+
globalCacheDir: join(resolvedHome, ".cache", "opencode"),
|
|
44
|
+
wunderkindDir,
|
|
45
|
+
wunderkindConfig: join(wunderkindDir, "wunderkind.config.jsonc"),
|
|
46
|
+
legacyWunderkindConfig: join(resolvedCwd, "wunderkind.config.jsonc"),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export function __setConfigManagerPathOverrideForTests(override) {
|
|
50
|
+
const nextOverride = {};
|
|
51
|
+
if (override.cwd !== undefined)
|
|
52
|
+
nextOverride.cwd = override.cwd;
|
|
53
|
+
if (override.home !== undefined)
|
|
54
|
+
nextOverride.home = override.home;
|
|
55
|
+
const globalState = globalThis;
|
|
56
|
+
if (Object.keys(nextOverride).length === 0) {
|
|
57
|
+
delete globalState[CONFIG_MANAGER_PATH_OVERRIDE_KEY];
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
globalState[CONFIG_MANAGER_PATH_OVERRIDE_KEY] = nextOverride;
|
|
61
|
+
}
|
|
62
|
+
export function __resetConfigManagerPathOverrideForTests() {
|
|
63
|
+
delete globalThis[CONFIG_MANAGER_PATH_OVERRIDE_KEY];
|
|
64
|
+
}
|
|
28
65
|
const PROJECT_CONFIG_KEYS = [
|
|
29
66
|
"teamCulture",
|
|
30
67
|
"orgStructure",
|
|
@@ -87,11 +124,13 @@ export function getDefaultProjectConfig() {
|
|
|
87
124
|
return { ...DEFAULT_PROJECT_CONFIG };
|
|
88
125
|
}
|
|
89
126
|
export function resolveOpenCodeConfigPath(scope) {
|
|
127
|
+
const runtimeContext = resolveConfigManagerRuntimeContext();
|
|
128
|
+
const paths = resolveConfigManagerPaths();
|
|
90
129
|
if (scope === "project") {
|
|
91
|
-
const projectJson = join(
|
|
92
|
-
const projectJsonc = join(
|
|
93
|
-
const projectLegacyJson = join(
|
|
94
|
-
const projectLegacyJsonc = join(
|
|
130
|
+
const projectJson = join(runtimeContext.cwd, "opencode.json");
|
|
131
|
+
const projectJsonc = join(runtimeContext.cwd, "opencode.jsonc");
|
|
132
|
+
const projectLegacyJson = join(runtimeContext.cwd, "config.json");
|
|
133
|
+
const projectLegacyJsonc = join(runtimeContext.cwd, "config.jsonc");
|
|
95
134
|
if (existsSync(projectJson))
|
|
96
135
|
return { path: projectJson, format: "json", source: "opencode.json" };
|
|
97
136
|
if (existsSync(projectJsonc))
|
|
@@ -102,15 +141,15 @@ export function resolveOpenCodeConfigPath(scope) {
|
|
|
102
141
|
return { path: projectLegacyJsonc, format: "jsonc", source: "config.jsonc" };
|
|
103
142
|
return { path: projectJson, format: "none", source: "default" };
|
|
104
143
|
}
|
|
105
|
-
if (existsSync(
|
|
106
|
-
return { path:
|
|
107
|
-
if (existsSync(
|
|
108
|
-
return { path:
|
|
109
|
-
if (existsSync(
|
|
110
|
-
return { path:
|
|
111
|
-
if (existsSync(
|
|
112
|
-
return { path:
|
|
113
|
-
return { path:
|
|
144
|
+
if (existsSync(paths.configJson))
|
|
145
|
+
return { path: paths.configJson, format: "json", source: "opencode.json" };
|
|
146
|
+
if (existsSync(paths.configJsonc))
|
|
147
|
+
return { path: paths.configJsonc, format: "jsonc", source: "opencode.jsonc" };
|
|
148
|
+
if (existsSync(paths.legacyConfigJson))
|
|
149
|
+
return { path: paths.legacyConfigJson, format: "json", source: "config.json" };
|
|
150
|
+
if (existsSync(paths.legacyConfigJsonc))
|
|
151
|
+
return { path: paths.legacyConfigJsonc, format: "jsonc", source: "config.jsonc" };
|
|
152
|
+
return { path: paths.configJson, format: "none", source: "default" };
|
|
114
153
|
}
|
|
115
154
|
function parseConfig(path) {
|
|
116
155
|
try {
|
|
@@ -148,9 +187,10 @@ function findPluginEntry(entries, packageName) {
|
|
|
148
187
|
return entries.find((entry) => entry === packageName || entry.startsWith(`${packageName}@`) || entry.startsWith(`file://`)) ?? null;
|
|
149
188
|
}
|
|
150
189
|
function detectLoadedPackageVersion(packageName) {
|
|
190
|
+
const paths = resolveConfigManagerPaths();
|
|
151
191
|
const candidates = [
|
|
152
|
-
join(
|
|
153
|
-
join(
|
|
192
|
+
join(paths.globalOpenCodeNodeModules, packageName, "package.json"),
|
|
193
|
+
join(paths.globalCacheDir, "node_modules", packageName, "package.json"),
|
|
154
194
|
];
|
|
155
195
|
for (const candidate of candidates) {
|
|
156
196
|
if (!existsSync(candidate))
|
|
@@ -163,8 +203,9 @@ function detectLoadedPackageVersion(packageName) {
|
|
|
163
203
|
return { version: null, packagePath: null };
|
|
164
204
|
}
|
|
165
205
|
function detectLoadedPackageSources(packageName) {
|
|
166
|
-
const
|
|
167
|
-
const
|
|
206
|
+
const paths = resolveConfigManagerPaths();
|
|
207
|
+
const globalPath = join(paths.globalOpenCodeNodeModules, packageName, "package.json");
|
|
208
|
+
const cachePath = join(paths.globalCacheDir, "node_modules", packageName, "package.json");
|
|
168
209
|
return {
|
|
169
210
|
global: {
|
|
170
211
|
version: existsSync(globalPath) ? readJsonVersion(globalPath) : null,
|
|
@@ -392,8 +433,9 @@ function detectRegistration() {
|
|
|
392
433
|
};
|
|
393
434
|
}
|
|
394
435
|
export function readWunderkindConfig() {
|
|
395
|
-
const
|
|
396
|
-
const
|
|
436
|
+
const paths = resolveConfigManagerPaths();
|
|
437
|
+
const projectConfig = existsSync(paths.wunderkindConfig) ? parseWunderkindConfig(paths.wunderkindConfig) : null;
|
|
438
|
+
const globalConfig = existsSync(paths.globalWunderkindConfig) ? parseWunderkindConfig(paths.globalWunderkindConfig) : null;
|
|
397
439
|
if (!projectConfig && !globalConfig) {
|
|
398
440
|
return null;
|
|
399
441
|
}
|
|
@@ -407,11 +449,13 @@ export function readWunderkindConfig() {
|
|
|
407
449
|
};
|
|
408
450
|
}
|
|
409
451
|
export function readGlobalWunderkindConfig() {
|
|
410
|
-
const
|
|
452
|
+
const paths = resolveConfigManagerPaths();
|
|
453
|
+
const globalConfig = existsSync(paths.globalWunderkindConfig) ? parseWunderkindConfig(paths.globalWunderkindConfig) : null;
|
|
411
454
|
return globalConfig ? coerceGlobalConfig(globalConfig) : null;
|
|
412
455
|
}
|
|
413
456
|
export function readProjectWunderkindConfig() {
|
|
414
|
-
const
|
|
457
|
+
const paths = resolveConfigManagerPaths();
|
|
458
|
+
const projectConfig = existsSync(paths.wunderkindConfig) ? parseWunderkindConfig(paths.wunderkindConfig) : null;
|
|
415
459
|
return projectConfig ? coerceProjectConfig(projectConfig) : null;
|
|
416
460
|
}
|
|
417
461
|
function ensureConfigDir(configDir, configPath) {
|
|
@@ -465,25 +509,27 @@ function renderProjectWunderkindConfig(config, baseline) {
|
|
|
465
509
|
if (baselineOverrideLines.length > 0) {
|
|
466
510
|
lines.push(` // Optional project-local baseline overrides — only write fields that intentionally differ from global defaults`, ...baselineOverrideLines, ``);
|
|
467
511
|
}
|
|
468
|
-
lines.push(` // Team culture baseline — affects all agents' communication style and decision rigour`, ` // "formal-strict" | "pragmatic-balanced" | "experimental-informal"`, ` "teamCulture": ${JSON.stringify(config.teamCulture)},`, ` // Org structure — "flat" (peers, escalate to user) | "hierarchical" (domain authority applies, CISO has hard veto)`, ` "orgStructure": ${JSON.stringify(config.orgStructure)},`, ``, ` // Agent personalities — controls each agent's default character archetype`, ` // CISO: "paranoid-enforcer" | "pragmatic-risk-manager" | "educator-collaborator"`, ` // Also carries security-incident posture and compliance-impact escalation style`, ` "cisoPersonality": ${JSON.stringify(config.cisoPersonality)},`, ` // CTO/Fullstack: "grizzled-sysadmin" | "startup-bro" | "code-archaeologist"`, ` // Also carries TDD, regression, technical triage, reliability, runbook, and supportability posture`, ` "ctoPersonality": ${JSON.stringify(config.ctoPersonality)},`, ` // CMO/Marketing: "data-driven" | "brand-storyteller" | "growth-hacker"`, ` // Also carries brand, community, developer advocacy, docs adoption, funnel, and campaign-analysis posture`, ` "cmoPersonality": ${JSON.stringify(config.cmoPersonality)},`, ` // Product: "user-advocate" | "velocity-optimizer" | "outcome-obsessed"`, ` // Also carries issue intake, repro shaping, acceptance review, experiment readouts, and backlog-ready triage posture`, ` "productPersonality": ${JSON.stringify(config.productPersonality)},`, ` // Creative Director: "perfectionist-craftsperson" | "bold-provocateur" | "pragmatic-problem-solver"`, ` "creativePersonality": ${JSON.stringify(config.creativePersonality)},`, ` // Legal Counsel: "cautious-gatekeeper" | "pragmatic-advisor" | "plain-english-counselor"`, ` "legalPersonality": ${JSON.stringify(config.legalPersonality)},`, ``, ` // Docs output settings`, ` // Enable or disable writing docs outputs to disk`, ` "docsEnabled": ${JSON.stringify(config.docsEnabled)},`, ` // Directory path where docs outputs are written`, ` "docsPath": ${JSON.stringify(config.docsPath)},`, ` // History mode: "overwrite" | "append-dated" | "new-dated-file" | "overwrite-archive"`, ` "docHistoryMode": ${JSON.stringify(config.docHistoryMode)},`, ` // PRD / planning workflow mode`, ` // "filesystem" writes to .sisyphus/; "github" expects gh + GitHub repo readiness`, ` // PRD pipeline mode: "filesystem" | "github"`);
|
|
512
|
+
lines.push(` // Team culture baseline — affects all agents' communication style and decision rigour`, ` // "formal-strict" | "pragmatic-balanced" | "experimental-informal"`, ` "teamCulture": ${JSON.stringify(config.teamCulture)},`, ` // Org structure — "flat" (peers, escalate to user) | "hierarchical" (domain authority applies, CISO has hard veto)`, ` "orgStructure": ${JSON.stringify(config.orgStructure)},`, ``, ` // Agent personalities — controls each agent's default character archetype`, ` // CISO: "paranoid-enforcer" | "pragmatic-risk-manager" | "educator-collaborator"`, ` // Also carries security-incident posture and compliance-impact escalation style`, ` "cisoPersonality": ${JSON.stringify(config.cisoPersonality)},`, ` // CTO/Fullstack: "grizzled-sysadmin" | "startup-bro" | "code-archaeologist"`, ` // Also carries TDD, regression, technical triage, reliability, runbook, and supportability posture`, ` "ctoPersonality": ${JSON.stringify(config.ctoPersonality)},`, ` // CMO/Marketing: "data-driven" | "brand-storyteller" | "growth-hacker"`, ` // Also carries brand, community, developer advocacy, docs adoption, funnel, and campaign-analysis posture`, ` "cmoPersonality": ${JSON.stringify(config.cmoPersonality)},`, ` // Product: "user-advocate" | "velocity-optimizer" | "outcome-obsessed"`, ` // Also carries issue intake, repro shaping, acceptance review, experiment readouts, and backlog-ready triage posture`, ` "productPersonality": ${JSON.stringify(config.productPersonality)},`, ` // Creative Director: "perfectionist-craftsperson" | "bold-provocateur" | "pragmatic-problem-solver"`, ` "creativePersonality": ${JSON.stringify(config.creativePersonality)},`, ` // Legal Counsel: "cautious-gatekeeper" | "pragmatic-advisor" | "plain-english-counselor"`, ` "legalPersonality": ${JSON.stringify(config.legalPersonality)},`, ``, ` // Docs output settings`, ` // Enable or disable writing docs outputs to disk`, ` "docsEnabled": ${JSON.stringify(config.docsEnabled)},`, ` // Directory path where docs outputs are written`, ` "docsPath": ${JSON.stringify(config.docsPath)},`, ` // History mode: "overwrite" | "append-dated" (UTC-timestamped sections) | "new-dated-file" (UTC-timestamped files) | "overwrite-archive"`, ` "docHistoryMode": ${JSON.stringify(config.docHistoryMode)},`, ` // PRD / planning workflow mode`, ` // "filesystem" writes to .sisyphus/; "github" expects gh + GitHub repo readiness`, ` // PRD pipeline mode: "filesystem" | "github"`);
|
|
469
513
|
lines.push(` "prdPipelineMode": ${JSON.stringify(config.prdPipelineMode ?? "filesystem")}`);
|
|
470
514
|
lines.push(`}`, ``);
|
|
471
515
|
return lines.join("\n");
|
|
472
516
|
}
|
|
473
517
|
export function writeGlobalWunderkindConfig(config) {
|
|
474
|
-
const
|
|
518
|
+
const paths = resolveConfigManagerPaths();
|
|
519
|
+
const setupError = ensureConfigDir(paths.globalWunderkindDir, paths.globalWunderkindConfig);
|
|
475
520
|
if (setupError)
|
|
476
521
|
return setupError;
|
|
477
522
|
try {
|
|
478
|
-
writeFileSync(
|
|
479
|
-
return { success: true, configPath:
|
|
523
|
+
writeFileSync(paths.globalWunderkindConfig, renderGlobalWunderkindConfig(config));
|
|
524
|
+
return { success: true, configPath: paths.globalWunderkindConfig };
|
|
480
525
|
}
|
|
481
526
|
catch (err) {
|
|
482
|
-
return { success: false, configPath:
|
|
527
|
+
return { success: false, configPath: paths.globalWunderkindConfig, error: String(err) };
|
|
483
528
|
}
|
|
484
529
|
}
|
|
485
530
|
export function writeProjectWunderkindConfig(config) {
|
|
486
|
-
const
|
|
531
|
+
const paths = resolveConfigManagerPaths();
|
|
532
|
+
const setupError = ensureConfigDir(paths.wunderkindDir, paths.wunderkindConfig);
|
|
487
533
|
if (setupError)
|
|
488
534
|
return setupError;
|
|
489
535
|
try {
|
|
@@ -491,18 +537,19 @@ export function writeProjectWunderkindConfig(config) {
|
|
|
491
537
|
...DEFAULT_GLOBAL_CONFIG,
|
|
492
538
|
...(readGlobalWunderkindConfig() ?? {}),
|
|
493
539
|
};
|
|
494
|
-
writeFileSync(
|
|
495
|
-
return { success: true, configPath:
|
|
540
|
+
writeFileSync(paths.wunderkindConfig, renderProjectWunderkindConfig(config, baseline));
|
|
541
|
+
return { success: true, configPath: paths.wunderkindConfig };
|
|
496
542
|
}
|
|
497
543
|
catch (err) {
|
|
498
|
-
return { success: false, configPath:
|
|
544
|
+
return { success: false, configPath: paths.wunderkindConfig, error: String(err) };
|
|
499
545
|
}
|
|
500
546
|
}
|
|
501
547
|
export function readWunderkindConfigForScope(scope) {
|
|
502
548
|
if (scope === "global") {
|
|
503
549
|
return readGlobalWunderkindConfig();
|
|
504
550
|
}
|
|
505
|
-
const
|
|
551
|
+
const paths = resolveConfigManagerPaths();
|
|
552
|
+
const projectConfig = existsSync(paths.wunderkindConfig) ? parseWunderkindConfig(paths.wunderkindConfig) : null;
|
|
506
553
|
if (!projectConfig)
|
|
507
554
|
return null;
|
|
508
555
|
return {
|
|
@@ -511,6 +558,7 @@ export function readWunderkindConfigForScope(scope) {
|
|
|
511
558
|
};
|
|
512
559
|
}
|
|
513
560
|
export function detectCurrentConfig() {
|
|
561
|
+
const paths = resolveConfigManagerPaths();
|
|
514
562
|
const projectResolution = resolveOpenCodeConfigPath("project");
|
|
515
563
|
const globalResolution = resolveOpenCodeConfigPath("global");
|
|
516
564
|
const defaults = getDefaultInstallConfig();
|
|
@@ -531,10 +579,10 @@ export function detectCurrentConfig() {
|
|
|
531
579
|
...registration,
|
|
532
580
|
};
|
|
533
581
|
}
|
|
534
|
-
const globalConfig = existsSync(
|
|
582
|
+
const globalConfig = existsSync(paths.globalWunderkindConfig) ? parseWunderkindConfig(paths.globalWunderkindConfig) : null;
|
|
535
583
|
const legacyGlobalProjectFields = globalConfig ? listLegacyGlobalProjectFields(globalConfig) : [];
|
|
536
584
|
const globalSafe = readGlobalWunderkindConfig();
|
|
537
|
-
const projectConfig = existsSync(
|
|
585
|
+
const projectConfig = existsSync(paths.wunderkindConfig) ? parseWunderkindConfig(paths.wunderkindConfig) : null;
|
|
538
586
|
const projectGlobalSafe = coerceGlobalConfig(projectConfig ?? {});
|
|
539
587
|
const projectLocal = readProjectWunderkindConfig();
|
|
540
588
|
const legacyGlobalProject = coerceProjectConfig(globalConfig ?? {});
|
|
@@ -566,8 +614,10 @@ export function detectCurrentConfig() {
|
|
|
566
614
|
};
|
|
567
615
|
}
|
|
568
616
|
export function addPluginToOpenCodeConfig(scope) {
|
|
617
|
+
const runtimeContext = resolveConfigManagerRuntimeContext();
|
|
618
|
+
const paths = resolveConfigManagerPaths();
|
|
569
619
|
const targetPath = resolveOpenCodeConfigPath(scope).path;
|
|
570
|
-
const targetDir = scope === "project" ?
|
|
620
|
+
const targetDir = scope === "project" ? runtimeContext.cwd : paths.configDir;
|
|
571
621
|
try {
|
|
572
622
|
if (!existsSync(targetDir)) {
|
|
573
623
|
mkdirSync(targetDir, { recursive: true });
|
|
@@ -610,7 +660,7 @@ export function writeWunderkindConfig(installConfig, scope) {
|
|
|
610
660
|
return writeProjectWunderkindConfig(installConfig);
|
|
611
661
|
}
|
|
612
662
|
export function detectLegacyConfig() {
|
|
613
|
-
return existsSync(
|
|
663
|
+
return existsSync(resolveConfigManagerPaths().legacyWunderkindConfig);
|
|
614
664
|
}
|
|
615
665
|
export function removePluginFromOpenCodeConfig(scope) {
|
|
616
666
|
const targetPath = resolveOpenCodeConfigPath(scope).path;
|
|
@@ -644,13 +694,13 @@ export function removePluginFromOpenCodeConfig(scope) {
|
|
|
644
694
|
}
|
|
645
695
|
}
|
|
646
696
|
export function getNativeAgentDir() {
|
|
647
|
-
return
|
|
697
|
+
return resolveConfigManagerPaths().globalOpenCodeAgentsDir;
|
|
648
698
|
}
|
|
649
699
|
export function getNativeCommandsDir() {
|
|
650
|
-
return
|
|
700
|
+
return resolveConfigManagerPaths().globalOpenCodeCommandsDir;
|
|
651
701
|
}
|
|
652
702
|
export function getNativeSkillsDir() {
|
|
653
|
-
return
|
|
703
|
+
return resolveConfigManagerPaths().globalOpenCodeSkillsDir;
|
|
654
704
|
}
|
|
655
705
|
export function getNativeAgentFilePaths(scope) {
|
|
656
706
|
void scope;
|
|
@@ -836,18 +886,19 @@ export function removeNativeSkillFiles(scope) {
|
|
|
836
886
|
}
|
|
837
887
|
}
|
|
838
888
|
export function removeGlobalWunderkindConfig() {
|
|
889
|
+
const paths = resolveConfigManagerPaths();
|
|
839
890
|
try {
|
|
840
|
-
if (!existsSync(
|
|
841
|
-
return { success: true, configPath:
|
|
891
|
+
if (!existsSync(paths.globalWunderkindConfig)) {
|
|
892
|
+
return { success: true, configPath: paths.globalWunderkindConfig, changed: false };
|
|
842
893
|
}
|
|
843
|
-
rmSync(
|
|
844
|
-
if (existsSync(
|
|
845
|
-
rmSync(
|
|
894
|
+
rmSync(paths.globalWunderkindConfig, { force: true });
|
|
895
|
+
if (existsSync(paths.globalWunderkindDir) && readdirSync(paths.globalWunderkindDir).length === 0) {
|
|
896
|
+
rmSync(paths.globalWunderkindDir, { recursive: true, force: true });
|
|
846
897
|
}
|
|
847
|
-
return { success: true, configPath:
|
|
898
|
+
return { success: true, configPath: paths.globalWunderkindConfig, changed: true };
|
|
848
899
|
}
|
|
849
900
|
catch (err) {
|
|
850
|
-
return { success: false, configPath:
|
|
901
|
+
return { success: false, configPath: paths.globalWunderkindConfig, error: String(err) };
|
|
851
902
|
}
|
|
852
903
|
}
|
|
853
904
|
//# sourceMappingURL=index.js.map
|