opkg 0.6.1 → 0.7.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 +109 -186
- package/assets/openpackage_ascii_dark.png +0 -0
- package/assets/openpackage_ascii_light.png +0 -0
- package/dist/commands/add.js +34 -10
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/apply.js +16 -0
- package/dist/commands/apply.js.map +1 -0
- package/dist/commands/delete.js +1 -1
- package/dist/commands/delete.js.map +1 -1
- package/dist/commands/install.js +177 -8
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/list.js +2 -2
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/login.js +1 -1
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.js +1 -1
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/new.js +125 -0
- package/dist/commands/new.js.map +1 -0
- package/dist/commands/pack.js +7 -13
- package/dist/commands/pack.js.map +1 -1
- package/dist/commands/pull.js +1 -1
- package/dist/commands/pull.js.map +1 -1
- package/dist/commands/push.js +1 -1
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/remove.js +63 -0
- package/dist/commands/remove.js.map +1 -0
- package/dist/commands/save.js +11 -17
- package/dist/commands/save.js.map +1 -1
- package/dist/commands/set.js +33 -0
- package/dist/commands/set.js.map +1 -0
- package/dist/commands/show.js +16 -94
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/status.js +26 -701
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/uninstall.js +14 -427
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/constants/index.js +72 -16
- package/dist/constants/index.js.map +1 -1
- package/dist/core/add/add-conflict-handler.js +1 -8
- package/dist/core/add/add-conflict-handler.js.map +1 -1
- package/dist/core/add/add-pipeline.js +12 -10
- package/dist/core/add/add-pipeline.js.map +1 -1
- package/dist/core/add/add-to-source-pipeline.js +123 -0
- package/dist/core/add/add-to-source-pipeline.js.map +1 -0
- package/dist/core/add/package-index-updater.js +77 -78
- package/dist/core/add/package-index-updater.js.map +1 -1
- package/dist/core/add/platform-path-transformer.js +6 -4
- package/dist/core/add/platform-path-transformer.js.map +1 -1
- package/dist/core/add/source-collector.js +2 -3
- package/dist/core/add/source-collector.js.map +1 -1
- package/dist/core/apply/apply-pipeline.js +110 -0
- package/dist/core/apply/apply-pipeline.js.map +1 -0
- package/dist/core/dependency-resolver.js +263 -21
- package/dist/core/dependency-resolver.js.map +1 -1
- package/dist/core/discovery/file-discovery.js +1 -2
- package/dist/core/discovery/file-discovery.js.map +1 -1
- package/dist/core/discovery/platform-files-discovery.js +33 -18
- package/dist/core/discovery/platform-files-discovery.js.map +1 -1
- package/dist/core/flows/flow-executor.js +974 -0
- package/dist/core/flows/flow-executor.js.map +1 -0
- package/dist/core/flows/flow-inverter.js +442 -0
- package/dist/core/flows/flow-inverter.js.map +1 -0
- package/dist/core/flows/flow-key-extractor.js +101 -0
- package/dist/core/flows/flow-key-extractor.js.map +1 -0
- package/dist/core/flows/flow-key-mapper.js +382 -0
- package/dist/core/flows/flow-key-mapper.js.map +1 -0
- package/dist/core/flows/flow-transforms.js +632 -0
- package/dist/core/flows/flow-transforms.js.map +1 -0
- package/dist/core/flows/map-pipeline/context.js +73 -0
- package/dist/core/flows/map-pipeline/context.js.map +1 -0
- package/dist/core/flows/map-pipeline/index.js +156 -0
- package/dist/core/flows/map-pipeline/index.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/copy.js +104 -0
- package/dist/core/flows/map-pipeline/operations/copy.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/pipe.js +70 -0
- package/dist/core/flows/map-pipeline/operations/pipe.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/rename.js +102 -0
- package/dist/core/flows/map-pipeline/operations/rename.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/set.js +50 -0
- package/dist/core/flows/map-pipeline/operations/set.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/switch.js +79 -0
- package/dist/core/flows/map-pipeline/operations/switch.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/transform.js +543 -0
- package/dist/core/flows/map-pipeline/operations/transform.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/unset.js +65 -0
- package/dist/core/flows/map-pipeline/operations/unset.js.map +1 -0
- package/dist/core/flows/map-pipeline/types.js +8 -0
- package/dist/core/flows/map-pipeline/types.js.map +1 -0
- package/dist/core/flows/map-pipeline/utils.js +278 -0
- package/dist/core/flows/map-pipeline/utils.js.map +1 -0
- package/dist/core/flows/platform-converter.js +328 -0
- package/dist/core/flows/platform-converter.js.map +1 -0
- package/dist/core/flows/source-resolver.js +192 -0
- package/dist/core/flows/source-resolver.js.map +1 -0
- package/dist/core/flows/toml-domain-transforms.js +23 -0
- package/dist/core/flows/toml-domain-transforms.js.map +1 -0
- package/dist/core/install/bulk-install-pipeline.js +68 -7
- package/dist/core/install/bulk-install-pipeline.js.map +1 -1
- package/dist/core/install/canonical-plan.js +3 -3
- package/dist/core/install/canonical-plan.js.map +1 -1
- package/dist/core/install/dry-run.js +3 -3
- package/dist/core/install/dry-run.js.map +1 -1
- package/dist/core/install/flow-based-installer.js +1158 -0
- package/dist/core/install/flow-based-installer.js.map +1 -0
- package/dist/core/install/flow-workspace-tracker.js +111 -0
- package/dist/core/install/flow-workspace-tracker.js.map +1 -0
- package/dist/core/install/format-detector.js +228 -0
- package/dist/core/install/format-detector.js.map +1 -0
- package/dist/core/install/git-package-loader.js +20 -0
- package/dist/core/install/git-package-loader.js.map +1 -0
- package/dist/core/install/install-errors.js +1 -1
- package/dist/core/install/install-errors.js.map +1 -1
- package/dist/core/install/install-flow.js +34 -14
- package/dist/core/install/install-flow.js.map +1 -1
- package/dist/core/install/install-pipeline.js +52 -17
- package/dist/core/install/install-pipeline.js.map +1 -1
- package/dist/core/install/install-reporting.js +26 -8
- package/dist/core/install/install-reporting.js.map +1 -1
- package/dist/core/install/local-source-resolution.js +103 -0
- package/dist/core/install/local-source-resolution.js.map +1 -0
- package/dist/core/install/marketplace-handler.js +221 -0
- package/dist/core/install/marketplace-handler.js.map +1 -0
- package/dist/core/install/path-install-pipeline.js +241 -0
- package/dist/core/install/path-install-pipeline.js.map +1 -0
- package/dist/core/install/path-package-loader.js +116 -0
- package/dist/core/install/path-package-loader.js.map +1 -0
- package/dist/core/install/plugin-detector.js +72 -0
- package/dist/core/install/plugin-detector.js.map +1 -0
- package/dist/core/install/plugin-to-universal-converter.js +218 -0
- package/dist/core/install/plugin-to-universal-converter.js.map +1 -0
- package/dist/core/install/plugin-transformer.js +191 -0
- package/dist/core/install/plugin-transformer.js.map +1 -0
- package/dist/core/install/version-selection.js +1 -1
- package/dist/core/install/version-selection.js.map +1 -1
- package/dist/core/openpackage.js +40 -22
- package/dist/core/openpackage.js.map +1 -1
- package/dist/core/pack/pack-output.js +62 -0
- package/dist/core/pack/pack-output.js.map +1 -0
- package/dist/core/pack/pack-pipeline.js +186 -0
- package/dist/core/pack/pack-pipeline.js.map +1 -0
- package/dist/core/package-context.js +45 -70
- package/dist/core/package-context.js.map +1 -1
- package/dist/core/package-creation.js +203 -0
- package/dist/core/package-creation.js.map +1 -0
- package/dist/core/package.js +20 -6
- package/dist/core/package.js.map +1 -1
- package/dist/core/platforms.js +665 -209
- package/dist/core/platforms.js.map +1 -1
- package/dist/core/push/push-context.js +1 -1
- package/dist/core/push/push-context.js.map +1 -1
- package/dist/core/push/push-upload.js +2 -2
- package/dist/core/push/push-upload.js.map +1 -1
- package/dist/core/registry.js +6 -6
- package/dist/core/registry.js.map +1 -1
- package/dist/core/remote-pull.js +2 -2
- package/dist/core/remote-pull.js.map +1 -1
- package/dist/core/remove/removal-collector.js +52 -0
- package/dist/core/remove/removal-collector.js.map +1 -0
- package/dist/core/remove/removal-confirmation.js +39 -0
- package/dist/core/remove/removal-confirmation.js.map +1 -0
- package/dist/core/remove/remove-from-source-pipeline.js +173 -0
- package/dist/core/remove/remove-from-source-pipeline.js.map +1 -0
- package/dist/core/save/constants.js +3 -3
- package/dist/core/save/constants.js.map +1 -1
- package/dist/core/save/flow-based-saver.js +270 -0
- package/dist/core/save/flow-based-saver.js.map +1 -0
- package/dist/core/save/name-resolution.js +1 -1
- package/dist/core/save/name-resolution.js.map +1 -1
- package/dist/core/save/package-yml-generator.js +4 -5
- package/dist/core/save/package-yml-generator.js.map +1 -1
- package/dist/core/save/save-candidate-builder.js +215 -0
- package/dist/core/save/save-candidate-builder.js.map +1 -0
- package/dist/core/save/save-candidate-loader.js +12 -11
- package/dist/core/save/save-candidate-loader.js.map +1 -1
- package/dist/core/save/save-conflict-analyzer.js +150 -0
- package/dist/core/save/save-conflict-analyzer.js.map +1 -0
- package/dist/core/save/save-conflict-resolution.js +28 -14
- package/dist/core/save/save-conflict-resolution.js.map +1 -1
- package/dist/core/save/save-conflict-resolver.js +31 -275
- package/dist/core/save/save-conflict-resolver.js.map +1 -1
- package/dist/core/save/save-group-builder.js +52 -0
- package/dist/core/save/save-group-builder.js.map +1 -0
- package/dist/core/save/save-interactive-resolver.js +190 -0
- package/dist/core/save/save-interactive-resolver.js.map +1 -0
- package/dist/core/save/save-pipeline.js +58 -34
- package/dist/core/save/save-pipeline.js.map +1 -1
- package/dist/core/save/save-platform-handler.js +53 -0
- package/dist/core/save/save-platform-handler.js.map +1 -0
- package/dist/core/save/save-resolution-executor.js +145 -0
- package/dist/core/save/save-resolution-executor.js.map +1 -0
- package/dist/core/save/save-result-reporter.js +167 -0
- package/dist/core/save/save-result-reporter.js.map +1 -0
- package/dist/core/save/save-to-source-pipeline.js +154 -0
- package/dist/core/save/save-to-source-pipeline.js.map +1 -0
- package/dist/core/save/save-versioning.js +4 -4
- package/dist/core/save/save-versioning.js.map +1 -1
- package/dist/core/save/save-write-coordinator.js +204 -0
- package/dist/core/save/save-write-coordinator.js.map +1 -0
- package/dist/core/save/save-yml-resolution.js +28 -216
- package/dist/core/save/save-yml-resolution.js.map +1 -1
- package/dist/core/save/workspace-rename.js +7 -8
- package/dist/core/save/workspace-rename.js.map +1 -1
- package/dist/core/set/set-output.js +72 -0
- package/dist/core/set/set-output.js.map +1 -0
- package/dist/core/set/set-pipeline.js +361 -0
- package/dist/core/set/set-pipeline.js.map +1 -0
- package/dist/core/set/set-types.js +5 -0
- package/dist/core/set/set-types.js.map +1 -0
- package/dist/core/show/package-resolver.js +257 -0
- package/dist/core/show/package-resolver.js.map +1 -0
- package/dist/core/show/scope-discovery.js +165 -0
- package/dist/core/show/scope-discovery.js.map +1 -0
- package/dist/core/show/show-output.js +168 -0
- package/dist/core/show/show-output.js.map +1 -0
- package/dist/core/show/show-pipeline.js +113 -0
- package/dist/core/show/show-pipeline.js.map +1 -0
- package/dist/core/show/show-types.js +5 -0
- package/dist/core/show/show-types.js.map +1 -0
- package/dist/core/source-resolution/dependency-graph.js +104 -0
- package/dist/core/source-resolution/dependency-graph.js.map +1 -0
- package/dist/core/source-resolution/resolve-mutable-source.js +109 -0
- package/dist/core/source-resolution/resolve-mutable-source.js.map +1 -0
- package/dist/core/source-resolution/resolve-package-source.js +29 -0
- package/dist/core/source-resolution/resolve-package-source.js.map +1 -0
- package/dist/core/source-resolution/resolve-registry-version.js +35 -0
- package/dist/core/source-resolution/resolve-registry-version.js.map +1 -0
- package/dist/core/source-resolution/types.js.map +1 -0
- package/dist/core/status/status-file-discovery.js +23 -12
- package/dist/core/status/status-file-discovery.js.map +1 -1
- package/dist/core/status/status-pipeline.js +134 -0
- package/dist/core/status/status-pipeline.js.map +1 -0
- package/dist/core/sync/platform-sync-summary.js +27 -0
- package/dist/core/sync/platform-sync-summary.js.map +1 -0
- package/dist/core/uninstall/flow-aware-uninstaller.js +189 -0
- package/dist/core/uninstall/flow-aware-uninstaller.js.map +1 -0
- package/dist/core/uninstall/uninstall-file-discovery.js +11 -6
- package/dist/core/uninstall/uninstall-file-discovery.js.map +1 -1
- package/dist/core/uninstall/uninstall-pipeline.js +141 -0
- package/dist/core/uninstall/uninstall-pipeline.js.map +1 -0
- package/dist/core/universal-patterns.js +64 -0
- package/dist/core/universal-patterns.js.map +1 -0
- package/dist/index.js +99 -6
- package/dist/index.js.map +1 -1
- package/dist/types/flows.js +8 -0
- package/dist/types/flows.js.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/platform-flows.js +8 -0
- package/dist/types/platform-flows.js.map +1 -0
- package/dist/types/workspace-index.js +6 -0
- package/dist/types/workspace-index.js.map +1 -0
- package/dist/utils/custom-path-resolution.js +160 -0
- package/dist/utils/custom-path-resolution.js.map +1 -0
- package/dist/utils/dependency-coverage.js +1 -1
- package/dist/utils/dependency-coverage.js.map +1 -1
- package/dist/utils/file-processing.js +1 -1
- package/dist/utils/flow-index-installer.js +209 -0
- package/dist/utils/flow-index-installer.js.map +1 -0
- package/dist/utils/formatters.js +47 -1
- package/dist/utils/formatters.js.map +1 -1
- package/dist/utils/fs.js +17 -0
- package/dist/utils/fs.js.map +1 -1
- package/dist/utils/git-clone-registry.js +88 -0
- package/dist/utils/git-clone-registry.js.map +1 -0
- package/dist/utils/git-clone.js +69 -0
- package/dist/utils/git-clone.js.map +1 -0
- package/dist/utils/git-spec.js +96 -0
- package/dist/utils/git-spec.js.map +1 -0
- package/dist/utils/http-client.js +7 -0
- package/dist/utils/http-client.js.map +1 -1
- package/dist/utils/index-based-installer.js +356 -163
- package/dist/utils/index-based-installer.js.map +1 -1
- package/dist/utils/install-conflict-handler.js +2 -2
- package/dist/utils/install-conflict-handler.js.map +1 -1
- package/dist/utils/install-file-discovery.js +18 -13
- package/dist/utils/install-file-discovery.js.map +1 -1
- package/dist/utils/install-helpers.js +43 -20
- package/dist/utils/install-helpers.js.map +1 -1
- package/dist/utils/jsonc.js +23 -1
- package/dist/utils/jsonc.js.map +1 -1
- package/dist/utils/manifest-paths.js +1 -1
- package/dist/utils/manifest-paths.js.map +1 -1
- package/dist/utils/markdown-frontmatter.js +46 -0
- package/dist/utils/markdown-frontmatter.js.map +1 -1
- package/dist/utils/package-copy.js +5 -103
- package/dist/utils/package-copy.js.map +1 -1
- package/dist/utils/package-filters.js +9 -105
- package/dist/utils/package-filters.js.map +1 -1
- package/dist/utils/package-index-yml.js +27 -6
- package/dist/utils/package-index-yml.js.map +1 -1
- package/dist/utils/package-input.js +98 -0
- package/dist/utils/package-input.js.map +1 -0
- package/dist/utils/package-management.js +80 -28
- package/dist/utils/package-management.js.map +1 -1
- package/dist/utils/package-name-resolution.js +327 -0
- package/dist/utils/package-name-resolution.js.map +1 -0
- package/dist/utils/package-name.js +18 -16
- package/dist/utils/package-name.js.map +1 -1
- package/dist/utils/package-versioning.js +2 -33
- package/dist/utils/package-versioning.js.map +1 -1
- package/dist/utils/package-yml.js +19 -28
- package/dist/utils/package-yml.js.map +1 -1
- package/dist/utils/path-resolution.js +102 -0
- package/dist/utils/path-resolution.js.map +1 -0
- package/dist/utils/paths.js +6 -6
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/platform-file.js +36 -24
- package/dist/utils/platform-file.js.map +1 -1
- package/dist/utils/platform-mapper.js +222 -68
- package/dist/utils/platform-mapper.js.map +1 -1
- package/dist/utils/platform-root-files.js +44 -0
- package/dist/utils/platform-root-files.js.map +1 -0
- package/dist/utils/platform-utils.js +35 -54
- package/dist/utils/platform-utils.js.map +1 -1
- package/dist/utils/platform-yaml-merge.js +20 -140
- package/dist/utils/platform-yaml-merge.js.map +1 -1
- package/dist/utils/prompts.js +92 -7
- package/dist/utils/prompts.js.map +1 -1
- package/dist/utils/registry-entry-filter.js +50 -27
- package/dist/utils/registry-entry-filter.js.map +1 -1
- package/dist/utils/registry-paths.js +5 -4
- package/dist/utils/registry-paths.js.map +1 -1
- package/dist/utils/scope-resolution.js +156 -0
- package/dist/utils/scope-resolution.js.map +1 -0
- package/dist/utils/source-mutability.js +15 -0
- package/dist/utils/source-mutability.js.map +1 -0
- package/dist/utils/tarball.js +29 -4
- package/dist/utils/tarball.js.map +1 -1
- package/dist/utils/version-ranges.js +1 -32
- package/dist/utils/version-ranges.js.map +1 -1
- package/dist/utils/workspace-index-helpers.js +28 -0
- package/dist/utils/workspace-index-helpers.js.map +1 -0
- package/dist/utils/workspace-index-ownership.js +100 -0
- package/dist/utils/workspace-index-ownership.js.map +1 -0
- package/dist/utils/workspace-index-yml.js +173 -0
- package/dist/utils/workspace-index-yml.js.map +1 -0
- package/examples/custom-subdirs-platform.jsonc +157 -0
- package/package.json +7 -2
- package/platforms.jsonc +531 -84
- package/schemas/map-pipeline-v1.json +256 -0
- package/schemas/platforms-v1.json +400 -0
- package/specs/README.md +88 -0
- package/specs/add/README.md +166 -0
- package/specs/agents-claude.md +570 -0
- package/specs/agents-opencode.md +622 -0
- package/specs/apply/README.md +21 -0
- package/specs/apply/apply-behavior.md +58 -0
- package/specs/apply/apply-command.md +51 -0
- package/specs/apply/conflicts.md +41 -0
- package/specs/apply/index-effects.md +81 -0
- package/specs/architecture.md +107 -0
- package/specs/auth/README.md +17 -0
- package/specs/auth/auth-http-contract.md +25 -0
- package/specs/auth/cli/credentials.md +39 -0
- package/specs/auth/cli/login.md +32 -0
- package/specs/auth/cli/logout.md +16 -0
- package/specs/claude-mcp.md +1065 -0
- package/specs/claude-plugins-marketplace.md +363 -0
- package/specs/claude-plugins.md +413 -0
- package/specs/cli-options.md +52 -0
- package/specs/codex-mcp.md +114 -0
- package/specs/commands-overview.md +175 -0
- package/specs/directory-layout.md +95 -0
- package/specs/install/README.md +12 -4
- package/specs/install/git-sources.md +230 -0
- package/specs/install/install-behavior.md +483 -73
- package/specs/install/package-yml-canonical.md +67 -35
- package/specs/install/version-resolution.md +69 -115
- package/specs/new/README.md +769 -0
- package/specs/new/SUMMARY.md +310 -0
- package/specs/new/scope-behavior.md +793 -0
- package/specs/pack/README.md +77 -0
- package/specs/pack/package-name-resolution.md +330 -0
- package/specs/package/README.md +18 -17
- package/specs/package/nested-packages-and-parent-packages.md +32 -31
- package/specs/package/package-index-yml.md +95 -101
- package/specs/package/package-root-layout.md +64 -46
- package/specs/package/registry-payload-and-copy.md +50 -44
- package/specs/package/universal-content.md +33 -56
- package/specs/package-sources.md +248 -0
- package/specs/platforms/README.md +52 -0
- package/specs/platforms/configuration.md +571 -0
- package/specs/platforms/detection.md +552 -0
- package/specs/platforms/directory-layout.md +599 -0
- package/specs/platforms/examples.md +1146 -0
- package/specs/platforms/flow-reference.md +1240 -0
- package/specs/platforms/flows.md +1488 -0
- package/specs/platforms/map-pipeline.md +801 -0
- package/specs/platforms/overview.md +349 -0
- package/specs/platforms/specification.md +700 -0
- package/specs/platforms/troubleshooting.md +697 -0
- package/specs/platforms/universal-converter.md +520 -0
- package/specs/push/README.md +1 -0
- package/specs/push/push-behavior.md +11 -3
- package/specs/push/push-remote-upload.md +1 -1
- package/specs/push/push-scoping.md +1 -1
- package/specs/push/push-version-selection.md +1 -1
- package/specs/registry.md +111 -0
- package/specs/remove/README.md +257 -0
- package/specs/save/README.md +21 -17
- package/specs/save/save-conflict-resolution.md +205 -83
- package/specs/save/save-file-discovery.md +6 -4
- package/specs/save/save-frontmatter-overrides.md +11 -15
- package/specs/save/save-modes-inputs.md +9 -39
- package/specs/save/save-naming-scoping.md +4 -4
- package/specs/save/save-package-detection.md +13 -13
- package/specs/save/save-registry-sync.md +16 -106
- package/specs/save/save-versioning.md +80 -0
- package/specs/scope-management.md +92 -0
- package/specs/set/README.md +520 -0
- package/specs/set/set-behavior.md +563 -0
- package/specs/show/README.md +483 -0
- package/specs/show/show-remote.md +494 -0
- package/specs/status/README.md +38 -0
- package/specs/uninstall/README.md +231 -0
- package/dist/commands/duplicate.js +0 -69
- package/dist/commands/duplicate.js.map +0 -1
- package/dist/commands/init.js +0 -117
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/prune.js +0 -357
- package/dist/commands/prune.js.map +0 -1
- package/dist/commands/tui.js +0 -61
- package/dist/commands/tui.js.map +0 -1
- package/dist/core/install/index.js +0 -3
- package/dist/core/install/index.js.map +0 -1
- package/dist/core/push/push-single-file.js +0 -56
- package/dist/core/push/push-single-file.js.map +0 -1
- package/dist/core/save/package-detection.js +0 -147
- package/dist/core/save/package-detection.js.map +0 -1
- package/dist/core/save/save-single-file.js +0 -124
- package/dist/core/save/save-single-file.js.map +0 -1
- package/dist/core/token-store.js +0 -73
- package/dist/core/token-store.js.map +0 -1
- package/dist/tui/app.js +0 -95
- package/dist/tui/app.js.map +0 -1
- package/dist/tui/components/package-list.js +0 -73
- package/dist/tui/components/package-list.js.map +0 -1
- package/dist/tui/controller.js +0 -365
- package/dist/tui/controller.js.map +0 -1
- package/dist/tui/index.js +0 -12
- package/dist/tui/index.js.map +0 -1
- package/dist/tui/services/file-index.js +0 -64
- package/dist/tui/services/file-index.js.map +0 -1
- package/dist/tui/services/packages.js +0 -18
- package/dist/tui/services/packages.js.map +0 -1
- package/dist/tui/services/save.js +0 -21
- package/dist/tui/services/save.js.map +0 -1
- package/dist/tui/state/app-state.js +0 -15
- package/dist/tui/state/app-state.js.map +0 -1
- package/dist/tui/state.js +0 -17
- package/dist/tui/state.js.map +0 -1
- package/dist/tui/types.js.map +0 -1
- package/dist/tui/views/add-file-modal.js +0 -129
- package/dist/tui/views/add-file-modal.js.map +0 -1
- package/dist/tui/views/file-preview.js +0 -44
- package/dist/tui/views/file-preview.js.map +0 -1
- package/dist/tui/views/list-packages.js +0 -73
- package/dist/tui/views/list-packages.js.map +0 -1
- package/dist/tui/views/main-menu.js +0 -29
- package/dist/tui/views/main-menu.js.map +0 -1
- package/dist/tui/views/manage-view.js +0 -81
- package/dist/tui/views/manage-view.js.map +0 -1
- package/dist/tui/views/package-hub.js +0 -120
- package/dist/tui/views/package-hub.js.map +0 -1
- package/dist/tui/views/placeholder.js +0 -24
- package/dist/tui/views/placeholder.js.map +0 -1
- package/dist/utils/bun-bootstrap.js +0 -72
- package/dist/utils/bun-bootstrap.js.map +0 -1
- package/dist/utils/entity-id.js +0 -19
- package/dist/utils/entity-id.js.map +0 -1
- package/dist/utils/package-local-files.js +0 -5
- package/dist/utils/package-local-files.js.map +0 -1
- package/dist/utils/path-matching.js +0 -74
- package/dist/utils/path-matching.js.map +0 -1
- package/dist/utils/root-file-operations.js +0 -39
- package/dist/utils/root-file-operations.js.map +0 -1
- package/dist/utils/root-file-transformer.js +0 -27
- package/dist/utils/root-file-transformer.js.map +0 -1
- package/dist/utils/yaml-frontmatter.js +0 -25
- package/dist/utils/yaml-frontmatter.js.map +0 -1
- package/specs/auth/auth-device-flow.md +0 -70
- package/specs/login/login-device-flow.md +0 -70
- package/specs/platforms.md +0 -193
- package/specs/save-pack-versioning.md +0 -224
- package/specs/save-pack.md +0 -68
- /package/dist/{tui → core/source-resolution}/types.js +0 -0
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
# Create plugins
|
|
2
|
+
|
|
3
|
+
> Create custom plugins to extend Claude Code with slash commands, agents, hooks, Skills, and MCP servers.
|
|
4
|
+
|
|
5
|
+
Plugins let you extend Claude Code with custom functionality that can be shared across projects and teams. This guide covers creating your own plugins with slash commands, agents, Skills, hooks, and MCP servers.
|
|
6
|
+
|
|
7
|
+
Looking to install existing plugins? See [Discover and install plugins](/en/discover-plugins). For complete technical specifications, see [Plugins reference](/en/plugins-reference).
|
|
8
|
+
|
|
9
|
+
## When to use plugins vs standalone configuration
|
|
10
|
+
|
|
11
|
+
Claude Code supports two ways to add custom slash commands, agents, and hooks:
|
|
12
|
+
|
|
13
|
+
| Approach | Slash command names | Best for |
|
|
14
|
+
| :---------------------------------------------------------- | :------------------- | :---------------------------------------------------------------------------------------------- |
|
|
15
|
+
| **Standalone** (`.claude/` directory) | `/hello` | Personal workflows, project-specific customizations, quick experiments |
|
|
16
|
+
| **Plugins** (directories with `.claude-plugin/plugin.json`) | `/plugin-name:hello` | Sharing with teammates, distributing to community, versioned releases, reusable across projects |
|
|
17
|
+
|
|
18
|
+
**Use standalone configuration when**:
|
|
19
|
+
|
|
20
|
+
* You're customizing Claude Code for a single project
|
|
21
|
+
* The configuration is personal and doesn't need to be shared
|
|
22
|
+
* You're experimenting with slash commands or hooks before packaging them
|
|
23
|
+
* You want short slash command names like `/hello` or `/review`
|
|
24
|
+
|
|
25
|
+
**Use plugins when**:
|
|
26
|
+
|
|
27
|
+
* You want to share functionality with your team or community
|
|
28
|
+
* You need the same slash commands/agents across multiple projects
|
|
29
|
+
* You want version control and easy updates for your extensions
|
|
30
|
+
* You're distributing through a marketplace
|
|
31
|
+
* You're okay with namespaced slash commands like `/my-plugin:hello` (namespacing prevents conflicts between plugins)
|
|
32
|
+
|
|
33
|
+
<Tip>
|
|
34
|
+
Start with standalone configuration in `.claude/` for quick iteration, then [convert to a plugin](#convert-existing-configurations-to-plugins) when you're ready to share.
|
|
35
|
+
</Tip>
|
|
36
|
+
|
|
37
|
+
## Quickstart
|
|
38
|
+
|
|
39
|
+
This quickstart walks you through creating a plugin with a custom slash command. You'll create a manifest (the configuration file that defines your plugin), add a slash command, and test it locally using the `--plugin-dir` flag.
|
|
40
|
+
|
|
41
|
+
### Prerequisites
|
|
42
|
+
|
|
43
|
+
* Claude Code [installed and authenticated](/en/quickstart#step-1-install-claude-code)
|
|
44
|
+
* Claude Code version 1.0.33 or later (run `claude --version` to check)
|
|
45
|
+
|
|
46
|
+
<Note>
|
|
47
|
+
If you don't see the `/plugin` command, update Claude Code to the latest version. See [Troubleshooting](/en/troubleshooting) for upgrade instructions.
|
|
48
|
+
</Note>
|
|
49
|
+
|
|
50
|
+
### Create your first plugin
|
|
51
|
+
|
|
52
|
+
<Steps>
|
|
53
|
+
<Step title="Create the plugin directory">
|
|
54
|
+
Every plugin lives in its own directory containing a manifest and your custom commands, agents, or hooks. Create one now:
|
|
55
|
+
|
|
56
|
+
```bash theme={null}
|
|
57
|
+
mkdir my-first-plugin
|
|
58
|
+
```
|
|
59
|
+
</Step>
|
|
60
|
+
|
|
61
|
+
<Step title="Create the plugin manifest">
|
|
62
|
+
The manifest file at `.claude-plugin/plugin.json` defines your plugin's identity: its name, description, and version. Claude Code uses this metadata to display your plugin in the plugin manager.
|
|
63
|
+
|
|
64
|
+
Create the `.claude-plugin` directory inside your plugin folder:
|
|
65
|
+
|
|
66
|
+
```bash theme={null}
|
|
67
|
+
mkdir my-first-plugin/.claude-plugin
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Then create `my-first-plugin/.claude-plugin/plugin.json` with this content:
|
|
71
|
+
|
|
72
|
+
```json my-first-plugin/.claude-plugin/plugin.json theme={null}
|
|
73
|
+
{
|
|
74
|
+
"name": "my-first-plugin",
|
|
75
|
+
"description": "A greeting plugin to learn the basics",
|
|
76
|
+
"version": "1.0.0",
|
|
77
|
+
"author": {
|
|
78
|
+
"name": "Your Name"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
| Field | Purpose |
|
|
84
|
+
| :------------ | :--------------------------------------------------------------------------------------------------------------------- |
|
|
85
|
+
| `name` | Unique identifier and slash command namespace. Slash commands are prefixed with this (e.g., `/my-first-plugin:hello`). |
|
|
86
|
+
| `description` | Shown in the plugin manager when browsing or installing plugins. |
|
|
87
|
+
| `version` | Track releases using [semantic versioning](/en/plugins-reference#version-management). |
|
|
88
|
+
| `author` | Optional. Helpful for attribution. |
|
|
89
|
+
|
|
90
|
+
For additional fields like `homepage`, `repository`, and `license`, see the [full manifest schema](/en/plugins-reference#plugin-manifest-schema).
|
|
91
|
+
</Step>
|
|
92
|
+
|
|
93
|
+
<Step title="Add a slash command">
|
|
94
|
+
Slash commands are Markdown files in the `commands/` directory. The filename becomes the slash command name, prefixed with the plugin's namespace (`hello.md` in a plugin named `my-first-plugin` creates `/my-first-plugin:hello`). The Markdown content tells Claude how to respond when someone runs the slash command.
|
|
95
|
+
|
|
96
|
+
Create a `commands` directory in your plugin folder:
|
|
97
|
+
|
|
98
|
+
```bash theme={null}
|
|
99
|
+
mkdir my-first-plugin/commands
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Then create `my-first-plugin/commands/hello.md` with this content:
|
|
103
|
+
|
|
104
|
+
```markdown my-first-plugin/commands/hello.md theme={null}
|
|
105
|
+
---
|
|
106
|
+
description: Greet the user with a friendly message
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
# Hello Command
|
|
110
|
+
|
|
111
|
+
Greet the user warmly and ask how you can help them today.
|
|
112
|
+
```
|
|
113
|
+
</Step>
|
|
114
|
+
|
|
115
|
+
<Step title="Test your plugin">
|
|
116
|
+
Run Claude Code with the `--plugin-dir` flag to load your plugin:
|
|
117
|
+
|
|
118
|
+
```bash theme={null}
|
|
119
|
+
claude --plugin-dir ./my-first-plugin
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Once Claude Code starts, try your new command:
|
|
123
|
+
|
|
124
|
+
```shell theme={null}
|
|
125
|
+
/my-first-plugin:hello
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
You'll see Claude respond with a greeting. Run `/help` to see your command listed under the plugin namespace.
|
|
129
|
+
|
|
130
|
+
<Note>
|
|
131
|
+
**Why namespacing?** Plugin slash commands are always namespaced (like `/greet:hello`) to prevent conflicts when multiple plugins have commands with the same name.
|
|
132
|
+
|
|
133
|
+
To change the namespace prefix, update the `name` field in `plugin.json`.
|
|
134
|
+
</Note>
|
|
135
|
+
</Step>
|
|
136
|
+
|
|
137
|
+
<Step title="Add slash command arguments">
|
|
138
|
+
Make your slash command dynamic by accepting user input. The `$ARGUMENTS` placeholder captures any text the user provides after the slash command.
|
|
139
|
+
|
|
140
|
+
Update your `hello.md` file:
|
|
141
|
+
|
|
142
|
+
```markdown my-first-plugin/commands/hello.md theme={null}
|
|
143
|
+
---
|
|
144
|
+
description: Greet the user with a personalized message
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
# Hello Command
|
|
148
|
+
|
|
149
|
+
Greet the user named "$ARGUMENTS" warmly and ask how you can help them today. Make the greeting personal and encouraging.
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Restart Claude Code to pick up the changes, then try the command with your name:
|
|
153
|
+
|
|
154
|
+
```shell theme={null}
|
|
155
|
+
/my-first-plugin:hello Alex
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Claude will greet you by name. For more argument options like `$1`, `$2` for individual parameters, see [Slash commands](/en/slash-commands).
|
|
159
|
+
</Step>
|
|
160
|
+
</Steps>
|
|
161
|
+
|
|
162
|
+
You've successfully created and tested a plugin with these key components:
|
|
163
|
+
|
|
164
|
+
* **Plugin manifest** (`.claude-plugin/plugin.json`): describes your plugin's metadata
|
|
165
|
+
* **Commands directory** (`commands/`): contains your custom slash commands
|
|
166
|
+
* **Command arguments** (`$ARGUMENTS`): captures user input for dynamic behavior
|
|
167
|
+
|
|
168
|
+
<Tip>
|
|
169
|
+
The `--plugin-dir` flag is useful for development and testing. When you're ready to share your plugin with others, see [Create and distribute a plugin marketplace](/en/plugin-marketplaces).
|
|
170
|
+
</Tip>
|
|
171
|
+
|
|
172
|
+
## Plugin structure overview
|
|
173
|
+
|
|
174
|
+
You've created a plugin with a slash command, but plugins can include much more: custom agents, Skills, hooks, MCP servers, and LSP servers.
|
|
175
|
+
|
|
176
|
+
<Warning>
|
|
177
|
+
**Common mistake**: Don't put `commands/`, `agents/`, `skills/`, or `hooks/` inside the `.claude-plugin/` directory. Only `plugin.json` goes inside `.claude-plugin/`. All other directories must be at the plugin root level.
|
|
178
|
+
</Warning>
|
|
179
|
+
|
|
180
|
+
| Directory | Location | Purpose |
|
|
181
|
+
| :---------------- | :---------- | :---------------------------------------------- |
|
|
182
|
+
| `.claude-plugin/` | Plugin root | Contains only `plugin.json` manifest (required) |
|
|
183
|
+
| `commands/` | Plugin root | Slash commands as Markdown files |
|
|
184
|
+
| `agents/` | Plugin root | Custom agent definitions |
|
|
185
|
+
| `skills/` | Plugin root | Agent Skills with `SKILL.md` files |
|
|
186
|
+
| `hooks/` | Plugin root | Event handlers in `hooks.json` |
|
|
187
|
+
| `.mcp.json` | Plugin root | MCP server configurations |
|
|
188
|
+
| `.lsp.json` | Plugin root | LSP server configurations for code intelligence |
|
|
189
|
+
|
|
190
|
+
<Note>
|
|
191
|
+
**Next steps**: Ready to add more features? Jump to [Develop more complex plugins](#develop-more-complex-plugins) to add agents, hooks, MCP servers, and LSP servers. For complete technical specifications of all plugin components, see [Plugins reference](/en/plugins-reference).
|
|
192
|
+
</Note>
|
|
193
|
+
|
|
194
|
+
## Develop more complex plugins
|
|
195
|
+
|
|
196
|
+
Once you're comfortable with basic plugins, you can create more sophisticated extensions.
|
|
197
|
+
|
|
198
|
+
### Add Skills to your plugin
|
|
199
|
+
|
|
200
|
+
Plugins can include [Agent Skills](/en/skills) to extend Claude's capabilities. Skills are model-invoked: Claude automatically uses them based on the task context.
|
|
201
|
+
|
|
202
|
+
Add a `skills/` directory at your plugin root with Skill folders containing `SKILL.md` files:
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
my-plugin/
|
|
206
|
+
├── .claude-plugin/
|
|
207
|
+
│ └── plugin.json
|
|
208
|
+
└── skills/
|
|
209
|
+
└── code-review/
|
|
210
|
+
└── SKILL.md
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Each `SKILL.md` needs frontmatter with `name` and `description` fields, followed by instructions:
|
|
214
|
+
|
|
215
|
+
```yaml theme={null}
|
|
216
|
+
---
|
|
217
|
+
name: code-review
|
|
218
|
+
description: Reviews code for best practices and potential issues. Use when reviewing code, checking PRs, or analyzing code quality.
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
When reviewing code, check for:
|
|
222
|
+
1. Code organization and structure
|
|
223
|
+
2. Error handling
|
|
224
|
+
3. Security concerns
|
|
225
|
+
4. Test coverage
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
After installing the plugin, restart Claude Code to load the Skills. For complete Skill authoring guidance including progressive disclosure and tool restrictions, see [Agent Skills](/en/skills).
|
|
229
|
+
|
|
230
|
+
### Add LSP servers to your plugin
|
|
231
|
+
|
|
232
|
+
<Tip>
|
|
233
|
+
For common languages like TypeScript, Python, and Rust, install the pre-built LSP plugins from the official marketplace. Create custom LSP plugins only when you need support for languages not already covered.
|
|
234
|
+
</Tip>
|
|
235
|
+
|
|
236
|
+
LSP (Language Server Protocol) plugins give Claude real-time code intelligence. If you need to support a language that doesn't have an official LSP plugin, you can create your own by adding an `.lsp.json` file to your plugin:
|
|
237
|
+
|
|
238
|
+
```json .lsp.json theme={null}
|
|
239
|
+
{
|
|
240
|
+
"go": {
|
|
241
|
+
"command": "gopls",
|
|
242
|
+
"args": ["serve"],
|
|
243
|
+
"extensionToLanguage": {
|
|
244
|
+
".go": "go"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Users installing your plugin must have the language server binary installed on their machine.
|
|
251
|
+
|
|
252
|
+
For complete LSP configuration options, see [LSP servers](/en/plugins-reference#lsp-servers).
|
|
253
|
+
|
|
254
|
+
### Organize complex plugins
|
|
255
|
+
|
|
256
|
+
For plugins with many components, organize your directory structure by functionality. For complete directory layouts and organization patterns, see [Plugin directory structure](/en/plugins-reference#plugin-directory-structure).
|
|
257
|
+
|
|
258
|
+
### Test your plugins locally
|
|
259
|
+
|
|
260
|
+
Use the `--plugin-dir` flag to test plugins during development. This loads your plugin directly without requiring installation.
|
|
261
|
+
|
|
262
|
+
```bash theme={null}
|
|
263
|
+
claude --plugin-dir ./my-plugin
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
As you make changes to your plugin, restart Claude Code to pick up the updates. Test your plugin components:
|
|
267
|
+
|
|
268
|
+
* Try your commands with `/command-name`
|
|
269
|
+
* Check that agents appear in `/agents`
|
|
270
|
+
* Verify hooks work as expected
|
|
271
|
+
|
|
272
|
+
<Tip>
|
|
273
|
+
You can load multiple plugins at once by specifying the flag multiple times:
|
|
274
|
+
|
|
275
|
+
```bash theme={null}
|
|
276
|
+
claude --plugin-dir ./plugin-one --plugin-dir ./plugin-two
|
|
277
|
+
```
|
|
278
|
+
</Tip>
|
|
279
|
+
|
|
280
|
+
### Debug plugin issues
|
|
281
|
+
|
|
282
|
+
If your plugin isn't working as expected:
|
|
283
|
+
|
|
284
|
+
1. **Check the structure**: Ensure your directories are at the plugin root, not inside `.claude-plugin/`
|
|
285
|
+
2. **Test components individually**: Check each command, agent, and hook separately
|
|
286
|
+
3. **Use validation and debugging tools**: See [Debugging and development tools](/en/plugins-reference#debugging-and-development-tools) for CLI commands and troubleshooting techniques
|
|
287
|
+
|
|
288
|
+
### Share your plugins
|
|
289
|
+
|
|
290
|
+
When your plugin is ready to share:
|
|
291
|
+
|
|
292
|
+
1. **Add documentation**: Include a `README.md` with installation and usage instructions
|
|
293
|
+
2. **Version your plugin**: Use [semantic versioning](/en/plugins-reference#version-management) in your `plugin.json`
|
|
294
|
+
3. **Create or use a marketplace**: Distribute through [plugin marketplaces](/en/plugin-marketplaces) for installation
|
|
295
|
+
4. **Test with others**: Have team members test the plugin before wider distribution
|
|
296
|
+
|
|
297
|
+
Once your plugin is in a marketplace, others can install it using the instructions in [Discover and install plugins](/en/discover-plugins).
|
|
298
|
+
|
|
299
|
+
<Note>
|
|
300
|
+
For complete technical specifications, debugging techniques, and distribution strategies, see [Plugins reference](/en/plugins-reference).
|
|
301
|
+
</Note>
|
|
302
|
+
|
|
303
|
+
## Convert existing configurations to plugins
|
|
304
|
+
|
|
305
|
+
If you already have custom commands, Skills, or hooks in your `.claude/` directory, you can convert them into a plugin for easier sharing and distribution.
|
|
306
|
+
|
|
307
|
+
### Migration steps
|
|
308
|
+
|
|
309
|
+
<Steps>
|
|
310
|
+
<Step title="Create the plugin structure">
|
|
311
|
+
Create a new plugin directory:
|
|
312
|
+
|
|
313
|
+
```bash theme={null}
|
|
314
|
+
mkdir -p my-plugin/.claude-plugin
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Create the manifest file at `my-plugin/.claude-plugin/plugin.json`:
|
|
318
|
+
|
|
319
|
+
```json my-plugin/.claude-plugin/plugin.json theme={null}
|
|
320
|
+
{
|
|
321
|
+
"name": "my-plugin",
|
|
322
|
+
"description": "Migrated from standalone configuration",
|
|
323
|
+
"version": "1.0.0"
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
</Step>
|
|
327
|
+
|
|
328
|
+
<Step title="Copy your existing files">
|
|
329
|
+
Copy your existing configurations to the plugin directory:
|
|
330
|
+
|
|
331
|
+
```bash theme={null}
|
|
332
|
+
# Copy commands
|
|
333
|
+
cp -r .claude/commands my-plugin/
|
|
334
|
+
|
|
335
|
+
# Copy agents (if any)
|
|
336
|
+
cp -r .claude/agents my-plugin/
|
|
337
|
+
|
|
338
|
+
# Copy skills (if any)
|
|
339
|
+
cp -r .claude/skills my-plugin/
|
|
340
|
+
```
|
|
341
|
+
</Step>
|
|
342
|
+
|
|
343
|
+
<Step title="Migrate hooks">
|
|
344
|
+
If you have hooks in your settings, create a hooks directory:
|
|
345
|
+
|
|
346
|
+
```bash theme={null}
|
|
347
|
+
mkdir my-plugin/hooks
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Create `my-plugin/hooks/hooks.json` with your hooks configuration. Copy the `hooks` object from your `.claude/settings.json` or `settings.local.json`—the format is the same:
|
|
351
|
+
|
|
352
|
+
```json my-plugin/hooks/hooks.json theme={null}
|
|
353
|
+
{
|
|
354
|
+
"hooks": {
|
|
355
|
+
"PostToolUse": [
|
|
356
|
+
{
|
|
357
|
+
"matcher": "Write|Edit",
|
|
358
|
+
"hooks": [{ "type": "command", "command": "npm run lint:fix $FILE" }]
|
|
359
|
+
}
|
|
360
|
+
]
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
</Step>
|
|
365
|
+
|
|
366
|
+
<Step title="Test your migrated plugin">
|
|
367
|
+
Load your plugin to verify everything works:
|
|
368
|
+
|
|
369
|
+
```bash theme={null}
|
|
370
|
+
claude --plugin-dir ./my-plugin
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
Test each component: run your commands, check agents appear in `/agents`, and verify hooks trigger correctly.
|
|
374
|
+
</Step>
|
|
375
|
+
</Steps>
|
|
376
|
+
|
|
377
|
+
### What changes when migrating
|
|
378
|
+
|
|
379
|
+
| Standalone (`.claude/`) | Plugin |
|
|
380
|
+
| :---------------------------- | :------------------------------- |
|
|
381
|
+
| Only available in one project | Can be shared via marketplaces |
|
|
382
|
+
| Files in `.claude/commands/` | Files in `plugin-name/commands/` |
|
|
383
|
+
| Hooks in `settings.json` | Hooks in `hooks/hooks.json` |
|
|
384
|
+
| Must manually copy to share | Install with `/plugin install` |
|
|
385
|
+
|
|
386
|
+
<Note>
|
|
387
|
+
After migrating, you can remove the original files from `.claude/` to avoid duplicates. The plugin version will take precedence when loaded.
|
|
388
|
+
</Note>
|
|
389
|
+
|
|
390
|
+
## Next steps
|
|
391
|
+
|
|
392
|
+
Now that you understand Claude Code's plugin system, here are suggested paths for different goals:
|
|
393
|
+
|
|
394
|
+
### For plugin users
|
|
395
|
+
|
|
396
|
+
* [Discover and install plugins](/en/discover-plugins): browse marketplaces and install plugins
|
|
397
|
+
* [Configure team marketplaces](/en/discover-plugins#configure-team-marketplaces): set up repository-level plugins for your team
|
|
398
|
+
|
|
399
|
+
### For plugin developers
|
|
400
|
+
|
|
401
|
+
* [Create and distribute a marketplace](/en/plugin-marketplaces): package and share your plugins
|
|
402
|
+
* [Plugins reference](/en/plugins-reference): complete technical specifications
|
|
403
|
+
* Dive deeper into specific plugin components:
|
|
404
|
+
* [Slash commands](/en/slash-commands): command development details
|
|
405
|
+
* [Subagents](/en/sub-agents): agent configuration and capabilities
|
|
406
|
+
* [Agent Skills](/en/skills): extend Claude's capabilities
|
|
407
|
+
* [Hooks](/en/hooks): event handling and automation
|
|
408
|
+
* [MCP](/en/mcp): external tool integration
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
> To find navigation and other pages in this documentation, fetch the llms.txt file at: https://code.claude.com/docs/llms.txt
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# CLI Global Options
|
|
2
|
+
|
|
3
|
+
This document specifies behavior for global CLI flags available across all `opkg` / `openpackage` commands.
|
|
4
|
+
|
|
5
|
+
## `--cwd <dir>`
|
|
6
|
+
|
|
7
|
+
### Overview
|
|
8
|
+
The `--cwd` global option overrides the effective working directory for the entire command execution. It simulates running the CLI from `<dir>` instead of the shell's current directory, affecting:
|
|
9
|
+
- Path resolutions (relative files, globs).
|
|
10
|
+
- Package/workspace detection (e.g., `openpackage.yml` lookup at effective cwd).
|
|
11
|
+
- File operations (install/save/add/pack/apply/uninstall/status target the specified dir's context).
|
|
12
|
+
- Any code using `process.cwd()` (captured post-`--cwd` processing).
|
|
13
|
+
|
|
14
|
+
This enables monorepo workflows without `cd` (e.g., `opkg install --cwd ./packages/web some-dep` installs into `./packages/web` from root).
|
|
15
|
+
|
|
16
|
+
### Behavior
|
|
17
|
+
1. **Parsing & Timing**: Commander parses it as global (usable before/after subcommand). Processed in `preAction` hook *before* subcommand action runs (after arg validation).
|
|
18
|
+
2. **Resolution**: Resolved to absolute via `path.resolve(originalProcessCwd, <dir>)` (relatives vs shell cwd, not target).
|
|
19
|
+
3. **Validation** (sync/async checks before chdir):
|
|
20
|
+
- Exists (fs.stat throws ENOENT if not).
|
|
21
|
+
- Is directory (fs.stat.isDirectory()).
|
|
22
|
+
- Readable/writable (fs.access R_OK | W_OK; errors if perms insufficient for cmd).
|
|
23
|
+
- Errors: Custom msg via console.error + log, `process.exit(1)` (e.g., "Invalid --cwd: must exist, be accessible, and writable").
|
|
24
|
+
4. **chdir**: Calls `process.chdir(resolved)` if valid; logs "Changed working directory to: <abs>".
|
|
25
|
+
5. **Effects**:
|
|
26
|
+
- All relative paths (e.g., getPackageYmlPath, file discovery) resolve vs new cwd.
|
|
27
|
+
- Package root = effective cwd (or --cwd dir).
|
|
28
|
+
- Global state unaffected (e.g., `~/.openpackage/registry` via os.homedir()).
|
|
29
|
+
6. **Edge Cases**:
|
|
30
|
+
- Relative: `--cwd ../sibling` → resolves vs original.
|
|
31
|
+
- Invalid: Early exit, no action run.
|
|
32
|
+
- No-op: Omitted → uses shell cwd.
|
|
33
|
+
- Globals: Applies (harmless for login/list; may affect utils like prompts for rel paths).
|
|
34
|
+
- Subprocesses: Inherit new cwd (if spawned).
|
|
35
|
+
7. **Limitations**: Doesn't re-parse other args vs new cwd (resolved early). User scripts via exec may need own handling.
|
|
36
|
+
|
|
37
|
+
### Usage Patterns
|
|
38
|
+
- Monorepos: Target sub-packages without cd.
|
|
39
|
+
- Scripts: `opkg save --cwd $PROJ_DIR`.
|
|
40
|
+
- Validation fails prevent ops (safety).
|
|
41
|
+
|
|
42
|
+
Cross-refs: [install-behavior.md] (installs to effective cwd), [save-modes-inputs.md] (saves from effective cwd), [package-root-layout.md] (root = effective cwd).
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Command Notes (selected)
|
|
47
|
+
|
|
48
|
+
This document primarily defines global flags, but some global-option-sensitive behavior is worth calling out:
|
|
49
|
+
|
|
50
|
+
- **`opkg save`**: sync workspace edits back to a **mutable package source** based on `.openpackage/openpackage.index.yml` mappings.
|
|
51
|
+
- **`opkg pack`**: write a snapshot of a package source to the local registry (no platform apply/sync is performed as part of packing). Use `opkg apply` to materialize content into platform directories.
|
|
52
|
+
- **`opkg apply`**: applies/syncs the current/root package to detected platforms from the effective cwd. Supports `--dry-run` and `--force`.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Model Context Protocol
|
|
2
|
+
|
|
3
|
+
Model Context Protocol (MCP) connects models to tools and context. Use it to give Codex access to third-party documentation, or to let it interact with developer tools like your browser or Figma.
|
|
4
|
+
|
|
5
|
+
Codex supports MCP servers in both the CLI and the IDE extension.
|
|
6
|
+
|
|
7
|
+
## Supported MCP features
|
|
8
|
+
|
|
9
|
+
- **STDIO servers**: Servers that run as a local process (started by a command).
|
|
10
|
+
- Environment variables
|
|
11
|
+
- **Streamable HTTP servers**: Servers that you access at an address.
|
|
12
|
+
- Bearer token authentication
|
|
13
|
+
- OAuth authentication (run `codex mcp login <server-name>` for servers that support OAuth)
|
|
14
|
+
|
|
15
|
+
## Connect Codex to an MCP server
|
|
16
|
+
|
|
17
|
+
Codex stores MCP configuration in `~/.codex/config.toml` alongside other Codex configuration settings.
|
|
18
|
+
|
|
19
|
+
The CLI and the IDE extension share this configuration. Once you configure your MCP servers, you can switch between the two Codex clients without redoing setup.
|
|
20
|
+
|
|
21
|
+
To configure MCP servers, choose one option:
|
|
22
|
+
|
|
23
|
+
1. **Use the CLI**: Run `codex mcp` to add and manage servers.
|
|
24
|
+
2. **Edit `config.toml`**: Update `~/.codex/config.toml` directly.
|
|
25
|
+
|
|
26
|
+
### Configure with the CLI
|
|
27
|
+
|
|
28
|
+
#### Add an MCP server
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
codex mcp add <server-name> --env VAR1=VALUE1 --env VAR2=VALUE2 -- <stdio server-command>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
For example, to add Context7 (a free MCP server for developer documentation), you can run the following command:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
codex mcp add context7 -- npx -y @upstash/context7-mcp
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
#### Other CLI commands
|
|
41
|
+
|
|
42
|
+
To see all available MCP commands, you can run `codex mcp --help`.
|
|
43
|
+
|
|
44
|
+
#### Terminal UI (TUI)
|
|
45
|
+
|
|
46
|
+
In the `codex` TUI, use `/mcp` to see your active MCP servers.
|
|
47
|
+
|
|
48
|
+
### Configure with config.toml
|
|
49
|
+
|
|
50
|
+
For more fine-grained control over MCP server options, edit `~/.codex/config.toml`. In the IDE extension, select **MCP settings** > **Open config.toml** from the gear menu.
|
|
51
|
+
|
|
52
|
+
Configure each MCP server with a `[mcp_servers.<server-name>]` table in the configuration file.
|
|
53
|
+
|
|
54
|
+
#### STDIO servers
|
|
55
|
+
|
|
56
|
+
- `command` (required): The command that starts the server.
|
|
57
|
+
- `args` (optional): Arguments to pass to the server.
|
|
58
|
+
- `env` (optional): Environment variables to set for the server.
|
|
59
|
+
- `env_vars` (optional): Environment variables to allow and forward.
|
|
60
|
+
- `cwd` (optional): Working directory to start the server from.
|
|
61
|
+
|
|
62
|
+
#### Streamable HTTP servers
|
|
63
|
+
|
|
64
|
+
- `url` (required): The server address.
|
|
65
|
+
- `bearer_token_env_var` (optional): Environment variable name for a bearer token to send in `Authorization`.
|
|
66
|
+
- `http_headers` (optional): Map of header names to static values.
|
|
67
|
+
- `env_http_headers` (optional): Map of header names to environment variable names (values pulled from the environment).
|
|
68
|
+
|
|
69
|
+
#### Other configuration options
|
|
70
|
+
|
|
71
|
+
- `startup_timeout_sec` (optional): Timeout (seconds) for the server to start. Default: `10`.
|
|
72
|
+
- `tool_timeout_sec` (optional): Timeout (seconds) for the server to run a tool. Default: `60`.
|
|
73
|
+
- `enabled` (optional): Set `false` to disable a server without deleting it.
|
|
74
|
+
- `enabled_tools` (optional): Tool allow list.
|
|
75
|
+
- `disabled_tools` (optional): Tool deny list (applied after `enabled_tools`).
|
|
76
|
+
|
|
77
|
+
#### config.toml examples
|
|
78
|
+
|
|
79
|
+
```toml
|
|
80
|
+
[mcp_servers.context7]
|
|
81
|
+
command = "npx"
|
|
82
|
+
args = ["-y", "@upstash/context7-mcp"]
|
|
83
|
+
|
|
84
|
+
[mcp_servers.context7.env]
|
|
85
|
+
MY_ENV_VAR = "MY_ENV_VALUE"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```toml
|
|
89
|
+
[mcp_servers.figma]
|
|
90
|
+
url = "https://mcp.figma.com/mcp"
|
|
91
|
+
bearer_token_env_var = "FIGMA_OAUTH_TOKEN"
|
|
92
|
+
http_headers = { "X-Figma-Region" = "us-east-1" }
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```toml
|
|
96
|
+
[mcp_servers.chrome_devtools]
|
|
97
|
+
url = "http://localhost:3000/mcp"
|
|
98
|
+
enabled_tools = ["open", "screenshot"]
|
|
99
|
+
disabled_tools = ["screenshot"] # applied after enabled_tools
|
|
100
|
+
startup_timeout_sec = 20
|
|
101
|
+
tool_timeout_sec = 45
|
|
102
|
+
enabled = true
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Examples of useful MCP servers
|
|
106
|
+
|
|
107
|
+
The list of MCP servers keeps growing. Here are a few common ones:
|
|
108
|
+
|
|
109
|
+
- [Context7](https://github.com/upstash/context7): Connect to up-to-date developer documentation.
|
|
110
|
+
- Figma [Local](https://developers.figma.com/docs/figma-mcp-server/local-server-installation/) and [Remote](https://developers.figma.com/docs/figma-mcp-server/remote-server-installation/): Access your Figma designs.
|
|
111
|
+
- [Playwright](https://www.npmjs.com/package/@playwright/mcp): Control and inspect a browser using Playwright.
|
|
112
|
+
- [Chrome Developer Tools](https://github.com/ChromeDevTools/chrome-devtools-mcp/): Control and inspect Chrome.
|
|
113
|
+
- [Sentry](https://docs.sentry.io/product/sentry-mcp/#codex): Access Sentry logs.
|
|
114
|
+
- [GitHub](https://github.com/github/github-mcp-server): Manage GitHub beyond what `git` supports (for example, pull requests and issues).
|