@solidactions/cli 3.20.0 → 3.20.1
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.
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* solidactions doc pull <folder> [dest]
|
|
4
4
|
*
|
|
5
5
|
* Downloads a Docs folder tree from SA-Docs into a local markdown tree (the
|
|
6
|
-
* inverse of `doc push`): BFS-walks the folder via `
|
|
7
|
-
* bulk-fetches doc bodies via `
|
|
6
|
+
* inverse of `doc push`): BFS-walks the folder via `docs_read` `list`,
|
|
7
|
+
* bulk-fetches doc bodies via `docs_read` `bulk_read`, and writes each doc as
|
|
8
8
|
* <dest>/<relative-folder>/<sanitized-title>.md plus a revision manifest
|
|
9
9
|
* (<dest>/.solidactions-docs.json) recording id/title/current_revision_id
|
|
10
10
|
* per file for later diffing.
|
|
@@ -142,7 +142,7 @@ function lastSegment(folderPath) {
|
|
|
142
142
|
return segments[segments.length - 1] ?? folderPath;
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
145
|
-
* BFS-walk `folderPath` via `
|
|
145
|
+
* BFS-walk `folderPath` via `docs_read` `list`, collecting every doc row with
|
|
146
146
|
* its relative folder path. Returns null (with the list error message
|
|
147
147
|
* already known to the caller) if the root list call fails.
|
|
148
148
|
*/
|
|
@@ -152,7 +152,7 @@ async function listTree(config, folderPath) {
|
|
|
152
152
|
let first = true;
|
|
153
153
|
while (queue.length > 0) {
|
|
154
154
|
const { folder_path, relative } = queue.shift();
|
|
155
|
-
const result = await (0, mcp_1.callDocsTool)(config,
|
|
155
|
+
const result = await (0, mcp_1.callDocsTool)(config, { action: 'list', folder_path });
|
|
156
156
|
if (!result.ok) {
|
|
157
157
|
// A subfolder returned by the server itself failed to list is surfaced the
|
|
158
158
|
// same way as a root failure — only the root failure triggers the
|
|
@@ -188,7 +188,7 @@ async function fetchBodies(config, rows) {
|
|
|
188
188
|
const warnings = [];
|
|
189
189
|
for (let i = 0; i < rows.length; i += CHUNK_SIZE) {
|
|
190
190
|
const chunk = rows.slice(i, i + CHUNK_SIZE);
|
|
191
|
-
const result = await (0, mcp_1.callDocsTool)(config,
|
|
191
|
+
const result = await (0, mcp_1.callDocsTool)(config, {
|
|
192
192
|
action: 'bulk_read',
|
|
193
193
|
items: chunk.map((r) => ({ id: r.id })),
|
|
194
194
|
});
|
|
@@ -391,8 +391,8 @@ async function docPullWithConfig(folderPath, dest, options, config) {
|
|
|
391
391
|
usedSingleDocFallback = true;
|
|
392
392
|
const dir = path_1.default.dirname(folderPath);
|
|
393
393
|
const title = path_1.default.basename(folderPath);
|
|
394
|
-
const readArgs = { action: '
|
|
395
|
-
const readResult = await (0, mcp_1.callDocsTool)(config,
|
|
394
|
+
const readArgs = { action: 'read_doc', path: dir === '.' ? { title } : { folder_path: dir, title } };
|
|
395
|
+
const readResult = await (0, mcp_1.callDocsTool)(config, readArgs);
|
|
396
396
|
if (!readResult.ok) {
|
|
397
397
|
const readCode = readResult.data?.code ?? 'unknown_error';
|
|
398
398
|
const readMessage = readResult.data?.message ?? 'MCP returned an error with no message';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* solidactions doc push <dir>
|
|
4
4
|
*
|
|
5
5
|
* Recursively uploads a local markdown tree into SA-Docs via the docs MCP
|
|
6
|
-
* server's `
|
|
6
|
+
* server's `docs_manage` tool's `bulk_create` action, mirroring folder structure.
|
|
7
7
|
*
|
|
8
8
|
* Prints a report distinguishing fully-published docs from "properties pending"
|
|
9
9
|
* ones (docs whose frontmatter properties couldn't be validated yet).
|
|
@@ -170,7 +170,7 @@ async function docPushWithConfig(dir, options, config) {
|
|
|
170
170
|
// Partition into tracked (relative path present in the pull manifest) vs. untracked.
|
|
171
171
|
// A media doc titled *.md (e.g. `notes.md`) is bytes, not markdown — it's owned by
|
|
172
172
|
// the media pass below, not this markdown pass, or its bytes would be sent through
|
|
173
|
-
//
|
|
173
|
+
// docs_manage write as a text body and corrupt the doc.
|
|
174
174
|
const trackedFiles = [];
|
|
175
175
|
const untrackedFiles = [];
|
|
176
176
|
for (const f of allFiles) {
|
|
@@ -202,7 +202,7 @@ async function docPushWithConfig(dir, options, config) {
|
|
|
202
202
|
trackedUnchanged.push({ file: relPath, id: entry.id });
|
|
203
203
|
continue;
|
|
204
204
|
}
|
|
205
|
-
// --dry-run must never live-write: preview the tracked doc instead of calling
|
|
205
|
+
// --dry-run must never live-write: preview the tracked doc instead of calling docs_manage write.
|
|
206
206
|
if (options.dryRun) {
|
|
207
207
|
trackedPlanned.push({ file: relPath, id: entry.id });
|
|
208
208
|
continue;
|
|
@@ -213,7 +213,7 @@ async function docPushWithConfig(dir, options, config) {
|
|
|
213
213
|
}
|
|
214
214
|
let mcpResult;
|
|
215
215
|
try {
|
|
216
|
-
mcpResult = await (0, mcp_1.callDocsTool)(config,
|
|
216
|
+
mcpResult = await (0, mcp_1.callDocsTool)(config, editArgs);
|
|
217
217
|
}
|
|
218
218
|
catch (e) {
|
|
219
219
|
process.stderr.write(chalk_1.default.red(`error: ${e.message}\n`));
|
|
@@ -299,7 +299,7 @@ async function docPushWithConfig(dir, options, config) {
|
|
|
299
299
|
process.stderr.write(chalk_1.default.red(`error: ${relPath}: ${data?.message ?? error.message}\n`));
|
|
300
300
|
process.exit(1);
|
|
301
301
|
}
|
|
302
|
-
// The REST presenter names the revision `current_version_id`; MCP
|
|
302
|
+
// The REST presenter names the revision `current_version_id`; MCP docs_manage write
|
|
303
303
|
// names it `current_revision_id`. Reading the wrong one nulls the entry and
|
|
304
304
|
// silently disarms the drift guard on every later push.
|
|
305
305
|
entry.current_revision_id = doc?.current_version_id ?? entry.current_revision_id;
|
|
@@ -351,7 +351,7 @@ async function docPushWithConfig(dir, options, config) {
|
|
|
351
351
|
}
|
|
352
352
|
let mcpResult;
|
|
353
353
|
try {
|
|
354
|
-
mcpResult = await (0, mcp_1.callDocsTool)(config,
|
|
354
|
+
mcpResult = await (0, mcp_1.callDocsTool)(config, callArgs);
|
|
355
355
|
}
|
|
356
356
|
catch (e) {
|
|
357
357
|
process.stderr.write(chalk_1.default.red(`error: ${e.message}\n`));
|
package/dist/utils/mcp.js
CHANGED
|
@@ -44,6 +44,7 @@ exports.McpRpcError = void 0;
|
|
|
44
44
|
exports.retryAfterSeconds = retryAfterSeconds;
|
|
45
45
|
exports.resolveCrewsCall = resolveCrewsCall;
|
|
46
46
|
exports.callCrewsTool = callCrewsTool;
|
|
47
|
+
exports.resolveDocsCall = resolveDocsCall;
|
|
47
48
|
exports.callDocsTool = callDocsTool;
|
|
48
49
|
exports.callCrewsToolContent = callCrewsToolContent;
|
|
49
50
|
const http = __importStar(require("http"));
|
|
@@ -239,11 +240,39 @@ async function callCrewsTool(config, toolName, args) {
|
|
|
239
240
|
}
|
|
240
241
|
return callMcpTool(config, UNIFIED_MCP_PATH, toolName, args);
|
|
241
242
|
}
|
|
243
|
+
// Current catalog (solidactions-app ToolCatalog.php): the public docs tool depends on the action.
|
|
244
|
+
// Call sites send the public action names, so only the tool is routed (no action/param renames).
|
|
245
|
+
// Only actions the CLI actually sends are routed; anything else throws in resolveDocsCall.
|
|
246
|
+
const DOCS_ROUTES = {
|
|
247
|
+
list: 'docs_read',
|
|
248
|
+
bulk_read: 'docs_read',
|
|
249
|
+
read_doc: 'docs_read',
|
|
250
|
+
bulk_create: 'docs_manage',
|
|
251
|
+
write: 'docs_manage',
|
|
252
|
+
};
|
|
242
253
|
/**
|
|
243
|
-
*
|
|
254
|
+
* Map a docs call (public action name) to the public MCP tool of the current
|
|
255
|
+
* catalog. Throws for an action the CLI has no route for; drops undefined values.
|
|
244
256
|
*/
|
|
245
|
-
|
|
246
|
-
|
|
257
|
+
function resolveDocsCall(args) {
|
|
258
|
+
const action = String(args.action ?? '');
|
|
259
|
+
const tool = DOCS_ROUTES[action];
|
|
260
|
+
if (!tool)
|
|
261
|
+
throw new Error(`unsupported docs action: ${action}`);
|
|
262
|
+
const out = {};
|
|
263
|
+
for (const [k, v] of Object.entries(args)) {
|
|
264
|
+
if (v === undefined)
|
|
265
|
+
continue;
|
|
266
|
+
out[k] = v;
|
|
267
|
+
}
|
|
268
|
+
return { tool, args: out };
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Call a docs MCP tool on the unified /mcp endpoint; the tool is resolved from the action.
|
|
272
|
+
*/
|
|
273
|
+
async function callDocsTool(config, args) {
|
|
274
|
+
const r = resolveDocsCall(args);
|
|
275
|
+
return callMcpTool(config, UNIFIED_MCP_PATH, r.tool, r.args);
|
|
247
276
|
}
|
|
248
277
|
/**
|
|
249
278
|
* Call a crews MCP tool and return the RAW content blocks. Needed for
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* and checking which HTTP verb it sends. Most commands call axios directly
|
|
11
11
|
* (GET = read, POST/PUT/PATCH/DELETE = write). The MCP-backed commands
|
|
12
12
|
* (crews/roles tools: skill push/publish/pull/list/view/delete, role push;
|
|
13
|
-
*
|
|
13
|
+
* docs_read/docs_manage tools: doc push/pull) are transported as a single JSON-RPC
|
|
14
14
|
* `tools/call` POST regardless of semantics (see `postMcpTool` in
|
|
15
15
|
* src/utils/mcp.ts) — for those, the classification follows the MCP tool's
|
|
16
16
|
* `action` argument instead of the outer HTTP verb ('list'/'read' = read,
|