@brucewaynedecoy/make-docs 2.0.4 → 2.0.6
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/{backup-CM7RL2Q7.js → backup-P5NUPAJL.js} +4 -4
- package/dist/{chunk-M7DMFIKU.js → chunk-2WC74W66.js} +224 -20
- package/dist/chunk-2WC74W66.js.map +1 -0
- package/dist/{chunk-OR5ZVGLG.js → chunk-B7QF7XZT.js} +151 -5
- package/dist/chunk-B7QF7XZT.js.map +1 -0
- package/dist/{chunk-LV3CBXZB.js → chunk-DNPFQB24.js} +3 -3
- package/dist/{chunk-52FTNVXS.js → chunk-EF47XIIR.js} +8977 -2891
- package/dist/chunk-EF47XIIR.js.map +1 -0
- package/dist/{chunk-GERMRLJ2.js → chunk-KFYUB4AX.js} +6 -4
- package/dist/chunk-KFYUB4AX.js.map +1 -0
- package/dist/{chunk-ADVNSMA7.js → chunk-LK6BLVZA.js} +3 -3
- package/dist/{chunk-65QWMODG.js → chunk-PI7W5QDB.js} +3 -3
- package/dist/{chunk-65QWMODG.js.map → chunk-PI7W5QDB.js.map} +1 -1
- package/dist/{chunk-YVSASZMT.js → chunk-SFKYGFUV.js} +277 -79
- package/dist/chunk-SFKYGFUV.js.map +1 -0
- package/dist/{chunk-J5QDGRZ7.js → chunk-TDB6UW4M.js} +116 -37
- package/dist/chunk-TDB6UW4M.js.map +1 -0
- package/dist/{chunk-7R2PPKTB.js → chunk-XFFESINU.js} +2 -2
- package/dist/index.js +408 -86
- package/dist/index.js.map +1 -1
- package/dist/registry-44WLX4F5.js +50 -0
- package/dist/registry-44WLX4F5.js.map +1 -0
- package/dist/{self-36ULRIJ6.js → self-WRWI5XNE.js} +10 -10
- package/dist/server-FYRDPOBR.js +1117 -0
- package/dist/server-FYRDPOBR.js.map +1 -0
- package/dist/{setup-system-JI36YJ6D.js → setup-system-XX6NSVXZ.js} +263 -40
- package/dist/setup-system-XX6NSVXZ.js.map +1 -0
- package/dist/{skills-command-IGDVLNKY.js → skills-command-YAQP24JM.js} +17 -7
- package/dist/skills-command-YAQP24JM.js.map +1 -0
- package/dist/{uninstall-VBGMQQLA.js → uninstall-3YJKZ6UF.js} +9 -9
- package/dist/virtual_make-docs-first-party-skills-5TYTCD5U.js +11 -0
- package/dist/virtual_make-docs-first-party-skills-5TYTCD5U.js.map +1 -0
- package/package.json +5 -5
- package/skill-registry.json +24 -8
- package/skill-registry.schema.json +2 -1
- package/template/.make-docs/system/contracts/system-resource-contract.md +16 -0
- package/template/.make-docs/system-resources.catalog.json +415 -0
- package/template/.make-docs/system-resources.schema.json +25 -0
- package/dist/chunk-52FTNVXS.js.map +0 -1
- package/dist/chunk-GERMRLJ2.js.map +0 -1
- package/dist/chunk-J5QDGRZ7.js.map +0 -1
- package/dist/chunk-M7DMFIKU.js.map +0 -1
- package/dist/chunk-OR5ZVGLG.js.map +0 -1
- package/dist/chunk-YVSASZMT.js.map +0 -1
- package/dist/server-H754TA4Q.js +0 -512
- package/dist/server-H754TA4Q.js.map +0 -1
- package/dist/setup-system-JI36YJ6D.js.map +0 -1
- package/dist/skills-command-IGDVLNKY.js.map +0 -1
- package/dist/virtual_make-docs-first-party-skills-H3FC47C2.js +0 -11
- package/dist/virtual_make-docs-first-party-skills-H3FC47C2.js.map +0 -1
- /package/dist/{backup-CM7RL2Q7.js.map → backup-P5NUPAJL.js.map} +0 -0
- /package/dist/{chunk-LV3CBXZB.js.map → chunk-DNPFQB24.js.map} +0 -0
- /package/dist/{chunk-ADVNSMA7.js.map → chunk-LK6BLVZA.js.map} +0 -0
- /package/dist/{chunk-7R2PPKTB.js.map → chunk-XFFESINU.js.map} +0 -0
- /package/dist/{self-36ULRIJ6.js.map → self-WRWI5XNE.js.map} +0 -0
- /package/dist/{uninstall-VBGMQQLA.js.map → uninstall-3YJKZ6UF.js.map} +0 -0
package/dist/server-H754TA4Q.js
DELETED
|
@@ -1,512 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
classifyCompatibilityState
|
|
4
|
-
} from "./chunk-ADVNSMA7.js";
|
|
5
|
-
import {
|
|
6
|
-
ResourceOperationError,
|
|
7
|
-
createExecutionContext,
|
|
8
|
-
external_exports,
|
|
9
|
-
getOperation,
|
|
10
|
-
invokeOperation,
|
|
11
|
-
listOperationAccessFacts,
|
|
12
|
-
listOperations,
|
|
13
|
-
serializeOperationError
|
|
14
|
-
} from "./chunk-52FTNVXS.js";
|
|
15
|
-
import "./chunk-GERMRLJ2.js";
|
|
16
|
-
import "./chunk-J5QDGRZ7.js";
|
|
17
|
-
import {
|
|
18
|
-
findReviewableManagedFileConflicts,
|
|
19
|
-
getConfigRenderingLabels,
|
|
20
|
-
loadMakeDocsConfigOrThrow,
|
|
21
|
-
planInstall
|
|
22
|
-
} from "./chunk-OR5ZVGLG.js";
|
|
23
|
-
import "./chunk-7R2PPKTB.js";
|
|
24
|
-
import {
|
|
25
|
-
HARNESS_CALLER_IDENTITY_ENV
|
|
26
|
-
} from "./chunk-M7DMFIKU.js";
|
|
27
|
-
import {
|
|
28
|
-
cloneSelections,
|
|
29
|
-
defaultSelections,
|
|
30
|
-
loadManifest,
|
|
31
|
-
readPackageMeta
|
|
32
|
-
} from "./chunk-YVSASZMT.js";
|
|
33
|
-
import "./chunk-D4HDZEJT.js";
|
|
34
|
-
|
|
35
|
-
// src/mcp/server.ts
|
|
36
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
37
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
38
|
-
import {
|
|
39
|
-
ListResourcesRequestSchema,
|
|
40
|
-
ReadResourceRequestSchema
|
|
41
|
-
} from "@modelcontextprotocol/sdk/types.js";
|
|
42
|
-
|
|
43
|
-
// src/mcp/resources.ts
|
|
44
|
-
import path from "path";
|
|
45
|
-
import { ErrorCode, McpError } from "@modelcontextprotocol/sdk/types.js";
|
|
46
|
-
function throwNativeResourceError(error) {
|
|
47
|
-
if (error instanceof ResourceOperationError) {
|
|
48
|
-
throw new McpError(ErrorCode.InvalidParams, error.message, {
|
|
49
|
-
makeDocs: {
|
|
50
|
-
code: error.code,
|
|
51
|
-
recovery: error.recovery,
|
|
52
|
-
...error.uri ? { uri: error.uri } : {},
|
|
53
|
-
...error.path ? { path: error.path } : {}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
throw error;
|
|
58
|
-
}
|
|
59
|
-
async function listNativeMcpResources(targetRoot = process.cwd()) {
|
|
60
|
-
const invocation = await invokeOperation(
|
|
61
|
-
"resource.list",
|
|
62
|
-
{ targetRoot: path.resolve(targetRoot) },
|
|
63
|
-
createExecutionContext({
|
|
64
|
-
surface: "mcp",
|
|
65
|
-
route: "mcp",
|
|
66
|
-
callerIdentityRaw: process.env[HARNESS_CALLER_IDENTITY_ENV],
|
|
67
|
-
cwd: targetRoot
|
|
68
|
-
})
|
|
69
|
-
).catch(throwNativeResourceError);
|
|
70
|
-
const value = invocation.value;
|
|
71
|
-
return {
|
|
72
|
-
resources: value.resources.map((entry) => {
|
|
73
|
-
if (!entry.result.ok) {
|
|
74
|
-
return {
|
|
75
|
-
uri: entry.uri,
|
|
76
|
-
name: entry.uri,
|
|
77
|
-
description: "Unavailable Make Docs system resource.",
|
|
78
|
-
_meta: { makeDocs: { error: entry.result.error } }
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
uri: entry.uri,
|
|
83
|
-
name: entry.uri,
|
|
84
|
-
description: "Make Docs system resource.",
|
|
85
|
-
mimeType: String(entry.result.value.mediaType),
|
|
86
|
-
size: Number(entry.result.value.byteLength),
|
|
87
|
-
_meta: { makeDocs: entry.result.value }
|
|
88
|
-
};
|
|
89
|
-
})
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
async function readNativeMcpResource(uri, targetRoot = process.cwd()) {
|
|
93
|
-
const invocation = await invokeOperation(
|
|
94
|
-
"resource.read",
|
|
95
|
-
{ uri, targetRoot: path.resolve(targetRoot) },
|
|
96
|
-
createExecutionContext({
|
|
97
|
-
surface: "mcp",
|
|
98
|
-
route: "mcp",
|
|
99
|
-
callerIdentityRaw: process.env[HARNESS_CALLER_IDENTITY_ENV],
|
|
100
|
-
cwd: targetRoot
|
|
101
|
-
})
|
|
102
|
-
).catch(throwNativeResourceError);
|
|
103
|
-
const value = invocation.value;
|
|
104
|
-
const { content, ...metadata } = value.resource;
|
|
105
|
-
return {
|
|
106
|
-
contents: [
|
|
107
|
-
{
|
|
108
|
-
uri: value.resource.identity.uri,
|
|
109
|
-
mimeType: value.resource.mediaType,
|
|
110
|
-
blob: content.data,
|
|
111
|
-
_meta: { makeDocs: metadata }
|
|
112
|
-
}
|
|
113
|
-
]
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// src/mcp/tools.ts
|
|
118
|
-
import path4 from "path";
|
|
119
|
-
|
|
120
|
-
// src/operations/closeout/index.ts
|
|
121
|
-
import {
|
|
122
|
-
existsSync,
|
|
123
|
-
mkdirSync,
|
|
124
|
-
readdirSync,
|
|
125
|
-
statSync,
|
|
126
|
-
writeFileSync
|
|
127
|
-
} from "fs";
|
|
128
|
-
import path2 from "path";
|
|
129
|
-
import { spawnSync } from "child_process";
|
|
130
|
-
|
|
131
|
-
// src/operations/lifecycle/index.ts
|
|
132
|
-
import { existsSync as existsSync2, readdirSync as readdirSync2, rmdirSync, rmSync } from "fs";
|
|
133
|
-
import path3 from "path";
|
|
134
|
-
|
|
135
|
-
// src/operations/index.ts
|
|
136
|
-
function listOperationDomains() {
|
|
137
|
-
const domains = /* @__PURE__ */ new Map();
|
|
138
|
-
for (const operation of listOperations()) {
|
|
139
|
-
let domain = domains.get(operation.domain);
|
|
140
|
-
if (!domain) {
|
|
141
|
-
domain = { name: operation.domain, commands: [] };
|
|
142
|
-
domains.set(operation.domain, domain);
|
|
143
|
-
}
|
|
144
|
-
domain.commands.push({
|
|
145
|
-
id: operation.id,
|
|
146
|
-
summary: operation.summary,
|
|
147
|
-
mutates: operation.mutates === "write",
|
|
148
|
-
status: operation.status
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
return [...domains.values()];
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// src/mcp/tools.ts
|
|
155
|
-
var targetDirSchema = external_exports.string().optional().describe("Project root to inspect. Defaults to the current working directory.");
|
|
156
|
-
var systemAssetMaterializationModeSchema = external_exports.enum([
|
|
157
|
-
"full-snapshot",
|
|
158
|
-
"provider-backed",
|
|
159
|
-
"hybrid-pinned-cache"
|
|
160
|
-
]);
|
|
161
|
-
var HAND_DEFINED_MCP_TOOLS = [
|
|
162
|
-
{
|
|
163
|
-
name: "make_docs_operation_domains",
|
|
164
|
-
title: "List Make Docs Operation Domains",
|
|
165
|
-
description: "List deterministic operation domains shared by CLI and MCP tools.",
|
|
166
|
-
inputSchema: {}
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
name: "make_docs_installed_state",
|
|
170
|
-
title: "Inspect Make Docs Installed State",
|
|
171
|
-
description: "Inspect manifest, config, compatibility, and package state for a make-docs project.",
|
|
172
|
-
inputSchema: { targetDir: targetDirSchema }
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
name: "make_docs_manifest_read",
|
|
176
|
-
title: "Read Make Docs Manifest",
|
|
177
|
-
description: "Read .make-docs/manifest.json without mutating the project.",
|
|
178
|
-
inputSchema: { targetDir: targetDirSchema }
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
name: "make_docs_config_read",
|
|
182
|
-
title: "Read Make Docs Config",
|
|
183
|
-
description: "Read .make-docs/config.yaml with default overlay diagnostics.",
|
|
184
|
-
inputSchema: { targetDir: targetDirSchema }
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
name: "make_docs_compatibility_classify",
|
|
188
|
-
title: "Classify Make Docs Compatibility State",
|
|
189
|
-
description: "Run the same compatibility classifier used by the CLI.",
|
|
190
|
-
inputSchema: { targetDir: targetDirSchema }
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
name: "make_docs_install_plan",
|
|
194
|
-
title: "Plan Make Docs Install Or Sync",
|
|
195
|
-
description: "Create a dry-run install/sync plan using CLI planner semantics and without file writes.",
|
|
196
|
-
inputSchema: {
|
|
197
|
-
targetDir: targetDirSchema,
|
|
198
|
-
selections: external_exports.unknown().optional().describe("Optional InstallSelections override."),
|
|
199
|
-
systemAssetMaterializationMode: systemAssetMaterializationModeSchema.optional()
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
];
|
|
203
|
-
function deriveMcpToolName(operationId) {
|
|
204
|
-
return `make_docs_${operationId.replace(/[.-]/g, "_")}`;
|
|
205
|
-
}
|
|
206
|
-
var allowWriteSchema = external_exports.boolean().optional().describe(
|
|
207
|
-
"Set true to permit this mutating operation to write. Enforced uniformly by the operation core."
|
|
208
|
-
);
|
|
209
|
-
var dryRunSchema = external_exports.boolean().optional().describe("Set true to plan rather than write; rides the execution context, not the input.");
|
|
210
|
-
var approvalsSchema = external_exports.array(external_exports.string()).optional().describe(
|
|
211
|
-
"Named approval tokens granted to the operation (e.g. reviewed-overwrite); rides the execution context, not the input."
|
|
212
|
-
);
|
|
213
|
-
function operationInputShape(schema) {
|
|
214
|
-
if (schema instanceof external_exports.ZodObject) {
|
|
215
|
-
return { ...schema.shape };
|
|
216
|
-
}
|
|
217
|
-
return {};
|
|
218
|
-
}
|
|
219
|
-
function deriveToolInputSchema(definition) {
|
|
220
|
-
return {
|
|
221
|
-
...operationInputShape(definition.inputSchema),
|
|
222
|
-
...definition.mutates === "write" ? { allowWrite: allowWriteSchema } : {},
|
|
223
|
-
dryRun: dryRunSchema,
|
|
224
|
-
approvals: approvalsSchema
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
function deriveToolDescription(definition) {
|
|
228
|
-
const parts = [
|
|
229
|
-
definition.summary,
|
|
230
|
-
`Access: Store ${definition.access.store}; project ${definition.access.project}; host configuration ${definition.access.hostConfig}.`
|
|
231
|
-
];
|
|
232
|
-
if (definition.status === "pending") {
|
|
233
|
-
parts.push(
|
|
234
|
-
`Pending: reserved registry identifier whose semantics land with ${definition.pendingLineage}; invocation is refused until then.`
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
if (definition.mutates === "write") {
|
|
238
|
-
parts.push("Mutating operation: requires allowWrite=true, enforced by the operation core.");
|
|
239
|
-
}
|
|
240
|
-
return parts.join(" ");
|
|
241
|
-
}
|
|
242
|
-
var DERIVED_MCP_OPERATION_TOOLS = listOperations().map(
|
|
243
|
-
(operation) => {
|
|
244
|
-
const definition = getOperation(operation.id);
|
|
245
|
-
const accessFact = listOperationAccessFacts().find((fact) => fact.operation === operation.id);
|
|
246
|
-
return {
|
|
247
|
-
name: deriveMcpToolName(operation.id),
|
|
248
|
-
operation: operation.id,
|
|
249
|
-
title: `Make Docs Operation ${operation.id}`,
|
|
250
|
-
description: deriveToolDescription(definition),
|
|
251
|
-
inputSchema: deriveToolInputSchema(definition),
|
|
252
|
-
access: { ...accessFact.access },
|
|
253
|
-
mcpReady: accessFact.mcpReady
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
);
|
|
257
|
-
var DERIVED_TOOLS_BY_NAME = new Map(
|
|
258
|
-
DERIVED_MCP_OPERATION_TOOLS.map((tool) => [tool.name, tool])
|
|
259
|
-
);
|
|
260
|
-
var MAKE_DOCS_MCP_TOOLS = [
|
|
261
|
-
...HAND_DEFINED_MCP_TOOLS,
|
|
262
|
-
...DERIVED_MCP_OPERATION_TOOLS
|
|
263
|
-
];
|
|
264
|
-
function listMakeDocsMcpTools(targetRoot = process.cwd()) {
|
|
265
|
-
void targetRoot;
|
|
266
|
-
return MAKE_DOCS_MCP_TOOLS.map((tool) => {
|
|
267
|
-
if (!tool.operation || !tool.access) return tool;
|
|
268
|
-
return { ...tool, access: { ...tool.access } };
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
async function callMakeDocsMcpTool(name, args = {}) {
|
|
272
|
-
switch (name) {
|
|
273
|
-
case "make_docs_operation_domains":
|
|
274
|
-
return mcpPayload(name, listOperationDomains());
|
|
275
|
-
case "make_docs_installed_state":
|
|
276
|
-
return mcpPayload(name, await readInstalledState(resolveTargetDir(args)));
|
|
277
|
-
case "make_docs_manifest_read":
|
|
278
|
-
return mcpPayload(name, readManifest(resolveTargetDir(args)));
|
|
279
|
-
case "make_docs_config_read":
|
|
280
|
-
return mcpPayload(name, readConfig(resolveTargetDir(args)));
|
|
281
|
-
case "make_docs_compatibility_classify":
|
|
282
|
-
return mcpPayload(
|
|
283
|
-
name,
|
|
284
|
-
await classifyCompatibilityState({ targetDir: resolveTargetDir(args) })
|
|
285
|
-
);
|
|
286
|
-
case "make_docs_install_plan":
|
|
287
|
-
return mcpPayload(name, await buildInstallPlan(resolveTargetDir(args), args));
|
|
288
|
-
}
|
|
289
|
-
const derived = DERIVED_TOOLS_BY_NAME.get(name);
|
|
290
|
-
if (derived === void 0) {
|
|
291
|
-
throw new Error(`Unknown make-docs MCP tool: ${name}`);
|
|
292
|
-
}
|
|
293
|
-
const targetRoot = resolveOperationTargetDir(args);
|
|
294
|
-
const effective = listMakeDocsMcpTools(targetRoot).find((tool) => tool.name === name);
|
|
295
|
-
return mcpPayload(name, await invokeDerivedOperationTool(derived.operation, args), {
|
|
296
|
-
operation: derived.operation,
|
|
297
|
-
access: { ...derived.access },
|
|
298
|
-
mcpReady: effective?.mcpReady === true
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
async function invokeDerivedOperationTool(id, args) {
|
|
302
|
-
const { allowWrite, dryRun, approvals, ...input } = args;
|
|
303
|
-
const invocation = await invokeOperation(
|
|
304
|
-
id,
|
|
305
|
-
input,
|
|
306
|
-
createExecutionContext({
|
|
307
|
-
surface: "mcp",
|
|
308
|
-
route: "mcp",
|
|
309
|
-
callerIdentityRaw: process.env[HARNESS_CALLER_IDENTITY_ENV],
|
|
310
|
-
writesAllowed: allowWrite === true,
|
|
311
|
-
dryRun: dryRun === true,
|
|
312
|
-
approvals: Array.isArray(approvals) ? approvals.map(String) : []
|
|
313
|
-
})
|
|
314
|
-
);
|
|
315
|
-
return invocation.value;
|
|
316
|
-
}
|
|
317
|
-
async function readInstalledState(targetDir) {
|
|
318
|
-
return {
|
|
319
|
-
targetDir,
|
|
320
|
-
package: readPackageMeta(),
|
|
321
|
-
manifest: readManifest(targetDir),
|
|
322
|
-
config: readConfig(targetDir),
|
|
323
|
-
compatibility: await classifyCompatibilityState({ targetDir }),
|
|
324
|
-
operationDomains: listOperationDomains()
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
function readManifest(targetDir) {
|
|
328
|
-
const manifest = loadManifest(targetDir);
|
|
329
|
-
return {
|
|
330
|
-
targetDir,
|
|
331
|
-
present: manifest !== null,
|
|
332
|
-
manifest
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
function readConfig(targetDir) {
|
|
336
|
-
const loaded = loadMakeDocsConfigOrThrow(targetDir);
|
|
337
|
-
return {
|
|
338
|
-
targetDir,
|
|
339
|
-
present: loaded.present,
|
|
340
|
-
valid: loaded.valid,
|
|
341
|
-
configPath: loaded.configPath,
|
|
342
|
-
diagnostics: loaded.diagnostics,
|
|
343
|
-
config: loaded.config,
|
|
344
|
-
renderingLabels: getConfigRenderingLabels(loaded.config)
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
async function buildInstallPlan(targetDir, args) {
|
|
348
|
-
const existingManifest = loadManifest(targetDir);
|
|
349
|
-
const selections = resolveSelections(existingManifest?.selections, args.selections);
|
|
350
|
-
const plan = await planInstall({
|
|
351
|
-
targetDir,
|
|
352
|
-
selections,
|
|
353
|
-
existingManifest,
|
|
354
|
-
packageMeta: readPackageMeta(),
|
|
355
|
-
systemAssetMaterializationMode: systemAssetMaterializationModeSchema.optional().parse(
|
|
356
|
-
args.systemAssetMaterializationMode
|
|
357
|
-
)
|
|
358
|
-
});
|
|
359
|
-
const conflicts = findReviewableManagedFileConflicts(plan);
|
|
360
|
-
return summarizeInstallPlan(plan, conflicts);
|
|
361
|
-
}
|
|
362
|
-
function summarizeInstallPlan(plan, conflicts) {
|
|
363
|
-
const counts = {
|
|
364
|
-
create: 0,
|
|
365
|
-
generate: 0,
|
|
366
|
-
noop: 0,
|
|
367
|
-
removeManaged: 0,
|
|
368
|
-
skipConflict: 0,
|
|
369
|
-
update: 0,
|
|
370
|
-
updateConflict: 0
|
|
371
|
-
};
|
|
372
|
-
for (const action of plan.actions) {
|
|
373
|
-
switch (action.type) {
|
|
374
|
-
case "create":
|
|
375
|
-
counts.create += 1;
|
|
376
|
-
break;
|
|
377
|
-
case "generate":
|
|
378
|
-
counts.generate += 1;
|
|
379
|
-
break;
|
|
380
|
-
case "noop":
|
|
381
|
-
counts.noop += 1;
|
|
382
|
-
break;
|
|
383
|
-
case "remove-managed":
|
|
384
|
-
counts.removeManaged += 1;
|
|
385
|
-
break;
|
|
386
|
-
case "skip-conflict":
|
|
387
|
-
counts.skipConflict += 1;
|
|
388
|
-
break;
|
|
389
|
-
case "update":
|
|
390
|
-
case "strip-managed-block":
|
|
391
|
-
counts.update += 1;
|
|
392
|
-
break;
|
|
393
|
-
case "update-conflict":
|
|
394
|
-
counts.updateConflict += 1;
|
|
395
|
-
break;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
return {
|
|
399
|
-
packageName: plan.packageName,
|
|
400
|
-
packageVersion: plan.packageVersion,
|
|
401
|
-
profile: plan.profile,
|
|
402
|
-
systemAssetMaterialization: plan.systemAssetMaterialization,
|
|
403
|
-
actionCounts: counts,
|
|
404
|
-
actions: plan.actions.map(summarizeAction),
|
|
405
|
-
reviewableManagedFileConflicts: conflicts,
|
|
406
|
-
writesFiles: false
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
function summarizeAction(action) {
|
|
410
|
-
const { content: _content, ...summary } = action;
|
|
411
|
-
return summary;
|
|
412
|
-
}
|
|
413
|
-
function resolveSelections(manifestSelections, override) {
|
|
414
|
-
if (override !== void 0) {
|
|
415
|
-
return override;
|
|
416
|
-
}
|
|
417
|
-
if (manifestSelections) {
|
|
418
|
-
return cloneSelections(manifestSelections);
|
|
419
|
-
}
|
|
420
|
-
return defaultSelections();
|
|
421
|
-
}
|
|
422
|
-
function mcpPayload(tool, result, details = {}) {
|
|
423
|
-
return {
|
|
424
|
-
tool,
|
|
425
|
-
source: "mcp",
|
|
426
|
-
...details,
|
|
427
|
-
result
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
function resolveOperationTargetDir(args) {
|
|
431
|
-
return path4.resolve(
|
|
432
|
-
optionalString(args, "targetRoot") ?? optionalString(args, "targetDir") ?? process.cwd()
|
|
433
|
-
);
|
|
434
|
-
}
|
|
435
|
-
function resolveTargetDir(args) {
|
|
436
|
-
return path4.resolve(optionalString(args, "targetDir") ?? process.cwd());
|
|
437
|
-
}
|
|
438
|
-
function optionalString(args, key) {
|
|
439
|
-
const value = args[key];
|
|
440
|
-
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
// src/mcp/server.ts
|
|
444
|
-
function createMakeDocsMcpServer() {
|
|
445
|
-
const packageMeta = readPackageMeta();
|
|
446
|
-
const server = new McpServer({
|
|
447
|
-
name: packageMeta.name,
|
|
448
|
-
version: packageMeta.version
|
|
449
|
-
});
|
|
450
|
-
for (const tool of listMakeDocsMcpTools().filter((candidate) => candidate.mcpReady !== false)) {
|
|
451
|
-
server.registerTool(
|
|
452
|
-
tool.name,
|
|
453
|
-
{
|
|
454
|
-
title: tool.title,
|
|
455
|
-
description: tool.description,
|
|
456
|
-
inputSchema: tool.inputSchema
|
|
457
|
-
},
|
|
458
|
-
async (args) => {
|
|
459
|
-
try {
|
|
460
|
-
return formatMcpToolResult(await callMakeDocsMcpTool(tool.name, args));
|
|
461
|
-
} catch (error) {
|
|
462
|
-
return formatMcpToolError(error);
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
);
|
|
466
|
-
}
|
|
467
|
-
server.server.registerCapabilities({ resources: {} });
|
|
468
|
-
server.server.setRequestHandler(
|
|
469
|
-
ListResourcesRequestSchema,
|
|
470
|
-
async () => listNativeMcpResources()
|
|
471
|
-
);
|
|
472
|
-
server.server.setRequestHandler(
|
|
473
|
-
ReadResourceRequestSchema,
|
|
474
|
-
async (request) => readNativeMcpResource(request.params.uri)
|
|
475
|
-
);
|
|
476
|
-
return server;
|
|
477
|
-
}
|
|
478
|
-
async function runMcpServer() {
|
|
479
|
-
const server = createMakeDocsMcpServer();
|
|
480
|
-
const transport = new StdioServerTransport();
|
|
481
|
-
await server.connect(transport);
|
|
482
|
-
}
|
|
483
|
-
function formatMcpToolResult(value) {
|
|
484
|
-
const structuredContent = value !== null && typeof value === "object" && !Array.isArray(value) ? value : { value };
|
|
485
|
-
return {
|
|
486
|
-
content: [
|
|
487
|
-
{
|
|
488
|
-
type: "text",
|
|
489
|
-
text: JSON.stringify(structuredContent, null, 2)
|
|
490
|
-
}
|
|
491
|
-
],
|
|
492
|
-
structuredContent
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
function formatMcpToolError(error) {
|
|
496
|
-
const structuredContent = serializeOperationError(error);
|
|
497
|
-
return {
|
|
498
|
-
isError: true,
|
|
499
|
-
content: [
|
|
500
|
-
{
|
|
501
|
-
type: "text",
|
|
502
|
-
text: JSON.stringify(structuredContent, null, 2)
|
|
503
|
-
}
|
|
504
|
-
],
|
|
505
|
-
structuredContent
|
|
506
|
-
};
|
|
507
|
-
}
|
|
508
|
-
export {
|
|
509
|
-
createMakeDocsMcpServer,
|
|
510
|
-
runMcpServer
|
|
511
|
-
};
|
|
512
|
-
//# sourceMappingURL=server-H754TA4Q.js.map
|