@farming-labs/docs 0.2.52 → 0.2.53
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/agent-2t4kZLGo.mjs +10 -0
- package/dist/{agent-CaOBIVFy.mjs → agent-BMxMpEa0.mjs} +194 -22
- package/dist/agent-contract-b0akaPcg.mjs +573 -0
- package/dist/agent-export--X9Go-wj.mjs +853 -0
- package/dist/{agents-DjhjZaNP.mjs → agents-CW-zTNKP.mjs} +6 -5
- package/dist/cli/index.mjs +43 -28
- package/dist/client/react.d.mts +1 -1
- package/dist/{cloud-ask-ai-DcMe6xOf.d.mts → cloud-ask-ai-CMzYVzVX.d.mts} +1 -1
- package/dist/{cloud-C_Ok9rC5.mjs → cloud-zs0qAnKJ.mjs} +3 -3
- package/dist/{codeblocks-z9iT794h.mjs → codeblocks-DWM4IJPL.mjs} +9 -12
- package/dist/{dev-Tm9Ss4D6.mjs → dev-DFeVU2Ui.mjs} +2 -2
- package/dist/docs-cloud-server.d.mts +2 -2
- package/dist/docs-cloud-server.mjs +1 -1
- package/dist/{doctor-O9o9kjN8.mjs → doctor-CkM5tKdD.mjs} +36 -24
- package/dist/{downgrade-CYEaOctn.mjs → downgrade-Dj_KXV11.mjs} +2 -2
- package/dist/i18n-CAlj1ADU.mjs +40 -0
- package/dist/index.d.mts +139 -3
- package/dist/index.mjs +7 -5
- package/dist/{init-Ch5On0zm.mjs → init-Cmz-oqnp.mjs} +3 -3
- package/dist/{mcp-DuCPNHS-.mjs → mcp-B4Q1PN93.mjs} +9 -5
- package/dist/mcp.d.mts +102 -4
- package/dist/mcp.mjs +1446 -66
- package/dist/{package-version-C8PigBZk.mjs → package-version-DxnTZH4m.mjs} +1 -1
- package/dist/{reading-time-CPAy1SWO.mjs → reading-time-BuK2YL23.mjs} +278 -33
- package/dist/{review-lm3dt7yy.mjs → review-BEsbm0l2.mjs} +38 -3
- package/dist/{robots-DV7u4Ire.mjs → robots-BOwkq9du.mjs} +5 -4
- package/dist/{robots-XVPs9lVz.mjs → robots-C6uQG-fS.mjs} +1 -1
- package/dist/{search-BWuU70B0.mjs → search-CJNLkdjX.mjs} +174 -79
- package/dist/{search-DFEhf9-s.d.mts → search-CTu6Bvq-.d.mts} +3 -1
- package/dist/{search-B6nEkx86.mjs → search-CtAXkk_J.mjs} +5 -4
- package/dist/server.d.mts +5 -5
- package/dist/server.mjs +8 -7
- package/dist/{sitemap-BEiKy4Iy.mjs → sitemap-OPb8EdNe.mjs} +6 -5
- package/dist/{sitemap-server-xEHtDUDB.mjs → sitemap-server-DnilMEiZ.mjs} +1 -1
- package/dist/{templates-uaauJcTO.mjs → templates-Bty9M6lA.mjs} +11 -5
- package/dist/{types-XqGLsmOD.d.mts → types-CdKu8KmO.d.mts} +118 -2
- package/dist/{upgrade-DzQtpgJM.mjs → upgrade-BNdBB9tQ.mjs} +2 -2
- package/package.json +1 -1
- package/dist/agent-DXDOMJBw.mjs +0 -9
- /package/dist/{cloud-ask-ai-Cl-xaV8j.mjs → cloud-ask-ai-BFlx8VMO.mjs} +0 -0
- /package/dist/{config-tiQCZ46q.mjs → config-DhIyFsy9.mjs} +0 -0
- /package/dist/{errors-CW1LnxaQ.mjs → errors-BxfYhp1L.mjs} +0 -0
- /package/dist/{review-B7goPYUb.mjs → review-BHdy75TE.mjs} +0 -0
- /package/dist/{utils-D-xTRNuh.mjs → utils-CMZTjRQT.mjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as detectPackageManagerFromProject, l as formatPackageManagerDetection, t as detectFramework, u as installCommand } from "./utils-
|
|
1
|
+
import { i as detectPackageManagerFromProject, l as formatPackageManagerDetection, t as detectFramework, u as installCommand } from "./utils-CMZTjRQT.mjs";
|
|
2
2
|
import pc from "picocolors";
|
|
3
3
|
import * as p from "@clack/prompts";
|
|
4
4
|
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { a as normalizePageAgentFrontmatter, i as hasStructuredPageAgentContract } from "./agent-contract-b0akaPcg.mjs";
|
|
2
|
+
import { Et as DEFAULT_SITEMAP_XML_ROUTE, S as DEFAULT_MCP_WELL_KNOWN_ROUTE, c as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, f as DEFAULT_DOCS_CONFIG_ROUTE, h as DEFAULT_LLMS_FULL_TXT_ROUTE, i as DEFAULT_AGENT_FEEDBACK_ROUTE, m as DEFAULT_DOCS_DIAGNOSTICS_ROUTE, t as DEFAULT_AGENTS_MD_ROUTE, v as DEFAULT_LLMS_TXT_ROUTE, w as DEFAULT_SKILL_MD_ROUTE, wt as DEFAULT_SITEMAP_MD_ROUTE } from "./agent-BMxMpEa0.mjs";
|
|
3
|
+
import { n as DEFAULT_ROBOTS_TXT_ROUTE } from "./robots-C6uQG-fS.mjs";
|
|
1
4
|
import matter from "gray-matter";
|
|
2
5
|
|
|
3
6
|
//#region src/define-docs.ts
|
|
@@ -158,41 +161,236 @@ function extendTheme(baseTheme, extensions) {
|
|
|
158
161
|
}
|
|
159
162
|
|
|
160
163
|
//#endregion
|
|
161
|
-
//#region src/
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
function splitSegments(value) {
|
|
166
|
-
const cleaned = normalizeSegment(value);
|
|
167
|
-
return cleaned ? cleaned.split("/").filter(Boolean) : [];
|
|
168
|
-
}
|
|
169
|
-
function resolveDocsI18n(config) {
|
|
170
|
-
if (!config || !Array.isArray(config.locales)) return null;
|
|
171
|
-
const locales = Array.from(new Set(config.locales.map((l) => l.trim()).filter(Boolean)));
|
|
172
|
-
if (locales.length === 0) return null;
|
|
173
|
-
return {
|
|
174
|
-
locales,
|
|
175
|
-
defaultLocale: config.defaultLocale && locales.includes(config.defaultLocale) ? config.defaultLocale : locales[0]
|
|
176
|
-
};
|
|
164
|
+
//#region src/agent-conformance.ts
|
|
165
|
+
const DOCS_AGENT_CONTRACT_VERSION = "1.0";
|
|
166
|
+
function normalizeOrigin(value) {
|
|
167
|
+
return value.replace(/\/+$/, "");
|
|
177
168
|
}
|
|
178
|
-
function
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
function
|
|
186
|
-
const
|
|
187
|
-
const
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
169
|
+
function normalizeEntry(value) {
|
|
170
|
+
return value.replace(/^\/+|\/+$/g, "") || "docs";
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The framework-neutral public surface every first-party adapter must implement.
|
|
174
|
+
* Adapter tests consume this list so new routes and invariants are added once.
|
|
175
|
+
*/
|
|
176
|
+
function createDocsAgentContractCases(options = {}) {
|
|
177
|
+
const origin = normalizeOrigin(options.origin ?? "http://localhost");
|
|
178
|
+
const entry = normalizeEntry(options.entry ?? "docs");
|
|
179
|
+
const locale = options.locale === void 0 ? "fr" : options.locale;
|
|
180
|
+
const url = (route) => `${origin}${route.startsWith("/") ? route : `/${route}`}`;
|
|
181
|
+
const markdown = ["text/markdown"];
|
|
182
|
+
const json = ["application/json"];
|
|
183
|
+
const cases = [
|
|
184
|
+
{
|
|
185
|
+
surface: "discovery",
|
|
186
|
+
request: { url: url(DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE) },
|
|
187
|
+
expect: {
|
|
188
|
+
statuses: [200],
|
|
189
|
+
contentTypes: json
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
surface: "config",
|
|
194
|
+
request: { url: url(DEFAULT_DOCS_CONFIG_ROUTE) },
|
|
195
|
+
expect: {
|
|
196
|
+
statuses: [200],
|
|
197
|
+
contentTypes: json,
|
|
198
|
+
bodyIncludes: ["docs-config-map.v1"]
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
surface: "diagnostics",
|
|
203
|
+
request: { url: url(DEFAULT_DOCS_DIAGNOSTICS_ROUTE) },
|
|
204
|
+
expect: {
|
|
205
|
+
statuses: [200],
|
|
206
|
+
contentTypes: json,
|
|
207
|
+
bodyIncludes: ["docs-diagnostics.v1"]
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
surface: "feedback-schema",
|
|
212
|
+
request: { url: url(`${DEFAULT_AGENT_FEEDBACK_ROUTE}/schema`) },
|
|
213
|
+
expect: {
|
|
214
|
+
statuses: [200],
|
|
215
|
+
contentTypes: ["application/schema+json"]
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
surface: "markdown",
|
|
220
|
+
request: { url: url(`/${entry}.md`) },
|
|
221
|
+
expect: {
|
|
222
|
+
statuses: [200],
|
|
223
|
+
contentTypes: markdown,
|
|
224
|
+
bodyIncludes: ["Introduction"]
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
surface: "markdown-accept",
|
|
229
|
+
request: {
|
|
230
|
+
url: url(`/${entry}`),
|
|
231
|
+
init: { headers: { Accept: "text/markdown" } }
|
|
232
|
+
},
|
|
233
|
+
expect: {
|
|
234
|
+
statuses: [200],
|
|
235
|
+
contentTypes: markdown,
|
|
236
|
+
bodyIncludes: ["Introduction"]
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
surface: "markdown-missing",
|
|
241
|
+
request: { url: url(`/${entry}/missing.md`) },
|
|
242
|
+
expect: {
|
|
243
|
+
statuses: [200, 404],
|
|
244
|
+
contentTypes: markdown,
|
|
245
|
+
bodyIncludes: ["not found"]
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
surface: "llms",
|
|
250
|
+
request: { url: url(DEFAULT_LLMS_TXT_ROUTE) },
|
|
251
|
+
expect: {
|
|
252
|
+
statuses: [200],
|
|
253
|
+
contentTypes: ["text/plain"],
|
|
254
|
+
bodyIncludes: ["Introduction"]
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
surface: "llms-full",
|
|
259
|
+
request: { url: url(DEFAULT_LLMS_FULL_TXT_ROUTE) },
|
|
260
|
+
expect: {
|
|
261
|
+
statuses: [200],
|
|
262
|
+
contentTypes: ["text/plain"],
|
|
263
|
+
bodyIncludes: ["Introduction"]
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
surface: "agents",
|
|
268
|
+
request: { url: url(DEFAULT_AGENTS_MD_ROUTE) },
|
|
269
|
+
expect: {
|
|
270
|
+
statuses: [200],
|
|
271
|
+
contentTypes: markdown,
|
|
272
|
+
bodyIncludes: ["AGENTS.md"]
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
surface: "skill",
|
|
277
|
+
request: { url: url(DEFAULT_SKILL_MD_ROUTE) },
|
|
278
|
+
expect: {
|
|
279
|
+
statuses: [200],
|
|
280
|
+
contentTypes: markdown,
|
|
281
|
+
bodyIncludes: ["name:"]
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
surface: "sitemap-xml",
|
|
286
|
+
request: { url: url(DEFAULT_SITEMAP_XML_ROUTE) },
|
|
287
|
+
expect: {
|
|
288
|
+
statuses: [200],
|
|
289
|
+
contentTypes: ["application/xml", "text/xml"],
|
|
290
|
+
bodyIncludes: ["<urlset"]
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
surface: "sitemap-markdown",
|
|
295
|
+
request: { url: url(DEFAULT_SITEMAP_MD_ROUTE) },
|
|
296
|
+
expect: {
|
|
297
|
+
statuses: [200],
|
|
298
|
+
contentTypes: markdown,
|
|
299
|
+
bodyIncludes: ["Introduction"]
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
surface: "robots",
|
|
304
|
+
request: { url: url(DEFAULT_ROBOTS_TXT_ROUTE) },
|
|
305
|
+
expect: {
|
|
306
|
+
statuses: [200],
|
|
307
|
+
contentTypes: ["text/plain"],
|
|
308
|
+
bodyIncludes: ["User-agent:"]
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
surface: "mcp",
|
|
313
|
+
request: {
|
|
314
|
+
url: url(DEFAULT_MCP_WELL_KNOWN_ROUTE),
|
|
315
|
+
init: {
|
|
316
|
+
method: "POST",
|
|
317
|
+
headers: {
|
|
318
|
+
Accept: "application/json, text/event-stream",
|
|
319
|
+
"Content-Type": "application/json",
|
|
320
|
+
"MCP-Protocol-Version": "2025-11-25"
|
|
321
|
+
},
|
|
322
|
+
body: JSON.stringify({
|
|
323
|
+
jsonrpc: "2.0",
|
|
324
|
+
id: 1,
|
|
325
|
+
method: "initialize",
|
|
326
|
+
params: {
|
|
327
|
+
protocolVersion: "2025-11-25",
|
|
328
|
+
capabilities: {},
|
|
329
|
+
clientInfo: {
|
|
330
|
+
name: "agent-conformance",
|
|
331
|
+
version: DOCS_AGENT_CONTRACT_VERSION
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
})
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
expect: {
|
|
338
|
+
statuses: [200],
|
|
339
|
+
contentTypes: ["application/json", "text/event-stream"],
|
|
340
|
+
bodyIncludes: ["serverInfo", "protocolVersion"]
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
];
|
|
344
|
+
if (locale) cases.splice(6, 0, {
|
|
345
|
+
surface: "markdown-locale",
|
|
346
|
+
request: { url: url(`/${entry}.md?lang=${encodeURIComponent(locale)}`) },
|
|
347
|
+
expect: {
|
|
348
|
+
statuses: [200],
|
|
349
|
+
contentTypes: markdown,
|
|
350
|
+
bodyIncludes: ["Bonjour"]
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
return cases;
|
|
354
|
+
}
|
|
355
|
+
function matchesContentType(actual, expected) {
|
|
356
|
+
const [mediaType] = actual.split(";", 1);
|
|
357
|
+
const normalized = mediaType?.trim().toLowerCase();
|
|
358
|
+
if (!normalized) return false;
|
|
359
|
+
return expected.some((value) => normalized === value.trim().toLowerCase());
|
|
360
|
+
}
|
|
361
|
+
async function runDocsAgentConformance(options) {
|
|
362
|
+
const cases = createDocsAgentContractCases(options);
|
|
363
|
+
const results = [];
|
|
364
|
+
for (const contractCase of cases) {
|
|
365
|
+
const issues = [];
|
|
366
|
+
try {
|
|
367
|
+
const response = await options.handle(new Request(contractCase.request.url, contractCase.request.init), contractCase.surface);
|
|
368
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
369
|
+
const body = await response.text();
|
|
370
|
+
if (!contractCase.expect.statuses.includes(response.status)) issues.push(`expected status ${contractCase.expect.statuses.join(" or ")}, received ${response.status}`);
|
|
371
|
+
if (!matchesContentType(contentType, contractCase.expect.contentTypes)) issues.push(`expected content-type ${contractCase.expect.contentTypes.join(" or ")}, received ${contentType || "<missing>"}`);
|
|
372
|
+
for (const requiredText of contractCase.expect.bodyIncludes ?? []) if (!body.toLowerCase().includes(requiredText.toLowerCase())) issues.push(`response body did not include ${JSON.stringify(requiredText)}`);
|
|
373
|
+
results.push({
|
|
374
|
+
surface: contractCase.surface,
|
|
375
|
+
passed: issues.length === 0,
|
|
376
|
+
status: response.status,
|
|
377
|
+
contentType,
|
|
378
|
+
issues
|
|
379
|
+
});
|
|
380
|
+
} catch (error) {
|
|
381
|
+
issues.push(error instanceof Error ? error.message : String(error));
|
|
382
|
+
results.push({
|
|
383
|
+
surface: contractCase.surface,
|
|
384
|
+
passed: false,
|
|
385
|
+
issues
|
|
386
|
+
});
|
|
387
|
+
}
|
|
192
388
|
}
|
|
193
389
|
return {
|
|
194
|
-
|
|
195
|
-
|
|
390
|
+
adapter: options.adapter,
|
|
391
|
+
contractVersion: DOCS_AGENT_CONTRACT_VERSION,
|
|
392
|
+
passed: results.every((result) => result.passed),
|
|
393
|
+
cases: results
|
|
196
394
|
};
|
|
197
395
|
}
|
|
198
396
|
|
|
@@ -327,6 +525,51 @@ function normalizeDateModified(value) {
|
|
|
327
525
|
const date = new Date(value);
|
|
328
526
|
return Number.isNaN(date.getTime()) ? value : date.toISOString();
|
|
329
527
|
}
|
|
528
|
+
function buildAgentContractHowTo(value, fallback) {
|
|
529
|
+
const agent = normalizePageAgentFrontmatter(value);
|
|
530
|
+
if (!agent || !hasStructuredPageAgentContract(agent)) return void 0;
|
|
531
|
+
const steps = [];
|
|
532
|
+
for (const command of agent.commands ?? []) {
|
|
533
|
+
const run = typeof command === "string" ? command : command.run;
|
|
534
|
+
const description = typeof command === "string" ? void 0 : command.description;
|
|
535
|
+
const cwd = typeof command === "string" ? void 0 : command.cwd;
|
|
536
|
+
steps.push({
|
|
537
|
+
"@type": "HowToStep",
|
|
538
|
+
position: steps.length + 1,
|
|
539
|
+
name: description ?? "Run command",
|
|
540
|
+
text: cwd ? `${run} (from ${cwd})` : run
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
for (const verification of agent.verification ?? []) {
|
|
544
|
+
const description = typeof verification === "string" ? verification : verification.description ?? "Verify the result";
|
|
545
|
+
const details = typeof verification === "string" ? verification : [verification.run, verification.expect ? `Expected: ${verification.expect}` : void 0].filter(Boolean).join(". ");
|
|
546
|
+
steps.push({
|
|
547
|
+
"@type": "HowToStep",
|
|
548
|
+
position: steps.length + 1,
|
|
549
|
+
name: description,
|
|
550
|
+
text: details || description
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
const supplies = [...(agent.prerequisites ?? []).map((name) => ({
|
|
554
|
+
"@type": "HowToSupply",
|
|
555
|
+
name
|
|
556
|
+
})), ...(agent.files ?? []).map((name) => ({
|
|
557
|
+
"@type": "HowToSupply",
|
|
558
|
+
name
|
|
559
|
+
}))];
|
|
560
|
+
const about = Object.entries(agent.appliesTo ?? {}).flatMap(([kind, values]) => (typeof values === "string" ? [values] : values ?? []).map((name) => ({
|
|
561
|
+
"@type": "Thing",
|
|
562
|
+
name: `${kind}: ${name}`
|
|
563
|
+
})));
|
|
564
|
+
return {
|
|
565
|
+
"@type": "HowTo",
|
|
566
|
+
name: agent.task ?? fallback.title,
|
|
567
|
+
...agent.outcome ?? fallback.description ? { description: agent.outcome ?? fallback.description } : {},
|
|
568
|
+
...about.length > 0 ? { about } : {},
|
|
569
|
+
...supplies.length > 0 ? { supply: supplies } : {},
|
|
570
|
+
...steps.length > 0 ? { step: steps } : {}
|
|
571
|
+
};
|
|
572
|
+
}
|
|
330
573
|
/**
|
|
331
574
|
* Resolve the public docs site URL from existing agent-facing config.
|
|
332
575
|
*
|
|
@@ -370,6 +613,8 @@ function buildDocsPageStructuredData(input) {
|
|
|
370
613
|
}
|
|
371
614
|
};
|
|
372
615
|
if (input.description) result.description = input.description;
|
|
616
|
+
const agentContract = buildAgentContractHowTo(input.agent, input);
|
|
617
|
+
if (agentContract) result.mainEntity = agentContract;
|
|
373
618
|
const dateModified = normalizeDateModified(input.dateModified);
|
|
374
619
|
if (dateModified) result.dateModified = dateModified;
|
|
375
620
|
return result;
|
|
@@ -437,4 +682,4 @@ function resolveReadingTimeFromSource(source, wordsPerMinute, options) {
|
|
|
437
682
|
}
|
|
438
683
|
|
|
439
684
|
//#endregion
|
|
440
|
-
export { extendTheme as _, resolveReadingTimeOptions as a, defineDocs as b, buildPageTwitter as c, resolveOGImage as d, resolveTitle as f, createTheme as g,
|
|
685
|
+
export { extendTheme as _, resolveReadingTimeOptions as a, defineDocs as b, buildPageTwitter as c, resolveOGImage as d, resolveTitle as f, createTheme as g, runDocsAgentConformance as h, resolveReadingTimeFromSource as i, renderDocsPageStructuredDataJson as l, createDocsAgentContractCases as m, resolvePageReadingTime as n, buildDocsPageStructuredData as o, DOCS_AGENT_CONTRACT_VERSION as p, resolveReadingTimeFromContent as r, buildPageOpenGraph as s, estimateReadingTimeMinutes as t, resolveDocsMetadataBaseUrl as u, deepMerge as v, resolveChangelogConfig as y };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
1
|
+
import { a as normalizePageAgentFrontmatter, i as hasStructuredPageAgentContract, r as getPageAgentFrontmatterIssues } from "./agent-contract-b0akaPcg.mjs";
|
|
2
|
+
import { a as ensureDocsReviewWorkflow, o as readDocsReviewConfigFromSource, s as resolveDocsReviewConfig } from "./review-BHdy75TE.mjs";
|
|
3
|
+
import { f as readTopLevelStringProperty, i as loadDocsConfigModule, m as resolveDocsContentDir, p as resolveDocsConfigPath } from "./config-DhIyFsy9.mjs";
|
|
3
4
|
import matter from "gray-matter";
|
|
4
5
|
import { existsSync, lstatSync, readFileSync, readdirSync } from "node:fs";
|
|
5
6
|
import path from "node:path";
|
|
@@ -214,7 +215,8 @@ function collectReviewFindings(options) {
|
|
|
214
215
|
checkAgentContext(findings, options.review, {
|
|
215
216
|
file,
|
|
216
217
|
source,
|
|
217
|
-
rootDir: options.rootDir
|
|
218
|
+
rootDir: options.rootDir,
|
|
219
|
+
agent: parsed.data.agent
|
|
218
220
|
});
|
|
219
221
|
}
|
|
220
222
|
checkBrokenLinks(findings, options.review, {
|
|
@@ -294,6 +296,39 @@ function checkCodeFences(findings, review, options) {
|
|
|
294
296
|
}
|
|
295
297
|
}
|
|
296
298
|
function checkAgentContext(findings, review, options) {
|
|
299
|
+
for (const issue of getPageAgentFrontmatterIssues(options.agent)) pushFinding(findings, review, {
|
|
300
|
+
rule: "agentContext",
|
|
301
|
+
severity: "warn",
|
|
302
|
+
file: options.file,
|
|
303
|
+
line: 1,
|
|
304
|
+
message: `Invalid ${issue.path}: ${issue.message}${/[.!?]$/.test(issue.message) ? "" : "."}`
|
|
305
|
+
});
|
|
306
|
+
const agent = normalizePageAgentFrontmatter(options.agent);
|
|
307
|
+
if (hasStructuredPageAgentContract(agent)) {
|
|
308
|
+
const missing = [!agent?.task ? "task" : void 0, !agent?.outcome ? "outcome" : void 0].filter(Boolean).join(" and ");
|
|
309
|
+
if (missing) pushFinding(findings, review, {
|
|
310
|
+
rule: "agentContext",
|
|
311
|
+
severity: "suggestion",
|
|
312
|
+
file: options.file,
|
|
313
|
+
line: 1,
|
|
314
|
+
message: `Structured agent contract is missing ${missing}.`
|
|
315
|
+
});
|
|
316
|
+
if (agent?.commands?.length && !agent.verification?.length) pushFinding(findings, review, {
|
|
317
|
+
rule: "agentContext",
|
|
318
|
+
severity: "suggestion",
|
|
319
|
+
file: options.file,
|
|
320
|
+
line: 1,
|
|
321
|
+
message: "Structured agent contract defines commands without verification steps."
|
|
322
|
+
});
|
|
323
|
+
if (agent?.sideEffects?.length && !agent.rollback?.length) pushFinding(findings, review, {
|
|
324
|
+
rule: "agentContext",
|
|
325
|
+
severity: "suggestion",
|
|
326
|
+
file: options.file,
|
|
327
|
+
line: 1,
|
|
328
|
+
message: "Structured agent contract defines side effects without rollback guidance."
|
|
329
|
+
});
|
|
330
|
+
if (agent?.task && agent.outcome) return;
|
|
331
|
+
}
|
|
297
332
|
if (options.source.includes("<Agent>") || options.source.includes("</Agent>")) return;
|
|
298
333
|
if (existsSync(path.join(path.dirname(path.join(options.rootDir, options.file)), "agent.md"))) return;
|
|
299
334
|
if (!/\b(install|configure|setup|implement|defineDocs|docs\.config|MCP|agent)\b/i.test(options.source)) return;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import "./agent-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
1
|
+
import "./agent-contract-b0akaPcg.mjs";
|
|
2
|
+
import "./agent-BMxMpEa0.mjs";
|
|
3
|
+
import { c as renderDocsRobotsGeneratedBlock, f as upsertDocsRobotsGeneratedBlock, i as DOCS_ROBOTS_GENERATED_BLOCK_START, r as DOCS_ROBOTS_GENERATED_BLOCK_END, u as resolveDocsRobotsConfig } from "./robots-C6uQG-fS.mjs";
|
|
4
|
+
import { f as readTopLevelStringProperty, i as loadDocsConfigModule, o as readBooleanProperty, p as resolveDocsConfigPath, t as extractNestedObjectLiteral, u as readStringProperty } from "./config-DhIyFsy9.mjs";
|
|
5
|
+
import { t as detectFramework } from "./utils-CMZTjRQT.mjs";
|
|
5
6
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
6
7
|
import path from "node:path";
|
|
7
8
|
import pc from "picocolors";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mt as resolveDocsSitemapConfig, Q as normalizeDocsPathSegment, S as DEFAULT_MCP_WELL_KNOWN_ROUTE, T as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, a as DEFAULT_AGENT_MD_ROUTE, b as DEFAULT_MCP_PUBLIC_ROUTE, c as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, g as DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, h as DEFAULT_LLMS_FULL_TXT_ROUTE, l as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, n as DEFAULT_AGENTS_MD_WELL_KNOWN_ROUTE, o as DEFAULT_AGENT_MD_WELL_KNOWN_ROUTE, t as DEFAULT_AGENTS_MD_ROUTE, v as DEFAULT_LLMS_TXT_ROUTE, w as DEFAULT_SKILL_MD_ROUTE, y as DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE } from "./agent-BMxMpEa0.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/robots.ts
|
|
4
4
|
const DEFAULT_ROBOTS_TXT_ROUTE = "/robots.txt";
|