@uniqbit/mate-core 0.21.1 → 1.0.0-canary.10
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/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
- package/claude-plugin/hooks/hooks.json +32 -1
- package/claude-plugin/hooks/workflow-turn.mjs +68 -0
- package/opencode-plugin/src/companion.ts +6 -0
- package/opencode-plugin/src/server.ts +24 -0
- package/package.json +9 -4
- package/src/cli/commands/artifact/apply-context.ts +1 -0
- package/src/cli/commands/artifact/artifact.ts +16 -0
- package/src/cli/commands/artifact/delivery/archive.ts +37 -112
- package/src/cli/commands/artifact/delivery/branch-flags.ts +19 -1
- package/src/cli/commands/artifact/delivery/environment.ts +30 -90
- package/src/cli/commands/artifact/delivery/link.ts +26 -26
- package/src/cli/commands/artifact/delivery/output.ts +27 -4
- package/src/cli/commands/artifact/delivery/resolve.ts +102 -0
- package/src/cli/commands/artifact/delivery/submit.ts +171 -0
- package/src/cli/commands/artifact/delivery/take.ts +46 -0
- package/src/cli/commands/artifact/extract-repo-name.ts +1 -1
- package/src/cli/commands/artifact/finish/command.ts +486 -55
- package/src/cli/commands/artifact/finish/engine.ts +87 -69
- package/src/cli/commands/artifact/finish/finisher.ts +5 -12
- package/src/cli/commands/artifact/finish/git.ts +9 -10
- package/src/cli/commands/artifact/finish/openspec.ts +21 -174
- package/src/cli/commands/artifact/finish/secret-scan.ts +5 -43
- package/src/cli/commands/artifact/finish/worktree-cleanup.ts +57 -7
- package/src/cli/commands/artifact/pending/command.ts +187 -10
- package/src/cli/commands/artifact/pending/discovery.ts +7 -11
- package/src/cli/commands/artifact/project/command.ts +59 -0
- package/src/cli/commands/cap/tokensave.ts +2 -2
- package/src/cli/commands/companion/hub.ts +11 -6
- package/src/cli/commands/companion/link.ts +173 -46
- package/src/cli/commands/companion/list.ts +70 -14
- package/src/cli/commands/companion/sync.ts +18 -0
- package/src/cli/commands/companion/update.ts +4 -3
- package/src/cli/commands/doctor.ts +84 -4
- package/src/cli/commands/friction.ts +558 -0
- package/src/cli/commands/install.ts +9 -4
- package/src/cli/commands/plugin/install.ts +82 -35
- package/src/cli/commands/studio/companion-add.ts +12 -27
- package/src/cli/commands/studio/connection.ts +53 -0
- package/src/{lib/factory/outcomes/sessions.ts → cli/commands/studio/live-sessions.ts} +7 -5
- package/src/cli/commands/studio/mcp-manager.ts +162 -0
- package/src/cli/commands/studio/payload.ts +172 -17
- package/src/cli/commands/studio/reports.ts +19 -18
- package/src/cli/commands/studio/routes.ts +8 -24
- package/src/cli/commands/studio/selection.ts +13 -4
- package/src/cli/commands/studio/server.ts +267 -243
- package/src/cli/commands/studio/service-host.ts +269 -0
- package/src/cli/commands/studio/services.ts +53 -34
- package/src/cli/commands/studio/studio-app.ts +1 -0
- package/src/cli/commands/studio/terminal.ts +1 -1
- package/src/cli/commands/studio/vault.ts +41 -40
- package/src/cli/commands/studio/views/model.ts +1 -9
- package/src/cli/commands/studio/views/vault/markdown-tree.ts +6 -5
- package/src/cli/commands/triage.ts +172 -0
- package/src/cli/commands/vscode/release-vsix.json +2 -2
- package/src/cli/commands/workflow/workflow.ts +516 -0
- package/src/cli/commands/working/cleanup.ts +1 -18
- package/src/cli/companion-link-wizard.tsx +158 -91
- package/src/cli/install-plan.tsx +3 -0
- package/src/cli/main.ts +106 -26
- package/src/cli/plugin-commands.ts +6 -1
- package/src/cli/repo-list-table.tsx +73 -37
- package/src/cli/usage.ts +30 -9
- package/src/create-mate.ts +15 -6
- package/src/distribution.ts +2 -0
- package/src/factory-host.ts +75 -0
- package/src/hooks/companion-instructions.ts +19 -8
- package/src/hooks/hook-io.ts +3 -1
- package/src/hooks/session-banner.ts +25 -0
- package/src/hooks/validate-artifact-path.ts +73 -22
- package/src/hooks/workflow-turn.ts +219 -0
- package/src/index.ts +1 -0
- package/src/lib/apply-context/fingerprint.ts +2 -1
- package/src/lib/apply-context/protocol.ts +2 -2
- package/src/lib/artifact-trailer.ts +27 -0
- package/src/lib/change-layout.ts +83 -38
- package/src/lib/delivery/branch-template.ts +4 -12
- package/src/lib/delivery/checkout.ts +3 -2
- package/src/lib/delivery/environment.ts +129 -7
- package/src/lib/delivery/merge-git.ts +312 -28
- package/src/lib/delivery/overlap.ts +81 -16
- package/src/lib/delivery/record-delivery.ts +102 -9
- package/src/lib/delivery/record.ts +186 -24
- package/src/lib/delivery/refresh.ts +241 -152
- package/src/lib/delivery/remote.ts +66 -0
- package/src/lib/delivery/repository-access.ts +30 -66
- package/src/lib/delivery/stages.ts +83 -50
- package/src/lib/delivery/staging/apply-chain.ts +182 -0
- package/src/lib/delivery/staging/artifact-type.ts +101 -0
- package/src/lib/delivery/staging/declared-type.ts +277 -0
- package/src/lib/delivery/staging/linked-merges.ts +175 -0
- package/src/lib/delivery/staging/naming.ts +67 -0
- package/src/lib/delivery/staging/openspec-type.ts +166 -0
- package/src/lib/delivery/staging/pending-edit.ts +291 -0
- package/src/lib/delivery/staging/pending.ts +922 -0
- package/src/lib/delivery/staging/preflight.ts +239 -0
- package/src/lib/delivery/staging/project.ts +512 -0
- package/src/lib/delivery/staging/publish.ts +1024 -0
- package/src/lib/delivery/staging/refs.ts +258 -0
- package/src/lib/delivery/staging/registry.ts +73 -0
- package/src/lib/delivery/staging/replay.ts +310 -0
- package/src/lib/delivery/staging/requirement-blocks.ts +10 -0
- package/src/lib/delivery/staging/resolve.ts +264 -0
- package/src/lib/delivery/staging/settle-linked.ts +176 -0
- package/src/lib/delivery/staging/submit.ts +1050 -0
- package/src/lib/delivery/staging/worktree.ts +130 -0
- package/src/lib/delivery/submit-change.ts +569 -0
- package/src/lib/friction/describe.ts +42 -0
- package/src/lib/friction/fields.ts +60 -0
- package/src/lib/friction/mark.ts +194 -0
- package/src/lib/friction/view/model.ts +67 -0
- package/src/lib/friction/view/read.ts +145 -0
- package/src/lib/friction/view/select.ts +54 -0
- package/src/lib/git-key.ts +15 -0
- package/src/lib/install.ts +2 -0
- package/src/lib/mcp-manager/resolve.ts +88 -0
- package/src/lib/mcp-manager/store.ts +133 -0
- package/src/lib/mcp-manager/types.ts +72 -0
- package/src/lib/mcp-manager/validate.ts +242 -0
- package/src/lib/openspec-canonical-frontmatter.ts +159 -0
- package/src/lib/openspec-cli.ts +10 -5
- package/src/lib/orchestrator/adapters/base.ts +31 -20
- package/src/lib/orchestrator/adapters/claude.ts +21 -7
- package/src/lib/orchestrator/adapters/opencode.ts +4 -0
- package/src/lib/orchestrator/companion-git-sync.ts +152 -16
- package/src/lib/orchestrator/config-store.ts +30 -7
- package/src/lib/orchestrator/engine-floor.ts +16 -4
- package/src/lib/orchestrator/engine-guard.ts +7 -1
- package/src/lib/orchestrator/framework-context.ts +15 -1
- package/src/lib/orchestrator/projection-claude-links.ts +1 -0
- package/src/lib/orchestrator/refresh-working-claude-links.ts +1 -0
- package/src/lib/orchestrator/repo-local-store.ts +14 -0
- package/src/lib/orchestrator/repository-link.ts +80 -52
- package/src/lib/orchestrator/root-context.ts +40 -7
- package/src/lib/orchestrator/session-prepare.ts +11 -1
- package/src/lib/orchestrator/types.ts +4 -0
- package/src/lib/orchestrator/umbrella-checkouts.ts +4 -4
- package/src/lib/package-paths.ts +23 -15
- package/src/lib/prebuilt-workspace-prepare.ts +2 -1
- package/src/lib/prebuilt-workspace.ts +1 -0
- package/src/lib/session-attribution.ts +3 -7
- package/src/lib/session-state.ts +3 -2
- package/src/lib/skills-cli.ts +38 -0
- package/src/lib/tool-manifest.ts +73 -0
- package/src/lib/triage/context.ts +312 -0
- package/src/lib/triage/launch.ts +52 -0
- package/src/lib/triage/prepare.ts +112 -0
- package/src/lib/triage/session.ts +126 -0
- package/src/lib/workflow/declaration.ts +6 -0
- package/src/lib/workflow/handoff.ts +90 -0
- package/src/lib/workflow/hook-trust.ts +108 -0
- package/src/lib/workflow/position.ts +524 -0
- package/src/lib/workflow/report.ts +79 -0
- package/src/lib/workflow/work.ts +106 -0
- package/src/lib/workset/factory-local.ts +2 -2
- package/src/lib/workset/repositories.ts +2 -2
- package/src/lib/workset/stage.ts +4 -2
- package/src/lib/workset/stages.ts +64 -4
- package/src/lib/workset/worktree.ts +32 -14
- package/src/opencode/companion-hooks.ts +63 -14
- package/src/opencode/projected-guidance.ts +7 -2
- package/src/opencode/turn-hook.ts +241 -0
- package/src/playbooks/companion-guidance.ts +7 -4
- package/src/plugin-api.ts +48 -0
- package/src/runtime/artifact-trailers.ts +63 -0
- package/src/runtime/claude-hook-group.ts +2 -0
- package/src/runtime/command-arg.ts +15 -0
- package/src/runtime/command-friction.ts +97 -0
- package/src/runtime/companion-git-state.ts +155 -10
- package/src/runtime/companion-git.ts +86 -11
- package/src/runtime/companion-guidance.ts +120 -17
- package/src/runtime/companion-instructions.ts +1 -1
- package/src/runtime/companion-sync.ts +109 -21
- package/src/runtime/env-names.ts +2 -2
- package/src/runtime/env.ts +7 -6
- package/src/runtime/forge-remote.ts +54 -0
- package/src/runtime/friction-fingerprint.ts +35 -0
- package/src/runtime/friction-log.ts +376 -0
- package/src/runtime/friction-recorder.ts +212 -0
- package/src/runtime/friction-retention.ts +1 -0
- package/src/runtime/friction-state.ts +110 -0
- package/src/runtime/friction-switch.ts +26 -0
- package/src/runtime/friction-vocabulary.ts +42 -0
- package/src/runtime/git-layout.ts +21 -7
- package/src/runtime/git-tracked.ts +13 -2
- package/src/runtime/json-fields.ts +8 -0
- package/src/runtime/pending-records.ts +533 -0
- package/src/runtime/projected-guidance.ts +8 -3
- package/src/runtime/publication-secret-scan.ts +45 -0
- package/src/runtime/secret-patterns.ts +7 -5
- package/src/runtime/secret-values.ts +16 -0
- package/src/runtime/session-id.ts +24 -0
- package/src/runtime/session-prepare-runner.ts +3 -0
- package/src/runtime/skill-prefix.ts +75 -0
- package/src/runtime/submitted-arrivals.ts +547 -0
- package/src/runtime/turn-state.d.mts +14 -0
- package/src/runtime/turn-state.mjs +93 -0
- package/src/runtime/umbrella-children.ts +52 -0
- package/src/runtime/umbrella-folder.ts +31 -3
- package/src/runtime/workflow/change-folders.ts +66 -0
- package/src/runtime/workflow/declaration.ts +720 -0
- package/src/runtime/workflow/globs.ts +85 -0
- package/src/runtime/workflow/next-handoff-process.ts +99 -0
- package/src/runtime/workflow/turn.ts +311 -0
- package/src/runtime/workflow/workflow.ts +262 -0
- package/src/studio.ts +113 -23
- package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/schema.yaml +3 -3
- package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/design.md +1 -1
- package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/proposal.md +1 -1
- package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/tasks.md +1 -1
- package/src/templates/capabilities/openspec-cap/mate-minimal/schema.yaml +7 -3
- package/src/templates/capabilities/react-doctor/mate-react-doctor/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +84 -28
- package/src/templates/mate-skills/agents/mate-apply-change/references/openspec-apply-change.md +1 -1
- package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +30 -68
- package/src/templates/mate-skills/agents/mate-backfill-spec/SKILL.md +23 -1
- package/src/templates/mate-skills/agents/mate-clarify-intent/SKILL.md +39 -8
- package/src/templates/mate-skills/agents/mate-domain-modeling/SKILL.md +38 -0
- package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +65 -12
- package/src/templates/mate-skills/agents/mate-grill-me/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-grill-with-docs/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-grilling/SKILL.md +25 -0
- package/src/templates/mate-skills/agents/mate-interview-me/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +68 -28
- package/src/templates/mate-skills/agents/mate-propose-change/references/mate-revise.md +13 -7
- package/src/templates/mate-skills/agents/mate-propose-change/references/openspec-update-change.md +1 -1
- package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +136 -86
- package/src/templates/mate-skills/agents/mate-publish-artifact/references/openspec.md +111 -100
- package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +28 -3
- package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +39 -5
- package/src/templates/mate-skills/agents/mate-submit-change/SKILL.md +138 -0
- package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +84 -28
- package/src/templates/mate-skills/claude/mate-apply-change/references/openspec-apply-change.md +1 -1
- package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +30 -68
- package/src/templates/mate-skills/claude/mate-backfill-spec/SKILL.md +23 -1
- package/src/templates/mate-skills/claude/mate-clarify-intent/SKILL.md +39 -8
- package/src/templates/mate-skills/claude/mate-domain-modeling/SKILL.md +38 -0
- package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +65 -12
- package/src/templates/mate-skills/claude/mate-grill-me/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-grill-with-docs/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-grilling/SKILL.md +25 -0
- package/src/templates/mate-skills/claude/mate-interview-me/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +68 -28
- package/src/templates/mate-skills/claude/mate-propose-change/references/mate-revise.md +13 -7
- package/src/templates/mate-skills/claude/mate-propose-change/references/openspec-update-change.md +1 -1
- package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +136 -86
- package/src/templates/mate-skills/claude/mate-publish-artifact/references/openspec.md +111 -100
- package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +28 -3
- package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +39 -5
- package/src/templates/mate-skills/claude/mate-submit-change/SKILL.md +138 -0
- package/src/templates/mate-skills/openspec-references.ts +3 -2
- package/src/templates/triage/PLAYBOOK.md +120 -0
- package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +678 -170
- package/src/tools/setup/capabilities/graphify.ts +23 -1
- package/src/tools/setup/capabilities/mcp-manager.ts +73 -0
- package/src/tools/setup/capabilities/openspec.ts +54 -15
- package/src/tools/setup/capabilities/rtk.ts +47 -94
- package/src/tools/setup/capabilities/tokensave.ts +79 -56
- package/src/tools/setup/context-services.ts +35 -6
- package/src/tools/setup/dynamic-plugins/api.ts +38 -0
- package/src/tools/setup/dynamic-plugins/audiences.ts +31 -16
- package/src/tools/setup/dynamic-plugins/host.ts +2 -32
- package/src/tools/setup/dynamic-plugins/hydrate.ts +32 -14
- package/src/tools/setup/dynamic-plugins/install.ts +2 -0
- package/src/tools/setup/dynamic-plugins/installed.ts +73 -0
- package/src/tools/setup/dynamic-plugins/loader.ts +12 -10
- package/src/tools/setup/dynamic-plugins/local.ts +492 -0
- package/src/tools/setup/dynamic-plugins/paths.ts +34 -6
- package/src/tools/setup/dynamic-plugins/verify.ts +34 -14
- package/src/tools/setup/dynamic-plugins/workspaces.ts +21 -12
- package/src/tools/setup/engine.ts +75 -4
- package/src/tools/setup/mate.ts +28 -1
- package/src/tools/setup/package-managers/bun.ts +8 -8
- package/src/tools/setup/plugin.ts +28 -1
- package/src/tools/setup/plugins/gitignore.ts +45 -12
- package/src/tools/setup/plugins/guidance.ts +4 -2
- package/src/tools/setup/providers/claude-format.ts +39 -2
- package/src/tools/setup/providers/claude-plugin-hooks.ts +18 -0
- package/src/tools/setup/providers/claude.ts +56 -6
- package/src/tools/setup/providers/opencode-format.ts +13 -3
- package/src/tools/setup/providers/opencode.ts +7 -18
- package/src/tools/setup/providers/relative-path-warnings.ts +26 -0
- package/src/tools/setup/service-registry.ts +69 -0
- package/src/tools/setup/service.ts +245 -0
- package/src/tools/setup/utils.ts +34 -4
- package/src/tools/setup.ts +16 -2
- package/studio-dist/client/assets/DialogTitle-B_G47-lk.js +1 -0
- package/studio-dist/client/assets/app-0NoFqMou.css +2 -0
- package/studio-dist/client/assets/button-D_0295cs.js +1 -0
- package/studio-dist/client/assets/cn-Cx_D6I3u.js +1 -0
- package/studio-dist/client/assets/combobox-D0iPQP50.js +1 -0
- package/studio-dist/client/assets/{companion-view-CrabvxS8.js → companion-view-D3A76MLj.js} +1 -1
- package/studio-dist/client/assets/fields-Ctheim1h.js +1 -0
- package/studio-dist/client/assets/friction-Cn9n_zBA.js +1 -0
- package/studio-dist/client/assets/getting-started-DgoVWbWo.js +1 -0
- package/studio-dist/client/assets/{getting-started-D6kgWwWZ.js → getting-started-MmLqvy01.js} +1 -1
- package/studio-dist/client/assets/getting-started._topic-DBF0khhz.js +1 -0
- package/studio-dist/client/assets/getting-started.index-BRdAVqIh.js +1 -0
- package/studio-dist/client/assets/graph-BVRdq46V.js +2 -0
- package/studio-dist/client/assets/{graph-canvas-Ba37Y5AE.js → graph-canvas-BNzd-eVb.js} +1 -1
- package/studio-dist/client/assets/guides-DY1W9LRs.js +1 -0
- package/studio-dist/client/assets/index-CuTIc9yd.js +40 -0
- package/studio-dist/client/assets/{markdown-view-BOX6x0rL.js → markdown-view-BqZQkk_k.js} +1 -1
- package/studio-dist/client/assets/mcp-CIFxmDs0.js +4 -0
- package/studio-dist/client/assets/panel-DafanLQ4.js +1 -0
- package/studio-dist/client/assets/plugins._service._view-xSRLxHNM.js +1 -0
- package/studio-dist/client/assets/prepaint-C--F50QZ.js +27 -0
- package/studio-dist/client/assets/{queries-RvHeXY12.js → queries-ByCoiacy.js} +1 -1
- package/studio-dist/client/assets/react-BYUSgtBs.js +1 -0
- package/studio-dist/client/assets/reports-Diryyked.js +1 -0
- package/studio-dist/client/assets/routes-DbRwPd55.js +1 -0
- package/studio-dist/client/assets/search-BDKQRwa5.js +1 -0
- package/studio-dist/client/assets/select-_9JT3hpU.js +1 -0
- package/studio-dist/client/assets/skills-D5a6ybQM.js +1 -0
- package/studio-dist/client/assets/{specs-B0ldF_6J.js → specs-COAWUTog.js} +1 -1
- package/studio-dist/client/assets/specs-view-9eTn9TcN.js +1 -0
- package/studio-dist/client/assets/steps-BS588WAV.js +1 -0
- package/studio-dist/client/assets/store-3cffhIO6.js +1 -0
- package/studio-dist/client/assets/studio-CG9eioSx.js +100 -0
- package/studio-dist/client/assets/studio-queries-BS1yR7Wc.js +2 -0
- package/studio-dist/client/assets/{usage-C2QJ_0IZ.js → usage-Ccl4d7w0.js} +15 -15
- package/studio-dist/client/assets/useAnchoredPopupScrollLock-D_y83VP7.js +1 -0
- package/studio-dist/client/assets/useBlocker-BQOfcu_f.js +1 -0
- package/studio-dist/client/assets/useMutation-BDmS2V6y.js +1 -0
- package/studio-dist/client/assets/usePopupHandleStore-BcqpNR-F.js +1 -0
- package/studio-dist/client/assets/vault-C1tOhQMe.js +1 -0
- package/studio-dist/client/assets/warnings-BZ_X1nkO.js +1 -0
- package/studio-dist/client/assets/workflow-Cm2fsnly.js +1 -0
- package/studio-dist/server/assets/DialogTitle-KSVhF_7V.js +421 -0
- package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-Bn896ZYj.js → __23tanstack-start-server-fn-resolver-QQnIXyKi.js} +40 -28
- package/studio-dist/server/assets/_tanstack-start-manifest_v.js +84 -74
- package/studio-dist/server/assets/{button-CgOIVdmD.js → button-C7EMLaX6.js} +229 -5527
- package/studio-dist/server/assets/cn-D7uJiH_O.js +5528 -0
- package/studio-dist/server/assets/{combobox-DV_s9W0s.js → combobox-Dc4_y20Y.js} +6 -5
- package/studio-dist/server/assets/{companion-view-BKVXD3TO.js → companion-view-CrSi37Mb.js} +2 -2
- package/studio-dist/server/assets/{companions-C7fctnU9.js → companions-CDSuLqA4.js} +1 -1
- package/studio-dist/server/assets/{fields-BbieQTD0.js → fields-BxBN6-Dz.js} +10 -2
- package/studio-dist/server/assets/friction-B1K8Kp8r.js +62 -0
- package/studio-dist/server/assets/friction-Vl3B6THL.js +943 -0
- package/studio-dist/server/assets/{getting-started-CRxMWorQ.js → getting-started-B3lu5W7M.js} +2 -2
- package/studio-dist/server/assets/{getting-started._topic-DJKQAzYl.js → getting-started._topic-EYtxZM-Y.js} +2 -2
- package/studio-dist/server/assets/{getting-started.index-D84gec1t.js → getting-started.index-CTaXYycH.js} +2 -2
- package/studio-dist/server/assets/{graph-DDZzXM1L.js → graph-Bhmk7H8V.js} +1 -1
- package/studio-dist/server/assets/{graph-CSje3029.js → graph-D3fXCaKt.js} +8 -8
- package/studio-dist/server/assets/{graph-canvas-22bWB5-2.js → graph-canvas-DIvTodML.js} +2 -2
- package/studio-dist/server/assets/{guides-IE-19POz.js → guides-BZWFpJl-.js} +1 -1
- package/studio-dist/server/assets/{guides-D9dk1Frq.js → guides-CHBkRO6R.js} +1 -1
- package/studio-dist/server/assets/{guides.server-vcYRY5wx.js → guides.server-DX9KRkcK.js} +1 -1
- package/studio-dist/server/assets/{markdown-view-BR8dJ7aR.js → markdown-view-qrCSkVta.js} +1 -1
- package/studio-dist/server/assets/mcp-Ljf4simO.js +1103 -0
- package/studio-dist/server/assets/mcp-manager-DohRwmJU.js +50 -0
- package/studio-dist/server/assets/{panel-BR_t9iMM.js → panel-CAwz4mKp.js} +6 -4
- package/studio-dist/server/assets/plugins._service._view-DUpAo5D_.js +97 -0
- package/studio-dist/server/assets/prepaint-BxZ-pU7t.js +45 -0
- package/studio-dist/server/assets/{queries-DWoTin-q.js → queries-W4LXzTnT.js} +1 -1
- package/studio-dist/server/assets/react-CiBZPDs8.js +45 -0
- package/studio-dist/server/assets/{reports-CQ9qQ1-n.js → reports-BVNSPHU3.js} +13 -7
- package/studio-dist/server/assets/{reports-dYDEoBeq.js → reports-CGG_wRN5.js} +1 -1
- package/studio-dist/server/assets/{router-DkRHNTpE.js → router-KH1x6ryF.js} +1039 -1096
- package/studio-dist/server/assets/{routes-B6GfOew4.js → routes-Bl90FC4R.js} +333 -38
- package/studio-dist/server/assets/search-BjG5f16n.js +110 -0
- package/studio-dist/server/assets/{select-Af7Wibii.js → select-B8q9tLbl.js} +5 -4
- package/studio-dist/server/assets/{shell-Hq-hXgnT.js → shell-C5emwofr.js} +12 -3
- package/studio-dist/server/assets/{skills-B7nEuVbx.js → skills-10l0eCfP.js} +8 -8
- package/studio-dist/server/assets/{skills-B_YYL7q8.js → skills-vG6TTvP1.js} +1 -1
- package/studio-dist/server/assets/{specs-BpLUFntA.js → specs-C1P2BEao.js} +4 -4
- package/studio-dist/server/assets/{specs-view-0peMVd22.js → specs-view-csUBtMWU.js} +10 -10
- package/studio-dist/server/assets/{steps-D56DApvK.js → steps-T4wXftgd.js} +88 -45
- package/studio-dist/server/assets/store-CWlRjv9s.js +93 -0
- package/studio-dist/server/assets/{studio-CAcKp3bM.js → studio-D-ZPWSMv.js} +1567 -59
- package/studio-dist/server/assets/{studio-queries-BtRGzDdh.js → studio-queries-DC273ifg.js} +66 -124
- package/studio-dist/server/assets/{usage-COdjd1gD.js → usage-CT3IWLJc.js} +13 -30
- package/studio-dist/server/assets/{usage-f6pqE1tm.js → usage-D4t_ibR8.js} +1 -1
- package/studio-dist/server/assets/{useAnchoredPopupScrollLock-DlBKHRw7.js → useAnchoredPopupScrollLock-BchJDJYg.js} +2 -2
- package/studio-dist/server/assets/useBlocker-CQtANHK8.js +111 -0
- package/studio-dist/server/assets/{useMutation-DzTZGenE.js → useMutation-0HbcKUsQ.js} +2 -2
- package/studio-dist/server/assets/usePopupHandleStore-B3SNGTic.js +26 -0
- package/studio-dist/server/assets/{vault-BDuIUq0F.js → vault-BIytrudF.js} +10 -117
- package/studio-dist/server/assets/{vault-BVLp6zu3.js → vault-MINXmyXA.js} +1 -1
- package/studio-dist/server/assets/{views-flRUr21z.js → views-DrmY_3J5.js} +7 -4
- package/studio-dist/server/assets/{warnings-CDy9pdgL.js → warnings-BVZCDbIz.js} +2 -2
- package/studio-dist/server/assets/{workflow-D9GKI2EV.js → workflow-DFdqnMtW.js} +57 -50
- package/studio-dist/server/server.js +2 -2
- package/tool-manifest.yaml +85 -0
- package/src/cli/commands/factory/factory.ts +0 -311
- package/src/cli/commands/studio/factory-credential.ts +0 -35
- package/src/cli/commands/studio/factory-git-tokens.ts +0 -40
- package/src/cli/commands/studio/factory-relay.ts +0 -18
- package/src/cli/commands/studio/repository-add.ts +0 -116
- package/src/cli/commands/studio/workset-session.ts +0 -164
- package/src/lib/delivery/archive-change.ts +0 -165
- package/src/lib/delivery/forge.ts +0 -279
- package/src/lib/delivery/token.ts +0 -24
- package/src/lib/factory/attach-client.ts +0 -123
- package/src/lib/factory/attach.ts +0 -178
- package/src/lib/factory/broker.ts +0 -187
- package/src/lib/factory/bun-commands.ts +0 -39
- package/src/lib/factory/client.ts +0 -113
- package/src/lib/factory/clone-url.ts +0 -39
- package/src/lib/factory/command.ts +0 -77
- package/src/lib/factory/credential-store.ts +0 -153
- package/src/lib/factory/frames.ts +0 -77
- package/src/lib/factory/git-auth.ts +0 -61
- package/src/lib/factory/git-credential-store.ts +0 -181
- package/src/lib/factory/ids.ts +0 -68
- package/src/lib/factory/outcomes/actions.ts +0 -130
- package/src/lib/factory/outcomes/index.ts +0 -457
- package/src/lib/factory/outcomes/lifecycle.ts +0 -212
- package/src/lib/factory/outcomes/runs.ts +0 -81
- package/src/lib/factory/prepare.ts +0 -55
- package/src/lib/factory/pty.ts +0 -103
- package/src/lib/factory/runner/companion-context.ts +0 -178
- package/src/lib/factory/runner/control.ts +0 -92
- package/src/lib/factory/runner/harness-agent.ts +0 -250
- package/src/lib/factory/runner/live.ts +0 -159
- package/src/lib/factory/runner/questions.ts +0 -22
- package/src/lib/factory/runner/rank.ts +0 -26
- package/src/lib/factory/runner/run-policy.ts +0 -12
- package/src/lib/factory/runner/run.ts +0 -199
- package/src/lib/factory/runner/scheduler.ts +0 -498
- package/src/lib/factory/runner/state.ts +0 -233
- package/src/lib/factory/runner/workflow.ts +0 -546
- package/src/lib/factory/runtime.ts +0 -1081
- package/src/lib/factory/sandbox.ts +0 -292
- package/src/lib/factory/worktree-branch.ts +0 -17
- package/src/templates/capabilities/openspec-cap/mate-v1/templates/explore-brief.md +0 -25
- package/studio-dist/client/assets/app-D9cw6szy.css +0 -2
- package/studio-dist/client/assets/artifacts-WD2ZXYrx.js +0 -1
- package/studio-dist/client/assets/button-Br0O1sXw.js +0 -1
- package/studio-dist/client/assets/combobox-DA7RAUUZ.js +0 -1
- package/studio-dist/client/assets/factory-DGS0E16C.js +0 -6
- package/studio-dist/client/assets/fields-6aXBpFhJ.js +0 -1
- package/studio-dist/client/assets/getting-started-Clde4w6P.js +0 -1
- package/studio-dist/client/assets/getting-started._topic-BiunccbT.js +0 -1
- package/studio-dist/client/assets/getting-started.index-DpiNoGw8.js +0 -1
- package/studio-dist/client/assets/graph-B_TCBVbu.js +0 -2
- package/studio-dist/client/assets/guides-Du_RtJxP.js +0 -1
- package/studio-dist/client/assets/index-Df8L1LQa.js +0 -40
- package/studio-dist/client/assets/panel-dbmCx7Mx.js +0 -1
- package/studio-dist/client/assets/react-3QStrcDO.js +0 -27
- package/studio-dist/client/assets/report-url-XRL0x1SY.js +0 -1
- package/studio-dist/client/assets/reports-r3IK7Doz.js +0 -1
- package/studio-dist/client/assets/routes-C0A5LTFc.js +0 -1
- package/studio-dist/client/assets/select-CnaMd617.js +0 -1
- package/studio-dist/client/assets/skills-CzjzHpBT.js +0 -1
- package/studio-dist/client/assets/specs-view-BnCLA0gW.js +0 -1
- package/studio-dist/client/assets/spinner-Dcm3fqK1.js +0 -1
- package/studio-dist/client/assets/steps-C0p2N1Pb.js +0 -1
- package/studio-dist/client/assets/store-Dw34catY.js +0 -1
- package/studio-dist/client/assets/studio-Cpz_HRHp.js +0 -100
- package/studio-dist/client/assets/studio-queries-ibmpFo6R.js +0 -2
- package/studio-dist/client/assets/useAnchoredPopupScrollLock-Bj-FWb8z.js +0 -1
- package/studio-dist/client/assets/useMutation-aAr2uiay.js +0 -1
- package/studio-dist/client/assets/vault-BGcxkSIY.js +0 -1
- package/studio-dist/client/assets/warnings-R1cE1rLf.js +0 -1
- package/studio-dist/client/assets/workflow-C2qTrMDH.js +0 -1
- package/studio-dist/server/assets/actions-DYSv-9VV.js +0 -60
- package/studio-dist/server/assets/artifacts-DnF9L3dZ.js +0 -216
- package/studio-dist/server/assets/factory-C7Ybg0xG.js +0 -3075
- package/studio-dist/server/assets/factory-Df5uAHjb.js +0 -116
- package/studio-dist/server/assets/react-CdqSUhaL.js +0 -89
- package/studio-dist/server/assets/report-url-BUXPcE_8.js +0 -9
- package/studio-dist/server/assets/search-BJnWLfkG.js +0 -55
- package/studio-dist/server/assets/spinner-CdwJW4VB.js +0 -20
- package/studio-dist/server/assets/store-Cs17okNG.js +0 -280
- /package/src/lib/{factory/keyed-serial.ts → keyed-serial.ts} +0 -0
- /package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/spec.md +0 -0
|
@@ -1,4 +1,30 @@
|
|
|
1
|
+
import { ARTIFACT_TRAILER, archiveOfArtifact } from "../../../../lib/artifact-trailer";
|
|
2
|
+
import { changeNameOf, parseAnchor } from "../../../../lib/change-layout";
|
|
3
|
+
import {
|
|
4
|
+
recordDelivery,
|
|
5
|
+
type DeliveryEdit,
|
|
6
|
+
type RecordDeliveryDeps,
|
|
7
|
+
} from "../../../../lib/delivery/record-delivery";
|
|
8
|
+
import type { ArtifactType } from "../../../../lib/delivery/staging/artifact-type";
|
|
9
|
+
import { isDeliveryGroup } from "../../../../lib/delivery/staging/naming";
|
|
10
|
+
import { groupOfChange } from "../../../../lib/delivery/staging/submit";
|
|
11
|
+
import { declaredSubmitType } from "../../../../lib/delivery/staging/registry";
|
|
12
|
+
import { errorMessage } from "../../../../runtime/error-message";
|
|
13
|
+
import { settleLinked } from "../../../../lib/delivery/staging/settle-linked";
|
|
14
|
+
import {
|
|
15
|
+
publicationQueue,
|
|
16
|
+
publishSubmitted,
|
|
17
|
+
type PublicationQueue,
|
|
18
|
+
type PublicationResult,
|
|
19
|
+
type PublishDeps,
|
|
20
|
+
} from "../../../../lib/delivery/staging/publish";
|
|
21
|
+
import { stagingRemote } from "../../../../lib/delivery/staging/refs";
|
|
1
22
|
import { resolveForCapability } from "../../../../lib/orchestrator/framework-context";
|
|
23
|
+
import { companionGit, outputLines } from "../../../../runtime/companion-git";
|
|
24
|
+
import type { BranchOutcome } from "../../../../lib/delivery/refresh";
|
|
25
|
+
import { CONFIRM_FLAGS, confirmFlag } from "../delivery/branch-flags";
|
|
26
|
+
import { resolveDeliveryEnvironment, type DeliveryEnvironmentDeps } from "../delivery/environment";
|
|
27
|
+
import { renderOutcome } from "../delivery/output";
|
|
2
28
|
import type { LaunchContext } from "../../../../lib/orchestrator/framework-context";
|
|
3
29
|
import type { CapabilityConfig } from "../../../../lib/orchestrator/types";
|
|
4
30
|
import { WorkingRepoRequiredError } from "../../../../lib/orchestrator/types";
|
|
@@ -35,12 +61,135 @@ export interface PublishCommandDeps {
|
|
|
35
61
|
) => Promise<PublicationSecretScan>;
|
|
36
62
|
/** Injectable readers and prune for the cleanup after a Workset becomes Done. */
|
|
37
63
|
worktreeCleanup?: WorktreeCleanupDeps;
|
|
64
|
+
/** Publishes a Delivery Group of submitted changes; see {@link publishSubmitted}. */
|
|
65
|
+
publishSubmitted?: (
|
|
66
|
+
companionPath: string,
|
|
67
|
+
target: string,
|
|
68
|
+
deps: PublishDeps,
|
|
69
|
+
) => Promise<PublicationResult>;
|
|
70
|
+
/** True when the companion has an upstream a Delivery Group publishes to. */
|
|
71
|
+
hasRemote?: (companionPath: string) => Promise<boolean>;
|
|
72
|
+
/** True when an earlier publication of the target is committed on `HEAD` but not pushed. */
|
|
73
|
+
unpushedPublication?: (companionPath: string, target: string) => Promise<boolean>;
|
|
74
|
+
/** The Delivery Groups `--all` publishes; see {@link publicationQueue}. */
|
|
75
|
+
publicationQueue?: (companionPath: string) => Promise<PublicationQueue>;
|
|
76
|
+
/** Builds the delivery environment `--refresh` and `--confirm-*` settle with. */
|
|
77
|
+
deliveryEnvironment?: DeliveryEnvironmentDeps & RecordDeliveryDeps;
|
|
78
|
+
/** `--refresh`: records the merges linked checkouts settle first; see {@link settleLinked}. */
|
|
79
|
+
settleLinked?: typeof settleLinked;
|
|
38
80
|
stdout?: (line: string) => void;
|
|
39
81
|
stderr?: (line: string) => void;
|
|
40
82
|
}
|
|
41
83
|
|
|
42
84
|
/** Presence-only flags; every other `--flag` consumes the following token as its value. */
|
|
43
|
-
const BOOLEAN_FLAGS: BooleanFlagSet = new Set([
|
|
85
|
+
const BOOLEAN_FLAGS: BooleanFlagSet = new Set([
|
|
86
|
+
"no-push",
|
|
87
|
+
"json",
|
|
88
|
+
"specs",
|
|
89
|
+
"all",
|
|
90
|
+
"refresh",
|
|
91
|
+
...CONFIRM_FLAGS,
|
|
92
|
+
]);
|
|
93
|
+
|
|
94
|
+
async function defaultHasRemote(companionPath: string): Promise<boolean> {
|
|
95
|
+
return (await stagingRemote(companionGit(companionPath, { prompt: "never" }))) !== null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* An earlier publication of `target` committed on `HEAD` that never reached the upstream: a
|
|
100
|
+
* `--no-push` commit, or a tag an older Mate version created. It is pushed from the checkout.
|
|
101
|
+
*/
|
|
102
|
+
export async function unpushedPublication(companionPath: string, target: string): Promise<boolean> {
|
|
103
|
+
const git = companionGit(companionPath, { prompt: "never" });
|
|
104
|
+
const upstream = (await git.upstreamTarget())?.ref;
|
|
105
|
+
if (!upstream) return false;
|
|
106
|
+
const log = await git.run([
|
|
107
|
+
"log",
|
|
108
|
+
`--format=%(trailers:key=${ARTIFACT_TRAILER},valueonly,separator=%x0a)`,
|
|
109
|
+
"--end-of-options",
|
|
110
|
+
`${upstream}..HEAD`,
|
|
111
|
+
]);
|
|
112
|
+
const matches = (anchor: string): boolean =>
|
|
113
|
+
anchor === target || (parseAnchor(anchor) !== null && changeNameOf(anchor) === target);
|
|
114
|
+
const published = log.status === 0 ? outputLines(log.stdout).map(archiveOfArtifact) : [];
|
|
115
|
+
if (published.some((anchor) => anchor !== null && matches(anchor))) return true;
|
|
116
|
+
const tags = await git.run([
|
|
117
|
+
"for-each-ref",
|
|
118
|
+
"--format=%(refname:strip=3)",
|
|
119
|
+
"refs/tags/openspec/",
|
|
120
|
+
]);
|
|
121
|
+
if (tags.status !== 0) return false;
|
|
122
|
+
for (const anchor of outputLines(tags.stdout).filter(matches)) {
|
|
123
|
+
const tag = `refs/tags/openspec/${anchor}`;
|
|
124
|
+
// A tag left on a commit a rebase replaced is not on HEAD, so it marks nothing to push.
|
|
125
|
+
// oxlint-disable-next-line no-await-in-loop -- one tag per archive of the change
|
|
126
|
+
const onHead = await git.run(["merge-base", "--is-ancestor", tag, "HEAD"]);
|
|
127
|
+
if (onHead.status !== 0) continue;
|
|
128
|
+
// oxlint-disable-next-line no-await-in-loop -- same tag
|
|
129
|
+
const reached = await git.run(["merge-base", "--is-ancestor", tag, upstream]);
|
|
130
|
+
if (reached.status === 1) return true;
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** A Delivery Group publication as the publish result the skill reads. */
|
|
136
|
+
function publicationResult(
|
|
137
|
+
type: string,
|
|
138
|
+
target: string,
|
|
139
|
+
publication: PublicationResult,
|
|
140
|
+
): FinishResult {
|
|
141
|
+
const ok = publication.status === "ok";
|
|
142
|
+
return {
|
|
143
|
+
type,
|
|
144
|
+
name: target,
|
|
145
|
+
anchorName: publication.records[0] ?? null,
|
|
146
|
+
tag: null,
|
|
147
|
+
...(publication.commit ? { commit: publication.commit } : {}),
|
|
148
|
+
...(publication.group ? { group: publication.group } : {}),
|
|
149
|
+
changes: publication.changes,
|
|
150
|
+
anchors: publication.records,
|
|
151
|
+
...(publication.reason ? { reason: publication.reason } : {}),
|
|
152
|
+
...(publication.heldBy ? { heldBy: publication.heldBy } : {}),
|
|
153
|
+
...(publication.merges ? { merges: publication.merges } : {}),
|
|
154
|
+
...(publication.blocked ? { blocked: true } : {}),
|
|
155
|
+
...(publication.conflict ? { conflict: publication.conflict } : {}),
|
|
156
|
+
...(publication.dependencies
|
|
157
|
+
? {
|
|
158
|
+
dependencies: publication.dependencies.map((dependency) =>
|
|
159
|
+
publicationResult(type, dependency.group ?? target, dependency),
|
|
160
|
+
),
|
|
161
|
+
}
|
|
162
|
+
: {}),
|
|
163
|
+
resumed: publication.alreadyPublished === true,
|
|
164
|
+
step: ok ? "done" : publication.status === "held" ? "resolve" : "publish",
|
|
165
|
+
status: publication.status,
|
|
166
|
+
conflictedPaths: publication.conflictedPaths,
|
|
167
|
+
local: { committed: ok, tagged: false, pushed: ok },
|
|
168
|
+
message: publication.message,
|
|
169
|
+
...(publication.secretFindings ? { secretFindings: publication.secretFindings } : {}),
|
|
170
|
+
...(publication.warnings.length > 0 ? { warning: publication.warnings.join(" ") } : {}),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Every result a publication carries: its own and those of dependencies published first. */
|
|
175
|
+
function flattened(results: readonly FinishResult[]): FinishResult[] {
|
|
176
|
+
return results.flatMap((result) => [...flattened(result.dependencies ?? []), result]);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** A deferral halts too: the remote is likely still unreachable. */
|
|
180
|
+
function halted(result: FinishResult): boolean {
|
|
181
|
+
return result.status === "conflict" || result.status === "error" || result.status === "deferred";
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** The archives an `ok` result published. */
|
|
185
|
+
function publishedBy(result: FinishResult): string[] {
|
|
186
|
+
if (result.status !== "ok") return [];
|
|
187
|
+
return result.anchors ?? (result.anchorName ? [result.anchorName] : []);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function deliveryRefusal(changes: string[], reason: string): string {
|
|
191
|
+
return `mate: the delivery of ${changes.join(", ")} could not be recorded (${reason}).`;
|
|
192
|
+
}
|
|
44
193
|
|
|
45
194
|
/**
|
|
46
195
|
* Every non-flag token, in order. Consumes the value of a value-taking flag exactly as
|
|
@@ -67,7 +216,7 @@ async function defaultLoadCapabilities(context: LaunchContext): Promise<Capabili
|
|
|
67
216
|
return config.capabilities ?? [];
|
|
68
217
|
}
|
|
69
218
|
|
|
70
|
-
/** A publication the pipeline never ran: nothing was resolved, committed,
|
|
219
|
+
/** A publication the pipeline never ran: nothing was resolved, committed, or pushed. */
|
|
71
220
|
function nothingToPublish(name: string, message: string): FinishResult {
|
|
72
221
|
return {
|
|
73
222
|
type: DEFAULT_FINISHER_TYPE,
|
|
@@ -100,25 +249,44 @@ function refusalResult(type: string, name: string, message: string): FinishResul
|
|
|
100
249
|
|
|
101
250
|
/**
|
|
102
251
|
* @command mate artifact publish <target>
|
|
103
|
-
* @description Publishes
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
252
|
+
* @description Publishes artifacts to the companion's default branch. A submitted change is
|
|
253
|
+
* published with its whole Delivery Group, from any machine, once every delivery in it is
|
|
254
|
+
* merged: in a temporary worktree of the fetched default branch its changes are applied in
|
|
255
|
+
* `dependsOn` order, then submit order (stale check against `specBase`, `openspec archive`,
|
|
256
|
+
* spec validation), committed once with a `Mate-Artifact` trailer per change and a
|
|
257
|
+
* `Mate-Transaction` trailer, secret-scanned and pushed without force, rebuilt once. The
|
|
258
|
+
* group then leaves the inbox `mate/inbox`. A conflict publishes nothing and records `blocked`
|
|
259
|
+
* in the change's `delivery.yaml` on the pending branch; a refused push is
|
|
260
|
+
* `awaiting-publisher`. The checkout and its `HEAD` are not touched. A change depending on an
|
|
261
|
+
* unpublished change of another group publishes that group first, or is held
|
|
262
|
+
* (`dependency-unpublished`). Archives an earlier Mate left uncommitted in this checkout,
|
|
263
|
+
* drifted canonical specs (`--specs`), `--no-push`, and companions without a remote use the
|
|
264
|
+
* commit pipeline on `HEAD` (resolve, branch guard, cap sync, secret scan, commit,
|
|
265
|
+
* sync-with-remote, push). No tag is created; results carry the published `commit`.
|
|
109
266
|
* @flags
|
|
110
|
-
* - `<target>` — a
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
267
|
+
* - `<target>` — a Delivery Group (`<repository>/<branch>`, `change/<name>`), a submitted change
|
|
268
|
+
* name, or the dated anchor (`YYYY-MM-DD-<name>`) or name of a local archive from an earlier
|
|
269
|
+
* Mate. Mutually exclusive with `--specs` and `--all`.
|
|
270
|
+
* - `--refresh` — before publishing, record the merges this machine's linked checkouts settle
|
|
271
|
+
* for every submitted change, then check each branch of the group's changes in its linked
|
|
272
|
+
* checkout, recorded in its `delivery.yaml` on the pending branch (published with the group,
|
|
273
|
+
* else pushed there alone).
|
|
274
|
+
* - `--confirm-merged` / `--confirm-open` / `--confirm-dropped` — the user's answer for the
|
|
275
|
+
* group's Working Repository delivery, else for the repository the group is named after,
|
|
276
|
+
* recorded the same way. One at a time; never with
|
|
277
|
+
* `--all`, `--specs` or `--no-push`.
|
|
278
|
+
* - `--specs [<path>...]` — publish drifted canonical specs as their own publication. Bare, it
|
|
279
|
+
* publishes every drifted spec; with paths, only those. A bare name alongside it is a change
|
|
280
|
+
* target and is refused.
|
|
281
|
+
* - `--all` — publish every submitted Delivery Group, dependencies first, then every local
|
|
282
|
+
* archive of an earlier Mate, then one spec publication for the drift that remains. Skips
|
|
283
|
+
* what is held or awaits a publisher, and a group resting on a merge someone else answered
|
|
284
|
+
* that no checkout found (`unconfirmed-merge`; publish it by name to accept the answer); a group's conflict blocks only that group and the run
|
|
285
|
+
* goes on, exiting 1 at the end. Halts at the first error or deferral; with `--json` it emits
|
|
286
|
+
* a single array of results in execution order.
|
|
119
287
|
* - `--type <type>` — finisher type to use; see `knownFinisherTypes()`. `--specs` and
|
|
120
288
|
* `--all` are openspec-only.
|
|
121
|
-
* - `--no-push` — commit
|
|
289
|
+
* - `--no-push` — commit a local archive on `HEAD` but skip the remote sync and push.
|
|
122
290
|
* - `--json` — emit machine-readable JSON instead of human-readable text.
|
|
123
291
|
* @remarks No-ops (with a message on stderr) when the selected finisher is disabled for the
|
|
124
292
|
* repo's configured capabilities — nothing is resolved or mutated in that case.
|
|
@@ -163,7 +331,29 @@ export async function runArtifactPublishCommand(
|
|
|
163
331
|
return;
|
|
164
332
|
}
|
|
165
333
|
if (!allMode && !specsMode && positionals.length === 0) {
|
|
166
|
-
refuse(
|
|
334
|
+
refuse(
|
|
335
|
+
"mate: artifact publish requires a Delivery Group, a change name or archive anchor, --specs, or --all.",
|
|
336
|
+
);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
const confirmation = confirmFlag(flags);
|
|
340
|
+
if ("error" in confirmation) {
|
|
341
|
+
refuse(confirmation.error);
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
const { confirm } = confirmation;
|
|
345
|
+
const refresh = flags.refresh === true;
|
|
346
|
+
const settling = refresh || confirm !== undefined;
|
|
347
|
+
if (confirm !== undefined && (allMode || specsMode)) {
|
|
348
|
+
refuse(
|
|
349
|
+
"mate: --confirm-* answers for the Delivery Group of one target; name it instead of --all or --specs.",
|
|
350
|
+
);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
if (settling && (specsMode || noPush)) {
|
|
354
|
+
refuse(
|
|
355
|
+
"mate: --refresh and --confirm-* record on the pending branch, which --specs and --no-push never reach; record with `mate artifact link` instead.",
|
|
356
|
+
);
|
|
167
357
|
return;
|
|
168
358
|
}
|
|
169
359
|
if ((allMode || specsMode) && type !== DEFAULT_FINISHER_TYPE) {
|
|
@@ -203,6 +393,17 @@ export async function runArtifactPublishCommand(
|
|
|
203
393
|
const loadCapabilities = deps.loadCapabilities ?? defaultLoadCapabilities;
|
|
204
394
|
const capabilities = await loadCapabilities(context);
|
|
205
395
|
|
|
396
|
+
// The declared type the companion's submit handles; an invalid declaration publishes nothing.
|
|
397
|
+
let declaredType: ArtifactType | undefined;
|
|
398
|
+
try {
|
|
399
|
+
declaredType = await declaredSubmitType(context.companionPath);
|
|
400
|
+
} catch (err) {
|
|
401
|
+
emitErr(`mate: ${errorMessage(err)}`);
|
|
402
|
+
process.exitCode = 1;
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
const typeDeps = declaredType ? { artifactType: declaredType } : {};
|
|
406
|
+
|
|
206
407
|
let git: GitOps;
|
|
207
408
|
const finishContext: FinishContext = {
|
|
208
409
|
companionPath: context.companionPath,
|
|
@@ -226,16 +427,19 @@ export async function runArtifactPublishCommand(
|
|
|
226
427
|
);
|
|
227
428
|
} catch (err) {
|
|
228
429
|
const message = `mate: publish Git guard rejected the target: ${String(err)}`;
|
|
229
|
-
|
|
230
|
-
|
|
430
|
+
emitErr(message);
|
|
431
|
+
if (json) {
|
|
432
|
+
const refusal = refusalResult(type, positionals[0] ?? "", message);
|
|
433
|
+
emitOut(JSON.stringify(allMode ? [refusal] : refusal));
|
|
434
|
+
}
|
|
231
435
|
process.exitCode = 1;
|
|
232
436
|
return;
|
|
233
437
|
}
|
|
234
438
|
|
|
235
439
|
const now = deps.now ?? (() => new Date());
|
|
236
440
|
/**
|
|
237
|
-
* Under `--all --json` the array is the whole
|
|
238
|
-
*
|
|
441
|
+
* Under `--all --json` the array is the whole stdout, so per-publication stdout is suppressed;
|
|
442
|
+
* stderr still names each failure as it happens.
|
|
239
443
|
*/
|
|
240
444
|
const quiet = allMode && json;
|
|
241
445
|
const scanPublicationFn = deps.scanPublication ?? scanPublication;
|
|
@@ -243,35 +447,228 @@ export async function runArtifactPublishCommand(
|
|
|
243
447
|
git,
|
|
244
448
|
json: !allMode && json,
|
|
245
449
|
stdout: quiet ? (): void => {} : emitOut,
|
|
246
|
-
stderr:
|
|
450
|
+
stderr: emitErr,
|
|
247
451
|
secretScan: (commitPaths: string[]) => scanPublicationFn(context.companionPath, commitPaths),
|
|
248
452
|
};
|
|
249
453
|
|
|
250
|
-
const
|
|
251
|
-
|
|
454
|
+
const deliveryEnvironment = () =>
|
|
455
|
+
resolveDeliveryEnvironment({
|
|
456
|
+
ensureUnambiguousCompanion: async () => true,
|
|
457
|
+
resolveContext: async () => context,
|
|
458
|
+
loadCapabilities: async () => capabilities,
|
|
459
|
+
...deps.deliveryEnvironment,
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
/** `--refresh`: the merges linked checkouts settle are recorded once per run, before any group. */
|
|
463
|
+
let linkedSettled: Promise<boolean> | undefined;
|
|
464
|
+
/** True when it pushed a record, which leaves refs fetched before it stale. */
|
|
465
|
+
const settleLinkedOnce = (): Promise<boolean> =>
|
|
466
|
+
(linkedSettled ??= (async () => {
|
|
467
|
+
const environment = await deliveryEnvironment();
|
|
468
|
+
if ("error" in environment) return false;
|
|
469
|
+
const settled = await (deps.settleLinked ?? settleLinked)(
|
|
470
|
+
environment,
|
|
471
|
+
deps.deliveryEnvironment ?? {},
|
|
472
|
+
);
|
|
473
|
+
if (settled.warning) emitErr(`mate: ${settled.warning}`);
|
|
474
|
+
return settled.recorded.length > 0;
|
|
475
|
+
})());
|
|
476
|
+
|
|
477
|
+
/** What `--refresh` found per change, kept for the result of a group it leaves held. */
|
|
478
|
+
const refreshOutcomes = new Map<string, BranchOutcome[]>();
|
|
479
|
+
/** Names why a group held as unmerged still waits: the lookups that need the user's answer. */
|
|
480
|
+
const withOutcomes = (result: FinishResult): FinishResult => {
|
|
481
|
+
const dependencies = result.dependencies?.map(withOutcomes);
|
|
482
|
+
const next = dependencies ? { ...result, dependencies } : result;
|
|
483
|
+
if (result.status !== "held" || result.reason !== "unmerged") return next;
|
|
484
|
+
const seen = new Set<string>();
|
|
485
|
+
const outcomes = (result.changes ?? [])
|
|
486
|
+
.flatMap((change) => refreshOutcomes.get(change) ?? [])
|
|
487
|
+
.filter((outcome) => {
|
|
488
|
+
const key = `${outcome.repository}\n${outcome.branch}`;
|
|
489
|
+
if (!outcome.needsAnswer || seen.has(key)) return false;
|
|
490
|
+
seen.add(key);
|
|
491
|
+
return true;
|
|
492
|
+
});
|
|
493
|
+
if (outcomes.length === 0) return next;
|
|
494
|
+
const lines = outcomes.flatMap(renderOutcome);
|
|
495
|
+
return {
|
|
496
|
+
...next,
|
|
497
|
+
outcomes,
|
|
498
|
+
message: `${result.message}\n${lines.join("\n")}\n Answer with --confirm-merged, --confirm-open or --confirm-dropped.`,
|
|
499
|
+
};
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
/** Records `--refresh` and, unless `refreshOnly`, `--confirm-*` into the changes in `dir`. */
|
|
503
|
+
const settleWith =
|
|
504
|
+
(refreshOnly: boolean) =>
|
|
505
|
+
async (dir: string, changes: string[]): Promise<string | null> => {
|
|
506
|
+
const environment = await deliveryEnvironment();
|
|
507
|
+
if ("error" in environment) return environment.error;
|
|
508
|
+
const answer = refreshOnly ? undefined : confirm;
|
|
509
|
+
const record = (names: string[], edit: DeliveryEdit = {}, repository?: string) =>
|
|
510
|
+
recordDelivery(
|
|
511
|
+
{ ...environment, companionPath: dir },
|
|
512
|
+
{
|
|
513
|
+
changes: names,
|
|
514
|
+
repository,
|
|
515
|
+
refresh: edit.confirm === undefined && refresh,
|
|
516
|
+
refreshAll: true,
|
|
517
|
+
edit,
|
|
518
|
+
// The worktree's HEAD is the publication tip; a base set here would hide staleness.
|
|
519
|
+
leaveSpecBase: true,
|
|
520
|
+
},
|
|
521
|
+
deps.deliveryEnvironment ?? {},
|
|
522
|
+
);
|
|
523
|
+
if (refresh) {
|
|
524
|
+
const outcome = await record(changes);
|
|
525
|
+
if ("refusal" in outcome) return deliveryRefusal(changes, outcome.refusal.reason);
|
|
526
|
+
if ("results" in outcome) {
|
|
527
|
+
for (const entry of outcome.results) refreshOutcomes.set(entry.change, entry.outcomes);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
if (!answer) return null;
|
|
531
|
+
// The answer is for the Working Repository's delivery, else, as in the companion or for a
|
|
532
|
+
// group of another repository, for the repository the group is named after; changes
|
|
533
|
+
// without that delivery keep theirs.
|
|
534
|
+
const groupRepository = async (change: string) =>
|
|
535
|
+
(await groupOfChange(dir, change, declaredType)).repository;
|
|
536
|
+
const confirmEach = async (
|
|
537
|
+
repositoryOf: (change: string) => Promise<string | undefined>,
|
|
538
|
+
): Promise<number | string> => {
|
|
539
|
+
let confirmed = 0;
|
|
540
|
+
for (const change of changes) {
|
|
541
|
+
// oxlint-disable-next-line no-await-in-loop -- one record at a time, in group order
|
|
542
|
+
const outcome = await record([change], { confirm: answer }, await repositoryOf(change));
|
|
543
|
+
if (!("refusal" in outcome)) confirmed += 1;
|
|
544
|
+
else if (outcome.refusal.reason !== "no-delivery-branch") {
|
|
545
|
+
return deliveryRefusal([change], outcome.refusal.reason);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
return confirmed;
|
|
549
|
+
};
|
|
550
|
+
const working = environment.workingRepo;
|
|
551
|
+
const inWorking = Boolean(working?.slug || working?.umbrellaChildren);
|
|
552
|
+
let confirmed = await confirmEach(inWorking ? async () => undefined : groupRepository);
|
|
553
|
+
if (confirmed === 0 && inWorking) confirmed = await confirmEach(groupRepository);
|
|
554
|
+
if (typeof confirmed === "string") return confirmed;
|
|
555
|
+
return confirmed > 0 ? null : deliveryRefusal(changes, "no-delivery-branch");
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
const hasRemote = !noPush && (await (deps.hasRemote ?? defaultHasRemote)(context.companionPath));
|
|
559
|
+
|
|
560
|
+
/** One capability sync per run, however many groups `--all` publishes. */
|
|
561
|
+
let capSynced: Promise<boolean> | undefined;
|
|
562
|
+
/** Set by the `--all` queue's fetch; the next publication reuses it instead of fetching again. */
|
|
563
|
+
let refsFresh = false;
|
|
564
|
+
const publishGroup = async (target: string, inQueue = false): Promise<FinishResult> => {
|
|
565
|
+
capSynced ??= finisher.capSync ? finisher.capSync() : Promise.resolve(true);
|
|
566
|
+
if (!(await capSynced)) {
|
|
567
|
+
process.exitCode = 1;
|
|
568
|
+
return refusalResult(type, target, "mate: cap sync failed; nothing was published.");
|
|
569
|
+
}
|
|
570
|
+
if (refresh && (await settleLinkedOnce())) refsFresh = false;
|
|
571
|
+
const fresh = refsFresh;
|
|
572
|
+
refsFresh = false;
|
|
573
|
+
const publication = await (deps.publishSubmitted ?? publishSubmitted)(
|
|
574
|
+
context.companionPath,
|
|
575
|
+
target,
|
|
576
|
+
{
|
|
577
|
+
...(settling ? { settle: settleWith(false) } : {}),
|
|
578
|
+
...(refresh ? { settleDependency: settleWith(true) } : {}),
|
|
579
|
+
...(fresh ? { fresh } : {}),
|
|
580
|
+
// `--all` publishes dependencies in queue order instead, and takes nobody's answer.
|
|
581
|
+
...(inQueue ? { withDependencies: false, ownAnswersOnly: true } : {}),
|
|
582
|
+
scan: scanPublicationFn,
|
|
583
|
+
...typeDeps,
|
|
584
|
+
},
|
|
585
|
+
);
|
|
586
|
+
const result = withOutcomes(publicationResult(type, target, publication));
|
|
587
|
+
if (result.status === "conflict" || result.status === "error") process.exitCode = 1;
|
|
588
|
+
return result;
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
/** Uncommitted archives of an earlier Mate, which publish from this checkout only. */
|
|
592
|
+
const localPendingArchives = async (changed = git.changedPaths()) => {
|
|
593
|
+
const paths = await changed;
|
|
594
|
+
const changeKinds = (await git.changedPathKinds?.()) ?? {};
|
|
595
|
+
return pendingArchives(await discoverArchives(context.companionPath, paths, changeKinds));
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Names of the checkout's pending archives, read once per run: publishing commits one but never
|
|
600
|
+
* adds one.
|
|
601
|
+
*/
|
|
602
|
+
let pendingArchiveNames: Promise<Set<string>> | undefined;
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Publishes from this checkout what only it holds (an archive of an earlier Mate, an unpushed
|
|
606
|
+
* earlier publication) and everything without a remote; otherwise the Delivery Group.
|
|
607
|
+
*/
|
|
608
|
+
const usesCheckout = async (target: string): Promise<boolean> => {
|
|
609
|
+
if (!hasRemote) return true;
|
|
610
|
+
if (isDeliveryGroup(target)) return false;
|
|
611
|
+
if (parseAnchor(target)) return true;
|
|
612
|
+
pendingArchiveNames ??= localPendingArchives().then(
|
|
613
|
+
(entries) => new Set(entries.map((entry) => entry.name)),
|
|
614
|
+
);
|
|
615
|
+
if ((await pendingArchiveNames).has(target)) return true;
|
|
616
|
+
return (deps.unpushedPublication ?? unpushedPublication)(context.companionPath, target);
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
/** Never prints: the caller does, once cleanup has attached `worktrees`. */
|
|
620
|
+
const runChange = async (target: string): Promise<FinishResult> => {
|
|
621
|
+
if (!hasRemote && isDeliveryGroup(target)) {
|
|
622
|
+
process.exitCode = 1;
|
|
623
|
+
return refusalResult(
|
|
624
|
+
type,
|
|
625
|
+
target,
|
|
626
|
+
`mate: ${target} is a Delivery Group, which publishes to the companion remote; ${noPush ? "drop --no-push" : "the companion has no remote"}.`,
|
|
627
|
+
);
|
|
628
|
+
}
|
|
629
|
+
if (!(await usesCheckout(target))) return await publishGroup(target);
|
|
630
|
+
if (!settling) {
|
|
631
|
+
return runFinishEngine(
|
|
632
|
+
finisher,
|
|
633
|
+
{ name: target, noPush },
|
|
634
|
+
{ ...engineDeps, printResult: false },
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
process.exitCode = 1;
|
|
638
|
+
return refusalResult(
|
|
639
|
+
type,
|
|
640
|
+
target,
|
|
641
|
+
`mate: ${target} is not submitted, so --refresh or --confirm-* has nothing to record on; record with \`mate artifact link\`, then publish again.`,
|
|
642
|
+
);
|
|
643
|
+
};
|
|
252
644
|
|
|
253
645
|
/**
|
|
254
646
|
* Cleans up the Worksets these change results made Done and attaches each outcome to the
|
|
255
647
|
* result that completed it. Runs after every status and exit code is final; never throws.
|
|
256
648
|
*/
|
|
257
649
|
const cleanUpWorktrees = async (changeResults: readonly FinishResult[]): Promise<void> => {
|
|
258
|
-
const
|
|
259
|
-
result.status === "ok" && result.anchorName ? [result.anchorName] : [],
|
|
260
|
-
);
|
|
650
|
+
const all = flattened(changeResults);
|
|
261
651
|
const outcomes = await cleanUpCompletedWorksets(
|
|
262
652
|
context.companionPath,
|
|
263
|
-
|
|
653
|
+
all.flatMap((result) =>
|
|
654
|
+
publishedBy(result).map((anchor) => ({
|
|
655
|
+
anchor,
|
|
656
|
+
...(result.commit ? { commit: result.commit } : {}),
|
|
657
|
+
})),
|
|
658
|
+
),
|
|
264
659
|
deps.worktreeCleanup,
|
|
265
660
|
);
|
|
266
|
-
for (const result of
|
|
267
|
-
const outcome =
|
|
661
|
+
for (const result of all) {
|
|
662
|
+
const outcome = publishedBy(result)
|
|
663
|
+
.map((anchor) => outcomes.get(anchor))
|
|
664
|
+
.find((found) => found !== undefined);
|
|
268
665
|
if (outcome) result.worktrees = outcome;
|
|
269
666
|
}
|
|
270
667
|
};
|
|
271
668
|
|
|
272
669
|
const printWorktrees = (changeResults: readonly FinishResult[]): void => {
|
|
273
670
|
if (json) return;
|
|
274
|
-
for (const { worktrees } of changeResults) {
|
|
671
|
+
for (const { worktrees } of flattened(changeResults)) {
|
|
275
672
|
for (const entry of worktrees?.removed ?? []) emitErr(`mate: removed worktree ${entry.path}`);
|
|
276
673
|
for (const entry of worktrees?.kept ?? []) {
|
|
277
674
|
emitErr(`mate: kept worktree ${entry.path} (${entry.reason})`);
|
|
@@ -283,9 +680,10 @@ export async function runArtifactPublishCommand(
|
|
|
283
680
|
const runSpecs = async (requested: string[]): Promise<FinishResult | null> => {
|
|
284
681
|
const drift = await resolveDriftedSpecs(context.companionPath, git, requested);
|
|
285
682
|
if (!drift.ok) {
|
|
286
|
-
|
|
683
|
+
const refusal = refusalResult(type, "--specs", drift.message);
|
|
684
|
+
printFinishResult(refusal, engineDeps);
|
|
287
685
|
process.exitCode = 1;
|
|
288
|
-
return
|
|
686
|
+
return refusal;
|
|
289
687
|
}
|
|
290
688
|
if (drift.paths.length === 0) return null;
|
|
291
689
|
const makeSpecsFinisher = deps.specsFinisher ?? openspecSpecsFinisher;
|
|
@@ -293,39 +691,73 @@ export async function runArtifactPublishCommand(
|
|
|
293
691
|
return runFinishEngine(specsFinisher, { name: "--specs", noPush }, engineDeps);
|
|
294
692
|
};
|
|
295
693
|
|
|
296
|
-
/** A deferral halts too: the remote is likely still unreachable, and the re-run must tag its own commit. */
|
|
297
|
-
const halted = (result: FinishResult): boolean =>
|
|
298
|
-
result.status === "conflict" || result.status === "error" || result.status === "deferred";
|
|
299
|
-
|
|
300
694
|
if (allMode) {
|
|
301
695
|
const results: FinishResult[] = [];
|
|
302
696
|
const changeResults: FinishResult[] = [];
|
|
303
|
-
|
|
304
|
-
const
|
|
305
|
-
|
|
697
|
+
let blocked = false;
|
|
698
|
+
const stop = async (): Promise<void> => {
|
|
699
|
+
// Worksets completed before the halt are still cleaned up.
|
|
700
|
+
await cleanUpWorktrees(changeResults);
|
|
701
|
+
printWorktrees(changeResults);
|
|
702
|
+
if (json) emitOut(JSON.stringify(results));
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
if (hasRemote) {
|
|
706
|
+
const queue = await (deps.publicationQueue ?? publicationQueue)(
|
|
707
|
+
context.companionPath,
|
|
708
|
+
typeDeps,
|
|
709
|
+
);
|
|
710
|
+
// A queue read from stale refs: the first publication fetches for itself.
|
|
711
|
+
refsFresh = queue.fresh;
|
|
712
|
+
for (const group of queue.groups) {
|
|
713
|
+
// oxlint-disable-next-line no-await-in-loop -- publications push one after another
|
|
714
|
+
const result = await publishGroup(group, true);
|
|
715
|
+
printFinishResult(result, engineDeps);
|
|
716
|
+
results.push(result);
|
|
717
|
+
// A group waiting on a merge, a dependency or a publisher does not stop the others.
|
|
718
|
+
if (result.status === "held" || result.status === "awaiting-publisher") continue;
|
|
719
|
+
changeResults.push(result);
|
|
720
|
+
// A group publication never touches the checkout, so its conflict blocks only that group.
|
|
721
|
+
if (result.status === "conflict") {
|
|
722
|
+
blocked = true;
|
|
723
|
+
continue;
|
|
724
|
+
}
|
|
725
|
+
if (halted(result)) {
|
|
726
|
+
// oxlint-disable-next-line no-await-in-loop -- ends the loop
|
|
727
|
+
await stop();
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
refsFresh = false;
|
|
732
|
+
}
|
|
306
733
|
|
|
307
|
-
|
|
734
|
+
const changed = git.changedPaths();
|
|
735
|
+
for (const entry of await localPendingArchives(changed)) {
|
|
308
736
|
// A held-back archive waits for its merge; it does not stop the merged ones.
|
|
309
737
|
// Same cache as the finisher's resolve step, so both see one pending set and agree.
|
|
738
|
+
// oxlint-disable-next-line no-await-in-loop -- one archive after another
|
|
310
739
|
const hold = await publicationHold(
|
|
311
740
|
context.companionPath,
|
|
312
741
|
entry.anchor,
|
|
313
|
-
|
|
742
|
+
() => changed,
|
|
314
743
|
finishContext.holdCache,
|
|
315
744
|
);
|
|
316
745
|
if (hold) {
|
|
317
|
-
|
|
746
|
+
emitErr(hold);
|
|
318
747
|
results.push(nothingToPublish(entry.anchor, hold));
|
|
319
748
|
continue;
|
|
320
749
|
}
|
|
321
|
-
|
|
750
|
+
// oxlint-disable-next-line no-await-in-loop -- one archive after another
|
|
751
|
+
const result = await runFinishEngine(
|
|
752
|
+
finisher,
|
|
753
|
+
{ name: entry.anchor, noPush },
|
|
754
|
+
{ ...engineDeps, printResult: true },
|
|
755
|
+
);
|
|
322
756
|
results.push(result);
|
|
323
757
|
changeResults.push(result);
|
|
324
758
|
if (halted(result)) {
|
|
325
|
-
//
|
|
326
|
-
await
|
|
327
|
-
printWorktrees(changeResults);
|
|
328
|
-
if (json) emitOut(JSON.stringify(results));
|
|
759
|
+
// oxlint-disable-next-line no-await-in-loop -- ends the loop
|
|
760
|
+
await stop();
|
|
329
761
|
return;
|
|
330
762
|
}
|
|
331
763
|
}
|
|
@@ -333,11 +765,10 @@ export async function runArtifactPublishCommand(
|
|
|
333
765
|
/** Drift is recomputed: a spec a change just committed is no longer drifted. */
|
|
334
766
|
const specResult = await runSpecs([]);
|
|
335
767
|
if (specResult) results.push(specResult);
|
|
768
|
+
if (blocked) process.exitCode = 1;
|
|
336
769
|
|
|
337
|
-
await
|
|
338
|
-
|
|
339
|
-
if (json) emitOut(JSON.stringify(results));
|
|
340
|
-
else if (results.length === 0) emitOut("Nothing to publish.");
|
|
770
|
+
await stop();
|
|
771
|
+
if (!json && results.length === 0) emitOut("Nothing to publish.");
|
|
341
772
|
return;
|
|
342
773
|
}
|
|
343
774
|
|
|
@@ -354,7 +785,7 @@ export async function runArtifactPublishCommand(
|
|
|
354
785
|
}
|
|
355
786
|
|
|
356
787
|
// Printed here, after cleanup, so `--json` stays one object that carries `worktrees`.
|
|
357
|
-
const result = await runChange(positionals[0]
|
|
788
|
+
const result = await runChange(positionals[0]);
|
|
358
789
|
await cleanUpWorktrees([result]);
|
|
359
790
|
printFinishResult(result, { json, stdout: emitOut, stderr: emitErr });
|
|
360
791
|
printWorktrees([result]);
|