opkg 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -21
- package/dist/commands/add.js +11 -276
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/duplicate.js +5 -2
- package/dist/commands/duplicate.js.map +1 -1
- package/dist/commands/init.js +76 -145
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install.js +30 -671
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/list.js +9 -3
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/login.js +58 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.js +28 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/pack.js +10 -137
- package/dist/commands/pack.js.map +1 -1
- package/dist/commands/pull.js +5 -299
- package/dist/commands/pull.js.map +1 -1
- package/dist/commands/push.js +5 -239
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/save.js +29 -168
- package/dist/commands/save.js.map +1 -1
- package/dist/commands/show.js +18 -5
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/status.js +21 -8
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/tui.js +61 -0
- package/dist/commands/tui.js.map +1 -0
- package/dist/commands/uninstall.js +5 -5
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/constants/index.js +19 -45
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/workspace.js +9 -0
- package/dist/constants/workspace.js.map +1 -0
- package/dist/core/add/add-conflict-handler.js +68 -0
- package/dist/core/add/add-conflict-handler.js.map +1 -0
- package/dist/core/add/add-pipeline.js +137 -0
- package/dist/core/add/add-pipeline.js.map +1 -0
- package/dist/core/add/package-index-updater.js +66 -36
- package/dist/core/add/package-index-updater.js.map +1 -1
- package/dist/core/add/platform-path-transformer.js +47 -0
- package/dist/core/add/platform-path-transformer.js.map +1 -0
- package/dist/core/add/source-collector.js +57 -0
- package/dist/core/add/source-collector.js.map +1 -0
- package/dist/core/api-keys.js +6 -2
- package/dist/core/api-keys.js.map +1 -1
- package/dist/core/auth.js +25 -40
- package/dist/core/auth.js.map +1 -1
- package/dist/core/config.js +11 -3
- package/dist/core/config.js.map +1 -1
- package/dist/core/dependency-resolver.js +24 -11
- package/dist/core/dependency-resolver.js.map +1 -1
- package/dist/core/device-auth.js +81 -0
- package/dist/core/device-auth.js.map +1 -0
- package/dist/core/directory.js +15 -9
- package/dist/core/directory.js.map +1 -1
- package/dist/core/discovery/file-discovery.js +55 -54
- package/dist/core/discovery/file-discovery.js.map +1 -1
- package/dist/core/discovery/platform-files-discovery.js +32 -17
- package/dist/core/discovery/platform-files-discovery.js.map +1 -1
- package/dist/core/install/bulk-install-pipeline.js +200 -0
- package/dist/core/install/bulk-install-pipeline.js.map +1 -0
- package/dist/core/install/canonical-plan.js +129 -0
- package/dist/core/install/canonical-plan.js.map +1 -0
- package/dist/core/install/download-keys.js +2 -2
- package/dist/core/install/download-keys.js.map +1 -1
- package/dist/core/install/dry-run.js +2 -2
- package/dist/core/install/dry-run.js.map +1 -1
- package/dist/core/install/index.js +3 -0
- package/dist/core/install/index.js.map +1 -0
- package/dist/core/install/install-errors.js +41 -0
- package/dist/core/install/install-errors.js.map +1 -0
- package/dist/core/install/install-flow.js +8 -9
- package/dist/core/install/install-flow.js.map +1 -1
- package/dist/core/install/install-pipeline.js +296 -0
- package/dist/core/install/install-pipeline.js.map +1 -0
- package/dist/core/install/install-reporting.js +99 -0
- package/dist/core/install/install-reporting.js.map +1 -0
- package/dist/core/install/platform-resolution.js +6 -6
- package/dist/core/install/platform-resolution.js.map +1 -1
- package/dist/core/install/remote-flow.js +84 -7
- package/dist/core/install/remote-flow.js.map +1 -1
- package/dist/core/install/version-selection.js +25 -8
- package/dist/core/install/version-selection.js.map +1 -1
- package/dist/core/openpackage.js +22 -14
- package/dist/core/openpackage.js.map +1 -1
- package/dist/core/package-context.js +246 -0
- package/dist/core/package-context.js.map +1 -0
- package/dist/core/package.js +73 -9
- package/dist/core/package.js.map +1 -1
- package/dist/core/platforms.js +126 -217
- package/dist/core/platforms.js.map +1 -1
- package/dist/core/profiles.js +60 -3
- package/dist/core/profiles.js.map +1 -1
- package/dist/core/pull/pull-errors.js +62 -0
- package/dist/core/pull/pull-errors.js.map +1 -0
- package/dist/core/pull/pull-options.js +2 -0
- package/dist/core/pull/pull-options.js.map +1 -0
- package/dist/core/pull/pull-output.js +50 -0
- package/dist/core/pull/pull-output.js.map +1 -0
- package/dist/core/pull/pull-pipeline.js +141 -0
- package/dist/core/pull/pull-pipeline.js.map +1 -0
- package/dist/core/pull/pull-strategies.js +103 -0
- package/dist/core/pull/pull-strategies.js.map +1 -0
- package/dist/core/pull/pull-types.js +2 -0
- package/dist/core/pull/pull-types.js.map +1 -0
- package/dist/core/push/push-context.js +95 -0
- package/dist/core/push/push-context.js.map +1 -0
- package/dist/core/push/push-errors.js +133 -0
- package/dist/core/push/push-errors.js.map +1 -0
- package/dist/core/push/push-output.js +44 -0
- package/dist/core/push/push-output.js.map +1 -0
- package/dist/core/push/push-pipeline.js +74 -0
- package/dist/core/push/push-pipeline.js.map +1 -0
- package/dist/core/push/push-single-file.js +56 -0
- package/dist/core/push/push-single-file.js.map +1 -0
- package/dist/core/push/push-types.js +2 -0
- package/dist/core/push/push-types.js.map +1 -0
- package/dist/core/push/push-upload.js +68 -0
- package/dist/core/push/push-upload.js.map +1 -0
- package/dist/core/registry/registry-rename.js +2 -1
- package/dist/core/registry/registry-rename.js.map +1 -1
- package/dist/core/registry.js +14 -5
- package/dist/core/registry.js.map +1 -1
- package/dist/core/remote-pull.js +165 -36
- package/dist/core/remote-pull.js.map +1 -1
- package/dist/core/save/constants.js +4 -0
- package/dist/core/save/constants.js.map +1 -1
- package/dist/core/save/name-resolution.js +31 -0
- package/dist/core/save/name-resolution.js.map +1 -0
- package/dist/core/save/package-detection.js +147 -0
- package/dist/core/save/package-detection.js.map +1 -0
- package/dist/core/save/package-saver.js +82 -43
- package/dist/core/save/package-saver.js.map +1 -1
- package/dist/core/save/package-yml-generator.js +51 -71
- package/dist/core/save/package-yml-generator.js.map +1 -1
- package/dist/core/save/root-save-candidates.js.map +1 -1
- package/dist/core/save/save-candidate-loader.js +89 -0
- package/dist/core/save/save-candidate-loader.js.map +1 -0
- package/dist/core/save/save-conflict-resolution.js +72 -410
- package/dist/core/save/save-conflict-resolution.js.map +1 -1
- package/dist/core/save/save-conflict-resolver.js +277 -0
- package/dist/core/save/save-conflict-resolver.js.map +1 -0
- package/dist/core/save/save-pipeline.js +162 -0
- package/dist/core/save/save-pipeline.js.map +1 -0
- package/dist/core/save/save-single-file.js +124 -0
- package/dist/core/save/save-single-file.js.map +1 -0
- package/dist/core/save/save-types.js +2 -0
- package/dist/core/save/save-types.js.map +1 -0
- package/dist/core/save/save-yml-resolution.js +77 -39
- package/dist/core/save/save-yml-resolution.js.map +1 -1
- package/dist/core/save/workspace-rename.js +6 -6
- package/dist/core/save/workspace-rename.js.map +1 -1
- package/dist/core/scoping/package-scoping.js +14 -2
- package/dist/core/scoping/package-scoping.js.map +1 -1
- package/dist/core/status/status-file-discovery.js +12 -30
- package/dist/core/status/status-file-discovery.js.map +1 -1
- package/dist/core/sync/platform-sync.js +7 -4
- package/dist/core/sync/platform-sync.js.map +1 -1
- package/dist/core/sync/root-files-sync.js +59 -1
- package/dist/core/sync/root-files-sync.js.map +1 -1
- package/dist/core/token-store.js +73 -0
- package/dist/core/token-store.js.map +1 -0
- package/dist/core/uninstall/uninstall-file-discovery.js +1 -2
- package/dist/core/uninstall/uninstall-file-discovery.js.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/tui/app.js +95 -0
- package/dist/tui/app.js.map +1 -0
- package/dist/tui/components/package-list.js +73 -0
- package/dist/tui/components/package-list.js.map +1 -0
- package/dist/tui/controller.js +365 -0
- package/dist/tui/controller.js.map +1 -0
- package/dist/tui/index.js +12 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/services/file-index.js +64 -0
- package/dist/tui/services/file-index.js.map +1 -0
- package/dist/tui/services/packages.js +18 -0
- package/dist/tui/services/packages.js.map +1 -0
- package/dist/tui/services/save.js +21 -0
- package/dist/tui/services/save.js.map +1 -0
- package/dist/tui/state/app-state.js +15 -0
- package/dist/tui/state/app-state.js.map +1 -0
- package/dist/tui/state.js +17 -0
- package/dist/tui/state.js.map +1 -0
- package/dist/tui/types.js +2 -0
- package/dist/tui/types.js.map +1 -0
- package/dist/tui/views/add-file-modal.js +129 -0
- package/dist/tui/views/add-file-modal.js.map +1 -0
- package/dist/tui/views/file-preview.js +44 -0
- package/dist/tui/views/file-preview.js.map +1 -0
- package/dist/tui/views/list-packages.js +73 -0
- package/dist/tui/views/list-packages.js.map +1 -0
- package/dist/tui/views/main-menu.js +29 -0
- package/dist/tui/views/main-menu.js.map +1 -0
- package/dist/tui/views/manage-view.js +81 -0
- package/dist/tui/views/manage-view.js.map +1 -0
- package/dist/tui/views/package-hub.js +120 -0
- package/dist/tui/views/package-hub.js.map +1 -0
- package/dist/tui/views/placeholder.js +24 -0
- package/dist/tui/views/placeholder.js.map +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/utils/bun-bootstrap.js +72 -0
- package/dist/utils/bun-bootstrap.js.map +1 -0
- package/dist/utils/file-processing.js +5 -58
- package/dist/utils/file-processing.js.map +1 -1
- package/dist/utils/formatters.js +3 -1
- package/dist/utils/formatters.js.map +1 -1
- package/dist/utils/http-client.js +27 -5
- package/dist/utils/http-client.js.map +1 -1
- package/dist/utils/index-based-installer.js +40 -35
- package/dist/utils/index-based-installer.js.map +1 -1
- package/dist/utils/install-file-discovery.js +18 -24
- package/dist/utils/install-file-discovery.js.map +1 -1
- package/dist/utils/install-orchestrator.js +21 -21
- package/dist/utils/install-orchestrator.js.map +1 -1
- package/dist/utils/jsonc.js +44 -0
- package/dist/utils/jsonc.js.map +1 -0
- package/dist/utils/manifest-paths.js +27 -0
- package/dist/utils/manifest-paths.js.map +1 -0
- package/dist/utils/package-copy.js +199 -0
- package/dist/utils/package-copy.js.map +1 -0
- package/dist/utils/package-filters.js +125 -0
- package/dist/utils/package-filters.js.map +1 -0
- package/dist/utils/package-index-yml.js +15 -10
- package/dist/utils/package-index-yml.js.map +1 -1
- package/dist/utils/package-installation.js +4 -113
- package/dist/utils/package-installation.js.map +1 -1
- package/dist/utils/package-local-files.js +2 -35
- package/dist/utils/package-local-files.js.map +1 -1
- package/dist/utils/package-management.js +191 -75
- package/dist/utils/package-management.js.map +1 -1
- package/dist/utils/package-merge.js +48 -0
- package/dist/utils/package-merge.js.map +1 -0
- package/dist/utils/package-name.js +29 -0
- package/dist/utils/package-name.js.map +1 -1
- package/dist/utils/package-versioning.js +16 -4
- package/dist/utils/package-versioning.js.map +1 -1
- package/dist/utils/package-yml.js +41 -12
- package/dist/utils/package-yml.js.map +1 -1
- package/dist/utils/path-normalization.js +8 -53
- package/dist/utils/path-normalization.js.map +1 -1
- package/dist/utils/paths.js +17 -9
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/platform-file.js +16 -59
- package/dist/utils/platform-file.js.map +1 -1
- package/dist/utils/platform-mapper.js +29 -41
- package/dist/utils/platform-mapper.js.map +1 -1
- package/dist/utils/platform-specific-paths.js.map +1 -1
- package/dist/utils/platform-utils.js +28 -139
- package/dist/utils/platform-utils.js.map +1 -1
- package/dist/utils/platform-yaml-merge.js +13 -6
- package/dist/utils/platform-yaml-merge.js.map +1 -1
- package/dist/utils/prompts.js +0 -31
- package/dist/utils/prompts.js.map +1 -1
- package/dist/utils/registry-entry-filter.js +38 -24
- package/dist/utils/registry-entry-filter.js.map +1 -1
- package/dist/utils/registry-paths.js +48 -0
- package/dist/utils/registry-paths.js.map +1 -0
- package/dist/utils/root-file-installer.js +19 -0
- package/dist/utils/root-file-installer.js.map +1 -1
- package/dist/utils/root-file-registry.js.map +1 -1
- package/dist/utils/tarball.js +6 -2
- package/dist/utils/tarball.js.map +1 -1
- package/dist/utils/version-ranges.js +11 -8
- package/dist/utils/version-ranges.js.map +1 -1
- package/package.json +3 -2
- package/platforms.jsonc +178 -0
- package/specs/auth/auth-device-flow.md +70 -0
- package/specs/install/install-behavior.md +30 -0
- package/specs/install/package-yml-canonical.md +21 -1
- package/specs/install/version-resolution.md +9 -7
- package/specs/login/login-device-flow.md +70 -0
- package/specs/package/README.md +60 -0
- package/specs/package/nested-packages-and-parent-packages.md +79 -0
- package/specs/package/package-index-yml.md +171 -0
- package/specs/package/package-root-layout.md +78 -0
- package/specs/package/registry-payload-and-copy.md +77 -0
- package/specs/package/universal-content.md +144 -0
- package/specs/platforms.md +193 -0
- package/specs/push/push-behavior.md +38 -10
- package/specs/push/push-errors-and-hints.md +19 -6
- package/specs/push/push-remote-upload.md +3 -0
- package/specs/push/push-scoping.md +14 -22
- package/specs/push/push-version-selection.md +18 -16
- package/specs/save/README.md +40 -0
- package/specs/save/save-conflict-resolution.md +146 -0
- package/specs/save/save-file-discovery.md +101 -0
- package/specs/save/save-frontmatter-overrides.md +81 -0
- package/specs/save/save-modes-inputs.md +55 -0
- package/specs/save/save-naming-scoping.md +93 -0
- package/specs/save/save-package-detection.md +60 -0
- package/specs/save/save-registry-sync.md +126 -0
- package/specs/save-pack.md +1 -0
- package/dist/commands/release.js +0 -33
- package/dist/commands/release.js.map +0 -1
- package/dist/commands/tag.js +0 -311
- package/dist/commands/tag.js.map +0 -1
- package/dist/commands/update.js +0 -30
- package/dist/commands/update.js.map +0 -1
- package/dist/core/add/formula-index-updater.js +0 -290
- package/dist/core/add/formula-index-updater.js.map +0 -1
- package/dist/core/discovery/ai-files-discovery.js +0 -2
- package/dist/core/discovery/ai-files-discovery.js.map +0 -1
- package/dist/core/discovery/formula-files-discovery.js +0 -14
- package/dist/core/discovery/formula-files-discovery.js.map +0 -1
- package/dist/core/discovery/index-files-discovery.js +0 -91
- package/dist/core/discovery/index-files-discovery.js.map +0 -1
- package/dist/core/discovery/md-files-discovery.js +0 -82
- package/dist/core/discovery/md-files-discovery.js.map +0 -1
- package/dist/core/discovery/package-files-discovery.js +0 -14
- package/dist/core/discovery/package-files-discovery.js.map +0 -1
- package/dist/core/discovery/platform-discovery.js +0 -84
- package/dist/core/discovery/platform-discovery.js.map +0 -1
- package/dist/core/discovery/root-files-discovery.js +0 -2
- package/dist/core/discovery/root-files-discovery.js.map +0 -1
- package/dist/core/formula.js +0 -170
- package/dist/core/formula.js.map +0 -1
- package/dist/core/git-registry.js +0 -46
- package/dist/core/git-registry.js.map +0 -1
- package/dist/core/groundzero.js +0 -277
- package/dist/core/groundzero.js.map +0 -1
- package/dist/core/install/scenario.js +0 -11
- package/dist/core/install/scenario.js.map +0 -1
- package/dist/core/package-sync.js +0 -219
- package/dist/core/package-sync.js.map +0 -1
- package/dist/core/save/formula-file-generator.js +0 -167
- package/dist/core/save/formula-file-generator.js.map +0 -1
- package/dist/core/save/formula-saver.js +0 -52
- package/dist/core/save/formula-saver.js.map +0 -1
- package/dist/core/save/formula-yml-generator.js +0 -89
- package/dist/core/save/formula-yml-generator.js.map +0 -1
- package/dist/core/save/formula-yml-versioning.js +0 -108
- package/dist/core/save/formula-yml-versioning.js.map +0 -1
- package/dist/core/save/generic-file-sync.js +0 -38
- package/dist/core/save/generic-file-sync.js.map +0 -1
- package/dist/core/save/md-files-sync.js +0 -33
- package/dist/core/save/md-files-sync.js.map +0 -1
- package/dist/core/save/package-yml-versioning.js +0 -108
- package/dist/core/save/package-yml-versioning.js.map +0 -1
- package/dist/core/save/platform-sync.js +0 -95
- package/dist/core/save/platform-sync.js.map +0 -1
- package/dist/core/save/root-files-sync.js +0 -140
- package/dist/core/save/root-files-sync.js.map +0 -1
- package/dist/core/save/save-candidate-types.js +0 -2
- package/dist/core/save/save-candidate-types.js.map +0 -1
- package/dist/core/save/save-conflict-types.js +0 -2
- package/dist/core/save/save-conflict-types.js.map +0 -1
- package/dist/core/save/save-file-discovery.js +0 -5
- package/dist/core/save/save-file-discovery.js.map +0 -1
- package/dist/core/status-file-discovery.js +0 -175
- package/dist/core/status-file-discovery.js.map +0 -1
- package/dist/utils/discovery/file-processing.js +0 -156
- package/dist/utils/discovery/file-processing.js.map +0 -1
- package/dist/utils/discovery/formula-discovery.js +0 -211
- package/dist/utils/discovery/formula-discovery.js.map +0 -1
- package/dist/utils/discovery/platform-discovery.js +0 -2
- package/dist/utils/discovery/platform-discovery.js.map +0 -1
- package/dist/utils/formula-discovery.js +0 -102
- package/dist/utils/formula-discovery.js.map +0 -1
- package/dist/utils/formula-index-yml.js +0 -122
- package/dist/utils/formula-index-yml.js.map +0 -1
- package/dist/utils/formula-installation.js +0 -110
- package/dist/utils/formula-installation.js.map +0 -1
- package/dist/utils/formula-local-files.js +0 -38
- package/dist/utils/formula-local-files.js.map +0 -1
- package/dist/utils/formula-management.js +0 -191
- package/dist/utils/formula-management.js.map +0 -1
- package/dist/utils/formula-name.js +0 -97
- package/dist/utils/formula-name.js.map +0 -1
- package/dist/utils/formula-versioning.js +0 -109
- package/dist/utils/formula-versioning.js.map +0 -1
- package/dist/utils/formula-yml.js +0 -82
- package/dist/utils/formula-yml.js.map +0 -1
- package/dist/utils/git.js +0 -54
- package/dist/utils/git.js.map +0 -1
- package/dist/utils/id-based-discovery.js +0 -126
- package/dist/utils/id-based-discovery.js.map +0 -1
- package/dist/utils/id-based-installer.js +0 -249
- package/dist/utils/id-based-installer.js.map +0 -1
- package/dist/utils/index-yml-based-installer.js +0 -375
- package/dist/utils/index-yml-based-installer.js.map +0 -1
- package/dist/utils/index-yml.js +0 -124
- package/dist/utils/index-yml.js.map +0 -1
- package/dist/utils/md-frontmatter.js +0 -3
- package/dist/utils/md-frontmatter.js.map +0 -1
- package/dist/utils/package-link-yml.js +0 -92
- package/dist/utils/package-link-yml.js.map +0 -1
- package/dist/utils/platform-discovery.js +0 -2
- package/dist/utils/platform-discovery.js.map +0 -1
- package/dist/utils/platform-frontmatter-split.js +0 -15
- package/dist/utils/platform-frontmatter-split.js.map +0 -1
- package/dist/utils/timestamp-encoder.js +0 -13
- package/dist/utils/timestamp-encoder.js.map +0 -1
- package/dist/utils/wip-versioning.js +0 -24
- package/dist/utils/wip-versioning.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# OpenPackage
|
|
2
2
|
|
|
3
3
|
<a href="https://www.npmjs.com/package/opkg " target="blank">
|
|
4
|
-
<img src="https://img.shields.io/npm/v/opkg
|
|
4
|
+
<img src="https://img.shields.io/npm/v/opkg?style=flat-square" alt="Npm package for OpenPackage">
|
|
5
5
|
</a>
|
|
6
6
|
<a href="https://discord.gg/W5H54HZ8Fm" target="blank">
|
|
7
7
|
<img src="https://img.shields.io/badge/Discord-%235865F2.svg?&logo=discord&logoColor=white&style=flat-square" alt="OpenPackage Discord">
|
|
@@ -32,6 +32,16 @@ npm install -g opkg
|
|
|
32
32
|
|
|
33
33
|
### Reuse files across multiple codebases
|
|
34
34
|
Reuse rules, slash commands, and more across multiple codebases.
|
|
35
|
+
|
|
36
|
+
#### Single file
|
|
37
|
+
```bash title="Terminal"
|
|
38
|
+
# In current codebase
|
|
39
|
+
opkg save f specs/nextjs.md
|
|
40
|
+
# In another codebase
|
|
41
|
+
opkg install f/specs/nextjs.md
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
#### Multiple files via package
|
|
35
45
|
```bash title="Terminal"
|
|
36
46
|
# In current codebase
|
|
37
47
|
opkg save essentials
|
|
@@ -50,32 +60,28 @@ opkg save essentials .cursor/commands/essentials
|
|
|
50
60
|
# OpenPackage CLI automatically generates/syncs the same command files across all platforms.
|
|
51
61
|
|
|
52
62
|
# Before save:
|
|
53
|
-
# .cursor/commands/essentials/
|
|
63
|
+
# .cursor/commands/essentials/cleanup.md
|
|
54
64
|
|
|
55
65
|
# After save:
|
|
56
|
-
# .cursor/commands/essentials/
|
|
57
|
-
# .claude/commands/essentials/
|
|
58
|
-
# .opencode/command/essentials/
|
|
66
|
+
# .cursor/commands/essentials/cleanup.md
|
|
67
|
+
# .claude/commands/essentials/cleanup.md
|
|
68
|
+
# .opencode/command/essentials/cleanup.md
|
|
59
69
|
```
|
|
60
70
|
|
|
61
71
|
### Modular management of files
|
|
62
72
|
Create domain specific packages for modular reuse.
|
|
63
73
|
```bash title="Terminal"
|
|
64
74
|
# Create typescript package
|
|
65
|
-
opkg
|
|
66
|
-
opkg save typescript
|
|
75
|
+
opkg save typescript .cursor/rules/typescript
|
|
67
76
|
|
|
68
77
|
# Create scalable-nextjs package
|
|
69
|
-
opkg
|
|
70
|
-
opkg save scalable-nextjs
|
|
78
|
+
opkg save scalable-nextjs .cursor/rules/nextjs
|
|
71
79
|
|
|
72
80
|
# Create scalable-nestjs package
|
|
73
|
-
opkg
|
|
74
|
-
opkg save scalable-nestjs
|
|
81
|
+
opkg save scalable-nestjs .cursor/rules/nestjs
|
|
75
82
|
|
|
76
83
|
# Create mongodb package
|
|
77
|
-
opkg
|
|
78
|
-
opkg save mongodb
|
|
84
|
+
opkg save mongodb .cursor/rules/mongodb
|
|
79
85
|
|
|
80
86
|
# In your NextJS codebase
|
|
81
87
|
opkg install typescript
|
|
@@ -90,23 +96,46 @@ opkg install mongodb
|
|
|
90
96
|
## Usage
|
|
91
97
|
|
|
92
98
|
> [!TIP]
|
|
93
|
-
>
|
|
99
|
+
> We highly recommend reading [the packages doc](https://openpackage.dev/docs/packages) to understand how packages work.
|
|
100
|
+
|
|
101
|
+
### Save a file
|
|
94
102
|
|
|
95
|
-
|
|
103
|
+
```bash title="Terminal"
|
|
104
|
+
opkg save <package> <path-to-dir-or-file>
|
|
105
|
+
```
|
|
106
|
+
Adds the file to the specified package and saves to local registry for reuse and sharing.
|
|
107
|
+
|
|
108
|
+
### Create a package
|
|
109
|
+
|
|
110
|
+
#### In a project/workspace
|
|
111
|
+
|
|
112
|
+
```bash title="Terminal"
|
|
113
|
+
opkg init <package>
|
|
114
|
+
```
|
|
115
|
+
Initializes a package at `.openpackage/packages/<package>/` and generates the package's `package.yml` manifest file. This method is ideal for creating/managing multiple packages within existing projects.
|
|
96
116
|
```bash title="Terminal"
|
|
97
117
|
opkg add <package> <path-to-dir-or-file>
|
|
98
118
|
```
|
|
99
|
-
|
|
119
|
+
Use the `add` command to add files from the workspace to a package. You can also directly create/update the package files in `.openpackage/packages/<package>/` (see Package Structure below for details).
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
#### In a dedicated codebase for the package
|
|
123
|
+
```bash title="Terminal"
|
|
124
|
+
opkg init
|
|
125
|
+
```
|
|
126
|
+
Initializes a package at cwd and generates the package's `package.yml` manifest file. Use this to dedicate the codebase to the package itself (see Package Structure below for details on structuring a package).
|
|
127
|
+
|
|
100
128
|
|
|
101
129
|
### Save a package
|
|
102
130
|
```bash title="Terminal"
|
|
103
|
-
opkg save
|
|
131
|
+
opkg save [package]
|
|
104
132
|
```
|
|
105
|
-
Save the set of dirs and files as a package for reuse and cross-platform sync (prerelease).
|
|
133
|
+
Save the set of dirs and files as a package for reuse and cross-platform sync (prerelease).
|
|
134
|
+
Also performs sync of universal subdir content across detected AI coding platform dirs.
|
|
106
135
|
|
|
107
136
|
### Finalize/pack a package
|
|
108
137
|
```bash title="Terminal"
|
|
109
|
-
opkg pack
|
|
138
|
+
opkg pack [package]
|
|
110
139
|
```
|
|
111
140
|
Save the package as a stable non-prerelease version ready for push (upload).
|
|
112
141
|
|
|
@@ -134,6 +163,12 @@ opkg uninstall <package>
|
|
|
134
163
|
```
|
|
135
164
|
Use the uninstall command to remove all files for the specified package from the codebase at cwd.
|
|
136
165
|
|
|
166
|
+
### Authenticate CLI
|
|
167
|
+
```bash title="Terminal"
|
|
168
|
+
opkg login
|
|
169
|
+
```
|
|
170
|
+
Use the `login` command to authenticate the CLI for pushing packages to the [official OpenPackage registry](https://openpackage.dev).
|
|
171
|
+
|
|
137
172
|
### Push a package to remote
|
|
138
173
|
```bash title="Terminal"
|
|
139
174
|
opkg push <package>
|
|
@@ -149,13 +184,39 @@ Use the `pull` command to download a package from the [official OpenPackage regi
|
|
|
149
184
|
> [!TIP]
|
|
150
185
|
> Learn more by heading over to the [official docs](https://openpackage.dev/docs).
|
|
151
186
|
|
|
187
|
+
## Package Structure
|
|
188
|
+
|
|
189
|
+
Packages are composed using the following directory structure:
|
|
190
|
+
|
|
191
|
+
```txt title="Structure"
|
|
192
|
+
<package>
|
|
193
|
+
├── .openpackage/
|
|
194
|
+
│ ├── package.yml # The OpenPackage manifest, required
|
|
195
|
+
│ ├── rules/
|
|
196
|
+
│ │ └── # Rule files
|
|
197
|
+
│ ├── commands/
|
|
198
|
+
│ │ └── # Command files (slash commands)
|
|
199
|
+
│ ├── agents/
|
|
200
|
+
│ │ └── # Agent files (subagents)
|
|
201
|
+
│ └── skills/
|
|
202
|
+
│ └── # Skill files (Claude Code skills)
|
|
203
|
+
├── <dirs-or-files>
|
|
204
|
+
│ └── # Any other root dirs or files (Ex: specs/, docs/, tests/, etc.)
|
|
205
|
+
├── README.md # Metadata files (LICENSE.md, CONTRIBUTING.md, etc.)
|
|
206
|
+
└── AGENTS.md # Platform root file
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
There are two ways to compose packages:
|
|
210
|
+
- In a project workspace: `opkg init <package>` will create a package in `.openpackage/packages/<packages>/`
|
|
211
|
+
- In a dedicated package codebase: `opkg init` will create a package at cwd (similar to npm, pypi, etc.)
|
|
212
|
+
|
|
152
213
|
## Supported Platforms
|
|
153
214
|
|
|
154
215
|
OpenPackage performs installation and platform sync of files for supported AI coding platforms outlined by the table below.
|
|
155
|
-
Files and paths will be automatically converted to platform specific designations during `save` and `install`.
|
|
216
|
+
Files and paths will be automatically converted to platform specific designations during `save` and `install`. The `platforms.jsonc` file includes the specifications for all supported platforms.
|
|
156
217
|
|
|
157
218
|
> [!NOTE]
|
|
158
|
-
> OpenPackage
|
|
219
|
+
> OpenPackage searches and includes markdown files under supported platform directories as well as any other workspace directories.
|
|
159
220
|
|
|
160
221
|
| Platform | Directory | Root file | Rules | Commands | Agents | Skills |
|
|
161
222
|
| --- | --- | --- | --- | --- | --- | --- |
|
package/dist/commands/add.js
CHANGED
|
@@ -1,286 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { getAllPlatforms, getDetectedPlatforms, getPlatformDefinition } from '../core/platforms.js';
|
|
4
|
-
import { withErrorHandling, UserCancellationError } from '../utils/errors.js';
|
|
5
|
-
import { ensureDir, exists, isDirectory, isFile, readTextFile, writeTextFile, walkFiles } from '../utils/fs.js';
|
|
6
|
-
import { getLocalPackageDir, getLocalOpenPackageDir } from '../utils/paths.js';
|
|
7
|
-
import { parsePackageYml, writePackageYml } from '../utils/package-yml.js';
|
|
8
|
-
import { normalizePackageName, validatePackageName } from '../utils/package-name.js';
|
|
9
|
-
import { promptPackageDetailsForNamed, safePrompts } from '../utils/prompts.js';
|
|
10
|
-
import { mapPlatformFileToUniversal } from '../utils/platform-mapper.js';
|
|
11
|
-
import { normalizePathForProcessing } from '../utils/path-normalization.js';
|
|
12
|
-
import { suffixFileBasename, suffixFirstContentDir } from '../utils/platform-specific-paths.js';
|
|
13
|
-
import { logger } from '../utils/logger.js';
|
|
14
|
-
import { buildMappingAndWriteIndex } from '../core/add/package-index-updater.js';
|
|
15
|
-
import { readLocalPackageFilesForIndex } from '../utils/package-local-files.js';
|
|
16
|
-
const PLATFORM_ROOT_FILES = buildPlatformRootFiles();
|
|
1
|
+
import { withErrorHandling } from '../utils/errors.js';
|
|
2
|
+
import { runAddPipeline } from '../core/add/add-pipeline.js';
|
|
17
3
|
export function setupAddCommand(program) {
|
|
18
4
|
program
|
|
19
5
|
.command('add')
|
|
20
|
-
.argument('
|
|
21
|
-
.argument('
|
|
6
|
+
.argument('[package-or-path]', 'package name, or path when omitting package name')
|
|
7
|
+
.argument('[path]', 'file or directory to add (when first arg is a package name)')
|
|
22
8
|
.description('Copy supported workspace files or directories into a local package directory.\n' +
|
|
23
9
|
'Usage examples:\n' +
|
|
24
10
|
' opkg add my-package .cursor/rules/example.md\n' +
|
|
25
|
-
' opkg add my-package ai/helpers/\n'
|
|
11
|
+
' opkg add my-package ai/helpers/\n' +
|
|
12
|
+
' opkg add ai/helpers/\n')
|
|
26
13
|
.option('--platform-specific', 'Save platform-specific variants for platform subdir inputs')
|
|
27
|
-
.action(withErrorHandling(async (
|
|
28
|
-
await
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
async function runAddCommand(packageName, inputPath, options = {}) {
|
|
32
|
-
const cwd = process.cwd();
|
|
33
|
-
// Validate and inspect the input path first
|
|
34
|
-
const resolvedInputPath = resolve(cwd, inputPath);
|
|
35
|
-
await validateSourcePath(resolvedInputPath, cwd);
|
|
36
|
-
const inputIsDirectory = await isDirectory(resolvedInputPath);
|
|
37
|
-
const inputIsFile = !inputIsDirectory && await isFile(resolvedInputPath);
|
|
38
|
-
let entries = await collectSourceEntries(resolvedInputPath, cwd);
|
|
39
|
-
if (entries.length === 0) {
|
|
40
|
-
throw new Error(`No supported files found in ${inputPath}`);
|
|
41
|
-
}
|
|
42
|
-
if (options.platformSpecific) {
|
|
43
|
-
entries = applyPlatformSpecificPaths(cwd, entries, resolvedInputPath, {
|
|
44
|
-
inputIsDirectory,
|
|
45
|
-
inputIsFile
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
// Only now ensure/create the package & package.yml
|
|
49
|
-
const ensuredPackage = await ensurePackageExists(cwd, packageName);
|
|
50
|
-
const changedFiles = await copyWithConflictResolution(ensuredPackage, entries);
|
|
51
|
-
// Always update index using all candidate entries (even if nothing changed on disk)
|
|
52
|
-
// Directory collapsing is now universally applied
|
|
53
|
-
await updatePackageIndex(cwd, ensuredPackage);
|
|
54
|
-
if (changedFiles.length > 0) {
|
|
55
|
-
logger.info(`Added ${changedFiles.length} file(s) to package '${ensuredPackage.normalizedName}'.`);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
logger.info('No files were added or modified.');
|
|
59
|
-
}
|
|
60
|
-
return { success: true };
|
|
61
|
-
}
|
|
62
|
-
async function ensurePackageExists(cwd, packageName) {
|
|
63
|
-
validatePackageName(packageName);
|
|
64
|
-
const normalizedName = normalizePackageName(packageName);
|
|
65
|
-
const packageDir = getLocalPackageDir(cwd, normalizedName);
|
|
66
|
-
const packageYmlPath = join(packageDir, FILE_PATTERNS.PACKAGE_YML);
|
|
67
|
-
await ensureDir(packageDir);
|
|
68
|
-
let packageConfig;
|
|
69
|
-
if (await exists(packageYmlPath)) {
|
|
70
|
-
packageConfig = await parsePackageYml(packageYmlPath);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
packageConfig = await promptPackageDetailsForNamed(normalizedName);
|
|
74
|
-
await writePackageYml(packageYmlPath, packageConfig);
|
|
75
|
-
logger.info(`Created new package '${packageConfig.name}@${packageConfig.version}' at ${relative(cwd, packageDir)}`);
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
normalizedName,
|
|
79
|
-
packageDir,
|
|
80
|
-
packageConfig
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
async function validateSourcePath(resolvedPath, cwd) {
|
|
84
|
-
if (!(await exists(resolvedPath))) {
|
|
85
|
-
throw new Error(`Path not found: ${relative(cwd, resolvedPath) || resolvedPath}`);
|
|
86
|
-
}
|
|
87
|
-
if (!isWithinDirectory(cwd, resolvedPath)) {
|
|
88
|
-
throw new Error('Path must be within the current working directory.');
|
|
89
|
-
}
|
|
90
|
-
const openpackageDir = getLocalOpenPackageDir(cwd);
|
|
91
|
-
if (isWithinDirectory(openpackageDir, resolvedPath)) {
|
|
92
|
-
throw new Error('Cannot add files from the .openpackage directory.');
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
async function collectSourceEntries(resolvedPath, cwd) {
|
|
96
|
-
const entries = [];
|
|
97
|
-
if (await isDirectory(resolvedPath)) {
|
|
98
|
-
for await (const filePath of walkFiles(resolvedPath)) {
|
|
99
|
-
const entry = deriveSourceEntry(filePath, cwd);
|
|
100
|
-
if (!entry) {
|
|
101
|
-
throw new Error(`Unsupported file inside directory: ${relative(cwd, filePath)}`);
|
|
102
|
-
}
|
|
103
|
-
entries.push(entry);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
else if (await isFile(resolvedPath)) {
|
|
107
|
-
const entry = deriveSourceEntry(resolvedPath, cwd);
|
|
108
|
-
if (!entry) {
|
|
109
|
-
throw new Error(`Unsupported file: ${relative(cwd, resolvedPath)}`);
|
|
110
|
-
}
|
|
111
|
-
entries.push(entry);
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
throw new Error(`Unsupported path type: ${resolvedPath}`);
|
|
115
|
-
}
|
|
116
|
-
return entries;
|
|
117
|
-
}
|
|
118
|
-
function deriveSourceEntry(absFilePath, cwd) {
|
|
119
|
-
const relativePath = relative(cwd, absFilePath);
|
|
120
|
-
const normalizedRelPath = normalizePathForProcessing(relativePath);
|
|
121
|
-
if (normalizedRelPath.startsWith(`${PLATFORM_DIRS.AI}/`)) {
|
|
122
|
-
return {
|
|
123
|
-
sourcePath: absFilePath,
|
|
124
|
-
registryPath: normalizedRelPath
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
const mapping = mapPlatformFileToUniversal(absFilePath);
|
|
128
|
-
if (mapping) {
|
|
129
|
-
return {
|
|
130
|
-
sourcePath: absFilePath,
|
|
131
|
-
registryPath: joinPathSegments(mapping.subdir, mapping.relPath)
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
const fileName = normalizedRelPath.split('/').pop();
|
|
135
|
-
if (fileName && isPlatformRootFile(fileName) && !normalizedRelPath.includes('/')) {
|
|
136
|
-
return {
|
|
137
|
-
sourcePath: absFilePath,
|
|
138
|
-
registryPath: fileName
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
function joinPathSegments(...parts) {
|
|
144
|
-
return parts
|
|
145
|
-
.filter(Boolean)
|
|
146
|
-
.join('/')
|
|
147
|
-
.replace(/\/{2,}/g, '/');
|
|
148
|
-
}
|
|
149
|
-
function applyPlatformSpecificPaths(cwd, entries, resolvedInputPath, options) {
|
|
150
|
-
const normalizedInput = resolve(resolvedInputPath);
|
|
151
|
-
for (const entry of entries) {
|
|
152
|
-
const { registryPath, sourcePath } = entry;
|
|
153
|
-
if (isAiRegistryPath(registryPath)) {
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
const fileName = registryPath.split('/').pop();
|
|
157
|
-
if (fileName && isPlatformRootFile(fileName)) {
|
|
158
|
-
continue;
|
|
159
|
-
}
|
|
160
|
-
const mapping = mapPlatformFileToUniversal(sourcePath);
|
|
161
|
-
if (!mapping) {
|
|
162
|
-
continue;
|
|
163
|
-
}
|
|
164
|
-
const definition = getPlatformDefinition(mapping.platform);
|
|
165
|
-
const subdirDef = definition.subdirs[mapping.subdir];
|
|
166
|
-
if (!subdirDef?.path) {
|
|
167
|
-
continue;
|
|
168
|
-
}
|
|
169
|
-
const subdirAbs = resolve(join(cwd, definition.rootDir, subdirDef.path));
|
|
170
|
-
const sourceAbs = resolve(sourcePath);
|
|
171
|
-
const withinSubdir = sourceAbs === subdirAbs || isWithinDirectory(subdirAbs, sourceAbs);
|
|
172
|
-
if (!withinSubdir) {
|
|
173
|
-
continue;
|
|
14
|
+
.action(withErrorHandling(async (packageOrPath, pathArg, options) => {
|
|
15
|
+
const result = await runAddPipeline(packageOrPath, pathArg, options);
|
|
16
|
+
if (!result.success) {
|
|
17
|
+
throw new Error(result.error || 'Add operation failed');
|
|
174
18
|
}
|
|
175
|
-
|
|
176
|
-
entry.registryPath = suffixFileBasename(registryPath, mapping.platform);
|
|
177
|
-
continue;
|
|
178
|
-
}
|
|
179
|
-
if (!options.inputIsDirectory) {
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
182
|
-
if (normalizedInput === subdirAbs) {
|
|
183
|
-
entry.registryPath = suffixFileBasename(registryPath, mapping.platform);
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
if (isWithinDirectory(normalizedInput, sourceAbs)) {
|
|
187
|
-
entry.registryPath = suffixFirstContentDir(registryPath, mapping.platform);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return entries;
|
|
191
|
-
}
|
|
192
|
-
function isAiRegistryPath(registryPath) {
|
|
193
|
-
return registryPath === PLATFORM_DIRS.AI || registryPath.startsWith(`${PLATFORM_DIRS.AI}/`);
|
|
194
|
-
}
|
|
195
|
-
// computeDirKeyFromRegistryPath and directory collapsing moved to core/add/package-index-updater.ts
|
|
196
|
-
function buildPlatformRootFiles() {
|
|
197
|
-
const rootFiles = new Set();
|
|
198
|
-
for (const platform of getAllPlatforms()) {
|
|
199
|
-
const def = getPlatformDefinition(platform);
|
|
200
|
-
if (def.rootFile) {
|
|
201
|
-
rootFiles.add(def.rootFile);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
rootFiles.add(FILE_PATTERNS.AGENTS_MD);
|
|
205
|
-
return rootFiles;
|
|
206
|
-
}
|
|
207
|
-
function isPlatformRootFile(fileName) {
|
|
208
|
-
return PLATFORM_ROOT_FILES.has(fileName);
|
|
209
|
-
}
|
|
210
|
-
function isWithinDirectory(parentDir, targetPath) {
|
|
211
|
-
const resolvedParent = resolve(parentDir);
|
|
212
|
-
const resolvedTarget = resolve(targetPath);
|
|
213
|
-
if (resolvedParent === resolvedTarget) {
|
|
214
|
-
return true;
|
|
215
|
-
}
|
|
216
|
-
const rel = relative(resolvedParent, resolvedTarget);
|
|
217
|
-
return !!rel && !rel.startsWith('..') && !isAbsolute(rel);
|
|
218
|
-
}
|
|
219
|
-
async function copyWithConflictResolution(ensuredPackage, entries) {
|
|
220
|
-
const changedFiles = [];
|
|
221
|
-
const { packageDir, normalizedName } = ensuredPackage;
|
|
222
|
-
for (const entry of entries) {
|
|
223
|
-
const registryPath = entry.registryPath;
|
|
224
|
-
const destination = join(packageDir, ...registryPath.split('/'));
|
|
225
|
-
const sourceContent = await readTextFile(entry.sourcePath);
|
|
226
|
-
const destExists = await exists(destination);
|
|
227
|
-
if (destExists) {
|
|
228
|
-
let existingContent = '';
|
|
229
|
-
try {
|
|
230
|
-
existingContent = await readTextFile(destination);
|
|
231
|
-
}
|
|
232
|
-
catch {
|
|
233
|
-
existingContent = '';
|
|
234
|
-
}
|
|
235
|
-
if (existingContent === sourceContent) {
|
|
236
|
-
logger.debug(`Skipping unchanged file: ${registryPath}`);
|
|
237
|
-
continue;
|
|
238
|
-
}
|
|
239
|
-
const decision = await promptConflictDecision(normalizedName, registryPath);
|
|
240
|
-
if (decision === 'keep-existing') {
|
|
241
|
-
logger.debug(`Kept existing file for ${registryPath}`);
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
await ensureDir(dirname(destination));
|
|
246
|
-
await writeTextFile(destination, sourceContent);
|
|
247
|
-
changedFiles.push({
|
|
248
|
-
path: registryPath,
|
|
249
|
-
content: sourceContent,
|
|
250
|
-
encoding: 'utf8'
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
return changedFiles;
|
|
254
|
-
}
|
|
255
|
-
async function promptConflictDecision(packageName, registryPath) {
|
|
256
|
-
const response = await safePrompts({
|
|
257
|
-
type: 'select',
|
|
258
|
-
name: 'decision',
|
|
259
|
-
message: `File '${registryPath}' already exists in package '${packageName}'. Choose how to proceed:`,
|
|
260
|
-
choices: [
|
|
261
|
-
{
|
|
262
|
-
title: 'Keep existing file (skip)',
|
|
263
|
-
value: 'keep-existing'
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
title: 'Replace with workspace file',
|
|
267
|
-
value: 'overwrite'
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
title: 'Cancel operation',
|
|
271
|
-
value: 'cancel'
|
|
272
|
-
}
|
|
273
|
-
]
|
|
274
|
-
});
|
|
275
|
-
if (response.decision === 'cancel') {
|
|
276
|
-
throw new UserCancellationError();
|
|
277
|
-
}
|
|
278
|
-
return response.decision;
|
|
279
|
-
}
|
|
280
|
-
async function updatePackageIndex(cwd, ensuredPackage) {
|
|
281
|
-
const { normalizedName, packageDir } = ensuredPackage;
|
|
282
|
-
const packageFiles = await readLocalPackageFilesForIndex(packageDir);
|
|
283
|
-
const detectedPlatforms = await getDetectedPlatforms(cwd);
|
|
284
|
-
await buildMappingAndWriteIndex(cwd, normalizedName, packageFiles, detectedPlatforms, { preserveExactPaths: true });
|
|
19
|
+
}));
|
|
285
20
|
}
|
|
286
21
|
//# sourceMappingURL=add.js.map
|
package/dist/commands/add.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,cAAc,EAA2B,MAAM,6BAA6B,CAAC;AAEtF,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,OAAO;SACJ,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CAAC,mBAAmB,EAAE,kDAAkD,CAAC;SACjF,QAAQ,CAAC,QAAQ,EAAE,6DAA6D,CAAC;SACjF,WAAW,CACV,iFAAiF;QACjF,mBAAmB;QACnB,kDAAkD;QAClD,qCAAqC;QACrC,0BAA0B,CAC3B;SACA,MAAM,CAAC,qBAAqB,EAAE,4DAA4D,CAAC;SAC3F,MAAM,CACL,iBAAiB,CAAC,KAAK,EAAE,aAAiC,EAAE,OAA2B,EAAE,OAA2B,EAAE,EAAE;QACtH,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,aAAa,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACrE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,sBAAsB,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACN,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { logger } from '../utils/logger.js';
|
|
|
5
5
|
import { withErrorHandling, PackageNotFoundError } from '../utils/errors.js';
|
|
6
6
|
import { parsePackageInput } from '../utils/package-name.js';
|
|
7
7
|
import { transformPackageFilesMetadata } from '../utils/package-versioning.js';
|
|
8
|
+
import { UNVERSIONED } from '../constants/index.js';
|
|
8
9
|
async function duplicatePackageCommand(sourceInput, newInput) {
|
|
9
10
|
logger.info(`Duplicating package: ${sourceInput} -> ${newInput}`);
|
|
10
11
|
// Ensure registry directories
|
|
@@ -45,8 +46,10 @@ async function duplicatePackageCommand(sourceInput, newInput) {
|
|
|
45
46
|
};
|
|
46
47
|
// Save duplicated package
|
|
47
48
|
await packageManager.savePackage(newPackage);
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
const fromLabel = sourcePackage.metadata.version ? `${sourceName}@${sourcePackage.metadata.version}` : `${sourceName} (${UNVERSIONED})`;
|
|
50
|
+
const toLabel = newVersion ? `${newName}@${newVersion}` : `${newName} (${UNVERSIONED})`;
|
|
51
|
+
console.log(`✓ Duplicated '${fromLabel}' -> '${toLabel}'`);
|
|
52
|
+
return { success: true, data: { from: fromLabel, to: toLabel } };
|
|
50
53
|
}
|
|
51
54
|
export function setupDuplicateCommand(program) {
|
|
52
55
|
program
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duplicate.js","sourceRoot":"","sources":["../../src/commands/duplicate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE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