@kelceyp/caw-server 1.0.245 → 1.0.246

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
@@ -62,7 +62,7 @@ server/
62
62
  │ │ ├── DocumentRoutes.js
63
63
  │ │ ├── TemplateRoutes.js
64
64
  │ │ ├── FieldRoutes.js
65
- │ │ ├── ExportRoutes.js
65
+ │ │ ├── BundleRoutes.js
66
66
  │ │ └── EventRoutes.js
67
67
  │ ├── core/ # Business logic layer
68
68
  │ │ ├── Core.js # Facade - token resolution, service caching
package/dist/cli.js CHANGED
@@ -10142,14 +10142,17 @@ var create73 = ({ httpClient }) => {
10142
10142
  };
10143
10143
  var cancel_resume_default = Object.freeze({ create: create73 });
10144
10144
 
10145
- // src/commands/export/list.js
10145
+ // src/commands/bundle/list.js
10146
10146
  var create74 = ({ httpClient }) => {
10147
- return createCommand("list").summary("List available export files").param((p) => p.name("sid").type("string").flag("sid", "s").required()).run(async (ctx) => {
10148
- const { sid } = ctx.params;
10147
+ return createCommand("list").summary("List available bundles").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("store").type("string").flag("store")).run(async (ctx) => {
10148
+ const { sid, store } = ctx.params;
10149
+ const args = {};
10150
+ if (store !== undefined)
10151
+ args.store = store;
10149
10152
  const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
10150
10153
  cwd: process.cwd(),
10151
- tool: "list_exports",
10152
- args: {}
10154
+ tool: "list_bundles",
10155
+ args
10153
10156
  });
10154
10157
  ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
10155
10158
  `);
@@ -10157,16 +10160,35 @@ var create74 = ({ httpClient }) => {
10157
10160
  };
10158
10161
  var list_default5 = Object.freeze({ create: create74 });
10159
10162
 
10160
- // src/commands/export/preview.js
10163
+ // src/commands/bundle/preview.js
10164
+ var splitIds = (value) => value.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
10161
10165
  var create75 = ({ httpClient }) => {
10162
- return createCommand("preview").summary("Preview export").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("store").type("string").flag("store")).run(async (ctx) => {
10163
- const { sid, store } = ctx.params;
10164
- const args = {};
10166
+ return createCommand("preview").summary("Preview a bundle export (dependency walk)").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("store").type("string").flag("store")).param((p) => p.name("pickedDocIds").type("string").flag("pickedDocIds")).param((p) => p.name("pickedTemplateIds").type("string").flag("pickedTemplateIds")).param((p) => p.name("pickedTrackIds").type("string").flag("pickedTrackIds")).param((p) => p.name("pickedFolderIds").type("string").flag("pickedFolderIds")).param((p) => p.name("excludeIds").type("string").flag("excludeIds")).run(async (ctx) => {
10167
+ const {
10168
+ sid,
10169
+ store,
10170
+ pickedDocIds,
10171
+ pickedTemplateIds,
10172
+ pickedTrackIds,
10173
+ pickedFolderIds,
10174
+ excludeIds
10175
+ } = ctx.params;
10176
+ const args = { commit: false };
10177
+ if (pickedDocIds !== undefined)
10178
+ args.pickedDocIds = splitIds(pickedDocIds);
10179
+ if (pickedTemplateIds !== undefined)
10180
+ args.pickedTemplateIds = splitIds(pickedTemplateIds);
10181
+ if (pickedTrackIds !== undefined)
10182
+ args.pickedTrackIds = splitIds(pickedTrackIds);
10183
+ if (pickedFolderIds !== undefined)
10184
+ args.pickedFolderIds = splitIds(pickedFolderIds);
10185
+ if (excludeIds !== undefined)
10186
+ args.excludeIds = splitIds(excludeIds);
10165
10187
  if (store !== undefined)
10166
10188
  args.store = store;
10167
10189
  const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
10168
10190
  cwd: process.cwd(),
10169
- tool: "export_preview",
10191
+ tool: "export_bundle",
10170
10192
  args
10171
10193
  });
10172
10194
  ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
@@ -10175,18 +10197,36 @@ var create75 = ({ httpClient }) => {
10175
10197
  };
10176
10198
  var preview_default = Object.freeze({ create: create75 });
10177
10199
 
10178
- // src/commands/export/export.js
10200
+ // src/commands/bundle/export.js
10201
+ var splitIds2 = (value) => value.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
10179
10202
  var create76 = ({ httpClient }) => {
10180
- return createCommand("export").summary("Export documents and templates").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("confirm").type("boolean").flag("confirm")).param((p) => p.name("store").type("string").flag("store")).run(async (ctx) => {
10181
- const { sid, confirm, store } = ctx.params;
10182
- const args = {};
10183
- if (confirm !== undefined)
10184
- args.confirm = confirm;
10203
+ return createCommand("export").summary("Export a bundle (commit)").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("name").type("string").flag("name").required()).param((p) => p.name("store").type("string").flag("store")).param((p) => p.name("pickedDocIds").type("string").flag("pickedDocIds")).param((p) => p.name("pickedTemplateIds").type("string").flag("pickedTemplateIds")).param((p) => p.name("pickedTrackIds").type("string").flag("pickedTrackIds")).param((p) => p.name("pickedFolderIds").type("string").flag("pickedFolderIds")).param((p) => p.name("excludeIds").type("string").flag("excludeIds")).run(async (ctx) => {
10204
+ const {
10205
+ sid,
10206
+ name,
10207
+ store,
10208
+ pickedDocIds,
10209
+ pickedTemplateIds,
10210
+ pickedTrackIds,
10211
+ pickedFolderIds,
10212
+ excludeIds
10213
+ } = ctx.params;
10214
+ const args = { commit: true, name };
10215
+ if (pickedDocIds !== undefined)
10216
+ args.pickedDocIds = splitIds2(pickedDocIds);
10217
+ if (pickedTemplateIds !== undefined)
10218
+ args.pickedTemplateIds = splitIds2(pickedTemplateIds);
10219
+ if (pickedTrackIds !== undefined)
10220
+ args.pickedTrackIds = splitIds2(pickedTrackIds);
10221
+ if (pickedFolderIds !== undefined)
10222
+ args.pickedFolderIds = splitIds2(pickedFolderIds);
10223
+ if (excludeIds !== undefined)
10224
+ args.excludeIds = splitIds2(excludeIds);
10185
10225
  if (store !== undefined)
10186
10226
  args.store = store;
10187
10227
  const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
10188
10228
  cwd: process.cwd(),
10189
- tool: "export_documents",
10229
+ tool: "export_bundle",
10190
10230
  args
10191
10231
  });
10192
10232
  ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
@@ -10195,16 +10235,16 @@ var create76 = ({ httpClient }) => {
10195
10235
  };
10196
10236
  var export_default = Object.freeze({ create: create76 });
10197
10237
 
10198
- // src/commands/export/import.js
10238
+ // src/commands/bundle/import.js
10199
10239
  var create77 = ({ httpClient }) => {
10200
- return createCommand("import").summary("Import documents and templates").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("filename").type("string").flag("filename").required()).param((p) => p.name("store").type("string").flag("store")).run(async (ctx) => {
10240
+ return createCommand("import").summary("Import a bundle (non-destructive)").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("filename").type("string").flag("filename").required()).param((p) => p.name("store").type("string").flag("store")).run(async (ctx) => {
10201
10241
  const { sid, filename, store } = ctx.params;
10202
10242
  const args = { filename };
10203
10243
  if (store !== undefined)
10204
10244
  args.store = store;
10205
10245
  const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
10206
10246
  cwd: process.cwd(),
10207
- tool: "import_documents",
10247
+ tool: "import_bundle",
10208
10248
  args
10209
10249
  });
10210
10250
  ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
@@ -10213,8 +10253,26 @@ var create77 = ({ httpClient }) => {
10213
10253
  };
10214
10254
  var import_default = Object.freeze({ create: create77 });
10215
10255
 
10216
- // src/commands/asset/read.js
10256
+ // src/commands/bundle/delete.js
10217
10257
  var create78 = ({ httpClient }) => {
10258
+ return createCommand("delete").summary("Delete a bundle").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("filename").type("string").flag("filename").required()).param((p) => p.name("store").type("string").flag("store")).run(async (ctx) => {
10259
+ const { sid, filename, store } = ctx.params;
10260
+ const args = { filename };
10261
+ if (store !== undefined)
10262
+ args.store = store;
10263
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
10264
+ cwd: process.cwd(),
10265
+ tool: "delete_bundle",
10266
+ args
10267
+ });
10268
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
10269
+ `);
10270
+ }).onError({ exitCode: 1 }).build();
10271
+ };
10272
+ var delete_default6 = Object.freeze({ create: create78 });
10273
+
10274
+ // src/commands/asset/read.js
10275
+ var create79 = ({ httpClient }) => {
10218
10276
  return createCommand("read").summary("Read an asset").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("id").type("string").flag("id").required()).run(async (ctx) => {
10219
10277
  const { sid, id } = ctx.params;
10220
10278
  const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
@@ -10226,10 +10284,10 @@ var create78 = ({ httpClient }) => {
10226
10284
  `);
10227
10285
  }).onError({ exitCode: 1 }).build();
10228
10286
  };
10229
- var read_default2 = Object.freeze({ create: create78 });
10287
+ var read_default2 = Object.freeze({ create: create79 });
10230
10288
 
10231
10289
  // src/commands/backfill/content-refs.js
10232
- var create79 = ({ httpClient }) => {
10290
+ var create80 = ({ httpClient }) => {
10233
10291
  return createCommand("content-refs").summary("Backfill content reference fields on existing versions").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("store").type("string").flag("store")).param((p) => p.name("confirm").type("boolean").flag("confirm")).param((p) => p.name("skipPopulated").type("boolean").flag("skip-populated")).param((p) => p.name("batchSize").type("number").flag("batch-size")).run(async (ctx) => {
10234
10292
  const { sid, store, confirm, skipPopulated, batchSize } = ctx.params;
10235
10293
  const args = {};
@@ -10250,10 +10308,10 @@ var create79 = ({ httpClient }) => {
10250
10308
  `);
10251
10309
  }).onError({ exitCode: 1 }).build();
10252
10310
  };
10253
- var content_refs_default = Object.freeze({ create: create79 });
10311
+ var content_refs_default = Object.freeze({ create: create80 });
10254
10312
 
10255
10313
  // src/commands/embeddings/reindex.js
10256
- var create80 = ({ httpClient }) => {
10314
+ var create81 = ({ httpClient }) => {
10257
10315
  return createCommand("reindex").summary("Trigger a full embedding reindex").param((p) => p.name("sid").type("string").flag("sid", "s").required()).run(async (ctx) => {
10258
10316
  const { sid } = ctx.params;
10259
10317
  const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
@@ -10265,13 +10323,13 @@ var create80 = ({ httpClient }) => {
10265
10323
  `);
10266
10324
  }).onError({ exitCode: 1 }).build();
10267
10325
  };
10268
- var reindex_default = Object.freeze({ create: create80 });
10326
+ var reindex_default = Object.freeze({ create: create81 });
10269
10327
 
10270
10328
  // src/cli-main.js
10271
10329
  var CAW_URL = process.env.CAW_URL || "http://localhost:2229";
10272
10330
  try {
10273
10331
  const httpClient = http_client_default.create({ baseUrl: CAW_URL });
10274
- const app = create().name("caw").version("0.0.1").command(connect_default.create({ httpClient })).command(disconnect_default.create({ httpClient })).group(createCommandGroup("doc").summary("Document operations").command(read_default.create({ httpClient })).command(create_default.create({ httpClient })).command(save_default.create({ httpClient })).command(publish_default.create({ httpClient })).command(read_by_path_default.create({ httpClient })).command(update_path_default.create({ httpClient })).command(versions_default.create({ httpClient })).command(read_version_default.create({ httpClient })).command(discard_default.create({ httpClient })).command(delete_default.create({ httpClient })).command(read_lines_default.create({ httpClient })).command(read_head_default.create({ httpClient })).command(read_tail_default.create({ httpClient })).command(read_from_line_default.create({ httpClient })).command(read_to_line_default.create({ httpClient })).command(read_between_markers_default.create({ httpClient })).command(read_section_default.create({ httpClient })).command(headings_default.create({ httpClient })).command(checklist_default.create({ httpClient })).command(stats_default.create({ httpClient })).command(frontmatter_default.create({ httpClient })).command(edit_default.create({ httpClient })).command(batch_edit_default.create({ httpClient })).command(check_item_default.create({ httpClient })).command(toggle_item_default.create({ httpClient })).command(batch_check_items_default.create({ httpClient })).command(set_edit_state_default.create({ httpClient })).command(clear_edit_state_default.create({ httpClient })).command(get_edit_state_default.create({ httpClient })).command(check_includes_default.create({ httpClient })).command(update_includes_default.create({ httpClient })).build()).group(createCommandGroup("folder").summary("Folder operations").command(list_default.create({ httpClient })).command(create_default2.create({ httpClient })).command(get_default.create({ httpClient })).command(get_by_path_default.create({ httpClient })).command(rename_default.create({ httpClient })).command(move_default.create({ httpClient })).command(delete_default2.create({ httpClient })).build()).group(createCommandGroup("field").summary("Field operations").command(get_default2.create({ httpClient })).command(get_field_default.create({ httpClient })).command(set_default.create({ httpClient })).command(delete_default3.create({ httpClient })).command(create_def_default.create({ httpClient })).command(list_defs_default.create({ httpClient })).command(get_type_fields_default.create({ httpClient })).command(delete_def_default.create({ httpClient })).build()).group(createCommandGroup("story").summary("Story operations").command(create_default3.create({ httpClient })).command(list_default2.create({ httpClient })).command(get_default3.create({ httpClient })).command(update_state_default.create({ httpClient })).command(change_track_default.create({ httpClient })).command(delete_default4.create({ httpClient })).command(inc_jobs_default.create({ httpClient })).command(dec_jobs_default.create({ httpClient })).build()).group(createCommandGroup("track").summary("Track operations").command(list_default3.create({ httpClient })).command(create_default4.create({ httpClient })).command(update_default.create({ httpClient })).command(delete_default5.create({ httpClient })).build()).group(createCommandGroup("template").summary("Template operations").command(create_default5.create({ httpClient })).command(render_default.create({ httpClient })).command(params_default.create({ httpClient })).command(list_by_type_default.create({ httpClient })).build()).group(createCommandGroup("job").summary("Job operations").command(list_default4.create({ httpClient })).command(get_default4.create({ httpClient })).command(create_default6.create({ httpClient })).command(continue_default.create({ httpClient })).command(output_default.create({ httpClient })).command(prompt_default.create({ httpClient })).command(cancel_resume_default.create({ httpClient })).build()).group(createCommandGroup("export").summary("Export operations").command(list_default5.create({ httpClient })).command(preview_default.create({ httpClient })).command(export_default.create({ httpClient })).command(import_default.create({ httpClient })).build()).group(createCommandGroup("asset").summary("Asset operations").command(read_default2.create({ httpClient })).build()).group(createCommandGroup("backfill").summary("Backfill operations").command(content_refs_default.create({ httpClient })).build()).group(createCommandGroup("embeddings").summary("Embedding operations").command(reindex_default.create({ httpClient })).build());
10332
+ const app = create().name("caw").version("0.0.1").command(connect_default.create({ httpClient })).command(disconnect_default.create({ httpClient })).group(createCommandGroup("doc").summary("Document operations").command(read_default.create({ httpClient })).command(create_default.create({ httpClient })).command(save_default.create({ httpClient })).command(publish_default.create({ httpClient })).command(read_by_path_default.create({ httpClient })).command(update_path_default.create({ httpClient })).command(versions_default.create({ httpClient })).command(read_version_default.create({ httpClient })).command(discard_default.create({ httpClient })).command(delete_default.create({ httpClient })).command(read_lines_default.create({ httpClient })).command(read_head_default.create({ httpClient })).command(read_tail_default.create({ httpClient })).command(read_from_line_default.create({ httpClient })).command(read_to_line_default.create({ httpClient })).command(read_between_markers_default.create({ httpClient })).command(read_section_default.create({ httpClient })).command(headings_default.create({ httpClient })).command(checklist_default.create({ httpClient })).command(stats_default.create({ httpClient })).command(frontmatter_default.create({ httpClient })).command(edit_default.create({ httpClient })).command(batch_edit_default.create({ httpClient })).command(check_item_default.create({ httpClient })).command(toggle_item_default.create({ httpClient })).command(batch_check_items_default.create({ httpClient })).command(set_edit_state_default.create({ httpClient })).command(clear_edit_state_default.create({ httpClient })).command(get_edit_state_default.create({ httpClient })).command(check_includes_default.create({ httpClient })).command(update_includes_default.create({ httpClient })).build()).group(createCommandGroup("folder").summary("Folder operations").command(list_default.create({ httpClient })).command(create_default2.create({ httpClient })).command(get_default.create({ httpClient })).command(get_by_path_default.create({ httpClient })).command(rename_default.create({ httpClient })).command(move_default.create({ httpClient })).command(delete_default2.create({ httpClient })).build()).group(createCommandGroup("field").summary("Field operations").command(get_default2.create({ httpClient })).command(get_field_default.create({ httpClient })).command(set_default.create({ httpClient })).command(delete_default3.create({ httpClient })).command(create_def_default.create({ httpClient })).command(list_defs_default.create({ httpClient })).command(get_type_fields_default.create({ httpClient })).command(delete_def_default.create({ httpClient })).build()).group(createCommandGroup("story").summary("Story operations").command(create_default3.create({ httpClient })).command(list_default2.create({ httpClient })).command(get_default3.create({ httpClient })).command(update_state_default.create({ httpClient })).command(change_track_default.create({ httpClient })).command(delete_default4.create({ httpClient })).command(inc_jobs_default.create({ httpClient })).command(dec_jobs_default.create({ httpClient })).build()).group(createCommandGroup("track").summary("Track operations").command(list_default3.create({ httpClient })).command(create_default4.create({ httpClient })).command(update_default.create({ httpClient })).command(delete_default5.create({ httpClient })).build()).group(createCommandGroup("template").summary("Template operations").command(create_default5.create({ httpClient })).command(render_default.create({ httpClient })).command(params_default.create({ httpClient })).command(list_by_type_default.create({ httpClient })).build()).group(createCommandGroup("job").summary("Job operations").command(list_default4.create({ httpClient })).command(get_default4.create({ httpClient })).command(create_default6.create({ httpClient })).command(continue_default.create({ httpClient })).command(output_default.create({ httpClient })).command(prompt_default.create({ httpClient })).command(cancel_resume_default.create({ httpClient })).build()).group(createCommandGroup("bundle").summary("Bundle operations").command(list_default5.create({ httpClient })).command(preview_default.create({ httpClient })).command(export_default.create({ httpClient })).command(import_default.create({ httpClient })).command(delete_default6.create({ httpClient })).build()).group(createCommandGroup("asset").summary("Asset operations").command(read_default2.create({ httpClient })).build()).group(createCommandGroup("backfill").summary("Backfill operations").command(content_refs_default.create({ httpClient })).build()).group(createCommandGroup("embeddings").summary("Embedding operations").command(reindex_default.create({ httpClient })).build());
10275
10333
  await app.run(process.argv.slice(2));
10276
10334
  } catch (error) {
10277
10335
  console.error(`Error: ${error.message}`);