@documentation-robotics/cli 0.1.12 → 0.1.13

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/README.md CHANGED
@@ -289,7 +289,7 @@ your-project/
289
289
  │ └── ...
290
290
  ```
291
291
 
292
- **Legacy models**: Old projects using `.dr/` directory will auto-migrate changesets to `documentation-robotics/changesets/` on first use.
292
+ **Spec-version migrations**: When the model's spec version is older than the CLI's bundled spec (e.g. after a layer renumbering), run `dr upgrade` to migrate the on-disk model in place — see `MigrationRegistry` in `cli/src/core/migration-registry.ts` for the supported version paths.
293
293
 
294
294
  ### Specification Reference
295
295
 
package/dist/cli.js CHANGED
@@ -48,7 +48,7 @@ async function extractExitCode(error) {
48
48
  }
49
49
  return 1;
50
50
  }
51
- const cliVersion = "0.1.12", program = new Command();
51
+ const cliVersion = "0.1.13", program = new Command();
52
52
  (process.argv.includes("--version") || process.argv.includes("-V")) && (process.argv = ["node", "dr", "version"]), program.name("dr").description("Documentation Robotics CLI - Architecture Model Management").option("-v, --verbose", "Enable verbose output").option("--debug", "Enable debug mode").exitOverride().showSuggestionAfterError().hook("preAction", async (thisCommand) => {
53
53
  const options = thisCommand.opts();
54
54
  setGlobalOptions({
@@ -2,7 +2,7 @@ import ansis from "ansis";
2
2
  import { getCliBundledSpecVersion } from "../utils/spec-version.js";
3
3
  import { isTelemetryBuiltIn, isTelemetryConfigured } from "../telemetry/detect.js";
4
4
  import { getSpecReferencePath, getModelPath } from "../utils/project-paths.js";
5
- const gitHash = "d34903f", cliVersion = "0.1.12";
5
+ const gitHash = "3ba0141", cliVersion = "0.1.13";
6
6
  async function versionCommand() {
7
7
  const specVersion = getCliBundledSpecVersion(), telemetryBuiltIn = isTelemetryBuiltIn(), telemetryConfigured = await isTelemetryConfigured();
8
8
  let telemetryStatus;
@@ -62,6 +62,8 @@ class VisualizationServer {
62
62
  // Selected chat client for server
63
63
  chatInitializationError;
64
64
  // Store initialization error for status endpoint
65
+ _testClaudeCmdOverride;
66
+ _testCopilotCmdOverride;
65
67
  /**
66
68
  * Valid spec node IDs per layer
67
69
  * Dynamically loaded from compiled spec (spec/dist/{layer}.json at module load time)
@@ -1269,7 +1271,7 @@ class VisualizationServer {
1269
1271
  async launchClaudeCodeChat(ws, conversationId, message, requestId) {
1270
1272
  try {
1271
1273
  const cmd = ["claude", "--agent", "dr-architect", "--print"];
1272
- this.withDanger && cmd.push("--dangerously-skip-permissions"), cmd.push("--verbose", "--output-format", "stream-json");
1274
+ this.withDanger && cmd.push("--dangerously-skip-permissions"), cmd.push("--verbose", "--output-format", "stream-json"), this._testClaudeCmdOverride && cmd.splice(0, cmd.length, ...this._testClaudeCmdOverride);
1273
1275
  const proc = spawn(cmd[0], cmd.slice(1), {
1274
1276
  cwd: this.model.rootPath,
1275
1277
  stdio: ["pipe", "pipe", "pipe"]
@@ -1424,10 +1426,14 @@ class VisualizationServer {
1424
1426
  async launchCopilotChat(ws, conversationId, message, requestId) {
1425
1427
  try {
1426
1428
  let cmd;
1427
- const ghResult = spawnSync("gh", ["copilot", "--version"], {
1428
- stdio: ["ignore", "pipe", "pipe"]
1429
- });
1430
- ghResult.error ? console.warn(`[Copilot] 'gh copilot --version' probe failed to spawn: ${getErrorMessage(ghResult.error)}`) : ghResult.status !== 0 && process.env.VERBOSE && console.log(`[Copilot] 'gh copilot' unavailable (exit ${ghResult.status}), falling back to standalone 'copilot'`), ghResult.status === 0 ? (cmd = ["gh", "copilot", "explain"], this.withDanger && cmd.push("--allow-all-tools"), cmd.push(message)) : (cmd = ["copilot", "explain"], this.withDanger && cmd.push("--allow-all-tools"), cmd.push(message));
1429
+ if (this._testCopilotCmdOverride)
1430
+ cmd = [...this._testCopilotCmdOverride];
1431
+ else {
1432
+ const ghResult = spawnSync("gh", ["copilot", "--version"], {
1433
+ stdio: ["ignore", "pipe", "pipe"]
1434
+ });
1435
+ ghResult.error ? console.warn(`[Copilot] 'gh copilot --version' probe failed to spawn: ${getErrorMessage(ghResult.error)}`) : ghResult.status !== 0 && process.env.VERBOSE && console.log(`[Copilot] 'gh copilot' unavailable (exit ${ghResult.status}), falling back to standalone 'copilot'`), ghResult.status === 0 ? (cmd = ["gh", "copilot", "explain"], this.withDanger && cmd.push("--allow-all-tools"), cmd.push(message)) : (cmd = ["copilot", "explain"], this.withDanger && cmd.push("--allow-all-tools"), cmd.push(message));
1436
+ }
1431
1437
  const proc = spawn(cmd[0], cmd.slice(1), {
1432
1438
  cwd: this.model.rootPath,
1433
1439
  stdio: ["pipe", "pipe", "pipe"]
@@ -1497,7 +1503,20 @@ class VisualizationServer {
1497
1503
  }
1498
1504
  }
1499
1505
  })().catch((err) => {
1500
- console.error(`[Copilot] Stream error: ${getErrorMessage(err)}`);
1506
+ const errorMsg = getErrorMessage(err);
1507
+ console.error(`[Copilot] Stream error: ${errorMsg}`);
1508
+ try {
1509
+ ws.send(JSON.stringify({
1510
+ jsonrpc: "2.0",
1511
+ error: {
1512
+ code: JSONRPC_ERRORS.INTERNAL_ERROR,
1513
+ message: `Stream error: ${errorMsg}`
1514
+ },
1515
+ id: requestId
1516
+ }));
1517
+ } catch (sendError) {
1518
+ console.error(`[Copilot] Failed to send stream error notification: ${getErrorMessage(sendError)}`);
1519
+ }
1501
1520
  });
1502
1521
  } catch (error) {
1503
1522
  const errorMsg = getErrorMessage(error);