Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

docs(knowledge): every component spec lives in docs/specs/components, one folder per component (#9007)

Cindy Zhange0a03766d05f
diff --git a/.changeset/component-specs-move-to-docs.md b/.changeset/component-specs-move-to-docs.md
new file mode 100644
index 0000000000..1ff3470acd
--- /dev/null
+++ b/.changeset/component-specs-move-to-docs.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/core': patch
+---
+
+[docs] Component specs are no longer shipped inside the npm package; they live in the repo at `docs/specs/components/`, one folder per component, beside each platform's spec. `astryx swizzle` no longer copies the component's spec file into your project. Nothing a consumer imports or renders changes.
+
+@cixzhang
diff --git a/.github/REVIEW_GATE.md b/.github/REVIEW_GATE.md
index e97d8dffa8..6c2b863ebc 100644
--- a/.github/REVIEW_GATE.md
+++ b/.github/REVIEW_GATE.md
@@ -56,7 +56,7 @@ A PR changes only spec records when every changed path is one of:
- `docs/specs/<id>/spec.md` or `plan.md`;
- a family or design spec (excluding indexes, templates, schemas, and assets);
-- a colocated Core/Lab `<Name>.spec.md`.
+- a component or module record under `docs/specs/components/`.
Draft-only spec records can merge after validation without owner approval.
Approval reads the record against the `## Writing rubric results` the author
diff --git a/.github/scripts/a11y-pr-contracts.test.mjs b/.github/scripts/a11y-pr-contracts.test.mjs
index 85a362edc2..20a8256148 100644
--- a/.github/scripts/a11y-pr-contracts.test.mjs
+++ b/.github/scripts/a11y-pr-contracts.test.mjs
@@ -213,7 +213,7 @@ describe('selectSpecs', () => {
});
it('runs no spec for a changed knowledge record alone', () => {
- const record = 'packages/core/src/Chat/ChatLayout.spec.md';
+ const record = 'docs/specs/components/Chat/ChatLayout.spec.md';
expect(pr(all, {changedPaths: [record]})).toEqual([always.file]);
const pattern = spec(
'internal/a11y-spec/src/patterns/accordion.chromium.spec.ts',
@@ -221,7 +221,7 @@ describe('selectSpecs', () => {
);
expect(
pr([pattern], {
- changedPaths: ['packages/core/src/Collapsible/Collapsible.spec.md'],
+ changedPaths: ['docs/specs/components/Collapsible/Collapsible.spec.md'],
}),
).toEqual([]);
// Code beside the record still selects the spec.
@@ -531,7 +531,7 @@ describe('isKnowledgeRecord', () => {
});
it('treats a component record as a record and its fixtures as not', () => {
- expect(isKnowledgeRecord('packages/core/src/Chat/ChatLayout.spec.md')).toBe(
+ expect(isKnowledgeRecord('docs/specs/components/Chat/ChatLayout.spec.md')).toBe(
true,
);
expect(
diff --git a/.github/scripts/analyze-pr.test.mjs b/.github/scripts/analyze-pr.test.mjs
index 68868762b3..ed09acbfe1 100644
--- a/.github/scripts/analyze-pr.test.mjs
+++ b/.github/scripts/analyze-pr.test.mjs
@@ -89,7 +89,8 @@ function buildFixture() {
fs.writeFileSync(path.join(upstream, 'packages/core/src/Badge/Badge.tsx'), 'export function Badge() {}\n');
fs.writeFileSync(path.join(upstream, 'packages/core/src/Badge/Badge.doc.mjs'), "export default {name: 'Badge'};\n");
fs.writeFileSync(path.join(upstream, 'packages/core/src/Badge/index.ts'), "export {Badge} from './Badge';\n");
- fs.writeFileSync(path.join(upstream, 'packages/core/src/Badge/Badge.spec.md'), '---\nschema_version: 3\n---\n');
+ fs.mkdirSync(path.join(upstream, 'docs/specs/components/Badge'), {recursive: true});
+ fs.writeFileSync(path.join(upstream, 'docs/specs/components/Badge/Badge.spec.md'), '---\nschema_version: 3\n---\n');
fs.writeFileSync(path.join(upstream, 'packages/core/src/Card/Card.tsx'), 'export function Card() {}\n');
fs.writeFileSync(path.join(upstream, 'packages/core/src/Card/Card.doc.mjs'), "export default {name: 'Card'};\n");
fs.writeFileSync(path.join(upstream, 'packages/core/src/Card/index.ts'), "export {Card} from './Card';\n");
@@ -150,7 +151,7 @@ function buildFixture() {
git(upstream, ['checkout', '-q', 'feature']);
fs.appendFileSync(path.join(upstream, 'packages/core/src/Card/index.ts'), 'export const Card = {}\n');
// Only Badge's knowledge record changes: no browser audit owns Badge.
- fs.appendFileSync(path.join(upstream, 'packages/core/src/Badge/Badge.spec.md'), 'record text\n');
+ fs.appendFileSync(path.join(upstream, 'docs/specs/components/Badge/Badge.spec.md'), 'record text\n');
fs.appendFileSync(
path.join(upstream, 'packages/richtext/src/RichTextEditor.tsx'),
'export const richTextChanged = true\n',
diff --git a/.github/scripts/change-scope.cjs b/.github/scripts/change-scope.cjs
index 88cc3ecb6e..d0f105e382 100644
--- a/.github/scripts/change-scope.cjs
+++ b/.github/scripts/change-scope.cjs
@@ -4,7 +4,10 @@
/* global console, module, process, require */
// eslint-disable-next-line @typescript-eslint/no-require-imports
-const {isComponentSpecRecordPath} = require('./knowledge-paths.cjs');
+const {
+ isComponentSpecRecordPath,
+ isLegacyComponentSpecPath,
+} = require('./knowledge-paths.cjs');
/**
* Classifies changed paths without reading PR-controlled content.
@@ -134,6 +137,8 @@ function isPackageReleasePath(filePath) {
function isKnowledgeRecordPath(filePath) {
return (
isSpecRecordPath(filePath) ||
+ // Not a record and never spec-only, but the owner gate must still see it.
+ isLegacyComponentSpecPath(filePath) ||
KNOWLEDGE_RECORD_PATTERNS.some(pattern => pattern.test(filePath))
);
}
diff --git a/.github/scripts/change-scope.test.mjs b/.github/scripts/change-scope.test.mjs
index 479a6180b9..5451a0d724 100644
--- a/.github/scripts/change-scope.test.mjs
+++ b/.github/scripts/change-scope.test.mjs
@@ -18,15 +18,15 @@ describe('spec-only change scope', () => {
{filename: 'docs/families/input-fields.md'},
{filename: 'docs/design/selection-inputs.md'},
{filename: 'packages/themes/neutral/neutral.spec.md'},
- {filename: 'packages/core/src/Selector/Selector.spec.md'},
+ {filename: 'docs/specs/components/Selector/Selector.spec.md'},
{
filename:
- 'packages/core/src/Table/plugins/rowStatus/useTableRowStatus.spec.md',
+ 'docs/specs/components/Table/plugins/rowStatus/useTableRowStatus.spec.md',
},
- {filename: 'packages/lab/src/FutureInput/FutureInput.spec.md'},
- {filename: 'packages/charts/src/Chart.spec.md'},
- {filename: 'packages/richtext/src/RichTextView.spec.md'},
- {filename: 'packages/vega/src/VegaChart.spec.md'},
+ {filename: 'docs/specs/components/FutureInput/FutureInput.spec.md'},
+ {filename: 'docs/specs/components/Chart/Chart.spec.md'},
+ {filename: 'docs/specs/components/RichTextView/RichTextView.spec.md'},
+ {filename: 'docs/specs/components/VegaChart/VegaChart.spec.md'},
]);
expect(result.specOnly).toBe(true);
});
@@ -168,18 +168,49 @@ describe('spec-only change scope', () => {
});
it.each([
- 'packages/core/src/__tests__/TopLevel.spec.md',
- 'packages/core/src/Selector/__fixtures__/fixture.spec.md',
- 'packages/core/src/Selector/.hidden/Hidden.spec.md',
- 'packages/core/src/Selector/.Hidden.spec.md',
- 'packages/core/src/Selector/generated/fake.spec.md',
- 'packages/core/src/Selector/plugins/fake.generated.spec.md',
+ 'docs/specs/components/__tests__/TopLevel.spec.md',
+ 'docs/specs/components/Selector/__fixtures__/fixture.spec.md',
+ 'docs/specs/components/Selector/.hidden/Hidden.spec.md',
+ 'docs/specs/components/Selector/.Hidden.spec.md',
+ 'docs/specs/components/Selector/generated/fake.spec.md',
+ 'docs/specs/components/Selector/plugins/fake.generated.spec.md',
])('ignores non-record component spec path %s consistently', filename => {
const result = classifyChanges([{filename}]);
expect(result.specOnly).toBe(false);
expect(result.touchesKnowledgeRecords).toBe(false);
});
+ it.each([
+ ['packages/core/src/Selector/Selector.spec.md', ['runtime:core']],
+ [
+ 'packages/core/src/Table/plugins/rowStatus/useTableRowStatus.spec.md',
+ ['runtime:core'],
+ ],
+ ['packages/charts/src/ChartAxis.spec.md', ['runtime:charts']],
+ [
+ 'packages/native/apple/Sources/Astryx/Button/Button.spec.md',
+ ['shared-or-unknown'],
+ ],
+ ])(
+ 'owner-gates a spec left at its old path, %s, without the spec-only fast path',
+ (filename, surfaces) => {
+ const result = classifyChanges([{filename}]);
+ expect(result.specOnly).toBe(false);
+ expect(result.touchesKnowledgeRecords).toBe(true);
+ expect(result.surfaces).toEqual(surfaces);
+ },
+ );
+
+ it.each([
+ 'packages/core/src/__tests__/TopLevel.spec.md',
+ 'packages/core/src/Selector/__fixtures__/fixture.spec.md',
+ 'packages/core/src/Selector/plugins/fake.generated.spec.md',
+ 'packages/cli/src/Prompt.spec.md',
+ 'packages/core/src/Button/Button.a11y.chromium.spec.ts',
+ ])('does not owner-gate %s as an old-path record', filename => {
+ expect(classifyChanges([{filename}]).touchesKnowledgeRecords).toBe(false);
+ });
+
it('fails closed for an empty change set', () => {
expect(classifyChanges([]).specOnly).toBe(false);
});
@@ -205,7 +236,7 @@ describe('spec-only change scope', () => {
expect(
classifyChanges([
{
- filename: 'packages/core/src/Selector/Selector.spec.md',
+ filename: 'docs/specs/components/Selector/Selector.spec.md',
previous_filename: 'packages/core/src/Selector/Selector.tsx',
},
]).specOnly,
@@ -257,7 +288,7 @@ describe('positive CI surfaces', () => {
it('keeps pure specification records in the knowledge singleton', () => {
const result = classifyChanges([
- {filename: 'packages/core/src/Button/Button.spec.md'},
+ {filename: 'docs/specs/components/Button/Button.spec.md'},
]);
expect(result.specOnly).toBe(true);
expect(result.toolingOnly).toBe(false);
@@ -268,7 +299,7 @@ describe('positive CI surfaces', () => {
{
name: 'component spec plus component code',
files: [
- 'packages/core/src/Button/Button.spec.md',
+ 'docs/specs/components/Button/Button.spec.md',
'packages/core/src/Button/Button.tsx',
],
surfaces: [SURFACES.KNOWLEDGE, 'runtime:core'],
@@ -276,7 +307,7 @@ describe('positive CI surfaces', () => {
{
name: 'module spec plus Table plugin code',
files: [
- 'packages/core/src/Table/plugins/rowStatus/useTableRowStatus.spec.md',
+ 'docs/specs/components/Table/plugins/rowStatus/useTableRowStatus.spec.md',
'packages/core/src/Table/plugins/rowStatus/useTableRowStatus.tsx',
],
surfaces: [SURFACES.KNOWLEDGE, 'runtime:core'],
diff --git a/.github/scripts/ci-interaction-webkit.test.mjs b/.github/scripts/ci-interaction-webkit.test.mjs
index 42a81fd271..d67eb68641 100644
--- a/.github/scripts/ci-interaction-webkit.test.mjs
+++ b/.github/scripts/ci-interaction-webkit.test.mjs
@@ -281,7 +281,7 @@ describe('WebKit interaction proof routing', () => {
'.changeset/toast-pause-sources.md',
'packages/core/src/Toast/Toast.tsx',
'packages/core/src/Toast/ToastViewport.test.tsx',
- 'packages/core/src/Toast/Toast.spec.md',
+ 'docs/specs/components/Toast/Toast.spec.md',
],
[
'.changeset/textarea-counter-i18n.md',
diff --git a/.github/scripts/component-audit-scope.test.mjs b/.github/scripts/component-audit-scope.test.mjs
index 6e3517bbfc..78932eebda 100644
--- a/.github/scripts/component-audit-scope.test.mjs
+++ b/.github/scripts/component-audit-scope.test.mjs
@@ -90,7 +90,7 @@ describe('component audit scope', () => {
expect(
classifyComponentAuditScope(
[
- 'packages/core/src/Button/Button.spec.md',
+ 'docs/specs/components/Button/Button.spec.md',
'packages/cli/api/theme/build/build.mjs',
],
COMPONENT_PACKAGES,
@@ -102,7 +102,7 @@ describe('component audit scope', () => {
expect(
classifyComponentAuditScope(
[
- 'packages/core/src/Button/Button.spec.md',
+ 'docs/specs/components/Button/Button.spec.md',
'packages/core/src/Button/Button.tsx',
],
COMPONENT_PACKAGES,
diff --git a/.github/scripts/component-design-decisions.test.mjs b/.github/scripts/component-design-decisions.test.mjs
index 2b5d6ba1d4..5331d8f42c 100644
--- a/.github/scripts/component-design-decisions.test.mjs
+++ b/.github/scripts/component-design-decisions.test.mjs
@@ -176,7 +176,7 @@ describe('parseDesignDecisionsBlock', () => {
});
describe('classifyDesignDecisionChange', () => {
- const path = 'packages/core/src/Button/Button.spec.md';
+ const path = 'docs/specs/components/Button/Button.spec.md';
it('stays dependency-free for trusted workflow loading', () => {
const source = readFileSync(
@@ -226,7 +226,7 @@ describe('classifyDesignDecisionChange', () => {
it('classifies a valid current module block edit as DD-only', () => {
const modulePath =
- 'packages/core/src/Table/plugins/rowStatus/useTableRowStatus.spec.md';
+ 'docs/specs/components/Table/plugins/rowStatus/useTableRowStatus.spec.md';
expect(
classifyDesignDecisionChange({
basePath: modulePath,
diff --git a/.github/scripts/knowledge-paths.cjs b/.github/scripts/knowledge-paths.cjs
index 1ec206fbe5..8e834578f5 100644
--- a/.github/scripts/knowledge-paths.cjs
+++ b/.github/scripts/knowledge-paths.cjs
@@ -4,17 +4,33 @@
/* global module, require */
/**
- * One shared path contract for component-local knowledge records. It consumes
- * the component-package registry so validation, change classification, and the
- * spec-owner gate cannot disagree about supported package layouts.
+ * One shared path contract for component knowledge records. Every component
+ * record, for every package and platform, lives under
+ * `docs/specs/components/<ComponentRoot>/`, mirroring the component's source
+ * tree: a component root's records sit directly in its folder, and module
+ * records keep the subdirectories their code has. Validation, change
+ * classification, and the spec-owner gate all read paths through this file, so
+ * they cannot disagree about the layout. Classification reads the path alone;
+ * `resolveComponentPackage` reads the working tree to find the package that
+ * owns a component root.
*/
+const fs = require('node:fs');
+const path = require('node:path');
// eslint-disable-next-line @typescript-eslint/no-require-imports
const {
+ COMPONENT_PACKAGES,
COMPONENT_PACKAGE_NAMES,
- componentPackage,
} = require('../../scripts/component-packages.cjs');
+const COMPONENT_SPEC_ROOT = 'docs/specs/components';
+
+/**
+ * Platform implementation languages whose component records sit beside the
+ * core record as `<PublicName>.<language>.spec.md`.
+ */
+const PLATFORM_SPEC_LANGUAGES = Object.freeze(['swift']);
+
const IGNORED_COMPONENT_KNOWLEDGE_SEGMENTS = new Set([
'__fixtures__',
'__generated__',
@@ -42,65 +58,271 @@ function isIgnoredComponentKnowledgeSegment(segment) {
}
/**
- * Classify a canonical component-local knowledge candidate by path alone.
- * Directory-layout component records are direct children of a component root;
- * flat-package component records are direct children of src. Module records are
- * nested below either component boundary. Semantic kind, filename/id agreement,
- * and parent ownership are validated after parsing.
+ * The segments of a candidate below `docs/specs/components/`, or null when the
+ * path is outside that root, sits directly in it, or crosses an ignored segment.
*/
-function classifyComponentKnowledgePath(filePath) {
+function componentSpecSegments(filePath) {
const normalized = normalizePath(filePath);
- const match = /^packages\/([^/]+)\/src\/(.+\.spec\.md)$/.exec(normalized);
- if (!match) return null;
-
- const packageName = match[1];
- const packageConfig = componentPackage(packageName);
- if (!packageConfig) return null;
-
- const packageRelativePath = match[2];
- const packageSegments = packageRelativePath.split('/');
- if (packageSegments.some(isIgnoredComponentKnowledgeSegment)) return null;
+ const prefix = `${COMPONENT_SPEC_ROOT}/`;
+ if (!normalized.startsWith(prefix) || !normalized.endsWith('.spec.md')) {
+ return null;
+ }
+ const segments = normalized.slice(prefix.length).split('/');
+ if (segments.length < 2) return null;
+ if (segments.some(isIgnoredComponentKnowledgeSegment)) return null;
+ if (segments.at(-1).endsWith('.generated.spec.md')) return null;
+ return segments;
+}
- const fileName = packageSegments.at(-1);
- if (fileName.endsWith('.generated.spec.md')) return null;
+/**
+ * Classify a canonical component knowledge candidate by path alone. A record
+ * directly in `docs/specs/components/<ComponentRoot>/` is a component record;
+ * one nested deeper is a module record. Semantic kind, filename/id agreement,
+ * the owning package, and parent ownership are validated after parsing.
+ */
+function classifyComponentKnowledgePath(filePath) {
+ const segments = componentSpecSegments(filePath);
+ if (!segments) return null;
+ const fileName = segments.at(-1);
const publicName = fileName.slice(0, -'.spec.md'.length);
if (!/^[A-Za-z][A-Za-z0-9]*$/.test(publicName)) return null;
-
- if (packageConfig.layout === 'flat') {
- const nested = packageSegments.length > 1;
- return {
- componentRoot: nested ? packageSegments[0] : publicName,
- fileName,
- kind: nested ? 'module' : 'component',
- layout: packageConfig.layout,
- packageName,
- publicName,
- relativePath: packageRelativePath,
- };
- }
-
- if (packageSegments.length < 2) return null;
- const componentRoot = packageSegments[0];
- const relativePath = packageSegments.slice(1).join('/');
return {
- componentRoot,
+ componentRoot: segments[0],
fileName,
- kind: relativePath.includes('/') ? 'module' : 'component',
- layout: packageConfig.layout,
- packageName,
+ kind: segments.length === 2 ? 'component' : 'module',
publicName,
- relativePath,
+ relativePath: segments.slice(1).join('/'),
};
}
+/**
+ * Classify a platform implementation's component record,
+ * `docs/specs/components/<ComponentRoot>/<PublicName>.<language>.spec.md`.
+ */
+function classifyPlatformComponentSpecPath(filePath) {
+ const segments = componentSpecSegments(filePath);
+ if (!segments || segments.length !== 2) return null;
+ const match = /^([A-Za-z][A-Za-z0-9]*)\.([a-z][a-z0-9-]*)\.spec\.md$/.exec(
+ segments[1],
+ );
+ if (!match || !PLATFORM_SPEC_LANGUAGES.includes(match[2])) return null;
+ return {
+ componentRoot: segments[0],
+ fileName: segments[1],
+ language: match[2],
+ publicName: match[1],
+ };
+}
+
+/**
+ * A spec file at a location component records used before they moved to
+ * `docs/specs/components/`: inside a registered component package's `src`, or
+ * beside a Swift view under `packages/native/apple/Sources/`. Such a file is
+ * not a record, but change classification treats it as knowledge so the owner
+ * gate fails closed for a branch that still edits one: on merge, rename
+ * detection carries that edit into the record's new location.
+ */
+function isLegacyComponentSpecPath(filePath) {
+ const normalized = normalizePath(filePath);
+ if (!normalized.endsWith('.spec.md')) return false;
+ if (normalized.endsWith('.generated.spec.md')) return false;
+ const nativeMatch = /^packages\/native\/apple\/Sources\/(.+)$/.exec(
+ normalized,
+ );
+ const sourceMatch = /^packages\/([^/]+)\/src\/(.+)$/.exec(normalized);
+ let segments;
+ if (nativeMatch) {
+ segments = nativeMatch[1].split('/');
+ } else if (sourceMatch && COMPONENT_PACKAGE_NAMES.includes(sourceMatch[1])) {
+ segments = sourceMatch[2].split('/');
+ } else {
+ return false;
+ }
+ if (segments.some(isIgnoredComponentKnowledgeSegment)) return false;
+ return /^[A-Za-z][A-Za-z0-9]*\.spec\.md$/.test(segments.at(-1));
+}
+
function isComponentSpecRecordPath(filePath) {
return classifyComponentKnowledgePath(filePath) !== null;
}
+function isPlatformComponentSpecPath(filePath) {
+ return classifyPlatformComponentSpecPath(filePath) !== null;
+}
+
+/**
+ * Exact-case directory entries, so a case-insensitive file system agrees with
+ * CI. Read fresh on every call: callers resolve a few hundred records at most,
+ * and a cache would go stale when a caller writes files between lookups.
+ */
+function directoryEntries(directory) {
+ try {
+ return new Map(
+ fs
+ .readdirSync(directory, {withFileTypes: true})
+ .map(entry => [entry.name, entry.isDirectory() ? 'dir' : 'file']),
+ );
+ } catch {
+ return new Map();
+ }
+}
+
+function hasEntry(directory, name, type) {
+ return directoryEntries(directory).get(name) === type;
+}
+
+/** True when `relativeDirectory` (posix, may be '.') exists below `base`, exact case. */
+function hasDirectoryPath(base, relativeDirectory) {
+ let current = base;
+ for (const segment of relativeDirectory.split('/')) {
+ if (segment === '.' || segment === '') continue;
+ if (!hasEntry(current, segment, 'dir')) return false;
+ current = path.join(current, segment);
+ }
+ return true;
+}
+
+/**
+ * The registered package that owns a classified component record. A package
+ * can own the record's component root when it has `src/<ComponentRoot>/`, or,
+ * for a flat package, a `src/<ComponentRoot>` module. When more than one
+ * package has that root (Core and Lab both keep a `Chat/`), the owner is the
+ * one that holds the record's code: the same-stem `<PublicName>.doc.mjs` of a
+ * component record, or the mirrored directory of a module record. Null when no
+ * package, or more than one, owns it.
+ */
+function resolveComponentPackage(root, classified) {
+ const {componentRoot, kind, publicName, relativePath} = classified;
+ const candidates = COMPONENT_PACKAGES.filter(pkg => {
+ const source = path.join(root, pkg.src);
+ if (hasEntry(source, componentRoot, 'dir')) return true;
+ return (
+ pkg.layout === 'flat' &&
+ ['.tsx', '.ts'].some(extension =>
+ hasEntry(source, `${componentRoot}${extension}`, 'file'),
+ )
+ );
+ });
+ if (candidates.length <= 1) return candidates[0] ?? null;
+ const pick = test => {
+ const owners = candidates.filter(test);
+ return owners.length === 1 ? owners[0] : null;
+ };
+ if (kind === 'module') {
+ // A module record mirrors its code's directory when it has one. One kept
+ // in `modules/` belongs to the package holding a same-stem source or doc
+ // file (under the component root, or anywhere in a flat package's src),
+ // and otherwise to its parent component record's package.
+ return (
+ pick(pkg =>
+ hasDirectoryPath(
+ path.join(root, pkg.src, componentRoot),
+ path.posix.dirname(relativePath),
+ ),
+ ) ??
+ pick(pkg =>
+ hasStemBelow(
+ pkg.layout === 'flat'
+ ? path.join(root, pkg.src)
+ : path.join(root, pkg.src, componentRoot),
+ publicName,
+ ),
+ ) ??
+ resolveComponentPackage(root, {
+ componentRoot,
+ kind: 'component',
+ publicName: componentRoot,
+ relativePath: `${componentRoot}.spec.md`,
+ })
+ );
+ }
+ return pick(pkg => {
+ const source = path.join(root, pkg.src);
+ const docDirectory =
+ pkg.layout === 'flat' && publicName === componentRoot
+ ? source
+ : path.join(source, componentRoot);
+ return hasEntry(docDirectory, `${publicName}.doc.mjs`, 'file');
+ });
+}
+
+/** True when a file named `<stem>.<ext>` sits anywhere below `directory`. */
+function hasStemBelow(directory, stem) {
+ const pending = [directory];
+ while (pending.length > 0) {
+ const current = pending.pop();
+ for (const [name, type] of directoryEntries(current)) {
+ if (type === 'dir') {
+ if (!isIgnoredComponentKnowledgeSegment(name)) {
+ pending.push(path.join(current, name));
+ }
+ } else if (name.split('.')[0] === stem && !name.endsWith('.spec.md')) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+/**
+ * Classify a component record path and resolve where its code lives:
+ * `packageName`, `layout`, `componentSource` (the component root directory, or
+ * a flat package's `src`), and `codeDirectory` (the directory the record
+ * mirrors). Null when the path is not a record or no package owns its root.
+ */
+function locateComponentKnowledgePath(root, filePath) {
+ const classified = classifyComponentKnowledgePath(filePath);
+ if (!classified) return null;
+ const pkg = resolveComponentPackage(root, classified);
+ if (!pkg) return null;
+ const rootDirectory = path.posix.join(pkg.src, classified.componentRoot);
+ const nested = path.posix.dirname(classified.relativePath);
+ return {
+ ...classified,
+ packageName: pkg.name,
+ layout: pkg.layout,
+ componentRootDirectory: rootDirectory,
+ componentSourceDirectory: pkg.layout === 'flat' ? pkg.src : rootDirectory,
+ codeDirectory:
+ classified.kind === 'component' && pkg.layout === 'flat'
+ ? pkg.src
+ : nested === '.'
+ ? rootDirectory
+ : path.posix.join(rootDirectory, nested),
+ };
+}
+
+/**
+ * Where a component record for `relativePath` under a package's `src` belongs:
+ * `docs/specs/components/<relativePath>` for a directory-layout package, and
+ * `docs/specs/components/<Name>/<Name>.spec.md` for a flat package's top-level
+ * record.
+ */
+function componentSpecPathForSource(packageName, relativePath) {
+ const pkg = COMPONENT_PACKAGES.find(
+ candidate => candidate.name === packageName,
+ );
+ if (!pkg) return null;
+ const segments = normalizePath(relativePath).split('/');
+ if (pkg.layout === 'flat' && segments.length === 1) {
+ const name = segments[0].replace(/\.spec\.md$/, '');
+ return `${COMPONENT_SPEC_ROOT}/${name}/${segments[0]}`;
+ }
+ return `${COMPONENT_SPEC_ROOT}/${segments.join('/')}`;
+}
+
module.exports = {
COMPONENT_PACKAGE_NAMES,
+ COMPONENT_SPEC_ROOT,
IGNORED_COMPONENT_KNOWLEDGE_SEGMENTS,
+ PLATFORM_SPEC_LANGUAGES,
classifyComponentKnowledgePath,
+ classifyPlatformComponentSpecPath,
+ componentSpecPathForSource,
isComponentSpecRecordPath,
isIgnoredComponentKnowledgeSegment,
+ isLegacyComponentSpecPath,
+ isPlatformComponentSpecPath,
+ locateComponentKnowledgePath,
+ resolveComponentPackage,
};
diff --git a/.github/scripts/knowledge-paths.test.mjs b/.github/scripts/knowledge-paths.test.mjs
index e1fd98fc87..2b0ab2d33d 100644
--- a/.github/scripts/knowledge-paths.test.mjs
+++ b/.github/scripts/knowledge-paths.test.mjs
@@ -1,76 +1,232 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
+import fs from 'node:fs';
+import os from 'node:os';
+import path from 'node:path';
import {createRequire} from 'node:module';
-import {describe, expect, it} from 'vitest';
+import {afterEach, describe, expect, it} from 'vitest';
const require = createRequire(import.meta.url);
const {
classifyComponentKnowledgePath,
+ classifyPlatformComponentSpecPath,
+ componentSpecPathForSource,
isComponentSpecRecordPath,
+ isLegacyComponentSpecPath,
+ isPlatformComponentSpecPath,
+ locateComponentKnowledgePath,
} = require('./knowledge-paths.cjs');
+const roots = [];
+afterEach(() => {
+ for (const root of roots.splice(0)) {
+ fs.rmSync(root, {recursive: true, force: true});
+ }
+});
+
+function fixtureRoot(files) {
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-paths-'));
+ roots.push(root);
+ for (const [relative, content] of Object.entries(files)) {
+ const absolute = path.join(root, relative);
+ fs.mkdirSync(path.dirname(absolute), {recursive: true});
+ fs.writeFileSync(absolute, content);
+ }
+ return root;
+}
+
describe('component knowledge paths', () => {
it.each([
[
- 'directory-layout Core component record',
- 'packages/core/src/Button/Button.spec.md',
+ 'component record',
+ 'docs/specs/components/Button/Button.spec.md',
'component',
],
[
- 'directory-layout public member record',
- 'packages/core/src/NavMenu/NavHeadingMenu.spec.md',
+ 'public member record',
+ 'docs/specs/components/NavMenu/NavHeadingMenu.spec.md',
'component',
],
[
- 'directory-layout module record',
- 'packages/core/src/Table/plugins/rowStatus/useTableRowStatus.spec.md',
+ 'module record',
+ 'docs/specs/components/Table/plugins/rowStatus/useTableRowStatus.spec.md',
'module',
],
[
- 'flat Charts component record',
- 'packages/charts/src/Chart.spec.md',
- 'component',
- ],
- [
- 'flat Rich Text component record',
- 'packages/richtext/src/RichTextView.spec.md',
+ 'flat-package component record',
+ 'docs/specs/components/Chart/Chart.spec.md',
'component',
],
- [
- 'flat Vega component record',
- 'packages/vega/src/VegaChart.spec.md',
- 'component',
- ],
- [
- 'flat-package module record',
- 'packages/charts/src/Chart/plugins/useChartSelection.spec.md',
- 'module',
- ],
- ])('classifies the %s', (_label, filePath, kind) => {
+ ])('classifies a %s', (_label, filePath, kind) => {
expect(classifyComponentKnowledgePath(filePath)).toMatchObject({kind});
expect(isComponentSpecRecordPath(filePath)).toBe(true);
+ expect(isPlatformComponentSpecPath(filePath)).toBe(false);
});
it.each([
- 'packages/core/src/__tests__/TopLevel.spec.md',
- 'packages/core/src/Button/__fixtures__/Fixture.spec.md',
- 'packages/core/src/Button/.hidden/Hidden.spec.md',
- 'packages/core/src/Button/.Hidden.spec.md',
- 'packages/core/src/Button/generated/Generated.spec.md',
- 'packages/core/src/Button/plugins/Thing.generated.spec.md',
- 'packages/core/src/Button/node_modules/pkg/Dependency.spec.md',
+ 'docs/specs/components/__tests__/TopLevel.spec.md',
+ 'docs/specs/components/Button/__fixtures__/Fixture.spec.md',
+ 'docs/specs/components/Button/.hidden/Hidden.spec.md',
+ 'docs/specs/components/Button/.Hidden.spec.md',
+ 'docs/specs/components/Button/generated/Generated.spec.md',
+ 'docs/specs/components/Button/plugins/Thing.generated.spec.md',
+ 'docs/specs/components/Button/node_modules/pkg/Dependency.spec.md',
])('ignores %s on every consumer', filePath => {
expect(classifyComponentKnowledgePath(filePath)).toBeNull();
expect(isComponentSpecRecordPath(filePath)).toBe(false);
});
it.each([
- 'packages/core/src/Button/Button.md',
- 'packages/core/src/Button/not-kebab.spec.md',
- 'packages/core/src/Button.spec.md',
- 'packages/themes/neutral/src/Button.spec.md',
- 'packages/cli/src/Prompt.spec.md',
+ 'docs/specs/components/Button/Button.md',
+ 'docs/specs/components/Button/not-kebab.spec.md',
+ 'docs/specs/components/Button.spec.md',
+ 'docs/specs/components/Button/Button.swift.spec.md',
+ 'docs/specs/AST-001/spec.md',
+ 'packages/core/src/Button/Button.spec.md',
+ 'packages/charts/src/Chart.spec.md',
+ 'packages/themes/neutral/neutral.spec.md',
])('rejects non-record path %s', filePath => {
expect(classifyComponentKnowledgePath(filePath)).toBeNull();
});
+
+ it('classifies a platform record beside the core record', () => {
+ expect(
+ classifyPlatformComponentSpecPath(
+ 'docs/specs/components/Avatar/AvatarStatusDot.swift.spec.md',
+ ),
+ ).toEqual({
+ componentRoot: 'Avatar',
+ fileName: 'AvatarStatusDot.swift.spec.md',
+ language: 'swift',
+ publicName: 'AvatarStatusDot',
+ });
+ for (const filePath of [
+ 'docs/specs/components/Avatar/Avatar.klingon.spec.md',
+ 'docs/specs/components/Avatar/modules/Avatar.swift.spec.md',
+ 'docs/specs/components/Avatar.swift.spec.md',
+ ]) {
+ expect(isPlatformComponentSpecPath(filePath)).toBe(false);
+ }
+ });
+
+ it('recognizes a spec left at a pre-move record location', () => {
+ for (const filePath of [
+ 'packages/core/src/Button/Button.spec.md',
+ 'packages/core/src/Dialog/modules/DialogHeader.spec.md',
+ 'packages/charts/src/ChartAxis.spec.md',
+ 'packages/native/apple/Sources/Astryx/Button/Button.spec.md',
+ ]) {
+ expect(isLegacyComponentSpecPath(filePath), filePath).toBe(true);
+ }
+ for (const filePath of [
+ 'docs/specs/components/Button/Button.spec.md',
+ 'packages/core/src/__tests__/TopLevel.spec.md',
+ 'packages/core/src/Button/Thing.generated.spec.md',
+ 'packages/core/src/Button/Button.a11y.chromium.spec.ts',
+ 'packages/cli/src/Prompt.spec.md',
+ 'packages/native/specs/swift/library/tooltip.spec.md',
+ ]) {
+ expect(isLegacyComponentSpecPath(filePath), filePath).toBe(false);
+ }
+ });
+
+ it('maps a source-tree record path to its docs location', () => {
+ expect(componentSpecPathForSource('core', 'Button/Button.spec.md')).toBe(
+ 'docs/specs/components/Button/Button.spec.md',
+ );
+ expect(
+ componentSpecPathForSource('core', 'Dialog/modules/DialogHeader.spec.md'),
+ ).toBe('docs/specs/components/Dialog/modules/DialogHeader.spec.md');
+ expect(componentSpecPathForSource('charts', 'ChartAxis.spec.md')).toBe(
+ 'docs/specs/components/ChartAxis/ChartAxis.spec.md',
+ );
+ expect(componentSpecPathForSource('cli', 'Prompt.spec.md')).toBeNull();
+ });
+});
+
+describe('component record location', () => {
+ it('resolves the package and the code directory a record mirrors', () => {
+ const root = fixtureRoot({
+ 'packages/core/src/Table/Table.tsx': '',
+ 'packages/core/src/Table/plugins/rowStatus/useTableRowStatus.ts': '',
+ 'packages/charts/src/ChartAxis.tsx': '',
+ });
+ expect(
+ locateComponentKnowledgePath(
+ root,
+ 'docs/specs/components/Table/plugins/rowStatus/useTableRowStatus.spec.md',
+ ),
+ ).toMatchObject({
+ packageName: 'core',
+ layout: 'nested',
+ kind: 'module',
+ codeDirectory: 'packages/core/src/Table/plugins/rowStatus',
+ });
+ expect(
+ locateComponentKnowledgePath(
+ root,
+ 'docs/specs/components/ChartAxis/ChartAxis.spec.md',
+ ),
+ ).toMatchObject({
+ packageName: 'charts',
+ layout: 'flat',
+ codeDirectory: 'packages/charts/src',
+ });
+ });
+
+ it('picks the package that holds the record when two packages share a root', () => {
+ const root = fixtureRoot({
+ 'packages/core/src/Chat/ChatMessage.tsx': '',
+ 'packages/core/src/Chat/ChatMessage.doc.mjs': '',
+ 'packages/lab/src/Chat/ChatEmojiPicker.tsx': '',
+ 'packages/lab/src/Chat/ChatEmojiPicker.doc.mjs': '',
+ 'packages/lab/src/Chart/Chart.tsx': '',
+ 'packages/charts/src/Chart.tsx': '',
+ 'packages/charts/src/Chart.doc.mjs': '',
+ });
+ const owner = filePath =>
+ locateComponentKnowledgePath(root, filePath)?.packageName ?? null;
+ expect(owner('docs/specs/components/Chat/ChatMessage.spec.md')).toBe(
+ 'core',
+ );
+ expect(owner('docs/specs/components/Chat/ChatEmojiPicker.spec.md')).toBe(
+ 'lab',
+ );
+ expect(owner('docs/specs/components/Chart/Chart.spec.md')).toBe('charts');
+ // A module record kept in modules/ belongs to the package holding its code.
+ fs.mkdirSync(path.join(root, 'packages/lab/src/Chat/hooks'), {
+ recursive: true,
+ });
+ fs.writeFileSync(
+ path.join(root, 'packages/lab/src/Chat/hooks/useReactionPicker.ts'),
+ '',
+ );
+ expect(
+ owner('docs/specs/components/Chat/modules/useReactionPicker.spec.md'),
+ ).toBe('lab');
+ expect(
+ owner('docs/specs/components/Chat/modules/useNowhere.spec.md'),
+ ).toBeNull();
+ // Charts keeps its code flat in src/, beside Lab's Chart/ folder.
+ fs.writeFileSync(path.join(root, 'packages/charts/src/markColor.ts'), '');
+ expect(owner('docs/specs/components/Chart/modules/markColor.spec.md')).toBe(
+ 'charts',
+ );
+ // No same-stem code anywhere: the parent component record's package.
+ expect(
+ owner('docs/specs/components/Chart/modules/chartLegendLayout.spec.md'),
+ ).toBe('charts');
+ // Neither package holds a consumer doc for it, so no package owns it.
+ expect(owner('docs/specs/components/Chat/ChatGhost.spec.md')).toBeNull();
+ });
+
+ it('matches component roots by exact case', () => {
+ const root = fixtureRoot({'packages/core/src/Button/Button.tsx': ''});
+ expect(
+ locateComponentKnowledgePath(
+ root,
+ 'docs/specs/components/button/button.spec.md',
+ ),
+ ).toBeNull();
+ });
});
diff --git a/.github/scripts/lib/classify-visual.test.mjs b/.github/scripts/lib/classify-visual.test.mjs
index 556b1bb9dd..cdf3143c1e 100644
--- a/.github/scripts/lib/classify-visual.test.mjs
+++ b/.github/scripts/lib/classify-visual.test.mjs
@@ -344,7 +344,7 @@ describe('classifyVisualDiff', () => {
const result = classifyVisualDiff(
[
change.diff,
- makeDiff('packages/core/src/Button/Button.spec.md', [
+ makeDiff('docs/specs/components/Button/Button.spec.md', [
'| DD1 | Keep the label quiet. | Preserve emphasis. | Label | Theme tokens may vary. |',
]),
makeDiff('evidence/button-after.png', ['binary evidence']),
diff --git a/.github/scripts/spec-owner-decision.test.mjs b/.github/scripts/spec-owner-decision.test.mjs
index 09ba6304b5..282ff66e94 100644
--- a/.github/scripts/spec-owner-decision.test.mjs
+++ b/.github/scripts/spec-owner-decision.test.mjs
@@ -28,7 +28,7 @@ const {
const head = 'abcdef1234567890abcdef1234567890abcdef12';
const owner = {login: 'cixzhang'};
-const componentPath = 'packages/core/src/Button/Button.spec.md';
+const componentPath = 'docs/specs/components/Button/Button.spec.md';
function componentRecord({body = 'Body.', decision = null} = {}) {
const block =
@@ -120,7 +120,7 @@ describe('spec owner decision', () => {
expect(
requiredApprovalGroups([
{
- path: 'packages/core/src/Button/Button.spec.md',
+ path: 'docs/specs/components/Button/Button.spec.md',
baseContent: 'kind: component\nauthority: current',
headContent: 'kind: component\nauthority: current',
},
diff --git a/.github/scripts/spec-owner-reconcile.test.mjs b/.github/scripts/spec-owner-reconcile.test.mjs
index 6b2c5de975..9b5d02e35d 100644
--- a/.github/scripts/spec-owner-reconcile.test.mjs
+++ b/.github/scripts/spec-owner-reconcile.test.mjs
@@ -346,7 +346,7 @@ const designRecord = {
};
const currentDesign = 'kind: design\nauthority: current\n';
const componentRecord = {
- filename: 'packages/core/src/Button/Button.spec.md',
+ filename: 'docs/specs/components/Button/Button.spec.md',
status: 'modified',
};
function currentComponentSpec(decision, body = 'Body.') {
diff --git a/.github/scripts/spec-owner-workflow.test.mjs b/.github/scripts/spec-owner-workflow.test.mjs
index b2607e5ca0..b42dde8dc5 100644
--- a/.github/scripts/spec-owner-workflow.test.mjs
+++ b/.github/scripts/spec-owner-workflow.test.mjs
@@ -88,7 +88,7 @@ describe('spec-only workflow contract', () => {
encoding: 'utf8',
env: {...process.env, GITHUB_OUTPUT: output},
input:
- 'A\tpackages/core/src/Table/plugins/rowStatus/useTableRowStatus.spec.md\n',
+ 'A\tdocs/specs/components/Table/plugins/rowStatus/useTableRowStatus.spec.md\n',
},
);
expect(result.status, result.stderr).toBe(0);
@@ -102,7 +102,7 @@ describe('spec-only workflow contract', () => {
[path.join(classifierDir, 'change-scope.cjs')],
{
encoding: 'utf8',
- input: 'A\tpackages/core/src/Button/Button.spec.md\n',
+ input: 'A\tdocs/specs/components/Button/Button.spec.md\n',
},
);
expect(missingDependency.status).not.toBe(0);
diff --git a/AGENTS.md b/AGENTS.md
index 480344c028..a4c7311029 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -24,7 +24,8 @@ nested `AGENTS.md`.
global baseline claims with `node scripts/review-global-baselines.mjs
--authority-commit <base-sha> --review-head <head-sha> --triggers
<comma-separated-triggers>`, then read
- the component's `{Name}.spec.md` when one exists and any `module:*` records it
+ the component's `docs/specs/components/<ComponentRoot>/{Name}.spec.md` when
+ one exists and any `module:*` records it
lists. Load global records before narrower owners, but resolve the direct
component or family owner first when it governs the exact delta. A global
route exposes only the listed claim; it never makes the whole record govern
diff --git a/docs/README.md b/docs/README.md
index 4ca15a71f0..2104411f56 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -12,31 +12,43 @@ it governs. Consumer documentation remains in component `.doc.mjs` files and
- `themes/`: guidance and index for package-local theme specifications.
- `families/`: contracts shared by sibling components.
- `specs/`: consequential proposed or shipped system changes and their decisions.
+- `specs/components/`: component and module contracts, one folder per component.
- `templates/knowledge/`: authoring templates. Templates never live among records.
- `schemas/knowledge/`: versioned structural requirements for templates and records.
-Component contracts live beside the public component in every component-bearing
-package registered by `scripts/component-packages.cjs`:
-
-- directory-layout packages (`core`, `lab`) use
- `packages/<package>/src/<ComponentRoot>/<PublicName>.spec.md`;
-- flat packages (`charts`, `richtext`, `vega`) use
- `packages/<package>/src/<PublicName>.spec.md`.
-
-In a directory-layout package, `<PublicName>` normally matches the root directory;
-a public member such as `NavMenu/NavHeadingMenu.spec.md` is valid only when an
-exact top-level or full inline consumer-doc entry in that root declares the same
-public name. In a flat package, the public named export and matching TSX module
-define the component boundary.
+Every component's records, for every package and platform, live together in
+one folder, `specs/components/<ComponentRoot>/`, named after the folder that
+holds the component's code. The tree mirrors the source tree of the package
+registered by `scripts/component-packages.cjs`:
+
+- a directory-layout package (`core`, `lab`) keeps
+ `packages/<package>/src/<ComponentRoot>/`, and its records are
+ `specs/components/<ComponentRoot>/<PublicName>.spec.md`;
+- a flat package (`charts`, `richtext`, `vega`) keeps
+ `packages/<package>/src/<PublicName>.tsx`, and its record is
+ `specs/components/<PublicName>/<PublicName>.spec.md`;
+- a platform implementation's record sits beside the core record as
+ `specs/components/<ComponentRoot>/<PublicName>.<language>.spec.md`, for
+ example `specs/components/Avatar/Avatar.swift.spec.md`.
+
+`<PublicName>` normally matches the root; a public member such as
+`NavMenu/NavHeadingMenu.spec.md` is valid only when an exact top-level or full
+inline consumer-doc entry in that root declares the same public name. In a flat
+package, the public named export and matching TSX module define the component
+boundary. When two packages keep a folder with the same name, the record belongs
+to the package that holds its code.
Independently contractible public hooks, plugins, utilities, and subsystems use
`kind: module` records named `<PublicName>.spec.md` at least one directory below
-the same component root. Their canonical id is
+the same component folder, usually in `modules/` (`specs/components/Dialog/modules/DialogHeader.spec.md`)
+or in a plugin's own folder (`specs/components/Table/plugins/rowStatus/useTableRowStatus.spec.md`).
+The subdirectory need not match where the module's code sits; lookup reaches the
+record by the code's file name or its `verified_by` evidence. Their canonical id is
`module:<ParentComponent>/<PublicName>`; the module's `parent_component` and the
parent component's `modules` list must agree. Private transform helpers do not
require records.
-Component-local discovery and PR routing ignore hidden path segments,
+Component record discovery and PR routing ignore hidden path segments,
`*.generated.spec.md`, and fixture, test, generated, build-output, coverage, and
`node_modules` directories. Those files are not knowledge records or spec-only
changes. Theme contracts live beside the package as
diff --git a/docs/architecture/component-theming-surface.md b/docs/architecture/component-theming-surface.md
index dc98ff8b68..8d337084e3 100644
--- a/docs/architecture/component-theming-surface.md
+++ b/docs/architecture/component-theming-surface.md
@@ -405,7 +405,7 @@ how themes become output, or the design rationale for a component's appearance.
- Component `.doc.mjs` `theming.vars[]` owns documented custom properties and
marks private implementation variables; `theming.derived[]` records checked
public-property expansion metadata.
-- A colocated component `.spec.md` `### Theming anatomy` block owns the exact,
+- A component record's (`docs/specs/components/`) `### Theming anatomy` block owns the exact,
machine-readable anatomy-to-target dispositions. It is optional during
migration, checked against consumer anatomy, and excluded from generated
consumer docs. Nearby component-spec prose owns non-obvious rationale,
diff --git a/docs/architecture/knowledge-contracts.md b/docs/architecture/knowledge-contracts.md
index 769a41aa27..7230f0646c 100644
--- a/docs/architecture/knowledge-contracts.md
+++ b/docs/architecture/knowledge-contracts.md
@@ -48,7 +48,8 @@ deciding_specs: []
"INV27",
"DEC-10",
"DEC-12",
- "DEC-13"
+ "DEC-13",
+ "DEC-15"
]
}
}
@@ -106,7 +107,8 @@ those records, and the global claims the path's component triggers route; with
follows only links that records and files declare:
- placement: the record itself, the component, module, or theme record whose
- canonical location contains the path;
+ canonical location contains the path (a component or module record's location
+ is the source directory its folder under `docs/specs/components/` mirrors);
- path fields: `applies_to`, `verified_by`, and `path-applicability:v1` patterns;
- names: family `members`, design `components`, and `affects_consumer_docs` ids
naming the path's component or consumer-doc topic;
@@ -708,22 +710,33 @@ this flow passes the historical review benchmark and is enforced on pull request
- `AGENTS.md` points reviewers to the narrowest relevant record.
- `docs/templates/knowledge/` contains the only authoring forms; a package keeps
no template of its own (INV27).
-- Component records are direct `<PublicName>.spec.md` children of a component
- root. Component roots are the component directories of Core
- (`packages/core/src/`) and Lab (`packages/lab/src/`), the source roots of the
- flat component packages `scripts/component-packages.cjs` registers (Charts,
- RichText, and Vega keep their records directly in `src/`), and the component
- directories of every platform implementation package, such as
- `packages/native/apple/Sources/Astryx/` for Swift. A platform implementation's record has the id
+- Component records live in `docs/specs/components/<ComponentRoot>/`, one
+ folder per component root, as direct `<PublicName>.spec.md` children
+ (DEC-15). The folder tree mirrors the component's source tree: a component
+ root is a component directory of Core (`packages/core/src/`) or Lab
+ (`packages/lab/src/`), or a top-level module of a flat component package
+ `scripts/component-packages.cjs` registers (Charts, RichText, and Vega), whose
+ record is `docs/specs/components/<PublicName>/<PublicName>.spec.md`. The
+ package that owns a record is the one whose source tree has its component
+ root; when two packages have a root of that name, it is the one holding the
+ record's code. A platform implementation's record sits in the same folder as
+ `<PublicName>.<language>.spec.md` (for example
+ `docs/specs/components/Button/Button.swift.spec.md`), has the id
`component:<language>/<PublicName>` (for example `component:swift/Button`),
names its core component in `platform_of` (`component:<PublicName>`), and
states only what that platform adds or must do differently; the core record
keeps the shared contract (INV2). Until the core component has its own
- record, its public source and documentation stand in as that contract. The public name normally matches the root; a parent/member
- exception requires an exact top-level or full inline consumer-doc entry in
- that root. Public semantic module records are nested at least one directory
- beneath the same root as `<PublicName>.spec.md`; the parent component's
- `modules` list and the module's `parent_component` field must agree. Hidden,
+ record, its public source and documentation stand in as that contract. The
+ public name normally matches the root; a parent/member exception requires an
+ exact top-level or full inline consumer-doc entry in that root. Public
+ semantic module records are nested at least one directory beneath the same
+ folder as `<PublicName>.spec.md`, usually in `modules/`, or in a plugin's
+ own folder such as `Table/plugins/rowStatus/`. The subdirectory need not
+ match where the module's code sits: lookup reaches the record by the code's
+ file name or its `verified_by` evidence. The parent component's `modules`
+ list and the module's `parent_component` field must agree. Neither a
+ component package's source tree nor `packages/native/apple/Sources/` holds a
+ `*.spec.md`. Hidden,
fixture, test, generated, build-output, coverage, dependency, and
`*.generated.spec.md` paths are ignored consistently by discovery and PR
routing.
@@ -1097,6 +1110,23 @@ it would be approved unseen); a separate spec status (one gate, one message);
reaction approvals (no event, so a polling job); a workflow-pushed
`draft`-to-`current` change (it starts no checks and cannot write a fork).
+### DEC-15 — A component's records live in one folder under docs, for every platform
+
+**Reference:** `architecture:knowledge-contracts/DEC-15`
+**Decider:** `cixzhang`, `2026-10-28`
+
+Every component record and module record lives in
+`docs/specs/components/<ComponentRoot>/`, structured as the component's source
+tree, so a person working on a component on any platform finds its core
+contract and each platform's record side by side in one folder. Lookup stays
+path-first: discovery reads that tree, and placement maps each record to the
+source directory its folder mirrors. Record ids and contents do not change with
+the move.
+
+Rejected: records beside each package's code, because a component's core and
+platform records then sit in different packages and every platform package
+needs its own spec location.
+
## Verification
| Invariant | Evidence | Failure signal |
@@ -1116,22 +1146,23 @@ reaction approvals (no event, so a polling job); a workflow-pushed
| DEC-14 | `.github/scripts/spec-owner-reconcile.test.mjs`, `.github/scripts/spec-owner-decision.test.mjs`, and `.github/scripts/spec-owner-workflow.test.mjs` | A non-spec commit, base merge, rebase, or status flip resets approval; changed spec text or a new spec path keeps it; a command naming other spec content, a reaction, a non-owner act, or an author review approves; `review-required` succeeds while spec approval is missing or before the spec decision is published; a revoke or request for changes naming other spec content is ignored; a missing approval reports failure; or an evaluation leaves its head without a terminal state |
| DEC-11 | `.github/scripts/review-signal-decision.test.mjs`, `.github/scripts/review-clear-workflow.test.mjs`, and `.github/scripts/review-signal-workflow.test.mjs` | An app approval clears a read-only or fork author or an earlier head; a later app request for changes or dismissal leaves the gate clear; an app approval overrides an ENGOWNER request for changes; or an unset app or unreadable permission clears the gate |
-| Invariant | Evidence | Failure signal |
-| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| INV22–INV24 | Contributor/reviewer evidence inventory; public-link and byte verification; retained remote refs; unchanged fixture/baseline/media paths | Disposable captures enter the source tree, cleanup loses a referenced image, a temporary branch is called durable, or storage changes overwrite an owner's proof or retention contract |
-| INV25, INV26, DEC-12 | `scripts/specs-for-file.test.mjs`, `scripts/check-knowledge.test.mjs`, and `pnpm check:knowledge` | A current record is reached by no tracked non-record path, a lookup infers a link from a name, a pattern matches nothing or the whole repository, or a pattern match widens a claim or outranks a narrower owner |
-| INV27, DEC-13 | `scripts/check-knowledge.test.mjs` and `pnpm check:knowledge` | A `*.spec.md` file or a Markdown file under a `specs` directory without valid record frontmatter, outside its kind's location, or following a package-local template passes |
+| Invariant | Evidence | Failure signal |
+| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| INV22–INV24 | Contributor/reviewer evidence inventory; public-link and byte verification; retained remote refs; unchanged fixture/baseline/media paths | Disposable captures enter the source tree, cleanup loses a referenced image, a temporary branch is called durable, or storage changes overwrite an owner's proof or retention contract |
+| INV25, INV26, DEC-12 | `scripts/specs-for-file.test.mjs`, `scripts/check-knowledge.test.mjs`, and `pnpm check:knowledge` | A current record is reached by no tracked non-record path, a lookup infers a link from a name, a pattern matches nothing or the whole repository, or a pattern match widens a claim or outranks a narrower owner |
+| INV27, DEC-13 | `scripts/check-knowledge.test.mjs` and `pnpm check:knowledge` | A `*.spec.md` file or a Markdown file under a `specs` directory without valid record frontmatter, outside its kind's location, or following a package-local template passes |
+| DEC-15 | `.github/scripts/knowledge-paths.test.mjs`, `scripts/check-knowledge.test.mjs`, `scripts/specs-for-file.test.mjs`, and `pnpm check:knowledge` | A component or module record outside `docs/specs/components/<ComponentRoot>/`, a `*.spec.md` left in a component package's source tree or beside a Swift view, a record matched to the wrong package when two share a root, or a record whose component root no registered package's source tree has |
Evidence placement is enforced by contributors and reviewers. The local
`docs/pr-assets/` ignore prevents accidental staging; it is not a blocking CI
check and does not prevent force-added evidence elsewhere.
Current enforcement gap: discovery does not yet read record candidates outside
-registered component packages, themes, and `docs/`; component records have no
-`platform_of` field until the next schema version; and the component id
-pattern does not yet accept a language-qualified id such as
-`component:swift/Button`. Until all three land, records under
-`packages/native/` are checked only by review.
+`docs/` and themes; component records have no `platform_of` field until the
+next schema version; and the component id pattern does not yet accept a
+language-qualified id such as `component:swift/Button`. Until all three land,
+platform records (`docs/specs/components/<ComponentRoot>/<PublicName>.<language>.spec.md`)
+and package records under `packages/native/specs/` are checked only by review.
Current enforcement gap: no checked-in gate yet proves the open-pull-request
search. Until one exists, the pull-request summary records the search terms,
diff --git a/docs/contributing/api-conventions.md b/docs/contributing/api-conventions.md
index da23f5751e..01a8b4b9e6 100644
--- a/docs/contributing/api-conventions.md
+++ b/docs/contributing/api-conventions.md
@@ -15,8 +15,8 @@ owner first when one is linked or easy to find. Human contributors do not need t
understand or edit the spec system to contribute; reviewers and maintainers route
new decisions and record final rulings.
-1. The component's `<Name>.spec.md`, when one exists beside its code in
- [`packages/core/src/`](../../packages/core/src/), owns component behavior.
+1. The component's `<Name>.spec.md`, when one exists in its folder under
+ [`docs/specs/components/`](../specs/components/), owns component behavior.
2. A current contract under [`docs/families/`](../families/) owns behavior shared
by sibling components.
3. Current architecture and accepted system decisions own cross-component rules.
diff --git a/docs/contributing/pull-requests.md b/docs/contributing/pull-requests.md
index ae304bc09a..3fc0b6c018 100644
--- a/docs/contributing/pull-requests.md
+++ b/docs/contributing/pull-requests.md
@@ -4,7 +4,7 @@ A pull request should make one reviewable change for one reason. Choose the temp
GitHub uses the default template automatically. To choose another, add `?template=<file>.md` to the new-pull-request URL, or copy the matching file from `.github/PULL_REQUEST_TEMPLATE/` into the description.
-Any pull request that creates or changes a knowledge record — a `docs/specs/<id>/spec.md`, a family, design, theme, or architecture record, or a colocated `<Name>.spec.md` — reports the results of the rubric in [Writing specification records](spec-writing.md) in its description, whichever template it uses. `specification.md` carries the `## Writing rubric results` section; copy it into another template when that pull request also touches a record.
+Any pull request that creates or changes a knowledge record — a `docs/specs/<id>/spec.md`, a family, design, theme, or architecture record, or a component or module record under `docs/specs/components/` — reports the results of the rubric in [Writing specification records](spec-writing.md) in its description, whichever template it uses. `specification.md` carries the `## Writing rubric results` section; copy it into another template when that pull request also touches a record.
| Primary intent | Template | Minimum evidence |
| ---------------------------------------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
diff --git a/docs/contributing/spec-writing.md b/docs/contributing/spec-writing.md
index 4c037c7ab8..0938c21fdf 100644
--- a/docs/contributing/spec-writing.md
+++ b/docs/contributing/spec-writing.md
@@ -8,10 +8,9 @@ that reader.
This guide applies to every knowledge record that states what the system does,
wherever it lives in the repository and in any package added later:
`docs/specs/<id>/spec.md`, family, design, theme, and architecture records,
-package records under a package's `specs/` directory, and colocated
-`<Name>.spec.md` component and module contracts in Core, Lab, the flat
-component packages (Charts, RichText, Vega), and platform implementation
-packages. Every spec must be a valid knowledge record; one that is not fails
+package records under a package's `specs/` directory, and the component and
+module contracts under `docs/specs/components/` for Core, Lab, the flat
+component packages (Charts, RichText, Vega), and platform implementations. Every spec must be a valid knowledge record; one that is not fails
the knowledge check (`architecture:knowledge-contracts` INV27). An implementation
plan (`plan.md`) tracks work and is outside it. It projects
`architecture:knowledge-contracts` (INV2 and INV10) and the templates under
diff --git a/docs/specs/AST-057-row-actions/spec.md b/docs/specs/AST-057-row-actions/spec.md
index 9820aae83a..1bdc6415f8 100644
--- a/docs/specs/AST-057-row-actions/spec.md
+++ b/docs/specs/AST-057-row-actions/spec.md
@@ -107,7 +107,7 @@ and its panels stay put, so no element is added to any row.
templates render inside a `BottomSheet` and on a page — are the rows this
record serves: two real consumers, one home, and the prop stays on the
primitive (DEC-3).
-- [`component:List`](../../../packages/core/src/List/List.spec.md) is
+- [`component:List`](../components/List/List.spec.md) is
`current` and owns List's geometry; it gains the inline clip and cites
this record.
- [`spec:AST-002`](../AST-002/spec.md) owns admission: the caller owns which
diff --git a/docs/specs/AST-093-native-component-guidelines/spec.md b/docs/specs/AST-093-native-component-guidelines/spec.md
index e544890340..b1fa6ce33a 100644
--- a/docs/specs/AST-093-native-component-guidelines/spec.md
+++ b/docs/specs/AST-093-native-component-guidelines/spec.md
@@ -52,13 +52,17 @@ validating, and reviewing individual native components while
## Requirements
-- **FR1 — A native component's spec lives beside its implementation.** Each
+- **FR1 — A native component's spec lives beside the core component's.** Each
native component has its own folder in its language's implementation, named
- as the core component, and its spec is `<Name>.spec.md` in that folder, as
- core does (`packages/core/src/<Name>/<Name>.spec.md`). Each language has one
- implementation package; for Swift that is `packages/native/apple/`, and the
- spec is `packages/native/apple/Sources/Astryx/<Name>/<Name>.spec.md`, beside
- the component's views. `<Name>` is the core component's name. The spec is a
+ as the core component. Its spec is `<Name>.<language>.spec.md` in the core
+ component's folder under `docs/specs/components/`, beside the core record
+ (`docs/specs/components/<ComponentRoot>/<Name>.spec.md`), as
+ `architecture:knowledge-contracts` DEC-15 places every component record. Each
+ language has one implementation package; for Swift that is
+ `packages/native/apple/`, with the component's views in
+ `packages/native/apple/Sources/Astryx/<Name>/`, and its spec is
+ `docs/specs/components/<ComponentRoot>/<Name>.swift.spec.md`. `<Name>` is the
+ core component's name, and `<ComponentRoot>` the folder core keeps it in. The spec is a
knowledge record of kind `component` with id `component:<language>/<Name>`
that names its core component in `platform_of`, built from
`docs/templates/knowledge/component-spec.md`
@@ -113,7 +117,8 @@ validating, and reviewing individual native components while
(`spec:AST-082/FR12`). A claim that could not be captured is reported as not
measured.
- **FR6 — Native changes from the native group are approved after a spec
- review.** A pull request whose every changed file is under `packages/native/`,
+ review.** A pull request whose every changed file is under `packages/native/`
+ or is a native component spec (`docs/specs/components/**/<Name>.<language>.spec.md`),
and whose author and every commit author are members of the native group, is
approved by an engineering owner on its exact head, without a separate code or
design review, once all three hold: its required checks pass; the review app
@@ -125,7 +130,7 @@ validating, and reviewing individual native components while
the review records each such behavior as a spec gap so a spec can follow. The
native group is the GitHub accounts `cixzhang`, `ejc3`, `ejhammond`,
`ernestt`, `imdreamrunner`, and `vjeux`. A pull request that changes any file
- outside `packages/native/`, or that carries a commit from anyone else, follows
+ outside those paths, or that carries a commit from anyone else, follows
the repository's normal review gate. A request for changes from any reviewer
still blocks the merge. Changing the group is a change to this record.
@@ -168,14 +173,14 @@ validating, and reviewing individual native components while
## Verification
-| Contract | Verification | Representative states | Mutation or failure expectation |
-| -------- | ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| FR1 | Review of the spec's path beside the component, plus `pnpm check:knowledge` on its record frontmatter, id, and `platform_of` | a spec per language; a spec for a component with no core contract | A component spec outside its component's folder, without valid record frontmatter, under another id, naming no core component, or renaming a core prop passes |
-| FR2 | The spec's account of the platform control it builds on, or why none fits, and the state captures | a component built on a platform control; a component with no platform control | A component draws its own control where a platform control fits, with no reason in its spec |
-| FR3 | The spec's account of the platform guidelines it follows, and the captures | hit target size; largest Dynamic Type; Reduce Motion; VoiceOver focus | A capture shows a hit target below the platform minimum or text that does not scale |
-| FR4 | Theme test with two themes, plus source review for literals | default theme; a second theme with different color, type, and shape | A brand value stays the same across both themes, or a platform-only visual prop is added |
-| FR5 | The package's tests on every supported platform and the captures attached to the change | light; dark; largest text; every state the core contract names | A change merges without tests, without captures, or with a capture-based claim backed only by source |
-| FR6 | Changed paths, commit authors, the review app's exact-head review, the spec review's findings, and the approval | all native paths by group members; a spec-defined requirement unmet; behavior no spec defines; a path outside `packages/native/`; a commit from someone else | An approval without an exact-head review-app pass or a spec review, an approval with a spec-defined requirement unmet, an out-of-scope pull request approved without review, or an in-scope one blocked only for behavior no spec defines |
+| Contract | Verification | Representative states | Mutation or failure expectation |
+| -------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| FR1 | Review of the spec's path beside the core component's spec, plus `pnpm check:knowledge` on its record frontmatter, id, and `platform_of` | a spec per language; a spec for a component with no core contract | A component spec outside the core component's folder under `docs/specs/components/`, without valid record frontmatter, under another id, naming no core component, or renaming a core prop passes |
+| FR2 | The spec's account of the platform control it builds on, or why none fits, and the state captures | a component built on a platform control; a component with no platform control | A component draws its own control where a platform control fits, with no reason in its spec |
+| FR3 | The spec's account of the platform guidelines it follows, and the captures | hit target size; largest Dynamic Type; Reduce Motion; VoiceOver focus | A capture shows a hit target below the platform minimum or text that does not scale |
+| FR4 | Theme test with two themes, plus source review for literals | default theme; a second theme with different color, type, and shape | A brand value stays the same across both themes, or a platform-only visual prop is added |
+| FR5 | The package's tests on every supported platform and the captures attached to the change | light; dark; largest text; every state the core contract names | A change merges without tests, without captures, or with a capture-based claim backed only by source |
+| FR6 | Changed paths, commit authors, the review app's exact-head review, the spec review's findings, and the approval | all native paths by group members; a spec-defined requirement unmet; behavior no spec defines; a native component spec under `docs/specs/components/`; a path outside `packages/native/` and those specs; a commit from someone else | An approval without an exact-head review-app pass or a spec review, an approval with a spec-defined requirement unmet, an out-of-scope pull request approved without review, or an in-scope one blocked only for behavior no spec defines |
## Decision log
diff --git a/docs/specs/README.md b/docs/specs/README.md
index e920a93fa9..30b60cfefc 100644
--- a/docs/specs/README.md
+++ b/docs/specs/README.md
@@ -4,6 +4,11 @@ This directory contains records for consequential shared-system changes. Each
spec lives under `docs/specs/<id>-<slug>/spec.md`; an optional sibling `plan.md`
is used only for multi-step implementation.
+Component and module contracts live under `docs/specs/components/`, one folder
+per component, holding the core record beside each platform's
+(`components/Avatar/Avatar.spec.md` and `components/Avatar/Avatar.swift.spec.md`).
+[`docs/README.md`](../README.md) has the layout.
+
Templates live separately under `docs/templates/knowledge/`. Existing records
are validated against `docs/schemas/knowledge/`; changing a template does not
silently change accepted history.
diff --git a/packages/core/src/AlertDialog/AlertDialog.spec.md b/docs/specs/components/AlertDialog/AlertDialog.spec.md
similarity index 100%
rename from packages/core/src/AlertDialog/AlertDialog.spec.md
rename to docs/specs/components/AlertDialog/AlertDialog.spec.md
diff --git a/packages/core/src/AppShell/AppShell.spec.md b/docs/specs/components/AppShell/AppShell.spec.md
similarity index 100%
rename from packages/core/src/AppShell/AppShell.spec.md
rename to docs/specs/components/AppShell/AppShell.spec.md
diff --git a/packages/core/src/AspectRatio/AspectRatio.spec.md b/docs/specs/components/AspectRatio/AspectRatio.spec.md
similarity index 100%
rename from packages/core/src/AspectRatio/AspectRatio.spec.md
rename to docs/specs/components/AspectRatio/AspectRatio.spec.md
diff --git a/packages/core/src/Avatar/Avatar.spec.md b/docs/specs/components/Avatar/Avatar.spec.md
similarity index 100%
rename from packages/core/src/Avatar/Avatar.spec.md
rename to docs/specs/components/Avatar/Avatar.spec.md
diff --git a/packages/native/apple/Sources/Astryx/Avatar/Avatar.spec.md b/docs/specs/components/Avatar/Avatar.swift.spec.md
similarity index 100%
rename from packages/native/apple/Sources/Astryx/Avatar/Avatar.spec.md
rename to docs/specs/components/Avatar/Avatar.swift.spec.md
diff --git a/packages/core/src/Avatar/AvatarStatusDot.spec.md b/docs/specs/components/Avatar/AvatarStatusDot.spec.md
similarity index 100%
rename from packages/core/src/Avatar/AvatarStatusDot.spec.md
rename to docs/specs/components/Avatar/AvatarStatusDot.spec.md
diff --git a/packages/native/apple/Sources/Astryx/Avatar/AvatarStatusDot.spec.md b/docs/specs/components/Avatar/AvatarStatusDot.swift.spec.md
similarity index 100%
rename from packages/native/apple/Sources/Astryx/Avatar/AvatarStatusDot.spec.md
rename to docs/specs/components/Avatar/AvatarStatusDot.swift.spec.md
diff --git a/packages/core/src/AvatarGroup/AvatarGroup.spec.md b/docs/specs/components/AvatarGroup/AvatarGroup.spec.md
similarity index 100%
rename from packages/core/src/AvatarGroup/AvatarGroup.spec.md
rename to docs/specs/components/AvatarGroup/AvatarGroup.spec.md
diff --git a/packages/core/src/AvatarGroup/AvatarGroupOverflow.spec.md b/docs/specs/components/AvatarGroup/AvatarGroupOverflow.spec.md
similarity index 100%
rename from packages/core/src/AvatarGroup/AvatarGroupOverflow.spec.md
rename to docs/specs/components/AvatarGroup/AvatarGroupOverflow.spec.md
diff --git a/packages/core/src/Badge/Badge.spec.md b/docs/specs/components/Badge/Badge.spec.md
similarity index 100%
rename from packages/core/src/Badge/Badge.spec.md
rename to docs/specs/components/Badge/Badge.spec.md
diff --git a/packages/core/src/Banner/Banner.spec.md b/docs/specs/components/Banner/Banner.spec.md
similarity index 100%
rename from packages/core/src/Banner/Banner.spec.md
rename to docs/specs/components/Banner/Banner.spec.md
diff --git a/packages/core/src/Blockquote/Blockquote.spec.md b/docs/specs/components/Blockquote/Blockquote.spec.md
similarity index 100%
rename from packages/core/src/Blockquote/Blockquote.spec.md
rename to docs/specs/components/Blockquote/Blockquote.spec.md
diff --git a/packages/core/src/BottomSheet/BottomSheet.spec.md b/docs/specs/components/BottomSheet/BottomSheet.spec.md
similarity index 100%
rename from packages/core/src/BottomSheet/BottomSheet.spec.md
rename to docs/specs/components/BottomSheet/BottomSheet.spec.md
diff --git a/packages/core/src/BottomSheet/BottomSheetSwitcher.spec.md b/docs/specs/components/BottomSheet/BottomSheetSwitcher.spec.md
similarity index 100%
rename from packages/core/src/BottomSheet/BottomSheetSwitcher.spec.md
rename to docs/specs/components/BottomSheet/BottomSheetSwitcher.spec.md
diff --git a/packages/core/src/Breadcrumbs/BreadcrumbItem.spec.md b/docs/specs/components/Breadcrumbs/BreadcrumbItem.spec.md
similarity index 100%
rename from packages/core/src/Breadcrumbs/BreadcrumbItem.spec.md
rename to docs/specs/components/Breadcrumbs/BreadcrumbItem.spec.md
diff --git a/packages/core/src/Breadcrumbs/Breadcrumbs.spec.md b/docs/specs/components/Breadcrumbs/Breadcrumbs.spec.md
similarity index 100%
rename from packages/core/src/Breadcrumbs/Breadcrumbs.spec.md
rename to docs/specs/components/Breadcrumbs/Breadcrumbs.spec.md
diff --git a/packages/core/src/Button/Button.spec.md b/docs/specs/components/Button/Button.spec.md
similarity index 100%
rename from packages/core/src/Button/Button.spec.md
rename to docs/specs/components/Button/Button.spec.md
diff --git a/packages/native/apple/Sources/Astryx/Button/Button.spec.md b/docs/specs/components/Button/Button.swift.spec.md
similarity index 100%
rename from packages/native/apple/Sources/Astryx/Button/Button.spec.md
rename to docs/specs/components/Button/Button.swift.spec.md
diff --git a/packages/core/src/ButtonGroup/ButtonGroup.spec.md b/docs/specs/components/ButtonGroup/ButtonGroup.spec.md
similarity index 100%
rename from packages/core/src/ButtonGroup/ButtonGroup.spec.md
rename to docs/specs/components/ButtonGroup/ButtonGroup.spec.md
diff --git a/packages/core/src/Calendar/Calendar.spec.md b/docs/specs/components/Calendar/Calendar.spec.md
similarity index 100%
rename from packages/core/src/Calendar/Calendar.spec.md
rename to docs/specs/components/Calendar/Calendar.spec.md
diff --git a/packages/core/src/Card/Card.spec.md b/docs/specs/components/Card/Card.spec.md
similarity index 100%
rename from packages/core/src/Card/Card.spec.md
rename to docs/specs/components/Card/Card.spec.md
diff --git a/packages/core/src/Carousel/Carousel.spec.md b/docs/specs/components/Carousel/Carousel.spec.md
similarity index 100%
rename from packages/core/src/Carousel/Carousel.spec.md
rename to docs/specs/components/Carousel/Carousel.spec.md
diff --git a/packages/core/src/Center/Center.spec.md b/docs/specs/components/Center/Center.spec.md
similarity index 100%
rename from packages/core/src/Center/Center.spec.md
rename to docs/specs/components/Center/Center.spec.md
diff --git a/packages/charts/src/Chart.spec.md b/docs/specs/components/Chart/Chart.spec.md
similarity index 100%
rename from packages/charts/src/Chart.spec.md
rename to docs/specs/components/Chart/Chart.spec.md
diff --git a/packages/charts/src/ChartAxis.spec.md b/docs/specs/components/ChartAxis/ChartAxis.spec.md
similarity index 100%
rename from packages/charts/src/ChartAxis.spec.md
rename to docs/specs/components/ChartAxis/ChartAxis.spec.md
diff --git a/packages/charts/src/ChartGrid.spec.md b/docs/specs/components/ChartGrid/ChartGrid.spec.md
similarity index 100%
rename from packages/charts/src/ChartGrid.spec.md
rename to docs/specs/components/ChartGrid/ChartGrid.spec.md
diff --git a/packages/charts/src/ChartLegend.spec.md b/docs/specs/components/ChartLegend/ChartLegend.spec.md
similarity index 100%
rename from packages/charts/src/ChartLegend.spec.md
rename to docs/specs/components/ChartLegend/ChartLegend.spec.md
diff --git a/packages/charts/src/ChartSwatch.spec.md b/docs/specs/components/ChartSwatch/ChartSwatch.spec.md
similarity index 100%
rename from packages/charts/src/ChartSwatch.spec.md
rename to docs/specs/components/ChartSwatch/ChartSwatch.spec.md
diff --git a/packages/charts/src/ChartTooltip.spec.md b/docs/specs/components/ChartTooltip/ChartTooltip.spec.md
similarity index 100%
rename from packages/charts/src/ChartTooltip.spec.md
rename to docs/specs/components/ChartTooltip/ChartTooltip.spec.md
diff --git a/packages/core/src/Chat/ChatComposer.spec.md b/docs/specs/components/Chat/ChatComposer.spec.md
similarity index 100%
rename from packages/core/src/Chat/ChatComposer.spec.md
rename to docs/specs/components/Chat/ChatComposer.spec.md
diff --git a/packages/core/src/Chat/ChatComposerDrawer.spec.md b/docs/specs/components/Chat/ChatComposerDrawer.spec.md
similarity index 100%
rename from packages/core/src/Chat/ChatComposerDrawer.spec.md
rename to docs/specs/components/Chat/ChatComposerDrawer.spec.md
diff --git a/packages/core/src/Chat/ChatComposerInput.spec.md b/docs/specs/components/Chat/ChatComposerInput.spec.md
similarity index 100%
rename from packages/core/src/Chat/ChatComposerInput.spec.md
rename to docs/specs/components/Chat/ChatComposerInput.spec.md
diff --git a/packages/core/src/Chat/ChatComposerTokenElement.spec.md b/docs/specs/components/Chat/ChatComposerTokenElement.spec.md
similarity index 100%
rename from packages/core/src/Chat/ChatComposerTokenElement.spec.md
rename to docs/specs/components/Chat/ChatComposerTokenElement.spec.md
diff --git a/packages/core/src/Chat/ChatDictationButton.spec.md b/docs/specs/components/Chat/ChatDictationButton.spec.md
similarity index 100%
rename from packages/core/src/Chat/ChatDictationButton.spec.md
rename to docs/specs/components/Chat/ChatDictationButton.spec.md
diff --git a/packages/core/src/Chat/ChatLayout.spec.md b/docs/specs/components/Chat/ChatLayout.spec.md
similarity index 100%
rename from packages/core/src/Chat/ChatLayout.spec.md
rename to docs/specs/components/Chat/ChatLayout.spec.md
diff --git a/packages/core/src/Chat/ChatLayoutScrollButton.spec.md b/docs/specs/components/Chat/ChatLayoutScrollButton.spec.md
similarity index 100%
rename from packages/core/src/Chat/ChatLayoutScrollButton.spec.md
rename to docs/specs/components/Chat/ChatLayoutScrollButton.spec.md
diff --git a/packages/core/src/Chat/ChatMessage.spec.md b/docs/specs/components/Chat/ChatMessage.spec.md
similarity index 100%
rename from packages/core/src/Chat/ChatMessage.spec.md
rename to docs/specs/components/Chat/ChatMessage.spec.md
diff --git a/packages/core/src/Chat/ChatMessageBubble.spec.md b/docs/specs/components/Chat/ChatMessageBubble.spec.md
similarity index 100%
rename from packages/core/src/Chat/ChatMessageBubble.spec.md
rename to docs/specs/components/Chat/ChatMessageBubble.spec.md
diff --git a/packages/core/src/Chat/ChatMessageList.spec.md b/docs/specs/components/Chat/ChatMessageList.spec.md
similarity index 100%
rename from packages/core/src/Chat/ChatMessageList.spec.md
rename to docs/specs/components/Chat/ChatMessageList.spec.md
diff --git a/packages/core/src/Chat/ChatMessageMetadata.spec.md b/docs/specs/components/Chat/ChatMessageMetadata.spec.md
similarity index 100%
rename from packages/core/src/Chat/ChatMessageMetadata.spec.md
rename to docs/specs/components/Chat/ChatMessageMetadata.spec.md
diff --git a/packages/core/src/Chat/ChatSendButton.spec.md b/docs/specs/components/Chat/ChatSendButton.spec.md
similarity index 100%
rename from packages/core/src/Chat/ChatSendButton.spec.md
rename to docs/specs/components/Chat/ChatSendButton.spec.md
diff --git a/packages/core/src/Chat/ChatSystemMessage.spec.md b/docs/specs/components/Chat/ChatSystemMessage.spec.md
similarity index 100%
rename from packages/core/src/Chat/ChatSystemMessage.spec.md
rename to docs/specs/components/Chat/ChatSystemMessage.spec.md
diff --git a/packages/core/src/Chat/ChatTokenizedText.spec.md b/docs/specs/components/Chat/ChatTokenizedText.spec.md
similarity index 100%
rename from packages/core/src/Chat/ChatTokenizedText.spec.md
rename to docs/specs/components/Chat/ChatTokenizedText.spec.md
diff --git a/packages/core/src/Chat/ChatToolCalls.spec.md b/docs/specs/components/Chat/ChatToolCalls.spec.md
similarity index 100%
rename from packages/core/src/Chat/ChatToolCalls.spec.md
rename to docs/specs/components/Chat/ChatToolCalls.spec.md
diff --git a/packages/core/src/CheckboxInput/CheckboxInput.spec.md b/docs/specs/components/CheckboxInput/CheckboxInput.spec.md
similarity index 100%
rename from packages/core/src/CheckboxInput/CheckboxInput.spec.md
rename to docs/specs/components/CheckboxInput/CheckboxInput.spec.md
diff --git a/packages/core/src/CheckboxList/CheckboxList.spec.md b/docs/specs/components/CheckboxList/CheckboxList.spec.md
similarity index 100%
rename from packages/core/src/CheckboxList/CheckboxList.spec.md
rename to docs/specs/components/CheckboxList/CheckboxList.spec.md
diff --git a/packages/core/src/CheckboxList/CheckboxListItem.spec.md b/docs/specs/components/CheckboxList/CheckboxListItem.spec.md
similarity index 100%
rename from packages/core/src/CheckboxList/CheckboxListItem.spec.md
rename to docs/specs/components/CheckboxList/CheckboxListItem.spec.md
diff --git a/packages/core/src/Citation/Citation.spec.md b/docs/specs/components/Citation/Citation.spec.md
similarity index 100%
rename from packages/core/src/Citation/Citation.spec.md
rename to docs/specs/components/Citation/Citation.spec.md
diff --git a/packages/core/src/ClickableCard/ClickableCard.spec.md b/docs/specs/components/ClickableCard/ClickableCard.spec.md
similarity index 100%
rename from packages/core/src/ClickableCard/ClickableCard.spec.md
rename to docs/specs/components/ClickableCard/ClickableCard.spec.md
diff --git a/packages/core/src/Code/Code.spec.md b/docs/specs/components/Code/Code.spec.md
similarity index 100%
rename from packages/core/src/Code/Code.spec.md
rename to docs/specs/components/Code/Code.spec.md
diff --git a/packages/core/src/CodeBlock/CodeBlock.spec.md b/docs/specs/components/CodeBlock/CodeBlock.spec.md
similarity index 100%
rename from packages/core/src/CodeBlock/CodeBlock.spec.md
rename to docs/specs/components/CodeBlock/CodeBlock.spec.md
diff --git a/packages/core/src/Collapsible/Collapsible.spec.md b/docs/specs/components/Collapsible/Collapsible.spec.md
similarity index 100%
rename from packages/core/src/Collapsible/Collapsible.spec.md
rename to docs/specs/components/Collapsible/Collapsible.spec.md
diff --git a/packages/core/src/Collapsible/CollapsibleGroup.spec.md b/docs/specs/components/Collapsible/CollapsibleGroup.spec.md
similarity index 100%
rename from packages/core/src/Collapsible/CollapsibleGroup.spec.md
rename to docs/specs/components/Collapsible/CollapsibleGroup.spec.md
diff --git a/packages/core/src/CommandPalette/CommandPalette.spec.md b/docs/specs/components/CommandPalette/CommandPalette.spec.md
similarity index 100%
rename from packages/core/src/CommandPalette/CommandPalette.spec.md
rename to docs/specs/components/CommandPalette/CommandPalette.spec.md
diff --git a/packages/core/src/CommandPalette/CommandPaletteEmpty.spec.md b/docs/specs/components/CommandPalette/CommandPaletteEmpty.spec.md
similarity index 100%
rename from packages/core/src/CommandPalette/CommandPaletteEmpty.spec.md
rename to docs/specs/components/CommandPalette/CommandPaletteEmpty.spec.md
diff --git a/packages/core/src/CommandPalette/CommandPaletteInput.spec.md b/docs/specs/components/CommandPalette/CommandPaletteInput.spec.md
similarity index 100%
rename from packages/core/src/CommandPalette/CommandPaletteInput.spec.md
rename to docs/specs/components/CommandPalette/CommandPaletteInput.spec.md
diff --git a/packages/core/src/CommandPalette/CommandPaletteItem.spec.md b/docs/specs/components/CommandPalette/CommandPaletteItem.spec.md
similarity index 100%
rename from packages/core/src/CommandPalette/CommandPaletteItem.spec.md
rename to docs/specs/components/CommandPalette/CommandPaletteItem.spec.md
diff --git a/packages/core/src/CommandPalette/CommandPaletteList.spec.md b/docs/specs/components/CommandPalette/CommandPaletteList.spec.md
similarity index 100%
rename from packages/core/src/CommandPalette/CommandPaletteList.spec.md
rename to docs/specs/components/CommandPalette/CommandPaletteList.spec.md
diff --git a/packages/lab/src/CommentPin/CommentPin.spec.md b/docs/specs/components/CommentPin/CommentPin.spec.md
similarity index 100%
rename from packages/lab/src/CommentPin/CommentPin.spec.md
rename to docs/specs/components/CommentPin/CommentPin.spec.md
diff --git a/packages/core/src/ComplexSelector/ComplexSelector.spec.md b/docs/specs/components/ComplexSelector/ComplexSelector.spec.md
similarity index 100%
rename from packages/core/src/ComplexSelector/ComplexSelector.spec.md
rename to docs/specs/components/ComplexSelector/ComplexSelector.spec.md
diff --git a/packages/core/src/ContextMenu/ContextMenu.spec.md b/docs/specs/components/ContextMenu/ContextMenu.spec.md
similarity index 100%
rename from packages/core/src/ContextMenu/ContextMenu.spec.md
rename to docs/specs/components/ContextMenu/ContextMenu.spec.md
diff --git a/packages/core/src/ContextMenu/ContextMenuItem.spec.md b/docs/specs/components/ContextMenu/ContextMenuItem.spec.md
similarity index 100%
rename from packages/core/src/ContextMenu/ContextMenuItem.spec.md
rename to docs/specs/components/ContextMenu/ContextMenuItem.spec.md
diff --git a/packages/core/src/DateInput/DateInput.spec.md b/docs/specs/components/DateInput/DateInput.spec.md
similarity index 100%
rename from packages/core/src/DateInput/DateInput.spec.md
rename to docs/specs/components/DateInput/DateInput.spec.md
diff --git a/packages/core/src/DateRangeInput/DateRangeInput.spec.md b/docs/specs/components/DateRangeInput/DateRangeInput.spec.md
similarity index 100%
rename from packages/core/src/DateRangeInput/DateRangeInput.spec.md
rename to docs/specs/components/DateRangeInput/DateRangeInput.spec.md
diff --git a/packages/core/src/DateTimeInput/DateTimeInput.spec.md b/docs/specs/components/DateTimeInput/DateTimeInput.spec.md
similarity index 100%
rename from packages/core/src/DateTimeInput/DateTimeInput.spec.md
rename to docs/specs/components/DateTimeInput/DateTimeInput.spec.md
diff --git a/packages/core/src/Dialog/Dialog.spec.md b/docs/specs/components/Dialog/Dialog.spec.md
similarity index 100%
rename from packages/core/src/Dialog/Dialog.spec.md
rename to docs/specs/components/Dialog/Dialog.spec.md
diff --git a/packages/core/src/Dialog/modules/DialogHeader.spec.md b/docs/specs/components/Dialog/modules/DialogHeader.spec.md
similarity index 100%
rename from packages/core/src/Dialog/modules/DialogHeader.spec.md
rename to docs/specs/components/Dialog/modules/DialogHeader.spec.md
diff --git a/packages/core/src/Divider/Divider.spec.md b/docs/specs/components/Divider/Divider.spec.md
similarity index 100%
rename from packages/core/src/Divider/Divider.spec.md
rename to docs/specs/components/Divider/Divider.spec.md
diff --git a/packages/core/src/Drawer/Drawer.spec.md b/docs/specs/components/Drawer/Drawer.spec.md
similarity index 100%
rename from packages/core/src/Drawer/Drawer.spec.md
rename to docs/specs/components/Drawer/Drawer.spec.md
diff --git a/packages/core/src/Drawer/DrawerHeader.spec.md b/docs/specs/components/Drawer/DrawerHeader.spec.md
similarity index 100%
rename from packages/core/src/Drawer/DrawerHeader.spec.md
rename to docs/specs/components/Drawer/DrawerHeader.spec.md
diff --git a/packages/core/src/DropdownMenu/DropdownMenu.spec.md b/docs/specs/components/DropdownMenu/DropdownMenu.spec.md
similarity index 100%
rename from packages/core/src/DropdownMenu/DropdownMenu.spec.md
rename to docs/specs/components/DropdownMenu/DropdownMenu.spec.md
diff --git a/packages/core/src/DropdownMenu/DropdownMenuCheckboxItem.spec.md b/docs/specs/components/DropdownMenu/DropdownMenuCheckboxItem.spec.md
similarity index 100%
rename from packages/core/src/DropdownMenu/DropdownMenuCheckboxItem.spec.md
rename to docs/specs/components/DropdownMenu/DropdownMenuCheckboxItem.spec.md
diff --git a/packages/core/src/DropdownMenu/DropdownMenuDivider.spec.md b/docs/specs/components/DropdownMenu/DropdownMenuDivider.spec.md
similarity index 100%
rename from packages/core/src/DropdownMenu/DropdownMenuDivider.spec.md
rename to docs/specs/components/DropdownMenu/DropdownMenuDivider.spec.md
diff --git a/packages/core/src/DropdownMenu/DropdownMenuGroup.spec.md b/docs/specs/components/DropdownMenu/DropdownMenuGroup.spec.md
similarity index 100%
rename from packages/core/src/DropdownMenu/DropdownMenuGroup.spec.md
rename to docs/specs/components/DropdownMenu/DropdownMenuGroup.spec.md
diff --git a/packages/core/src/DropdownMenu/DropdownMenuItem.spec.md b/docs/specs/components/DropdownMenu/DropdownMenuItem.spec.md
similarity index 100%
rename from packages/core/src/DropdownMenu/DropdownMenuItem.spec.md
rename to docs/specs/components/DropdownMenu/DropdownMenuItem.spec.md
diff --git a/packages/core/src/DropdownMenu/DropdownMenuRadioGroup.spec.md b/docs/specs/components/DropdownMenu/DropdownMenuRadioGroup.spec.md
similarity index 100%
rename from packages/core/src/DropdownMenu/DropdownMenuRadioGroup.spec.md
rename to docs/specs/components/DropdownMenu/DropdownMenuRadioGroup.spec.md
diff --git a/packages/core/src/DropdownMenu/DropdownMenuRadioItem.spec.md b/docs/specs/components/DropdownMenu/DropdownMenuRadioItem.spec.md
similarity index 100%
rename from packages/core/src/DropdownMenu/DropdownMenuRadioItem.spec.md
rename to docs/specs/components/DropdownMenu/DropdownMenuRadioItem.spec.md
diff --git a/packages/core/src/DropdownMenu/DropdownMenuSubMenu.spec.md b/docs/specs/components/DropdownMenu/DropdownMenuSubMenu.spec.md
similarity index 100%
rename from packages/core/src/DropdownMenu/DropdownMenuSubMenu.spec.md
rename to docs/specs/components/DropdownMenu/DropdownMenuSubMenu.spec.md
diff --git a/packages/core/src/DropdownMenu/modules/useMenuHover.spec.md b/docs/specs/components/DropdownMenu/modules/useMenuHover.spec.md
similarity index 100%
rename from packages/core/src/DropdownMenu/modules/useMenuHover.spec.md
rename to docs/specs/components/DropdownMenu/modules/useMenuHover.spec.md
diff --git a/packages/core/src/DropdownMenu/modules/useMenuPress.spec.md b/docs/specs/components/DropdownMenu/modules/useMenuPress.spec.md
similarity index 100%
rename from packages/core/src/DropdownMenu/modules/useMenuPress.spec.md
rename to docs/specs/components/DropdownMenu/modules/useMenuPress.spec.md
diff --git a/packages/core/src/EmptyState/EmptyState.spec.md b/docs/specs/components/EmptyState/EmptyState.spec.md
similarity index 100%
rename from packages/core/src/EmptyState/EmptyState.spec.md
rename to docs/specs/components/EmptyState/EmptyState.spec.md
diff --git a/packages/core/src/Field/Field.spec.md b/docs/specs/components/Field/Field.spec.md
similarity index 100%
rename from packages/core/src/Field/Field.spec.md
rename to docs/specs/components/Field/Field.spec.md
diff --git a/packages/core/src/Field/FieldLabel.spec.md b/docs/specs/components/Field/FieldLabel.spec.md
similarity index 100%
rename from packages/core/src/Field/FieldLabel.spec.md
rename to docs/specs/components/Field/FieldLabel.spec.md
diff --git a/packages/core/src/FieldStatus/FieldStatus.spec.md b/docs/specs/components/FieldStatus/FieldStatus.spec.md
similarity index 100%
rename from packages/core/src/FieldStatus/FieldStatus.spec.md
rename to docs/specs/components/FieldStatus/FieldStatus.spec.md
diff --git a/packages/core/src/FileInput/FileInput.spec.md b/docs/specs/components/FileInput/FileInput.spec.md
similarity index 100%
rename from packages/core/src/FileInput/FileInput.spec.md
rename to docs/specs/components/FileInput/FileInput.spec.md
diff --git a/packages/core/src/FormLayout/FormLayout.spec.md b/docs/specs/components/FormLayout/FormLayout.spec.md
similarity index 100%
rename from packages/core/src/FormLayout/FormLayout.spec.md
rename to docs/specs/components/FormLayout/FormLayout.spec.md
diff --git a/packages/core/src/Grid/Grid.spec.md b/docs/specs/components/Grid/Grid.spec.md
similarity index 100%
rename from packages/core/src/Grid/Grid.spec.md
rename to docs/specs/components/Grid/Grid.spec.md
diff --git a/packages/core/src/Grid/GridSpan.spec.md b/docs/specs/components/Grid/GridSpan.spec.md
similarity index 100%
rename from packages/core/src/Grid/GridSpan.spec.md
rename to docs/specs/components/Grid/GridSpan.spec.md
diff --git a/packages/core/src/Heading/Heading.spec.md b/docs/specs/components/Heading/Heading.spec.md
similarity index 100%
rename from packages/core/src/Heading/Heading.spec.md
rename to docs/specs/components/Heading/Heading.spec.md
diff --git a/packages/core/src/HoverCard/HoverCard.spec.md b/docs/specs/components/HoverCard/HoverCard.spec.md
similarity index 100%
rename from packages/core/src/HoverCard/HoverCard.spec.md
rename to docs/specs/components/HoverCard/HoverCard.spec.md
diff --git a/packages/core/src/Icon/Icon.spec.md b/docs/specs/components/Icon/Icon.spec.md
similarity index 100%
rename from packages/core/src/Icon/Icon.spec.md
rename to docs/specs/components/Icon/Icon.spec.md
diff --git a/packages/native/apple/Sources/Astryx/Icon/Icon.spec.md b/docs/specs/components/Icon/Icon.swift.spec.md
similarity index 100%
rename from packages/native/apple/Sources/Astryx/Icon/Icon.spec.md
rename to docs/specs/components/Icon/Icon.swift.spec.md
diff --git a/packages/core/src/IconButton/IconButton.spec.md b/docs/specs/components/IconButton/IconButton.spec.md
similarity index 100%
rename from packages/core/src/IconButton/IconButton.spec.md
rename to docs/specs/components/IconButton/IconButton.spec.md
diff --git a/packages/core/src/Indicator/CheckIndicator.spec.md b/docs/specs/components/Indicator/CheckIndicator.spec.md
similarity index 100%
rename from packages/core/src/Indicator/CheckIndicator.spec.md
rename to docs/specs/components/Indicator/CheckIndicator.spec.md
diff --git a/packages/core/src/Indicator/CheckboxIndicator.spec.md b/docs/specs/components/Indicator/CheckboxIndicator.spec.md
similarity index 100%
rename from packages/core/src/Indicator/CheckboxIndicator.spec.md
rename to docs/specs/components/Indicator/CheckboxIndicator.spec.md
diff --git a/packages/core/src/Indicator/Indicator.spec.md b/docs/specs/components/Indicator/Indicator.spec.md
similarity index 100%
rename from packages/core/src/Indicator/Indicator.spec.md
rename to docs/specs/components/Indicator/Indicator.spec.md
diff --git a/packages/core/src/InfoTip/InfoTip.spec.md b/docs/specs/components/InfoTip/InfoTip.spec.md
similarity index 100%
rename from packages/core/src/InfoTip/InfoTip.spec.md
rename to docs/specs/components/InfoTip/InfoTip.spec.md
diff --git a/packages/core/src/InputGroup/InputGroup.spec.md b/docs/specs/components/InputGroup/InputGroup.spec.md
similarity index 100%
rename from packages/core/src/InputGroup/InputGroup.spec.md
rename to docs/specs/components/InputGroup/InputGroup.spec.md
diff --git a/packages/core/src/InputGroup/InputGroupText.spec.md b/docs/specs/components/InputGroup/InputGroupText.spec.md
similarity index 100%
rename from packages/core/src/InputGroup/InputGroupText.spec.md
rename to docs/specs/components/InputGroup/InputGroupText.spec.md
diff --git a/packages/core/src/Item/Item.spec.md b/docs/specs/components/Item/Item.spec.md
similarity index 100%
rename from packages/core/src/Item/Item.spec.md
rename to docs/specs/components/Item/Item.spec.md
diff --git a/packages/core/src/Kbd/Kbd.spec.md b/docs/specs/components/Kbd/Kbd.spec.md
similarity index 100%
rename from packages/core/src/Kbd/Kbd.spec.md
rename to docs/specs/components/Kbd/Kbd.spec.md
diff --git a/packages/core/src/Layer/LayerProvider.spec.md b/docs/specs/components/Layer/LayerProvider.spec.md
similarity index 100%
rename from packages/core/src/Layer/LayerProvider.spec.md
rename to docs/specs/components/Layer/LayerProvider.spec.md
diff --git a/packages/core/src/Layout/Layout.spec.md b/docs/specs/components/Layout/Layout.spec.md
similarity index 100%
rename from packages/core/src/Layout/Layout.spec.md
rename to docs/specs/components/Layout/Layout.spec.md
diff --git a/packages/core/src/Layout/LayoutContent.spec.md b/docs/specs/components/Layout/LayoutContent.spec.md
similarity index 100%
rename from packages/core/src/Layout/LayoutContent.spec.md
rename to docs/specs/components/Layout/LayoutContent.spec.md
diff --git a/packages/core/src/Layout/LayoutFooter.spec.md b/docs/specs/components/Layout/LayoutFooter.spec.md
similarity index 100%
rename from packages/core/src/Layout/LayoutFooter.spec.md
rename to docs/specs/components/Layout/LayoutFooter.spec.md
diff --git a/packages/core/src/Layout/LayoutHeader.spec.md b/docs/specs/components/Layout/LayoutHeader.spec.md
similarity index 100%
rename from packages/core/src/Layout/LayoutHeader.spec.md
rename to docs/specs/components/Layout/LayoutHeader.spec.md
diff --git a/packages/core/src/Layout/LayoutPanel.spec.md b/docs/specs/components/Layout/LayoutPanel.spec.md
similarity index 100%
rename from packages/core/src/Layout/LayoutPanel.spec.md
rename to docs/specs/components/Layout/LayoutPanel.spec.md
diff --git a/packages/core/src/Lightbox/Lightbox.spec.md b/docs/specs/components/Lightbox/Lightbox.spec.md
similarity index 100%
rename from packages/core/src/Lightbox/Lightbox.spec.md
rename to docs/specs/components/Lightbox/Lightbox.spec.md
diff --git a/packages/core/src/Link/Link.spec.md b/docs/specs/components/Link/Link.spec.md
similarity index 99%
rename from packages/core/src/Link/Link.spec.md
rename to docs/specs/components/Link/Link.spec.md
index 3d58f62d00..456238dd37 100644
--- a/packages/core/src/Link/Link.spec.md
+++ b/docs/specs/components/Link/Link.spec.md
@@ -192,7 +192,7 @@ carries no anatomy-theming map.
| FR2, FR3, AR3 | `Link.test.tsx` external, target, rel, and new-tab cases; `Link.a11y.chromium.spec.ts` external state | External; explicit `_blank`; custom label | A missing safety token, icon, or new-tab text fails. Evidence gap: no test checks the accessible name of an external link with `label`. Evidence gap: no test sets `referrerPolicy` or asserts the external icon's size or color. | `audit:Link/accessibility` |
| FR4 | `Link.navigation.a11y.chromium.spec.ts` | Rejected and ordinary schemes; native, router, downloads | A rejected destination that navigates or reaches a router fails. | `audit:Link/behavior` |
| FR5, AR2 | `Link.test.tsx` disabled cases | Disabled anchor; disabled button form; with `onClick` | Navigation, a consumer `onClick`, a lost Tab stop, or a custom component on a disabled link fails. Evidence gap: no test disables a focused link or passes a caller `aria-disabled`, `role`, or `tabIndex`. Evidence gap: no test asserts that other keys reach the caller's `onKeyDown`, or the half-opacity, no-pointer-events paint. | `audit:Link/accessibility` |
-| FR6 (type) | `Link.test.tsx` text-type cases | Default `body`; `type="inherit"` | A dropped Text `type` fails. `Link.truncation.a11y.chromium.spec.ts`: an anchor and a button Link with `maxLines={1}` in a fixed-width line stop at the line and draw an ellipsis. Evidence gap: no test asserts that `size`, `weight`, `color`, or `display` reach Text, or the `isStandalone` root size. | `audit:Link/visual` |
+| FR6 (type) | `Link.test.tsx` text-type cases | Default `body`; `type="inherit"` | A dropped Text `type` fails. `Link.truncation.a11y.chromium.spec.ts`: an anchor and a button Link with `maxLines={1}` in a fixed-width line stop at the line and draw an ellipsis. Evidence gap: no test asserts that `size`, `weight`, `color`, or `display` reach Text, or the `isStandalone` root size. | `audit:Link/visual` |
| FR6, FR7 (paint) | Evidence gap: the color, underline, and standalone cases assert only that a link renders; hover paint is untested | Each color; `hasUnderline`; `isStandalone` | — | `audit:Link/visual` |
| FR8 | `Link.test.tsx` pressed-state suite | Link, button form, disabled | No press paint, or press paint on a disabled Link, fails. | `audit:Link/behavior` |
| FR9, FR11, AR4 | `Link.test.tsx` label, ref, and theme-class cases | With and without `label`; `data-color` | A missing or extra `aria-label`, target, `data-color`, or ref fails. The accessibility suites assert a passed `data-*` attribute and `aria-current` on the root, and the navigation suite asserts `download`. Evidence gap: no test passes both `label` and `aria-label`, or passes `className`, `style`, or `xstyle`. | `audit:Link/theming` |
diff --git a/packages/core/src/Link/LinkProvider.spec.md b/docs/specs/components/Link/LinkProvider.spec.md
similarity index 100%
rename from packages/core/src/Link/LinkProvider.spec.md
rename to docs/specs/components/Link/LinkProvider.spec.md
diff --git a/packages/core/src/List/List.spec.md b/docs/specs/components/List/List.spec.md
similarity index 100%
rename from packages/core/src/List/List.spec.md
rename to docs/specs/components/List/List.spec.md
diff --git a/packages/core/src/List/ListItem.spec.md b/docs/specs/components/List/ListItem.spec.md
similarity index 100%
rename from packages/core/src/List/ListItem.spec.md
rename to docs/specs/components/List/ListItem.spec.md
diff --git a/packages/core/src/Markdown/Markdown.spec.md b/docs/specs/components/Markdown/Markdown.spec.md
similarity index 100%
rename from packages/core/src/Markdown/Markdown.spec.md
rename to docs/specs/components/Markdown/Markdown.spec.md
diff --git a/packages/core/src/Markdown/modules/headingLinks.spec.md b/docs/specs/components/Markdown/modules/headingLinks.spec.md
similarity index 100%
rename from packages/core/src/Markdown/modules/headingLinks.spec.md
rename to docs/specs/components/Markdown/modules/headingLinks.spec.md
diff --git a/packages/core/src/Markdown/modules/remark.spec.md b/docs/specs/components/Markdown/modules/remark.spec.md
similarity index 99%
rename from packages/core/src/Markdown/modules/remark.spec.md
rename to docs/specs/components/Markdown/modules/remark.spec.md
index 3d6b3ed562..c5463ff2b8 100644
--- a/packages/core/src/Markdown/modules/remark.spec.md
+++ b/docs/specs/components/Markdown/modules/remark.spec.md
@@ -27,7 +27,7 @@ references: [architecture:public-component-api, spec:AST-036/DEC-3]
| Builder impact | Builders who import nothing are unaffected. An opt-in builder imports the adapter, proves one plugin compatible with fixtures, and reads one diagnostic when a plugin leaves the profile. |
| Compatibility/readiness | Additive and opt-in; absent from Markdown's entry point and from parser-only or server bundles unless imported. Compatibility is per plugin evidence, never package identity. |
| Review checks | Reject silent approximation, dropped fields, restored or rebuilt provenance, authored or shifted positions, edited Astryx owned nodes, raw-markup channels, async or processor-state plugins, plugin-authored diagnostic text, a refusal a plugin can catch and continue past, an unhandled rejection, or adapter imports inside Markdown or the parser. |
-| Governing rules | [`spec:AST-036` FR18–FR20, FR24](../../../../../docs/specs/AST-036/spec.md); [`component:Markdown` FR12–FR16](../Markdown.spec.md); [`architecture:public-component-api`](../../../../../docs/architecture/public-component-api.md). |
+| Governing rules | [`spec:AST-036` FR18–FR20, FR24](../../../AST-036/spec.md); [`component:Markdown` FR12–FR16](../Markdown.spec.md); [`architecture:public-component-api`](../../../../architecture/public-component-api.md). |
This table is a review projection; the body below is authoritative.
diff --git a/packages/core/src/Markdown/modules/softBreaks.spec.md b/docs/specs/components/Markdown/modules/softBreaks.spec.md
similarity index 98%
rename from packages/core/src/Markdown/modules/softBreaks.spec.md
rename to docs/specs/components/Markdown/modules/softBreaks.spec.md
index 20ccce4e82..58e24322e8 100644
--- a/packages/core/src/Markdown/modules/softBreaks.spec.md
+++ b/docs/specs/components/Markdown/modules/softBreaks.spec.md
@@ -32,7 +32,7 @@ references: [spec:AST-036/DEC-1, spec:AST-036/DEC-11]
| Builder impact | Builders opt in by adding one value to `plugins`; there are no settings or renderer slots. |
| Compatibility | Additive and opt-in; omitted and empty plugin lists preserve the released parser, DOM, accessibility, and streaming behavior. |
| Review checks | Reject missing link-label parity with `remark-breaks`, matching inside code, images, citations, math, or extension nodes; source preprocessing; a custom renderer; or behavior that diverges between complete and streaming input. |
-| Governing rules | [`spec:AST-036` FR1–FR17, FR21–FR24, FR36, FR38, FR40](../../../../../docs/specs/AST-036/spec.md); [`component:Markdown` FR12–FR16, FR21](../Markdown.spec.md). |
+| Governing rules | [`spec:AST-036` FR1–FR17, FR21–FR24, FR36, FR38, FR40](../../../AST-036/spec.md); [`component:Markdown` FR12–FR16, FR21](../Markdown.spec.md). |
This table is a review projection; the body below is authoritative.
diff --git a/packages/core/src/Markdown/modules/sourceLines.spec.md b/docs/specs/components/Markdown/modules/sourceLines.spec.md
similarity index 99%
rename from packages/core/src/Markdown/modules/sourceLines.spec.md
rename to docs/specs/components/Markdown/modules/sourceLines.spec.md
index c181c36e9f..6253395410 100644
--- a/packages/core/src/Markdown/modules/sourceLines.spec.md
+++ b/docs/specs/components/Markdown/modules/sourceLines.spec.md
@@ -27,7 +27,7 @@ references: [spec:AST-036/DEC-1, spec:AST-036/DEC-11, component:Markdown/DEC-2]
| Builder impact | Builders opt in by adding one value to `plugins`. A builder with a custom block renderer places the received `sourceLines` on its own element; a plugin block renderer reads lines from its node's `position`. |
| Compatibility/readiness | Additive and opt-in. Omitted or empty plugin lists keep the released AST, DOM, parse cost, and streaming reuse. |
| Review checks | Reject a Markdown prop, stamps on inline elements, line work without the plugin, a wrapper element Markdown adds around custom or plugin output, lines that disagree between full and streaming parses, or offsets in DOM. |
-| Governing rules | [`spec:AST-036` FR3, FR9, FR15, FR40](../../../../../docs/specs/AST-036/spec.md); [`component:Markdown` FR3, FR12, FR15](../Markdown.spec.md). |
+| Governing rules | [`spec:AST-036` FR3, FR9, FR15, FR40](../../../AST-036/spec.md); [`component:Markdown` FR3, FR12, FR15](../Markdown.spec.md). |
This table is a review projection; the body below is authoritative.
diff --git a/packages/core/src/MetadataList/MetadataList.spec.md b/docs/specs/components/MetadataList/MetadataList.spec.md
similarity index 100%
rename from packages/core/src/MetadataList/MetadataList.spec.md
rename to docs/specs/components/MetadataList/MetadataList.spec.md
diff --git a/packages/core/src/MetadataList/MetadataListItem.spec.md b/docs/specs/components/MetadataList/MetadataListItem.spec.md
similarity index 100%
rename from packages/core/src/MetadataList/MetadataListItem.spec.md
rename to docs/specs/components/MetadataList/MetadataListItem.spec.md
diff --git a/packages/core/src/MobileNav/MobileNav.spec.md b/docs/specs/components/MobileNav/MobileNav.spec.md
similarity index 100%
rename from packages/core/src/MobileNav/MobileNav.spec.md
rename to docs/specs/components/MobileNav/MobileNav.spec.md
diff --git a/packages/core/src/MoreMenu/MoreMenu.spec.md b/docs/specs/components/MoreMenu/MoreMenu.spec.md
similarity index 100%
rename from packages/core/src/MoreMenu/MoreMenu.spec.md
rename to docs/specs/components/MoreMenu/MoreMenu.spec.md
diff --git a/packages/core/src/MultiSelector/MultiSelector.spec.md b/docs/specs/components/MultiSelector/MultiSelector.spec.md
similarity index 100%
rename from packages/core/src/MultiSelector/MultiSelector.spec.md
rename to docs/specs/components/MultiSelector/MultiSelector.spec.md
diff --git a/packages/core/src/NavIcon/NavIcon.spec.md b/docs/specs/components/NavIcon/NavIcon.spec.md
similarity index 100%
rename from packages/core/src/NavIcon/NavIcon.spec.md
rename to docs/specs/components/NavIcon/NavIcon.spec.md
diff --git a/packages/core/src/NavMenu/NavHeadingMenu.spec.md b/docs/specs/components/NavMenu/NavHeadingMenu.spec.md
similarity index 99%
rename from packages/core/src/NavMenu/NavHeadingMenu.spec.md
rename to docs/specs/components/NavMenu/NavHeadingMenu.spec.md
index c671a98559..bac8727f04 100644
--- a/packages/core/src/NavMenu/NavHeadingMenu.spec.md
+++ b/docs/specs/components/NavMenu/NavHeadingMenu.spec.md
@@ -44,7 +44,7 @@ system_specs: [spec:AST-005/DEC-1, spec:AST-020, spec:AST-085]
| Behavior | A `role="menu"` list of `menuitem` rows inside a heading popover, with arrow, Home, End, typeahead, Enter, Space, and Escape support. Selecting an enabled item runs it and, where the host heading supplies a close action, closes the heading menu. |
| End-user impact | Users switch products or accounts from the heading menu by pointer or keyboard; disabled rows are skipped by keyboard and typeahead. |
| Builder impact | None. |
-| Compatibility/readiness | Records shipped behavior; no public change. Five implementation gaps (see Current-state impact). |
+| Compatibility/readiness | Records shipped behavior; no public change. Five implementation gaps (see Current-state impact). |
| Review checks | Reject losing `menu`/`menuitem` roles to caller props, keyboard focus landing on a disabled item, or a caller `onKeyDown` that silently disables the keyboard model. |
| Governing rules | `family:navigation-destinations` FR7; `architecture:interaction-modality`; `architecture:component-theming-surface`; `architecture:layer-runtime`. |
diff --git a/packages/core/src/NumberInput/NumberInput.spec.md b/docs/specs/components/NumberInput/NumberInput.spec.md
similarity index 100%
rename from packages/core/src/NumberInput/NumberInput.spec.md
rename to docs/specs/components/NumberInput/NumberInput.spec.md
diff --git a/packages/core/src/Outline/Outline.spec.md b/docs/specs/components/Outline/Outline.spec.md
similarity index 100%
rename from packages/core/src/Outline/Outline.spec.md
rename to docs/specs/components/Outline/Outline.spec.md
diff --git a/packages/core/src/Outline/modules/parseOutlineFromMarkdown.spec.md b/docs/specs/components/Outline/modules/parseOutlineFromMarkdown.spec.md
similarity index 100%
rename from packages/core/src/Outline/modules/parseOutlineFromMarkdown.spec.md
rename to docs/specs/components/Outline/modules/parseOutlineFromMarkdown.spec.md
diff --git a/packages/core/src/OverflowList/OverflowList.spec.md b/docs/specs/components/OverflowList/OverflowList.spec.md
similarity index 100%
rename from packages/core/src/OverflowList/OverflowList.spec.md
rename to docs/specs/components/OverflowList/OverflowList.spec.md
diff --git a/packages/core/src/Overlay/Overlay.spec.md b/docs/specs/components/Overlay/Overlay.spec.md
similarity index 100%
rename from packages/core/src/Overlay/Overlay.spec.md
rename to docs/specs/components/Overlay/Overlay.spec.md
diff --git a/packages/core/src/Pagination/Pagination.spec.md b/docs/specs/components/Pagination/Pagination.spec.md
similarity index 100%
rename from packages/core/src/Pagination/Pagination.spec.md
rename to docs/specs/components/Pagination/Pagination.spec.md
diff --git a/packages/core/src/Popover/Popover.spec.md b/docs/specs/components/Popover/Popover.spec.md
similarity index 100%
rename from packages/core/src/Popover/Popover.spec.md
rename to docs/specs/components/Popover/Popover.spec.md
diff --git a/packages/core/src/PowerSearch/PowerSearch.spec.md b/docs/specs/components/PowerSearch/PowerSearch.spec.md
similarity index 100%
rename from packages/core/src/PowerSearch/PowerSearch.spec.md
rename to docs/specs/components/PowerSearch/PowerSearch.spec.md
diff --git a/packages/core/src/ProgressBar/ProgressBar.spec.md b/docs/specs/components/ProgressBar/ProgressBar.spec.md
similarity index 100%
rename from packages/core/src/ProgressBar/ProgressBar.spec.md
rename to docs/specs/components/ProgressBar/ProgressBar.spec.md
diff --git a/packages/core/src/RadioList/RadioList.spec.md b/docs/specs/components/RadioList/RadioList.spec.md
similarity index 100%
rename from packages/core/src/RadioList/RadioList.spec.md
rename to docs/specs/components/RadioList/RadioList.spec.md
diff --git a/packages/core/src/RadioList/RadioListItem.spec.md b/docs/specs/components/RadioList/RadioListItem.spec.md
similarity index 100%
rename from packages/core/src/RadioList/RadioListItem.spec.md
rename to docs/specs/components/RadioList/RadioListItem.spec.md
diff --git a/packages/core/src/Resizable/Resizable.spec.md b/docs/specs/components/Resizable/Resizable.spec.md
similarity index 100%
rename from packages/core/src/Resizable/Resizable.spec.md
rename to docs/specs/components/Resizable/Resizable.spec.md
diff --git a/packages/lab/src/Schedule/Schedule.spec.md b/docs/specs/components/Schedule/Schedule.spec.md
similarity index 100%
rename from packages/lab/src/Schedule/Schedule.spec.md
rename to docs/specs/components/Schedule/Schedule.spec.md
diff --git a/packages/core/src/ScrollableArea/ScrollableArea.spec.md b/docs/specs/components/ScrollableArea/ScrollableArea.spec.md
similarity index 100%
rename from packages/core/src/ScrollableArea/ScrollableArea.spec.md
rename to docs/specs/components/ScrollableArea/ScrollableArea.spec.md
diff --git a/packages/core/src/ScrollableArea/modules/useScrollableArea.spec.md b/docs/specs/components/ScrollableArea/modules/useScrollableArea.spec.md
similarity index 100%
rename from packages/core/src/ScrollableArea/modules/useScrollableArea.spec.md
rename to docs/specs/components/ScrollableArea/modules/useScrollableArea.spec.md
diff --git a/packages/core/src/Section/Section.spec.md b/docs/specs/components/Section/Section.spec.md
similarity index 100%
rename from packages/core/src/Section/Section.spec.md
rename to docs/specs/components/Section/Section.spec.md
diff --git a/packages/core/src/SegmentedControl/SegmentedControl.spec.md b/docs/specs/components/SegmentedControl/SegmentedControl.spec.md
similarity index 100%
rename from packages/core/src/SegmentedControl/SegmentedControl.spec.md
rename to docs/specs/components/SegmentedControl/SegmentedControl.spec.md
diff --git a/packages/core/src/SegmentedControl/SegmentedControlItem.spec.md b/docs/specs/components/SegmentedControl/SegmentedControlItem.spec.md
similarity index 100%
rename from packages/core/src/SegmentedControl/SegmentedControlItem.spec.md
rename to docs/specs/components/SegmentedControl/SegmentedControlItem.spec.md
diff --git a/packages/core/src/SelectableCard/SelectableCard.spec.md b/docs/specs/components/SelectableCard/SelectableCard.spec.md
similarity index 100%
rename from packages/core/src/SelectableCard/SelectableCard.spec.md
rename to docs/specs/components/SelectableCard/SelectableCard.spec.md
diff --git a/packages/core/src/Selector/Selector.spec.md b/docs/specs/components/Selector/Selector.spec.md
similarity index 100%
rename from packages/core/src/Selector/Selector.spec.md
rename to docs/specs/components/Selector/Selector.spec.md
diff --git a/packages/core/src/SideNav/SideNav.spec.md b/docs/specs/components/SideNav/SideNav.spec.md
similarity index 100%
rename from packages/core/src/SideNav/SideNav.spec.md
rename to docs/specs/components/SideNav/SideNav.spec.md
diff --git a/packages/core/src/SideNav/SideNavCollapseButton.spec.md b/docs/specs/components/SideNav/SideNavCollapseButton.spec.md
similarity index 100%
rename from packages/core/src/SideNav/SideNavCollapseButton.spec.md
rename to docs/specs/components/SideNav/SideNavCollapseButton.spec.md
diff --git a/packages/core/src/SideNav/SideNavHeading.spec.md b/docs/specs/components/SideNav/SideNavHeading.spec.md
similarity index 100%
rename from packages/core/src/SideNav/SideNavHeading.spec.md
rename to docs/specs/components/SideNav/SideNavHeading.spec.md
diff --git a/packages/core/src/SideNav/SideNavItem.spec.md b/docs/specs/components/SideNav/SideNavItem.spec.md
similarity index 100%
rename from packages/core/src/SideNav/SideNavItem.spec.md
rename to docs/specs/components/SideNav/SideNavItem.spec.md
diff --git a/packages/core/src/SideNav/SideNavSection.spec.md b/docs/specs/components/SideNav/SideNavSection.spec.md
similarity index 100%
rename from packages/core/src/SideNav/SideNavSection.spec.md
rename to docs/specs/components/SideNav/SideNavSection.spec.md
diff --git a/packages/core/src/Skeleton/Skeleton.spec.md b/docs/specs/components/Skeleton/Skeleton.spec.md
similarity index 100%
rename from packages/core/src/Skeleton/Skeleton.spec.md
rename to docs/specs/components/Skeleton/Skeleton.spec.md
diff --git a/packages/core/src/Slider/Slider.spec.md b/docs/specs/components/Slider/Slider.spec.md
similarity index 100%
rename from packages/core/src/Slider/Slider.spec.md
rename to docs/specs/components/Slider/Slider.spec.md
diff --git a/packages/core/src/Spinner/Spinner.spec.md b/docs/specs/components/Spinner/Spinner.spec.md
similarity index 100%
rename from packages/core/src/Spinner/Spinner.spec.md
rename to docs/specs/components/Spinner/Spinner.spec.md
diff --git a/packages/core/src/Stack/Stack.spec.md b/docs/specs/components/Stack/Stack.spec.md
similarity index 100%
rename from packages/core/src/Stack/Stack.spec.md
rename to docs/specs/components/Stack/Stack.spec.md
diff --git a/packages/core/src/StatusDot/StatusDot.spec.md b/docs/specs/components/StatusDot/StatusDot.spec.md
similarity index 100%
rename from packages/core/src/StatusDot/StatusDot.spec.md
rename to docs/specs/components/StatusDot/StatusDot.spec.md
diff --git a/packages/core/src/Stepper/Step.spec.md b/docs/specs/components/Stepper/Step.spec.md
similarity index 100%
rename from packages/core/src/Stepper/Step.spec.md
rename to docs/specs/components/Stepper/Step.spec.md
diff --git a/packages/core/src/Stepper/Stepper.spec.md b/docs/specs/components/Stepper/Stepper.spec.md
similarity index 100%
rename from packages/core/src/Stepper/Stepper.spec.md
rename to docs/specs/components/Stepper/Stepper.spec.md
diff --git a/packages/core/src/Switch/Switch.spec.md b/docs/specs/components/Switch/Switch.spec.md
similarity index 100%
rename from packages/core/src/Switch/Switch.spec.md
rename to docs/specs/components/Switch/Switch.spec.md
diff --git a/packages/core/src/TabList/Tab.spec.md b/docs/specs/components/TabList/Tab.spec.md
similarity index 100%
rename from packages/core/src/TabList/Tab.spec.md
rename to docs/specs/components/TabList/Tab.spec.md
diff --git a/packages/core/src/TabList/TabList.spec.md b/docs/specs/components/TabList/TabList.spec.md
similarity index 100%
rename from packages/core/src/TabList/TabList.spec.md
rename to docs/specs/components/TabList/TabList.spec.md
diff --git a/packages/core/src/TabList/TabMenu.spec.md b/docs/specs/components/TabList/TabMenu.spec.md
similarity index 100%
rename from packages/core/src/TabList/TabMenu.spec.md
rename to docs/specs/components/TabList/TabMenu.spec.md
diff --git a/packages/core/src/Table/Table.spec.md b/docs/specs/components/Table/Table.spec.md
similarity index 100%
rename from packages/core/src/Table/Table.spec.md
rename to docs/specs/components/Table/Table.spec.md
diff --git a/packages/core/src/Table/plugins/activation/useTableActivation.spec.md b/docs/specs/components/Table/plugins/activation/useTableActivation.spec.md
similarity index 100%
rename from packages/core/src/Table/plugins/activation/useTableActivation.spec.md
rename to docs/specs/components/Table/plugins/activation/useTableActivation.spec.md
diff --git a/packages/core/src/Table/plugins/columnResize/useTableColumnResize.spec.md b/docs/specs/components/Table/plugins/columnResize/useTableColumnResize.spec.md
similarity index 100%
rename from packages/core/src/Table/plugins/columnResize/useTableColumnResize.spec.md
rename to docs/specs/components/Table/plugins/columnResize/useTableColumnResize.spec.md
diff --git a/packages/core/src/Table/plugins/infiniteScroll/useTableInfiniteScroll.spec.md b/docs/specs/components/Table/plugins/infiniteScroll/useTableInfiniteScroll.spec.md
similarity index 100%
rename from packages/core/src/Table/plugins/infiniteScroll/useTableInfiniteScroll.spec.md
rename to docs/specs/components/Table/plugins/infiniteScroll/useTableInfiniteScroll.spec.md
diff --git a/packages/core/src/Table/plugins/rowStatus/useTableRowStatus.spec.md b/docs/specs/components/Table/plugins/rowStatus/useTableRowStatus.spec.md
similarity index 100%
rename from packages/core/src/Table/plugins/rowStatus/useTableRowStatus.spec.md
rename to docs/specs/components/Table/plugins/rowStatus/useTableRowStatus.spec.md
diff --git a/packages/core/src/Table/plugins/virtualization/useTableVirtualization.spec.md b/docs/specs/components/Table/plugins/virtualization/useTableVirtualization.spec.md
similarity index 96%
rename from packages/core/src/Table/plugins/virtualization/useTableVirtualization.spec.md
rename to docs/specs/components/Table/plugins/virtualization/useTableVirtualization.spec.md
index 0af3b1c0a0..55e1b7a116 100644
--- a/packages/core/src/Table/plugins/virtualization/useTableVirtualization.spec.md
+++ b/docs/specs/components/Table/plugins/virtualization/useTableVirtualization.spec.md
@@ -53,7 +53,7 @@ references:
| Builder impact | Builders opt into a fixed-height contract, identify the vertical viewport, and supply stable row keys. Variable-height content and unsupported plugin combinations remain explicit rather than silently degrading. |
| Compatibility/readiness | Additive, unreleased virtualization capability; no automatic correction to existing nonvirtualized paginated rowIndexStart/rowCount callers. Any shared correction needs a separately approved Table authority/compatibility decision under OQ9. This draft is not implementation authority; parent integration, viewport, fixed height, SSR, focus, anchoring, plugin/appearance compatibility, and budgets remain owner decisions. |
| Review checks | Reject invalid table DOM, block rewrites of semantic elements, render-then-hide, mismatched/duplicate/index keys, incomplete full-table ARIA totals or positions, unenforceable fixed height, silent clipping/drift, lost focus, unbounded focus retention, spacer-relative striping/dividers, recycled uncontrolled state, scroll jumps, unsupported combinations that appear to work, or unmeasured performance claims. |
-| Governing rules | `component:Table` owns shared plugin phases and row rendering; its DEC-1 and [`spec:AST-025`](../../../../../../docs/specs/AST-025/spec.md) FR18/FR19 constrain shared viewport ownership. `architecture:react-component-runtime` owns measurement/resource lifetime; `architecture:public-component-api` and `spec:AST-002` own public caller burden. |
+| Governing rules | `component:Table` owns shared plugin phases and row rendering; its DEC-1 and [`spec:AST-025`](../../../../AST-025/spec.md) FR18/FR19 constrain shared viewport ownership. `architecture:react-component-runtime` owns measurement/resource lifetime; `architecture:public-component-api` and `spec:AST-002` own public caller burden. |
This table is a review projection; the body below is authoritative.
@@ -181,14 +181,14 @@ identity, and full-table metadata without an approved integration; OQ1 owns that
## Design relationships
-| Anatomy or state | Design requirement | Representation authority | Module contract |
-| ---------------------- | --------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | --------------------------- |
-| Mounted data row | Looks and behaves like the same logical row in a non-virtualized Table. | Existing row/cell targets and supported plugins | FR2-FR16, AR1-AR8 |
-| Spacer segments | Preserve geometry without becoming visible/accessibility data anatomy. | This module; not a public theme target | FR3-FR5, AR1-AR3 |
-| Vertical viewport | Preserves Table's shared scroll owner; nested owners obey nearest-effective-axis ownership and default chaining. | `component:Table/DEC-1` and [`spec:AST-025`](../../../../../../docs/specs/AST-025/spec.md) FR18/FR19; integration pending OQ2 | FR3, FR11, PR3 |
-| Focus island | Keeps at most one focused row subtree mounted outside the ordinary window; detail participates only if OQ6 admits it. | This module plus the focused descendant/detail owner | FR2, FR5, FR7, AR2, AR4-AR5 |
-| Logical row appearance | Preserves striping parity and final-row dividers from absolute logical metadata. | Parent Table appearance plus this module | FR15, ORD6 |
-| Unsupported tall row | Uses the explicit rejection/full-render fallback rather than clipping under a fixed-height promise. | Parent/module boundary pending OQ10 | FR14, AR7 |
+| Anatomy or state | Design requirement | Representation authority | Module contract |
+| ---------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | --------------------------- |
+| Mounted data row | Looks and behaves like the same logical row in a non-virtualized Table. | Existing row/cell targets and supported plugins | FR2-FR16, AR1-AR8 |
+| Spacer segments | Preserve geometry without becoming visible/accessibility data anatomy. | This module; not a public theme target | FR3-FR5, AR1-AR3 |
+| Vertical viewport | Preserves Table's shared scroll owner; nested owners obey nearest-effective-axis ownership and default chaining. | `component:Table/DEC-1` and [`spec:AST-025`](../../../../AST-025/spec.md) FR18/FR19; integration pending OQ2 | FR3, FR11, PR3 |
+| Focus island | Keeps at most one focused row subtree mounted outside the ordinary window; detail participates only if OQ6 admits it. | This module plus the focused descendant/detail owner | FR2, FR5, FR7, AR2, AR4-AR5 |
+| Logical row appearance | Preserves striping parity and final-row dividers from absolute logical metadata. | Parent Table appearance plus this module | FR15, ORD6 |
+| Unsupported tall row | Uses the explicit rejection/full-render fallback rather than clipping under a fixed-height promise. | Parent/module boundary pending OQ10 | FR14, AR7 |
The module adds no new theming target. Data rows retain current Table targets. Spacer geometry
is structural implementation detail and cannot accept arbitrary theme paint or sizing.
@@ -196,7 +196,7 @@ is structural implementation detail and cannot accept arbitrary theme paint or s
## Parent and system relationships
- `component:Table` owns BaseTable's data/render phases, semantic body/header construction, canonical key reconciliation, row memoization, plugin ordering, core striping/divider appearance, existing body-relative `rowIndexStart`/`rowCount` behavior, and stable expansion/detail representation. This module requires an approved window/spacer/identity/appearance integration with FR5 full-table metadata. OQ9 keeps any shared correction for existing nonvirtualized paginated callers outside the additive module until a separate Table authority/compatibility decision approves it.
-- `component:Table/DEC-1` keeps one Table-owned viewport with shared scroll behavior on the existing Scroll region and a private observed content box. [`spec:AST-025`](../../../../../../docs/specs/AST-025/spec.md) FR18 makes the nearest effective owner on the applicable axis win, permits orthogonal nesting, and requires deliberate same-axis nesting with chaining by default. FR19 lets Table integrate on its existing wrapper so column sizing, keyboard access, scroll shadows, sticky columns, and sticky headers share one viewport; it does not require a separate public ScrollableArea. An external owner is valid only when Table explicitly accepts and coordinates it. OQ2 chooses integration within these constraints, not a parallel scroll owner or overflow detector.
+- `component:Table/DEC-1` keeps one Table-owned viewport with shared scroll behavior on the existing Scroll region and a private observed content box. [`spec:AST-025`](../../../../AST-025/spec.md) FR18 makes the nearest effective owner on the applicable axis win, permits orthogonal nesting, and requires deliberate same-axis nesting with chaining by default. FR19 lets Table integrate on its existing wrapper so column sizing, keyboard access, scroll shadows, sticky columns, and sticky headers share one viewport; it does not require a separate public ScrollableArea. An external owner is valid only when Table explicitly accepts and coordinates it. OQ2 chooses integration within these constraints, not a parallel scroll owner or overflow detector.
- `architecture:react-component-runtime` owns scroll/resize resource lifetime, current values, scheduling, node replacement, StrictMode replay, and cleanup.
- `architecture:public-component-api` and `spec:AST-002` require intent-named inputs and reject leaking an internal virtualizer or tuning knob without proven caller need.
- `spec:AST-009` and `spec:AST-020` own the evidence boundary. This draft claims computed accessibility-tree metadata for mounted rows, not AT discovery of unmounted rows.
@@ -247,7 +247,7 @@ Rejected: separate window/Table extractors, optional identity that falls back to
## Open questions
- **OQ1 — Which parent integration represents windowing, identity, metadata, and spacers?** (`human-api`) Choose parent-owned phases, a dedicated component, or one atomic Table-compatible props bundle. Whichever shape is chosen must keep mutable-compatible `T[]`, the exact validated unique `idKey`, logical offset/count, and semantic spacer ownership together so callers cannot omit or disagree with identity/metadata. No hook or return-object shape is admitted by this question.
-- **OQ2 — Who owns the vertical viewport?** (`human-api`) Decide a Table-owned block viewport versus a caller-supplied ref explicitly accepted and coordinated by Table, subject to `component:Table/DEC-1` and [`spec:AST-025`](../../../../../../docs/specs/AST-025/spec.md) FR18/FR19. Preserve the shared scroll owner for column sizing, keyboard access, scroll shadows, sticky columns, and sticky headers; no separate public ScrollableArea is required. The nearest effective owner on the applicable axis wins; orthogonal nesting may coexist, and any same-axis nesting is deliberate in Table's contract and preserves chaining by default. An arbitrary external wrapper does not satisfy ownership without explicit Table coordination; do not create a parallel owner or overflow detector.
+- **OQ2 — Who owns the vertical viewport?** (`human-api`) Decide a Table-owned block viewport versus a caller-supplied ref explicitly accepted and coordinated by Table, subject to `component:Table/DEC-1` and [`spec:AST-025`](../../../../AST-025/spec.md) FR18/FR19. Preserve the shared scroll owner for column sizing, keyboard access, scroll shadows, sticky columns, and sticky headers; no separate public ScrollableArea is required. The nearest effective owner on the applicable axis wins; orthogonal nesting may coexist, and any same-axis nesting is deliberate in Table's contract and preserves chaining by default. An arbitrary external wrapper does not satisfy ownership without explicit Table coordination; do not create a parallel owner or overflow detector.
- **OQ3 — What is the initial SSR range?** (`human-api`) Decide whether an initial row count is required, has a documented default, or derives from explicit server-known geometry. Full-render-then-collapse and empty-then-repair are rejected.
- **OQ4 — How is the bounded focus island represented?** (`human-design`) Define at most one discontiguous retained row and, only if OQ6 admits it, its owner-defined detail subtree, spacer segmentation, release on blur/removal/return, scroll/focus behavior, and what happens when another off-window row receives focus. Detail shape remains the parent/detail owner's, not virtualization's.
- **OQ5 — What happens when data order changes?** (`human-api`) Decide start-offset, focused/active-key, first-visible-key, or another scroll-anchor policy for sorting, filtering, insertion, deletion, and replacement.
diff --git a/packages/core/src/Text/Text.spec.md b/docs/specs/components/Text/Text.spec.md
similarity index 100%
rename from packages/core/src/Text/Text.spec.md
rename to docs/specs/components/Text/Text.spec.md
diff --git a/packages/core/src/TextArea/TextArea.spec.md b/docs/specs/components/TextArea/TextArea.spec.md
similarity index 100%
rename from packages/core/src/TextArea/TextArea.spec.md
rename to docs/specs/components/TextArea/TextArea.spec.md
diff --git a/packages/core/src/TextInput/TextInput.spec.md b/docs/specs/components/TextInput/TextInput.spec.md
similarity index 100%
rename from packages/core/src/TextInput/TextInput.spec.md
rename to docs/specs/components/TextInput/TextInput.spec.md
diff --git a/packages/native/apple/Sources/Astryx/TextInput/TextInput.spec.md b/docs/specs/components/TextInput/TextInput.swift.spec.md
similarity index 100%
rename from packages/native/apple/Sources/Astryx/TextInput/TextInput.spec.md
rename to docs/specs/components/TextInput/TextInput.swift.spec.md
diff --git a/packages/core/src/Thumbnail/Thumbnail.spec.md b/docs/specs/components/Thumbnail/Thumbnail.spec.md
similarity index 100%
rename from packages/core/src/Thumbnail/Thumbnail.spec.md
rename to docs/specs/components/Thumbnail/Thumbnail.spec.md
diff --git a/packages/native/apple/Sources/Astryx/Thumbnail/Thumbnail.spec.md b/docs/specs/components/Thumbnail/Thumbnail.swift.spec.md
similarity index 100%
rename from packages/native/apple/Sources/Astryx/Thumbnail/Thumbnail.spec.md
rename to docs/specs/components/Thumbnail/Thumbnail.swift.spec.md
diff --git a/packages/core/src/TimeInput/TimeInput.spec.md b/docs/specs/components/TimeInput/TimeInput.spec.md
similarity index 100%
rename from packages/core/src/TimeInput/TimeInput.spec.md
rename to docs/specs/components/TimeInput/TimeInput.spec.md
diff --git a/packages/core/src/Timer/Timer.spec.md b/docs/specs/components/Timer/Timer.spec.md
similarity index 100%
rename from packages/core/src/Timer/Timer.spec.md
rename to docs/specs/components/Timer/Timer.spec.md
diff --git a/packages/core/src/Timestamp/Timestamp.spec.md b/docs/specs/components/Timestamp/Timestamp.spec.md
similarity index 100%
rename from packages/core/src/Timestamp/Timestamp.spec.md
rename to docs/specs/components/Timestamp/Timestamp.spec.md
diff --git a/packages/core/src/Toast/Toast.spec.md b/docs/specs/components/Toast/Toast.spec.md
similarity index 100%
rename from packages/core/src/Toast/Toast.spec.md
rename to docs/specs/components/Toast/Toast.spec.md
diff --git a/packages/core/src/ToggleButton/ToggleButton.spec.md b/docs/specs/components/ToggleButton/ToggleButton.spec.md
similarity index 100%
rename from packages/core/src/ToggleButton/ToggleButton.spec.md
rename to docs/specs/components/ToggleButton/ToggleButton.spec.md
diff --git a/packages/core/src/ToggleButton/ToggleButtonGroup.spec.md b/docs/specs/components/ToggleButton/ToggleButtonGroup.spec.md
similarity index 100%
rename from packages/core/src/ToggleButton/ToggleButtonGroup.spec.md
rename to docs/specs/components/ToggleButton/ToggleButtonGroup.spec.md
diff --git a/packages/core/src/Token/Token.spec.md b/docs/specs/components/Token/Token.spec.md
similarity index 100%
rename from packages/core/src/Token/Token.spec.md
rename to docs/specs/components/Token/Token.spec.md
diff --git a/packages/core/src/Tokenizer/Tokenizer.spec.md b/docs/specs/components/Tokenizer/Tokenizer.spec.md
similarity index 100%
rename from packages/core/src/Tokenizer/Tokenizer.spec.md
rename to docs/specs/components/Tokenizer/Tokenizer.spec.md
diff --git a/packages/core/src/Toolbar/Toolbar.spec.md b/docs/specs/components/Toolbar/Toolbar.spec.md
similarity index 100%
rename from packages/core/src/Toolbar/Toolbar.spec.md
rename to docs/specs/components/Toolbar/Toolbar.spec.md
diff --git a/packages/core/src/Tooltip/Tooltip.spec.md b/docs/specs/components/Tooltip/Tooltip.spec.md
similarity index 100%
rename from packages/core/src/Tooltip/Tooltip.spec.md
rename to docs/specs/components/Tooltip/Tooltip.spec.md
diff --git a/packages/core/src/TopNav/TopNav.spec.md b/docs/specs/components/TopNav/TopNav.spec.md
similarity index 100%
rename from packages/core/src/TopNav/TopNav.spec.md
rename to docs/specs/components/TopNav/TopNav.spec.md
diff --git a/packages/core/src/TopNav/TopNavHeading.spec.md b/docs/specs/components/TopNav/TopNavHeading.spec.md
similarity index 100%
rename from packages/core/src/TopNav/TopNavHeading.spec.md
rename to docs/specs/components/TopNav/TopNavHeading.spec.md
diff --git a/packages/core/src/TopNav/TopNavItem.spec.md b/docs/specs/components/TopNav/TopNavItem.spec.md
similarity index 100%
rename from packages/core/src/TopNav/TopNavItem.spec.md
rename to docs/specs/components/TopNav/TopNavItem.spec.md
diff --git a/packages/core/src/TopNav/TopNavMegaMenu.spec.md b/docs/specs/components/TopNav/TopNavMegaMenu.spec.md
similarity index 100%
rename from packages/core/src/TopNav/TopNavMegaMenu.spec.md
rename to docs/specs/components/TopNav/TopNavMegaMenu.spec.md
diff --git a/packages/core/src/TopNav/TopNavMegaMenuFeaturedCard.spec.md b/docs/specs/components/TopNav/TopNavMegaMenuFeaturedCard.spec.md
similarity index 100%
rename from packages/core/src/TopNav/TopNavMegaMenuFeaturedCard.spec.md
rename to docs/specs/components/TopNav/TopNavMegaMenuFeaturedCard.spec.md
diff --git a/packages/core/src/TopNav/TopNavMegaMenuItem.spec.md b/docs/specs/components/TopNav/TopNavMegaMenuItem.spec.md
similarity index 100%
rename from packages/core/src/TopNav/TopNavMegaMenuItem.spec.md
rename to docs/specs/components/TopNav/TopNavMegaMenuItem.spec.md
diff --git a/packages/core/src/TopNav/TopNavMenu.spec.md b/docs/specs/components/TopNav/TopNavMenu.spec.md
similarity index 100%
rename from packages/core/src/TopNav/TopNavMenu.spec.md
rename to docs/specs/components/TopNav/TopNavMenu.spec.md
diff --git a/packages/core/src/TreeList/TreeList.spec.md b/docs/specs/components/TreeList/TreeList.spec.md
similarity index 99%
rename from packages/core/src/TreeList/TreeList.spec.md
rename to docs/specs/components/TreeList/TreeList.spec.md
index 40eb45ed01..f817e70f61 100644
--- a/packages/core/src/TreeList/TreeList.spec.md
+++ b/docs/specs/components/TreeList/TreeList.spec.md
@@ -43,7 +43,7 @@ system_specs:
| Builder impact | The three standard styling mechanisms remain interchangeable parts of one row-styling seam. A builder may use one or combine them; no existing callsite must opt in. |
| Compatibility/readiness | The contract is additive and preserves default output, except FR8's group motion under a coarse pointer. Its authority is current; implementation support may arrive separately, but the durable API is incomplete until all three mechanisms are supported on the same row. |
| Review checks | Reject an implementation that omits one mechanism from the durable API, sends the mechanisms to different elements, drops a supplied value, targets the semantic `<li>`, or moves the promised row target without an explicit compatibility decision. |
-| Governing rules | [Public component API INV5–INV6](../../../../docs/architecture/public-component-api.md) and [AST-002 FR1, FR4, FR7–FR10, FR12, and DEC-1](../../../../docs/specs/AST-002/spec.md) govern admission, predictability, and composition of the component-local styling seam. |
+| Governing rules | [Public component API INV5–INV6](../../../architecture/public-component-api.md) and [AST-002 FR1, FR4, FR7–FR10, FR12, and DEC-1](../../AST-002/spec.md) govern admission, predictability, and composition of the component-local styling seam. |
This table is a review projection; the body below is authoritative.
diff --git a/packages/core/src/Typeahead/BaseTypeahead.spec.md b/docs/specs/components/Typeahead/BaseTypeahead.spec.md
similarity index 100%
rename from packages/core/src/Typeahead/BaseTypeahead.spec.md
rename to docs/specs/components/Typeahead/BaseTypeahead.spec.md
diff --git a/packages/core/src/Typeahead/Typeahead.spec.md b/docs/specs/components/Typeahead/Typeahead.spec.md
similarity index 100%
rename from packages/core/src/Typeahead/Typeahead.spec.md
rename to docs/specs/components/Typeahead/Typeahead.spec.md
diff --git a/packages/core/src/VisuallyHidden/VisuallyHidden.spec.md b/docs/specs/components/VisuallyHidden/VisuallyHidden.spec.md
similarity index 100%
rename from packages/core/src/VisuallyHidden/VisuallyHidden.spec.md
rename to docs/specs/components/VisuallyHidden/VisuallyHidden.spec.md
diff --git a/packages/core/src/i18n/InternationalizationProvider.spec.md b/docs/specs/components/i18n/InternationalizationProvider.spec.md
similarity index 100%
rename from packages/core/src/i18n/InternationalizationProvider.spec.md
rename to docs/specs/components/i18n/InternationalizationProvider.spec.md
diff --git a/packages/core/src/BottomSheet/BottomSheetSwitcher.tsx b/packages/core/src/BottomSheet/BottomSheetSwitcher.tsx
index 0a1b5eea7d..ffb14203ce 100644
--- a/packages/core/src/BottomSheet/BottomSheetSwitcher.tsx
+++ b/packages/core/src/BottomSheet/BottomSheetSwitcher.tsx
@@ -67,7 +67,7 @@
* - /packages/core/src/BottomSheet/BottomSheetStacking.test.tsx
* - /packages/core/src/BottomSheet/BottomSheetSwitcherContext.ts
* - /packages/core/src/BottomSheet/BottomSheetSwitcher.doc.mjs
- * - /packages/core/src/BottomSheet/BottomSheetSwitcher.spec.md
+ * - /docs/specs/components/BottomSheet/BottomSheetSwitcher.spec.md
* - /packages/core/src/BottomSheet/BottomSheetSwitcher.test.tsx
* - /packages/core/src/BottomSheet/index.ts
* - /apps/storybook/stories/BottomSheetSwitcher.stories.tsx
diff --git a/packages/core/src/Center/Center.tsx b/packages/core/src/Center/Center.tsx
index 4306869e33..4e2c74dac9 100644
--- a/packages/core/src/Center/Center.tsx
+++ b/packages/core/src/Center/Center.tsx
@@ -8,7 +8,7 @@
*
* SYNC: When modified, update these files to stay in sync:
* - /packages/core/src/Center/Center.doc.mjs
- * - /packages/core/src/Center/Center.spec.md
+ * - /docs/specs/components/Center/Center.spec.md
* - /packages/core/src/Center/Center.test.tsx
* - /apps/storybook/stories/Center.stories.tsx
* - /packages/cli/assets/templates/blocks/components/Center/ (showcase blocks)
diff --git a/packages/core/src/Chat/ChatComposerDrawer.tsx b/packages/core/src/Chat/ChatComposerDrawer.tsx
index 8df85ec892..50d039efc7 100644
--- a/packages/core/src/Chat/ChatComposerDrawer.tsx
+++ b/packages/core/src/Chat/ChatComposerDrawer.tsx
@@ -15,7 +15,7 @@
* SYNC: When modified, update:
* - /packages/core/src/Chat/ChatComposerDrawer.test.tsx
* - /packages/core/src/Chat/ChatComposerDrawer.doc.mjs
- * - /packages/core/src/Chat/ChatComposerDrawer.spec.md
+ * - /docs/specs/components/Chat/ChatComposerDrawer.spec.md
* - /apps/storybook/stories/ChatComposerDrawer.stories.tsx
* - /packages/core/src/Chat/index.ts (exports)
* - /packages/cli/assets/templates/blocks/components/ChatComposerDrawer/ (block examples)
diff --git a/packages/core/src/Chat/ChatComposerInput.tsx b/packages/core/src/Chat/ChatComposerInput.tsx
index 2ec516375a..69ba3cdc71 100644
--- a/packages/core/src/Chat/ChatComposerInput.tsx
+++ b/packages/core/src/Chat/ChatComposerInput.tsx
@@ -20,7 +20,7 @@
* SYNC: When modified, update:
* - /packages/core/src/Chat/ChatComposerInput.test.tsx
* - /packages/core/src/Chat/ChatComposerInput.doc.mjs
- * - /packages/core/src/Chat/ChatComposerInput.spec.md
+ * - /docs/specs/components/Chat/ChatComposerInput.spec.md
* - /apps/storybook/stories/ChatComposerInput.stories.tsx
* - /packages/core/src/Chat/index.ts
* - /apps/storybook/stories/ChatComposer.stories.tsx
diff --git a/packages/core/src/Code/Code.tsx b/packages/core/src/Code/Code.tsx
index 1898ef6551..ec697b3b44 100644
--- a/packages/core/src/Code/Code.tsx
+++ b/packages/core/src/Code/Code.tsx
@@ -8,7 +8,7 @@
*
* SYNC: When modified, update:
* - /packages/core/src/Code/Code.doc.mjs (consumer API and theming metadata)
- * - /packages/core/src/Code/Code.spec.md (behavior and verification map)
+ * - /docs/specs/components/Code/Code.spec.md (behavior and verification map)
* - /packages/core/src/CodeBlock/index.ts (compatibility re-exports if types change)
* - /packages/cli/assets/templates/blocks/components/Code/ (showcase blocks)
* - /packages/cli/assets/templates/blocks/components/CodeBlock/ (showcase blocks)
diff --git a/packages/core/src/Drawer/Drawer.tsx b/packages/core/src/Drawer/Drawer.tsx
index bec3f19057..135e500d66 100644
--- a/packages/core/src/Drawer/Drawer.tsx
+++ b/packages/core/src/Drawer/Drawer.tsx
@@ -53,7 +53,7 @@
* - /packages/core/src/Drawer/Drawer.doc.mjs (props table, features, usage)
* - /packages/core/src/Drawer/Drawer.test.tsx (tests for new/changed behavior)
* - /packages/core/src/Drawer/__tests__/DrawerNonModalPageScroll.a11y.chromium.spec.ts (the page beside a non-modal drawer scrolls)
- * - /packages/core/src/Drawer/Drawer.spec.md (component contract)
+ * - /docs/specs/components/Drawer/Drawer.spec.md (component contract)
* - /packages/core/src/Drawer/index.ts (exports if types change)
* - /packages/cli/assets/templates/blocks/components/Drawer/ (showcase blocks)
* - /apps/storybook/stories/Drawer.stories.tsx (examples and visual coverage)
diff --git a/packages/core/src/Selector/Selector.tsx b/packages/core/src/Selector/Selector.tsx
index 4ae01ede43..cc7cbe78b9 100644
--- a/packages/core/src/Selector/Selector.tsx
+++ b/packages/core/src/Selector/Selector.tsx
@@ -10,7 +10,7 @@
* @position Core implementation; consumed by index.ts
*
* SYNC: When modified, update:
- * - /packages/core/src/Selector/Selector.spec.md
+ * - /docs/specs/components/Selector/Selector.spec.md
* - /packages/core/src/Selector/Selector.doc.mjs
* - /packages/core/src/Selector/Selector.test.tsx
* - /packages/core/src/Selector/index.ts
diff --git a/packages/core/src/Timer/Timer.tsx b/packages/core/src/Timer/Timer.tsx
index e89a8af6de..fe37d0138b 100644
--- a/packages/core/src/Timer/Timer.tsx
+++ b/packages/core/src/Timer/Timer.tsx
@@ -9,7 +9,7 @@
* @position Core content primitive for elapsed duration in active operations
*
* SYNC: When modified, update these files to stay in sync:
- * - /packages/core/src/Timer/Timer.spec.md
+ * - /docs/specs/components/Timer/Timer.spec.md
* - /packages/core/src/Timer/Timer.doc.mjs
* - /packages/core/src/Timer/Timer.test.tsx
* - /packages/core/src/Timer/index.ts
diff --git a/packages/core/src/Tokenizer/TokenizerBottomSheet.tsx b/packages/core/src/Tokenizer/TokenizerBottomSheet.tsx
index 1f73054805..987696b89e 100644
--- a/packages/core/src/Tokenizer/TokenizerBottomSheet.tsx
+++ b/packages/core/src/Tokenizer/TokenizerBottomSheet.tsx
@@ -23,7 +23,7 @@
*
* SYNC: When modified, update:
* - /packages/core/src/Tokenizer/Tokenizer.tsx (the trigger and the lazy host)
- * - /packages/core/src/Tokenizer/Tokenizer.spec.md (FR16–FR24, AR6, PR6)
+ * - /docs/specs/components/Tokenizer/Tokenizer.spec.md (FR16–FR24, AR6, PR6)
*/
import {
diff --git a/packages/lab/src/CommentPin/CommentPin.tsx b/packages/lab/src/CommentPin/CommentPin.tsx
index b819073686..38a612b831 100644
--- a/packages/lab/src/CommentPin/CommentPin.tsx
+++ b/packages/lab/src/CommentPin/CommentPin.tsx
@@ -15,7 +15,7 @@
*
* SYNC: When modified, update these files to stay in sync:
* - /packages/lab/src/CommentPin/CommentPin.doc.mjs
- * - /packages/lab/src/CommentPin/CommentPin.spec.md
+ * - /docs/specs/components/CommentPin/CommentPin.spec.md
* - /packages/lab/src/CommentPin/CommentPin.test.tsx
* - /packages/lab/src/CommentPin/index.ts
* - /apps/storybook/stories/CommentPin.stories.tsx
diff --git a/packages/native/apple/Package.swift b/packages/native/apple/Package.swift
index 8d921fb83a..aa749dc6b7 100644
--- a/packages/native/apple/Package.swift
+++ b/packages/native/apple/Package.swift
@@ -27,8 +27,6 @@ let package = Package(
name: "Astryx",
dependencies: ["AstryxNative"],
path: "Sources/Astryx",
- // Each component's spec lives beside its view (AST-093 FR1).
- exclude: ["Avatar/Avatar.spec.md", "Avatar/AvatarStatusDot.spec.md", "Button/Button.spec.md", "Icon/Icon.spec.md", "TextInput/TextInput.spec.md", "Thumbnail/Thumbnail.spec.md"],
resources: [.process("Resources")]
),
.testTarget(name: "AstryxNativeTests", dependencies: ["AstryxNative"], path: "Tests/AstryxNativeTests"),
diff --git a/packages/native/apple/README.md b/packages/native/apple/README.md
index 1e8ac40f82..16aad346ca 100644
--- a/packages/native/apple/README.md
+++ b/packages/native/apple/README.md
@@ -26,13 +26,13 @@ apple/
│ │ │ └── Generated/ # typed tokens and every published theme, generated; do not edit
│ │ ├── Resources/ # core's messages per locale, generated; do not edit
│ │ ├── Localization/
-│ │ ├── Icon/ # Icon, Icon.spec.md
-│ │ ├── Avatar/ # Avatar, Avatar.spec.md
+│ │ ├── Icon/ # Icon
+│ │ ├── Avatar/ # Avatar
│ │ ├── Text/ # Text
│ │ ├── Heading/ # Heading
│ │ ├── Button/ # Button
│ │ ├── TextInput/ # TextInput
-│ │ ├── Thumbnail/ # Thumbnail, Thumbnail.spec.md
+│ │ ├── Thumbnail/ # Thumbnail
│ │ ├── Card/ # Card
│ │ └── Banner/ # Banner
│ └── AstryxNative/ # contracts, wire, logic host (module AstryxNative)
@@ -46,6 +46,9 @@ apple/
└── Tests/
```
+Each component's Swift spec sits beside its core spec, at
+`docs/specs/components/<ComponentRoot>/<Name>.swift.spec.md`.
+
- **`Sources/Astryx/<Name>/`** holds one folder per component, named as in
`packages/core/src/<Name>/`. Each view has core's component name in the
`Astryx` module (`Button`, `Text`), which re-exports SwiftUI and the
diff --git a/packages/native/specs/README.md b/packages/native/specs/README.md
index 69c88cc314..fafa0aee35 100644
--- a/packages/native/specs/README.md
+++ b/packages/native/specs/README.md
@@ -1,8 +1,9 @@
# Native component specs
-One short spec per native component, per language, kept in the component's own
-folder beside its implementation, the way core keeps `TabList.spec.md` next to
-`TabList.tsx`. The rules live in
+One short spec per native component, per language, kept beside the core
+component's spec in its folder under `docs/specs/components/`, so
+`docs/specs/components/TabList/` holds `TabList.spec.md` and
+`TabList.swift.spec.md` side by side. The rules live in
[AST-093 (Native component guidelines)](../../../docs/specs/AST-093-native-component-guidelines/spec.md),
which applies [AST-082 (Native-first surfaces)](../../../docs/specs/AST-082-native-first-surfaces/spec.md).
@@ -14,8 +15,12 @@ packages/native/
│ └── library/ # rules every Swift component or build step shares
└── apple/Sources/Astryx/
└── <Name>/ # one folder per component, named as core's
- ├── <Name>.swift # declares <Name> in the Astryx module
- └── <Name>.spec.md # the component's spec, e.g. Button.spec.md
+ └── <Name>.swift # declares <Name> in the Astryx module
+
+docs/specs/components/
+└── <ComponentRoot>/ # the folder core keeps the component in
+ ├── <Name>.spec.md # the core contract
+ └── <Name>.swift.spec.md # the Swift spec, e.g. Button.swift.spec.md
```
Swift comes first. Kotlin and other languages get their own directory when
@@ -39,13 +44,15 @@ the same everywhere. A native spec never renames or changes it.
## Adding a spec
-1. Copy `TEMPLATE.md` to the component's folder as `<Name>.spec.md`, for
- Swift `apple/Sources/Astryx/<Name>/<Name>.spec.md`.
+1. Copy `TEMPLATE.md` to the core component's folder under
+ `docs/specs/components/` as `<Name>.<language>.spec.md`, for Swift
+ `docs/specs/components/<ComponentRoot>/<Name>.swift.spec.md`.
2. Fill every section. Write "None" rather than deleting one.
-3. Open a pull request that changes only files under `packages/native/`. A spec
- can land on its own or with the component it describes.
+3. Open a pull request that changes only files under `packages/native/` and
+ native specs. A spec can land on its own or with the component it describes.
-Pull requests that change only `packages/native/`, written entirely by the
+Pull requests that change only `packages/native/` and native component specs
+(`docs/specs/components/**/<Name>.<language>.spec.md`), written entirely by the
native group listed in AST-093 FR6, are approved once required checks pass, the
review app finds no defect on the exact head, and a review against AST-082,
AST-093, and the specs of the components they touch finds every defined
diff --git a/packages/native/specs/TEMPLATE.md b/packages/native/specs/TEMPLATE.md
index 53da3081cc..6bbdda560e 100644
--- a/packages/native/specs/TEMPLATE.md
+++ b/packages/native/specs/TEMPLATE.md
@@ -1,7 +1,7 @@
# <Name> (<language>)
-<!-- Copy into the component's folder as <Name>.spec.md (Swift:
-packages/native/apple/Sources/Astryx/<Name>/<Name>.spec.md). Fill every section;
+<!-- Copy into the core component's folder as <Name>.<language>.spec.md (Swift:
+docs/specs/components/<ComponentRoot>/<Name>.swift.spec.md). Fill every section;
write "None" rather than deleting one. Present tense: describe what the
component does, not how it was decided. Rules: AST-093. -->
diff --git a/packages/native/specs/swift/README.md b/packages/native/specs/swift/README.md
index 483cf0c063..29d7d9f6d6 100644
--- a/packages/native/specs/swift/README.md
+++ b/packages/native/specs/swift/README.md
@@ -2,9 +2,9 @@
Rules shared by every Astryx component written in Swift, for iOS and macOS.
-A single component's spec lives in that component's own folder, beside its
-views: `packages/native/apple/Sources/Astryx/<Name>/<Name>.spec.md`, named as the
-core component (`Button.spec.md`, `TextInput.spec.md`) and copied from
+A single component's spec lives beside the core component's spec:
+`docs/specs/components/<ComponentRoot>/<Name>.swift.spec.md`, named as the core
+component (`Button.swift.spec.md`, `TextInput.swift.spec.md`) and copied from
[`../TEMPLATE.md`](../TEMPLATE.md).
Start with a component that already has a generated contract in
diff --git a/packages/native/specs/swift/library/README.md b/packages/native/specs/swift/library/README.md
index cbde4012b3..37fa1e76e8 100644
--- a/packages/native/specs/swift/library/README.md
+++ b/packages/native/specs/swift/library/README.md
@@ -1,9 +1,9 @@
# Swift library specs
Rules that every Astryx Swift component or Swift build step shares, one
-concern per file. A component spec (`<Name>.spec.md` in the component's own
-folder, such as `apple/Sources/Astryx/Button/Button.spec.md`, from
-`../../TEMPLATE.md`) follows these and records only where a component differs.
+concern per file. A component spec (`<Name>.swift.spec.md` beside the core
+component's spec, such as `docs/specs/components/Button/Button.swift.spec.md`,
+from `../../TEMPLATE.md`) follows these and records only where a component differs.
These specs apply AST-082 (native-first surfaces) and AST-093 (native component
guidelines). Where one of them and an approved record disagree, the record
diff --git a/scripts/check-knowledge.mjs b/scripts/check-knowledge.mjs
index 39f7544582..83a15b8c66 100644
--- a/scripts/check-knowledge.mjs
+++ b/scripts/check-knowledge.mjs
@@ -30,9 +30,12 @@ const {
validateDesignDecisionsBlock,
} = require('../.github/scripts/component-design-decisions.cjs');
const {
- classifyComponentKnowledgePath,
+ COMPONENT_SPEC_ROOT,
+ componentSpecPathForSource,
isComponentSpecRecordPath,
isIgnoredComponentKnowledgeSegment,
+ isPlatformComponentSpecPath,
+ locateComponentKnowledgePath,
} = require('../.github/scripts/knowledge-paths.cjs');
const HERE = path.dirname(fileURLToPath(import.meta.url));
@@ -967,46 +970,94 @@ export function discoverKnowledgeRecords(root = DEFAULT_ROOT) {
records.push(...discoverThemeRecordCandidates(root).records);
+ records.push(
+ ...matchingFilesRecursively(
+ path.join(root, COMPONENT_SPEC_ROOT),
+ (_name, candidate) =>
+ isComponentSpecRecordPath(
+ path.relative(root, candidate).split(path.sep).join('/'),
+ ),
+ {skipDirectory: isIgnoredComponentKnowledgeSegment},
+ ),
+ );
+
+ return records.sort();
+}
+
+/**
+ * Spec files outside the component record layout: a `*.spec.md` left in a
+ * registered component package's source tree, and a `*.spec.md` under
+ * `docs/specs/components/` that is neither a component or module record nor a
+ * platform implementation's `<PublicName>.<language>.spec.md`.
+ */
+export function discoverMisplacedComponentSpecs(root = DEFAULT_ROOT) {
+ const problems = [];
+ const toPosix = candidate =>
+ path.relative(root, candidate).split(path.sep).join('/');
+ const isSpecFile = name =>
+ name.endsWith('.spec.md') && !name.endsWith('.generated.spec.md');
+
for (const packageName of COMPONENT_PACKAGE_NAMES) {
const sourceRoot = path.join(root, `packages/${packageName}/src`);
- records.push(
- ...matchingFilesRecursively(
- sourceRoot,
- (_name, candidate) =>
- isComponentSpecRecordPath(
- path.relative(root, candidate).split(path.sep).join('/'),
- ),
- {skipDirectory: isIgnoredComponentKnowledgeSegment},
- ),
+ for (const candidate of matchingFilesRecursively(
+ sourceRoot,
+ name => isSpecFile(name) && !name.startsWith('.'),
+ {skipDirectory: isIgnoredComponentKnowledgeSegment},
+ )) {
+ const relativeToSource = path
+ .relative(sourceRoot, candidate)
+ .split(path.sep)
+ .join('/');
+ problems.push(
+ `${toPosix(candidate)}: component records live under ${COMPONENT_SPEC_ROOT}/; move this record to ${componentSpecPathForSource(packageName, relativeToSource)}.`,
+ );
+ }
+ }
+
+ const nativeSources = path.join(root, 'packages/native/apple/Sources');
+ for (const candidate of matchingFilesRecursively(
+ nativeSources,
+ name => isSpecFile(name) && !name.startsWith('.'),
+ {skipDirectory: isIgnoredComponentKnowledgeSegment},
+ )) {
+ const relative = path
+ .relative(nativeSources, candidate)
+ .split(path.sep)
+ .join('/')
+ .split('/');
+ // Sources/<Module>/<ComponentRoot>/.../<Name>.spec.md
+ const componentRoot =
+ relative.length >= 3 ? relative[1] : '<ComponentRoot>';
+ const name = relative.at(-1).slice(0, -'.spec.md'.length);
+ problems.push(
+ `${toPosix(candidate)}: Swift component records live beside the core record; move this record to ${COMPONENT_SPEC_ROOT}/${componentRoot}/${name}.swift.spec.md.`,
);
}
- return records.sort();
+ for (const candidate of matchingFilesRecursively(
+ path.join(root, COMPONENT_SPEC_ROOT),
+ name => isSpecFile(name) && !name.startsWith('.'),
+ {skipDirectory: isIgnoredComponentKnowledgeSegment},
+ )) {
+ const filePath = toPosix(candidate);
+ if (isComponentSpecRecordPath(filePath)) continue;
+ if (isPlatformComponentSpecPath(filePath)) continue;
+ problems.push(
+ `${filePath}: a file under ${COMPONENT_SPEC_ROOT}/ must be <ComponentRoot>/<PublicName>.spec.md, a module record nested below it, or a platform record <ComponentRoot>/<PublicName>.<language>.spec.md.`,
+ );
+ }
+
+ return problems;
}
function componentRecordLocation(root, absolutePath) {
const filePath = path.relative(root, absolutePath).split(path.sep).join('/');
- const classified = classifyComponentKnowledgePath(filePath);
- if (!classified) return null;
+ const location = locateComponentKnowledgePath(root, filePath);
+ if (!location) return null;
return {
- ...classified,
- componentRootPath: path.join(
- root,
- 'packages',
- classified.packageName,
- 'src',
- classified.componentRoot,
- ),
- componentSourcePath:
- classified.layout === 'flat'
- ? path.join(root, 'packages', classified.packageName, 'src')
- : path.join(
- root,
- 'packages',
- classified.packageName,
- 'src',
- classified.componentRoot,
- ),
+ ...location,
+ componentRootPath: path.join(root, location.componentRootDirectory),
+ componentSourcePath: path.join(root, location.componentSourceDirectory),
};
}
@@ -1109,7 +1160,7 @@ export function validateComponentModuleRelationships(
const location = componentRecordLocation(root, record.absolutePath);
if (!location) {
problems.push(
- `${record.filePath}: ${kind} records must live under a registered component package source root.`,
+ `${record.filePath}: ${kind} records must live at ${COMPONENT_SPEC_ROOT}/<ComponentRoot>/, where exactly one registered component package owns <ComponentRoot>.`,
);
continue;
}
@@ -1160,7 +1211,7 @@ export function validateComponentModuleRelationships(
const expectedParent = `component:${idMatch[1]}`;
if (location.layout === 'flat' && location.componentRoot !== idMatch[1]) {
problems.push(
- `${record.filePath}: flat-package module ${id} must live under packages/${location.packageName}/src/${idMatch[1]}/ to match its parent component.`,
+ `${record.filePath}: flat-package module ${id} must live under ${COMPONENT_SPEC_ROOT}/${idMatch[1]}/ to match its parent component.`,
);
}
if (frontmatter.get('parent_component') !== expectedParent) {
@@ -1594,7 +1645,13 @@ export function validateDelegations(
}
function loadComponentContract(root, specPath, componentName) {
- const directory = path.dirname(specPath);
+ const location = componentRecordLocation(root, specPath);
+ if (!location) {
+ return {
+ problem: `${path.relative(root, specPath)}: component record is outside a component root.`,
+ };
+ }
+ const directory = path.join(root, location.codeDirectory);
for (const docPath of matchingFiles(directory, name =>
name.endsWith('.doc.mjs'),
)) {
@@ -2004,7 +2061,10 @@ export async function validateKnowledgeRoot(root = DEFAULT_ROOT) {
const engineeringApprovalOwners = fs.existsSync(engineeringOwnersPath)
? parseOwnerFile(fs.readFileSync(engineeringOwnersPath, 'utf8'))
: [];
- const problems = [...discoverThemeRecordCandidates(root).problems];
+ const problems = [
+ ...discoverThemeRecordCandidates(root).problems,
+ ...discoverMisplacedComponentSpecs(root),
+ ];
const ids = new Map();
const records = [];
const delegations = [];
diff --git a/scripts/check-knowledge.test.mjs b/scripts/check-knowledge.test.mjs
index 447c246665..fdd204d8c9 100644
--- a/scripts/check-knowledge.test.mjs
+++ b/scripts/check-knowledge.test.mjs
@@ -4,6 +4,7 @@ import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import {execFileSync} from 'node:child_process';
+import {createRequire} from 'node:module';
import {afterEach, describe, expect, it} from 'vitest';
import {
composeKnowledgeSchemas,
@@ -29,6 +30,29 @@ import {
const repoRoot = path.resolve(import.meta.dirname, '..');
const roots = [];
+const {componentSpecPathForSource} = createRequire(import.meta.url)(
+ '../.github/scripts/knowledge-paths.cjs',
+);
+
+/**
+ * Fixtures describe a record by the source path it governs; the record itself
+ * lives under docs/specs/components/, mirroring that path.
+ */
+function recordPath(codeSidePath) {
+ const match =
+ /^(.*)[\\/]packages[\\/]([^\\/]+)[\\/]src[\\/](.+\.spec\.md)$/.exec(
+ codeSidePath,
+ );
+ if (!match) return codeSidePath;
+ const target = path.join(
+ match[1],
+ componentSpecPathForSource(match[2], match[3].split(path.sep).join('/')),
+ );
+ // The source directory the record mirrors exists, as it does beside real code.
+ fs.mkdirSync(path.dirname(codeSidePath), {recursive: true});
+ fs.mkdirSync(path.dirname(target), {recursive: true});
+ return target;
+}
function fixtureRoot() {
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-knowledge-'));
@@ -1001,7 +1025,7 @@ describe('component theming anatomy metadata', () => {
fs.mkdirSync(directory);
const consumerDoc = writeButtonDoc(directory);
fs.writeFileSync(
- path.join(directory, 'Button.spec.md'),
+ recordPath(path.join(directory, 'Button.spec.md')),
withAnatomyTheming(componentRecord(), {
...valid,
Icon: {none: {reason: 'intentional: Fixture-owned icon.'}},
@@ -1018,7 +1042,10 @@ describe('component theming anatomy metadata', () => {
const root = fixtureRoot();
const directory = path.join(root, 'packages/core/src/Button');
fs.mkdirSync(directory);
- fs.writeFileSync(path.join(directory, 'Button.spec.md'), componentRecord());
+ fs.writeFileSync(
+ recordPath(path.join(directory, 'Button.spec.md')),
+ componentRecord(),
+ );
expect(await validateKnowledgeRoot(root)).toEqual([]);
});
});
@@ -1215,7 +1242,7 @@ describe('component delegation ownership', () => {
fs.mkdirSync(directory);
writeButtonDoc(directory);
fs.writeFileSync(
- path.join(directory, 'Button.spec.md'),
+ recordPath(path.join(directory, 'Button.spec.md')),
withAnatomyTheming(componentRecord(overrides), {
Root: {target: 'button'},
Label: {inherits: 'button'},
@@ -1246,7 +1273,7 @@ describe('component delegation ownership', () => {
fs.mkdirSync(directory);
writeButtonDoc(directory);
fs.writeFileSync(
- path.join(directory, 'Button.spec.md'),
+ recordPath(path.join(directory, 'Button.spec.md')),
withAnatomyTheming(
componentRecord({
authority: 'archived',
@@ -1369,7 +1396,7 @@ describe('knowledge validation', () => {
const directory = path.join(root, 'packages/core/src/Button');
fs.mkdirSync(directory);
fs.writeFileSync(
- path.join(directory, 'Button.spec.md'),
+ recordPath(path.join(directory, 'Button.spec.md')),
componentRecord().replace(
'## Intent',
'## Contract at a glance\n\nProjection.\n\n## Intent',
@@ -1405,7 +1432,10 @@ describe('knowledge validation', () => {
const root = fixtureRoot();
const directory = path.join(root, 'packages/core/src/Button');
fs.mkdirSync(directory);
- fs.writeFileSync(path.join(directory, 'Button.spec.md'), componentRecord());
+ fs.writeFileSync(
+ recordPath(path.join(directory, 'Button.spec.md')),
+ componentRecord(),
+ );
expect(await validateKnowledgeRoot(root)).toEqual([]);
});
@@ -1421,7 +1451,7 @@ describe('knowledge validation', () => {
'export function VegaChart() {}\n',
);
fs.writeFileSync(
- path.join(directory, 'VegaChart.spec.md'),
+ recordPath(path.join(directory, 'VegaChart.spec.md')),
componentRecord({id: 'component:VegaChart'}),
);
expect(await validateKnowledgeRoot(root)).toEqual([]);
@@ -1438,8 +1468,13 @@ describe('knowledge validation', () => {
path.join(directory, 'Chart.tsx'),
'export function Chart() {}\n',
);
+ // Ghost.tsx exists but the package barrel does not export it.
fs.writeFileSync(
- path.join(directory, 'Ghost.spec.md'),
+ path.join(directory, 'Ghost.tsx'),
+ 'export function Ghost() {}\n',
+ );
+ fs.writeFileSync(
+ recordPath(path.join(directory, 'Ghost.spec.md')),
componentRecord({id: 'component:Ghost'}),
);
expect((await validateKnowledgeRoot(root)).join('\n')).toMatch(
@@ -1450,7 +1485,9 @@ describe('knowledge validation', () => {
it('accepts a flat-package module beneath its declared parent component', async () => {
const root = fixtureRoot();
const source = path.join(root, 'packages/charts/src');
- const modulePath = path.join(source, 'Chart/plugins/useChartThing.spec.md');
+ const modulePath = recordPath(
+ path.join(source, 'Chart/plugins/useChartThing.spec.md'),
+ );
fs.mkdirSync(path.dirname(modulePath), {recursive: true});
fs.writeFileSync(
path.join(source, 'index.ts'),
@@ -1461,7 +1498,7 @@ describe('knowledge validation', () => {
'export function Chart() {}\n',
);
fs.writeFileSync(
- path.join(source, 'Chart.spec.md'),
+ recordPath(path.join(source, 'Chart.spec.md')),
componentRecord({
id: 'component:Chart',
modules: '[module:Chart/useChartThing]',
@@ -1481,7 +1518,9 @@ describe('knowledge validation', () => {
it('rejects a flat-package module beneath a different path root', async () => {
const root = fixtureRoot();
const source = path.join(root, 'packages/charts/src');
- const modulePath = path.join(source, 'Ghost/plugins/useChartThing.spec.md');
+ const modulePath = recordPath(
+ path.join(source, 'Ghost/plugins/useChartThing.spec.md'),
+ );
fs.mkdirSync(path.dirname(modulePath), {recursive: true});
fs.writeFileSync(
path.join(source, 'index.ts'),
@@ -1492,7 +1531,7 @@ describe('knowledge validation', () => {
'export function Chart() {}\n',
);
fs.writeFileSync(
- path.join(source, 'Chart.spec.md'),
+ recordPath(path.join(source, 'Chart.spec.md')),
componentRecord({
id: 'component:Chart',
modules: '[module:Chart/useChartThing]',
@@ -1507,7 +1546,7 @@ describe('knowledge validation', () => {
);
expect((await validateKnowledgeRoot(root)).join('\n')).toMatch(
- /flat-package module module:Chart\/useChartThing must live under packages\/charts\/src\/Chart\//,
+ /flat-package module module:Chart\/useChartThing must live under docs\/specs\/components\/Chart\//,
);
});
@@ -1520,7 +1559,7 @@ describe('knowledge validation', () => {
"export const docs = {name: 'NavHeadingMenu'};\n",
);
fs.writeFileSync(
- path.join(directory, 'NavHeadingMenu.spec.md'),
+ recordPath(path.join(directory, 'NavHeadingMenu.spec.md')),
componentRecord({id: 'component:NavHeadingMenu'}),
);
@@ -1539,7 +1578,7 @@ describe('knowledge validation', () => {
};\n`,
);
fs.writeFileSync(
- path.join(directory, 'TableRow.spec.md'),
+ recordPath(path.join(directory, 'TableRow.spec.md')),
componentRecord({id: 'component:TableRow'}),
);
@@ -1556,7 +1595,7 @@ describe('knowledge validation', () => {
);
fs.writeFileSync(path.join(directory, 'Button.doc.mjs'), parentDoc);
fs.writeFileSync(
- path.join(directory, 'Wrong.spec.md'),
+ recordPath(path.join(directory, 'Wrong.spec.md')),
componentRecord({id: 'component:Wrong'}),
);
@@ -1568,13 +1607,12 @@ describe('knowledge validation', () => {
it('discovers a nested module beside its flat parent and ignores non-record trees', async () => {
const root = fixtureRoot();
const componentDirectory = path.join(root, 'packages/core/src/Button');
- const modulePath = path.join(
- componentDirectory,
- 'plugins/thing/useButtonThing.spec.md',
+ const modulePath = recordPath(
+ path.join(componentDirectory, 'plugins/thing/useButtonThing.spec.md'),
);
fs.mkdirSync(path.dirname(modulePath), {recursive: true});
fs.writeFileSync(
- path.join(componentDirectory, 'Button.spec.md'),
+ recordPath(path.join(componentDirectory, 'Button.spec.md')),
componentRecord({modules: '[module:Button/useButtonThing]'}),
);
fs.writeFileSync(modulePath, moduleRecord());
@@ -1591,13 +1629,13 @@ describe('knowledge validation', () => {
'plugins/thing/snapshot.generated.spec.md',
];
for (const relative of ignored) {
- const ignoredPath = path.join(componentDirectory, relative);
+ const ignoredPath = recordPath(path.join(componentDirectory, relative));
fs.mkdirSync(path.dirname(ignoredPath), {recursive: true});
fs.writeFileSync(ignoredPath, moduleRecord());
}
const topLevelIgnored = path.join(
root,
- 'packages/core/src/__tests__/TopLevel.spec.md',
+ 'docs/specs/components/__tests__/TopLevel.spec.md',
);
fs.mkdirSync(path.dirname(topLevelIgnored), {recursive: true});
fs.writeFileSync(topLevelIgnored, moduleRecord());
@@ -1605,26 +1643,83 @@ describe('knowledge validation', () => {
const discovered = discoverKnowledgeRecords(root).map(filePath =>
path.relative(root, filePath).split(path.sep).join('/'),
);
- expect(discovered).toContain('packages/core/src/Button/Button.spec.md');
+ expect(discovered).toContain('docs/specs/components/Button/Button.spec.md');
expect(discovered).toContain(
- 'packages/core/src/Button/plugins/thing/useButtonThing.spec.md',
+ 'docs/specs/components/Button/plugins/thing/useButtonThing.spec.md',
);
for (const relative of ignored) {
- expect(discovered).not.toContain(`packages/core/src/Button/${relative}`);
+ expect(discovered).not.toContain(
+ `docs/specs/components/Button/${relative}`,
+ );
}
expect(discovered).not.toContain(
- 'packages/core/src/__tests__/TopLevel.spec.md',
+ 'docs/specs/components/__tests__/TopLevel.spec.md',
);
expect(await validateKnowledgeRoot(root)).toEqual([]);
});
+ it('rejects a component spec left beside its code and names where it belongs', async () => {
+ const root = fixtureRoot();
+ const directory = path.join(root, 'packages/core/src/Button');
+ fs.mkdirSync(directory);
+ fs.writeFileSync(path.join(directory, 'Button.spec.md'), componentRecord());
+ fs.writeFileSync(
+ path.join(root, 'packages/charts/src/Chart.spec.md'),
+ componentRecord({id: 'component:Chart'}),
+ );
+ const problems = (await validateKnowledgeRoot(root)).join('\n');
+ expect(problems).toContain(
+ 'packages/core/src/Button/Button.spec.md: component records live under docs/specs/components/; move this record to docs/specs/components/Button/Button.spec.md.',
+ );
+ expect(problems).toContain(
+ 'packages/charts/src/Chart.spec.md: component records live under docs/specs/components/; move this record to docs/specs/components/Chart/Chart.spec.md.',
+ );
+ });
+
+ it('rejects a Swift spec left beside its view and names its place beside the core record', async () => {
+ const root = fixtureRoot();
+ const view = path.join(
+ root,
+ 'packages/native/apple/Sources/Astryx/Avatar/AvatarStatusDot.spec.md',
+ );
+ fs.mkdirSync(path.dirname(view), {recursive: true});
+ fs.writeFileSync(view, '# Swift\n');
+ expect((await validateKnowledgeRoot(root)).join('\n')).toContain(
+ 'packages/native/apple/Sources/Astryx/Avatar/AvatarStatusDot.spec.md: Swift component records live beside the core record; move this record to docs/specs/components/Avatar/AvatarStatusDot.swift.spec.md.',
+ );
+ });
+
+ it('accepts a platform record beside the core record and rejects other stray files', async () => {
+ const root = fixtureRoot();
+ fs.mkdirSync(path.join(root, 'packages/core/src/Button'));
+ fs.writeFileSync(
+ recordPath(path.join(root, 'packages/core/src/Button/Button.spec.md')),
+ componentRecord(),
+ );
+ const folder = path.join(root, 'docs/specs/components/Button');
+ // Platform records are not checked yet (no platform_of in the schema).
+ fs.writeFileSync(path.join(folder, 'Button.swift.spec.md'), '# Swift\n');
+ fs.writeFileSync(path.join(folder, 'Button.klingon.spec.md'), '# ?\n');
+ fs.writeFileSync(
+ path.join(root, 'docs/specs/components/Loose.spec.md'),
+ '# ?\n',
+ );
+ const problems = await validateKnowledgeRoot(root);
+ expect(problems.join('\n')).not.toContain('Button.swift.spec.md');
+ expect(
+ problems.filter(problem => problem.includes('must be <ComponentRoot>')),
+ ).toHaveLength(2);
+ });
+
it('rejects a nested component record instead of treating it as a module', async () => {
const root = fixtureRoot();
const componentDirectory = path.join(root, 'packages/core/src/Button');
- const nestedPath = path.join(componentDirectory, 'notes/Extra.spec.md');
+ const nestedPath = recordPath(
+ path.join(componentDirectory, 'notes/Extra.spec.md'),
+ );
fs.mkdirSync(path.dirname(nestedPath), {recursive: true});
fs.writeFileSync(
- path.join(componentDirectory, 'Button.spec.md'),
+ recordPath(path.join(componentDirectory, 'Button.spec.md')),
componentRecord(),
);
fs.writeFileSync(nestedPath, componentRecord({id: 'component:Extra'}));
@@ -1639,11 +1734,11 @@ describe('knowledge validation', () => {
const componentDirectory = path.join(root, 'packages/core/src/Button');
fs.mkdirSync(componentDirectory, {recursive: true});
fs.writeFileSync(
- path.join(componentDirectory, 'Button.spec.md'),
+ recordPath(path.join(componentDirectory, 'Button.spec.md')),
componentRecord({modules: '[module:Button/useButtonThing]'}),
);
fs.writeFileSync(
- path.join(componentDirectory, 'useButtonThing.spec.md'),
+ recordPath(path.join(componentDirectory, 'useButtonThing.spec.md')),
moduleRecord(),
);
@@ -1655,13 +1750,12 @@ describe('knowledge validation', () => {
it('rejects missing parent links and orphan module records', async () => {
const root = fixtureRoot();
const componentDirectory = path.join(root, 'packages/core/src/Button');
- const modulePath = path.join(
- componentDirectory,
- 'plugins/orphan/useOrphan.spec.md',
+ const modulePath = recordPath(
+ path.join(componentDirectory, 'plugins/orphan/useOrphan.spec.md'),
);
fs.mkdirSync(path.dirname(modulePath), {recursive: true});
fs.writeFileSync(
- path.join(componentDirectory, 'Button.spec.md'),
+ recordPath(path.join(componentDirectory, 'Button.spec.md')),
componentRecord({modules: '[module:Button/useMissing]'}),
);
fs.writeFileSync(
@@ -1683,18 +1777,17 @@ describe('knowledge validation', () => {
const root = fixtureRoot();
const buttonDirectory = path.join(root, 'packages/core/src/Button');
const otherDirectory = path.join(root, 'packages/core/src/Other');
- const modulePath = path.join(
- otherDirectory,
- 'plugins/thing/useButtonThing.spec.md',
+ const modulePath = recordPath(
+ path.join(otherDirectory, 'plugins/thing/useButtonThing.spec.md'),
);
fs.mkdirSync(buttonDirectory, {recursive: true});
fs.mkdirSync(path.dirname(modulePath), {recursive: true});
fs.writeFileSync(
- path.join(buttonDirectory, 'Button.spec.md'),
+ recordPath(path.join(buttonDirectory, 'Button.spec.md')),
componentRecord({modules: '[module:Other/useButtonThing]'}),
);
fs.writeFileSync(
- path.join(otherDirectory, 'Other.spec.md'),
+ recordPath(path.join(otherDirectory, 'Other.spec.md')),
componentRecord({
id: 'component:Other',
modules: '[module:Other/useButtonThing]',
@@ -1728,9 +1821,10 @@ describe('knowledge validation', () => {
'id: component:Button',
),
);
+ fs.mkdirSync(path.join(root, 'packages/core/src/Button'));
const modulePath = path.join(
root,
- 'packages/core/src/Button/plugins/thing/useButtonThing.spec.md',
+ 'docs/specs/components/Button/plugins/thing/useButtonThing.spec.md',
);
fs.mkdirSync(path.dirname(modulePath), {recursive: true});
fs.writeFileSync(modulePath, moduleRecord());
@@ -1753,7 +1847,7 @@ describe('knowledge validation', () => {
const componentDirectory = path.join(root, 'packages/core/src/Button');
fs.mkdirSync(componentDirectory, {recursive: true});
fs.writeFileSync(
- path.join(componentDirectory, 'Button.spec.md'),
+ recordPath(path.join(componentDirectory, 'Button.spec.md')),
componentRecord({modules: '[family:actions]'}),
);
@@ -1767,15 +1861,17 @@ describe('knowledge validation', () => {
const componentDirectory = path.join(root, 'packages/core/src/Button');
fs.mkdirSync(componentDirectory, {recursive: true});
fs.writeFileSync(
- path.join(componentDirectory, 'Button.spec.md'),
+ recordPath(path.join(componentDirectory, 'Button.spec.md')),
componentRecord({
modules: '[module:Button/useButtonThing,module:Button/useButtonThing]',
}),
);
for (const owner of ['first', 'second']) {
- const modulePath = path.join(
- componentDirectory,
- `plugins/${owner}/useButtonThing.spec.md`,
+ const modulePath = recordPath(
+ path.join(
+ componentDirectory,
+ `plugins/${owner}/useButtonThing.spec.md`,
+ ),
);
fs.mkdirSync(path.dirname(modulePath), {recursive: true});
fs.writeFileSync(modulePath, moduleRecord());
@@ -1791,13 +1887,12 @@ describe('knowledge validation', () => {
it('requires module ids and filenames to encode the same public name', async () => {
const root = fixtureRoot();
const componentDirectory = path.join(root, 'packages/core/src/Button');
- const modulePath = path.join(
- componentDirectory,
- 'plugins/thing/WrongName.spec.md',
+ const modulePath = recordPath(
+ path.join(componentDirectory, 'plugins/thing/WrongName.spec.md'),
);
fs.mkdirSync(path.dirname(modulePath), {recursive: true});
fs.writeFileSync(
- path.join(componentDirectory, 'Button.spec.md'),
+ recordPath(path.join(componentDirectory, 'Button.spec.md')),
componentRecord({modules: '[module:Button/useButtonThing]'}),
);
fs.writeFileSync(modulePath, moduleRecord());
@@ -1810,13 +1905,12 @@ describe('knowledge validation', () => {
it('validates module anatomy only against the module consumer doc', async () => {
const root = fixtureRoot();
const componentDirectory = path.join(root, 'packages/core/src/Button');
- const modulePath = path.join(
- componentDirectory,
- 'plugins/thing/useButtonThing.spec.md',
+ const modulePath = recordPath(
+ path.join(componentDirectory, 'plugins/thing/useButtonThing.spec.md'),
);
fs.mkdirSync(path.dirname(modulePath), {recursive: true});
fs.writeFileSync(
- path.join(componentDirectory, 'Button.spec.md'),
+ recordPath(path.join(componentDirectory, 'Button.spec.md')),
componentRecord({modules: '[module:Button/useButtonThing]'}),
);
fs.writeFileSync(
@@ -1846,9 +1940,8 @@ describe('knowledge validation', () => {
it('never validates a module map against parent aggregate anatomy', async () => {
const root = fixtureRoot();
const componentDirectory = path.join(root, 'packages/core/src/Button');
- const modulePath = path.join(
- componentDirectory,
- 'plugins/thing/useButtonThing.spec.md',
+ const modulePath = recordPath(
+ path.join(componentDirectory, 'plugins/thing/useButtonThing.spec.md'),
);
fs.mkdirSync(path.dirname(modulePath), {recursive: true});
const parentDoc = writeButtonDoc(componentDirectory).replace(
@@ -1860,7 +1953,7 @@ describe('knowledge validation', () => {
parentDoc,
);
fs.writeFileSync(
- path.join(componentDirectory, 'Button.spec.md'),
+ recordPath(path.join(componentDirectory, 'Button.spec.md')),
componentRecord({modules: '[module:Button/useButtonThing]'}),
);
fs.writeFileSync(
@@ -2127,7 +2220,7 @@ describe('knowledge validation', () => {
const directory = path.join(root, 'packages/core/src/Button');
fs.mkdirSync(directory);
fs.writeFileSync(
- path.join(directory, 'Button.spec.md'),
+ recordPath(path.join(directory, 'Button.spec.md')),
componentRecord().replace(
'authority: draft',
'authority: draft\nauthority: "current"',
@@ -2144,12 +2237,12 @@ describe('knowledge validation', () => {
[
'component',
'component-spec.md',
- 'packages/core/src/Button/Button.spec.md',
+ 'docs/specs/components/Button/Button.spec.md',
],
[
'module',
'module-spec.md',
- 'packages/core/src/Button/hooks/useButtonThing.spec.md',
+ 'docs/specs/components/Button/hooks/useButtonThing.spec.md',
],
['family', 'family-contract.md', 'docs/families/approval.md'],
['system-spec', 'system-spec.md', 'docs/specs/AST-900/spec.md'],
@@ -2222,7 +2315,7 @@ describe('knowledge validation', () => {
const directory = path.join(root, 'packages/core/src/Button');
fs.mkdirSync(directory);
fs.writeFileSync(
- path.join(directory, 'Button.spec.md'),
+ recordPath(path.join(directory, 'Button.spec.md')),
componentRecord({authority: 'current'}),
);
expect((await validateKnowledgeRoot(root)).join('\n')).toMatch(
@@ -2235,7 +2328,7 @@ describe('knowledge validation', () => {
const directory = path.join(root, 'packages/core/src/Button');
fs.mkdirSync(directory);
fs.writeFileSync(
- path.join(directory, 'Button.spec.md'),
+ recordPath(path.join(directory, 'Button.spec.md')),
componentRecord({
authority: 'current',
approved_by: 'someone-else',
@@ -2252,7 +2345,7 @@ describe('knowledge validation', () => {
const directory = path.join(root, 'packages/core/src/Button');
fs.mkdirSync(directory);
fs.writeFileSync(
- path.join(directory, 'Button.spec.md'),
+ recordPath(path.join(directory, 'Button.spec.md')),
componentRecord({
authority: 'current',
approved_by: 'cixzhang',
@@ -2267,7 +2360,7 @@ describe('knowledge validation', () => {
const directory = path.join(root, 'packages/core/src/Button');
fs.mkdirSync(directory);
fs.writeFileSync(
- path.join(directory, 'Button.spec.md'),
+ recordPath(path.join(directory, 'Button.spec.md')),
componentRecord({authority: 'archived', archive_reason: 'superseded'}),
);
expect((await validateKnowledgeRoot(root)).join('\n')).toMatch(
@@ -2280,7 +2373,7 @@ describe('knowledge validation', () => {
const directory = path.join(root, 'packages/core/src/Button');
fs.mkdirSync(directory);
fs.writeFileSync(
- path.join(directory, 'Button.spec.md'),
+ recordPath(path.join(directory, 'Button.spec.md')),
componentRecord({template_version: '8'}),
);
expect((await validateKnowledgeRoot(root)).join('\n')).toMatch(
@@ -2294,7 +2387,7 @@ describe('knowledge validation', () => {
const directory = path.join(root, 'packages/core/src/Button');
fs.mkdirSync(directory);
fs.writeFileSync(
- path.join(directory, 'Button.spec.md'),
+ recordPath(path.join(directory, 'Button.spec.md')),
componentRecord({schema_version: '0'}),
);
expect((await validateKnowledgeRoot(root)).join('\n')).toMatch(
@@ -2308,7 +2401,7 @@ describe('knowledge validation', () => {
const directory = path.join(root, 'packages/core/src/Button');
fs.mkdirSync(directory);
fs.writeFileSync(
- path.join(directory, 'Button.spec.md'),
+ recordPath(path.join(directory, 'Button.spec.md')),
componentRecord({
schema_version: '0',
authority: 'archived',
@@ -2364,7 +2457,7 @@ describe('knowledge validation', () => {
const directory = path.join(root, `packages/core/src/${name}`);
fs.mkdirSync(directory);
fs.writeFileSync(
- path.join(directory, `${name}.spec.md`),
+ recordPath(path.join(directory, `${name}.spec.md`)),
componentRecord(),
);
}
diff --git a/scripts/release/changeset-coverage.test.mjs b/scripts/release/changeset-coverage.test.mjs
index 52f09ca81b..a1732a48fb 100644
--- a/scripts/release/changeset-coverage.test.mjs
+++ b/scripts/release/changeset-coverage.test.mjs
@@ -125,7 +125,7 @@ function repo(overrides = {}) {
'packages/core/src/Button/Button.test.tsx': 'test();\n',
'packages/core/src/Button/Button.a11y.chromium.spec.ts': 'test();\n',
'packages/core/src/Button/Button.stories.tsx': 'export default {};\n',
- 'packages/core/src/Button/Button.spec.md': '# Button spec\n',
+ 'docs/specs/components/Button/Button.spec.md': '# Button spec\n',
'packages/core/src/Button/__fixtures__/data.ts': 'export {};\n',
'packages/core/CHANGELOG.md': '# Changelog\n',
'packages/themes/stone/package.json': manifest(
@@ -221,7 +221,7 @@ describe('classifyPath — what ships to consumers', () => {
['packages/core/src/Button/Button.test.tsx', /test/],
['packages/core/src/Button/Button.a11y.chromium.spec.ts', /test/],
['packages/core/src/Button/Button.stories.tsx', /story/],
- ['packages/core/src/Button/Button.spec.md', /spec record/],
+ ['docs/specs/components/Button/Button.spec.md', /outside/],
['packages/core/src/Button/__fixtures__/data.ts', /fixture/],
['packages/cli/api/doctor/doctor.test.mjs', /test/],
['packages/cli/test/__golden__/docs-list.json', /test/],
@@ -718,7 +718,7 @@ describe('rule 1 — a shipped change names its package', () => {
'apps/sandbox/src/App.tsx': 'export const x = 1;\n',
'apps/docsite/pages/index.tsx': 'export const y = 1;\n',
'packages/core/src/Button/Button.test.tsx': 'test(2);\n',
- 'packages/core/src/Button/Button.spec.md': '# Button spec v2\n',
+ 'docs/specs/components/Button/Button.spec.md': '# Button spec v2\n',
'packages/core/src/Button/__fixtures__/data.ts': 'export const d = 1;\n',
'packages/core/CHANGELOG.md': '# Changelog\n\n## 0.6.7\n',
'packages/cli/test/__golden__/docs-list.json': DOCS_LIST_GOLDEN.replace(
diff --git a/scripts/specs-for-file.mjs b/scripts/specs-for-file.mjs
index ae3d720a7e..bbc2415bab 100644
--- a/scripts/specs-for-file.mjs
+++ b/scripts/specs-for-file.mjs
@@ -33,6 +33,7 @@ const require = createRequire(import.meta.url);
const {componentPackage} = require('./component-packages.cjs');
const {
classifyComponentKnowledgePath,
+ locateComponentKnowledgePath,
} = require('../.github/scripts/knowledge-paths.cjs');
const HERE = path.dirname(fileURLToPath(import.meta.url));
@@ -146,6 +147,7 @@ export function loadKnowledgeIndex(root = DEFAULT_ROOT) {
authority: frontmatter.get('authority'),
frontmatter,
classified: classifyComponentKnowledgePath(filePath),
+ located: locateComponentKnowledgePath(root, filePath),
pathPatterns: asList(
parsePathApplicabilityBlock(content, filePath).config?.paths,
).filter(pattern => typeof pattern === 'string'),
@@ -259,9 +261,8 @@ function placementMatches(index, filePath, location) {
}
continue;
}
- const {classified} = record;
+ const {classified, located} = record;
if (!classified) continue;
- const recordDirectory = path.posix.dirname(record.path);
const recordStem = classified.publicName;
if (classified.kind === 'module' && stem === recordStem) {
@@ -281,19 +282,21 @@ function placementMatches(index, filePath, location) {
}
}
+ // Every other placement compares the record's code: a record sits under
+ // docs/specs/components/ and mirrors the source directory it governs.
+ if (!located) continue;
+ const recordDirectory = located.codeDirectory;
+
if (
!location ||
- classified.packageName !== location.packageName ||
- classified.componentRoot !== location.componentRoot
+ located.packageName !== location.packageName ||
+ located.componentRoot !== location.componentRoot
) {
continue;
}
- if (classified.kind === 'component') {
- if (
- classified.layout === 'flat' ||
- recordStem === location.componentRoot
- ) {
+ if (located.kind === 'component') {
+ if (located.layout === 'flat' || recordStem === location.componentRoot) {
matches.push({
record,
via: 'placement',
@@ -320,8 +323,8 @@ function placementMatches(index, filePath, location) {
const siblingsInDirectory = index.records.some(
other =>
other !== record &&
- path.posix.dirname(other.path) === recordDirectory &&
- other.classified?.kind === 'module',
+ other.located?.codeDirectory === recordDirectory &&
+ other.located?.kind === 'module',
);
if (
!siblingsInDirectory &&
diff --git a/scripts/specs-for-file.test.mjs b/scripts/specs-for-file.test.mjs
index 13c3549819..fd9c0b75e9 100644
--- a/scripts/specs-for-file.test.mjs
+++ b/scripts/specs-for-file.test.mjs
@@ -80,7 +80,7 @@ function popoverFixture() {
'packages/core/src/Popover/Popover.doc.mjs',
"export const docs = {name: 'Popover', usage: {anatomy: [{name: 'Table'}]}, components: [{name: 'PopoverTrigger', description: 'Opens it.'}, {name: 'Item'}]};\n",
);
- writeRecord(root, 'packages/core/src/Popover/Popover.spec.md', {
+ writeRecord(root, 'docs/specs/components/Popover/Popover.spec.md', {
kind: 'component',
id: 'component:Popover',
review_triggers: ['behavior', 'layering'],
@@ -142,13 +142,17 @@ function popoverFixture() {
write(root, 'packages/core/src/Dialog/modules/DialogHeader.tsx');
write(root, 'packages/core/src/Dialog/modules/DialogHeader.test.tsx');
write(root, 'packages/core/src/Dialog/modules/DialogFooter.tsx');
- writeRecord(root, 'packages/core/src/Dialog/modules/DialogHeader.spec.md', {
- kind: 'module',
- id: 'module:Dialog/DialogHeader',
- parent_component: 'component:Dialog',
- references: [],
- });
- writeRecord(root, 'packages/core/src/Dialog/modules/DialogBody.spec.md', {
+ writeRecord(
+ root,
+ 'docs/specs/components/Dialog/modules/DialogHeader.spec.md',
+ {
+ kind: 'module',
+ id: 'module:Dialog/DialogHeader',
+ parent_component: 'component:Dialog',
+ references: [],
+ },
+ );
+ writeRecord(root, 'docs/specs/components/Dialog/modules/DialogBody.spec.md', {
kind: 'module',
id: 'module:Dialog/DialogBody',
parent_component: 'component:Dialog',
@@ -158,7 +162,7 @@ function popoverFixture() {
write(root, 'packages/core/src/Table/plugins/activation/helpers/key.ts');
writeRecord(
root,
- 'packages/core/src/Table/plugins/activation/useTableActivation.spec.md',
+ 'docs/specs/components/Table/plugins/activation/useTableActivation.spec.md',
{
kind: 'module',
id: 'module:Table/useTableActivation',
@@ -181,7 +185,7 @@ function popoverFixture() {
deciding_specs: [],
});
write(root, 'packages/core/src/Drawer/Drawer.tsx');
- writeRecord(root, 'packages/core/src/Drawer/Drawer.spec.md', {
+ writeRecord(root, 'docs/specs/components/Drawer/Drawer.spec.md', {
kind: 'component',
id: 'component:Drawer',
authority: 'draft',
@@ -212,7 +216,7 @@ function popoverFixture() {
'packages/core/src/Chat/__tests__/ChatComposerDrawer.a11y.states.ts',
);
write(root, 'packages/core/src/Chat/ChatHeadingItem.tsx');
- writeRecord(root, 'packages/core/src/Chat/ChatComposerDrawer.spec.md', {
+ writeRecord(root, 'docs/specs/components/Chat/ChatComposerDrawer.spec.md', {
kind: 'component',
id: 'component:ChatComposerDrawer',
review_triggers: ['motion'],
@@ -224,18 +228,26 @@ function popoverFixture() {
write(root, 'packages/core/src/Markdown/Markdown.tsx');
write(root, 'packages/core/src/Markdown/plugins/headingLinks.ts');
write(root, 'packages/core/src/Markdown/plugins/softBreaks.ts');
- writeRecord(root, 'packages/core/src/Markdown/modules/headingLinks.spec.md', {
- kind: 'module',
- id: 'module:Markdown/headingLinks',
- parent_component: 'component:Markdown',
- references: [],
- });
- writeRecord(root, 'packages/core/src/Markdown/modules/softBreaks.spec.md', {
- kind: 'module',
- id: 'module:Markdown/softBreaks',
- parent_component: 'component:Markdown',
- references: [],
- });
+ writeRecord(
+ root,
+ 'docs/specs/components/Markdown/modules/headingLinks.spec.md',
+ {
+ kind: 'module',
+ id: 'module:Markdown/headingLinks',
+ parent_component: 'component:Markdown',
+ references: [],
+ },
+ );
+ writeRecord(
+ root,
+ 'docs/specs/components/Markdown/modules/softBreaks.spec.md',
+ {
+ kind: 'module',
+ id: 'module:Markdown/softBreaks',
+ parent_component: 'component:Markdown',
+ references: [],
+ },
+ );
write(root, 'packages/core/src/hooks/useMenuPress.ts');
write(root, 'packages/core/src/hooks/useMenuPress.test.tsx');
write(root, 'packages/core/src/hooks/useEntryAnimation.ts');
@@ -251,7 +263,7 @@ function popoverFixture() {
);
writeRecord(
root,
- 'packages/core/src/DropdownMenu/modules/useMenuPress.spec.md',
+ 'docs/specs/components/DropdownMenu/modules/useMenuPress.spec.md',
{
kind: 'module',
id: 'module:DropdownMenu/useMenuPress',
@@ -268,7 +280,7 @@ function popoverFixture() {
affects_consumer_docs: ['useEntryAnimation'],
});
write(root, 'apps/sandbox/src/app/(fullscreen)/pages/perf/benchmark.test.ts');
- writeRecord(root, 'packages/core/src/Markdown/Markdown.spec.md', {
+ writeRecord(root, 'docs/specs/components/Markdown/Markdown.spec.md', {
kind: 'component',
id: 'component:Markdown',
review_triggers: ['behavior'],
@@ -291,7 +303,7 @@ function popoverFixture() {
affects_consumer_docs: ['color'],
});
write(root, 'packages/core/src/TabList/TabList.tsx');
- writeRecord(root, 'packages/core/src/TabList/TabList.spec.md', {
+ writeRecord(root, 'docs/specs/components/TabList/TabList.spec.md', {
kind: 'component',
id: 'component:TabList',
review_triggers: ['behavior'],