@atom63/create 0.0.0-stage → 0.1.0-beta.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.
Files changed (89) hide show
  1. package/LICENSE +27 -0
  2. package/README.md +70 -2
  3. package/package.json +27 -3
  4. package/src/generate.mjs +281 -0
  5. package/src/index.mjs +64 -0
  6. package/starter/app/AGENTS.md +17 -0
  7. package/starter/app/README.md +40 -0
  8. package/starter/app/src/app.ts +4 -0
  9. package/starter/app/src/components/app-layout.tsx +49 -0
  10. package/starter/app/src/components/appearance-settings.tsx +87 -0
  11. package/starter/app/src/pages/not-found.tsx +30 -0
  12. package/starter/app/src/router.tsx +79 -0
  13. package/starter/app/src/styles.css +31 -0
  14. package/starter/app/vite.config.ts +10 -0
  15. package/starter/base/_gitignore +4 -0
  16. package/starter/base/components.json +21 -0
  17. package/starter/base/index.html +12 -0
  18. package/starter/base/src/lib/utils.ts +7 -0
  19. package/starter/base/src/main.tsx +21 -0
  20. package/starter/base/src/theme.tsx +89 -0
  21. package/starter/base/tsconfig.json +21 -0
  22. package/starter/content/AGENTS.md +16 -0
  23. package/starter/content/README.md +35 -0
  24. package/starter/content/src/components/site-footer.tsx +9 -0
  25. package/starter/content/src/components/site-header.tsx +32 -0
  26. package/starter/content/src/mdx.d.ts +7 -0
  27. package/starter/content/src/styles.css +32 -0
  28. package/starter/content/vite.config.ts +25 -0
  29. package/starter/docs/src/components/docs-sidebar.tsx +35 -0
  30. package/starter/docs/src/content/docs/installation.mdx +22 -0
  31. package/starter/docs/src/content/docs/introduction.mdx +22 -0
  32. package/starter/docs/src/content/docs/writing-pages.mdx +36 -0
  33. package/starter/docs/src/content/docs.ts +60 -0
  34. package/starter/docs/src/pages/doc-page.tsx +57 -0
  35. package/starter/docs/src/pages/home.tsx +39 -0
  36. package/starter/docs/src/pages/not-found.tsx +30 -0
  37. package/starter/docs/src/router.tsx +86 -0
  38. package/starter/docs/src/site.ts +7 -0
  39. package/starter/portfolio/AGENTS.md +28 -0
  40. package/starter/portfolio/README.md +152 -0
  41. package/starter/portfolio/public/plates/hero.svg +40 -0
  42. package/starter/portfolio/public/projects/front-desk-scheduling/calendar.svg +30 -0
  43. package/starter/portfolio/public/projects/front-desk-scheduling/cover.svg +28 -0
  44. package/starter/portfolio/public/projects/ledger-design-system/cover.svg +13 -0
  45. package/starter/portfolio/public/projects/night-trip-planner/cover.svg +19 -0
  46. package/starter/portfolio/public/projects/night-trip-planner/flow.svg +34 -0
  47. package/starter/portfolio/src/components/mdx-components.tsx +25 -0
  48. package/starter/portfolio/src/components/project-card.tsx +32 -0
  49. package/starter/portfolio/src/components/site-footer.tsx +33 -0
  50. package/starter/portfolio/src/components/site-header.tsx +124 -0
  51. package/starter/portfolio/src/components/site-layout.tsx +62 -0
  52. package/starter/portfolio/src/content/projects/front-desk-scheduling.mdx +47 -0
  53. package/starter/portfolio/src/content/projects/ledger-design-system.mdx +40 -0
  54. package/starter/portfolio/src/content/projects/night-trip-planner.mdx +51 -0
  55. package/starter/portfolio/src/content/projects.ts +43 -0
  56. package/starter/portfolio/src/content/resume.ts +80 -0
  57. package/starter/portfolio/src/content/timeline.ts +69 -0
  58. package/starter/portfolio/src/content/writing/a-design-system-for-one.mdx +21 -0
  59. package/starter/portfolio/src/content/writing/case-studies-that-show-the-work.mdx +24 -0
  60. package/starter/portfolio/src/content/writing/designing-for-interruptions.mdx +23 -0
  61. package/starter/portfolio/src/content/writing.ts +37 -0
  62. package/starter/portfolio/src/modules/assistant/answers.ts +60 -0
  63. package/starter/portfolio/src/modules/assistant/assistant.tsx +107 -0
  64. package/starter/portfolio/src/modules/assistant/transport.ts +36 -0
  65. package/starter/portfolio/src/modules/dock/dock.tsx +141 -0
  66. package/starter/portfolio/src/modules/slides/decks.ts +49 -0
  67. package/starter/portfolio/src/modules/slides/slides-pages.tsx +128 -0
  68. package/starter/portfolio/src/modules/widgets/widget-board.tsx +121 -0
  69. package/starter/portfolio/src/pages/home.tsx +139 -0
  70. package/starter/portfolio/src/pages/not-found.tsx +30 -0
  71. package/starter/portfolio/src/pages/project-page.tsx +102 -0
  72. package/starter/portfolio/src/pages/projects-index.tsx +39 -0
  73. package/starter/portfolio/src/pages/resume.tsx +97 -0
  74. package/starter/portfolio/src/pages/timeline.tsx +89 -0
  75. package/starter/portfolio/src/pages/writing-index.tsx +64 -0
  76. package/starter/portfolio/src/pages/writing-post.tsx +43 -0
  77. package/starter/portfolio/src/portfolio.config.ts +88 -0
  78. package/starter/portfolio/src/router.tsx +113 -0
  79. package/starter/portfolio/src/styles.css +38 -0
  80. package/starter/site/src/content/blog/hello-world.mdx +25 -0
  81. package/starter/site/src/content/blog/writing-with-mdx.mdx +29 -0
  82. package/starter/site/src/content/posts.ts +37 -0
  83. package/starter/site/src/pages/blog-index.tsx +60 -0
  84. package/starter/site/src/pages/blog-post.tsx +43 -0
  85. package/starter/site/src/pages/home.tsx +143 -0
  86. package/starter/site/src/pages/not-found.tsx +30 -0
  87. package/starter/site/src/router.tsx +82 -0
  88. package/starter/site/src/site.ts +7 -0
  89. package/versions.json +27 -0
package/LICENSE ADDED
@@ -0,0 +1,27 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 You Zhang (ATOM63)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ The MIT license above covers the code and documentation in this repository. It does not grant
26
+ any right to use the ATOM63 name, the ATOM63 logo or other ATOM63 brand marks, including the
27
+ artwork in packages/brand. All rights to them are reserved.
package/README.md CHANGED
@@ -1,3 +1,71 @@
1
- # Temporary Holding Version
1
+ # @atom63/create
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Create a new project on the Atom63 design system. The plans and their decisions are in
4
+ [`docs/design-system/starter-plan.md`](../../docs/design-system/starter-plan.md) and, for the
5
+ `app` kind, [`starter-app-plan.md`](../../docs/design-system/starter-app-plan.md).
6
+
7
+ ```bash
8
+ pnpm create @atom63 my-site # once published
9
+ pnpm create:app my-site # in this repo, today
10
+ ```
11
+
12
+ The generated app follows the [quickstart](../../docs/design-system/quickstart.md):
13
+
14
+ - **Stack:** Vite, React 19, TypeScript and TanStack Router.
15
+ - **Styling:** `@atom63/styles`, `@atom63/ui-react` and `Atom63Theme`, with Tailwind CSS v4
16
+ wired to the tokens. `bg-background` and `text-muted-foreground` resolve to `--a63-*`, and the
17
+ `dark:` variant follows `Atom63Theme`.
18
+ - **Content** (`site` and `docs`): MDX through `@mdx-js/rollup` and `@atom63/mdx`. Posts are
19
+ `.mdx` files with frontmatter, and the list and post pages are generated from the folder.
20
+ - **Templates** (`app`): the page templates and the blocks they use, copied from the agent index
21
+ into `src/templates` as the app's own code.
22
+ - **shadcn:** the bridge in `@atom63/styles/compat/shadcn`, plus `components.json`, the `cn`
23
+ helper and `class-variance-authority`, so `npx shadcn add <component>` works and the component
24
+ takes the system's colors, radius and modes.
25
+ - **Agents:** `AGENTS.md` with the rules from the `atom63` rule table. It points agents at the
26
+ published docs (`llms.txt` and the per-page Markdown), because the CLI is not published yet.
27
+
28
+ ## Kinds
29
+
30
+ | Kind | Pages |
31
+ | --- | --- |
32
+ | `site` (default) | A landing page (hero, features, latest posts, sign-up) and an MDX blog |
33
+ | `docs` | MDX documentation: a sidebar grouped from the pages' frontmatter, the docs typography, an "On this page" table of contents, and previous and next links |
34
+ | `app` | A product app from the page templates: the app shell (rendered once, in a layout route) around an overview, an invoice list with its detail view, settings and a first-run page, plus sign-in and a not-found page. The sample data stays until you replace it |
35
+ | `portfolio` | A personal portfolio: a home page with a hero plate and featured projects, projects with MDX case studies (problem, role, process, outcome, media), MDX writing, a timeline and a printable resume, with a fictional person's sample content. Optional modules switch in `src/portfolio.config.ts`: an assistant on `@atom63/agent` that answers offline from the content (on), slides, a widget board and a bottom dock with mini apps (off). `examples/portfolio` is this kind, generated |
36
+
37
+ Each kind is a folder in `starter/`, layered over shared layers: `starter/base` is what every app
38
+ shares (the entry, the theme, TypeScript and shadcn setup), `starter/content` adds MDX and the
39
+ site header and footer to `site`, `docs` and `portfolio`, and `starter/app` is the app kind's
40
+ router, layout and config. Choose a kind with `--kind`, for example
41
+ `pnpm create:app my-docs --kind docs`.
42
+
43
+ ## How it works
44
+
45
+ `src/generate.mjs` copies the kind's layers in order (`kindLayers`; a later layer's file replaces
46
+ an earlier one at the same path) and fills `{{title}}` and `{{date}}`. It builds `package.json`
47
+ itself from the packages each layer adds (`layerPackages`): the `@atom63/*` packages take their exact versions
48
+ from this repo (only the release that publishes them changes those), and every other package
49
+ takes the range the repo already uses. Packages no workspace package uses are listed in
50
+ `starterOnly`.
51
+
52
+ For a kind with templates (`kindTemplates`), it also copies those page templates and every block
53
+ they use from the agent index (`@atom63/cli/agent-index.json`) into `src/templates`, keeping the
54
+ `pages/<id>/` and `blocks/<id>/` layout as `atom63 copy` does.
55
+
56
+ `pnpm check:starter` proves the starter works, and CI runs it:
57
+
58
+ 1. pack the design system packages;
59
+ 2. generate an app of every kind and install each against the tarballs;
60
+ 3. run `typecheck` and `build`;
61
+ 4. hold the generated source to the craft rules;
62
+ 5. for the `app` and `portfolio` kinds, open every route at a desktop and a phone width in light
63
+ and dark mode (axe, console errors, one `h1`, no horizontal overflow); for `portfolio`, build
64
+ again with every optional module on and open their routes too;
65
+ 6. with `--shadcn`, add a shadcn button to the first kind's app and build again.
66
+
67
+ The generated app installs from npm only after `@atom63/mdx` has been published.
68
+
69
+ `examples/portfolio` is the portfolio kind generated with the design system packages taken from the
70
+ workspace. After changing the portfolio starter, run `pnpm generate:example:portfolio`;
71
+ `pnpm test:scripts` fails while the two differ.
package/package.json CHANGED
@@ -1,6 +1,30 @@
1
1
  {
2
2
  "name": "@atom63/create",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0-beta.2",
4
+ "description": "Create a new project on the Atom63 design system: a site, docs or a product app, with React and Tailwind CSS wired to the tokens",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/atom63/atom63-design-system.git",
9
+ "directory": "packages/create"
10
+ },
11
+ "type": "module",
12
+ "bin": {
13
+ "create-atom63": "./src/index.mjs"
14
+ },
15
+ "files": [
16
+ "src",
17
+ "!src/**/*.test.mjs",
18
+ "starter",
19
+ "versions.json"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "dependencies": {
25
+ "@atom63/cli": "0.1.0-beta.11"
26
+ },
27
+ "scripts": {
28
+ "test": "node --test \"src/**/*.test.mjs\""
29
+ }
6
30
  }
@@ -0,0 +1,281 @@
1
+ /**
2
+ * Plans and writes a new Atom63 project: the shared base plus the files of
3
+ * one kind, with package.json built here so every version comes from this
4
+ * repo (the design system packages at their released versions, everything
5
+ * else as the repo pins it).
6
+ */
7
+ import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'
8
+ import { createRequire } from 'node:module'
9
+ import path from 'node:path'
10
+ import { fileURLToPath } from 'node:url'
11
+
12
+ import { agentsBlock } from '@atom63/cli/agents-md'
13
+
14
+ const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
15
+ const repoRoot = path.resolve(packageRoot, '../..')
16
+ const starterRoot = path.join(packageRoot, 'starter')
17
+
18
+ /**
19
+ * The layers each kind is built from, in order; a later layer's file replaces
20
+ * an earlier one at the same path. `base` is what every app shares; `content`
21
+ * adds MDX and the site header and footer.
22
+ */
23
+ const kindLayers = {
24
+ site: ['base', 'content', 'site'],
25
+ docs: ['base', 'content', 'docs'],
26
+ app: ['base', 'app'],
27
+ portfolio: ['base', 'content', 'portfolio'],
28
+ }
29
+
30
+ /**
31
+ * The page templates a kind starts from. They are copied, with the blocks
32
+ * they use, from the agent index into `src/templates`, keeping the
33
+ * `pages/<id>/` and `blocks/<id>/` layout as `atom63 copy` does.
34
+ */
35
+ const kindTemplates = {
36
+ app: ['dashboard-page', 'list-page', 'settings-page', 'onboarding-page', 'sign-in-page'],
37
+ portfolio: ['chat-panel'],
38
+ }
39
+
40
+ export const kinds = Object.keys(kindLayers)
41
+
42
+ const atom63Packages = {
43
+ '@atom63/agent': 'packages/agent',
44
+ '@atom63/mdx': 'packages/mdx',
45
+ '@atom63/styles': 'packages/styles',
46
+ '@atom63/ui-foundation': 'packages/ui-foundation',
47
+ '@atom63/ui-react': 'packages/ui-react',
48
+ '@atom63/widgets': 'packages/widgets',
49
+ }
50
+
51
+ /**
52
+ * Packages the starter needs that no workspace package uses, so the repo has
53
+ * no range to copy. Keep this list short, and check a new entry against npm.
54
+ */
55
+ const starterOnly = {
56
+ // shadcn's `init` normally installs it; every shadcn component imports it.
57
+ 'class-variance-authority': '^0.7.1',
58
+ }
59
+
60
+ /** The packages each layer adds. */
61
+ const layerPackages = {
62
+ base: {
63
+ dependencies: [
64
+ '@atom63/styles',
65
+ '@atom63/ui-foundation',
66
+ '@atom63/ui-react',
67
+ '@tanstack/react-router',
68
+ 'class-variance-authority',
69
+ 'clsx',
70
+ 'lucide-react',
71
+ 'react',
72
+ 'react-dom',
73
+ 'tailwind-merge',
74
+ ],
75
+ devDependencies: [
76
+ '@tailwindcss/vite',
77
+ '@types/react',
78
+ '@types/react-dom',
79
+ '@vitejs/plugin-react',
80
+ 'tailwindcss',
81
+ 'typescript',
82
+ 'vite',
83
+ ],
84
+ },
85
+ content: {
86
+ dependencies: ['@atom63/mdx', '@mdx-js/react'],
87
+ devDependencies: [
88
+ '@mdx-js/rollup',
89
+ 'remark-frontmatter',
90
+ 'remark-gfm',
91
+ 'remark-mdx-frontmatter',
92
+ ],
93
+ },
94
+ portfolio: {
95
+ dependencies: ['@atom63/agent', '@atom63/widgets'],
96
+ devDependencies: [],
97
+ },
98
+ }
99
+
100
+ const allPackages = Object.values(layerPackages).flatMap(layer => [
101
+ ...layer.dependencies,
102
+ ...layer.devDependencies,
103
+ ])
104
+
105
+ const readJson = relative => JSON.parse(readFileSync(path.join(repoRoot, relative), 'utf8'))
106
+
107
+ /** `catalog:` entries from pnpm-workspace.yaml. */
108
+ function catalog() {
109
+ const source = readFileSync(path.join(repoRoot, 'pnpm-workspace.yaml'), 'utf8')
110
+ const block = /^catalog:\n((?: {2}.+\n)+)/m.exec(source)
111
+ if (!block) throw new Error('pnpm-workspace.yaml has no catalog')
112
+ return Object.fromEntries(
113
+ [...block[1].matchAll(/^ {2}'?([^':]+)'?:\s*(.+)$/gm)].map(([, name, range]) => [
114
+ name,
115
+ range.trim(),
116
+ ])
117
+ )
118
+ }
119
+
120
+ /**
121
+ * The version range for each dependency. Design system packages use their
122
+ * exact version: only the release that publishes them changes it. Other
123
+ * packages use the range this repo already tests with; an exact pin becomes
124
+ * a caret range so the app can take patch fixes.
125
+ */
126
+ /**
127
+ * The published package carries the versions in `versions.json`, written from
128
+ * this repo at pack time (`prepack`), because the repo files they come from
129
+ * do not ship. In the repo, the versions come from the repo.
130
+ */
131
+ const bakedVersionsPath = path.join(packageRoot, 'versions.json')
132
+
133
+ export function resolveVersions() {
134
+ if (!existsSync(path.join(repoRoot, 'pnpm-workspace.yaml')) && existsSync(bakedVersionsPath)) {
135
+ return JSON.parse(readFileSync(bakedVersionsPath, 'utf8'))
136
+ }
137
+ return versionsFromRepo()
138
+ }
139
+
140
+ /** Write the versions a published starter installs (the package's `prepack`). */
141
+ export function bakeVersions() {
142
+ const versions = versionsFromRepo()
143
+ writeFileSync(bakedVersionsPath, `${JSON.stringify(versions, null, 2)}\n`)
144
+ return versions
145
+ }
146
+
147
+ function versionsFromRepo() {
148
+ const pinned = catalog()
149
+ const docs = readJson('apps/docs/package.json')
150
+ const rootManifest = readJson('package.json')
151
+ const sources = [
152
+ { ...docs.dependencies, ...docs.devDependencies },
153
+ { ...rootManifest.dependencies, ...rootManifest.devDependencies },
154
+ ]
155
+ const versions = {}
156
+ for (const name of allPackages) {
157
+ if (atom63Packages[name]) {
158
+ versions[name] = readJson(`${atom63Packages[name]}/package.json`).version
159
+ continue
160
+ }
161
+ let range = sources.map(source => source[name]).find(value => value && value !== 'catalog:')
162
+ range ??= pinned[name] ?? starterOnly[name]
163
+ if (!range) throw new Error(`No version for ${name} in this repo`)
164
+ versions[name] = /^\d/.test(range) ? `^${range}` : range
165
+ }
166
+ return versions
167
+ }
168
+
169
+ function listFiles(directory, prefix = '') {
170
+ if (!existsSync(directory)) return []
171
+ return readdirSync(directory, { withFileTypes: true }).flatMap(entry => {
172
+ const relative = prefix ? `${prefix}/${entry.name}` : entry.name
173
+ return entry.isDirectory()
174
+ ? listFiles(path.join(directory, entry.name), relative)
175
+ : [{ relative, source: path.join(directory, entry.name) }]
176
+ })
177
+ }
178
+
179
+ /** The template files for `ids` and every block they use, keyed by their path in the project. */
180
+ export function templateFiles(ids) {
181
+ const index = createRequire(import.meta.url)('@atom63/cli/agent-index.json')
182
+ const byId = new Map(index.templates.map(entry => [entry.id, entry]))
183
+ const seen = new Map()
184
+ const visit = id => {
185
+ const entry = byId.get(id)
186
+ if (!entry) throw new Error(`No template "${id}" in the agent index`)
187
+ if (seen.has(id)) return
188
+ seen.set(id, entry)
189
+ for (const block of entry.blocksUsed) visit(block)
190
+ }
191
+ for (const id of ids) visit(id)
192
+ return new Map(
193
+ [...seen.values()].flatMap(entry =>
194
+ entry.files.map(file => [`src/templates/${file.path}`, file.source])
195
+ )
196
+ )
197
+ }
198
+
199
+ /** A package name from the directory name: lowercase, npm-safe. */
200
+ export function packageName(directory) {
201
+ const base = path.basename(path.resolve(directory))
202
+ const name = base
203
+ .toLowerCase()
204
+ .replace(/[^a-z0-9._-]+/g, '-')
205
+ .replace(/^[._-]+|[-]+$/g, '')
206
+ if (!name) throw new Error(`Cannot derive a package name from "${directory}"`)
207
+ return name
208
+ }
209
+
210
+ /** "my-new-site" → "My new site". */
211
+ export function titleFromName(name) {
212
+ const words = name.replace(/[-_.]+/g, ' ').trim()
213
+ return words[0].toUpperCase() + words.slice(1)
214
+ }
215
+
216
+ /**
217
+ * Every file of the new project, keyed by its path in the project.
218
+ * @param {{ name: string, kind?: string, title?: string, date?: string, versions?: Record<string, string> }} options
219
+ */
220
+ export function planProject({ name, kind = 'site', title = titleFromName(name), date, versions }) {
221
+ if (!kinds.includes(kind)) {
222
+ throw new Error(`Unknown kind "${kind}". Choose one of: ${kinds.join(', ')}`)
223
+ }
224
+ const resolved = versions ?? resolveVersions()
225
+ const today = date ?? new Date().toISOString().slice(0, 10)
226
+ const fill = text => text.replaceAll('{{title}}', title).replaceAll('{{date}}', today)
227
+
228
+ const files = new Map()
229
+ const layers = kindLayers[kind]
230
+ for (const layer of layers) {
231
+ for (const { relative, source } of listFiles(path.join(starterRoot, layer))) {
232
+ // npm drops .gitignore from published packages, so the template stores it as _gitignore.
233
+ const target = relative === '_gitignore' ? '.gitignore' : relative
234
+ files.set(target, fill(readFileSync(source, 'utf8')))
235
+ }
236
+ }
237
+
238
+ for (const [target, source] of templateFiles(kindTemplates[kind] ?? [])) {
239
+ files.set(target, source)
240
+ }
241
+
242
+ const pick = field =>
243
+ Object.fromEntries(
244
+ layers
245
+ .flatMap(layer => layerPackages[layer]?.[field] ?? [])
246
+ .sort()
247
+ .map(dependency => [dependency, resolved[dependency]])
248
+ )
249
+ const manifest = {
250
+ name,
251
+ version: '0.0.0',
252
+ private: true,
253
+ type: 'module',
254
+ scripts: {
255
+ dev: 'vite',
256
+ build: 'tsc --noEmit && vite build',
257
+ typecheck: 'tsc --noEmit',
258
+ preview: 'vite preview',
259
+ },
260
+ dependencies: pick('dependencies'),
261
+ devDependencies: pick('devDependencies'),
262
+ }
263
+ files.set('package.json', `${JSON.stringify(manifest, null, 2)}\n`)
264
+ files.set(
265
+ 'AGENTS.md',
266
+ `# ${title}\n\n${files.get('AGENTS.md') ?? ''}${agentsBlock({ variant: 'docs' })}\n`
267
+ )
268
+ return new Map([...files].sort(([left], [right]) => left.localeCompare(right)))
269
+ }
270
+
271
+ /** Write a planned project into `directory`, which must be missing or empty. */
272
+ export function writeProject(directory, files) {
273
+ if (existsSync(directory) && readdirSync(directory).length > 0) {
274
+ throw new Error(`${directory} is not empty. Choose a new directory.`)
275
+ }
276
+ for (const [relative, content] of files) {
277
+ const target = path.join(directory, relative)
278
+ mkdirSync(path.dirname(target), { recursive: true })
279
+ writeFileSync(target, content)
280
+ }
281
+ }
package/src/index.mjs ADDED
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Create a new project on the Atom63 design system.
4
+ *
5
+ * pnpm create @atom63 <directory> [--kind site] [--title "My site"]
6
+ *
7
+ * In the design system repo: pnpm create:app <directory>
8
+ */
9
+ import { realpathSync } from 'node:fs'
10
+ import path from 'node:path'
11
+ import process from 'node:process'
12
+ import { fileURLToPath } from 'node:url'
13
+ import { parseArgs } from 'node:util'
14
+
15
+ import { kinds, packageName, planProject, writeProject } from './generate.mjs'
16
+
17
+ export function main(argv) {
18
+ const { positionals, values } = parseArgs({
19
+ args: argv,
20
+ allowPositionals: true,
21
+ options: {
22
+ help: { type: 'boolean', short: 'h' },
23
+ kind: { type: 'string', default: 'site' },
24
+ title: { type: 'string' },
25
+ },
26
+ })
27
+ if (values.help || positionals.length !== 1) {
28
+ return {
29
+ exitCode: values.help ? 0 : 2,
30
+ output: `Usage: create-atom63 <directory> [--kind ${kinds.join('|')}] [--title "My site"]`,
31
+ }
32
+ }
33
+
34
+ const directory = path.resolve(positionals[0])
35
+ try {
36
+ const files = planProject({
37
+ name: packageName(directory),
38
+ kind: values.kind,
39
+ title: values.title,
40
+ })
41
+ writeProject(directory, files)
42
+ const relative = path.relative(process.cwd(), directory) || '.'
43
+ return {
44
+ exitCode: 0,
45
+ output: [
46
+ `Created ${relative} (${values.kind}, ${files.size} files).`,
47
+ '',
48
+ 'Next:',
49
+ ` cd ${relative}`,
50
+ ' pnpm install',
51
+ ' pnpm dev',
52
+ ].join('\n'),
53
+ }
54
+ } catch (error) {
55
+ return { exitCode: 1, output: error.message }
56
+ }
57
+ }
58
+
59
+ const invoked = process.argv[1] ? realpathSync(process.argv[1]) : ''
60
+ if (invoked === fileURLToPath(import.meta.url)) {
61
+ const { exitCode, output } = main(process.argv.slice(2))
62
+ ;(exitCode === 0 ? process.stdout : process.stderr).write(`${output}\n`)
63
+ process.exitCode = exitCode
64
+ }
@@ -0,0 +1,17 @@
1
+ This app is built on the Atom63 design system. Components come from `@atom63/ui-react` and tokens
2
+ from `@atom63/styles`. Its pages started as Atom63 page templates.
3
+
4
+ ## Project
5
+
6
+ - `pnpm dev` runs the app; `pnpm typecheck` and `pnpm build` must pass before a change is done.
7
+ - Routes live in `src/router.tsx`. The signed-in pages render inside `src/components/app-layout.tsx`,
8
+ which holds the app shell and its navigation; sign-in sits outside it.
9
+ - `src/templates` holds the page and block templates this app was created from. They are the
10
+ app's own code now: edit them in place, and replace their sample data (invoices, customers,
11
+ activity) with the product's.
12
+ - Start a new page from the closest template (see below), render its content inside the shell
13
+ route, and add it to the navigation in `app-layout.tsx`.
14
+ - Mode and theme are set once in `src/theme.tsx` through `Atom63Theme`. Style with tokens and the
15
+ Tailwind utilities mapped onto them (`bg-background`, `text-muted-foreground`, `border-border`).
16
+ - `npx shadcn add <component>` works (see `components.json`). Use it only for something the design
17
+ system does not offer; its components pick up the same tokens through the shadcn bridge.
@@ -0,0 +1,40 @@
1
+ # {{title}}
2
+
3
+ A product app built on the [Atom63 design system](https://system.atom63.io): React, TanStack Router
4
+ and Tailwind CSS, with every color, space and radius coming from the system's tokens. It starts
5
+ from the Atom63 page templates: an overview, a list with a detail view, settings, a first-run page
6
+ and sign-in.
7
+
8
+ ```bash
9
+ pnpm install
10
+ pnpm dev
11
+ ```
12
+
13
+ | Command | What it does |
14
+ | --- | --- |
15
+ | `pnpm dev` | Start the dev server |
16
+ | `pnpm build` | Typecheck and build to `dist/` |
17
+ | `pnpm typecheck` | Typecheck only |
18
+ | `pnpm preview` | Serve the built app |
19
+
20
+ ## Where things are
21
+
22
+ - `src/app.ts`: the product name.
23
+ - `src/router.tsx`: the routes. `/`, `/invoices`, `/settings` and `/welcome` share the app shell;
24
+ `/sign-in` sits outside it.
25
+ - `src/components/app-layout.tsx`: the app shell, its navigation and the appearance controls.
26
+ - `src/templates`: the page and block templates the app was created from, now the app's own code.
27
+ Their data is sample data: replace it with yours.
28
+ - `src/theme.tsx`: mode and theme, applied through `Atom63Theme` and remembered per browser.
29
+ - `src/styles.css`: Tailwind, the token stack and the component styles.
30
+
31
+ ## Using the design system
32
+
33
+ Prefer components from `@atom63/ui-react`; the [component docs](https://system.atom63.io) list
34
+ them with their contracts. Tailwind utilities such as `bg-background` and `text-muted-foreground`
35
+ resolve to the same tokens, so custom layout follows every theme and mode.
36
+
37
+ More page and block templates are in the [template registry](https://system.atom63.io/r/registry.json),
38
+ and `npx shadcn add https://system.atom63.io/r/<id>.json` adds one.
39
+
40
+ `AGENTS.md` tells coding agents how to use the design system here.
@@ -0,0 +1,4 @@
1
+ /** The product's name, shown in the app shell and the page titles. Change it first. */
2
+ export const app = {
3
+ title: '{{title}}',
4
+ }
@@ -0,0 +1,49 @@
1
+ import { DropdownMenuItem } from '@atom63/ui-react'
2
+ import { Link, Outlet, useLocation } from '@tanstack/react-router'
3
+ import { FileText, LayoutDashboard, Settings } from 'lucide-react'
4
+
5
+ import { app } from '../app'
6
+ import { AppShell, type AppShellLinkProps } from '../templates/blocks/app-shell/app-shell'
7
+ import { AppearanceControls } from '../theme'
8
+
9
+ const nav = [
10
+ { href: '/', icon: <LayoutDashboard aria-hidden />, label: 'Overview' },
11
+ { href: '/invoices', icon: <FileText aria-hidden />, label: 'Invoices' },
12
+ { href: '/settings', icon: <Settings aria-hidden />, label: 'Settings' },
13
+ ]
14
+
15
+ /* The signed-in user at the foot of the sidebar. Replace it with the session's
16
+ user, and the menu with the app's account actions. */
17
+ const user = {
18
+ detail: 'you@example.com',
19
+ menu: <DropdownMenuItem>Sign out</DropdownMenuItem>,
20
+ name: 'Your name',
21
+ }
22
+
23
+ /* The shell's links go through the router, so navigating keeps the shell. */
24
+ const routerLink = ({ href, ...props }: AppShellLinkProps) => <Link to={href} {...props} />
25
+
26
+ /*
27
+ * The app shell, rendered once around every signed-in page. Each route
28
+ * renders a template's content (DashboardContent, ListContent, …) inside it.
29
+ */
30
+ export function AppLayout() {
31
+ const { pathname } = useLocation()
32
+ return (
33
+ <AppShell
34
+ navItems={nav.map(item => ({ ...item, current: item.href === pathname }))}
35
+ productName={app.title}
36
+ renderLink={routerLink}
37
+ user={user}
38
+ topBarActions={
39
+ // Two rows of switches would not fit a phone's top bar; there the app
40
+ // keeps the stored or system appearance.
41
+ <div className="hidden sm:block">
42
+ <AppearanceControls />
43
+ </div>
44
+ }
45
+ >
46
+ <Outlet />
47
+ </AppShell>
48
+ )
49
+ }