@kelceyp/caw-server 0.0.46 → 0.0.48
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 +59 -10
- package/dist/main.js +181 -181
- package/package.json +1 -1
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(
|
|
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(
|
|
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
|
|
8722
|
+
args
|
|
8720
8723
|
});
|
|
8721
8724
|
ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
|
|
8722
8725
|
`);
|
|
@@ -8726,7 +8729,12 @@ var read_default = Object.freeze({ create: create5 });
|
|
|
8726
8729
|
|
|
8727
8730
|
// src/commands/doc/create.js
|
|
8728
8731
|
var create6 = ({ httpClient }) => {
|
|
8729
|
-
return createCommand("create").summary("Create a document").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")).
|
|
8732
|
+
return createCommand("create").summary("Create a document").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) => {
|
|
8733
|
+
if (ctx.stdin.available && ctx.argv.flags.content) {
|
|
8734
|
+
return "Cannot use --content when piping stdin";
|
|
8735
|
+
}
|
|
8736
|
+
return true;
|
|
8737
|
+
}).run(async (ctx) => {
|
|
8730
8738
|
const { sid, path, store, root, parent, name, content } = ctx.params;
|
|
8731
8739
|
const args = {};
|
|
8732
8740
|
if (path !== undefined)
|
|
@@ -8754,7 +8762,15 @@ var create_default = Object.freeze({ create: create6 });
|
|
|
8754
8762
|
|
|
8755
8763
|
// src/commands/doc/save.js
|
|
8756
8764
|
var create7 = ({ httpClient }) => {
|
|
8757
|
-
return createCommand("save").summary("Save document draft").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("content").type("string").flag("content").
|
|
8765
|
+
return createCommand("save").summary("Save document draft").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("content").type("string").flag("content").stdin()).preValidate((ctx) => {
|
|
8766
|
+
if (ctx.stdin.available && ctx.argv.flags.content) {
|
|
8767
|
+
return "Cannot use --content when piping stdin";
|
|
8768
|
+
}
|
|
8769
|
+
if (!ctx.stdin.available && !ctx.argv.flags.content) {
|
|
8770
|
+
return "Content required via --content or stdin";
|
|
8771
|
+
}
|
|
8772
|
+
return true;
|
|
8773
|
+
}).run(async (ctx) => {
|
|
8758
8774
|
const { sid, id, content } = ctx.params;
|
|
8759
8775
|
const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
|
|
8760
8776
|
cwd: process.cwd(),
|
|
@@ -9155,8 +9171,41 @@ var create29 = ({ httpClient }) => {
|
|
|
9155
9171
|
};
|
|
9156
9172
|
var delete_default4 = Object.freeze({ create: create29 });
|
|
9157
9173
|
|
|
9158
|
-
// src/commands/template/
|
|
9174
|
+
// src/commands/template/create.js
|
|
9159
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 }) => {
|
|
9160
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) => {
|
|
9161
9210
|
const { sid, id, params, target, path, publish } = ctx.params;
|
|
9162
9211
|
const args = { id };
|
|
@@ -9185,13 +9234,13 @@ var create30 = ({ httpClient }) => {
|
|
|
9185
9234
|
`);
|
|
9186
9235
|
}).onError({ exitCode: 1 }).build();
|
|
9187
9236
|
};
|
|
9188
|
-
var render_default = Object.freeze({ create:
|
|
9237
|
+
var render_default = Object.freeze({ create: create31 });
|
|
9189
9238
|
|
|
9190
9239
|
// src/cli-main.js
|
|
9191
9240
|
var CAW_URL = process.env.CAW_URL || "https://caw.localhost";
|
|
9192
9241
|
try {
|
|
9193
9242
|
const httpClient = http_client_default.create({ baseUrl: CAW_URL });
|
|
9194
|
-
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());
|
|
9195
9244
|
await app.run(process.argv.slice(2));
|
|
9196
9245
|
} catch (error) {
|
|
9197
9246
|
console.error(`Error: ${error.message}`);
|