@uniqbit/mate-core 1.0.0-canary.7 → 1.0.0-canary.8
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/package.json +6 -3
- package/src/cli/commands/artifact/delivery/submit.ts +6 -4
- package/src/cli/commands/artifact/finish/command.ts +28 -11
- package/src/cli/commands/artifact/pending/command.ts +71 -7
- package/src/cli/commands/cap/tokensave.ts +2 -2
- package/src/cli/commands/companion/update.ts +2 -3
- package/src/cli/commands/doctor.ts +16 -4
- package/src/cli/commands/install.ts +8 -4
- package/src/cli/commands/plugin/install.ts +82 -35
- package/src/cli/commands/studio/service-host.ts +3 -0
- package/src/cli/commands/triage.ts +32 -11
- package/src/cli/commands/vscode/release-vsix.json +2 -2
- package/src/cli/install-plan.tsx +3 -0
- package/src/cli/main.ts +51 -7
- package/src/cli/usage.ts +3 -3
- package/src/factory-host.ts +6 -0
- package/src/index.ts +1 -0
- package/src/lib/delivery/merge-git.ts +31 -7
- package/src/lib/delivery/overlap.ts +14 -1
- package/src/lib/delivery/repository-access.ts +11 -6
- package/src/lib/delivery/staging/apply-chain.ts +25 -7
- package/src/lib/delivery/staging/linked-merges.ts +175 -0
- package/src/lib/delivery/staging/naming.ts +3 -0
- package/src/lib/delivery/staging/openspec-type.ts +38 -7
- package/src/lib/delivery/staging/pending.ts +153 -11
- package/src/lib/delivery/staging/preflight.ts +239 -0
- package/src/lib/delivery/staging/project.ts +243 -104
- package/src/lib/delivery/staging/replay.ts +5 -3
- package/src/lib/delivery/staging/settle-linked.ts +5 -119
- package/src/lib/delivery/staging/submit.ts +139 -18
- package/src/lib/delivery/submit-change.ts +163 -37
- package/src/lib/friction/mark.ts +49 -11
- package/src/lib/friction/view/read.ts +10 -1
- package/src/lib/openspec-cli.ts +10 -5
- package/src/lib/skills-cli.ts +38 -0
- package/src/lib/tool-manifest.ts +73 -0
- package/src/lib/triage/context.ts +138 -12
- package/src/lib/triage/prepare.ts +19 -4
- package/src/plugin-api.ts +1 -0
- package/src/runtime/command-arg.ts +15 -0
- package/src/runtime/companion-guidance.ts +1 -1
- package/src/runtime/friction-log.ts +41 -17
- package/src/runtime/friction-recorder.ts +15 -2
- package/src/runtime/git-tracked.ts +13 -2
- package/src/studio.ts +6 -1
- package/src/templates/capabilities/openspec-cap/mate-minimal/schema.yaml +5 -1
- package/src/templates/capabilities/react-doctor/mate-react-doctor/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +42 -4
- package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +27 -2
- package/src/templates/mate-skills/agents/mate-backfill-spec/SKILL.md +23 -1
- package/src/templates/mate-skills/agents/mate-clarify-intent/SKILL.md +26 -1
- package/src/templates/mate-skills/agents/mate-domain-modeling/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +28 -3
- 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 +28 -3
- package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +28 -6
- package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +27 -2
- package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-submit-change/SKILL.md +24 -2
- package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +42 -4
- package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +27 -2
- package/src/templates/mate-skills/claude/mate-backfill-spec/SKILL.md +23 -1
- package/src/templates/mate-skills/claude/mate-clarify-intent/SKILL.md +26 -1
- package/src/templates/mate-skills/claude/mate-domain-modeling/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +28 -3
- 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 +28 -3
- package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +28 -6
- package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +27 -2
- package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-submit-change/SKILL.md +24 -2
- package/src/templates/triage/PLAYBOOK.md +9 -1
- package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +108 -108
- package/src/tools/setup/capabilities/graphify.ts +23 -1
- package/src/tools/setup/capabilities/rtk.ts +27 -86
- package/src/tools/setup/capabilities/tokensave.ts +76 -54
- package/src/tools/setup/dynamic-plugins/audiences.ts +28 -14
- 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 +17 -8
- package/src/tools/setup/mate.ts +26 -1
- package/src/tools/setup/plugins/gitignore.ts +45 -12
- package/src/tools/setup/service.ts +8 -0
- package/src/tools/setup/utils.ts +10 -1
- package/studio-dist/client/assets/app-ggXJ_QVh.css +2 -0
- package/studio-dist/client/assets/button-amJ3g5oD.js +1 -0
- package/studio-dist/client/assets/cn-BQPKiwI4.js +1 -0
- package/studio-dist/client/assets/combobox-CJ7aGFid.js +1 -0
- package/studio-dist/client/assets/{companion-view-DINdPF-b.js → companion-view-C_N237bf.js} +1 -1
- package/studio-dist/client/assets/fields-BAiGkJ5N.js +1 -0
- package/studio-dist/client/assets/friction-DqOU59v7.js +1 -0
- package/studio-dist/client/assets/getting-started-yp42dj5S.js +1 -0
- package/studio-dist/client/assets/{getting-started._topic-DVB8e5R9.js → getting-started._topic-C9zVXz_m.js} +1 -1
- package/studio-dist/client/assets/{getting-started.index-DQvLHEr1.js → getting-started.index-DWbDKICP.js} +1 -1
- package/studio-dist/client/assets/graph-BYaD_5Bq.js +2 -0
- package/studio-dist/client/assets/{graph-canvas-DIcAqwtK.js → graph-canvas-ySGKMhmk.js} +1 -1
- package/studio-dist/client/assets/index-Qx7reRPD.js +40 -0
- package/studio-dist/client/assets/panel-C4bf_h2W.js +1 -0
- package/studio-dist/client/assets/plugins._service._view-y6f2FDAB.js +1 -0
- package/studio-dist/client/assets/reports-JFSwSueq.js +1 -0
- package/studio-dist/client/assets/routes-BdOWSgzK.js +1 -0
- package/studio-dist/client/assets/select-BHYYWPhK.js +1 -0
- package/studio-dist/client/assets/skills-Bo9FLsBd.js +1 -0
- package/studio-dist/client/assets/{specs-Dl8HfGlU.js → specs-BrCOjOch.js} +1 -1
- package/studio-dist/client/assets/specs-view-CdE2rlli.js +1 -0
- package/studio-dist/client/assets/{store-DyXbi6o9.js → store-C3vJq8Wj.js} +1 -1
- package/studio-dist/client/assets/{usage-Blcl8kA_.js → usage-BLsLy0nN.js} +13 -13
- package/studio-dist/client/assets/{useAnchoredPopupScrollLock-BBXJpX5L.js → useAnchoredPopupScrollLock-DC7f8GOp.js} +1 -1
- package/studio-dist/client/assets/useMutation-uJUrejsi.js +1 -0
- package/studio-dist/client/assets/vault-BB1B_OhR.js +1 -0
- package/studio-dist/client/assets/warnings-CqOOGlPD.js +1 -0
- package/studio-dist/client/assets/workflow-BFzmI-06.js +1 -0
- package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-JoHQ5ihx.js → __23tanstack-start-server-fn-resolver-gVfW5vIV.js} +1 -1
- package/studio-dist/server/assets/_tanstack-start-manifest_v.js +42 -42
- package/studio-dist/server/assets/{button-B7e1fRyW.js → button-D6bvrFmm.js} +3 -3480
- package/studio-dist/server/assets/cn-FXJAM0KO.js +5528 -0
- package/studio-dist/server/assets/{combobox--S_OmUfh.js → combobox-D2MbYV1O.js} +6 -5
- package/studio-dist/server/assets/{companion-view-D-vGM55e.js → companion-view-Mf1ANbMb.js} +2 -2
- package/studio-dist/server/assets/{fields-B4qM2ZwC.js → fields-B4mAPETz.js} +2 -1
- package/studio-dist/server/assets/{friction-sLxaWY-H.js → friction-9a5S1m7U.js} +54 -14
- package/studio-dist/server/assets/{getting-started-Cq5Pcnsr.js → getting-started-RU6tYU2Q.js} +2 -2
- package/studio-dist/server/assets/{getting-started._topic-CmWdl3u3.js → getting-started._topic-C02HGrC6.js} +2 -2
- package/studio-dist/server/assets/{getting-started.index-AB8xpTFY.js → getting-started.index-EzLRosbb.js} +2 -2
- package/studio-dist/server/assets/{graph-C_Hn-Wf_.js → graph-CZ2H9Fzr.js} +7 -6
- package/studio-dist/server/assets/{graph-canvas-BthrSmPS.js → graph-canvas-rP5TT14Z.js} +1 -1
- package/studio-dist/server/assets/{guides-BVQ4pt5B.js → guides-BGftp4wf.js} +1 -1
- package/studio-dist/server/assets/{markdown-view-rwiiVcPC.js → markdown-view-CArpV-CS.js} +1 -1
- package/studio-dist/server/assets/{panel-CUxRIpYL.js → panel-DR0iq46J.js} +4 -3
- package/studio-dist/server/assets/{plugins._service._view-BSvGnlhU.js → plugins._service._view-n7u2k5dF.js} +7 -4
- package/studio-dist/server/assets/{queries-S_Pl90IG.js → queries-D-yVP9i0.js} +1 -1
- package/studio-dist/server/assets/{reports-CJpAItPk.js → reports-C2SmTgqh.js} +6 -5
- package/studio-dist/server/assets/{router-DF0etoNa.js → router-CPt0TAk_.js} +54 -29
- package/studio-dist/server/assets/{routes-6ylCLkyg.js → routes-CwH8LEy2.js} +8 -7
- package/studio-dist/server/assets/{select-CjuKScan.js → select-C3i6TTX-.js} +5 -4
- package/studio-dist/server/assets/{shell-DLkP7wG9.js → shell-CagqZZMZ.js} +2 -1
- package/studio-dist/server/assets/{skills-zeU80A9S.js → skills-C21Mg_8-.js} +7 -6
- package/studio-dist/server/assets/{specs-DDBNT_v1.js → specs-DetoMiaB.js} +3 -3
- package/studio-dist/server/assets/{specs-view-exvmWdg0.js → specs-view-CmbfLDwN.js} +9 -8
- package/studio-dist/server/assets/{store-kS7zk0Hr.js → store-aC-I6f6o.js} +1 -1
- package/studio-dist/server/assets/{studio-queries-qOXOYoPt.js → studio-queries-Dqf-3nzj.js} +1 -1
- package/studio-dist/server/assets/{usage-C2um7YiV.js → usage-CS4CBK9D.js} +9 -9
- package/studio-dist/server/assets/{useAnchoredPopupScrollLock-kQBB3y_b.js → useAnchoredPopupScrollLock-BjMNgXv9.js} +2 -2
- package/studio-dist/server/assets/{useMutation-C-WO6hCM.js → useMutation-DpBIuWXt.js} +2 -2
- package/studio-dist/server/assets/{vault-B8vgVIH9.js → vault-DVQidlId.js} +6 -6
- package/studio-dist/server/assets/{warnings-BxK4VfV5.js → warnings-C7hgXpdk.js} +2 -1
- package/studio-dist/server/assets/{workflow-BrTK632u.js → workflow-6dZZ1ofw.js} +7 -6
- package/studio-dist/server/server.js +2 -2
- package/tool-manifest.yaml +85 -0
- package/studio-dist/client/assets/app-aIwDxf48.css +0 -2
- package/studio-dist/client/assets/button-CX0sWAJl.js +0 -1
- package/studio-dist/client/assets/combobox-BmA8RjOc.js +0 -1
- package/studio-dist/client/assets/fields-BobQ7zRF.js +0 -1
- package/studio-dist/client/assets/friction-YdYd3zaz.js +0 -1
- package/studio-dist/client/assets/getting-started-CY7NEtTw.js +0 -1
- package/studio-dist/client/assets/graph-DbNnR884.js +0 -2
- package/studio-dist/client/assets/index-CysBCSxM.js +0 -40
- package/studio-dist/client/assets/panel-Csr49lBo.js +0 -1
- package/studio-dist/client/assets/plugins._service._view-CEA_CcPe.js +0 -1
- package/studio-dist/client/assets/reports-CLdgxxkg.js +0 -1
- package/studio-dist/client/assets/routes-DGilWbDE.js +0 -1
- package/studio-dist/client/assets/select-DdebbX7K.js +0 -1
- package/studio-dist/client/assets/skills-C3zNkU8g.js +0 -1
- package/studio-dist/client/assets/specs-view-B_n0Pekv.js +0 -1
- package/studio-dist/client/assets/useBaseQuery-C2cjmeH2.js +0 -1
- package/studio-dist/client/assets/useMutation-DI6LbvVa.js +0 -1
- package/studio-dist/client/assets/vault-Cb9DmM1i.js +0 -1
- package/studio-dist/client/assets/warnings-B-rvoW8q.js +0 -1
- package/studio-dist/client/assets/workflow-DN5T19jd.js +0 -1
- package/studio-dist/server/assets/useBaseQuery--iH3rd-T.js +0 -2051
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
StudioServiceHost,
|
|
14
14
|
StudioSocketHandler,
|
|
15
15
|
StudioSocketPeer,
|
|
16
|
+
StudioViewLayout,
|
|
16
17
|
StudioWorksetSessions,
|
|
17
18
|
} from "../../../tools/setup/service";
|
|
18
19
|
import { SERVICE_ASSET_PREFIX, SERVICE_ROUTE_PREFIX } from "./routes";
|
|
@@ -26,6 +27,7 @@ export interface StudioServiceViewSummary {
|
|
|
26
27
|
moduleUrl?: string;
|
|
27
28
|
/** The service route answering the view's attention count, when it declares one. */
|
|
28
29
|
attentionUrl?: string;
|
|
30
|
+
layout?: StudioViewLayout;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
/** A mounted service as Studio's application sees it. */
|
|
@@ -218,6 +220,7 @@ function mountedServices(mounted: MountedService[]): MountedServices {
|
|
|
218
220
|
...(view.attention
|
|
219
221
|
? { attentionUrl: `${SERVICE_ROUTE_PREFIX}${service.id}${view.attention}` }
|
|
220
222
|
: {}),
|
|
223
|
+
...(view.layout ? { layout: view.layout } : {}),
|
|
221
224
|
})),
|
|
222
225
|
})),
|
|
223
226
|
match(pathname, method) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import readline from "node:readline/promises";
|
|
2
2
|
|
|
3
3
|
import { FRAMEWORK_NAME } from "../../framework";
|
|
4
|
+
import { FrictionRefusal } from "../../lib/friction/fields";
|
|
5
|
+
import { formatCommand } from "../../runtime/command-arg";
|
|
4
6
|
import {
|
|
5
7
|
launchAgent,
|
|
6
8
|
TRIAGE_AGENT_NAMES,
|
|
@@ -18,11 +20,12 @@ import { currentSession } from "../../runtime/session-id";
|
|
|
18
20
|
import { collectDoctorReport } from "./doctor";
|
|
19
21
|
|
|
20
22
|
interface TriageArgs {
|
|
23
|
+
target?: string;
|
|
21
24
|
agent: TriageAgent | null;
|
|
22
25
|
launch: boolean;
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
const TRIAGE_USAGE = `Usage: ${FRAMEWORK_NAME} triage [--agent <${TRIAGE_AGENTS.join("|")}>] [--no-launch]`;
|
|
28
|
+
const TRIAGE_USAGE = `Usage: ${FRAMEWORK_NAME} triage ["<fingerprint|report-id>"] [--agent <${TRIAGE_AGENTS.join("|")}>] [--no-launch]`;
|
|
26
29
|
|
|
27
30
|
function parseTriageArgs(argv: string[]): TriageArgs | { error: string } {
|
|
28
31
|
const args: TriageArgs = { agent: null, launch: true };
|
|
@@ -37,6 +40,12 @@ function parseTriageArgs(argv: string[]): TriageArgs | { error: string } {
|
|
|
37
40
|
return { error: `--agent must be one of: ${TRIAGE_AGENTS.join(", ")}` };
|
|
38
41
|
}
|
|
39
42
|
args.agent = value as TriageAgent;
|
|
43
|
+
} else if (!arg.startsWith("-")) {
|
|
44
|
+
if (arg.trim() === "") return { error: "the Triage Target is empty" };
|
|
45
|
+
if (args.target !== undefined) {
|
|
46
|
+
return { error: `triage takes one Triage Target; got a second: ${arg}` };
|
|
47
|
+
}
|
|
48
|
+
args.target = arg;
|
|
40
49
|
} else {
|
|
41
50
|
return { error: `unknown triage option: ${arg}` };
|
|
42
51
|
}
|
|
@@ -102,6 +111,8 @@ function printPaths(files: TriageSessionFiles): void {
|
|
|
102
111
|
* shipped playbook, a seed prompt and a 30-day friction snapshot) and starts
|
|
103
112
|
* Claude Code or OpenCode in it, directly and not through a Mate launch.
|
|
104
113
|
* Runs before every gate, so it works when Mate itself does not.
|
|
114
|
+
* An optional Triage Target (a fingerprint or Free Report id) focuses the
|
|
115
|
+
* session on that item and chooses the snapshot's companion.
|
|
105
116
|
* `--no-launch` only prints the session paths.
|
|
106
117
|
*/
|
|
107
118
|
export async function runTriageCommand(argv: string[] = [], deps: TriageDeps = {}): Promise<void> {
|
|
@@ -113,20 +124,30 @@ export async function runTriageCommand(argv: string[] = [], deps: TriageDeps = {
|
|
|
113
124
|
return;
|
|
114
125
|
}
|
|
115
126
|
const env = deps.env ?? process.env;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
127
|
+
let prepared: Awaited<ReturnType<typeof prepareTriageSession>>;
|
|
128
|
+
try {
|
|
129
|
+
prepared = await prepareTriageSession({
|
|
130
|
+
argv,
|
|
131
|
+
cwd: deps.cwd ?? process.cwd(),
|
|
132
|
+
homeDir: env.HOME,
|
|
133
|
+
now: deps.now ?? new Date(),
|
|
134
|
+
pathValue: env.PATH ?? "",
|
|
135
|
+
env,
|
|
136
|
+
collectDoctor: deps.collectDoctor ?? ((cwd) => collectDoctorReport({ cwd, write: false })),
|
|
137
|
+
target: args.target,
|
|
138
|
+
});
|
|
139
|
+
} catch (error) {
|
|
140
|
+
if (!(error instanceof FrictionRefusal)) throw error;
|
|
141
|
+
console.error(`${FRAMEWORK_NAME}: ${error.message}`);
|
|
142
|
+
process.exitCode = 1;
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const { files, agents } = prepared;
|
|
125
146
|
printPaths(files);
|
|
126
147
|
if (!args.launch) return;
|
|
127
148
|
if (currentSession(env)) {
|
|
128
149
|
console.log(
|
|
129
|
-
`No agent started: this is an agent session. Run \`${FRAMEWORK_NAME
|
|
150
|
+
`No agent started: this is an agent session. Run \`${formatCommand([FRAMEWORK_NAME, "triage", ...argv])}\` in your own terminal.`,
|
|
130
151
|
);
|
|
131
152
|
return;
|
|
132
153
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.0-canary.
|
|
3
|
-
"sha512": "sha512-
|
|
2
|
+
"version": "1.0.0-canary.8",
|
|
3
|
+
"sha512": "sha512-eOxXhwtswLDZvHJJYI86S91PNqhNhKaGbbDbL4/TH5j2pxuyyHyOtBaYZGrH/0Hy6eGLSfJE1VMlCDJFfDcPjw=="
|
|
4
4
|
}
|
package/src/cli/install-plan.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import { BRAND_ACCENT } from "../brand/palette";
|
|
|
7
7
|
import { useSpinnerFrame } from "../lib/components/spinner";
|
|
8
8
|
import type { InstallPlan, InstallPlanItem, InstallRequirementResult } from "../lib/install";
|
|
9
9
|
import { runInstallPlan } from "../lib/install";
|
|
10
|
+
import { holdToolNotices } from "../lib/tool-manifest";
|
|
10
11
|
|
|
11
12
|
type Execution = { ok: boolean; results: InstallRequirementResult[] };
|
|
12
13
|
|
|
@@ -178,8 +179,10 @@ export function InstallExecutionView({
|
|
|
178
179
|
export async function renderInstallExecution(plan: InstallPlan): Promise<Execution> {
|
|
179
180
|
return new Promise((resolve) => {
|
|
180
181
|
let app: ReturnType<typeof render> | undefined;
|
|
182
|
+
const releaseNotices = holdToolNotices();
|
|
181
183
|
const finish = (execution: Execution) => {
|
|
182
184
|
app?.unmount();
|
|
185
|
+
releaseNotices();
|
|
183
186
|
resolve(execution);
|
|
184
187
|
};
|
|
185
188
|
app = render(<InstallExecutionView plan={plan} onDone={finish} />);
|
package/src/cli/main.ts
CHANGED
|
@@ -27,7 +27,7 @@ import { runVscodeCommand } from "./commands/vscode/setup";
|
|
|
27
27
|
import { parseWrapArgs, runWrapCommand } from "./commands/wrap";
|
|
28
28
|
import { runWorkingCommand } from "./commands/working/working";
|
|
29
29
|
import { runWorkflowCommand } from "./commands/workflow/workflow";
|
|
30
|
-
import { runInstallCommand } from "./commands/install";
|
|
30
|
+
import { isFrozenPluginInstall, runInstallCommand } from "./commands/install";
|
|
31
31
|
import { parseDirectLaunchArgs } from "./commands/launch/shared";
|
|
32
32
|
import {
|
|
33
33
|
inspectInstallPreflight,
|
|
@@ -86,6 +86,40 @@ function printPreflightErrorDocument(message: string): void {
|
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Built-in commands whose `--help` or `-h` main answers with the usage before any gate.
|
|
91
|
+
* `workflow` and `plugin install` print their own usage, `cap` its plugin's, and `claude` and
|
|
92
|
+
* `opencode` pass it to the agent.
|
|
93
|
+
*/
|
|
94
|
+
const MAIN_ANSWERS_HELP = new Set([
|
|
95
|
+
"install",
|
|
96
|
+
"plugin",
|
|
97
|
+
"artifact",
|
|
98
|
+
"companion",
|
|
99
|
+
"hub",
|
|
100
|
+
"report",
|
|
101
|
+
"studio",
|
|
102
|
+
"config",
|
|
103
|
+
"doctor",
|
|
104
|
+
"friction",
|
|
105
|
+
"update",
|
|
106
|
+
"working",
|
|
107
|
+
"wrap",
|
|
108
|
+
"session",
|
|
109
|
+
"vscode",
|
|
110
|
+
"unwrap",
|
|
111
|
+
"triage",
|
|
112
|
+
]);
|
|
113
|
+
|
|
114
|
+
/** True when `args` ask for help before a `--`, which passes what follows on untouched. */
|
|
115
|
+
function asksForHelp(command: string, args: readonly string[]): boolean {
|
|
116
|
+
if (!MAIN_ANSWERS_HELP.has(command) || (command === "plugin" && args[0] === "install")) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
const end = args.indexOf("--");
|
|
120
|
+
return (end < 0 ? args : args.slice(0, end)).some((arg) => arg === "--help" || arg === "-h");
|
|
121
|
+
}
|
|
122
|
+
|
|
89
123
|
const FRICTION_GATE_NEEDS = new Map<string | undefined, GateNeeds>([
|
|
90
124
|
["list", { updateGuard: true, companion: true, install: true }],
|
|
91
125
|
["report", { companion: true }],
|
|
@@ -93,23 +127,27 @@ const FRICTION_GATE_NEEDS = new Map<string | undefined, GateNeeds>([
|
|
|
93
127
|
|
|
94
128
|
export async function main(argv = process.argv, deps: MainDeps = mainDeps): Promise<void> {
|
|
95
129
|
const [, , command, subcommand, ...rest] = argv;
|
|
130
|
+
const helpRequest = command !== undefined && asksForHelp(command, argv.slice(3));
|
|
96
131
|
|
|
97
132
|
/**
|
|
98
133
|
* A Claude plugin asks this on every mention of a plain session. It changes
|
|
99
134
|
* nothing and prints only its answer, so it skips the runtime refresh,
|
|
100
135
|
* plugin loading, the update checks and every gate.
|
|
101
136
|
*/
|
|
102
|
-
if (command === "session" && subcommand === "context") {
|
|
137
|
+
if (command === "session" && subcommand === "context" && !helpRequest) {
|
|
103
138
|
await runSessionContextCommand(rest);
|
|
104
139
|
return;
|
|
105
140
|
}
|
|
106
141
|
|
|
107
|
-
if (command === "triage") {
|
|
142
|
+
if (command === "triage" && !helpRequest) {
|
|
108
143
|
await runTriageCommand(argv.slice(3));
|
|
109
144
|
return;
|
|
110
145
|
}
|
|
111
146
|
|
|
112
|
-
|
|
147
|
+
// Help needs no runtime paths, so a failed refresh only warns, as for `mate help`.
|
|
148
|
+
if (
|
|
149
|
+
!(await ensureRuntimeDirectory(helpRequest ? "help" : command, deps.refreshRuntimeDirectory))
|
|
150
|
+
) {
|
|
113
151
|
process.exitCode = 1;
|
|
114
152
|
return;
|
|
115
153
|
}
|
|
@@ -123,10 +161,16 @@ export async function main(argv = process.argv, deps: MainDeps = mainDeps): Prom
|
|
|
123
161
|
// text is printed, so their commands route like compiled-in ones
|
|
124
162
|
// (including MCP servers whose command is their own cap subcommand) and
|
|
125
163
|
// show up in `mate help`. Diagnostics stay on stderr; a missing or
|
|
126
|
-
// ambiguous companion makes this a no-op.
|
|
127
|
-
|
|
164
|
+
// ambiguous companion makes this a no-op. A frozen verification ignores
|
|
165
|
+
// local plugins.
|
|
166
|
+
const ignoresLocalPlugins = command === "doctor" && isFrozenPluginInstall(argv);
|
|
167
|
+
// A package registers once per process, so a load here would pin the
|
|
168
|
+
// pre-install version for the install's own sync; both installs load after their plugin step.
|
|
169
|
+
if (!(command === "install" || (command === "plugin" && subcommand === "install"))) {
|
|
170
|
+
await deps.hydrateDynamicPlugins({ includeLocal: !ignoresLocalPlugins });
|
|
171
|
+
}
|
|
128
172
|
|
|
129
|
-
if (!command || command === "help" || command === "--help" || command === "-h") {
|
|
173
|
+
if (!command || command === "help" || command === "--help" || command === "-h" || helpRequest) {
|
|
130
174
|
console.log(usage());
|
|
131
175
|
return;
|
|
132
176
|
}
|
package/src/cli/usage.ts
CHANGED
|
@@ -40,7 +40,7 @@ export function usage(): string {
|
|
|
40
40
|
` ${n} artifact publish <group|change|anchor>|--specs [<path>...]|--all [--refresh]`,
|
|
41
41
|
" [--confirm-merged|--confirm-open|--confirm-dropped] [--type openspec] [--no-push] [--json]",
|
|
42
42
|
" target: a Delivery Group or submitted change, or a dated archive anchor of an earlier Mate",
|
|
43
|
-
` ${n} artifact pending [--json]`,
|
|
43
|
+
` ${n} artifact pending [--no-merge-check] [--json]`,
|
|
44
44
|
` ${n} artifact link <change>... [--repository <org/repo>] [--branch <b> [--direct]]`,
|
|
45
45
|
" [--not-applicable <reason>] [--pr <url>] [--ticket <KEY>] [--refresh]",
|
|
46
46
|
" [--confirm-merged|--confirm-open|--confirm-dropped] [--spec-base] [--json]",
|
|
@@ -67,7 +67,7 @@ export function usage(): string {
|
|
|
67
67
|
" [--workaround <text>] [--json]",
|
|
68
68
|
` ${n} friction mark <fingerprint|report-id> --state <open|fixed|reported|dismissed>`,
|
|
69
69
|
" [--note <text>] [--link <url>] [--json]",
|
|
70
|
-
` ${n} triage [--agent <claude|opencode>] [--no-launch]`,
|
|
70
|
+
` ${n} triage ["<fingerprint|report-id>"] [--agent <claude|opencode>] [--no-launch]`,
|
|
71
71
|
` ${n} report [--days N] [--input FILE|-] [--json]`,
|
|
72
72
|
` ${n} studio [--writable] [--terminal] [--detach-timeout <minutes>]`,
|
|
73
73
|
` ${n} studio serve --port <port> [--host <host>] [--writable] [--terminal]`,
|
|
@@ -82,7 +82,7 @@ export function usage(): string {
|
|
|
82
82
|
` ${n} cap openspec <subcommand> [args...]`,
|
|
83
83
|
` ${n} cap graphify <subcommand> [args...]`,
|
|
84
84
|
` ${n} cap index [--graphify] [--tokensave]`,
|
|
85
|
-
` ${n} plugin install <package>[@version]`,
|
|
85
|
+
` ${n} plugin install [--local] <package>[@version]`,
|
|
86
86
|
...pluginCliCommandLines(),
|
|
87
87
|
` ${n} update`,
|
|
88
88
|
` ${n} update --check`,
|
package/src/factory-host.ts
CHANGED
|
@@ -65,5 +65,11 @@ export { readWorksetStages, type WorksetWithStage } from "./lib/workset/stages";
|
|
|
65
65
|
export { buildCompanionGuidance } from "./playbooks/companion-guidance";
|
|
66
66
|
export { errorMessage } from "./runtime/error-message";
|
|
67
67
|
export { resolveSecretPolicy } from "./runtime/policy";
|
|
68
|
+
export {
|
|
69
|
+
installedPluginPackages,
|
|
70
|
+
type InstalledPluginPackage,
|
|
71
|
+
type InstalledPluginsOptions,
|
|
72
|
+
} from "./tools/setup/dynamic-plugins/installed";
|
|
73
|
+
export type { PluginOrigin } from "./tools/setup/dynamic-plugins/paths";
|
|
68
74
|
export { deployReactDoctorSkill } from "./tools/setup/capabilities/react-doctor";
|
|
69
75
|
export { applyMateSkills, MATE_SKILLS } from "./tools/setup/mate";
|
package/src/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ export {
|
|
|
21
21
|
type NormalizedRegistration,
|
|
22
22
|
} from "./tools/setup/registry";
|
|
23
23
|
export { ensureCapabilityEnabled, type EnsureCapabilityEnabledDeps } from "./cli/plugin-commands";
|
|
24
|
+
export { toolVersion } from "./lib/tool-manifest";
|
|
24
25
|
// Dynamic plugin authors: import from this package as TYPES ONLY. Runtime
|
|
25
26
|
// imports resolve a second, uninitialized copy of mate-core inside the
|
|
26
27
|
// plugin's own node_modules; all runtime behavior flows through PluginHost.
|
|
@@ -22,7 +22,14 @@ export interface ProcessResult {
|
|
|
22
22
|
export type SpawnProcess = (
|
|
23
23
|
command: string,
|
|
24
24
|
args: readonly string[],
|
|
25
|
-
options: {
|
|
25
|
+
options: {
|
|
26
|
+
cwd: string;
|
|
27
|
+
env: NodeJS.ProcessEnv;
|
|
28
|
+
input?: string;
|
|
29
|
+
timeoutMs?: number;
|
|
30
|
+
/** Kills the process once aborted; the result then counts as timed out. */
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
},
|
|
26
33
|
) => Promise<ProcessResult>;
|
|
27
34
|
|
|
28
35
|
export interface PatchMatch {
|
|
@@ -134,6 +141,8 @@ export interface MergeGitDeps {
|
|
|
134
141
|
containmentLimit?: number;
|
|
135
142
|
/** Wall time one containment search may take; 5 s by default. */
|
|
136
143
|
containmentBudgetMs?: number;
|
|
144
|
+
/** Once aborted, running Git commands are killed and new ones fail at once. */
|
|
145
|
+
signal?: AbortSignal;
|
|
137
146
|
}
|
|
138
147
|
|
|
139
148
|
/** Upstream commits compared by patch identity at most; more is asked instead. */
|
|
@@ -179,12 +188,20 @@ export const spawnProcess: SpawnProcess = (command, args, options) =>
|
|
|
179
188
|
env: options.env,
|
|
180
189
|
stdio: ["pipe", "pipe", "pipe"],
|
|
181
190
|
timeout: options.timeoutMs,
|
|
191
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
182
192
|
});
|
|
183
193
|
const stdout: Buffer[] = [];
|
|
184
194
|
const stderr: Buffer[] = [];
|
|
185
195
|
child.stdout.on("data", (chunk: Buffer) => stdout.push(chunk));
|
|
186
196
|
child.stderr.on("data", (chunk: Buffer) => stderr.push(chunk));
|
|
187
|
-
child.on("error", (error) =>
|
|
197
|
+
child.on("error", (error) =>
|
|
198
|
+
resolve({
|
|
199
|
+
code: -1,
|
|
200
|
+
stdout: "",
|
|
201
|
+
stderr: error.message,
|
|
202
|
+
...(options.signal?.aborted ? { timedOut: true } : {}),
|
|
203
|
+
}),
|
|
204
|
+
);
|
|
188
205
|
child.on("close", (code, signal) =>
|
|
189
206
|
resolve({
|
|
190
207
|
code: code ?? -1,
|
|
@@ -229,7 +246,10 @@ export function localGitEnv(env: NodeJS.ProcessEnv = process.env): NodeJS.Proces
|
|
|
229
246
|
}
|
|
230
247
|
|
|
231
248
|
export function mergeGit(repoPath: string, deps: MergeGitDeps = {}): MergeGit {
|
|
232
|
-
const
|
|
249
|
+
const baseSpawn = deps.spawn ?? spawnProcess;
|
|
250
|
+
const spawnFn: SpawnProcess = deps.signal
|
|
251
|
+
? (command, args, options) => baseSpawn(command, args, { ...options, signal: deps.signal })
|
|
252
|
+
: baseSpawn;
|
|
233
253
|
const base = gitEnvironment(deps.env ?? process.env) as NodeJS.ProcessEnv;
|
|
234
254
|
const promptless = promptlessEnv(base);
|
|
235
255
|
const localEnv: NodeJS.ProcessEnv = { ...promptless, GIT_NO_LAZY_FETCH: "1" };
|
|
@@ -247,10 +267,14 @@ export function mergeGit(repoPath: string, deps: MergeGitDeps = {}): MergeGit {
|
|
|
247
267
|
(await value("config", "--get", "extensions.partialClone")) !== null;
|
|
248
268
|
|
|
249
269
|
const supportsContainment = (): Promise<boolean> => {
|
|
250
|
-
let known = containmentSupport.get(
|
|
270
|
+
let known = containmentSupport.get(baseSpawn);
|
|
251
271
|
if (!known) {
|
|
252
|
-
known = git(["version"]).then((result) =>
|
|
253
|
-
|
|
272
|
+
known = git(["version"]).then((result) => {
|
|
273
|
+
// A killed probe proves nothing about this Git.
|
|
274
|
+
if (result.timedOut) containmentSupport.delete(baseSpawn);
|
|
275
|
+
return result.code === 0 && hasWriteTree(result.stdout);
|
|
276
|
+
});
|
|
277
|
+
containmentSupport.set(baseSpawn, known);
|
|
254
278
|
}
|
|
255
279
|
return known;
|
|
256
280
|
};
|
|
@@ -392,7 +416,7 @@ export function mergeGit(repoPath: string, deps: MergeGitDeps = {}): MergeGit {
|
|
|
392
416
|
if (!(await supportsContainment())) return "unknown";
|
|
393
417
|
const upstream = remoteRef(defaultBranch);
|
|
394
418
|
const tip = await verify(upstream);
|
|
395
|
-
const notContained = notContainedMemo(
|
|
419
|
+
const notContained = notContainedMemo(baseSpawn);
|
|
396
420
|
const key = `${repoPath}\0${head}\0${tip}`;
|
|
397
421
|
// Unchanged head and default tip: a repeated refresh does not test every candidate again.
|
|
398
422
|
if (tip && notContained.has(key)) return "none";
|
|
@@ -44,13 +44,26 @@ export type CountedWarning = {
|
|
|
44
44
|
message: string;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* - `preflight-skipped`: submit could not archive the change's Delivery Group as publication
|
|
49
|
+
* would, or only against the last fetched refs
|
|
50
|
+
* - `preflight-blocked`: publication will block the group on the stale delta of `change` until it
|
|
51
|
+
* is resolved on the pending branch
|
|
52
|
+
*/
|
|
53
|
+
export type PreflightWarning = {
|
|
54
|
+
kind: "preflight-skipped" | "preflight-blocked";
|
|
55
|
+
change: string;
|
|
56
|
+
message: string;
|
|
57
|
+
};
|
|
58
|
+
|
|
47
59
|
export type SubmitWarning =
|
|
48
60
|
| { kind: "overlap"; change: string; capability: string; requirement: string; message: string }
|
|
49
61
|
| DependencyWarning
|
|
50
62
|
| PlanningWarning
|
|
51
63
|
| GroupWarning
|
|
52
64
|
| StageWarning
|
|
53
|
-
| CountedWarning
|
|
65
|
+
| CountedWarning
|
|
66
|
+
| PreflightWarning;
|
|
54
67
|
|
|
55
68
|
const SECTION = /^##\s+(ADDED|MODIFIED|REMOVED|RENAMED)\s+Requirements\s*$/;
|
|
56
69
|
const REQUIREMENT = /^###\s+Requirement:\s*(.+?)\s*$/;
|
|
@@ -22,11 +22,16 @@ export interface Checkout {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export interface RepositoryAccessDeps {
|
|
25
|
-
openCheckout?: (path: string) => Checkout;
|
|
25
|
+
openCheckout?: (path: string, signal?: AbortSignal) => Checkout;
|
|
26
|
+
/** Once aborted, the checkouts' merge queries and fetches are killed. */
|
|
27
|
+
signal?: AbortSignal;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
function defaultOpenCheckout(path: string): Checkout {
|
|
29
|
-
return {
|
|
30
|
+
function defaultOpenCheckout(path: string, signal?: AbortSignal): Checkout {
|
|
31
|
+
return {
|
|
32
|
+
git: mergeGit(path, signal ? { signal } : {}),
|
|
33
|
+
defaultBranch: () => workingRepoGit(path).defaultBranch(),
|
|
34
|
+
};
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
/**
|
|
@@ -48,7 +53,7 @@ export function repositoryAccessFor(
|
|
|
48
53
|
const working = slug && sameRepository(slug, repository) ? environment.workingRepo : null;
|
|
49
54
|
let localAccess: Promise<LocalMergeAccess | null> | undefined;
|
|
50
55
|
const local = (): Promise<LocalMergeAccess | null> =>
|
|
51
|
-
(localAccess ??= openLocal(environment, repository, deps
|
|
56
|
+
(localAccess ??= openLocal(environment, repository, deps));
|
|
52
57
|
let otherDefault: Promise<string> | undefined;
|
|
53
58
|
const defaultBranch = working
|
|
54
59
|
? () => working.git.defaultBranch()
|
|
@@ -72,11 +77,11 @@ export function repositoryAccessFor(
|
|
|
72
77
|
async function openLocal(
|
|
73
78
|
environment: DeliveryEnvironment,
|
|
74
79
|
repository: string,
|
|
75
|
-
|
|
80
|
+
deps: RepositoryAccessDeps,
|
|
76
81
|
): Promise<LocalMergeAccess | null> {
|
|
77
82
|
const path = await environment.checkoutOf?.(repository);
|
|
78
83
|
if (!path) return null;
|
|
79
|
-
const checkout = (
|
|
84
|
+
const checkout = (deps.openCheckout ?? defaultOpenCheckout)(path, deps.signal);
|
|
80
85
|
if (!(await checkout.git.isRepository())) return null;
|
|
81
86
|
const defaultBranch = await checkout.defaultBranch();
|
|
82
87
|
const fetched = new Map<string, Promise<FetchResult>>();
|
|
@@ -127,9 +127,11 @@ export function describeFailure(failure: ChainFailure, defaultBranch: string): s
|
|
|
127
127
|
if (failure.kind === "stale") {
|
|
128
128
|
return `${change}: "${inboxText(failure.failure.requirement)}" in ${inboxText(failure.failure.capability)} changed on ${defaultBranch} since the delta was written`;
|
|
129
129
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
if (!failure.failure) {
|
|
131
|
+
return `${change}: it no longer applies to ${defaultBranch} (${inboxText(failure.detail)})`;
|
|
132
|
+
}
|
|
133
|
+
const { capability, requirement, reason } = failure.failure;
|
|
134
|
+
return `${change}: its ${inboxText(capability)} delta for "${inboxText(requirement)}" no longer applies to ${defaultBranch}${reason ? ` (${inboxText(reason)})` : ""}`;
|
|
133
135
|
}
|
|
134
136
|
|
|
135
137
|
/** `value` as one POSIX shell word: names come from teammates' specs. */
|
|
@@ -137,8 +139,16 @@ function shellQuote(value: string): string {
|
|
|
137
139
|
return `'${value.replaceAll("'", `'\\''`)}'`;
|
|
138
140
|
}
|
|
139
141
|
|
|
140
|
-
/**
|
|
141
|
-
|
|
142
|
+
/** `mate artifact submit` for `names`, each quoted as one shell word. */
|
|
143
|
+
function submitCommand(names: readonly string[]): string {
|
|
144
|
+
return `\`mate artifact submit${names.map((name) => ` ${shellQuote(name)}`).join("")}\``;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* How to get past a failure. With `resubmit`, the changes a submit named, the remedy ends with
|
|
149
|
+
* submitting them again instead of publishing: submit's pre-flight found the failure.
|
|
150
|
+
*/
|
|
151
|
+
export function failureRemedy(failure: ChainFailure, resubmit?: readonly string[]): string {
|
|
142
152
|
const versions = failure.kind === "stale" ? failure.failure.versions : undefined;
|
|
143
153
|
// A name that does not print as it is cannot be passed on a command line.
|
|
144
154
|
const printable =
|
|
@@ -153,12 +163,20 @@ export function failureRemedy(failure: ChainFailure): string {
|
|
|
153
163
|
versions.ours !== null &&
|
|
154
164
|
versions.theirs !== null
|
|
155
165
|
) {
|
|
156
|
-
|
|
166
|
+
const next = resubmit ? `run ${submitCommand(resubmit)} again` : "publish again";
|
|
167
|
+
return `Resolve it from any machine: write the requirement's body as it should read (without its \`### Requirement:\` heading) to a file, run \`mate artifact resolve ${shellQuote(failure.change)} --capability ${shellQuote(failure.failure.capability)} --requirement ${shellQuote(failure.failure.requirement)} --file <file>\` (one triple per requirement it reports unresolved), then ${next}.`;
|
|
157
168
|
}
|
|
158
169
|
const change = failure.change === null ? "the change that changes it" : inboxText(failure.change);
|
|
159
170
|
const keep =
|
|
160
171
|
failure.kind === "stale" && failure.failure.overwrites === false && versions?.ours === null
|
|
161
172
|
? " To keep it as it is, submit it again unchanged: that accepts the conflict."
|
|
162
173
|
: "";
|
|
163
|
-
|
|
174
|
+
// Submitting the fixed change runs the pre-flight again; only other named changes need a rerun.
|
|
175
|
+
const others = resubmit?.filter((name) => name !== failure.change) ?? [];
|
|
176
|
+
const next = !resubmit
|
|
177
|
+
? ", then publish again"
|
|
178
|
+
: others.length > 0
|
|
179
|
+
? `, then run ${submitCommand(others)} again`
|
|
180
|
+
: "";
|
|
181
|
+
return `Fix the delta spec of ${change}, submit it again with \`mate artifact submit\`${next}.${keep}`;
|
|
164
182
|
}
|