create-project-arch 1.1.0 โ†’ 1.3.0

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 (62) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/LICENSE +21 -0
  3. package/README.md +662 -43
  4. package/dist/cli.js +151 -0
  5. package/dist/cli.test.js +191 -0
  6. package/package.json +28 -4
  7. package/templates/arch-ui/.arch/edges/decision_to_domain.json +0 -1
  8. package/templates/arch-ui/.arch/edges/milestone_to_task.json +0 -1
  9. package/templates/arch-ui/.arch/edges/task_to_decision.json +0 -1
  10. package/templates/arch-ui/.arch/edges/task_to_module.json +0 -1
  11. package/templates/arch-ui/.arch/graph.json +0 -1
  12. package/templates/arch-ui/.arch/nodes/decisions.json +0 -1
  13. package/templates/arch-ui/.arch/nodes/domains.json +0 -1
  14. package/templates/arch-ui/.arch/nodes/milestones.json +0 -1
  15. package/templates/arch-ui/.arch/nodes/modules.json +0 -1
  16. package/templates/arch-ui/.arch/nodes/tasks.json +0 -1
  17. package/templates/arch-ui/app/api/health/route.ts +5 -4
  18. package/templates/arch-ui/app/api/node-files/route.ts +6 -1
  19. package/templates/arch-ui/app/api/search/route.ts +0 -1
  20. package/templates/arch-ui/app/work/page.tsx +94 -64
  21. package/templates/arch-ui/components/app-shell.tsx +1 -7
  22. package/templates/arch-ui/components/graph/arch-node.tsx +13 -3
  23. package/templates/arch-ui/components/graph/build-graph-from-dataset.ts +6 -2
  24. package/templates/arch-ui/components/graph/build-initial-graph.ts +215 -221
  25. package/templates/arch-ui/components/graph/graph-types.ts +49 -49
  26. package/templates/arch-ui/components/graph/use-auto-layout.ts +51 -51
  27. package/templates/arch-ui/components/graph/use-connection-validation.ts +48 -48
  28. package/templates/arch-ui/components/graph/use-flow-persistence.ts +38 -38
  29. package/templates/arch-ui/components/graph-canvas.tsx +90 -74
  30. package/templates/arch-ui/components/inspector.tsx +56 -22
  31. package/templates/arch-ui/components/sidebar.tsx +18 -8
  32. package/templates/arch-ui/components/topbar.tsx +8 -11
  33. package/templates/arch-ui/components/work-table.tsx +1 -5
  34. package/templates/arch-ui/components/workspace-context.tsx +2 -1
  35. package/templates/arch-ui/eslint.config.js +2 -2
  36. package/templates/arch-ui/lib/graph-dataset.ts +4 -8
  37. package/templates/arch-ui/lib/graph-schema.ts +1 -4
  38. package/templates/arch-ui/package.json +0 -1
  39. package/templates/arch-ui/tsconfig.json +3 -11
  40. package/templates/architecture-specs/SPEC_TEMPLATE.md +49 -0
  41. package/templates/architecture-specs/example-system.md +42 -0
  42. package/templates/concept-map/concept-map.json +67 -0
  43. package/templates/decisions/DECISION_TEMPLATE.md +53 -0
  44. package/templates/decisions/README.md +19 -0
  45. package/templates/decisions/example-decision.md +45 -0
  46. package/templates/domains/DOMAIN_TEMPLATE.md +43 -0
  47. package/templates/domains/README.md +18 -0
  48. package/templates/domains/api.md +33 -0
  49. package/templates/domains/core.md +33 -0
  50. package/templates/domains/domains.json +19 -0
  51. package/templates/domains/ui.md +34 -0
  52. package/templates/foundation/goals.md +35 -0
  53. package/templates/foundation/project-overview.md +35 -0
  54. package/templates/foundation/prompt.md +23 -0
  55. package/templates/foundation/scope.md +35 -0
  56. package/templates/foundation/user-journey.md +37 -0
  57. package/templates/gap-closure/GAP_CLOSURE_TEMPLATE.md +50 -0
  58. package/templates/gap-closure/README.md +19 -0
  59. package/templates/gap-closure/example-gap-closure.md +43 -0
  60. package/templates/validation-hooks/.githooks/pre-commit +4 -0
  61. package/templates/validation-hooks/README.md +20 -0
  62. package/templates/validation-hooks/scripts/validate.sh +9 -0
package/README.md CHANGED
@@ -1,58 +1,677 @@
1
1
  # create-project-arch
2
2
 
3
- A scaffolding tool designed to bootstrap a new Turborepo monorepo with `project-arch` integrated natively.
3
+ [![NPM Version](https://img.shields.io/npm/v/create-project-arch.svg)](https://www.npmjs.com/package/create-project-arch)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
4
5
 
5
- ## Usage
6
+ A scaffolding tool designed to bootstrap new projects with `project-arch` integrated natively. Create production-ready monorepos with architecture management built-in from day one.
7
+
8
+ ## Features
9
+
10
+ ๐Ÿš€ **Quick Setup** - Get started with architecture-first development in minutes
11
+ ๐Ÿ“ฆ **Modern Stack** - Next.js, React, TypeScript, and Turborepo
12
+ ๐ŸŽจ **UI Templates** - Pre-built architecture visualization components
13
+ ๐Ÿ—๏ธ **Structured Architecture** - Phases, milestones, and tasks from the start
14
+ ๐Ÿ“ **ADR Support** - Architecture decision records included
15
+ ๐Ÿ”ง **Customizable** - Choose your package manager and template options
16
+
17
+ ## Quick Start
18
+
19
+ Create a new project with npx (no installation required):
20
+
21
+ ```bash
22
+ npx create-project-arch my-awesome-project
23
+ ```
6
24
 
7
- You can use `npx` or `pnpx` to run the scaffolder directly:
25
+ Or with pnpm:
8
26
 
9
27
  ```bash
10
- npx create-project-arch my-new-architecture
28
+ pnpm create project-arch my-awesome-project
11
29
  ```
12
30
 
13
- ### Under the Hood
31
+ Or with yarn:
14
32
 
15
- When executed, `create-project-arch`:
33
+ ```bash
34
+ yarn create project-arch my-awesome-project
35
+ ```
16
36
 
17
- 1. Runs `npx create-turbo` to generate the raw workspace.
18
- 2. Invokes `pa init` to seed an `arch-model/` directory.
19
- 3. Injects architecture applications (`apps/arch` and `packages/ui`) from internal templates.
20
- 4. Auto-wires the `package.json` configurations so `project-arch` commands are available out of the box.
37
+ Then follow the interactive prompts to configure your project!
21
38
 
22
- ## Options
39
+ ## Usage
23
40
 
24
41
  ```bash
25
42
  create-project-arch <project-name> [options]
43
+ ```
44
+
45
+ ### Options
46
+
47
+ | Option | Description | Default |
48
+ | ------------------- | ---------------------------------------- | --------- |
49
+ | `--template <name>` | Template to use | `arch-ui` |
50
+ | `--pm <name>` | Package manager (pnpm, npm, yarn) | `pnpm` |
51
+ | `--force` | Allow scaffolding in non-empty directory | `false` |
52
+
53
+ ### Examples
54
+
55
+ Basic usage:
56
+
57
+ ```bash
58
+ # Create with default options (pnpm, arch-ui template)
59
+ npx create-project-arch my-project
60
+
61
+ # Specify package manager
62
+ npx create-project-arch my-project --pm npm
63
+
64
+ # Use specific template
65
+ npx create-project-arch my-project --template ui-package
66
+
67
+ # Force creation in existing directory
68
+ npx create-project-arch my-project --force
69
+ ```
70
+
71
+ ## What Gets Created?
72
+
73
+ When you run `create-project-arch`, it:
74
+
75
+ 1. **Creates a Turborepo monorepo** with modern tooling
76
+ 2. **Initializes project-arch** with `arch-model/` directory
77
+ 3. **Scaffolds template applications** based on your selection
78
+ 4. **Configures package scripts** for architecture management
79
+ 5. **Installs dependencies** using your chosen package manager
80
+
81
+ ### Project Structure
82
+
83
+ ```bash
84
+ my-awesome-project/
85
+ โ”œโ”€โ”€ apps/
86
+ โ”‚ โ”œโ”€โ”€ arch/ # Architecture UI (Next.js app)
87
+ โ”‚ โ”‚ โ”œโ”€โ”€ app/
88
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ page.tsx # Dashboard
89
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ phases/ # Phase explorer
90
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ milestones/ # Milestone viewer
91
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ tasks/ # Task manager
92
+ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ decisions/ # ADR browser
93
+ โ”‚ โ”‚ โ””โ”€โ”€ components/
94
+ โ”‚ โ”‚ โ”œโ”€โ”€ PhaseCard.tsx
95
+ โ”‚ โ”‚ โ”œโ”€โ”€ TaskList.tsx
96
+ โ”‚ โ”‚ โ””โ”€โ”€ MilestoneTimeline.tsx
97
+ โ”‚ โ””โ”€โ”€ web/ # Your main application
98
+ โ”œโ”€โ”€ packages/
99
+ โ”‚ โ””โ”€โ”€ ui/ # Shared UI components
100
+ โ”‚ โ”œโ”€โ”€ src/
101
+ โ”‚ โ”‚ โ”œโ”€โ”€ button.tsx
102
+ โ”‚ โ”‚ โ”œโ”€โ”€ card.tsx
103
+ โ”‚ โ”‚ โ””โ”€โ”€ ...
104
+ โ”‚ โ””โ”€โ”€ package.json
105
+ โ”œโ”€โ”€ arch-model/ # Architecture directory
106
+ โ”‚ โ”œโ”€โ”€ phases/
107
+ โ”‚ โ”‚ โ””โ”€โ”€ phase-1/
108
+ โ”‚ โ”‚ โ””โ”€โ”€ milestones/
109
+ โ”‚ โ”œโ”€โ”€ decisions/
110
+ โ”‚ โ”œโ”€โ”€ docs/
111
+ โ”‚ โ””โ”€โ”€ concept-map.json # Concept-to-module traceability map
112
+ โ”œโ”€โ”€ architecture/
113
+ โ”‚ โ”œโ”€โ”€ foundation/ # Milestone 1 prerequisite docs
114
+ โ”‚ โ”‚ โ”œโ”€โ”€ prompt.md
115
+ โ”‚ โ”‚ โ”œโ”€โ”€ project-overview.md
116
+ โ”‚ โ”‚ โ”œโ”€โ”€ goals.md
117
+ โ”‚ โ”‚ โ”œโ”€โ”€ user-journey.md
118
+ โ”‚ โ”‚ โ””โ”€โ”€ scope.md
119
+ โ”‚ โ”œโ”€โ”€ architecture/ # System architecture specs
120
+ โ”‚ โ”‚ โ”œโ”€โ”€ SPEC_TEMPLATE.md
121
+ โ”‚ โ”‚ โ””โ”€โ”€ example-system.md
122
+ โ”‚ โ”œโ”€โ”€ decisions/ # Architecture decision records
123
+ โ”‚ โ”œโ”€โ”€ DECISION_TEMPLATE.md
124
+ โ”‚ โ””โ”€โ”€ example-decision.md
125
+ โ”‚ โ””โ”€โ”€ reference/ # Reusable quality and closure references
126
+ โ”‚ โ”œโ”€โ”€ GAP_CLOSURE_TEMPLATE.md
127
+ โ”‚ โ””โ”€โ”€ example-gap-closure.md
128
+ โ”œโ”€โ”€ arch-domains/ # Domain boundaries and ownership
129
+ โ”‚ โ”œโ”€โ”€ README.md
130
+ โ”‚ โ”œโ”€โ”€ domains.json
131
+ โ”‚ โ”œโ”€โ”€ DOMAIN_TEMPLATE.md
132
+ โ”‚ โ”œโ”€โ”€ core.md
133
+ โ”‚ โ”œโ”€โ”€ ui.md
134
+ โ”‚ โ””โ”€โ”€ api.md
135
+ โ”œโ”€โ”€ scripts/
136
+ โ”‚ โ””โ”€โ”€ validate.sh # Local architecture validation hook
137
+ โ”œโ”€โ”€ .githooks/
138
+ โ”‚ โ””โ”€โ”€ pre-commit # Optional local pre-commit validation hook
139
+ โ”œโ”€โ”€ package.json
140
+ โ”œโ”€โ”€ turbo.json
141
+ โ””โ”€โ”€ pnpm-workspace.yaml
142
+ ```
143
+
144
+ ### Milestone 1 Prerequisites
145
+
146
+ Scaffolded projects include these foundation docs by default under `architecture/foundation/`:
147
+
148
+ - `prompt.md` (canonical source brief)
149
+ - `project-overview.md`
150
+ - `goals.md`
151
+ - `user-journey.md`
152
+ - `scope.md`
153
+
154
+ Complete these files first before implementing milestone tasks.
155
+
156
+ ### Domain Spec Scaffold
157
+
158
+ Scaffolded projects also include baseline domain specs under `arch-domains/`:
159
+
160
+ - `domains.json` with starter domains (`core`, `ui`, `api`)
161
+ - `DOMAIN_TEMPLATE.md` with required sections:
162
+ - Responsibilities
163
+ - Primary Data Ownership
164
+ - Interface Contracts
165
+ - Non-Goals
166
+ - Milestone Mapping
167
+ - Starter specs: `core.md`, `ui.md`, and `api.md`
168
+
169
+ ### System Architecture Spec Scaffold
170
+
171
+ Scaffolded projects include reusable architecture specs under `architecture/architecture/`:
172
+
173
+ - `SPEC_TEMPLATE.md` with required sections:
174
+ - Purpose
175
+ - Scope (in-scope / out-of-scope)
176
+ - Key Definitions
177
+ - Design
178
+ - Data Model
179
+ - Owning Domain
180
+ - MVP Constraints
181
+ - `example-system.md` showing a realistic completed reference
182
+
183
+ ### Concept-To-Module Traceability Scaffold
184
+
185
+ Scaffolded projects include `arch-model/concept-map.json` with:
186
+
187
+ - concept metadata (`id`, `name`, `description`)
188
+ - owning domain assignment
189
+ - module responsibilities
190
+ - implementation surfaces (API/UI/component/code paths)
191
+ - concept dependencies
192
+ - domain-module mapping and implementation checklist placeholders
193
+
194
+ ### Decision Record Scaffold
195
+
196
+ Scaffolded projects include architecture decision templates under `architecture/decisions/`:
197
+
198
+ - `DECISION_TEMPLATE.md` with structured frontmatter (`id`, `title`, `slug`, `status`, timestamps, `relatedTasks`, `relatedDocs`, `supersedes`)
199
+ - Required sections:
200
+ - Context
201
+ - Decision
202
+ - Rationale
203
+ - Alternatives Considered
204
+ - Affected Artifacts
205
+ - Implementation Status Checklist
206
+ - `example-decision.md` demonstrating a completed decision record
207
+
208
+ Use `pa decision new` for operational decision creation linked into roadmap decision indexes.
209
+
210
+ ### Milestone Gap-Closure Report Scaffold
211
+
212
+ Scaffolded projects include closure report artifacts under `architecture/reference/`:
213
+
214
+ - `GAP_CLOSURE_TEMPLATE.md` with sections for:
215
+ - Executive Summary
216
+ - Gap Categories And Resolutions
217
+ - Layer Synchronization Check
218
+ - Coverage Audit
219
+ - Remaining Gaps And Follow-On Items
220
+ - Template Improvement Feedback
221
+ - `example-gap-closure.md` demonstrating a completed closure report
222
+
223
+ Recommended workflow:
224
+
225
+ 1. Complete milestone tasks and decision updates.
226
+ 2. Run `pa check` and `pa report`.
227
+ 3. Record closure outcomes in milestone closure report.
228
+ 4. Track remaining gaps as follow-on tasks/decisions.
229
+
230
+ ### Local Validation Hook Scaffold
231
+
232
+ Scaffolded projects include local validation automation assets:
233
+
234
+ - `scripts/validate.sh` runs:
235
+ - `pnpm arch:check`
236
+ - `pnpm arch:report`
237
+ - Optional local hook example:
238
+ - `.githooks/pre-commit`
239
+
240
+ Use these hooks to keep architecture validation consistent in local workflows.
241
+
242
+ ## Available Templates
243
+
244
+ ### arch-ui (Default)
245
+
246
+ A complete Next.js application for visualizing and managing your project architecture.
247
+
248
+ **Includes:**
249
+
250
+ - ๐Ÿ“Š Dashboard with project overview
251
+ - ๐Ÿ“‹ Phase and milestone explorer
252
+ - โœ… Task management interface
253
+ - ๐Ÿ“ ADR browser and editor
254
+ - ๐Ÿ“ˆ Progress tracking and metrics
255
+ - ๐ŸŽจ Beautiful UI with Tailwind CSS
256
+
257
+ **Perfect for:**
258
+
259
+ - Teams that want visual architecture management
260
+ - Projects with multiple phases and complex dependencies
261
+ - Organizations adopting architecture-first development
262
+
263
+ **Technologies:**
264
+
265
+ - Next.js 14+ (App Router)
266
+ - React 18+
267
+ - TypeScript
268
+ - Tailwind CSS
269
+ - project-arch SDK
270
+
271
+ ### ui-package
272
+
273
+ A starter template for building a shared React component library.
274
+
275
+ **Includes:**
276
+
277
+ - ๐ŸŽจ Basic UI components (Button, Card, Input, etc.)
278
+ - ๐Ÿ“š Component documentation structure
279
+ - ๐Ÿ”ง TypeScript configuration
280
+ - ๐Ÿ“ฆ Optimized for publishing
281
+
282
+ **Perfect for:**
283
+
284
+ - Building design systems
285
+ - Creating shared component libraries
286
+ - Publishing npm packages
287
+
288
+ **Technologies:**
289
+
290
+ - React 18+
291
+ - TypeScript
292
+ - ESLint configuration
293
+
294
+ ## Getting Started with Your New Project
295
+
296
+ After scaffolding completes:
297
+
298
+ ### 1. Navigate to your project
299
+
300
+ ```bash
301
+ cd my-awesome-project
302
+ ```
303
+
304
+ ### 2. Install dependencies (if not auto-installed)
305
+
306
+ ```bash
307
+ pnpm install
308
+ ```
309
+
310
+ ### 3. Start the development server
311
+
312
+ ```bash
313
+ # Start all apps
314
+ pnpm dev
315
+
316
+ # Or start specific app
317
+ pnpm dev --filter=arch
318
+ ```
319
+
320
+ The architecture UI will be available at `http://localhost:3000`
321
+
322
+ ### 4. Initialize your architecture
323
+
324
+ The project comes with a sample architecture, but you can customize it:
325
+
326
+ ```bash
327
+ # Create a new phase
328
+ pnpm arch phase new phase-1
329
+
330
+ # Create a milestone
331
+ pnpm arch milestone new phase-1 milestone-1
332
+
333
+ # Create tasks
334
+ pnpm arch task new phase-1 milestone-1
335
+
336
+ # Document a decision
337
+ pnpm arch decision new use-react
338
+
339
+ # Run validations
340
+ pnpm arch check
341
+ ```
342
+
343
+ ### 5. View your architecture
344
+
345
+ Open the architecture UI at `http://localhost:3000` to see:
346
+
347
+ - Visual representation of phases and milestones
348
+ - Task progress and dependencies
349
+ - Architecture decision records
350
+ - Project metrics and reports
351
+
352
+ ## Architecture Management Commands
353
+
354
+ Your scaffolded project includes these scripts in `package.json`:
355
+
356
+ ```json
357
+ {
358
+ "scripts": {
359
+ "dev": "turbo dev",
360
+ "build": "turbo build",
361
+ "arch": "pa",
362
+ "arch:check": "pa check",
363
+ "arch:report": "pa report",
364
+ "arch:docs": "pa docs"
365
+ }
366
+ }
367
+ ```
368
+
369
+ ### Available Commands
370
+
371
+ ```bash
372
+ # Initialize architecture (already done during scaffolding)
373
+ pnpm arch init
374
+
375
+ # Create and manage phases
376
+ pnpm arch phase new <phase-id>
377
+ pnpm arch phase list
378
+
379
+ # Create and manage milestones
380
+ pnpm arch milestone new <phase> <milestone>
381
+ pnpm arch milestone list <phase>
382
+
383
+ # Create and manage tasks
384
+ pnpm arch task new <phase> <milestone>
385
+ pnpm arch task discover <phase> <milestone> --from <task-id>
386
+ pnpm arch task idea <phase> <milestone>
387
+ pnpm arch task lanes <phase> <milestone>
388
+
389
+ # Document decisions
390
+ pnpm arch decision new <decision-id>
391
+ pnpm arch decision list
392
+
393
+ # Validation and reporting
394
+ pnpm arch check
395
+ pnpm arch report
396
+ pnpm arch docs
397
+ ```
398
+
399
+ ## Developing Templates (For Contributors)
400
+
401
+ If you want to customize the templates or contribute new ones:
402
+
403
+ ### 1. Initialize the Sandbox
404
+
405
+ ```bash
406
+ pnpm run sandbox:init
407
+ ```
408
+
409
+ This creates a `testProject/` directory with the scaffolded templates.
410
+
411
+ ### 2. Start Development
26
412
 
27
- Options:
28
- --template <name> template (default: "nextjs-turbo")
29
- --apps <items> comma-separated apps (default: "web,docs")
30
- --pm <name> package manager (default: "pnpm")
31
- --with-ai create ai/indexing directory (default: false)
32
- --with-docs-site create docs app (default: enabled)
33
- --force allow scaffolding in a non-empty target directory
34
- ```
35
-
36
- ## Developing the Architecture UI (Arch-UI)
37
- The `arch-ui` Next.js application and `@repo/ui` packages are stored as static templates inside `templates/`. To iterate on them with full IDE support and hot-reloading, use the Sandbox DX flow provided in the monorepo root:
38
-
39
- 1. **Initialize the Sandbox:**
40
- ```bash
41
- pnpm run sandbox:init
42
- ```
43
- *This scaffolds `testProject` and runs `pnpm install` inside it.*
44
-
45
- 2. **Start the Dev Server:**
46
- ```bash
47
- pnpm run sandbox:dev
48
- ```
49
- *This boots up Next.js for the `arch-ui` inside the sandbox on port 4020.*
50
-
51
- 3. **Develop & Iterate:**
52
- Open the files located in `testProject/apps/arch/` and `testProject/packages/ui/`. Your changes will hot-reload.
53
-
54
- 4. **Sync Changes Back:**
55
- When you are satisfied with your UI changes, sync them back to the static `templates/` directory so they are included in the next CLI release:
56
- ```bash
57
- pnpm run sandbox:sync
58
- ```
413
+ ```bash
414
+ pnpm run sandbox:dev
415
+ ```
416
+
417
+ This starts the Next.js dev server for the arch-ui template at `http://localhost:4020`.
418
+
419
+ ### 3. Make Changes
420
+
421
+ Edit files in `testProject/apps/arch/` and `testProject/packages/ui/`. Changes will hot-reload.
422
+
423
+ ### 4. Sync Changes Back
424
+
425
+ When satisfied with your changes:
426
+
427
+ ```bash
428
+ pnpm run sandbox:sync
429
+ ```
430
+
431
+ This copies your changes back to the `templates/` directory so they're included in the next release.
432
+
433
+ ### 5. Test Scaffolding
434
+
435
+ ```bash
436
+ # Build the CLI
437
+ pnpm build
438
+
439
+ # Test scaffolding
440
+ node dist/cli.js test-output --force
441
+ ```
442
+
443
+ ## Template Structure
444
+
445
+ Templates are stored in `templates/` directory:
446
+
447
+ ```bash
448
+ templates/
449
+ โ”œโ”€โ”€ arch-ui/
450
+ โ”‚ โ”œโ”€โ”€ package.json
451
+ โ”‚ โ”œโ”€โ”€ next.config.js
452
+ โ”‚ โ”œโ”€โ”€ tailwind.config.ts
453
+ โ”‚ โ”œโ”€โ”€ app/
454
+ โ”‚ โ”‚ โ”œโ”€โ”€ page.tsx
455
+ โ”‚ โ”‚ โ”œโ”€โ”€ layout.tsx
456
+ โ”‚ โ”‚ โ””โ”€โ”€ ...
457
+ โ”‚ โ””โ”€โ”€ components/
458
+ โ”‚ โ””โ”€โ”€ ...
459
+ โ””โ”€โ”€ ui-package/
460
+ โ”œโ”€โ”€ package.json
461
+ โ”œโ”€โ”€ tsconfig.json
462
+ โ””โ”€โ”€ src/
463
+ โ””โ”€โ”€ ...
464
+ ```
465
+
466
+ ### Creating a New Template
467
+
468
+ 1. Create a new directory in `templates/`
469
+ 2. Add all necessary files for the template
470
+ 3. Use placeholders for project-specific values:
471
+ - `{{PROJECT_NAME}}` - Replaced with the project name
472
+ - `{{PACKAGE_MANAGER}}` - Replaced with pm choice
473
+ 4. Update the CLI to recognize the new template
474
+ 5. Add documentation
475
+
476
+ ## Configuration
477
+
478
+ ### Package Manager Detection
479
+
480
+ The tool automatically detects and uses the package manager you invoked it with:
481
+
482
+ ```bash
483
+ npx create-project-arch my-app # Uses npm
484
+ pnpm create project-arch my-app # Uses pnpm
485
+ yarn create project-arch my-app # Uses yarn
486
+ ```
487
+
488
+ You can override with `--pm`:
489
+
490
+ ```bash
491
+ npx create-project-arch my-app --pm pnpm
492
+ ```
493
+
494
+ ### Template Selection
495
+
496
+ Choose a template with `--template`:
497
+
498
+ ```bash
499
+ npx create-project-arch my-app --template ui-package
500
+ ```
501
+
502
+ ## Troubleshooting
503
+
504
+ ### Installation Fails
505
+
506
+ **Issue**: Dependencies fail to install
507
+
508
+ **Solution**:
509
+
510
+ ```bash
511
+ # Clear cache and retry
512
+ pnpm store prune
513
+ pnpm install
514
+ ```
515
+
516
+ ### Port Already in Use
517
+
518
+ **Issue**: Dev server can't start (port 3000 in use)
519
+
520
+ **Solution**:
521
+
522
+ ```bash
523
+ # Use a different port
524
+ PORT=3001 pnpm dev
525
+ ```
526
+
527
+ ### Template Not Found
528
+
529
+ **Issue**: `Template 'xyz' not found`
530
+
531
+ **Solution**: Check available templates:
532
+
533
+ ```bash
534
+ npx create-project-arch --help
535
+ ```
536
+
537
+ Valid templates: `arch-ui`, `ui-package`
538
+
539
+ ### Force Flag Required
540
+
541
+ **Issue**: `Directory not empty`
542
+
543
+ **Solution**: Use `--force` flag to scaffold in existing directory:
544
+
545
+ ```bash
546
+ npx create-project-arch my-app --force
547
+ ```
548
+
549
+ **Warning**: This will overwrite existing files!
550
+
551
+ ## Examples
552
+
553
+ ### Create a Team Project
554
+
555
+ ```bash
556
+ # Scaffold with architecture UI
557
+ npx create-project-arch team-project
558
+
559
+ # Navigate and start
560
+ cd team-project
561
+ pnpm install
562
+ pnpm dev
563
+
564
+ # Set up initial architecture
565
+ pnpm arch phase new foundation
566
+ pnpm arch milestone new foundation mvp
567
+ pnpm arch task new foundation mvp
568
+ ```
569
+
570
+ ### Create a Component Library
571
+
572
+ ```bash
573
+ # Use ui-package template
574
+ npx create-project-arch my-ui-lib --template ui-package
575
+
576
+ cd my-ui-lib
577
+ pnpm install
578
+
579
+ # Build the library
580
+ pnpm build
581
+
582
+ # Develop with hot reload
583
+ pnpm dev
584
+ ```
585
+
586
+ ### Quick Prototype
587
+
588
+ ```bash
589
+ # Use npm for simplicity
590
+ npx create-project-arch prototype --pm npm
591
+
592
+ cd prototype
593
+ npm install
594
+ npm run dev
595
+ ```
596
+
597
+ ## Migration from Existing Projects
598
+
599
+ To add project-arch to an existing project:
600
+
601
+ ### 1. Install project-arch
602
+
603
+ ```bash
604
+ pnpm add project-arch -w
605
+ ```
606
+
607
+ ### 2. Initialize architecture
608
+
609
+ ```bash
610
+ pnpm exec pa init
611
+ ```
612
+
613
+ ### 3. (Optional) Copy template files manually from this repository
614
+
615
+ ## API Reference (Programmatic Usage)
616
+
617
+ You can use create-project-arch programmatically:
618
+
619
+ ```typescript
620
+ import { scaffold } from "create-project-arch";
621
+
622
+ await scaffold({
623
+ projectName: "my-project",
624
+ template: "arch-ui",
625
+ packageManager: "pnpm",
626
+ targetDir: "/path/to/project",
627
+ force: false,
628
+ });
629
+ ```
630
+
631
+ ## Contributing
632
+
633
+ We welcome contributions! See [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines.
634
+
635
+ ### Areas for Contribution
636
+
637
+ - ๐ŸŽจ New templates
638
+ - ๐Ÿ› Bug fixes
639
+ - ๐Ÿ“š Documentation improvements
640
+ - โœจ Feature enhancements
641
+ - ๐Ÿงช Test coverage
642
+
643
+ ## Changelog
644
+
645
+ See [CHANGELOG.md](CHANGELOG.md) for version history and updates.
646
+
647
+ ## License
648
+
649
+ MIT License - see [LICENSE](LICENSE) for details.
650
+
651
+ ## Related Projects
652
+
653
+ - [project-arch](https://www.npmjs.com/package/project-arch) - Core CLI and SDK
654
+ - [Turborepo](https://turbo.build/) - High-performance build system
655
+ - [Next.js](https://nextjs.org/) - React framework
656
+
657
+ ## Support
658
+
659
+ - ๐Ÿ“– [Documentation](https://github.com/project-arch/project-arch-system#readme)
660
+ - ๐Ÿ› [Issue Tracker](https://github.com/project-arch/project-arch-system/issues)
661
+ - ๐Ÿ’ฌ [Discussions](https://github.com/project-arch/project-arch-system/discussions)
662
+
663
+ ## Acknowledgments
664
+
665
+ Built with:
666
+
667
+ - [Commander.js](https://github.com/tj/commander.js) - CLI framework
668
+ - [fs-extra](https://github.com/jprichardson/node-fs-extra) - File system utilities
669
+ - [project-arch](https://github.com/project-arch/project-arch-system) - Architecture management
670
+
671
+ ---
672
+
673
+ **Ready to build architecture-first?** ๐Ÿš€
674
+
675
+ ```bash
676
+ npx create-project-arch my-next-project
677
+ ```