@reqvire-org/ads 0.3.25 → 0.3.26
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 +7 -5
- package/dist/bootstrap-ds/ADS.md +28 -30
- package/dist/bootstrap-ds/README.md +6 -6
- package/dist/bootstrap-ds/design-system/assets/brand/README.md +3 -2
- package/dist/boundaries.mjs +0 -3
- package/dist/check.mjs +15 -22
- package/dist/config.mjs +3 -7
- package/dist/contract-migration.mjs +2 -2
- package/dist/contracts.d.mts +0 -1
- package/dist/design-values.mjs +81 -0
- package/dist/evidence.mjs +1 -1
- package/dist/mcp/context.mjs +3 -3
- package/dist/mcp/prompts.mjs +4 -4
- package/dist/mcp/reports.mjs +101 -0
- package/dist/mcp/server.mjs +38 -3
- package/dist/paint-contracts.mjs +4 -5
- package/dist/preview-resources.mjs +1 -2
- package/dist/scenarios.mjs +14 -14
- package/dist/skills/README.md +7 -3
- package/dist/skills/ads-break-ui/SKILL.md +23 -13
- package/dist/skills/ads-break-ui/references/atomic-styles.md +9 -2
- package/dist/skills/ads-break-ui/references/behaviors.md +393 -0
- package/dist/skills/ads-break-ui/references/captures.md +1 -1
- package/dist/skills/ads-break-ui/references/contracts.md +18 -37
- package/dist/skills/ads-break-ui/references/design-data.md +91 -0
- package/dist/skills/ads-break-ui/references/evidence.md +4 -0
- package/dist/skills/ads-break-ui/references/guarded-editing.md +7 -11
- package/dist/skills/ads-break-ui/references/reporting.md +101 -0
- package/dist/skills/ads-break-ui/references/scenarios.md +9 -15
- package/dist/skills/ads-designer/SKILL.md +25 -15
- package/dist/skills/ads-designer/assets/bootstrap-ds/ADS.md +28 -30
- package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +6 -6
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/README.md +3 -2
- package/dist/skills/ads-designer/references/atomic-styles.md +9 -2
- package/dist/skills/ads-designer/references/behaviors.md +393 -0
- package/dist/skills/ads-designer/references/captures.md +1 -1
- package/dist/skills/ads-designer/references/contracts.md +18 -37
- package/dist/skills/ads-designer/references/design-craft.md +1 -1
- package/dist/skills/ads-designer/references/design-data.md +91 -0
- package/dist/skills/ads-designer/references/evidence.md +4 -0
- package/dist/skills/ads-designer/references/guarded-editing.md +7 -11
- package/dist/skills/ads-designer/references/mobile.md +1 -1
- package/dist/skills/ads-designer/references/reporting.md +101 -0
- package/dist/skills/ads-designer/references/scenarios.md +9 -15
- package/dist/skills/ads-import/SKILL.md +28 -17
- package/dist/skills/ads-import/references/atomic-styles.md +9 -2
- package/dist/skills/ads-import/references/behaviors.md +393 -0
- package/dist/skills/ads-import/references/branding.md +1 -1
- package/dist/skills/ads-import/references/captures.md +1 -1
- package/dist/skills/ads-import/references/contracts.md +18 -37
- package/dist/skills/ads-import/references/design-data.md +91 -0
- package/dist/skills/ads-import/references/evidence.md +4 -0
- package/dist/skills/ads-import/references/guarded-editing.md +7 -11
- package/dist/skills/ads-import/references/implementation.md +3 -2
- package/dist/skills/ads-import/references/reporting.md +101 -0
- package/dist/skills/ads-import/references/scenarios.md +9 -15
- package/dist/skills/ads-import/references/tokens.md +11 -9
- package/dist/skills/ads-motion/SKILL.md +22 -12
- package/dist/skills/ads-motion/references/atomic-styles.md +9 -2
- package/dist/skills/ads-motion/references/behaviors.md +393 -0
- package/dist/skills/ads-motion/references/captures.md +1 -1
- package/dist/skills/ads-motion/references/contracts.md +18 -37
- package/dist/skills/ads-motion/references/design-data.md +91 -0
- package/dist/skills/ads-motion/references/evidence.md +4 -0
- package/dist/skills/ads-motion/references/guarded-editing.md +7 -11
- package/dist/skills/ads-motion/references/reporting.md +101 -0
- package/dist/skills/ads-motion/references/scenarios.md +9 -15
- package/dist/skills/{ads-migrate → ads-port}/SKILL.md +58 -31
- package/dist/skills/ads-port/agents/openai.yaml +4 -0
- package/dist/skills/{ads-migrate → ads-port}/references/atomic-styles.md +9 -2
- package/dist/skills/ads-port/references/behaviors.md +393 -0
- package/dist/skills/{ads-migrate → ads-port}/references/captures.md +1 -1
- package/dist/skills/{ads-migrate → ads-port}/references/contracts.md +18 -37
- package/dist/skills/ads-port/references/design-data.md +91 -0
- package/dist/skills/{ads-migrate → ads-port}/references/evidence.md +4 -0
- package/dist/skills/{ads-migrate → ads-port}/references/guarded-editing.md +7 -11
- package/dist/skills/{ads-migrate → ads-port}/references/lint-and-docs.md +5 -0
- package/dist/skills/{ads-migrate → ads-port}/references/native-implementation.md +49 -15
- package/dist/skills/ads-port/references/reporting.md +101 -0
- package/dist/skills/{ads-migrate → ads-port}/references/scenarios.md +9 -15
- package/dist/skills/{ads-migrate → ads-port}/references/testing.md +11 -1
- package/dist/tokens.mjs +5 -8
- package/dist/unit-contracts.mjs +1 -8
- package/docs/ADS.md +42 -73
- package/docs/ARCHITECTURE.md +49 -20
- package/docs/BEHAVIORS.md +40 -38
- package/docs/CHANGELOG.md +23 -0
- package/docs/CONTRACTS.md +18 -37
- package/docs/GUIDE.md +21 -13
- package/docs/MCP.md +57 -10
- package/package.json +1 -1
- package/dist/scoped-tokens.mjs +0 -68
- package/dist/skills/ads-migrate/agents/openai.yaml +0 -4
- /package/dist/skills/{ads-migrate → ads-port}/references/cli.md +0 -0
- /package/dist/skills/{ads-migrate → ads-port}/references/layers.md +0 -0
- /package/dist/skills/{ads-migrate → ads-port}/references/review.md +0 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
+
import { closeSync, existsSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { compactRow, jsonBytes } from "./result-pages.mjs";
|
|
6
|
+
|
|
7
|
+
export const reportLimits = Object.freeze({ recordBytes: 32768 });
|
|
8
|
+
const text = max => z.string().trim().min(1).max(max);
|
|
9
|
+
const identifier = text(256).refine(value => !["\r","\n","\0"].some(character=>value.includes(character)), "Use a single project discovery ID.");
|
|
10
|
+
const evidence = z.union([
|
|
11
|
+
z.object({ resultId: z.string().uuid() }).strict(),
|
|
12
|
+
z.object({ unit: identifier, check: text(100), runId: text(100) }).strict(),
|
|
13
|
+
]);
|
|
14
|
+
const common = { title: text(160), unit: identifier.optional(), scenario: identifier.optional(), reporter: text(100).optional(), evidence: z.array(evidence).max(3).default([]) };
|
|
15
|
+
export const bugReportSchema = z.object({ ...common, expected: text(2000), observed: text(2000), steps: z.array(text(500)).min(1).max(12), frequency: z.enum(["always", "intermittent", "once", "unknown"]), suspectedCause: text(1000).optional() }).strict();
|
|
16
|
+
export const featureRequestSchema = z.object({ ...common, workflow: text(2000), capability: text(2000), impact: text(1000), proposal: text(1500).optional() }).strict();
|
|
17
|
+
const schemas = { bug: bugReportSchema, feature: featureRequestSchema };
|
|
18
|
+
const uuid = value => typeof value === "string" && /^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/.test(value);
|
|
19
|
+
const digest = value => createHash("sha256").update(JSON.stringify(value)).digest("hex");
|
|
20
|
+
function receipt(record) {
|
|
21
|
+
return { reportId: record.id, revision: record.revision, kind: record.kind, status: "untriaged", classification: "agent-supplied",
|
|
22
|
+
createdAt: record.createdAt, updatedAt: record.updatedAt, submissionCount: record.submissionCount,
|
|
23
|
+
storagePath: `.ds/reports/${record.id}.json`, delivery: "local-only" };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Durable project-local intake with bounded records and delivery. */
|
|
27
|
+
export function createReportStore(root, { context = () => ({}), resolveEvidence = () => { throw new Error("Evidence is unavailable."); } } = {}) {
|
|
28
|
+
root = path.resolve(root);
|
|
29
|
+
const folder = path.join(root, ".ds/reports"), lock = path.join(folder, "write.lock"), cached = new Map();
|
|
30
|
+
function directory(target, create = false) {
|
|
31
|
+
if (create && !existsSync(target)) { try { mkdirSync(target); } catch(error) { if(error.code!=="EEXIST")throw error; } }
|
|
32
|
+
if (realpathSync(target) !== target || !lstatSync(target).isDirectory()) throw new Error("Report storage must use ordinary project directories.");
|
|
33
|
+
}
|
|
34
|
+
function parents(create = false) { directory(root); directory(path.join(root, ".ds"), create); directory(folder, create); }
|
|
35
|
+
function regular(target, max) {
|
|
36
|
+
const stat = lstatSync(target);
|
|
37
|
+
if (realpathSync(target) !== target || !stat.isFile() || stat.nlink !== 1 || stat.size > max) throw new Error("Invalid or oversized report storage file.");
|
|
38
|
+
}
|
|
39
|
+
function files() {
|
|
40
|
+
if (!existsSync(path.join(root, ".ds"))) return [];
|
|
41
|
+
directory(path.join(root, ".ds"));
|
|
42
|
+
if (!existsSync(folder)) return [];
|
|
43
|
+
parents();
|
|
44
|
+
return readdirSync(folder).filter(name => name.endsWith(".json") && uuid(name.slice(0,-5))).sort().map(name => {
|
|
45
|
+
const file=path.join(folder,name),stat=lstatSync(file);
|
|
46
|
+
return {file,id:name.slice(0,-5),stamp:`${stat.ino}:${stat.mtimeMs}:${stat.ctimeMs}:${stat.size}`};
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function readFile(file,id) {
|
|
50
|
+
regular(file,reportLimits.recordBytes);
|
|
51
|
+
const record=JSON.parse(readFileSync(file,"utf8"));
|
|
52
|
+
if(record.schemaVersion!==1||record.id!==id||!uuid(record.revision)||!/^[a-f0-9]{64}$/.test(record.fingerprint)||!Object.hasOwn(schemas,record.kind)||!schemas[record.kind].safeParse(record.submission).success||!Number.isSafeInteger(record.submissionCount)||record.submissionCount<1||!Array.isArray(record.evidence)||!record.context||typeof record.context!=="object"||typeof record.createdAt!=="string"||typeof record.updatedAt!=="string")throw new Error("Invalid saved report; preserve it for recovery rather than overwriting it.");
|
|
53
|
+
return record;
|
|
54
|
+
}
|
|
55
|
+
function headers() {
|
|
56
|
+
const entries=files(),live=new Set(entries.map(entry=>entry.id));
|
|
57
|
+
for(const id of cached.keys())if(!live.has(id))cached.delete(id);
|
|
58
|
+
return entries.map(({file,id,stamp})=>{
|
|
59
|
+
if(cached.get(id)?.stamp!==stamp){const record=readFile(file,id);cached.set(id,{stamp,value:{id,fingerprint:record.fingerprint,createdAt:record.createdAt,submissionCount:record.submissionCount}});}
|
|
60
|
+
return cached.get(id).value;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function acquire() {
|
|
64
|
+
parents(true);
|
|
65
|
+
if (existsSync(lock)) try {
|
|
66
|
+
regular(lock, 512);
|
|
67
|
+
const previous = readFileSync(lock, "utf8"), owner = JSON.parse(previous);
|
|
68
|
+
if (!Number.isSafeInteger(owner.pid) || owner.pid <= 0 || !uuid(owner.nonce)) throw new Error("Invalid report lock; inspect the local store.");
|
|
69
|
+
let gone = false;
|
|
70
|
+
try { process.kill(owner.pid, 0); } catch (error) { if (error.code === "ESRCH") gone = true; }
|
|
71
|
+
if (gone && readFileSync(lock, "utf8") === previous) rmSync(lock);
|
|
72
|
+
}catch(error){if(error instanceof SyntaxError)throw new Error("Report storage is busy or its lock is incomplete. Retry the same submission; inspect a persistent lock.");if(error.code!=="ENOENT")throw error;}
|
|
73
|
+
const token = JSON.stringify({ pid: process.pid, nonce: randomUUID() });
|
|
74
|
+
let fd;
|
|
75
|
+
try { fd = openSync(lock, "wx", 0o600); writeFileSync(fd, token); }
|
|
76
|
+
catch (error) { if(fd!==undefined)rmSync(lock,{force:true}); if (error.code === "EEXIST") throw new Error("Report storage is busy. Retry the same submission; duplicates reuse their report ID."); throw error; }
|
|
77
|
+
finally { if (fd !== undefined) closeSync(fd); }
|
|
78
|
+
return () => { if (readFileSync(lock, "utf8") === token) rmSync(lock); };
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
submit(kind, args) {
|
|
82
|
+
if (!Object.hasOwn(schemas,kind)) throw new Error("Unknown report kind.");
|
|
83
|
+
const submission = schemas[kind].parse(args);
|
|
84
|
+
// Resolve exact evidence before writing. Superseded or fabricated IDs fail.
|
|
85
|
+
const evidence = submission.evidence.map(reference => ({ reference, snapshot: compactRow(resolveEvidence(reference), 4096) }));
|
|
86
|
+
const captured = compactRow(context(submission), 4096);
|
|
87
|
+
const { title, unit, scenario, expected, observed, steps, workflow, capability } = submission;
|
|
88
|
+
const normalized = value => typeof value === "string" ? value.replace(/\s+/g, " ").trim() : value;
|
|
89
|
+
const identity = JSON.parse(JSON.stringify({ kind, version: captured.ads?.version, framework: captured.framework, title, unit, scenario, expected, observed, steps, workflow, capability }), (_key, value) => normalized(value));
|
|
90
|
+
const fingerprint = digest(identity), release = acquire();
|
|
91
|
+
try {
|
|
92
|
+
const prior = headers().find(record => record.fingerprint === fingerprint), now = new Date().toISOString();
|
|
93
|
+
const record = { schemaVersion:1,id: prior?.id ?? randomUUID(), revision: randomUUID(), fingerprint, kind, createdAt: prior?.createdAt ?? now, updatedAt: now, submissionCount: (prior?.submissionCount ?? 0) + 1, submission, context: captured, evidence };
|
|
94
|
+
if (jsonBytes(record) > reportLimits.recordBytes) throw new Error("Report exceeds 32 KiB. Shorten the narrative/reproduction; reference existing evidence instead of pasting logs or files.");
|
|
95
|
+
const file=path.join(folder,`${record.id}.json`),bytes = JSON.stringify(record), temporary = path.join(folder, `${randomUUID()}.tmp`);
|
|
96
|
+
try { writeFileSync(temporary, bytes, { flag: "wx", mode: 0o600 }); renameSync(temporary, file); } finally { rmSync(temporary, { force: true }); }
|
|
97
|
+
return { ok: true, ...receipt(record), deduplicated: !!prior, retention:"until-explicit-removal", guidanceUri: "ads://guides/reporting" };
|
|
98
|
+
} finally { release(); }
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|
package/dist/mcp/server.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { z } from "zod";
|
|
|
6
6
|
import { checkProject } from "../check.mjs";
|
|
7
7
|
import { loadConfig, sourceFiles } from "../config.mjs";
|
|
8
8
|
import { createVerificationController, BEHAVIOR_URI } from "../verification.mjs";
|
|
9
|
-
import { INVESTIGATIONS_URI, investigationIndex, investigationPage, investigationSections, readInvestigationResource } from "../investigations.mjs";
|
|
9
|
+
import { INVESTIGATIONS_URI, investigationIndex, investigationPage, investigationSections, readInvestigation, readInvestigationResource } from "../investigations.mjs";
|
|
10
10
|
import { failure } from "../evidence.mjs";
|
|
11
11
|
import { inspectTokens } from "../tokens.mjs";
|
|
12
12
|
import { inspectScenarios } from "../scenarios.mjs";
|
|
@@ -29,6 +29,8 @@ import { previewSourceRevision } from "../preview-inputs.mjs";
|
|
|
29
29
|
import { createExecutionResults, RESULTS_URI, resultSections } from "./execution-results.mjs";
|
|
30
30
|
import { behaviorPage, behaviorSections } from "./behavior-pages.mjs";
|
|
31
31
|
import { compactProgress, resultBudgets } from "./result-pages.mjs";
|
|
32
|
+
import { createReportStore, bugReportSchema, featureRequestSchema } from "./reports.mjs";
|
|
33
|
+
import { createHash } from "node:crypto";
|
|
32
34
|
|
|
33
35
|
const pkg = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8"));
|
|
34
36
|
class InvalidParamsError extends ProtocolError {
|
|
@@ -63,6 +65,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
63
65
|
const edits = cache.edits ??= createMutationController(root, { captures });
|
|
64
66
|
const verification = cache.verification ??= createVerificationController(root);
|
|
65
67
|
const executionResults = cache.executionResults ??= createExecutionResults(root);
|
|
68
|
+
const reports = cache.reports ??= createReportStore(root, { context: reportContext, resolveEvidence: reportEvidence });
|
|
66
69
|
let options = loadConfig(root);
|
|
67
70
|
const signature = `${root}:${JSON.stringify(options.config)}`;
|
|
68
71
|
if (cache.signature !== signature) {
|
|
@@ -114,6 +117,31 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
114
117
|
};
|
|
115
118
|
const previews = () => options.config.mcp.apps.map((app) => ({ id: app.id, title: app.title, kind: app.kind, tool: `ads_show_${app.id.replaceAll("-", "_")}`, resourceUri: appUri(app.id), available: existsSync(path.resolve(root, app.file)), file: app.file }));
|
|
116
119
|
|
|
120
|
+
function reportContext(submission) {
|
|
121
|
+
const captured = { ads: { package: pkg.name, version: pkg.version }, capturedAt: new Date().toISOString(), framework: null,
|
|
122
|
+
runtime: { node: process.version, platform: process.platform, arch: process.arch }, warnings: [] };
|
|
123
|
+
try { const current=loadConfig(root);captured.framework=current.config.framework;captured.configurationRevision=createHash("sha256").update(JSON.stringify(current.config)).digest("hex");captured.sourceRevision=previewSourceRevision(current); }
|
|
124
|
+
catch { captured.warnings.push("Current configuration/source revision could not be captured."); }
|
|
125
|
+
try{const projectPackage=JSON.parse(readFileSync(path.join(root,"package.json"),"utf8"));if(typeof projectPackage.name==="string")captured.project={name:projectPackage.name.slice(0,160)};}catch{captured.warnings.push("Project package name could not be captured.");}
|
|
126
|
+
try { const build=builds(),preview=build.previews?.find(item=>item.id===submission.scenario);captured.build={state:build.state,updatedAt:build.updatedAt,session:build.session,sequence:build.sequence,...(preview?{preview:{id:preview.id,state:preview.state,revision:preview.revision,current:preview.current,stale:preview.stale}}:{})}; }
|
|
127
|
+
catch { captured.warnings.push("Current build metadata could not be captured."); }
|
|
128
|
+
// Target names can describe an unaccepted draft; they are agent claims, not registrations.
|
|
129
|
+
if(submission.scenario)try{captured.scenarioRegistered=getRegistry().scenarios.some(item=>item.id===submission.scenario);}catch{captured.scenarioRegistered=null;}
|
|
130
|
+
if(submission.unit)try{captured.unitRegistered=edits.units().some(item=>item.id===submission.unit);}catch{captured.unitRegistered=null;}
|
|
131
|
+
return captured;
|
|
132
|
+
}
|
|
133
|
+
function reportEvidence(reference) {
|
|
134
|
+
if(reference.resultId)return JSON.parse(executionResults.readResource(`ads://results/${reference.resultId}`).text);
|
|
135
|
+
const bundle=readInvestigation(root,reference);
|
|
136
|
+
if(bundle.runId!==reference.runId)throw new Error("Investigation was superseded. Reference the exact current unit/check/runId or describe earlier observations without attaching unrelated evidence.");
|
|
137
|
+
const {unit,check,runId,status,target,inputRevision,observedPreviewRevision,framework,profile,completedAt,failure,source,failingStep,viewport,acceptance}=bundle;
|
|
138
|
+
return {unit,check,runId,status,target,inputRevision,observedPreviewRevision,framework,profile,completedAt,failure,source,failingStep,viewport,acceptance,
|
|
139
|
+
artifacts:(bundle.artifacts??[]).slice(0,3).map(({resourceUri,digest,mimeType,available})=>({resourceUri,digest,mimeType,available})),artifactsAreReferences:true};
|
|
140
|
+
}
|
|
141
|
+
function submitReport(kind,args) {
|
|
142
|
+
return json(reports.submit(kind,args));
|
|
143
|
+
}
|
|
144
|
+
|
|
117
145
|
function resources() {
|
|
118
146
|
const context = project();
|
|
119
147
|
const documents = getDocuments();
|
|
@@ -142,6 +170,8 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
142
170
|
// Keep fallback workflow metadata discoverable in the bounded first page.
|
|
143
171
|
...skills.skills.map(({ uri, frontmatter }) => ({ uri, name: frontmatter.name, description: frontmatter.description, mimeType: "text/markdown" })),
|
|
144
172
|
...documents.filter(document => promoted.has(document.uri)).sort((a, b) => Number(b.uri === context.publicEntryUri) - Number(a.uri === context.publicEntryUri)).map(({ file: _file, ...document }) => document),
|
|
173
|
+
{ uri: "ads://guides/tokens", name: "Shared Data and component variable boundaries", mimeType: "text/markdown" },
|
|
174
|
+
{ uri: "ads://guides/reporting", name: "Report suspected ADS bugs and feature requests", mimeType: "text/markdown" },
|
|
145
175
|
{ uri: TOKENS_APP_URI, name: "Experimental token widget", mimeType: APP_MIME },
|
|
146
176
|
{ uri: SCENARIO_APP_URI, name: "Experimental scenario widget", mimeType: APP_MIME },
|
|
147
177
|
...(options.config.mcp.previewManifest ? [{ uri: PREVIEW_APP_URI, name: "Shared-resource preview App", mimeType: APP_MIME }, { uri: PREVIEW_MANIFEST_URI, name: "Preview dependency graph", mimeType: "application/json" }] : []),
|
|
@@ -165,12 +195,15 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
165
195
|
scenarios: { count: getRegistry().scenarios.length, diagnostics: getRegistry().diagnostics, resourceUri: `${PROJECT_URI}/scenarios`, tool: "ads_show_scenario" },
|
|
166
196
|
behaviors: { resourceUri: BEHAVIOR_URI, discoveryTool: "ads_behaviors", verificationTool: "ads_verify", investigationTool: "ads_investigate", investigationResourceUri: INVESTIGATIONS_URI, ...behaviorState, progress: compactProgress(behaviorState.progress), lastResult: executionResults.latest("verification"), resultsTool: "ads_results", resultsResourceUri: RESULTS_URI },
|
|
167
197
|
captures: { resourceUri: CAPTURES_URI, tool: "ads_capture", clearTool: "ads_capture_clear", ...captures.status() },
|
|
198
|
+
reports: { access:"submission-only", storageDirectory:".ds/reports", bugTool:"ads_report_bug", featureTool:"ads_request_feature", guidanceUri:"ads://guides/reporting", delivery:"local-only", retention:"until-explicit-removal" },
|
|
168
199
|
experimental: { apps: true, nativeSkills: era === "modern", nativeSkillActivation: "host-controlled" } };
|
|
169
200
|
}
|
|
170
201
|
async function read(uri, signal) {
|
|
171
202
|
if (uri === GUIDE_URI) return { contents: [{ uri, mimeType: "text/markdown", text: projectGuide(project(), [...previews(), ...scenarioApps()]) }] };
|
|
172
|
-
if (uri === "ads://guides/behaviors") return { contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL("
|
|
203
|
+
if (uri === "ads://guides/behaviors") return { contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL("../skills/ads-designer/references/behaviors.md", import.meta.url), "utf8") }] };
|
|
173
204
|
if (uri === "ads://guides/evidence") return { contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL("../skills/ads-designer/references/evidence.md", import.meta.url), "utf8") }] };
|
|
205
|
+
if (uri === "ads://guides/tokens") return { contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL("../skills/ads-designer/references/design-data.md", import.meta.url), "utf8") }] };
|
|
206
|
+
if (uri === "ads://guides/reporting") return { contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL("../skills/ads-designer/references/reporting.md", import.meta.url), "utf8") }] };
|
|
174
207
|
if (uri === "ads://guides/atomic-styles") return { contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL("../skills/ads-designer/references/atomic-styles.md", import.meta.url), "utf8") }] };
|
|
175
208
|
if (uri === "ads://guides/scenarios") return { contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL("../skills/ads-designer/references/scenarios.md", import.meta.url), "utf8") }] };
|
|
176
209
|
if (uri === "ads://guides/layers") return { contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL("../skills/ads-designer/references/layers.md", import.meta.url), "utf8") }] };
|
|
@@ -282,7 +315,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
282
315
|
const result = checkProject(root);
|
|
283
316
|
return json({ ok: result.ok, acceptance:result.acceptance, 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` });
|
|
284
317
|
} },
|
|
285
|
-
{ name: "ads_skills", description: "Select one ADS workflow after ads_status: ads-designer for building/refining/debugging UI; ads-
|
|
318
|
+
{ 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 })) }) },
|
|
286
319
|
{ 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 }) => {
|
|
287
320
|
const skill = skills.skills.find((entry) => entry.frontmatter.name === name);
|
|
288
321
|
if (!skill) throw new Error("Unknown ADS skill name.");
|
|
@@ -310,6 +343,8 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
310
343
|
} },
|
|
311
344
|
{ name: "ads_behaviors", description: "Discover behavior owners, then page an exact unit's checks, guarantees, subjects, demonstrations or profiles. Summary listings never embed runner logs. Default 10/max 20 entries and 8 KiB JSON per page; continue with nextCursor and identical filters. Cursors expire when discovery/evidence changes. Read sourceFile with ads_read_file for a complete contract. Metadata and reachable calls do not prove execution; use ads_verify for registered checks.", schema: z.object({ query: z.string().max(200).optional(), unit: z.string().min(1).max(256).optional(), api: z.string().max(200).optional(), section: z.enum(behaviorSections).optional(), ...paged }).strict(), call: args => json(behaviorPage(options,args)) },
|
|
312
345
|
{ name: "ads_results", title: "Read execution outcomes", description: "Read saved ads_verify/ads_apply_patch/ads_apply_transaction outcomes without rerunning anything. Pass the returned resultId; select outcomes, checks, diagnostics, advisories, warnings, changes, captures, acceptance, investigation or selection. Default 10/max 20 rows, at most 8 KiB JSON per page. Follow nextCursor with identical section/status. Rows marked detailTruncated can be read in full using recordIndex and offset/chars (max 2000); follow nextOffset. Only the latest verification and mutation snapshots are retained; replaced IDs fail explicitly. For one outcome's browser evidence use ads_investigate with its exact unit/check/runId.", schema: z.object({ resultId: z.string().uuid(), section: z.enum(resultSections).optional(), status: z.enum(["all","passed","not_passed"]).optional(), ...paged, ...recordRange }).strict(), call: args => json(executionResults.page(args)) },
|
|
346
|
+
{ 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) },
|
|
347
|
+
{ 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) },
|
|
313
348
|
{ 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. Only the latest bundle per check is retained, 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)) },
|
|
314
349
|
{ 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) => {
|
|
315
350
|
const result = await verification.run(args, signal, progress);
|
package/dist/paint-contracts.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import ts from "typescript";
|
|
3
3
|
import valueParser from "postcss-value-parser";
|
|
4
|
+
import { isSharedToken } from "./token-policy.mjs";
|
|
4
5
|
import { isContractFile, isInside } from "./config.mjs";
|
|
5
6
|
import { inspectUnitContracts, implementationIdentity, runtimeBindingOwner } from "./unit-contracts.mjs";
|
|
6
7
|
import { createSourceValues, reference } from "./source-values.mjs";
|
|
@@ -61,8 +62,7 @@ export function inspectPaintContracts(options) {
|
|
|
61
62
|
const paintProp=/^(?:background(?:Color)?|color|fill|stroke|stopColor|stop-color|floodColor|flood-color|(?:\w+)?ColorToken)$/i;
|
|
62
63
|
|
|
63
64
|
/** Check resolved values at the consuming source, so exports cannot launder privacy. */
|
|
64
|
-
export function inspectTokenValueFlows(program, options, inventory,
|
|
65
|
-
if(!scoped.definitions.length && !inspectUnitContracts(options).contracts.some(contract=>contract.paintInputs?.length))return;
|
|
65
|
+
export function inspectTokenValueFlows(program, options, inventory, units, report) {
|
|
66
66
|
const values=createSourceValues(program,options), checker=program.getTypeChecker();
|
|
67
67
|
const declarations=inspectUnitContracts(options).contracts;
|
|
68
68
|
function strings(input, context=values.state()) {
|
|
@@ -82,14 +82,13 @@ export function inspectTokenValueFlows(program, options, inventory, scoped, repo
|
|
|
82
82
|
}
|
|
83
83
|
for(const source of program.getSourceFiles()) {
|
|
84
84
|
if(!isInside(options.root,source.fileName)||source.fileName.includes(`${path.sep}node_modules${path.sep}`)||isContractFile(source.fileName))continue;
|
|
85
|
-
const owner=
|
|
85
|
+
const owner=units.owner(units.relative(path.relative(options.root,source.fileName)));
|
|
86
86
|
const emitted=new Set();
|
|
87
87
|
function check(node,text,bare=false,requirePaint=false,allowedBindings=null) {
|
|
88
88
|
const names=bare&&/^--[\w-]+$/.test(text)?[text]:valueParser(text).nodes.flatMap(function walk(value){return value.type==="function"&&value.value==="var"?[value.nodes.find(item=>item.type==="word")?.value]:value.nodes?value.nodes.flatMap(walk):[];}).filter(Boolean);
|
|
89
89
|
for(const name of names) {
|
|
90
|
-
const tokenOwner=scoped.definitions.find(entry=>name.startsWith(entry.namespace));
|
|
91
90
|
const binding=runtimeBindingOwner(options,name);
|
|
92
|
-
const issue=
|
|
91
|
+
const issue=binding&&(binding.unit!==owner||allowedBindings&&!allowedBindings.includes(binding.id))?`${name} is an instance binding private to ${binding.unit} and is not permitted by this consuming paint input.`:!binding&&(!isSharedToken(name)&&!/^--(?:ds|ux|showcase)-/.test(name)||requirePaint&&!inventory.tokens.some(token=>token.name===name))?`Undefined paint reference ${name}. Declare a real accessible token or a scoped runtime binding.`:null;
|
|
93
92
|
if(issue&&!emitted.has(`${node.pos}:${name}`)) {emitted.add(`${node.pos}:${name}`);const p=source.getLineAndCharacterOfPosition(node.getStart());report(source.fileName,"token-reference",issue,p.line+1,p.character+1);}
|
|
94
93
|
}
|
|
95
94
|
if(requirePaint&&!paintReference(text)) {const p=source.getLineAndCharacterOfPosition(node.getStart());report(source.fileName,"paint-reference",`Invalid paint reference ${JSON.stringify(text)}. Use an accessible token, declared scoped binding, local SVG paint resource, none or currentColor.`,p.line+1,p.character+1);}
|
|
@@ -38,8 +38,7 @@ export function previewEntriesPlugin(entries, mountEntry) {
|
|
|
38
38
|
load(id) {
|
|
39
39
|
const entry = ids.get(id.slice(1));
|
|
40
40
|
if (!entry) return;
|
|
41
|
-
|
|
42
|
-
return `import { mountScenario } from ${JSON.stringify(mountEntry)};${styles}import Scenario from ${JSON.stringify(path.resolve(entry.root, entry.file))};export const mount = container => mountScenario(Scenario,container);`;
|
|
41
|
+
return `import { mountScenario } from ${JSON.stringify(mountEntry)};import Scenario from ${JSON.stringify(path.resolve(entry.root, entry.file))};export const mount = container => mountScenario(Scenario,container);`;
|
|
43
42
|
},
|
|
44
43
|
};
|
|
45
44
|
}
|
package/dist/scenarios.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { projectCompilerOptions } from "./boundaries.mjs";
|
|
|
8
8
|
import { inspectTokens } from "./tokens.mjs";
|
|
9
9
|
import { isSharedToken } from "./token-policy.mjs";
|
|
10
10
|
import { validTokenSamples } from "./token-samples.mjs";
|
|
11
|
-
import {
|
|
11
|
+
import { inspectUnits } from "./units.mjs";
|
|
12
12
|
import { createScenarioTrace } from "./scenario-trace.mjs";
|
|
13
13
|
import { inspectRuntimeContracts } from "./runtime-contracts.mjs";
|
|
14
14
|
import { inspectUnitContracts } from "./unit-contracts.mjs";
|
|
@@ -51,7 +51,7 @@ export function inspectScenarios(options, suppliedProgram) {
|
|
|
51
51
|
const behaviorApis = new Map(publicApi(program, options).filter(item => !item.renderable && item.behavioral).map(item => [item.name, item]));
|
|
52
52
|
const tokenInventory = inspectTokens(root, options);
|
|
53
53
|
const tokenNames = new Set(tokenInventory.tokens.map(token => token.name));
|
|
54
|
-
const
|
|
54
|
+
const units = inspectUnits(options);
|
|
55
55
|
const scenarios = [];
|
|
56
56
|
const diagnostics = [...inspectUnitContracts(options).diagnostics,...inspectRuntimeContracts(options,program).diagnostics,...inspectPaintContracts(options).diagnostics];
|
|
57
57
|
const ids = new Set();
|
|
@@ -76,7 +76,7 @@ export function inspectScenarios(options, suppliedProgram) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
if(metadata?.id!==undefined) {
|
|
79
|
-
const owner=
|
|
79
|
+
const owner=units.owner(relative);
|
|
80
80
|
if(typeof metadata.id!=="string"||metadata.id.length>256||!/^[\w-]+(?:[/.][\w-]+)*$/.test(metadata.id)||!owner||!(metadata.id===owner||metadata.id.startsWith(owner+"/")||metadata.id.startsWith(owner+".")))report(file,"Scenario id must be a safe stable identity inside this owner; it cannot capture another layer/owner.",metadataExpression,{entry:"id"});
|
|
81
81
|
else id=metadata.id;
|
|
82
82
|
}
|
|
@@ -84,8 +84,8 @@ export function inspectScenarios(options, suppliedProgram) {
|
|
|
84
84
|
if (ids.has(id)) { report(file, `Duplicate scenario id ${id}. Use one entrypoint per identity.`); continue; }
|
|
85
85
|
ids.add(id);
|
|
86
86
|
if (metadata?.kind !== undefined) {
|
|
87
|
-
const owner =
|
|
88
|
-
if (metadata.kind !== "tokens" ||
|
|
87
|
+
const owner = units.owner(relative);
|
|
88
|
+
if (metadata.kind !== "tokens" || owner !== "tokens") report(file, "Token previews belong in the shared Data token directory. Components and patterns map shared tokens; they do not own independent token catalogues.",entryNode("kind"),{entry:"kind"});
|
|
89
89
|
else kind = "tokens";
|
|
90
90
|
}
|
|
91
91
|
if (!entry) report(file, "Export a default independently mountable scenario entrypoint.");
|
|
@@ -117,7 +117,7 @@ export function inspectScenarios(options, suppliedProgram) {
|
|
|
117
117
|
return index !== undefined && property && ts.isArrayLiteralExpression(property.initializer) ? property.initializer.elements[index] : property?.initializer ?? metadataExpression;
|
|
118
118
|
}
|
|
119
119
|
if (!metadata) {
|
|
120
|
-
report(file, "Scenario metadata is not statically readable. Render coverage is not established until this prerequisite is repaired.", metadataExpression, {coverage:"not-established",owner:
|
|
120
|
+
report(file, "Scenario metadata is not statically readable. Render coverage is not established until this prerequisite is repaired.", metadataExpression, {coverage:"not-established",owner:units.owner(relative)});
|
|
121
121
|
continue;
|
|
122
122
|
}
|
|
123
123
|
for(const field of Object.keys(metadata))if(!["id","title","kind","covers","exercises","tokens","samples","captureTargets"].includes(field))report(file,`Unknown scenario field ${field}.`,entryNode(field),{entry:field});
|
|
@@ -126,7 +126,7 @@ export function inspectScenarios(options, suppliedProgram) {
|
|
|
126
126
|
metadata.title=id;
|
|
127
127
|
}
|
|
128
128
|
if(!Array.isArray(metadata.covers)||!metadata.covers.length) {
|
|
129
|
-
report(file,"Scenario covers must be a nonempty static array naming rendered public UI. Coverage is not established until repaired.",entryNode("covers"),{entry:"covers",coverage:"not-established",owner:
|
|
129
|
+
report(file,"Scenario covers must be a nonempty static array naming rendered public UI. Coverage is not established until repaired.",entryNode("covers"),{entry:"covers",coverage:"not-established",owner:units.owner(relative)});
|
|
130
130
|
metadata.covers=[];
|
|
131
131
|
}
|
|
132
132
|
if(Object.hasOwn(metadata,"tokens")&&(!Array.isArray(metadata.tokens)||metadata.tokens.some(name=>typeof name!=="string"||!name.startsWith("--")))) {
|
|
@@ -163,16 +163,16 @@ export function inspectScenarios(options, suppliedProgram) {
|
|
|
163
163
|
const tokens = [...new Set([...(metadata.tokens ?? []), ...(metadata.samples ?? []).map(sample => sample.token)])];
|
|
164
164
|
for (const name of tokens) if (!tokenNames.has(name)) diagnostics.push({ file: path.relative(root, file).replaceAll("\\", "/"), rule: "token-scenario-reference", line: 1, column: 1, message: `Scenario references undeclared token ${name}. Use a real token from its defining owner.` });
|
|
165
165
|
if (kind === "tokens") {
|
|
166
|
-
const owner =
|
|
167
|
-
for (const name of tokens) if (tokenInventory.tokens.find(token => token.name === name)?.owner !== owner) report(file, `Token ${name} needs a preview beside its defining owner.
|
|
166
|
+
const owner = units.owner(relative);
|
|
167
|
+
for (const name of tokens) if (tokenInventory.tokens.find(token => token.name === name)?.owner !== owner) report(file, `Token ${name} needs a preview beside its defining owner. All design tokens and their previews belong under the configured shared token directory.`);
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
|
|
170
170
|
const reachable = new Set(metadata.covers);
|
|
171
171
|
function findBindings(node) { if(ts.isJsxElement(node)||ts.isJsxSelfClosingElement(node))for(const name of bindingTrace.traceRenders(node).rendered)reachable.add(name);ts.forEachChild(node,findBindings); }
|
|
172
172
|
if(bindingTrace) findBindings(source);
|
|
173
173
|
const paintBindings = inspectRuntimeContracts(options,program).bindings.filter(binding=>reachable.has(binding.scope.apiName)).map(binding=>({owner:binding.unit,name:binding.name,scope:binding.scope.selector,prefix:binding.prefix,suffix:binding.suffix,tokens:tokenInventory.tokens.filter(token=>!token.owner||token.owner==="tokens"||token.owner===binding.unit).map(token=>token.name)}));
|
|
174
174
|
const paintAudit=contractDeclarations.some(contract=>contract.paintInputs?.some(input=>reachable.has(input.apiName)));
|
|
175
|
-
scenarios.push({ id, kind, title: metadata.title, ...(fixture ? { fixture: path.relative(root, fixture).replaceAll("\\", "/") } : {}), covers: [...new Set(metadata.covers)], ...(captureTargets ? { captureTargets } : {}), ...(Object.hasOwn(metadata, "exercises") ? { exercises: [...new Set(exercises)] } : {}), tokens, ...(metadata.samples ? { samples: metadata.samples } : {}), ...(
|
|
175
|
+
scenarios.push({ id, kind, title: metadata.title, ...(fixture ? { fixture: path.relative(root, fixture).replaceAll("\\", "/") } : {}), covers: [...new Set(metadata.covers)], ...(captureTargets ? { captureTargets } : {}), ...(Object.hasOwn(metadata, "exercises") ? { exercises: [...new Set(exercises)] } : {}), tokens, ...(metadata.samples ? { samples: metadata.samples } : {}), ...(paintBindings.length?{paintBindings}:{}), ...(paintAudit?{paintAudit:true}:{}), file: path.relative(root, file).replaceAll("\\", "/"), artifact: path.relative(root, scenarioArtifact(root, id)).replaceAll("\\", "/") });
|
|
176
176
|
}
|
|
177
177
|
return { scenarios: scenarios.sort((a, b) => a.id.localeCompare(b.id)), diagnostics };
|
|
178
178
|
}
|
|
@@ -300,7 +300,7 @@ export function inspectScenarioCoverage(options, program, report, advise = () =>
|
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
302
|
const blockedOwners=new Set(registry.diagnostics.filter(item=>item.coverage==="not-established").map(item=>item.owner));
|
|
303
|
-
for (const item of ui.filter((item) => item.renderable && !covered.has(item.name) && !blockedOwners.has(
|
|
303
|
+
for (const item of ui.filter((item) => item.renderable && !covered.has(item.name) && !blockedOwners.has(inspectUnits(options).owner(inspectUnits(options).relative(path.relative(options.root,item.file)))))) report(item.file, "scenario-coverage", `Public UI ${item.name} needs a colocated, registered scenario render reference. Related parts may share a scenario.`);
|
|
304
304
|
for (const token of tokenInventory.tokens.filter(token => !coveredTokens.has(token.name))) {
|
|
305
305
|
const definition = token.definitions[0];
|
|
306
306
|
report(path.join(options.root, definition.file), "token-scenario-coverage", `Token ${token.name} needs a registered scenario with a reachable token fixture reference.`, definition.line, definition.column);
|
|
@@ -335,9 +335,9 @@ export function tokenSampleSource(options, scenario) {
|
|
|
335
335
|
const array = property && resolve(property.initializer);
|
|
336
336
|
if (array && ts.isArrayLiteralExpression(array)) {
|
|
337
337
|
const source = array.getSourceFile();
|
|
338
|
-
const
|
|
338
|
+
const units = inspectUnits(options), owner = units.owner(units.relative(scenario.file));
|
|
339
339
|
const relative = path.relative(options.root, source.fileName).replaceAll("\\", "/");
|
|
340
|
-
if (!isDevelopmentFile(source.fileName, options) ||
|
|
340
|
+
if (!isDevelopmentFile(source.fileName, options) || units.owner(units.relative(relative)) !== owner) throw new Error("The consumed samples array must live in this scenario's own development fixture.");
|
|
341
341
|
return {file:relative, content:source.text, start:array.getStart(source), end:array.end};
|
|
342
342
|
}
|
|
343
343
|
}
|
package/dist/skills/README.md
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Install the skills you need with `npx skills`:
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
npx skills add reqvire-org/ads --skill ads-designer --skill ads-import --skill ads-
|
|
6
|
+
npx skills add reqvire-org/ads --skill ads-designer --skill ads-import --skill ads-port --skill ads-break-ui --skill ads-motion
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
For local development, install from this checkout:
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npx skills add ./skills --skill ads-designer --skill ads-import --skill ads-
|
|
12
|
+
npx skills add ./skills --skill ads-designer --skill ads-import --skill ads-port --skill ads-break-ui --skill ads-motion
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Each skill includes its own instructions and references. `ads-designer` also
|
|
@@ -36,13 +36,17 @@ the browser, and provides a running URL or exact command for review. See the
|
|
|
36
36
|
|-------|-----|---------|
|
|
37
37
|
| [ads-designer](ads-designer/SKILL.md) | Bootstrap or build UI using the local ADS, with craft/mobile guidance | `$ads-designer build a settings page using this project's ADS` |
|
|
38
38
|
| [ads-import](ads-import/SKILL.md) | Import selected external ADS source, brand artwork, or compatible source token values | `$ads-import /path/to/source-repo component Toast` |
|
|
39
|
-
| [ads-
|
|
39
|
+
| [ads-port](ads-port/SKILL.md) | Port library capabilities into a coherent ADS using shared tokens and primitives | `$ads-port https://github.com/emilkowalski/sonner` |
|
|
40
40
|
| [ads-break-ui](ads-break-ui/SKILL.md) | Stress-test real components/patterns; optionally fix demonstrated failures | `$ads-break-ui AppShell +fix` |
|
|
41
41
|
| [ads-motion](ads-motion/SKILL.md) | Implement, review, audit, or profile motion | `$ads-motion review Toast` |
|
|
42
42
|
|
|
43
43
|
For token values, use `$ads-import /path/to/source-repo tokens`; for original
|
|
44
44
|
artwork and its guidance, use `$ads-import /path/to/source-repo brand`. ADS token
|
|
45
45
|
names and ownership prefixes are fixed; imports conform to that architecture.
|
|
46
|
+
Shared Data is the only design-value catalogue. Existing project font, text and
|
|
47
|
+
spacing roles take precedence over divergent upstream constants. Each skill
|
|
48
|
+
includes `references/design-data.md` for source rules and duplication review;
|
|
49
|
+
demo framing lives in development-only `review/`.
|
|
46
50
|
For motion, the
|
|
47
51
|
request selects the mode, for example `build`, `audit`, or `performance`.
|
|
48
52
|
Review/audit requests report findings; a fix request authorizes implementation.
|
|
@@ -49,7 +49,7 @@ ADS gates. For binary/large assets, generate `git diff --binary --full-index` in
|
|
|
49
49
|
stay out of model context. Binary changes require Git. When editing is disabled,
|
|
50
50
|
use the client's normal source-editing tools.
|
|
51
51
|
For owner drafts, token-sample reconciliation, coupled transactions and local
|
|
52
|
-
|
|
52
|
+
shared Data ownership, read [guarded-editing.md](references/guarded-editing.md).
|
|
53
53
|
For on-demand current/candidate screenshots and visual dry-run review, read
|
|
54
54
|
[captures.md](references/captures.md).
|
|
55
55
|
For a rejected patch, failed check or loading error, read
|
|
@@ -93,11 +93,11 @@ pattern; reusable controllers use discovered `controllers/<Name>` units. Use the
|
|
|
93
93
|
project's configured framework and declared dependencies, or plain TypeScript,
|
|
94
94
|
browser APIs and local helpers. MCP hosts supply no ad hoc runtime APIs. The
|
|
95
95
|
framework setting selects compilation/mounting; controller checks also validate
|
|
96
|
-
imports. For controller/behavior work, read
|
|
97
|
-
|
|
96
|
+
imports. For controller/behavior work, read
|
|
97
|
+
[behaviors.md](references/behaviors.md), also served as `ads://guides/behaviors`. Discover registered guarantees
|
|
98
98
|
with `ads_behaviors`; use `ads_verify` for selected real checks. Optional
|
|
99
99
|
`exercises` links public behavioral APIs to scenarios; keep `covers` for rendered
|
|
100
|
-
UI. Registration and demonstration are not passing evidence.
|
|
100
|
+
UI. Registration and demonstration are not passing evidence. `<Owner>.ads.contract.ts`,
|
|
101
101
|
scenarios, fixtures and checks stay out of production exports/imports. Verify
|
|
102
102
|
current results, including lifecycle setup/cleanup/setup and the actual browser
|
|
103
103
|
profile when promised. React StrictMode needs a development harness; wrapping a
|
|
@@ -154,7 +154,7 @@ failure is reproducible.
|
|
|
154
154
|
|
|
155
155
|
Scenarios own sample data and example selection. Missing reusable UI belongs in the
|
|
156
156
|
ADS implementation and public exports, not in a scenario-only control. The tool supplies the neutral client shell; reusable scenario review layouts
|
|
157
|
-
are
|
|
157
|
+
are exported through the separate development-only review entry.
|
|
158
158
|
Showcase/scenario files define no CSS, custom classes, or widget markup. Change
|
|
159
159
|
the owning ADS frame pattern when a necessary layout is missing. Run shared ADS/project guards for its build and the app
|
|
160
160
|
build, then give a full running URL or exact run command for human review.
|
|
@@ -179,26 +179,27 @@ The host shows errors and marks retained output as stale. Other hosts may need a
|
|
|
179
179
|
explicit preview-tool invocation. Compilation remains project-owned and required
|
|
180
180
|
for TSX/Linaria; it is automatic, not eliminated.
|
|
181
181
|
|
|
182
|
-
Reusable review layouts belong in
|
|
182
|
+
Reusable review layouts belong in development-only `review/`, exported through
|
|
183
|
+
the separate review entry, while scenario
|
|
183
184
|
files define no CSS, custom classes or widget replicas. Keep real presentation in
|
|
184
185
|
its component/pattern owner. The tooling shell's CSS is outside that project
|
|
185
186
|
contract. Legacy custom showcase pages may be retained during migration; new
|
|
186
187
|
projects require no TokensPage/ComponentsPage/PatternsPage/CompositionPage files.
|
|
187
188
|
|
|
188
|
-
Colocate
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
Colocate `<Owner>.ads.scenario.tsx` and `<Owner>.ads.fixture.ts` with tokens and
|
|
190
|
+
each component/pattern. Put larger entries under `composition/<Name>/` with their
|
|
191
|
+
own marked scenario and fixture. Export a default
|
|
191
192
|
zero-input mountable view and literal metadata, for example
|
|
192
193
|
`export const scenario = { title: "Button states", covers: ["Button"] };`.
|
|
193
194
|
Import the real UI from the public ADS alias. Keep fixture inputs, simulated
|
|
194
195
|
services and initial state/callback adapters beside the scenario. Empty fixtures
|
|
195
196
|
are valid for an entry with no inputs. Extra development helpers use a
|
|
196
|
-
|
|
197
|
+
`<Owner>.ads.helpers.ts` file, so guards
|
|
197
198
|
recognize their role even beside runtime code. Never require a page, router or store to
|
|
198
199
|
initialize the entry. Several contextual public parts may share one scenario.
|
|
199
200
|
|
|
200
|
-
IDs derive from ADS-relative filenames: both `components/core/Button/
|
|
201
|
-
and `components/core/Button.scenario.tsx` identify `components/core/Button`.
|
|
201
|
+
IDs derive from ADS-relative filenames: both `components/core/Button/Button.ads.scenario.tsx`
|
|
202
|
+
and `components/core/Button.ads.scenario.tsx` identify `components/core/Button`.
|
|
202
203
|
Use one form, no duplicate IDs or hand-maintained registry. Renames change IDs.
|
|
203
204
|
The showcase and external hosts mount the same discovered entry. The Vite
|
|
204
205
|
adapter uses `previewEntriesPlugin` and `createPreviewResources` with
|
|
@@ -358,5 +359,14 @@ Source credits and retained MIT terms: [README.md](README.md) and
|
|
|
358
359
|
|
|
359
360
|
For static owner contracts, `.ads.` development roles, typed paint/binding APIs,
|
|
360
361
|
declarative parent graphs, constrained theme bindings, private visual subject roles,
|
|
361
|
-
|
|
362
|
+
shared Data ownership and guarded migration, read
|
|
362
363
|
[contracts.md](references/contracts.md) when the task touches those contracts.
|
|
364
|
+
|
|
365
|
+
For a suspected ADS defect or missing capability after targeted investigation, read
|
|
366
|
+
[reporting.md](references/reporting.md). Record actionable observations with
|
|
367
|
+
`ads_report_bug` or `ads_request_feature`; preserve valid APIs and rejected drafts.
|
|
368
|
+
|
|
369
|
+
For Data/UX/Skin boundaries, shared token reuse and private-value diagnostics, read
|
|
370
|
+
[design-data.md](references/design-data.md). Components own mappings and mechanics,
|
|
371
|
+
not independent token catalogues. Existing project font, text and spacing roles
|
|
372
|
+
take precedence over divergent upstream constants during adaptation.
|
|
@@ -110,8 +110,7 @@ MCP delivers it inside the App document, not the outer showcase host.
|
|
|
110
110
|
ownership, and rejects conflicting schemas or registrations shared by unrelated
|
|
111
111
|
owners. Identical registrations from the same owner are permitted. Runtime
|
|
112
112
|
`--ds-*` / `--ux-*` variables stay with their runtime owner. A shared token's
|
|
113
|
-
registration belongs beside its actual definition in a foundation value sheet
|
|
114
|
-
a namespaced owner token's registration belongs in its registered `tokens.css`.
|
|
113
|
+
registration belongs beside its actual definition in a foundation value sheet.
|
|
115
114
|
Neither `base.css` nor `fonts.css` becomes a registration escape hatch. Registration
|
|
116
115
|
alone does not define a token or satisfy its sample/fixture coverage.
|
|
117
116
|
|
|
@@ -258,6 +257,14 @@ contract; an overlap warning remains a review signal.
|
|
|
258
257
|
with `severity: "warning"`. CLI checks still exit successfully when there are no
|
|
259
258
|
errors; MCP checks and mutations preserve the warning and its guidance URI.
|
|
260
259
|
|
|
260
|
+
An unchanged advisory baseline is not evidence that the affected styles are
|
|
261
|
+
correct. Triage warnings that reach an edited owner or its shared helpers against
|
|
262
|
+
the actual DOM classes and computed styles in a compiled scenario. Interaction
|
|
263
|
+
checks may pass without measuring padding, alignment or sizing. When an intended
|
|
264
|
+
layout is known, add a focused rendered assertion for that contract; when keeping
|
|
265
|
+
an overlap, state why it is intentional and which states/directions were checked.
|
|
266
|
+
Keep unresolved paths and unsupported writing modes explicit in the evidence.
|
|
267
|
+
|
|
261
268
|
The source review examines atomic Linaria templates and statically traceable
|
|
262
269
|
`cx` arguments, including aliases, local imports/re-exports, local helper returns,
|
|
263
270
|
arguments/defaults, nested composition, conditional expressions and variant-object
|