@kelceyp/caw-server 1.0.8 → 1.0.10

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
@@ -8711,11 +8711,13 @@ 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()).param((p) => p.name("draft").type("boolean").flag("draft")).run(async (ctx) => {
8715
- const { sid, id, draft } = 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")).param((p) => p.name("resolveIncludes").type("boolean").flag("resolve-includes").default(true)).run(async (ctx) => {
8715
+ const { sid, id, draft, resolveIncludes } = ctx.params;
8716
8716
  const args = { id };
8717
8717
  if (draft)
8718
8718
  args.include_draft = true;
8719
+ if (resolveIncludes === false)
8720
+ args.resolve_includes = false;
8719
8721
  const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
8720
8722
  cwd: process.cwd(),
8721
8723
  tool: "read_document",
@@ -8845,13 +8847,15 @@ var publish_default = Object.freeze({ create: create8 });
8845
8847
 
8846
8848
  // src/commands/doc/read-by-path.js
8847
8849
  var create9 = ({ httpClient }) => {
8848
- return createCommand("read-by-path").summary("Read a document by path").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("path").type("string").flag("path").required()).param((p) => p.name("type").type("string").flag("type").required()).param((p) => p.name("store").type("string").flag("store")).param((p) => p.name("draft").type("boolean").flag("draft")).run(async (ctx) => {
8849
- const { sid, path, type, store, draft } = ctx.params;
8850
+ return createCommand("read-by-path").summary("Read a document by path").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("path").type("string").flag("path").required()).param((p) => p.name("type").type("string").flag("type").required()).param((p) => p.name("store").type("string").flag("store")).param((p) => p.name("draft").type("boolean").flag("draft")).param((p) => p.name("resolveIncludes").type("boolean").flag("resolve-includes").default(true)).run(async (ctx) => {
8851
+ const { sid, path, type, store, draft, resolveIncludes } = ctx.params;
8850
8852
  const args = { path, type };
8851
8853
  if (store !== undefined)
8852
8854
  args.store = store;
8853
8855
  if (draft !== undefined)
8854
8856
  args.include_draft = draft;
8857
+ if (resolveIncludes === false)
8858
+ args.resolve_includes = false;
8855
8859
  const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
8856
8860
  cwd: process.cwd(),
8857
8861
  tool: "read_document_by_path",
@@ -8945,8 +8949,429 @@ var create14 = ({ httpClient }) => {
8945
8949
  };
8946
8950
  var delete_default = Object.freeze({ create: create14 });
8947
8951
 
8948
- // src/commands/folder/list.js
8952
+ // src/commands/doc/read-lines.js
8949
8953
  var create15 = ({ httpClient }) => {
8954
+ return createCommand("read-lines").summary("Read specific lines from 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("start").type("number").flag("start").required()).param((p) => p.name("end").type("number").flag("end").required()).param((p) => p.name("draft").type("boolean").flag("draft")).run(async (ctx) => {
8955
+ const { sid, id, start, end, draft } = ctx.params;
8956
+ const args = { id, start_line: start, end_line: end };
8957
+ if (draft)
8958
+ args.include_draft = true;
8959
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
8960
+ cwd: process.cwd(),
8961
+ tool: "read_lines",
8962
+ args
8963
+ });
8964
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
8965
+ `);
8966
+ }).onError({ exitCode: 1 }).build();
8967
+ };
8968
+ var read_lines_default = Object.freeze({ create: create15 });
8969
+
8970
+ // src/commands/doc/read-head.js
8971
+ var create16 = ({ httpClient }) => {
8972
+ return createCommand("read-head").summary("Read the first N lines from 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("lines").type("number").flag("lines").required()).param((p) => p.name("draft").type("boolean").flag("draft")).run(async (ctx) => {
8973
+ const { sid, id, lines, draft } = ctx.params;
8974
+ const args = { id, lines };
8975
+ if (draft)
8976
+ args.include_draft = true;
8977
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
8978
+ cwd: process.cwd(),
8979
+ tool: "read_head",
8980
+ args
8981
+ });
8982
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
8983
+ `);
8984
+ }).onError({ exitCode: 1 }).build();
8985
+ };
8986
+ var read_head_default = Object.freeze({ create: create16 });
8987
+
8988
+ // src/commands/doc/read-tail.js
8989
+ var create17 = ({ httpClient }) => {
8990
+ return createCommand("read-tail").summary("Read the last N lines from 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("lines").type("number").flag("lines").required()).param((p) => p.name("draft").type("boolean").flag("draft")).run(async (ctx) => {
8991
+ const { sid, id, lines, draft } = ctx.params;
8992
+ const args = { id, lines };
8993
+ if (draft)
8994
+ args.include_draft = true;
8995
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
8996
+ cwd: process.cwd(),
8997
+ tool: "read_tail",
8998
+ args
8999
+ });
9000
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9001
+ `);
9002
+ }).onError({ exitCode: 1 }).build();
9003
+ };
9004
+ var read_tail_default = Object.freeze({ create: create17 });
9005
+
9006
+ // src/commands/doc/read-from-line.js
9007
+ var create18 = ({ httpClient }) => {
9008
+ return createCommand("read-from-line").summary("Read from a starting line to the end of 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("start").type("number").flag("start").required()).param((p) => p.name("draft").type("boolean").flag("draft")).run(async (ctx) => {
9009
+ const { sid, id, start, draft } = ctx.params;
9010
+ const args = { id, start_line: start };
9011
+ if (draft)
9012
+ args.include_draft = true;
9013
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9014
+ cwd: process.cwd(),
9015
+ tool: "read_from_line",
9016
+ args
9017
+ });
9018
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9019
+ `);
9020
+ }).onError({ exitCode: 1 }).build();
9021
+ };
9022
+ var read_from_line_default = Object.freeze({ create: create18 });
9023
+
9024
+ // src/commands/doc/read-to-line.js
9025
+ var create19 = ({ httpClient }) => {
9026
+ return createCommand("read-to-line").summary("Read from the beginning to an ending line in 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("end").type("number").flag("end").required()).param((p) => p.name("draft").type("boolean").flag("draft")).run(async (ctx) => {
9027
+ const { sid, id, end, draft } = ctx.params;
9028
+ const args = { id, end_line: end };
9029
+ if (draft)
9030
+ args.include_draft = true;
9031
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9032
+ cwd: process.cwd(),
9033
+ tool: "read_to_line",
9034
+ args
9035
+ });
9036
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9037
+ `);
9038
+ }).onError({ exitCode: 1 }).build();
9039
+ };
9040
+ var read_to_line_default = Object.freeze({ create: create19 });
9041
+
9042
+ // src/commands/doc/read-between-markers.js
9043
+ var create20 = ({ httpClient }) => {
9044
+ return createCommand("read-between-markers").summary("Read content between markers from 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("startMarker").type("string").flag("start-marker").required()).param((p) => p.name("endMarker").type("string").flag("end-marker").required()).param((p) => p.name("inclusive").type("boolean").flag("inclusive")).param((p) => p.name("draft").type("boolean").flag("draft")).run(async (ctx) => {
9045
+ const { sid, id, startMarker, endMarker, inclusive, draft } = ctx.params;
9046
+ const args = { id, start_marker: startMarker, end_marker: endMarker };
9047
+ if (inclusive !== undefined)
9048
+ args.inclusive = inclusive;
9049
+ if (draft)
9050
+ args.include_draft = true;
9051
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9052
+ cwd: process.cwd(),
9053
+ tool: "read_between_markers",
9054
+ args
9055
+ });
9056
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9057
+ `);
9058
+ }).onError({ exitCode: 1 }).build();
9059
+ };
9060
+ var read_between_markers_default = Object.freeze({ create: create20 });
9061
+
9062
+ // src/commands/doc/read-section.js
9063
+ var create21 = ({ httpClient }) => {
9064
+ return createCommand("read-section").summary("Read a section from 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("heading").type("string").flag("heading").required()).param((p) => p.name("includeHeading").type("boolean").flag("include-heading").default(true)).param((p) => p.name("draft").type("boolean").flag("draft")).run(async (ctx) => {
9065
+ const { sid, id, heading, includeHeading, draft } = ctx.params;
9066
+ const parsedHeading = /^\d+$/.test(heading) ? parseInt(heading, 10) : heading;
9067
+ const args = { id, heading: parsedHeading };
9068
+ if (includeHeading === false)
9069
+ args.include_heading = false;
9070
+ if (draft)
9071
+ args.include_draft = true;
9072
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9073
+ cwd: process.cwd(),
9074
+ tool: "read_section",
9075
+ args
9076
+ });
9077
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9078
+ `);
9079
+ }).onError({ exitCode: 1 }).build();
9080
+ };
9081
+ var read_section_default = Object.freeze({ create: create21 });
9082
+
9083
+ // src/commands/doc/headings.js
9084
+ var create22 = ({ httpClient }) => {
9085
+ return createCommand("headings").summary("Extract heading structure from 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("maxDepth").type("number").flag("max-depth")).param((p) => p.name("draft").type("boolean").flag("draft")).run(async (ctx) => {
9086
+ const { sid, id, maxDepth, draft } = ctx.params;
9087
+ const args = { id };
9088
+ if (maxDepth !== undefined)
9089
+ args.max_depth = maxDepth;
9090
+ if (draft)
9091
+ args.include_draft = true;
9092
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9093
+ cwd: process.cwd(),
9094
+ tool: "read_headings",
9095
+ args
9096
+ });
9097
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9098
+ `);
9099
+ }).onError({ exitCode: 1 }).build();
9100
+ };
9101
+ var headings_default = Object.freeze({ create: create22 });
9102
+
9103
+ // src/commands/doc/checklist.js
9104
+ var create23 = ({ httpClient }) => {
9105
+ return createCommand("checklist").summary("Extract checklist items from 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("section").type("string").flag("section")).param((p) => p.name("draft").type("boolean").flag("draft")).run(async (ctx) => {
9106
+ const { sid, id, section, draft } = ctx.params;
9107
+ const args = { id };
9108
+ if (section !== undefined)
9109
+ args.section = section;
9110
+ if (draft)
9111
+ args.include_draft = true;
9112
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9113
+ cwd: process.cwd(),
9114
+ tool: "read_checklist",
9115
+ args
9116
+ });
9117
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9118
+ `);
9119
+ }).onError({ exitCode: 1 }).build();
9120
+ };
9121
+ var checklist_default = Object.freeze({ create: create23 });
9122
+
9123
+ // src/commands/doc/stats.js
9124
+ var create24 = ({ httpClient }) => {
9125
+ return createCommand("stats").summary("Get document statistics").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) => {
9126
+ const { sid, id, draft } = ctx.params;
9127
+ const args = { id };
9128
+ if (draft)
9129
+ args.include_draft = true;
9130
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9131
+ cwd: process.cwd(),
9132
+ tool: "get_document_stats",
9133
+ args
9134
+ });
9135
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9136
+ `);
9137
+ }).onError({ exitCode: 1 }).build();
9138
+ };
9139
+ var stats_default = Object.freeze({ create: create24 });
9140
+
9141
+ // src/commands/doc/frontmatter.js
9142
+ var create25 = ({ httpClient }) => {
9143
+ return createCommand("frontmatter").summary("Extract YAML frontmatter from 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) => {
9144
+ const { sid, id, draft } = ctx.params;
9145
+ const args = { id };
9146
+ if (draft)
9147
+ args.include_draft = true;
9148
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9149
+ cwd: process.cwd(),
9150
+ tool: "read_frontmatter",
9151
+ args
9152
+ });
9153
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9154
+ `);
9155
+ }).onError({ exitCode: 1 }).build();
9156
+ };
9157
+ var frontmatter_default = Object.freeze({ create: create25 });
9158
+
9159
+ // src/commands/doc/edit.js
9160
+ var create26 = ({ httpClient }) => {
9161
+ return createCommand("edit").summary("Edit a document with a single operation").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("operation").type("string").flag("operation").stdin()).param((p) => p.name("preview").type("boolean").flag("preview")).param((p) => p.name("ignoreContent").type("boolean").flag("ignore-content")).preValidate((ctx) => {
9162
+ if (ctx.stdin.available && ctx.argv.flags.operation) {
9163
+ return "Cannot use --operation when piping stdin";
9164
+ }
9165
+ if (!ctx.stdin.available && !ctx.argv.flags.operation) {
9166
+ return "Operation required via --operation or stdin";
9167
+ }
9168
+ return true;
9169
+ }).run(async (ctx) => {
9170
+ const { sid, id, operation, preview, ignoreContent } = ctx.params;
9171
+ const args = { id };
9172
+ try {
9173
+ args.operation = JSON.parse(operation);
9174
+ } catch {
9175
+ throw new Error("Invalid JSON for operation");
9176
+ }
9177
+ if (preview !== undefined)
9178
+ args.preview = preview;
9179
+ if (ignoreContent !== undefined)
9180
+ args.ignoreContent = ignoreContent;
9181
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9182
+ cwd: process.cwd(),
9183
+ tool: "edit_document",
9184
+ args
9185
+ });
9186
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9187
+ `);
9188
+ }).onError({ exitCode: 1 }).build();
9189
+ };
9190
+ var edit_default = Object.freeze({ create: create26 });
9191
+
9192
+ // src/commands/doc/batch-edit.js
9193
+ var create27 = ({ httpClient }) => {
9194
+ return createCommand("batch-edit").summary("Edit a document with multiple operations").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("operations").type("string").flag("operations").stdin()).param((p) => p.name("preview").type("boolean").flag("preview")).param((p) => p.name("ignoreContent").type("boolean").flag("ignore-content")).preValidate((ctx) => {
9195
+ if (ctx.stdin.available && ctx.argv.flags.operations) {
9196
+ return "Cannot use --operations when piping stdin";
9197
+ }
9198
+ if (!ctx.stdin.available && !ctx.argv.flags.operations) {
9199
+ return "Operations required via --operations or stdin";
9200
+ }
9201
+ return true;
9202
+ }).run(async (ctx) => {
9203
+ const { sid, id, operations, preview, ignoreContent } = ctx.params;
9204
+ const args = { id };
9205
+ try {
9206
+ args.operations = JSON.parse(operations);
9207
+ } catch {
9208
+ throw new Error("Invalid JSON for operations");
9209
+ }
9210
+ if (preview !== undefined)
9211
+ args.preview = preview;
9212
+ if (ignoreContent !== undefined)
9213
+ args.ignoreContent = ignoreContent;
9214
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9215
+ cwd: process.cwd(),
9216
+ tool: "batch_edit_document",
9217
+ args
9218
+ });
9219
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9220
+ `);
9221
+ }).onError({ exitCode: 1 }).build();
9222
+ };
9223
+ var batch_edit_default = Object.freeze({ create: create27 });
9224
+
9225
+ // src/commands/doc/check-item.js
9226
+ var create28 = ({ httpClient }) => {
9227
+ return createCommand("check-item").summary("Set checklist item checked status").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("line").type("number").flag("line").required()).param((p) => p.name("checked").type("boolean").flag("checked").required()).param((p) => p.name("draft").type("boolean").flag("draft")).param((p) => p.name("preview").type("boolean").flag("preview")).run(async (ctx) => {
9228
+ const { sid, id, line, checked, draft, preview } = ctx.params;
9229
+ const args = { id, lineNumber: line, checked };
9230
+ if (draft)
9231
+ args.include_draft = true;
9232
+ if (preview)
9233
+ args.preview = true;
9234
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9235
+ cwd: process.cwd(),
9236
+ tool: "check_checklist_item",
9237
+ args
9238
+ });
9239
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9240
+ `);
9241
+ }).onError({ exitCode: 1 }).build();
9242
+ };
9243
+ var check_item_default = Object.freeze({ create: create28 });
9244
+
9245
+ // src/commands/doc/toggle-item.js
9246
+ var create29 = ({ httpClient }) => {
9247
+ return createCommand("toggle-item").summary("Toggle checklist item checked status").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("line").type("number").flag("line").required()).param((p) => p.name("draft").type("boolean").flag("draft")).param((p) => p.name("preview").type("boolean").flag("preview")).run(async (ctx) => {
9248
+ const { sid, id, line, draft, preview } = ctx.params;
9249
+ const args = { id, lineNumber: line };
9250
+ if (draft)
9251
+ args.include_draft = true;
9252
+ if (preview)
9253
+ args.preview = true;
9254
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9255
+ cwd: process.cwd(),
9256
+ tool: "toggle_checklist_item",
9257
+ args
9258
+ });
9259
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9260
+ `);
9261
+ }).onError({ exitCode: 1 }).build();
9262
+ };
9263
+ var toggle_item_default = Object.freeze({ create: create29 });
9264
+
9265
+ // src/commands/doc/batch-check-items.js
9266
+ var create30 = ({ httpClient }) => {
9267
+ return createCommand("batch-check-items").summary("Update multiple checklist items").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("items").type("string").flag("items").stdin()).param((p) => p.name("draft").type("boolean").flag("draft")).param((p) => p.name("preview").type("boolean").flag("preview")).preValidate((ctx) => {
9268
+ if (ctx.stdin.available && ctx.argv.flags.items) {
9269
+ return "Cannot use --items when piping stdin";
9270
+ }
9271
+ if (!ctx.stdin.available && !ctx.argv.flags.items) {
9272
+ return "Items required via --items or stdin";
9273
+ }
9274
+ return true;
9275
+ }).run(async (ctx) => {
9276
+ const { sid, id, items, draft, preview } = ctx.params;
9277
+ const args = { id };
9278
+ try {
9279
+ args.items = JSON.parse(items);
9280
+ } catch {
9281
+ throw new Error("Invalid JSON for items");
9282
+ }
9283
+ if (draft)
9284
+ args.include_draft = true;
9285
+ if (preview)
9286
+ args.preview = true;
9287
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9288
+ cwd: process.cwd(),
9289
+ tool: "batch_check_checklist_items",
9290
+ args
9291
+ });
9292
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9293
+ `);
9294
+ }).onError({ exitCode: 1 }).build();
9295
+ };
9296
+ var batch_check_items_default = Object.freeze({ create: create30 });
9297
+
9298
+ // src/commands/doc/set-edit-state.js
9299
+ var create31 = ({ httpClient }) => {
9300
+ return createCommand("set-edit-state").summary("Acquire edit lock on 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) => {
9301
+ const { sid, id } = ctx.params;
9302
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9303
+ cwd: process.cwd(),
9304
+ tool: "set_edit_state",
9305
+ args: { id }
9306
+ });
9307
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9308
+ `);
9309
+ }).onError({ exitCode: 1 }).build();
9310
+ };
9311
+ var set_edit_state_default = Object.freeze({ create: create31 });
9312
+
9313
+ // src/commands/doc/clear-edit-state.js
9314
+ var create32 = ({ httpClient }) => {
9315
+ return createCommand("clear-edit-state").summary("Release edit lock on 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) => {
9316
+ const { sid, id } = ctx.params;
9317
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9318
+ cwd: process.cwd(),
9319
+ tool: "clear_edit_state",
9320
+ args: { id }
9321
+ });
9322
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9323
+ `);
9324
+ }).onError({ exitCode: 1 }).build();
9325
+ };
9326
+ var clear_edit_state_default = Object.freeze({ create: create32 });
9327
+
9328
+ // src/commands/doc/get-edit-state.js
9329
+ var create33 = ({ httpClient }) => {
9330
+ return createCommand("get-edit-state").summary("Get edit lock status for 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) => {
9331
+ const { sid, id } = ctx.params;
9332
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9333
+ cwd: process.cwd(),
9334
+ tool: "get_edit_state",
9335
+ args: { id }
9336
+ });
9337
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9338
+ `);
9339
+ }).onError({ exitCode: 1 }).build();
9340
+ };
9341
+ var get_edit_state_default = Object.freeze({ create: create33 });
9342
+
9343
+ // src/commands/doc/check-includes.js
9344
+ var create34 = ({ httpClient }) => {
9345
+ return createCommand("check-includes").summary("Check for stale includes in 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) => {
9346
+ const { sid, id } = ctx.params;
9347
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9348
+ cwd: process.cwd(),
9349
+ tool: "check_includes",
9350
+ args: { id }
9351
+ });
9352
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9353
+ `);
9354
+ }).onError({ exitCode: 1 }).build();
9355
+ };
9356
+ var check_includes_default = Object.freeze({ create: create34 });
9357
+
9358
+ // src/commands/doc/update-includes.js
9359
+ var create35 = ({ httpClient }) => {
9360
+ return createCommand("update-includes").summary("Update includes to latest versions").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("id").type("string").flag("id").required()).run(async (ctx) => {
9361
+ const { sid, id } = ctx.params;
9362
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9363
+ cwd: process.cwd(),
9364
+ tool: "update_includes",
9365
+ args: { id }
9366
+ });
9367
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9368
+ `);
9369
+ }).onError({ exitCode: 1 }).build();
9370
+ };
9371
+ var update_includes_default = Object.freeze({ create: create35 });
9372
+
9373
+ // src/commands/folder/list.js
9374
+ var create36 = ({ httpClient }) => {
8950
9375
  return createCommand("list").summary("List folder contents").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("id").type("string").flag("id")).param((p) => p.name("store").type("string").flag("store")).param((p) => p.name("type").type("string").flag("type")).run(async (ctx) => {
8951
9376
  const { sid, id, store, type } = ctx.params;
8952
9377
  const args = {};
@@ -8965,10 +9390,10 @@ var create15 = ({ httpClient }) => {
8965
9390
  `);
8966
9391
  }).onError({ exitCode: 1 }).build();
8967
9392
  };
8968
- var list_default = Object.freeze({ create: create15 });
9393
+ var list_default = Object.freeze({ create: create36 });
8969
9394
 
8970
9395
  // src/commands/folder/create.js
8971
- var create16 = ({ httpClient }) => {
9396
+ var create37 = ({ httpClient }) => {
8972
9397
  return createCommand("create").summary("Create a folder").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")).run(async (ctx) => {
8973
9398
  const { sid, path, store, root, parent, name } = ctx.params;
8974
9399
  const args = {};
@@ -8991,10 +9416,10 @@ var create16 = ({ httpClient }) => {
8991
9416
  `);
8992
9417
  }).onError({ exitCode: 1 }).build();
8993
9418
  };
8994
- var create_default2 = Object.freeze({ create: create16 });
9419
+ var create_default2 = Object.freeze({ create: create37 });
8995
9420
 
8996
9421
  // src/commands/folder/get.js
8997
- var create17 = ({ httpClient }) => {
9422
+ var create38 = ({ httpClient }) => {
8998
9423
  return createCommand("get").summary("Get folder by ID").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("id").type("string").flag("id").required()).run(async (ctx) => {
8999
9424
  const { sid, id } = ctx.params;
9000
9425
  const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
@@ -9006,10 +9431,10 @@ var create17 = ({ httpClient }) => {
9006
9431
  `);
9007
9432
  }).onError({ exitCode: 1 }).build();
9008
9433
  };
9009
- var get_default = Object.freeze({ create: create17 });
9434
+ var get_default = Object.freeze({ create: create38 });
9010
9435
 
9011
9436
  // src/commands/folder/get-by-path.js
9012
- var create18 = ({ httpClient }) => {
9437
+ var create39 = ({ httpClient }) => {
9013
9438
  return createCommand("get-by-path").summary("Get folder by path").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("path").type("string").flag("path").required()).param((p) => p.name("type").type("string").flag("type").required()).param((p) => p.name("store").type("string").flag("store")).run(async (ctx) => {
9014
9439
  const { sid, path, type, store } = ctx.params;
9015
9440
  const args = { path, type };
@@ -9024,10 +9449,10 @@ var create18 = ({ httpClient }) => {
9024
9449
  `);
9025
9450
  }).onError({ exitCode: 1 }).build();
9026
9451
  };
9027
- var get_by_path_default = Object.freeze({ create: create18 });
9452
+ var get_by_path_default = Object.freeze({ create: create39 });
9028
9453
 
9029
9454
  // src/commands/folder/rename.js
9030
- var create19 = ({ httpClient }) => {
9455
+ var create40 = ({ httpClient }) => {
9031
9456
  return createCommand("rename").summary("Rename a folder").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("name").type("string").flag("name").required()).run(async (ctx) => {
9032
9457
  const { sid, id, name } = ctx.params;
9033
9458
  const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
@@ -9039,10 +9464,10 @@ var create19 = ({ httpClient }) => {
9039
9464
  `);
9040
9465
  }).onError({ exitCode: 1 }).build();
9041
9466
  };
9042
- var rename_default = Object.freeze({ create: create19 });
9467
+ var rename_default = Object.freeze({ create: create40 });
9043
9468
 
9044
9469
  // src/commands/folder/move.js
9045
- var create20 = ({ httpClient }) => {
9470
+ var create41 = ({ httpClient }) => {
9046
9471
  return createCommand("move").summary("Move a folder to a new parent").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("parent").type("string").flag("parent").required()).run(async (ctx) => {
9047
9472
  const { sid, id, parent } = ctx.params;
9048
9473
  const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
@@ -9054,10 +9479,10 @@ var create20 = ({ httpClient }) => {
9054
9479
  `);
9055
9480
  }).onError({ exitCode: 1 }).build();
9056
9481
  };
9057
- var move_default = Object.freeze({ create: create20 });
9482
+ var move_default = Object.freeze({ create: create41 });
9058
9483
 
9059
9484
  // src/commands/folder/delete.js
9060
- var create21 = ({ httpClient }) => {
9485
+ var create42 = ({ httpClient }) => {
9061
9486
  return createCommand("delete").summary("Delete a folder").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("id").type("string").flag("id").required()).run(async (ctx) => {
9062
9487
  const { sid, id } = ctx.params;
9063
9488
  const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
@@ -9069,10 +9494,10 @@ var create21 = ({ httpClient }) => {
9069
9494
  `);
9070
9495
  }).onError({ exitCode: 1 }).build();
9071
9496
  };
9072
- var delete_default2 = Object.freeze({ create: create21 });
9497
+ var delete_default2 = Object.freeze({ create: create42 });
9073
9498
 
9074
9499
  // src/commands/field/get.js
9075
- var create22 = ({ httpClient }) => {
9500
+ var create43 = ({ httpClient }) => {
9076
9501
  return createCommand("get").summary("Get all fields for an entity").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("id").type("string").flag("id").required()).run(async (ctx) => {
9077
9502
  const { sid, id } = ctx.params;
9078
9503
  const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
@@ -9084,10 +9509,10 @@ var create22 = ({ httpClient }) => {
9084
9509
  `);
9085
9510
  }).onError({ exitCode: 1 }).build();
9086
9511
  };
9087
- var get_default2 = Object.freeze({ create: create22 });
9512
+ var get_default2 = Object.freeze({ create: create43 });
9088
9513
 
9089
9514
  // src/commands/field/set.js
9090
- var create23 = ({ httpClient }) => {
9515
+ var create44 = ({ httpClient }) => {
9091
9516
  return createCommand("set").summary("Set a field value").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("fieldId").type("string").flag("field-id")).param((p) => p.name("fieldName").type("string").flag("field-name")).param((p) => p.name("value").type("string").flag("value")).param((p) => p.name("values").type("string").flag("values")).run(async (ctx) => {
9092
9517
  const { sid, id, fieldId, fieldName, value, values } = ctx.params;
9093
9518
  const args = { id };
@@ -9108,10 +9533,10 @@ var create23 = ({ httpClient }) => {
9108
9533
  `);
9109
9534
  }).onError({ exitCode: 1 }).build();
9110
9535
  };
9111
- var set_default = Object.freeze({ create: create23 });
9536
+ var set_default = Object.freeze({ create: create44 });
9112
9537
 
9113
9538
  // src/commands/field/delete.js
9114
- var create24 = ({ httpClient }) => {
9539
+ var create45 = ({ httpClient }) => {
9115
9540
  return createCommand("delete").summary("Remove a field from an entity").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("fieldId").type("string").flag("field-id")).param((p) => p.name("fieldName").type("string").flag("field-name")).run(async (ctx) => {
9116
9541
  const { sid, id, fieldId, fieldName } = ctx.params;
9117
9542
  const args = { id };
@@ -9128,10 +9553,99 @@ var create24 = ({ httpClient }) => {
9128
9553
  `);
9129
9554
  }).onError({ exitCode: 1 }).build();
9130
9555
  };
9131
- var delete_default3 = Object.freeze({ create: create24 });
9556
+ var delete_default3 = Object.freeze({ create: create45 });
9557
+
9558
+ // src/commands/field/create-def.js
9559
+ var create46 = ({ httpClient }) => {
9560
+ return createCommand("create-def").summary("Create a field definition").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("type").type("string").flag("type").required()).param((p) => p.name("owner").type("string").flag("owner")).param((p) => p.name("typeCode").type("string").flag("type-code")).param((p) => p.name("subtype").type("string").flag("subtype")).param((p) => p.name("label").type("string").flag("label")).param((p) => p.name("description").type("string").flag("description")).param((p) => p.name("required").type("boolean").flag("required")).param((p) => p.name("multiplicity").type("string").flag("multiplicity")).param((p) => p.name("system").type("boolean").flag("system")).param((p) => p.name("store").type("string").flag("store")).run(async (ctx) => {
9561
+ const { sid, name, type, owner, typeCode, subtype, label, description, required, multiplicity, system, store } = ctx.params;
9562
+ const args = { name, primitiveType: type };
9563
+ if (owner !== undefined)
9564
+ args.ownerEntityId = owner;
9565
+ if (typeCode !== undefined)
9566
+ args.ownerEntityTypeCode = typeCode;
9567
+ if (subtype !== undefined)
9568
+ args.ownerEntityTypeSubtype = subtype;
9569
+ if (label !== undefined)
9570
+ args.label = label;
9571
+ if (description !== undefined)
9572
+ args.description = description;
9573
+ if (required !== undefined)
9574
+ args.required = required;
9575
+ if (multiplicity !== undefined)
9576
+ args.multiplicity = multiplicity;
9577
+ if (system !== undefined)
9578
+ args.isSystem = system;
9579
+ if (store !== undefined)
9580
+ args.store = store;
9581
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9582
+ cwd: process.cwd(),
9583
+ tool: "create_field_definition",
9584
+ args
9585
+ });
9586
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9587
+ `);
9588
+ }).onError({ exitCode: 1 }).build();
9589
+ };
9590
+ var create_def_default = Object.freeze({ create: create46 });
9591
+
9592
+ // src/commands/field/list-defs.js
9593
+ var create47 = ({ httpClient }) => {
9594
+ return createCommand("list-defs").summary("List field definitions").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("owner").type("string").flag("owner")).param((p) => p.name("includeSystem").type("boolean").flag("include-system")).param((p) => p.name("store").type("string").flag("store")).run(async (ctx) => {
9595
+ const { sid, owner, includeSystem, store } = ctx.params;
9596
+ const args = {};
9597
+ if (owner !== undefined)
9598
+ args.ownerEntityId = owner;
9599
+ if (includeSystem !== undefined)
9600
+ args.includeSystem = includeSystem;
9601
+ if (store !== undefined)
9602
+ args.store = store;
9603
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9604
+ cwd: process.cwd(),
9605
+ tool: "get_field_definitions",
9606
+ args
9607
+ });
9608
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9609
+ `);
9610
+ }).onError({ exitCode: 1 }).build();
9611
+ };
9612
+ var list_defs_default = Object.freeze({ create: create47 });
9613
+
9614
+ // src/commands/field/get-type-fields.js
9615
+ var create48 = ({ httpClient }) => {
9616
+ return createCommand("get-type-fields").summary("Get field definitions for an entity type/subtype").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("code").type("string").flag("code").required()).param((p) => p.name("subtype").type("string").flag("subtype").required()).param((p) => p.name("store").type("string").flag("store")).run(async (ctx) => {
9617
+ const { sid, code, subtype, store } = ctx.params;
9618
+ const args = { code, subtype };
9619
+ if (store !== undefined)
9620
+ args.store = store;
9621
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9622
+ cwd: process.cwd(),
9623
+ tool: "get_type_fields",
9624
+ args
9625
+ });
9626
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9627
+ `);
9628
+ }).onError({ exitCode: 1 }).build();
9629
+ };
9630
+ var get_type_fields_default = Object.freeze({ create: create48 });
9631
+
9632
+ // src/commands/field/delete-def.js
9633
+ var create49 = ({ httpClient }) => {
9634
+ return createCommand("delete-def").summary("Delete a field definition").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("id").type("string").flag("id").required()).run(async (ctx) => {
9635
+ const { sid, id } = ctx.params;
9636
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9637
+ cwd: process.cwd(),
9638
+ tool: "delete_field_definition",
9639
+ args: { id }
9640
+ });
9641
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9642
+ `);
9643
+ }).onError({ exitCode: 1 }).build();
9644
+ };
9645
+ var delete_def_default = Object.freeze({ create: create49 });
9132
9646
 
9133
9647
  // src/commands/story/create.js
9134
- var create25 = ({ httpClient }) => {
9648
+ var create50 = ({ httpClient }) => {
9135
9649
  return createCommand("create").summary("Create a story").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("state").type("string").flag("state")).run(async (ctx) => {
9136
9650
  const { sid, name, store, state } = ctx.params;
9137
9651
  const args = { name };
@@ -9148,10 +9662,10 @@ var create25 = ({ httpClient }) => {
9148
9662
  `);
9149
9663
  }).onError({ exitCode: 1 }).build();
9150
9664
  };
9151
- var create_default3 = Object.freeze({ create: create25 });
9665
+ var create_default3 = Object.freeze({ create: create50 });
9152
9666
 
9153
9667
  // src/commands/story/list.js
9154
- var create26 = ({ httpClient }) => {
9668
+ var create51 = ({ httpClient }) => {
9155
9669
  return createCommand("list").summary("List all stories").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("store").type("string").flag("store")).run(async (ctx) => {
9156
9670
  const { sid, store } = ctx.params;
9157
9671
  const args = {};
@@ -9166,10 +9680,10 @@ var create26 = ({ httpClient }) => {
9166
9680
  `);
9167
9681
  }).onError({ exitCode: 1 }).build();
9168
9682
  };
9169
- var list_default2 = Object.freeze({ create: create26 });
9683
+ var list_default2 = Object.freeze({ create: create51 });
9170
9684
 
9171
9685
  // src/commands/story/get.js
9172
- var create27 = ({ httpClient }) => {
9686
+ var create52 = ({ httpClient }) => {
9173
9687
  return createCommand("get").summary("Get story details").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("id").type("string").flag("id").required()).run(async (ctx) => {
9174
9688
  const { sid, id } = ctx.params;
9175
9689
  const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
@@ -9181,10 +9695,10 @@ var create27 = ({ httpClient }) => {
9181
9695
  `);
9182
9696
  }).onError({ exitCode: 1 }).build();
9183
9697
  };
9184
- var get_default3 = Object.freeze({ create: create27 });
9698
+ var get_default3 = Object.freeze({ create: create52 });
9185
9699
 
9186
9700
  // src/commands/story/update-state.js
9187
- var create28 = ({ httpClient }) => {
9701
+ var create53 = ({ httpClient }) => {
9188
9702
  return createCommand("update-state").summary("Update story state").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("state").type("string").flag("state").required()).run(async (ctx) => {
9189
9703
  const { sid, id, state } = ctx.params;
9190
9704
  const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
@@ -9196,10 +9710,10 @@ var create28 = ({ httpClient }) => {
9196
9710
  `);
9197
9711
  }).onError({ exitCode: 1 }).build();
9198
9712
  };
9199
- var update_state_default = Object.freeze({ create: create28 });
9713
+ var update_state_default = Object.freeze({ create: create53 });
9200
9714
 
9201
9715
  // src/commands/story/delete.js
9202
- var create29 = ({ httpClient }) => {
9716
+ var create54 = ({ httpClient }) => {
9203
9717
  return createCommand("delete").summary("Delete a story").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("confirm").type("boolean").flag("confirm")).run(async (ctx) => {
9204
9718
  const { sid, id, confirm } = ctx.params;
9205
9719
  const args = { id };
@@ -9214,10 +9728,40 @@ var create29 = ({ httpClient }) => {
9214
9728
  `);
9215
9729
  }).onError({ exitCode: 1 }).build();
9216
9730
  };
9217
- var delete_default4 = Object.freeze({ create: create29 });
9731
+ var delete_default4 = Object.freeze({ create: create54 });
9732
+
9733
+ // src/commands/story/inc-jobs.js
9734
+ var create55 = ({ httpClient }) => {
9735
+ return createCommand("inc-jobs").summary("Increment story job count").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("id").type("string").flag("id").required()).run(async (ctx) => {
9736
+ const { sid, id } = ctx.params;
9737
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9738
+ cwd: process.cwd(),
9739
+ tool: "increment_story_job_count",
9740
+ args: { id }
9741
+ });
9742
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9743
+ `);
9744
+ }).onError({ exitCode: 1 }).build();
9745
+ };
9746
+ var inc_jobs_default = Object.freeze({ create: create55 });
9747
+
9748
+ // src/commands/story/dec-jobs.js
9749
+ var create56 = ({ httpClient }) => {
9750
+ return createCommand("dec-jobs").summary("Decrement story job count").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("id").type("string").flag("id").required()).run(async (ctx) => {
9751
+ const { sid, id } = ctx.params;
9752
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9753
+ cwd: process.cwd(),
9754
+ tool: "decrement_story_job_count",
9755
+ args: { id }
9756
+ });
9757
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9758
+ `);
9759
+ }).onError({ exitCode: 1 }).build();
9760
+ };
9761
+ var dec_jobs_default = Object.freeze({ create: create56 });
9218
9762
 
9219
9763
  // src/commands/template/create.js
9220
- var create30 = ({ httpClient }) => {
9764
+ var create57 = ({ httpClient }) => {
9221
9765
  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) => {
9222
9766
  if (ctx.stdin.available && ctx.argv.flags.content) {
9223
9767
  return "Cannot use --content when piping stdin";
@@ -9247,10 +9791,10 @@ var create30 = ({ httpClient }) => {
9247
9791
  `);
9248
9792
  }).onError({ exitCode: 1 }).build();
9249
9793
  };
9250
- var create_default4 = Object.freeze({ create: create30 });
9794
+ var create_default4 = Object.freeze({ create: create57 });
9251
9795
 
9252
9796
  // src/commands/template/render.js
9253
- var create31 = ({ httpClient }) => {
9797
+ var create58 = ({ httpClient }) => {
9254
9798
  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) => {
9255
9799
  const { sid, id, params, target, path, publish } = ctx.params;
9256
9800
  const args = { id };
@@ -9279,13 +9823,164 @@ var create31 = ({ httpClient }) => {
9279
9823
  `);
9280
9824
  }).onError({ exitCode: 1 }).build();
9281
9825
  };
9282
- var render_default = Object.freeze({ create: create31 });
9826
+ var render_default = Object.freeze({ create: create58 });
9827
+
9828
+ // src/commands/template/params.js
9829
+ var create59 = ({ httpClient }) => {
9830
+ return createCommand("params").summary("Get template parameters").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("id").type("string").flag("id").required()).run(async (ctx) => {
9831
+ const { sid, id } = ctx.params;
9832
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9833
+ cwd: process.cwd(),
9834
+ tool: "get_template_parameters",
9835
+ args: { id }
9836
+ });
9837
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9838
+ `);
9839
+ }).onError({ exitCode: 1 }).build();
9840
+ };
9841
+ var params_default = Object.freeze({ create: create59 });
9842
+
9843
+ // src/commands/template/list-by-type.js
9844
+ var create60 = ({ httpClient }) => {
9845
+ return createCommand("list-by-type").summary("List templates by entity type code").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("typeCode").type("string").flag("type-code").required()).run(async (ctx) => {
9846
+ const { sid, typeCode } = ctx.params;
9847
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9848
+ cwd: process.cwd(),
9849
+ tool: "list_templates_by_type",
9850
+ args: { typeCode }
9851
+ });
9852
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9853
+ `);
9854
+ }).onError({ exitCode: 1 }).build();
9855
+ };
9856
+ var list_by_type_default = Object.freeze({ create: create60 });
9857
+
9858
+ // src/commands/job/list.js
9859
+ var create61 = ({ httpClient }) => {
9860
+ return createCommand("list").summary("List all jobs").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("store").type("string").flag("store")).param((p) => p.name("status").type("string").flag("status")).run(async (ctx) => {
9861
+ const { sid, store, status } = ctx.params;
9862
+ const args = {};
9863
+ if (store !== undefined)
9864
+ args.store = store;
9865
+ if (status !== undefined)
9866
+ args.status = status;
9867
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9868
+ cwd: process.cwd(),
9869
+ tool: "list_jobs",
9870
+ args
9871
+ });
9872
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9873
+ `);
9874
+ }).onError({ exitCode: 1 }).build();
9875
+ };
9876
+ var list_default3 = Object.freeze({ create: create61 });
9877
+
9878
+ // src/commands/job/get.js
9879
+ var create62 = ({ httpClient }) => {
9880
+ return createCommand("get").summary("Get job details").param((p) => p.name("sid").type("string").flag("sid", "s").required()).param((p) => p.name("id").type("string").flag("id").required()).run(async (ctx) => {
9881
+ const { sid, id } = ctx.params;
9882
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9883
+ cwd: process.cwd(),
9884
+ tool: "read_job",
9885
+ args: { id }
9886
+ });
9887
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9888
+ `);
9889
+ }).onError({ exitCode: 1 }).build();
9890
+ };
9891
+ var get_default4 = Object.freeze({ create: create62 });
9892
+
9893
+ // src/commands/export/list.js
9894
+ var create63 = ({ httpClient }) => {
9895
+ return createCommand("list").summary("List available export files").param((p) => p.name("sid").type("string").flag("sid", "s").required()).run(async (ctx) => {
9896
+ const { sid } = ctx.params;
9897
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9898
+ cwd: process.cwd(),
9899
+ tool: "list_exports",
9900
+ args: {}
9901
+ });
9902
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9903
+ `);
9904
+ }).onError({ exitCode: 1 }).build();
9905
+ };
9906
+ var list_default4 = Object.freeze({ create: create63 });
9907
+
9908
+ // src/commands/export/preview.js
9909
+ var create64 = ({ httpClient }) => {
9910
+ 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) => {
9911
+ const { sid, store } = ctx.params;
9912
+ const args = {};
9913
+ if (store !== undefined)
9914
+ args.store = store;
9915
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9916
+ cwd: process.cwd(),
9917
+ tool: "export_preview",
9918
+ args
9919
+ });
9920
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9921
+ `);
9922
+ }).onError({ exitCode: 1 }).build();
9923
+ };
9924
+ var preview_default = Object.freeze({ create: create64 });
9925
+
9926
+ // src/commands/export/export.js
9927
+ var create65 = ({ httpClient }) => {
9928
+ 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) => {
9929
+ const { sid, confirm, store } = ctx.params;
9930
+ const args = {};
9931
+ if (confirm !== undefined)
9932
+ args.confirm = confirm;
9933
+ if (store !== undefined)
9934
+ args.store = store;
9935
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9936
+ cwd: process.cwd(),
9937
+ tool: "export_documents",
9938
+ args
9939
+ });
9940
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9941
+ `);
9942
+ }).onError({ exitCode: 1 }).build();
9943
+ };
9944
+ var export_default = Object.freeze({ create: create65 });
9945
+
9946
+ // src/commands/export/import.js
9947
+ var create66 = ({ httpClient }) => {
9948
+ 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) => {
9949
+ const { sid, filename, store } = ctx.params;
9950
+ const args = { filename };
9951
+ if (store !== undefined)
9952
+ args.store = store;
9953
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9954
+ cwd: process.cwd(),
9955
+ tool: "import_documents",
9956
+ args
9957
+ });
9958
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9959
+ `);
9960
+ }).onError({ exitCode: 1 }).build();
9961
+ };
9962
+ var import_default = Object.freeze({ create: create66 });
9963
+
9964
+ // src/commands/asset/read.js
9965
+ var create67 = ({ httpClient }) => {
9966
+ 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) => {
9967
+ const { sid, id } = ctx.params;
9968
+ const result = await httpClient.post(`/cli/mcp-client/${sid}/dispatch`, {
9969
+ cwd: process.cwd(),
9970
+ tool: "read_asset",
9971
+ args: { id }
9972
+ });
9973
+ ctx.stdio.stdout.write(JSON.stringify(result, null, 2) + `
9974
+ `);
9975
+ }).onError({ exitCode: 1 }).build();
9976
+ };
9977
+ var read_default2 = Object.freeze({ create: create67 });
9283
9978
 
9284
9979
  // src/cli-main.js
9285
9980
  var CAW_URL = process.env.CAW_URL || "https://caw.localhost";
9286
9981
  try {
9287
9982
  const httpClient = http_client_default.create({ baseUrl: CAW_URL });
9288
- 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());
9983
+ 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(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(delete_default4.create({ httpClient })).command(inc_jobs_default.create({ httpClient })).command(dec_jobs_default.create({ httpClient })).build()).group(createCommandGroup("template").summary("Template operations").command(create_default4.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_default3.create({ httpClient })).command(get_default4.create({ httpClient })).build()).group(createCommandGroup("export").summary("Export operations").command(list_default4.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());
9289
9984
  await app.run(process.argv.slice(2));
9290
9985
  } catch (error) {
9291
9986
  console.error(`Error: ${error.message}`);