@orbit-build/cli 1.6.5 → 1.6.6

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/dist/index.js CHANGED
@@ -238108,7 +238108,7 @@ import picocolors36 from "picocolors";
238108
238108
  // ../shared/dist/index.js
238109
238109
  import { randomUUID } from "crypto";
238110
238110
  import { dirname, isAbsolute, normalize, relative, resolve } from "path";
238111
- import { execSync as execSync2 } from "child_process";
238111
+ import { execSync } from "child_process";
238112
238112
  import { existsSync, realpathSync } from "fs";
238113
238113
  import { readFileSync } from "fs";
238114
238114
  import { z } from "zod";
@@ -238357,7 +238357,7 @@ function getGitBranch(cwd) {
238357
238357
  return "";
238358
238358
  }
238359
238359
  try {
238360
- const branch = execSync2("git rev-parse --abbrev-ref HEAD", {
238360
+ const branch = execSync("git rev-parse --abbrev-ref HEAD", {
238361
238361
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
238362
238362
  cwd,
238363
238363
  stdio: ["ignore", "pipe", "ignore"],
@@ -242619,7 +242619,7 @@ function runConfig(cwd) {
242619
242619
  }
242620
242620
 
242621
242621
  // src/commands/doctor.ts
242622
- import { execSync as execSync3 } from "child_process";
242622
+ import { execSync as execSync2 } from "child_process";
242623
242623
  import { existsSync as existsSync14 } from "fs";
242624
242624
  import { basename as basename5, join as join12 } from "path";
242625
242625
  import picocolors6 from "picocolors";
@@ -259028,7 +259028,7 @@ import http from "http";
259028
259028
  import { createHash as createHash32 } from "crypto";
259029
259029
  var MAX_MCP_INPUT_SCHEMA_BYTES = 256 * 1024;
259030
259030
  var MAX_VALIDATION_ERRORS = 12;
259031
- var ajv = new import_ajv.default({
259031
+ var ajv = new import_ajv.Ajv({
259032
259032
  allErrors: true,
259033
259033
  strict: false,
259034
259034
  allowUnionTypes: true,
@@ -267059,7 +267059,9 @@ function generateXMLToolsPrompt(tools) {
267059
267059
  for (const tool of tools) {
267060
267060
  lines.push(`- **${tool.name}**: ${tool.description}`, " Parameters:");
267061
267061
  if (tool.inputSchema instanceof z55.ZodObject) {
267062
- for (const [key, property] of Object.entries(tool.inputSchema.shape)) {
267062
+ for (const [key, property] of Object.entries(
267063
+ tool.inputSchema.shape
267064
+ )) {
267063
267065
  const field = describeZodPromptField(property);
267064
267066
  const values = field.values ? `, values: ${field.values}` : "";
267065
267067
  const description = field.description ? ` - ${field.description.replace(/\s+/g, " ").trim()}` : "";
@@ -267266,7 +267268,11 @@ function resolveLocalPackageBinary(cwd, packageName, binaryName) {
267266
267268
  }
267267
267269
  function resolveManifestBinary(bin, binaryName) {
267268
267270
  if (typeof bin === "string") return bin;
267269
- return bin?.[binaryName];
267271
+ if (typeof bin !== "object" || bin === null || Array.isArray(bin)) {
267272
+ return void 0;
267273
+ }
267274
+ const candidate = bin[binaryName];
267275
+ return typeof candidate === "string" ? candidate : void 0;
267270
267276
  }
267271
267277
  function isValidPackageName(packageName) {
267272
267278
  if (packageName.length === 0 || packageName.length > 214) return false;
@@ -275214,41 +275220,53 @@ function createProviderFromConfig(config) {
275214
275220
  modelCapabilities: pConfig.modelCapabilities,
275215
275221
  apiKeyResolver: () => pConfig.apiKey
275216
275222
  };
275217
- if (pConfig.type === "deepseek" || pConfig.type === "openai-compatible" && isOfficialDeepSeekApi(pConfig.baseUrl)) {
275218
- return new DeepSeekProvider(void 0, pConfig.baseUrl, providerOptions);
275223
+ const baseUrl = pConfig.baseUrl;
275224
+ if (pConfig.type === "deepseek" || pConfig.type === "openai-compatible" && baseUrl !== void 0 && isOfficialDeepSeekApi(baseUrl)) {
275225
+ return new DeepSeekProvider(
275226
+ void 0,
275227
+ baseUrl ?? "https://api.deepseek.com",
275228
+ providerOptions
275229
+ );
275219
275230
  }
275220
275231
  if (pConfig.type === "anthropic-compatible") {
275221
275232
  return new AnthropicCompatibleProvider(
275222
275233
  void 0,
275223
- pConfig.baseUrl,
275234
+ baseUrl ?? "https://api.anthropic.com",
275224
275235
  providerOptions
275225
275236
  );
275226
275237
  }
275227
275238
  if (pConfig.type === "openai-compatible") {
275228
275239
  const generic = new OpenAICompatibleProvider(
275229
275240
  void 0,
275230
- pConfig.baseUrl,
275241
+ baseUrl ?? "https://api.openai.com/v1",
275231
275242
  providerOptions
275232
275243
  );
275233
275244
  const deepSeek = new DeepSeekProvider(
275234
275245
  void 0,
275235
- pConfig.baseUrl,
275246
+ baseUrl ?? "https://api.openai.com/v1",
275236
275247
  providerOptions
275237
275248
  );
275238
275249
  return new ModelAwareProvider(generic, deepSeek);
275239
275250
  }
275240
275251
  if (pConfig.type === "openai") {
275241
- return new OpenAIProvider(pConfig.apiKey, pConfig.baseUrl, providerOptions);
275252
+ return new OpenAIProvider(
275253
+ pConfig.apiKey,
275254
+ baseUrl ?? "https://api.openai.com/v1",
275255
+ providerOptions
275256
+ );
275242
275257
  }
275243
275258
  if (pConfig.type === "anthropic") {
275244
275259
  return new AnthropicProvider(
275245
275260
  pConfig.apiKey,
275246
- pConfig.baseUrl,
275261
+ baseUrl ?? "https://api.anthropic.com",
275247
275262
  providerOptions
275248
275263
  );
275249
275264
  }
275250
275265
  if (pConfig.type === "ollama") {
275251
- return new OllamaProvider(pConfig.baseUrl, providerOptions);
275266
+ return new OllamaProvider(
275267
+ pConfig.baseUrl ?? "http://localhost:11434",
275268
+ providerOptions
275269
+ );
275252
275270
  }
275253
275271
  throw new Error(`Unsupported provider type "${pConfig.type}".`);
275254
275272
  }
@@ -275367,7 +275385,7 @@ var DoctorSnapshotSchema = z48.object({
275367
275385
  issues: z48.array(DoctorIssueSchema)
275368
275386
  });
275369
275387
  function defaultExec(command, options = {}) {
275370
- return execSync3(command, {
275388
+ return execSync2(command, {
275371
275389
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
275372
275390
  encoding: "utf8",
275373
275391
  stdio: ["ignore", "pipe", "ignore"],
@@ -281837,16 +281855,17 @@ var FullscreenTui = class {
281837
281855
  const loopMsg = loopAsst[i2];
281838
281856
  const textBlock = loopMsg.content.find((block2) => block2.type === "text");
281839
281857
  if (textBlock && textBlock.text) {
281858
+ const model = typeof loopMsg.metadata?.model === "string" ? loopMsg.metadata.model : void 0;
281840
281859
  const localIdx = localAsstIdx[i2];
281841
281860
  if (localIdx !== void 0) {
281842
281861
  this.history[localIdx].text = textBlock.text;
281843
- this.history[localIdx].model = loopMsg.metadata?.model;
281862
+ this.history[localIdx].model = model;
281844
281863
  } else {
281845
281864
  this.history.push({
281846
281865
  role: "assistant",
281847
281866
  text: textBlock.text,
281848
281867
  attempt: i2 + 1,
281849
- model: loopMsg.metadata?.model
281868
+ model
281850
281869
  });
281851
281870
  }
281852
281871
  }
@@ -281869,11 +281888,12 @@ var FullscreenTui = class {
281869
281888
  } else if (msg.role === "assistant") {
281870
281889
  attempt++;
281871
281890
  const textBlock = msg.content.find((block2) => block2.type === "text");
281891
+ const model = typeof msg.metadata?.model === "string" ? msg.metadata.model : void 0;
281872
281892
  this.history.push({
281873
281893
  role: "assistant",
281874
281894
  text: textBlock?.text || "",
281875
281895
  attempt,
281876
- model: msg.metadata?.model
281896
+ model
281877
281897
  });
281878
281898
  } else if (msg.role === "system") {
281879
281899
  const text2 = msg.content.map((content) => content.type === "text" ? content.text : "").join("");
@@ -283192,9 +283212,6 @@ function stripQuotes(value) {
283192
283212
  return value.length >= 2 && value.startsWith('"') && value.endsWith('"') ? value.slice(1, -1) : value;
283193
283213
  }
283194
283214
 
283195
- // src/runtime/CommandRouter.ts
283196
- import { execFileSync as execFileSync8 } from "child_process";
283197
-
283198
283215
  // src/runtime/webui/WebUiRuntime.ts
283199
283216
  import http2 from "http";
283200
283217
  import { randomBytes as randomBytes4, randomUUID as randomUUID10 } from "crypto";
@@ -290017,10 +290034,11 @@ function safeWebMessage(error) {
290017
290034
  function summarizeWebToolValue(value, options = {}) {
290018
290035
  let candidate = value;
290019
290036
  if (typeof candidate === "string") {
290037
+ const rawText = candidate;
290020
290038
  try {
290021
- candidate = JSON.parse(candidate);
290039
+ candidate = JSON.parse(rawText);
290022
290040
  } catch {
290023
- return options.allowPlainText ? safeWebToolText(candidate, 700) : "";
290041
+ return options.allowPlainText ? safeWebToolText(rawText, 700) : "";
290024
290042
  }
290025
290043
  }
290026
290044
  if (!isRecord7(candidate)) return "";
@@ -290325,16 +290343,17 @@ function collectWebUiStatus(options, activeTurn) {
290325
290343
  lastOpenedAt: typeof project.lastOpenedAt === "string" ? project.lastOpenedAt.slice(0, 64) : "",
290326
290344
  available: project.available === true
290327
290345
  }));
290346
+ const taskStatus = activeTurn?.cancelRequested ? "cancelling" : approval ? "waiting_approval" : activeTurn ? "running" : "ready";
290328
290347
  const agentRuns = summarizeWebUiAgentRuns(
290329
290348
  safeCall(() => options.getAgentRuns?.()) || []
290330
290349
  );
290331
- return {
290350
+ const snapshot = {
290332
290351
  language: config.language,
290333
290352
  workspace: cwd,
290334
290353
  projects,
290335
290354
  agentRuns,
290336
290355
  task: {
290337
- status: activeTurn?.cancelRequested ? "cancelling" : approval ? "waiting_approval" : activeTurn ? "running" : "ready",
290356
+ status: taskStatus,
290338
290357
  reason: approval?.reason || ""
290339
290358
  },
290340
290359
  agentTeam: {
@@ -290463,6 +290482,7 @@ function collectWebUiStatus(options, activeTurn) {
290463
290482
  cacheDiagnostics: redactSecrets(stripAnsi3(buildCacheDiagnostics(cwd))),
290464
290483
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
290465
290484
  };
290485
+ return snapshot;
290466
290486
  }
290467
290487
  function summarizeWebUiBackgroundTasks(value) {
290468
290488
  const statuses = /* @__PURE__ */ new Set([
@@ -290486,8 +290506,15 @@ function summarizeWebUiBackgroundTasks(value) {
290486
290506
  })).filter((task) => task.id);
290487
290507
  }
290488
290508
  function summarizeWebUiInputQueue(value) {
290489
- const modes = /* @__PURE__ */ new Set(["follow_up", "steer"]);
290490
- const sources = /* @__PURE__ */ new Set(["terminal", "web", "api"]);
290509
+ const modes = /* @__PURE__ */ new Set([
290510
+ "follow_up",
290511
+ "steer"
290512
+ ]);
290513
+ const sources = /* @__PURE__ */ new Set([
290514
+ "terminal",
290515
+ "web",
290516
+ "api"
290517
+ ]);
290491
290518
  return (Array.isArray(value) ? value : []).filter(isRecord9).slice(0, 12).map((item) => ({
290492
290519
  id: safeLabel(typeof item.id === "string" ? item.id : "", 200),
290493
290520
  mode: typeof item.mode === "string" && modes.has(item.mode) ? item.mode : "follow_up",
@@ -303312,6 +303339,41 @@ function normalizeCommitMessage(message2) {
303312
303339
  ) ? subject : `chore: ${subject}`.slice(0, MAX_COMMIT_SUBJECT_LENGTH).trim();
303313
303340
  }
303314
303341
 
303342
+ // src/runtime/Clipboard.ts
303343
+ import { execFileSync as execFileSync8 } from "child_process";
303344
+ var DEFAULT_RUNTIME = {
303345
+ platform: process.platform,
303346
+ execute(executable, args, input) {
303347
+ execFileSync8(executable, [...args], {
303348
+ ...HIDDEN_CHILD_PROCESS_OPTIONS,
303349
+ input
303350
+ });
303351
+ }
303352
+ };
303353
+ function copyTextToClipboard(text2, runtime = DEFAULT_RUNTIME) {
303354
+ const candidates = clipboardCandidates(runtime.platform);
303355
+ for (const candidate of candidates) {
303356
+ try {
303357
+ runtime.execute(candidate.executable, candidate.args, text2);
303358
+ return true;
303359
+ } catch (error) {
303360
+ void redactSecrets(
303361
+ error instanceof Error ? error.message : String(error)
303362
+ );
303363
+ }
303364
+ }
303365
+ return false;
303366
+ }
303367
+ function clipboardCandidates(platform) {
303368
+ if (platform === "win32") return [{ executable: "clip", args: [] }];
303369
+ if (platform === "darwin") return [{ executable: "pbcopy", args: [] }];
303370
+ return [
303371
+ { executable: "xclip", args: ["-selection", "clipboard"] },
303372
+ { executable: "xsel", args: ["-ib"] },
303373
+ { executable: "wl-copy", args: [] }
303374
+ ];
303375
+ }
303376
+
303315
303377
  // src/runtime/CommandRouter.ts
303316
303378
  function stripAnsi4(value) {
303317
303379
  return value.replace(/\u001b\[[0-9;]*m/g, "");
@@ -304198,16 +304260,16 @@ var CommandRouter = class {
304198
304260
  if (command === "/commit") {
304199
304261
  const commitMsg = parts.slice(1).join(" ").trim();
304200
304262
  const isZh = config.language !== "en";
304201
- const { execFileSync: execFileSync10, execSync: execSync4 } = await import("child_process");
304263
+ const { execFileSync: execFileSync10, execSync: execSync3 } = await import("child_process");
304202
304264
  const childEnvironment = isFullAccessEnabled(config) ? buildInheritedChildEnvironment() : buildSanitizedChildEnvironment();
304203
304265
  try {
304204
- let diff = execSync4("git diff --cached", {
304266
+ let diff = execSync3("git diff --cached", {
304205
304267
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
304206
304268
  cwd,
304207
304269
  env: childEnvironment
304208
304270
  }).toString().trim();
304209
304271
  if (!diff) {
304210
- const unstaged = execSync4("git status --porcelain", {
304272
+ const unstaged = execSync3("git status --porcelain", {
304211
304273
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
304212
304274
  cwd,
304213
304275
  env: childEnvironment
@@ -304234,12 +304296,12 @@ var CommandRouter = class {
304234
304296
  this.printOutput(
304235
304297
  isZh ? "\u6B63\u5728\u6682\u5B58\u6240\u6709\u53D8\u66F4..." : "Staging all changes..."
304236
304298
  );
304237
- execSync4("git add -A", {
304299
+ execSync3("git add -A", {
304238
304300
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
304239
304301
  cwd,
304240
304302
  env: childEnvironment
304241
304303
  });
304242
- diff = execSync4("git diff --cached", {
304304
+ diff = execSync3("git diff --cached", {
304243
304305
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
304244
304306
  cwd,
304245
304307
  env: childEnvironment
@@ -305333,49 +305395,7 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
305333
305395
  }
305334
305396
  }
305335
305397
  copyToClipboard(text2) {
305336
- try {
305337
- if (process.platform === "win32") {
305338
- execFileSync8("clip", [], {
305339
- ...HIDDEN_CHILD_PROCESS_OPTIONS,
305340
- input: text2
305341
- });
305342
- return true;
305343
- } else if (process.platform === "darwin") {
305344
- execFileSync8("pbcopy", [], {
305345
- ...HIDDEN_CHILD_PROCESS_OPTIONS,
305346
- input: text2
305347
- });
305348
- return true;
305349
- } else {
305350
- try {
305351
- execFileSync8("xclip", ["-selection", "clipboard"], {
305352
- ...HIDDEN_CHILD_PROCESS_OPTIONS,
305353
- input: text2
305354
- });
305355
- return true;
305356
- } catch {
305357
- try {
305358
- execFileSync8("xsel", ["-ib"], {
305359
- ...HIDDEN_CHILD_PROCESS_OPTIONS,
305360
- input: text2
305361
- });
305362
- return true;
305363
- } catch {
305364
- try {
305365
- execSync("wl-copy", {
305366
- ...HIDDEN_CHILD_PROCESS_OPTIONS,
305367
- input: text2
305368
- });
305369
- return true;
305370
- } catch {
305371
- return false;
305372
- }
305373
- }
305374
- }
305375
- }
305376
- } catch {
305377
- return false;
305378
- }
305398
+ return copyTextToClipboard(text2);
305379
305399
  }
305380
305400
  };
305381
305401
  function validateImageAttachments(model, capabilities, attachments) {
@@ -306674,7 +306694,7 @@ Risk Warning: ${reason}`);
306674
306694
  providerInstance,
306675
306695
  interaction,
306676
306696
  multi,
306677
- !!cliOverrides?.direct,
306697
+ isDirectRun(cliOverrides),
306678
306698
  options?.webUi,
306679
306699
  selectedProfile
306680
306700
  );
@@ -306743,6 +306763,9 @@ Risk Warning: ${reason}`);
306743
306763
  cleanupJsonl();
306744
306764
  }
306745
306765
  }
306766
+ function isDirectRun(value) {
306767
+ return typeof value === "object" && value !== null && !Array.isArray(value) && value.direct === true;
306768
+ }
306746
306769
  function exitCodeForOutcome(outcome) {
306747
306770
  if (!outcome || outcome.status === "completed") return 0;
306748
306771
  if (outcome.status === "aborted") return 130;
@@ -313248,16 +313271,21 @@ function runReviewCommand(action, artifactName, findingId, options = {}) {
313248
313271
  if (action === "verify") {
313249
313272
  const selected = artifactName ? artifacts.filter((item) => item.name === validateName(artifactName)) : artifacts;
313250
313273
  const blockedFindings = selected.flatMap(
313251
- ({ name, value }) => value.findings.filter(
313252
- (finding2) => (finding2.severity === "P0" || finding2.severity === "P1") && finding2.disposition === "open"
313253
- ).map((finding2) => ({
313254
- artifact: name,
313255
- id: finding2.id,
313256
- severity: finding2.severity,
313257
- file: finding2.file,
313258
- line: finding2.line,
313259
- title: finding2.title
313260
- }))
313274
+ ({ name, value }) => value.findings.flatMap((finding2) => {
313275
+ if (finding2.severity !== "P0" && finding2.severity !== "P1" || finding2.disposition !== "open") {
313276
+ return [];
313277
+ }
313278
+ return [
313279
+ {
313280
+ artifact: name,
313281
+ id: finding2.id,
313282
+ severity: finding2.severity,
313283
+ file: finding2.file,
313284
+ line: finding2.line,
313285
+ title: finding2.title
313286
+ }
313287
+ ];
313288
+ })
313261
313289
  );
313262
313290
  const result = {
313263
313291
  ok: blockedFindings.length === 0,
@@ -313300,7 +313328,8 @@ function runReviewCommand(action, artifactName, findingId, options = {}) {
313300
313328
  if (!artifact)
313301
313329
  return fail(`Review artifact not found: ${safeName}`, options);
313302
313330
  if (action === "show") {
313303
- emit(options.json ? artifact : [artifact], options.json === true);
313331
+ if (options.json) emit(artifact, true);
313332
+ else emit([{ name: safeName, value: artifact }], false);
313304
313333
  return 0;
313305
313334
  }
313306
313335
  const nextDisposition = options.disposition;
@@ -313471,6 +313500,12 @@ function emit(value, json) {
313471
313500
  console.log(JSON.stringify({ schemaVersion: 1, reviews: value }, null, 2));
313472
313501
  return;
313473
313502
  }
313503
+ if ("artifact" in value) {
313504
+ console.log(
313505
+ `\u2714 ${value.artifact}:${value.findingId} ${value.previousDisposition} \u2192 ${value.disposition}`
313506
+ );
313507
+ return;
313508
+ }
313474
313509
  if (!Array.isArray(value)) {
313475
313510
  console.log(picocolors28.bold(`
313476
313511
  ${value.perspective} \xB7 ${value.verdict}
@@ -314231,10 +314266,7 @@ var InputsSchema = z89.record(
314231
314266
  ).default({}).superRefine((value, context) => {
314232
314267
  if (Object.keys(value).length > MAX_INPUTS) {
314233
314268
  context.addIssue({
314234
- code: z89.ZodIssueCode.too_big,
314235
- type: "object",
314236
- maximum: MAX_INPUTS,
314237
- inclusive: true,
314269
+ code: z89.ZodIssueCode.custom,
314238
314270
  path: [],
314239
314271
  message: `Workflow dispatch accepts at most ${MAX_INPUTS} inputs.`
314240
314272
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbit-build/cli",
3
- "version": "1.6.5",
3
+ "version": "1.6.6",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Local-first AI coding agent CLI, TUI, Web UI, diagnostics, and LSP runtime",
6
6
  "keywords": [
@@ -1,5 +1,5 @@
1
1
  interface:
2
- display_name: "CUMCM Draft"
2
+ display_name: "cumcm-draft"
3
3
  short_description: "Complete CUMCM paper, code, PDF, AI record, and support ZIP"
4
4
  default_prompt: "Use $cumcm-draft to ask which Python or Conda interpreter to use, audit the current official CUMCM rules, build responsibility-based q1/q2 code without project-local finalizers or Python caches, generate Chinese-named tables and Chinese PDF+SVG figures, keep final PDFs/TeX and required qN submission copies under happy/, inspect the full Chinese paper, and package the matching PDF/ZIP pair."
5
5
  policy: