@skillsmith/core 0.12.1 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +155 -0
- package/README.md +2 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/src/api/client.d.ts +5 -3
- package/dist/src/api/client.d.ts.map +1 -1
- package/dist/src/api/client.js +23 -33
- package/dist/src/api/client.js.map +1 -1
- package/dist/src/api/client.registry-sync.d.ts +28 -0
- package/dist/src/api/client.registry-sync.d.ts.map +1 -0
- package/dist/src/api/client.registry-sync.js +36 -0
- package/dist/src/api/client.registry-sync.js.map +1 -0
- package/dist/src/api/client.test.js +185 -0
- package/dist/src/api/client.test.js.map +1 -1
- package/dist/src/api/client.toSkill.d.ts +16 -0
- package/dist/src/api/client.toSkill.d.ts.map +1 -0
- package/dist/src/api/client.toSkill.js +46 -0
- package/dist/src/api/client.toSkill.js.map +1 -0
- package/dist/src/api/client.types.d.ts +22 -0
- package/dist/src/api/client.types.d.ts.map +1 -1
- package/dist/src/api/index.d.ts +1 -1
- package/dist/src/api/index.d.ts.map +1 -1
- package/dist/src/api/index.js.map +1 -1
- package/dist/src/api/schemas.d.ts +28 -0
- package/dist/src/api/schemas.d.ts.map +1 -1
- package/dist/src/api/schemas.js +13 -0
- package/dist/src/api/schemas.js.map +1 -1
- package/dist/src/audit/remote-audit.d.ts +85 -0
- package/dist/src/audit/remote-audit.d.ts.map +1 -1
- package/dist/src/audit/remote-audit.js +126 -3
- package/dist/src/audit/remote-audit.js.map +1 -1
- package/dist/src/audit/remote-audit.test.js +217 -1
- package/dist/src/audit/remote-audit.test.js.map +1 -1
- package/dist/src/config/index.d.ts +1 -0
- package/dist/src/config/index.d.ts.map +1 -1
- package/dist/src/config/index.js.map +1 -1
- package/dist/src/db/migration-runner.d.ts.map +1 -1
- package/dist/src/db/migration-runner.js +6 -0
- package/dist/src/db/migration-runner.js.map +1 -1
- package/dist/src/db/migrations/v18-skill-versions-real-content-hash.d.ts +36 -0
- package/dist/src/db/migrations/v18-skill-versions-real-content-hash.d.ts.map +1 -0
- package/dist/src/db/migrations/v18-skill-versions-real-content-hash.js +38 -0
- package/dist/src/db/migrations/v18-skill-versions-real-content-hash.js.map +1 -0
- package/dist/src/db/schema.d.ts +1 -1
- package/dist/src/db/schema.d.ts.map +1 -1
- package/dist/src/db/schema.js +3 -1
- package/dist/src/db/schema.js.map +1 -1
- package/dist/src/exports/services.d.ts +3 -7
- package/dist/src/exports/services.d.ts.map +1 -1
- package/dist/src/exports/services.install.d.ts +18 -0
- package/dist/src/exports/services.install.d.ts.map +1 -0
- package/dist/src/exports/services.install.js +62 -0
- package/dist/src/exports/services.install.js.map +1 -0
- package/dist/src/exports/services.js +12 -32
- package/dist/src/exports/services.js.map +1 -1
- package/dist/src/exports/types.d.ts +1 -1
- package/dist/src/exports/types.d.ts.map +1 -1
- package/dist/src/index.d.ts +5 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/install/agent-config-merge.json.d.ts +5 -4
- package/dist/src/install/agent-config-merge.json.d.ts.map +1 -1
- package/dist/src/install/agent-config-merge.json.js +10 -9
- package/dist/src/install/agent-config-merge.json.js.map +1 -1
- package/dist/src/install/agent-config-merge.types.d.ts +11 -1
- package/dist/src/install/agent-config-merge.types.d.ts.map +1 -1
- package/dist/src/install/agent-config-merge.types.js.map +1 -1
- package/dist/src/install/agent-harness-targets.d.ts +30 -2
- package/dist/src/install/agent-harness-targets.d.ts.map +1 -1
- package/dist/src/install/agent-harness-targets.js +17 -0
- package/dist/src/install/agent-harness-targets.js.map +1 -1
- package/dist/src/install/agent-manifest-path-guard.d.ts +28 -3
- package/dist/src/install/agent-manifest-path-guard.d.ts.map +1 -1
- package/dist/src/install/agent-manifest-path-guard.js +59 -3
- package/dist/src/install/agent-manifest-path-guard.js.map +1 -1
- package/dist/src/install/agent-manifest-path-guard.test.js +27 -1
- package/dist/src/install/agent-manifest-path-guard.test.js.map +1 -1
- package/dist/src/install/agent-pack-installer.antigravity-mcp.d.ts +74 -0
- package/dist/src/install/agent-pack-installer.antigravity-mcp.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.antigravity-mcp.js +106 -0
- package/dist/src/install/agent-pack-installer.antigravity-mcp.js.map +1 -0
- package/dist/src/install/agent-pack-installer.antigravity-mcp.test.d.ts +2 -0
- package/dist/src/install/agent-pack-installer.antigravity-mcp.test.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.antigravity-mcp.test.js +157 -0
- package/dist/src/install/agent-pack-installer.antigravity-mcp.test.js.map +1 -0
- package/dist/src/install/agent-pack-installer.cursor-mcp.d.ts +53 -0
- package/dist/src/install/agent-pack-installer.cursor-mcp.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.cursor-mcp.js +207 -0
- package/dist/src/install/agent-pack-installer.cursor-mcp.js.map +1 -0
- package/dist/src/install/agent-pack-installer.cursor-mcp.test.d.ts +2 -0
- package/dist/src/install/agent-pack-installer.cursor-mcp.test.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.cursor-mcp.test.js +285 -0
- package/dist/src/install/agent-pack-installer.cursor-mcp.test.js.map +1 -0
- package/dist/src/install/agent-pack-installer.d.ts +8 -0
- package/dist/src/install/agent-pack-installer.d.ts.map +1 -1
- package/dist/src/install/agent-pack-installer.entry.d.ts +120 -3
- package/dist/src/install/agent-pack-installer.entry.d.ts.map +1 -1
- package/dist/src/install/agent-pack-installer.entry.js +166 -3
- package/dist/src/install/agent-pack-installer.entry.js.map +1 -1
- package/dist/src/install/agent-pack-installer.js +97 -3
- package/dist/src/install/agent-pack-installer.js.map +1 -1
- package/dist/src/install/agent-pack-installer.types.d.ts +27 -0
- package/dist/src/install/agent-pack-installer.types.d.ts.map +1 -1
- package/dist/src/install/agent-pack-installer.types.js +6 -0
- package/dist/src/install/agent-pack-installer.types.js.map +1 -1
- package/dist/src/install/agent-pack-installer.workspace-scope.test.d.ts +2 -0
- package/dist/src/install/agent-pack-installer.workspace-scope.test.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.workspace-scope.test.js +148 -0
- package/dist/src/install/agent-pack-installer.workspace-scope.test.js.map +1 -0
- package/dist/src/install/agent-pack-uninstaller.d.ts +18 -7
- package/dist/src/install/agent-pack-uninstaller.d.ts.map +1 -1
- package/dist/src/install/agent-pack-uninstaller.js +59 -9
- package/dist/src/install/agent-pack-uninstaller.js.map +1 -1
- package/dist/src/install/agent-pack-uninstaller.test.js +74 -1
- package/dist/src/install/agent-pack-uninstaller.test.js.map +1 -1
- package/dist/src/install/fan-out.d.ts.map +1 -1
- package/dist/src/install/fan-out.js +6 -0
- package/dist/src/install/fan-out.js.map +1 -1
- package/dist/src/install/index.d.ts +2 -0
- package/dist/src/install/index.d.ts.map +1 -1
- package/dist/src/install/index.js +2 -0
- package/dist/src/install/index.js.map +1 -1
- package/dist/src/install/workspace-scope.d.ts +207 -0
- package/dist/src/install/workspace-scope.d.ts.map +1 -0
- package/dist/src/install/workspace-scope.js +275 -0
- package/dist/src/install/workspace-scope.js.map +1 -0
- package/dist/src/install/workspace-scope.test.d.ts +2 -0
- package/dist/src/install/workspace-scope.test.d.ts.map +1 -0
- package/dist/src/install/workspace-scope.test.js +378 -0
- package/dist/src/install/workspace-scope.test.js.map +1 -0
- package/dist/src/security/__tests__/pathValidation.test.js +30 -1
- package/dist/src/security/__tests__/pathValidation.test.js.map +1 -1
- package/dist/src/services/SubagentGenerator.client-profiles.d.ts +258 -0
- package/dist/src/services/SubagentGenerator.client-profiles.d.ts.map +1 -0
- package/dist/src/services/SubagentGenerator.client-profiles.js +260 -0
- package/dist/src/services/SubagentGenerator.client-profiles.js.map +1 -0
- package/dist/src/services/SubagentGenerator.d.ts +19 -41
- package/dist/src/services/SubagentGenerator.d.ts.map +1 -1
- package/dist/src/services/SubagentGenerator.helpers.d.ts +64 -0
- package/dist/src/services/SubagentGenerator.helpers.d.ts.map +1 -0
- package/dist/src/services/SubagentGenerator.helpers.js +228 -0
- package/dist/src/services/SubagentGenerator.helpers.js.map +1 -0
- package/dist/src/services/SubagentGenerator.js +66 -208
- package/dist/src/services/SubagentGenerator.js.map +1 -1
- package/dist/src/services/SubagentGenerator.types.d.ts +45 -0
- package/dist/src/services/SubagentGenerator.types.d.ts.map +1 -0
- package/dist/src/services/SubagentGenerator.types.js +14 -0
- package/dist/src/services/SubagentGenerator.types.js.map +1 -0
- package/dist/src/services/TransformationService.d.ts +18 -61
- package/dist/src/services/TransformationService.d.ts.map +1 -1
- package/dist/src/services/TransformationService.js +29 -17
- package/dist/src/services/TransformationService.js.map +1 -1
- package/dist/src/services/TransformationService.types.d.ts +74 -0
- package/dist/src/services/TransformationService.types.d.ts.map +1 -0
- package/dist/src/services/TransformationService.types.js +8 -0
- package/dist/src/services/TransformationService.types.js.map +1 -0
- package/dist/src/services/__tests__/SubagentGenerator.client-profiles.test.d.ts +5 -0
- package/dist/src/services/__tests__/SubagentGenerator.client-profiles.test.d.ts.map +1 -0
- package/dist/src/services/__tests__/SubagentGenerator.client-profiles.test.js +72 -0
- package/dist/src/services/__tests__/SubagentGenerator.client-profiles.test.js.map +1 -0
- package/dist/src/services/__tests__/SubagentGenerator.helpers.test.d.ts +2 -0
- package/dist/src/services/__tests__/SubagentGenerator.helpers.test.d.ts.map +1 -0
- package/dist/src/services/__tests__/SubagentGenerator.helpers.test.js +61 -0
- package/dist/src/services/__tests__/SubagentGenerator.helpers.test.js.map +1 -0
- package/dist/src/services/__tests__/SubagentGenerator.test.js +155 -0
- package/dist/src/services/__tests__/SubagentGenerator.test.js.map +1 -1
- package/dist/src/services/__tests__/TransformationService.test.js +48 -0
- package/dist/src/services/__tests__/TransformationService.test.js.map +1 -1
- package/dist/src/services/agent-pack/agent-pack.test.js +1 -0
- package/dist/src/services/agent-pack/agent-pack.test.js.map +1 -1
- package/dist/src/services/agent-pack/prompt-source.d.ts +1 -1
- package/dist/src/services/agent-pack/prompt-source.d.ts.map +1 -1
- package/dist/src/services/agent-pack/prompt-source.js +10 -3
- package/dist/src/services/agent-pack/prompt-source.js.map +1 -1
- package/dist/src/services/agent-pack/types.d.ts +26 -2
- package/dist/src/services/agent-pack/types.d.ts.map +1 -1
- package/dist/src/services/agent-pack/types.js +13 -0
- package/dist/src/services/agent-pack/types.js.map +1 -1
- package/dist/src/services/agent-tool-profile.d.ts.map +1 -1
- package/dist/src/services/agent-tool-profile.js +7 -0
- package/dist/src/services/agent-tool-profile.js.map +1 -1
- package/dist/src/services/agent-tool-profile.test.js +2 -2
- package/dist/src/services/skill-content-comparison.d.ts +71 -0
- package/dist/src/services/skill-content-comparison.d.ts.map +1 -0
- package/dist/src/services/skill-content-comparison.js +90 -0
- package/dist/src/services/skill-content-comparison.js.map +1 -0
- package/dist/src/services/skill-content-comparison.test.d.ts +6 -0
- package/dist/src/services/skill-content-comparison.test.d.ts.map +1 -0
- package/dist/src/services/skill-content-comparison.test.js +83 -0
- package/dist/src/services/skill-content-comparison.test.js.map +1 -0
- package/dist/src/services/skill-identity-classification.d.ts +202 -0
- package/dist/src/services/skill-identity-classification.d.ts.map +1 -0
- package/dist/src/services/skill-identity-classification.js +295 -0
- package/dist/src/services/skill-identity-classification.js.map +1 -0
- package/dist/src/services/skill-identity-classification.test.d.ts +6 -0
- package/dist/src/services/skill-identity-classification.test.d.ts.map +1 -0
- package/dist/src/services/skill-identity-classification.test.js +314 -0
- package/dist/src/services/skill-identity-classification.test.js.map +1 -0
- package/dist/src/services/skill-installation.content.d.ts.map +1 -1
- package/dist/src/services/skill-installation.content.js +6 -1
- package/dist/src/services/skill-installation.content.js.map +1 -1
- package/dist/src/services/skill-installation.helpers.d.ts +8 -15
- package/dist/src/services/skill-installation.helpers.d.ts.map +1 -1
- package/dist/src/services/skill-installation.helpers.js +11 -105
- package/dist/src/services/skill-installation.helpers.js.map +1 -1
- package/dist/src/services/skill-installation.helpers.test.js +106 -1
- package/dist/src/services/skill-installation.helpers.test.js.map +1 -1
- package/dist/src/services/skill-installation.service.js +1 -1
- package/dist/src/services/skill-installation.service.js.map +1 -1
- package/dist/src/services/skill-installation.types.d.ts +33 -0
- package/dist/src/services/skill-installation.types.d.ts.map +1 -1
- package/dist/src/services/skill-installation.types.js.map +1 -1
- package/dist/src/services/skill-installation.uninstall.d.ts +84 -0
- package/dist/src/services/skill-installation.uninstall.d.ts.map +1 -0
- package/dist/src/services/skill-installation.uninstall.js +252 -0
- package/dist/src/services/skill-installation.uninstall.js.map +1 -0
- package/dist/src/services/skill-manifest.d.ts +41 -0
- package/dist/src/services/skill-manifest.d.ts.map +1 -1
- package/dist/src/services/skill-manifest.js +93 -0
- package/dist/src/services/skill-manifest.js.map +1 -1
- package/dist/src/services/skill-manifest.test.js +27 -0
- package/dist/src/services/skill-manifest.test.js.map +1 -1
- package/dist/src/sync/SyncEngine.d.ts.map +1 -1
- package/dist/src/sync/SyncEngine.js +69 -77
- package/dist/src/sync/SyncEngine.js.map +1 -1
- package/dist/src/telemetry/agent-marker.d.ts +8 -0
- package/dist/src/telemetry/agent-marker.d.ts.map +1 -1
- package/dist/src/telemetry/agent-marker.js +7 -0
- package/dist/src/telemetry/agent-marker.js.map +1 -1
- package/dist/src/telemetry/agent-marker.test.js +7 -1
- package/dist/src/telemetry/agent-marker.test.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +1 -1
- package/dist/src/telemetry/index.d.ts.map +1 -1
- package/dist/src/telemetry/index.js +1 -1
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/wrap.d.ts +6 -0
- package/dist/src/telemetry/wrap.d.ts.map +1 -1
- package/dist/src/telemetry/wrap.js +65 -10
- package/dist/src/telemetry/wrap.js.map +1 -1
- package/dist/src/telemetry/wrap.test.js +81 -1
- package/dist/src/telemetry/wrap.test.js.map +1 -1
- package/dist/src/telemetry/wrap.tool-call-sink.test.d.ts +26 -0
- package/dist/src/telemetry/wrap.tool-call-sink.test.d.ts.map +1 -0
- package/dist/src/telemetry/wrap.tool-call-sink.test.js +162 -0
- package/dist/src/telemetry/wrap.tool-call-sink.test.js.map +1 -0
- package/dist/src/types/skill.d.ts +9 -1
- package/dist/src/types/skill.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +1 -1
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/version-check.d.ts +61 -0
- package/dist/src/utils/version-check.d.ts.map +1 -1
- package/dist/src/utils/version-check.js +78 -1
- package/dist/src/utils/version-check.js.map +1 -1
- package/dist/src/utils/version-check.test.js +130 -1
- package/dist/src/utils/version-check.test.js.map +1 -1
- package/dist/tests/db/migration-runner-race.test.js +19 -9
- package/dist/tests/db/migration-runner-race.test.js.map +1 -1
- package/dist/tests/install/fan-out.test.js +27 -0
- package/dist/tests/install/fan-out.test.js.map +1 -1
- package/dist/tests/sync/SyncEngine.abort.test.js +15 -11
- package/dist/tests/sync/SyncEngine.abort.test.js.map +1 -1
- package/dist/tests/sync/SyncEngine.status.test.js +1 -1
- package/dist/tests/sync/SyncEngine.status.test.js.map +1 -1
- package/dist/tests/sync/SyncEngine.test.d.ts +11 -2
- package/dist/tests/sync/SyncEngine.test.d.ts.map +1 -1
- package/dist/tests/sync/SyncEngine.test.js +164 -13
- package/dist/tests/sync/SyncEngine.test.js.map +1 -1
- package/dist/tests/unit/migrations/migration-v18.test.d.ts +16 -0
- package/dist/tests/unit/migrations/migration-v18.test.d.ts.map +1 -0
- package/dist/tests/unit/migrations/migration-v18.test.js +192 -0
- package/dist/tests/unit/migrations/migration-v18.test.js.map +1 -0
- package/dist/tests/unit/services/skill-installation.content.test.js +65 -1
- package/dist/tests/unit/services/skill-installation.content.test.js.map +1 -1
- package/dist/tests/unit/services/skill-installation.service.test.js +9 -8
- package/dist/tests/unit/services/skill-installation.service.test.js.map +1 -1
- package/dist/tests/unit/sync-engine.source-aware.test.js +5 -5
- package/dist/tests/unit/sync-engine.source-aware.test.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AntiGravity-specific MCP registration step for `sklx agent install`
|
|
3
|
+
* (SMI-6275 Wave 5, closing the last unshipped ask of GH#2166).
|
|
4
|
+
*
|
|
5
|
+
* Split out of `agent-pack-installer.harness.ts`'s generic `installMcpConfig`
|
|
6
|
+
* for a STRUCTURAL reason (not just a per-harness-quirk reason like Cursor's
|
|
7
|
+
* split): every other MCP-capable harness's config path is HOME-anchored
|
|
8
|
+
* (`AGENT_MCP_TARGETS`, `agent-harness-targets.ts`) and resolved via
|
|
9
|
+
* `relocateUnderHome()`. AntiGravity's `.agents/mcp_config.json` is
|
|
10
|
+
* WORKSPACE-anchored — relative to the workspace root Wave 4
|
|
11
|
+
* (`workspace-scope.ts`, ADR-139) resolves — so it cannot live in that
|
|
12
|
+
* HOME-anchored `Record` at all, and never goes through `relocateUnderHome()`.
|
|
13
|
+
* This module owns AntiGravity's path resolution + entry-value shape
|
|
14
|
+
* entirely outside that table, mirroring the Cursor precedent
|
|
15
|
+
* (`agent-pack-installer.cursor-mcp.ts`, SMI-6279 Wave 9) for the "give it
|
|
16
|
+
* its own file" convention while differing in WHY: Cursor's shape/key both
|
|
17
|
+
* diverge from the shared convention; AntiGravity's shape and key both MATCH
|
|
18
|
+
* the shared convention (see {@link ANTIGRAVITY_MCP_ENTRY_KEY} and
|
|
19
|
+
* `buildAntigravityMcpEntryValue()` in `agent-pack-installer.entry.ts}) — only
|
|
20
|
+
* its PATH RESOLUTION diverges structurally.
|
|
21
|
+
*
|
|
22
|
+
* ## Schema verification (SMI-6275 Wave 5 Step 2 point 5)
|
|
23
|
+
*
|
|
24
|
+
* Confidence: **HIGH**. Verified 2026-08-30 via live web search against two
|
|
25
|
+
* canonical Google sources (antigravity.google/docs/ide/mcp/ and
|
|
26
|
+
* antigravity.google/docs/cli/mcp/), corroborated by two independent
|
|
27
|
+
* third-party write-ups (a Google Cloud Community/Medium walkthrough and a
|
|
28
|
+
* Composio how-to guide):
|
|
29
|
+
* - Path: `.agents/mcp_config.json`, workspace-local, discovered
|
|
30
|
+
* automatically by "the SDK" (AntiGravity's own phrasing) — sibling to
|
|
31
|
+
* the GLOBAL `~/.gemini/config/mcp_config.json` (itself a sibling of
|
|
32
|
+
* `CLIENT_NATIVE_PATHS.antigravity`'s `~/.gemini/config/skills`, `paths.ts`).
|
|
33
|
+
* Matches `docs/internal/research/smi-5386-opencode-antigravity-skill-dirs.md`'s
|
|
34
|
+
* already-verified `.agents/skills/` sibling convention for the same
|
|
35
|
+
* workspace root.
|
|
36
|
+
* - Schema: a single top-level `mcpServers` object — the SAME
|
|
37
|
+
* `mcpServers`-keyed convention claude-code/copilot/windsurf/hermes
|
|
38
|
+
* already use (NOT OpenCode's distinct `local|remote`-typed shape, NOT
|
|
39
|
+
* Codex's TOML block, NOT Cursor's resolved-binary-path form). Local/
|
|
40
|
+
* command-based servers are defined with `command` + `args` + optional
|
|
41
|
+
* `env` — exactly {@link buildAgentMcpEntryValue}'s existing shape, so
|
|
42
|
+
* `buildAntigravityMcpEntryValue()` composes over it rather than
|
|
43
|
+
* reinventing it.
|
|
44
|
+
* - This is reused, not novel: `mergeJsonMcpEntry()` (`agent-config-merge.json.ts`)
|
|
45
|
+
* already speaks this exact shape for four other harnesses — only the
|
|
46
|
+
* PATH (workspace-anchored) and the entry KEY (package-scoped, matching
|
|
47
|
+
* AntiGravity's own docs snippet — see `ANTIGRAVITY_MCP_ENTRY_KEY`) are
|
|
48
|
+
* new to this wave.
|
|
49
|
+
*
|
|
50
|
+
* @module @skillsmith/core/install/agent-pack-installer.antigravity-mcp
|
|
51
|
+
*/
|
|
52
|
+
import type { HarnessInstallCtx } from './agent-pack-installer.harness.js';
|
|
53
|
+
import type { HarnessInstallReport } from './agent-pack-installer.types.js';
|
|
54
|
+
/**
|
|
55
|
+
* Relative path segments (from the resolved workspace root) to AntiGravity's
|
|
56
|
+
* MCP config file. Exported as a fixed constant — not a hand-duplicated
|
|
57
|
+
* string literal — so `agent-manifest-path-guard.ts`'s uninstall-time
|
|
58
|
+
* allowlist check can validate against the EXACT same shape this module
|
|
59
|
+
* writes, rather than an independently-maintained copy that could drift.
|
|
60
|
+
*/
|
|
61
|
+
export declare const ANTIGRAVITY_MCP_CONFIG_RELATIVE_SEGMENTS: readonly [".agents", "mcp_config.json"];
|
|
62
|
+
/**
|
|
63
|
+
* Merge AntiGravity's MCP server registration into
|
|
64
|
+
* `<workspaceRoot>/.agents/mcp_config.json` under
|
|
65
|
+
* {@link ANTIGRAVITY_MCP_ENTRY_KEY}.
|
|
66
|
+
*
|
|
67
|
+
* Caller (`agent-pack-installer.ts`) is responsible for having already
|
|
68
|
+
* confirmed `workspaceRoot` is a genuinely resolved AntiGravity workspace
|
|
69
|
+
* scope (via `resolveScopedSkillsDir()`) — this function does no scope
|
|
70
|
+
* resolution or detection of its own, per the "reuse Wave 4's resolver,
|
|
71
|
+
* don't reimplement detection" requirement.
|
|
72
|
+
*/
|
|
73
|
+
export declare function installAntigravityMcpConfig(workspaceRoot: string, ctx: HarnessInstallCtx, report: HarnessInstallReport): void;
|
|
74
|
+
//# sourceMappingURL=agent-pack-installer.antigravity-mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-pack-installer.antigravity-mcp.d.ts","sourceRoot":"","sources":["../../../src/install/agent-pack-installer.antigravity-mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AASH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAQ3E;;;;;;GAMG;AACH,eAAO,MAAM,wCAAwC,yCAA0C,CAAA;AAE/F;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,iBAAiB,EACtB,MAAM,EAAE,oBAAoB,GAC3B,IAAI,CA+BN"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AntiGravity-specific MCP registration step for `sklx agent install`
|
|
3
|
+
* (SMI-6275 Wave 5, closing the last unshipped ask of GH#2166).
|
|
4
|
+
*
|
|
5
|
+
* Split out of `agent-pack-installer.harness.ts`'s generic `installMcpConfig`
|
|
6
|
+
* for a STRUCTURAL reason (not just a per-harness-quirk reason like Cursor's
|
|
7
|
+
* split): every other MCP-capable harness's config path is HOME-anchored
|
|
8
|
+
* (`AGENT_MCP_TARGETS`, `agent-harness-targets.ts`) and resolved via
|
|
9
|
+
* `relocateUnderHome()`. AntiGravity's `.agents/mcp_config.json` is
|
|
10
|
+
* WORKSPACE-anchored — relative to the workspace root Wave 4
|
|
11
|
+
* (`workspace-scope.ts`, ADR-139) resolves — so it cannot live in that
|
|
12
|
+
* HOME-anchored `Record` at all, and never goes through `relocateUnderHome()`.
|
|
13
|
+
* This module owns AntiGravity's path resolution + entry-value shape
|
|
14
|
+
* entirely outside that table, mirroring the Cursor precedent
|
|
15
|
+
* (`agent-pack-installer.cursor-mcp.ts`, SMI-6279 Wave 9) for the "give it
|
|
16
|
+
* its own file" convention while differing in WHY: Cursor's shape/key both
|
|
17
|
+
* diverge from the shared convention; AntiGravity's shape and key both MATCH
|
|
18
|
+
* the shared convention (see {@link ANTIGRAVITY_MCP_ENTRY_KEY} and
|
|
19
|
+
* `buildAntigravityMcpEntryValue()` in `agent-pack-installer.entry.ts}) — only
|
|
20
|
+
* its PATH RESOLUTION diverges structurally.
|
|
21
|
+
*
|
|
22
|
+
* ## Schema verification (SMI-6275 Wave 5 Step 2 point 5)
|
|
23
|
+
*
|
|
24
|
+
* Confidence: **HIGH**. Verified 2026-08-30 via live web search against two
|
|
25
|
+
* canonical Google sources (antigravity.google/docs/ide/mcp/ and
|
|
26
|
+
* antigravity.google/docs/cli/mcp/), corroborated by two independent
|
|
27
|
+
* third-party write-ups (a Google Cloud Community/Medium walkthrough and a
|
|
28
|
+
* Composio how-to guide):
|
|
29
|
+
* - Path: `.agents/mcp_config.json`, workspace-local, discovered
|
|
30
|
+
* automatically by "the SDK" (AntiGravity's own phrasing) — sibling to
|
|
31
|
+
* the GLOBAL `~/.gemini/config/mcp_config.json` (itself a sibling of
|
|
32
|
+
* `CLIENT_NATIVE_PATHS.antigravity`'s `~/.gemini/config/skills`, `paths.ts`).
|
|
33
|
+
* Matches `docs/internal/research/smi-5386-opencode-antigravity-skill-dirs.md`'s
|
|
34
|
+
* already-verified `.agents/skills/` sibling convention for the same
|
|
35
|
+
* workspace root.
|
|
36
|
+
* - Schema: a single top-level `mcpServers` object — the SAME
|
|
37
|
+
* `mcpServers`-keyed convention claude-code/copilot/windsurf/hermes
|
|
38
|
+
* already use (NOT OpenCode's distinct `local|remote`-typed shape, NOT
|
|
39
|
+
* Codex's TOML block, NOT Cursor's resolved-binary-path form). Local/
|
|
40
|
+
* command-based servers are defined with `command` + `args` + optional
|
|
41
|
+
* `env` — exactly {@link buildAgentMcpEntryValue}'s existing shape, so
|
|
42
|
+
* `buildAntigravityMcpEntryValue()` composes over it rather than
|
|
43
|
+
* reinventing it.
|
|
44
|
+
* - This is reused, not novel: `mergeJsonMcpEntry()` (`agent-config-merge.json.ts`)
|
|
45
|
+
* already speaks this exact shape for four other harnesses — only the
|
|
46
|
+
* PATH (workspace-anchored) and the entry KEY (package-scoped, matching
|
|
47
|
+
* AntiGravity's own docs snippet — see `ANTIGRAVITY_MCP_ENTRY_KEY`) are
|
|
48
|
+
* new to this wave.
|
|
49
|
+
*
|
|
50
|
+
* @module @skillsmith/core/install/agent-pack-installer.antigravity-mcp
|
|
51
|
+
*/
|
|
52
|
+
import { join } from 'node:path';
|
|
53
|
+
import { mergeJsonMcpEntry } from './agent-config-merge.json.js';
|
|
54
|
+
import { ANTIGRAVITY_MCP_ENTRY_KEY, buildAntigravityMcpEntryValue, } from './agent-pack-installer.entry.js';
|
|
55
|
+
/** Same predicate as `agent-pack-installer.harness.ts`'s private `mergeSucceeded` — duplicated rather than exported to keep that module's helper private. */
|
|
56
|
+
function mergeSucceeded(status) {
|
|
57
|
+
return status === 'created' || status === 'updated' || status === 'unchanged';
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Relative path segments (from the resolved workspace root) to AntiGravity's
|
|
61
|
+
* MCP config file. Exported as a fixed constant — not a hand-duplicated
|
|
62
|
+
* string literal — so `agent-manifest-path-guard.ts`'s uninstall-time
|
|
63
|
+
* allowlist check can validate against the EXACT same shape this module
|
|
64
|
+
* writes, rather than an independently-maintained copy that could drift.
|
|
65
|
+
*/
|
|
66
|
+
export const ANTIGRAVITY_MCP_CONFIG_RELATIVE_SEGMENTS = ['.agents', 'mcp_config.json'];
|
|
67
|
+
/**
|
|
68
|
+
* Merge AntiGravity's MCP server registration into
|
|
69
|
+
* `<workspaceRoot>/.agents/mcp_config.json` under
|
|
70
|
+
* {@link ANTIGRAVITY_MCP_ENTRY_KEY}.
|
|
71
|
+
*
|
|
72
|
+
* Caller (`agent-pack-installer.ts`) is responsible for having already
|
|
73
|
+
* confirmed `workspaceRoot` is a genuinely resolved AntiGravity workspace
|
|
74
|
+
* scope (via `resolveScopedSkillsDir()`) — this function does no scope
|
|
75
|
+
* resolution or detection of its own, per the "reuse Wave 4's resolver,
|
|
76
|
+
* don't reimplement detection" requirement.
|
|
77
|
+
*/
|
|
78
|
+
export function installAntigravityMcpConfig(workspaceRoot, ctx, report) {
|
|
79
|
+
const path = join(workspaceRoot, ...ANTIGRAVITY_MCP_CONFIG_RELATIVE_SEGMENTS);
|
|
80
|
+
const result = mergeJsonMcpEntry({
|
|
81
|
+
path,
|
|
82
|
+
keyPath: ['mcpServers'],
|
|
83
|
+
entryKey: ANTIGRAVITY_MCP_ENTRY_KEY,
|
|
84
|
+
entryValue: buildAntigravityMcpEntryValue(),
|
|
85
|
+
backupDir: ctx.backupDir,
|
|
86
|
+
force: ctx.force,
|
|
87
|
+
alreadyBackedUpPaths: ctx.backedUpPaths,
|
|
88
|
+
});
|
|
89
|
+
report.mcpConfig = result;
|
|
90
|
+
if (result.status === 'conflict') {
|
|
91
|
+
report.notes.push(`MCP config at ${path} already has a '${ANTIGRAVITY_MCP_ENTRY_KEY}' entry that doesn't look like ours — left untouched. Re-run with --force to overwrite, or edit ${path} manually.`);
|
|
92
|
+
}
|
|
93
|
+
if (result.status === 'error') {
|
|
94
|
+
report.notes.push(`MCP config merge failed at ${path}: ${result.errorMessage}`);
|
|
95
|
+
}
|
|
96
|
+
if (mergeSucceeded(result.status)) {
|
|
97
|
+
ctx.entries.push({
|
|
98
|
+
path,
|
|
99
|
+
kind: 'mcp-config',
|
|
100
|
+
harness: 'antigravity',
|
|
101
|
+
backupPath: result.backupPath,
|
|
102
|
+
executable: false,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=agent-pack-installer.antigravity-mcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-pack-installer.antigravity-mcp.js","sourceRoot":"","sources":["../../../src/install/agent-pack-installer.antigravity-mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,EACL,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,iCAAiC,CAAA;AAKxC,6JAA6J;AAC7J,SAAS,cAAc,CAAC,MAA6B;IACnD,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,WAAW,CAAA;AAC/E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wCAAwC,GAAG,CAAC,SAAS,EAAE,iBAAiB,CAAU,CAAA;AAE/F;;;;;;;;;;GAUG;AACH,MAAM,UAAU,2BAA2B,CACzC,aAAqB,EACrB,GAAsB,EACtB,MAA4B;IAE5B,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,EAAE,GAAG,wCAAwC,CAAC,CAAA;IAE7E,MAAM,MAAM,GAAG,iBAAiB,CAAC;QAC/B,IAAI;QACJ,OAAO,EAAE,CAAC,YAAY,CAAC;QACvB,QAAQ,EAAE,yBAAyB;QACnC,UAAU,EAAE,6BAA6B,EAAE;QAC3C,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,oBAAoB,EAAE,GAAG,CAAC,aAAa;KACxC,CAAC,CAAA;IAEF,MAAM,CAAC,SAAS,GAAG,MAAM,CAAA;IACzB,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QACjC,MAAM,CAAC,KAAK,CAAC,IAAI,CACf,iBAAiB,IAAI,mBAAmB,yBAAyB,mGAAmG,IAAI,YAAY,CACrL,CAAA;IACH,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;QAC9B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,8BAA8B,IAAI,KAAK,MAAM,CAAC,YAAY,EAAE,CAAC,CAAA;IACjF,CAAC;IACD,IAAI,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;YACf,IAAI;YACJ,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,aAAa;YACtB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,UAAU,EAAE,KAAK;SAClB,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-pack-installer.antigravity-mcp.test.d.ts","sourceRoot":"","sources":["../../../src/install/agent-pack-installer.antigravity-mcp.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AntiGravity `.agents/mcp_config.json` entry-shape + lifecycle coverage
|
|
3
|
+
* (SMI-6275 Wave 5, GH#2166 ask 3).
|
|
4
|
+
*
|
|
5
|
+
* Split from the sibling `agent-pack-installer.workspace-scope.test.ts`
|
|
6
|
+
* (which covers detection/scope-resolution behavior) and
|
|
7
|
+
* `agent-pack-installer.test.ts`/`agent-manifest-path-guard.test.ts`,
|
|
8
|
+
* mirroring this file family's existing `.cursor-mcp.test.ts` sibling
|
|
9
|
+
* convention. Covers the four things Wave 5's own required test names:
|
|
10
|
+
* 1. Entry shape — `@skillsmith/mcp-server` key, `npx` form,
|
|
11
|
+
* `SKILLSMITH_CLIENT=antigravity` + `SKILLSMITH_TOOL_PROFILE=agent`.
|
|
12
|
+
* 2. Idempotency — re-install does not duplicate or corrupt the entry.
|
|
13
|
+
* 3. Conflict/force — a foreign entry at the same key is preserved unless
|
|
14
|
+
* `--force` is passed.
|
|
15
|
+
* 4. Uninstall — removes only Skillsmith-owned keys, restoring any
|
|
16
|
+
* hand-added sibling key untouched (also the regression test for the
|
|
17
|
+
* `agent-manifest-path-guard.ts` workspace-relative allowlist fix this
|
|
18
|
+
* wave adds — without it, `uninstallAgentPack` would silently REJECT
|
|
19
|
+
* every AntiGravity manifest entry as "outside known install targets").
|
|
20
|
+
*
|
|
21
|
+
* @module @skillsmith/core/install/agent-pack-installer.antigravity-mcp.test
|
|
22
|
+
*/
|
|
23
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
24
|
+
import { tmpdir } from 'node:os';
|
|
25
|
+
import { join } from 'node:path';
|
|
26
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
27
|
+
import { installAgentPack } from './agent-pack-installer.js';
|
|
28
|
+
import { uninstallAgentPack } from './agent-pack-uninstaller.js';
|
|
29
|
+
import { AGENT_INSTALL_DIR_ENV_VAR } from './agent-manifest.js';
|
|
30
|
+
let homeDir;
|
|
31
|
+
let workspaceDir;
|
|
32
|
+
let manifestDir;
|
|
33
|
+
let prevInstallDirEnv;
|
|
34
|
+
function mcpConfigPath(workspace) {
|
|
35
|
+
return join(workspace, '.agents', 'mcp_config.json');
|
|
36
|
+
}
|
|
37
|
+
function readAntigravityMcpJson(workspace) {
|
|
38
|
+
return JSON.parse(readFileSync(mcpConfigPath(workspace), 'utf-8'));
|
|
39
|
+
}
|
|
40
|
+
beforeEach(() => {
|
|
41
|
+
homeDir = mkdtempSync(join(tmpdir(), 'skillsmith-agent-install-home-'));
|
|
42
|
+
workspaceDir = mkdtempSync(join(tmpdir(), 'skillsmith-agent-install-workspace-'));
|
|
43
|
+
mkdirSync(join(workspaceDir, '.git'), { recursive: true });
|
|
44
|
+
manifestDir = mkdtempSync(join(tmpdir(), 'skillsmith-agent-install-manifest-'));
|
|
45
|
+
prevInstallDirEnv = process.env[AGENT_INSTALL_DIR_ENV_VAR];
|
|
46
|
+
process.env[AGENT_INSTALL_DIR_ENV_VAR] = manifestDir;
|
|
47
|
+
});
|
|
48
|
+
afterEach(() => {
|
|
49
|
+
rmSync(homeDir, { recursive: true, force: true });
|
|
50
|
+
rmSync(workspaceDir, { recursive: true, force: true });
|
|
51
|
+
rmSync(manifestDir, { recursive: true, force: true });
|
|
52
|
+
if (prevInstallDirEnv !== undefined)
|
|
53
|
+
process.env[AGENT_INSTALL_DIR_ENV_VAR] = prevInstallDirEnv;
|
|
54
|
+
else
|
|
55
|
+
delete process.env[AGENT_INSTALL_DIR_ENV_VAR];
|
|
56
|
+
});
|
|
57
|
+
describe('installAgentPack — AntiGravity mcp_config.json entry shape (SMI-6275 Wave 5)', () => {
|
|
58
|
+
it('writes the entry under the @skillsmith/mcp-server key with the npx form + SKILLSMITH_CLIENT=antigravity', () => {
|
|
59
|
+
const result = installAgentPack({ homeDir, cwd: workspaceDir, scope: 'workspace' });
|
|
60
|
+
const doc = readAntigravityMcpJson(workspaceDir);
|
|
61
|
+
const entry = doc.mcpServers['@skillsmith/mcp-server'];
|
|
62
|
+
expect(entry?.command).toBe('npx');
|
|
63
|
+
expect(entry?.args).toEqual(['-y', '@skillsmith/mcp-server']);
|
|
64
|
+
expect(entry?.env?.SKILLSMITH_CLIENT).toBe('antigravity');
|
|
65
|
+
expect(entry?.env?.SKILLSMITH_TOOL_PROFILE).toBe('agent');
|
|
66
|
+
// No stray legacy 'skillsmith'-keyed entry — this is a first-ever
|
|
67
|
+
// implementation, nothing to migrate away from.
|
|
68
|
+
expect(doc.mcpServers.skillsmith).toBeUndefined();
|
|
69
|
+
const report = result.harnessReports.find((r) => r.harness === 'antigravity');
|
|
70
|
+
expect(report?.mcpConfig?.status).toBe('created');
|
|
71
|
+
});
|
|
72
|
+
it('does not regress claude-code’s own entry — still the npx form under the "skillsmith" key, no SKILLSMITH_CLIENT', () => {
|
|
73
|
+
installAgentPack({ homeDir, cwd: workspaceDir, scope: 'workspace' });
|
|
74
|
+
const claudeDoc = JSON.parse(readFileSync(join(homeDir, '.claude', 'settings.json'), 'utf-8'));
|
|
75
|
+
expect(claudeDoc.mcpServers.skillsmith?.command).toBe('npx');
|
|
76
|
+
expect(claudeDoc.mcpServers.skillsmith?.env?.SKILLSMITH_TOOL_PROFILE).toBe('agent');
|
|
77
|
+
expect(claudeDoc.mcpServers.skillsmith?.env?.SKILLSMITH_CLIENT).toBeUndefined();
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
describe('installAgentPack — AntiGravity mcp_config.json idempotency (SMI-6275 Wave 5)', () => {
|
|
81
|
+
it('re-install does not create a duplicate second server entry', () => {
|
|
82
|
+
installAgentPack({ homeDir, cwd: workspaceDir, scope: 'workspace' });
|
|
83
|
+
const second = installAgentPack({ homeDir, cwd: workspaceDir, scope: 'workspace' });
|
|
84
|
+
const doc = readAntigravityMcpJson(workspaceDir);
|
|
85
|
+
expect(Object.keys(doc.mcpServers)).toEqual(['@skillsmith/mcp-server']);
|
|
86
|
+
const report = second.harnessReports.find((r) => r.harness === 'antigravity');
|
|
87
|
+
expect(report?.mcpConfig?.status).toBe('unchanged');
|
|
88
|
+
});
|
|
89
|
+
it('a second install run leaves the file byte-identical', () => {
|
|
90
|
+
installAgentPack({ homeDir, cwd: workspaceDir, scope: 'workspace' });
|
|
91
|
+
const afterFirst = readFileSync(mcpConfigPath(workspaceDir), 'utf-8');
|
|
92
|
+
installAgentPack({ homeDir, cwd: workspaceDir, scope: 'workspace' });
|
|
93
|
+
const afterSecond = readFileSync(mcpConfigPath(workspaceDir), 'utf-8');
|
|
94
|
+
expect(afterSecond).toBe(afterFirst);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
describe('installAgentPack — AntiGravity mcp_config.json conflict + --force (SMI-6275 Wave 5)', () => {
|
|
98
|
+
it('leaves a foreign entry at the same key untouched, reporting a conflict', () => {
|
|
99
|
+
mkdirSync(join(workspaceDir, '.agents'), { recursive: true });
|
|
100
|
+
const foreignEntry = { command: 'some-other-tool', args: ['--flag'] };
|
|
101
|
+
writeFileSync(mcpConfigPath(workspaceDir), JSON.stringify({ mcpServers: { '@skillsmith/mcp-server': foreignEntry } }, null, 2));
|
|
102
|
+
const result = installAgentPack({ homeDir, cwd: workspaceDir, scope: 'workspace' });
|
|
103
|
+
const doc = readAntigravityMcpJson(workspaceDir);
|
|
104
|
+
expect(doc.mcpServers['@skillsmith/mcp-server']).toEqual(foreignEntry);
|
|
105
|
+
const report = result.harnessReports.find((r) => r.harness === 'antigravity');
|
|
106
|
+
expect(report?.mcpConfig?.status).toBe('conflict');
|
|
107
|
+
expect(report?.notes.some((n) => n.includes('--force'))).toBe(true);
|
|
108
|
+
});
|
|
109
|
+
it('--force overwrites a foreign entry at the same key', () => {
|
|
110
|
+
mkdirSync(join(workspaceDir, '.agents'), { recursive: true });
|
|
111
|
+
writeFileSync(mcpConfigPath(workspaceDir), JSON.stringify({ mcpServers: { '@skillsmith/mcp-server': { command: 'some-other-tool' } } }, null, 2));
|
|
112
|
+
const result = installAgentPack({
|
|
113
|
+
homeDir,
|
|
114
|
+
cwd: workspaceDir,
|
|
115
|
+
scope: 'workspace',
|
|
116
|
+
force: true,
|
|
117
|
+
});
|
|
118
|
+
const doc = readAntigravityMcpJson(workspaceDir);
|
|
119
|
+
expect(doc.mcpServers['@skillsmith/mcp-server']?.command).toBe('npx');
|
|
120
|
+
const report = result.harnessReports.find((r) => r.harness === 'antigravity');
|
|
121
|
+
expect(report?.mcpConfig?.status).toBe('updated');
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
describe('installAgentPack + uninstallAgentPack — AntiGravity workspace artifacts (SMI-6275 Wave 5)', () => {
|
|
125
|
+
it('uninstall removes the freshly-created skill pack AND mcp_config.json entirely (no manifest-guard rejection)', () => {
|
|
126
|
+
installAgentPack({ homeDir, cwd: workspaceDir, scope: 'workspace' });
|
|
127
|
+
const skillPackPath = join(workspaceDir, '.agents', 'skills', 'skillsmith-agent', 'SKILL.md');
|
|
128
|
+
expect(existsSync(skillPackPath)).toBe(true);
|
|
129
|
+
expect(existsSync(mcpConfigPath(workspaceDir))).toBe(true);
|
|
130
|
+
const result = uninstallAgentPack({ homeDir });
|
|
131
|
+
// The regression this test guards: without the agent-manifest-path-guard.ts
|
|
132
|
+
// workspace-relative allowlist fix, both paths would land in `rejected`
|
|
133
|
+
// (outside the guard's home-relative-only allowlist) and never actually
|
|
134
|
+
// be deleted.
|
|
135
|
+
expect(result.rejected).toEqual([]);
|
|
136
|
+
expect(result.removed).toContain(skillPackPath);
|
|
137
|
+
expect(result.removed).toContain(mcpConfigPath(workspaceDir));
|
|
138
|
+
expect(existsSync(skillPackPath)).toBe(false);
|
|
139
|
+
expect(existsSync(mcpConfigPath(workspaceDir))).toBe(false);
|
|
140
|
+
});
|
|
141
|
+
it('uninstall restores a hand-added sibling key in mcp_config.json untouched, removing only our own key', () => {
|
|
142
|
+
mkdirSync(join(workspaceDir, '.agents'), { recursive: true });
|
|
143
|
+
const siblingDoc = { mcpServers: { 'my-other-tool': { command: 'foo', args: ['bar'] } } };
|
|
144
|
+
writeFileSync(mcpConfigPath(workspaceDir), JSON.stringify(siblingDoc, null, 2));
|
|
145
|
+
installAgentPack({ homeDir, cwd: workspaceDir, scope: 'workspace' });
|
|
146
|
+
const afterInstall = readAntigravityMcpJson(workspaceDir);
|
|
147
|
+
expect(afterInstall.mcpServers['my-other-tool']).toEqual(siblingDoc.mcpServers['my-other-tool']);
|
|
148
|
+
expect(afterInstall.mcpServers['@skillsmith/mcp-server']).toBeDefined();
|
|
149
|
+
const result = uninstallAgentPack({ homeDir });
|
|
150
|
+
expect(result.rejected).toEqual([]);
|
|
151
|
+
expect(result.restored).toContain(mcpConfigPath(workspaceDir));
|
|
152
|
+
const afterUninstall = readAntigravityMcpJson(workspaceDir);
|
|
153
|
+
expect(afterUninstall.mcpServers['my-other-tool']).toEqual(siblingDoc.mcpServers['my-other-tool']);
|
|
154
|
+
expect(afterUninstall.mcpServers['@skillsmith/mcp-server']).toBeUndefined();
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
//# sourceMappingURL=agent-pack-installer.antigravity-mcp.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-pack-installer.antigravity-mcp.test.js","sourceRoot":"","sources":["../../../src/install/agent-pack-installer.antigravity-mcp.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACjG,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MA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AAM,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAA;QAE9D,MAAM,cAAc,GAAG,sBAAsB,CAAC,YAAY,CAAC,CAAA;QAC3D,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CACxD,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,CACvC,CAAA;QACD,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC,CAAC,aAAa,EAAE,CAAA;IAC7E,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor-specific MCP registration step for `sklx agent install`
|
|
3
|
+
* (SMI-6279 Wave 9).
|
|
4
|
+
*
|
|
5
|
+
* Split out of `agent-pack-installer.harness.ts`'s generic `installMcpConfig`
|
|
6
|
+
* — mirrors the existing `agent-pack-installer.cursor-hooks.ts` split
|
|
7
|
+
* (SMI-5893 Wave 8a) for the same reason: Cursor's on-disk shape/resolution
|
|
8
|
+
* needs diverge structurally from the other 6 MCP-capable harnesses, so
|
|
9
|
+
* folding cursor-only logic into the shared function would either bloat it
|
|
10
|
+
* past the 500-line gate or force every other harness through cursor-only
|
|
11
|
+
* branches it doesn't need.
|
|
12
|
+
*
|
|
13
|
+
* Two independent, confirmed-broken things this fixes (GH#2368 V3 repro —
|
|
14
|
+
* see the SMI-6266 Wave 9 plan doc):
|
|
15
|
+
* 1. `buildAgentMcpEntryValue()` wrote the `npx`/`args` form into Cursor's
|
|
16
|
+
* `mcp.json` — the exact shape two live UAT passes proved ENOENTs
|
|
17
|
+
* inside Cursor's bundled Node (GH#2368 C-01) — and never set
|
|
18
|
+
* `SKILLSMITH_CLIENT`, so re-running `agent install` (the very
|
|
19
|
+
* remediation `formatUpdateNotification()` tells a user to run)
|
|
20
|
+
* silently rewrote the SAME broken entry, even after the website docs
|
|
21
|
+
* snippet was corrected (SMI-5893 Wave 11). {@link installCursorMcpConfig}
|
|
22
|
+
* now writes `buildCursorMcpEntryValue()` instead — resolved binary
|
|
23
|
+
* path (or the documented paste-here placeholder) plus
|
|
24
|
+
* `SKILLSMITH_CLIENT=cursor`.
|
|
25
|
+
* 2. The installer wrote its entry under the JSON key `skillsmith`, while
|
|
26
|
+
* the website/CLI-template docs snippet (which users are told to
|
|
27
|
+
* hand-paste) uses the package-scoped key `@skillsmith/mcp-server` — a
|
|
28
|
+
* user who did both ended up with TWO different server entries
|
|
29
|
+
* coexisting in the same file, neither ever recognized as "the
|
|
30
|
+
* other's" by the installer's own conflict-detection (which matches
|
|
31
|
+
* purely on key). {@link installCursorMcpConfig} now writes under
|
|
32
|
+
* `CURSOR_MCP_ENTRY_KEY` (`'@skillsmith/mcp-server'`) so a docs-paste
|
|
33
|
+
* and an `agent install` reconcile as ONE entry, and
|
|
34
|
+
* {@link stripStaleLegacyMcpKey} removes a pre-fix install's stale
|
|
35
|
+
* `'skillsmith'`-keyed entry (mirroring the cursor-hooks legacy-key
|
|
36
|
+
* cleanup precedent) so a re-install doesn't leave both keys present.
|
|
37
|
+
*
|
|
38
|
+
* Scoped to Cursor ONLY — `mergeJsonMcpEntry`'s default `entryKey`
|
|
39
|
+
* (`'skillsmith'`) and `buildAgentMcpEntryValue()`'s `npx` form are
|
|
40
|
+
* UNCHANGED for claude-code/copilot/windsurf/opencode/codex/hermes; nothing
|
|
41
|
+
* in this module is reachable from any other harness's install path.
|
|
42
|
+
*
|
|
43
|
+
* @module @skillsmith/core/install/agent-pack-installer.cursor-mcp
|
|
44
|
+
*/
|
|
45
|
+
import type { HarnessInstallCtx } from './agent-pack-installer.harness.js';
|
|
46
|
+
import type { HarnessInstallReport } from './agent-pack-installer.types.js';
|
|
47
|
+
/**
|
|
48
|
+
* Merge Cursor's `skillsmith` MCP server registration into `~/.cursor/mcp.json`
|
|
49
|
+
* under {@link CURSOR_MCP_ENTRY_KEY}, then clean up a stale legacy-keyed
|
|
50
|
+
* entry from a pre-SMI-6279 install (see module header).
|
|
51
|
+
*/
|
|
52
|
+
export declare function installCursorMcpConfig(ctx: HarnessInstallCtx, report: HarnessInstallReport): void;
|
|
53
|
+
//# sourceMappingURL=agent-pack-installer.cursor-mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-pack-installer.cursor-mcp.d.ts","sourceRoot":"","sources":["../../../src/install/agent-pack-installer.cursor-mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAeH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAQ3E;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,iBAAiB,EAAE,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAqDjG"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor-specific MCP registration step for `sklx agent install`
|
|
3
|
+
* (SMI-6279 Wave 9).
|
|
4
|
+
*
|
|
5
|
+
* Split out of `agent-pack-installer.harness.ts`'s generic `installMcpConfig`
|
|
6
|
+
* — mirrors the existing `agent-pack-installer.cursor-hooks.ts` split
|
|
7
|
+
* (SMI-5893 Wave 8a) for the same reason: Cursor's on-disk shape/resolution
|
|
8
|
+
* needs diverge structurally from the other 6 MCP-capable harnesses, so
|
|
9
|
+
* folding cursor-only logic into the shared function would either bloat it
|
|
10
|
+
* past the 500-line gate or force every other harness through cursor-only
|
|
11
|
+
* branches it doesn't need.
|
|
12
|
+
*
|
|
13
|
+
* Two independent, confirmed-broken things this fixes (GH#2368 V3 repro —
|
|
14
|
+
* see the SMI-6266 Wave 9 plan doc):
|
|
15
|
+
* 1. `buildAgentMcpEntryValue()` wrote the `npx`/`args` form into Cursor's
|
|
16
|
+
* `mcp.json` — the exact shape two live UAT passes proved ENOENTs
|
|
17
|
+
* inside Cursor's bundled Node (GH#2368 C-01) — and never set
|
|
18
|
+
* `SKILLSMITH_CLIENT`, so re-running `agent install` (the very
|
|
19
|
+
* remediation `formatUpdateNotification()` tells a user to run)
|
|
20
|
+
* silently rewrote the SAME broken entry, even after the website docs
|
|
21
|
+
* snippet was corrected (SMI-5893 Wave 11). {@link installCursorMcpConfig}
|
|
22
|
+
* now writes `buildCursorMcpEntryValue()` instead — resolved binary
|
|
23
|
+
* path (or the documented paste-here placeholder) plus
|
|
24
|
+
* `SKILLSMITH_CLIENT=cursor`.
|
|
25
|
+
* 2. The installer wrote its entry under the JSON key `skillsmith`, while
|
|
26
|
+
* the website/CLI-template docs snippet (which users are told to
|
|
27
|
+
* hand-paste) uses the package-scoped key `@skillsmith/mcp-server` — a
|
|
28
|
+
* user who did both ended up with TWO different server entries
|
|
29
|
+
* coexisting in the same file, neither ever recognized as "the
|
|
30
|
+
* other's" by the installer's own conflict-detection (which matches
|
|
31
|
+
* purely on key). {@link installCursorMcpConfig} now writes under
|
|
32
|
+
* `CURSOR_MCP_ENTRY_KEY` (`'@skillsmith/mcp-server'`) so a docs-paste
|
|
33
|
+
* and an `agent install` reconcile as ONE entry, and
|
|
34
|
+
* {@link stripStaleLegacyMcpKey} removes a pre-fix install's stale
|
|
35
|
+
* `'skillsmith'`-keyed entry (mirroring the cursor-hooks legacy-key
|
|
36
|
+
* cleanup precedent) so a re-install doesn't leave both keys present.
|
|
37
|
+
*
|
|
38
|
+
* Scoped to Cursor ONLY — `mergeJsonMcpEntry`'s default `entryKey`
|
|
39
|
+
* (`'skillsmith'`) and `buildAgentMcpEntryValue()`'s `npx` form are
|
|
40
|
+
* UNCHANGED for claude-code/copilot/windsurf/opencode/codex/hermes; nothing
|
|
41
|
+
* in this module is reachable from any other harness's install path.
|
|
42
|
+
*
|
|
43
|
+
* @module @skillsmith/core/install/agent-pack-installer.cursor-mcp
|
|
44
|
+
*/
|
|
45
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
46
|
+
import { AGENT_MCP_TARGETS } from './agent-harness-targets.js';
|
|
47
|
+
import { mergeJsonMcpEntry } from './agent-config-merge.json.js';
|
|
48
|
+
import { writeBackup } from './agent-config-merge.json-array.js';
|
|
49
|
+
import { deepEqualJson, markBackedUp, shouldBackup } from './agent-config-merge.types.js';
|
|
50
|
+
import { CURSOR_MCP_ENTRY_KEY, LEGACY_MCP_ENTRY_KEY, buildAgentMcpEntryValue, buildCursorMcpEntryValue, } from './agent-pack-installer.entry.js';
|
|
51
|
+
import { relocateUnderHome } from './agent-home-relocate.js';
|
|
52
|
+
/** Same predicate as `agent-pack-installer.harness.ts`'s private `mergeSucceeded` — duplicated rather than exported to keep that module's helper private. */
|
|
53
|
+
function mergeSucceeded(status) {
|
|
54
|
+
return status === 'created' || status === 'updated' || status === 'unchanged';
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Merge Cursor's `skillsmith` MCP server registration into `~/.cursor/mcp.json`
|
|
58
|
+
* under {@link CURSOR_MCP_ENTRY_KEY}, then clean up a stale legacy-keyed
|
|
59
|
+
* entry from a pre-SMI-6279 install (see module header).
|
|
60
|
+
*/
|
|
61
|
+
export function installCursorMcpConfig(ctx, report) {
|
|
62
|
+
const target = AGENT_MCP_TARGETS.cursor;
|
|
63
|
+
const path = relocateUnderHome(target.path, ctx.homeDir);
|
|
64
|
+
const entryValue = buildCursorMcpEntryValue();
|
|
65
|
+
const result = mergeJsonMcpEntry({
|
|
66
|
+
path,
|
|
67
|
+
keyPath: target.keyPath,
|
|
68
|
+
entryKey: CURSOR_MCP_ENTRY_KEY,
|
|
69
|
+
entryValue,
|
|
70
|
+
backupDir: ctx.backupDir,
|
|
71
|
+
force: ctx.force,
|
|
72
|
+
alreadyBackedUpPaths: ctx.backedUpPaths,
|
|
73
|
+
});
|
|
74
|
+
report.mcpConfig = result;
|
|
75
|
+
if (result.status === 'conflict') {
|
|
76
|
+
report.notes.push(`MCP config at ${path} already has a '${CURSOR_MCP_ENTRY_KEY}' entry that doesn't look like ours — left untouched. Re-run with --force to overwrite, or edit ${path} manually.`);
|
|
77
|
+
}
|
|
78
|
+
if (result.status === 'error') {
|
|
79
|
+
report.notes.push(`MCP config merge failed at ${path}: ${result.errorMessage}`);
|
|
80
|
+
}
|
|
81
|
+
// Only attempt the legacy-key cleanup once our own write succeeded (or was
|
|
82
|
+
// already correct) — same data-loss guard as the cursor-hooks precedent:
|
|
83
|
+
// a 'conflict'/'error' write means we deliberately left the file alone (or
|
|
84
|
+
// couldn't touch it), so removing the legacy key too would still mutate a
|
|
85
|
+
// file the real merge just refused to touch.
|
|
86
|
+
const cleanup = mergeSucceeded(result.status)
|
|
87
|
+
? stripStaleLegacyMcpKey(path, target.keyPath, ctx)
|
|
88
|
+
: null;
|
|
89
|
+
if (cleanup?.status === 'updated') {
|
|
90
|
+
report.notes.push(`Removed stale legacy '${LEGACY_MCP_ENTRY_KEY}' MCP entry at ${path} — superseded by '${CURSOR_MCP_ENTRY_KEY}' (aligns with the website/CLI docs snippet key, SMI-6279 Wave 9).`);
|
|
91
|
+
}
|
|
92
|
+
if (cleanup?.status === 'error') {
|
|
93
|
+
report.notes.push(`Found a stale legacy '${LEGACY_MCP_ENTRY_KEY}' MCP entry at ${path} but could not remove it: ${cleanup.errorMessage}. The new '${CURSOR_MCP_ENTRY_KEY}' entry above was written successfully; the stale entry was left in place — remove it manually.`);
|
|
94
|
+
}
|
|
95
|
+
if (mergeSucceeded(result.status) || cleanup?.status === 'updated') {
|
|
96
|
+
ctx.entries.push({
|
|
97
|
+
path,
|
|
98
|
+
kind: 'mcp-config',
|
|
99
|
+
harness: 'cursor',
|
|
100
|
+
backupPath: result.backupPath ?? cleanup?.backupPath ?? null,
|
|
101
|
+
executable: false,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Strict, purpose-built ownership fingerprint for the destructive delete in
|
|
107
|
+
* {@link stripStaleLegacyMcpKey} — deliberately NOT the shared
|
|
108
|
+
* `looksLikeOurMcpEntry` heuristic (`agent-config-merge.types.ts`).
|
|
109
|
+
*
|
|
110
|
+
* `looksLikeOurMcpEntry` is intentionally loose (substring-matches an
|
|
111
|
+
* `args` element, or merely checks a `SKILLSMITH_TOOL_PROFILE` key is
|
|
112
|
+
* PRESENT regardless of its value) because its only job is gating a
|
|
113
|
+
* same-key OVERWRITE — a false positive there is non-destructive, the
|
|
114
|
+
* entry we'd write next replaces whatever was there either way. Deleting a
|
|
115
|
+
* DIFFERENT key entirely (this function) is a strictly higher-risk
|
|
116
|
+
* operation: a false positive here permanently removes a user's config
|
|
117
|
+
* with nothing to replace it — e.g. a custom wrapper script whose `args`
|
|
118
|
+
* happen to reference the package name in one element among several, or a
|
|
119
|
+
* user's own hand-authored `skillsmith`-keyed entry that happens to set a
|
|
120
|
+
* `SKILLSMITH_TOOL_PROFILE` env var with a DIFFERENT value for unrelated
|
|
121
|
+
* reasons (code-review finding, GPT-5.6-Sol / SMI-6279).
|
|
122
|
+
*
|
|
123
|
+
* The bar here is "structurally identical to exactly what
|
|
124
|
+
* `buildAgentMcpEntryValue()` itself would have written" — checked via
|
|
125
|
+
* `deepEqualJson` against that function's actual return value (not a
|
|
126
|
+
* hand-duplicated literal, so this can never drift out of sync with the
|
|
127
|
+
* real shape): exact `command`, exact `args` sequence (not "contains"),
|
|
128
|
+
* exact `env` key SET (not just key presence) and exact value.
|
|
129
|
+
*/
|
|
130
|
+
function looksLikeExactLegacyNpxEntry(value) {
|
|
131
|
+
return deepEqualJson(value, buildAgentMcpEntryValue());
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Remove a stale `LEGACY_MCP_ENTRY_KEY` (`'skillsmith'`)-keyed MCP entry
|
|
135
|
+
* left behind by a pre-SMI-6279 `agent install` run, but ONLY when it is
|
|
136
|
+
* structurally IDENTICAL to what that installer itself would have written
|
|
137
|
+
* (`looksLikeExactLegacyNpxEntry` above). A user's own hand-written
|
|
138
|
+
* `skillsmith`-named entry — even one that superficially resembles ours —
|
|
139
|
+
* is left completely untouched — this never silently deletes a foreign or
|
|
140
|
+
* near-miss entry just because it shares the old key name.
|
|
141
|
+
*
|
|
142
|
+
* Read-modify-write is scoped to exactly the `mcpServers.skillsmith` key —
|
|
143
|
+
* every other key in the file (including the entry this function's caller
|
|
144
|
+
* just wrote under `CURSOR_MCP_ENTRY_KEY`) is preserved byte-for-byte.
|
|
145
|
+
*
|
|
146
|
+
* @returns `null` when there's genuinely nothing to clean up (file missing,
|
|
147
|
+
* no `mcpServers` object, no legacy key, or the legacy key isn't an EXACT
|
|
148
|
+
* match for our own legacy shape) — a real no-op, not surfaced as a report
|
|
149
|
+
* entry. A `MergeResult` with `status: 'updated'` when the legacy key was
|
|
150
|
+
* removed, or `status: 'error'` when a match WAS found but reading,
|
|
151
|
+
* backing up, or writing the file failed — this must reach the caller as
|
|
152
|
+
* a reported failure, not collapse into the same `null` "nothing to do"
|
|
153
|
+
* return as the routine no-match case (PR-07 finding, GPT-5.6-Sol /
|
|
154
|
+
* SMI-6279): a swallowed write failure here would silently leave a
|
|
155
|
+
* confirmed-stale, confirmed-broken legacy entry in place with no
|
|
156
|
+
* indication anything went wrong.
|
|
157
|
+
*/
|
|
158
|
+
function stripStaleLegacyMcpKey(path, keyPath, ctx) {
|
|
159
|
+
if (!existsSync(path))
|
|
160
|
+
return null;
|
|
161
|
+
let doc;
|
|
162
|
+
try {
|
|
163
|
+
const parsed = JSON.parse(readFileSync(path, 'utf-8'));
|
|
164
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
165
|
+
return null;
|
|
166
|
+
doc = parsed;
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
// Unparsable/unreadable — not a match we can act on either way; the
|
|
170
|
+
// main merge above already succeeded reading+writing this same file
|
|
171
|
+
// moments earlier, so this is a genuine no-op, not a swallowed failure.
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
const containerKey = keyPath[0];
|
|
175
|
+
if (containerKey === undefined)
|
|
176
|
+
return null;
|
|
177
|
+
const container = doc[containerKey];
|
|
178
|
+
if (!container || typeof container !== 'object' || Array.isArray(container))
|
|
179
|
+
return null;
|
|
180
|
+
const containerObj = container;
|
|
181
|
+
const legacyEntry = containerObj[LEGACY_MCP_ENTRY_KEY];
|
|
182
|
+
if (legacyEntry === undefined)
|
|
183
|
+
return null;
|
|
184
|
+
// Foreign OR near-miss — never touch, even if named 'skillsmith'.
|
|
185
|
+
if (!looksLikeExactLegacyNpxEntry(legacyEntry))
|
|
186
|
+
return null;
|
|
187
|
+
// Past this point we've confirmed a real match to delete — any failure
|
|
188
|
+
// from here on is a genuine error, not a no-op, and must be reported.
|
|
189
|
+
try {
|
|
190
|
+
delete containerObj[LEGACY_MCP_ENTRY_KEY];
|
|
191
|
+
const backupPath = shouldBackup(path, ctx.backedUpPaths)
|
|
192
|
+
? writeBackup(path, ctx.backupDir)
|
|
193
|
+
: null;
|
|
194
|
+
markBackedUp(path, ctx.backedUpPaths);
|
|
195
|
+
writeFileSync(path, JSON.stringify(doc, null, 2) + '\n', { mode: 0o600 });
|
|
196
|
+
return { status: 'updated', path, backupPath };
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
return {
|
|
200
|
+
status: 'error',
|
|
201
|
+
path,
|
|
202
|
+
backupPath: null,
|
|
203
|
+
errorMessage: error instanceof Error ? error.message : String(error),
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=agent-pack-installer.cursor-mcp.js.map
|