@loomwright/cli 1.0.1 → 1.0.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes per release. `loomwright update` applies them to an installed workspace (see [docs/cli.md](docs/cli.md#update)).
4
4
 
5
+ ## 1.0.2
6
+
7
+ ### Patch Changes
8
+
9
+ - a9d57b0: opencode: accept every 2.x minor below 3.0.0 and let features declare their own floor
10
+ (`mcp.roles` needs 2.2.0); the lock records the effective floor and init, update and doctor
11
+ report it.
12
+
5
13
  ## 1.0.1
6
14
 
7
15
  ### Patch Changes
package/README.md CHANGED
@@ -24,15 +24,17 @@ How it works inside: [ARCHITECTURE.md](ARCHITECTURE.md). Every command: [docs/cl
24
24
 
25
25
  Requirements: macOS or Linux, Node ≥ 20 or Bun ≥ 1.3, and these tools on `PATH`:
26
26
 
27
- | Tool | Version | Install |
28
- | -------- | ----------------------------------- | -------------------------------------------------- |
29
- | git | ≥ 2.31 | Xcode CLT or your package manager |
30
- | opencode | 2.1.x–2.2.x (≥ 2.1.2; tested 2.2.0) | `npm install --global @opencode/cli@2.2.0` |
31
- | OpenSpec | 1.x (≥ 1.10) | `npm install --global @fission-ai/openspec@1.14.3` |
32
- | Graphify | 0.9.x (≥ 0.9.93) | `uv tool install graphifyy==0.9.93` |
27
+ | Tool | Version | Install |
28
+ | -------- | ------------------------------------ | -------------------------------------------------- |
29
+ | git | ≥ 2.31 | Xcode CLT or your package manager |
30
+ | opencode | 2.x (≥ 2.1.2, < 3.0.0; tested 2.2.0) | `npm install --global @opencode/cli@2.2.0` |
31
+ | OpenSpec | 1.x (≥ 1.10) | `npm install --global @fission-ai/openspec@1.14.3` |
32
+ | Graphify | 0.9.x (≥ 0.9.93) | `uv tool install graphifyy==0.9.93` |
33
33
 
34
34
  Plus credentials for the model providers you configure, either exported (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, …) or stored with `opencode auth login`. The factory copies the configured providers' stored credentials into its private runtime database at startup, so they never enter your config or git.
35
35
 
36
+ opencode support is bounded by majors: every 2.x release is accepted until 3.0.0. Features that need a newer minor raise the floor for the workspaces that use them: `mcp.roles` needs 2.2.0, because 2.2.0 exposes MCP/plugin tools to agents that deny `execute`. A config without `mcp.roles` keeps running on 2.1.2.
37
+
36
38
  Run the CLI without installing it:
37
39
 
38
40
  ```bash
@@ -266,7 +268,7 @@ The root is a private workspace manifest; the packages are `packages/protocol`,
266
268
 
267
269
  The test suite builds fixture workspaces in temp dirs: a single TS repo, and an AI repo with Go, React and Helm submodules. It stubs the LLM with scripted handoffs. The manual end-to-end runs in [docs/e2e/](docs/e2e/) drive the real opencode server, git, OpenSpec, Graphify and gate toolchains, with a scripted role-aware model, so they cost nothing and can be reproduced. See ADR-0023 for what they cover and what they don't.
268
270
 
269
- CI runs the full suite on Ubuntu and macOS, then smoke-tests the npm tarball and the built bundle on Node 20.3, 22 and 24. The manual `E2E` workflow runs the real-opencode runtime test against each supported opencode version (2.1.2 and 2.2.0).
271
+ CI runs the full suite on Ubuntu and macOS, then smoke-tests the npm tarball and the built bundle on Node 20.3, 22 and 24. The manual `E2E` workflow runs the real-opencode runtime test against the opencode versions verified end to end (2.1.2 and 2.2.0).
270
272
 
271
273
  ### Releasing
272
274
 
package/dist/cli.js CHANGED
@@ -14743,7 +14743,7 @@ class TransientError extends Error {
14743
14743
  }
14744
14744
 
14745
14745
  // packages/core/src/version.ts
14746
- var FACTORY_VERSION = "1.0.1";
14746
+ var FACTORY_VERSION = "1.0.2";
14747
14747
  var PACKAGE_NAME = "@loomwright/cli";
14748
14748
  var runVersion = (version) => `npx ${PACKAGE_NAME}@${version}`;
14749
14749
 
@@ -22243,7 +22243,7 @@ function superRefine(fn, params) {
22243
22243
  // packages/core/src/versions.ts
22244
22244
  var OPENCODE = {
22245
22245
  min: "2.1.2",
22246
- maxExclusive: "2.3.0",
22246
+ maxExclusive: "3.0.0",
22247
22247
  tested: "2.2.0",
22248
22248
  npmCli: "@opencode/cli"
22249
22249
  };
@@ -23206,8 +23206,9 @@ function compareVersions(a, b) {
23206
23206
  }
23207
23207
  return 0;
23208
23208
  }
23209
- async function checkTool(name, cwd) {
23209
+ async function checkTool(name, cwd, requirement) {
23210
23210
  const spec = TOOL_SPECS[name];
23211
+ const floor = requirement !== undefined && compareVersions(requirement.min, spec.min) > 0 ? requirement.min : spec.min;
23211
23212
  const res = await exec([toolBin(name), "--version"], {
23212
23213
  cwd,
23213
23214
  env: toolEnv(name),
@@ -23217,12 +23218,13 @@ async function checkTool(name, cwd) {
23217
23218
  if (version === undefined) {
23218
23219
  return { tool: name, ok: false, problem: "not found", fix: spec.install };
23219
23220
  }
23220
- if (compareVersions(version, spec.min) < 0) {
23221
+ if (compareVersions(version, floor) < 0) {
23222
+ const reason = requirement === undefined ? "" : ` — ${requirement.reason}`;
23221
23223
  return {
23222
23224
  tool: name,
23223
23225
  ok: false,
23224
23226
  version,
23225
- problem: `${version} < ${spec.min}`,
23227
+ problem: `${version} < ${floor}${reason}`,
23226
23228
  fix: spec.install
23227
23229
  };
23228
23230
  }
@@ -23237,8 +23239,8 @@ async function checkTool(name, cwd) {
23237
23239
  }
23238
23240
  return { tool: name, ok: true, version };
23239
23241
  }
23240
- function checkTools(names, cwd) {
23241
- return Promise.all(names.map((n) => checkTool(n, cwd)));
23242
+ function checkTools(names, cwd, requirements = {}) {
23243
+ return Promise.all(names.map((n) => checkTool(n, cwd, requirements[n])));
23242
23244
  }
23243
23245
 
23244
23246
  // packages/core/src/openspec/cli.ts
@@ -26268,7 +26270,7 @@ var Lock = strictObject({
26268
26270
  }).default({}),
26269
26271
  managed: record(string2(), LockEntry)
26270
26272
  });
26271
- function buildLock(managed, addons = {}) {
26273
+ function buildLock(managed, addons = {}, opencodeMin = OPENCODE.min) {
26272
26274
  const sorted = Object.fromEntries(Object.entries(managed).sort(([a], [b]) => a.localeCompare(b)));
26273
26275
  return {
26274
26276
  lockVersion: LOCK_VERSION,
@@ -26276,7 +26278,7 @@ function buildLock(managed, addons = {}) {
26276
26278
  configSchemaVersion: CONFIG_SCHEMA_VERSION,
26277
26279
  tools: {
26278
26280
  git: { min: GIT.min, tested: GIT.tested },
26279
- opencode: { min: OPENCODE.min, maxExclusive: OPENCODE.maxExclusive, tested: OPENCODE.tested },
26281
+ opencode: { min: opencodeMin, maxExclusive: OPENCODE.maxExclusive, tested: OPENCODE.tested },
26280
26282
  openspec: { min: OPENSPEC.min, maxExclusive: OPENSPEC.maxExclusive, tested: OPENSPEC.tested },
26281
26283
  graphify: { min: GRAPHIFY.min, maxExclusive: GRAPHIFY.maxExclusive, tested: GRAPHIFY.tested }
26282
26284
  },
@@ -32496,6 +32498,34 @@ async function executeSync(root, plan, previous, options = {}) {
32496
32498
  return { managed, merged, conflicts };
32497
32499
  }
32498
32500
 
32501
+ // packages/core/src/opencode-features.ts
32502
+ var OPENCODE_FEATURES = {
32503
+ "mcp.roles": {
32504
+ min: "2.2.0",
32505
+ why: "direct MCP/plugin tool exposure when `execute` is denied, which makes `config.mcp.roles` effective"
32506
+ }
32507
+ };
32508
+ function enabledOpencodeFeatures(config) {
32509
+ const enabled = [];
32510
+ if (Object.values(config.mcp.roles).some((patterns) => (patterns?.length ?? 0) > 0)) {
32511
+ enabled.push("mcp.roles");
32512
+ }
32513
+ return enabled;
32514
+ }
32515
+ function opencodeRequirement(config) {
32516
+ let requirement;
32517
+ for (const id of enabledOpencodeFeatures(config)) {
32518
+ const feature = OPENCODE_FEATURES[id];
32519
+ if (requirement === undefined || compareVersions(feature.min, requirement.min) > 0) {
32520
+ requirement = {
32521
+ min: feature.min,
32522
+ reason: `${id} needs opencode >= ${feature.min}: ${feature.why}`
32523
+ };
32524
+ }
32525
+ }
32526
+ return requirement;
32527
+ }
32528
+
32499
32529
  // packages/core/src/workspace/sync.ts
32500
32530
  var INSTALL_PATHS = [
32501
32531
  "AGENTS.md",
@@ -32556,7 +32586,7 @@ async function syncWorkspace(root, config, options = {}) {
32556
32586
  contentSha256: PONYTAIL.contentSha256,
32557
32587
  files: [...PONYTAIL.files]
32558
32588
  }
32559
- } : {});
32589
+ } : {}, opencodeRequirement(config)?.min ?? OPENCODE.min);
32560
32590
  writeFileSync5(join22(root, LOCK_FILE), serializeLock(lock));
32561
32591
  const hooks = [];
32562
32592
  for (const repo of config.repos) {
@@ -39911,18 +39941,23 @@ class Checks {
39911
39941
  var GUARD_PLUGIN = ".opencode/plugins/factory.js";
39912
39942
  var CURRENT_PINS = buildLock({}).tools;
39913
39943
  var range = (pin) => `>= ${pin.min}${pin.maxExclusive ? ` < ${pin.maxExclusive}` : ""}`;
39914
- async function checkToolsAndLock(c, root, lock) {
39944
+ async function checkToolsAndLock(c, root, lock, config) {
39915
39945
  c.in("tools");
39946
+ const requirement = config === undefined ? undefined : opencodeRequirement(config);
39947
+ const floor = requirement !== undefined && compareVersions(requirement.min, OPENCODE.min) > 0 ? requirement.min : OPENCODE.min;
39916
39948
  const names = ["git", "opencode", "openspec", "graphify"];
39917
- for (const t of await checkTools(names, root)) {
39949
+ for (const t of await checkTools(names, root, requirement ? { opencode: requirement } : {})) {
39918
39950
  if (!t.ok) {
39919
39951
  c.add("fail", t.tool, t.problem, t.fix);
39920
39952
  continue;
39921
39953
  }
39922
39954
  const pin = lock?.tools[t.tool];
39923
39955
  const outsideLock = pin !== undefined && (compareVersions(t.version, pin.min) < 0 || pin.maxExclusive !== undefined && compareVersions(t.version, pin.maxExclusive) >= 0);
39956
+ const staleFloor = t.tool === "opencode" && pin !== undefined && !outsideLock && compareVersions(pin.min, floor) < 0;
39924
39957
  if (pin !== undefined && outsideLock) {
39925
39958
  c.add("warn", t.tool, `${t.version} is outside the lock's range (${range(pin)})`, "loomwright update --tools");
39959
+ } else if (staleFloor) {
39960
+ c.add("warn", t.tool, `${t.version}; the lock's floor is ${pin.min}, this config needs ${floor}${requirement === undefined ? "" : ` (${requirement.reason})`}`, "loomwright update");
39926
39961
  } else if (pin !== undefined && pin.tested !== CURRENT_PINS[t.tool].tested) {
39927
39962
  c.add("warn", t.tool, `${t.version}; the lock pins tested ${pin.tested}, this factory ${CURRENT_PINS[t.tool].tested}`, "loomwright update --tools");
39928
39963
  } else {
@@ -40362,20 +40397,26 @@ function checkSandbox(c, config) {
40362
40397
  async function runDoctor(root) {
40363
40398
  const c = new Checks("tools");
40364
40399
  const lock = readLock(root);
40365
- await checkToolsAndLock(c, root, lock);
40400
+ let config;
40401
+ let configFailure;
40402
+ if (lock !== undefined) {
40403
+ try {
40404
+ config = loadConfig(root).config;
40405
+ } catch (err) {
40406
+ if (!(err instanceof FactoryError))
40407
+ throw err;
40408
+ configFailure = err;
40409
+ }
40410
+ }
40411
+ await checkToolsAndLock(c, root, lock, config);
40366
40412
  const uninitialised = [];
40367
40413
  c.in("install");
40368
40414
  if (lock === undefined) {
40369
40415
  c.add("fail", "install", "loomwright is not installed here", "loomwright init");
40370
40416
  return { checks: c.list, gates: [], uninitialised };
40371
40417
  }
40372
- let config;
40373
- try {
40374
- config = loadConfig(root).config;
40375
- } catch (err) {
40376
- if (!(err instanceof FactoryError))
40377
- throw err;
40378
- c.add("fail", "config", err.message, err.details.join("; ") || undefined);
40418
+ if (config === undefined) {
40419
+ c.add("fail", "config", configFailure?.message ?? "config could not be read", configFailure?.details.join("; ") || undefined);
40379
40420
  return { checks: c.list, gates: [], uninitialised };
40380
40421
  }
40381
40422
  c.add("ok", "config", `schemaVersion ${config.schemaVersion}, layout ${config.layout}`);
@@ -40919,7 +40960,11 @@ var initCommand = {
40919
40960
  if (top !== root) {
40920
40961
  throw new PreconditionError(`${root} is not the top level of its git repository (${top})`);
40921
40962
  }
40922
- const tools = await checkTools(REQUIRED_TOOLS, root);
40963
+ const configPath = join55(root, CONFIG_FILE);
40964
+ const newConfig = !existsSync41(configPath);
40965
+ const existingConfig = newConfig ? undefined : loadConfig(root).config;
40966
+ const requirement = existingConfig === undefined ? undefined : opencodeRequirement(existingConfig);
40967
+ const tools = await checkTools(REQUIRED_TOOLS, root, requirement === undefined ? {} : { opencode: requirement });
40923
40968
  const missing = tools.filter((t) => !t.ok);
40924
40969
  if (missing.length > 0) {
40925
40970
  throw new PreconditionError("required tools are missing or unsupported", missing.map((t) => t.ok ? "" : `${t.tool}: ${t.problem} → ${t.fix}`));
@@ -40933,15 +40978,13 @@ var initCommand = {
40933
40978
  ]);
40934
40979
  }
40935
40980
  }
40936
- const configPath = join55(root, CONFIG_FILE);
40937
- const newConfig = !existsSync41(configPath);
40938
40981
  const unadopted = unadoptedChanges(root);
40939
40982
  const detection = newConfig ? await detectWorkspace(root) : undefined;
40940
40983
  const legacy = !values.plan && readLock(root) === undefined && detection !== undefined ? archiveLegacySetups(root, detection.repos.map((r) => r.path)) : undefined;
40941
40984
  const keepOpenspec = newConfig && !values.force && existsSync41(join55(root, OPENSPEC_CONFIG)) && readLock(root) === undefined;
40942
40985
  const rendered = detection !== undefined ? renderInitialConfig(detection) : undefined;
40943
40986
  const configText = rendered !== undefined && keepOpenspec ? setJsonc(rendered, ["unmanaged"], [OPENSPEC_CONFIG]) : rendered;
40944
- const config = configText !== undefined ? parseConfigText(configText, CONFIG_FILE) : loadConfig(root).config;
40987
+ const config = configText !== undefined ? parseConfigText(configText, CONFIG_FILE) : existingConfig ?? loadConfig(root).config;
40945
40988
  const openspecFiles = await renderOpenspecTools(root);
40946
40989
  if (values.plan) {
40947
40990
  const planned = planSync(root, [...renderWorkspace(config, { root }), ...openspecFiles], readLock(root)?.managed ?? {}, { unmanaged: config.unmanaged, force: values.force });
@@ -42759,7 +42802,8 @@ Upgrades this workspace to the installed factory version, as one local commit
42759
42802
  }, null, 2));
42760
42803
  return ExitCode.Ok;
42761
42804
  }
42762
- const tools = await checkTools(["git", "opencode", "openspec", "graphify"], root);
42805
+ const requirement = opencodeRequirement(plan.config);
42806
+ const tools = await checkTools(["git", "opencode", "openspec", "graphify"], root, requirement === undefined ? {} : { opencode: requirement });
42763
42807
  for (const t of tools)
42764
42808
  if (!t.ok)
42765
42809
  io.out(`warning: ${t.tool}: ${t.problem} → ${t.fix}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomwright/cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Loomwright: repo-local AI software factory — OpenSpec + Graphify + opencode v2",
5
5
  "license": "MIT",
6
6
  "author": "Lars Roth",