opkg 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -186
- package/assets/openpackage_ascii_dark.png +0 -0
- package/assets/openpackage_ascii_light.png +0 -0
- package/dist/commands/add.js +34 -10
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/apply.js +16 -0
- package/dist/commands/apply.js.map +1 -0
- package/dist/commands/delete.js +1 -1
- package/dist/commands/delete.js.map +1 -1
- package/dist/commands/install.js +177 -8
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/list.js +2 -2
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/login.js +1 -1
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.js +1 -1
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/new.js +125 -0
- package/dist/commands/new.js.map +1 -0
- package/dist/commands/pack.js +7 -13
- package/dist/commands/pack.js.map +1 -1
- package/dist/commands/pull.js +1 -1
- package/dist/commands/pull.js.map +1 -1
- package/dist/commands/push.js +1 -1
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/remove.js +63 -0
- package/dist/commands/remove.js.map +1 -0
- package/dist/commands/save.js +11 -17
- package/dist/commands/save.js.map +1 -1
- package/dist/commands/set.js +33 -0
- package/dist/commands/set.js.map +1 -0
- package/dist/commands/show.js +16 -94
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/status.js +26 -701
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/uninstall.js +14 -427
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/constants/index.js +72 -16
- package/dist/constants/index.js.map +1 -1
- package/dist/core/add/add-conflict-handler.js +1 -8
- package/dist/core/add/add-conflict-handler.js.map +1 -1
- package/dist/core/add/add-pipeline.js +12 -10
- package/dist/core/add/add-pipeline.js.map +1 -1
- package/dist/core/add/add-to-source-pipeline.js +123 -0
- package/dist/core/add/add-to-source-pipeline.js.map +1 -0
- package/dist/core/add/package-index-updater.js +77 -78
- package/dist/core/add/package-index-updater.js.map +1 -1
- package/dist/core/add/platform-path-transformer.js +6 -4
- package/dist/core/add/platform-path-transformer.js.map +1 -1
- package/dist/core/add/source-collector.js +2 -3
- package/dist/core/add/source-collector.js.map +1 -1
- package/dist/core/apply/apply-pipeline.js +110 -0
- package/dist/core/apply/apply-pipeline.js.map +1 -0
- package/dist/core/dependency-resolver.js +263 -21
- package/dist/core/dependency-resolver.js.map +1 -1
- package/dist/core/discovery/file-discovery.js +1 -2
- package/dist/core/discovery/file-discovery.js.map +1 -1
- package/dist/core/discovery/platform-files-discovery.js +33 -18
- package/dist/core/discovery/platform-files-discovery.js.map +1 -1
- package/dist/core/flows/flow-executor.js +974 -0
- package/dist/core/flows/flow-executor.js.map +1 -0
- package/dist/core/flows/flow-inverter.js +442 -0
- package/dist/core/flows/flow-inverter.js.map +1 -0
- package/dist/core/flows/flow-key-extractor.js +101 -0
- package/dist/core/flows/flow-key-extractor.js.map +1 -0
- package/dist/core/flows/flow-key-mapper.js +382 -0
- package/dist/core/flows/flow-key-mapper.js.map +1 -0
- package/dist/core/flows/flow-transforms.js +632 -0
- package/dist/core/flows/flow-transforms.js.map +1 -0
- package/dist/core/flows/map-pipeline/context.js +73 -0
- package/dist/core/flows/map-pipeline/context.js.map +1 -0
- package/dist/core/flows/map-pipeline/index.js +156 -0
- package/dist/core/flows/map-pipeline/index.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/copy.js +104 -0
- package/dist/core/flows/map-pipeline/operations/copy.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/pipe.js +70 -0
- package/dist/core/flows/map-pipeline/operations/pipe.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/rename.js +102 -0
- package/dist/core/flows/map-pipeline/operations/rename.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/set.js +50 -0
- package/dist/core/flows/map-pipeline/operations/set.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/switch.js +79 -0
- package/dist/core/flows/map-pipeline/operations/switch.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/transform.js +543 -0
- package/dist/core/flows/map-pipeline/operations/transform.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/unset.js +65 -0
- package/dist/core/flows/map-pipeline/operations/unset.js.map +1 -0
- package/dist/core/flows/map-pipeline/types.js +8 -0
- package/dist/core/flows/map-pipeline/types.js.map +1 -0
- package/dist/core/flows/map-pipeline/utils.js +278 -0
- package/dist/core/flows/map-pipeline/utils.js.map +1 -0
- package/dist/core/flows/platform-converter.js +328 -0
- package/dist/core/flows/platform-converter.js.map +1 -0
- package/dist/core/flows/source-resolver.js +192 -0
- package/dist/core/flows/source-resolver.js.map +1 -0
- package/dist/core/flows/toml-domain-transforms.js +23 -0
- package/dist/core/flows/toml-domain-transforms.js.map +1 -0
- package/dist/core/install/bulk-install-pipeline.js +68 -7
- package/dist/core/install/bulk-install-pipeline.js.map +1 -1
- package/dist/core/install/canonical-plan.js +3 -3
- package/dist/core/install/canonical-plan.js.map +1 -1
- package/dist/core/install/dry-run.js +3 -3
- package/dist/core/install/dry-run.js.map +1 -1
- package/dist/core/install/flow-based-installer.js +1158 -0
- package/dist/core/install/flow-based-installer.js.map +1 -0
- package/dist/core/install/flow-workspace-tracker.js +111 -0
- package/dist/core/install/flow-workspace-tracker.js.map +1 -0
- package/dist/core/install/format-detector.js +228 -0
- package/dist/core/install/format-detector.js.map +1 -0
- package/dist/core/install/git-package-loader.js +20 -0
- package/dist/core/install/git-package-loader.js.map +1 -0
- package/dist/core/install/install-errors.js +1 -1
- package/dist/core/install/install-errors.js.map +1 -1
- package/dist/core/install/install-flow.js +34 -14
- package/dist/core/install/install-flow.js.map +1 -1
- package/dist/core/install/install-pipeline.js +52 -17
- package/dist/core/install/install-pipeline.js.map +1 -1
- package/dist/core/install/install-reporting.js +26 -8
- package/dist/core/install/install-reporting.js.map +1 -1
- package/dist/core/install/local-source-resolution.js +103 -0
- package/dist/core/install/local-source-resolution.js.map +1 -0
- package/dist/core/install/marketplace-handler.js +221 -0
- package/dist/core/install/marketplace-handler.js.map +1 -0
- package/dist/core/install/path-install-pipeline.js +241 -0
- package/dist/core/install/path-install-pipeline.js.map +1 -0
- package/dist/core/install/path-package-loader.js +116 -0
- package/dist/core/install/path-package-loader.js.map +1 -0
- package/dist/core/install/plugin-detector.js +72 -0
- package/dist/core/install/plugin-detector.js.map +1 -0
- package/dist/core/install/plugin-to-universal-converter.js +218 -0
- package/dist/core/install/plugin-to-universal-converter.js.map +1 -0
- package/dist/core/install/plugin-transformer.js +191 -0
- package/dist/core/install/plugin-transformer.js.map +1 -0
- package/dist/core/install/version-selection.js +1 -1
- package/dist/core/install/version-selection.js.map +1 -1
- package/dist/core/openpackage.js +40 -22
- package/dist/core/openpackage.js.map +1 -1
- package/dist/core/pack/pack-output.js +62 -0
- package/dist/core/pack/pack-output.js.map +1 -0
- package/dist/core/pack/pack-pipeline.js +186 -0
- package/dist/core/pack/pack-pipeline.js.map +1 -0
- package/dist/core/package-context.js +45 -70
- package/dist/core/package-context.js.map +1 -1
- package/dist/core/package-creation.js +203 -0
- package/dist/core/package-creation.js.map +1 -0
- package/dist/core/package.js +20 -6
- package/dist/core/package.js.map +1 -1
- package/dist/core/platforms.js +665 -209
- package/dist/core/platforms.js.map +1 -1
- package/dist/core/push/push-context.js +1 -1
- package/dist/core/push/push-context.js.map +1 -1
- package/dist/core/push/push-upload.js +2 -2
- package/dist/core/push/push-upload.js.map +1 -1
- package/dist/core/registry.js +6 -6
- package/dist/core/registry.js.map +1 -1
- package/dist/core/remote-pull.js +2 -2
- package/dist/core/remote-pull.js.map +1 -1
- package/dist/core/remove/removal-collector.js +52 -0
- package/dist/core/remove/removal-collector.js.map +1 -0
- package/dist/core/remove/removal-confirmation.js +39 -0
- package/dist/core/remove/removal-confirmation.js.map +1 -0
- package/dist/core/remove/remove-from-source-pipeline.js +173 -0
- package/dist/core/remove/remove-from-source-pipeline.js.map +1 -0
- package/dist/core/save/constants.js +3 -3
- package/dist/core/save/constants.js.map +1 -1
- package/dist/core/save/flow-based-saver.js +270 -0
- package/dist/core/save/flow-based-saver.js.map +1 -0
- package/dist/core/save/name-resolution.js +1 -1
- package/dist/core/save/name-resolution.js.map +1 -1
- package/dist/core/save/package-yml-generator.js +4 -5
- package/dist/core/save/package-yml-generator.js.map +1 -1
- package/dist/core/save/save-candidate-builder.js +215 -0
- package/dist/core/save/save-candidate-builder.js.map +1 -0
- package/dist/core/save/save-candidate-loader.js +12 -11
- package/dist/core/save/save-candidate-loader.js.map +1 -1
- package/dist/core/save/save-conflict-analyzer.js +150 -0
- package/dist/core/save/save-conflict-analyzer.js.map +1 -0
- package/dist/core/save/save-conflict-resolution.js +28 -14
- package/dist/core/save/save-conflict-resolution.js.map +1 -1
- package/dist/core/save/save-conflict-resolver.js +31 -275
- package/dist/core/save/save-conflict-resolver.js.map +1 -1
- package/dist/core/save/save-group-builder.js +52 -0
- package/dist/core/save/save-group-builder.js.map +1 -0
- package/dist/core/save/save-interactive-resolver.js +190 -0
- package/dist/core/save/save-interactive-resolver.js.map +1 -0
- package/dist/core/save/save-pipeline.js +58 -34
- package/dist/core/save/save-pipeline.js.map +1 -1
- package/dist/core/save/save-platform-handler.js +53 -0
- package/dist/core/save/save-platform-handler.js.map +1 -0
- package/dist/core/save/save-resolution-executor.js +145 -0
- package/dist/core/save/save-resolution-executor.js.map +1 -0
- package/dist/core/save/save-result-reporter.js +167 -0
- package/dist/core/save/save-result-reporter.js.map +1 -0
- package/dist/core/save/save-to-source-pipeline.js +154 -0
- package/dist/core/save/save-to-source-pipeline.js.map +1 -0
- package/dist/core/save/save-versioning.js +4 -4
- package/dist/core/save/save-versioning.js.map +1 -1
- package/dist/core/save/save-write-coordinator.js +204 -0
- package/dist/core/save/save-write-coordinator.js.map +1 -0
- package/dist/core/save/save-yml-resolution.js +28 -216
- package/dist/core/save/save-yml-resolution.js.map +1 -1
- package/dist/core/save/workspace-rename.js +7 -8
- package/dist/core/save/workspace-rename.js.map +1 -1
- package/dist/core/set/set-output.js +72 -0
- package/dist/core/set/set-output.js.map +1 -0
- package/dist/core/set/set-pipeline.js +361 -0
- package/dist/core/set/set-pipeline.js.map +1 -0
- package/dist/core/set/set-types.js +5 -0
- package/dist/core/set/set-types.js.map +1 -0
- package/dist/core/show/package-resolver.js +257 -0
- package/dist/core/show/package-resolver.js.map +1 -0
- package/dist/core/show/scope-discovery.js +165 -0
- package/dist/core/show/scope-discovery.js.map +1 -0
- package/dist/core/show/show-output.js +168 -0
- package/dist/core/show/show-output.js.map +1 -0
- package/dist/core/show/show-pipeline.js +113 -0
- package/dist/core/show/show-pipeline.js.map +1 -0
- package/dist/core/show/show-types.js +5 -0
- package/dist/core/show/show-types.js.map +1 -0
- package/dist/core/source-resolution/dependency-graph.js +104 -0
- package/dist/core/source-resolution/dependency-graph.js.map +1 -0
- package/dist/core/source-resolution/resolve-mutable-source.js +109 -0
- package/dist/core/source-resolution/resolve-mutable-source.js.map +1 -0
- package/dist/core/source-resolution/resolve-package-source.js +29 -0
- package/dist/core/source-resolution/resolve-package-source.js.map +1 -0
- package/dist/core/source-resolution/resolve-registry-version.js +35 -0
- package/dist/core/source-resolution/resolve-registry-version.js.map +1 -0
- package/dist/core/source-resolution/types.js.map +1 -0
- package/dist/core/status/status-file-discovery.js +23 -12
- package/dist/core/status/status-file-discovery.js.map +1 -1
- package/dist/core/status/status-pipeline.js +134 -0
- package/dist/core/status/status-pipeline.js.map +1 -0
- package/dist/core/sync/platform-sync-summary.js +27 -0
- package/dist/core/sync/platform-sync-summary.js.map +1 -0
- package/dist/core/uninstall/flow-aware-uninstaller.js +189 -0
- package/dist/core/uninstall/flow-aware-uninstaller.js.map +1 -0
- package/dist/core/uninstall/uninstall-file-discovery.js +11 -6
- package/dist/core/uninstall/uninstall-file-discovery.js.map +1 -1
- package/dist/core/uninstall/uninstall-pipeline.js +141 -0
- package/dist/core/uninstall/uninstall-pipeline.js.map +1 -0
- package/dist/core/universal-patterns.js +64 -0
- package/dist/core/universal-patterns.js.map +1 -0
- package/dist/index.js +99 -6
- package/dist/index.js.map +1 -1
- package/dist/types/flows.js +8 -0
- package/dist/types/flows.js.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/platform-flows.js +8 -0
- package/dist/types/platform-flows.js.map +1 -0
- package/dist/types/workspace-index.js +6 -0
- package/dist/types/workspace-index.js.map +1 -0
- package/dist/utils/custom-path-resolution.js +160 -0
- package/dist/utils/custom-path-resolution.js.map +1 -0
- package/dist/utils/dependency-coverage.js +1 -1
- package/dist/utils/dependency-coverage.js.map +1 -1
- package/dist/utils/file-processing.js +1 -1
- package/dist/utils/flow-index-installer.js +209 -0
- package/dist/utils/flow-index-installer.js.map +1 -0
- package/dist/utils/formatters.js +47 -1
- package/dist/utils/formatters.js.map +1 -1
- package/dist/utils/fs.js +17 -0
- package/dist/utils/fs.js.map +1 -1
- package/dist/utils/git-clone-registry.js +88 -0
- package/dist/utils/git-clone-registry.js.map +1 -0
- package/dist/utils/git-clone.js +69 -0
- package/dist/utils/git-clone.js.map +1 -0
- package/dist/utils/git-spec.js +96 -0
- package/dist/utils/git-spec.js.map +1 -0
- package/dist/utils/http-client.js +7 -0
- package/dist/utils/http-client.js.map +1 -1
- package/dist/utils/index-based-installer.js +356 -163
- package/dist/utils/index-based-installer.js.map +1 -1
- package/dist/utils/install-conflict-handler.js +2 -2
- package/dist/utils/install-conflict-handler.js.map +1 -1
- package/dist/utils/install-file-discovery.js +18 -13
- package/dist/utils/install-file-discovery.js.map +1 -1
- package/dist/utils/install-helpers.js +43 -20
- package/dist/utils/install-helpers.js.map +1 -1
- package/dist/utils/jsonc.js +23 -1
- package/dist/utils/jsonc.js.map +1 -1
- package/dist/utils/manifest-paths.js +1 -1
- package/dist/utils/manifest-paths.js.map +1 -1
- package/dist/utils/markdown-frontmatter.js +46 -0
- package/dist/utils/markdown-frontmatter.js.map +1 -1
- package/dist/utils/package-copy.js +5 -103
- package/dist/utils/package-copy.js.map +1 -1
- package/dist/utils/package-filters.js +9 -105
- package/dist/utils/package-filters.js.map +1 -1
- package/dist/utils/package-index-yml.js +27 -6
- package/dist/utils/package-index-yml.js.map +1 -1
- package/dist/utils/package-input.js +98 -0
- package/dist/utils/package-input.js.map +1 -0
- package/dist/utils/package-management.js +80 -28
- package/dist/utils/package-management.js.map +1 -1
- package/dist/utils/package-name-resolution.js +327 -0
- package/dist/utils/package-name-resolution.js.map +1 -0
- package/dist/utils/package-name.js +18 -16
- package/dist/utils/package-name.js.map +1 -1
- package/dist/utils/package-versioning.js +2 -33
- package/dist/utils/package-versioning.js.map +1 -1
- package/dist/utils/package-yml.js +19 -28
- package/dist/utils/package-yml.js.map +1 -1
- package/dist/utils/path-resolution.js +102 -0
- package/dist/utils/path-resolution.js.map +1 -0
- package/dist/utils/paths.js +6 -6
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/platform-file.js +36 -24
- package/dist/utils/platform-file.js.map +1 -1
- package/dist/utils/platform-mapper.js +222 -68
- package/dist/utils/platform-mapper.js.map +1 -1
- package/dist/utils/platform-root-files.js +44 -0
- package/dist/utils/platform-root-files.js.map +1 -0
- package/dist/utils/platform-utils.js +35 -54
- package/dist/utils/platform-utils.js.map +1 -1
- package/dist/utils/platform-yaml-merge.js +20 -140
- package/dist/utils/platform-yaml-merge.js.map +1 -1
- package/dist/utils/prompts.js +92 -7
- package/dist/utils/prompts.js.map +1 -1
- package/dist/utils/registry-entry-filter.js +50 -27
- package/dist/utils/registry-entry-filter.js.map +1 -1
- package/dist/utils/registry-paths.js +5 -4
- package/dist/utils/registry-paths.js.map +1 -1
- package/dist/utils/scope-resolution.js +156 -0
- package/dist/utils/scope-resolution.js.map +1 -0
- package/dist/utils/source-mutability.js +15 -0
- package/dist/utils/source-mutability.js.map +1 -0
- package/dist/utils/tarball.js +29 -4
- package/dist/utils/tarball.js.map +1 -1
- package/dist/utils/version-ranges.js +1 -32
- package/dist/utils/version-ranges.js.map +1 -1
- package/dist/utils/workspace-index-helpers.js +28 -0
- package/dist/utils/workspace-index-helpers.js.map +1 -0
- package/dist/utils/workspace-index-ownership.js +100 -0
- package/dist/utils/workspace-index-ownership.js.map +1 -0
- package/dist/utils/workspace-index-yml.js +173 -0
- package/dist/utils/workspace-index-yml.js.map +1 -0
- package/examples/custom-subdirs-platform.jsonc +157 -0
- package/package.json +7 -2
- package/platforms.jsonc +531 -84
- package/schemas/map-pipeline-v1.json +256 -0
- package/schemas/platforms-v1.json +400 -0
- package/specs/README.md +88 -0
- package/specs/add/README.md +166 -0
- package/specs/agents-claude.md +570 -0
- package/specs/agents-opencode.md +622 -0
- package/specs/apply/README.md +21 -0
- package/specs/apply/apply-behavior.md +58 -0
- package/specs/apply/apply-command.md +51 -0
- package/specs/apply/conflicts.md +41 -0
- package/specs/apply/index-effects.md +81 -0
- package/specs/architecture.md +107 -0
- package/specs/auth/README.md +17 -0
- package/specs/auth/auth-http-contract.md +25 -0
- package/specs/auth/cli/credentials.md +39 -0
- package/specs/auth/cli/login.md +32 -0
- package/specs/auth/cli/logout.md +16 -0
- package/specs/claude-mcp.md +1065 -0
- package/specs/claude-plugins-marketplace.md +363 -0
- package/specs/claude-plugins.md +413 -0
- package/specs/cli-options.md +52 -0
- package/specs/codex-mcp.md +114 -0
- package/specs/commands-overview.md +175 -0
- package/specs/directory-layout.md +95 -0
- package/specs/install/README.md +12 -4
- package/specs/install/git-sources.md +230 -0
- package/specs/install/install-behavior.md +483 -73
- package/specs/install/package-yml-canonical.md +67 -35
- package/specs/install/version-resolution.md +69 -115
- package/specs/new/README.md +769 -0
- package/specs/new/SUMMARY.md +310 -0
- package/specs/new/scope-behavior.md +793 -0
- package/specs/pack/README.md +77 -0
- package/specs/pack/package-name-resolution.md +330 -0
- package/specs/package/README.md +18 -17
- package/specs/package/nested-packages-and-parent-packages.md +32 -31
- package/specs/package/package-index-yml.md +95 -101
- package/specs/package/package-root-layout.md +64 -46
- package/specs/package/registry-payload-and-copy.md +50 -44
- package/specs/package/universal-content.md +33 -56
- package/specs/package-sources.md +248 -0
- package/specs/platforms/README.md +52 -0
- package/specs/platforms/configuration.md +571 -0
- package/specs/platforms/detection.md +552 -0
- package/specs/platforms/directory-layout.md +599 -0
- package/specs/platforms/examples.md +1146 -0
- package/specs/platforms/flow-reference.md +1240 -0
- package/specs/platforms/flows.md +1488 -0
- package/specs/platforms/map-pipeline.md +801 -0
- package/specs/platforms/overview.md +349 -0
- package/specs/platforms/specification.md +700 -0
- package/specs/platforms/troubleshooting.md +697 -0
- package/specs/platforms/universal-converter.md +520 -0
- package/specs/push/README.md +1 -0
- package/specs/push/push-behavior.md +11 -3
- package/specs/push/push-remote-upload.md +1 -1
- package/specs/push/push-scoping.md +1 -1
- package/specs/push/push-version-selection.md +1 -1
- package/specs/registry.md +111 -0
- package/specs/remove/README.md +257 -0
- package/specs/save/README.md +21 -17
- package/specs/save/save-conflict-resolution.md +205 -83
- package/specs/save/save-file-discovery.md +6 -4
- package/specs/save/save-frontmatter-overrides.md +11 -15
- package/specs/save/save-modes-inputs.md +9 -39
- package/specs/save/save-naming-scoping.md +4 -4
- package/specs/save/save-package-detection.md +13 -13
- package/specs/save/save-registry-sync.md +16 -106
- package/specs/save/save-versioning.md +80 -0
- package/specs/scope-management.md +92 -0
- package/specs/set/README.md +520 -0
- package/specs/set/set-behavior.md +563 -0
- package/specs/show/README.md +483 -0
- package/specs/show/show-remote.md +494 -0
- package/specs/status/README.md +38 -0
- package/specs/uninstall/README.md +231 -0
- package/dist/commands/duplicate.js +0 -69
- package/dist/commands/duplicate.js.map +0 -1
- package/dist/commands/init.js +0 -117
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/prune.js +0 -357
- package/dist/commands/prune.js.map +0 -1
- package/dist/commands/tui.js +0 -61
- package/dist/commands/tui.js.map +0 -1
- package/dist/core/install/index.js +0 -3
- package/dist/core/install/index.js.map +0 -1
- package/dist/core/push/push-single-file.js +0 -56
- package/dist/core/push/push-single-file.js.map +0 -1
- package/dist/core/save/package-detection.js +0 -147
- package/dist/core/save/package-detection.js.map +0 -1
- package/dist/core/save/save-single-file.js +0 -124
- package/dist/core/save/save-single-file.js.map +0 -1
- package/dist/core/token-store.js +0 -73
- package/dist/core/token-store.js.map +0 -1
- package/dist/tui/app.js +0 -95
- package/dist/tui/app.js.map +0 -1
- package/dist/tui/components/package-list.js +0 -73
- package/dist/tui/components/package-list.js.map +0 -1
- package/dist/tui/controller.js +0 -365
- package/dist/tui/controller.js.map +0 -1
- package/dist/tui/index.js +0 -12
- package/dist/tui/index.js.map +0 -1
- package/dist/tui/services/file-index.js +0 -64
- package/dist/tui/services/file-index.js.map +0 -1
- package/dist/tui/services/packages.js +0 -18
- package/dist/tui/services/packages.js.map +0 -1
- package/dist/tui/services/save.js +0 -21
- package/dist/tui/services/save.js.map +0 -1
- package/dist/tui/state/app-state.js +0 -15
- package/dist/tui/state/app-state.js.map +0 -1
- package/dist/tui/state.js +0 -17
- package/dist/tui/state.js.map +0 -1
- package/dist/tui/types.js.map +0 -1
- package/dist/tui/views/add-file-modal.js +0 -129
- package/dist/tui/views/add-file-modal.js.map +0 -1
- package/dist/tui/views/file-preview.js +0 -44
- package/dist/tui/views/file-preview.js.map +0 -1
- package/dist/tui/views/list-packages.js +0 -73
- package/dist/tui/views/list-packages.js.map +0 -1
- package/dist/tui/views/main-menu.js +0 -29
- package/dist/tui/views/main-menu.js.map +0 -1
- package/dist/tui/views/manage-view.js +0 -81
- package/dist/tui/views/manage-view.js.map +0 -1
- package/dist/tui/views/package-hub.js +0 -120
- package/dist/tui/views/package-hub.js.map +0 -1
- package/dist/tui/views/placeholder.js +0 -24
- package/dist/tui/views/placeholder.js.map +0 -1
- package/dist/utils/bun-bootstrap.js +0 -72
- package/dist/utils/bun-bootstrap.js.map +0 -1
- package/dist/utils/entity-id.js +0 -19
- package/dist/utils/entity-id.js.map +0 -1
- package/dist/utils/package-local-files.js +0 -5
- package/dist/utils/package-local-files.js.map +0 -1
- package/dist/utils/path-matching.js +0 -74
- package/dist/utils/path-matching.js.map +0 -1
- package/dist/utils/root-file-operations.js +0 -39
- package/dist/utils/root-file-operations.js.map +0 -1
- package/dist/utils/root-file-transformer.js +0 -27
- package/dist/utils/root-file-transformer.js.map +0 -1
- package/dist/utils/yaml-frontmatter.js +0 -25
- package/dist/utils/yaml-frontmatter.js.map +0 -1
- package/specs/auth/auth-device-flow.md +0 -70
- package/specs/login/login-device-flow.md +0 -70
- package/specs/platforms.md +0 -193
- package/specs/save-pack-versioning.md +0 -224
- package/specs/save-pack.md +0 -68
- /package/dist/{tui → core/source-resolution}/types.js +0 -0
|
@@ -0,0 +1,1240 @@
|
|
|
1
|
+
# Flow Reference
|
|
2
|
+
|
|
3
|
+
Complete technical reference for all flow fields, transforms, and options.
|
|
4
|
+
|
|
5
|
+
## Flow Schema
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
interface Flow {
|
|
9
|
+
// Required
|
|
10
|
+
from: string
|
|
11
|
+
to: string | MultiTargetFlows
|
|
12
|
+
|
|
13
|
+
// Optional transforms
|
|
14
|
+
map?: Operation[] // Map pipeline (includes $pipe for transform registry ops)
|
|
15
|
+
pick?: string[]
|
|
16
|
+
omit?: string[]
|
|
17
|
+
path?: string
|
|
18
|
+
embed?: string
|
|
19
|
+
section?: string
|
|
20
|
+
when?: Condition
|
|
21
|
+
merge?: "deep" | "shallow" | "replace" | "composite"
|
|
22
|
+
namespace?: boolean | string
|
|
23
|
+
handler?: string
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Required Fields
|
|
28
|
+
|
|
29
|
+
### `from` (string)
|
|
30
|
+
|
|
31
|
+
Source file pattern relative to package root.
|
|
32
|
+
|
|
33
|
+
**Pattern syntax:**
|
|
34
|
+
```jsonc
|
|
35
|
+
"rules/typescript.md" // Exact file
|
|
36
|
+
"rules/*.md" // Single-level glob (files in rules/ only)
|
|
37
|
+
"rules/**/*.md" // Recursive glob (all .md files in rules/ and subdirs)
|
|
38
|
+
"skills/**/*" // Recursive glob (all files in skills/ and subdirs)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Glob pattern usage:**
|
|
42
|
+
```jsonc
|
|
43
|
+
// Single-level glob
|
|
44
|
+
{
|
|
45
|
+
"from": "rules/*.md",
|
|
46
|
+
"to": ".cursor/rules/*.mdc" // * matches filename, changes extension
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Recursive glob with nested directories
|
|
50
|
+
{
|
|
51
|
+
"from": "rules/**/*.md",
|
|
52
|
+
"to": ".cursor/rules/**/*.mdc" // Preserves nested directory structure
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// All files recursively
|
|
56
|
+
{
|
|
57
|
+
"from": "skills/**/*",
|
|
58
|
+
"to": ".claude/skills/**/*" // Copies all file types with full structure
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Examples:**
|
|
63
|
+
```jsonc
|
|
64
|
+
"config.yaml" // Single file
|
|
65
|
+
"rules/**/*.md" // All markdown in rules/ and subdirectories
|
|
66
|
+
"agents/**/*.md" // All agents, including nested directories
|
|
67
|
+
"commands/**/*.md" // All commands with full directory structure
|
|
68
|
+
"skills/**/*" // All files in skills/, any type, nested
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### `to` (string | object)
|
|
72
|
+
|
|
73
|
+
Target path(s) relative to workspace root.
|
|
74
|
+
|
|
75
|
+
**Single target with glob:**
|
|
76
|
+
```jsonc
|
|
77
|
+
{
|
|
78
|
+
"to": ".cursor/rules/*.mdc" // * matches source filename
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Recursive target with glob:**
|
|
83
|
+
```jsonc
|
|
84
|
+
{
|
|
85
|
+
"to": ".cursor/rules/**/*.mdc" // ** preserves directory structure
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Exact file mapping:**
|
|
90
|
+
```jsonc
|
|
91
|
+
{
|
|
92
|
+
"to": "CLAUDE.md" // Specific target file
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Multi-target:**
|
|
97
|
+
```jsonc
|
|
98
|
+
{
|
|
99
|
+
"to": {
|
|
100
|
+
".cursor/mcp.json": {
|
|
101
|
+
"namespace": true,
|
|
102
|
+
"merge": "deep"
|
|
103
|
+
},
|
|
104
|
+
".claude/config.json": {
|
|
105
|
+
"embed": "mcp",
|
|
106
|
+
"merge": "deep"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Multi-target options:**
|
|
113
|
+
Each target key maps to an object with any flow options except `from`, `to`, and `handler`.
|
|
114
|
+
|
|
115
|
+
## Transform Fields
|
|
116
|
+
|
|
117
|
+
### `$pipe` (Map Operation)
|
|
118
|
+
|
|
119
|
+
Apply transform registry operations within the map pipeline using the `$pipe` operation.
|
|
120
|
+
|
|
121
|
+
**Example:**
|
|
122
|
+
```jsonc
|
|
123
|
+
{
|
|
124
|
+
"map": [
|
|
125
|
+
{ "$rename": { "old": "new" } },
|
|
126
|
+
{ "$pipe": ["json-to-toml"] }
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Built-in transforms:**
|
|
132
|
+
|
|
133
|
+
#### Format Converters
|
|
134
|
+
- `jsonc` - Parse JSON with comments
|
|
135
|
+
- `json` - Parse/stringify JSON
|
|
136
|
+
- `yaml` - Parse/stringify YAML
|
|
137
|
+
- `toml` - Parse/stringify TOML
|
|
138
|
+
- `json-to-toml` - Convert JSON object to TOML string
|
|
139
|
+
- `toml-to-json` - Convert TOML string to JSON object
|
|
140
|
+
- `xml` - Parse/emit XML
|
|
141
|
+
- `ini` - Parse/emit INI
|
|
142
|
+
|
|
143
|
+
#### Filtering
|
|
144
|
+
- `filter-comments` - Remove comments from strings
|
|
145
|
+
- `filter-empty` - Remove empty objects/arrays
|
|
146
|
+
- `filter-null` - Remove null values
|
|
147
|
+
|
|
148
|
+
#### Markdown
|
|
149
|
+
- `sections` - Extract markdown sections
|
|
150
|
+
- `frontmatter` - Extract only frontmatter
|
|
151
|
+
- `body` - Extract only body content
|
|
152
|
+
|
|
153
|
+
#### Validation
|
|
154
|
+
- `validate` - Validate against basic schema
|
|
155
|
+
- `validate-schema(path)` - Validate against JSON schema at path
|
|
156
|
+
|
|
157
|
+
**Custom transforms:**
|
|
158
|
+
Register via `handler` field for complex logic.
|
|
159
|
+
|
|
160
|
+
### `map` (array)
|
|
161
|
+
|
|
162
|
+
MongoDB-inspired transformation pipeline for document field operations.
|
|
163
|
+
|
|
164
|
+
**Pipeline structure:**
|
|
165
|
+
```jsonc
|
|
166
|
+
{
|
|
167
|
+
"map": [
|
|
168
|
+
{ "$operation1": config },
|
|
169
|
+
{ "$operation2": config },
|
|
170
|
+
...
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Core concept:** Map is an **array of operations** that execute sequentially on the entire document. Each operation performs a specific transformation.
|
|
176
|
+
|
|
177
|
+
#### Operation 1: `$set` - Set Field Values
|
|
178
|
+
|
|
179
|
+
Set one or more field values with context variable support:
|
|
180
|
+
|
|
181
|
+
```jsonc
|
|
182
|
+
// Single field with context variable
|
|
183
|
+
{ "$set": { "name": "$$filename" } }
|
|
184
|
+
|
|
185
|
+
// Multiple fields
|
|
186
|
+
{ "$set": {
|
|
187
|
+
"name": "$$filename",
|
|
188
|
+
"version": "1.0.0"
|
|
189
|
+
}}
|
|
190
|
+
|
|
191
|
+
// Nested fields (dot notation)
|
|
192
|
+
{ "$set": { "config.model": "sonnet" } }
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Context variables** (use `$$` prefix):
|
|
196
|
+
- `$$filename` - Filename without extension
|
|
197
|
+
- `$$dirname` - Parent directory name
|
|
198
|
+
- `$$path` - Full relative path
|
|
199
|
+
- `$$ext` - File extension (including dot)
|
|
200
|
+
|
|
201
|
+
#### Operation 2: `$rename` - Rename Fields
|
|
202
|
+
|
|
203
|
+
Rename fields with wildcard support:
|
|
204
|
+
|
|
205
|
+
```jsonc
|
|
206
|
+
// Simple rename
|
|
207
|
+
{ "$rename": { "oldName": "newName" } }
|
|
208
|
+
|
|
209
|
+
// Multiple renames
|
|
210
|
+
{ "$rename": {
|
|
211
|
+
"old1": "new1",
|
|
212
|
+
"old2": "new2"
|
|
213
|
+
}}
|
|
214
|
+
|
|
215
|
+
// Nested paths
|
|
216
|
+
{ "$rename": { "config.ai.model": "settings.model" } }
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Before:**
|
|
220
|
+
```json
|
|
221
|
+
{ "mcp": { "server1": {}, "server2": {} } }
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**After:**
|
|
225
|
+
```json
|
|
226
|
+
{ "mcpServers": { "server1": {}, "server2": {} } }
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### Operation 3: `$unset` - Remove Fields
|
|
230
|
+
|
|
231
|
+
Remove one or more fields:
|
|
232
|
+
|
|
233
|
+
```jsonc
|
|
234
|
+
// Single field
|
|
235
|
+
{ "$unset": "permission" }
|
|
236
|
+
|
|
237
|
+
// Multiple fields
|
|
238
|
+
{ "$unset": ["permission", "legacy", "temp"] }
|
|
239
|
+
|
|
240
|
+
// Nested field
|
|
241
|
+
{ "$unset": "config.deprecated" }
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
#### Operation 4: `$switch` - Pattern Matching
|
|
245
|
+
|
|
246
|
+
Conditional field replacement based on patterns. **First match wins.**
|
|
247
|
+
|
|
248
|
+
```jsonc
|
|
249
|
+
{
|
|
250
|
+
"$switch": {
|
|
251
|
+
"field": "model",
|
|
252
|
+
"cases": [
|
|
253
|
+
{ "pattern": "anthropic/claude-sonnet-*", "value": "sonnet" },
|
|
254
|
+
{ "pattern": "anthropic/claude-opus-*", "value": "opus" }
|
|
255
|
+
],
|
|
256
|
+
"default": "inherit"
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**Pattern types:**
|
|
262
|
+
- **String patterns**: Glob syntax (`*`, `?`)
|
|
263
|
+
- **Object patterns**: Match object shape
|
|
264
|
+
- `{ "edit": "deny", "bash": "deny" }` - exact match
|
|
265
|
+
- `{ "*": "deny" }` - all values must be "deny"
|
|
266
|
+
- **Wildcard**: `"*"` matches anything
|
|
267
|
+
|
|
268
|
+
**Before:**
|
|
269
|
+
```yaml
|
|
270
|
+
model: anthropic/claude-sonnet-4-20250514
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
**After:**
|
|
274
|
+
```yaml
|
|
275
|
+
model: sonnet
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
#### Operation 5: `$pipeline` - Field Transformation Pipeline
|
|
279
|
+
|
|
280
|
+
Transform a field through a pipeline of MongoDB-aligned operations:
|
|
281
|
+
|
|
282
|
+
```jsonc
|
|
283
|
+
{
|
|
284
|
+
"$pipeline": {
|
|
285
|
+
"field": "tools",
|
|
286
|
+
"operations": [
|
|
287
|
+
{ "$filter": { "match": { "value": true } } },
|
|
288
|
+
{ "$objectToArray": { "extract": "keys" } },
|
|
289
|
+
{ "$map": { "each": "capitalize" } },
|
|
290
|
+
{ "$reduce": { "type": "join", "separator": ", " } }
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
**Pipeline operations:**
|
|
297
|
+
|
|
298
|
+
| Operation | Purpose | Example |
|
|
299
|
+
|-----------|---------|---------|
|
|
300
|
+
| `{ "$filter": { "match": { "value": X } } }` | Keep entries where value equals X | Filter true values |
|
|
301
|
+
| `{ "$filter": { "match": { "key": X } } }` | Keep entries where key equals X | Filter by key name |
|
|
302
|
+
| `{ "$objectToArray": { "extract": "keys" } }` | Extract object keys to array | `{a:1, b:2}` → `["a","b"]` |
|
|
303
|
+
| `{ "$objectToArray": { "extract": "values" } }` | Extract values to array | `{a:1, b:2}` → `[1,2]` |
|
|
304
|
+
| `{ "$objectToArray": { "extract": "entries" } }` | Convert to entries | `{a:1}` → `[["a",1]]` |
|
|
305
|
+
| `{ "$map": { "each": "capitalize" } }` | Transform each element | Capitalize strings |
|
|
306
|
+
| `{ "$map": { "each": "uppercase" } }` | Transform each element | Uppercase strings |
|
|
307
|
+
| `{ "$map": { "each": "lowercase" } }` | Transform each element | Lowercase strings |
|
|
308
|
+
| `{ "$reduce": { "type": "join", "separator": "," } }` | Join array to string | Join with separator |
|
|
309
|
+
| `{ "$reduce": { "type": "split", "separator": "," } }` | Split string to array | Split by separator |
|
|
310
|
+
| `{ "$arrayToObject": { "value": X } }` | Array to object | `["a","b"]` → `{a:X, b:X}` |
|
|
311
|
+
| `{ "$replace": { "pattern": "...", "with": "..." } }` | Regex replace | String transformation |
|
|
312
|
+
|
|
313
|
+
**Before:**
|
|
314
|
+
```yaml
|
|
315
|
+
tools:
|
|
316
|
+
write: false
|
|
317
|
+
bash: true
|
|
318
|
+
read: true
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
**After:**
|
|
322
|
+
```yaml
|
|
323
|
+
tools: Bash, Read
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
#### Operation 6: `$copy` - Copy with Transformation
|
|
327
|
+
|
|
328
|
+
Copy a field with optional pattern-based transformation:
|
|
329
|
+
|
|
330
|
+
```jsonc
|
|
331
|
+
{
|
|
332
|
+
"$copy": {
|
|
333
|
+
"from": "permission",
|
|
334
|
+
"to": "permissionMode",
|
|
335
|
+
"transform": {
|
|
336
|
+
"cases": [
|
|
337
|
+
{ "pattern": { "edit": "deny", "bash": "deny" }, "value": "plan" },
|
|
338
|
+
{ "pattern": { "*": "deny" }, "value": "ignore" }
|
|
339
|
+
],
|
|
340
|
+
"default": "default"
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
**Combine with `$unset` to replace fields:**
|
|
347
|
+
|
|
348
|
+
```jsonc
|
|
349
|
+
[
|
|
350
|
+
{ "$copy": { "from": "old", "to": "new" } },
|
|
351
|
+
{ "$unset": "old" }
|
|
352
|
+
]
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
#### Complete Pipeline Example
|
|
356
|
+
|
|
357
|
+
```jsonc
|
|
358
|
+
{
|
|
359
|
+
"from": "agents/**/*.md",
|
|
360
|
+
"to": ".claude/agents/**/*.md",
|
|
361
|
+
"map": [
|
|
362
|
+
{ "$set": { "name": "$$filename" } },
|
|
363
|
+
{
|
|
364
|
+
"$switch": {
|
|
365
|
+
"field": "model",
|
|
366
|
+
"cases": [
|
|
367
|
+
{ "pattern": "anthropic/claude-sonnet-*", "value": "sonnet" }
|
|
368
|
+
],
|
|
369
|
+
"default": "inherit"
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
"$pipeline": {
|
|
374
|
+
"field": "tools",
|
|
375
|
+
"operations": [
|
|
376
|
+
{ "$filter": { "match": { "value": true } } },
|
|
377
|
+
{ "$objectToArray": { "extract": "keys" } },
|
|
378
|
+
{ "$map": { "each": "capitalize" } },
|
|
379
|
+
{ "$reduce": { "type": "join", "separator": ", " } }
|
|
380
|
+
]
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"$copy": {
|
|
385
|
+
"from": "permission",
|
|
386
|
+
"to": "permissionMode",
|
|
387
|
+
"transform": {
|
|
388
|
+
"cases": [
|
|
389
|
+
{ "pattern": { "edit": "deny", "bash": "deny" }, "value": "plan" }
|
|
390
|
+
],
|
|
391
|
+
"default": "default"
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
{ "$unset": "permission" }
|
|
396
|
+
]
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
**Schema:** Map pipelines are validated against `schemas/map-pipeline-v1.json`.
|
|
401
|
+
|
|
402
|
+
**See also:** [Map Pipeline Guide](./map-pipeline.md) for comprehensive documentation and examples.
|
|
403
|
+
|
|
404
|
+
### `pick` (string[])
|
|
405
|
+
|
|
406
|
+
Whitelist specific keys (extract only these).
|
|
407
|
+
|
|
408
|
+
**Example:**
|
|
409
|
+
```jsonc
|
|
410
|
+
{
|
|
411
|
+
"pick": ["theme", "fontSize", "tabSize"]
|
|
412
|
+
}
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
**Before:**
|
|
416
|
+
```json
|
|
417
|
+
{
|
|
418
|
+
"theme": "dark",
|
|
419
|
+
"fontSize": 14,
|
|
420
|
+
"internal": "debug",
|
|
421
|
+
"deprecated": true
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
**After:**
|
|
426
|
+
```json
|
|
427
|
+
{
|
|
428
|
+
"theme": "dark",
|
|
429
|
+
"fontSize": 14
|
|
430
|
+
}
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
**Nested keys:**
|
|
434
|
+
```jsonc
|
|
435
|
+
{
|
|
436
|
+
"pick": ["editor.theme", "editor.fontSize"]
|
|
437
|
+
}
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
**Cannot use with `omit`.**
|
|
441
|
+
|
|
442
|
+
### `omit` (string[])
|
|
443
|
+
|
|
444
|
+
Blacklist specific keys (exclude these).
|
|
445
|
+
|
|
446
|
+
**Example:**
|
|
447
|
+
```jsonc
|
|
448
|
+
{
|
|
449
|
+
"omit": ["internal", "debug", "deprecated"]
|
|
450
|
+
}
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
**Before:**
|
|
454
|
+
```json
|
|
455
|
+
{
|
|
456
|
+
"theme": "dark",
|
|
457
|
+
"fontSize": 14,
|
|
458
|
+
"internal": "debug"
|
|
459
|
+
}
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
**After:**
|
|
463
|
+
```json
|
|
464
|
+
{
|
|
465
|
+
"theme": "dark",
|
|
466
|
+
"fontSize": 14
|
|
467
|
+
}
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
**Cannot use with `pick`.**
|
|
471
|
+
|
|
472
|
+
### `path` (string)
|
|
473
|
+
|
|
474
|
+
JSONPath expression to extract subset of data.
|
|
475
|
+
|
|
476
|
+
**Syntax:** JSONPath (subset of XPath for JSON)
|
|
477
|
+
|
|
478
|
+
**Example:**
|
|
479
|
+
```jsonc
|
|
480
|
+
{
|
|
481
|
+
"path": "$.editor"
|
|
482
|
+
}
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
**Before:**
|
|
486
|
+
```json
|
|
487
|
+
{
|
|
488
|
+
"editor": {
|
|
489
|
+
"theme": "dark",
|
|
490
|
+
"fontSize": 14
|
|
491
|
+
},
|
|
492
|
+
"terminal": {
|
|
493
|
+
"shell": "bash"
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
**After:**
|
|
499
|
+
```json
|
|
500
|
+
{
|
|
501
|
+
"theme": "dark",
|
|
502
|
+
"fontSize": 14
|
|
503
|
+
}
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
**Common expressions:**
|
|
507
|
+
```jsonc
|
|
508
|
+
"$.editor" // Extract editor object
|
|
509
|
+
"$.servers.*" // All servers
|
|
510
|
+
"$.servers[0]" // First server
|
|
511
|
+
"$.servers[?(@.enabled)]" // Servers where enabled=true
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
**Libraries:** Typically uses `jsonpath-plus` or similar.
|
|
515
|
+
|
|
516
|
+
### `embed` (string)
|
|
517
|
+
|
|
518
|
+
Wrap content under specified key.
|
|
519
|
+
|
|
520
|
+
**Example:**
|
|
521
|
+
```jsonc
|
|
522
|
+
{
|
|
523
|
+
"embed": "mcp"
|
|
524
|
+
}
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
**Before:**
|
|
528
|
+
```json
|
|
529
|
+
{ "servers": { "db": {} } }
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
**After:**
|
|
533
|
+
```json
|
|
534
|
+
{
|
|
535
|
+
"mcp": {
|
|
536
|
+
"servers": { "db": {} }
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
**Use case:** Embed package content in larger configuration structure.
|
|
542
|
+
|
|
543
|
+
**With merge:**
|
|
544
|
+
```jsonc
|
|
545
|
+
{
|
|
546
|
+
"embed": "mcp",
|
|
547
|
+
"merge": "deep"
|
|
548
|
+
}
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
**Existing target:**
|
|
552
|
+
```json
|
|
553
|
+
{ "other": "config" }
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
**Result:**
|
|
557
|
+
```json
|
|
558
|
+
{
|
|
559
|
+
"other": "config",
|
|
560
|
+
"mcp": {
|
|
561
|
+
"servers": { "db": {} }
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### `section` (string)
|
|
567
|
+
|
|
568
|
+
TOML section name for embedding.
|
|
569
|
+
|
|
570
|
+
**Example:**
|
|
571
|
+
```jsonc
|
|
572
|
+
{
|
|
573
|
+
"section": "mcp_servers"
|
|
574
|
+
}
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
**Before (JSON):**
|
|
578
|
+
```json
|
|
579
|
+
{ "host": "localhost", "port": 5432 }
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
**After (TOML):**
|
|
583
|
+
```toml
|
|
584
|
+
[mcp_servers]
|
|
585
|
+
host = "localhost"
|
|
586
|
+
port = 5432
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
**Use case:** Convert JSON/YAML to TOML sections.
|
|
590
|
+
|
|
591
|
+
### `when` (object)
|
|
592
|
+
|
|
593
|
+
Conditional execution based on context.
|
|
594
|
+
|
|
595
|
+
**Condition types:**
|
|
596
|
+
|
|
597
|
+
#### Platform check
|
|
598
|
+
```jsonc
|
|
599
|
+
{
|
|
600
|
+
"when": { "platform": "cursor" }
|
|
601
|
+
}
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
Executes only if Cursor platform detected.
|
|
605
|
+
|
|
606
|
+
#### File existence
|
|
607
|
+
```jsonc
|
|
608
|
+
{
|
|
609
|
+
"when": { "exists": ".cursor" }
|
|
610
|
+
}
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
Executes only if `.cursor` directory exists.
|
|
614
|
+
|
|
615
|
+
#### Key existence
|
|
616
|
+
```jsonc
|
|
617
|
+
{
|
|
618
|
+
"when": { "key": "servers" }
|
|
619
|
+
}
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
Executes only if source has `servers` key.
|
|
623
|
+
|
|
624
|
+
#### Value equality
|
|
625
|
+
```jsonc
|
|
626
|
+
{
|
|
627
|
+
"when": {
|
|
628
|
+
"key": "env",
|
|
629
|
+
"equals": "production"
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
Executes only if `env` field equals `"production"`.
|
|
635
|
+
|
|
636
|
+
#### Composite AND
|
|
637
|
+
```jsonc
|
|
638
|
+
{
|
|
639
|
+
"when": {
|
|
640
|
+
"and": [
|
|
641
|
+
{ "platform": "cursor" },
|
|
642
|
+
{ "exists": "mcp.jsonc" }
|
|
643
|
+
]
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
All conditions must be true.
|
|
649
|
+
|
|
650
|
+
#### Composite OR
|
|
651
|
+
```jsonc
|
|
652
|
+
{
|
|
653
|
+
"when": {
|
|
654
|
+
"or": [
|
|
655
|
+
{ "platform": "cursor" },
|
|
656
|
+
{ "platform": "claude" }
|
|
657
|
+
]
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
Any condition can be true.
|
|
663
|
+
|
|
664
|
+
**Schema:**
|
|
665
|
+
```typescript
|
|
666
|
+
type Condition =
|
|
667
|
+
| { platform: string }
|
|
668
|
+
| { exists: string }
|
|
669
|
+
| { key: string; equals?: any }
|
|
670
|
+
| { and: Condition[] }
|
|
671
|
+
| { or: Condition[] }
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
### `merge` (string)
|
|
675
|
+
|
|
676
|
+
Merge strategy when target file exists.
|
|
677
|
+
|
|
678
|
+
**Options:**
|
|
679
|
+
- `"deep"` - Recursive merge (default for objects)
|
|
680
|
+
- `"shallow"` - Top-level merge only
|
|
681
|
+
- `"replace"` - Overwrite entirely (default for primitives/arrays)
|
|
682
|
+
- `"composite"` - Compose multiple packages using delimiters
|
|
683
|
+
|
|
684
|
+
**Deep merge:**
|
|
685
|
+
```jsonc
|
|
686
|
+
{ "merge": "deep" }
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
**Existing:**
|
|
690
|
+
```json
|
|
691
|
+
{
|
|
692
|
+
"servers": {
|
|
693
|
+
"db": { "host": "localhost" }
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
**New:**
|
|
699
|
+
```json
|
|
700
|
+
{
|
|
701
|
+
"servers": {
|
|
702
|
+
"db": { "port": 5432 },
|
|
703
|
+
"api": { "host": "api.example.com" }
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
**Result:**
|
|
709
|
+
```json
|
|
710
|
+
{
|
|
711
|
+
"servers": {
|
|
712
|
+
"db": { "host": "localhost", "port": 5432 },
|
|
713
|
+
"api": { "host": "api.example.com" }
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
**Shallow merge:**
|
|
719
|
+
```jsonc
|
|
720
|
+
{ "merge": "shallow" }
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
**Result (shallow):**
|
|
724
|
+
```json
|
|
725
|
+
{
|
|
726
|
+
"servers": {
|
|
727
|
+
"db": { "port": 5432 },
|
|
728
|
+
"api": { "host": "api.example.com" }
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
Note: `db` object replaced entirely.
|
|
734
|
+
|
|
735
|
+
**Replace:**
|
|
736
|
+
```jsonc
|
|
737
|
+
{ "merge": "replace" }
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
**Result:**
|
|
741
|
+
```json
|
|
742
|
+
{
|
|
743
|
+
"servers": {
|
|
744
|
+
"db": { "port": 5432 },
|
|
745
|
+
"api": { "host": "api.example.com" }
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
Entire file replaced.
|
|
751
|
+
|
|
752
|
+
### `namespace` (boolean | string)
|
|
753
|
+
|
|
754
|
+
Wrap content under package-specific namespace.
|
|
755
|
+
|
|
756
|
+
**Boolean (auto-generate key):**
|
|
757
|
+
```jsonc
|
|
758
|
+
{
|
|
759
|
+
"namespace": true
|
|
760
|
+
}
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
**Result:**
|
|
764
|
+
```json
|
|
765
|
+
{
|
|
766
|
+
"packages": {
|
|
767
|
+
"@user/package-name": {
|
|
768
|
+
/* content */
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
```
|
|
773
|
+
|
|
774
|
+
**String (custom namespace key):**
|
|
775
|
+
```jsonc
|
|
776
|
+
{
|
|
777
|
+
"namespace": "extensions"
|
|
778
|
+
}
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
**Result:**
|
|
782
|
+
```json
|
|
783
|
+
{
|
|
784
|
+
"extensions": {
|
|
785
|
+
"@user/package-name": {
|
|
786
|
+
/* content */
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
**Use case:** Prevent collisions when multiple packages write to same file.
|
|
793
|
+
|
|
794
|
+
**With merge:**
|
|
795
|
+
```jsonc
|
|
796
|
+
{
|
|
797
|
+
"namespace": true,
|
|
798
|
+
"merge": "deep"
|
|
799
|
+
}
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
Merges namespaced content from multiple packages.
|
|
803
|
+
|
|
804
|
+
### `handler` (string)
|
|
805
|
+
|
|
806
|
+
Custom handler function for complex transformations.
|
|
807
|
+
|
|
808
|
+
**Example:**
|
|
809
|
+
```jsonc
|
|
810
|
+
{
|
|
811
|
+
"handler": "custom-mcp-transform"
|
|
812
|
+
}
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
**Use case:** Complex logic not expressible via declarative options.
|
|
816
|
+
|
|
817
|
+
**Registration:**
|
|
818
|
+
```typescript
|
|
819
|
+
// In CLI code
|
|
820
|
+
registerHandler("custom-mcp-transform", (source, context) => {
|
|
821
|
+
// Custom transformation logic
|
|
822
|
+
return transformed;
|
|
823
|
+
});
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
**Not available in user configurations** - requires CLI code changes.
|
|
827
|
+
|
|
828
|
+
## Value Transforms
|
|
829
|
+
|
|
830
|
+
Used in `map` field for value transformations.
|
|
831
|
+
|
|
832
|
+
### Type Converters
|
|
833
|
+
|
|
834
|
+
- `number` - Convert to number
|
|
835
|
+
- `string` - Convert to string
|
|
836
|
+
- `boolean` - Convert to boolean
|
|
837
|
+
- `json` - Parse JSON string to object
|
|
838
|
+
- `date` - Parse date string to Date
|
|
839
|
+
|
|
840
|
+
**Example:**
|
|
841
|
+
```jsonc
|
|
842
|
+
{
|
|
843
|
+
"map": {
|
|
844
|
+
"fontSize": {
|
|
845
|
+
"to": "editor.fontSize",
|
|
846
|
+
"transform": "number"
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
### String Transforms
|
|
853
|
+
|
|
854
|
+
- `uppercase` - Convert to UPPERCASE
|
|
855
|
+
- `lowercase` - Convert to lowercase
|
|
856
|
+
- `title-case` - Convert To Title Case
|
|
857
|
+
- `camel-case` - Convert to camelCase
|
|
858
|
+
- `kebab-case` - Convert to kebab-case
|
|
859
|
+
- `snake-case` - Convert to snake_case
|
|
860
|
+
- `trim` - Remove leading/trailing whitespace
|
|
861
|
+
- `slugify` - Create URL-safe slug
|
|
862
|
+
|
|
863
|
+
**Example:**
|
|
864
|
+
```jsonc
|
|
865
|
+
{
|
|
866
|
+
"map": {
|
|
867
|
+
"name": {
|
|
868
|
+
"to": "id",
|
|
869
|
+
"transform": "kebab-case"
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
```
|
|
874
|
+
|
|
875
|
+
**Before:**
|
|
876
|
+
```json
|
|
877
|
+
{ "name": "My Custom Rule" }
|
|
878
|
+
```
|
|
879
|
+
|
|
880
|
+
**After:**
|
|
881
|
+
```json
|
|
882
|
+
{ "id": "my-custom-rule" }
|
|
883
|
+
```
|
|
884
|
+
|
|
885
|
+
### Array Transforms
|
|
886
|
+
|
|
887
|
+
- `array-append` - Append to existing array
|
|
888
|
+
- `array-unique` - Remove duplicates
|
|
889
|
+
- `array-flatten` - Flatten nested arrays
|
|
890
|
+
|
|
891
|
+
**Example:**
|
|
892
|
+
```jsonc
|
|
893
|
+
{
|
|
894
|
+
"map": {
|
|
895
|
+
"tags": {
|
|
896
|
+
"to": "categories",
|
|
897
|
+
"transform": "array-unique"
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
```
|
|
902
|
+
|
|
903
|
+
**Before:**
|
|
904
|
+
```json
|
|
905
|
+
{ "tags": ["typescript", "quality", "typescript"] }
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
**After:**
|
|
909
|
+
```json
|
|
910
|
+
{ "categories": ["typescript", "quality"] }
|
|
911
|
+
```
|
|
912
|
+
|
|
913
|
+
### Object Transforms
|
|
914
|
+
|
|
915
|
+
- `flatten` - Flatten nested object to dot notation
|
|
916
|
+
- `unflatten` - Expand dot notation to nested object
|
|
917
|
+
- `pick-keys` - Extract specific keys
|
|
918
|
+
- `omit-keys` - Remove specific keys
|
|
919
|
+
|
|
920
|
+
**Flatten example:**
|
|
921
|
+
```jsonc
|
|
922
|
+
{
|
|
923
|
+
"map": {
|
|
924
|
+
"config": {
|
|
925
|
+
"to": "settings",
|
|
926
|
+
"transform": "flatten"
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
```
|
|
931
|
+
|
|
932
|
+
**Before:**
|
|
933
|
+
```json
|
|
934
|
+
{
|
|
935
|
+
"config": {
|
|
936
|
+
"editor": { "theme": "dark" }
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
```
|
|
940
|
+
|
|
941
|
+
**After:**
|
|
942
|
+
```json
|
|
943
|
+
{
|
|
944
|
+
"settings": {
|
|
945
|
+
"editor.theme": "dark"
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
## Complete Examples
|
|
951
|
+
|
|
952
|
+
### Example 1: Simple File Copy with Extension Change
|
|
953
|
+
|
|
954
|
+
```jsonc
|
|
955
|
+
{
|
|
956
|
+
"from": "rules/**/*.md",
|
|
957
|
+
"to": ".cursor/rules/**/*.mdc"
|
|
958
|
+
}
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
**Behavior:**
|
|
962
|
+
- Recursively copies all `.md` files from `rules/` directory and subdirectories
|
|
963
|
+
- Preserves nested directory structure
|
|
964
|
+
- Changes extension from `.md` to `.mdc`
|
|
965
|
+
- No content transformation
|
|
966
|
+
|
|
967
|
+
**Example structure:**
|
|
968
|
+
```
|
|
969
|
+
Package: Workspace:
|
|
970
|
+
rules/ .cursor/rules/
|
|
971
|
+
├── typescript.md → ├── typescript.mdc
|
|
972
|
+
├── advanced/ → ├── advanced/
|
|
973
|
+
│ └── generics.md → │ └── generics.mdc
|
|
974
|
+
└── basic/ → └── basic/
|
|
975
|
+
└── variables.md → └── variables.mdc
|
|
976
|
+
```
|
|
977
|
+
|
|
978
|
+
### Example 2: Format Conversion with Key Mapping
|
|
979
|
+
|
|
980
|
+
```jsonc
|
|
981
|
+
{
|
|
982
|
+
"from": "settings.yaml",
|
|
983
|
+
"to": ".cursor/settings.json",
|
|
984
|
+
"map": {
|
|
985
|
+
"theme": "workbench.colorTheme",
|
|
986
|
+
"fontSize": "editor.fontSize"
|
|
987
|
+
},
|
|
988
|
+
"merge": "deep"
|
|
989
|
+
}
|
|
990
|
+
```
|
|
991
|
+
|
|
992
|
+
**Behavior:**
|
|
993
|
+
- Converts YAML to JSON
|
|
994
|
+
- Remaps keys to nested paths
|
|
995
|
+
- Deep merges with existing settings
|
|
996
|
+
|
|
997
|
+
### Example 3: Multi-Package MCP Composition
|
|
998
|
+
|
|
999
|
+
```jsonc
|
|
1000
|
+
{
|
|
1001
|
+
"from": "mcp.jsonc",
|
|
1002
|
+
"to": ".cursor/mcp.json",
|
|
1003
|
+
"namespace": true,
|
|
1004
|
+
"merge": "deep"
|
|
1005
|
+
}
|
|
1006
|
+
```
|
|
1007
|
+
|
|
1008
|
+
**Behavior:**
|
|
1009
|
+
- Wraps content under `packages.{packageName}`
|
|
1010
|
+
- Merges with other packages
|
|
1011
|
+
- Prevents naming conflicts
|
|
1012
|
+
|
|
1013
|
+
### Example 4: Conditional Platform Flow
|
|
1014
|
+
|
|
1015
|
+
```jsonc
|
|
1016
|
+
{
|
|
1017
|
+
"from": "config.yaml",
|
|
1018
|
+
"to": ".cursor/config.json",
|
|
1019
|
+
"when": {
|
|
1020
|
+
"and": [
|
|
1021
|
+
{ "platform": "cursor" },
|
|
1022
|
+
{ "exists": "config.yaml" }
|
|
1023
|
+
]
|
|
1024
|
+
},
|
|
1025
|
+
"merge": "deep"
|
|
1026
|
+
}
|
|
1027
|
+
```
|
|
1028
|
+
|
|
1029
|
+
**Behavior:**
|
|
1030
|
+
- Executes only for Cursor platform
|
|
1031
|
+
- Checks source file exists
|
|
1032
|
+
- Deep merges configuration
|
|
1033
|
+
|
|
1034
|
+
### Example 5: Multi-Target with Different Transforms
|
|
1035
|
+
|
|
1036
|
+
```jsonc
|
|
1037
|
+
{
|
|
1038
|
+
"from": "mcp.jsonc",
|
|
1039
|
+
"to": {
|
|
1040
|
+
".cursor/mcp.json": {
|
|
1041
|
+
"namespace": true,
|
|
1042
|
+
"merge": "deep"
|
|
1043
|
+
},
|
|
1044
|
+
".opencode/opencode.json": {
|
|
1045
|
+
"embed": "mcp",
|
|
1046
|
+
"merge": "deep"
|
|
1047
|
+
},
|
|
1048
|
+
".codex/config.toml": {
|
|
1049
|
+
"path": "$.servers",
|
|
1050
|
+
"section": "mcp_servers",
|
|
1051
|
+
"merge": "deep"
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
```
|
|
1056
|
+
|
|
1057
|
+
**Behavior:**
|
|
1058
|
+
- Parses source once
|
|
1059
|
+
- Cursor: Namespaced JSON
|
|
1060
|
+
- OpenCode: Embedded in JSON
|
|
1061
|
+
- Codex: Extracted servers in TOML section
|
|
1062
|
+
|
|
1063
|
+
### Example 6: Markdown Frontmatter Transform
|
|
1064
|
+
|
|
1065
|
+
```jsonc
|
|
1066
|
+
{
|
|
1067
|
+
"from": "agents/**/*.md",
|
|
1068
|
+
"to": ".claude/agents/**/*.md",
|
|
1069
|
+
"map": [
|
|
1070
|
+
{ "$set": { "name": "$$filename" } },
|
|
1071
|
+
{
|
|
1072
|
+
"$switch": {
|
|
1073
|
+
"field": "model",
|
|
1074
|
+
"cases": [
|
|
1075
|
+
{ "pattern": "anthropic/claude-sonnet-*", "value": "sonnet" },
|
|
1076
|
+
{ "pattern": "anthropic/claude-opus-*", "value": "opus" }
|
|
1077
|
+
],
|
|
1078
|
+
"default": "inherit"
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
]
|
|
1082
|
+
}
|
|
1083
|
+
```
|
|
1084
|
+
|
|
1085
|
+
**Behavior:**
|
|
1086
|
+
- Transforms YAML frontmatter using map pipeline
|
|
1087
|
+
- Sets `name` from filename
|
|
1088
|
+
- Transforms model field using pattern matching
|
|
1089
|
+
- Preserves markdown body
|
|
1090
|
+
|
|
1091
|
+
### Example 7: Recursive Directory Copy with Mixed File Types
|
|
1092
|
+
|
|
1093
|
+
```jsonc
|
|
1094
|
+
{
|
|
1095
|
+
"from": "skills/**/*",
|
|
1096
|
+
"to": ".claude/skills/**/*"
|
|
1097
|
+
}
|
|
1098
|
+
```
|
|
1099
|
+
|
|
1100
|
+
**Behavior:**
|
|
1101
|
+
- Recursively copies all files from `skills/` directory
|
|
1102
|
+
- Preserves all file types (.md, .ts, .json, etc.)
|
|
1103
|
+
- Maintains complete directory structure
|
|
1104
|
+
- No content transformation
|
|
1105
|
+
|
|
1106
|
+
**Example structure:**
|
|
1107
|
+
```
|
|
1108
|
+
Package: Workspace:
|
|
1109
|
+
skills/ .claude/skills/
|
|
1110
|
+
├── code-review/ → ├── code-review/
|
|
1111
|
+
│ ├── analyze.md → │ ├── analyze.md
|
|
1112
|
+
│ ├── config.json → │ ├── config.json
|
|
1113
|
+
│ └── helpers/ → │ └── helpers/
|
|
1114
|
+
│ └── utils.ts → │ └── utils.ts
|
|
1115
|
+
└── testing/ → └── testing/
|
|
1116
|
+
└── test-gen.md → └── test-gen.md
|
|
1117
|
+
```
|
|
1118
|
+
|
|
1119
|
+
### Example 8: Complex Map Pipeline
|
|
1120
|
+
|
|
1121
|
+
```jsonc
|
|
1122
|
+
{
|
|
1123
|
+
"from": "config.jsonc",
|
|
1124
|
+
"to": ".cursor/config.json",
|
|
1125
|
+
"pick": ["editor", "terminal"],
|
|
1126
|
+
"map": [
|
|
1127
|
+
{ "$rename": { "editor.theme": "workbench.colorTheme" } },
|
|
1128
|
+
{ "$pipe": ["filter-empty", "filter-null"] }
|
|
1129
|
+
],
|
|
1130
|
+
"merge": "deep"
|
|
1131
|
+
}
|
|
1132
|
+
```
|
|
1133
|
+
|
|
1134
|
+
**Behavior:**
|
|
1135
|
+
- Extracts only `editor` and `terminal` keys
|
|
1136
|
+
- Renames nested theme key using map pipeline
|
|
1137
|
+
- Filters empty/null values using $pipe operation
|
|
1138
|
+
- Deep merges result
|
|
1139
|
+
|
|
1140
|
+
## Best Practices
|
|
1141
|
+
|
|
1142
|
+
### 1. Keep Flows Simple
|
|
1143
|
+
|
|
1144
|
+
Start with minimal options:
|
|
1145
|
+
```jsonc
|
|
1146
|
+
{ "from": "rules/**/*.md", "to": ".platform/rules/**/*.md" }
|
|
1147
|
+
```
|
|
1148
|
+
|
|
1149
|
+
Add complexity only when needed.
|
|
1150
|
+
|
|
1151
|
+
### 2. Use Merge for Composition
|
|
1152
|
+
|
|
1153
|
+
Enable multiple packages to coexist:
|
|
1154
|
+
```jsonc
|
|
1155
|
+
{ "merge": "deep" }
|
|
1156
|
+
```
|
|
1157
|
+
|
|
1158
|
+
### 3. Namespace for Safety
|
|
1159
|
+
|
|
1160
|
+
Prevent conflicts:
|
|
1161
|
+
```jsonc
|
|
1162
|
+
{ "namespace": true, "merge": "deep" }
|
|
1163
|
+
```
|
|
1164
|
+
|
|
1165
|
+
### 4. Test Conditionals
|
|
1166
|
+
|
|
1167
|
+
Ensure conditions work as expected:
|
|
1168
|
+
```bash
|
|
1169
|
+
opkg install @user/package --dry-run
|
|
1170
|
+
```
|
|
1171
|
+
|
|
1172
|
+
### 5. Document Complex Flows
|
|
1173
|
+
|
|
1174
|
+
Add comments explaining intent:
|
|
1175
|
+
```jsonc
|
|
1176
|
+
{
|
|
1177
|
+
// Transform MCP config with namespacing for multi-package support
|
|
1178
|
+
"from": "mcp.jsonc",
|
|
1179
|
+
"to": ".cursor/mcp.json",
|
|
1180
|
+
"namespace": true,
|
|
1181
|
+
"merge": "deep"
|
|
1182
|
+
}
|
|
1183
|
+
```
|
|
1184
|
+
|
|
1185
|
+
### 6. Validate Configurations
|
|
1186
|
+
|
|
1187
|
+
Always validate before deploying:
|
|
1188
|
+
```bash
|
|
1189
|
+
opkg validate platforms --strict
|
|
1190
|
+
```
|
|
1191
|
+
|
|
1192
|
+
## Performance Tips
|
|
1193
|
+
|
|
1194
|
+
- **Simple flows are fastest** - Direct copy when possible
|
|
1195
|
+
- **Avoid deep merges** if shallow merge sufficient
|
|
1196
|
+
- **Use conditionals** to skip unnecessary work
|
|
1197
|
+
- **Multi-target flows reuse parsing** - More efficient than separate flows
|
|
1198
|
+
|
|
1199
|
+
## Troubleshooting
|
|
1200
|
+
|
|
1201
|
+
### Flow Not Executing
|
|
1202
|
+
|
|
1203
|
+
**Check conditions:**
|
|
1204
|
+
```bash
|
|
1205
|
+
opkg status # Shows detected platforms
|
|
1206
|
+
```
|
|
1207
|
+
|
|
1208
|
+
**Check syntax:**
|
|
1209
|
+
```bash
|
|
1210
|
+
opkg validate platforms
|
|
1211
|
+
```
|
|
1212
|
+
|
|
1213
|
+
### Merge Not Working
|
|
1214
|
+
|
|
1215
|
+
**Remember merge strategy:**
|
|
1216
|
+
- Default is `replace` for arrays/primitives
|
|
1217
|
+
- Use `"merge": "deep"` explicitly for objects
|
|
1218
|
+
|
|
1219
|
+
### Keys Not Mapping
|
|
1220
|
+
|
|
1221
|
+
**Check dot notation:**
|
|
1222
|
+
```jsonc
|
|
1223
|
+
"theme": "workbench.colorTheme" // Correct
|
|
1224
|
+
"theme": "workbench/colorTheme" // Wrong
|
|
1225
|
+
```
|
|
1226
|
+
|
|
1227
|
+
### Transform Not Found
|
|
1228
|
+
|
|
1229
|
+
**Check transform name:**
|
|
1230
|
+
```bash
|
|
1231
|
+
opkg validate platforms --strict
|
|
1232
|
+
```
|
|
1233
|
+
|
|
1234
|
+
Shows available transforms.
|
|
1235
|
+
|
|
1236
|
+
## Next Steps
|
|
1237
|
+
|
|
1238
|
+
- **See practical examples:** [Examples](./examples.md)
|
|
1239
|
+
- **Learn platform detection:** [Detection](./detection.md)
|
|
1240
|
+
- **Debug issues:** [Troubleshooting](./troubleshooting.md)
|