@aiwg/cli 2026.11.7 → 2026.11.9
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/README.md +1 -1
- package/agentic/code/addons/aiwg-hooks/hooks/aiwg-prompt-discovery.cjs +3 -2
- package/agentic/code/providers/capability-matrix.yaml +4 -4
- package/agentic/code/providers/model-capabilities.v1.json +169 -46
- package/agentic/code/providers/model-catalog.v1.json +17 -15
- package/bin/aiwg.mjs +3 -1
- package/dist/src/agents/agent-packager.js +3 -3
- package/dist/src/artifacts/cli.js +6 -2
- package/dist/src/artifacts/fortemi-core-sync.js +2 -0
- package/dist/src/artifacts/index-query-help.js +27 -0
- package/dist/src/artifacts/query-engine-installation.js +17 -4
- package/dist/src/artifacts/query-engine-name-intent.js +56 -0
- package/dist/src/artifacts/query-engine-scoring.js +14 -8
- package/dist/src/artifacts/query-engine-show-card.js +3 -3
- package/dist/src/cli/agent-spawn.js +4 -4
- package/dist/src/cli/handlers/best-practices-audit.js +1 -1
- package/dist/src/cli/handlers/bundle-deployment-mode.js +26 -13
- package/dist/src/cli/handlers/bundle-reconciliation.js +2 -2
- package/dist/src/cli/handlers/init.js +1 -1
- package/dist/src/cli/handlers/issues.js +5 -0
- package/dist/src/cli/handlers/marketplace-plugin-search.js +6 -5
- package/dist/src/cli/handlers/marketplace.js +1 -1
- package/dist/src/cli/handlers/models-muse-wrapper.js +32 -0
- package/dist/src/cli/handlers/models.js +5 -4
- package/dist/src/cli/handlers/refresh-artifact-freshness.js +51 -0
- package/dist/src/cli/handlers/refresh-bundles.js +3 -0
- package/dist/src/cli/handlers/refresh-managed-deployment.js +19 -7
- package/dist/src/cli/handlers/refresh-user-hooks.js +102 -0
- package/dist/src/cli/handlers/refresh.js +9 -3
- package/dist/src/cli/handlers/repo-access.js +15 -2
- package/dist/src/cli/handlers/sdlc-accelerate.js +1 -1
- package/dist/src/cli/handlers/steward.js +1 -1
- package/dist/src/cli/handlers/subcommands-bundles.js +1 -1
- package/dist/src/cli/handlers/subcommands-discovery.js +5 -0
- package/dist/src/cli/handlers/subcommands-list.js +1 -1
- package/dist/src/cli/handlers/subcommands-plugins.js +1 -1
- package/dist/src/cli/handlers/subcommands-storage.js +11 -0
- package/dist/src/cli/handlers/team.js +1 -1
- package/dist/src/cli/handlers/use-additive-bundles.js +9 -2
- package/dist/src/cli/handlers/use-bundle-counts.js +1 -1
- package/dist/src/cli/handlers/use-copy-selection.js +42 -0
- package/dist/src/cli/handlers/use.js +33 -38
- package/dist/src/cli/handlers/workspace-context.js +4 -0
- package/dist/src/cli/help-generator.js +1 -1
- package/dist/src/cli/new-project-options.js +46 -0
- package/dist/src/cli/router.js +15 -4
- package/dist/src/cli/scope-resolver.js +6 -6
- package/dist/src/cli/services/deployment-probe-scope.js +11 -0
- package/dist/src/cli/services/deployment-staleness.js +83 -0
- package/dist/src/cli/services/deployment-verification.js +20 -11
- package/dist/src/config/aiwg-config.js +1 -1
- package/dist/src/config/authorization-cli.js +36 -1
- package/dist/src/config/config-normalization.js +3 -1
- package/dist/src/config/worker-guidance-warning.js +8 -0
- package/dist/src/data/community.yaml +3 -3
- package/dist/src/extensions/commands/definitions.js +2 -2
- package/dist/src/extensions/manifest.js +27 -1
- package/dist/src/extensions/user-hook-diagnostics.js +18 -1
- package/dist/src/extensions/verified-hook-command.js +9 -0
- package/dist/src/features/catalog.js +2 -2
- package/dist/src/issues/cli.js +10 -2
- package/dist/src/marketplace/cache.js +31 -0
- package/dist/src/marketplace/plugin-search.js +39 -20
- package/dist/src/marketplace/public-search.js +122 -0
- package/dist/src/marketplace/registry.js +2 -0
- package/dist/src/marketplace/search-contract.js +19 -0
- package/dist/src/marketplace/sources/public-search.js +81 -0
- package/dist/src/mcp/cli.mjs +8 -7
- package/dist/src/mcp/credentials.mjs +1 -1
- package/dist/src/mcp/registry.js +6 -2
- package/dist/src/mcp/tool-filters.mjs +1 -1
- package/dist/src/memory/provider-memory-adapter.js +1 -1
- package/dist/src/models/catalog-policy.js +2 -1
- package/dist/src/models/config-loader.js +2 -1
- package/dist/src/models/cursor-models.js +92 -0
- package/dist/src/models/cursor-worker-version.d.mts +2 -0
- package/dist/src/models/cursor-worker-version.mjs +27 -0
- package/dist/src/models/model-capabilities.v1.json +169 -46
- package/dist/src/models/model-catalog.v1.json +17 -15
- package/dist/src/models/model-discovery.js +7 -6
- package/dist/src/models/policy-resources.js +1 -1
- package/dist/src/models/provider-policy.js +1 -1
- package/dist/src/models/worker-direct-readiness.js +8 -5
- package/dist/src/models/worker-health-readiness.js +4 -0
- package/dist/src/models/worker-installation.d.mts +5 -2
- package/dist/src/models/worker-installation.mjs +20 -12
- package/dist/src/models/worker-invocation-policy.js +22 -2
- package/dist/src/models/worker-plan.js +3 -1
- package/dist/src/models/worker-wiring-diagnostics.js +25 -0
- package/dist/src/models/wrapper-deployment.js +1 -1
- package/dist/src/models/wrapper-enforcement.js +6 -2
- package/dist/src/plugin/skill-command-frontmatter.js +1 -1
- package/dist/src/plugin/skill-command-translator.js +1 -1
- package/dist/src/policy/repo-access-workspace-spec.js +63 -0
- package/dist/src/policy/repo-access.js +22 -0
- package/dist/src/providers/capability-matrix.yaml +4 -4
- package/dist/src/providers/deployment-ownership.mjs +1 -1
- package/dist/src/providers/deployment-preservation.mjs +10 -5
- package/dist/src/providers/deployment-removal.js +1 -1
- package/dist/src/providers/devin-compat.d.mts +4 -0
- package/dist/src/providers/devin-compat.mjs +29 -0
- package/dist/src/providers/grok-build-acp.js +39 -9
- package/dist/src/providers/grok-build-paths.js +8 -7
- package/dist/src/providers/provider-context-contracts.js +7 -3
- package/dist/src/providers/provider-definition-schema.js +1 -1
- package/dist/src/providers/provider-definitions.js +1 -1
- package/dist/src/providers/provider-definitions.mjs +3 -3
- package/dist/src/providers/provider-inventory.js +13 -1
- package/dist/src/providers/provider-seeds-1.js +1 -1
- package/dist/src/providers/provider-seeds-3.js +10 -9
- package/dist/src/providers/transformation-receipt-integration.js +1 -1
- package/dist/src/sessions/adapters/windsurf.js +7 -7
- package/dist/src/sessions/grok-build-cli-output.js +1 -1
- package/dist/src/sessions/grok-build-cli.js +7 -1
- package/dist/src/skills/bundle-import-cli.js +61 -0
- package/dist/src/skills/bundle-import-plan.js +108 -0
- package/dist/src/skills/bundle-import.js +192 -0
- package/dist/src/skills/cli.js +5 -0
- package/dist/src/skills/deployment-policy.js +1 -1
- package/dist/src/skills/importer.js +4 -4
- package/dist/src/smiths/agentsmith/demo.js +1 -1
- package/dist/src/smiths/agentsmith/examples.js +6 -6
- package/dist/src/smiths/commandsmith/generator.js +1 -1
- package/dist/src/smiths/context-pipeline/allowlist.js +1 -1
- package/dist/src/smiths/context-pipeline/muse-bridge.js +7 -4
- package/dist/src/smiths/context-pipeline/parallelism-section.js +2 -2
- package/dist/src/smiths/context-pipeline/workspace-audit.js +37 -6
- package/dist/src/smiths/context-pipeline/workspace-bootstrap.js +3 -1
- package/dist/src/smiths/context-pipeline/workspace-doctor.js +16 -4
- package/dist/src/smiths/context-pipeline/workspace-document.js +4 -2
- package/dist/src/smiths/hook-bridge/codex-trust.js +56 -7
- package/dist/src/smiths/hook-bridge/cursor-translator.js +89 -0
- package/dist/src/smiths/hook-bridge/index.js +4 -1
- package/dist/src/smiths/skillsmith/collision-detector.js +1 -1
- package/dist/src/smiths/skillsmith/namespace-adapter.js +1 -1
- package/dist/src/smiths/skillsmith/platform-resolver.js +2 -2
- package/dist/src/writing/campaign-report.js +4 -3
- package/dist/src/writing/contextual-diagnostics.js +29 -3
- package/dist/src/writing/current-patterns.catalogue.json +4 -4
- package/dist/src/writing/current-patterns.js +3 -2
- package/dist/src/writing/structural-judgment.catalogue.json +17 -0
- package/dist/src/writing/structural-judgment.js +33 -0
- package/dist/src/writing/structural-patterns.js +78 -6
- package/dist/src/writing/validation-campaign.js +3 -0
- package/dist/src/writing/validation-engine.js +7 -4
- package/package.json +4 -2
- package/schemas/models/model-config-compatibility.v1.schema.json +1 -1
- package/tools/agents/deploy-agents.mjs +12 -10
- package/tools/agents/deploy-options.mjs +1 -0
- package/tools/agents/providers/base-behaviors.mjs +1 -1
- package/tools/agents/providers/base-contract.mjs +1 -1
- package/tools/agents/providers/base-kernel-skills.mjs +1 -1
- package/tools/agents/providers/base-models-platforms.mjs +9 -7
- package/tools/agents/providers/base-rule-index.mjs +1 -1
- package/tools/agents/providers/codex.mjs +1 -0
- package/tools/agents/providers/cursor-prompt-discovery.mjs +13 -0
- package/tools/agents/providers/cursor.mjs +2 -0
- package/tools/agents/providers/devin.mjs +3 -0
- package/tools/agents/providers/grok-build.mjs +14 -19
- package/tools/agents/providers/hook-capabilities.mjs +1 -1
- package/tools/agents/providers/model-wrapper.mjs +1 -1
- package/tools/agents/providers/openclaw-context.mjs +6 -0
- package/tools/agents/providers/openclaw.mjs +14 -12
- package/tools/agents/providers/rule-delivery-surface.mjs +15 -11
- package/tools/agents/providers/rule-deployment-prepare.mjs +9 -8
- package/tools/agents/providers/rule-presentation.mjs +1 -1
- package/tools/agents/providers/rule-projection.mjs +5 -5
- package/tools/agents/providers/rule-startup.mjs +4 -2
- package/tools/agents/providers/skill-copy-prune.mjs +5 -1
- package/tools/agents/providers/windsurf.mjs +26 -26
- package/tools/agents/use-rule-selection.mjs +1 -1
- package/tools/cli/workspace-deployment-health.mjs +38 -0
- package/tools/cli/workspace-status.mjs +5 -2
- package/tools/daemon/provider-watcher.mjs +3 -3
- package/tools/plugin/package-plugins.mjs +16 -2
- package/tools/ralph-external/lib/deepseek-harness-adapter.mjs +36 -22
- package/tools/ralph-external/lib/factory-adapter.mjs +13 -28
- package/tools/ralph-external/lib/factory-stream-final.mjs +31 -0
- package/tools/skills/deploy-skills-codex.mjs +2 -1
- package/vscode-extension/schemas/aiwg.config.v1.json +15 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Read pre-buyout Desktop configuration and deployment records under the canonical identity.
|
|
2
|
+
const record = value => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
3
|
+
export const canonicalDesktopProviderId = provider => provider === 'windsurf' ? 'devin' : provider;
|
|
4
|
+
|
|
5
|
+
export function canonicalizeDesktopProviderKeys(records) {
|
|
6
|
+
if (!record(records) || !Object.hasOwn(records, 'windsurf')) return records;
|
|
7
|
+
const { windsurf, ...current } = records;
|
|
8
|
+
if (!Object.hasOwn(current, 'devin')) return { ...current, devin: windsurf };
|
|
9
|
+
return { ...current, devin: record(windsurf) && record(current.devin)
|
|
10
|
+
? { ...windsurf, ...current.devin } : current.devin };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function normalizeDesktopConfig(config) {
|
|
14
|
+
if (!record(config)) return config;
|
|
15
|
+
if (Array.isArray(config.providers) && config.providers.includes('windsurf')) {
|
|
16
|
+
config.providers = config.providers.map(canonicalDesktopProviderId)
|
|
17
|
+
.filter((id, index, ids) => id !== 'devin' || ids.indexOf(id) === index);
|
|
18
|
+
}
|
|
19
|
+
if (record(config.installed)) for (const entry of Object.values(config.installed)) {
|
|
20
|
+
if (record(entry) && record(entry.deployedTo)) entry.deployedTo = canonicalizeDesktopProviderKeys(entry.deployedTo);
|
|
21
|
+
}
|
|
22
|
+
return config;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Model validation and loading share a pure conversion of the deprecated selector.
|
|
26
|
+
export function normalizeDesktopModelConfig(config) {
|
|
27
|
+
if (!record(config) || !record(config.defaults) || config.defaults.provider !== 'windsurf') return config;
|
|
28
|
+
return { ...config, defaults: { ...config.defaults, provider: 'devin' } };
|
|
29
|
+
}
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { signalChild } from '../process/signal-child.mjs';
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
4
|
import { redactGrokOutput } from './grok-build-headless.js';
|
|
5
|
+
function isRecord(value) {
|
|
6
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
7
|
+
}
|
|
5
8
|
export class GrokAcpClient {
|
|
6
9
|
child;
|
|
7
10
|
env;
|
|
@@ -18,10 +21,15 @@ export class GrokAcpClient {
|
|
|
18
21
|
sessionId;
|
|
19
22
|
text = '';
|
|
20
23
|
constructor(options) {
|
|
24
|
+
for (const key of ['timeoutMs', 'maxStderrBytes']) {
|
|
25
|
+
if (options[key] !== undefined && (!Number.isFinite(options[key]) || options[key] <= 0)) {
|
|
26
|
+
throw new Error(`Grok ACP ${key} must be a positive finite number`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
21
29
|
this.env = options.env ?? process.env;
|
|
22
30
|
this.cwd = options.cwd;
|
|
23
31
|
this.timeoutMs = Math.min(Math.max(options.timeoutMs ?? 30_000, 1), 120_000);
|
|
24
|
-
this.maxStderrBytes = options.maxStderrBytes ?? 1024 * 1024;
|
|
32
|
+
this.maxStderrBytes = Math.min(options.maxStderrBytes ?? 1024 * 1024, 8 * 1024 * 1024);
|
|
25
33
|
this.onUpdate = options.onUpdate;
|
|
26
34
|
this.child = spawn(options.command ?? 'grok', [...(options.prefixArgs ?? []), '--no-auto-update', '--allow', 'Bash(aiwg discover *)', ...(options.disableSubagents ? ['--no-subagents', '--disallowed-tools', 'workflow'] : []), 'agent', 'stdio'], {
|
|
27
35
|
cwd: options.cwd, env: this.env, stdio: ['pipe', 'pipe', 'pipe'], shell: false,
|
|
@@ -31,13 +39,18 @@ export class GrokAcpClient {
|
|
|
31
39
|
this.failAll(new Error(`Grok ACP closed (exit ${code ?? 'signal'})`));
|
|
32
40
|
void options.onExit?.();
|
|
33
41
|
});
|
|
34
|
-
this.child.stdout.
|
|
42
|
+
this.child.stdout.setEncoding('utf8');
|
|
43
|
+
this.child.stderr.setEncoding('utf8');
|
|
44
|
+
this.child.stdout.on('data', (chunk) => this.receive(chunk));
|
|
35
45
|
this.child.stderr.on('data', (chunk) => {
|
|
36
|
-
this.
|
|
37
|
-
|
|
46
|
+
if (this.closed)
|
|
47
|
+
return;
|
|
48
|
+
if (Buffer.byteLength(this.stderrBuffer) + Buffer.byteLength(chunk) > this.maxStderrBytes) {
|
|
38
49
|
this.failAll(new Error('Grok ACP stderr limit exceeded'));
|
|
39
50
|
this.close();
|
|
51
|
+
return;
|
|
40
52
|
}
|
|
53
|
+
this.stderrBuffer += chunk;
|
|
41
54
|
});
|
|
42
55
|
}
|
|
43
56
|
get stderr() { return redactGrokOutput(this.stderrBuffer, this.env); }
|
|
@@ -50,8 +63,10 @@ export class GrokAcpClient {
|
|
|
50
63
|
}
|
|
51
64
|
}
|
|
52
65
|
receive(chunk) {
|
|
66
|
+
if (this.closed)
|
|
67
|
+
return;
|
|
53
68
|
this.stdoutBuffer += chunk;
|
|
54
|
-
if (this.stdoutBuffer
|
|
69
|
+
if (Buffer.byteLength(this.stdoutBuffer) > 8 * 1024 * 1024) {
|
|
55
70
|
this.failAll(new Error('Grok ACP stdout limit exceeded'));
|
|
56
71
|
this.close();
|
|
57
72
|
return;
|
|
@@ -64,7 +79,10 @@ export class GrokAcpClient {
|
|
|
64
79
|
continue;
|
|
65
80
|
let message;
|
|
66
81
|
try {
|
|
67
|
-
|
|
82
|
+
const parsed = JSON.parse(line);
|
|
83
|
+
if (!isRecord(parsed))
|
|
84
|
+
throw new Error('Invalid frame');
|
|
85
|
+
message = parsed;
|
|
68
86
|
}
|
|
69
87
|
catch {
|
|
70
88
|
this.failAll(new Error('Invalid Grok ACP JSON-RPC message'));
|
|
@@ -72,17 +90,29 @@ export class GrokAcpClient {
|
|
|
72
90
|
return;
|
|
73
91
|
}
|
|
74
92
|
if (message.method === 'session/update' || message.method === '_x.ai/session_notification') {
|
|
75
|
-
const params = message.params;
|
|
93
|
+
const params = isRecord(message.params) ? message.params : undefined;
|
|
94
|
+
if (this.sessionId && params?.sessionId !== undefined && params.sessionId !== this.sessionId)
|
|
95
|
+
continue;
|
|
76
96
|
const update = params?.update;
|
|
77
|
-
if (update) {
|
|
97
|
+
if (isRecord(update)) {
|
|
78
98
|
const safe = JSON.parse(redactGrokOutput(JSON.stringify(update), this.env));
|
|
79
99
|
const content = safe.content;
|
|
80
100
|
if (safe.sessionUpdate === 'agent_message_chunk' && typeof content?.text === 'string')
|
|
81
101
|
this.text += content.text;
|
|
82
|
-
|
|
102
|
+
try {
|
|
103
|
+
this.onUpdate?.(safe);
|
|
104
|
+
}
|
|
105
|
+
catch (cause) {
|
|
106
|
+
const detail = cause instanceof Error ? cause.message : String(cause);
|
|
107
|
+
this.failAll(new Error(`Grok ACP update callback failed: ${redactGrokOutput(detail, this.env)}`));
|
|
108
|
+
this.close();
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
83
111
|
}
|
|
84
112
|
continue;
|
|
85
113
|
}
|
|
114
|
+
if (typeof message.method === 'string')
|
|
115
|
+
continue;
|
|
86
116
|
const id = message.id;
|
|
87
117
|
if (typeof id !== 'number')
|
|
88
118
|
continue;
|
|
@@ -18,11 +18,11 @@ export const GROK_HOME_ENV = 'GROK_HOME';
|
|
|
18
18
|
export function isGrokFilesystemRoot(resolved, pathFlavor = path) {
|
|
19
19
|
return pathFlavor.parse(resolved).root === resolved;
|
|
20
20
|
}
|
|
21
|
-
function expandHomePrefix(raw, userHome
|
|
21
|
+
function expandHomePrefix(raw, userHome, pathFlavor) {
|
|
22
22
|
if (raw === '~')
|
|
23
23
|
return raw;
|
|
24
24
|
if (raw.startsWith('~/'))
|
|
25
|
-
return
|
|
25
|
+
return pathFlavor.join(userHome, raw.slice(2));
|
|
26
26
|
return raw;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
@@ -31,9 +31,10 @@ function expandHomePrefix(raw, userHome = homedir()) {
|
|
|
31
31
|
*/
|
|
32
32
|
export function resolveGrokHomeResult(env = process.env, userHome = homedir()) {
|
|
33
33
|
const raw = (env[GROK_HOME_ENV] || '').trim();
|
|
34
|
+
const pathFlavor = process.platform === 'win32' ? path.win32 : path;
|
|
34
35
|
const fromEnv = Boolean(raw);
|
|
35
|
-
const candidate = fromEnv ? raw :
|
|
36
|
-
const expanded = expandHomePrefix(candidate, userHome);
|
|
36
|
+
const candidate = fromEnv ? raw : pathFlavor.join(userHome, '.grok');
|
|
37
|
+
const expanded = expandHomePrefix(candidate, userHome, pathFlavor);
|
|
37
38
|
if (expanded === '~' || expanded.startsWith('~')) {
|
|
38
39
|
return {
|
|
39
40
|
ok: false,
|
|
@@ -41,7 +42,7 @@ export function resolveGrokHomeResult(env = process.env, userHome = homedir()) {
|
|
|
41
42
|
message: `${GROK_HOME_ENV} must be an absolute path or ~/… (got '${raw || '(default)'}'). Bare '~' is rejected.`,
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
|
-
if (!
|
|
45
|
+
if (!pathFlavor.isAbsolute(expanded)) {
|
|
45
46
|
return {
|
|
46
47
|
ok: false,
|
|
47
48
|
reason: 'not-absolute',
|
|
@@ -55,8 +56,8 @@ export function resolveGrokHomeResult(env = process.env, userHome = homedir()) {
|
|
|
55
56
|
message: `${GROK_HOME_ENV} contains an invalid path character.`,
|
|
56
57
|
};
|
|
57
58
|
}
|
|
58
|
-
const resolved =
|
|
59
|
-
if (!resolved || isGrokFilesystemRoot(resolved)) {
|
|
59
|
+
const resolved = pathFlavor.resolve(expanded);
|
|
60
|
+
if (!resolved || isGrokFilesystemRoot(resolved, pathFlavor)) {
|
|
60
61
|
return {
|
|
61
62
|
ok: false,
|
|
62
63
|
reason: 'root',
|
|
@@ -40,6 +40,9 @@ export const CONTEXT_CONTRACTS = {
|
|
|
40
40
|
verification: { method: 'official Copilot CLI custom-instruction imports', source: 'https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/add-custom-instructions', lastVerified: VERIFIED_ON },
|
|
41
41
|
},
|
|
42
42
|
cursor: {
|
|
43
|
+
promptDiscovery: { delivery: 'hook-bridge', event: 'beforeSubmitPrompt', files: [
|
|
44
|
+
'.cursor/hooks.json', '.cursor/hooks/aiwg-prompt-discovery.cjs',
|
|
45
|
+
] },
|
|
43
46
|
startupFiles: ['AGENTS.md', 'CLAUDE.md', '.cursor/rules/*.mdc'], precedence: ['provider/system', 'project rules', 'root AGENTS.md'],
|
|
44
47
|
loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
|
|
45
48
|
bootstrapTargets: ['AGENTS.md'], maxContextBytes: null, recommendedMaxLines: 500, nestedContext: false, support: 'supported',
|
|
@@ -163,11 +166,12 @@ export const CONTEXT_CONTRACTS = {
|
|
|
163
166
|
bootstrapTargets: ['WARP.md', 'AGENTS.md'], maxContextBytes: null, recommendedMaxLines: null, nestedContext: true, support: 'supported',
|
|
164
167
|
verification: { method: 'official Warp project rules documentation', source: 'https://docs.warp.dev/agent-platform/capabilities/rules/', lastVerified: VERIFIED_ON },
|
|
165
168
|
},
|
|
166
|
-
|
|
167
|
-
|
|
169
|
+
devin: {
|
|
170
|
+
// Retained topology: Desktop 3.14 loader precedence still needs verification on titan.
|
|
171
|
+
startupFiles: ['AGENTS.md', '.windsurf/rules/*.md', '.devin/rules/*.md'], precedence: ['provider/system', 'Devin rules', 'Devin Desktop rules', 'AGENTS.md'],
|
|
168
172
|
loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
|
|
169
173
|
bootstrapTargets: ['AGENTS.md'], maxContextBytes: null, recommendedMaxLines: null, nestedContext: true, support: 'degraded',
|
|
170
|
-
verification: { method: 'AIWG
|
|
174
|
+
verification: { method: 'AIWG Devin Desktop/Devin topology contract; provider-native rules retained', source: 'src/providers/provider-definitions.ts', lastVerified: VERIFIED_ON },
|
|
171
175
|
},
|
|
172
176
|
generic: {
|
|
173
177
|
startupFiles: ['AGENTS.md'], precedence: ['host policy'], loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
|
|
@@ -99,10 +99,10 @@ const MCP_INJECTION_DEFINITIONS = [
|
|
|
99
99
|
},
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
|
-
id: '
|
|
103
|
-
aliases: ['
|
|
102
|
+
id: 'devin',
|
|
103
|
+
aliases: ['windsurf', 'devin-desktop', 'devin-local', 'cascade'],
|
|
104
104
|
mcp: {
|
|
105
|
-
providerId: '
|
|
105
|
+
providerId: 'devin',
|
|
106
106
|
includeInSupportedProviders: true,
|
|
107
107
|
configFormat: 'json',
|
|
108
108
|
serverConfigFormat: 'standard',
|
|
@@ -24,7 +24,7 @@ const PROVIDER_EXECUTABLES = {
|
|
|
24
24
|
pi: ['pi'],
|
|
25
25
|
omp: ['omp'],
|
|
26
26
|
warp: ['warp'],
|
|
27
|
-
|
|
27
|
+
devin: ['devin-desktop', 'windsurf'],
|
|
28
28
|
};
|
|
29
29
|
async function defaultPathExists(filePath) {
|
|
30
30
|
try {
|
|
@@ -138,6 +138,18 @@ export async function collectProviderInventory(projectDir, options = {}) {
|
|
|
138
138
|
if (configPath && await pathExists(resolve(configPath))) {
|
|
139
139
|
evidence.push({ kind: 'provider-config', scope: configPath.startsWith(homeDir) ? 'user' : 'project', value: configPath });
|
|
140
140
|
}
|
|
141
|
+
// Inspect directory existence only: current Desktop and legacy Windsurf may coexist.
|
|
142
|
+
// These are detection markers, not new deployment destinations (3.14 read paths unverified).
|
|
143
|
+
if (definition.id === 'devin') {
|
|
144
|
+
for (const marker of ['.devin', '.config/Devin', '.codeium', '.windsurf']) {
|
|
145
|
+
const location = join(homeDir, marker);
|
|
146
|
+
if (await pathExists(location))
|
|
147
|
+
evidence.push({ kind: 'provider-config', scope: 'user', value: location });
|
|
148
|
+
}
|
|
149
|
+
const legacyDeployment = join(projectDir, '.windsurf');
|
|
150
|
+
if (await pathExists(legacyDeployment))
|
|
151
|
+
evidence.push({ kind: 'provider-config', scope: 'project', value: legacyDeployment });
|
|
152
|
+
}
|
|
141
153
|
const configured = evidence.some(item => item.kind === 'project-config' || item.kind === 'user-config');
|
|
142
154
|
const deployed = evidence.some(item => item.kind === 'deployment-record');
|
|
143
155
|
const detected = evidence.some(item => item.kind === 'runtime-env' ||
|
|
@@ -124,10 +124,10 @@ export const BUILT_IN_SEEDS_3 = [
|
|
|
124
124
|
matrixRef: 'warp',
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
|
-
id: '
|
|
127
|
+
id: 'devin',
|
|
128
128
|
displayName: 'Devin Desktop',
|
|
129
129
|
status: 'stable',
|
|
130
|
-
aliases: ['
|
|
130
|
+
aliases: ['windsurf', 'devin-desktop', 'devin-local', 'cascade'],
|
|
131
131
|
builtIn: true,
|
|
132
132
|
surfaces: {
|
|
133
133
|
primary: 'devin',
|
|
@@ -148,7 +148,7 @@ export const BUILT_IN_SEEDS_3 = [
|
|
|
148
148
|
},
|
|
149
149
|
notes: [
|
|
150
150
|
'Devin Desktop is the current product name; --provider devin is preferred and --provider windsurf remains a deprecated compatibility id.',
|
|
151
|
-
'
|
|
151
|
+
'AIWG keeps .devin/ as ignored local provider output and retains .windsurf/ plus AGENTS.md; the installed 3.11 package is insufficient to verify 3.14 project discovery. Verify on titan before changing paths.',
|
|
152
152
|
],
|
|
153
153
|
},
|
|
154
154
|
{
|
|
@@ -164,7 +164,7 @@ export const BUILT_IN_SEEDS_3 = [
|
|
|
164
164
|
legacy: ['.windsurfrules'],
|
|
165
165
|
},
|
|
166
166
|
notes: [
|
|
167
|
-
'Devin CLI has distinct rules and skills surfaces and should not normalize to
|
|
167
|
+
'Devin CLI has distinct rules and skills surfaces and should not normalize to devin until a dedicated provider behavior issue adds writer support.',
|
|
168
168
|
],
|
|
169
169
|
},
|
|
170
170
|
{
|
|
@@ -180,17 +180,18 @@ export const BUILT_IN_SEEDS_3 = [
|
|
|
180
180
|
legacy: [],
|
|
181
181
|
},
|
|
182
182
|
notes: [
|
|
183
|
-
'Devin product skills use the Agent Skills layout and are recorded here as a readable surface, not as current AIWG
|
|
183
|
+
'Devin product skills use the Agent Skills layout and are recorded here as a readable surface, not as current AIWG devin deploy output.',
|
|
184
184
|
],
|
|
185
185
|
},
|
|
186
186
|
],
|
|
187
187
|
},
|
|
188
188
|
detection: {
|
|
189
189
|
env: ['WINDSURF_VERSION'],
|
|
190
|
-
process: ['windsurf'],
|
|
191
|
-
capabilityId: '
|
|
190
|
+
process: ['devin-desktop', 'windsurf'],
|
|
191
|
+
capabilityId: 'devin',
|
|
192
192
|
runtimeEnvPriority: 30,
|
|
193
193
|
},
|
|
194
|
+
// Compatibility filenames stay unchanged; verify Desktop 3.14 on titan before migrating.
|
|
194
195
|
paths: {
|
|
195
196
|
artifacts: {
|
|
196
197
|
agents: '.windsurf/agents',
|
|
@@ -221,11 +222,11 @@ export const BUILT_IN_SEEDS_3 = [
|
|
|
221
222
|
adapters: {
|
|
222
223
|
agentFormat: 'windsurf-markdown',
|
|
223
224
|
hookBridge: null,
|
|
224
|
-
mcpInjection: '
|
|
225
|
+
mcpInjection: 'devin',
|
|
225
226
|
contextAggregation: 'agents-md',
|
|
226
227
|
ruleFormat: 'windsurf-rule',
|
|
227
228
|
},
|
|
228
|
-
matrixRef: '
|
|
229
|
+
matrixRef: 'devin',
|
|
229
230
|
},
|
|
230
231
|
{
|
|
231
232
|
id: 'generic',
|
|
@@ -151,7 +151,7 @@ export async function resolveProviderReceiptRuntimeEvidence(rawOptions) {
|
|
|
151
151
|
const paths = artifactPaths(provider, options.scope);
|
|
152
152
|
const outputRoot = path.resolve(options.outputRoot ?? (options.scope === 'user' ? homedir() : options.projectRoot));
|
|
153
153
|
const ownedFiles = new Set();
|
|
154
|
-
const receiptDirectories = new Set([outputRoot, path.join(outputRoot, '.aiwg'), path.join(outputRoot, `.${provider}`)]);
|
|
154
|
+
const receiptDirectories = new Set([outputRoot, path.join(outputRoot, '.aiwg'), path.join(outputRoot, `.${provider === 'devin' ? 'windsurf' : provider}`)]);
|
|
155
155
|
if (paths) {
|
|
156
156
|
for (const type of ['agents', 'commands', 'skills', 'rules', 'behaviors']) {
|
|
157
157
|
const configured = paths[type];
|
|
@@ -57,12 +57,12 @@ export class DevinDesktopSessionAdapter {
|
|
|
57
57
|
for await (const line of input) {
|
|
58
58
|
const parsed = StepSchema.safeParse(line.value);
|
|
59
59
|
if (!parsed.success) {
|
|
60
|
-
throw new SessionContractError('MALFORMED_SOURCE', '
|
|
60
|
+
throw new SessionContractError('MALFORMED_SOURCE', 'Devin Desktop transcript step is malformed', schemaRejectionDetail(parsed.error));
|
|
61
61
|
}
|
|
62
62
|
const step = parsed.data;
|
|
63
63
|
const currentVersion = step.schema_version ?? DEVIN_DESKTOP_TRANSCRIPT_SCHEMA_VERSION;
|
|
64
64
|
if (schemaVersion && schemaVersion !== currentVersion) {
|
|
65
|
-
throw new SessionContractError('SCHEMA_DRIFT', 'mixed
|
|
65
|
+
throw new SessionContractError('SCHEMA_DRIFT', 'mixed Devin Desktop transcript schemas', schemaIssueDetail('schema_version'));
|
|
66
66
|
}
|
|
67
67
|
schemaVersion = currentVersion;
|
|
68
68
|
assertSupportedSchemaMajor(schemaVersion);
|
|
@@ -70,7 +70,7 @@ export class DevinDesktopSessionAdapter {
|
|
|
70
70
|
?? nativeSessionId
|
|
71
71
|
?? basename(source.locator, '.jsonl');
|
|
72
72
|
if (step.trajectory_id && nativeSessionId && step.trajectory_id !== nativeSessionId) {
|
|
73
|
-
throw new SessionContractError('SCHEMA_DRIFT', 'mixed
|
|
73
|
+
throw new SessionContractError('SCHEMA_DRIFT', 'mixed Devin Desktop trajectory identities', schemaIssueDetail('trajectory_id'));
|
|
74
74
|
}
|
|
75
75
|
nativeSessionId = currentSession;
|
|
76
76
|
if (seen++ < start)
|
|
@@ -78,7 +78,7 @@ export class DevinDesktopSessionAdapter {
|
|
|
78
78
|
yield normalizeStep(step, currentSession, line.sequence, line.byteOffset, canonicalLocatorClass(source.locatorClass), schemaVersion);
|
|
79
79
|
}
|
|
80
80
|
if (seen === 0) {
|
|
81
|
-
throw new SessionContractError('MALFORMED_SOURCE', '
|
|
81
|
+
throw new SessionContractError('MALFORMED_SOURCE', 'Devin Desktop transcript is empty or malformed', schemaIssueDetail('<root>'));
|
|
82
82
|
}
|
|
83
83
|
return {
|
|
84
84
|
sourceSchemaVersion: schemaVersion,
|
|
@@ -91,7 +91,7 @@ export class DevinDesktopSessionAdapter {
|
|
|
91
91
|
throw new SessionContractError('UNSUPPORTED_OPERATION', 'legacy Devin Desktop/Windsurf protobuf stores are unsupported; enable post_cascade_response_with_transcript and select its JSONL output');
|
|
92
92
|
}
|
|
93
93
|
if (!isCurrentHookLocator(source.locatorClass)) {
|
|
94
|
-
throw new SessionContractError('UNSUPPORTED_OPERATION', 'Devin Desktop (
|
|
94
|
+
throw new SessionContractError('UNSUPPORTED_OPERATION', 'Devin Desktop (legacy transcript compatibility) requires an explicitly selected post_cascade_response_with_transcript JSONL file');
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -169,7 +169,7 @@ function timestamp(value) {
|
|
|
169
169
|
return undefined;
|
|
170
170
|
const date = new Date(value);
|
|
171
171
|
if (Number.isNaN(date.getTime())) {
|
|
172
|
-
throw new SessionContractError('AMBIGUOUS_TIMESTAMP', 'invalid
|
|
172
|
+
throw new SessionContractError('AMBIGUOUS_TIMESTAMP', 'invalid Devin Desktop timestamp');
|
|
173
173
|
}
|
|
174
174
|
return date.toISOString();
|
|
175
175
|
}
|
|
@@ -177,7 +177,7 @@ function parseCursor(value) {
|
|
|
177
177
|
if (!value)
|
|
178
178
|
return 0;
|
|
179
179
|
if (!/^\d+$/.test(value))
|
|
180
|
-
throw new SessionContractError('SCHEMA_DRIFT', 'invalid
|
|
180
|
+
throw new SessionContractError('SCHEMA_DRIFT', 'invalid Devin Desktop cursor', schemaIssueDetail('cursor'));
|
|
181
181
|
return Number(value);
|
|
182
182
|
}
|
|
183
183
|
//# sourceMappingURL=windsurf.js.map
|
|
@@ -68,7 +68,7 @@ const eventKeys = {
|
|
|
68
68
|
const object = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
69
69
|
export function validateGrokHeadlessEnvelope(value, format) {
|
|
70
70
|
const type = format === 'json' ? 'result' : String(value.type);
|
|
71
|
-
const keys = type === 'result' ? resultKeys : eventKeys[type];
|
|
71
|
+
const keys = type === 'result' ? resultKeys : Object.hasOwn(eventKeys, type) ? eventKeys[type] : undefined;
|
|
72
72
|
if (!keys || Object.keys(value).some(key => !keys.includes(key)))
|
|
73
73
|
drift('headless event');
|
|
74
74
|
if (type === 'result' || type === 'end') {
|
|
@@ -60,7 +60,11 @@ export function parseGrokHeadlessSessionId(output, format) {
|
|
|
60
60
|
}
|
|
61
61
|
const lines = format === 'json' ? [output] : output.trim().split(/\r?\n/);
|
|
62
62
|
const ids = new Set();
|
|
63
|
+
let ended = false;
|
|
63
64
|
for (const line of lines) {
|
|
65
|
+
if (ended) {
|
|
66
|
+
throw new SessionContractError('SCHEMA_DRIFT', 'unrecognized Grok Build headless stream after final end; check CLI version and use a supported export');
|
|
67
|
+
}
|
|
64
68
|
let value;
|
|
65
69
|
try {
|
|
66
70
|
value = JSON.parse(line);
|
|
@@ -72,6 +76,7 @@ export function parseGrokHeadlessSessionId(output, format) {
|
|
|
72
76
|
throw new SessionContractError('SCHEMA_DRIFT', 'Grok Build headless event must be an object');
|
|
73
77
|
}
|
|
74
78
|
validateGrokHeadlessEnvelope(value, format);
|
|
79
|
+
ended = format === 'streaming-json' && value.type === 'end';
|
|
75
80
|
const id = value.sessionId;
|
|
76
81
|
if (id !== undefined) {
|
|
77
82
|
if (typeof id !== 'string' || !UUID.test(id)) {
|
|
@@ -116,7 +121,8 @@ async function runGrok(options, args) {
|
|
|
116
121
|
const home = resolveGrokHomeResult(env);
|
|
117
122
|
if (!home.ok)
|
|
118
123
|
throw new SessionContractError('SOURCE_NOT_AUTHORIZED', home.message);
|
|
119
|
-
|
|
124
|
+
// The public CLI opens this store too; a safe home alone cannot authorize a linked store.
|
|
125
|
+
await rejectSymlinkComponents(join(home.path, 'sessions'));
|
|
120
126
|
if (options.binary !== undefined && !isAbsolute(options.binary)) {
|
|
121
127
|
throw new SessionContractError('SOURCE_NOT_AUTHORIZED', 'Grok Build binary override must be absolute');
|
|
122
128
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Extend skills import with repository-to-addon and pinned refresh options.
|
|
2
|
+
import { importSkillBundle } from './bundle-import.js';
|
|
3
|
+
export async function handleBundleImport(args) {
|
|
4
|
+
const options = { projectDir: process.cwd() };
|
|
5
|
+
const positional = [];
|
|
6
|
+
const fields = { '--into': 'into', '--refresh': 'refresh', '--ref': 'ref', '--only': 'only' };
|
|
7
|
+
const json = args.includes('--json');
|
|
8
|
+
try {
|
|
9
|
+
for (let index = 0; index < args.length; index++) {
|
|
10
|
+
const arg = args[index];
|
|
11
|
+
if (Object.hasOwn(fields, arg)) {
|
|
12
|
+
const field = fields[arg];
|
|
13
|
+
const value = args[++index];
|
|
14
|
+
if (!value || value.startsWith('-') || options[field] !== undefined)
|
|
15
|
+
throw new Error(`${arg} requires one value`);
|
|
16
|
+
options[field] = value;
|
|
17
|
+
}
|
|
18
|
+
else if (arg === '--dry-run')
|
|
19
|
+
options.dryRun = true;
|
|
20
|
+
else if (arg === '--json')
|
|
21
|
+
continue;
|
|
22
|
+
else if (arg.startsWith('-'))
|
|
23
|
+
throw new Error(`Unknown bundle import option: ${arg}`);
|
|
24
|
+
else
|
|
25
|
+
positional.push(arg);
|
|
26
|
+
}
|
|
27
|
+
if (positional.length > 1)
|
|
28
|
+
throw new Error('Provide exactly one repository source');
|
|
29
|
+
options.source = positional[0];
|
|
30
|
+
// The report is deliberately emitted before the importer can write any project files.
|
|
31
|
+
options.report = (plan) => {
|
|
32
|
+
if (json)
|
|
33
|
+
console.log(JSON.stringify({ phase: 'preflight', ...plan }));
|
|
34
|
+
else {
|
|
35
|
+
console.log(`${plan.dryRun ? '[DRY RUN] ' : ''}Skill bundle preflight: ${plan.manifest.id}`);
|
|
36
|
+
for (const upstream of plan.manifest.upstream ?? [])
|
|
37
|
+
console.log(` ${upstream.repo} @ ${upstream.commit}`);
|
|
38
|
+
for (const item of plan.diagnostics)
|
|
39
|
+
console.log(` ${item.code}: ${item.file}: ${item.message}`);
|
|
40
|
+
for (const [kind, files] of Object.entries(plan.diff)) {
|
|
41
|
+
for (const file of files)
|
|
42
|
+
console.log(` ${kind}: ${file}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const result = await importSkillBundle(options);
|
|
47
|
+
if (json)
|
|
48
|
+
console.log(JSON.stringify({ phase: 'result', ...result }));
|
|
49
|
+
else
|
|
50
|
+
console.log(`${result.dryRun ? 'Planned' : 'Indexed'} ${result.manifest.skills?.length ?? 0} skills; installed: false`);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
54
|
+
if (json)
|
|
55
|
+
console.log(JSON.stringify({ phase: 'error', message }));
|
|
56
|
+
else
|
|
57
|
+
console.error(`Error: ${message}`);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=bundle-import-cli.js.map
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// Plan inert repository skill trees, exclusions, diagnostics and stable local names.
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
import { minimatch } from 'minimatch';
|
|
5
|
+
import { collectGitTree, DEFAULT_AGENT_SKILL_IMPORT_LIMITS } from './importer.js';
|
|
6
|
+
import { validateAgentSkillContent } from './validator.js';
|
|
7
|
+
export function repositoryKey(repo) {
|
|
8
|
+
const slug = path.basename(repo.replace(/\/$/, '').replace(/\.git$/, ''))
|
|
9
|
+
.toLowerCase().replace(/[^a-z0-9-]+/g, '-').replace(/^-+|-+$/g, '') || 'upstream';
|
|
10
|
+
return `${slug.slice(0, 40)}-${createHash('sha256').update(repo).digest('hex').slice(0, 8)}`;
|
|
11
|
+
}
|
|
12
|
+
const excluded = (file) => file.split('/').some(part => /^(?:tests?|__tests__|tools?|tooling|scripts|node_modules|\.git)$/i.test(part))
|
|
13
|
+
|| /\.(?:test|spec)\.[^/]+$/i.test(file);
|
|
14
|
+
const licenseFile = (file) => /^(?:licen[cs]e|copying|notice)(?:[._-].*)?$/i.test(file);
|
|
15
|
+
function localName(name, prefix, occupied) {
|
|
16
|
+
const base = `${prefix}-${name}`.slice(0, 60).replace(/-$/, '');
|
|
17
|
+
let candidate = base;
|
|
18
|
+
let index = 2;
|
|
19
|
+
while (occupied.has(candidate))
|
|
20
|
+
candidate = `${base}-${index++}`;
|
|
21
|
+
return candidate;
|
|
22
|
+
}
|
|
23
|
+
export function planRepository(input) {
|
|
24
|
+
const materialized = collectGitTree({
|
|
25
|
+
kind: 'git', url: input.repo, revision: input.ref, subpath: '.',
|
|
26
|
+
}, { ...DEFAULT_AGENT_SKILL_IMPORT_LIMITS, maxFiles: 10_000 }, true);
|
|
27
|
+
if (materialized.source.kind !== 'git')
|
|
28
|
+
throw new Error('Expected pinned Git source');
|
|
29
|
+
const sourceFiles = new Map(materialized.entries.flatMap(entry => entry.kind === 'file' ? [[entry.path, entry.bytes]] : []));
|
|
30
|
+
const allNames = [...sourceFiles.keys()].flatMap(file => /^skills\/([^/]+)\/SKILL\.md$/.exec(file)?.[1] ?? []);
|
|
31
|
+
const names = input.pinned?.skills ?? allNames.filter(name => !input.only
|
|
32
|
+
|| minimatch(name, input.only) || minimatch(`skills/${name}`, input.only));
|
|
33
|
+
if (!names.length)
|
|
34
|
+
throw new Error('No skills/*/SKILL.md trees match the selection');
|
|
35
|
+
const licenses = [...sourceFiles].filter(([file]) => licenseFile(file));
|
|
36
|
+
if (!licenses.length)
|
|
37
|
+
throw new Error(`No root license file found in ${input.repo}; review licensing before importing`);
|
|
38
|
+
const files = new Map();
|
|
39
|
+
const diagnostics = [];
|
|
40
|
+
const renames = { ...input.pinned?.renames };
|
|
41
|
+
const key = repositoryKey(input.repo);
|
|
42
|
+
const prefix = key.slice(0, key.lastIndexOf('-'));
|
|
43
|
+
for (const name of names.sort()) {
|
|
44
|
+
const skillFile = `skills/${name}/SKILL.md`;
|
|
45
|
+
const content = sourceFiles.get(skillFile)?.toString('utf8');
|
|
46
|
+
if (content === undefined)
|
|
47
|
+
throw new Error(`Pinned upstream skill is missing: ${skillFile}`);
|
|
48
|
+
const validation = validateAgentSkillContent(content, { profile: 'compatible', file: skillFile, directoryName: name });
|
|
49
|
+
if (!validation.valid)
|
|
50
|
+
throw new Error(`Invalid ${skillFile}: ${validation.diagnostics.map(d => d.message).join('; ')}`);
|
|
51
|
+
let target = renames[name] ?? name;
|
|
52
|
+
if (input.occupied.has(target)) {
|
|
53
|
+
if (input.pinned)
|
|
54
|
+
throw new Error(`Saved rename collides with existing skill: ${target}`);
|
|
55
|
+
target = localName(name, prefix, input.occupied);
|
|
56
|
+
renames[name] = target;
|
|
57
|
+
diagnostics.push({ code: 'collision', file: skillFile, message: `${name} collides; proposed local name: ${target}` });
|
|
58
|
+
}
|
|
59
|
+
input.occupied.add(target);
|
|
60
|
+
const selected = [...sourceFiles].filter(([file]) => file.startsWith(`skills/${name}/`));
|
|
61
|
+
for (const [file, bytes] of selected) {
|
|
62
|
+
const tail = file.slice(`skills/${name}/`.length);
|
|
63
|
+
if (/\.(?:[cm]?js|[cm]?ts|py|sh|bash|ps1|rb|pl|exe|dll|so|wasm)$/i.test(file)
|
|
64
|
+
|| bytes.subarray(0, 2).toString() === '#!') {
|
|
65
|
+
diagnostics.push({ code: 'script', file, message: `Script or executable content (${excluded(tail) ? 'excluded' : 'copied inertly'})` });
|
|
66
|
+
}
|
|
67
|
+
if (bytes.includes(0))
|
|
68
|
+
diagnostics.push({ code: 'binary', file, message: 'Binary content; never executed by import' });
|
|
69
|
+
if (excluded(tail))
|
|
70
|
+
continue;
|
|
71
|
+
let output = bytes;
|
|
72
|
+
if (file === skillFile && target !== name) {
|
|
73
|
+
// Change only the frontmatter name; retain comments, body and upstream links verbatim.
|
|
74
|
+
output = Buffer.from(content.replace(/^(---\r?\n)([\s\S]*?)(\r?\n---)/, (_match, start, yaml, end) => start + yaml.replace(/^name\s*:.*$/m, `name: ${target}`) + end));
|
|
75
|
+
}
|
|
76
|
+
files.set(`skills/${target}/${tail}`, output);
|
|
77
|
+
}
|
|
78
|
+
// Local links and code-formatted paths may resolve from the skill or repository root.
|
|
79
|
+
const kept = new Set([...files.keys()].filter(file => file.startsWith(`skills/${target}/`))
|
|
80
|
+
.map(file => `skills/${name}/${file.slice(`skills/${target}/`.length)}`));
|
|
81
|
+
for (const [file, bytes] of selected) {
|
|
82
|
+
if (excluded(file.slice(`skills/${name}/`.length)) || !/\.(?:md|txt)$/i.test(file))
|
|
83
|
+
continue;
|
|
84
|
+
const tokens = bytes.toString('utf8').matchAll(/([^\s<>()`"'\[\]]+\/[^\s<>()`"'\[\]]+)/g);
|
|
85
|
+
for (const match of tokens) {
|
|
86
|
+
const ref = match[1].replace(/[#?].*$/, '').replace(/[.,;:]$/, '');
|
|
87
|
+
if (/^(?:[a-z]+:|\/\/)/i.test(ref))
|
|
88
|
+
continue;
|
|
89
|
+
const candidates = [path.posix.normalize(path.posix.join(path.posix.dirname(file), ref)), ref.replace(/^\.\//, '')];
|
|
90
|
+
if (!candidates.some(candidate => kept.has(candidate))) {
|
|
91
|
+
diagnostics.push({ code: 'dangling-reference', file, message: `${match[1]} is absent from the copied skill tree` });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
for (const [file, bytes] of licenses)
|
|
97
|
+
files.set(`licenses/${key}/${file}`, bytes);
|
|
98
|
+
return {
|
|
99
|
+
files, diagnostics,
|
|
100
|
+
upstream: {
|
|
101
|
+
repo: input.repo, commit: materialized.source.resolvedRevision,
|
|
102
|
+
license: licenses.some(([, bytes]) => /MIT License|Permission is hereby granted/i.test(bytes.toString('utf8')))
|
|
103
|
+
? 'MIT' : 'SEE LICENSE FILES',
|
|
104
|
+
skills: names, renames,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=bundle-import-plan.js.map
|