@agents-inc/cli 0.32.1
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 +462 -0
- package/LICENSE +21 -0
- package/README.md +179 -0
- package/config/skills-matrix.yaml +926 -0
- package/config/stacks.yaml +2186 -0
- package/dist/chunk-3ZOIOVKT.js +365 -0
- package/dist/chunk-3ZOIOVKT.js.map +1 -0
- package/dist/chunk-4RAY5AOI.js +78 -0
- package/dist/chunk-4RAY5AOI.js.map +1 -0
- package/dist/chunk-5PIKNCZX.js +234 -0
- package/dist/chunk-5PIKNCZX.js.map +1 -0
- package/dist/chunk-66UDJBF6.js +96 -0
- package/dist/chunk-66UDJBF6.js.map +1 -0
- package/dist/chunk-7SOPVGDV.js +24 -0
- package/dist/chunk-7SOPVGDV.js.map +1 -0
- package/dist/chunk-A27LOC4Z.js +95 -0
- package/dist/chunk-A27LOC4Z.js.map +1 -0
- package/dist/chunk-B2UBHA66.js +301 -0
- package/dist/chunk-B2UBHA66.js.map +1 -0
- package/dist/chunk-BZN2Z5P7.js +882 -0
- package/dist/chunk-BZN2Z5P7.js.map +1 -0
- package/dist/chunk-BZQBJP34.js +186 -0
- package/dist/chunk-BZQBJP34.js.map +1 -0
- package/dist/chunk-DC5AK3LW.js +105 -0
- package/dist/chunk-DC5AK3LW.js.map +1 -0
- package/dist/chunk-DHET7RCE.js +50 -0
- package/dist/chunk-DHET7RCE.js.map +1 -0
- package/dist/chunk-EMJ2ZKS7.js +346 -0
- package/dist/chunk-EMJ2ZKS7.js.map +1 -0
- package/dist/chunk-FJQRVFMB.js +48 -0
- package/dist/chunk-FJQRVFMB.js.map +1 -0
- package/dist/chunk-FZGYSLJL.js +85 -0
- package/dist/chunk-FZGYSLJL.js.map +1 -0
- package/dist/chunk-H566H3MQ.js +87 -0
- package/dist/chunk-H566H3MQ.js.map +1 -0
- package/dist/chunk-IYG2LAIM.js +90 -0
- package/dist/chunk-IYG2LAIM.js.map +1 -0
- package/dist/chunk-IZZ4IIEG.js +29 -0
- package/dist/chunk-IZZ4IIEG.js.map +1 -0
- package/dist/chunk-JMVWYAHT.js +63 -0
- package/dist/chunk-JMVWYAHT.js.map +1 -0
- package/dist/chunk-LAPCUV4D.js +191 -0
- package/dist/chunk-LAPCUV4D.js.map +1 -0
- package/dist/chunk-LGUI3PMO.js +109 -0
- package/dist/chunk-LGUI3PMO.js.map +1 -0
- package/dist/chunk-MM7NK5N2.js +4542 -0
- package/dist/chunk-MM7NK5N2.js.map +1 -0
- package/dist/chunk-N6S7ZRIL.js +31 -0
- package/dist/chunk-N6S7ZRIL.js.map +1 -0
- package/dist/chunk-O4D67NN7.js +24 -0
- package/dist/chunk-O4D67NN7.js.map +1 -0
- package/dist/chunk-ODUOU55D.js +56 -0
- package/dist/chunk-ODUOU55D.js.map +1 -0
- package/dist/chunk-OGJIZ6QH.js +497 -0
- package/dist/chunk-OGJIZ6QH.js.map +1 -0
- package/dist/chunk-OMV7TLWD.js +340 -0
- package/dist/chunk-OMV7TLWD.js.map +1 -0
- package/dist/chunk-PBEHPQLK.js +146 -0
- package/dist/chunk-PBEHPQLK.js.map +1 -0
- package/dist/chunk-QPTOIZAT.js +32 -0
- package/dist/chunk-QPTOIZAT.js.map +1 -0
- package/dist/chunk-R3XFQKPG.js +111 -0
- package/dist/chunk-R3XFQKPG.js.map +1 -0
- package/dist/chunk-R74PZWQS.js +69 -0
- package/dist/chunk-R74PZWQS.js.map +1 -0
- package/dist/chunk-SO22IQPY.js +45 -0
- package/dist/chunk-SO22IQPY.js.map +1 -0
- package/dist/chunk-T4EXUIBY.js +19 -0
- package/dist/chunk-T4EXUIBY.js.map +1 -0
- package/dist/chunk-U3IGFMCY.js +31 -0
- package/dist/chunk-U3IGFMCY.js.map +1 -0
- package/dist/chunk-UICL22RT.js +318 -0
- package/dist/chunk-UICL22RT.js.map +1 -0
- package/dist/chunk-UX2H2K2G.js +183 -0
- package/dist/chunk-UX2H2K2G.js.map +1 -0
- package/dist/chunk-W2ZSCZ2U.js +93 -0
- package/dist/chunk-W2ZSCZ2U.js.map +1 -0
- package/dist/chunk-WEUVWHMA.js +189 -0
- package/dist/chunk-WEUVWHMA.js.map +1 -0
- package/dist/chunk-XY3XDVMI.js +15599 -0
- package/dist/chunk-XY3XDVMI.js.map +1 -0
- package/dist/chunk-YND42IXK.js +233 -0
- package/dist/chunk-YND42IXK.js.map +1 -0
- package/dist/chunk-YZTWZVGX.js +41 -0
- package/dist/chunk-YZTWZVGX.js.map +1 -0
- package/dist/chunk-Z4TWOP3H.js +81 -0
- package/dist/chunk-Z4TWOP3H.js.map +1 -0
- package/dist/cli/defaults/agent-mappings.yaml +271 -0
- package/dist/commands/build/marketplace.js +252 -0
- package/dist/commands/build/marketplace.js.map +1 -0
- package/dist/commands/build/plugins.js +114 -0
- package/dist/commands/build/plugins.js.map +1 -0
- package/dist/commands/build/stack.js +153 -0
- package/dist/commands/build/stack.js.map +1 -0
- package/dist/commands/compile.js +354 -0
- package/dist/commands/compile.js.map +1 -0
- package/dist/commands/config/get.js +61 -0
- package/dist/commands/config/get.js.map +1 -0
- package/dist/commands/config/index.js +23 -0
- package/dist/commands/config/index.js.map +1 -0
- package/dist/commands/config/path.js +34 -0
- package/dist/commands/config/path.js.map +1 -0
- package/dist/commands/config/set-project.js +61 -0
- package/dist/commands/config/set-project.js.map +1 -0
- package/dist/commands/config/show.js +14 -0
- package/dist/commands/config/show.js.map +1 -0
- package/dist/commands/config/unset-project.js +57 -0
- package/dist/commands/config/unset-project.js.map +1 -0
- package/dist/commands/diff.js +742 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/doctor.js +370 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/edit.js +301 -0
- package/dist/commands/edit.js.map +1 -0
- package/dist/commands/eject.js +262 -0
- package/dist/commands/eject.js.map +1 -0
- package/dist/commands/import/skill.js +361 -0
- package/dist/commands/import/skill.js.map +1 -0
- package/dist/commands/info.js +217 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/init.js +443 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.js +49 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/new/agent.js +224 -0
- package/dist/commands/new/agent.js.map +1 -0
- package/dist/commands/new/skill.js +199 -0
- package/dist/commands/new/skill.js.map +1 -0
- package/dist/commands/outdated.js +176 -0
- package/dist/commands/outdated.js.map +1 -0
- package/dist/commands/search.js +288 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/uninstall.js +302 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.js +304 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/validate.js +389 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/commands/version/bump.js +79 -0
- package/dist/commands/version/bump.js.map +1 -0
- package/dist/commands/version/index.js +54 -0
- package/dist/commands/version/index.js.map +1 -0
- package/dist/commands/version/set.js +86 -0
- package/dist/commands/version/set.js.map +1 -0
- package/dist/commands/version/show.js +54 -0
- package/dist/commands/version/show.js.map +1 -0
- package/dist/components/common/confirm.js +9 -0
- package/dist/components/common/confirm.js.map +1 -0
- package/dist/components/common/confirm.test.js +203 -0
- package/dist/components/common/confirm.test.js.map +1 -0
- package/dist/components/common/message.js +20 -0
- package/dist/components/common/message.js.map +1 -0
- package/dist/components/common/spinner.js +14 -0
- package/dist/components/common/spinner.js.map +1 -0
- package/dist/components/skill-search/skill-search.js +12 -0
- package/dist/components/skill-search/skill-search.js.map +1 -0
- package/dist/components/wizard/category-grid.js +11 -0
- package/dist/components/wizard/category-grid.js.map +1 -0
- package/dist/components/wizard/category-grid.test.js +997 -0
- package/dist/components/wizard/category-grid.test.js.map +1 -0
- package/dist/components/wizard/domain-selection.js +14 -0
- package/dist/components/wizard/domain-selection.js.map +1 -0
- package/dist/components/wizard/help-modal.js +10 -0
- package/dist/components/wizard/help-modal.js.map +1 -0
- package/dist/components/wizard/menu-item.js +10 -0
- package/dist/components/wizard/menu-item.js.map +1 -0
- package/dist/components/wizard/search-modal.js +11 -0
- package/dist/components/wizard/search-modal.js.map +1 -0
- package/dist/components/wizard/search-modal.test.js +218 -0
- package/dist/components/wizard/search-modal.test.js.map +1 -0
- package/dist/components/wizard/section-progress.js +10 -0
- package/dist/components/wizard/section-progress.js.map +1 -0
- package/dist/components/wizard/section-progress.test.js +192 -0
- package/dist/components/wizard/section-progress.test.js.map +1 -0
- package/dist/components/wizard/source-grid.js +14 -0
- package/dist/components/wizard/source-grid.js.map +1 -0
- package/dist/components/wizard/source-grid.test.js +504 -0
- package/dist/components/wizard/source-grid.test.js.map +1 -0
- package/dist/components/wizard/stack-selection.js +17 -0
- package/dist/components/wizard/stack-selection.js.map +1 -0
- package/dist/components/wizard/step-build.js +17 -0
- package/dist/components/wizard/step-build.js.map +1 -0
- package/dist/components/wizard/step-build.test.js +600 -0
- package/dist/components/wizard/step-build.test.js.map +1 -0
- package/dist/components/wizard/step-confirm.js +12 -0
- package/dist/components/wizard/step-confirm.js.map +1 -0
- package/dist/components/wizard/step-confirm.test.js +366 -0
- package/dist/components/wizard/step-confirm.test.js.map +1 -0
- package/dist/components/wizard/step-refine.js +10 -0
- package/dist/components/wizard/step-refine.js.map +1 -0
- package/dist/components/wizard/step-refine.test.js +237 -0
- package/dist/components/wizard/step-refine.test.js.map +1 -0
- package/dist/components/wizard/step-settings.js +17 -0
- package/dist/components/wizard/step-settings.js.map +1 -0
- package/dist/components/wizard/step-settings.test.js +243 -0
- package/dist/components/wizard/step-settings.test.js.map +1 -0
- package/dist/components/wizard/step-sources.js +20 -0
- package/dist/components/wizard/step-sources.js.map +1 -0
- package/dist/components/wizard/step-sources.test.js +294 -0
- package/dist/components/wizard/step-sources.test.js.map +1 -0
- package/dist/components/wizard/step-stack.js +19 -0
- package/dist/components/wizard/step-stack.js.map +1 -0
- package/dist/components/wizard/step-stack.test.js +357 -0
- package/dist/components/wizard/step-stack.test.js.map +1 -0
- package/dist/components/wizard/view-title.js +10 -0
- package/dist/components/wizard/view-title.js.map +1 -0
- package/dist/components/wizard/wizard-layout.js +16 -0
- package/dist/components/wizard/wizard-layout.js.map +1 -0
- package/dist/components/wizard/wizard-tabs.js +14 -0
- package/dist/components/wizard/wizard-tabs.js.map +1 -0
- package/dist/components/wizard/wizard-tabs.test.js +294 -0
- package/dist/components/wizard/wizard-tabs.test.js.map +1 -0
- package/dist/components/wizard/wizard.js +35 -0
- package/dist/components/wizard/wizard.js.map +1 -0
- package/dist/config/skills-matrix.yaml +926 -0
- package/dist/config/stacks.yaml +2186 -0
- package/dist/hooks/init.js +40 -0
- package/dist/hooks/init.js.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/magic-string.es-RGXYGAW3.js +1316 -0
- package/dist/magic-string.es-RGXYGAW3.js.map +1 -0
- package/dist/source-manager-SBPPLOQQ.js +16 -0
- package/dist/source-manager-SBPPLOQQ.js.map +1 -0
- package/dist/src/agents/_templates/agent.liquid +140 -0
- package/dist/src/agents/developer/api-developer/agent.yaml +12 -0
- package/dist/src/agents/developer/api-developer/critical-reminders.md +23 -0
- package/dist/src/agents/developer/api-developer/critical-requirements.md +11 -0
- package/dist/src/agents/developer/api-developer/examples.md +72 -0
- package/dist/src/agents/developer/api-developer/intro.md +22 -0
- package/dist/src/agents/developer/api-developer/output-format.md +359 -0
- package/dist/src/agents/developer/api-developer/workflow.md +471 -0
- package/dist/src/agents/developer/cli-developer/agent.yaml +12 -0
- package/dist/src/agents/developer/cli-developer/critical-reminders.md +28 -0
- package/dist/src/agents/developer/cli-developer/critical-requirements.md +15 -0
- package/dist/src/agents/developer/cli-developer/examples.md +68 -0
- package/dist/src/agents/developer/cli-developer/intro.md +23 -0
- package/dist/src/agents/developer/cli-developer/output-format.md +216 -0
- package/dist/src/agents/developer/cli-developer/workflow.md +509 -0
- package/dist/src/agents/developer/web-architecture/agent.yaml +12 -0
- package/dist/src/agents/developer/web-architecture/critical-reminders.md +27 -0
- package/dist/src/agents/developer/web-architecture/critical-requirements.md +35 -0
- package/dist/src/agents/developer/web-architecture/examples.md +187 -0
- package/dist/src/agents/developer/web-architecture/intro.md +35 -0
- package/dist/src/agents/developer/web-architecture/output-format.md +261 -0
- package/dist/src/agents/developer/web-architecture/workflow.md +599 -0
- package/dist/src/agents/developer/web-developer/agent.yaml +12 -0
- package/dist/src/agents/developer/web-developer/critical-reminders.md +17 -0
- package/dist/src/agents/developer/web-developer/critical-requirements.md +15 -0
- package/dist/src/agents/developer/web-developer/examples.md +109 -0
- package/dist/src/agents/developer/web-developer/intro.md +5 -0
- package/dist/src/agents/developer/web-developer/output-format.md +213 -0
- package/dist/src/agents/developer/web-developer/workflow.md +459 -0
- package/dist/src/agents/meta/agent-summoner/agent.yaml +12 -0
- package/dist/src/agents/meta/agent-summoner/critical-reminders.md +31 -0
- package/dist/src/agents/meta/agent-summoner/critical-requirements.md +27 -0
- package/dist/src/agents/meta/agent-summoner/examples.md +176 -0
- package/dist/src/agents/meta/agent-summoner/intro.md +9 -0
- package/dist/src/agents/meta/agent-summoner/output-format.md +115 -0
- package/dist/src/agents/meta/agent-summoner/workflow.md +1540 -0
- package/dist/src/agents/meta/documentor/agent.yaml +11 -0
- package/dist/src/agents/meta/documentor/critical-reminders.md +23 -0
- package/dist/src/agents/meta/documentor/critical-requirements.md +13 -0
- package/dist/src/agents/meta/documentor/examples.md +147 -0
- package/dist/src/agents/meta/documentor/intro.md +11 -0
- package/dist/src/agents/meta/documentor/output-format.md +237 -0
- package/dist/src/agents/meta/documentor/workflow.md +1271 -0
- package/dist/src/agents/meta/skill-summoner/agent.yaml +13 -0
- package/dist/src/agents/meta/skill-summoner/critical-reminders.md +73 -0
- package/dist/src/agents/meta/skill-summoner/critical-requirements.md +62 -0
- package/dist/src/agents/meta/skill-summoner/examples.md +116 -0
- package/dist/src/agents/meta/skill-summoner/intro.md +5 -0
- package/dist/src/agents/meta/skill-summoner/output-format.md +279 -0
- package/dist/src/agents/meta/skill-summoner/workflow.md +1485 -0
- package/dist/src/agents/migration/cli-migrator/agent.yaml +12 -0
- package/dist/src/agents/migration/cli-migrator/anti-patterns.md +158 -0
- package/dist/src/agents/migration/cli-migrator/conversion-mappings.md +63 -0
- package/dist/src/agents/migration/cli-migrator/critical-reminders.md +17 -0
- package/dist/src/agents/migration/cli-migrator/critical-requirements.md +13 -0
- package/dist/src/agents/migration/cli-migrator/intro.md +15 -0
- package/dist/src/agents/migration/cli-migrator/output-format.md +164 -0
- package/dist/src/agents/migration/cli-migrator/workflow.md +230 -0
- package/dist/src/agents/pattern/pattern-scout/agent.yaml +10 -0
- package/dist/src/agents/pattern/pattern-scout/critical-reminders.md +58 -0
- package/dist/src/agents/pattern/pattern-scout/critical-requirements.md +17 -0
- package/dist/src/agents/pattern/pattern-scout/examples.md +93 -0
- package/dist/src/agents/pattern/pattern-scout/intro.md +3 -0
- package/dist/src/agents/pattern/pattern-scout/output-format.md +196 -0
- package/dist/src/agents/pattern/pattern-scout/workflow.md +1901 -0
- package/dist/src/agents/pattern/web-pattern-critique/agent.yaml +12 -0
- package/dist/src/agents/pattern/web-pattern-critique/critical-reminders.md +13 -0
- package/dist/src/agents/pattern/web-pattern-critique/critical-requirements.md +11 -0
- package/dist/src/agents/pattern/web-pattern-critique/examples.md +56 -0
- package/dist/src/agents/pattern/web-pattern-critique/intro.md +5 -0
- package/dist/src/agents/pattern/web-pattern-critique/output-format.md +257 -0
- package/dist/src/agents/pattern/web-pattern-critique/workflow.md +674 -0
- package/dist/src/agents/planning/web-pm/agent.yaml +12 -0
- package/dist/src/agents/planning/web-pm/critical-reminders.md +21 -0
- package/dist/src/agents/planning/web-pm/critical-requirements.md +17 -0
- package/dist/src/agents/planning/web-pm/examples.md +85 -0
- package/dist/src/agents/planning/web-pm/intro.md +3 -0
- package/dist/src/agents/planning/web-pm/output-format.md +228 -0
- package/dist/src/agents/planning/web-pm/workflow.md +393 -0
- package/dist/src/agents/researcher/api-researcher/agent.yaml +10 -0
- package/dist/src/agents/researcher/api-researcher/critical-reminders.md +27 -0
- package/dist/src/agents/researcher/api-researcher/critical-requirements.md +13 -0
- package/dist/src/agents/researcher/api-researcher/examples.md +116 -0
- package/dist/src/agents/researcher/api-researcher/intro.md +32 -0
- package/dist/src/agents/researcher/api-researcher/output-format.md +135 -0
- package/dist/src/agents/researcher/api-researcher/workflow.md +261 -0
- package/dist/src/agents/researcher/web-researcher/agent.yaml +10 -0
- package/dist/src/agents/researcher/web-researcher/critical-reminders.md +23 -0
- package/dist/src/agents/researcher/web-researcher/critical-requirements.md +11 -0
- package/dist/src/agents/researcher/web-researcher/examples.md +126 -0
- package/dist/src/agents/researcher/web-researcher/intro.md +31 -0
- package/dist/src/agents/researcher/web-researcher/output-format.md +112 -0
- package/dist/src/agents/researcher/web-researcher/workflow.md +322 -0
- package/dist/src/agents/reviewer/api-reviewer/agent.yaml +12 -0
- package/dist/src/agents/reviewer/api-reviewer/critical-reminders.md +16 -0
- package/dist/src/agents/reviewer/api-reviewer/critical-requirements.md +13 -0
- package/dist/src/agents/reviewer/api-reviewer/examples.md +54 -0
- package/dist/src/agents/reviewer/api-reviewer/intro.md +22 -0
- package/dist/src/agents/reviewer/api-reviewer/output-format.md +288 -0
- package/dist/src/agents/reviewer/api-reviewer/workflow.md +369 -0
- package/dist/src/agents/reviewer/cli-reviewer/agent.yaml +12 -0
- package/dist/src/agents/reviewer/cli-reviewer/critical-reminders.md +17 -0
- package/dist/src/agents/reviewer/cli-reviewer/critical-requirements.md +13 -0
- package/dist/src/agents/reviewer/cli-reviewer/examples.md +83 -0
- package/dist/src/agents/reviewer/cli-reviewer/intro.md +21 -0
- package/dist/src/agents/reviewer/cli-reviewer/output-format.md +330 -0
- package/dist/src/agents/reviewer/cli-reviewer/workflow.md +294 -0
- package/dist/src/agents/reviewer/web-reviewer/agent.yaml +12 -0
- package/dist/src/agents/reviewer/web-reviewer/critical-reminders.md +17 -0
- package/dist/src/agents/reviewer/web-reviewer/critical-requirements.md +11 -0
- package/dist/src/agents/reviewer/web-reviewer/examples.md +79 -0
- package/dist/src/agents/reviewer/web-reviewer/intro.md +20 -0
- package/dist/src/agents/reviewer/web-reviewer/output-format.md +253 -0
- package/dist/src/agents/reviewer/web-reviewer/workflow.md +228 -0
- package/dist/src/agents/tester/cli-tester/agent.yaml +12 -0
- package/dist/src/agents/tester/cli-tester/critical-reminders.md +19 -0
- package/dist/src/agents/tester/cli-tester/critical-requirements.md +17 -0
- package/dist/src/agents/tester/cli-tester/examples.md +80 -0
- package/dist/src/agents/tester/cli-tester/intro.md +19 -0
- package/dist/src/agents/tester/cli-tester/output-format.md +232 -0
- package/dist/src/agents/tester/cli-tester/workflow.md +304 -0
- package/dist/src/agents/tester/web-tester/agent.yaml +12 -0
- package/dist/src/agents/tester/web-tester/critical-reminders.md +15 -0
- package/dist/src/agents/tester/web-tester/critical-requirements.md +11 -0
- package/dist/src/agents/tester/web-tester/examples.md +68 -0
- package/dist/src/agents/tester/web-tester/intro.md +18 -0
- package/dist/src/agents/tester/web-tester/output-format.md +252 -0
- package/dist/src/agents/tester/web-tester/workflow.md +507 -0
- package/dist/stores/wizard-store.js +13 -0
- package/dist/stores/wizard-store.js.map +1 -0
- package/dist/stores/wizard-store.test.js +689 -0
- package/dist/stores/wizard-store.test.js.map +1 -0
- package/package.json +134 -0
- package/src/agents/_templates/agent.liquid +140 -0
- package/src/agents/developer/api-developer/agent.yaml +12 -0
- package/src/agents/developer/api-developer/critical-reminders.md +23 -0
- package/src/agents/developer/api-developer/critical-requirements.md +11 -0
- package/src/agents/developer/api-developer/examples.md +72 -0
- package/src/agents/developer/api-developer/intro.md +22 -0
- package/src/agents/developer/api-developer/output-format.md +359 -0
- package/src/agents/developer/api-developer/workflow.md +471 -0
- package/src/agents/developer/cli-developer/agent.yaml +12 -0
- package/src/agents/developer/cli-developer/critical-reminders.md +28 -0
- package/src/agents/developer/cli-developer/critical-requirements.md +15 -0
- package/src/agents/developer/cli-developer/examples.md +68 -0
- package/src/agents/developer/cli-developer/intro.md +23 -0
- package/src/agents/developer/cli-developer/output-format.md +216 -0
- package/src/agents/developer/cli-developer/workflow.md +509 -0
- package/src/agents/developer/web-architecture/agent.yaml +12 -0
- package/src/agents/developer/web-architecture/critical-reminders.md +27 -0
- package/src/agents/developer/web-architecture/critical-requirements.md +35 -0
- package/src/agents/developer/web-architecture/examples.md +187 -0
- package/src/agents/developer/web-architecture/intro.md +35 -0
- package/src/agents/developer/web-architecture/output-format.md +261 -0
- package/src/agents/developer/web-architecture/workflow.md +599 -0
- package/src/agents/developer/web-developer/agent.yaml +12 -0
- package/src/agents/developer/web-developer/critical-reminders.md +17 -0
- package/src/agents/developer/web-developer/critical-requirements.md +15 -0
- package/src/agents/developer/web-developer/examples.md +109 -0
- package/src/agents/developer/web-developer/intro.md +5 -0
- package/src/agents/developer/web-developer/output-format.md +213 -0
- package/src/agents/developer/web-developer/workflow.md +459 -0
- package/src/agents/meta/agent-summoner/agent.yaml +12 -0
- package/src/agents/meta/agent-summoner/critical-reminders.md +31 -0
- package/src/agents/meta/agent-summoner/critical-requirements.md +27 -0
- package/src/agents/meta/agent-summoner/examples.md +176 -0
- package/src/agents/meta/agent-summoner/intro.md +9 -0
- package/src/agents/meta/agent-summoner/output-format.md +115 -0
- package/src/agents/meta/agent-summoner/workflow.md +1540 -0
- package/src/agents/meta/documentor/agent.yaml +11 -0
- package/src/agents/meta/documentor/critical-reminders.md +23 -0
- package/src/agents/meta/documentor/critical-requirements.md +13 -0
- package/src/agents/meta/documentor/examples.md +147 -0
- package/src/agents/meta/documentor/intro.md +11 -0
- package/src/agents/meta/documentor/output-format.md +237 -0
- package/src/agents/meta/documentor/workflow.md +1271 -0
- package/src/agents/meta/skill-summoner/agent.yaml +13 -0
- package/src/agents/meta/skill-summoner/critical-reminders.md +73 -0
- package/src/agents/meta/skill-summoner/critical-requirements.md +62 -0
- package/src/agents/meta/skill-summoner/examples.md +116 -0
- package/src/agents/meta/skill-summoner/intro.md +5 -0
- package/src/agents/meta/skill-summoner/output-format.md +279 -0
- package/src/agents/meta/skill-summoner/workflow.md +1485 -0
- package/src/agents/migration/cli-migrator/agent.yaml +12 -0
- package/src/agents/migration/cli-migrator/anti-patterns.md +158 -0
- package/src/agents/migration/cli-migrator/conversion-mappings.md +63 -0
- package/src/agents/migration/cli-migrator/critical-reminders.md +17 -0
- package/src/agents/migration/cli-migrator/critical-requirements.md +13 -0
- package/src/agents/migration/cli-migrator/intro.md +15 -0
- package/src/agents/migration/cli-migrator/output-format.md +164 -0
- package/src/agents/migration/cli-migrator/workflow.md +230 -0
- package/src/agents/pattern/pattern-scout/agent.yaml +10 -0
- package/src/agents/pattern/pattern-scout/critical-reminders.md +58 -0
- package/src/agents/pattern/pattern-scout/critical-requirements.md +17 -0
- package/src/agents/pattern/pattern-scout/examples.md +93 -0
- package/src/agents/pattern/pattern-scout/intro.md +3 -0
- package/src/agents/pattern/pattern-scout/output-format.md +196 -0
- package/src/agents/pattern/pattern-scout/workflow.md +1901 -0
- package/src/agents/pattern/web-pattern-critique/agent.yaml +12 -0
- package/src/agents/pattern/web-pattern-critique/critical-reminders.md +13 -0
- package/src/agents/pattern/web-pattern-critique/critical-requirements.md +11 -0
- package/src/agents/pattern/web-pattern-critique/examples.md +56 -0
- package/src/agents/pattern/web-pattern-critique/intro.md +5 -0
- package/src/agents/pattern/web-pattern-critique/output-format.md +257 -0
- package/src/agents/pattern/web-pattern-critique/workflow.md +674 -0
- package/src/agents/planning/web-pm/agent.yaml +12 -0
- package/src/agents/planning/web-pm/critical-reminders.md +21 -0
- package/src/agents/planning/web-pm/critical-requirements.md +17 -0
- package/src/agents/planning/web-pm/examples.md +85 -0
- package/src/agents/planning/web-pm/intro.md +3 -0
- package/src/agents/planning/web-pm/output-format.md +228 -0
- package/src/agents/planning/web-pm/workflow.md +393 -0
- package/src/agents/researcher/api-researcher/agent.yaml +10 -0
- package/src/agents/researcher/api-researcher/critical-reminders.md +27 -0
- package/src/agents/researcher/api-researcher/critical-requirements.md +13 -0
- package/src/agents/researcher/api-researcher/examples.md +116 -0
- package/src/agents/researcher/api-researcher/intro.md +32 -0
- package/src/agents/researcher/api-researcher/output-format.md +135 -0
- package/src/agents/researcher/api-researcher/workflow.md +261 -0
- package/src/agents/researcher/web-researcher/agent.yaml +10 -0
- package/src/agents/researcher/web-researcher/critical-reminders.md +23 -0
- package/src/agents/researcher/web-researcher/critical-requirements.md +11 -0
- package/src/agents/researcher/web-researcher/examples.md +126 -0
- package/src/agents/researcher/web-researcher/intro.md +31 -0
- package/src/agents/researcher/web-researcher/output-format.md +112 -0
- package/src/agents/researcher/web-researcher/workflow.md +322 -0
- package/src/agents/reviewer/api-reviewer/agent.yaml +12 -0
- package/src/agents/reviewer/api-reviewer/critical-reminders.md +16 -0
- package/src/agents/reviewer/api-reviewer/critical-requirements.md +13 -0
- package/src/agents/reviewer/api-reviewer/examples.md +54 -0
- package/src/agents/reviewer/api-reviewer/intro.md +22 -0
- package/src/agents/reviewer/api-reviewer/output-format.md +288 -0
- package/src/agents/reviewer/api-reviewer/workflow.md +369 -0
- package/src/agents/reviewer/cli-reviewer/agent.yaml +12 -0
- package/src/agents/reviewer/cli-reviewer/critical-reminders.md +17 -0
- package/src/agents/reviewer/cli-reviewer/critical-requirements.md +13 -0
- package/src/agents/reviewer/cli-reviewer/examples.md +83 -0
- package/src/agents/reviewer/cli-reviewer/intro.md +21 -0
- package/src/agents/reviewer/cli-reviewer/output-format.md +330 -0
- package/src/agents/reviewer/cli-reviewer/workflow.md +294 -0
- package/src/agents/reviewer/web-reviewer/agent.yaml +12 -0
- package/src/agents/reviewer/web-reviewer/critical-reminders.md +17 -0
- package/src/agents/reviewer/web-reviewer/critical-requirements.md +11 -0
- package/src/agents/reviewer/web-reviewer/examples.md +79 -0
- package/src/agents/reviewer/web-reviewer/intro.md +20 -0
- package/src/agents/reviewer/web-reviewer/output-format.md +253 -0
- package/src/agents/reviewer/web-reviewer/workflow.md +228 -0
- package/src/agents/tester/cli-tester/agent.yaml +12 -0
- package/src/agents/tester/cli-tester/critical-reminders.md +19 -0
- package/src/agents/tester/cli-tester/critical-requirements.md +17 -0
- package/src/agents/tester/cli-tester/examples.md +80 -0
- package/src/agents/tester/cli-tester/intro.md +19 -0
- package/src/agents/tester/cli-tester/output-format.md +232 -0
- package/src/agents/tester/cli-tester/workflow.md +304 -0
- package/src/agents/tester/web-tester/agent.yaml +12 -0
- package/src/agents/tester/web-tester/critical-reminders.md +15 -0
- package/src/agents/tester/web-tester/critical-requirements.md +11 -0
- package/src/agents/tester/web-tester/examples.md +68 -0
- package/src/agents/tester/web-tester/intro.md +18 -0
- package/src/agents/tester/web-tester/output-format.md +252 -0
- package/src/agents/tester/web-tester/workflow.md +507 -0
- package/src/schemas/agent-frontmatter.schema.json +84 -0
- package/src/schemas/agent.schema.json +93 -0
- package/src/schemas/hooks.schema.json +47 -0
- package/src/schemas/marketplace.schema.json +119 -0
- package/src/schemas/metadata.schema.json +113 -0
- package/src/schemas/plugin.schema.json +130 -0
- package/src/schemas/project-config.schema.json +125 -0
- package/src/schemas/project-source-config.schema.json +81 -0
- package/src/schemas/skill-frontmatter.schema.json +42 -0
- package/src/schemas/skills-matrix.schema.json +467 -0
- package/src/schemas/stack.schema.json +191 -0
- package/src/schemas/stacks.schema.json +111 -0
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
INFO_MESSAGES,
|
|
4
|
+
STATUS_MESSAGES
|
|
5
|
+
} from "../../chunk-R74PZWQS.js";
|
|
6
|
+
import {
|
|
7
|
+
BaseCommand,
|
|
8
|
+
EXIT_CODES
|
|
9
|
+
} from "../../chunk-ODUOU55D.js";
|
|
10
|
+
import {
|
|
11
|
+
IMPORT_DEFAULTS,
|
|
12
|
+
computeFileHash,
|
|
13
|
+
fetchFromSource,
|
|
14
|
+
getCurrentDate
|
|
15
|
+
} from "../../chunk-MM7NK5N2.js";
|
|
16
|
+
import "../../chunk-T4EXUIBY.js";
|
|
17
|
+
import {
|
|
18
|
+
copy,
|
|
19
|
+
directoryExists,
|
|
20
|
+
ensureDir,
|
|
21
|
+
fileExists,
|
|
22
|
+
getErrorMessage,
|
|
23
|
+
importedSkillMetadataSchema,
|
|
24
|
+
listDirectories,
|
|
25
|
+
readFile,
|
|
26
|
+
writeFile
|
|
27
|
+
} from "../../chunk-BZN2Z5P7.js";
|
|
28
|
+
import {
|
|
29
|
+
DEFAULT_SKILLS_SUBDIR,
|
|
30
|
+
GITHUB_SOURCE,
|
|
31
|
+
LOCAL_SKILLS_PATH,
|
|
32
|
+
STANDARD_FILES,
|
|
33
|
+
YAML_FORMATTING
|
|
34
|
+
} from "../../chunk-LAPCUV4D.js";
|
|
35
|
+
import {
|
|
36
|
+
init_esm_shims
|
|
37
|
+
} from "../../chunk-DHET7RCE.js";
|
|
38
|
+
|
|
39
|
+
// src/cli/commands/import/skill.ts
|
|
40
|
+
init_esm_shims();
|
|
41
|
+
import { Args, Flags } from "@oclif/core";
|
|
42
|
+
import path from "path";
|
|
43
|
+
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
|
44
|
+
var SKILL_MD_FILE = STANDARD_FILES.SKILL_MD;
|
|
45
|
+
var METADATA_YAML_FILE = STANDARD_FILES.METADATA_YAML;
|
|
46
|
+
var METADATA_JSON_FILE = STANDARD_FILES.METADATA_JSON;
|
|
47
|
+
function parseGitHubSource(source) {
|
|
48
|
+
if (source.startsWith(GITHUB_SOURCE.HTTPS_PREFIX)) {
|
|
49
|
+
const path2 = source.replace(GITHUB_SOURCE.HTTPS_PREFIX, "");
|
|
50
|
+
return {
|
|
51
|
+
gigetSource: `${GITHUB_SOURCE.GITHUB_PREFIX}${path2}`,
|
|
52
|
+
displaySource: source
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (source.startsWith(GITHUB_SOURCE.GITHUB_PREFIX) || source.startsWith(GITHUB_SOURCE.GH_PREFIX)) {
|
|
56
|
+
const normalized = source.startsWith(GITHUB_SOURCE.GH_PREFIX) ? GITHUB_SOURCE.GITHUB_PREFIX + source.slice(GITHUB_SOURCE.GH_PREFIX.length) : source;
|
|
57
|
+
return {
|
|
58
|
+
gigetSource: normalized,
|
|
59
|
+
displaySource: `${GITHUB_SOURCE.HTTPS_PREFIX}${normalized.replace(GITHUB_SOURCE.GITHUB_PREFIX, "")}`
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
if (source.includes("/") && !source.includes(":")) {
|
|
63
|
+
return {
|
|
64
|
+
gigetSource: `${GITHUB_SOURCE.GITHUB_PREFIX}${source}`,
|
|
65
|
+
displaySource: `${GITHUB_SOURCE.HTTPS_PREFIX}${source}`
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
gigetSource: source,
|
|
70
|
+
displaySource: source
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
async function discoverValidSkills(skillsDir, skillDirs) {
|
|
74
|
+
const validSkills = [];
|
|
75
|
+
for (const skillDir of skillDirs) {
|
|
76
|
+
const skillMdPath = path.join(skillsDir, skillDir, SKILL_MD_FILE);
|
|
77
|
+
if (await fileExists(skillMdPath)) {
|
|
78
|
+
validSkills.push(skillDir);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return validSkills.sort();
|
|
82
|
+
}
|
|
83
|
+
var ImportSkill = class _ImportSkill extends BaseCommand {
|
|
84
|
+
static summary = "Import a skill from a third-party GitHub repository";
|
|
85
|
+
static description = "Download and import skills from external GitHub repositories into your local .claude/skills/ directory. Supports importing specific skills or listing available skills.";
|
|
86
|
+
static examples = [
|
|
87
|
+
{
|
|
88
|
+
description: "List available skills from a repository",
|
|
89
|
+
command: "<%= config.bin %> import skill github:vercel-labs/agent-skills --list"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
description: "Import a specific skill",
|
|
93
|
+
command: "<%= config.bin %> import skill github:vercel-labs/agent-skills --skill react-best-practices"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
description: "Import all skills from a repository",
|
|
97
|
+
command: "<%= config.bin %> import skill github:vercel-labs/agent-skills --all"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
description: "Import with custom skills directory",
|
|
101
|
+
command: "<%= config.bin %> import skill github:owner/repo --skill my-skill --subdir custom-skills"
|
|
102
|
+
}
|
|
103
|
+
];
|
|
104
|
+
static args = {
|
|
105
|
+
source: Args.string({
|
|
106
|
+
description: "GitHub repository source (github:owner/repo, https://github.com/owner/repo, or owner/repo)",
|
|
107
|
+
required: true
|
|
108
|
+
})
|
|
109
|
+
};
|
|
110
|
+
static flags = {
|
|
111
|
+
...BaseCommand.baseFlags,
|
|
112
|
+
skill: Flags.string({
|
|
113
|
+
char: "n",
|
|
114
|
+
description: "Name of the specific skill to import",
|
|
115
|
+
required: false
|
|
116
|
+
}),
|
|
117
|
+
all: Flags.boolean({
|
|
118
|
+
char: "a",
|
|
119
|
+
description: "Import all skills from the repository",
|
|
120
|
+
default: false
|
|
121
|
+
}),
|
|
122
|
+
list: Flags.boolean({
|
|
123
|
+
char: "l",
|
|
124
|
+
description: "List available skills without importing",
|
|
125
|
+
default: false
|
|
126
|
+
}),
|
|
127
|
+
subdir: Flags.string({
|
|
128
|
+
description: "Subdirectory containing skills (default: skills)",
|
|
129
|
+
default: DEFAULT_SKILLS_SUBDIR
|
|
130
|
+
}),
|
|
131
|
+
force: Flags.boolean({
|
|
132
|
+
char: "f",
|
|
133
|
+
description: "Overwrite existing skills",
|
|
134
|
+
default: false
|
|
135
|
+
}),
|
|
136
|
+
refresh: Flags.boolean({
|
|
137
|
+
description: "Force refresh from remote (ignore cache)",
|
|
138
|
+
default: false
|
|
139
|
+
})
|
|
140
|
+
};
|
|
141
|
+
async run() {
|
|
142
|
+
const { args, flags } = await this.parse(_ImportSkill);
|
|
143
|
+
const projectDir = process.cwd();
|
|
144
|
+
this.log("");
|
|
145
|
+
this.log("Import Third-Party Skill");
|
|
146
|
+
this.log("");
|
|
147
|
+
if (!flags.list && !flags.skill && !flags.all) {
|
|
148
|
+
this.error("Please specify --skill <name>, --all, or --list to list available skills", {
|
|
149
|
+
exit: EXIT_CODES.INVALID_ARGS
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
if (flags.skill && flags.all) {
|
|
153
|
+
this.error("Cannot use --skill and --all together", {
|
|
154
|
+
exit: EXIT_CODES.INVALID_ARGS
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
const { gigetSource, displaySource } = parseGitHubSource(args.source);
|
|
158
|
+
this.log(`Source: ${displaySource}`);
|
|
159
|
+
this.log(STATUS_MESSAGES.FETCHING_REPOSITORY);
|
|
160
|
+
let repoPath;
|
|
161
|
+
try {
|
|
162
|
+
const result = await fetchFromSource(gigetSource, {
|
|
163
|
+
forceRefresh: flags.refresh
|
|
164
|
+
});
|
|
165
|
+
repoPath = result.path;
|
|
166
|
+
this.log(result.fromCache ? "Using cached source" : "Downloaded fresh copy");
|
|
167
|
+
} catch (error) {
|
|
168
|
+
this.error(error instanceof Error ? error.message : `Failed to fetch: ${args.source}`, {
|
|
169
|
+
exit: EXIT_CODES.NETWORK_ERROR
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
const subdir = flags.subdir;
|
|
173
|
+
if (/\0/.test(subdir)) {
|
|
174
|
+
this.error("--subdir contains null bytes", {
|
|
175
|
+
exit: EXIT_CODES.INVALID_ARGS
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
if (path.isAbsolute(subdir)) {
|
|
179
|
+
this.error(`--subdir must be a relative path, got: ${subdir}`, {
|
|
180
|
+
exit: EXIT_CODES.INVALID_ARGS
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
const skillsDir = path.resolve(path.join(repoPath, subdir));
|
|
184
|
+
const resolvedRepoPath = path.resolve(repoPath);
|
|
185
|
+
if (!skillsDir.startsWith(resolvedRepoPath + path.sep) && skillsDir !== resolvedRepoPath) {
|
|
186
|
+
this.error(`--subdir path escapes repository boundary: ${subdir}`, {
|
|
187
|
+
exit: EXIT_CODES.INVALID_ARGS
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
if (!await directoryExists(skillsDir)) {
|
|
191
|
+
this.error(
|
|
192
|
+
`Skills directory not found: ${flags.subdir}
|
|
193
|
+
The repository doesn't have a '${flags.subdir}' directory.
|
|
194
|
+
Use --subdir to specify a different location.`,
|
|
195
|
+
{ exit: EXIT_CODES.INVALID_ARGS }
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
const skillDirs = await listDirectories(skillsDir);
|
|
199
|
+
const availableSkills = await discoverValidSkills(skillsDir, skillDirs);
|
|
200
|
+
if (availableSkills.length === 0) {
|
|
201
|
+
this.error(`No valid skills found in ${flags.subdir}/
|
|
202
|
+
Skills must have a SKILL.md file.`, {
|
|
203
|
+
exit: EXIT_CODES.ERROR
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
if (flags.list) {
|
|
207
|
+
this.log("");
|
|
208
|
+
this.log(`Available skills (${availableSkills.length}):`);
|
|
209
|
+
this.log("");
|
|
210
|
+
for (const skill of availableSkills) {
|
|
211
|
+
this.log(` - ${skill}`);
|
|
212
|
+
}
|
|
213
|
+
this.log("");
|
|
214
|
+
this.log("Use --skill <name> to import a specific skill, or --all to import all.");
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
let skillsToImport = [];
|
|
218
|
+
if (flags.all) {
|
|
219
|
+
skillsToImport = availableSkills;
|
|
220
|
+
} else if (flags.skill) {
|
|
221
|
+
if (!availableSkills.includes(flags.skill)) {
|
|
222
|
+
this.error(
|
|
223
|
+
`Skill '${flags.skill}' not found in repository.
|
|
224
|
+
Available skills: ${availableSkills.join(", ")}
|
|
225
|
+
Use --list to see all available skills.`,
|
|
226
|
+
{ exit: EXIT_CODES.INVALID_ARGS }
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
skillsToImport = [flags.skill];
|
|
230
|
+
}
|
|
231
|
+
const destDir = path.join(projectDir, LOCAL_SKILLS_PATH);
|
|
232
|
+
if (flags["dry-run"]) {
|
|
233
|
+
this.log("");
|
|
234
|
+
this.log("[DRY RUN] Would import the following skills:");
|
|
235
|
+
for (const skill of skillsToImport) {
|
|
236
|
+
const destPath = path.join(destDir, skill);
|
|
237
|
+
const exists = await directoryExists(destPath);
|
|
238
|
+
this.log(` - ${skill} -> ${destPath}${exists ? " (exists)" : ""}`);
|
|
239
|
+
}
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
this.log("");
|
|
243
|
+
this.log(`Importing ${skillsToImport.length} skill(s)...`);
|
|
244
|
+
let imported = 0;
|
|
245
|
+
let skipped = 0;
|
|
246
|
+
for (const skillName of skillsToImport) {
|
|
247
|
+
const sourcePath = path.join(skillsDir, skillName);
|
|
248
|
+
const destPath = path.join(destDir, skillName);
|
|
249
|
+
if (await directoryExists(destPath)) {
|
|
250
|
+
if (!flags.force) {
|
|
251
|
+
this.warn(`Skipping '${skillName}': already exists. Use --force to overwrite.`);
|
|
252
|
+
skipped++;
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
try {
|
|
257
|
+
await this.importSkill(sourcePath, destPath, skillName, displaySource);
|
|
258
|
+
this.logSuccess(`Imported: ${skillName}`);
|
|
259
|
+
imported++;
|
|
260
|
+
} catch (error) {
|
|
261
|
+
this.warn(`Failed to import '${skillName}': ${getErrorMessage(error)}`);
|
|
262
|
+
skipped++;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
this.log("");
|
|
266
|
+
this.logSuccess(`Import complete: ${imported} imported, ${skipped} skipped`);
|
|
267
|
+
this.log(`Skills location: ${destDir}`);
|
|
268
|
+
this.log("");
|
|
269
|
+
this.log(INFO_MESSAGES.RUN_COMPILE);
|
|
270
|
+
this.log("");
|
|
271
|
+
}
|
|
272
|
+
async importSkill(sourcePath, destPath, skillName, source) {
|
|
273
|
+
const skillMdPath = path.join(sourcePath, SKILL_MD_FILE);
|
|
274
|
+
if (!await fileExists(skillMdPath)) {
|
|
275
|
+
throw new Error(
|
|
276
|
+
`Missing required SKILL.md file at ${skillMdPath}
|
|
277
|
+
Every skill must have a SKILL.md file containing the skill's prompt content.
|
|
278
|
+
Create one with:
|
|
279
|
+
echo "# ${skillName}" > ${path.join(sourcePath, SKILL_MD_FILE)}`
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
const contentHash = await computeFileHash(skillMdPath);
|
|
283
|
+
await ensureDir(path.dirname(destPath));
|
|
284
|
+
await copy(sourcePath, destPath);
|
|
285
|
+
await this.injectForkedFromMetadata(destPath, skillName, source, contentHash);
|
|
286
|
+
}
|
|
287
|
+
async injectForkedFromMetadata(destPath, skillName, source, contentHash) {
|
|
288
|
+
const metadataYamlPath = path.join(destPath, METADATA_YAML_FILE);
|
|
289
|
+
const metadataJsonPath = path.join(destPath, METADATA_JSON_FILE);
|
|
290
|
+
const forkedFrom = {
|
|
291
|
+
source,
|
|
292
|
+
skill_name: skillName,
|
|
293
|
+
content_hash: contentHash,
|
|
294
|
+
date: getCurrentDate()
|
|
295
|
+
};
|
|
296
|
+
if (await fileExists(metadataYamlPath)) {
|
|
297
|
+
const rawContent = await readFile(metadataYamlPath);
|
|
298
|
+
const lines = rawContent.split("\n");
|
|
299
|
+
let yamlContent2 = rawContent;
|
|
300
|
+
let schemaComment = "";
|
|
301
|
+
if (lines[0]?.startsWith("# yaml-language-server:")) {
|
|
302
|
+
schemaComment = `${lines[0]}
|
|
303
|
+
`;
|
|
304
|
+
yamlContent2 = lines.slice(1).join("\n");
|
|
305
|
+
}
|
|
306
|
+
const raw = parseYaml(yamlContent2);
|
|
307
|
+
const parseResult = importedSkillMetadataSchema.safeParse(raw);
|
|
308
|
+
if (!parseResult.success) {
|
|
309
|
+
this.warn(
|
|
310
|
+
`Malformed metadata.yaml at ${metadataYamlPath} \u2014 existing fields may be lost
|
|
311
|
+
Validation errors: ${parseResult.error.issues.map((i) => i.message).join(", ")}
|
|
312
|
+
Expected fields: cli_name (string), cli_description (string), category (string)
|
|
313
|
+
Validate your YAML syntax at https://yamllint.com`
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
const metadata = parseResult.success ? parseResult.data : { forked_from: void 0 };
|
|
317
|
+
metadata.forked_from = forkedFrom;
|
|
318
|
+
const newYamlContent = stringifyYaml(metadata, {
|
|
319
|
+
lineWidth: YAML_FORMATTING.LINE_WIDTH_NONE
|
|
320
|
+
});
|
|
321
|
+
await writeFile(metadataYamlPath, schemaComment + newYamlContent);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
if (await fileExists(metadataJsonPath)) {
|
|
325
|
+
const rawContent = await readFile(metadataJsonPath);
|
|
326
|
+
let jsonParsed;
|
|
327
|
+
try {
|
|
328
|
+
jsonParsed = JSON.parse(rawContent);
|
|
329
|
+
} catch {
|
|
330
|
+
this.warn(
|
|
331
|
+
`Malformed JSON in ${metadataJsonPath} \u2014 skipping metadata injection
|
|
332
|
+
Common issues: trailing commas, unquoted keys, single quotes instead of double quotes
|
|
333
|
+
Validate your JSON at https://jsonlint.com`
|
|
334
|
+
);
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
const jsonResult = importedSkillMetadataSchema.safeParse(jsonParsed);
|
|
338
|
+
const metadata = jsonResult.success ? jsonResult.data : { forked_from: void 0 };
|
|
339
|
+
metadata.forked_from = forkedFrom;
|
|
340
|
+
const yamlContent2 = stringifyYaml(metadata, { lineWidth: YAML_FORMATTING.LINE_WIDTH_NONE });
|
|
341
|
+
await writeFile(metadataYamlPath, yamlContent2);
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
const minimalMetadata = {
|
|
345
|
+
cli_name: skillName.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" "),
|
|
346
|
+
cli_description: "Imported from third-party repository",
|
|
347
|
+
category: IMPORT_DEFAULTS.CATEGORY,
|
|
348
|
+
category_exclusive: false,
|
|
349
|
+
author: IMPORT_DEFAULTS.AUTHOR,
|
|
350
|
+
forked_from: forkedFrom
|
|
351
|
+
};
|
|
352
|
+
const yamlContent = stringifyYaml(minimalMetadata, {
|
|
353
|
+
lineWidth: YAML_FORMATTING.LINE_WIDTH_NONE
|
|
354
|
+
});
|
|
355
|
+
await writeFile(metadataYamlPath, yamlContent);
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
export {
|
|
359
|
+
ImportSkill as default
|
|
360
|
+
};
|
|
361
|
+
//# sourceMappingURL=skill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/commands/import/skill.ts"],"sourcesContent":["import { Args, Flags } from \"@oclif/core\";\nimport path from \"path\";\nimport { parse as parseYaml, stringify as stringifyYaml } from \"yaml\";\nimport { BaseCommand } from \"../../base-command.js\";\nimport { getErrorMessage } from \"../../utils/errors.js\";\nimport { EXIT_CODES } from \"../../lib/exit-codes.js\";\nimport { fetchFromSource } from \"../../lib/loading/index.js\";\nimport { importedSkillMetadataSchema } from \"../../lib/schemas.js\";\nimport { getCurrentDate, computeFileHash } from \"../../lib/versioning.js\";\nimport {\n copy,\n directoryExists,\n fileExists,\n listDirectories,\n readFile,\n writeFile,\n ensureDir,\n} from \"../../utils/fs.js\";\nimport {\n DEFAULT_SKILLS_SUBDIR,\n GITHUB_SOURCE,\n LOCAL_SKILLS_PATH,\n STANDARD_FILES,\n YAML_FORMATTING,\n} from \"../../consts.js\";\nimport { IMPORT_DEFAULTS } from \"../../lib/metadata-keys.js\";\nimport { STATUS_MESSAGES, INFO_MESSAGES } from \"../../utils/messages.js\";\n\n/**\n * Metadata for tracking third-party imports. Different from ForkedFromMetadata\n * in skill-metadata.ts which tracks internal fork lineage (uses skill_id\n * instead of source/skill_name).\n */\ntype ImportedForkedFromMetadata = {\n source: string;\n skill_name: string;\n content_hash: string;\n date: string;\n};\n\ntype SkillMetadata = {\n forked_from?: ImportedForkedFromMetadata;\n [key: string]: unknown;\n};\n\nconst SKILL_MD_FILE = STANDARD_FILES.SKILL_MD;\nconst METADATA_YAML_FILE = STANDARD_FILES.METADATA_YAML;\nconst METADATA_JSON_FILE = STANDARD_FILES.METADATA_JSON;\n\nfunction parseGitHubSource(source: string): {\n gigetSource: string;\n displaySource: string;\n} {\n if (source.startsWith(GITHUB_SOURCE.HTTPS_PREFIX)) {\n const path = source.replace(GITHUB_SOURCE.HTTPS_PREFIX, \"\");\n return {\n gigetSource: `${GITHUB_SOURCE.GITHUB_PREFIX}${path}`,\n displaySource: source,\n };\n }\n\n if (\n source.startsWith(GITHUB_SOURCE.GITHUB_PREFIX) ||\n source.startsWith(GITHUB_SOURCE.GH_PREFIX)\n ) {\n const normalized = source.startsWith(GITHUB_SOURCE.GH_PREFIX)\n ? GITHUB_SOURCE.GITHUB_PREFIX + source.slice(GITHUB_SOURCE.GH_PREFIX.length)\n : source;\n return {\n gigetSource: normalized,\n displaySource: `${GITHUB_SOURCE.HTTPS_PREFIX}${normalized.replace(GITHUB_SOURCE.GITHUB_PREFIX, \"\")}`,\n };\n }\n\n if (source.includes(\"/\") && !source.includes(\":\")) {\n return {\n gigetSource: `${GITHUB_SOURCE.GITHUB_PREFIX}${source}`,\n displaySource: `${GITHUB_SOURCE.HTTPS_PREFIX}${source}`,\n };\n }\n\n return {\n gigetSource: source,\n displaySource: source,\n };\n}\n\nasync function discoverValidSkills(skillsDir: string, skillDirs: string[]): Promise<string[]> {\n const validSkills: string[] = [];\n\n for (const skillDir of skillDirs) {\n const skillMdPath = path.join(skillsDir, skillDir, SKILL_MD_FILE);\n if (await fileExists(skillMdPath)) {\n validSkills.push(skillDir);\n }\n }\n\n return validSkills.sort();\n}\n\nexport default class ImportSkill extends BaseCommand {\n static summary = \"Import a skill from a third-party GitHub repository\";\n static description =\n \"Download and import skills from external GitHub repositories into your local \" +\n \".claude/skills/ directory. Supports importing specific skills or listing available skills.\";\n\n static examples = [\n {\n description: \"List available skills from a repository\",\n command: \"<%= config.bin %> import skill github:vercel-labs/agent-skills --list\",\n },\n {\n description: \"Import a specific skill\",\n command:\n \"<%= config.bin %> import skill github:vercel-labs/agent-skills --skill react-best-practices\",\n },\n {\n description: \"Import all skills from a repository\",\n command: \"<%= config.bin %> import skill github:vercel-labs/agent-skills --all\",\n },\n {\n description: \"Import with custom skills directory\",\n command:\n \"<%= config.bin %> import skill github:owner/repo --skill my-skill --subdir custom-skills\",\n },\n ];\n\n static args = {\n source: Args.string({\n description:\n \"GitHub repository source (github:owner/repo, https://github.com/owner/repo, or owner/repo)\",\n required: true,\n }),\n };\n\n static flags = {\n ...BaseCommand.baseFlags,\n skill: Flags.string({\n char: \"n\",\n description: \"Name of the specific skill to import\",\n required: false,\n }),\n all: Flags.boolean({\n char: \"a\",\n description: \"Import all skills from the repository\",\n default: false,\n }),\n list: Flags.boolean({\n char: \"l\",\n description: \"List available skills without importing\",\n default: false,\n }),\n subdir: Flags.string({\n description: \"Subdirectory containing skills (default: skills)\",\n default: DEFAULT_SKILLS_SUBDIR,\n }),\n force: Flags.boolean({\n char: \"f\",\n description: \"Overwrite existing skills\",\n default: false,\n }),\n refresh: Flags.boolean({\n description: \"Force refresh from remote (ignore cache)\",\n default: false,\n }),\n };\n\n async run(): Promise<void> {\n const { args, flags } = await this.parse(ImportSkill);\n const projectDir = process.cwd();\n\n this.log(\"\");\n this.log(\"Import Third-Party Skill\");\n this.log(\"\");\n\n if (!flags.list && !flags.skill && !flags.all) {\n this.error(\"Please specify --skill <name>, --all, or --list to list available skills\", {\n exit: EXIT_CODES.INVALID_ARGS,\n });\n }\n\n if (flags.skill && flags.all) {\n this.error(\"Cannot use --skill and --all together\", {\n exit: EXIT_CODES.INVALID_ARGS,\n });\n }\n\n const { gigetSource, displaySource } = parseGitHubSource(args.source);\n this.log(`Source: ${displaySource}`);\n\n this.log(STATUS_MESSAGES.FETCHING_REPOSITORY);\n\n let repoPath: string;\n try {\n const result = await fetchFromSource(gigetSource, {\n forceRefresh: flags.refresh,\n });\n repoPath = result.path;\n this.log(result.fromCache ? \"Using cached source\" : \"Downloaded fresh copy\");\n } catch (error) {\n this.error(error instanceof Error ? error.message : `Failed to fetch: ${args.source}`, {\n exit: EXIT_CODES.NETWORK_ERROR,\n });\n }\n\n // Validate --subdir to prevent path traversal outside repository boundary\n const subdir = flags.subdir;\n if (/\\0/.test(subdir)) {\n this.error(\"--subdir contains null bytes\", {\n exit: EXIT_CODES.INVALID_ARGS,\n });\n }\n if (path.isAbsolute(subdir)) {\n this.error(`--subdir must be a relative path, got: ${subdir}`, {\n exit: EXIT_CODES.INVALID_ARGS,\n });\n }\n const skillsDir = path.resolve(path.join(repoPath, subdir));\n const resolvedRepoPath = path.resolve(repoPath);\n if (!skillsDir.startsWith(resolvedRepoPath + path.sep) && skillsDir !== resolvedRepoPath) {\n this.error(`--subdir path escapes repository boundary: ${subdir}`, {\n exit: EXIT_CODES.INVALID_ARGS,\n });\n }\n\n if (!(await directoryExists(skillsDir))) {\n this.error(\n `Skills directory not found: ${flags.subdir}\\n` +\n `The repository doesn't have a '${flags.subdir}' directory.\\n` +\n `Use --subdir to specify a different location.`,\n { exit: EXIT_CODES.INVALID_ARGS },\n );\n }\n\n const skillDirs = await listDirectories(skillsDir);\n const availableSkills = await discoverValidSkills(skillsDir, skillDirs);\n\n if (availableSkills.length === 0) {\n this.error(`No valid skills found in ${flags.subdir}/\\nSkills must have a SKILL.md file.`, {\n exit: EXIT_CODES.ERROR,\n });\n }\n\n if (flags.list) {\n this.log(\"\");\n this.log(`Available skills (${availableSkills.length}):`);\n this.log(\"\");\n for (const skill of availableSkills) {\n this.log(` - ${skill}`);\n }\n this.log(\"\");\n this.log(\"Use --skill <name> to import a specific skill, or --all to import all.\");\n return;\n }\n\n let skillsToImport: string[] = [];\n\n if (flags.all) {\n skillsToImport = availableSkills;\n } else if (flags.skill) {\n if (!availableSkills.includes(flags.skill)) {\n this.error(\n `Skill '${flags.skill}' not found in repository.\\n` +\n `Available skills: ${availableSkills.join(\", \")}\\n` +\n `Use --list to see all available skills.`,\n { exit: EXIT_CODES.INVALID_ARGS },\n );\n }\n skillsToImport = [flags.skill];\n }\n\n const destDir = path.join(projectDir, LOCAL_SKILLS_PATH);\n\n if (flags[\"dry-run\"]) {\n this.log(\"\");\n this.log(\"[DRY RUN] Would import the following skills:\");\n for (const skill of skillsToImport) {\n const destPath = path.join(destDir, skill);\n const exists = await directoryExists(destPath);\n this.log(` - ${skill} -> ${destPath}${exists ? \" (exists)\" : \"\"}`);\n }\n return;\n }\n\n this.log(\"\");\n this.log(`Importing ${skillsToImport.length} skill(s)...`);\n\n let imported = 0;\n let skipped = 0;\n\n for (const skillName of skillsToImport) {\n const sourcePath = path.join(skillsDir, skillName);\n const destPath = path.join(destDir, skillName);\n\n if (await directoryExists(destPath)) {\n if (!flags.force) {\n this.warn(`Skipping '${skillName}': already exists. Use --force to overwrite.`);\n skipped++;\n continue;\n }\n }\n\n try {\n await this.importSkill(sourcePath, destPath, skillName, displaySource);\n this.logSuccess(`Imported: ${skillName}`);\n imported++;\n } catch (error) {\n this.warn(`Failed to import '${skillName}': ${getErrorMessage(error)}`);\n skipped++;\n }\n }\n\n this.log(\"\");\n this.logSuccess(`Import complete: ${imported} imported, ${skipped} skipped`);\n this.log(`Skills location: ${destDir}`);\n this.log(\"\");\n this.log(INFO_MESSAGES.RUN_COMPILE);\n this.log(\"\");\n }\n\n private async importSkill(\n sourcePath: string,\n destPath: string,\n skillName: string,\n source: string,\n ): Promise<void> {\n const skillMdPath = path.join(sourcePath, SKILL_MD_FILE);\n if (!(await fileExists(skillMdPath))) {\n throw new Error(\n `Missing required SKILL.md file at ${skillMdPath}\\n` +\n `Every skill must have a SKILL.md file containing the skill's prompt content.\\n` +\n `Create one with:\\n` +\n ` echo \"# ${skillName}\" > ${path.join(sourcePath, SKILL_MD_FILE)}`,\n );\n }\n\n const contentHash = await computeFileHash(skillMdPath);\n\n await ensureDir(path.dirname(destPath));\n await copy(sourcePath, destPath);\n\n await this.injectForkedFromMetadata(destPath, skillName, source, contentHash);\n }\n\n private async injectForkedFromMetadata(\n destPath: string,\n skillName: string,\n source: string,\n contentHash: string,\n ): Promise<void> {\n const metadataYamlPath = path.join(destPath, METADATA_YAML_FILE);\n const metadataJsonPath = path.join(destPath, METADATA_JSON_FILE);\n\n const forkedFrom: ImportedForkedFromMetadata = {\n source,\n skill_name: skillName,\n content_hash: contentHash,\n date: getCurrentDate(),\n };\n\n if (await fileExists(metadataYamlPath)) {\n const rawContent = await readFile(metadataYamlPath);\n const lines = rawContent.split(\"\\n\");\n let yamlContent = rawContent;\n let schemaComment = \"\";\n\n if (lines[0]?.startsWith(\"# yaml-language-server:\")) {\n schemaComment = `${lines[0]}\\n`;\n yamlContent = lines.slice(1).join(\"\\n\");\n }\n\n const raw = parseYaml(yamlContent);\n const parseResult = importedSkillMetadataSchema.safeParse(raw);\n if (!parseResult.success) {\n this.warn(\n `Malformed metadata.yaml at ${metadataYamlPath} — existing fields may be lost\\n` +\n ` Validation errors: ${parseResult.error.issues.map((i) => i.message).join(\", \")}\\n` +\n ` Expected fields: cli_name (string), cli_description (string), category (string)\\n` +\n ` Validate your YAML syntax at https://yamllint.com`,\n );\n }\n const metadata = parseResult.success\n ? (parseResult.data as SkillMetadata)\n : { forked_from: undefined };\n metadata.forked_from = forkedFrom;\n\n const newYamlContent = stringifyYaml(metadata, {\n lineWidth: YAML_FORMATTING.LINE_WIDTH_NONE,\n });\n await writeFile(metadataYamlPath, schemaComment + newYamlContent);\n return;\n }\n\n if (await fileExists(metadataJsonPath)) {\n const rawContent = await readFile(metadataJsonPath);\n let jsonParsed: unknown;\n try {\n jsonParsed = JSON.parse(rawContent);\n } catch {\n this.warn(\n `Malformed JSON in ${metadataJsonPath} — skipping metadata injection\\n` +\n ` Common issues: trailing commas, unquoted keys, single quotes instead of double quotes\\n` +\n ` Validate your JSON at https://jsonlint.com`,\n );\n return;\n }\n const jsonResult = importedSkillMetadataSchema.safeParse(jsonParsed);\n const metadata = jsonResult.success\n ? (jsonResult.data as SkillMetadata)\n : { forked_from: undefined };\n metadata.forked_from = forkedFrom;\n\n const yamlContent = stringifyYaml(metadata, { lineWidth: YAML_FORMATTING.LINE_WIDTH_NONE });\n await writeFile(metadataYamlPath, yamlContent);\n return;\n }\n\n const minimalMetadata: SkillMetadata = {\n cli_name: skillName\n .split(\"-\")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \"),\n cli_description: \"Imported from third-party repository\",\n category: IMPORT_DEFAULTS.CATEGORY,\n category_exclusive: false,\n author: IMPORT_DEFAULTS.AUTHOR,\n forked_from: forkedFrom,\n };\n\n const yamlContent = stringifyYaml(minimalMetadata, {\n lineWidth: YAML_FORMATTING.LINE_WIDTH_NONE,\n });\n await writeFile(metadataYamlPath, yamlContent);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,SAAS,MAAM,aAAa;AAC5B,OAAO,UAAU;AACjB,SAAS,SAAS,WAAW,aAAa,qBAAqB;AA2C/D,IAAM,gBAAgB,eAAe;AACrC,IAAM,qBAAqB,eAAe;AAC1C,IAAM,qBAAqB,eAAe;AAE1C,SAAS,kBAAkB,QAGzB;AACA,MAAI,OAAO,WAAW,cAAc,YAAY,GAAG;AACjD,UAAMA,QAAO,OAAO,QAAQ,cAAc,cAAc,EAAE;AAC1D,WAAO;AAAA,MACL,aAAa,GAAG,cAAc,aAAa,GAAGA,KAAI;AAAA,MAClD,eAAe;AAAA,IACjB;AAAA,EACF;AAEA,MACE,OAAO,WAAW,cAAc,aAAa,KAC7C,OAAO,WAAW,cAAc,SAAS,GACzC;AACA,UAAM,aAAa,OAAO,WAAW,cAAc,SAAS,IACxD,cAAc,gBAAgB,OAAO,MAAM,cAAc,UAAU,MAAM,IACzE;AACJ,WAAO;AAAA,MACL,aAAa;AAAA,MACb,eAAe,GAAG,cAAc,YAAY,GAAG,WAAW,QAAQ,cAAc,eAAe,EAAE,CAAC;AAAA,IACpG;AAAA,EACF;AAEA,MAAI,OAAO,SAAS,GAAG,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AA,IAC7B,CAAC;AACD,UAAM,UAAU,kBAAkB,WAAW;AAAA,EAC/C;AACF;","names":["path","yamlContent"]}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
STATUS_MESSAGES
|
|
4
|
+
} from "../chunk-R74PZWQS.js";
|
|
5
|
+
import {
|
|
6
|
+
BaseCommand,
|
|
7
|
+
EXIT_CODES
|
|
8
|
+
} from "../chunk-ODUOU55D.js";
|
|
9
|
+
import {
|
|
10
|
+
discoverLocalSkills,
|
|
11
|
+
loadSkillsMatrixFromSource
|
|
12
|
+
} from "../chunk-MM7NK5N2.js";
|
|
13
|
+
import "../chunk-T4EXUIBY.js";
|
|
14
|
+
import {
|
|
15
|
+
fileExists,
|
|
16
|
+
readFile
|
|
17
|
+
} from "../chunk-BZN2Z5P7.js";
|
|
18
|
+
import {
|
|
19
|
+
STANDARD_FILES
|
|
20
|
+
} from "../chunk-LAPCUV4D.js";
|
|
21
|
+
import {
|
|
22
|
+
init_esm_shims
|
|
23
|
+
} from "../chunk-DHET7RCE.js";
|
|
24
|
+
|
|
25
|
+
// src/cli/commands/info.ts
|
|
26
|
+
init_esm_shims();
|
|
27
|
+
import { Args, Flags } from "@oclif/core";
|
|
28
|
+
import path from "path";
|
|
29
|
+
var CONTENT_PREVIEW_LINES = 10;
|
|
30
|
+
var MAX_LINE_LENGTH = 80;
|
|
31
|
+
var MAX_SUGGESTIONS = 5;
|
|
32
|
+
function stripFrontmatter(content) {
|
|
33
|
+
const lines = content.split("\n");
|
|
34
|
+
let inFrontmatter = false;
|
|
35
|
+
let frontmatterEndIndex = 0;
|
|
36
|
+
for (let i = 0; i < lines.length; i++) {
|
|
37
|
+
const line = lines[i].trim();
|
|
38
|
+
if (line === "---") {
|
|
39
|
+
if (!inFrontmatter) {
|
|
40
|
+
inFrontmatter = true;
|
|
41
|
+
} else {
|
|
42
|
+
frontmatterEndIndex = i + 1;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return lines.slice(frontmatterEndIndex).join("\n");
|
|
48
|
+
}
|
|
49
|
+
function getPreviewLines(content, maxLines) {
|
|
50
|
+
const body = stripFrontmatter(content);
|
|
51
|
+
const lines = body.split("\n");
|
|
52
|
+
const result = [];
|
|
53
|
+
for (const line of lines) {
|
|
54
|
+
if (result.length >= maxLines) break;
|
|
55
|
+
if (line.trim() || result.length > 0) {
|
|
56
|
+
const truncated = line.length > MAX_LINE_LENGTH ? `${line.slice(0, MAX_LINE_LENGTH - 3)}...` : line;
|
|
57
|
+
result.push(truncated);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
function formatRelations(relations) {
|
|
63
|
+
if (relations.length === 0) {
|
|
64
|
+
return "(none)";
|
|
65
|
+
}
|
|
66
|
+
return relations.map((r) => r.skillId).join(", ");
|
|
67
|
+
}
|
|
68
|
+
function formatRequirements(requirements) {
|
|
69
|
+
if (requirements.length === 0) {
|
|
70
|
+
return "(none)";
|
|
71
|
+
}
|
|
72
|
+
return requirements.map((req) => {
|
|
73
|
+
const prefix = req.needsAny ? "any of: " : "";
|
|
74
|
+
return prefix + req.skillIds.join(", ");
|
|
75
|
+
}).join("; ");
|
|
76
|
+
}
|
|
77
|
+
function formatTags(tags) {
|
|
78
|
+
if (tags.length === 0) {
|
|
79
|
+
return "(none)";
|
|
80
|
+
}
|
|
81
|
+
return tags.join(", ");
|
|
82
|
+
}
|
|
83
|
+
function findSuggestions(skills, query, maxSuggestions) {
|
|
84
|
+
const lowerQuery = query.toLowerCase();
|
|
85
|
+
const matches = [];
|
|
86
|
+
for (const skill of Object.values(skills)) {
|
|
87
|
+
if (!skill) continue;
|
|
88
|
+
if (matches.length >= maxSuggestions) break;
|
|
89
|
+
if (skill.id.toLowerCase().includes(lowerQuery) || skill.displayName?.toLowerCase().includes(lowerQuery)) {
|
|
90
|
+
matches.push(skill.id);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return matches;
|
|
94
|
+
}
|
|
95
|
+
function formatSkillInfo(skill, isInstalled) {
|
|
96
|
+
const lines = [];
|
|
97
|
+
lines.push(`Skill: ${skill.id}`);
|
|
98
|
+
if (skill.displayName) {
|
|
99
|
+
lines.push(`Alias: ${skill.displayName}`);
|
|
100
|
+
}
|
|
101
|
+
lines.push(`Author: ${skill.author}`);
|
|
102
|
+
lines.push(`Category: ${skill.category}`);
|
|
103
|
+
lines.push("");
|
|
104
|
+
lines.push("Description:");
|
|
105
|
+
lines.push(` ${skill.description}`);
|
|
106
|
+
lines.push("");
|
|
107
|
+
lines.push(`Tags: ${formatTags(skill.tags)}`);
|
|
108
|
+
lines.push("");
|
|
109
|
+
lines.push(`Requires: ${formatRequirements(skill.requires)}`);
|
|
110
|
+
lines.push(`Conflicts with: ${formatRelations(skill.conflictsWith)}`);
|
|
111
|
+
lines.push(`Recommends: ${formatRelations(skill.recommends)}`);
|
|
112
|
+
if (skill.usageGuidance) {
|
|
113
|
+
lines.push("");
|
|
114
|
+
lines.push("Usage Guidance:");
|
|
115
|
+
lines.push(` ${skill.usageGuidance}`);
|
|
116
|
+
}
|
|
117
|
+
lines.push("");
|
|
118
|
+
lines.push(`Local Status: ${isInstalled ? "Installed" : "Not installed"}`);
|
|
119
|
+
return lines.join("\n");
|
|
120
|
+
}
|
|
121
|
+
var Info = class _Info extends BaseCommand {
|
|
122
|
+
static summary = "Show detailed information about a skill";
|
|
123
|
+
static description = "Display comprehensive information about a skill including metadata, relationships, and content preview";
|
|
124
|
+
static examples = [
|
|
125
|
+
{
|
|
126
|
+
description: "Show info for a skill by ID",
|
|
127
|
+
command: "<%= config.bin %> <%= command.id %> web-framework-react"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
description: "Show info without content preview",
|
|
131
|
+
command: "<%= config.bin %> <%= command.id %> web-framework-react --no-preview"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
description: "Show info from a custom source",
|
|
135
|
+
command: "<%= config.bin %> <%= command.id %> my-skill --source github:org/marketplace"
|
|
136
|
+
}
|
|
137
|
+
];
|
|
138
|
+
static args = {
|
|
139
|
+
skill: Args.string({
|
|
140
|
+
description: "Skill ID or alias to look up",
|
|
141
|
+
required: true
|
|
142
|
+
})
|
|
143
|
+
};
|
|
144
|
+
static flags = {
|
|
145
|
+
...BaseCommand.baseFlags,
|
|
146
|
+
preview: Flags.boolean({
|
|
147
|
+
description: "Show content preview from SKILL.md",
|
|
148
|
+
default: true,
|
|
149
|
+
allowNo: true
|
|
150
|
+
})
|
|
151
|
+
};
|
|
152
|
+
async run() {
|
|
153
|
+
const { args, flags } = await this.parse(_Info);
|
|
154
|
+
try {
|
|
155
|
+
this.log(STATUS_MESSAGES.LOADING_SKILLS);
|
|
156
|
+
const { matrix, sourcePath, isLocal } = await loadSkillsMatrixFromSource({
|
|
157
|
+
sourceFlag: flags.source
|
|
158
|
+
});
|
|
159
|
+
this.log(`Loaded from ${isLocal ? "local" : "remote"}: ${sourcePath}`);
|
|
160
|
+
let skill = matrix.skills[args.skill];
|
|
161
|
+
if (!skill) {
|
|
162
|
+
const fullId = matrix.displayNameToId[args.skill];
|
|
163
|
+
if (fullId) {
|
|
164
|
+
skill = matrix.skills[fullId];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (!skill) {
|
|
168
|
+
const suggestions = findSuggestions(matrix.skills, args.skill, MAX_SUGGESTIONS);
|
|
169
|
+
this.log("");
|
|
170
|
+
this.error(`Skill "${args.skill}" not found.`, { exit: false });
|
|
171
|
+
if (suggestions.length > 0) {
|
|
172
|
+
this.log("");
|
|
173
|
+
this.log("Did you mean one of these?");
|
|
174
|
+
for (const suggestion of suggestions) {
|
|
175
|
+
this.log(` - ${suggestion}`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
this.log("");
|
|
179
|
+
this.logInfo("Use 'cc search <query>' to find available skills.");
|
|
180
|
+
this.log("");
|
|
181
|
+
this.exit(EXIT_CODES.ERROR);
|
|
182
|
+
}
|
|
183
|
+
const localSkillsResult = await discoverLocalSkills(process.cwd());
|
|
184
|
+
const localSkillIds = localSkillsResult?.skills.map((s) => s.id) || [];
|
|
185
|
+
const isInstalled = localSkillIds.includes(skill.id);
|
|
186
|
+
this.log("");
|
|
187
|
+
this.log(formatSkillInfo(skill, isInstalled));
|
|
188
|
+
if (flags.preview) {
|
|
189
|
+
let skillMdPath;
|
|
190
|
+
if (skill.local && skill.localPath) {
|
|
191
|
+
skillMdPath = path.join(process.cwd(), skill.localPath, STANDARD_FILES.SKILL_MD);
|
|
192
|
+
} else {
|
|
193
|
+
const sourceDir = isLocal ? sourcePath : path.dirname(sourcePath);
|
|
194
|
+
skillMdPath = path.join(sourceDir, skill.path, STANDARD_FILES.SKILL_MD);
|
|
195
|
+
}
|
|
196
|
+
if (await fileExists(skillMdPath)) {
|
|
197
|
+
const content = await readFile(skillMdPath);
|
|
198
|
+
const previewLines = getPreviewLines(content, CONTENT_PREVIEW_LINES);
|
|
199
|
+
if (previewLines.length > 0) {
|
|
200
|
+
this.log("");
|
|
201
|
+
this.log(`--- Content Preview (first ${CONTENT_PREVIEW_LINES} lines) ---`);
|
|
202
|
+
for (const line of previewLines) {
|
|
203
|
+
this.log(line);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
this.log("");
|
|
209
|
+
} catch (error) {
|
|
210
|
+
this.handleError(error);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
export {
|
|
215
|
+
Info as default
|
|
216
|
+
};
|
|
217
|
+
//# sourceMappingURL=info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/cli/commands/info.ts"],"sourcesContent":["import { Args, Flags } from \"@oclif/core\";\nimport path from \"path\";\nimport { BaseCommand } from \"../base-command.js\";\nimport { loadSkillsMatrixFromSource } from \"../lib/loading/index.js\";\nimport { discoverLocalSkills } from \"../lib/skills/index.js\";\nimport { fileExists, readFile } from \"../utils/fs.js\";\nimport { STANDARD_FILES } from \"../consts.js\";\nimport { EXIT_CODES } from \"../lib/exit-codes.js\";\nimport { STATUS_MESSAGES } from \"../utils/messages.js\";\nimport type {\n ResolvedSkill,\n SkillDisplayName,\n SkillId,\n SkillRelation,\n SkillRequirement,\n} from \"../types/index.js\";\n\nconst CONTENT_PREVIEW_LINES = 10;\nconst MAX_LINE_LENGTH = 80;\nconst MAX_SUGGESTIONS = 5;\n\nfunction stripFrontmatter(content: string): string {\n const lines = content.split(\"\\n\");\n let inFrontmatter = false;\n let frontmatterEndIndex = 0;\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i].trim();\n if (line === \"---\") {\n if (!inFrontmatter) {\n inFrontmatter = true;\n } else {\n frontmatterEndIndex = i + 1;\n break;\n }\n }\n }\n\n return lines.slice(frontmatterEndIndex).join(\"\\n\");\n}\n\nfunction getPreviewLines(content: string, maxLines: number): string[] {\n const body = stripFrontmatter(content);\n const lines = body.split(\"\\n\");\n const result: string[] = [];\n\n for (const line of lines) {\n if (result.length >= maxLines) break;\n if (line.trim() || result.length > 0) {\n const truncated =\n line.length > MAX_LINE_LENGTH ? `${line.slice(0, MAX_LINE_LENGTH - 3)}...` : line;\n result.push(truncated);\n }\n }\n\n return result;\n}\n\nfunction formatRelations(relations: SkillRelation[]): string {\n if (relations.length === 0) {\n return \"(none)\";\n }\n return relations.map((r) => r.skillId).join(\", \");\n}\n\nfunction formatRequirements(requirements: SkillRequirement[]): string {\n if (requirements.length === 0) {\n return \"(none)\";\n }\n return requirements\n .map((req) => {\n const prefix = req.needsAny ? \"any of: \" : \"\";\n return prefix + req.skillIds.join(\", \");\n })\n .join(\"; \");\n}\n\nfunction formatTags(tags: string[]): string {\n if (tags.length === 0) {\n return \"(none)\";\n }\n return tags.join(\", \");\n}\n\nfunction findSuggestions(\n skills: Partial<Record<SkillId, ResolvedSkill>>,\n query: string,\n maxSuggestions: number,\n): string[] {\n const lowerQuery = query.toLowerCase();\n const matches: string[] = [];\n\n for (const skill of Object.values(skills)) {\n if (!skill) continue;\n if (matches.length >= maxSuggestions) break;\n if (\n skill.id.toLowerCase().includes(lowerQuery) ||\n skill.displayName?.toLowerCase().includes(lowerQuery)\n ) {\n matches.push(skill.id);\n }\n }\n\n return matches;\n}\n\nfunction formatSkillInfo(skill: ResolvedSkill, isInstalled: boolean): string {\n const lines: string[] = [];\n\n lines.push(`Skill: ${skill.id}`);\n if (skill.displayName) {\n lines.push(`Alias: ${skill.displayName}`);\n }\n lines.push(`Author: ${skill.author}`);\n lines.push(`Category: ${skill.category}`);\n lines.push(\"\");\n lines.push(\"Description:\");\n lines.push(` ${skill.description}`);\n lines.push(\"\");\n lines.push(`Tags: ${formatTags(skill.tags)}`);\n lines.push(\"\");\n lines.push(`Requires: ${formatRequirements(skill.requires)}`);\n lines.push(`Conflicts with: ${formatRelations(skill.conflictsWith)}`);\n lines.push(`Recommends: ${formatRelations(skill.recommends)}`);\n\n if (skill.usageGuidance) {\n lines.push(\"\");\n lines.push(\"Usage Guidance:\");\n lines.push(` ${skill.usageGuidance}`);\n }\n\n lines.push(\"\");\n lines.push(`Local Status: ${isInstalled ? \"Installed\" : \"Not installed\"}`);\n\n return lines.join(\"\\n\");\n}\n\nexport default class Info extends BaseCommand {\n static summary = \"Show detailed information about a skill\";\n static description =\n \"Display comprehensive information about a skill including metadata, relationships, and content preview\";\n\n static examples = [\n {\n description: \"Show info for a skill by ID\",\n command: \"<%= config.bin %> <%= command.id %> web-framework-react\",\n },\n {\n description: \"Show info without content preview\",\n command: \"<%= config.bin %> <%= command.id %> web-framework-react --no-preview\",\n },\n {\n description: \"Show info from a custom source\",\n command: \"<%= config.bin %> <%= command.id %> my-skill --source github:org/marketplace\",\n },\n ];\n\n static args = {\n skill: Args.string({\n description: \"Skill ID or alias to look up\",\n required: true,\n }),\n };\n\n static flags = {\n ...BaseCommand.baseFlags,\n preview: Flags.boolean({\n description: \"Show content preview from SKILL.md\",\n default: true,\n allowNo: true,\n }),\n };\n\n async run(): Promise<void> {\n const { args, flags } = await this.parse(Info);\n\n try {\n this.log(STATUS_MESSAGES.LOADING_SKILLS);\n\n const { matrix, sourcePath, isLocal } = await loadSkillsMatrixFromSource({\n sourceFlag: flags.source,\n });\n\n this.log(`Loaded from ${isLocal ? \"local\" : \"remote\"}: ${sourcePath}`);\n\n // CLI arg is an untyped string — cast at data boundary\n let skill: ResolvedSkill | undefined = matrix.skills[args.skill as SkillId];\n\n if (!skill) {\n // Try alias lookup — CLI arg is an untyped string\n const fullId = matrix.displayNameToId[args.skill as SkillDisplayName];\n if (fullId) {\n skill = matrix.skills[fullId];\n }\n }\n\n if (!skill) {\n const suggestions = findSuggestions(matrix.skills, args.skill, MAX_SUGGESTIONS);\n\n this.log(\"\");\n this.error(`Skill \"${args.skill}\" not found.`, { exit: false });\n\n if (suggestions.length > 0) {\n this.log(\"\");\n this.log(\"Did you mean one of these?\");\n for (const suggestion of suggestions) {\n this.log(` - ${suggestion}`);\n }\n }\n\n this.log(\"\");\n this.logInfo(\"Use 'cc search <query>' to find available skills.\");\n this.log(\"\");\n this.exit(EXIT_CODES.ERROR);\n }\n\n const localSkillsResult = await discoverLocalSkills(process.cwd());\n const localSkillIds = localSkillsResult?.skills.map((s) => s.id) || [];\n const isInstalled = localSkillIds.includes(skill.id);\n\n this.log(\"\");\n this.log(formatSkillInfo(skill, isInstalled));\n\n if (flags.preview) {\n let skillMdPath: string;\n\n if (skill.local && skill.localPath) {\n skillMdPath = path.join(process.cwd(), skill.localPath, STANDARD_FILES.SKILL_MD);\n } else {\n const sourceDir = isLocal ? sourcePath : path.dirname(sourcePath);\n skillMdPath = path.join(sourceDir, skill.path, STANDARD_FILES.SKILL_MD);\n }\n\n if (await fileExists(skillMdPath)) {\n const content = await readFile(skillMdPath);\n const previewLines = getPreviewLines(content, CONTENT_PREVIEW_LINES);\n\n if (previewLines.length > 0) {\n this.log(\"\");\n this.log(`--- Content Preview (first ${CONTENT_PREVIEW_LINES} lines) ---`);\n for (const line of previewLines) {\n this.log(line);\n }\n }\n }\n }\n\n this.log(\"\");\n } catch (error) {\n this.handleError(error);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,SAAS,MAAM,aAAa;AAC5B,OAAO,UAAU;AAgBjB,IAAM,wBAAwB;AAC9B,IAAM,kBAAkB;AACxB,IAAM,kBAAkB;AAExB,SAAS,iBAAiB,SAAyB;AACjD,QAAM,QAAQ,QAAQ,MAAM,IAAI;AAChC,MAAI,gBAAgB;AACpB,MAAI,sBAAsB;AAE1B,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,UAAM,OAAO,MAAM,CAAC,EAAE,KAAK;AAC3B,QAAI,SAAS,OAAO;AAClB,UAAI,CAAC,eAAe;AAClB,wBAAgB;AAAA,MAClB,OAAO;AACL,8BAAsB,IAAI;AAC1B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO,MAAM,MAAM,mBAAmB,EAAE,KAAK,IAAI;AACnD;AAEA,SAAS,gBAAgB,SAAiB,UAA4B;AACpE,QAAM,OAAO,iBAAiB,OAAO;AACrC,QAAM,QAAQ,KAAK,MAAM,IAAI;AAC7B,QAAM,SAAmB,CAAC;AAE1B,aAAW,QAAQ,OAAO;AACxB,QAAI,OAAO,UAAU,SAAU;AAC/B,QAAI,KAAK,KAAK,KAAK,OAAO,SAAS,GAAG;AACpC,YAAM,YACJ,KAAK,SAAS,kBAAkB,GAAG,KAAK,MAAM,GAAG,kBAAkB,CAAC,CAAC,QAAQ;AAC/E,aAAO,KAAK,SAAS;AAAA,IACvB;AAAA,EACF;AAEA,SAAO;AACT;AAEA,SAAS,gBAAgB,WAAoC;AAC3D,MAAI,UAAU,WAAW,GAAG;AAC1B,WAAO;AAAA,EACT;AACA,SAAO,UAAU,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAA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