@aiwg/cli 2026.10.11 → 2026.10.14
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/agentic/code/providers/model-catalog.v1.json +62 -12
- package/agentic/code/providers/pi/aiwg-bridge.ts +44 -1
- package/dist/src/artifacts/binding-target-identity.js +51 -0
- package/dist/src/artifacts/checksum-manifest.js +12 -0
- package/dist/src/artifacts/index-builder.js +11 -13
- package/dist/src/artifacts/query-engine.js +5 -11
- package/dist/src/cli/handlers/doctor-help.js +32 -0
- package/dist/src/cli/handlers/gates.js +19 -18
- package/dist/src/cli/handlers/models-help.js +7 -1
- package/dist/src/cli/handlers/models.js +3 -3
- package/dist/src/cli/handlers/script-runner.js +8 -5
- package/dist/src/cli/handlers/sessions-intake.js +104 -0
- package/dist/src/cli/handlers/sessions-tail.js +172 -0
- package/dist/src/cli/handlers/sessions.js +90 -17
- package/dist/src/cli/handlers/skill-lint.js +10 -3
- package/dist/src/cli/handlers/steward-format.js +100 -0
- package/dist/src/cli/handlers/steward-models.js +167 -0
- package/dist/src/cli/handlers/steward.js +14 -248
- package/dist/src/cli/handlers/use-bundle-counts.js +87 -0
- package/dist/src/cli/handlers/use-skill-assets.js +207 -0
- package/dist/src/cli/handlers/use.js +35 -216
- package/dist/src/cli/handlers/utilities.js +1 -24
- package/dist/src/config/aiwg-config.js +7 -0
- package/dist/src/config/authorization-cli.js +97 -0
- package/dist/src/config/cli-help.js +1 -0
- package/dist/src/config/cli.js +10 -1
- package/dist/src/decision/context-pruning-common.js +41 -0
- package/dist/src/decision/context-pruning-evaluation.js +366 -0
- package/dist/src/decision/context-pruning-pilot.js +431 -0
- package/dist/src/decision/context-pruning-types.js +19 -0
- package/dist/src/decision/context-pruning.js +5 -846
- package/dist/src/decision/ensemble/contract.js +17 -26
- package/dist/src/decision/ensemble-study/artifacts.js +5 -0
- package/dist/src/decision/ensemble-study/score.js +4 -3
- package/dist/src/decision/feature-export.js +3 -9
- package/dist/src/decision/heldout/collector.js +2 -2
- package/dist/src/decision/issue-triage/runtime.js +3 -9
- package/dist/src/decision/qualification/gates.js +2 -1
- package/dist/src/decision/qualification/release.js +6 -64
- package/dist/src/decision/routing/report.js +2 -0
- package/dist/src/decision/sdlc-screening.js +3 -5
- package/dist/src/decision/sensitivity/comparative.js +5 -3
- package/dist/src/extensions/manifest.js +8 -1
- package/dist/src/extensions/project-local-doctor.js +78 -2
- package/dist/src/extensions/validation.js +10 -11
- package/dist/src/gates/driver.js +6 -77
- package/dist/src/gates/evaluate.js +6 -23
- package/dist/src/gates/floors.js +4 -4
- package/dist/src/gates/index.js +3 -3
- package/dist/src/gates/lattice.js +26 -0
- package/dist/src/gates/registry.js +2 -1
- package/dist/src/gates/report.js +19 -7
- package/dist/src/gates/upstream-ceiling.js +111 -0
- package/dist/src/issues/audit-cli.js +120 -0
- package/dist/src/issues/audit-contract.js +64 -0
- package/dist/src/issues/audit-local.js +82 -0
- package/dist/src/issues/audit.js +220 -0
- package/dist/src/lint/rule-activation.js +15 -1
- package/dist/src/mission-protocol/canonical-codecs.js +270 -0
- package/dist/src/mission-protocol/codecs.js +22 -550
- package/dist/src/mission-protocol/health-trace-codecs.js +281 -0
- package/dist/src/mission-protocol/health-trace-types.js +43 -0
- package/dist/src/mission-protocol/types.js +2 -42
- package/dist/src/mission-protocol/worker-contract-json.js +10 -0
- package/dist/src/mission-protocol/worker-review-gate.js +100 -0
- package/dist/src/mission-protocol/worker-review-types.js +2 -0
- package/dist/src/models/catalog-policy.js +280 -0
- package/dist/src/models/index.js +1 -1
- package/dist/src/models/model-catalog.v1.json +62 -12
- package/dist/src/models/policy-resources.js +28 -0
- package/dist/src/models/provider-models.js +5 -8
- package/dist/src/models/provider-policy.js +10 -546
- package/dist/src/models/resolver.js +26 -8
- package/dist/src/models/router.js +15 -2
- package/dist/src/models/tiers.js +13 -0
- package/dist/src/models/types.js +0 -6
- package/dist/src/models/worker-ceilings.js +59 -0
- package/dist/src/models/worker-invocation-policy.js +243 -0
- package/dist/src/models/worker-plan.js +16 -20
- package/dist/src/models/worker-review-lineage.js +55 -0
- package/dist/src/models/worker-selection-policy.js +1 -1
- package/dist/src/models/wrapper-definitions.js +14 -0
- package/dist/src/models/wrapper-deployment.js +48 -25
- package/dist/src/models/wrapper-enforcement.js +72 -0
- package/dist/src/models/wrapper-route.js +6 -3
- package/dist/src/policy/authorization.js +1 -0
- package/dist/src/policy/hitl-check.js +80 -0
- package/dist/src/policy/hitl-config.js +63 -0
- package/dist/src/policy/hitl-receipt.js +57 -0
- package/dist/src/policy/hitl-types.js +4 -0
- package/dist/src/policy/hitl-validation.js +39 -0
- package/dist/src/policy/hitl.js +117 -0
- package/dist/src/rules/activation.d.mts +3 -1
- package/dist/src/rules/activation.mjs +23 -2
- package/dist/src/rules/gate-coverage.js +51 -0
- package/dist/src/rules/gate-references.js +16 -0
- package/dist/src/rules/rule-frontmatter.schema.json +7 -1
- package/dist/src/serve/worker-command-request.js +21 -4
- package/dist/src/serve/worker-invocation-preparation.js +3 -1
- package/dist/src/serve/worker-invocation.js +21 -10
- package/dist/src/sessions/adapters/deepseek-harness.js +1 -0
- package/dist/src/sessions/adapters/grok-build-native.js +269 -0
- package/dist/src/sessions/adapters/grok-build.js +57 -15
- package/dist/src/sessions/adapters/hermes-state-db.js +252 -0
- package/dist/src/sessions/adapters/hermes.js +42 -3
- package/dist/src/sessions/adapters/warp.js +1 -1
- package/dist/src/sessions/batch-import.js +10 -0
- package/dist/src/sessions/contracts.js +1 -1
- package/dist/src/sessions/discovery-capability.js +38 -0
- package/dist/src/sessions/importer.js +8 -251
- package/dist/src/sessions/index.js +4 -0
- package/dist/src/sessions/intake-dir.js +71 -0
- package/dist/src/sessions/normalization.js +251 -0
- package/dist/src/sessions/tail.js +91 -0
- package/dist/src/sessions/workspace-discovery.js +83 -7
- package/dist/src/skills/adapters/local.js +32 -9
- package/dist/src/skills/agent-skill-sidecar.js +28 -0
- package/dist/src/skills/agent-skills.js +6 -23
- package/dist/src/skills/claude-surface-projection.js +25 -0
- package/dist/src/skills/cli-display.js +33 -0
- package/dist/src/skills/cli.js +2 -26
- package/dist/src/skills/collision-discovery.js +84 -0
- package/dist/src/skills/deployer.js +26 -361
- package/dist/src/skills/deployment-ownership.js +74 -0
- package/dist/src/skills/deployment-policy.js +114 -0
- package/dist/src/skills/deployment-projection.js +152 -0
- package/dist/src/skills/deployment-types.js +20 -0
- package/dist/src/skills/doctor.js +2 -2
- package/dist/src/skills/exporter.js +8 -31
- package/dist/src/skills/importer.js +4 -26
- package/dist/src/skills/provider-extensions.js +41 -0
- package/dist/src/skills/registry.js +22 -7
- package/dist/src/skills/run.js +6 -0
- package/dist/src/skills/types.js +0 -8
- package/dist/src/skills/validator-resources.js +68 -0
- package/dist/src/skills/validator.js +6 -55
- package/dist/src/smiths/context-pipeline/parallelism-section.js +7 -3
- package/dist/src/storage/cli-migrate-options.js +125 -0
- package/dist/src/storage/cli-migrate.js +111 -0
- package/dist/src/storage/cli.js +4 -279
- package/dist/src/storage/migration-adapter.js +79 -0
- package/dist/src/storage/migration-copy.js +108 -0
- package/dist/src/storage/migration-protocol.js +14 -197
- package/dist/src/storage/migration-records.js +186 -0
- package/dist/src/storage/migration-types.js +12 -0
- package/dist/src/tracker/forge-http.js +2 -1
- package/dist/src/tracker/issue-pages.js +110 -0
- package/package.json +3 -1
- package/schemas/mission-v1.schema.json +335 -0
- package/schemas/models/model-catalog.v1.schema.json +19 -1
- package/schemas/models/model-config-compatibility.v1.schema.json +3 -2
- package/schemas/models/model-policy.v1.schema.json +1 -1
- package/tools/agents/providers/antigravity.mjs +3 -5
- package/tools/agents/providers/base.mjs +3 -3
- package/tools/agents/providers/claude.mjs +3 -5
- package/tools/agents/providers/codex.mjs +3 -5
- package/tools/agents/providers/copilot.mjs +3 -5
- package/tools/agents/providers/cursor.mjs +3 -5
- package/tools/agents/providers/factory.mjs +3 -5
- package/tools/agents/providers/grok-build.mjs +9 -7
- package/tools/agents/providers/model-wrapper.mjs +86 -0
- package/tools/agents/providers/omp.mjs +3 -1
- package/tools/agents/providers/openclaw.mjs +3 -5
- package/tools/agents/providers/opencode.mjs +3 -5
- package/tools/agents/providers/provider-paths-staging.mjs +44 -0
- package/tools/agents/providers/rule-binding-targets.mjs +146 -0
- package/tools/agents/providers/rule-delivery.mjs +9 -128
- package/tools/agents/providers/warp.mjs +3 -5
- package/tools/agents/providers/windsurf.mjs +3 -5
- package/tools/plugin/package-plugins.mjs +2 -2
- package/tools/skills/codex-skill-transform.mjs +232 -0
- package/tools/skills/deploy-skills-codex.mjs +8 -249
- package/tools/warp/warp-content.mjs +548 -0
- package/vscode-extension/schemas/aiwg.config.v1.json +177 -0
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
addManagedMarker, contentHash, replaceBoundRulesBlock, deployEmulatedBehaviors, filterAgentFiles,
|
|
13
13
|
} from './base.mjs';
|
|
14
14
|
|
|
15
|
-
const { parseRuleFrontmatter, inferRuleActivation,
|
|
15
|
+
const { parseRuleFrontmatter, inferRuleActivation, readCoreBody, validateCoreSet, formatRuleFrontmatterError, CORE_RULES_START, CORE_RULES_END } = await importImpl(import.meta.url, 'rules/activation.mjs');
|
|
16
16
|
const { resolveDeployVersion } = await importImpl(import.meta.url, 'providers/deploy-version.mjs');
|
|
17
17
|
const { trackTemporaryDirectory } = await importImpl(import.meta.url, 'utils/temporary-directory.js');
|
|
18
18
|
const { loadRulePinConfigs, installedRuleCapabilities, resolveRulePins } = await importImpl(import.meta.url, 'rules/pins.mjs');
|
|
@@ -20,6 +20,8 @@ const { guardRulesInlineBudget } = await importImpl(import.meta.url, 'rules/inli
|
|
|
20
20
|
const { userConfigFile } = await importImpl(import.meta.url, 'config/user-config-dir.mjs');
|
|
21
21
|
const { resolveProjectAiwgDir } = await importImpl(import.meta.url, 'config/project-artifacts-runtime.mjs');
|
|
22
22
|
import { writeContextFileSync, CONTEXT_STAGE_ENV } from './context-write.mjs';
|
|
23
|
+
import { captureProviderPathDescriptors, setStagedProviderPath, restoreProviderPaths, logicalProviderOutputPath } from './provider-paths-staging.mjs';
|
|
24
|
+
import { resolveDeliveryRuleBindings } from './rule-binding-targets.mjs';
|
|
23
25
|
import { projectOnDemandReferences, renderRuleKernelIndex } from './rule-presentation.mjs';
|
|
24
26
|
export { renderRuleKernelIndex } from './rule-presentation.mjs';
|
|
25
27
|
const PREPARATION_HOOK = Symbol.for('aiwg.provider-preparation-hook.v1');
|
|
@@ -133,7 +135,7 @@ export async function prepareRuleDelivery(opts) {
|
|
|
133
135
|
const rules = collectDeploymentRuleSources(opts).map(file => {
|
|
134
136
|
const content = fs.readFileSync(file, 'utf8');
|
|
135
137
|
const parsed = parseRuleFrontmatter(content);
|
|
136
|
-
if (!parsed.valid) throw new Error(
|
|
138
|
+
if (!parsed.valid) throw new Error(formatRuleFrontmatterError(opts.logicalInputPath ? opts.logicalInputPath(file) : file, parsed.data, parsed.diagnostics));
|
|
137
139
|
const behavior = path.basename(file) === 'BEHAVIOR.md';
|
|
138
140
|
const rule = { ...parsed.rule, file, content, body: parsed.body, behavior,
|
|
139
141
|
name: behavior ? `behavior/${path.basename(path.dirname(file))}` : parsed.data.name || path.basename(file, '.md') };
|
|
@@ -175,128 +177,7 @@ export async function prepareRuleDelivery(opts) {
|
|
|
175
177
|
// All pins use native kernel projection, including legacy untagged rules.
|
|
176
178
|
rule.tagged = true;
|
|
177
179
|
}
|
|
178
|
-
const bindings =
|
|
179
|
-
const targets = [];
|
|
180
|
-
const targetKeys = new Set();
|
|
181
|
-
if (rules.some(rule => Object.values(rule.bound_to).some(ids => ids.length))) {
|
|
182
|
-
const { loadLocalCapabilityEntries, loadLocalOverrideCapabilityEntries, createRuleBindingTargetResolver } = await importImpl(import.meta.url, 'artifacts/query-engine.js');
|
|
183
|
-
const root = resolveAiwgRoot(opts.srcRoot) || opts.srcRoot;
|
|
184
|
-
// Framework graph paths are package-relative; project graph paths belong
|
|
185
|
-
// to the queried project. Normalize before merging so one source cannot
|
|
186
|
-
// become two apparently ambiguous targets after a source-index rebuild.
|
|
187
|
-
const indexEntries = new Map();
|
|
188
|
-
const entryPaths = new Map();
|
|
189
|
-
const loadEntries = (cwd, overridesOnly = false) => (overridesOnly
|
|
190
|
-
? loadLocalOverrideCapabilityEntries(cwd)
|
|
191
|
-
: loadLocalCapabilityEntries(cwd, undefined, indexEntries)).map(entry => {
|
|
192
|
-
const anchor = entry.path.startsWith('agentic/code/') ? root : cwd;
|
|
193
|
-
const key = `${anchor}\0${entry.path}`;
|
|
194
|
-
if (!entryPaths.has(key)) entryPaths.set(key, path.resolve(anchor, entry.path));
|
|
195
|
-
const resolvedPath = entryPaths.get(key);
|
|
196
|
-
// Canonical IDs hash the indexed package-relative path. Keep it through
|
|
197
|
-
// resolution; the selected target is anchored to root below.
|
|
198
|
-
return { ...entry, path: entry.path.startsWith('agentic/code/') ? entry.path
|
|
199
|
-
: opts.mapInputPath ? opts.mapInputPath(resolvedPath) : resolvedPath };
|
|
200
|
-
});
|
|
201
|
-
let rebuilt = false;
|
|
202
|
-
const cacheDir = process.env.AIWG_RULE_BINDING_INDEX_CACHE;
|
|
203
|
-
const cacheFile = cacheDir && path.join(cacheDir, `${contentHash(opts.logicalInputPath ? opts.logicalInputPath(root) : root)}.json`);
|
|
204
|
-
const buildSourceEntries = async (refresh = false) => {
|
|
205
|
-
if (!refresh && cacheFile) {
|
|
206
|
-
try { return JSON.parse(fs.readFileSync(cacheFile, 'utf8')).map(entry => ({ ...entry, path: path.isAbsolute(entry.path) && opts.mapInputPath ? opts.mapInputPath(entry.path) : entry.path })); }
|
|
207
|
-
catch (error) {
|
|
208
|
-
if (error.code !== 'ENOENT' && !(error instanceof SyntaxError)) throw error;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
const { collectRuleBindingEntries } = await importImpl(import.meta.url, 'artifacts/index-builder.js');
|
|
212
|
-
const sourceEntries = await collectRuleBindingEntries(root,
|
|
213
|
-
root === opts.srcRoot && !fs.existsSync(path.join(root, 'agentic')) ? '.' : 'agentic/code');
|
|
214
|
-
rebuilt = true;
|
|
215
|
-
const entries = sourceEntries.map(entry => ({ ...entry, path: entry.path.startsWith('agentic/code/')
|
|
216
|
-
? entry.path : path.resolve(root, entry.path) }));
|
|
217
|
-
if (cacheFile) {
|
|
218
|
-
fs.mkdirSync(cacheDir, { recursive: true });
|
|
219
|
-
// Workers may publish the same immutable source snapshot concurrently.
|
|
220
|
-
const temporary = `${cacheFile}.${process.pid}.tmp`;
|
|
221
|
-
fs.writeFileSync(temporary, JSON.stringify(entries.map(entry => ({ ...entry, path: opts.logicalInputPath ? opts.logicalInputPath(entry.path) : entry.path }))));
|
|
222
|
-
fs.renameSync(temporary, cacheFile);
|
|
223
|
-
}
|
|
224
|
-
return entries;
|
|
225
|
-
};
|
|
226
|
-
const localEntries = opts.bindingEntries || loadEntries(opts.target, Boolean(packageRelations));
|
|
227
|
-
let entries = [...localEntries];
|
|
228
|
-
if (!opts.bindingEntries) {
|
|
229
|
-
// The validated package table is authoritative for its exact source digest.
|
|
230
|
-
// Keep the canonical resolver for aliases, local overrides and ambiguity.
|
|
231
|
-
const sourceEntries = packageRelations
|
|
232
|
-
? Object.values(packageRelations.index.artifacts).map(entry => ({ ...entry,
|
|
233
|
-
indexScope: 'packaged', indexGraph: 'framework' }))
|
|
234
|
-
: loadEntries(root);
|
|
235
|
-
// A relocated project graph may also be visible while querying the
|
|
236
|
-
// package root. Keep its project-anchored instance only.
|
|
237
|
-
const uniqueSources = sourceEntries.filter(entry => !(opts.sharedProjectGraph &&
|
|
238
|
-
entry.path.startsWith(path.join(root, '.aiwg') + path.sep) &&
|
|
239
|
-
localEntries.some(local => local.type === entry.type && local.name === entry.name)));
|
|
240
|
-
entries.push(...uniqueSources);
|
|
241
|
-
if (!sourceEntries.length) entries.push(...await buildSourceEntries());
|
|
242
|
-
}
|
|
243
|
-
// Project-local installed bundles are outside the package source index.
|
|
244
|
-
// Reuse the existing binding index builder only for those source roots.
|
|
245
|
-
if (!opts.bindingEntries) {
|
|
246
|
-
for (const entry of Object.values(configs.project.installed || {})) {
|
|
247
|
-
if (!entry.localPath) continue;
|
|
248
|
-
const localRoot = path.resolve(opts.target, entry.localPath);
|
|
249
|
-
if (localRoot === root || !fs.existsSync(localRoot)) continue;
|
|
250
|
-
const temp = fs.mkdtempSync(path.join(os.tmpdir(), 'aiwg-local-rule-index-'));
|
|
251
|
-
try {
|
|
252
|
-
const { buildIndex } = await importImpl(import.meta.url, 'artifacts/index-builder.js');
|
|
253
|
-
await buildIndex(localRoot, { scope: '.', outputDir: temp, force: true, quiet: true });
|
|
254
|
-
const index = JSON.parse(read(path.join(temp, '.aiwg', '.index', 'metadata.json')));
|
|
255
|
-
const scoped = Object.values(index.entries).map(entry => ({ ...entry, path: path.resolve(localRoot, entry.path) }));
|
|
256
|
-
localEntries.push(...scoped);
|
|
257
|
-
entries.push(...scoped);
|
|
258
|
-
} finally { fs.rmSync(temp, { recursive: true, force: true }); }
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
// A stored index can predate the source tree (edge/dev checkouts). Rebuild once from source
|
|
262
|
-
// before reporting a binding target as missing.
|
|
263
|
-
const resolvedTargets = new Map();
|
|
264
|
-
let resolveBinding = createRuleBindingTargetResolver(entries);
|
|
265
|
-
const resolveTarget = async (type, id) => {
|
|
266
|
-
const key = `${type}:${id}`;
|
|
267
|
-
if (resolvedTargets.has(key)) return resolvedTargets.get(key);
|
|
268
|
-
let target;
|
|
269
|
-
try { target = resolveBinding(type, id); }
|
|
270
|
-
catch (error) {
|
|
271
|
-
if (packageRelations || rebuilt || opts.bindingEntries || !/^Missing /.test(error.message)) throw error;
|
|
272
|
-
indexEntries.clear();
|
|
273
|
-
entryPaths.clear();
|
|
274
|
-
entries = [...localEntries, ...await buildSourceEntries(true)];
|
|
275
|
-
rebuilt = true;
|
|
276
|
-
resolveBinding = createRuleBindingTargetResolver(entries);
|
|
277
|
-
target = resolveBinding(type, id);
|
|
278
|
-
// A rebuild replaces the input set for every lookup.
|
|
279
|
-
resolvedTargets.clear();
|
|
280
|
-
}
|
|
281
|
-
resolvedTargets.set(key, target);
|
|
282
|
-
return target;
|
|
283
|
-
};
|
|
284
|
-
for (const rule of rules.filter(rule => rule.tagged)) {
|
|
285
|
-
for (const [key, type] of Object.entries(RULE_BINDING_TYPES)) {
|
|
286
|
-
for (const id of rule.bound_to[key]) {
|
|
287
|
-
const target = await resolveTarget(type, id);
|
|
288
|
-
const source = path.isAbsolute(target.path) ? target.path : path.resolve(target.path.startsWith('agentic/code/') ? root : opts.target, target.path);
|
|
289
|
-
if (!fs.existsSync(source)) throw new Error(`${rule.file}: binding target content missing: ${source}`);
|
|
290
|
-
bindings.set(source, [...(bindings.get(source) || []), rule]);
|
|
291
|
-
const key = `${target.type}:${source}`;
|
|
292
|
-
if (!targetKeys.has(key)) {
|
|
293
|
-
targetKeys.add(key);
|
|
294
|
-
targets.push({ ...target, source });
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
180
|
+
const { bindings, targets } = await resolveDeliveryRuleBindings(opts, rules, configs, root, packageRelations);
|
|
300
181
|
return { rules, bindings, targets, pins: pinned.rules, pinWarnings: pinned.warnings };
|
|
301
182
|
}
|
|
302
183
|
|
|
@@ -1010,7 +891,7 @@ export async function prepareRuleDeployment(original, provider, deploy) {
|
|
|
1010
891
|
const mappings = [];
|
|
1011
892
|
const preimages = [...initialPreimages];
|
|
1012
893
|
let retained = false;
|
|
1013
|
-
const originals =
|
|
894
|
+
const originals = captureProviderPathDescriptors(provider);
|
|
1014
895
|
const logicalTarget = original.target;
|
|
1015
896
|
const priorAiwgRoot = process.env.AIWG_ROOT;
|
|
1016
897
|
const priorRegistry = process.env.AIWG_USER_REGISTRY_PATH;
|
|
@@ -1148,7 +1029,7 @@ export async function prepareRuleDeployment(original, provider, deploy) {
|
|
|
1148
1029
|
if (!path.isAbsolute(dir)) continue;
|
|
1149
1030
|
const to = path.join(temp, 'native', key);
|
|
1150
1031
|
mount(dir, to);
|
|
1151
|
-
provider
|
|
1032
|
+
setStagedProviderPath(provider, key, to);
|
|
1152
1033
|
}
|
|
1153
1034
|
let kernel = provider.kernelSkillsPath;
|
|
1154
1035
|
if (kernel && path.isAbsolute(kernel)) {
|
|
@@ -1235,7 +1116,7 @@ export async function prepareRuleDeployment(original, provider, deploy) {
|
|
|
1235
1116
|
}
|
|
1236
1117
|
delivery.bindings = remappedBindings;
|
|
1237
1118
|
preimages.push(...snapshotPreimages([...delivery.rules.map(rule => rule.file), ...delivery.targets.map(entry => entry.source), path.join(target, '.aiwg', 'aiwg.config')]));
|
|
1238
|
-
const opts = { ...original, target: stage, dryRun: false, ruleDelivery: delivery,
|
|
1119
|
+
const opts = { ...original, target: stage, dryRun: false, ruleDelivery: delivery, logicalOutputPath: file => logicalProviderOutputPath(file, stage, target, mappings),
|
|
1239
1120
|
kernelSkillsPath: kernel, deploymentHome: home, activeWorkspace, hermesLegacySkills, legacyCodexSkills, staging: true };
|
|
1240
1121
|
await deploySelectedSurface(opts, provider, deploy);
|
|
1241
1122
|
if (!opts.commandsOnly && !opts.skillsOnly && !opts.rulesOnly && opts.deployBehaviors !== false) {
|
|
@@ -1344,7 +1225,7 @@ export async function prepareRuleDeployment(original, provider, deploy) {
|
|
|
1344
1225
|
return plan;
|
|
1345
1226
|
} finally {
|
|
1346
1227
|
if (priorContextStage === undefined) delete process.env[CONTEXT_STAGE_ENV]; else process.env[CONTEXT_STAGE_ENV] = priorContextStage;
|
|
1347
|
-
|
|
1228
|
+
restoreProviderPaths(provider, originals);
|
|
1348
1229
|
if (priorAiwgRoot === undefined) delete process.env.AIWG_ROOT; else process.env.AIWG_ROOT = priorAiwgRoot;
|
|
1349
1230
|
if (priorRegistry === undefined) delete process.env.AIWG_USER_REGISTRY_PATH; else process.env.AIWG_USER_REGISTRY_PATH = priorRegistry;
|
|
1350
1231
|
if (priorArtifacts === undefined) delete process.env.AIWG_ARTIFACTS_PATH; else process.env.AIWG_ARTIFACTS_PATH = priorArtifacts;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withModelWrapper } from './model-wrapper.mjs';
|
|
1
2
|
import { importImpl } from '../../_resolve-impl.mjs';
|
|
2
3
|
/**
|
|
3
4
|
* Warp Terminal Provider
|
|
@@ -20,7 +21,6 @@ import { importImpl } from '../../_resolve-impl.mjs';
|
|
|
20
21
|
* - Backup creation with timestamp
|
|
21
22
|
* - CLAUDE.md symlink support
|
|
22
23
|
*/
|
|
23
|
-
|
|
24
24
|
import realFs from 'fs';
|
|
25
25
|
import { createRequire } from 'module';
|
|
26
26
|
const _require = createRequire(import.meta.url);
|
|
@@ -48,13 +48,10 @@ import {
|
|
|
48
48
|
normalizeDeploymentMode,
|
|
49
49
|
collectFrameworkArtifacts
|
|
50
50
|
} from './base.mjs';
|
|
51
|
-
|
|
52
51
|
import { writeContextFileSync } from './context-write.mjs';
|
|
53
|
-
|
|
54
52
|
// ============================================================================
|
|
55
53
|
// Provider Configuration
|
|
56
54
|
// ============================================================================
|
|
57
|
-
|
|
58
55
|
export const name = 'warp';
|
|
59
56
|
export const aliases = [];
|
|
60
57
|
|
|
@@ -141,7 +138,8 @@ export function mapModel(shorthand, modelCfg, modelsConfig) {
|
|
|
141
138
|
/**
|
|
142
139
|
* Transform agent content for Warp
|
|
143
140
|
*/
|
|
144
|
-
export
|
|
141
|
+
export const transformAgent = withModelWrapper('warp', translateAgent);
|
|
142
|
+
function translateAgent(srcPath, content, opts) {
|
|
145
143
|
const { reasoningModel, codingModel, efficiencyModel } = opts;
|
|
146
144
|
|
|
147
145
|
// Only transform if model overrides specified
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withModelWrapper } from './model-wrapper.mjs';
|
|
1
2
|
import { importImpl } from '../../_resolve-impl.mjs';
|
|
2
3
|
/**
|
|
3
4
|
* Devin Desktop Provider (Windsurf compatibility adapter)
|
|
@@ -23,7 +24,6 @@ import { importImpl } from '../../_resolve-impl.mjs';
|
|
|
23
24
|
* - Conventional skills and rules deployment
|
|
24
25
|
* - Devin Desktop selectors resolve to the stable `windsurf` provider id
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
27
|
import realFs from 'fs';
|
|
28
28
|
import { createRequire } from 'module';
|
|
29
29
|
const _require = createRequire(import.meta.url);
|
|
@@ -55,13 +55,10 @@ import {
|
|
|
55
55
|
filterCommandsAgainstSkills,
|
|
56
56
|
deploySoulCompanions
|
|
57
57
|
} from './base.mjs';
|
|
58
|
-
|
|
59
58
|
import { writeContextFileSync } from './context-write.mjs';
|
|
60
|
-
|
|
61
59
|
// ============================================================================
|
|
62
60
|
// Provider Configuration
|
|
63
61
|
// ============================================================================
|
|
64
|
-
|
|
65
62
|
export const name = 'windsurf';
|
|
66
63
|
export const aliases = ['devin', 'devin-desktop', 'devin-local', 'cascade'];
|
|
67
64
|
|
|
@@ -98,7 +95,8 @@ export const capabilities = {
|
|
|
98
95
|
/**
|
|
99
96
|
* Transform agent content to Windsurf format (plain markdown, no YAML frontmatter)
|
|
100
97
|
*/
|
|
101
|
-
export
|
|
98
|
+
export const transformAgent = withModelWrapper('windsurf', translateAgent);
|
|
99
|
+
function translateAgent(srcPath, content, opts) {
|
|
102
100
|
const fmMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
103
101
|
if (!fmMatch) return content;
|
|
104
102
|
|
|
@@ -227,7 +227,6 @@ Writing quality validation and AI pattern detection.
|
|
|
227
227
|
- Discord: https://discord.gg/BuAusFMxdA
|
|
228
228
|
`
|
|
229
229
|
},
|
|
230
|
-
|
|
231
230
|
'utils': {
|
|
232
231
|
name: 'utils',
|
|
233
232
|
displayName: 'AIWG Utilities',
|
|
@@ -240,7 +239,8 @@ Writing quality validation and AI pattern detection.
|
|
|
240
239
|
extraCopy: [
|
|
241
240
|
{ from: 'agentic/code/addons/aiwg-utils/rules/skill-discovery.md', to: 'rules/skill-discovery.md' },
|
|
242
241
|
{ from: 'agentic/code/addons/aiwg-utils/rules/skill-discovery-guidance.md', to: 'rules/skill-discovery-guidance.md' },
|
|
243
|
-
{ from: 'agentic/code/addons/aiwg-utils/rules/cli-secondary.md', to: 'rules/cli-secondary.md' }
|
|
242
|
+
{ from: 'agentic/code/addons/aiwg-utils/rules/cli-secondary.md', to: 'rules/cli-secondary.md' },
|
|
243
|
+
{ from: 'agentic/code/addons/aiwg-utils/templates/subagent-brief.md', to: 'templates/subagent-brief.md' }
|
|
244
244
|
],
|
|
245
245
|
readme: `# AIWG Utilities
|
|
246
246
|
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
// Transform AIWG skill instructions and metadata for Codex deployment.
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { skillMatchesProvider } from '../agents/providers/base.mjs';
|
|
5
|
+
|
|
6
|
+
const MAX_NAME_LENGTH = 100;
|
|
7
|
+
const MAX_DESCRIPTION_LENGTH = 500;
|
|
8
|
+
|
|
9
|
+
export function stripWrappingQuotes(value) {
|
|
10
|
+
const trimmed = String(value ?? '').trim();
|
|
11
|
+
if (
|
|
12
|
+
(trimmed.startsWith('"') && trimmed.endsWith('"')) ||
|
|
13
|
+
(trimmed.startsWith("'") && trimmed.endsWith("'"))
|
|
14
|
+
) {
|
|
15
|
+
return trimmed.slice(1, -1);
|
|
16
|
+
}
|
|
17
|
+
return trimmed;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function yamlDoubleQuoted(value) {
|
|
21
|
+
return String(value ?? '')
|
|
22
|
+
.replace(/\\/g, '\\\\')
|
|
23
|
+
.replace(/"/g, '\\"')
|
|
24
|
+
.replace(/\r?\n/g, ' ')
|
|
25
|
+
.trim();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function codexDisplayName(skillName) {
|
|
29
|
+
const acronyms = new Map([
|
|
30
|
+
['aiwg', 'AIWG'],
|
|
31
|
+
['dfir', 'DFIR'],
|
|
32
|
+
['sdlc', 'SDLC'],
|
|
33
|
+
['mcp', 'MCP'],
|
|
34
|
+
['pr', 'PR'],
|
|
35
|
+
]);
|
|
36
|
+
|
|
37
|
+
return String(skillName)
|
|
38
|
+
.split('-')
|
|
39
|
+
.filter(Boolean)
|
|
40
|
+
.map((part) => acronyms.get(part.toLowerCase()) || part.charAt(0).toUpperCase() + part.slice(1))
|
|
41
|
+
.join(' ');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function codexOpenAiMetadata(skill) {
|
|
45
|
+
return `interface:
|
|
46
|
+
display_name: "${yamlDoubleQuoted(codexDisplayName(skill.name))}"
|
|
47
|
+
short_description: "${yamlDoubleQuoted(skill.description)}"
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function resolveSkillModelPolicy(frontmatter) {
|
|
52
|
+
const block = frontmatter.match(/^commandHint:\s*\n((?:[ \t]+[^\n]*\n?)*)/m)?.[1] || '';
|
|
53
|
+
const hint = {};
|
|
54
|
+
for (const line of block.split('\n')) {
|
|
55
|
+
const match = line.trim().match(/^(model|modelRole|modelTier|modelEffort|modelRationale):\s*(.+)$/);
|
|
56
|
+
if (match) hint[match[1]] = stripWrappingQuotes(match[2]);
|
|
57
|
+
}
|
|
58
|
+
const legacy = String(hint.model || '').toLowerCase();
|
|
59
|
+
const role = hint.modelRole || (legacy === 'opus' ? 'reasoning'
|
|
60
|
+
: legacy === 'haiku' ? 'efficiency' : legacy ? 'coding' : null);
|
|
61
|
+
if (!role) return null;
|
|
62
|
+
return {
|
|
63
|
+
role,
|
|
64
|
+
tier: hint.modelTier || (role === 'reasoning' ? 'premium'
|
|
65
|
+
: role === 'efficiency' ? 'economy' : 'standard'),
|
|
66
|
+
effort: hint.modelEffort,
|
|
67
|
+
rationale: hint.modelRationale,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Parse AIWG SKILL.md - handles both frontmatter and non-frontmatter formats
|
|
73
|
+
*/
|
|
74
|
+
function parseSkillContent(content, skillName) {
|
|
75
|
+
// Try YAML frontmatter format first
|
|
76
|
+
const fmMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
77
|
+
if (fmMatch) {
|
|
78
|
+
const [, frontmatter, body] = fmMatch;
|
|
79
|
+
const metadata = {};
|
|
80
|
+
|
|
81
|
+
// Parse YAML-like frontmatter
|
|
82
|
+
for (const line of frontmatter.split('\n')) {
|
|
83
|
+
const colonIdx = line.indexOf(':');
|
|
84
|
+
if (colonIdx > 0) {
|
|
85
|
+
const key = line.slice(0, colonIdx).trim();
|
|
86
|
+
const value = line.slice(colonIdx + 1).trim();
|
|
87
|
+
metadata[key] = stripWrappingQuotes(value);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return { metadata, body, modelPolicy: resolveSkillModelPolicy(frontmatter) };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Fallback: Parse non-frontmatter format (# skill-name header)
|
|
95
|
+
const lines = content.split('\n');
|
|
96
|
+
let name = skillName;
|
|
97
|
+
let description = '';
|
|
98
|
+
let bodyStartIdx = 0;
|
|
99
|
+
|
|
100
|
+
// Look for # header as name
|
|
101
|
+
for (let i = 0; i < lines.length; i++) {
|
|
102
|
+
const line = lines[i].trim();
|
|
103
|
+
if (line.startsWith('# ')) {
|
|
104
|
+
name = line.slice(2).trim();
|
|
105
|
+
bodyStartIdx = i + 1;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Look for first paragraph as description (skip empty lines)
|
|
111
|
+
for (let i = bodyStartIdx; i < lines.length; i++) {
|
|
112
|
+
const line = lines[i].trim();
|
|
113
|
+
if (
|
|
114
|
+
line &&
|
|
115
|
+
!line.endsWith(':') &&
|
|
116
|
+
!line.startsWith('#') &&
|
|
117
|
+
!line.startsWith('-') &&
|
|
118
|
+
!line.startsWith('|')
|
|
119
|
+
) {
|
|
120
|
+
description = line;
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// If description is too short, try next paragraph
|
|
126
|
+
if (description.length < 20) {
|
|
127
|
+
for (let i = bodyStartIdx; i < lines.length; i++) {
|
|
128
|
+
const line = lines[i].trim();
|
|
129
|
+
if (line.startsWith('## ') && line.toLowerCase().includes('purpose')) {
|
|
130
|
+
// Look for content after ## Purpose
|
|
131
|
+
for (let j = i + 1; j < lines.length && j < i + 10; j++) {
|
|
132
|
+
const purposeLine = lines[j].trim();
|
|
133
|
+
if (purposeLine && !purposeLine.startsWith('#') && !purposeLine.startsWith('-')) {
|
|
134
|
+
description = purposeLine;
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
metadata: { name, description },
|
|
145
|
+
body: content
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Transform AIWG skill to Codex format
|
|
151
|
+
*/
|
|
152
|
+
export function transformToCodexSkill(skillDir) {
|
|
153
|
+
const skillPath = path.join(skillDir, 'SKILL.md');
|
|
154
|
+
const skillName = path.basename(skillDir);
|
|
155
|
+
const content = fs.readFileSync(skillPath, 'utf8');
|
|
156
|
+
|
|
157
|
+
// Platform filtering: skip skills with explicit restrictions that exclude codex.
|
|
158
|
+
// Skills using platforms: [all] (the standard token) always pass this check.
|
|
159
|
+
if (!skillMatchesProvider(content, 'codex')) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const parsed = parseSkillContent(content, skillName);
|
|
164
|
+
|
|
165
|
+
if (!parsed) {
|
|
166
|
+
console.warn(`Warning: Could not parse ${skillPath}`);
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const { metadata, body, modelPolicy } = parsed;
|
|
171
|
+
|
|
172
|
+
// Validate and truncate
|
|
173
|
+
const name = (metadata.name || path.basename(skillDir)).slice(0, MAX_NAME_LENGTH);
|
|
174
|
+
let description = metadata.description || '';
|
|
175
|
+
|
|
176
|
+
// Codex REQUIRES a non-empty description — it rejects SKILL.md files that
|
|
177
|
+
// lack one. Fail loudly rather than silently writing `description: ""`
|
|
178
|
+
// (the exact regression this guard defends against).
|
|
179
|
+
if (!description || !String(description).trim()) {
|
|
180
|
+
console.error(
|
|
181
|
+
`ERROR: Skill '${name}' has empty/missing description in source ${skillPath}`
|
|
182
|
+
);
|
|
183
|
+
console.error(
|
|
184
|
+
` Codex rejects SKILL.md files without a description field.`
|
|
185
|
+
);
|
|
186
|
+
console.error(
|
|
187
|
+
` Fix the source file: add a non-empty 'description:' to the frontmatter.`
|
|
188
|
+
);
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Truncate description to 500 chars, ending at word boundary
|
|
193
|
+
if (description.length > MAX_DESCRIPTION_LENGTH) {
|
|
194
|
+
description = description.slice(0, MAX_DESCRIPTION_LENGTH - 3);
|
|
195
|
+
const lastSpace = description.lastIndexOf(' ');
|
|
196
|
+
if (lastSpace > MAX_DESCRIPTION_LENGTH - 50) {
|
|
197
|
+
description = description.slice(0, lastSpace);
|
|
198
|
+
}
|
|
199
|
+
description += '...';
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Final guard: never emit `description: ""` under any circumstance.
|
|
203
|
+
const quotedDescription = yamlDoubleQuoted(description);
|
|
204
|
+
if (!quotedDescription || !quotedDescription.trim()) {
|
|
205
|
+
console.error(
|
|
206
|
+
`ERROR: Skill '${name}' description collapsed to empty after normalization (source: ${skillPath})`
|
|
207
|
+
);
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Build Codex skill format — include platforms: [codex] so deployed skills are self-describing
|
|
212
|
+
const codexContent = `---
|
|
213
|
+
name: "${yamlDoubleQuoted(name)}"
|
|
214
|
+
description: "${quotedDescription}"
|
|
215
|
+
platforms: [codex]
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
${modelPolicy
|
|
219
|
+
? `<!-- aiwg:model-policy role=${modelPolicy.role} tier=${modelPolicy.tier}${modelPolicy.effort ? ` effort=${modelPolicy.effort}` : ''} outcome=unsupported${modelPolicy.rationale ? ` rationale=${yamlDoubleQuoted(modelPolicy.rationale)}` : ''} -->\n\n`
|
|
220
|
+
: ''}${body.trim()}
|
|
221
|
+
`;
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
name,
|
|
225
|
+
description,
|
|
226
|
+
content: codexContent,
|
|
227
|
+
metadataContent: codexOpenAiMetadata({ name, description }),
|
|
228
|
+
sourcePath: skillPath,
|
|
229
|
+
modelPolicy,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|