agents-inc 0.155.0 → 0.157.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 +45 -0
- package/dist/{chunk-PMUABBPG.js → chunk-24IGOJ7E.js} +9 -13
- package/dist/chunk-24IGOJ7E.js.map +1 -0
- package/dist/{chunk-H6UTKTLK.js → chunk-3E52LCYC.js} +98 -34
- package/dist/chunk-3E52LCYC.js.map +1 -0
- package/dist/{chunk-UMH2YZKG.js → chunk-4CIAZOTD.js} +4 -6
- package/dist/{chunk-UMH2YZKG.js.map → chunk-4CIAZOTD.js.map} +1 -1
- package/dist/{chunk-D2CAV7MG.js → chunk-4DMFK67G.js} +2 -2
- package/dist/{chunk-PNMM5HNX.js → chunk-4EPJWN7C.js} +9 -10
- package/dist/chunk-4EPJWN7C.js.map +1 -0
- package/dist/{chunk-MHRC3KRX.js → chunk-4KHUHPX4.js} +3 -3
- package/dist/chunk-4KHUHPX4.js.map +1 -0
- package/dist/{chunk-2H7UWE2G.js → chunk-CEGHC7L5.js} +13 -12
- package/dist/chunk-CEGHC7L5.js.map +1 -0
- package/dist/{chunk-MO5FGLVS.js → chunk-DCIC35R7.js} +11 -12
- package/dist/chunk-DCIC35R7.js.map +1 -0
- package/dist/{chunk-ILUVL7WM.js → chunk-DZD25NHW.js} +2 -2
- package/dist/{chunk-IO5YBKHV.js → chunk-G6G2FT2G.js} +10 -8
- package/dist/chunk-G6G2FT2G.js.map +1 -0
- package/dist/{chunk-RWOYPOMR.js → chunk-IGOFZG3S.js} +19 -5
- package/dist/chunk-IGOFZG3S.js.map +1 -0
- package/dist/{chunk-CLFHC2DK.js → chunk-K2VTGT45.js} +17 -18
- package/dist/chunk-K2VTGT45.js.map +1 -0
- package/dist/{chunk-YO2LTXB4.js → chunk-KTXVQ7OM.js} +115 -10
- package/dist/chunk-KTXVQ7OM.js.map +1 -0
- package/dist/{chunk-SY4X2LND.js → chunk-KUZBMEWR.js} +3 -3
- package/dist/{chunk-ZUAZHDKP.js → chunk-LDBVIPTP.js} +277 -40
- package/dist/chunk-LDBVIPTP.js.map +1 -0
- package/dist/{chunk-PCC4LBKB.js → chunk-MU2TQ5KK.js} +2 -2
- package/dist/{chunk-4G2YHZIM.js → chunk-O4K42CJB.js} +4 -6
- package/dist/{chunk-4G2YHZIM.js.map → chunk-O4K42CJB.js.map} +1 -1
- package/dist/{chunk-HXKOIWLU.js → chunk-P6OKOH62.js} +2 -6
- package/dist/chunk-P6OKOH62.js.map +1 -0
- package/dist/{chunk-IXRZAHZF.js → chunk-PGZSNNDA.js} +4 -4
- package/dist/{chunk-LJCNUP6M.js → chunk-PVPNVK3W.js} +2 -2
- package/dist/{chunk-4A4L3YIW.js → chunk-PXGDA2SY.js} +6 -7
- package/dist/chunk-PXGDA2SY.js.map +1 -0
- package/dist/{chunk-G47TDUK3.js → chunk-QNAMXQKF.js} +2 -2
- package/dist/{chunk-5OKLCVM4.js → chunk-QO4XD5V5.js} +3 -3
- package/dist/{chunk-5F2YR5XV.js → chunk-QXPMQBEI.js} +15 -5
- package/dist/chunk-QXPMQBEI.js.map +1 -0
- package/dist/{chunk-F5T6TV4Z.js → chunk-RLU2IXD3.js} +40 -14
- package/dist/chunk-RLU2IXD3.js.map +1 -0
- package/dist/{chunk-WCAUUBHO.js → chunk-RVXI5VQU.js} +14758 -14501
- package/dist/chunk-RVXI5VQU.js.map +1 -0
- package/dist/{chunk-WFRTHH3A.js → chunk-TZRXWFF5.js} +3 -3
- package/dist/{chunk-HG4JPXJT.js → chunk-V7PMQDDU.js} +23 -10
- package/dist/chunk-V7PMQDDU.js.map +1 -0
- package/dist/{chunk-Y5Y7XHVU.js → chunk-VI6U2PJG.js} +4 -4
- package/dist/{chunk-TBOVYLQJ.js → chunk-VTIDLRNA.js} +2 -2
- package/dist/{chunk-OKH64JZE.js → chunk-WCZNQECQ.js} +2 -2
- package/dist/{chunk-QWVXOCXO.js → chunk-WENBESZO.js} +7 -9
- package/dist/{chunk-QWVXOCXO.js.map → chunk-WENBESZO.js.map} +1 -1
- package/dist/{chunk-TNGMF4UX.js → chunk-XOZAKFTS.js} +12 -12
- package/dist/chunk-XOZAKFTS.js.map +1 -0
- package/dist/{chunk-6RLV45HN.js → chunk-YG5YPVTJ.js} +6 -6
- package/dist/chunk-YG5YPVTJ.js.map +1 -0
- package/dist/{chunk-HTYH7CKN.js → chunk-YKFCUVHG.js} +3 -3
- package/dist/{chunk-VPASBA7P.js → chunk-YXI3BTQQ.js} +2 -2
- package/dist/chunk-Z3H2K5PK.js +1352 -0
- package/dist/chunk-Z3H2K5PK.js.map +1 -0
- package/dist/{chunk-5QZAK6J7.js → chunk-ZAQ6WMJV.js} +50 -18
- package/dist/chunk-ZAQ6WMJV.js.map +1 -0
- package/dist/{chunk-GS2NZ3GD.js → chunk-ZBYVDXZG.js} +5 -5
- package/dist/chunk-ZBYVDXZG.js.map +1 -0
- package/dist/commands/build/marketplace.js +9 -12
- package/dist/commands/build/marketplace.js.map +1 -1
- package/dist/commands/build/plugins.js +9 -12
- package/dist/commands/build/plugins.js.map +1 -1
- package/dist/commands/compile.js +15 -19
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/doctor.js +75 -54
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/edit.js +154 -109
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/eject.js +68 -38
- package/dist/commands/eject.js.map +1 -1
- package/dist/commands/init.js +36 -39
- package/dist/commands/list.js +8 -10
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/new/marketplace.js +8 -11
- package/dist/commands/new/marketplace.js.map +1 -1
- package/dist/commands/search.js +10 -13
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/share.js +8 -10
- package/dist/commands/share.js.map +1 -1
- package/dist/commands/uninstall.js +39 -28
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +7 -10
- package/dist/commands/update.js.map +1 -1
- package/dist/components/common/removal-plan-confirm.js +2 -2
- package/dist/components/common/select-list.js +2 -2
- package/dist/components/wizard/category-grid.js +4 -5
- package/dist/components/wizard/checkbox-grid.js +4 -4
- package/dist/components/wizard/domain-selection.js +9 -11
- package/dist/components/wizard/run-wizard-session.js +26 -28
- package/dist/components/wizard/scroll-affordance.js +2 -2
- package/dist/components/wizard/skill-agent-summary.js +5 -7
- package/dist/components/wizard/source-grid.js +5 -6
- package/dist/components/wizard/stack-selection.js +7 -9
- package/dist/components/wizard/step-agents.js +8 -10
- package/dist/components/wizard/step-build.js +7 -9
- package/dist/components/wizard/step-confirm.js +9 -11
- package/dist/components/wizard/step-sources.js +8 -10
- package/dist/components/wizard/step-stack.js +8 -10
- package/dist/components/wizard/summary-panel.js +8 -10
- package/dist/components/wizard/toast.js +2 -2
- package/dist/components/wizard/wizard-layout.js +12 -14
- package/dist/components/wizard/wizard-tabs.js +2 -4
- package/dist/components/wizard/wizard.js +25 -27
- package/dist/hooks/init.js +36 -39
- package/dist/hooks/init.js.map +1 -1
- package/dist/load-agent-defs-M6LRVISN.js +13 -0
- package/dist/recompile-project-agents-G7ZM25PC.js +17 -0
- package/dist/{source-loader-3DL3NYUX.js → source-loader-BIAEDR5R.js} +4 -8
- package/dist/src/agents/_templates/agent.liquid +2 -2
- package/dist/stores/wizard-store.js +6 -6
- package/package.json +1 -1
- package/src/agents/_templates/agent.liquid +2 -2
- package/src/schemas/custom-metadata.schema.json +1 -1
- package/src/schemas/marketplace.schema.json +2 -1
- package/dist/chunk-2H7UWE2G.js.map +0 -1
- package/dist/chunk-4A4L3YIW.js.map +0 -1
- package/dist/chunk-5F2YR5XV.js.map +0 -1
- package/dist/chunk-5QZAK6J7.js.map +0 -1
- package/dist/chunk-6RLV45HN.js.map +0 -1
- package/dist/chunk-CLFHC2DK.js.map +0 -1
- package/dist/chunk-F2AMBBIA.js +0 -64
- package/dist/chunk-F2AMBBIA.js.map +0 -1
- package/dist/chunk-F5T6TV4Z.js.map +0 -1
- package/dist/chunk-GS2NZ3GD.js.map +0 -1
- package/dist/chunk-H6UTKTLK.js.map +0 -1
- package/dist/chunk-HG4JPXJT.js.map +0 -1
- package/dist/chunk-HXKOIWLU.js.map +0 -1
- package/dist/chunk-IO5YBKHV.js.map +0 -1
- package/dist/chunk-MHRC3KRX.js.map +0 -1
- package/dist/chunk-MO5FGLVS.js.map +0 -1
- package/dist/chunk-PMUABBPG.js.map +0 -1
- package/dist/chunk-PNMM5HNX.js.map +0 -1
- package/dist/chunk-RWOYPOMR.js.map +0 -1
- package/dist/chunk-TNGMF4UX.js.map +0 -1
- package/dist/chunk-VASLW636.js +0 -23
- package/dist/chunk-VASLW636.js.map +0 -1
- package/dist/chunk-WCAUUBHO.js.map +0 -1
- package/dist/chunk-WUQ3MTPF.js +0 -173
- package/dist/chunk-WUQ3MTPF.js.map +0 -1
- package/dist/chunk-XAXJWXI4.js +0 -1667
- package/dist/chunk-XAXJWXI4.js.map +0 -1
- package/dist/chunk-YO2LTXB4.js.map +0 -1
- package/dist/chunk-ZUAZHDKP.js.map +0 -1
- package/dist/copy-local-skills-NSUTBVLJ.js +0 -14
- package/dist/load-agent-defs-X4E57I2U.js +0 -15
- package/dist/loader-G6BFG2VA.js +0 -24
- package/dist/recompile-project-agents-JE4MM72I.js +0 -20
- package/dist/recompile-project-agents-JE4MM72I.js.map +0 -1
- package/dist/source-loader-3DL3NYUX.js.map +0 -1
- /package/dist/{chunk-D2CAV7MG.js.map → chunk-4DMFK67G.js.map} +0 -0
- /package/dist/{chunk-ILUVL7WM.js.map → chunk-DZD25NHW.js.map} +0 -0
- /package/dist/{chunk-SY4X2LND.js.map → chunk-KUZBMEWR.js.map} +0 -0
- /package/dist/{chunk-PCC4LBKB.js.map → chunk-MU2TQ5KK.js.map} +0 -0
- /package/dist/{chunk-IXRZAHZF.js.map → chunk-PGZSNNDA.js.map} +0 -0
- /package/dist/{chunk-LJCNUP6M.js.map → chunk-PVPNVK3W.js.map} +0 -0
- /package/dist/{chunk-G47TDUK3.js.map → chunk-QNAMXQKF.js.map} +0 -0
- /package/dist/{chunk-5OKLCVM4.js.map → chunk-QO4XD5V5.js.map} +0 -0
- /package/dist/{chunk-WFRTHH3A.js.map → chunk-TZRXWFF5.js.map} +0 -0
- /package/dist/{chunk-Y5Y7XHVU.js.map → chunk-VI6U2PJG.js.map} +0 -0
- /package/dist/{chunk-TBOVYLQJ.js.map → chunk-VTIDLRNA.js.map} +0 -0
- /package/dist/{chunk-OKH64JZE.js.map → chunk-WCZNQECQ.js.map} +0 -0
- /package/dist/{chunk-HTYH7CKN.js.map → chunk-YKFCUVHG.js.map} +0 -0
- /package/dist/{chunk-VPASBA7P.js.map → chunk-YXI3BTQQ.js.map} +0 -0
- /package/dist/{copy-local-skills-NSUTBVLJ.js.map → load-agent-defs-M6LRVISN.js.map} +0 -0
- /package/dist/{load-agent-defs-X4E57I2U.js.map → recompile-project-agents-G7ZM25PC.js.map} +0 -0
- /package/dist/{loader-G6BFG2VA.js.map → source-loader-BIAEDR5R.js.map} +0 -0
package/dist/chunk-WUQ3MTPF.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
compileAgents
|
|
4
|
-
} from "./chunk-5QZAK6J7.js";
|
|
5
|
-
import {
|
|
6
|
-
ConfigLoadError,
|
|
7
|
-
buildAndMergeConfig,
|
|
8
|
-
detectGlobalInstallation,
|
|
9
|
-
detectInstallation,
|
|
10
|
-
detectProjectInstallation,
|
|
11
|
-
ensureBlankPair,
|
|
12
|
-
isHomeDirectory,
|
|
13
|
-
loadProjectConfig,
|
|
14
|
-
loadSkillsMatrixFromSource,
|
|
15
|
-
resolveInstallPaths,
|
|
16
|
-
writeScopedFromWizard
|
|
17
|
-
} from "./chunk-WCAUUBHO.js";
|
|
18
|
-
import {
|
|
19
|
-
disableBuffering,
|
|
20
|
-
drainBuffer,
|
|
21
|
-
enableBuffering,
|
|
22
|
-
ensureDir,
|
|
23
|
-
loadMergedAgents
|
|
24
|
-
} from "./chunk-XAXJWXI4.js";
|
|
25
|
-
|
|
26
|
-
// src/cli/lib/operations/source/load-source.ts
|
|
27
|
-
async function loadSource(options) {
|
|
28
|
-
const { caller, sourceFlag, projectDir, captureStartupMessages } = options;
|
|
29
|
-
if (captureStartupMessages) {
|
|
30
|
-
enableBuffering();
|
|
31
|
-
}
|
|
32
|
-
let sourceResult;
|
|
33
|
-
try {
|
|
34
|
-
sourceResult = await loadSkillsMatrixFromSource({
|
|
35
|
-
...caller !== void 0 && { caller },
|
|
36
|
-
...sourceFlag !== void 0 && { sourceFlag },
|
|
37
|
-
projectDir
|
|
38
|
-
});
|
|
39
|
-
} catch (error) {
|
|
40
|
-
if (captureStartupMessages) {
|
|
41
|
-
disableBuffering();
|
|
42
|
-
}
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
let startupMessages = [];
|
|
46
|
-
if (captureStartupMessages) {
|
|
47
|
-
startupMessages = drainBuffer();
|
|
48
|
-
disableBuffering();
|
|
49
|
-
}
|
|
50
|
-
return { sourceResult, startupMessages };
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// src/cli/lib/operations/project/detect-project.ts
|
|
54
|
-
async function detectProject(projectDir) {
|
|
55
|
-
const resolvedDir = projectDir ?? process.cwd();
|
|
56
|
-
let installation;
|
|
57
|
-
try {
|
|
58
|
-
installation = await detectInstallation(resolvedDir);
|
|
59
|
-
} catch (error) {
|
|
60
|
-
if (error instanceof ConfigLoadError) return null;
|
|
61
|
-
throw error;
|
|
62
|
-
}
|
|
63
|
-
if (!installation) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
const loaded = await loadProjectConfig(installation.projectDir);
|
|
67
|
-
return {
|
|
68
|
-
installation,
|
|
69
|
-
config: loaded?.config ?? null,
|
|
70
|
-
configPath: loaded?.configPath ?? null
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// src/cli/lib/operations/project/detect-both-installations.ts
|
|
75
|
-
async function detectBothInstallations(projectDir) {
|
|
76
|
-
const global = await detectGlobalInstallation();
|
|
77
|
-
const project = isHomeDirectory(projectDir) ? null : await detectProjectInstallation(projectDir);
|
|
78
|
-
return { global, project, hasBoth: !!global && !!project };
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// src/cli/lib/operations/project/write-project-config.ts
|
|
82
|
-
import path from "path";
|
|
83
|
-
async function writeProjectConfig(options) {
|
|
84
|
-
const { wizardResult, sourceResult, projectDir, sourceFlag } = options;
|
|
85
|
-
const projectPaths = resolveInstallPaths(projectDir, "project");
|
|
86
|
-
await ensureDir(path.dirname(projectPaths.configPath));
|
|
87
|
-
let agents;
|
|
88
|
-
if (options.agents) {
|
|
89
|
-
agents = options.agents;
|
|
90
|
-
} else {
|
|
91
|
-
agents = await loadMergedAgents(sourceResult.sourcePath);
|
|
92
|
-
}
|
|
93
|
-
const mergeResult = await buildAndMergeConfig(
|
|
94
|
-
wizardResult,
|
|
95
|
-
sourceResult,
|
|
96
|
-
projectDir,
|
|
97
|
-
sourceFlag,
|
|
98
|
-
options.authoritativeScope
|
|
99
|
-
);
|
|
100
|
-
const finalConfig = mergeResult.config;
|
|
101
|
-
const isProjectContext = !isHomeDirectory(projectDir);
|
|
102
|
-
if (isProjectContext) {
|
|
103
|
-
await ensureBlankPair();
|
|
104
|
-
}
|
|
105
|
-
const propagation = await writeScopedFromWizard({
|
|
106
|
-
finalConfig,
|
|
107
|
-
matrix: sourceResult.matrix,
|
|
108
|
-
agents,
|
|
109
|
-
projectDir,
|
|
110
|
-
projectConfigPath: projectPaths.configPath,
|
|
111
|
-
projectInstallationExists: isProjectContext,
|
|
112
|
-
// The same word the merger above took. It decides the config ROW there and the GLOBAL
|
|
113
|
-
// config a project write commits here, and the two files disagree the moment it does not
|
|
114
|
-
// reach both: a row preserved for a skill whose directory the removal diff deleted.
|
|
115
|
-
...options.authoritativeScope !== void 0 && {
|
|
116
|
-
authoritativeScope: options.authoritativeScope
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
return {
|
|
120
|
-
config: finalConfig,
|
|
121
|
-
configPath: projectPaths.configPath,
|
|
122
|
-
wasMerged: mergeResult.merged,
|
|
123
|
-
...mergeResult.existingConfigPath !== void 0 && {
|
|
124
|
-
existingConfigPath: mergeResult.existingConfigPath
|
|
125
|
-
},
|
|
126
|
-
filesWritten: isProjectContext ? 4 : 2,
|
|
127
|
-
propagation
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// src/cli/lib/operations/project/compile-agents-all-scopes.ts
|
|
132
|
-
import os from "os";
|
|
133
|
-
async function compileAgentsAllScopes(options) {
|
|
134
|
-
const { projectDir, sourcePath, skills, agentScopeMap } = options;
|
|
135
|
-
const base = { sourcePath, skills, agentScopeMap };
|
|
136
|
-
if (isHomeDirectory(projectDir)) {
|
|
137
|
-
return compileAgents({
|
|
138
|
-
...base,
|
|
139
|
-
projectDir,
|
|
140
|
-
outputDir: resolveInstallPaths(projectDir, "project").agentsDir
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
const globalResult = await compileAgents({
|
|
144
|
-
...base,
|
|
145
|
-
projectDir: os.homedir(),
|
|
146
|
-
outputDir: resolveInstallPaths(os.homedir(), "global").agentsDir,
|
|
147
|
-
scopeFilter: "global"
|
|
148
|
-
});
|
|
149
|
-
const projectResult = await compileAgents({
|
|
150
|
-
...base,
|
|
151
|
-
projectDir,
|
|
152
|
-
outputDir: resolveInstallPaths(projectDir, "project").agentsDir,
|
|
153
|
-
scopeFilter: "project"
|
|
154
|
-
});
|
|
155
|
-
return mergeCompilationResults(globalResult, projectResult);
|
|
156
|
-
}
|
|
157
|
-
function mergeCompilationResults(...results) {
|
|
158
|
-
return {
|
|
159
|
-
compiled: results.flatMap((r) => r.compiled),
|
|
160
|
-
rewritten: results.flatMap((r) => r.rewritten),
|
|
161
|
-
failed: results.flatMap((r) => r.failed),
|
|
162
|
-
warnings: results.flatMap((r) => r.warnings)
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export {
|
|
167
|
-
loadSource,
|
|
168
|
-
detectProject,
|
|
169
|
-
detectBothInstallations,
|
|
170
|
-
writeProjectConfig,
|
|
171
|
-
compileAgentsAllScopes
|
|
172
|
-
};
|
|
173
|
-
//# sourceMappingURL=chunk-WUQ3MTPF.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/lib/operations/source/load-source.ts","../src/cli/lib/operations/project/detect-project.ts","../src/cli/lib/operations/project/detect-both-installations.ts","../src/cli/lib/operations/project/write-project-config.ts","../src/cli/lib/operations/project/compile-agents-all-scopes.ts"],"sourcesContent":["import { loadSkillsMatrixFromSource, type SourceLoadResult } from \"../../loading/index.js\";\nimport type { SourceCaller } from \"../../configuration/index.js\";\nimport {\n enableBuffering,\n drainBuffer,\n disableBuffering,\n type StartupMessage,\n} from \"../../../utils/logger.js\";\n\nexport type LoadSourceOptions = {\n /** Whether this load may reach the init-time source rungs — see {@link SourceCaller}. */\n caller?: SourceCaller;\n sourceFlag?: string;\n projectDir: string;\n /** When true, enables message buffering and captures startup messages. Default: false. */\n captureStartupMessages?: boolean;\n};\n\nexport type LoadedSource = {\n sourceResult: SourceLoadResult;\n /** Empty array when captureStartupMessages is false. */\n startupMessages: StartupMessage[];\n};\n\n/**\n * Loads the skills matrix from a resolved source.\n *\n * When `captureStartupMessages` is true, wraps the load in buffer mode so\n * warn() calls during loading are captured instead of written to stderr.\n * The caller (init/edit) hands them to the wizard, which paints them as a band\n * above the step — stderr does not survive the wizard clearing the terminal.\n *\n * @throws {Error} If source resolution or fetching fails.\n */\nexport async function loadSource(options: LoadSourceOptions): Promise<LoadedSource> {\n const { caller, sourceFlag, projectDir, captureStartupMessages } = options;\n\n if (captureStartupMessages) {\n enableBuffering();\n }\n\n let sourceResult: SourceLoadResult;\n try {\n sourceResult = await loadSkillsMatrixFromSource({\n ...(caller !== undefined && { caller }),\n ...(sourceFlag !== undefined && { sourceFlag }),\n projectDir,\n });\n } catch (error) {\n if (captureStartupMessages) {\n disableBuffering();\n }\n throw error;\n }\n\n let startupMessages: StartupMessage[] = [];\n if (captureStartupMessages) {\n startupMessages = drainBuffer();\n disableBuffering();\n }\n\n return { sourceResult, startupMessages };\n}\n","import { detectInstallation, type Installation } from \"../../installation/index.js\";\nimport { ConfigLoadError, loadProjectConfig } from \"../../configuration/index.js\";\nimport type { ProjectConfig } from \"../../../types/index.js\";\n\nexport type DetectedProject = {\n installation: Installation;\n config: ProjectConfig | null;\n configPath: string | null;\n};\n\n/**\n * Detects an existing CLI installation and loads its project config.\n *\n * Uses detectInstallation() which checks project-level first, then falls back\n * to global. Returns the installation metadata plus the loaded config.\n *\n * Does NOT throw. Returns null when no installation is found OR when the config\n * file exists but is corrupt — the caller (doctor, edit) reports the resulting\n * null as a config/installation problem to the user. `compile` deliberately\n * does NOT use this wrapper: it detects scopes directly so it can hard-error on\n * a corrupt config instead of degrading to null.\n */\nexport async function detectProject(projectDir?: string): Promise<DetectedProject | null> {\n const resolvedDir = projectDir ?? process.cwd();\n\n let installation: Installation | null;\n try {\n installation = await detectInstallation(resolvedDir);\n } catch (error) {\n if (error instanceof ConfigLoadError) return null;\n throw error;\n }\n\n if (!installation) {\n return null;\n }\n\n const loaded = await loadProjectConfig(installation.projectDir);\n\n return {\n installation,\n config: loaded?.config ?? null,\n configPath: loaded?.configPath ?? null,\n };\n}\n","import {\n detectGlobalInstallation,\n detectProjectInstallation,\n isHomeDirectory,\n type Installation,\n} from \"../../installation/index.js\";\n\nexport type BothInstallations = {\n global: Installation | null;\n project: Installation | null;\n hasBoth: boolean;\n};\n\n/**\n * Detects both global and project installations.\n *\n * Skips project detection when projectDir is the home directory\n * to avoid double-compile. Returns a convenience `hasBoth` flag\n * used by callers to set scopeFilter on compile passes.\n */\nexport async function detectBothInstallations(projectDir: string): Promise<BothInstallations> {\n const global = await detectGlobalInstallation();\n\n const project = isHomeDirectory(projectDir) ? null : await detectProjectInstallation(projectDir);\n return { global, project, hasBoth: !!global && !!project };\n}\n","import path from \"path\";\nimport {\n buildAndMergeConfig,\n resolveInstallPaths,\n isHomeDirectory,\n} from \"../../installation/index.js\";\nimport { loadMergedAgents, type SourceLoadResult } from \"../../loading/index.js\";\nimport type { AuthoritativeScope } from \"../../configuration/index.js\";\nimport {\n ensureBlankPair,\n writeScopedFromWizard,\n type GateReport,\n} from \"../../config-gate/index.js\";\nimport { ensureDir } from \"../../../utils/fs.js\";\nimport type { ProjectConfig, AgentDefinition, AgentName } from \"../../../types/index.js\";\nimport type { WizardResultV2 } from \"../../../components/wizard/wizard.js\";\n\nexport type ConfigWriteOptions = {\n wizardResult: WizardResultV2;\n sourceResult: SourceLoadResult;\n projectDir: string;\n sourceFlag?: string;\n /** Pre-loaded agent definitions. If omitted, loads from CLI + source. */\n agents?: Partial<Record<AgentName, AgentDefinition>>;\n /**\n * Authority of `cc edit`'s newConfig over absent entries (D-233 Scenario C):\n * `\"all\"` (global edit) drops any deselected entry, `\"owned\"` (project edit) drops deselected\n * project-owned entries only, `undefined` (init) keeps additive union-preserve.\n */\n authoritativeScope?: AuthoritativeScope;\n};\n\nexport type ConfigWriteResult = {\n config: ProjectConfig;\n configPath: string;\n wasMerged: boolean;\n existingConfigPath?: string;\n filesWritten: number;\n /**\n * What the gated write did: what moved in the global config, which registered\n * projects it fanned out to, and the recompile it drove in them. The caller\n * renders it; the work is already done.\n */\n propagation: GateReport;\n};\n\n/**\n * Builds, merges, and writes project configuration files.\n *\n * Handles the full config pipeline:\n * 1. buildAndMergeConfig() — generates config from wizard result, merges with existing\n * 2. loadAllAgents() — loads agent definitions for config-types generation\n * 3. ensureBlankPair() — ensures the global config pair exists (when in project context)\n * 4. writeScopedFromWizard() — writes config.ts and config-types.ts split by scope,\n * fans global changes out to registered projects and recompiles their agents\n */\nexport async function writeProjectConfig(options: ConfigWriteOptions): Promise<ConfigWriteResult> {\n const { wizardResult, sourceResult, projectDir, sourceFlag } = options;\n const projectPaths = resolveInstallPaths(projectDir, \"project\");\n\n await ensureDir(path.dirname(projectPaths.configPath));\n\n let agents: Partial<Record<AgentName, AgentDefinition>>;\n if (options.agents) {\n agents = options.agents;\n } else {\n agents = await loadMergedAgents(sourceResult.sourcePath);\n }\n\n const mergeResult = await buildAndMergeConfig(\n wizardResult,\n sourceResult,\n projectDir,\n sourceFlag,\n options.authoritativeScope,\n );\n const finalConfig = mergeResult.config;\n\n const isProjectContext = !isHomeDirectory(projectDir);\n\n if (isProjectContext) {\n await ensureBlankPair();\n }\n\n const propagation = await writeScopedFromWizard({\n finalConfig,\n matrix: sourceResult.matrix,\n agents,\n projectDir,\n projectConfigPath: projectPaths.configPath,\n projectInstallationExists: isProjectContext,\n // The same word the merger above took. It decides the config ROW there and the GLOBAL\n // config a project write commits here, and the two files disagree the moment it does not\n // reach both: a row preserved for a skill whose directory the removal diff deleted.\n ...(options.authoritativeScope !== undefined && {\n authoritativeScope: options.authoritativeScope,\n }),\n });\n\n return {\n config: finalConfig,\n configPath: projectPaths.configPath,\n wasMerged: mergeResult.merged,\n ...(mergeResult.existingConfigPath !== undefined && {\n existingConfigPath: mergeResult.existingConfigPath,\n }),\n filesWritten: isProjectContext ? 4 : 2,\n propagation,\n };\n}\n","import os from \"os\";\nimport { compileAgents, type CompilationResult } from \"./compile-agents.js\";\nimport { isHomeDirectory, resolveInstallPaths } from \"../../installation/index.js\";\nimport type { AgentName, SkillDefinitionMap, SkillScope } from \"../../../types/index.js\";\n\nexport type CompileAllScopesOptions = {\n /** Working directory of the command — a project root, or home for global context. */\n projectDir: string;\n sourcePath: string;\n skills: SkillDefinitionMap;\n agentScopeMap: Map<AgentName, SkillScope>;\n};\n\n/**\n * Compiles agents for every scope the current context owns.\n *\n * Home context: a single pass writing to the home agents directory.\n * Project context: a global pass (from home) then a project pass, each\n * filtered to its own scope so the project pass cannot overwrite global\n * agents with zero-skill versions. Results merge in pass order.\n */\nexport async function compileAgentsAllScopes(\n options: CompileAllScopesOptions,\n): Promise<CompilationResult> {\n const { projectDir, sourcePath, skills, agentScopeMap } = options;\n const base = { sourcePath, skills, agentScopeMap };\n\n if (isHomeDirectory(projectDir)) {\n return compileAgents({\n ...base,\n projectDir,\n outputDir: resolveInstallPaths(projectDir, \"project\").agentsDir,\n });\n }\n\n const globalResult = await compileAgents({\n ...base,\n projectDir: os.homedir(),\n outputDir: resolveInstallPaths(os.homedir(), \"global\").agentsDir,\n scopeFilter: \"global\",\n });\n const projectResult = await compileAgents({\n ...base,\n projectDir,\n outputDir: resolveInstallPaths(projectDir, \"project\").agentsDir,\n scopeFilter: \"project\",\n });\n return mergeCompilationResults(globalResult, projectResult);\n}\n\nfunction mergeCompilationResults(...results: CompilationResult[]): CompilationResult {\n return {\n compiled: results.flatMap((r) => r.compiled),\n rewritten: results.flatMap((r) => r.rewritten),\n failed: results.flatMap((r) => r.failed),\n warnings: results.flatMap((r) => r.warnings),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,eAAsB,WAAW,SAAmD;AAClF,QAAM,EAAE,QAAQ,YAAY,YAAY,uBAAuB,IAAI;AAEnE,MAAI,wBAAwB;AAC1B,oBAAgB;AAAA,EAClB;AAEA,MAAI;AACJ,MAAI;AACF,mBAAe,MAAM,2BAA2B;AAAA,MAC9C,GAAI,WAAW,UAAa,EAAE,OAAO;AAAA,MACrC,GAAI,eAAe,UAAa,EAAE,WAAW;AAAA,MAC7C;AAAA,IACF,CAAC;AAAA,EACH,SAAS,OAAO;AACd,QAAI,wBAAwB;AAC1B,uBAAiB;AAAA,IACnB;AACA,UAAM;AAAA,EACR;AAEA,MAAI,kBAAoC,CAAC;AACzC,MAAI,wBAAwB;AAC1B,sBAAkB,YAAY;AAC9B,qBAAiB;AAAA,EACnB;AAEA,SAAO,EAAE,cAAc,gBAAgB;AACzC;;;ACxCA,eAAsB,cAAc,YAAsD;AACxF,QAAM,cAAc,cAAc,QAAQ,IAAI;AAE9C,MAAI;AACJ,MAAI;AACF,mBA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