@kelceyp/caw-server 0.0.47 → 0.0.49

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/cli.js CHANGED
@@ -8692,7 +8692,7 @@ var create3 = ({ httpClient }) => {
8692
8692
  projectName,
8693
8693
  cwd: process.cwd()
8694
8694
  });
8695
- ctx.stdio.stdout.write(`${result.alias}
8695
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
8696
8696
  `);
8697
8697
  }).onError({ exitCode: 1 }).build();
8698
8698
  };
@@ -8703,7 +8703,7 @@ var create4 = ({ httpClient }) => {
8703
8703
  return createCommand("disconnect").summary("Disconnect from a CAW session").param((p) => p.name("sid").type("string").flag("sid", "s").required()).run(async (ctx) => {
8704
8704
  const { sid } = ctx.params;
8705
8705
  await httpClient.delete(`/cli/mcp-client/${sid}`);
8706
- ctx.stdio.stdout.write(`Disconnected session: ${sid}
8706
+ ctx.stdio.stdout.write(JSON.stringify({ success: true, alias: sid }, null, 2) + `
8707
8707
  `);
8708
8708
  }).onError({ exitCode: 1 }).build();
8709
8709
  };
@@ -8711,12 +8711,15 @@ var disconnect_default = Object.freeze({ create: create4 });
8711
8711
 
8712
8712
  // src/commands/doc/read.js
8713
8713
  var create5 = ({ httpClient }) => {
8714
- return createCommand("read").summary("Read a document").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("id").type("string").flag("id").required()).run(async (ctx) => {
8715
- const { sid, id } = ctx.params;
8714
+ return createCommand("read").summary("Read a document").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("id").type("string").flag("id").required()).param((p) => p.name("draft").type("boolean").flag("draft")).run(async (ctx) => {
8715
+ const { sid, id, draft } = ctx.params;
8716
+ const args = { id };
8717
+ if (draft)
8718
+ args.include_draft = true;
8716
8719
  const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
8717
8720
  cwd: process.cwd(),
8718
8721
  tool: "read_document",
8719
- args: { id }
8722
+ args
8720
8723
  });
8721
8724
  ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
8722
8725
  `);
@@ -9168,8 +9171,41 @@ var create29 = ({ httpClient }) => {
9168
9171
  };
9169
9172
  var delete_default4 = Object.freeze({ create: create29 });
9170
9173
 
9171
- // src/commands/template/render.js
9174
+ // src/commands/template/create.js
9172
9175
  var create30 = ({ httpClient }) => {
9176
+ return createCommand("create").summary("Create a template").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("path").type("string").flag("path")).param((p) => p.name("store").type("string").flag("store")).param((p) => p.name("root").type("string").flag("root")).param((p) => p.name("parent").type("string").flag("parent")).param((p) => p.name("name").type("string").flag("name")).param((p) => p.name("content").type("string").flag("content").stdin()).preValidate((ctx) => {
9177
+ if (ctx.stdin.available && ctx.argv.flags.content) {
9178
+ return "Cannot use --content when piping stdin";
9179
+ }
9180
+ return true;
9181
+ }).run(async (ctx) => {
9182
+ const { sid, path, store, root, parent, name, content } = ctx.params;
9183
+ const args = {};
9184
+ if (path !== undefined)
9185
+ args.path = path;
9186
+ if (store !== undefined)
9187
+ args.store = store;
9188
+ if (root !== undefined)
9189
+ args.root = root;
9190
+ if (parent !== undefined)
9191
+ args.parentId = parent;
9192
+ if (name !== undefined)
9193
+ args.name = name;
9194
+ if (content !== undefined)
9195
+ args.content = content;
9196
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9197
+ cwd: process.cwd(),
9198
+ tool: "create_template",
9199
+ args
9200
+ });
9201
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9202
+ `);
9203
+ }).onError({ exitCode: 1 }).build();
9204
+ };
9205
+ var create_default4 = Object.freeze({ create: create30 });
9206
+
9207
+ // src/commands/template/render.js
9208
+ var create31 = ({ httpClient }) => {
9173
9209
  return createCommand("render").summary("Render a template").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("id").type("string").flag("id").required()).param((p) => p.name("params").type("string").flag("params")).param((p) => p.name("target").type("string").flag("target")).param((p) => p.name("path").type("string").flag("path")).param((p) => p.name("publish").type("boolean").flag("publish")).run(async (ctx) => {
9174
9210
  const { sid, id, params, target, path, publish } = ctx.params;
9175
9211
  const args = { id };
@@ -9198,13 +9234,13 @@ var create30 = ({ httpClient }) => {
9198
9234
  `);
9199
9235
  }).onError({ exitCode: 1 }).build();
9200
9236
  };
9201
- var render_default = Object.freeze({ create: create30 });
9237
+ var render_default = Object.freeze({ create: create31 });
9202
9238
 
9203
9239
  // src/cli-main.js
9204
9240
  var CAW_URL = process.env.CAW_URL || "https://caw.localhost";
9205
9241
  try {
9206
9242
  const httpClient = http_client_default.create({ baseUrl: CAW_URL });
9207
- 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 })).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(set_default.create({ httpClient })).command(delete_default3.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(delete_default4.create({ httpClient })).build()).group(createCommandGroup("template").summary("Template operations").command(render_default.create({ httpClient })).build());
9243
+ 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 })).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(set_default.create({ httpClient })).command(delete_default3.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(delete_default4.create({ httpClient })).build()).group(createCommandGroup("template").summary("Template operations").command(create_default4.create({ httpClient })).command(render_default.create({ httpClient })).build());
9208
9244
  await app.run(process.argv.slice(2));
9209
9245
  } catch (error) {
9210
9246
  console.error(`Error: ${error.message}`);