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,622 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Agents
|
|
3
|
+
description: Configure and use specialized agents.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Agents are specialized AI assistants that can be configured for specific tasks and workflows. They allow you to create focused tools with custom prompts, models, and tool access.
|
|
7
|
+
|
|
8
|
+
:::tip
|
|
9
|
+
Use the plan agent to analyze code and review suggestions without making any code changes.
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
You can switch between agents during a session or invoke them with the `@` mention.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Types
|
|
17
|
+
|
|
18
|
+
There are two types of agents in OpenCode; primary agents and subagents.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
### Primary agents
|
|
23
|
+
|
|
24
|
+
Primary agents are the main assistants you interact with directly. You can cycle through them using the **Tab** key, or your configured `switch_agent` keybind. These agents handle your main conversation and can access all configured tools.
|
|
25
|
+
|
|
26
|
+
:::tip
|
|
27
|
+
You can use the **Tab** key to switch between primary agents during a session.
|
|
28
|
+
:::
|
|
29
|
+
|
|
30
|
+
OpenCode comes with two built-in primary agents, **Build** and **Plan**. We'll
|
|
31
|
+
look at these below.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
### Subagents
|
|
36
|
+
|
|
37
|
+
Subagents are specialized assistants that primary agents can invoke for specific tasks. You can also manually invoke them by **@ mentioning** them in your messages.
|
|
38
|
+
|
|
39
|
+
OpenCode comes with two built-in subagents, **General** and **Explore**. We'll look at this below.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Built-in
|
|
44
|
+
|
|
45
|
+
OpenCode comes with two built-in primary agents and two built-in subagents.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
### Build
|
|
50
|
+
|
|
51
|
+
_Mode_: `primary`
|
|
52
|
+
|
|
53
|
+
Build is the **default** primary agent with all tools enabled. This is the standard agent for development work where you need full access to file operations and system commands.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
### Plan
|
|
58
|
+
|
|
59
|
+
_Mode_: `primary`
|
|
60
|
+
|
|
61
|
+
A restricted agent designed for planning and analysis. We use a permission system to give you more control and prevent unintended changes.
|
|
62
|
+
By default, all of the following are set to `ask`:
|
|
63
|
+
|
|
64
|
+
- `file edits`: All writes, patches, and edits
|
|
65
|
+
- `bash`: All bash commands
|
|
66
|
+
|
|
67
|
+
This agent is useful when you want the LLM to analyze code, suggest changes, or create plans without making any actual modifications to your codebase.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### General
|
|
72
|
+
|
|
73
|
+
_Mode_: `subagent`
|
|
74
|
+
|
|
75
|
+
A general-purpose agent for researching complex questions, searching for code, and executing multi-step tasks. Use when searching for keywords or files and you're not confident you'll find the right match in the first few tries.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### Explore
|
|
80
|
+
|
|
81
|
+
_Mode_: `subagent`
|
|
82
|
+
|
|
83
|
+
A fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns, search code for keywords, or answer questions about the codebase.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Usage
|
|
88
|
+
|
|
89
|
+
1. For primary agents, use the **Tab** key to cycle through them during a session. You can also use your configured `switch_agent` keybind.
|
|
90
|
+
|
|
91
|
+
2. Subagents can be invoked:
|
|
92
|
+
- **Automatically** by primary agents for specialized tasks based on their descriptions.
|
|
93
|
+
- Manually by **@ mentioning** a subagent in your message. For example.
|
|
94
|
+
|
|
95
|
+
```txt frame="none"
|
|
96
|
+
@general help me search for this function
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
3. **Navigation between sessions**: When subagents create their own child sessions, you can navigate between the parent session and all child sessions using:
|
|
100
|
+
- **\<Leader>+Right** (or your configured `session_child_cycle` keybind) to cycle forward through parent → child1 → child2 → ... → parent
|
|
101
|
+
- **\<Leader>+Left** (or your configured `session_child_cycle_reverse` keybind) to cycle backward through parent ← child1 ← child2 ← ... ← parent
|
|
102
|
+
|
|
103
|
+
This allows you to seamlessly switch between the main conversation and specialized subagent work.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Configure
|
|
108
|
+
|
|
109
|
+
You can customize the built-in agents or create your own through configuration. Agents can be configured in two ways:
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
### JSON
|
|
114
|
+
|
|
115
|
+
Configure agents in your `opencode.json` config file:
|
|
116
|
+
|
|
117
|
+
```json title="opencode.json"
|
|
118
|
+
{
|
|
119
|
+
"$schema": "https://opencode.ai/config.json",
|
|
120
|
+
"agent": {
|
|
121
|
+
"build": {
|
|
122
|
+
"mode": "primary",
|
|
123
|
+
"model": "anthropic/claude-sonnet-4-20250514",
|
|
124
|
+
"prompt": "{file:./prompts/build.txt}",
|
|
125
|
+
"tools": {
|
|
126
|
+
"write": true,
|
|
127
|
+
"edit": true,
|
|
128
|
+
"bash": true
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"plan": {
|
|
132
|
+
"mode": "primary",
|
|
133
|
+
"model": "anthropic/claude-haiku-4-20250514",
|
|
134
|
+
"tools": {
|
|
135
|
+
"write": false,
|
|
136
|
+
"edit": false,
|
|
137
|
+
"bash": false
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"code-reviewer": {
|
|
141
|
+
"description": "Reviews code for best practices and potential issues",
|
|
142
|
+
"mode": "subagent",
|
|
143
|
+
"model": "anthropic/claude-sonnet-4-20250514",
|
|
144
|
+
"prompt": "You are a code reviewer. Focus on security, performance, and maintainability.",
|
|
145
|
+
"tools": {
|
|
146
|
+
"write": false,
|
|
147
|
+
"edit": false
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### Markdown
|
|
157
|
+
|
|
158
|
+
You can also define agents using markdown files. Place them in:
|
|
159
|
+
|
|
160
|
+
- Global: `~/.config/opencode/agent/`
|
|
161
|
+
- Per-project: `.opencode/agent/`
|
|
162
|
+
|
|
163
|
+
```markdown title="~/.config/opencode/agent/review.md"
|
|
164
|
+
---
|
|
165
|
+
description: Reviews code for quality and best practices
|
|
166
|
+
mode: subagent
|
|
167
|
+
model: anthropic/claude-sonnet-4-20250514
|
|
168
|
+
temperature: 0.1
|
|
169
|
+
tools:
|
|
170
|
+
write: false
|
|
171
|
+
edit: false
|
|
172
|
+
bash: false
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
You are in code review mode. Focus on:
|
|
176
|
+
|
|
177
|
+
- Code quality and best practices
|
|
178
|
+
- Potential bugs and edge cases
|
|
179
|
+
- Performance implications
|
|
180
|
+
- Security considerations
|
|
181
|
+
|
|
182
|
+
Provide constructive feedback without making direct changes.
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
The markdown file name becomes the agent name. For example, `review.md` creates a `review` agent.
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Options
|
|
190
|
+
|
|
191
|
+
Let's look at these configuration options in detail.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
### Description
|
|
196
|
+
|
|
197
|
+
Use the `description` option to provide a brief description of what the agent does and when to use it.
|
|
198
|
+
|
|
199
|
+
```json title="opencode.json"
|
|
200
|
+
{
|
|
201
|
+
"agent": {
|
|
202
|
+
"review": {
|
|
203
|
+
"description": "Reviews code for best practices and potential issues"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
This is a **required** config option.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
### Temperature
|
|
214
|
+
|
|
215
|
+
Control the randomness and creativity of the LLM's responses with the `temperature` config.
|
|
216
|
+
|
|
217
|
+
Lower values make responses more focused and deterministic, while higher values increase creativity and variability.
|
|
218
|
+
|
|
219
|
+
```json title="opencode.json"
|
|
220
|
+
{
|
|
221
|
+
"agent": {
|
|
222
|
+
"plan": {
|
|
223
|
+
"temperature": 0.1
|
|
224
|
+
},
|
|
225
|
+
"creative": {
|
|
226
|
+
"temperature": 0.8
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Temperature values typically range from 0.0 to 1.0:
|
|
233
|
+
|
|
234
|
+
- **0.0-0.2**: Very focused and deterministic responses, ideal for code analysis and planning
|
|
235
|
+
- **0.3-0.5**: Balanced responses with some creativity, good for general development tasks
|
|
236
|
+
- **0.6-1.0**: More creative and varied responses, useful for brainstorming and exploration
|
|
237
|
+
|
|
238
|
+
```json title="opencode.json"
|
|
239
|
+
{
|
|
240
|
+
"agent": {
|
|
241
|
+
"analyze": {
|
|
242
|
+
"temperature": 0.1,
|
|
243
|
+
"prompt": "{file:./prompts/analysis.txt}"
|
|
244
|
+
},
|
|
245
|
+
"build": {
|
|
246
|
+
"temperature": 0.3
|
|
247
|
+
},
|
|
248
|
+
"brainstorm": {
|
|
249
|
+
"temperature": 0.7,
|
|
250
|
+
"prompt": "{file:./prompts/creative.txt}"
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
If no temperature is specified, OpenCode uses model-specific defaults; typically 0 for most models, 0.55 for Qwen models.
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
### Max steps
|
|
261
|
+
|
|
262
|
+
Control the maximum number of agentic iterations an agent can perform before being forced to respond with text only. This allows users who wish to control costs to set a limit on agentic actions.
|
|
263
|
+
|
|
264
|
+
If this is not set, the agent will continue to iterate until the model chooses to stop or the user interrupts the session.
|
|
265
|
+
|
|
266
|
+
```json title="opencode.json"
|
|
267
|
+
{
|
|
268
|
+
"agent": {
|
|
269
|
+
"quick-thinker": {
|
|
270
|
+
"description": "Fast reasoning with limited iterations",
|
|
271
|
+
"prompt": "You are a quick thinker. Solve problems with minimal steps.",
|
|
272
|
+
"maxSteps": 5
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
When the limit is reached, the agent receives a special system prompt instructing it to respond with a summarization of its work and recommended remaining tasks.
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
### Disable
|
|
283
|
+
|
|
284
|
+
Set to `true` to disable the agent.
|
|
285
|
+
|
|
286
|
+
```json title="opencode.json"
|
|
287
|
+
{
|
|
288
|
+
"agent": {
|
|
289
|
+
"review": {
|
|
290
|
+
"disable": true
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
### Prompt
|
|
299
|
+
|
|
300
|
+
Specify a custom system prompt file for this agent with the `prompt` config. The prompt file should contain instructions specific to the agent's purpose.
|
|
301
|
+
|
|
302
|
+
```json title="opencode.json"
|
|
303
|
+
{
|
|
304
|
+
"agent": {
|
|
305
|
+
"review": {
|
|
306
|
+
"prompt": "{file:./prompts/code-review.txt}"
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
This path is relative to where the config file is located. So this works for both the global OpenCode config and the project specific config.
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
### Model
|
|
317
|
+
|
|
318
|
+
Use the `model` config to override the model for this agent. Useful for using different models optimized for different tasks. For example, a faster model for planning, a more capable model for implementation.
|
|
319
|
+
|
|
320
|
+
:::tip
|
|
321
|
+
If you don’t specify a model, primary agents use the [model globally configured](/docs/config#models) while subagents will use the model of the primary agent that invoked the subagent.
|
|
322
|
+
:::
|
|
323
|
+
|
|
324
|
+
```json title="opencode.json"
|
|
325
|
+
{
|
|
326
|
+
"agent": {
|
|
327
|
+
"plan": {
|
|
328
|
+
"model": "anthropic/claude-haiku-4-20250514"
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
The model ID in your OpenCode config uses the format `provider/model-id`. For example, if you're using [OpenCode Zen](/docs/zen), you would use `opencode/gpt-5.1-codex` for GPT 5.1 Codex.
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
### Tools
|
|
339
|
+
|
|
340
|
+
Control which tools are available in this agent with the `tools` config. You can enable or disable specific tools by setting them to `true` or `false`.
|
|
341
|
+
|
|
342
|
+
```json title="opencode.json" {3-6,9-12}
|
|
343
|
+
{
|
|
344
|
+
"$schema": "https://opencode.ai/config.json",
|
|
345
|
+
"tools": {
|
|
346
|
+
"write": true,
|
|
347
|
+
"bash": true
|
|
348
|
+
},
|
|
349
|
+
"agent": {
|
|
350
|
+
"plan": {
|
|
351
|
+
"tools": {
|
|
352
|
+
"write": false,
|
|
353
|
+
"bash": false
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
:::note
|
|
361
|
+
The agent-specific config overrides the global config.
|
|
362
|
+
:::
|
|
363
|
+
|
|
364
|
+
You can also use wildcards to control multiple tools at once. For example, to disable all tools from an MCP server:
|
|
365
|
+
|
|
366
|
+
```json title="opencode.json"
|
|
367
|
+
{
|
|
368
|
+
"$schema": "https://opencode.ai/config.json",
|
|
369
|
+
"agent": {
|
|
370
|
+
"readonly": {
|
|
371
|
+
"tools": {
|
|
372
|
+
"mymcp_*": false,
|
|
373
|
+
"write": false,
|
|
374
|
+
"edit": false
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
[Learn more about tools](/docs/tools).
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
### Permissions
|
|
386
|
+
|
|
387
|
+
You can configure permissions to manage what actions an agent can take. Currently, the permissions for the `edit`, `bash`, and `webfetch` tools can be configured to:
|
|
388
|
+
|
|
389
|
+
- `"ask"` — Prompt for approval before running the tool
|
|
390
|
+
- `"allow"` — Allow all operations without approval
|
|
391
|
+
- `"deny"` — Disable the tool
|
|
392
|
+
|
|
393
|
+
```json title="opencode.json"
|
|
394
|
+
{
|
|
395
|
+
"$schema": "https://opencode.ai/config.json",
|
|
396
|
+
"permission": {
|
|
397
|
+
"edit": "deny"
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
You can override these permissions per agent.
|
|
403
|
+
|
|
404
|
+
```json title="opencode.json" {3-5,8-10}
|
|
405
|
+
{
|
|
406
|
+
"$schema": "https://opencode.ai/config.json",
|
|
407
|
+
"permission": {
|
|
408
|
+
"edit": "deny"
|
|
409
|
+
},
|
|
410
|
+
"agent": {
|
|
411
|
+
"build": {
|
|
412
|
+
"permission": {
|
|
413
|
+
"edit": "ask"
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
You can also set permissions in Markdown agents.
|
|
421
|
+
|
|
422
|
+
```markdown title="~/.config/opencode/agent/review.md"
|
|
423
|
+
---
|
|
424
|
+
description: Code review without edits
|
|
425
|
+
mode: subagent
|
|
426
|
+
permission:
|
|
427
|
+
edit: deny
|
|
428
|
+
bash:
|
|
429
|
+
"*": ask
|
|
430
|
+
"git diff": allow
|
|
431
|
+
"git log*": allow
|
|
432
|
+
webfetch: deny
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
Only analyze code and suggest changes.
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
You can set permissions for specific bash commands.
|
|
439
|
+
|
|
440
|
+
```json title="opencode.json" {7}
|
|
441
|
+
{
|
|
442
|
+
"$schema": "https://opencode.ai/config.json",
|
|
443
|
+
"agent": {
|
|
444
|
+
"build": {
|
|
445
|
+
"permission": {
|
|
446
|
+
"bash": {
|
|
447
|
+
"git push": "ask"
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
This can take a glob pattern.
|
|
456
|
+
|
|
457
|
+
```json title="opencode.json" {7}
|
|
458
|
+
{
|
|
459
|
+
"$schema": "https://opencode.ai/config.json",
|
|
460
|
+
"agent": {
|
|
461
|
+
"build": {
|
|
462
|
+
"permission": {
|
|
463
|
+
"bash": {
|
|
464
|
+
"git *": "ask"
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
And you can also use the `*` wildcard to manage permissions for all commands.
|
|
473
|
+
Since the last matching rule takes precedence, put the `*` wildcard first and specific rules after.
|
|
474
|
+
|
|
475
|
+
```json title="opencode.json" {8}
|
|
476
|
+
{
|
|
477
|
+
"$schema": "https://opencode.ai/config.json",
|
|
478
|
+
"agent": {
|
|
479
|
+
"build": {
|
|
480
|
+
"permission": {
|
|
481
|
+
"bash": {
|
|
482
|
+
"*": "ask",
|
|
483
|
+
"git status": "allow"
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
[Learn more about permissions](/docs/permissions).
|
|
492
|
+
|
|
493
|
+
---
|
|
494
|
+
|
|
495
|
+
### Mode
|
|
496
|
+
|
|
497
|
+
Control the agent's mode with the `mode` config. The `mode` option is used to determine how the agent can be used.
|
|
498
|
+
|
|
499
|
+
```json title="opencode.json"
|
|
500
|
+
{
|
|
501
|
+
"agent": {
|
|
502
|
+
"review": {
|
|
503
|
+
"mode": "subagent"
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
The `mode` option can be set to `primary`, `subagent`, or `all`. If no `mode` is specified, it defaults to `all`.
|
|
510
|
+
|
|
511
|
+
---
|
|
512
|
+
|
|
513
|
+
### Additional
|
|
514
|
+
|
|
515
|
+
Any other options you specify in your agent configuration will be **passed through directly** to the provider as model options. This allows you to use provider-specific features and parameters.
|
|
516
|
+
|
|
517
|
+
For example, with OpenAI's reasoning models, you can control the reasoning effort:
|
|
518
|
+
|
|
519
|
+
```json title="opencode.json" {6,7}
|
|
520
|
+
{
|
|
521
|
+
"agent": {
|
|
522
|
+
"deep-thinker": {
|
|
523
|
+
"description": "Agent that uses high reasoning effort for complex problems",
|
|
524
|
+
"model": "openai/gpt-5",
|
|
525
|
+
"reasoningEffort": "high",
|
|
526
|
+
"textVerbosity": "low"
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
These additional options are model and provider-specific. Check your provider's documentation for available parameters.
|
|
533
|
+
|
|
534
|
+
:::tip
|
|
535
|
+
Run `opencode models` to see a list of the available models.
|
|
536
|
+
:::
|
|
537
|
+
|
|
538
|
+
---
|
|
539
|
+
|
|
540
|
+
## Create agents
|
|
541
|
+
|
|
542
|
+
You can create new agents using the following command:
|
|
543
|
+
|
|
544
|
+
```bash
|
|
545
|
+
opencode agent create
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
This interactive command will:
|
|
549
|
+
|
|
550
|
+
1. Ask where to save the agent; global or project-specific.
|
|
551
|
+
2. Description of what the agent should do.
|
|
552
|
+
3. Generate an appropriate system prompt and identifier.
|
|
553
|
+
4. Let you select which tools the agent can access.
|
|
554
|
+
5. Finally, create a markdown file with the agent configuration.
|
|
555
|
+
|
|
556
|
+
---
|
|
557
|
+
|
|
558
|
+
## Use cases
|
|
559
|
+
|
|
560
|
+
Here are some common use cases for different agents.
|
|
561
|
+
|
|
562
|
+
- **Build agent**: Full development work with all tools enabled
|
|
563
|
+
- **Plan agent**: Analysis and planning without making changes
|
|
564
|
+
- **Review agent**: Code review with read-only access plus documentation tools
|
|
565
|
+
- **Debug agent**: Focused on investigation with bash and read tools enabled
|
|
566
|
+
- **Docs agent**: Documentation writing with file operations but no system commands
|
|
567
|
+
|
|
568
|
+
---
|
|
569
|
+
|
|
570
|
+
## Examples
|
|
571
|
+
|
|
572
|
+
Here are some examples agents you might find useful.
|
|
573
|
+
|
|
574
|
+
:::tip
|
|
575
|
+
Do you have an agent you'd like to share? [Submit a PR](https://github.com/anomalyco/opencode).
|
|
576
|
+
:::
|
|
577
|
+
|
|
578
|
+
---
|
|
579
|
+
|
|
580
|
+
### Documentation agent
|
|
581
|
+
|
|
582
|
+
```markdown title="~/.config/opencode/agent/docs-writer.md"
|
|
583
|
+
---
|
|
584
|
+
description: Writes and maintains project documentation
|
|
585
|
+
mode: subagent
|
|
586
|
+
tools:
|
|
587
|
+
bash: false
|
|
588
|
+
---
|
|
589
|
+
|
|
590
|
+
You are a technical writer. Create clear, comprehensive documentation.
|
|
591
|
+
|
|
592
|
+
Focus on:
|
|
593
|
+
|
|
594
|
+
- Clear explanations
|
|
595
|
+
- Proper structure
|
|
596
|
+
- Code examples
|
|
597
|
+
- User-friendly language
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
---
|
|
601
|
+
|
|
602
|
+
### Security auditor
|
|
603
|
+
|
|
604
|
+
```markdown title="~/.config/opencode/agent/security-auditor.md"
|
|
605
|
+
---
|
|
606
|
+
description: Performs security audits and identifies vulnerabilities
|
|
607
|
+
mode: subagent
|
|
608
|
+
tools:
|
|
609
|
+
write: false
|
|
610
|
+
edit: false
|
|
611
|
+
---
|
|
612
|
+
|
|
613
|
+
You are a security expert. Focus on identifying potential security issues.
|
|
614
|
+
|
|
615
|
+
Look for:
|
|
616
|
+
|
|
617
|
+
- Input validation vulnerabilities
|
|
618
|
+
- Authentication and authorization flaws
|
|
619
|
+
- Data exposure risks
|
|
620
|
+
- Dependency vulnerabilities
|
|
621
|
+
- Configuration security issues
|
|
622
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
### Apply Specs
|
|
2
|
+
|
|
3
|
+
This directory defines the behavior of **apply** (a.k.a. platform apply/sync): projecting a package's canonical content into **platform-specific workspace layouts**, and updating `openpackage.index.yml` to reflect what is actually installed.
|
|
4
|
+
|
|
5
|
+
Apply can be triggered in two ways:
|
|
6
|
+
|
|
7
|
+
- `opkg apply` – explicit apply/sync.
|
|
8
|
+
|
|
9
|
+
> `opkg pack` writes registry snapshots; `opkg save` syncs workspace edits back to a mutable source. Neither mutates platform workspaces unless you run `opkg apply` (or `opkg add --apply` when adding new files).
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
#### Documents
|
|
14
|
+
|
|
15
|
+
| File | Topic |
|
|
16
|
+
|------|-------|
|
|
17
|
+
| `apply-command.md` | CLI contract: args, flags, and examples |
|
|
18
|
+
| `apply-behavior.md` | What apply does (create/update/delete), timing, and root-package considerations |
|
|
19
|
+
| `conflicts.md` | Conflict handling (interactive vs non-interactive) and strategies |
|
|
20
|
+
| `index-effects.md` | How apply affects `openpackage.index.yml`, including before/after examples |
|
|
21
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
### Apply – Behavior
|
|
2
|
+
|
|
3
|
+
#### 1. Definition
|
|
4
|
+
|
|
5
|
+
**Apply** (also referred to as platform apply/sync) projects a package’s canonical content into **platform-specific workspace locations** based on detected platforms and platform mapping rules.
|
|
6
|
+
|
|
7
|
+
Apply may be invoked:
|
|
8
|
+
|
|
9
|
+
- explicitly via `opkg apply`, or
|
|
10
|
+
- as a post-step of `opkg add --apply` (when adding new files before syncing platforms).
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
#### 2. Purpose
|
|
15
|
+
|
|
16
|
+
- Keep platform-specific working directories (e.g. `.cursor/`, `.opencode/`, etc.) consistent with the package’s canonical content.
|
|
17
|
+
- Ensure `openpackage.index.yml` reflects the **paths that actually exist** after apply.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
#### 3. Operations
|
|
22
|
+
|
|
23
|
+
Apply distinguishes between:
|
|
24
|
+
|
|
25
|
+
- **Create / Update**: write new or changed files to platform-specific targets.
|
|
26
|
+
- **Delete**: remove stale files that were previously installed by the package but no longer exist in the package snapshot.
|
|
27
|
+
|
|
28
|
+
Apply runs against the set of platforms detected for the effective cwd.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
#### 4. Timing
|
|
33
|
+
|
|
34
|
+
Apply only runs after:
|
|
35
|
+
|
|
36
|
+
- Package detection and name resolution are complete.
|
|
37
|
+
- File mapping/selection has succeeded.
|
|
38
|
+
- When invoked as `opkg add --apply`, the add step has completed successfully.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
#### 5. Root Package Considerations
|
|
43
|
+
|
|
44
|
+
- Root packages may skip root-level “self mappings” (where a registry key would map to the exact same on-disk path) to avoid redundant index entries and no-op writes.
|
|
45
|
+
- Root file syncing (e.g., platform-specific root files) may be skipped for root packages when appropriate to avoid syncing “back into itself”.
|
|
46
|
+
|
|
47
|
+
Nested packages:
|
|
48
|
+
|
|
49
|
+
- Always participate fully in apply/sync when apply is requested; their changes are projected out to platform workspaces.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
#### 6. Error Reporting
|
|
54
|
+
|
|
55
|
+
Failures in apply are surfaced to the user as part of the command result, along with a summary of created/updated/removed paths.
|
|
56
|
+
|
|
57
|
+
See `conflicts.md` for how apply handles conflicts and interactive prompts.
|
|
58
|
+
|