@aiwg/cli 2026.10.16 → 2026.10.18
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/dist/src/artifacts/corpus-tools/resolve.js +21 -4
- package/dist/src/artifacts/query-engine-corpus.js +217 -0
- package/dist/src/artifacts/query-engine-discover-output.js +229 -0
- package/dist/src/artifacts/query-engine-discover.js +285 -0
- package/dist/src/artifacts/query-engine-entries.js +188 -0
- package/dist/src/artifacts/query-engine-index.js +249 -0
- package/dist/src/artifacts/query-engine-matching.js +143 -0
- package/dist/src/artifacts/query-engine-options.js +2 -0
- package/dist/src/artifacts/query-engine-rules.js +202 -0
- package/dist/src/artifacts/query-engine-scoring.js +436 -0
- package/dist/src/artifacts/query-engine-show-card.js +194 -0
- package/dist/src/artifacts/query-engine-show-load.js +211 -0
- package/dist/src/artifacts/query-engine-show.js +300 -0
- package/dist/src/artifacts/query-engine.js +7 -2576
- package/dist/src/cli/handlers/mc-agents.js +111 -0
- package/dist/src/cli/handlers/mc-args.js +54 -0
- package/dist/src/cli/handlers/mc-control.js +227 -0
- package/dist/src/cli/handlers/mc-dispatch.js +203 -0
- package/dist/src/cli/handlers/mc-help.js +171 -0
- package/dist/src/cli/handlers/mc-run.js +343 -0
- package/dist/src/cli/handlers/mc-session.js +138 -0
- package/dist/src/cli/handlers/mc-status.js +258 -0
- package/dist/src/cli/handlers/mc-summary.js +43 -0
- package/dist/src/cli/handlers/mc-types.js +3 -0
- package/dist/src/cli/handlers/mc-worker.js +205 -0
- package/dist/src/cli/handlers/mc.js +12 -1665
- package/dist/src/cli/handlers/models-refusal.js +13 -0
- package/dist/src/cli/handlers/models.js +2 -1
- package/dist/src/cli/handlers/remove-bundled.js +133 -0
- package/dist/src/cli/handlers/remove-options.js +31 -0
- package/dist/src/cli/handlers/remove-user.js +174 -0
- package/dist/src/cli/handlers/remove.js +201 -0
- package/dist/src/cli/handlers/subcommands-bundles.js +257 -0
- package/dist/src/cli/handlers/subcommands-discovery.js +165 -0
- package/dist/src/cli/handlers/subcommands-list-format.js +129 -0
- package/dist/src/cli/handlers/subcommands-list.js +250 -0
- package/dist/src/cli/handlers/subcommands-plugins.js +213 -0
- package/dist/src/cli/handlers/subcommands-quickref.js +58 -0
- package/dist/src/cli/handlers/subcommands-rlm.js +113 -0
- package/dist/src/cli/handlers/subcommands-services.js +66 -0
- package/dist/src/cli/handlers/subcommands-storage.js +259 -0
- package/dist/src/cli/handlers/subcommands.js +18 -1984
- package/dist/src/cli/scope-resolver.js +1 -142
- package/dist/src/cli/user-scope-mirror.js +173 -0
- package/dist/src/config/dispatch-host-thresholds.js +2 -0
- package/dist/src/config/dispatch-thresholds-runtime.mjs +4 -0
- package/dist/src/config/host-resource-report.d.mts +5 -0
- package/dist/src/config/host-resource-report.mjs +36 -6
- package/dist/src/config/host-resource-runtime.d.mts +3 -0
- package/dist/src/config/host-resource-runtime.mjs +9 -6
- package/dist/src/decision/ensemble-study/artifacts.js +7 -0
- package/dist/src/decision/ensemble-study/gate-policy.js +58 -0
- package/dist/src/decision/ensemble-study/gates.js +78 -0
- package/dist/src/decision/ensemble-study/protocol.js +18 -21
- package/dist/src/decision/ensemble-study/score.js +3 -2
- package/dist/src/decision/ensemble-study/statistics.js +7 -26
- package/dist/src/decision/sensitivity/comparative-gates.js +135 -0
- package/dist/src/decision/sensitivity/comparative.js +18 -41
- package/dist/src/extensions/claude-hooks-installer.js +18 -0
- package/dist/src/gates/evaluate.js +2 -358
- package/dist/src/gates/observations.js +363 -0
- package/dist/src/gates/pack-composition.js +270 -0
- package/dist/src/gates/pack-tightening.js +197 -0
- package/dist/src/gates/pack-validation.js +262 -0
- package/dist/src/gates/registry-error.js +5 -0
- package/dist/src/gates/registry.js +13 -685
- package/dist/src/mcp/json-document.mjs +29 -0
- package/dist/src/mcp/muse-native-config.mjs +1 -28
- package/dist/src/mission-protocol/worker-review-gate.js +7 -0
- package/dist/src/models/worker-plan.js +5 -5
- package/dist/src/plugin/command-ownership.js +34 -0
- package/dist/src/plugin/skill-command-frontmatter.js +197 -0
- package/dist/src/plugin/skill-command-translator.js +6 -232
- package/dist/src/providers/context-output-ownership.js +26 -0
- package/dist/src/providers/deployment-ownership.d.mts +19 -0
- package/dist/src/providers/deployment-ownership.mjs +226 -0
- package/dist/src/providers/deployment-removal.js +200 -0
- package/dist/src/providers/removal-transaction.js +86 -0
- package/dist/src/providers/settings-document.d.mts +3 -0
- package/dist/src/providers/settings-document.mjs +47 -0
- package/dist/src/providers/settings-removal.js +190 -0
- package/dist/src/providers/skill-ownership.d.mts +19 -2
- package/dist/src/providers/skill-ownership.mjs +12 -4
- package/dist/src/providers/transformation-receipt-integration.js +15 -271
- package/dist/src/providers/transformation-receipt-outputs.js +99 -0
- package/dist/src/providers/transformation-receipt-source.js +194 -0
- package/dist/src/research/identity.js +8 -2
- package/dist/src/research/reference-match.js +42 -7
- package/dist/src/rules/activation.mjs +15 -6
- package/dist/src/rules/core-startup.mjs +2 -2
- package/dist/src/serve/mission-conductor.js +4 -0
- package/dist/src/serve/mission-summary.js +56 -0
- package/dist/src/smiths/context-pipeline/aiwg-md.js +23 -0
- package/dist/src/smiths/context-pipeline/context-file-safety.js +3 -0
- package/dist/src/smiths/context-pipeline/generator.js +1 -1
- package/dist/src/smiths/hook-bridge/index.js +9 -0
- package/package.json +4 -1
- package/schemas/decision/D17StudyProtocol.v1.schema.json +39 -67
- package/tools/agents/deploy-agents.mjs +16 -677
- package/tools/agents/deploy-command-mirrors.mjs +229 -0
- package/tools/agents/deploy-options.mjs +258 -0
- package/tools/agents/deploy-support.mjs +165 -0
- package/tools/agents/providers/base-addon-discovery.mjs +139 -0
- package/tools/agents/providers/base-behaviors.mjs +168 -0
- package/tools/agents/providers/base-context.mjs +205 -0
- package/tools/agents/providers/base-contract.mjs +116 -0
- package/tools/agents/providers/base-files.mjs +252 -0
- package/tools/agents/providers/base-flat-artifacts.mjs +233 -0
- package/tools/agents/providers/base-framework-discovery.mjs +309 -0
- package/tools/agents/providers/base-frontmatter.mjs +196 -0
- package/tools/agents/providers/base-inventory.mjs +269 -0
- package/tools/agents/providers/base-kernel-skills.mjs +354 -0
- package/tools/agents/providers/base-migrations.mjs +258 -0
- package/tools/agents/providers/base-models-platforms.mjs +273 -0
- package/tools/agents/providers/base-rule-index.mjs +450 -0
- package/tools/agents/providers/base-runtime.mjs +60 -0
- package/tools/agents/providers/base-skill-copy.mjs +273 -0
- package/tools/agents/providers/base.mjs +16 -3364
- package/tools/agents/providers/claude-post-deploy.mjs +10 -2
- package/tools/agents/providers/hermes-startup.mjs +0 -5
- package/tools/agents/providers/muse.mjs +7 -2
- package/tools/agents/providers/rule-delivery-surface.mjs +31 -4
- package/tools/agents/providers/rule-deployment-commit.mjs +19 -15
- package/tools/agents/providers/rule-deployment-prepare.mjs +11 -2
- package/tools/agents/providers/rule-projection.mjs +3 -0
- package/tools/ralph-external/lib/worker-invocation-processes.mjs +4 -2
- package/tools/ralph-external/lib/worker-termination.mjs +15 -8
- package/vscode-extension/schemas/aiwg.config.v1.json +2 -4
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
// Project command-shaped skills into provider command surfaces.
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import { addManagedMarker, collectFrameworkArtifacts, contentHash, extractFrameworkSlug, getAddonSkillDirs, listSkillDirs, parseFrontmatter, updateSidecarManifest } from "./providers/base.mjs";
|
|
6
|
+
|
|
7
|
+
const MIRRORED_STANDARD_COMMAND_SKILLS = new Set([
|
|
8
|
+
'aiwg-setup-project',
|
|
9
|
+
'aiwg-update-claude',
|
|
10
|
+
'aiwg-update-agents-md',
|
|
11
|
+
'sdlc-accelerate',
|
|
12
|
+
'project-status',
|
|
13
|
+
'intake-wizard',
|
|
14
|
+
'intake-from-codebase',
|
|
15
|
+
'intake-start',
|
|
16
|
+
// Issue-workflow entry commands — invoked directly by users; mirror as
|
|
17
|
+
// commands so they reach .opencode/command/, .claude/commands/, etc. (#1549).
|
|
18
|
+
'address-issues',
|
|
19
|
+
'issue-audit',
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
const MIRRORED_KERNEL_COMMAND_SKILLS = new Set([
|
|
23
|
+
'aiwg-refresh',
|
|
24
|
+
'aiwg-doctor',
|
|
25
|
+
'aiwg-status',
|
|
26
|
+
'aiwg-help',
|
|
27
|
+
'aiwg-regenerate',
|
|
28
|
+
'aiwg-regenerate-claude',
|
|
29
|
+
'aiwg-regenerate-codex',
|
|
30
|
+
'aiwg-regenerate-opencode',
|
|
31
|
+
'aiwg-regenerate-agents',
|
|
32
|
+
'aiwg-issue',
|
|
33
|
+
'aiwg-pr',
|
|
34
|
+
'aiwg-mission',
|
|
35
|
+
'use',
|
|
36
|
+
'steward',
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const DEFAULT_COMMAND_MIRROR_POLICY = { standard: MIRRORED_STANDARD_COMMAND_SKILLS, kernel: MIRRORED_KERNEL_COMMAND_SKILLS };
|
|
41
|
+
|
|
42
|
+
function providerUsesSkillsNatively(providerName) {
|
|
43
|
+
return ['antigravity', 'claude', 'cursor', 'deepseek-harness', 'hermes', 'openhuman', 'pi', 'omp'].includes(providerName);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function shouldMirrorStandardCommandSkill(skillName, policy) {
|
|
47
|
+
return (
|
|
48
|
+
skillName.startsWith('flow-') ||
|
|
49
|
+
policy.standard.has(skillName)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function shouldMirrorCommandSkill(providerName, skillName, policy) {
|
|
54
|
+
if (policy.kernel.has(skillName)) {
|
|
55
|
+
return !providerUsesSkillsNatively(providerName);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return shouldMirrorStandardCommandSkill(skillName, policy);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function uniquePaths(paths) {
|
|
62
|
+
return [...new Set(paths.filter(Boolean))];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function collectMirrorSkillDirs(srcRoot, mode, providerName) {
|
|
66
|
+
const dirs = [];
|
|
67
|
+
|
|
68
|
+
const directSkillsDir = path.join(srcRoot, 'skills');
|
|
69
|
+
dirs.push(...listSkillDirs(directSkillsDir));
|
|
70
|
+
|
|
71
|
+
// If --source itself is a skills directory, support that shape too.
|
|
72
|
+
dirs.push(...listSkillDirs(srcRoot));
|
|
73
|
+
|
|
74
|
+
const repoFrameworksRoot = path.join(srcRoot, 'agentic', 'code', 'frameworks');
|
|
75
|
+
if (fs.existsSync(repoFrameworksRoot)) {
|
|
76
|
+
const artifacts = collectFrameworkArtifacts(srcRoot, mode, {
|
|
77
|
+
includeAgents: false,
|
|
78
|
+
includeCommands: false,
|
|
79
|
+
includeSkills: true,
|
|
80
|
+
includeRules: false,
|
|
81
|
+
});
|
|
82
|
+
dirs.push(...artifacts.skills);
|
|
83
|
+
// Pi's provider collector already deploys all eligible addon skills for
|
|
84
|
+
// every root framework mode. Mirror the command-shaped addon skills in
|
|
85
|
+
// that same root pass so `aiwg use` does not need to repeat the entire
|
|
86
|
+
// deployment once per addon merely to produce these wrappers. Keep addon
|
|
87
|
+
// skills after framework skills: this preserves the existing per-addon
|
|
88
|
+
// winner when a framework and addon expose the same command name.
|
|
89
|
+
if (mode === 'all'
|
|
90
|
+
|| (providerName === 'pi' && ['general', 'sdlc', 'both'].includes(mode))) {
|
|
91
|
+
dirs.push(...getAddonSkillDirs(srcRoot));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return uniquePaths(dirs);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function resolveCommandMirrorDir(provider, target) {
|
|
99
|
+
const commandsPath = provider.paths?.commands;
|
|
100
|
+
if (commandsPath) {
|
|
101
|
+
return path.isAbsolute(commandsPath) ? commandsPath : path.join(target, commandsPath);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Closest conventional location for providers whose primary command
|
|
105
|
+
// surface is MCP/aggregation rather than a documented command directory.
|
|
106
|
+
if (provider.name === 'hermes') {
|
|
107
|
+
// #2119: HERMES_HOME is the single source of truth the running Hermes
|
|
108
|
+
// runtime uses to locate its files — resolve the home the same way the
|
|
109
|
+
// provider does instead of hardcoding $HOME/.hermes.
|
|
110
|
+
const hermesHome = typeof provider.getHermesHome === 'function'
|
|
111
|
+
? provider.getHermesHome()
|
|
112
|
+
: path.join(os.homedir(), '.hermes');
|
|
113
|
+
return path.resolve(hermesHome, 'commands');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function commandFileExtensionForProvider(provider) {
|
|
120
|
+
if (provider.name === 'copilot') return '.prompt.md';
|
|
121
|
+
return '.md';
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function resolveSkillCommandPolicy(commandHint = {}) {
|
|
125
|
+
const legacy = String(commandHint.model || '').trim().toLowerCase();
|
|
126
|
+
const legacyRole = legacy === 'opus' ? 'reasoning'
|
|
127
|
+
: legacy === 'haiku' ? 'efficiency'
|
|
128
|
+
: legacy ? 'coding' : null;
|
|
129
|
+
const modelRole = commandHint.modelRole || legacyRole;
|
|
130
|
+
if (!modelRole) return null;
|
|
131
|
+
const modelTier = commandHint.modelTier
|
|
132
|
+
|| (modelRole === 'reasoning' ? 'premium'
|
|
133
|
+
: modelRole === 'efficiency' ? 'economy' : 'standard');
|
|
134
|
+
return {
|
|
135
|
+
modelRole,
|
|
136
|
+
modelTier,
|
|
137
|
+
modelEffort: commandHint.modelEffort,
|
|
138
|
+
modelRationale: commandHint.modelRationale,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function parseSkillCommandHint(raw) {
|
|
143
|
+
const { frontmatter } = parseFrontmatter(raw);
|
|
144
|
+
const block = frontmatter?.match(/^commandHint:\s*\n((?:[ \t]+[^\n]*\n?)*)/m)?.[1] || '';
|
|
145
|
+
const hint = {};
|
|
146
|
+
for (const line of block.split('\n')) {
|
|
147
|
+
const match = line.trim().match(/^(model|modelRole|modelTier|modelEffort|modelRationale):\s*(.+)$/);
|
|
148
|
+
if (match) hint[match[1]] = match[2].trim().replace(/^['"]|['"]$/g, '');
|
|
149
|
+
}
|
|
150
|
+
return hint;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function skillToCommandContent(skillDir) {
|
|
154
|
+
const skillName = path.basename(skillDir);
|
|
155
|
+
const skillPath = path.join(skillDir, 'SKILL.md');
|
|
156
|
+
const raw = fs.readFileSync(skillPath, 'utf8');
|
|
157
|
+
const { metadata, body } = parseFrontmatter(raw);
|
|
158
|
+
const description = metadata.description || `Run AIWG skill ${skillName}`;
|
|
159
|
+
const policy = resolveSkillCommandPolicy(parseSkillCommandHint(raw));
|
|
160
|
+
const policyLines = policy ? [
|
|
161
|
+
`aiwg-model-role: ${policy.modelRole}`,
|
|
162
|
+
`aiwg-model-tier: ${policy.modelTier}`,
|
|
163
|
+
...(policy.modelEffort ? [`aiwg-model-effort: ${policy.modelEffort}`] : []),
|
|
164
|
+
...(policy.modelRationale ? [`aiwg-model-rationale: ${policy.modelRationale}`] : []),
|
|
165
|
+
] : [];
|
|
166
|
+
|
|
167
|
+
return `---\nname: ${skillName}\ndescription: ${description}\n${policyLines.join('\n')}${policyLines.length ? '\n' : ''}---\n\n${body.trim()}\n`;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export function mirrorSkillsAsCommands(provider, target, srcRoot, opts) {
|
|
171
|
+
if (!opts.deployCommands && !opts.commandsOnly) return 0;
|
|
172
|
+
const policy = opts.commandMirrorPolicy ?? DEFAULT_COMMAND_MIRROR_POLICY;
|
|
173
|
+
|
|
174
|
+
const targetDir = resolveCommandMirrorDir(provider, target);
|
|
175
|
+
if (!targetDir) return 0;
|
|
176
|
+
|
|
177
|
+
const skillDirs = collectMirrorSkillDirs(srcRoot, opts.mode, provider.name)
|
|
178
|
+
.filter((dir) => shouldMirrorCommandSkill(provider.name, path.basename(dir), policy));
|
|
179
|
+
|
|
180
|
+
if (skillDirs.length === 0) return 0;
|
|
181
|
+
if (!opts.dryRun) fs.mkdirSync(targetDir, { recursive: true });
|
|
182
|
+
|
|
183
|
+
const ext = commandFileExtensionForProvider(provider);
|
|
184
|
+
const deployedEntries = [];
|
|
185
|
+
let count = 0;
|
|
186
|
+
|
|
187
|
+
for (const skillDir of skillDirs) {
|
|
188
|
+
const skillName = path.basename(skillDir);
|
|
189
|
+
let content = skillToCommandContent(skillDir);
|
|
190
|
+
if (typeof provider.transformCommand === 'function') {
|
|
191
|
+
content = provider.transformCommand(path.join(skillDir, `${skillName}.md`), content, opts);
|
|
192
|
+
}
|
|
193
|
+
// #2507: mirrored wrappers used to be written with no ownership signal, so
|
|
194
|
+
// AIWG could neither count them as deployed nor prune them when the source
|
|
195
|
+
// skill went away — a later run reported its own 46 wrappers as unmanaged
|
|
196
|
+
// artifacts the operator should delete. They carry the same managed marker
|
|
197
|
+
// and sidecar entry as any other deployed command now.
|
|
198
|
+
content = addManagedMarker(content, opts.deployVersion || 'unknown', opts.deploySource || 'bundled');
|
|
199
|
+
|
|
200
|
+
const filename = `${skillName}${ext}`;
|
|
201
|
+
const dest = path.join(targetDir, filename);
|
|
202
|
+
if (opts.dryRun) {
|
|
203
|
+
if (opts.verbose) console.log(`[dry-run] mirror skill command ${skillName} -> ${dest}`);
|
|
204
|
+
const raw = fs.readFileSync(path.join(skillDir, 'SKILL.md'), 'utf8');
|
|
205
|
+
const policy = resolveSkillCommandPolicy(parseSkillCommandHint(raw));
|
|
206
|
+
if (policy && opts.verbose) {
|
|
207
|
+
const outcome = provider.name === 'claude' ? 'native'
|
|
208
|
+
: provider.name === 'factory' ? 'informational' : 'unsupported';
|
|
209
|
+
console.log(`[dry-run] skill model policy ${skillName}: ${outcome} (${policy.modelRole}/${policy.modelTier})`);
|
|
210
|
+
}
|
|
211
|
+
} else {
|
|
212
|
+
fs.writeFileSync(dest, content, 'utf8');
|
|
213
|
+
}
|
|
214
|
+
const sourcePath = path.join(skillDir, 'SKILL.md');
|
|
215
|
+
deployedEntries.push({ filename, hash: contentHash(content), kind: 'skill-command', sourcePath,
|
|
216
|
+
frameworkSlug: extractFrameworkSlug(opts.logicalInputPath?.(sourcePath) || sourcePath) });
|
|
217
|
+
count++;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (deployedEntries.length > 0) {
|
|
221
|
+
updateSidecarManifest(targetDir, deployedEntries, {
|
|
222
|
+
dryRun: opts.dryRun,
|
|
223
|
+
version: opts.deployVersion || 'unknown',
|
|
224
|
+
source: opts.deploySource || 'bundled',
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return count;
|
|
229
|
+
}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
// Parse deploy options and resolve provider modules.
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
export function parseArgs(args = process.argv.slice(2)) {
|
|
4
|
+
const cfg = {
|
|
5
|
+
source: null,
|
|
6
|
+
userScope: false,
|
|
7
|
+
target: process.cwd(),
|
|
8
|
+
mode: 'all', // 'general', 'sdlc', 'marketing', 'media-curator', 'research', 'both' (legacy), or 'all'
|
|
9
|
+
dryRun: false,
|
|
10
|
+
force: false,
|
|
11
|
+
provider: 'claude',
|
|
12
|
+
model: null, // Blanket override for all tiers
|
|
13
|
+
modelTier: null, // Blanket canonical tier override
|
|
14
|
+
reasoningModel: null,
|
|
15
|
+
codingModel: null,
|
|
16
|
+
efficiencyModel: null,
|
|
17
|
+
asAgentsMd: false,
|
|
18
|
+
createAgentsMd: false,
|
|
19
|
+
contextFiles: true,
|
|
20
|
+
projectScope: false,
|
|
21
|
+
deployCommands: false,
|
|
22
|
+
deploySkills: false,
|
|
23
|
+
deployRules: false,
|
|
24
|
+
deployBehaviors: false, // Deploy behaviors (native on openclaw, emulated on others)
|
|
25
|
+
commandsOnly: false,
|
|
26
|
+
skillsOnly: false,
|
|
27
|
+
rulesOnly: false,
|
|
28
|
+
strict: false,
|
|
29
|
+
reportOnly: true,
|
|
30
|
+
kernelOnly: false,
|
|
31
|
+
deferRuleProjection: false,
|
|
32
|
+
additionalSources: [],
|
|
33
|
+
filter: null, // Glob pattern for agent names
|
|
34
|
+
filterRole: null, // Filter by role: reasoning|coding|efficiency
|
|
35
|
+
save: false, // Save model config to project models.json
|
|
36
|
+
saveUser: false, // Save model config to ~/.config/aiwg/models.json
|
|
37
|
+
verbose: false, // Show per-file deployment details
|
|
38
|
+
quiet: false, // Suppress all non-error output (for embedding in use.ts)
|
|
39
|
+
asPlugin: false, // Generate .factory-plugin/ bundle (Factory provider only)
|
|
40
|
+
deployBehaviors: false, // Deploy behaviors in addition to agents
|
|
41
|
+
skipCommandsMigration: false, // Skip commands → skills migration (warns about duplicates)
|
|
42
|
+
warnOnSkippedCommandsMigration: true, // Emit the duplicate warning when the migration is skipped
|
|
43
|
+
// Managed-marker provenance (#2502). Deployers that are not shipping the
|
|
44
|
+
// bundled framework corpus (project-local bundles, in particular) must
|
|
45
|
+
// override these so `aiwg refresh` does not mistake their artifacts for
|
|
46
|
+
// stale copies of packaged ones.
|
|
47
|
+
deploySource: null, // Managed-marker source; defaults to 'bundled'
|
|
48
|
+
listingBudget: false, // Honor the provider startup-listing cap despite --copy-all (#2561)
|
|
49
|
+
deployVersion: null, // Managed-marker version; defaults to srcRoot package.json
|
|
50
|
+
mcp: false, // #228: opt-in MCP settings profile (Muse provider)
|
|
51
|
+
hooks: true, // #228: managed project hooks (Muse provider); --no-hooks opts out
|
|
52
|
+
};
|
|
53
|
+
for (let i = 0; i < args.length; i++) {
|
|
54
|
+
const a = args[i];
|
|
55
|
+
if (a === '--source' && args[i + 1]) cfg.source = path.resolve(args[++i]);
|
|
56
|
+
else if (a === '--additional-source') {
|
|
57
|
+
const source = args[++i];
|
|
58
|
+
if (!source || source.startsWith('--')) throw new Error('--additional-source requires a source directory');
|
|
59
|
+
cfg.additionalSources.push(path.resolve(source));
|
|
60
|
+
}
|
|
61
|
+
else if (a === '--target' && args[i + 1]) cfg.target = path.resolve(args[++i]);
|
|
62
|
+
else if (a === '--mode' && args[i + 1]) cfg.mode = String(args[++i]).toLowerCase();
|
|
63
|
+
else if (a === '--scope') {
|
|
64
|
+
const scope = args[++i];
|
|
65
|
+
if (scope !== 'user' && scope !== 'project') {
|
|
66
|
+
throw new Error(`--scope expected 'user' or 'project', got '${scope ?? '(missing)'}'`);
|
|
67
|
+
}
|
|
68
|
+
cfg.userScope = scope === 'user';
|
|
69
|
+
cfg.projectScope = scope === 'project';
|
|
70
|
+
}
|
|
71
|
+
else if (a === '--user') cfg.userScope = true;
|
|
72
|
+
else if (a === '--dry-run') cfg.dryRun = true;
|
|
73
|
+
else if (a === '--force') cfg.force = true;
|
|
74
|
+
else if ((a === '--provider' || a === '--platform') && args[i + 1]) cfg.provider = String(args[++i]).toLowerCase();
|
|
75
|
+
else if (a === '--model' && args[i + 1]) cfg.model = args[++i];
|
|
76
|
+
else if (a === '--model-tier' && args[i + 1]) cfg.modelTier = String(args[++i]).toLowerCase();
|
|
77
|
+
else if ((a === '--reasoning-model' || a === '--reasoning') && args[i + 1]) cfg.reasoningModel = args[++i];
|
|
78
|
+
else if ((a === '--coding-model' || a === '--coding') && args[i + 1]) cfg.codingModel = args[++i];
|
|
79
|
+
else if ((a === '--efficiency-model' || a === '--efficiency') && args[i + 1]) cfg.efficiencyModel = args[++i];
|
|
80
|
+
else if (a === '--as-agents-md') cfg.asAgentsMd = true;
|
|
81
|
+
else if (a === '--create-agents-md') cfg.createAgentsMd = true;
|
|
82
|
+
else if (a === '--deploy-commands') cfg.deployCommands = true;
|
|
83
|
+
else if (a === '--deploy-skills') cfg.deploySkills = true;
|
|
84
|
+
else if (a === '--deploy-rules') cfg.deployRules = true;
|
|
85
|
+
else if (a === '--deploy-behaviors') cfg.deployBehaviors = true;
|
|
86
|
+
else if (a === '--commands-only') cfg.commandsOnly = true;
|
|
87
|
+
else if (a === '--skills-only') cfg.skillsOnly = true;
|
|
88
|
+
else if (a === '--rules-only') cfg.rulesOnly = true;
|
|
89
|
+
else if (a === '--strict') { cfg.strict = true; cfg.reportOnly = false; }
|
|
90
|
+
else if (a === '--allow-over-budget') cfg.allowOverBudget = true;
|
|
91
|
+
else if (a === '--report-only') cfg.reportOnly = true;
|
|
92
|
+
else if (a === '--kernel-only') cfg.kernelOnly = true;
|
|
93
|
+
// Internal use orchestration: the final source owns rule presentation.
|
|
94
|
+
else if (a === '--defer-rule-projection') cfg.deferRuleProjection = true;
|
|
95
|
+
else if (a === '--deploy-behaviors') cfg.deployBehaviors = true;
|
|
96
|
+
else if (a === '--filter' && args[i + 1]) cfg.filter = args[++i];
|
|
97
|
+
else if (a === '--filter-role' && args[i + 1]) cfg.filterRole = args[++i];
|
|
98
|
+
else if (a === '--save') cfg.save = true;
|
|
99
|
+
else if (a === '--save-user') cfg.saveUser = true;
|
|
100
|
+
else if (a === '--verbose' || a === '-v') cfg.verbose = true;
|
|
101
|
+
else if (a === '--quiet' || a === '-q') cfg.quiet = true;
|
|
102
|
+
else if (a === '--as-plugin') cfg.asPlugin = true;
|
|
103
|
+
else if (a === '--skip-commands-migration') cfg.skipCommandsMigration = true;
|
|
104
|
+
// Structural opt-out: skip the migration without claiming the operator declined it (#2541).
|
|
105
|
+
else if (a === '--no-commands-warning') cfg.warnOnSkippedCommandsMigration = false;
|
|
106
|
+
else if (a === '--copy-all' || a === '--copy-standard-skills') cfg.copyStandardSkills = true;
|
|
107
|
+
// #228: Muse provider — explicit opt-in MCP settings profile, and the
|
|
108
|
+
// managed-hooks opt-out (default on, mirroring the Claude autoInstall policy).
|
|
109
|
+
else if (a === '--mcp') cfg.mcp = true;
|
|
110
|
+
else if (a === '--no-hooks') cfg.hooks = false;
|
|
111
|
+
else if (a === '--no-attribution') cfg.attribution = false;
|
|
112
|
+
else if (a === '--no-context-files') cfg.contextFiles = false;
|
|
113
|
+
else if (a === '--deploy-source' && args[i + 1]) cfg.deploySource = String(args[++i]);
|
|
114
|
+
else if (a === '--listing-budget') cfg.listingBudget = true;
|
|
115
|
+
else if (a === '--deploy-version' && args[i + 1]) cfg.deployVersion = String(args[++i]);
|
|
116
|
+
else if (a === '--help' || a === '-h') {
|
|
117
|
+
cfg.help = true;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return cfg;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function printHelp() {
|
|
124
|
+
console.log(`
|
|
125
|
+
Deploy Agents and Commands
|
|
126
|
+
|
|
127
|
+
Usage:
|
|
128
|
+
node tools/agents/deploy-agents.mjs [options]
|
|
129
|
+
aiwg -deploy-agents [options]
|
|
130
|
+
|
|
131
|
+
Options:
|
|
132
|
+
--source <path> Source directory (defaults to repo root)
|
|
133
|
+
--target <path> Target directory (defaults to cwd)
|
|
134
|
+
--scope <user|project> Deployment scope (default: project)
|
|
135
|
+
--user Shorthand for --scope user
|
|
136
|
+
--mode <type> Deployment mode: general, sdlc, marketing (alias: mmk), media-curator, research, both, or all (default)
|
|
137
|
+
--deploy-commands Deploy commands in addition to agents
|
|
138
|
+
--deploy-skills Deploy skills in addition to agents
|
|
139
|
+
--deploy-rules Deploy rules in addition to agents
|
|
140
|
+
--commands-only Deploy only commands (skip agents)
|
|
141
|
+
--skills-only Deploy only skills (skip agents)
|
|
142
|
+
--rules-only Deploy only rules (skip agents)
|
|
143
|
+
--kernel-only Deploy kernel skills and rules; prune managed bulk agents/commands
|
|
144
|
+
--dry-run Show what would be deployed without writing
|
|
145
|
+
--force Overwrite existing files
|
|
146
|
+
--provider <name> Target provider (see below)
|
|
147
|
+
--model <name> Override model for all tiers (blanket)
|
|
148
|
+
--reasoning-model <name> Override model for reasoning tasks (alias: --reasoning)
|
|
149
|
+
--coding-model <name> Override model for coding tasks (alias: --coding)
|
|
150
|
+
--efficiency-model <name> Override model for efficiency tasks (alias: --efficiency)
|
|
151
|
+
--model-tier <tier> Override all artifacts with economy|standard|premium
|
|
152
|
+
--filter <pattern> Only deploy agents matching pattern (glob)
|
|
153
|
+
--filter-role <role> Only deploy agents of role: reasoning|coding|efficiency
|
|
154
|
+
--save Save model config to project models.json
|
|
155
|
+
--save-user Save model config to ~/.config/aiwg/models.json
|
|
156
|
+
--mcp Muse provider: opt in to the AIWG MCP settings profile
|
|
157
|
+
(merges the aiwg stdio server into user settings
|
|
158
|
+
mcp_servers; default off)
|
|
159
|
+
--no-hooks Muse provider: skip managed project hooks
|
|
160
|
+
(.muse/hooks.json; installed by default)
|
|
161
|
+
--no-attribution Claude provider: leave attribution settings untouched
|
|
162
|
+
--as-agents-md Aggregate to single AGENTS.md (Codex)
|
|
163
|
+
--create-agents-md Create/update AGENTS.md template
|
|
164
|
+
--no-context-files Preserve WORKSPACE.md, AIWG.md and AGENTS.md (including managed blocks)
|
|
165
|
+
--skip-commands-migration Skip deleting the commands directory before skills deployment
|
|
166
|
+
--listing-budget Honor the provider startup-listing cap even with --copy-all
|
|
167
|
+
--deploy-source <name> Managed-marker source stamped into deployed artifacts.
|
|
168
|
+
Defaults to 'bundled'. Deploys that do not ship the packaged
|
|
169
|
+
framework corpus (e.g. project-local bundles) MUST override
|
|
170
|
+
this so refresh's stale-artifact prune skips them (#2502).
|
|
171
|
+
--deploy-version <version> Managed-marker version stamped into deployed artifacts.
|
|
172
|
+
Defaults to the --source tree's package.json version.
|
|
173
|
+
--copy-all Copy ALL skills per-project (legacy mirror at <provider>/.aiwg/skills/).
|
|
174
|
+
For aiwg use all, this also restores the legacy full agent,
|
|
175
|
+
command, and expanded-rule copy. Default bulk deployment is
|
|
176
|
+
kernel-only + index-driven discovery for the rest (#1217).
|
|
177
|
+
Use this for sandboxed runtimes / air-gapped corpora where
|
|
178
|
+
$AIWG_ROOT isn't readable from the agent's working dir.
|
|
179
|
+
Alias: --copy-standard-skills — rc.29 era).
|
|
180
|
+
(warns about duplicate entries in the provider command palette)
|
|
181
|
+
|
|
182
|
+
Model Override Examples:
|
|
183
|
+
# Use sonnet for everything
|
|
184
|
+
aiwg use sdlc --model sonnet
|
|
185
|
+
|
|
186
|
+
# Override individual tiers
|
|
187
|
+
aiwg use sdlc --reasoning opus --coding sonnet --efficiency haiku
|
|
188
|
+
|
|
189
|
+
# Use a specific model ID for coding tier
|
|
190
|
+
aiwg use sdlc --provider factory --coding-model gpt-5.6-terra
|
|
191
|
+
|
|
192
|
+
# Blanket with per-tier override (reasoning uses opus, others use sonnet)
|
|
193
|
+
aiwg use sdlc --model sonnet --reasoning opus
|
|
194
|
+
|
|
195
|
+
# Save overrides to project models.json for future deployments
|
|
196
|
+
aiwg use sdlc --model sonnet --save
|
|
197
|
+
|
|
198
|
+
Model Precedence:
|
|
199
|
+
CLI flags > project models.json > user ~/.config/aiwg/models.json > AIWG defaults
|
|
200
|
+
|
|
201
|
+
Shorthand Values:
|
|
202
|
+
opus, sonnet, haiku, inherit — resolved per provider to full model IDs
|
|
203
|
+
|
|
204
|
+
Providers (all deploy agents, commands, skills, and rules):
|
|
205
|
+
claude - Claude Code (default)
|
|
206
|
+
Paths: .claude/agents/, .claude/commands/, .claude/skills/, .claude/rules/
|
|
207
|
+
factory - Factory AI
|
|
208
|
+
Paths: .factory/droids/, .factory/commands/, .factory/skills/, .factory/rules/
|
|
209
|
+
codex - OpenAI Codex (alias: openai)
|
|
210
|
+
Paths: .codex/agents/, .codex/commands/, .codex/skills/, .codex/rules/
|
|
211
|
+
opencode - OpenCode
|
|
212
|
+
Paths: .opencode/skill/, .opencode/rule/ (agents/commands not file-based in OpenCode)
|
|
213
|
+
copilot - GitHub Copilot
|
|
214
|
+
Paths: .github/agents/, .github/commands/, .github/skills/, .github/copilot-rules/
|
|
215
|
+
cursor - Cursor IDE
|
|
216
|
+
Paths: .cursor/agents/, .cursor/commands/, .cursor/skills/, .cursor/rules/
|
|
217
|
+
warp - Warp Terminal
|
|
218
|
+
Paths: .warp/agents/, .warp/commands/, .warp/skills/, .warp/rules/ + WARP.md
|
|
219
|
+
deepseek-harness - DeepSeek Harness (alias: dsh; experimental)
|
|
220
|
+
Paths: AGENTS.md, .agents/skills/, .dsh/aiwg.cordis.patch.yml
|
|
221
|
+
devin - Devin Desktop (preferred; aliases: devin-desktop, windsurf)
|
|
222
|
+
Paths: .windsurf/agents/, .windsurf/workflows/, .windsurf/skills/, .windsurf/rules/
|
|
223
|
+
grokbot - Grok Bot (AGENTS.md bridge; skills only with AIWG_GROKBOT_SKILLS_DIR)
|
|
224
|
+
grok-build - Grok Build (experimental; .grok paths + $GROK_HOME; no bare grok alias)
|
|
225
|
+
muse - Muse Code (stable; AGENTS.md bridge; .agents/skills + XDG user root; managed hooks, opt-in --mcp; no aliases)
|
|
226
|
+
hermes - Hermes Agent (MCP-based integration)
|
|
227
|
+
Skills: $HERMES_HOME/skills/ (user-global; defaults to ~/.hermes/skills/) | Agents: AGENTS.md
|
|
228
|
+
Commands/Rules: served via MCP, not file-deployed
|
|
229
|
+
|
|
230
|
+
Modes:
|
|
231
|
+
general - Writing-quality addon agents and commands (alias: writing)
|
|
232
|
+
sdlc - SDLC Complete framework agents and commands
|
|
233
|
+
marketing - Media/Marketing Kit framework agents and commands (alias: mmk)
|
|
234
|
+
media-curator - Media Curator framework agents and commands
|
|
235
|
+
research - Research Complete framework agents and commands
|
|
236
|
+
both - writing + SDLC (legacy compatibility)
|
|
237
|
+
all - All frameworks + addons (default)
|
|
238
|
+
|
|
239
|
+
Examples:
|
|
240
|
+
# Deploy SDLC framework to Claude Code
|
|
241
|
+
aiwg -deploy-agents --mode sdlc
|
|
242
|
+
|
|
243
|
+
# Deploy to Factory with commands and AGENTS.md
|
|
244
|
+
aiwg -deploy-agents --provider factory --mode sdlc --deploy-commands --create-agents-md
|
|
245
|
+
|
|
246
|
+
# Deploy to GitHub Copilot
|
|
247
|
+
aiwg -deploy-agents --provider copilot --mode sdlc
|
|
248
|
+
|
|
249
|
+
# Override model for all tiers
|
|
250
|
+
aiwg -deploy-agents --mode sdlc --model sonnet
|
|
251
|
+
|
|
252
|
+
# Override individual tiers
|
|
253
|
+
aiwg -deploy-agents --mode sdlc --reasoning opus --coding sonnet --efficiency haiku
|
|
254
|
+
|
|
255
|
+
# Dry run to preview deployment
|
|
256
|
+
aiwg -deploy-agents --provider cursor --mode sdlc --dry-run
|
|
257
|
+
`);
|
|
258
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
// Model persistence and interactive command migration support.
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import readline from "node:readline";
|
|
6
|
+
export function resolveShorthand(value, shorthandMap, modelsConfig, provider, tier) {
|
|
7
|
+
if (!value) return null;
|
|
8
|
+
|
|
9
|
+
const clean = value.toLowerCase().replace(/['"]/g, '');
|
|
10
|
+
|
|
11
|
+
// Check shorthand map first
|
|
12
|
+
if (shorthandMap[clean]) return shorthandMap[clean];
|
|
13
|
+
|
|
14
|
+
// Check provider-specific tier config (e.g., modelsConfig.factory.reasoning.model)
|
|
15
|
+
const providerConfig = modelsConfig?.[provider];
|
|
16
|
+
if (providerConfig?.[tier]?.model && clean === tier) {
|
|
17
|
+
return providerConfig[tier].model;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Not a shorthand — return as literal model ID
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// ============================================================================
|
|
25
|
+
// Model Configuration Persistence
|
|
26
|
+
// ============================================================================
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Save model configuration to project or user config file
|
|
30
|
+
* @param {object} cfg - Configuration with model overrides
|
|
31
|
+
* @param {string} providerName - Provider name for provider-specific config
|
|
32
|
+
*/
|
|
33
|
+
export async function saveModelConfig(cfg, providerName) {
|
|
34
|
+
// Build config object with only the provided overrides
|
|
35
|
+
const modelConfig = {};
|
|
36
|
+
if (cfg.modelTier) {
|
|
37
|
+
modelConfig.defaults = { tier: cfg.modelTier };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Provider-specific tier configuration
|
|
41
|
+
if (cfg.reasoningModel || cfg.codingModel || cfg.efficiencyModel) {
|
|
42
|
+
modelConfig[providerName] = {};
|
|
43
|
+
if (cfg.reasoningModel) {
|
|
44
|
+
modelConfig[providerName].reasoning = { model: cfg.reasoningModel };
|
|
45
|
+
}
|
|
46
|
+
if (cfg.codingModel) {
|
|
47
|
+
modelConfig[providerName].coding = { model: cfg.codingModel };
|
|
48
|
+
}
|
|
49
|
+
if (cfg.efficiencyModel) {
|
|
50
|
+
modelConfig[providerName].efficiency = { model: cfg.efficiencyModel };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Shorthand mappings
|
|
55
|
+
if (cfg.reasoningModel || cfg.codingModel || cfg.efficiencyModel) {
|
|
56
|
+
modelConfig.shorthand = {};
|
|
57
|
+
if (cfg.reasoningModel) modelConfig.shorthand.opus = cfg.reasoningModel;
|
|
58
|
+
if (cfg.codingModel) modelConfig.shorthand.sonnet = cfg.codingModel;
|
|
59
|
+
if (cfg.efficiencyModel) modelConfig.shorthand.haiku = cfg.efficiencyModel;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Determine target path
|
|
63
|
+
let targetPath;
|
|
64
|
+
if (cfg.saveUser) {
|
|
65
|
+
const configDir = path.join(os.homedir(), '.config', 'aiwg');
|
|
66
|
+
if (!fs.existsSync(configDir)) {
|
|
67
|
+
fs.mkdirSync(configDir, { recursive: true });
|
|
68
|
+
}
|
|
69
|
+
targetPath = path.join(configDir, 'models.json');
|
|
70
|
+
} else {
|
|
71
|
+
targetPath = path.join(cfg.target, 'models.json');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Merge with existing config if it exists
|
|
75
|
+
let existingConfig = {};
|
|
76
|
+
if (fs.existsSync(targetPath)) {
|
|
77
|
+
try {
|
|
78
|
+
existingConfig = JSON.parse(fs.readFileSync(targetPath, 'utf8'));
|
|
79
|
+
} catch {
|
|
80
|
+
// Ignore parse errors, start fresh
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Deep merge: existing config + new overrides
|
|
85
|
+
const mergedConfig = deepMerge(existingConfig, modelConfig);
|
|
86
|
+
|
|
87
|
+
// Write the config
|
|
88
|
+
fs.writeFileSync(targetPath, JSON.stringify(mergedConfig, null, 2) + '\n', 'utf8');
|
|
89
|
+
console.log(`\nModel configuration saved to: ${targetPath}`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Deep merge two objects
|
|
94
|
+
*/
|
|
95
|
+
function deepMerge(target, source) {
|
|
96
|
+
const result = { ...target };
|
|
97
|
+
for (const key of Object.keys(source)) {
|
|
98
|
+
if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {
|
|
99
|
+
result[key] = deepMerge(result[key] || {}, source[key]);
|
|
100
|
+
} else {
|
|
101
|
+
result[key] = source[key];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// ============================================================================
|
|
108
|
+
// Commands → Skills Migration
|
|
109
|
+
// ============================================================================
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Ask the user whether to delete the provider's commands directory before
|
|
113
|
+
* deploying skills. Skipped automatically when not running in a TTY (CI/pipe)
|
|
114
|
+
* or when --quiet is set.
|
|
115
|
+
*
|
|
116
|
+
* @param {object} cfg - Parsed CLI config
|
|
117
|
+
* @param {object} provider - Loaded provider module
|
|
118
|
+
* @param {string} targetDir - Resolved target directory
|
|
119
|
+
* @returns {Promise<boolean>} true = proceed with migration, false = skip
|
|
120
|
+
*/
|
|
121
|
+
export async function promptCommandsMigration(cfg, provider, targetDir, interactive = process.stdout.isTTY) {
|
|
122
|
+
// Home-directory providers share commands across projects — do not delete.
|
|
123
|
+
if (provider.capabilities?.homeDirectoryDeploy) return false;
|
|
124
|
+
// Some providers intentionally expose both surfaces with different runtime
|
|
125
|
+
// semantics. Pi prompt templates (/name) are not aliases for Agent Skills
|
|
126
|
+
// (/skill:name), so command-to-skill migration would destroy valid prompts.
|
|
127
|
+
if (provider.capabilities?.parallelCommandAndSkillSurfaces) return false;
|
|
128
|
+
|
|
129
|
+
const commandsRelPath = provider.paths?.commands;
|
|
130
|
+
if (!commandsRelPath) return false;
|
|
131
|
+
|
|
132
|
+
const commandsDir = path.join(targetDir, commandsRelPath);
|
|
133
|
+
if (!fs.existsSync(commandsDir)) return false;
|
|
134
|
+
|
|
135
|
+
const entries = fs.readdirSync(commandsDir).filter(e => e.endsWith('.md'));
|
|
136
|
+
if (entries.length === 0) return false;
|
|
137
|
+
|
|
138
|
+
// Non-interactive context: migrate silently.
|
|
139
|
+
if (cfg.quiet || !interactive) return true;
|
|
140
|
+
|
|
141
|
+
const rel = path.relative(process.cwd(), commandsDir);
|
|
142
|
+
console.log(`\n⚠ Commands → Skills Migration`);
|
|
143
|
+
console.log(` ${rel} contains ${entries.length} legacy command file(s).`);
|
|
144
|
+
console.log(` AIWG now serves these as skills (.claude/skills/).`);
|
|
145
|
+
console.log(` Keeping both causes duplicate entries in the Claude Code command palette.`);
|
|
146
|
+
console.log('');
|
|
147
|
+
|
|
148
|
+
const answer = await new Promise(resolve => {
|
|
149
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
150
|
+
rl.question(' Remove commands directory and migrate? [Y/n] ', ans => {
|
|
151
|
+
rl.close();
|
|
152
|
+
resolve(ans.trim().toLowerCase());
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
if (answer === 'n' || answer === 'no') {
|
|
157
|
+
console.log('');
|
|
158
|
+
console.log(' Skipping migration. Run `aiwg use` again without --skip-commands-migration');
|
|
159
|
+
console.log(` to clean up, or delete ${rel} manually.`);
|
|
160
|
+
console.log('');
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return true;
|
|
165
|
+
}
|