@reqvire-org/ads 0.3.46 → 0.3.48
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 +21 -11
- package/dist/a11y.mjs +4 -2
- package/dist/assets.mjs +20 -15
- package/dist/atomic-composition.mjs +3 -2
- package/dist/brand-assets.mjs +48 -11
- package/dist/brands.mjs +82 -0
- package/dist/browser-audit/worker.mjs +51 -0
- package/dist/browser-audit.mjs +147 -0
- package/dist/capture/worker.mjs +1 -0
- package/dist/capture-store.mjs +2 -0
- package/dist/capture.mjs +7 -4
- package/dist/check.mjs +38 -8
- package/dist/cli.mjs +45 -10
- package/dist/color-values.mjs +325 -0
- package/dist/config.mjs +16 -2
- package/dist/control-padding.mjs +93 -0
- package/dist/design-values.mjs +3 -2
- package/dist/finding-rules.mjs +61 -0
- package/dist/foundation.mjs +17 -4
- package/dist/icons.mjs +107 -0
- package/dist/init.mjs +3 -0
- package/dist/mcp/apps.mjs +9 -6
- package/dist/mcp/context.mjs +1 -1
- package/dist/mcp/drafts.mjs +3 -0
- package/dist/mcp/mutations.mjs +40 -1
- package/dist/mcp/preview-widget.bundle.js +36 -36
- package/dist/mcp/project-widget.bundle.js +12 -12
- package/dist/mcp/server.mjs +23 -11
- package/dist/mcp/widget.bundle.js +17 -17
- package/dist/palette-generated.mjs +180 -0
- package/dist/preview-resources.mjs +12 -3
- package/dist/render-color-probe.mjs +148 -0
- package/dist/runtime-contracts.mjs +14 -4
- package/dist/scenarios.mjs +1 -1
- package/dist/showcase/client.bundle.js +28 -28
- package/dist/showcase/icons.js +146 -0
- package/dist/showcase/index.html +2 -1
- package/dist/showcase/style.css +19 -2
- package/dist/skills/README.md +2 -1
- package/dist/skills/ads-break-ui/SKILL.md +6 -5
- package/dist/skills/ads-break-ui/references/atomic-styles.md +12 -12
- package/dist/skills/ads-break-ui/references/contracts.md +13 -10
- package/dist/skills/ads-break-ui/references/design-data.md +137 -29
- package/dist/skills/ads-break-ui/references/drafts.md +3 -1
- package/dist/skills/ads-break-ui/references/guarded-editing.md +3 -2
- package/dist/skills/ads-break-ui/references/validation.md +13 -4
- package/dist/skills/ads-designer/SKILL.md +23 -16
- package/dist/skills/ads-designer/references/accessibility.md +41 -5
- package/dist/skills/ads-designer/references/atomic-styles.md +12 -12
- package/dist/skills/ads-designer/references/branding.md +37 -10
- package/dist/skills/ads-designer/references/cli.md +8 -2
- package/dist/skills/ads-designer/references/contracts.md +13 -10
- package/dist/skills/ads-designer/references/design-data.md +137 -29
- package/dist/skills/ads-designer/references/drafts.md +3 -1
- package/dist/skills/ads-designer/references/guarded-editing.md +3 -2
- package/dist/skills/ads-designer/references/validation.md +13 -4
- package/dist/skills/ads-import/SKILL.md +9 -8
- package/dist/skills/ads-import/references/atomic-styles.md +12 -12
- package/dist/skills/ads-import/references/cli.md +8 -2
- package/dist/skills/ads-import/references/contracts.md +13 -10
- package/dist/skills/ads-import/references/design-data.md +137 -29
- package/dist/skills/ads-import/references/drafts.md +3 -1
- package/dist/skills/ads-import/references/guarded-editing.md +3 -2
- package/dist/skills/ads-import/references/tokens.md +7 -3
- package/dist/skills/ads-import/references/validation.md +13 -4
- package/dist/skills/ads-motion/SKILL.md +6 -5
- package/dist/skills/ads-motion/references/atomic-styles.md +12 -12
- package/dist/skills/ads-motion/references/contracts.md +13 -10
- package/dist/skills/ads-motion/references/design-data.md +137 -29
- package/dist/skills/ads-motion/references/drafts.md +3 -1
- package/dist/skills/ads-motion/references/guarded-editing.md +3 -2
- package/dist/skills/ads-motion/references/validation.md +13 -4
- package/dist/skills/ads-port/SKILL.md +6 -5
- package/dist/skills/ads-port/references/atomic-styles.md +12 -12
- package/dist/skills/ads-port/references/cli.md +8 -2
- package/dist/skills/ads-port/references/contracts.md +13 -10
- package/dist/skills/ads-port/references/design-data.md +137 -29
- package/dist/skills/ads-port/references/drafts.md +3 -1
- package/dist/skills/ads-port/references/guarded-editing.md +3 -2
- package/dist/skills/ads-port/references/validation.md +13 -4
- package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +11 -2
- package/dist/starters/react/ADS.md +43 -10
- package/dist/starters/react/README.md +14 -9
- package/dist/starters/react/design-system/assets/brand/README.md +8 -3
- package/dist/starters/react/design-system/assets/glyphs/README.md +4 -1
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.fixture.ts +6 -1
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.scenario.tsx +3 -2
- package/dist/starters/react/design-system/components/Content/Icon/README.md +2 -1
- package/dist/starters/react/design-system/components/Content/Logo/Logo.tsx +3 -9
- package/dist/starters/react/design-system/components/Content/Logo/README.md +4 -2
- package/dist/starters/react/design-system/controllers/Palette/Palette.ts +164 -0
- package/dist/starters/react/design-system/index.ts +3 -0
- package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +2 -5
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +11 -2
- package/dist/starters/react/design-system/styles.css +1 -0
- package/dist/starters/react/design-system/tokens/base.css +8 -5
- package/dist/starters/react/design-system/tokens/colors.css +167 -175
- package/dist/starters/react/design-system/tokens/elevation.css +14 -21
- package/dist/starters/react/design-system/tokens/themes.generated.css +142 -0
- package/dist/starters/react/design-system/tokens/themes.generated.ts +402 -0
- package/dist/style-boundaries.mjs +2 -1
- package/dist/themes-generated.mjs +150 -0
- package/dist/themes-watch.mjs +42 -0
- package/dist/themes.mjs +214 -63
- package/dist/token-export.mjs +22 -11
- package/dist/token-policy.mjs +2 -1
- package/dist/token-quality.mjs +28 -25
- package/dist/tokens.mjs +27 -32
- package/dist/validation.mjs +17 -1
- package/dist/verification/browser.mjs +14 -3
- package/dist/verification.mjs +25 -4
- package/docs/ADS.md +41 -27
- package/docs/ARCHITECTURE.md +49 -22
- package/docs/CACHING.md +2 -3
- package/docs/CHANGELOG.md +117 -13
- package/docs/CONTRACTS.md +13 -10
- package/docs/GUIDE.md +94 -22
- package/docs/MCP.md +50 -30
- package/docs/benchmarks/bun-previews.md +5 -5
- package/docs/benchmarks/{gidi-preview-memory.md → preview-memory.md} +14 -12
- package/docs/benchmarks/turbo-poc.md +24 -6
- package/package.json +2 -1
package/dist/mcp/server.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { watchThemesCss } from "../themes-watch.mjs";
|
|
1
2
|
import { randomUUID } from "node:crypto";
|
|
2
3
|
import { executionContext } from "./execution-context.mjs";
|
|
3
4
|
import { createExecutionCoordinator } from "./execution-coordinator.mjs";
|
|
@@ -14,6 +15,7 @@ import { createVerificationController, BEHAVIOR_URI } from "../verification.mjs"
|
|
|
14
15
|
import { INVESTIGATIONS_URI, investigationIndex, investigationPage, investigationSections, readInvestigation, readInvestigationResource } from "../investigations.mjs";
|
|
15
16
|
import { failure } from "../evidence.mjs";
|
|
16
17
|
import { inspectTokens } from "../tokens.mjs";
|
|
18
|
+
import { ICONS_URI, iconInputs, iconSet } from "../icons.mjs";
|
|
17
19
|
import { discoverScenarioRegistry, readScenarioRegistry, releaseScenarioRegistry } from "../scenario-registry.mjs";
|
|
18
20
|
import { createScenarioInspector } from "../scenario-inspector.mjs";
|
|
19
21
|
import { scenarioGroupFingerprint } from "../scenario-groups.mjs";
|
|
@@ -45,6 +47,7 @@ import { developmentRuntime } from "../development-runtime.mjs";
|
|
|
45
47
|
import { createDraftController, DRAFTS_URI, draftIdSchema, draftRevisionSchema } from "./drafts.mjs";
|
|
46
48
|
import { isDraftPreviewWorkspace } from "../draft-workspace.mjs";
|
|
47
49
|
import { isDraftFile } from "../draft-boundary.mjs";
|
|
50
|
+
import { findingCounts } from "../finding-rules.mjs";
|
|
48
51
|
|
|
49
52
|
const pkg = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8"));
|
|
50
53
|
class InvalidParamsError extends ProtocolError {
|
|
@@ -206,7 +209,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
206
209
|
async function explorer() {
|
|
207
210
|
const registry=await getRegistryAsync(), proposals=drafts.list({limit:100000}).drafts;
|
|
208
211
|
const scenarios=annotateDrafts(registry.scenarios,proposals).map(({id,title,kind,group,unit,drafts})=>({id,title,kind,...(group?{group}:{}),unit,drafts}));
|
|
209
|
-
return {status:{projectRoot:root,project:{showcase:project().showcase},drafts:{previewOnly:isDraftPreviewWorkspace(root)},previewWatch:previewWatch?.status(),build:summarizeBuild(builds())},
|
|
212
|
+
return {status:{projectRoot:root,project:{showcase:project().showcase},themes:options.config.themes,...(options.config.brands.length?{brands:options.config.brands}:{}),icons:Boolean(options.config.assets.glyphs),drafts:{previewOnly:isDraftPreviewWorkspace(root)},previewWatch:previewWatch?.status(),build:summarizeBuild(builds())},
|
|
210
213
|
scenarios,categories:scenarios.filter(item=>item.kind==="tokens").map(item=>({...item,count:registry.scenarios.find(value=>value.id===item.id)?.tokens?.length??0})),drafts:proposals,
|
|
211
214
|
tools:tools().map(({name,_meta,schema})=>{const waitFor=z.toJSONSchema(schema).properties?.waitFor;return{name,...(_meta?{_meta}:{}),inputSchema:{properties:waitFor?{waitFor}:{}}};}),diagnostics:registry.diagnostics};
|
|
212
215
|
}
|
|
@@ -264,6 +267,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
264
267
|
{ uri: `${PROJECT_URI}/explorer`, name: "Explorer navigation and preview bootstrap", mimeType: "application/json" },
|
|
265
268
|
{ uri: BUILD_URI, name: "Preview build status and diagnostics", mimeType: "application/json" },
|
|
266
269
|
{ uri: `${PROJECT_URI}/tokens`, name: "Project token values and themes", mimeType: "application/json" },
|
|
270
|
+
{ uri: ICONS_URI, name: "Glyph set, aliases, icon sizes, glyph findings and other products' logos", mimeType: "application/json" },
|
|
267
271
|
{ uri: `${PROJECT_URI}/catalog`, name: "Public components and patterns", mimeType: "application/json" },
|
|
268
272
|
{ uri: DRAFTS_URI, name: "Tracked ADS drafts and acceptance events", mimeType: "application/json" },
|
|
269
273
|
...drafts.previewStatuses().map(({ id, resourceUri }) => ({ uri: resourceUri, name: `Draft ${id}: preview build status and diagnostics`, mimeType: "application/json" })),
|
|
@@ -297,7 +301,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
297
301
|
package: pkg.name, version: pkg.version, dsDir: options.config.dsDir, publicAlias: options.config.publicAlias, behaviorLibraries: getBehaviorLibraries().libraries,
|
|
298
302
|
components: catalog.filter((item) => item.kind === "components" && item.apiKind === "ui").length,
|
|
299
303
|
patterns: catalog.filter((item) => item.kind === "patterns" && item.apiKind === "ui").length,
|
|
300
|
-
tokenCount: inspectTokens(root).tokens.length, themes: options.config.themes, showcaseUrl: getShowcaseUrl(),
|
|
304
|
+
tokenCount: inspectTokens(root).tokens.length, themes: options.config.themes, ...(options.config.brands.length ? { brands: options.config.brands } : {}), showcaseUrl: getShowcaseUrl(),
|
|
301
305
|
resourceLimits: resourceLimitsStatus(options.config.resources),
|
|
302
306
|
policies:{acceptance:options.config.acceptance,validation:options.config.validation},
|
|
303
307
|
previewWatch: previewWatch?.status() ?? { state: "disabled" },
|
|
@@ -342,6 +346,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
342
346
|
if (uri === `${PROJECT_URI}/status`) value = await status();
|
|
343
347
|
else if (uri === BUILD_URI) value = builds();
|
|
344
348
|
else if (uri === `${PROJECT_URI}/tokens`) value = tokenWidgetData(inspectTokens(root));
|
|
349
|
+
else if (uri === ICONS_URI) value = iconSet(loadConfig(root));
|
|
345
350
|
else if (uri === `${PROJECT_URI}/catalog`) value = { items: annotateDrafts(await getCatalog()) };
|
|
346
351
|
else if (uri === DRAFTS_URI) value = drafts.list();
|
|
347
352
|
else if (uri === `${PROJECT_URI}/scenarios`) value = getRegistry();
|
|
@@ -437,7 +442,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
437
442
|
{ name:"ads_create_draft", description:"Create a Git-committable proposal under ads-drafts/ for 1–64 coupled ADS owners, copying only their source/companions into non-importable .ads files. New owners are allowed. Optional dependencies name separate unaccepted drafts used by pattern/composition previews. Creation does not change accepted source. Edit the returned files normally; use ads_update_draft to register additions/deletions.", schema:z.object({units:z.array(z.string().min(1).max(256)).min(1).max(mutationLimits.units),title:z.string().min(1).max(160).optional(),id:draftIdSchema.optional(),dependencies:z.array(draftIdSchema).max(8).default([]),tokenGroups:z.array(z.string().min(1).max(160)).max(32).default([])}).strict(),_meta:{ui:{visibility:["model"]}},annotations:{...annotations,readOnlyHint:false,idempotentHint:false},call:async args=>{const result=drafts.create(args);if(observeChanges)await refresh();return json(result);} },
|
|
438
443
|
{ name:"ads_update_draft", description:"Update marked draft source or register new/deleted canonical target paths. Pass the current revision from ads_drafts. Source is UTF-8 unless encoding:base64; content:null proposes deletion. refresh:true rebases onto current accepted source using stored baselines; non-overlapping edits merge and overlapping edits leave the draft unchanged with diagnostics. Use changes with refresh only for explicit resolved contents of existing draft files; refresh separately from dependency changes. Optional dependencies replaces the draft dependency list. Normal local file edits need no iteration tool. Accepted source remains unchanged; ownership and all required checks run at acceptance.",schema:z.object({id:draftIdSchema,revision:draftRevisionSchema,refresh:z.boolean().default(false),dependencies:z.array(draftIdSchema).max(8).optional(),changes:z.array(z.object({unit:z.string().max(256),path:z.string().min(1).max(500),content:z.string().max(256*1024).nullable(),encoding:z.enum(["utf8","base64"]).optional()}).strict()).max(32).default([])}).strict(),_meta:{ui:{visibility:["model"]}},annotations:{...annotations,readOnlyHint:false,idempotentHint:false},call:async args=>{const result=drafts.update(args);if(observeChanges)await refresh();return json(result);} },
|
|
439
444
|
{ name:"ads_drop_draft",description:"Delete an exact tracked draft and its generated preview. This is Drop, not a separate refusal workflow. Accepted source is unchanged. Dependents report a missing dependency until corrected.",schema:z.object({id:draftIdSchema,revision:draftRevisionSchema}).strict(),_meta:{ui:{visibility:["model"]}},annotations:{...annotations,readOnlyHint:false,destructiveHint:true,idempotentHint:false},call:async args=>{const result=await drafts.drop(args);if(observeChanges)await refresh();return json(result);} },
|
|
440
|
-
{ name:"ads_accept",title:"Accept a reviewed draft",description:"Auto-mode acceptance: validate and apply the exact rendered/reviewed draft revision in one operation. Accept dependency drafts first; dependent drafts automatically switch to their final @ds implementations. Mandatory ADS guards and acceptance.checks run once on the candidate; affected registered tests gate acceptance when acceptance.behaviorChecks is true. Draft/source changes invalidate acceptance. On failure retain the draft and inspect ads_results; on success apply normal source, remove the draft and publish an event. No additional human approval or manual Apply step.",schema:z.object({fresh:z.boolean().default(false),id:draftIdSchema,revision:draftRevisionSchema}).strict(),_meta:{ui:{visibility:["model"]}},annotations:{...annotations,readOnlyHint:false,destructiveHint:true,idempotentHint:false},call:async(args,signal,progress)=>{
|
|
445
|
+
{ name:"ads_accept",title:"Accept a reviewed draft",description:"Auto-mode acceptance: validate and apply the exact rendered/reviewed draft revision in one operation. Accept dependency drafts first; dependent drafts automatically switch to their final @ds implementations. Mandatory ADS guards and acceptance.checks run once on the candidate; affected registered tests gate acceptance when acceptance.behaviorChecks is true. When acceptance.browserAudit is true, axe-core audits the candidate's affected UI scenarios in every declared brand and theme; any a11y-axe error (or an audit that cannot run) rejects acceptance. Draft/source changes invalidate acceptance. On failure retain the draft and inspect ads_results; on success apply normal source, remove the draft and publish an event. No additional human approval or manual Apply step.",schema:z.object({fresh:z.boolean().default(false),id:draftIdSchema,revision:draftRevisionSchema}).strict(),_meta:{ui:{visibility:["model"]}},annotations:{...annotations,readOnlyHint:false,destructiveHint:true,idempotentHint:false},call:async(args,signal,progress)=>{
|
|
441
446
|
const result=await drafts.accept(args,signal,progress);
|
|
442
447
|
if(result.applied){await previewWatch?.invalidate?.();await refresh(true);}else await refresh();
|
|
443
448
|
return finishExecution("mutation",result);
|
|
@@ -485,9 +490,9 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
485
490
|
const matches = inventory.tokens.filter((token) => token.name.toLowerCase().includes(search.toLowerCase()));
|
|
486
491
|
return json({ total: matches.length, tokens: matches.slice(0, limit), categories: tokenScenarios(), tokenGroups:drafts.tokenGroups(), diagnosticCount: inventory.diagnostics.length, resourceUri: `${PROJECT_URI}/tokens` });
|
|
487
492
|
} },
|
|
488
|
-
{ name: "ads_check", description: "Run read-only core ADS architecture checks; returns blocking diagnostics separately from nonblocking advisories, with
|
|
493
|
+
{ name: "ads_check", description: "Run read-only core ADS architecture checks; returns blocking errors (diagnostics) separately from nonblocking review items (the advisories section, severity review), with review items before informational limits; summary counts both. Atomic review items include helper/forwarded-class paths and ads://guides/atomic-styles guidance; unresolved paths do not establish safe composition. Project Oxlint, typecheck, build and browser tests remain separate.", schema: z.object({ limit: z.number().int().min(1).max(50).default(20), fresh:z.boolean().default(false) }).strict(), call: async ({ limit, fresh }, signal) => {
|
|
489
494
|
const result = await architecture(signal,fresh);
|
|
490
|
-
return json({ ok: result.ok, acceptance:result.acceptance, cache:result.cache, total: result.diagnostics.length, diagnostics: result.diagnostics.slice(0, limit), advisoryCount: result.advisories?.length ?? 0, advisories: (result.advisories ?? []).slice(0, limit), resourceUri: `${PROJECT_URI}/checks` });
|
|
495
|
+
return json({ ok: result.ok, acceptance:result.acceptance, cache:result.cache, summary: findingCounts(result.diagnostics.length, (result.advisories ?? []).filter(item => item.severity === "review").length), total: result.diagnostics.length, diagnostics: result.diagnostics.slice(0, limit), advisoryCount: result.advisories?.length ?? 0, advisories: (result.advisories ?? []).slice(0, limit), resourceUri: `${PROJECT_URI}/checks` });
|
|
491
496
|
} },
|
|
492
497
|
{ name: "ads_skills", description: "Select one ADS workflow after ads_status: ads-designer for building/refining/debugging UI; ads-port for a library reference; ads-import for another project's ADS; ads-motion for animation; ads-break-ui for stress testing. Then read that workflow with ads_read_skill. Listing does not activate a native skill.", schema: empty, call: () => json({ skills: skills.skills.map(({ uri, frontmatter }) => ({ uri, ...frontmatter })) }) },
|
|
493
498
|
{ name: "ads_read_skill", description: "Read a selected skill or relative supporting text file in bounded chunks. This is explicit instruction access, not automatic native skill activation/install.", schema: z.object({ name: z.string().max(64), file: z.string().max(300).default("SKILL.md"), offset: z.number().int().min(0).default(0), limit: z.number().int().min(1).max(8000).default(6000) }).strict(), call: ({ name, file, offset, limit }) => {
|
|
@@ -521,7 +526,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
521
526
|
{ name:"ads_report_bug",title:"Report a suspected ADS defect",description:"Record an unexpected ADS guard, preview, build, transport or runner behavior after targeted investigation. Provide expected/observed behavior, minimal steps and frequency; keep suspectedCause separate. Evidence optionally selects a returned resultId or exact unit/check/runId. ADS snapshots compact evidence, version, configured framework and revisions. A report is an untriaged agent claim, not proof of an ADS cause. Returns a small receipt with the report ID and local file path; submitted reports cannot be read through MCP. Stored locally under .ds/reports/ with deduplication, no automatic expiry and no upload. Read ads://guides/reporting; ordinary valid guard rejections should be fixed in their owner.",schema:bugReportSchema,annotations:{readOnlyHint:false,destructiveHint:false,idempotentHint:false,openWorldHint:false},call:args=>submitReport("bug",args) },
|
|
522
527
|
{ name:"ads_request_feature",title:"Request an ADS capability",description:"Record a legitimate workflow that needs a missing ADS capability. Provide workflow, capability and impact; proposal is optional. Preserve valid design/API rather than weakening guards or inventing workaround props. Optional evidence references an existing execution/check, not pasted files/logs. ADS attaches compact context and returns a receipt with the report ID and local file path. Intake is submission-only; no report-reading tools or resources. Shared local report store: deduplicated, untriaged, no automatic expiry or upload. Read ads://guides/reporting; use ads_report_bug for suspected broken existing behavior.",schema:featureRequestSchema,annotations:{readOnlyHint:false,destructiveHint:false,idempotentHint:false,openWorldHint:false},call:args=>submitReport("feature",args) },
|
|
523
528
|
{ name: "ads_investigate", title: "Inspect check evidence", description: "Read a summary for an exact unit/check, or list latest investigations when no check is selected. Pass the outcome's runId to reject superseded evidence. Summary is at most 4 KiB JSON; details, requests, browserErrors and artifacts are separate paged sections (default 10/max 20 entries, 8 KiB). Read truncated rows with recordIndex/offset/chars and the exact runId. Artifact URIs are read separately. Does not rerun checks or infer root cause. Lists latest checks; an exact runId reads retained historical evidence, including candidate runs.", schema: z.object({unit:z.string().min(1).max(256).optional(),check:z.string().min(1).max(100).optional(),runId:z.string().min(1).max(100).optional(),section:z.enum(investigationSections).optional(),...paged,...recordRange}).strict(), call: args => json(investigationPage(root,args)) },
|
|
524
|
-
{ name: "ads_validate", description: "Run mandatory ADS architecture/freshness guards and the selected project policy. policy defaults to validation: its configured scripts, preview freshness
|
|
529
|
+
{ name: "ads_validate", description: "Run mandatory ADS architecture/freshness guards and the selected project policy. policy defaults to validation: its configured scripts, preview freshness, optional registered behavior checks and, when <policy>.browserAudit is true, an axe-core audit of every rendered UI scenario in every declared brand and theme (a11y-axe findings are blocking errors in the diagnostics section). policy acceptance runs acceptance.checks, acceptance.behaviorChecks and acceptance.browserAudit without applying source, for direct editing; draft acceptance and guarded patches run the same acceptance policy, auditing only the candidate's affected UI scenarios. No script names are inferred. scope changed selects affected registered checks from this policy's own successful full baseline; broad changes expand to all. Project scripts keep full scope. Draft edit/show never triggers policies. Reports skipped stages honestly and a bounded resultId; use ads_results for details. Read ads://guides/validation. Trusted configured commands run; nothing is installed.", schema: z.object({scope:z.enum(["all","changed"]).default("all"),policy:z.enum(["acceptance","validation"]).default("validation"),fresh:z.boolean().default(false)}).strict(), annotations: {readOnlyHint:false,destructiveHint:false,idempotentHint:false,openWorldHint:false}, call: async (args,signal,progress) => {
|
|
525
530
|
return finishExecution("validation",await validation.run(args,signal,progress));
|
|
526
531
|
} },
|
|
527
532
|
{ name: "ads_verify", description: "Run one owner's registered development behavior checks using its configured runner/profile. Executes trusted project commands with bounded output, cancellation and process-tree cleanup; installs nothing. Progress and per-check timings are available through ads_status; a profile timeout bounds the whole run. Browser profiles use an isolated managed showcase/MCP App. React StrictMode requires a project development harness, not a production widget. Missing/skipped cases, stale inputs and process exit alone cannot produce passing evidence. Replies contain counts, acceptance, at most three failure summaries and a resultId (4 KiB JSON maximum). Page outcomes with ads_results; inspect one exact unit/check/runId with ads_investigate. Discover exact unit/check IDs with ads_behaviors first.", schema: z.object({ unit: z.string().min(1).max(256), checks: z.array(z.string().min(1).max(100)).min(1).max(100).optional() }).strict(), annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }, call: async (args, signal, progress) => {
|
|
@@ -538,11 +543,11 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
538
543
|
const {patch,...result}=reconcileTokenSamples(options,args);
|
|
539
544
|
return json({...result,removed:result.removed.slice(0,50),unresolved:result.unresolved.slice(0,50),unresolvedCount:result.unresolved.length,...storePreparedPatch(options,patch)});
|
|
540
545
|
}},
|
|
541
|
-
{ name: "ads_apply_patch", description: "Apply one Git diff to one ADS unit from ads_units. Pass exactly one of patch (inline) or patchFile (a regular .patch/.diff under .ds/patches/, for large/binary diffs without model-context bytes). Text uses --- a/path, +++ b/path and exact @@ hunks; /dev/null creates/deletes. Git binary patches require git diff --binary --full-index and installed Git. A unit owns its implementation, previews and fixtures; imported peers are separate. Foundation, documentation, assets and configuration are editable too. Configuration changes may register/edit project guards and builders; the proposed schema, mandatory ADS and candidate project checks must pass. Only selected-unit public re-exports may change; preserve unrelated statements. A real selected-unit re-export may remove a redundant export {}; placeholder. A tokens patch may include its companionFiles foundation entry only to add/remove canonical imports required by token files created/deleted in this patch, preserving other imports/comments and canonical order. A runtime owner patch may also include its ds.config.json companion solely for that owner's inlineStyleFiles/styleWrites entries alongside its source. Unused permissions fail validation. Set dryRun true to validate without writing. Optional screenshot:true plus captures:[{scenario,target?,theme?,viewport?}] captures current/candidate only after gates pass. For genuinely coupled owner changes use ads_apply_transaction with one patch per owner. Fix rejected patches and inspect current previews after acceptance. Reply is a 4 KiB summary; read diagnostics, outcomes and requested captures through ads_results using its resultId.",
|
|
546
|
+
{ name: "ads_apply_patch", description: "Apply one Git diff to one ADS unit from ads_units. Pass exactly one of patch (inline) or patchFile (a regular .patch/.diff under .ds/patches/, for large/binary diffs without model-context bytes). Text uses --- a/path, +++ b/path and exact @@ hunks; /dev/null creates/deletes. Git binary patches require git diff --binary --full-index and installed Git. A unit owns its implementation, previews and fixtures; imported peers are separate. Foundation, documentation, assets and configuration are editable too. Configuration changes may register/edit project guards and builders; the proposed schema, mandatory ADS and candidate project checks must pass. Only selected-unit public re-exports may change; preserve unrelated statements. A real selected-unit re-export may remove a redundant export {}; placeholder. A tokens patch may include its companionFiles foundation entry only to add/remove canonical imports required by token files created/deleted in this patch, preserving other imports/comments and canonical order. A runtime owner patch may also include its ds.config.json companion solely for that owner's inlineStyleFiles/styleWrites entries alongside its source. Unused permissions fail validation. When acceptance.browserAudit is true, axe-core audits the candidate's affected UI scenarios in every brand and theme; a11y-axe errors reject the patch. Set dryRun true to validate without writing. Optional screenshot:true plus captures:[{scenario,target?,theme?,brand?,viewport?}] captures current/candidate only after gates pass. For genuinely coupled owner changes use ads_apply_transaction with one patch per owner. Fix rejected patches and inspect current previews after acceptance. Reply is a 4 KiB summary; read diagnostics, outcomes and requested captures through ads_results using its resultId.",
|
|
542
547
|
schema: z.object({ unit: z.string().min(1).max(256), dryRun: z.boolean(), patch: z.string().min(1).max(mutationLimits.patchBytes).optional(), patchFile: z.string().min(1).max(500).optional(), ...screenshotFields }).strict().refine(args => (args.patch !== undefined) !== (args.patchFile !== undefined), "Provide exactly one of patch or patchFile."),
|
|
543
548
|
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false }, _meta: { ui: { visibility: ["model"] } },
|
|
544
549
|
call: applyEdits,
|
|
545
|
-
}, {name:"ads_apply_transaction",description:"Apply genuinely coupled ADS changes as 2–64 distinct owner Git patches. Each patch must obey its unit and narrow companion rules. Patches run in order; later patches use the earlier candidate's shared-entry content. Core guards, configured project checks
|
|
550
|
+
}, {name:"ads_apply_transaction",description:"Apply genuinely coupled ADS changes as 2–64 distinct owner Git patches. Each patch must obey its unit and narrow companion rules. Patches run in order; later patches use the earlier candidate's shared-entry content. Core guards, configured project checks, affected behavior checks and, when acceptance.browserAudit is true, the axe-core audit of affected UI scenarios validate the complete final candidate before any live source is written. Maximum 256 distinct files/16 MiB combined. Dry runs, failures and cancellation publish nothing; publication rolls back on write failure. Optional screenshot:true with dryRun:true and explicit captures selects current/candidate images. Prefer ads_apply_patch for independent edits. Reply is a bounded summary; page diagnostics, outcomes and captures with ads_results using the returned resultId.",schema:z.object({patches:z.array(ownerPatch).min(2).max(mutationLimits.units),dryRun:z.boolean(),...screenshotFields}).strict(),annotations:{readOnlyHint:false,destructiveHint:true,idempotentHint:false,openWorldHint:false},_meta:{ui:{visibility:["model"]}},call:applyEdits}] : []),
|
|
546
551
|
...options.config.mcp.apps.map((app) => ({ name: `ads_show_${app.id.replaceAll("-", "_")}`, title: app.title, description: `${app.description ?? app.title}. Renders the project's built ${app.kind} examples through MCP Apps; text fallback provides the showcase URL.`, schema: empty, _meta: { ui: { resourceUri: appUri(app.id) } }, call: async (_args, signal) => {
|
|
547
552
|
// Validate readiness without embedding executable HTML in model results.
|
|
548
553
|
const build = await previewBuild(app, signal);
|
|
@@ -647,6 +652,8 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
647
652
|
};
|
|
648
653
|
const artifactFingerprint = () => fileFingerprint(allApps(true).map(app => path.resolve(root, previewArtifactPath(previewOptions(), app.file))));
|
|
649
654
|
const assetFingerprint = () => resourceAssets().map(asset => asset.uri).sort().join("\n");
|
|
655
|
+
const iconFingerprint = () => fileFingerprint(iconInputs(options));
|
|
656
|
+
let previousIcons;
|
|
650
657
|
let previous, previousArtifacts, previousAssets, previousBuild, previousCaptures, previousCaptureUris, previousDrafts;
|
|
651
658
|
let previousDraftBuilds = new Map();
|
|
652
659
|
const draftBuilds = () => new Map(drafts.previewStatuses().map(build => [build.resourceUri, JSON.stringify(build)]));
|
|
@@ -660,7 +667,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
660
667
|
executionObservers.add(executionChanged);
|
|
661
668
|
function initializeObservation() {
|
|
662
669
|
if (observing) return;
|
|
663
|
-
previous=fingerprint();previousArtifacts=artifactFingerprint();previousAssets=assetFingerprint();previousBuild=JSON.stringify(builds());
|
|
670
|
+
previous=fingerprint();previousArtifacts=artifactFingerprint();previousAssets=assetFingerprint();previousIcons=iconFingerprint();previousBuild=JSON.stringify(builds());
|
|
664
671
|
previousCaptures=captures.store.fingerprint();previousCaptureUris=captures.store.resourceUris();
|
|
665
672
|
previousInvestigations=investigationFingerprint();previousResults=executionResults.fingerprint();observing=true;
|
|
666
673
|
previousDrafts=drafts.fingerprint();
|
|
@@ -701,6 +708,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
701
708
|
if (buildChanged) onBuildChange?.(JSON.parse(build));
|
|
702
709
|
const artifactsChanged = artifacts !== previousArtifacts;
|
|
703
710
|
const assetsChanged = assets !== previousAssets;
|
|
711
|
+
const iconsChanged = iconFingerprint() !== previousIcons;
|
|
704
712
|
const capturesChanged = captures.store.fingerprint() !== previousCaptures;
|
|
705
713
|
const investigationsChanged=investigationFingerprint()!==previousInvestigations;
|
|
706
714
|
const resultsChanged=executionResults.fingerprint()!==previousResults;
|
|
@@ -708,7 +716,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
708
716
|
const currentDraftBuilds=draftBuilds();
|
|
709
717
|
const changedDraftBuilds=[...new Set([...previousDraftBuilds.keys(),...currentDraftBuilds.keys()])].filter(uri=>previousDraftBuilds.get(uri)!==currentDraftBuilds.get(uri));
|
|
710
718
|
const draftResourcesChanged=[...previousDraftBuilds.keys()].some(uri=>!currentDraftBuilds.has(uri)) || [...currentDraftBuilds.keys()].some(uri=>!previousDraftBuilds.has(uri));
|
|
711
|
-
if (!filesChanged && !buildChanged && !artifactsChanged && !assetsChanged && !capturesChanged && !investigationsChanged && !resultsChanged && !draftsChanged && !deferredDiscovery) return false;
|
|
719
|
+
if (!filesChanged && !buildChanged && !artifactsChanged && !assetsChanged && !iconsChanged && !capturesChanged && !investigationsChanged && !resultsChanged && !draftsChanged && !deferredDiscovery) return false;
|
|
712
720
|
if (filesChanged) {
|
|
713
721
|
const updated = loadConfig(root);
|
|
714
722
|
await previewWatch?.reconfigure?.(updated.config.mcp);
|
|
@@ -731,9 +739,10 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
731
739
|
if (discoveryChanged || assetsChanged || draftResourcesChanged) { if (notifications) notifications.resourcesChanged(); else await server.sendResourceListChanged(); }
|
|
732
740
|
previousArtifacts = artifactFingerprint();
|
|
733
741
|
previousAssets = assetFingerprint();
|
|
742
|
+
previousIcons = iconFingerprint();
|
|
734
743
|
previousBuild = JSON.stringify(builds());
|
|
735
744
|
const targets = discoveryChanged ? (era === "modern" ? resources().map((entry) => entry.uri).filter((uri) => !skills.files.has(uri)) : [...subscribed]).filter(uri => !uri.startsWith("ads://drafts/"))
|
|
736
|
-
: [BUILD_URI, BEHAVIOR_URI, INVESTIGATIONS_URI, DRAFTS_URI, `${PROJECT_URI}/status`, ...(filesChanged ? [`${PROJECT_URI}/tokens`] : []), ...(options.config.mcp.previewManifest ? [PREVIEW_MANIFEST_URI, LIVE_PREVIEW_MANIFEST_URI] : []), ...(artifactsChanged ? allApps(true).map(app => appUri(app.id)) : [])].filter((uri) => era === "modern" || subscribed.has(uri));
|
|
745
|
+
: [BUILD_URI, BEHAVIOR_URI, INVESTIGATIONS_URI, DRAFTS_URI, `${PROJECT_URI}/status`, ...(filesChanged ? [`${PROJECT_URI}/tokens`] : []), ...(filesChanged || iconsChanged ? [ICONS_URI] : []), ...(options.config.mcp.previewManifest ? [PREVIEW_MANIFEST_URI, LIVE_PREVIEW_MANIFEST_URI] : []), ...(artifactsChanged ? allApps(true).map(app => appUri(app.id)) : [])].filter((uri) => era === "modern" || subscribed.has(uri));
|
|
737
746
|
if((discoveryChanged||draftsChanged)&&(era==="modern"||subscribed.has(`${PROJECT_URI}/explorer`)))targets.push(`${PROJECT_URI}/explorer`);
|
|
738
747
|
if(draftsChanged){
|
|
739
748
|
targets.push(...[...new Set([...previousDraftBuilds.keys(),...currentDraftBuilds.keys()])].map(uri=>uri.replace(encodeURIComponent(BUILD_URI),encodeURIComponent(`${PROJECT_URI}/scenarios`))).filter(uri=>era==="modern"||subscribed.has(uri)));
|
|
@@ -779,6 +788,8 @@ export async function startAdsMcp(directory = process.cwd(), { stdio = true, sho
|
|
|
779
788
|
if (process.versions.bun) assertBunRuntime();
|
|
780
789
|
// Fail before opening the transport for configuration/distribution errors.
|
|
781
790
|
const { root, config } = loadConfig(directory);
|
|
791
|
+
// The generated theme sheet follows the token sheets and ds.config.json from startup on.
|
|
792
|
+
const themesWatch = watchThemesCss(root, { log: message => process.stderr.write(`${message}\n`) });
|
|
782
793
|
const inspection = { skills: createSkillStore(), previewWork };
|
|
783
794
|
const previewWatch = createReconfigurablePreviewWatch(root, config.mcp, {buildTimeout:previewBuildTimeoutMs,prewarm});
|
|
784
795
|
let host, api;
|
|
@@ -814,6 +825,7 @@ export async function startAdsMcp(directory = process.cwd(), { stdio = true, sho
|
|
|
814
825
|
function close() {
|
|
815
826
|
return closing ??= (async () => {
|
|
816
827
|
clearTimeout(warmStart);
|
|
828
|
+
themesWatch.close();
|
|
817
829
|
buildListeners.clear();
|
|
818
830
|
clearTimeout(buildChangeTimer); buildWatcher?.close();
|
|
819
831
|
inspection.edits?.cancel();
|