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
|
@@ -9,12 +9,12 @@ export const ERROR_MESSAGES = {
|
|
|
9
9
|
INVALID_VERSION_FORMAT: 'Invalid version format: %s',
|
|
10
10
|
INVALID_BUMP_TYPE: 'Invalid bump type: %s. Must be \'patch\', \'minor\', or \'major\'.',
|
|
11
11
|
INVALID_VERSION_TYPE: 'Invalid version type: %s. Only \'%s\' is supported.',
|
|
12
|
-
PARSE_PACKAGE_YML_FAILED: 'Failed to parse existing
|
|
12
|
+
PARSE_PACKAGE_YML_FAILED: 'Failed to parse existing openpackage.yml at %s: %s',
|
|
13
13
|
PACKAGE_DIR_NOT_FOUND: 'Package directory not found at %s'
|
|
14
14
|
};
|
|
15
15
|
export const LOG_PREFIXES = {
|
|
16
|
-
CREATED: '✓ Created
|
|
17
|
-
FOUND: '✓ Found existing
|
|
16
|
+
CREATED: '✓ Created openpackage.yml in',
|
|
17
|
+
FOUND: '✓ Found existing openpackage.yml',
|
|
18
18
|
NAME: '✓ Name:',
|
|
19
19
|
VERSION: '✓ Version:',
|
|
20
20
|
FILES: '✓ Found',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/core/save/constants.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,aAAa,GAAG,MAAe,CAAC;AAC7C,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC;AACvC,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AE,iCAAiC;IACjD,gBAAgB,EAAE,+BAA+B;IACjD,cAAc,EAAE,+BAA+B;IAC/C,cAAc,EAAE,0CAA0C;IAC1D,OAAO,EAAE,aAAa;IACtB,cAAc,EAAE,oBAAoB;IACpC,eAAe,EAAE,KAAK;CACd,CAAC;AAEX,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IACjD,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;CAC5C,CAAC"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow-Based Saver
|
|
3
|
+
*
|
|
4
|
+
* Handles reverse flow transformations for the save pipeline.
|
|
5
|
+
* Transforms workspace platform-specific files back to universal package format.
|
|
6
|
+
*/
|
|
7
|
+
import { basename } from 'path';
|
|
8
|
+
import { getPlatformDefinition, getGlobalImportFlows, platformUsesFlows } from '../platforms.js';
|
|
9
|
+
import { createFlowExecutor } from '../flows/flow-executor.js';
|
|
10
|
+
import { logger } from '../../utils/logger.js';
|
|
11
|
+
/**
|
|
12
|
+
* Find the matching reverse flow for a workspace file
|
|
13
|
+
*
|
|
14
|
+
* Reverse flow logic:
|
|
15
|
+
* - Workspace file path matches the flow's 'to' pattern
|
|
16
|
+
* - Transform workspace → package (reverse of install)
|
|
17
|
+
* - Use the flow's 'from' pattern as the target in package
|
|
18
|
+
*/
|
|
19
|
+
function findReverseFlow(workspaceFilePath, platform, cwd) {
|
|
20
|
+
try {
|
|
21
|
+
const definition = getPlatformDefinition(platform, cwd);
|
|
22
|
+
if (!definition.import || definition.import.length === 0) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
// Platform not found - return null to skip
|
|
28
|
+
logger.debug(`Platform ${platform} not found: ${error}`);
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const definition = getPlatformDefinition(platform, cwd);
|
|
32
|
+
// Get all applicable import flows (global + platform)
|
|
33
|
+
const globalImportFlows = getGlobalImportFlows(cwd) ?? [];
|
|
34
|
+
const allImportFlows = [...globalImportFlows, ...definition.import];
|
|
35
|
+
// Normalize workspace path for matching
|
|
36
|
+
const normalizedWorkspacePath = workspaceFilePath.replace(/\\/g, '/');
|
|
37
|
+
for (const flow of allImportFlows) {
|
|
38
|
+
// Import flows use 'from' to match workspace files
|
|
39
|
+
// For array patterns in 'from', try each pattern
|
|
40
|
+
const fromPatterns = Array.isArray(flow.from) ? flow.from : [flow.from];
|
|
41
|
+
for (const fromPattern of fromPatterns) {
|
|
42
|
+
// Match the workspace file against the 'from' pattern
|
|
43
|
+
const match = matchWorkspacePathToPattern(normalizedWorkspacePath, fromPattern, definition.rootDir);
|
|
44
|
+
if (match) {
|
|
45
|
+
// Extract variables from the match (e.g., {name})
|
|
46
|
+
const variables = match.variables;
|
|
47
|
+
// Resolve the 'to' pattern with extracted variables (destination in package)
|
|
48
|
+
const toPattern = typeof flow.to === 'string' ? flow.to : Object.keys(flow.to)[0];
|
|
49
|
+
const registryPath = resolvePattern(toPattern, variables);
|
|
50
|
+
return { flow, registryPath };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
function matchWorkspacePathToPattern(workspacePath, pattern, rootDir) {
|
|
57
|
+
// Normalize both paths
|
|
58
|
+
const normalizedPath = workspacePath.replace(/\\/g, '/');
|
|
59
|
+
const normalizedPattern = pattern.replace(/\\/g, '/');
|
|
60
|
+
// Extract pattern parts
|
|
61
|
+
const patternParts = normalizedPattern.split('/');
|
|
62
|
+
const pathParts = normalizedPath.split('/');
|
|
63
|
+
// Must have same number of parts
|
|
64
|
+
if (patternParts.length !== pathParts.length) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const variables = {};
|
|
68
|
+
// Match each part
|
|
69
|
+
for (let i = 0; i < patternParts.length; i++) {
|
|
70
|
+
const patternPart = patternParts[i];
|
|
71
|
+
const pathPart = pathParts[i];
|
|
72
|
+
// Check for variable placeholder {name}
|
|
73
|
+
const varMatch = patternPart.match(/^\{(\w+)\}$/);
|
|
74
|
+
if (varMatch) {
|
|
75
|
+
variables[varMatch[1]] = pathPart;
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
// Check for inline variable {name}.ext
|
|
79
|
+
const inlineVarMatch = patternPart.match(/^(.*)\{(\w+)\}(.*)$/);
|
|
80
|
+
if (inlineVarMatch) {
|
|
81
|
+
const [, prefix = '', varName, suffix = ''] = inlineVarMatch;
|
|
82
|
+
if (pathPart.startsWith(prefix) && pathPart.endsWith(suffix)) {
|
|
83
|
+
const value = pathPart.slice(prefix.length, pathPart.length - suffix.length);
|
|
84
|
+
variables[varName] = value;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Exact match required
|
|
89
|
+
if (patternPart !== pathPart) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return { variables };
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Resolve a pattern with variables
|
|
97
|
+
*
|
|
98
|
+
* Example: "rules/{name}.md" with { name: "typescript" } → "rules/typescript.md"
|
|
99
|
+
*/
|
|
100
|
+
function resolvePattern(pattern, variables) {
|
|
101
|
+
let resolved = pattern;
|
|
102
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
103
|
+
resolved = resolved.replace(`{${key}}`, value);
|
|
104
|
+
}
|
|
105
|
+
return resolved;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Execute reverse flow transformation
|
|
109
|
+
*
|
|
110
|
+
* Reverse transformations:
|
|
111
|
+
* - Read workspace file
|
|
112
|
+
* - Reverse key mapping (if any)
|
|
113
|
+
* - Reverse format conversion (if any)
|
|
114
|
+
* - Write to package registry path
|
|
115
|
+
*/
|
|
116
|
+
async function executeReverseFlow(workspaceFilePath, flow, registryPath, packageRoot, cwd, options) {
|
|
117
|
+
const executor = createFlowExecutor();
|
|
118
|
+
try {
|
|
119
|
+
// Get relative path from workspace root
|
|
120
|
+
const relativeWorkspacePath = workspaceFilePath.startsWith(cwd)
|
|
121
|
+
? workspaceFilePath.slice(cwd.length + 1).replace(/\\/g, '/')
|
|
122
|
+
: workspaceFilePath;
|
|
123
|
+
// Create reverse flow
|
|
124
|
+
// For now, we'll do a simple copy - full reverse transformation coming later
|
|
125
|
+
const reverseFlow = {
|
|
126
|
+
from: relativeWorkspacePath,
|
|
127
|
+
to: registryPath,
|
|
128
|
+
// TODO: Implement full reverse transformation
|
|
129
|
+
// - Reverse key mapping
|
|
130
|
+
// - Reverse format conversion
|
|
131
|
+
// - Reverse embed/extract
|
|
132
|
+
};
|
|
133
|
+
// Create flow context for save (reverse of install)
|
|
134
|
+
// For save: source is workspace, target is package
|
|
135
|
+
// So we swap the roots compared to install
|
|
136
|
+
const context = {
|
|
137
|
+
workspaceRoot: packageRoot, // Target for save (writes to package)
|
|
138
|
+
packageRoot: cwd, // Source for save (reads from workspace)
|
|
139
|
+
platform: '', // Not needed for reverse flow
|
|
140
|
+
packageName: basename(packageRoot),
|
|
141
|
+
variables: {},
|
|
142
|
+
direction: 'save',
|
|
143
|
+
dryRun: options.dryRun ?? false
|
|
144
|
+
};
|
|
145
|
+
// Execute the reverse flow
|
|
146
|
+
const result = await executor.executeFlow(reverseFlow, context);
|
|
147
|
+
if (!result.success) {
|
|
148
|
+
return {
|
|
149
|
+
success: false,
|
|
150
|
+
sourceWorkspacePath: workspaceFilePath,
|
|
151
|
+
targetRegistryPath: registryPath,
|
|
152
|
+
transformed: false,
|
|
153
|
+
error: result.error
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
success: true,
|
|
158
|
+
sourceWorkspacePath: workspaceFilePath,
|
|
159
|
+
targetRegistryPath: registryPath,
|
|
160
|
+
transformed: result.transformed ?? false
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
return {
|
|
165
|
+
success: false,
|
|
166
|
+
sourceWorkspacePath: workspaceFilePath,
|
|
167
|
+
targetRegistryPath: registryPath,
|
|
168
|
+
transformed: false,
|
|
169
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Check if a platform uses flows
|
|
175
|
+
*/
|
|
176
|
+
export function shouldUseFlowsForSave(platform, cwd) {
|
|
177
|
+
if (!platform) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
return platformUsesFlows(platform, cwd);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Save workspace files using reverse flows
|
|
184
|
+
*
|
|
185
|
+
* Process:
|
|
186
|
+
* 1. Group candidates by platform
|
|
187
|
+
* 2. For each workspace candidate:
|
|
188
|
+
* - Find matching reverse flow
|
|
189
|
+
* - Execute reverse transformation
|
|
190
|
+
* - Write to package registry
|
|
191
|
+
* 3. Return results
|
|
192
|
+
*/
|
|
193
|
+
export async function saveWorkspaceFilesWithFlows(workspaceCandidates, packageRoot, cwd, options = {}) {
|
|
194
|
+
const fileResults = [];
|
|
195
|
+
const errors = [];
|
|
196
|
+
logger.debug(`Saving ${workspaceCandidates.length} workspace files using flows`);
|
|
197
|
+
for (const candidate of workspaceCandidates) {
|
|
198
|
+
// Skip candidates without platform info
|
|
199
|
+
if (!candidate.platform) {
|
|
200
|
+
fileResults.push({
|
|
201
|
+
success: false,
|
|
202
|
+
sourceWorkspacePath: candidate.fullPath,
|
|
203
|
+
targetRegistryPath: candidate.registryPath,
|
|
204
|
+
transformed: false,
|
|
205
|
+
skipped: true,
|
|
206
|
+
skipReason: 'No platform detected for file'
|
|
207
|
+
});
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
// Check if platform uses flows
|
|
211
|
+
if (!shouldUseFlowsForSave(candidate.platform, cwd)) {
|
|
212
|
+
fileResults.push({
|
|
213
|
+
success: false,
|
|
214
|
+
sourceWorkspacePath: candidate.fullPath,
|
|
215
|
+
targetRegistryPath: candidate.registryPath,
|
|
216
|
+
transformed: false,
|
|
217
|
+
skipped: true,
|
|
218
|
+
skipReason: `Platform ${candidate.platform} does not use flows`
|
|
219
|
+
});
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
// Find matching reverse flow
|
|
223
|
+
const match = findReverseFlow(candidate.displayPath, candidate.platform, cwd);
|
|
224
|
+
if (!match) {
|
|
225
|
+
// No reverse flow found - skip this file (handled by legacy save)
|
|
226
|
+
fileResults.push({
|
|
227
|
+
success: false,
|
|
228
|
+
sourceWorkspacePath: candidate.fullPath,
|
|
229
|
+
targetRegistryPath: candidate.registryPath,
|
|
230
|
+
transformed: false,
|
|
231
|
+
skipped: true,
|
|
232
|
+
skipReason: 'No matching reverse flow'
|
|
233
|
+
});
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
// Execute reverse flow
|
|
237
|
+
const result = await executeReverseFlow(candidate.fullPath, match.flow, match.registryPath, packageRoot, cwd, options);
|
|
238
|
+
fileResults.push(result);
|
|
239
|
+
if (!result.success) {
|
|
240
|
+
errors.push({
|
|
241
|
+
file: candidate.fullPath,
|
|
242
|
+
error: result.error ?? new Error('Unknown error')
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
// Calculate statistics
|
|
247
|
+
const filesProcessed = fileResults.filter(r => !r.skipped).length;
|
|
248
|
+
const filesWritten = fileResults.filter(r => r.success && !r.skipped).length;
|
|
249
|
+
const filesSkipped = fileResults.filter(r => r.skipped).length;
|
|
250
|
+
return {
|
|
251
|
+
success: errors.length === 0,
|
|
252
|
+
filesProcessed,
|
|
253
|
+
filesWritten,
|
|
254
|
+
filesSkipped,
|
|
255
|
+
fileResults,
|
|
256
|
+
errors
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Get statistics from flow save result
|
|
261
|
+
*/
|
|
262
|
+
export function getFlowSaveStatistics(result) {
|
|
263
|
+
return {
|
|
264
|
+
total: result.filesProcessed + result.filesSkipped,
|
|
265
|
+
written: result.filesWritten,
|
|
266
|
+
skipped: result.filesSkipped,
|
|
267
|
+
errors: result.errors.length
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=flow-based-saver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-based-saver.js","sourceRoot":"","sources":["../../../src/core/save/flow-based-saver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAiB,MAAM,MAAM,CAAC;AAE/C,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAsC/C;;;;;;;GAOG;AACH,SAAS,eAAe,CACtB,iBAAyB,EACzB,QAAkB,EAClB,GAAW;IAEX,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,qBAAqB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QACxD,IAAI,CAAC,UAAU,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,2CAA2C;QAC3C,MAAM,CAAC,KAAK,CAAC,YAAY,QAAQ,eAAe,KAAK,EAAE,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,UAAU,GAAG,qBAAqB,CAAC,QAAQ,EAAE,GA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L,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC5B,cAAc;QACd,YAAY;QACZ,YAAY;QACZ,WAAW;QACX,MAAM;KACP,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAsB;IAM1D,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,YAAY;QAClD,OAAO,EAAE,MAAM,CAAC,YAAY;QAC5B,OAAO,EAAE,MAAM,CAAC,YAAY;QAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { MODE_LABELS } from './constants.js';
|
|
|
5
5
|
export async function resolveWorkspaceNames(packageInput, renameOption, mode) {
|
|
6
6
|
const { name: inputName, version } = parsePackageInput(packageInput);
|
|
7
7
|
if (version) {
|
|
8
|
-
throw new ValidationError(`${MODE_LABELS[mode].label} command does not accept explicit versions. Edit
|
|
8
|
+
throw new ValidationError(`${MODE_LABELS[mode].label} command does not accept explicit versions. Edit openpackage.yml to change the stable line.`);
|
|
9
9
|
}
|
|
10
10
|
if (renameOption?.trim()) {
|
|
11
11
|
const { name: renameName, version: renameVersion } = parsePackageInput(renameOption.trim());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"name-resolution.js","sourceRoot":"","sources":["../../../src/core/save/name-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAY7C,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,YAAoB,EACpB,YAAgC,EAChC,IAAc;IAEd,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,OA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GAAG,MAAM,2BAA2B,CAAC,SAAS,CAAC,CAAC;IAEnE,OAAO;QACL,SAAS;QACT,SAAS,EAAE,aAAa,CAAC,aAAa;QACtC,WAAW,EAAE,aAAa,CAAC,WAAW;QACtC,YAAY,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;KAChE,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { dirname } from 'path';
|
|
2
1
|
import { normalizePackageName } from '../../utils/package-name.js';
|
|
3
2
|
import { logger } from '../../utils/logger.js';
|
|
4
3
|
import { getPackageFilesDir, getPackageYmlPath, getPackageRootDir } from '../package-context.js';
|
|
@@ -12,17 +11,17 @@ export async function readOrCreateBasePackageYml(cwd, name) {
|
|
|
12
11
|
defaultVersion: undefined
|
|
13
12
|
});
|
|
14
13
|
if (ensured.isNew) {
|
|
15
|
-
logger.debug('No
|
|
14
|
+
logger.debug('No openpackage.yml found for save, creating', { dir: ensured.packageDir });
|
|
16
15
|
console.log(`${LOG_PREFIXES.CREATED} ${ensured.packageDir}`);
|
|
17
16
|
console.log(`${LOG_PREFIXES.NAME} ${ensured.packageConfig.name}`);
|
|
18
17
|
console.log(`${LOG_PREFIXES.VERSION} ${ensured.packageConfig.version ?? UNVERSIONED}`);
|
|
19
18
|
}
|
|
20
19
|
else {
|
|
21
|
-
logger.debug('Found existing
|
|
20
|
+
logger.debug('Found existing openpackage.yml for save', { path: ensured.packageYmlPath });
|
|
22
21
|
console.log(`✓ Found existing package ${ensured.packageConfig.name}${ensured.packageConfig.version ? `@${ensured.packageConfig.version}` : ''}`);
|
|
23
22
|
}
|
|
24
|
-
//
|
|
25
|
-
const packageRootDir =
|
|
23
|
+
// Cached packages mirror the payload at their root
|
|
24
|
+
const packageRootDir = ensured.packageDir;
|
|
26
25
|
return {
|
|
27
26
|
name: ensured.normalizedName,
|
|
28
27
|
version: ensured.packageConfig.version,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-yml-generator.js","sourceRoot":"","sources":["../../../src/core/save/package-yml-generator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package-yml-generator.js","sourceRoot":"","sources":["../../../src/core/save/package-yml-generator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,iBAAiB,EAAuB,MAAM,uBAAuB,CAAC;AACtH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAMpE,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,GAAW,EACX,IAAY;IAEZ,MAAM,cAAc,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,GAAG,EAAE,cAAc,EAAE;QAC9D,cAAc,EAAE,SAAS;KAC1B,CAAC,CAAC;IAEH,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,CAAC,KAAK,CAAC,6CAA6C,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QACzF,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QAC7D,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;QAClE,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,OAAO,IAAI,OAAO,CAAC,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ACrD,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI;QACrB,EAAE,EAAE,YAAY;KACjB,CAAC,CAAC;IAEH,MAAM,2BAA2B,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC;IAE1D,MAAM,cAAc,GAAG,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;IACtE,MAAM,cAAc,GAAG,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;IACtE,MAAM,eAAe,GAAG,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;IAExE,OAAO;QACL,GAAG,GAAG;QACN,IAAI,EAAE,YAAY;QAClB,cAAc;QACd,cAAc;QACd,eAAe;QACf,MAAM,EAAE,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE;KAC9C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import { exists, getStats, readTextFile, walkFiles } from '../../utils/fs.js';
|
|
3
|
+
import { calculateFileHash } from '../../utils/hash-utils.js';
|
|
4
|
+
import { normalizePathForProcessing } from '../../utils/path-normalization.js';
|
|
5
|
+
import { inferPlatformFromWorkspaceFile } from '../platforms.js';
|
|
6
|
+
import { logger } from '../../utils/logger.js';
|
|
7
|
+
import { splitFrontmatter } from '../../utils/markdown-frontmatter.js';
|
|
8
|
+
import { getTargetPath } from '../../utils/workspace-index-helpers.js';
|
|
9
|
+
/**
|
|
10
|
+
* Build all candidates from index mapping
|
|
11
|
+
*
|
|
12
|
+
* This function discovers all workspace and local (source) candidates
|
|
13
|
+
* based on the workspace index mappings.
|
|
14
|
+
*/
|
|
15
|
+
export async function buildCandidates(options) {
|
|
16
|
+
const errors = [];
|
|
17
|
+
// Extract all registry paths from mappings
|
|
18
|
+
const mappedRegistryPaths = Object.keys(options.filesMapping);
|
|
19
|
+
// Build local candidates (from package source)
|
|
20
|
+
const localCandidates = await buildLocalCandidates(options.packageRoot, mappedRegistryPaths);
|
|
21
|
+
// Build workspace candidates (from workspace paths)
|
|
22
|
+
const { candidates: workspaceCandidates, errors: workspaceErrors } = await buildWorkspaceCandidates(options.workspaceRoot, options.packageRoot, options.filesMapping);
|
|
23
|
+
errors.push(...workspaceErrors);
|
|
24
|
+
return {
|
|
25
|
+
localCandidates,
|
|
26
|
+
workspaceCandidates,
|
|
27
|
+
errors
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Build local (source) candidates for mapped registry paths only
|
|
32
|
+
*
|
|
33
|
+
* Only loads files that exist in the index mapping - we don't want to
|
|
34
|
+
* discover unmapped files in the source.
|
|
35
|
+
*/
|
|
36
|
+
async function buildLocalCandidates(packageRoot, mappedRegistryPaths) {
|
|
37
|
+
const candidates = [];
|
|
38
|
+
for (const rawKey of mappedRegistryPaths) {
|
|
39
|
+
const normalizedKey = normalizePathForProcessing(rawKey);
|
|
40
|
+
if (!normalizedKey)
|
|
41
|
+
continue;
|
|
42
|
+
// Skip directory keys - we'll enumerate their contents separately
|
|
43
|
+
if (normalizedKey.endsWith('/'))
|
|
44
|
+
continue;
|
|
45
|
+
const absLocal = join(packageRoot, normalizedKey);
|
|
46
|
+
if (!(await exists(absLocal))) {
|
|
47
|
+
// File doesn't exist in source yet - this is fine (will be created)
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const candidate = await buildCandidate('local', absLocal, normalizedKey, {
|
|
51
|
+
packageRoot,
|
|
52
|
+
workspaceRoot: packageRoot, // Not used for local candidates
|
|
53
|
+
inferPlatform: false, // Local candidates don't have platform inference
|
|
54
|
+
parseMarkdown: true
|
|
55
|
+
});
|
|
56
|
+
if (candidate) {
|
|
57
|
+
candidates.push(candidate);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return candidates;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Build workspace candidates from mapped workspace paths
|
|
64
|
+
*
|
|
65
|
+
* Discovers files in the workspace based on index mappings.
|
|
66
|
+
* For directory mappings, recursively walks the directory tree.
|
|
67
|
+
*/
|
|
68
|
+
async function buildWorkspaceCandidates(workspaceRoot, packageRoot, filesMapping) {
|
|
69
|
+
const candidates = [];
|
|
70
|
+
const errors = [];
|
|
71
|
+
for (const [rawKey, targets] of Object.entries(filesMapping)) {
|
|
72
|
+
const registryKey = normalizePathForProcessing(rawKey);
|
|
73
|
+
if (!registryKey || !Array.isArray(targets))
|
|
74
|
+
continue;
|
|
75
|
+
const isDirectoryMapping = registryKey.endsWith('/');
|
|
76
|
+
for (const mapping of targets) {
|
|
77
|
+
const workspaceRel = getTargetPath(mapping);
|
|
78
|
+
const normalizedTargetPath = normalizePathForProcessing(workspaceRel);
|
|
79
|
+
if (!normalizedTargetPath)
|
|
80
|
+
continue;
|
|
81
|
+
const absTargetPath = join(workspaceRoot, normalizedTargetPath);
|
|
82
|
+
if (isDirectoryMapping) {
|
|
83
|
+
// Directory mapping: enumerate all files under the directory
|
|
84
|
+
try {
|
|
85
|
+
const files = await collectFilesUnderDirectory(absTargetPath);
|
|
86
|
+
for (const relFile of files) {
|
|
87
|
+
const registryPath = normalizePathForProcessing(join(registryKey, relFile));
|
|
88
|
+
if (!registryPath)
|
|
89
|
+
continue;
|
|
90
|
+
const absWorkspaceFile = join(absTargetPath, relFile);
|
|
91
|
+
const candidate = await buildCandidate('workspace', absWorkspaceFile, registryPath, {
|
|
92
|
+
packageRoot,
|
|
93
|
+
workspaceRoot,
|
|
94
|
+
inferPlatform: true,
|
|
95
|
+
parseMarkdown: true
|
|
96
|
+
});
|
|
97
|
+
if (candidate) {
|
|
98
|
+
candidates.push(candidate);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
errors.push({
|
|
104
|
+
path: absTargetPath,
|
|
105
|
+
registryPath: registryKey,
|
|
106
|
+
reason: `Failed to enumerate directory: ${error}`
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
// File mapping: single file
|
|
112
|
+
if (!(await exists(absTargetPath))) {
|
|
113
|
+
// File doesn't exist in workspace - skip (not an error)
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
const candidate = await buildCandidate('workspace', absTargetPath, registryKey, {
|
|
117
|
+
packageRoot,
|
|
118
|
+
workspaceRoot,
|
|
119
|
+
inferPlatform: true,
|
|
120
|
+
parseMarkdown: true
|
|
121
|
+
});
|
|
122
|
+
if (candidate) {
|
|
123
|
+
candidates.push(candidate);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return { candidates, errors };
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Build single candidate from file path
|
|
132
|
+
*
|
|
133
|
+
* Reads file content, calculates hash, extracts metadata.
|
|
134
|
+
* Returns null if file cannot be read.
|
|
135
|
+
*/
|
|
136
|
+
async function buildCandidate(source, absPath, registryPath, options) {
|
|
137
|
+
try {
|
|
138
|
+
const content = await readTextFile(absPath);
|
|
139
|
+
const contentHash = await calculateFileHash(content);
|
|
140
|
+
const stats = await getStats(absPath);
|
|
141
|
+
// Calculate display path (relative to appropriate root)
|
|
142
|
+
const displayPath = source === 'workspace'
|
|
143
|
+
? normalizePathForProcessing(absPath.slice(options.workspaceRoot.length + 1)) || registryPath
|
|
144
|
+
: normalizePathForProcessing(absPath.slice(options.packageRoot.length + 1)) || registryPath;
|
|
145
|
+
// Infer platform for workspace files
|
|
146
|
+
const platform = options.inferPlatform && source === 'workspace'
|
|
147
|
+
? inferPlatformFromWorkspaceFile(absPath, deriveSourceDir(displayPath), registryPath, options.workspaceRoot)
|
|
148
|
+
: undefined;
|
|
149
|
+
// Parse markdown frontmatter if enabled
|
|
150
|
+
let frontmatter = undefined;
|
|
151
|
+
let rawFrontmatter;
|
|
152
|
+
let markdownBody;
|
|
153
|
+
let isMarkdown = false;
|
|
154
|
+
if (options.parseMarkdown && (absPath.endsWith('.md') || absPath.endsWith('.markdown'))) {
|
|
155
|
+
isMarkdown = true;
|
|
156
|
+
try {
|
|
157
|
+
const parsed = splitFrontmatter(content);
|
|
158
|
+
if (parsed.frontmatter && Object.keys(parsed.frontmatter).length > 0) {
|
|
159
|
+
frontmatter = parsed.frontmatter;
|
|
160
|
+
rawFrontmatter = parsed.rawFrontmatter;
|
|
161
|
+
markdownBody = parsed.body;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
logger.debug(`Failed to parse frontmatter for ${absPath}: ${error}`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const candidate = {
|
|
169
|
+
source,
|
|
170
|
+
registryPath,
|
|
171
|
+
fullPath: absPath,
|
|
172
|
+
content,
|
|
173
|
+
contentHash,
|
|
174
|
+
mtime: stats.mtime.getTime(),
|
|
175
|
+
displayPath,
|
|
176
|
+
platform,
|
|
177
|
+
frontmatter,
|
|
178
|
+
rawFrontmatter,
|
|
179
|
+
markdownBody,
|
|
180
|
+
isMarkdown
|
|
181
|
+
};
|
|
182
|
+
return candidate;
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
logger.warn(`Failed to build candidate for ${absPath}: ${error}`);
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Collect all files under a directory recursively
|
|
191
|
+
*
|
|
192
|
+
* Returns relative paths from the directory root.
|
|
193
|
+
*/
|
|
194
|
+
async function collectFilesUnderDirectory(absDir) {
|
|
195
|
+
const collected = [];
|
|
196
|
+
if (!(await exists(absDir)))
|
|
197
|
+
return collected;
|
|
198
|
+
for await (const absFile of walkFiles(absDir)) {
|
|
199
|
+
const relPath = absFile.slice(absDir.length + 1).replace(/\\/g, '/');
|
|
200
|
+
collected.push(relPath);
|
|
201
|
+
}
|
|
202
|
+
return collected;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Derive source directory from relative path
|
|
206
|
+
*
|
|
207
|
+
* Returns the first segment of the path (e.g., ".cursor" from ".cursor/commands/test.md")
|
|
208
|
+
*/
|
|
209
|
+
function deriveSourceDir(relPath) {
|
|
210
|
+
if (!relPath)
|
|
211
|
+
return '';
|
|
212
|
+
const first = relPath.split('/')[0] || '';
|
|
213
|
+
return first;
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=save-candidate-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-candidate-builder.js","sourceRoot":"","sources":["../../../src/core/save/save-candidate-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAEvE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAkCvE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAAgC;IAEhC,MAAM,MAAM,GAA0B,EAAE,CAAC;IAEzC,2CAA2C;IAC3C,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAE9D,+CAA+C;IAC/C,MAAM,eAAe,GAAG,MAAM,oBAAoB,CAChD,OAAO,CAAC,WAAW,EACnB,mBAAmB,CACpB,CAAC;IAEF,oDAAoD;IACp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,YAAY;YACZ,QAAQ,EAAE,OAAO;YACjB,OAAO;YACP,WAAW;YACX,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE;YAC5B,WAAW;YACX,QAAQ;YACR,WAAW;YACX,cAAc;YACd,YAAY;YACZ,UAAU;SACX,CAAC;QAEF,OAAO,SAAS,CAAC;IACnB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CAAC,iCAAiC,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,0BAA0B,CAAC,MAAc;IACtD,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IAE9C,IAAI,KAAK,EAAE,MAAM,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9C,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACrE,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,SAAS,eAAe,CAAC,OAA2B;IAClD,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACxB,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1C,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -7,19 +7,20 @@ import { getRelativePathFromBase } from '../../utils/path-normalization.js';
|
|
|
7
7
|
import { splitFrontmatter, stripFrontmatter } from '../../utils/markdown-frontmatter.js';
|
|
8
8
|
import { discoverPlatformFilesUnified } from '../discovery/platform-files-discovery.js';
|
|
9
9
|
import { inferPlatformFromWorkspaceFile } from '../platforms.js';
|
|
10
|
-
|
|
10
|
+
function isValidLocalCandidatePath(normalizedPath, cwd) {
|
|
11
|
+
if (normalizedPath === FILE_PATTERNS.OPENPACKAGE_INDEX_YML ||
|
|
12
|
+
normalizedPath === PACKAGE_PATHS.INDEX_RELATIVE ||
|
|
13
|
+
normalizedPath === FILE_PATTERNS.AGENTS_MD) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return isAllowedRegistryPath(normalizedPath, cwd);
|
|
17
|
+
}
|
|
18
|
+
export async function loadLocalCandidates(packageDir, cwd) {
|
|
11
19
|
const entries = await findFilesByExtension(packageDir, [], packageDir);
|
|
12
20
|
const candidates = [];
|
|
13
21
|
for (const entry of entries) {
|
|
14
22
|
const normalizedPath = normalizeRegistryPath(entry.relativePath);
|
|
15
|
-
if (normalizedPath
|
|
16
|
-
normalizedPath === PACKAGE_PATHS.INDEX_RELATIVE) {
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
if (normalizedPath === FILE_PATTERNS.AGENTS_MD) {
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
if (!isAllowedRegistryPath(normalizedPath)) {
|
|
23
|
+
if (!isValidLocalCandidatePath(normalizedPath, cwd)) {
|
|
23
24
|
continue;
|
|
24
25
|
}
|
|
25
26
|
const fullPath = entry.fullPath;
|
|
@@ -52,7 +53,7 @@ export async function discoverWorkspaceCandidates(cwd, packageName) {
|
|
|
52
53
|
const candidates = [];
|
|
53
54
|
for (const file of discovered) {
|
|
54
55
|
const normalizedPath = normalizeRegistryPath(file.registryPath);
|
|
55
|
-
if (!isAllowedRegistryPath(normalizedPath)) {
|
|
56
|
+
if (!isAllowedRegistryPath(normalizedPath, cwd)) {
|
|
56
57
|
continue;
|
|
57
58
|
}
|
|
58
59
|
const content = await readTextFile(file.fullPath);
|
|
@@ -63,7 +64,7 @@ export async function discoverWorkspaceCandidates(cwd, packageName) {
|
|
|
63
64
|
const rawFrontmatter = split?.rawFrontmatter;
|
|
64
65
|
const contentHash = await calculateContentHash(normalizedPath, content);
|
|
65
66
|
const displayPath = getRelativePathFromBase(file.fullPath, cwd) || normalizedPath;
|
|
66
|
-
const platform = inferPlatformFromWorkspaceFile(file.fullPath, file.sourceDir, normalizedPath);
|
|
67
|
+
const platform = inferPlatformFromWorkspaceFile(file.fullPath, file.sourceDir, normalizedPath, cwd);
|
|
67
68
|
candidates.push({
|
|
68
69
|
source: 'workspace',
|
|
69
70
|
registryPath: normalizedPath,
|