gsd-pi 2.20.0 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/cli.js +21 -18
- package/dist/help-text.d.ts +2 -0
- package/dist/help-text.js +47 -0
- package/dist/loader.js +2 -16
- package/dist/mcp-server.d.ts +18 -0
- package/dist/mcp-server.js +53 -0
- package/dist/onboarding.d.ts +0 -6
- package/dist/onboarding.js +0 -28
- package/dist/resources/agents/javascript-pro.md +280 -0
- package/dist/resources/agents/typescript-pro.md +255 -0
- package/dist/resources/extensions/bg-shell/index.ts +14 -2
- package/dist/resources/extensions/bg-shell/utilities.ts +14 -0
- package/dist/resources/extensions/browser-tools/{core.js → core.ts} +329 -190
- package/dist/resources/extensions/gsd/auto-dashboard.ts +2 -1
- package/dist/resources/extensions/gsd/auto-prompts.ts +42 -1
- package/dist/resources/extensions/gsd/auto-worktree.ts +35 -2
- package/dist/resources/extensions/gsd/auto.ts +116 -10
- package/dist/resources/extensions/gsd/claude-import.ts +656 -0
- package/dist/resources/extensions/gsd/collision-diagnostics.ts +332 -0
- package/dist/resources/extensions/gsd/commands.ts +60 -7
- package/dist/resources/extensions/gsd/diff-context.ts +220 -0
- package/dist/resources/extensions/gsd/docs/claude-marketplace-import.md +214 -0
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +2 -1
- package/dist/resources/extensions/gsd/doctor.ts +12 -4
- package/dist/resources/extensions/gsd/file-watcher.ts +97 -0
- package/dist/resources/extensions/gsd/files.ts +1 -1
- package/dist/resources/extensions/gsd/forensics.ts +596 -0
- package/dist/resources/extensions/gsd/git-service.ts +2 -1
- package/dist/resources/extensions/gsd/github-client.ts +235 -0
- package/dist/resources/extensions/gsd/gitignore.ts +1 -0
- package/dist/resources/extensions/gsd/marketplace-discovery.ts +507 -0
- package/dist/resources/extensions/gsd/mcp-server.ts +87 -0
- package/dist/resources/extensions/gsd/namespaced-registry.ts +467 -0
- package/dist/resources/extensions/gsd/namespaced-resolver.ts +307 -0
- package/dist/resources/extensions/gsd/plugin-importer.ts +410 -0
- package/dist/resources/extensions/gsd/preferences.ts +14 -3
- package/dist/resources/extensions/gsd/prompts/execute-task.md +1 -1
- package/dist/resources/extensions/gsd/prompts/forensics.md +71 -0
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/research-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/system.md +12 -3
- package/dist/resources/extensions/gsd/roadmap-slices.ts +1 -1
- package/dist/resources/extensions/gsd/session-forensics.ts +5 -5
- package/dist/resources/extensions/gsd/tests/claude-import-tui.test.ts +351 -0
- package/dist/resources/extensions/gsd/tests/collision-diagnostics.test.ts +705 -0
- package/dist/resources/extensions/gsd/tests/context-compression.test.ts +13 -0
- package/dist/resources/extensions/gsd/tests/diff-context.test.ts +136 -0
- package/dist/resources/extensions/gsd/tests/doctor-git.test.ts +118 -0
- package/dist/resources/extensions/gsd/tests/marketplace-discovery.test.ts +202 -0
- package/dist/resources/extensions/gsd/tests/marketplace-test-fixtures.ts +91 -0
- package/dist/resources/extensions/gsd/tests/namespaced-registry.test.ts +1027 -0
- package/dist/resources/extensions/gsd/tests/namespaced-resolver.test.ts +671 -0
- package/dist/resources/extensions/gsd/tests/none-mode-gates.test.ts +105 -0
- package/dist/resources/extensions/gsd/tests/plugin-importer-live.test.ts +481 -0
- package/dist/resources/extensions/gsd/tests/plugin-importer.test.ts +1383 -0
- package/dist/resources/extensions/gsd/tests/preferences-git.test.ts +21 -2
- package/dist/resources/extensions/gsd/tests/preferences-schema-validation.test.ts +8 -1
- package/dist/resources/extensions/gsd/tests/visualizer-data.test.ts +11 -0
- package/dist/resources/extensions/gsd/tests/worktree-bugfix.test.ts +120 -0
- package/dist/resources/extensions/gsd/token-counter.ts +45 -0
- package/dist/resources/extensions/gsd/visualizer-data.ts +2 -2
- package/dist/resources/extensions/gsd/worktree-manager.ts +29 -1
- package/dist/resources/extensions/gsd/worktree.ts +3 -0
- package/dist/resources/extensions/mcporter/index.ts +90 -7
- package/dist/resources/extensions/search-the-web/native-search.ts +2 -0
- package/dist/resources/extensions/search-the-web/tool-fetch-page.ts +9 -1
- package/dist/resources/extensions/search-the-web/url-utils.ts +35 -1
- package/dist/resources/extensions/shared/terminal.ts +1 -1
- package/dist/resources/extensions/universal-config/discovery.ts +4 -0
- package/dist/resources/extensions/universal-config/format.ts +35 -4
- package/dist/resources/extensions/universal-config/index.ts +5 -3
- package/dist/resources/extensions/universal-config/scanners.ts +65 -2
- package/dist/resources/extensions/universal-config/tests/discovery.test.ts +9 -1
- package/dist/resources/extensions/universal-config/tests/format.test.ts +22 -6
- package/dist/resources/extensions/universal-config/tests/scanners.test.ts +18 -0
- package/dist/resources/extensions/universal-config/types.ts +20 -1
- package/dist/resources/skills/lint/SKILL.md +141 -0
- package/dist/resources/skills/review/SKILL.md +214 -0
- package/dist/resources/skills/test/SKILL.md +201 -0
- package/dist/tool-bootstrap.js +2 -1
- package/dist/wizard.js +2 -0
- package/package.json +12 -7
- package/packages/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/azure-openai-responses.js +12 -1
- package/packages/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.js +12 -1
- package/packages/pi-ai/dist/providers/openai-responses.js.map +1 -1
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/LICENSE +201 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/README.md +9 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-cjs/index.js +762 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +19 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/constants.js +1 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +9 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +230 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +87 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +32 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +169 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/readable.mock.js +21 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/server.mock.js +88 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +36 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +21 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +22 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +23 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js +8 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js +41 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/readable.mock.js +21 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/timing.js +4 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +63 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/build-abort-error.d.ts +10 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/constants.d.ts +5 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/get-transformed-headers.d.ts +4 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/index.d.ts +3 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +46 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +24 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +12 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +63 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/readable.mock.d.ts +13 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/server.mock.d.ts +12 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +2 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-request-timeout.d.ts +6 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +6 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +2 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/collector.d.ts +5 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/index.d.ts +6 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/readable.mock.d.ts +13 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/timing.d.ts +8 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/build-abort-error.d.ts +10 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/constants.d.ts +5 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/get-transformed-headers.d.ts +4 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/index.d.ts +3 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +46 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-manager.d.ts +24 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-pool.d.ts +12 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-handler.d.ts +63 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/readable.mock.d.ts +13 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/server.mock.d.ts +12 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +2 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-request-timeout.d.ts +6 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +6 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +2 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/collector.d.ts +5 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/index.d.ts +6 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/readable.mock.d.ts +13 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/timing.d.ts +8 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/write-request-body.d.ts +12 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/write-request-body.d.ts +12 -0
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/package.json +68 -0
- package/packages/pi-ai/package.json +3 -0
- package/packages/pi-ai/pnpm-lock.yaml +2022 -0
- package/packages/pi-ai/src/providers/azure-openai-responses.ts +12 -1
- package/packages/pi-ai/src/providers/openai-responses.ts +12 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +12 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.test.js +113 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/project-trust.d.ts +4 -0
- package/packages/pi-coding-agent/dist/core/extensions/project-trust.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/project-trust.js +42 -0
- package/packages/pi-coding-agent/dist/core/extensions/project-trust.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/resolve-config-value.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/resolve-config-value.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/resolve-config-value.js +18 -0
- package/packages/pi-coding-agent/dist/core/resolve-config-value.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/resolve-config-value.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/resolve-config-value.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/resolve-config-value.test.js +114 -0
- package/packages/pi-coding-agent/dist/core/resolve-config-value.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +8 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.d.ts +2 -0
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.js +23 -9
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.js.map +1 -1
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.test.js +67 -0
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.test.js.map +1 -0
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/pnpm-lock.yaml +454 -0
- package/packages/pi-coding-agent/scripts/copy-assets.cjs +24 -0
- package/packages/pi-coding-agent/src/core/extensions/index.ts +3 -0
- package/packages/pi-coding-agent/src/core/extensions/loader.test.ts +141 -0
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +14 -1
- package/packages/pi-coding-agent/src/core/extensions/project-trust.ts +51 -0
- package/packages/pi-coding-agent/src/core/resolve-config-value.test.ts +132 -0
- package/packages/pi-coding-agent/src/core/resolve-config-value.ts +20 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/login-dialog.ts +7 -2
- package/packages/pi-coding-agent/src/resources/extensions/memory/storage.test.ts +98 -0
- package/packages/pi-coding-agent/src/resources/extensions/memory/storage.ts +24 -9
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +2 -2
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/package.json +3 -1
- package/packages/pi-tui/src/tui.ts +2 -2
- package/src/resources/agents/javascript-pro.md +280 -0
- package/src/resources/agents/typescript-pro.md +255 -0
- package/src/resources/extensions/bg-shell/index.ts +14 -2
- package/src/resources/extensions/bg-shell/utilities.ts +14 -0
- package/src/resources/extensions/browser-tools/{core.js → core.ts} +329 -190
- package/src/resources/extensions/gsd/auto-dashboard.ts +2 -1
- package/src/resources/extensions/gsd/auto-prompts.ts +42 -1
- package/src/resources/extensions/gsd/auto-worktree.ts +35 -2
- package/src/resources/extensions/gsd/auto.ts +116 -10
- package/src/resources/extensions/gsd/claude-import.ts +656 -0
- package/src/resources/extensions/gsd/collision-diagnostics.ts +332 -0
- package/src/resources/extensions/gsd/commands.ts +60 -7
- package/src/resources/extensions/gsd/diff-context.ts +220 -0
- package/src/resources/extensions/gsd/docs/claude-marketplace-import.md +214 -0
- package/src/resources/extensions/gsd/docs/preferences-reference.md +2 -1
- package/src/resources/extensions/gsd/doctor.ts +12 -4
- package/src/resources/extensions/gsd/file-watcher.ts +97 -0
- package/src/resources/extensions/gsd/files.ts +1 -1
- package/src/resources/extensions/gsd/forensics.ts +596 -0
- package/src/resources/extensions/gsd/git-service.ts +2 -1
- package/src/resources/extensions/gsd/github-client.ts +235 -0
- package/src/resources/extensions/gsd/gitignore.ts +1 -0
- package/src/resources/extensions/gsd/marketplace-discovery.ts +507 -0
- package/src/resources/extensions/gsd/mcp-server.ts +87 -0
- package/src/resources/extensions/gsd/namespaced-registry.ts +467 -0
- package/src/resources/extensions/gsd/namespaced-resolver.ts +307 -0
- package/src/resources/extensions/gsd/plugin-importer.ts +410 -0
- package/src/resources/extensions/gsd/preferences.ts +14 -3
- package/src/resources/extensions/gsd/prompts/execute-task.md +1 -1
- package/src/resources/extensions/gsd/prompts/forensics.md +71 -0
- package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/research-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/system.md +12 -3
- package/src/resources/extensions/gsd/roadmap-slices.ts +1 -1
- package/src/resources/extensions/gsd/session-forensics.ts +5 -5
- package/src/resources/extensions/gsd/tests/claude-import-tui.test.ts +351 -0
- package/src/resources/extensions/gsd/tests/collision-diagnostics.test.ts +705 -0
- package/src/resources/extensions/gsd/tests/context-compression.test.ts +13 -0
- package/src/resources/extensions/gsd/tests/diff-context.test.ts +136 -0
- package/src/resources/extensions/gsd/tests/doctor-git.test.ts +118 -0
- package/src/resources/extensions/gsd/tests/marketplace-discovery.test.ts +202 -0
- package/src/resources/extensions/gsd/tests/marketplace-test-fixtures.ts +91 -0
- package/src/resources/extensions/gsd/tests/namespaced-registry.test.ts +1027 -0
- package/src/resources/extensions/gsd/tests/namespaced-resolver.test.ts +671 -0
- package/src/resources/extensions/gsd/tests/none-mode-gates.test.ts +105 -0
- package/src/resources/extensions/gsd/tests/plugin-importer-live.test.ts +481 -0
- package/src/resources/extensions/gsd/tests/plugin-importer.test.ts +1383 -0
- package/src/resources/extensions/gsd/tests/preferences-git.test.ts +21 -2
- package/src/resources/extensions/gsd/tests/preferences-schema-validation.test.ts +8 -1
- package/src/resources/extensions/gsd/tests/visualizer-data.test.ts +11 -0
- package/src/resources/extensions/gsd/tests/worktree-bugfix.test.ts +120 -0
- package/src/resources/extensions/gsd/token-counter.ts +45 -0
- package/src/resources/extensions/gsd/visualizer-data.ts +2 -2
- package/src/resources/extensions/gsd/worktree-manager.ts +29 -1
- package/src/resources/extensions/gsd/worktree.ts +3 -0
- package/src/resources/extensions/mcporter/index.ts +90 -7
- package/src/resources/extensions/search-the-web/native-search.ts +2 -0
- package/src/resources/extensions/search-the-web/tool-fetch-page.ts +9 -1
- package/src/resources/extensions/search-the-web/url-utils.ts +35 -1
- package/src/resources/extensions/shared/terminal.ts +1 -1
- package/src/resources/extensions/universal-config/discovery.ts +4 -0
- package/src/resources/extensions/universal-config/format.ts +35 -4
- package/src/resources/extensions/universal-config/index.ts +5 -3
- package/src/resources/extensions/universal-config/scanners.ts +65 -2
- package/src/resources/extensions/universal-config/tests/discovery.test.ts +9 -1
- package/src/resources/extensions/universal-config/tests/format.test.ts +22 -6
- package/src/resources/extensions/universal-config/tests/scanners.test.ts +18 -0
- package/src/resources/extensions/universal-config/types.ts +20 -1
- package/src/resources/skills/lint/SKILL.md +141 -0
- package/src/resources/skills/review/SKILL.md +214 -0
- package/src/resources/skills/test/SKILL.md +201 -0
- package/dist/resources/extensions/browser-tools/core.d.ts +0 -205
- package/src/resources/extensions/browser-tools/core.d.ts +0 -205
|
@@ -0,0 +1,1027 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Namespaced Registry Contract Tests
|
|
3
|
+
*
|
|
4
|
+
* Tests that prove the namespaced registry correctly handles:
|
|
5
|
+
* - Canonical identity (R004)
|
|
6
|
+
* - Canonical skill lookup (R005)
|
|
7
|
+
* - Canonical agent lookup (R006)
|
|
8
|
+
* - Flat compatibility
|
|
9
|
+
* - Collision detection
|
|
10
|
+
* - Namespace listing
|
|
11
|
+
* - Integration with S01 discovery types
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { describe, it, beforeEach } from 'node:test';
|
|
15
|
+
import assert from 'node:assert';
|
|
16
|
+
import {
|
|
17
|
+
NamespacedRegistry,
|
|
18
|
+
componentsFromDiscovery,
|
|
19
|
+
} from '../namespaced-registry.js';
|
|
20
|
+
import type { DiscoveredPlugin } from '../marketplace-discovery.js';
|
|
21
|
+
|
|
22
|
+
describe('NamespacedRegistry', () => {
|
|
23
|
+
let registry: NamespacedRegistry;
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
registry = new NamespacedRegistry();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
describe('canonical registration and lookup', () => {
|
|
30
|
+
it('should register a namespaced skill and compute canonical name (R004, R005)', () => {
|
|
31
|
+
const diagnostic = registry.register({
|
|
32
|
+
name: 'my-skill',
|
|
33
|
+
namespace: 'my-plugin',
|
|
34
|
+
type: 'skill',
|
|
35
|
+
filePath: '/plugins/my-plugin/skills/my-skill/SKILL.md',
|
|
36
|
+
source: 'plugin:my-plugin',
|
|
37
|
+
description: 'A test skill',
|
|
38
|
+
metadata: { pluginVersion: '1.0.0' },
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// No collision diagnostic expected
|
|
42
|
+
assert.strictEqual(diagnostic, undefined);
|
|
43
|
+
|
|
44
|
+
// Verify registration succeeded
|
|
45
|
+
assert.strictEqual(registry.size, 1);
|
|
46
|
+
assert.strictEqual(registry.has('my-plugin:my-skill'), true);
|
|
47
|
+
|
|
48
|
+
// Lookup by canonical name
|
|
49
|
+
const component = registry.getByCanonical('my-plugin:my-skill');
|
|
50
|
+
assert.ok(component !== undefined);
|
|
51
|
+
|
|
52
|
+
// Verify canonical identity preserved (R004)
|
|
53
|
+
assert.strictEqual(component.name, 'my-skill');
|
|
54
|
+
assert.strictEqual(component.namespace, 'my-plugin');
|
|
55
|
+
assert.strictEqual(component.canonicalName, 'my-plugin:my-skill');
|
|
56
|
+
assert.strictEqual(component.type, 'skill');
|
|
57
|
+
assert.strictEqual(component.filePath, '/plugins/my-plugin/skills/my-skill/SKILL.md');
|
|
58
|
+
assert.strictEqual(component.source, 'plugin:my-plugin');
|
|
59
|
+
assert.strictEqual(component.description, 'A test skill');
|
|
60
|
+
assert.strictEqual(component.metadata.pluginVersion, '1.0.0');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('should register a namespaced agent and compute canonical name (R006)', () => {
|
|
64
|
+
const diagnostic = registry.register({
|
|
65
|
+
name: 'abby',
|
|
66
|
+
namespace: 'farm',
|
|
67
|
+
type: 'agent',
|
|
68
|
+
filePath: '/plugins/farm/agents/abby/AGENT.md',
|
|
69
|
+
source: 'plugin:farm',
|
|
70
|
+
description: 'A farm agent',
|
|
71
|
+
metadata: { pluginAuthor: 'farm-team' },
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
assert.strictEqual(diagnostic, undefined);
|
|
75
|
+
assert.strictEqual(registry.size, 1);
|
|
76
|
+
|
|
77
|
+
// Lookup by canonical name (R006)
|
|
78
|
+
const agent = registry.getByCanonical('farm:abby');
|
|
79
|
+
assert.ok(agent !== undefined);
|
|
80
|
+
|
|
81
|
+
// Verify canonical identity (R004)
|
|
82
|
+
assert.strictEqual(agent.name, 'abby');
|
|
83
|
+
assert.strictEqual(agent.namespace, 'farm');
|
|
84
|
+
assert.strictEqual(agent.canonicalName, 'farm:abby');
|
|
85
|
+
assert.strictEqual(agent.type, 'agent');
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('should return undefined for non-existent canonical name', () => {
|
|
89
|
+
const result = registry.getByCanonical('nonexistent:skill');
|
|
90
|
+
assert.strictEqual(result, undefined);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe('flat (non-namespaced) compatibility', () => {
|
|
95
|
+
it('should register flat component with bare name as canonical', () => {
|
|
96
|
+
const diagnostic = registry.register({
|
|
97
|
+
name: 'code-review',
|
|
98
|
+
namespace: undefined,
|
|
99
|
+
type: 'skill',
|
|
100
|
+
filePath: '/skills/code-review/SKILL.md',
|
|
101
|
+
source: 'user',
|
|
102
|
+
description: 'A flat skill',
|
|
103
|
+
metadata: {},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
assert.strictEqual(diagnostic, undefined);
|
|
107
|
+
|
|
108
|
+
// Lookup by bare name (no namespace prefix)
|
|
109
|
+
const skill = registry.getByCanonical('code-review');
|
|
110
|
+
assert.ok(skill !== undefined);
|
|
111
|
+
assert.strictEqual(skill.name, 'code-review');
|
|
112
|
+
assert.strictEqual(skill.namespace, undefined);
|
|
113
|
+
assert.strictEqual(skill.canonicalName, 'code-review');
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('should retrieve flat component by bare name', () => {
|
|
117
|
+
registry.register({
|
|
118
|
+
name: 'test-skill',
|
|
119
|
+
namespace: undefined,
|
|
120
|
+
type: 'skill',
|
|
121
|
+
filePath: '/skills/test-skill/SKILL.md',
|
|
122
|
+
source: 'project',
|
|
123
|
+
description: undefined,
|
|
124
|
+
metadata: {},
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const skill = registry.getByCanonical('test-skill');
|
|
128
|
+
assert.ok(skill !== undefined);
|
|
129
|
+
assert.strictEqual(skill.canonicalName, 'test-skill');
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
describe('collision detection', () => {
|
|
134
|
+
it('should detect collision on duplicate canonical name and emit diagnostic', () => {
|
|
135
|
+
// First registration wins
|
|
136
|
+
const first = registry.register({
|
|
137
|
+
name: 'code-review',
|
|
138
|
+
namespace: 'my-plugin',
|
|
139
|
+
type: 'skill',
|
|
140
|
+
filePath: '/plugins/my-plugin/skills/code-review/SKILL.md',
|
|
141
|
+
source: 'plugin:my-plugin',
|
|
142
|
+
description: 'First skill',
|
|
143
|
+
metadata: {},
|
|
144
|
+
});
|
|
145
|
+
assert.strictEqual(first, undefined);
|
|
146
|
+
|
|
147
|
+
// Second registration collides
|
|
148
|
+
const second = registry.register({
|
|
149
|
+
name: 'code-review',
|
|
150
|
+
namespace: 'my-plugin',
|
|
151
|
+
type: 'skill',
|
|
152
|
+
filePath: '/plugins/other-plugin/skills/code-review/SKILL.md',
|
|
153
|
+
source: 'plugin:other-plugin',
|
|
154
|
+
description: 'Second skill',
|
|
155
|
+
metadata: {},
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// Should return collision diagnostic
|
|
159
|
+
assert.ok(second !== undefined);
|
|
160
|
+
assert.strictEqual(second.type, 'collision');
|
|
161
|
+
assert.strictEqual(second.message, 'canonical name "my-plugin:code-review" collision');
|
|
162
|
+
|
|
163
|
+
// Verify collision details
|
|
164
|
+
assert.strictEqual(second.collision.canonicalName, 'my-plugin:code-review');
|
|
165
|
+
assert.strictEqual(second.collision.winnerPath, '/plugins/my-plugin/skills/code-review/SKILL.md');
|
|
166
|
+
assert.strictEqual(second.collision.loserPath, '/plugins/other-plugin/skills/code-review/SKILL.md');
|
|
167
|
+
assert.strictEqual(second.collision.winnerSource, 'plugin:my-plugin');
|
|
168
|
+
assert.strictEqual(second.collision.loserSource, 'plugin:other-plugin');
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it('should preserve first-wins behavior on collision', () => {
|
|
172
|
+
// Register first
|
|
173
|
+
registry.register({
|
|
174
|
+
name: 'skill',
|
|
175
|
+
namespace: 'ns',
|
|
176
|
+
type: 'skill',
|
|
177
|
+
filePath: '/first/SKILL.md',
|
|
178
|
+
source: 'first',
|
|
179
|
+
description: 'First description',
|
|
180
|
+
metadata: { key: 'first-value' },
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// Attempt duplicate
|
|
184
|
+
registry.register({
|
|
185
|
+
name: 'skill',
|
|
186
|
+
namespace: 'ns',
|
|
187
|
+
type: 'skill',
|
|
188
|
+
filePath: '/second/SKILL.md',
|
|
189
|
+
source: 'second',
|
|
190
|
+
description: 'Second description',
|
|
191
|
+
metadata: { key: 'second-value' },
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// First registration wins
|
|
195
|
+
const component = registry.getByCanonical('ns:skill');
|
|
196
|
+
assert.ok(component !== undefined);
|
|
197
|
+
assert.strictEqual(component.filePath, '/first/SKILL.md');
|
|
198
|
+
assert.strictEqual(component.source, 'first');
|
|
199
|
+
assert.strictEqual(component.description, 'First description');
|
|
200
|
+
assert.strictEqual(component.metadata.key, 'first-value');
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it('should collect multiple collision diagnostics', () => {
|
|
204
|
+
// First registrations
|
|
205
|
+
registry.register({
|
|
206
|
+
name: 'skill-a',
|
|
207
|
+
namespace: 'plugin-x',
|
|
208
|
+
type: 'skill',
|
|
209
|
+
filePath: '/x/a.md',
|
|
210
|
+
source: 'x',
|
|
211
|
+
description: undefined,
|
|
212
|
+
metadata: {},
|
|
213
|
+
});
|
|
214
|
+
registry.register({
|
|
215
|
+
name: 'skill-b',
|
|
216
|
+
namespace: 'plugin-y',
|
|
217
|
+
type: 'skill',
|
|
218
|
+
filePath: '/y/b.md',
|
|
219
|
+
source: 'y',
|
|
220
|
+
description: undefined,
|
|
221
|
+
metadata: {},
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// Collisions
|
|
225
|
+
registry.register({
|
|
226
|
+
name: 'skill-a',
|
|
227
|
+
namespace: 'plugin-x',
|
|
228
|
+
type: 'skill',
|
|
229
|
+
filePath: '/z/a.md',
|
|
230
|
+
source: 'z',
|
|
231
|
+
description: undefined,
|
|
232
|
+
metadata: {},
|
|
233
|
+
});
|
|
234
|
+
registry.register({
|
|
235
|
+
name: 'skill-b',
|
|
236
|
+
namespace: 'plugin-y',
|
|
237
|
+
type: 'skill',
|
|
238
|
+
filePath: '/w/b.md',
|
|
239
|
+
source: 'w',
|
|
240
|
+
description: undefined,
|
|
241
|
+
metadata: {},
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
const diagnostics = registry.getDiagnostics();
|
|
245
|
+
assert.strictEqual(diagnostics.length, 2);
|
|
246
|
+
assert.strictEqual(diagnostics[0].collision.canonicalName, 'plugin-x:skill-a');
|
|
247
|
+
assert.strictEqual(diagnostics[1].collision.canonicalName, 'plugin-y:skill-b');
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it('should allow same name in different namespaces', () => {
|
|
251
|
+
// Same name, different namespace
|
|
252
|
+
registry.register({
|
|
253
|
+
name: 'code-review',
|
|
254
|
+
namespace: 'plugin-a',
|
|
255
|
+
type: 'skill',
|
|
256
|
+
filePath: '/a/code-review.md',
|
|
257
|
+
source: 'plugin:plugin-a',
|
|
258
|
+
description: undefined,
|
|
259
|
+
metadata: {},
|
|
260
|
+
});
|
|
261
|
+
registry.register({
|
|
262
|
+
name: 'code-review',
|
|
263
|
+
namespace: 'plugin-b',
|
|
264
|
+
type: 'skill',
|
|
265
|
+
filePath: '/b/code-review.md',
|
|
266
|
+
source: 'plugin:plugin-b',
|
|
267
|
+
description: undefined,
|
|
268
|
+
metadata: {},
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
// Both should be registered
|
|
272
|
+
assert.strictEqual(registry.size, 2);
|
|
273
|
+
|
|
274
|
+
const a = registry.getByCanonical('plugin-a:code-review');
|
|
275
|
+
const b = registry.getByCanonical('plugin-b:code-review');
|
|
276
|
+
|
|
277
|
+
assert.ok(a !== undefined);
|
|
278
|
+
assert.ok(b !== undefined);
|
|
279
|
+
assert.strictEqual(a.filePath, '/a/code-review.md');
|
|
280
|
+
assert.strictEqual(b.filePath, '/b/code-review.md');
|
|
281
|
+
|
|
282
|
+
// No collisions
|
|
283
|
+
assert.strictEqual(registry.getDiagnostics().length, 0);
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
it('should allow flat and namespaced components with same local name', () => {
|
|
287
|
+
// Flat component
|
|
288
|
+
registry.register({
|
|
289
|
+
name: 'code-review',
|
|
290
|
+
namespace: undefined,
|
|
291
|
+
type: 'skill',
|
|
292
|
+
filePath: '/flat/code-review.md',
|
|
293
|
+
source: 'user',
|
|
294
|
+
description: undefined,
|
|
295
|
+
metadata: {},
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
// Namespaced component with same local name
|
|
299
|
+
registry.register({
|
|
300
|
+
name: 'code-review',
|
|
301
|
+
namespace: 'plugin',
|
|
302
|
+
type: 'skill',
|
|
303
|
+
filePath: '/plugin/code-review.md',
|
|
304
|
+
source: 'plugin:plugin',
|
|
305
|
+
description: undefined,
|
|
306
|
+
metadata: {},
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
// Both should be accessible
|
|
310
|
+
const flat = registry.getByCanonical('code-review');
|
|
311
|
+
const namespaced = registry.getByCanonical('plugin:code-review');
|
|
312
|
+
|
|
313
|
+
assert.ok(flat !== undefined);
|
|
314
|
+
assert.ok(namespaced !== undefined);
|
|
315
|
+
assert.strictEqual(flat.namespace, undefined);
|
|
316
|
+
assert.strictEqual(namespaced.namespace, 'plugin');
|
|
317
|
+
|
|
318
|
+
assert.strictEqual(registry.getDiagnostics().length, 0);
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
describe('namespace listing', () => {
|
|
323
|
+
it('should list all components in a namespace via getByNamespace', () => {
|
|
324
|
+
// Register multiple components in plugin-a
|
|
325
|
+
registry.register({
|
|
326
|
+
name: 'skill-1',
|
|
327
|
+
namespace: 'plugin-a',
|
|
328
|
+
type: 'skill',
|
|
329
|
+
filePath: '/a/skill-1.md',
|
|
330
|
+
source: 'plugin:plugin-a',
|
|
331
|
+
description: undefined,
|
|
332
|
+
metadata: {},
|
|
333
|
+
});
|
|
334
|
+
registry.register({
|
|
335
|
+
name: 'skill-2',
|
|
336
|
+
namespace: 'plugin-a',
|
|
337
|
+
type: 'skill',
|
|
338
|
+
filePath: '/a/skill-2.md',
|
|
339
|
+
source: 'plugin:plugin-a',
|
|
340
|
+
description: undefined,
|
|
341
|
+
metadata: {},
|
|
342
|
+
});
|
|
343
|
+
registry.register({
|
|
344
|
+
name: 'agent-1',
|
|
345
|
+
namespace: 'plugin-a',
|
|
346
|
+
type: 'agent',
|
|
347
|
+
filePath: '/a/agent-1.md',
|
|
348
|
+
source: 'plugin:plugin-a',
|
|
349
|
+
description: undefined,
|
|
350
|
+
metadata: {},
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
// Register component in different namespace
|
|
354
|
+
registry.register({
|
|
355
|
+
name: 'skill-3',
|
|
356
|
+
namespace: 'plugin-b',
|
|
357
|
+
type: 'skill',
|
|
358
|
+
filePath: '/b/skill-3.md',
|
|
359
|
+
source: 'plugin:plugin-b',
|
|
360
|
+
description: undefined,
|
|
361
|
+
metadata: {},
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
const pluginAComponents = registry.getByNamespace('plugin-a');
|
|
365
|
+
assert.strictEqual(pluginAComponents.length, 3);
|
|
366
|
+
|
|
367
|
+
const names = pluginAComponents.map((c) => c.name).sort();
|
|
368
|
+
assert.deepStrictEqual(names, ['agent-1', 'skill-1', 'skill-2']);
|
|
369
|
+
|
|
370
|
+
// All should have correct namespace
|
|
371
|
+
assert.ok(pluginAComponents.every((c) => c.namespace === 'plugin-a'));
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
it('should return empty array for non-existent namespace', () => {
|
|
375
|
+
const result = registry.getByNamespace('nonexistent');
|
|
376
|
+
assert.deepStrictEqual(result, []);
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
it('should not include flat components in namespace listing', () => {
|
|
380
|
+
// Flat component
|
|
381
|
+
registry.register({
|
|
382
|
+
name: 'flat-skill',
|
|
383
|
+
namespace: undefined,
|
|
384
|
+
type: 'skill',
|
|
385
|
+
filePath: '/flat.md',
|
|
386
|
+
source: 'user',
|
|
387
|
+
description: undefined,
|
|
388
|
+
metadata: {},
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
// Namespaced component
|
|
392
|
+
registry.register({
|
|
393
|
+
name: 'ns-skill',
|
|
394
|
+
namespace: 'plugin',
|
|
395
|
+
type: 'skill',
|
|
396
|
+
filePath: '/plugin/ns-skill.md',
|
|
397
|
+
source: 'plugin:plugin',
|
|
398
|
+
description: undefined,
|
|
399
|
+
metadata: {},
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
// Flat components have namespace=undefined, not included
|
|
403
|
+
const pluginComponents = registry.getByNamespace('plugin');
|
|
404
|
+
assert.strictEqual(pluginComponents.length, 1);
|
|
405
|
+
assert.strictEqual(pluginComponents[0].name, 'ns-skill');
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
describe('mixed coexistence', () => {
|
|
410
|
+
it('should allow both namespaced and flat components without interference', () => {
|
|
411
|
+
// Flat skill
|
|
412
|
+
registry.register({
|
|
413
|
+
name: 'review',
|
|
414
|
+
namespace: undefined,
|
|
415
|
+
type: 'skill',
|
|
416
|
+
filePath: '/skills/review/SKILL.md',
|
|
417
|
+
source: 'user',
|
|
418
|
+
description: 'User skill',
|
|
419
|
+
metadata: {},
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
// Namespaced skill
|
|
423
|
+
registry.register({
|
|
424
|
+
name: 'review',
|
|
425
|
+
namespace: 'my-plugin',
|
|
426
|
+
type: 'skill',
|
|
427
|
+
filePath: '/plugins/my-plugin/skills/review/SKILL.md',
|
|
428
|
+
source: 'plugin:my-plugin',
|
|
429
|
+
description: 'Plugin skill',
|
|
430
|
+
metadata: { pluginVersion: '1.0.0' },
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
// Namespaced agent
|
|
434
|
+
registry.register({
|
|
435
|
+
name: 'builder',
|
|
436
|
+
namespace: 'my-plugin',
|
|
437
|
+
type: 'agent',
|
|
438
|
+
filePath: '/plugins/my-plugin/agents/builder/AGENT.md',
|
|
439
|
+
source: 'plugin:my-plugin',
|
|
440
|
+
description: 'Plugin agent',
|
|
441
|
+
metadata: {},
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
// Flat agent
|
|
445
|
+
registry.register({
|
|
446
|
+
name: 'assistant',
|
|
447
|
+
namespace: undefined,
|
|
448
|
+
type: 'agent',
|
|
449
|
+
filePath: '/agents/assistant/AGENT.md',
|
|
450
|
+
source: 'project',
|
|
451
|
+
description: 'Project agent',
|
|
452
|
+
metadata: {},
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
// Verify total count
|
|
456
|
+
assert.strictEqual(registry.size, 4);
|
|
457
|
+
|
|
458
|
+
// Flat skill
|
|
459
|
+
const flatSkill = registry.getByCanonical('review');
|
|
460
|
+
assert.ok(flatSkill !== undefined);
|
|
461
|
+
assert.strictEqual(flatSkill.namespace, undefined);
|
|
462
|
+
assert.strictEqual(flatSkill.type, 'skill');
|
|
463
|
+
|
|
464
|
+
// Namespaced skill
|
|
465
|
+
const nsSkill = registry.getByCanonical('my-plugin:review');
|
|
466
|
+
assert.ok(nsSkill !== undefined);
|
|
467
|
+
assert.strictEqual(nsSkill.namespace, 'my-plugin');
|
|
468
|
+
assert.strictEqual(nsSkill.type, 'skill');
|
|
469
|
+
|
|
470
|
+
// Namespaced agent
|
|
471
|
+
const nsAgent = registry.getByCanonical('my-plugin:builder');
|
|
472
|
+
assert.ok(nsAgent !== undefined);
|
|
473
|
+
assert.strictEqual(nsAgent.namespace, 'my-plugin');
|
|
474
|
+
assert.strictEqual(nsAgent.type, 'agent');
|
|
475
|
+
|
|
476
|
+
// Flat agent
|
|
477
|
+
const flatAgent = registry.getByCanonical('assistant');
|
|
478
|
+
assert.ok(flatAgent !== undefined);
|
|
479
|
+
assert.strictEqual(flatAgent.namespace, undefined);
|
|
480
|
+
assert.strictEqual(flatAgent.type, 'agent');
|
|
481
|
+
|
|
482
|
+
// Namespace listing
|
|
483
|
+
const myPluginComponents = registry.getByNamespace('my-plugin');
|
|
484
|
+
assert.strictEqual(myPluginComponents.length, 2);
|
|
485
|
+
|
|
486
|
+
// No collisions
|
|
487
|
+
assert.strictEqual(registry.getDiagnostics().length, 0);
|
|
488
|
+
});
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
describe('getAll and has', () => {
|
|
492
|
+
it('should return all components via getAll', () => {
|
|
493
|
+
registry.register({
|
|
494
|
+
name: 'skill-1',
|
|
495
|
+
namespace: 'plugin-a',
|
|
496
|
+
type: 'skill',
|
|
497
|
+
filePath: '/a/s1.md',
|
|
498
|
+
source: 'a',
|
|
499
|
+
description: undefined,
|
|
500
|
+
metadata: {},
|
|
501
|
+
});
|
|
502
|
+
registry.register({
|
|
503
|
+
name: 'skill-2',
|
|
504
|
+
namespace: undefined,
|
|
505
|
+
type: 'skill',
|
|
506
|
+
filePath: '/s2.md',
|
|
507
|
+
source: 'user',
|
|
508
|
+
description: undefined,
|
|
509
|
+
metadata: {},
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
const all = registry.getAll();
|
|
513
|
+
assert.strictEqual(all.length, 2);
|
|
514
|
+
|
|
515
|
+
const canonicalNames = all.map((c) => c.canonicalName).sort();
|
|
516
|
+
assert.deepStrictEqual(canonicalNames, ['plugin-a:skill-1', 'skill-2']);
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
it('should check existence via has', () => {
|
|
520
|
+
registry.register({
|
|
521
|
+
name: 'test',
|
|
522
|
+
namespace: 'ns',
|
|
523
|
+
type: 'skill',
|
|
524
|
+
filePath: '/test.md',
|
|
525
|
+
source: 'test',
|
|
526
|
+
description: undefined,
|
|
527
|
+
metadata: {},
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
assert.strictEqual(registry.has('ns:test'), true);
|
|
531
|
+
assert.strictEqual(registry.has('ns:other'), false);
|
|
532
|
+
assert.strictEqual(registry.has('test'), false);
|
|
533
|
+
});
|
|
534
|
+
});
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
describe('componentsFromDiscovery', () => {
|
|
538
|
+
it('should convert DiscoveredPlugin to registerable components', () => {
|
|
539
|
+
const mockPlugin: DiscoveredPlugin = {
|
|
540
|
+
name: 'test-plugin',
|
|
541
|
+
canonicalName: 'test-plugin',
|
|
542
|
+
source: './plugins/test-plugin',
|
|
543
|
+
resolvedPath: '/plugins/test-plugin',
|
|
544
|
+
status: 'ok',
|
|
545
|
+
manifestSource: 'plugin.json',
|
|
546
|
+
description: 'A test plugin',
|
|
547
|
+
version: '1.0.0',
|
|
548
|
+
author: { name: 'Test Author' },
|
|
549
|
+
category: 'testing',
|
|
550
|
+
homepage: 'https://example.com/test-plugin',
|
|
551
|
+
inventory: {
|
|
552
|
+
skills: ['skill-a', 'skill-b'],
|
|
553
|
+
agents: ['agent-x'],
|
|
554
|
+
commands: [],
|
|
555
|
+
mcpServers: {},
|
|
556
|
+
lspServers: {},
|
|
557
|
+
hooks: [],
|
|
558
|
+
},
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
const components = componentsFromDiscovery(mockPlugin);
|
|
562
|
+
|
|
563
|
+
// Should have 3 components (2 skills + 1 agent)
|
|
564
|
+
assert.strictEqual(components.length, 3);
|
|
565
|
+
|
|
566
|
+
// All should have the plugin's canonical name as namespace
|
|
567
|
+
assert.ok(components.every((c) => c.namespace === 'test-plugin'));
|
|
568
|
+
|
|
569
|
+
// Verify skills
|
|
570
|
+
const skills = components.filter((c) => c.type === 'skill');
|
|
571
|
+
assert.strictEqual(skills.length, 2);
|
|
572
|
+
|
|
573
|
+
const skillNames = skills.map((c) => c.name).sort();
|
|
574
|
+
assert.deepStrictEqual(skillNames, ['skill-a', 'skill-b']);
|
|
575
|
+
|
|
576
|
+
// Verify agents
|
|
577
|
+
const agents = components.filter((c) => c.type === 'agent');
|
|
578
|
+
assert.strictEqual(agents.length, 1);
|
|
579
|
+
assert.strictEqual(agents[0].name, 'agent-x');
|
|
580
|
+
|
|
581
|
+
// Verify metadata propagation
|
|
582
|
+
assert.strictEqual(skills[0].metadata.pluginVersion, '1.0.0');
|
|
583
|
+
assert.strictEqual(skills[0].metadata.pluginAuthor, 'Test Author');
|
|
584
|
+
assert.strictEqual(skills[0].metadata.pluginHomepage, 'https://example.com/test-plugin');
|
|
585
|
+
assert.strictEqual(skills[0].metadata.pluginCategory, 'testing');
|
|
586
|
+
|
|
587
|
+
// Verify source format
|
|
588
|
+
assert.strictEqual(skills[0].source, 'plugin:test-plugin');
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
it('should handle plugin without resolvedPath (external plugin)', () => {
|
|
592
|
+
const externalPlugin: DiscoveredPlugin = {
|
|
593
|
+
name: 'external-plugin',
|
|
594
|
+
canonicalName: 'external-plugin',
|
|
595
|
+
source: { source: 'github', repo: 'example/plugin' },
|
|
596
|
+
resolvedPath: null, // External - not locally resolved
|
|
597
|
+
status: 'ok',
|
|
598
|
+
manifestSource: 'marketplace-inline',
|
|
599
|
+
description: 'An external plugin',
|
|
600
|
+
inventory: {
|
|
601
|
+
skills: ['remote-skill'],
|
|
602
|
+
agents: [],
|
|
603
|
+
commands: [],
|
|
604
|
+
mcpServers: {},
|
|
605
|
+
lspServers: {},
|
|
606
|
+
hooks: [],
|
|
607
|
+
},
|
|
608
|
+
};
|
|
609
|
+
|
|
610
|
+
const components = componentsFromDiscovery(externalPlugin);
|
|
611
|
+
|
|
612
|
+
assert.strictEqual(components.length, 1);
|
|
613
|
+
assert.strictEqual(components[0].name, 'remote-skill');
|
|
614
|
+
assert.strictEqual(components[0].namespace, 'external-plugin');
|
|
615
|
+
assert.ok(components[0].filePath.includes('<external>'));
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
it('should produce components that can be registered in NamespacedRegistry', () => {
|
|
619
|
+
const mockPlugin: DiscoveredPlugin = {
|
|
620
|
+
name: 'integration-plugin',
|
|
621
|
+
canonicalName: 'integration-plugin',
|
|
622
|
+
source: './plugins/integration',
|
|
623
|
+
resolvedPath: '/plugins/integration',
|
|
624
|
+
status: 'ok',
|
|
625
|
+
manifestSource: 'plugin.json',
|
|
626
|
+
inventory: {
|
|
627
|
+
skills: ['int-skill'],
|
|
628
|
+
agents: ['int-agent'],
|
|
629
|
+
commands: [],
|
|
630
|
+
mcpServers: {},
|
|
631
|
+
lspServers: {},
|
|
632
|
+
hooks: [],
|
|
633
|
+
},
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
const registry = new NamespacedRegistry();
|
|
637
|
+
const components = componentsFromDiscovery(mockPlugin);
|
|
638
|
+
|
|
639
|
+
// Register all components
|
|
640
|
+
for (const component of components) {
|
|
641
|
+
const diag = registry.register(component);
|
|
642
|
+
assert.strictEqual(diag, undefined, 'No collision expected');
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
// Verify registration
|
|
646
|
+
assert.strictEqual(registry.size, 2);
|
|
647
|
+
assert.ok(registry.has('integration-plugin:int-skill'));
|
|
648
|
+
assert.ok(registry.has('integration-plugin:int-agent'));
|
|
649
|
+
|
|
650
|
+
// Lookup and verify
|
|
651
|
+
const skill = registry.getByCanonical('integration-plugin:int-skill');
|
|
652
|
+
assert.ok(skill !== undefined);
|
|
653
|
+
assert.strictEqual(skill.type, 'skill');
|
|
654
|
+
|
|
655
|
+
const agent = registry.getByCanonical('integration-plugin:int-agent');
|
|
656
|
+
assert.ok(agent !== undefined);
|
|
657
|
+
assert.strictEqual(agent.type, 'agent');
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
it('should strip .md extension from skill/agent names if present', () => {
|
|
661
|
+
const pluginWithMd: DiscoveredPlugin = {
|
|
662
|
+
name: 'md-plugin',
|
|
663
|
+
canonicalName: 'md-plugin',
|
|
664
|
+
source: './plugins/md',
|
|
665
|
+
resolvedPath: '/plugins/md',
|
|
666
|
+
status: 'ok',
|
|
667
|
+
manifestSource: 'derived',
|
|
668
|
+
inventory: {
|
|
669
|
+
skills: ['skill.md'], // .md extension in inventory
|
|
670
|
+
agents: ['agent.md'],
|
|
671
|
+
commands: [],
|
|
672
|
+
mcpServers: {},
|
|
673
|
+
lspServers: {},
|
|
674
|
+
hooks: [],
|
|
675
|
+
},
|
|
676
|
+
};
|
|
677
|
+
|
|
678
|
+
const components = componentsFromDiscovery(pluginWithMd);
|
|
679
|
+
|
|
680
|
+
const skill = components.find((c) => c.type === 'skill');
|
|
681
|
+
const agent = components.find((c) => c.type === 'agent');
|
|
682
|
+
|
|
683
|
+
assert.ok(skill !== undefined);
|
|
684
|
+
assert.ok(agent !== undefined);
|
|
685
|
+
assert.strictEqual(skill.name, 'skill'); // .md stripped
|
|
686
|
+
assert.strictEqual(agent.name, 'agent'); // .md stripped
|
|
687
|
+
});
|
|
688
|
+
});
|
|
689
|
+
|
|
690
|
+
describe('diagnostic structure verification', () => {
|
|
691
|
+
it('should emit diagnostic with correct RegistryCollision shape', () => {
|
|
692
|
+
const registry = new NamespacedRegistry();
|
|
693
|
+
|
|
694
|
+
registry.register({
|
|
695
|
+
name: 'dup',
|
|
696
|
+
namespace: 'ns',
|
|
697
|
+
type: 'skill',
|
|
698
|
+
filePath: '/first/dup.md',
|
|
699
|
+
source: 'first-source',
|
|
700
|
+
description: undefined,
|
|
701
|
+
metadata: {},
|
|
702
|
+
});
|
|
703
|
+
|
|
704
|
+
const diag = registry.register({
|
|
705
|
+
name: 'dup',
|
|
706
|
+
namespace: 'ns',
|
|
707
|
+
type: 'skill',
|
|
708
|
+
filePath: '/second/dup.md',
|
|
709
|
+
source: 'second-source',
|
|
710
|
+
description: undefined,
|
|
711
|
+
metadata: {},
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
assert.ok(diag !== undefined);
|
|
715
|
+
|
|
716
|
+
// Verify diagnostic type
|
|
717
|
+
assert.strictEqual(diag.type, 'collision');
|
|
718
|
+
|
|
719
|
+
// Verify message format
|
|
720
|
+
assert.ok(diag.message.includes('ns:dup'));
|
|
721
|
+
assert.ok(diag.message.includes('collision'));
|
|
722
|
+
|
|
723
|
+
// Verify collision object structure
|
|
724
|
+
assert.strictEqual(diag.collision.canonicalName, 'ns:dup');
|
|
725
|
+
assert.strictEqual(diag.collision.winnerPath, '/first/dup.md');
|
|
726
|
+
assert.strictEqual(diag.collision.loserPath, '/second/dup.md');
|
|
727
|
+
assert.strictEqual(diag.collision.winnerSource, 'first-source');
|
|
728
|
+
assert.strictEqual(diag.collision.loserSource, 'second-source');
|
|
729
|
+
});
|
|
730
|
+
|
|
731
|
+
it('should provide inspectable diagnostics via getDiagnostics', () => {
|
|
732
|
+
const registry = new NamespacedRegistry();
|
|
733
|
+
|
|
734
|
+
// Create collision
|
|
735
|
+
registry.register({
|
|
736
|
+
name: 'skill',
|
|
737
|
+
namespace: 'plugin',
|
|
738
|
+
type: 'skill',
|
|
739
|
+
filePath: '/a/skill.md',
|
|
740
|
+
source: 'a',
|
|
741
|
+
description: undefined,
|
|
742
|
+
metadata: {},
|
|
743
|
+
});
|
|
744
|
+
registry.register({
|
|
745
|
+
name: 'skill',
|
|
746
|
+
namespace: 'plugin',
|
|
747
|
+
type: 'skill',
|
|
748
|
+
filePath: '/b/skill.md',
|
|
749
|
+
source: 'b',
|
|
750
|
+
description: undefined,
|
|
751
|
+
metadata: {},
|
|
752
|
+
});
|
|
753
|
+
|
|
754
|
+
const diagnostics = registry.getDiagnostics();
|
|
755
|
+
|
|
756
|
+
assert.strictEqual(diagnostics.length, 1);
|
|
757
|
+
|
|
758
|
+
// Verify diagnostic is a copy (not mutable reference)
|
|
759
|
+
diagnostics[0].message = 'modified';
|
|
760
|
+
const freshDiagnostics = registry.getDiagnostics();
|
|
761
|
+
assert.strictEqual(freshDiagnostics[0].message, 'canonical name "plugin:skill" collision');
|
|
762
|
+
});
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
describe('alias management', () => {
|
|
766
|
+
let registry: NamespacedRegistry;
|
|
767
|
+
|
|
768
|
+
beforeEach(() => {
|
|
769
|
+
registry = new NamespacedRegistry();
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
describe('registerAlias', () => {
|
|
773
|
+
it('should register an alias for an existing canonical name', () => {
|
|
774
|
+
registry.register({
|
|
775
|
+
name: '3d-visualizer',
|
|
776
|
+
namespace: 'python-tools',
|
|
777
|
+
type: 'skill',
|
|
778
|
+
filePath: '/python-tools/3d-visualizer/SKILL.md',
|
|
779
|
+
source: 'plugin:python-tools',
|
|
780
|
+
description: '3D visualization',
|
|
781
|
+
metadata: {},
|
|
782
|
+
});
|
|
783
|
+
|
|
784
|
+
const result = registry.registerAlias('py3d', 'python-tools:3d-visualizer');
|
|
785
|
+
|
|
786
|
+
assert.strictEqual(result.success, true);
|
|
787
|
+
assert.strictEqual(registry.hasAlias('py3d'), true);
|
|
788
|
+
assert.strictEqual(registry.resolveAlias('py3d'), 'python-tools:3d-visualizer');
|
|
789
|
+
});
|
|
790
|
+
|
|
791
|
+
it('should reject alias if target canonical name does not exist', () => {
|
|
792
|
+
const result = registry.registerAlias('py3d', 'nonexistent:skill');
|
|
793
|
+
|
|
794
|
+
assert.strictEqual(result.success, false);
|
|
795
|
+
assert.strictEqual(result.reason, 'canonical-not-found');
|
|
796
|
+
assert.ok(result.message?.includes('does not exist'));
|
|
797
|
+
});
|
|
798
|
+
|
|
799
|
+
it('should reject alias that shadows an existing canonical name', () => {
|
|
800
|
+
registry.register({
|
|
801
|
+
name: 'existing',
|
|
802
|
+
namespace: 'plugin',
|
|
803
|
+
type: 'skill',
|
|
804
|
+
filePath: '/plugin/existing/SKILL.md',
|
|
805
|
+
source: 'plugin:plugin',
|
|
806
|
+
description: 'Existing skill',
|
|
807
|
+
metadata: {},
|
|
808
|
+
});
|
|
809
|
+
registry.register({
|
|
810
|
+
name: 'other',
|
|
811
|
+
namespace: 'plugin',
|
|
812
|
+
type: 'skill',
|
|
813
|
+
filePath: '/plugin/other/SKILL.md',
|
|
814
|
+
source: 'plugin:plugin',
|
|
815
|
+
description: 'Other skill',
|
|
816
|
+
metadata: {},
|
|
817
|
+
});
|
|
818
|
+
|
|
819
|
+
// Try to create alias that matches an existing canonical name
|
|
820
|
+
const result = registry.registerAlias('plugin:existing', 'plugin:other');
|
|
821
|
+
|
|
822
|
+
assert.strictEqual(result.success, false);
|
|
823
|
+
assert.strictEqual(result.reason, 'shadows-canonical');
|
|
824
|
+
assert.ok(result.message?.includes('shadows an existing canonical name'));
|
|
825
|
+
});
|
|
826
|
+
|
|
827
|
+
it('should reject duplicate alias pointing to different target', () => {
|
|
828
|
+
registry.register({
|
|
829
|
+
name: 'skill-a',
|
|
830
|
+
namespace: 'plugin',
|
|
831
|
+
type: 'skill',
|
|
832
|
+
filePath: '/plugin/skill-a/SKILL.md',
|
|
833
|
+
source: 'plugin:plugin',
|
|
834
|
+
description: 'Skill A',
|
|
835
|
+
metadata: {},
|
|
836
|
+
});
|
|
837
|
+
registry.register({
|
|
838
|
+
name: 'skill-b',
|
|
839
|
+
namespace: 'plugin',
|
|
840
|
+
type: 'skill',
|
|
841
|
+
filePath: '/plugin/skill-b/SKILL.md',
|
|
842
|
+
source: 'plugin:plugin',
|
|
843
|
+
description: 'Skill B',
|
|
844
|
+
metadata: {},
|
|
845
|
+
});
|
|
846
|
+
|
|
847
|
+
// First alias succeeds
|
|
848
|
+
const first = registry.registerAlias('shortcut', 'plugin:skill-a');
|
|
849
|
+
assert.strictEqual(first.success, true);
|
|
850
|
+
|
|
851
|
+
// Second alias with same name but different target fails
|
|
852
|
+
const second = registry.registerAlias('shortcut', 'plugin:skill-b');
|
|
853
|
+
assert.strictEqual(second.success, false);
|
|
854
|
+
assert.strictEqual(second.reason, 'duplicate-alias');
|
|
855
|
+
assert.ok(second.message?.includes('already exists'));
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
it('should be idempotent for same alias and target', () => {
|
|
859
|
+
registry.register({
|
|
860
|
+
name: 'skill',
|
|
861
|
+
namespace: 'plugin',
|
|
862
|
+
type: 'skill',
|
|
863
|
+
filePath: '/plugin/skill/SKILL.md',
|
|
864
|
+
source: 'plugin:plugin',
|
|
865
|
+
description: 'Skill',
|
|
866
|
+
metadata: {},
|
|
867
|
+
});
|
|
868
|
+
|
|
869
|
+
// Register alias twice with same target
|
|
870
|
+
const first = registry.registerAlias('s', 'plugin:skill');
|
|
871
|
+
assert.strictEqual(first.success, true);
|
|
872
|
+
|
|
873
|
+
const second = registry.registerAlias('s', 'plugin:skill');
|
|
874
|
+
assert.strictEqual(second.success, true);
|
|
875
|
+
});
|
|
876
|
+
|
|
877
|
+
it('should allow multiple aliases for same canonical name', () => {
|
|
878
|
+
registry.register({
|
|
879
|
+
name: 'visualizer',
|
|
880
|
+
namespace: 'python-tools',
|
|
881
|
+
type: 'skill',
|
|
882
|
+
filePath: '/python-tools/visualizer/SKILL.md',
|
|
883
|
+
source: 'plugin:python-tools',
|
|
884
|
+
description: 'Visualizer',
|
|
885
|
+
metadata: {},
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
const r1 = registry.registerAlias('pyviz', 'python-tools:visualizer');
|
|
889
|
+
const r2 = registry.registerAlias('viz', 'python-tools:visualizer');
|
|
890
|
+
const r3 = registry.registerAlias('py3d', 'python-tools:visualizer');
|
|
891
|
+
|
|
892
|
+
assert.strictEqual(r1.success, true);
|
|
893
|
+
assert.strictEqual(r2.success, true);
|
|
894
|
+
assert.strictEqual(r3.success, true);
|
|
895
|
+
|
|
896
|
+
assert.strictEqual(registry.resolveAlias('pyviz'), 'python-tools:visualizer');
|
|
897
|
+
assert.strictEqual(registry.resolveAlias('viz'), 'python-tools:visualizer');
|
|
898
|
+
assert.strictEqual(registry.resolveAlias('py3d'), 'python-tools:visualizer');
|
|
899
|
+
});
|
|
900
|
+
});
|
|
901
|
+
|
|
902
|
+
describe('resolveAlias', () => {
|
|
903
|
+
it('should resolve registered alias to canonical name', () => {
|
|
904
|
+
registry.register({
|
|
905
|
+
name: 'skill',
|
|
906
|
+
namespace: 'ns',
|
|
907
|
+
type: 'skill',
|
|
908
|
+
filePath: '/ns/skill/SKILL.md',
|
|
909
|
+
source: 'plugin:ns',
|
|
910
|
+
description: 'Skill',
|
|
911
|
+
metadata: {},
|
|
912
|
+
});
|
|
913
|
+
registry.registerAlias('s', 'ns:skill');
|
|
914
|
+
|
|
915
|
+
assert.strictEqual(registry.resolveAlias('s'), 'ns:skill');
|
|
916
|
+
});
|
|
917
|
+
|
|
918
|
+
it('should return undefined for non-existent alias', () => {
|
|
919
|
+
assert.strictEqual(registry.resolveAlias('nonexistent'), undefined);
|
|
920
|
+
});
|
|
921
|
+
});
|
|
922
|
+
|
|
923
|
+
describe('removeAlias', () => {
|
|
924
|
+
it('should remove an existing alias', () => {
|
|
925
|
+
registry.register({
|
|
926
|
+
name: 'skill',
|
|
927
|
+
namespace: 'ns',
|
|
928
|
+
type: 'skill',
|
|
929
|
+
filePath: '/ns/skill/SKILL.md',
|
|
930
|
+
source: 'plugin:ns',
|
|
931
|
+
description: 'Skill',
|
|
932
|
+
metadata: {},
|
|
933
|
+
});
|
|
934
|
+
registry.registerAlias('s', 'ns:skill');
|
|
935
|
+
|
|
936
|
+
assert.strictEqual(registry.hasAlias('s'), true);
|
|
937
|
+
|
|
938
|
+
const removed = registry.removeAlias('s');
|
|
939
|
+
assert.strictEqual(removed, true);
|
|
940
|
+
assert.strictEqual(registry.hasAlias('s'), false);
|
|
941
|
+
assert.strictEqual(registry.resolveAlias('s'), undefined);
|
|
942
|
+
});
|
|
943
|
+
|
|
944
|
+
it('should return false for non-existent alias', () => {
|
|
945
|
+
const removed = registry.removeAlias('nonexistent');
|
|
946
|
+
assert.strictEqual(removed, false);
|
|
947
|
+
});
|
|
948
|
+
});
|
|
949
|
+
|
|
950
|
+
describe('getAliases', () => {
|
|
951
|
+
it('should return empty map when no aliases registered', () => {
|
|
952
|
+
const aliases = registry.getAliases();
|
|
953
|
+
assert.strictEqual(aliases.size, 0);
|
|
954
|
+
});
|
|
955
|
+
|
|
956
|
+
it('should return copy of alias map', () => {
|
|
957
|
+
registry.register({
|
|
958
|
+
name: 'skill',
|
|
959
|
+
namespace: 'ns',
|
|
960
|
+
type: 'skill',
|
|
961
|
+
filePath: '/ns/skill/SKILL.md',
|
|
962
|
+
source: 'plugin:ns',
|
|
963
|
+
description: 'Skill',
|
|
964
|
+
metadata: {},
|
|
965
|
+
});
|
|
966
|
+
registry.registerAlias('s', 'ns:skill');
|
|
967
|
+
|
|
968
|
+
const aliases = registry.getAliases();
|
|
969
|
+
assert.strictEqual(aliases.size, 1);
|
|
970
|
+
assert.strictEqual(aliases.get('s'), 'ns:skill');
|
|
971
|
+
|
|
972
|
+
// Mutating returned map should not affect registry
|
|
973
|
+
aliases.set('other', 'ns:other');
|
|
974
|
+
assert.strictEqual(registry.hasAlias('other'), false);
|
|
975
|
+
});
|
|
976
|
+
|
|
977
|
+
it('should include all registered aliases', () => {
|
|
978
|
+
registry.register({
|
|
979
|
+
name: 'skill-a',
|
|
980
|
+
namespace: 'ns',
|
|
981
|
+
type: 'skill',
|
|
982
|
+
filePath: '/ns/a/SKILL.md',
|
|
983
|
+
source: 'plugin:ns',
|
|
984
|
+
description: 'A',
|
|
985
|
+
metadata: {},
|
|
986
|
+
});
|
|
987
|
+
registry.register({
|
|
988
|
+
name: 'skill-b',
|
|
989
|
+
namespace: 'ns',
|
|
990
|
+
type: 'skill',
|
|
991
|
+
filePath: '/ns/b/SKILL.md',
|
|
992
|
+
source: 'plugin:ns',
|
|
993
|
+
description: 'B',
|
|
994
|
+
metadata: {},
|
|
995
|
+
});
|
|
996
|
+
|
|
997
|
+
registry.registerAlias('sa', 'ns:skill-a');
|
|
998
|
+
registry.registerAlias('sb', 'ns:skill-b');
|
|
999
|
+
|
|
1000
|
+
const aliases = registry.getAliases();
|
|
1001
|
+
assert.strictEqual(aliases.size, 2);
|
|
1002
|
+
assert.strictEqual(aliases.get('sa'), 'ns:skill-a');
|
|
1003
|
+
assert.strictEqual(aliases.get('sb'), 'ns:skill-b');
|
|
1004
|
+
});
|
|
1005
|
+
});
|
|
1006
|
+
|
|
1007
|
+
describe('hasAlias', () => {
|
|
1008
|
+
it('should return true for registered alias', () => {
|
|
1009
|
+
registry.register({
|
|
1010
|
+
name: 'skill',
|
|
1011
|
+
namespace: 'ns',
|
|
1012
|
+
type: 'skill',
|
|
1013
|
+
filePath: '/ns/skill/SKILL.md',
|
|
1014
|
+
source: 'plugin:ns',
|
|
1015
|
+
description: 'Skill',
|
|
1016
|
+
metadata: {},
|
|
1017
|
+
});
|
|
1018
|
+
registry.registerAlias('s', 'ns:skill');
|
|
1019
|
+
|
|
1020
|
+
assert.strictEqual(registry.hasAlias('s'), true);
|
|
1021
|
+
});
|
|
1022
|
+
|
|
1023
|
+
it('should return false for non-existent alias', () => {
|
|
1024
|
+
assert.strictEqual(registry.hasAlias('nonexistent'), false);
|
|
1025
|
+
});
|
|
1026
|
+
});
|
|
1027
|
+
});
|