@motir/cli 0.11.0 → 0.11.2

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.
Files changed (2) hide show
  1. package/dist/index.js +93 -27
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ var __export = (target, all) => {
9
9
  import { Command as Command2, Option } from "commander";
10
10
 
11
11
  // package.json
12
- var version = "0.11.0";
12
+ var version = "0.11.2";
13
13
 
14
14
  // src/version.ts
15
15
  var CLI_VERSION = version;
@@ -824,7 +824,7 @@ function displayTokenPrefix(token) {
824
824
 
825
825
  // src/api/operations.ts
826
826
  var API_MAJOR = 1;
827
- var GENERATED_AGAINST = "1.60.0";
827
+ var GENERATED_AGAINST = "1.61.0";
828
828
  var V1_OPERATIONS = {
829
829
  "appendDispatchRunEvents": {
830
830
  method: "POST",
@@ -33312,7 +33312,7 @@ function validate58(data, { instancePath = "", parentData, parentDataProperty, r
33312
33312
  }
33313
33313
  validate58.evaluated = { "props": { "totalComments": true, "totalChanges": true, "items": true, "nextCursor": true, "totalCount": true }, "dynamicProps": false, "dynamicItems": false };
33314
33314
  var operation_getWorkItemApprovalGate = validate59;
33315
- var schema97 = { "type": "object", "properties": { "workItemKey": { "type": "string", "pattern": "^[A-Z][A-Z0-9]*-\\d+$" }, "workItemTitle": { "type": "string" }, "kind": { "type": "string", "enum": ["design_result", "decision_approval", "pull_request_approval", "pull_request_merge", "acceptance_result", "decision_choice", "decision_confirmation", "plan_approval", "agent_review"] }, "gate": { "anyOf": [{ "type": "object", "properties": { "id": { "type": "string" }, "kind": { "type": "string", "enum": ["design_result", "decision_approval", "pull_request_approval", "pull_request_merge", "acceptance_result", "decision_choice", "decision_confirmation", "plan_approval", "agent_review"] }, "state": { "type": "string", "enum": ["awaiting", "approved", "changes_requested", "superseded", "overturned", "declined"] }, "noteMd": { "anyOf": [{ "type": "string" }, { "type": "null" }] }, "decidedAt": { "anyOf": [{ "type": "string", "format": "date-time", "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" }, { "type": "null" }] }, "decidedByLabel": { "anyOf": [{ "type": "string" }, { "type": "null" }] }, "decidedUnderAuthority": { "anyOf": [{ "type": "string", "enum": ["assignee", "reporter", "admin", "github_review", "plan_permission", "review_agent", "project_setting"] }, { "type": "null" }] }, "decisionSource": { "anyOf": [{ "type": "string", "enum": ["ui", "api", "mcp", "github", "system"] }, { "type": "null" }] }, "subjectVersion": { "anyOf": [{ "type": "string" }, { "type": "null" }] }, "supersededCause": { "anyOf": [{ "type": "string", "enum": ["republished", "withdrawn", "head_moved", "member_closed", "member_drafted", "conflict", "set_changed", "pulled_back", "ci_failed", "ci_rerunning", "unknown", "plan_stale", "plan_discarded", "queue_failed", "review_agent_disabled"] }, { "type": "null" }] }, "outcomeRef": { "anyOf": [{ "type": "string" }, { "type": "null" }] }, "refusalVerdict": { "anyOf": [{ "type": "string", "enum": ["revise", "re_plan"] }, { "type": "null" }] }, "offersRefusalVerdict": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time", "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" }, "updatedAt": { "type": "string", "format": "date-time", "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" } }, "required": ["id", "kind", "state", "noteMd", "decidedAt", "decidedByLabel", "decidedUnderAuthority", "decisionSource", "subjectVersion", "supersededCause", "outcomeRef", "refusalVerdict", "offersRefusalVerdict", "createdAt", "updatedAt"] }, { "type": "null" }] }, "routedToLabel": { "anyOf": [{ "type": "string" }, { "type": "null" }] } }, "required": ["workItemKey", "workItemTitle", "kind", "gate", "routedToLabel"], "$id": "motir://v1/operations/getWorkItemApprovalGate" };
33315
+ var schema97 = { "type": "object", "properties": { "workItemKey": { "type": "string", "pattern": "^[A-Z][A-Z0-9]*-\\d+$" }, "workItemTitle": { "type": "string" }, "kind": { "type": "string", "enum": ["design_result", "decision_approval", "pull_request_approval", "pull_request_merge", "acceptance_result", "decision_choice", "decision_confirmation", "plan_approval", "agent_review"] }, "gate": { "anyOf": [{ "type": "object", "properties": { "id": { "type": "string" }, "kind": { "type": "string", "enum": ["design_result", "decision_approval", "pull_request_approval", "pull_request_merge", "acceptance_result", "decision_choice", "decision_confirmation", "plan_approval", "agent_review"] }, "state": { "type": "string", "enum": ["awaiting", "approved", "changes_requested", "superseded", "overturned", "declined"] }, "noteMd": { "anyOf": [{ "type": "string" }, { "type": "null" }] }, "decidedAt": { "anyOf": [{ "type": "string", "format": "date-time", "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" }, { "type": "null" }] }, "decidedByLabel": { "anyOf": [{ "type": "string" }, { "type": "null" }] }, "decidedUnderAuthority": { "anyOf": [{ "type": "string", "enum": ["assignee", "reporter", "admin", "github_review", "plan_permission", "review_agent", "project_setting"] }, { "type": "null" }] }, "decisionSource": { "anyOf": [{ "type": "string", "enum": ["ui", "api", "mcp", "github", "system"] }, { "type": "null" }] }, "subjectVersion": { "anyOf": [{ "type": "string" }, { "type": "null" }] }, "supersededCause": { "anyOf": [{ "type": "string", "enum": ["republished", "withdrawn", "head_moved", "member_closed", "member_drafted", "conflict", "set_changed", "pulled_back", "ci_failed", "ci_rerunning", "unknown", "plan_stale", "plan_discarded", "queue_failed", "review_agent_disabled", "subject_gone"] }, { "type": "null" }] }, "outcomeRef": { "anyOf": [{ "type": "string" }, { "type": "null" }] }, "refusalVerdict": { "anyOf": [{ "type": "string", "enum": ["revise", "re_plan"] }, { "type": "null" }] }, "offersRefusalVerdict": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time", "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" }, "updatedAt": { "type": "string", "format": "date-time", "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" } }, "required": ["id", "kind", "state", "noteMd", "decidedAt", "decidedByLabel", "decidedUnderAuthority", "decisionSource", "subjectVersion", "supersededCause", "outcomeRef", "refusalVerdict", "offersRefusalVerdict", "createdAt", "updatedAt"] }, { "type": "null" }] }, "routedToLabel": { "anyOf": [{ "type": "string" }, { "type": "null" }] } }, "required": ["workItemKey", "workItemTitle", "kind", "gate", "routedToLabel"], "$id": "motir://v1/operations/getWorkItemApprovalGate" };
33316
33316
  function validate59(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
33317
33317
  ;
33318
33318
  let vErrors = null;
@@ -33822,7 +33822,7 @@ function validate59(data, { instancePath = "", parentData, parentDataProperty, r
33822
33822
  }
33823
33823
  errors++;
33824
33824
  }
33825
- if (!(data13 === "republished" || data13 === "withdrawn" || data13 === "head_moved" || data13 === "member_closed" || data13 === "member_drafted" || data13 === "conflict" || data13 === "set_changed" || data13 === "pulled_back" || data13 === "ci_failed" || data13 === "ci_rerunning" || data13 === "unknown" || data13 === "plan_stale" || data13 === "plan_discarded" || data13 === "queue_failed" || data13 === "review_agent_disabled")) {
33825
+ if (!(data13 === "republished" || data13 === "withdrawn" || data13 === "head_moved" || data13 === "member_closed" || data13 === "member_drafted" || data13 === "conflict" || data13 === "set_changed" || data13 === "pulled_back" || data13 === "ci_failed" || data13 === "ci_rerunning" || data13 === "unknown" || data13 === "plan_stale" || data13 === "plan_discarded" || data13 === "queue_failed" || data13 === "review_agent_disabled" || data13 === "subject_gone")) {
33826
33826
  const err28 = { instancePath: instancePath + "/gate/supersededCause", schemaPath: "#/properties/gate/anyOf/0/properties/supersededCause/anyOf/0/enum", keyword: "enum", params: { allowedValues: schema97.properties.gate.anyOf[0].properties.supersededCause.anyOf[0].enum }, message: "must be equal to one of the allowed values" };
33827
33827
  if (vErrors === null) {
33828
33828
  vErrors = [err28];
@@ -59004,25 +59004,54 @@ var HOSTED_AGENT_ENV_KEYS = [
59004
59004
  var MAX_ARGV_PROMPT_BYTES2 = 100 * 1024;
59005
59005
  var EGRESS_DOCUMENT = {
59006
59006
  $schema: "https://opencode.ai/config.json",
59007
- enabled_providers: ["anthropic"],
59007
+ enabled_providers: ["anthropic", "deepseek", "z-ai", "qwen"],
59008
59008
  provider: {
59009
59009
  anthropic: {
59010
59010
  options: {
59011
59011
  baseURL: "{env:MOTIR_GATEWAY_URL}/v1",
59012
59012
  apiKey: "{env:MOTIR_RUN_KEY}"
59013
59013
  }
59014
+ },
59015
+ deepseek: {
59016
+ options: {
59017
+ baseURL: "{env:MOTIR_GATEWAY_URL}/v1",
59018
+ apiKey: "{env:MOTIR_RUN_KEY}"
59019
+ }
59020
+ },
59021
+ "z-ai": {
59022
+ npm: "@ai-sdk/openai-compatible",
59023
+ options: {
59024
+ baseURL: "{env:MOTIR_GATEWAY_URL}/v1",
59025
+ apiKey: "{env:MOTIR_RUN_KEY}"
59026
+ }
59027
+ },
59028
+ qwen: {
59029
+ npm: "@ai-sdk/openai-compatible",
59030
+ options: {
59031
+ baseURL: "{env:MOTIR_GATEWAY_URL}/v1",
59032
+ apiKey: "{env:MOTIR_RUN_KEY}"
59033
+ }
59014
59034
  }
59015
59035
  },
59016
59036
  share: "disabled",
59017
59037
  autoupdate: false
59018
59038
  };
59019
- function egressConfig() {
59020
- return JSON.stringify(EGRESS_DOCUMENT);
59039
+ var HOSTED_MODEL_PROVIDERS = EGRESS_DOCUMENT.enabled_providers;
59040
+ function egressConfig(model) {
59041
+ const slash = model ? model.indexOf("/") : -1;
59042
+ const provider = slash > 0 ? model.slice(0, slash) : "";
59043
+ const id = slash > 0 ? model.slice(slash + 1) : "";
59044
+ const block = EGRESS_DOCUMENT.provider[provider];
59045
+ if (!block || !("npm" in block) || !id) return JSON.stringify(EGRESS_DOCUMENT);
59046
+ return JSON.stringify({
59047
+ ...EGRESS_DOCUMENT,
59048
+ provider: { ...EGRESS_DOCUMENT.provider, [provider]: { ...block, models: { [id]: {} } } }
59049
+ });
59021
59050
  }
59022
59051
  function hostedAgentEnv(env) {
59023
59052
  const source = {
59024
59053
  ...env,
59025
- OPENCODE_CONFIG_CONTENT: egressConfig(),
59054
+ OPENCODE_CONFIG_CONTENT: egressConfig(env[HOSTED_MODEL_ENV]?.trim()),
59026
59055
  OPENCODE_DISABLE_AUTOUPDATE: "true",
59027
59056
  OPENCODE_DISABLE_MODELS_FETCH: "true",
59028
59057
  OPENCODE_DISABLE_CLAUDE_CODE: "true"
@@ -59044,8 +59073,13 @@ function hostedOpenCodeAgent(env = process.env, opts = {}) {
59044
59073
  hint: "The hosted image is booted with the run model, the gateway URL and the run key."
59045
59074
  });
59046
59075
  }
59047
- if (!/^anthropic\/[A-Za-z0-9._-]+$/.test(model)) {
59048
- throw new CliError(`${HOSTED_MODEL_ENV} must be "anthropic/<model id>", got "${model}".`);
59076
+ const slash = model.indexOf("/");
59077
+ const provider = slash > 0 ? model.slice(0, slash) : "";
59078
+ const id = slash > 0 ? model.slice(slash + 1) : "";
59079
+ if (!HOSTED_MODEL_PROVIDERS.includes(provider) || !/^[A-Za-z0-9._-]+$/.test(id)) {
59080
+ throw new CliError(
59081
+ `${HOSTED_MODEL_ENV} must be "<provider>/<model id>" with provider one of ${HOSTED_MODEL_PROVIDERS.join(", ")}, got "${model}".`
59082
+ );
59049
59083
  }
59050
59084
  const args = ["run", "--model", model, "--auto"];
59051
59085
  return {
@@ -59610,6 +59644,10 @@ function createLegLogTee(reporter, workItemKey) {
59610
59644
  // src/dispatchRunReporter.ts
59611
59645
  var REPORTER_QUEUE_LIMIT = 500;
59612
59646
  var REPORTER_BATCH_LIMIT = 200;
59647
+ var FLUSH_ON_ENQUEUE = /* @__PURE__ */ new Set([
59648
+ "run_opened",
59649
+ "checkout_ready"
59650
+ ]);
59613
59651
  var REPORTER_OFFLINE_WARNING = "motir: run reporting is unavailable \u2014 this run will not appear in Motir. The run itself is unaffected.";
59614
59652
  var RUN_HEARTBEAT_INTERVAL_MS = 6e4;
59615
59653
  var REPORTER_RUN_CLOSED_WARNING = "motir: Motir closed this run \u2014 it heard nothing from it for five minutes. The work on this machine continues; it is no longer reported.";
@@ -59646,7 +59684,8 @@ function createDispatchRunReporter(deps) {
59646
59684
  function startHeartbeat(id) {
59647
59685
  const client = deps.client;
59648
59686
  if (client.heartbeatDispatchRun === void 0 || heartbeat !== null) return;
59649
- heartbeat = setInterval(() => {
59687
+ const beat = () => {
59688
+ void flushQueue();
59650
59689
  if (client.heartbeatDispatchRun === void 0) return;
59651
59690
  void client.heartbeatDispatchRun(id).then(
59652
59691
  (answer) => {
@@ -59657,8 +59696,10 @@ function createDispatchRunReporter(deps) {
59657
59696
  },
59658
59697
  () => void 0
59659
59698
  );
59660
- }, RUN_HEARTBEAT_INTERVAL_MS);
59699
+ };
59700
+ heartbeat = setInterval(beat, RUN_HEARTBEAT_INTERVAL_MS);
59661
59701
  heartbeat.unref?.();
59702
+ beat();
59662
59703
  }
59663
59704
  function goOffline() {
59664
59705
  if (offline) return;
@@ -59674,6 +59715,20 @@ function createDispatchRunReporter(deps) {
59674
59715
  goOffline();
59675
59716
  }
59676
59717
  }
59718
+ function flushQueue() {
59719
+ const id = runId;
59720
+ if (offline || id === null) return Promise.resolve();
59721
+ const send = inFlight.then(async () => {
59722
+ while (!offline && queue.length > 0) {
59723
+ const batch = queue.splice(0, REPORTER_BATCH_LIMIT);
59724
+ await attempt(
59725
+ () => deps.client.appendDispatchRunEvents({ runId: id, events: batch }).then(() => void 0)
59726
+ );
59727
+ }
59728
+ });
59729
+ inFlight = send;
59730
+ return send;
59731
+ }
59677
59732
  return {
59678
59733
  get offline() {
59679
59734
  return offline;
@@ -59731,20 +59786,10 @@ function createDispatchRunReporter(deps) {
59731
59786
  const scrubbed = deps.reportLogBodies ? event : (({ body: _body, ...rest }) => rest)(event);
59732
59787
  queue.push(scrubbed);
59733
59788
  while (queue.length > REPORTER_QUEUE_LIMIT) queue.shift();
59789
+ if (FLUSH_ON_ENQUEUE.has(event.kind)) void flushQueue();
59734
59790
  },
59735
59791
  async flush() {
59736
- const id = runId;
59737
- if (offline || id === null || queue.length === 0) return;
59738
- const send = inFlight.then(async () => {
59739
- while (!offline && queue.length > 0) {
59740
- const batch = queue.splice(0, REPORTER_BATCH_LIMIT);
59741
- await attempt(
59742
- () => deps.client.appendDispatchRunEvents({ runId: id, events: batch }).then(() => void 0)
59743
- );
59744
- }
59745
- });
59746
- inFlight = send;
59747
- await send;
59792
+ await flushQueue();
59748
59793
  },
59749
59794
  async close(stopReason) {
59750
59795
  const id = runId;
@@ -60215,6 +60260,7 @@ function renderAcceptanceRerunPrompt(input) {
60215
60260
  lines2.push(` does, publish it again with \`${HOW_TO_TEST_TOOL_NAME}\` on ${input.key}.`);
60216
60261
  return lines2.join("\n");
60217
60262
  }
60263
+ var ACCEPTANCE_LANE_PUBLISHES_CHECK = "grep -rlE 'uses:\\s*\\./\\.github/actions/upload-acceptance-video' .github/workflows/";
60218
60264
  function renderAcceptanceRecordPrompt(input) {
60219
60265
  const lines2 = [];
60220
60266
  lines2.push(
@@ -60229,17 +60275,37 @@ function renderAcceptanceRecordPrompt(input) {
60229
60275
  lines2.push("");
60230
60276
  lines2.push("## What to do");
60231
60277
  lines2.push("");
60232
- lines2.push("1. **Run the story's acceptance spec** (`tests/e2e/acceptance*.spec.ts`, the one");
60278
+ lines2.push("1. **Find out who publishes the receipt.** In the checkout that holds the");
60279
+ lines2.push(" acceptance spec, run:");
60280
+ lines2.push("");
60281
+ lines2.push(` ${ACCEPTANCE_LANE_PUBLISHES_CHECK}`);
60282
+ lines2.push("");
60283
+ lines2.push(" **If it prints a file**, that repository\u2019s acceptance lane publishes the");
60284
+ lines2.push(" receipt itself, from the green pull-request run on the commit you pushed. Make");
60285
+ lines2.push(
60286
+ " NO MCP publish. Run the story\u2019s acceptance spec only to confirm it is green,"
60287
+ );
60288
+ lines2.push(
60289
+ " then report: \u201Cthe repository\u2019s acceptance lane published the receipt on"
60290
+ );
60291
+ lines2.push(" CI\u2019s green run; no MCP publish made\u201D, naming that run (its");
60292
+ lines2.push(
60293
+ " `Publish the acceptance receipt` step logs the receipt id). Steps 2\u20134 do not"
60294
+ );
60295
+ lines2.push(" apply.");
60296
+ lines2.push("");
60297
+ lines2.push(" **If it prints nothing**, no lane publishes there, and steps 2\u20134 are yours.");
60298
+ lines2.push("2. **Run the story's acceptance spec** (`tests/e2e/acceptance*.spec.ts`, the one");
60233
60299
  lines2.push(` that declares \`acceptanceStory('${input.key}')\`) on the acceptance lane, with`);
60234
60300
  lines2.push(" recording on, so the clip shows the fixed work.");
60235
- lines2.push("2. **Publish it \u2014 two calls.** `create_acceptance_upload` with the card key mints a");
60301
+ lines2.push("3. **Publish it \u2014 two calls.** `create_acceptance_upload` with the card key mints a");
60236
60302
  lines2.push(
60237
60303
  " presigned PUT; PUT the clip\u2019s bytes to it (`Content-Type: video/webm`); then"
60238
60304
  );
60239
60305
  lines2.push(" `publish_acceptance_result` with the pathname it returned, the chapters, the");
60240
60306
  lines2.push(" commit sha you pushed, and the card key.");
60241
60307
  lines2.push(
60242
- "3. **Report the receipt id the publish returned.** Without it nothing was published,"
60308
+ "4. **Report the receipt id the publish returned.** Without it nothing was published,"
60243
60309
  );
60244
60310
  lines2.push(" and the reviewer has nothing new to watch.");
60245
60311
  lines2.push("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motir/cli",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "description": "Motir CLI — terminal dispatch of the work loop, over Motir's public REST API.",
5
5
  "license": "GPL-3.0-only",
6
6
  "repository": {