@dashclaw/cli 0.6.2 → 0.7.0

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
@@ -66,6 +66,15 @@ Stop the local server (and the Docker DB if `up` started it).
66
66
  npx dashclaw down
67
67
  ```
68
68
 
69
+ ### `dashclaw import <bundle.json>`
70
+
71
+ Load a workspace carry-out bundle — the file **Export workspace** downloads on a trial's `/connect` card (or `GET /api/workspace/export` on any instance) — into the configured instance. Policies, guard decisions, action records, open loops, assumptions, and agent identities carry over; API keys, OAuth tokens, and secret values never ride a bundle. Idempotent: re-running skips rows that already exist.
72
+
73
+ ```bash
74
+ DASHCLAW_BASE_URL=http://localhost:3000 DASHCLAW_API_KEY=oc_live_... \
75
+ dashclaw import dashclaw-workspace-*.json
76
+ ```
77
+
69
78
  ### `dashclaw approvals`
70
79
 
71
80
  Interactive inbox for all pending approval requests. Use arrow keys to navigate, `A` to approve, `D` to deny, `O` to open the replay link, `Q` to quit.
package/bin/dashclaw.js CHANGED
@@ -86,6 +86,8 @@ ${bold('Usage:')}
86
86
  --port <n> Server port (default: 3000)
87
87
  --no-browser Do not open the browser when ready
88
88
  dashclaw down Stop the local DashClaw server (and Docker DB if we started it)
89
+ dashclaw import <bundle.json> Import a workspace carry-out bundle (from /api/workspace/export)
90
+ into this instance — idempotent; keys/secrets never ride a bundle
89
91
  dashclaw approvals Interactive approval inbox
90
92
  dashclaw approve <actionId> [--reason] Approve an action
91
93
  dashclaw deny <actionId> [--reason] Deny an action
@@ -565,6 +567,38 @@ async function cmdInstall() {
565
567
  }
566
568
  }
567
569
 
570
+ // -- import (v7.2 graduation path) --------------------------------------------
571
+
572
+ /*
573
+ * Ingest a workspace carry-out bundle (the file /api/workspace/export
574
+ * downloads) into the configured instance. HTTP like every other post-up
575
+ * command; the route is idempotent so re-running is safe.
576
+ */
577
+ async function cmdImport() {
578
+ const file = args[1];
579
+ if (!file || file.startsWith('--')) {
580
+ console.error('Usage: dashclaw import <bundle.json> (the file downloaded from your trial\'s "Export workspace")');
581
+ process.exitCode = 1;
582
+ return;
583
+ }
584
+ try {
585
+ let bundle;
586
+ try {
587
+ bundle = JSON.parse(readFileSync(file, 'utf8'));
588
+ } catch (err) {
589
+ throw new Error(err.code === 'ENOENT' ? `File not found: ${file}` : `${file} is not valid JSON`);
590
+ }
591
+ const data = await apiRequest({ baseUrl, apiKey }, 'POST', '/api/workspace/import', { body: bundle });
592
+ console.log(green(`Imported ${data.imported} rows (${data.skipped} skipped — already present or missing their id).`));
593
+ for (const [table, c] of Object.entries(data.counts || {})) {
594
+ console.log(` ${table}: +${c.imported}${c.skipped ? ` (${c.skipped} skipped)` : ''}`);
595
+ }
596
+ } catch (err) {
597
+ console.error(red(`Error: ${err.message}`));
598
+ process.exitCode = 1;
599
+ }
600
+ }
601
+
568
602
  // -- up / down (one-command local install) -----------------------------------
569
603
 
570
604
  async function cmdUp() {
@@ -1298,7 +1332,7 @@ async function cmdEnv() {
1298
1332
 
1299
1333
  // -- Router -------------------------------------------------------------------
1300
1334
 
1301
- const COMMANDS_NEEDING_CONFIG = new Set(['approvals', 'approve', 'deny', 'doctor', 'code', 'prompts', 'inbox', 'behavior', 'posture', 'next', 'env', 'halt']);
1335
+ const COMMANDS_NEEDING_CONFIG = new Set(['approvals', 'approve', 'deny', 'doctor', 'code', 'prompts', 'inbox', 'behavior', 'posture', 'next', 'env', 'halt', 'import']);
1302
1336
  // `install` deliberately omitted: provisioning hooks and AGENTS.md shouldn't
1303
1337
  // require the user to have already configured API keys. If config happens to
1304
1338
  // be present, install will pick up baseUrl for the AGENTS.md instance link.
@@ -1344,6 +1378,7 @@ const COMMAND_HANDLERS = {
1344
1378
  code: cmdCode,
1345
1379
  up: cmdUp,
1346
1380
  down: cmdDown,
1381
+ import: cmdImport,
1347
1382
  install: cmdInstall,
1348
1383
  codex: cmdCodex,
1349
1384
  prompts: cmdPrompts,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashclaw/cli",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "description": "DashClaw terminal client — approve agent actions and diagnose your instance",
5
5
  "type": "module",
6
6
  "keywords": [