@ted-galago/wave-cli 0.1.13 → 0.1.15
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 +107 -0
- package/dist/index.cjs +840 -4
- package/dist/index.js +837 -1
- package/package.json +1 -1
- package/scripts/verify-dev-api.mjs +214 -0
package/dist/index.js
CHANGED
|
@@ -3072,10 +3072,14 @@ function registerMemberCommands(program) {
|
|
|
3072
3072
|
members.command("list").option("--page <page>").option("--per <per>").option(
|
|
3073
3073
|
"--include-coaches <includeCoaches>",
|
|
3074
3074
|
"Include linked coach members. Defaults to false; omitted/false returns organization members only."
|
|
3075
|
+
).option(
|
|
3076
|
+
"--include-disabled <includeDisabled>",
|
|
3077
|
+
"Include deactivated members. Defaults to false; omitted/false returns active members only."
|
|
3075
3078
|
).action(async (opts, cmd) => {
|
|
3076
3079
|
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
3077
3080
|
const organizationId = resolveOrganizationId(context.organizationId);
|
|
3078
3081
|
const includeCoaches = opts.includeCoaches === void 0 ? void 0 : parseStrictBooleanOption(opts.includeCoaches, "--include-coaches");
|
|
3082
|
+
const includeDisabled = opts.includeDisabled === void 0 ? void 0 : parseStrictBooleanOption(opts.includeDisabled, "--include-disabled");
|
|
3079
3083
|
await runGraphqlQueryCommand({
|
|
3080
3084
|
command: "members.list",
|
|
3081
3085
|
runtimeOptions: context.runtimeOptions,
|
|
@@ -3084,7 +3088,8 @@ function registerMemberCommands(program) {
|
|
|
3084
3088
|
organization_id: organizationId,
|
|
3085
3089
|
page: opts.page,
|
|
3086
3090
|
per: opts.per,
|
|
3087
|
-
include_coaches: includeCoaches
|
|
3091
|
+
include_coaches: includeCoaches,
|
|
3092
|
+
include_disabled: includeDisabled
|
|
3088
3093
|
}),
|
|
3089
3094
|
isList: true
|
|
3090
3095
|
});
|
|
@@ -5137,6 +5142,13 @@ function baseNodeFields() {
|
|
|
5137
5142
|
"nodeKey",
|
|
5138
5143
|
"nodeKind",
|
|
5139
5144
|
"runtimeLabel",
|
|
5145
|
+
"path",
|
|
5146
|
+
"source",
|
|
5147
|
+
"access",
|
|
5148
|
+
"owner",
|
|
5149
|
+
"parentRef",
|
|
5150
|
+
"agentChildrenAllowed",
|
|
5151
|
+
"exists",
|
|
5140
5152
|
"resolvedScope { parentId recordId memberId teamId contentType }",
|
|
5141
5153
|
"isLeaf",
|
|
5142
5154
|
"treeView",
|
|
@@ -6071,6 +6083,829 @@ function registerMutationCapabilityCommands(program) {
|
|
|
6071
6083
|
});
|
|
6072
6084
|
}
|
|
6073
6085
|
|
|
6086
|
+
// src/commands/osmd.ts
|
|
6087
|
+
import { readFile } from "fs/promises";
|
|
6088
|
+
import { z as z16 } from "zod";
|
|
6089
|
+
var sourceSchema = z16.enum(["canonical_osmd", "agent_overlay", "agent_wiki"]);
|
|
6090
|
+
var accessSchema = z16.enum(["read_only", "read_write", "append_only"]);
|
|
6091
|
+
var ownerSchema = z16.enum(["system", "atlas"]);
|
|
6092
|
+
var suggestedActionSchema = z16.enum([
|
|
6093
|
+
"read",
|
|
6094
|
+
"create",
|
|
6095
|
+
"init",
|
|
6096
|
+
"update",
|
|
6097
|
+
"append",
|
|
6098
|
+
"forbidden",
|
|
6099
|
+
"invalid_parent"
|
|
6100
|
+
]);
|
|
6101
|
+
var agentMarkdownErrorCodeSchema = z16.enum([
|
|
6102
|
+
"canonical_osmd_read_only",
|
|
6103
|
+
"agent_parent_not_found",
|
|
6104
|
+
"agent_file_not_found",
|
|
6105
|
+
"agent_file_already_exists",
|
|
6106
|
+
"agent_path_forbidden",
|
|
6107
|
+
"append_only_violation",
|
|
6108
|
+
"unsupported_agent_file",
|
|
6109
|
+
"invalid_agent_wiki_path"
|
|
6110
|
+
]);
|
|
6111
|
+
var nonEmptyString3 = z16.string().min(1);
|
|
6112
|
+
var nonNegativeInt3 = z16.coerce.number().int().min(0);
|
|
6113
|
+
var agentOverlayFileSchema = z16.enum(["notes.md", "log.md"]);
|
|
6114
|
+
var agentMarkdownFileSchema = z16.object({
|
|
6115
|
+
path: z16.string(),
|
|
6116
|
+
source: sourceSchema,
|
|
6117
|
+
access: accessSchema,
|
|
6118
|
+
owner: ownerSchema,
|
|
6119
|
+
exists: z16.boolean(),
|
|
6120
|
+
canCreate: z16.boolean(),
|
|
6121
|
+
canUpdate: z16.boolean(),
|
|
6122
|
+
canAppend: z16.boolean(),
|
|
6123
|
+
parentRef: z16.string().nullable().optional(),
|
|
6124
|
+
agentChildrenAllowed: z16.boolean(),
|
|
6125
|
+
suggestedAction: suggestedActionSchema,
|
|
6126
|
+
errorCode: agentMarkdownErrorCodeSchema.nullable().optional(),
|
|
6127
|
+
content: z16.string().nullable().optional(),
|
|
6128
|
+
url: z16.string().nullable().optional()
|
|
6129
|
+
}).transform((value) => ({
|
|
6130
|
+
...value,
|
|
6131
|
+
parentRef: value.parentRef ?? null,
|
|
6132
|
+
errorCode: value.errorCode ?? null,
|
|
6133
|
+
content: value.content ?? null,
|
|
6134
|
+
url: value.url ?? null
|
|
6135
|
+
}));
|
|
6136
|
+
var agentMarkdownFilesSchema = z16.array(agentMarkdownFileSchema);
|
|
6137
|
+
var agentMarkdownMutationDataSchema = z16.union([
|
|
6138
|
+
agentMarkdownFileSchema,
|
|
6139
|
+
z16.object({ files: agentMarkdownFilesSchema })
|
|
6140
|
+
]);
|
|
6141
|
+
var mutationPayloadSchema = z16.object({
|
|
6142
|
+
ok: z16.boolean(),
|
|
6143
|
+
status: z16.number(),
|
|
6144
|
+
errorCode: z16.string().nullable().optional(),
|
|
6145
|
+
data: z16.unknown().nullable().optional(),
|
|
6146
|
+
errors: z16.unknown().nullable().optional()
|
|
6147
|
+
});
|
|
6148
|
+
var markdownTreeNodeSchema = z16.lazy(
|
|
6149
|
+
() => z16.object({
|
|
6150
|
+
toolKey: z16.string(),
|
|
6151
|
+
nodeKey: z16.string(),
|
|
6152
|
+
nodeKind: z16.string(),
|
|
6153
|
+
runtimeLabel: z16.string(),
|
|
6154
|
+
path: z16.string().nullable().optional().transform((value) => value ?? null),
|
|
6155
|
+
source: sourceSchema,
|
|
6156
|
+
access: accessSchema,
|
|
6157
|
+
owner: ownerSchema,
|
|
6158
|
+
parentRef: z16.string().nullable().optional().transform((value) => value ?? null),
|
|
6159
|
+
agentChildrenAllowed: z16.boolean(),
|
|
6160
|
+
exists: z16.boolean(),
|
|
6161
|
+
resolvedScope: z16.object({
|
|
6162
|
+
parentId: z16.string().nullable().optional().transform((value) => value ?? null),
|
|
6163
|
+
recordId: z16.string().nullable().optional().transform((value) => value ?? null),
|
|
6164
|
+
memberId: z16.string().nullable().optional().transform((value) => value ?? null),
|
|
6165
|
+
teamId: z16.string().nullable().optional().transform((value) => value ?? null),
|
|
6166
|
+
contentType: z16.string().nullable().optional().transform((value) => value ?? null)
|
|
6167
|
+
}),
|
|
6168
|
+
isLeaf: z16.boolean(),
|
|
6169
|
+
treeView: z16.boolean(),
|
|
6170
|
+
details: z16.unknown().nullable(),
|
|
6171
|
+
children: z16.array(markdownTreeNodeSchema).optional().transform((value) => value ?? [])
|
|
6172
|
+
})
|
|
6173
|
+
);
|
|
6174
|
+
var AGENT_MARKDOWN_FILE_SELECTION = `{
|
|
6175
|
+
path
|
|
6176
|
+
source
|
|
6177
|
+
access
|
|
6178
|
+
owner
|
|
6179
|
+
exists
|
|
6180
|
+
canCreate
|
|
6181
|
+
canUpdate
|
|
6182
|
+
canAppend
|
|
6183
|
+
parentRef
|
|
6184
|
+
agentChildrenAllowed
|
|
6185
|
+
suggestedAction
|
|
6186
|
+
errorCode
|
|
6187
|
+
content
|
|
6188
|
+
url
|
|
6189
|
+
}`;
|
|
6190
|
+
var MUTATION_RESULT_SELECTION = "{ ok status errorCode data errors }";
|
|
6191
|
+
var AGENT_JSON_KEY_ALIASES = {
|
|
6192
|
+
can_create: "canCreate",
|
|
6193
|
+
can_update: "canUpdate",
|
|
6194
|
+
can_append: "canAppend",
|
|
6195
|
+
parent_ref: "parentRef",
|
|
6196
|
+
agent_children_allowed: "agentChildrenAllowed",
|
|
6197
|
+
suggested_action: "suggestedAction",
|
|
6198
|
+
error_code: "errorCode"
|
|
6199
|
+
};
|
|
6200
|
+
var contentStdinPromise = null;
|
|
6201
|
+
function isRecord5(value) {
|
|
6202
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
6203
|
+
}
|
|
6204
|
+
function normalizeAgentMarkdownJsonKeys(value) {
|
|
6205
|
+
if (Array.isArray(value)) {
|
|
6206
|
+
return value.map((entry) => normalizeAgentMarkdownJsonKeys(entry));
|
|
6207
|
+
}
|
|
6208
|
+
if (!isRecord5(value)) {
|
|
6209
|
+
return value;
|
|
6210
|
+
}
|
|
6211
|
+
const normalized = {};
|
|
6212
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
6213
|
+
const normalizedKey = AGENT_JSON_KEY_ALIASES[key] ?? key;
|
|
6214
|
+
normalized[normalizedKey] = normalizeAgentMarkdownJsonKeys(entry);
|
|
6215
|
+
}
|
|
6216
|
+
return normalized;
|
|
6217
|
+
}
|
|
6218
|
+
function buildSuccessEnvelope(params) {
|
|
6219
|
+
return {
|
|
6220
|
+
ok: true,
|
|
6221
|
+
command: params.command,
|
|
6222
|
+
status: params.status,
|
|
6223
|
+
data: params.data,
|
|
6224
|
+
error: null,
|
|
6225
|
+
meta: { requestId: params.requestId }
|
|
6226
|
+
};
|
|
6227
|
+
}
|
|
6228
|
+
function buildErrorEnvelope(params) {
|
|
6229
|
+
return {
|
|
6230
|
+
ok: false,
|
|
6231
|
+
command: params.command,
|
|
6232
|
+
status: params.status,
|
|
6233
|
+
data: params.data,
|
|
6234
|
+
error: {
|
|
6235
|
+
code: params.code,
|
|
6236
|
+
message: params.message,
|
|
6237
|
+
suggestedAction: params.suggestedAction,
|
|
6238
|
+
details: params.details ?? {}
|
|
6239
|
+
},
|
|
6240
|
+
meta: { requestId: params.requestId }
|
|
6241
|
+
};
|
|
6242
|
+
}
|
|
6243
|
+
function printLocalError(params) {
|
|
6244
|
+
return printEnvelopeAndExit({
|
|
6245
|
+
envelope: buildErrorEnvelope(params),
|
|
6246
|
+
exitCode: mapStatusToExitCode(params.status)
|
|
6247
|
+
});
|
|
6248
|
+
}
|
|
6249
|
+
function printInvalidPayloadError(params) {
|
|
6250
|
+
return printLocalError({
|
|
6251
|
+
command: params.command,
|
|
6252
|
+
status: 502,
|
|
6253
|
+
code: "upstream_error",
|
|
6254
|
+
message: "GraphQL response did not match the expected OSMD contract.",
|
|
6255
|
+
requestId: params.requestId,
|
|
6256
|
+
data: null,
|
|
6257
|
+
details: { issues: params.issues }
|
|
6258
|
+
});
|
|
6259
|
+
}
|
|
6260
|
+
async function requestOsmdQuery(params) {
|
|
6261
|
+
const result = await graphqlRequest({
|
|
6262
|
+
config: getConfig(params.runtimeOptions),
|
|
6263
|
+
command: params.command,
|
|
6264
|
+
operationName: params.operationName,
|
|
6265
|
+
operationType: "query",
|
|
6266
|
+
field: params.field,
|
|
6267
|
+
variables: params.variables,
|
|
6268
|
+
selectionSet: params.selectionSet,
|
|
6269
|
+
isShow: true
|
|
6270
|
+
});
|
|
6271
|
+
if (!result.envelope.ok) {
|
|
6272
|
+
return printEnvelopeAndExit(result);
|
|
6273
|
+
}
|
|
6274
|
+
const dataRecord = isRecord5(result.envelope.data) ? result.envelope.data : {};
|
|
6275
|
+
const parsed = params.schema.safeParse(dataRecord[params.field]);
|
|
6276
|
+
if (!parsed.success) {
|
|
6277
|
+
return printInvalidPayloadError({
|
|
6278
|
+
command: params.command,
|
|
6279
|
+
requestId: result.envelope.meta.requestId,
|
|
6280
|
+
issues: parsed.error.issues
|
|
6281
|
+
});
|
|
6282
|
+
}
|
|
6283
|
+
return {
|
|
6284
|
+
data: parsed.data,
|
|
6285
|
+
status: result.envelope.status,
|
|
6286
|
+
requestId: result.envelope.meta.requestId
|
|
6287
|
+
};
|
|
6288
|
+
}
|
|
6289
|
+
async function requestAgentMarkdownStatus(params) {
|
|
6290
|
+
return requestOsmdQuery({
|
|
6291
|
+
command: params.command,
|
|
6292
|
+
operationName: "AgentMarkdownStatus",
|
|
6293
|
+
runtimeOptions: params.runtimeOptions,
|
|
6294
|
+
field: "agent_markdown_status",
|
|
6295
|
+
variables: {
|
|
6296
|
+
organization_id: params.organizationId,
|
|
6297
|
+
path: params.path,
|
|
6298
|
+
parent_ref: params.parentRef
|
|
6299
|
+
},
|
|
6300
|
+
selectionSet: AGENT_MARKDOWN_FILE_SELECTION,
|
|
6301
|
+
schema: agentMarkdownFileSchema
|
|
6302
|
+
});
|
|
6303
|
+
}
|
|
6304
|
+
async function requestAgentMarkdownFile(params) {
|
|
6305
|
+
return requestOsmdQuery({
|
|
6306
|
+
command: params.command,
|
|
6307
|
+
operationName: "AgentMarkdownFile",
|
|
6308
|
+
runtimeOptions: params.runtimeOptions,
|
|
6309
|
+
field: "agent_markdown_file",
|
|
6310
|
+
variables: {
|
|
6311
|
+
organization_id: params.organizationId,
|
|
6312
|
+
path: params.path,
|
|
6313
|
+
parent_ref: params.parentRef
|
|
6314
|
+
},
|
|
6315
|
+
selectionSet: AGENT_MARKDOWN_FILE_SELECTION,
|
|
6316
|
+
schema: agentMarkdownFileSchema
|
|
6317
|
+
});
|
|
6318
|
+
}
|
|
6319
|
+
async function requestAgentMarkdownChildren(params) {
|
|
6320
|
+
return requestOsmdQuery({
|
|
6321
|
+
command: params.command,
|
|
6322
|
+
operationName: "AgentMarkdownChildren",
|
|
6323
|
+
runtimeOptions: params.runtimeOptions,
|
|
6324
|
+
field: "agent_markdown_children",
|
|
6325
|
+
variables: {
|
|
6326
|
+
organization_id: params.organizationId,
|
|
6327
|
+
path: params.path,
|
|
6328
|
+
parent_ref: params.parentRef,
|
|
6329
|
+
source: params.source
|
|
6330
|
+
},
|
|
6331
|
+
selectionSet: AGENT_MARKDOWN_FILE_SELECTION,
|
|
6332
|
+
schema: agentMarkdownFilesSchema
|
|
6333
|
+
});
|
|
6334
|
+
}
|
|
6335
|
+
async function runAgentMarkdownMutation(params) {
|
|
6336
|
+
const result = await graphqlRequest({
|
|
6337
|
+
config: getConfig(params.runtimeOptions),
|
|
6338
|
+
command: params.command,
|
|
6339
|
+
operationName: params.operationName,
|
|
6340
|
+
operationType: "mutation",
|
|
6341
|
+
field: params.field,
|
|
6342
|
+
variables: params.variables,
|
|
6343
|
+
selectionSet: MUTATION_RESULT_SELECTION
|
|
6344
|
+
});
|
|
6345
|
+
if (!result.envelope.ok) {
|
|
6346
|
+
return printEnvelopeAndExit(result);
|
|
6347
|
+
}
|
|
6348
|
+
const dataRecord = isRecord5(result.envelope.data) ? result.envelope.data : {};
|
|
6349
|
+
const parsedPayload = mutationPayloadSchema.safeParse(dataRecord[params.field]);
|
|
6350
|
+
if (!parsedPayload.success) {
|
|
6351
|
+
return printInvalidPayloadError({
|
|
6352
|
+
command: params.command,
|
|
6353
|
+
requestId: result.envelope.meta.requestId,
|
|
6354
|
+
issues: parsedPayload.error.issues
|
|
6355
|
+
});
|
|
6356
|
+
}
|
|
6357
|
+
const mutationPayload = parsedPayload.data;
|
|
6358
|
+
const parsedData = agentMarkdownMutationDataSchema.safeParse(
|
|
6359
|
+
normalizeAgentMarkdownJsonKeys(mutationPayload.data)
|
|
6360
|
+
);
|
|
6361
|
+
if (!parsedData.success) {
|
|
6362
|
+
return printInvalidPayloadError({
|
|
6363
|
+
command: params.command,
|
|
6364
|
+
requestId: result.envelope.meta.requestId,
|
|
6365
|
+
issues: parsedData.error.issues
|
|
6366
|
+
});
|
|
6367
|
+
}
|
|
6368
|
+
return printEnvelopeAndExit({
|
|
6369
|
+
envelope: buildSuccessEnvelope({
|
|
6370
|
+
command: params.command,
|
|
6371
|
+
status: mutationPayload.status,
|
|
6372
|
+
data: parsedData.data,
|
|
6373
|
+
requestId: result.envelope.meta.requestId
|
|
6374
|
+
})
|
|
6375
|
+
});
|
|
6376
|
+
}
|
|
6377
|
+
function normalizeAgentFilePath(file) {
|
|
6378
|
+
const trimmed = nonEmptyString3.parse(file).trim().replace(/^\/+|\/+$/g, "");
|
|
6379
|
+
const fileName = trimmed.startsWith(".agent/") ? trimmed.slice(".agent/".length) : trimmed;
|
|
6380
|
+
const parsed = agentOverlayFileSchema.safeParse(fileName);
|
|
6381
|
+
if (!parsed.success) {
|
|
6382
|
+
throw new CliError({
|
|
6383
|
+
message: ".agent supports only notes.md and log.md in this CLI slice.",
|
|
6384
|
+
kind: "invalid_args",
|
|
6385
|
+
status: 400,
|
|
6386
|
+
exitCode: EXIT_CODES.invalidArgs,
|
|
6387
|
+
details: { supportedFiles: ["notes.md", "log.md"] }
|
|
6388
|
+
});
|
|
6389
|
+
}
|
|
6390
|
+
return `.agent/${parsed.data}`;
|
|
6391
|
+
}
|
|
6392
|
+
function normalizeWikiPath(path) {
|
|
6393
|
+
const trimmed = nonEmptyString3.parse(path).trim().replace(/^\/+/, "");
|
|
6394
|
+
if (trimmed.localeCompare("Agent Wiki", void 0, { sensitivity: "accent" }) === 0) {
|
|
6395
|
+
return "Agent Wiki";
|
|
6396
|
+
}
|
|
6397
|
+
if (trimmed.toLowerCase().startsWith("agent wiki/")) {
|
|
6398
|
+
return `Agent Wiki/${trimmed.slice("Agent Wiki/".length)}`;
|
|
6399
|
+
}
|
|
6400
|
+
return `Agent Wiki/${trimmed}`;
|
|
6401
|
+
}
|
|
6402
|
+
function parseOptionalParentRef(value) {
|
|
6403
|
+
return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
|
|
6404
|
+
}
|
|
6405
|
+
function parseOptionalSource(value) {
|
|
6406
|
+
if (value === void 0 || value === null || value === "") {
|
|
6407
|
+
return void 0;
|
|
6408
|
+
}
|
|
6409
|
+
const parsed = sourceSchema.safeParse(value);
|
|
6410
|
+
if (!parsed.success) {
|
|
6411
|
+
throw new CliError({
|
|
6412
|
+
message: "Invalid OSMD source. Use canonical_osmd, agent_overlay, or agent_wiki.",
|
|
6413
|
+
kind: "invalid_args",
|
|
6414
|
+
status: 400,
|
|
6415
|
+
exitCode: EXIT_CODES.invalidArgs,
|
|
6416
|
+
details: { supportedSources: sourceSchema.options }
|
|
6417
|
+
});
|
|
6418
|
+
}
|
|
6419
|
+
return parsed.data;
|
|
6420
|
+
}
|
|
6421
|
+
function parseDepth(value) {
|
|
6422
|
+
if (value === void 0 || value === null || value === "") {
|
|
6423
|
+
return 1;
|
|
6424
|
+
}
|
|
6425
|
+
return nonNegativeInt3.parse(value);
|
|
6426
|
+
}
|
|
6427
|
+
function readContentStdin() {
|
|
6428
|
+
if (!contentStdinPromise) {
|
|
6429
|
+
contentStdinPromise = new Promise((resolve, reject) => {
|
|
6430
|
+
if (process.stdin.isTTY) {
|
|
6431
|
+
resolve("");
|
|
6432
|
+
return;
|
|
6433
|
+
}
|
|
6434
|
+
let data = "";
|
|
6435
|
+
process.stdin.setEncoding("utf8");
|
|
6436
|
+
process.stdin.on("data", (chunk) => {
|
|
6437
|
+
data += chunk;
|
|
6438
|
+
});
|
|
6439
|
+
process.stdin.on("end", () => resolve(data));
|
|
6440
|
+
process.stdin.on("error", reject);
|
|
6441
|
+
});
|
|
6442
|
+
}
|
|
6443
|
+
return contentStdinPromise;
|
|
6444
|
+
}
|
|
6445
|
+
async function resolveContentInput(opts, globals) {
|
|
6446
|
+
const hasContent = typeof opts.content === "string";
|
|
6447
|
+
const hasFile = typeof opts.file === "string" && opts.file.trim() !== "";
|
|
6448
|
+
if (hasContent && hasFile) {
|
|
6449
|
+
throw new CliError({
|
|
6450
|
+
message: "Use only one markdown content source: --content, --file, or stdin.",
|
|
6451
|
+
kind: "invalid_args",
|
|
6452
|
+
status: 400,
|
|
6453
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
6454
|
+
});
|
|
6455
|
+
}
|
|
6456
|
+
if (hasContent) {
|
|
6457
|
+
return String(opts.content);
|
|
6458
|
+
}
|
|
6459
|
+
if (hasFile) {
|
|
6460
|
+
try {
|
|
6461
|
+
return await readFile(opts.file, "utf8");
|
|
6462
|
+
} catch (error) {
|
|
6463
|
+
throw new CliError({
|
|
6464
|
+
message: `Unable to read markdown file: ${opts.file}`,
|
|
6465
|
+
kind: "invalid_args",
|
|
6466
|
+
status: 400,
|
|
6467
|
+
exitCode: EXIT_CODES.invalidArgs,
|
|
6468
|
+
details: {
|
|
6469
|
+
cause: error instanceof Error ? error.message : String(error)
|
|
6470
|
+
}
|
|
6471
|
+
});
|
|
6472
|
+
}
|
|
6473
|
+
}
|
|
6474
|
+
if (globals.tokenStdin === true || globals.authJsonStdin === true) {
|
|
6475
|
+
throw new CliError({
|
|
6476
|
+
message: "Markdown content cannot share stdin with --token-stdin or --auth-json-stdin. Use --content or --file.",
|
|
6477
|
+
kind: "invalid_args",
|
|
6478
|
+
status: 400,
|
|
6479
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
6480
|
+
});
|
|
6481
|
+
}
|
|
6482
|
+
const stdin = await readContentStdin();
|
|
6483
|
+
if (stdin.length === 0) {
|
|
6484
|
+
throw new CliError({
|
|
6485
|
+
message: "Provide markdown content with --content, --file, or stdin.",
|
|
6486
|
+
kind: "invalid_args",
|
|
6487
|
+
status: 400,
|
|
6488
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
6489
|
+
});
|
|
6490
|
+
}
|
|
6491
|
+
return stdin;
|
|
6492
|
+
}
|
|
6493
|
+
function writePreflightError(status, action) {
|
|
6494
|
+
if (status.errorCode) {
|
|
6495
|
+
return {
|
|
6496
|
+
code: status.errorCode,
|
|
6497
|
+
message: `OSMD write is not allowed: ${status.errorCode}.`,
|
|
6498
|
+
suggestedAction: status.suggestedAction,
|
|
6499
|
+
status: statusCodeForAgentError(status.errorCode)
|
|
6500
|
+
};
|
|
6501
|
+
}
|
|
6502
|
+
if (status.source === "canonical_osmd" || status.access === "read_only") {
|
|
6503
|
+
return {
|
|
6504
|
+
code: "canonical_osmd_read_only",
|
|
6505
|
+
message: "Canonical OSMD files are read-only. Write to .agent overlays or Agent Wiki.",
|
|
6506
|
+
suggestedAction: status.suggestedAction,
|
|
6507
|
+
status: 403
|
|
6508
|
+
};
|
|
6509
|
+
}
|
|
6510
|
+
if (action === "create") {
|
|
6511
|
+
if (status.exists) {
|
|
6512
|
+
return {
|
|
6513
|
+
code: "agent_file_already_exists",
|
|
6514
|
+
message: `Agent markdown file already exists: ${status.path}`,
|
|
6515
|
+
suggestedAction: status.suggestedAction,
|
|
6516
|
+
status: 409
|
|
6517
|
+
};
|
|
6518
|
+
}
|
|
6519
|
+
if (!status.canCreate) {
|
|
6520
|
+
return {
|
|
6521
|
+
code: status.access === "append_only" ? "append_only_violation" : "agent_path_forbidden",
|
|
6522
|
+
message: `Create is not allowed for ${status.path}.`,
|
|
6523
|
+
suggestedAction: status.suggestedAction,
|
|
6524
|
+
status: 403
|
|
6525
|
+
};
|
|
6526
|
+
}
|
|
6527
|
+
}
|
|
6528
|
+
if (action === "update") {
|
|
6529
|
+
if (!status.exists) {
|
|
6530
|
+
return {
|
|
6531
|
+
code: "agent_file_not_found",
|
|
6532
|
+
message: `Agent markdown file does not exist: ${status.path}`,
|
|
6533
|
+
suggestedAction: status.suggestedAction,
|
|
6534
|
+
status: 404
|
|
6535
|
+
};
|
|
6536
|
+
}
|
|
6537
|
+
if (!status.canUpdate) {
|
|
6538
|
+
return {
|
|
6539
|
+
code: status.access === "append_only" ? "append_only_violation" : "agent_path_forbidden",
|
|
6540
|
+
message: `Update is not allowed for ${status.path}.`,
|
|
6541
|
+
suggestedAction: status.suggestedAction,
|
|
6542
|
+
status: 403
|
|
6543
|
+
};
|
|
6544
|
+
}
|
|
6545
|
+
}
|
|
6546
|
+
if (action === "append") {
|
|
6547
|
+
if (!status.exists) {
|
|
6548
|
+
return {
|
|
6549
|
+
code: "agent_file_not_found",
|
|
6550
|
+
message: `Agent markdown file does not exist: ${status.path}`,
|
|
6551
|
+
suggestedAction: status.suggestedAction,
|
|
6552
|
+
status: 404
|
|
6553
|
+
};
|
|
6554
|
+
}
|
|
6555
|
+
if (!status.canAppend) {
|
|
6556
|
+
return {
|
|
6557
|
+
code: "append_only_violation",
|
|
6558
|
+
message: `Append is not allowed for ${status.path}.`,
|
|
6559
|
+
suggestedAction: status.suggestedAction,
|
|
6560
|
+
status: 403
|
|
6561
|
+
};
|
|
6562
|
+
}
|
|
6563
|
+
}
|
|
6564
|
+
return null;
|
|
6565
|
+
}
|
|
6566
|
+
function statusCodeForAgentError(code) {
|
|
6567
|
+
if (code === "agent_parent_not_found" || code === "agent_file_not_found") {
|
|
6568
|
+
return 404;
|
|
6569
|
+
}
|
|
6570
|
+
if (code === "agent_file_already_exists") {
|
|
6571
|
+
return 409;
|
|
6572
|
+
}
|
|
6573
|
+
if (code === "unsupported_agent_file" || code === "invalid_agent_wiki_path") {
|
|
6574
|
+
return 422;
|
|
6575
|
+
}
|
|
6576
|
+
return 403;
|
|
6577
|
+
}
|
|
6578
|
+
async function runWriteFlow(params) {
|
|
6579
|
+
const status = await requestAgentMarkdownStatus({
|
|
6580
|
+
command: `${params.command}.status`,
|
|
6581
|
+
runtimeOptions: params.runtimeOptions,
|
|
6582
|
+
organizationId: params.organizationId,
|
|
6583
|
+
path: params.path,
|
|
6584
|
+
parentRef: params.parentRef
|
|
6585
|
+
});
|
|
6586
|
+
const preflightError = writePreflightError(status.data, params.action);
|
|
6587
|
+
if (preflightError) {
|
|
6588
|
+
return printLocalError({
|
|
6589
|
+
command: params.command,
|
|
6590
|
+
status: preflightError.status,
|
|
6591
|
+
code: preflightError.code,
|
|
6592
|
+
message: preflightError.message,
|
|
6593
|
+
suggestedAction: preflightError.suggestedAction,
|
|
6594
|
+
requestId: status.requestId,
|
|
6595
|
+
data: status.data
|
|
6596
|
+
});
|
|
6597
|
+
}
|
|
6598
|
+
const mutation = {
|
|
6599
|
+
create: {
|
|
6600
|
+
operationName: "CreateAgentMarkdownFile",
|
|
6601
|
+
field: "create_agent_markdown_file"
|
|
6602
|
+
},
|
|
6603
|
+
update: {
|
|
6604
|
+
operationName: "UpdateAgentMarkdownFile",
|
|
6605
|
+
field: "update_agent_markdown_file"
|
|
6606
|
+
},
|
|
6607
|
+
append: {
|
|
6608
|
+
operationName: "AppendAgentMarkdownFile",
|
|
6609
|
+
field: "append_agent_markdown_file"
|
|
6610
|
+
}
|
|
6611
|
+
}[params.action];
|
|
6612
|
+
return runAgentMarkdownMutation({
|
|
6613
|
+
command: params.command,
|
|
6614
|
+
operationName: mutation.operationName,
|
|
6615
|
+
runtimeOptions: params.runtimeOptions,
|
|
6616
|
+
field: mutation.field,
|
|
6617
|
+
variables: {
|
|
6618
|
+
organization_id: params.organizationId,
|
|
6619
|
+
path: status.data.path,
|
|
6620
|
+
parent_ref: status.data.parentRef ?? params.parentRef,
|
|
6621
|
+
content: params.content
|
|
6622
|
+
}
|
|
6623
|
+
});
|
|
6624
|
+
}
|
|
6625
|
+
function addContentOptions(command) {
|
|
6626
|
+
return command.option("--content <content>", "Markdown content").option("--file <file>", "Read markdown content from a local file");
|
|
6627
|
+
}
|
|
6628
|
+
async function resolveOsmdContext(cmd) {
|
|
6629
|
+
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
6630
|
+
return {
|
|
6631
|
+
organizationId: resolveOrganizationId(context.organizationId),
|
|
6632
|
+
runtimeOptions: context.runtimeOptions
|
|
6633
|
+
};
|
|
6634
|
+
}
|
|
6635
|
+
function registerOsmdCommands(program) {
|
|
6636
|
+
const osmd = program.command("osmd").description("OSMD and agent markdown operations; canonical OSMD is read-only");
|
|
6637
|
+
osmd.command("tree").description("Read the canonical OSMD tree with source/access metadata").option("--depth <depth>", "Selection depth for nested children", "1").option("--tree-view").action(async (opts, cmd) => {
|
|
6638
|
+
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
6639
|
+
const depth = parseDepth(opts.depth);
|
|
6640
|
+
const result = await requestOsmdQuery({
|
|
6641
|
+
command: "osmd.tree",
|
|
6642
|
+
operationName: "MarkdownTreeRoot",
|
|
6643
|
+
runtimeOptions,
|
|
6644
|
+
field: "markdown_tree_root",
|
|
6645
|
+
variables: {
|
|
6646
|
+
organization_id: organizationId,
|
|
6647
|
+
tree_view: opts.treeView === true ? true : void 0
|
|
6648
|
+
},
|
|
6649
|
+
selectionSet: buildNodeSelectionSet(depth),
|
|
6650
|
+
schema: markdownTreeNodeSchema
|
|
6651
|
+
});
|
|
6652
|
+
return printEnvelopeAndExit({
|
|
6653
|
+
envelope: buildSuccessEnvelope({
|
|
6654
|
+
command: "osmd.tree",
|
|
6655
|
+
status: result.status,
|
|
6656
|
+
data: result.data,
|
|
6657
|
+
requestId: result.requestId
|
|
6658
|
+
})
|
|
6659
|
+
});
|
|
6660
|
+
});
|
|
6661
|
+
osmd.command("status <path>").description("Inspect canonical OSMD, .agent overlay, or Agent Wiki file metadata").option("--parent-ref <parentRef>", "Canonical OSMD parent ref for .agent files").action(async (path, opts, cmd) => {
|
|
6662
|
+
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
6663
|
+
const result = await requestAgentMarkdownStatus({
|
|
6664
|
+
command: "osmd.status",
|
|
6665
|
+
runtimeOptions,
|
|
6666
|
+
organizationId,
|
|
6667
|
+
path: nonEmptyString3.parse(path).trim(),
|
|
6668
|
+
parentRef: parseOptionalParentRef(opts.parentRef)
|
|
6669
|
+
});
|
|
6670
|
+
return printEnvelopeAndExit({
|
|
6671
|
+
envelope: buildSuccessEnvelope({
|
|
6672
|
+
command: "osmd.status",
|
|
6673
|
+
status: result.status,
|
|
6674
|
+
data: result.data,
|
|
6675
|
+
requestId: result.requestId
|
|
6676
|
+
})
|
|
6677
|
+
});
|
|
6678
|
+
});
|
|
6679
|
+
osmd.command("read <path>").description("Read canonical OSMD, .agent overlay, or Agent Wiki markdown without creating files").option("--parent-ref <parentRef>", "Canonical OSMD parent ref for .agent files").action(async (path, opts, cmd) => {
|
|
6680
|
+
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
6681
|
+
const result = await requestAgentMarkdownFile({
|
|
6682
|
+
command: "osmd.read",
|
|
6683
|
+
runtimeOptions,
|
|
6684
|
+
organizationId,
|
|
6685
|
+
path: nonEmptyString3.parse(path).trim(),
|
|
6686
|
+
parentRef: parseOptionalParentRef(opts.parentRef)
|
|
6687
|
+
});
|
|
6688
|
+
return printEnvelopeAndExit({
|
|
6689
|
+
envelope: buildSuccessEnvelope({
|
|
6690
|
+
command: "osmd.read",
|
|
6691
|
+
status: result.status,
|
|
6692
|
+
data: result.data,
|
|
6693
|
+
requestId: result.requestId
|
|
6694
|
+
})
|
|
6695
|
+
});
|
|
6696
|
+
});
|
|
6697
|
+
osmd.command("children [path]").description("List backend-supported agent markdown children; search remains canonical-only").option("--parent-ref <parentRef>", "Canonical OSMD parent ref for .agent files").option("--source <source>", "Filter by canonical_osmd, agent_overlay, or agent_wiki").action(async (path, opts, cmd) => {
|
|
6698
|
+
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
6699
|
+
const result = await requestAgentMarkdownChildren({
|
|
6700
|
+
command: "osmd.children",
|
|
6701
|
+
runtimeOptions,
|
|
6702
|
+
organizationId,
|
|
6703
|
+
path: typeof path === "string" && path.trim() !== "" ? path.trim() : void 0,
|
|
6704
|
+
parentRef: parseOptionalParentRef(opts.parentRef),
|
|
6705
|
+
source: parseOptionalSource(opts.source)
|
|
6706
|
+
});
|
|
6707
|
+
return printEnvelopeAndExit({
|
|
6708
|
+
envelope: buildSuccessEnvelope({
|
|
6709
|
+
command: "osmd.children",
|
|
6710
|
+
status: result.status,
|
|
6711
|
+
data: result.data,
|
|
6712
|
+
requestId: result.requestId
|
|
6713
|
+
})
|
|
6714
|
+
});
|
|
6715
|
+
});
|
|
6716
|
+
const agent = osmd.command("agent").description(".agent overlay files writable by agents; supports notes.md and log.md");
|
|
6717
|
+
agent.command("status <parent-ref> <file>").action(async (parentRef, file, _opts, cmd) => {
|
|
6718
|
+
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
6719
|
+
const result = await requestAgentMarkdownStatus({
|
|
6720
|
+
command: "osmd.agent.status",
|
|
6721
|
+
runtimeOptions,
|
|
6722
|
+
organizationId,
|
|
6723
|
+
path: normalizeAgentFilePath(file),
|
|
6724
|
+
parentRef: nonEmptyString3.parse(parentRef).trim()
|
|
6725
|
+
});
|
|
6726
|
+
return printEnvelopeAndExit({
|
|
6727
|
+
envelope: buildSuccessEnvelope({
|
|
6728
|
+
command: "osmd.agent.status",
|
|
6729
|
+
status: result.status,
|
|
6730
|
+
data: result.data,
|
|
6731
|
+
requestId: result.requestId
|
|
6732
|
+
})
|
|
6733
|
+
});
|
|
6734
|
+
});
|
|
6735
|
+
agent.command("init <parent-ref>").action(async (parentRef, _opts, cmd) => {
|
|
6736
|
+
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
6737
|
+
return runAgentMarkdownMutation({
|
|
6738
|
+
command: "osmd.agent.init",
|
|
6739
|
+
operationName: "InitAgentMarkdown",
|
|
6740
|
+
runtimeOptions,
|
|
6741
|
+
field: "init_agent_markdown",
|
|
6742
|
+
variables: {
|
|
6743
|
+
organization_id: organizationId,
|
|
6744
|
+
path: ".agent",
|
|
6745
|
+
parent_ref: nonEmptyString3.parse(parentRef).trim()
|
|
6746
|
+
}
|
|
6747
|
+
});
|
|
6748
|
+
});
|
|
6749
|
+
agent.command("read <parent-ref> <file>").action(async (parentRef, file, _opts, cmd) => {
|
|
6750
|
+
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
6751
|
+
const result = await requestAgentMarkdownFile({
|
|
6752
|
+
command: "osmd.agent.read",
|
|
6753
|
+
runtimeOptions,
|
|
6754
|
+
organizationId,
|
|
6755
|
+
path: normalizeAgentFilePath(file),
|
|
6756
|
+
parentRef: nonEmptyString3.parse(parentRef).trim()
|
|
6757
|
+
});
|
|
6758
|
+
return printEnvelopeAndExit({
|
|
6759
|
+
envelope: buildSuccessEnvelope({
|
|
6760
|
+
command: "osmd.agent.read",
|
|
6761
|
+
status: result.status,
|
|
6762
|
+
data: result.data,
|
|
6763
|
+
requestId: result.requestId
|
|
6764
|
+
})
|
|
6765
|
+
});
|
|
6766
|
+
});
|
|
6767
|
+
addContentOptions(agent.command("create <parent-ref> <file>")).action(
|
|
6768
|
+
async (parentRef, file, opts, cmd) => {
|
|
6769
|
+
const globals = cmd.optsWithGlobals();
|
|
6770
|
+
const content = await resolveContentInput(opts, globals);
|
|
6771
|
+
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
6772
|
+
return runWriteFlow({
|
|
6773
|
+
command: "osmd.agent.create",
|
|
6774
|
+
action: "create",
|
|
6775
|
+
runtimeOptions,
|
|
6776
|
+
organizationId,
|
|
6777
|
+
path: normalizeAgentFilePath(file),
|
|
6778
|
+
parentRef: nonEmptyString3.parse(parentRef).trim(),
|
|
6779
|
+
content
|
|
6780
|
+
});
|
|
6781
|
+
}
|
|
6782
|
+
);
|
|
6783
|
+
addContentOptions(agent.command("update <parent-ref> <file>")).action(
|
|
6784
|
+
async (parentRef, file, opts, cmd) => {
|
|
6785
|
+
const globals = cmd.optsWithGlobals();
|
|
6786
|
+
const content = await resolveContentInput(opts, globals);
|
|
6787
|
+
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
6788
|
+
return runWriteFlow({
|
|
6789
|
+
command: "osmd.agent.update",
|
|
6790
|
+
action: "update",
|
|
6791
|
+
runtimeOptions,
|
|
6792
|
+
organizationId,
|
|
6793
|
+
path: normalizeAgentFilePath(file),
|
|
6794
|
+
parentRef: nonEmptyString3.parse(parentRef).trim(),
|
|
6795
|
+
content
|
|
6796
|
+
});
|
|
6797
|
+
}
|
|
6798
|
+
);
|
|
6799
|
+
addContentOptions(agent.command("append <parent-ref> <file>")).action(
|
|
6800
|
+
async (parentRef, file, opts, cmd) => {
|
|
6801
|
+
const globals = cmd.optsWithGlobals();
|
|
6802
|
+
const content = await resolveContentInput(opts, globals);
|
|
6803
|
+
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
6804
|
+
return runWriteFlow({
|
|
6805
|
+
command: "osmd.agent.append",
|
|
6806
|
+
action: "append",
|
|
6807
|
+
runtimeOptions,
|
|
6808
|
+
organizationId,
|
|
6809
|
+
path: normalizeAgentFilePath(file),
|
|
6810
|
+
parentRef: nonEmptyString3.parse(parentRef).trim(),
|
|
6811
|
+
content
|
|
6812
|
+
});
|
|
6813
|
+
}
|
|
6814
|
+
);
|
|
6815
|
+
const wiki = osmd.command("wiki").description("Agent Wiki files writable by agents; first slice should use index.md and log.md");
|
|
6816
|
+
wiki.command("status <path>").action(async (path, _opts, cmd) => {
|
|
6817
|
+
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
6818
|
+
const result = await requestAgentMarkdownStatus({
|
|
6819
|
+
command: "osmd.wiki.status",
|
|
6820
|
+
runtimeOptions,
|
|
6821
|
+
organizationId,
|
|
6822
|
+
path: normalizeWikiPath(path)
|
|
6823
|
+
});
|
|
6824
|
+
return printEnvelopeAndExit({
|
|
6825
|
+
envelope: buildSuccessEnvelope({
|
|
6826
|
+
command: "osmd.wiki.status",
|
|
6827
|
+
status: result.status,
|
|
6828
|
+
data: result.data,
|
|
6829
|
+
requestId: result.requestId
|
|
6830
|
+
})
|
|
6831
|
+
});
|
|
6832
|
+
});
|
|
6833
|
+
wiki.command("read <path>").action(async (path, _opts, cmd) => {
|
|
6834
|
+
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
6835
|
+
const result = await requestAgentMarkdownFile({
|
|
6836
|
+
command: "osmd.wiki.read",
|
|
6837
|
+
runtimeOptions,
|
|
6838
|
+
organizationId,
|
|
6839
|
+
path: normalizeWikiPath(path)
|
|
6840
|
+
});
|
|
6841
|
+
return printEnvelopeAndExit({
|
|
6842
|
+
envelope: buildSuccessEnvelope({
|
|
6843
|
+
command: "osmd.wiki.read",
|
|
6844
|
+
status: result.status,
|
|
6845
|
+
data: result.data,
|
|
6846
|
+
requestId: result.requestId
|
|
6847
|
+
})
|
|
6848
|
+
});
|
|
6849
|
+
});
|
|
6850
|
+
wiki.command("children [path]").action(async (path, _opts, cmd) => {
|
|
6851
|
+
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
6852
|
+
const result = await requestAgentMarkdownChildren({
|
|
6853
|
+
command: "osmd.wiki.children",
|
|
6854
|
+
runtimeOptions,
|
|
6855
|
+
organizationId,
|
|
6856
|
+
path: typeof path === "string" && path.trim() !== "" ? normalizeWikiPath(path) : "Agent Wiki",
|
|
6857
|
+
source: "agent_wiki"
|
|
6858
|
+
});
|
|
6859
|
+
return printEnvelopeAndExit({
|
|
6860
|
+
envelope: buildSuccessEnvelope({
|
|
6861
|
+
command: "osmd.wiki.children",
|
|
6862
|
+
status: result.status,
|
|
6863
|
+
data: result.data,
|
|
6864
|
+
requestId: result.requestId
|
|
6865
|
+
})
|
|
6866
|
+
});
|
|
6867
|
+
});
|
|
6868
|
+
addContentOptions(wiki.command("create <path>")).action(async (path, opts, cmd) => {
|
|
6869
|
+
const globals = cmd.optsWithGlobals();
|
|
6870
|
+
const content = await resolveContentInput(opts, globals);
|
|
6871
|
+
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
6872
|
+
return runWriteFlow({
|
|
6873
|
+
command: "osmd.wiki.create",
|
|
6874
|
+
action: "create",
|
|
6875
|
+
runtimeOptions,
|
|
6876
|
+
organizationId,
|
|
6877
|
+
path: normalizeWikiPath(path),
|
|
6878
|
+
content
|
|
6879
|
+
});
|
|
6880
|
+
});
|
|
6881
|
+
addContentOptions(wiki.command("update <path>")).action(async (path, opts, cmd) => {
|
|
6882
|
+
const globals = cmd.optsWithGlobals();
|
|
6883
|
+
const content = await resolveContentInput(opts, globals);
|
|
6884
|
+
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
6885
|
+
return runWriteFlow({
|
|
6886
|
+
command: "osmd.wiki.update",
|
|
6887
|
+
action: "update",
|
|
6888
|
+
runtimeOptions,
|
|
6889
|
+
organizationId,
|
|
6890
|
+
path: normalizeWikiPath(path),
|
|
6891
|
+
content
|
|
6892
|
+
});
|
|
6893
|
+
});
|
|
6894
|
+
addContentOptions(wiki.command("append <path>")).action(async (path, opts, cmd) => {
|
|
6895
|
+
const globals = cmd.optsWithGlobals();
|
|
6896
|
+
const content = await resolveContentInput(opts, globals);
|
|
6897
|
+
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
6898
|
+
return runWriteFlow({
|
|
6899
|
+
command: "osmd.wiki.append",
|
|
6900
|
+
action: "append",
|
|
6901
|
+
runtimeOptions,
|
|
6902
|
+
organizationId,
|
|
6903
|
+
path: normalizeWikiPath(path),
|
|
6904
|
+
content
|
|
6905
|
+
});
|
|
6906
|
+
});
|
|
6907
|
+
}
|
|
6908
|
+
|
|
6074
6909
|
// src/cli.ts
|
|
6075
6910
|
function buildCli(options) {
|
|
6076
6911
|
const program = new Command();
|
|
@@ -6108,6 +6943,7 @@ function buildCli(options) {
|
|
|
6108
6943
|
registerContentCommands(program);
|
|
6109
6944
|
registerMutationCapabilityCommands(program);
|
|
6110
6945
|
registerMarkdownTreeCommands(program);
|
|
6946
|
+
registerOsmdCommands(program);
|
|
6111
6947
|
registerNavigationCommands(program);
|
|
6112
6948
|
return program;
|
|
6113
6949
|
}
|