@atelier-ui/create-workspace 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -7
- package/package.json +1 -1
- package/src/generators/preset/files/claude/skills/atelier-component/SKILL.md +7 -7
- package/src/generators/preset/files/storybook/angular/main.ts.template +8 -0
- package/src/generators/preset/files/storybook/angular/preview.ts.template +17 -0
- package/src/generators/preset/files/storybook/react/atl-button.stories.tsx +1 -1
- package/src/generators/preset/files/storybook/react/main.ts.template +8 -0
- package/src/generators/preset/files/storybook/react/preview.tsx +18 -1
- package/src/generators/preset/files/storybook/vue/atl-button.stories.ts.template +1 -1
- package/src/generators/preset/files/storybook/vue/main.ts.template +8 -0
- package/src/generators/preset/files/storybook/vue/preview.ts.template +18 -1
- package/src/generators/preset/files/testing/angular/test-setup.ts.template +6 -0
- package/src/generators/preset/files/testing/react/atl-button.spec.tsx +17 -18
- package/src/generators/preset/files/testing/react/test-setup-stories.ts.template +17 -0
- package/src/generators/preset/files/testing/react/vitest.unit.config.ts.template +1 -1
- package/src/generators/preset/files/testing/vue/atl-button.spec.ts.template +17 -21
- package/src/generators/preset/files/testing/vue/test-setup-stories.ts.template +17 -0
- package/src/generators/preset/files/testing/vue/vitest.unit.config.ts.template +1 -1
- package/src/generators/preset/files/tools/scripts/preflight.mjs +79 -0
- package/src/generators/preset/preset.js +487 -38
- package/src/generators/preset/preset.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,48 @@
|
|
|
1
|
+
## 0.3.2 (2026-09-13)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **storybook:** a theme control that is honest about what it does not test ([80840f05](https://github.com/DominikPieper/atelier-ui/commit/80840f05))
|
|
6
|
+
|
|
7
|
+
### ❤️ Thank You
|
|
8
|
+
|
|
9
|
+
- Claude Opus 5 (1M context)
|
|
10
|
+
- Dominik Pieper @DominikPieper
|
|
11
|
+
|
|
12
|
+
## 0.3.1 (2026-09-13)
|
|
13
|
+
|
|
14
|
+
### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- **storybook:** stories run as tests in Vitest too, where the renderer allows it ([e3fecf5c](https://github.com/DominikPieper/atelier-ui/commit/e3fecf5c))
|
|
17
|
+
- **create-workspace:** the generated workspace is strict ([1cbe4517](https://github.com/DominikPieper/atelier-ui/commit/1cbe4517))
|
|
18
|
+
- **create-workspace:** the workspace is driven by npm, not by Nx knowledge ([e0824459](https://github.com/DominikPieper/atelier-ui/commit/e0824459))
|
|
19
|
+
|
|
20
|
+
### 🩹 Fixes
|
|
21
|
+
|
|
22
|
+
- **storybook:** the story-test setup imports its hooks instead of assuming globals ([09421473](https://github.com/DominikPieper/atelier-ui/commit/09421473))
|
|
23
|
+
|
|
24
|
+
### ❤️ Thank You
|
|
25
|
+
|
|
26
|
+
- Claude Opus 5 (1M context)
|
|
27
|
+
- Dominik Pieper @DominikPieper
|
|
28
|
+
|
|
1
29
|
## 0.3.0 (2026-09-13)
|
|
2
30
|
|
|
31
|
+
### 🚀 Features
|
|
32
|
+
|
|
33
|
+
- **preflight:** the workspace says when its Claude Code setup is inert ([eca6a703](https://github.com/DominikPieper/atelier-ui/commit/eca6a703))
|
|
34
|
+
|
|
3
35
|
### 🩹 Fixes
|
|
4
36
|
|
|
5
|
-
- ⚠️
|
|
37
|
+
- ⚠️ **react:** the published package declares what it actually ships ([68a3b528](https://github.com/DominikPieper/atelier-ui/commit/68a3b528))
|
|
6
38
|
|
|
7
|
-
### ⚠️
|
|
39
|
+
### ⚠️ Breaking Changes
|
|
8
40
|
|
|
9
|
-
- **react:** the published package declares what it actually ships
|
|
10
|
-
`
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
41
|
+
- **react:** the published package declares what it actually ships ([68a3b528](https://github.com/DominikPieper/atelier-ui/commit/68a3b528))
|
|
42
|
+
`footer, and that is a judgement to review
|
|
43
|
+
rather than a claim that nothing changed. An external consumer who imports this
|
|
44
|
+
package in their own Vitest suite was silently protected by the guard and now
|
|
45
|
+
needs the same`inline` entry themselves — semver-honest grounds for a major.
|
|
14
46
|
The footer is left off because on this setup it would likely cut 1.0.0
|
|
15
47
|
automatically on push, and that is the owner's call to make deliberately, not a
|
|
16
48
|
side effect of a bug fix.
|
package/package.json
CHANGED
|
@@ -12,13 +12,13 @@ reach one, rather than pretending the step happened.
|
|
|
12
12
|
|
|
13
13
|
## What this workspace can check, and what it cannot
|
|
14
14
|
|
|
15
|
-
| Can | How
|
|
16
|
-
| ----------------------------------------------------------------------- |
|
|
17
|
-
| That a contract matches its Figma master's shape | `npm run check:contracts` against `tools/figma/snapshot.json`
|
|
18
|
-
| That every variant value and Boolean state has a story | the same check's `[COVERAGE]` findings
|
|
19
|
-
| That a component, composable, service, or helper behaves as unit-tested | `npm run check:unit` (jsdom, `@testing-library/*`)
|
|
20
|
-
| That every story renders, behaves, and passes axe | `npm run check:stories` (Chromium, headless)
|
|
21
|
-
| That CSS uses tokens rather than literals | `npm run check:stylelint`
|
|
15
|
+
| Can | How |
|
|
16
|
+
| ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| That a contract matches its Figma master's shape | `npm run check:contracts` against `tools/figma/snapshot.json` |
|
|
18
|
+
| That every variant value and Boolean state has a story | the same check's `[COVERAGE]` findings |
|
|
19
|
+
| That a component, composable, service, or helper behaves as unit-tested | `npm run check:unit` (jsdom, `@testing-library/*`) — for React/Vue, composing the component's own stories (`composeStories`) is preferred over restating their claims by hand; see `<app>/src/atl-button.spec.*` |
|
|
20
|
+
| That every story renders, behaves, and passes axe | `npm run check:stories` (Chromium, headless) |
|
|
21
|
+
| That CSS uses tokens rather than literals | `npm run check:stylelint` |
|
|
22
22
|
|
|
23
23
|
It cannot check design parity against the live Figma file unless the `figma-console` MCP is
|
|
24
24
|
wired in `.mcp.json` and the Desktop Bridge plugin is running. If it is not, the loop ends at
|
|
@@ -15,6 +15,7 @@ const config: StorybookConfig = {
|
|
|
15
15
|
getAbsolutePath('@storybook/addon-vitest'),
|
|
16
16
|
getAbsolutePath('@storybook/addon-a11y'),
|
|
17
17
|
getAbsolutePath('@storybook/addon-docs'),
|
|
18
|
+
getAbsolutePath('@storybook/addon-themes'),
|
|
18
19
|
],
|
|
19
20
|
framework: {
|
|
20
21
|
name: getAbsolutePath('@storybook/angular-vite'),
|
|
@@ -29,6 +30,13 @@ const config: StorybookConfig = {
|
|
|
29
30
|
// explicit here so `components.json` carries real prop tables, not just
|
|
30
31
|
// id/name.
|
|
31
32
|
experimentalDocgenServer: true,
|
|
33
|
+
// `review-create` (wire name for the addon-mcp `review.create` method)
|
|
34
|
+
// registers for the deprecated `storybook ai` CLI proxy channel by default
|
|
35
|
+
// (unset ≠ false), but a direct MCP client — exactly what
|
|
36
|
+
// `claude mcp add --transport http storybook-local http://localhost:<port>/mcp`
|
|
37
|
+
// configures — only gets the tool when `experimentalReview` is explicitly
|
|
38
|
+
// `true` (verified against the installed 10.6.0 `storybook` dist).
|
|
39
|
+
experimentalReview: true,
|
|
32
40
|
},
|
|
33
41
|
};
|
|
34
42
|
|
|
@@ -3,6 +3,8 @@ import type { Preview } from '@storybook/angular-vite';
|
|
|
3
3
|
// Side-effect import: Vite injects tokens.css globally into the page
|
|
4
4
|
import '../src/styles/tokens.css';
|
|
5
5
|
|
|
6
|
+
import { withThemeByDataAttribute } from '@storybook/addon-themes';
|
|
7
|
+
|
|
6
8
|
const preview: Preview = {
|
|
7
9
|
parameters: {
|
|
8
10
|
a11y: {
|
|
@@ -25,6 +27,21 @@ const preview: Preview = {
|
|
|
25
27
|
},
|
|
26
28
|
},
|
|
27
29
|
},
|
|
30
|
+
|
|
31
|
+
decorators: [
|
|
32
|
+
// tokens.css keys dark mode off `[data-theme='dark']` / `[data-theme='light']`
|
|
33
|
+
// on the root element (with a `prefers-color-scheme` media-query fallback),
|
|
34
|
+
// so the data-attribute strategy is the one that matches — a class-name
|
|
35
|
+
// strategy would not touch the selector tokens.css actually uses.
|
|
36
|
+
withThemeByDataAttribute({
|
|
37
|
+
themes: { light: 'light', dark: 'dark' },
|
|
38
|
+
defaultTheme: 'light',
|
|
39
|
+
}),
|
|
40
|
+
],
|
|
41
|
+
|
|
42
|
+
initialGlobals: {
|
|
43
|
+
theme: 'light',
|
|
44
|
+
},
|
|
28
45
|
};
|
|
29
46
|
|
|
30
47
|
export default preview;
|
|
@@ -15,6 +15,7 @@ const config: StorybookConfig = {
|
|
|
15
15
|
getAbsolutePath('@storybook/addon-vitest'),
|
|
16
16
|
getAbsolutePath('@storybook/addon-a11y'),
|
|
17
17
|
getAbsolutePath('@storybook/addon-docs'),
|
|
18
|
+
getAbsolutePath('@storybook/addon-themes'),
|
|
18
19
|
],
|
|
19
20
|
framework: {
|
|
20
21
|
name: getAbsolutePath('@storybook/react-vite'),
|
|
@@ -27,6 +28,13 @@ const config: StorybookConfig = {
|
|
|
27
28
|
// (react-docgen), unlike Angular and Vue — no experimentalDocgenServer
|
|
28
29
|
// flag needed here.
|
|
29
30
|
componentsManifest: true,
|
|
31
|
+
// `review-create` (wire name for the addon-mcp `review.create` method)
|
|
32
|
+
// registers for the deprecated `storybook ai` CLI proxy channel by default
|
|
33
|
+
// (unset ≠ false), but a direct MCP client — exactly what
|
|
34
|
+
// `claude mcp add --transport http storybook-local http://localhost:<port>/mcp`
|
|
35
|
+
// configures — only gets the tool when `experimentalReview` is explicitly
|
|
36
|
+
// `true` (verified against the installed 10.6.0 `storybook` dist).
|
|
37
|
+
experimentalReview: true,
|
|
30
38
|
},
|
|
31
39
|
};
|
|
32
40
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { Preview } from '@storybook/react';
|
|
1
|
+
import type { Preview } from '@storybook/react-vite';
|
|
2
2
|
|
|
3
3
|
import '../src/styles/tokens.css';
|
|
4
4
|
|
|
5
|
+
import { withThemeByDataAttribute } from '@storybook/addon-themes';
|
|
6
|
+
|
|
5
7
|
const preview: Preview = {
|
|
6
8
|
parameters: {
|
|
7
9
|
a11y: {
|
|
@@ -24,6 +26,21 @@ const preview: Preview = {
|
|
|
24
26
|
},
|
|
25
27
|
},
|
|
26
28
|
},
|
|
29
|
+
|
|
30
|
+
decorators: [
|
|
31
|
+
// tokens.css keys dark mode off `[data-theme='dark']` / `[data-theme='light']`
|
|
32
|
+
// on the root element (with a `prefers-color-scheme` media-query fallback),
|
|
33
|
+
// so the data-attribute strategy is the one that matches — a class-name
|
|
34
|
+
// strategy would not touch the selector tokens.css actually uses.
|
|
35
|
+
withThemeByDataAttribute({
|
|
36
|
+
themes: { light: 'light', dark: 'dark' },
|
|
37
|
+
defaultTheme: 'light',
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
|
|
41
|
+
initialGlobals: {
|
|
42
|
+
theme: 'light',
|
|
43
|
+
},
|
|
27
44
|
};
|
|
28
45
|
|
|
29
46
|
export default preview;
|
|
@@ -15,6 +15,7 @@ const config: StorybookConfig = {
|
|
|
15
15
|
getAbsolutePath('@storybook/addon-vitest'),
|
|
16
16
|
getAbsolutePath('@storybook/addon-a11y'),
|
|
17
17
|
getAbsolutePath('@storybook/addon-docs'),
|
|
18
|
+
getAbsolutePath('@storybook/addon-themes'),
|
|
18
19
|
],
|
|
19
20
|
framework: {
|
|
20
21
|
name: getAbsolutePath('@storybook/vue3-vite'),
|
|
@@ -28,6 +29,13 @@ const config: StorybookConfig = {
|
|
|
28
29
|
// Vue's docgen server is opt-in under `@storybook/vue3-vite` until
|
|
29
30
|
// Storybook 11 — without this flag components.json has no props.
|
|
30
31
|
experimentalDocgenServer: true,
|
|
32
|
+
// `review-create` (wire name for the addon-mcp `review.create` method)
|
|
33
|
+
// registers for the deprecated `storybook ai` CLI proxy channel by default
|
|
34
|
+
// (unset ≠ false), but a direct MCP client — exactly what
|
|
35
|
+
// `claude mcp add --transport http storybook-local http://localhost:<port>/mcp`
|
|
36
|
+
// configures — only gets the tool when `experimentalReview` is explicitly
|
|
37
|
+
// `true` (verified against the installed 10.6.0 `storybook` dist).
|
|
38
|
+
experimentalReview: true,
|
|
31
39
|
},
|
|
32
40
|
};
|
|
33
41
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { Preview } from '@storybook/vue3';
|
|
1
|
+
import type { Preview } from '@storybook/vue3-vite';
|
|
2
2
|
|
|
3
3
|
import '../src/styles/tokens.css';
|
|
4
4
|
|
|
5
|
+
import { withThemeByDataAttribute } from '@storybook/addon-themes';
|
|
6
|
+
|
|
5
7
|
const preview: Preview = {
|
|
6
8
|
parameters: {
|
|
7
9
|
a11y: {
|
|
@@ -24,6 +26,21 @@ const preview: Preview = {
|
|
|
24
26
|
},
|
|
25
27
|
},
|
|
26
28
|
},
|
|
29
|
+
|
|
30
|
+
decorators: [
|
|
31
|
+
// tokens.css keys dark mode off `[data-theme='dark']` / `[data-theme='light']`
|
|
32
|
+
// on the root element (with a `prefers-color-scheme` media-query fallback),
|
|
33
|
+
// so the data-attribute strategy is the one that matches — a class-name
|
|
34
|
+
// strategy would not touch the selector tokens.css actually uses.
|
|
35
|
+
withThemeByDataAttribute({
|
|
36
|
+
themes: { light: 'light', dark: 'dark' },
|
|
37
|
+
defaultTheme: 'light',
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
|
|
41
|
+
initialGlobals: {
|
|
42
|
+
theme: 'light',
|
|
43
|
+
},
|
|
27
44
|
};
|
|
28
45
|
|
|
29
46
|
export default preview;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
// No test-setup-stories.ts sibling here (unlike react/vue): verified against
|
|
2
|
+
// the installed @storybook/angular@10.6.0 dist (and its -vite counterpart)
|
|
3
|
+
// that neither exports composeStories/composeStory, only
|
|
4
|
+
// setProjectAnnotations — tracked upstream as storybookjs/storybook#28897.
|
|
5
|
+
// Wiring setProjectAnnotations alone would register project-level config
|
|
6
|
+
// that nothing in this workspace could yet consume. See ADR-0141.
|
|
1
7
|
import '@angular/compiler';
|
|
2
8
|
import '@analogjs/vitest-angular/setup-snapshots';
|
|
3
9
|
import '@testing-library/jest-dom/vitest';
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { screen } from '@testing-library/react';
|
|
2
|
+
import { composeStories } from '@storybook/react';
|
|
3
|
+
import * as stories from './atl-button.stories';
|
|
3
4
|
|
|
4
|
-
// A working pattern to copy:
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
5
|
+
// A working pattern to copy: this composes atl-button.stories.tsx's own
|
|
6
|
+
// exports instead of restating their claims by hand (ADR-0121: the stories
|
|
7
|
+
// are the claims; ADR-0141: composing them here, in Vitest/jsdom, not just
|
|
8
|
+
// in Chromium via check:stories). Primary's own `play` (see that file) does
|
|
9
|
+
// the click + assertion; composeStories(...).Primary.run() renders the
|
|
10
|
+
// story exactly like Storybook does — decorators, parameters and globals
|
|
11
|
+
// included, via src/test-setup-stories.ts's setProjectAnnotations call —
|
|
12
|
+
// then executes that play. A story composed WITHOUT that setup would
|
|
13
|
+
// silently test a different component than the one Storybook renders.
|
|
14
|
+
const { Primary } = composeStories(stories);
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
expect(onClick).toHaveBeenCalledOnce();
|
|
16
|
+
describe('AtlButton', () => {
|
|
17
|
+
it('renders with its accessible name and fires its click handler when clicked', async () => {
|
|
18
|
+
await Primary.run();
|
|
19
|
+
expect(screen.getByRole('button', { name: 'Button' })).toBeInTheDocument();
|
|
21
20
|
});
|
|
22
21
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { beforeAll } from 'vitest';
|
|
2
|
+
import { setProjectAnnotations } from '@storybook/react';
|
|
3
|
+
import * as previewAnnotations from '../.storybook/preview';
|
|
4
|
+
|
|
5
|
+
// Portable stories (composeStories, used by atl-button.spec.tsx and any
|
|
6
|
+
// other jsdom test that imports a *.stories.tsx file) need the SAME
|
|
7
|
+
// decorators, parameters and globals the real Storybook applies via
|
|
8
|
+
// .storybook/preview — otherwise a composed story silently tests a
|
|
9
|
+
// different component than the one Storybook renders. setProjectAnnotations
|
|
10
|
+
// registers that config once; its returned `beforeAll` (addon-level setup,
|
|
11
|
+
// not just decorators) has to run through Vitest's own beforeAll — this is
|
|
12
|
+
// Storybook's documented Vitest portable-stories setup, not a local
|
|
13
|
+
// invention:
|
|
14
|
+
// https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest
|
|
15
|
+
const annotations = setProjectAnnotations([previewAnnotations]);
|
|
16
|
+
|
|
17
|
+
beforeAll(annotations.beforeAll);
|
|
@@ -16,7 +16,7 @@ export default defineConfig({
|
|
|
16
16
|
globals: true,
|
|
17
17
|
environment: 'jsdom',
|
|
18
18
|
include: ['src/**/*.spec.*'],
|
|
19
|
-
setupFiles: ['src/test-setup.ts'],
|
|
19
|
+
setupFiles: ['src/test-setup.ts', 'src/test-setup-stories.ts'],
|
|
20
20
|
server: {
|
|
21
21
|
deps: {
|
|
22
22
|
// @atelier-ui/react's built entry ships one `import './x.css'` per
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { screen } from '@testing-library/vue';
|
|
2
|
+
import { composeStories } from '@storybook/vue3';
|
|
3
|
+
import * as stories from './atl-button.stories';
|
|
3
4
|
|
|
4
|
-
// A working pattern to copy:
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
5
|
+
// A working pattern to copy: this composes atl-button.stories.ts's own
|
|
6
|
+
// exports instead of restating their claims by hand (ADR-0121: the stories
|
|
7
|
+
// are the claims; ADR-0141: composing them here, in Vitest/jsdom, not just
|
|
8
|
+
// in Chromium via check:stories). Primary's own `play` (see that file) does
|
|
9
|
+
// the click + assertion; composeStories(...).Primary.run() renders the
|
|
10
|
+
// story exactly like Storybook does — decorators, parameters and globals
|
|
11
|
+
// included, via src/test-setup-stories.ts's setProjectAnnotations call —
|
|
12
|
+
// then executes that play. A story composed WITHOUT that setup would
|
|
13
|
+
// silently test a different component than the one Storybook renders.
|
|
14
|
+
const { Primary } = composeStories(stories);
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
attrs: { onClick },
|
|
21
|
-
});
|
|
22
|
-
await fireEvent.click(screen.getByRole('button', { name: 'Click me' }));
|
|
23
|
-
expect(onClick).toHaveBeenCalledOnce();
|
|
16
|
+
describe('AtlButton', () => {
|
|
17
|
+
it('renders with its accessible name and fires its click handler when clicked', async () => {
|
|
18
|
+
await Primary.run();
|
|
19
|
+
expect(screen.getByRole('button', { name: 'Button' })).toBeInTheDocument();
|
|
24
20
|
});
|
|
25
21
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { beforeAll } from 'vitest';
|
|
2
|
+
import { setProjectAnnotations } from '@storybook/vue3';
|
|
3
|
+
import * as previewAnnotations from '../.storybook/preview';
|
|
4
|
+
|
|
5
|
+
// Portable stories (composeStories, used by atl-button.spec.ts and any
|
|
6
|
+
// other jsdom test that imports a *.stories.ts file) need the SAME
|
|
7
|
+
// decorators, parameters and globals the real Storybook applies via
|
|
8
|
+
// .storybook/preview — otherwise a composed story silently tests a
|
|
9
|
+
// different component than the one Storybook renders. setProjectAnnotations
|
|
10
|
+
// registers that config once; its returned `beforeAll` (addon-level setup,
|
|
11
|
+
// not just decorators) has to run through Vitest's own beforeAll — this is
|
|
12
|
+
// Storybook's documented Vitest portable-stories setup, not a local
|
|
13
|
+
// invention:
|
|
14
|
+
// https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest
|
|
15
|
+
const annotations = setProjectAnnotations([previewAnnotations]);
|
|
16
|
+
|
|
17
|
+
beforeAll(annotations.beforeAll);
|
|
@@ -17,7 +17,7 @@ export default defineConfig({
|
|
|
17
17
|
globals: true,
|
|
18
18
|
environment: 'jsdom',
|
|
19
19
|
include: ['src/**/*.spec.*'],
|
|
20
|
-
setupFiles: ['src/test-setup.ts'],
|
|
20
|
+
setupFiles: ['src/test-setup.ts', 'src/test-setup-stories.ts'],
|
|
21
21
|
server: {
|
|
22
22
|
deps: {
|
|
23
23
|
// @atelier-ui/vue's built entry (index.mjs) carries an unconditional
|
|
@@ -344,6 +344,84 @@ function checkClaudeCli() {
|
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
+
// A checked-in `.claude/settings.json` — the scaffold's permissions.allow
|
|
348
|
+
// list and `enableAllProjectMcpServers`, this repo's own pre-push hook — does
|
|
349
|
+
// nothing until a human has opened THIS folder in Claude Code once and
|
|
350
|
+
// accepted its one-time "do you trust this folder?" dialog. That acceptance
|
|
351
|
+
// lives in `~/.claude.json`, keyed by the workspace's own absolute path:
|
|
352
|
+
// `projects[<path>].hasTrustDialogAccepted`. Confirmed by reading a real
|
|
353
|
+
// `~/.claude.json` on this machine, not guessed at.
|
|
354
|
+
//
|
|
355
|
+
// A freshly scaffolded workspace is untrusted by construction — nobody has
|
|
356
|
+
// opened it in Claude Code yet — so this is a warning, never a hard failure:
|
|
357
|
+
// the remedy is one ordinary first session, not a defect. What it closes is
|
|
358
|
+
// the confusing gap a dry run surfaced: every other check green, and the
|
|
359
|
+
// first `claude` session in the room still printing "Ignoring 8
|
|
360
|
+
// permissions.allow entries … this workspace has not been trusted" — which
|
|
361
|
+
// reads as broken tooling to someone who was just told setup is finished.
|
|
362
|
+
//
|
|
363
|
+
// Runs unconditionally, in both the clone and the scaffold (no
|
|
364
|
+
// `detectEnvironment()` branch, unlike the ports/Playwright checks below):
|
|
365
|
+
// the trust dialog gates a checked-in `.claude/settings.json` the same way
|
|
366
|
+
// in either tree — this repo's own hook is just as inert pre-trust as the
|
|
367
|
+
// scaffold's permissions/MCP wiring — and `checkClaudeCli()` immediately
|
|
368
|
+
// above already runs unconditionally for the same reason, so this needs no
|
|
369
|
+
// new branch to match that existing shape.
|
|
370
|
+
//
|
|
371
|
+
// Factored as a pure function taking an explicit `claudeJsonPath` (rather
|
|
372
|
+
// than reading `~/.claude.json` inline) so the missing/unreadable/malformed
|
|
373
|
+
// branches can be exercised by pointing it at a path that doesn't exist,
|
|
374
|
+
// without ever touching the real file.
|
|
375
|
+
function readTrustStatus(claudeJsonPath, workspaceRoot) {
|
|
376
|
+
let raw;
|
|
377
|
+
try {
|
|
378
|
+
raw = readFileSync(claudeJsonPath, 'utf8');
|
|
379
|
+
} catch (err) {
|
|
380
|
+
return {
|
|
381
|
+
status: 'unknown',
|
|
382
|
+
reason:
|
|
383
|
+
err?.code === 'ENOENT'
|
|
384
|
+
? `no ${claudeJsonPath} yet`
|
|
385
|
+
: `could not read ${claudeJsonPath} (${err?.message ?? err})`,
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
let data;
|
|
389
|
+
try {
|
|
390
|
+
data = JSON.parse(raw);
|
|
391
|
+
} catch (err) {
|
|
392
|
+
return {
|
|
393
|
+
status: 'unknown',
|
|
394
|
+
reason: `${claudeJsonPath} is not valid JSON (${err?.message ?? err})`,
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
const accepted = data?.projects?.[workspaceRoot]?.hasTrustDialogAccepted;
|
|
398
|
+
return { status: accepted === true ? 'trusted' : 'untrusted' };
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
function checkClaudeTrust() {
|
|
402
|
+
const claudeJsonPath = join(homedir(), '.claude.json');
|
|
403
|
+
const { status, reason } = readTrustStatus(claudeJsonPath, ROOT);
|
|
404
|
+
const fix =
|
|
405
|
+
'Run `claude` here once and accept the trust dialog, or set ' +
|
|
406
|
+
`projects[${JSON.stringify(ROOT)}].hasTrustDialogAccepted: true in ${claudeJsonPath}`;
|
|
407
|
+
if (status === 'trusted') {
|
|
408
|
+
ok('Claude Code workspace trust', `accepted for ${ROOT}`);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
// 'untrusted' (recorded as declined/absent) and 'unknown' (the file is
|
|
412
|
+
// missing, unreadable, or unparseable — most commonly a machine that has
|
|
413
|
+
// never run Claude Code) get the same warning: neither has recorded
|
|
414
|
+
// acceptance, so the practical consequence — .mcp.json and
|
|
415
|
+
// .claude/settings.json being ignored — is identical either way.
|
|
416
|
+
warn(
|
|
417
|
+
'Claude Code workspace trust',
|
|
418
|
+
status === 'untrusted'
|
|
419
|
+
? 'not accepted yet — .mcp.json and .claude/settings.json (permissions, MCP auto-connect, hooks) stay inert until you do'
|
|
420
|
+
: `${reason} — treating this workspace as not yet trusted`,
|
|
421
|
+
fix,
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
|
|
347
425
|
async function checkFigmaSetup() {
|
|
348
426
|
// 1. Desktop Bridge plugin manifest — the primary channel.
|
|
349
427
|
const manifestPath = join(
|
|
@@ -636,6 +714,7 @@ async function main() {
|
|
|
636
714
|
|
|
637
715
|
header('Claude Code');
|
|
638
716
|
checkClaudeCli();
|
|
717
|
+
checkClaudeTrust();
|
|
639
718
|
|
|
640
719
|
header('Figma');
|
|
641
720
|
await checkFigmaSetup();
|