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,769 @@
|
|
|
1
|
+
# New Command Specification
|
|
2
|
+
|
|
3
|
+
The `opkg new` command creates new packages with explicit scope support. It replaces the deprecated `opkg init` command with clearer semantics and better UX.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
opkg new [package-name] [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Creates a new package with an `openpackage.yml` manifest in one of three predefined scopes or at a custom path:
|
|
12
|
+
- **root**: Current directory as package
|
|
13
|
+
- **local**: Workspace-scoped package (default)
|
|
14
|
+
- **global**: User-scoped package shared across workspaces
|
|
15
|
+
- **custom**: User-specified directory path
|
|
16
|
+
|
|
17
|
+
## Command Signature
|
|
18
|
+
|
|
19
|
+
### Arguments
|
|
20
|
+
- `[package-name]` (optional for root scope, required for local/global)
|
|
21
|
+
- Package name following OpenPackage naming conventions
|
|
22
|
+
- Supports scoped packages (`@org/package-name`)
|
|
23
|
+
- Validated against naming rules (lowercase, alphanumeric, hyphens, slashes for scopes)
|
|
24
|
+
|
|
25
|
+
### Options
|
|
26
|
+
- `--scope <scope>` - Package scope: `root`, `local`, or `global` (prompts if not specified in interactive mode)
|
|
27
|
+
- `--path <path>` - Custom directory path for package (overrides `--scope`)
|
|
28
|
+
- `-f, --force` - Overwrite existing package without prompting
|
|
29
|
+
- `--non-interactive` - Skip interactive prompts, use defaults
|
|
30
|
+
- `-h, --help` - Display help for command
|
|
31
|
+
|
|
32
|
+
**Note:** Either `--scope` or `--path` is required in non-interactive mode. If both are provided, `--path` takes precedence and a warning is issued.
|
|
33
|
+
|
|
34
|
+
### Scope Selection
|
|
35
|
+
|
|
36
|
+
When running interactively **without** the `--scope` or `--path` flag, you'll be prompted to choose:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
$ opkg new my-package
|
|
40
|
+
? Where should this package be created? ›
|
|
41
|
+
❯ Root (current directory) - Create openpackage.yml here - for standalone/distributable packages
|
|
42
|
+
Local (workspace-scoped) - Create in .openpackage/packages/ - for project-specific packages
|
|
43
|
+
Global (cross-workspace) - Create in ~/.openpackage/packages/ - shared across all workspaces on this machine
|
|
44
|
+
Custom (specify path) - Create at a custom location you specify
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
If you select **Custom**, you'll be prompted to enter a directory path:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
? Enter the directory path for the package: › ./my-custom-location
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This ensures you make an explicit choice about where your package lives. For CI/CD and automation, use the `--scope` or `--path` flag to skip the prompt.
|
|
54
|
+
|
|
55
|
+
## Scopes
|
|
56
|
+
|
|
57
|
+
### Root Scope
|
|
58
|
+
|
|
59
|
+
**Location:** Current directory (`./openpackage.yml`)
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
opkg new my-package --scope root
|
|
63
|
+
opkg new --scope root # Interactive: prompts for name
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Use Cases:**
|
|
67
|
+
- Dedicated package repository
|
|
68
|
+
- Standalone package development
|
|
69
|
+
- Similar to `npm init`, `cargo init`
|
|
70
|
+
|
|
71
|
+
**Behavior:**
|
|
72
|
+
- Creates `openpackage.yml` at cwd
|
|
73
|
+
- Does not create workspace structure
|
|
74
|
+
- Package content lives at cwd
|
|
75
|
+
|
|
76
|
+
**Example Structure:**
|
|
77
|
+
```
|
|
78
|
+
my-package/
|
|
79
|
+
├── openpackage.yml # Package manifest
|
|
80
|
+
├── .cursor/ # Platform-specific content
|
|
81
|
+
│ ├── rules/
|
|
82
|
+
│ └── commands/
|
|
83
|
+
├── root/ # Root files
|
|
84
|
+
│ └── AGENTS.md
|
|
85
|
+
└── README.md
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Local Scope
|
|
89
|
+
|
|
90
|
+
**Location:** `.openpackage/packages/<package-name>/`
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
opkg new my-package # Interactive: prompts for scope
|
|
94
|
+
opkg new my-package --scope local # Explicit
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Use Cases:**
|
|
98
|
+
- Project-specific packages
|
|
99
|
+
- Workspace-scoped development
|
|
100
|
+
- Packages tied to single project
|
|
101
|
+
|
|
102
|
+
**Behavior:**
|
|
103
|
+
- Creates package in `.openpackage/packages/<name>/`
|
|
104
|
+
- Package content lives in nested directory
|
|
105
|
+
- Not automatically added to workspace (use `opkg install` to add)
|
|
106
|
+
|
|
107
|
+
**Example Structure:**
|
|
108
|
+
```
|
|
109
|
+
project/
|
|
110
|
+
├── .openpackage/
|
|
111
|
+
│ └── packages/
|
|
112
|
+
│ └── my-package/
|
|
113
|
+
│ ├── openpackage.yml # Package manifest
|
|
114
|
+
│ ├── .cursor/
|
|
115
|
+
│ │ ├── rules/
|
|
116
|
+
│ │ └── commands/
|
|
117
|
+
│ └── root/
|
|
118
|
+
└── src/ # Project source code
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Installation:**
|
|
122
|
+
```bash
|
|
123
|
+
opkg install my-package # Adds to workspace manifest and installs files
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Global Scope
|
|
127
|
+
|
|
128
|
+
**Location:** `~/.openpackage/packages/<package-name>/`
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
opkg new shared-utils --scope global
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Use Cases:**
|
|
135
|
+
- Personal utilities shared across projects
|
|
136
|
+
- Common rules and prompts
|
|
137
|
+
- Cross-workspace shared packages
|
|
138
|
+
|
|
139
|
+
**Behavior:**
|
|
140
|
+
- Creates package in global directory
|
|
141
|
+
- Not added to workspace manifest (used via path reference)
|
|
142
|
+
- Persists across all workspaces
|
|
143
|
+
|
|
144
|
+
**Installation:**
|
|
145
|
+
- **By name**: `opkg install <package-name>` (automatic discovery with version-aware resolution)
|
|
146
|
+
- **By path**: `opkg install ~/.openpackage/packages/<package-name>/` (explicit)
|
|
147
|
+
|
|
148
|
+
**Priority**: Global packages are checked after workspace-local packages. When both global packages and registry versions exist, the system compares versions and uses the newer one (with tie-breaker preferring global for mutability).
|
|
149
|
+
|
|
150
|
+
**Example Structure:**
|
|
151
|
+
```
|
|
152
|
+
~/.openpackage/
|
|
153
|
+
└── packages/
|
|
154
|
+
└── shared-utils/
|
|
155
|
+
├── openpackage.yml
|
|
156
|
+
├── .cursor/
|
|
157
|
+
│ ├── rules/
|
|
158
|
+
│ └── commands/
|
|
159
|
+
└── root/
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**Usage in Workspace:**
|
|
163
|
+
```bash
|
|
164
|
+
# Install by name - automatic discovery
|
|
165
|
+
opkg install shared-utils
|
|
166
|
+
|
|
167
|
+
# Or explicit path
|
|
168
|
+
opkg install ~/.openpackage/packages/shared-utils/
|
|
169
|
+
|
|
170
|
+
# Or add to openpackage.yml manually
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
```yaml
|
|
174
|
+
# Any workspace's .openpackage/openpackage.yml
|
|
175
|
+
packages:
|
|
176
|
+
- name: shared-utils
|
|
177
|
+
path: ~/.openpackage/packages/shared-utils/
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Custom Path
|
|
181
|
+
|
|
182
|
+
**Location:** User-specified directory path
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
opkg new my-package --path ./custom-location
|
|
186
|
+
opkg new my-package --path /opt/packages/my-package
|
|
187
|
+
opkg new my-package --path ~/projects/my-package
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Use Cases:**
|
|
191
|
+
- Monorepo structures with custom package organization
|
|
192
|
+
- Shared team directories outside standard locations
|
|
193
|
+
- Integration with existing project structures
|
|
194
|
+
- Special organizational requirements
|
|
195
|
+
|
|
196
|
+
**Behavior:**
|
|
197
|
+
- Creates package at the exact path specified
|
|
198
|
+
- Supports relative paths (resolved from cwd)
|
|
199
|
+
- Supports absolute paths
|
|
200
|
+
- Supports tilde expansion (`~` → home directory)
|
|
201
|
+
- Validates parent directory exists before creation
|
|
202
|
+
- Blocks dangerous system directories
|
|
203
|
+
|
|
204
|
+
**Path Types:**
|
|
205
|
+
|
|
206
|
+
| Type | Example | Description |
|
|
207
|
+
|------|---------|-------------|
|
|
208
|
+
| Relative | `./my-package` | Relative to current directory |
|
|
209
|
+
| Relative Parent | `../shared/my-package` | Up and across directory tree |
|
|
210
|
+
| Absolute | `/opt/packages/my-package` | Full path from root |
|
|
211
|
+
| Tilde | `~/projects/my-package` | Relative to home directory |
|
|
212
|
+
|
|
213
|
+
**Example Structure:**
|
|
214
|
+
```
|
|
215
|
+
/custom/location/
|
|
216
|
+
└── my-package/
|
|
217
|
+
├── openpackage.yml # Package manifest
|
|
218
|
+
├── .cursor/ # Platform-specific content
|
|
219
|
+
│ ├── rules/
|
|
220
|
+
│ └── commands/
|
|
221
|
+
└── root/ # Root files
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Safety Features:**
|
|
225
|
+
- **Parent Validation**: Ensures parent directory exists before creating package
|
|
226
|
+
- **System Directory Protection**: Blocks creation in `/usr`, `/bin`, `/etc`, etc.
|
|
227
|
+
- **Existence Checking**: Detects existing packages and requires `--force` to overwrite
|
|
228
|
+
- **Clear Errors**: Provides actionable error messages when validation fails
|
|
229
|
+
|
|
230
|
+
**Installation:**
|
|
231
|
+
Custom path packages can be installed by path:
|
|
232
|
+
```bash
|
|
233
|
+
opkg install --path ./custom-location/my-package
|
|
234
|
+
# or
|
|
235
|
+
opkg install /opt/packages/my-package
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Priority**: When using custom paths, the package is treated similarly to root-scoped packages. Installation and management are done via explicit path references.
|
|
239
|
+
|
|
240
|
+
**Interactive Example:**
|
|
241
|
+
```bash
|
|
242
|
+
$ opkg new
|
|
243
|
+
? Where should this package be created? › Custom (specify path)
|
|
244
|
+
? Enter the directory path for the package: › ./my-custom-location
|
|
245
|
+
? Package name: › my-package
|
|
246
|
+
? Description: › My custom package
|
|
247
|
+
✓ my-custom-location/openpackage.yml created
|
|
248
|
+
|
|
249
|
+
📍 Location: Custom path (./my-custom-location)
|
|
250
|
+
💡 This package is at a custom location you specified
|
|
251
|
+
|
|
252
|
+
💡 Next steps:
|
|
253
|
+
1. Add files to your package at: ./my-custom-location
|
|
254
|
+
2. Install to workspace with path: opkg install --path ./my-custom-location
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**Non-Interactive Example:**
|
|
258
|
+
```bash
|
|
259
|
+
$ opkg new my-package --path ./custom-location --non-interactive
|
|
260
|
+
✓ custom-location/openpackage.yml created
|
|
261
|
+
- Name: my-package
|
|
262
|
+
|
|
263
|
+
📍 Location: Custom path (./custom-location)
|
|
264
|
+
💡 This package is at a custom location you specified
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Error Examples:**
|
|
268
|
+
```bash
|
|
269
|
+
# Parent directory doesn't exist
|
|
270
|
+
$ opkg new test --path ./non-existent/package
|
|
271
|
+
Error: Parent directory does not exist: /path/to/non-existent
|
|
272
|
+
Please create it first or choose a different path.
|
|
273
|
+
|
|
274
|
+
# System directory blocked
|
|
275
|
+
$ opkg new test --path /usr/my-package
|
|
276
|
+
Error: Cannot create package in system directory: /usr/my-package
|
|
277
|
+
|
|
278
|
+
# Both flags provided (warning)
|
|
279
|
+
$ opkg new test --scope local --path ./custom
|
|
280
|
+
# Uses custom path, logs warning about --scope being ignored
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Behavior Details
|
|
284
|
+
|
|
285
|
+
### Interactive Mode (Default)
|
|
286
|
+
|
|
287
|
+
When `--non-interactive` is not specified, prompts user for:
|
|
288
|
+
- Package name (if not provided and scope allows)
|
|
289
|
+
- Description
|
|
290
|
+
- Keywords (space-separated)
|
|
291
|
+
- Private flag
|
|
292
|
+
|
|
293
|
+
**Example Session:**
|
|
294
|
+
```bash
|
|
295
|
+
$ opkg new my-package
|
|
296
|
+
? Package name: › my-package
|
|
297
|
+
? Description: › My awesome package
|
|
298
|
+
? Keywords (space-separated): › tools utils
|
|
299
|
+
? Private package? › No
|
|
300
|
+
✓ .openpackage/packages/my-package/openpackage.yml created
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Non-Interactive Mode
|
|
304
|
+
|
|
305
|
+
When `--non-interactive` is specified:
|
|
306
|
+
- Uses provided package name or cwd basename
|
|
307
|
+
- Skips all prompts
|
|
308
|
+
- Creates minimal manifest with name only
|
|
309
|
+
|
|
310
|
+
**Example:**
|
|
311
|
+
```bash
|
|
312
|
+
$ opkg new my-package --non-interactive
|
|
313
|
+
✓ .openpackage/packages/my-package/openpackage.yml created
|
|
314
|
+
- Name: my-package
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Conflict Handling
|
|
318
|
+
|
|
319
|
+
#### Existing Package Without Force
|
|
320
|
+
|
|
321
|
+
If package already exists and `--force` is not specified:
|
|
322
|
+
- Displays existing package information
|
|
323
|
+
- Does not overwrite
|
|
324
|
+
- Exits successfully
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
$ opkg new existing-package
|
|
328
|
+
✓ .openpackage/packages/existing-package/openpackage.yml already exists
|
|
329
|
+
- Name: existing-package
|
|
330
|
+
- Version: 1.0.0
|
|
331
|
+
- Description: Existing package
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
#### Existing Package With Force
|
|
335
|
+
|
|
336
|
+
If package already exists and `--force` is specified:
|
|
337
|
+
- Overwrites `openpackage.yml`
|
|
338
|
+
- Preserves existing content directories
|
|
339
|
+
- Logs overwrite action
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
$ opkg new existing-package --force
|
|
343
|
+
✓ .openpackage/packages/existing-package/openpackage.yml created
|
|
344
|
+
- Name: existing-package
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Workspace Integration
|
|
348
|
+
|
|
349
|
+
The `opkg new` command **creates** packages but does **not** automatically add them to the workspace manifest.
|
|
350
|
+
|
|
351
|
+
To use a package after creation, explicitly install it:
|
|
352
|
+
```bash
|
|
353
|
+
opkg new my-package --scope local
|
|
354
|
+
opkg install my-package # Adds to workspace manifest and installs files
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
This separation keeps package creation (scaffolding) distinct from package usage (dependency management).
|
|
358
|
+
|
|
359
|
+
### Error Handling
|
|
360
|
+
|
|
361
|
+
#### Missing Scope or Path (Non-Interactive)
|
|
362
|
+
```bash
|
|
363
|
+
$ opkg new my-package --non-interactive
|
|
364
|
+
Error: Either --scope or --path is required in non-interactive mode.
|
|
365
|
+
|
|
366
|
+
Usage with scope:
|
|
367
|
+
opkg new [package-name] --scope <root|local|global> --non-interactive
|
|
368
|
+
|
|
369
|
+
Usage with custom path:
|
|
370
|
+
opkg new [package-name] --path <directory> --non-interactive
|
|
371
|
+
|
|
372
|
+
Available scopes:
|
|
373
|
+
root - Create in current directory
|
|
374
|
+
local - Create in .openpackage/packages/
|
|
375
|
+
global - Create in ~/.openpackage/packages/
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
#### Missing Package Name
|
|
379
|
+
```bash
|
|
380
|
+
$ opkg new --scope local --non-interactive
|
|
381
|
+
Error: Package name is required for local scope in non-interactive mode.
|
|
382
|
+
Usage: opkg new <package-name> --scope local --non-interactive
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
#### Invalid Scope
|
|
386
|
+
```bash
|
|
387
|
+
$ opkg new my-package --scope invalid
|
|
388
|
+
Error: Invalid scope: 'invalid'
|
|
389
|
+
Valid scopes: root, local, global
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
#### Invalid Package Name
|
|
393
|
+
```bash
|
|
394
|
+
$ opkg new My-Package
|
|
395
|
+
Error: Package name 'My-Package' is invalid.
|
|
396
|
+
Package names must be lowercase...
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
#### Custom Path: Non-Existent Parent Directory
|
|
400
|
+
```bash
|
|
401
|
+
$ opkg new my-package --path ./non-existent/package
|
|
402
|
+
Error: Parent directory does not exist: /path/to/non-existent
|
|
403
|
+
Please create it first or choose a different path.
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
#### Custom Path: System Directory Blocked
|
|
407
|
+
```bash
|
|
408
|
+
$ opkg new my-package --path /usr/my-package
|
|
409
|
+
Error: Cannot create package in system directory: /usr/my-package
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
#### Custom Path: Already Exists Without Force
|
|
413
|
+
```bash
|
|
414
|
+
$ opkg new my-package --path ./existing
|
|
415
|
+
Error: Package already exists at: /path/to/existing
|
|
416
|
+
Use --force to overwrite.
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
#### Custom Path: Empty Path
|
|
420
|
+
```bash
|
|
421
|
+
$ opkg new my-package --path ""
|
|
422
|
+
Error: Path cannot be empty
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
## Output Format
|
|
426
|
+
|
|
427
|
+
### Success Output
|
|
428
|
+
|
|
429
|
+
```bash
|
|
430
|
+
✓ <path-to-openpackage.yml> created
|
|
431
|
+
- Name: <package-name>
|
|
432
|
+
[- Version: <version>] # If specified
|
|
433
|
+
[- Description: <desc>] # If specified
|
|
434
|
+
|
|
435
|
+
📍 Scope: <scope-description>
|
|
436
|
+
💡 <scope-specific-tip>
|
|
437
|
+
|
|
438
|
+
💡 Next steps:
|
|
439
|
+
1. <step-1>
|
|
440
|
+
2. <step-2>
|
|
441
|
+
3. <step-3>
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### Error Output
|
|
445
|
+
|
|
446
|
+
```bash
|
|
447
|
+
Error: <error-message>
|
|
448
|
+
[Additional context or suggestions]
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
## Examples
|
|
452
|
+
|
|
453
|
+
### Create Package with Interactive Scope Selection
|
|
454
|
+
```bash
|
|
455
|
+
$ opkg new my-tools
|
|
456
|
+
? Where should this package be created? ›
|
|
457
|
+
❯ Root (current directory) - Create openpackage.yml here - for standalone/distributable packages
|
|
458
|
+
Local (workspace-scoped) - Create in .openpackage/packages/ - for project-specific packages
|
|
459
|
+
Global (cross-workspace) - Create in ~/.openpackage/packages/ - shared across all workspaces on this machine
|
|
460
|
+
|
|
461
|
+
# User selects "Root"
|
|
462
|
+
? Package name: › my-tools
|
|
463
|
+
? Description: › My project tools
|
|
464
|
+
? Keywords (space-separated): › tools utils
|
|
465
|
+
? Private package? › No
|
|
466
|
+
|
|
467
|
+
✓ openpackage.yml created
|
|
468
|
+
- Name: my-tools
|
|
469
|
+
- Description: My project tools
|
|
470
|
+
- Keywords: tools, utils
|
|
471
|
+
|
|
472
|
+
📍 Scope: Current directory (root package)
|
|
473
|
+
|
|
474
|
+
💡 Next steps:
|
|
475
|
+
1. Add files to your package in current directory
|
|
476
|
+
2. Save to registry: opkg pack
|
|
477
|
+
3. Install in other workspaces: opkg install my-tools
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
### Create Local Package (Explicit Scope)
|
|
481
|
+
```bash
|
|
482
|
+
$ opkg new my-tools --scope local
|
|
483
|
+
# Skips scope prompt, goes directly to package details
|
|
484
|
+
✓ .openpackage/packages/my-tools/openpackage.yml created
|
|
485
|
+
- Name: my-tools
|
|
486
|
+
|
|
487
|
+
📍 Scope: Workspace-local (.openpackage/packages/)
|
|
488
|
+
💡 This package is local to the current workspace
|
|
489
|
+
|
|
490
|
+
💡 Next steps:
|
|
491
|
+
1. Add files to your package: cd .openpackage/packages/my-tools/
|
|
492
|
+
2. Install to this workspace: opkg install my-tools
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
### Create Global Package
|
|
496
|
+
```bash
|
|
497
|
+
$ opkg new shared-prompts --scope global
|
|
498
|
+
✓ /Users/user/.openpackage/packages/shared-prompts/openpackage.yml created
|
|
499
|
+
- Name: shared-prompts
|
|
500
|
+
|
|
501
|
+
📍 Scope: Global shared (~/.openpackage/packages/)
|
|
502
|
+
💡 This package can be used across all workspaces
|
|
503
|
+
|
|
504
|
+
💡 Next steps:
|
|
505
|
+
1. Add files to your package: cd ~/.openpackage/packages/shared-prompts/
|
|
506
|
+
2. Install to any workspace: opkg install shared-prompts
|
|
507
|
+
3. Or use explicit path: opkg install ~/.openpackage/packages/shared-prompts/
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
### Create Root Package
|
|
511
|
+
```bash
|
|
512
|
+
$ opkg new my-package --scope root
|
|
513
|
+
✓ openpackage.yml created
|
|
514
|
+
- Name: my-package
|
|
515
|
+
|
|
516
|
+
📍 Scope: Current directory (root package)
|
|
517
|
+
|
|
518
|
+
💡 Next steps:
|
|
519
|
+
1. Add files to your package in current directory
|
|
520
|
+
2. Save to registry: opkg pack
|
|
521
|
+
3. Install in other workspaces: opkg install my-package
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
### Create with Force Overwrite
|
|
525
|
+
```bash
|
|
526
|
+
$ opkg new existing-package --scope local --force --non-interactive
|
|
527
|
+
✓ .openpackage/packages/existing-package/openpackage.yml created
|
|
528
|
+
- Name: existing-package
|
|
529
|
+
|
|
530
|
+
📍 Scope: Workspace-local (.openpackage/packages/)
|
|
531
|
+
💡 This package is local to the current workspace
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
### Non-Interactive Mode Requires Scope
|
|
535
|
+
```bash
|
|
536
|
+
$ opkg new my-package --non-interactive
|
|
537
|
+
Error: The --scope flag is required in non-interactive mode.
|
|
538
|
+
Usage: opkg new [package-name] --scope <root|local|global> --non-interactive
|
|
539
|
+
|
|
540
|
+
Available scopes:
|
|
541
|
+
root - Create in current directory
|
|
542
|
+
local - Create in .openpackage/packages/
|
|
543
|
+
global - Create in ~/.openpackage/packages/
|
|
544
|
+
|
|
545
|
+
$ opkg new my-package --scope local --non-interactive
|
|
546
|
+
✓ .openpackage/packages/my-package/openpackage.yml created
|
|
547
|
+
- Name: my-package
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
### Create Scoped Package
|
|
551
|
+
```bash
|
|
552
|
+
$ opkg new @myorg/utils
|
|
553
|
+
✓ .openpackage/packages/@myorg/utils/openpackage.yml created
|
|
554
|
+
- Name: @myorg/utils
|
|
555
|
+
|
|
556
|
+
📍 Scope: Workspace-local (.openpackage/packages/)
|
|
557
|
+
💡 This package is local to the current workspace
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
### Create Package at Custom Path (Interactive)
|
|
561
|
+
```bash
|
|
562
|
+
$ opkg new my-package
|
|
563
|
+
? Where should this package be created? › Custom (specify path)
|
|
564
|
+
? Enter the directory path for the package: › ./custom-location
|
|
565
|
+
? Package name: › my-package
|
|
566
|
+
? Description: › Custom location package
|
|
567
|
+
? Keywords (space-separated): ›
|
|
568
|
+
? Private package? › No
|
|
569
|
+
|
|
570
|
+
✓ custom-location/openpackage.yml created
|
|
571
|
+
- Name: my-package
|
|
572
|
+
- Description: Custom location package
|
|
573
|
+
|
|
574
|
+
📍 Location: Custom path (./custom-location)
|
|
575
|
+
💡 This package is at a custom location you specified
|
|
576
|
+
|
|
577
|
+
💡 Next steps:
|
|
578
|
+
1. Add files to your package at: ./custom-location
|
|
579
|
+
2. Install to workspace with path: opkg install --path ./custom-location
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
### Create Package at Custom Path (Relative)
|
|
583
|
+
```bash
|
|
584
|
+
$ opkg new my-package --path ./custom-location --non-interactive
|
|
585
|
+
✓ custom-location/openpackage.yml created
|
|
586
|
+
- Name: my-package
|
|
587
|
+
|
|
588
|
+
📍 Location: Custom path (./custom-location)
|
|
589
|
+
💡 This package is at a custom location you specified
|
|
590
|
+
|
|
591
|
+
💡 Next steps:
|
|
592
|
+
1. Add files to your package at: ./custom-location
|
|
593
|
+
2. Install to workspace with path: opkg install --path ./custom-location
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
### Create Package at Custom Path (Absolute)
|
|
597
|
+
```bash
|
|
598
|
+
$ opkg new my-package --path /opt/packages/my-package --non-interactive
|
|
599
|
+
✓ /opt/packages/my-package/openpackage.yml created
|
|
600
|
+
- Name: my-package
|
|
601
|
+
|
|
602
|
+
📍 Location: Custom path (/opt/packages/my-package)
|
|
603
|
+
💡 This package is at a custom location you specified
|
|
604
|
+
|
|
605
|
+
💡 Next steps:
|
|
606
|
+
1. Add files to your package at: /opt/packages/my-package
|
|
607
|
+
2. Install to workspace with path: opkg install --path /opt/packages/my-package
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
### Create Package at Custom Path (Tilde)
|
|
611
|
+
```bash
|
|
612
|
+
$ opkg new my-package --path ~/projects/my-package --non-interactive
|
|
613
|
+
✓ /Users/user/projects/my-package/openpackage.yml created
|
|
614
|
+
- Name: my-package
|
|
615
|
+
|
|
616
|
+
📍 Location: Custom path (~/projects/my-package)
|
|
617
|
+
💡 This package is at a custom location you specified
|
|
618
|
+
|
|
619
|
+
💡 Next steps:
|
|
620
|
+
1. Add files to your package at: ~/projects/my-package
|
|
621
|
+
2. Install to workspace with path: opkg install --path ~/projects/my-package
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
### Custom Path with Monorepo Structure
|
|
625
|
+
```bash
|
|
626
|
+
# Create package in monorepo packages directory
|
|
627
|
+
$ opkg new shared-components --path ../packages/shared-components --non-interactive
|
|
628
|
+
✓ ../packages/shared-components/openpackage.yml created
|
|
629
|
+
- Name: shared-components
|
|
630
|
+
|
|
631
|
+
📍 Location: Custom path (../packages/shared-components)
|
|
632
|
+
💡 This package is at a custom location you specified
|
|
633
|
+
|
|
634
|
+
# Resulting structure:
|
|
635
|
+
# project-root/
|
|
636
|
+
# ├── workspace-a/ (current directory)
|
|
637
|
+
# └── packages/
|
|
638
|
+
# └── shared-components/
|
|
639
|
+
# └── openpackage.yml
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
## Integration with Other Commands
|
|
643
|
+
|
|
644
|
+
### After `opkg new`
|
|
645
|
+
|
|
646
|
+
**Local Package Workflow:**
|
|
647
|
+
```bash
|
|
648
|
+
opkg new my-package # Create package
|
|
649
|
+
cd .openpackage/packages/my-package/
|
|
650
|
+
# Add files (rules, commands, etc.)
|
|
651
|
+
opkg install my-package # Install to workspace
|
|
652
|
+
opkg save my-package # Save changes back to package
|
|
653
|
+
opkg pack my-package # Create stable release
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
**Global Package Workflow:**
|
|
657
|
+
```bash
|
|
658
|
+
opkg new shared-utils --scope global # Create global package
|
|
659
|
+
cd ~/.openpackage/packages/shared-utils/
|
|
660
|
+
# Add files
|
|
661
|
+
opkg pack shared-utils # Pack to registry
|
|
662
|
+
|
|
663
|
+
# In any workspace:
|
|
664
|
+
# Add to .openpackage/openpackage.yml:
|
|
665
|
+
# - name: shared-utils
|
|
666
|
+
# path: ~/.openpackage/packages/shared-utils/
|
|
667
|
+
opkg install # Install all deps including shared-utils
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
**Root Package Workflow:**
|
|
671
|
+
```bash
|
|
672
|
+
mkdir my-package && cd my-package
|
|
673
|
+
opkg new --scope root # Create root package
|
|
674
|
+
# Add files to current directory
|
|
675
|
+
opkg pack # Pack to registry
|
|
676
|
+
opkg push my-package # Share to remote registry
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
**Custom Path Package Workflow:**
|
|
680
|
+
```bash
|
|
681
|
+
opkg new my-package --path ./custom-location # Create at custom path
|
|
682
|
+
cd custom-location/
|
|
683
|
+
# Add files (rules, commands, etc.)
|
|
684
|
+
opkg save --path ./custom-location # Save changes (if applicable)
|
|
685
|
+
opkg pack --path ./custom-location # Create stable release
|
|
686
|
+
|
|
687
|
+
# In any workspace:
|
|
688
|
+
opkg install --path /path/to/custom-location # Install by path
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
### Auto-Creation by Other Commands
|
|
692
|
+
|
|
693
|
+
The `opkg add` command may auto-create a root package if needed:
|
|
694
|
+
```bash
|
|
695
|
+
$ cd my-package/
|
|
696
|
+
$ opkg add ./rules/example.md
|
|
697
|
+
# No package detected - prompts to create root package
|
|
698
|
+
? Create package for current directory? › Yes
|
|
699
|
+
? Package name: › my-package
|
|
700
|
+
? Description: › ...
|
|
701
|
+
✓ Created root package
|
|
702
|
+
✓ Added ./rules/example.md to package
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
## Comparison with Deprecated `opkg init`
|
|
706
|
+
|
|
707
|
+
| Aspect | Old `opkg init` | New `opkg new` |
|
|
708
|
+
|--------|----------------|----------------|
|
|
709
|
+
| **Command** | `opkg init` | `opkg new` |
|
|
710
|
+
| **Dual Purpose** | ✅ Yes (workspace + package) | ❌ No (package only) |
|
|
711
|
+
| **Root Package** | `opkg init` | `opkg new --scope root` |
|
|
712
|
+
| **Local Package** | `opkg init <name>` | `opkg new <name>` |
|
|
713
|
+
| **Global Package** | ❌ Not supported | `opkg new <name> --scope global` |
|
|
714
|
+
| **Custom Path** | ❌ Not supported | `opkg new <name> --path <dir>` |
|
|
715
|
+
| **Workspace Init** | Manual required | Auto-created when needed |
|
|
716
|
+
| **Scope Clarity** | Implicit | Explicit with `--scope` or `--path` |
|
|
717
|
+
| **Overwrite** | `--force` | `--force` (same) |
|
|
718
|
+
| **Interactive** | Yes (default) | Yes (default) |
|
|
719
|
+
|
|
720
|
+
## Implementation Notes
|
|
721
|
+
|
|
722
|
+
### Core Logic
|
|
723
|
+
- Implemented in `src/commands/new.ts` (CLI interface)
|
|
724
|
+
- Core logic in `src/core/package-creation.ts` (business logic)
|
|
725
|
+
- Scope-based path resolution in `src/utils/scope-resolution.ts` (pure functions)
|
|
726
|
+
- Custom path resolution in `src/utils/custom-path-resolution.ts` (pure functions)
|
|
727
|
+
|
|
728
|
+
### Design Patterns
|
|
729
|
+
- **Separation of Concerns**: CLI, business logic, and utilities separated
|
|
730
|
+
- **Single Responsibility**: Each module has one clear purpose
|
|
731
|
+
- **Reusability**: `createPackage()` used by both `new` command and `add` pipeline
|
|
732
|
+
- **Testability**: Pure functions for path resolution, testable business logic
|
|
733
|
+
- **Modularity**: Custom path logic isolated in dedicated utility module
|
|
734
|
+
|
|
735
|
+
### Custom Path Implementation
|
|
736
|
+
The custom path feature follows these principles:
|
|
737
|
+
1. **Validation First**: Validate path before any file operations
|
|
738
|
+
2. **Clear Errors**: Provide actionable error messages with context
|
|
739
|
+
3. **Safety Checks**: Block dangerous system directories
|
|
740
|
+
4. **Path Types**: Support relative, absolute, and tilde paths
|
|
741
|
+
5. **Precedence**: `--path` takes precedence over `--scope` when both provided
|
|
742
|
+
|
|
743
|
+
**Key Functions** (`src/utils/custom-path-resolution.ts`):
|
|
744
|
+
- `resolveCustomPath()` - Resolves any path type to absolute path
|
|
745
|
+
- `validateCustomPath()` - Validates path safety and existence
|
|
746
|
+
- `formatCustomPathForDisplay()` - Formats paths for user output
|
|
747
|
+
|
|
748
|
+
### Extensibility
|
|
749
|
+
|
|
750
|
+
#### Adding a New Predefined Scope (e.g., "team")
|
|
751
|
+
1. Add to `PackageScope` type in `scope-resolution.ts`
|
|
752
|
+
2. Add path resolution in `getScopePackageDir()`
|
|
753
|
+
3. Add description in `getScopeDescription()`
|
|
754
|
+
4. Update command help text
|
|
755
|
+
5. Add to interactive prompt choices
|
|
756
|
+
|
|
757
|
+
#### Adding Custom Path Validation Rules
|
|
758
|
+
1. Extend `validateCustomPath()` in `custom-path-resolution.ts`
|
|
759
|
+
2. Add new validation checks as needed
|
|
760
|
+
3. Return structured error messages
|
|
761
|
+
4. Update tests to cover new rules
|
|
762
|
+
|
|
763
|
+
## See Also
|
|
764
|
+
|
|
765
|
+
- [Scope Management](../scope-management.md) - Details on local/global scopes
|
|
766
|
+
- [Directory Layout](../directory-layout.md) - Package directory structure
|
|
767
|
+
- [Package Sources](../package-sources.md) - Path-based source resolution
|
|
768
|
+
- [Save Command](../save/) - Syncing changes back to packages
|
|
769
|
+
- [Pack Command](../pack/) - Creating registry snapshots
|