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.
- package/CHANGELOG.md +56 -0
- package/LICENSE +21 -0
- package/README.md +662 -43
- package/dist/cli.js +151 -0
- package/dist/cli.test.js +191 -0
- package/package.json +28 -4
- package/templates/arch-ui/.arch/edges/decision_to_domain.json +0 -1
- package/templates/arch-ui/.arch/edges/milestone_to_task.json +0 -1
- package/templates/arch-ui/.arch/edges/task_to_decision.json +0 -1
- package/templates/arch-ui/.arch/edges/task_to_module.json +0 -1
- package/templates/arch-ui/.arch/graph.json +0 -1
- package/templates/arch-ui/.arch/nodes/decisions.json +0 -1
- package/templates/arch-ui/.arch/nodes/domains.json +0 -1
- package/templates/arch-ui/.arch/nodes/milestones.json +0 -1
- package/templates/arch-ui/.arch/nodes/modules.json +0 -1
- package/templates/arch-ui/.arch/nodes/tasks.json +0 -1
- package/templates/arch-ui/app/api/health/route.ts +5 -4
- package/templates/arch-ui/app/api/node-files/route.ts +6 -1
- package/templates/arch-ui/app/api/search/route.ts +0 -1
- package/templates/arch-ui/app/work/page.tsx +94 -64
- package/templates/arch-ui/components/app-shell.tsx +1 -7
- package/templates/arch-ui/components/graph/arch-node.tsx +13 -3
- package/templates/arch-ui/components/graph/build-graph-from-dataset.ts +6 -2
- package/templates/arch-ui/components/graph/build-initial-graph.ts +215 -221
- package/templates/arch-ui/components/graph/graph-types.ts +49 -49
- package/templates/arch-ui/components/graph/use-auto-layout.ts +51 -51
- package/templates/arch-ui/components/graph/use-connection-validation.ts +48 -48
- package/templates/arch-ui/components/graph/use-flow-persistence.ts +38 -38
- package/templates/arch-ui/components/graph-canvas.tsx +90 -74
- package/templates/arch-ui/components/inspector.tsx +56 -22
- package/templates/arch-ui/components/sidebar.tsx +18 -8
- package/templates/arch-ui/components/topbar.tsx +8 -11
- package/templates/arch-ui/components/work-table.tsx +1 -5
- package/templates/arch-ui/components/workspace-context.tsx +2 -1
- package/templates/arch-ui/eslint.config.js +2 -2
- package/templates/arch-ui/lib/graph-dataset.ts +4 -8
- package/templates/arch-ui/lib/graph-schema.ts +1 -4
- package/templates/arch-ui/package.json +0 -1
- package/templates/arch-ui/tsconfig.json +3 -11
- package/templates/architecture-specs/SPEC_TEMPLATE.md +49 -0
- package/templates/architecture-specs/example-system.md +42 -0
- package/templates/concept-map/concept-map.json +67 -0
- package/templates/decisions/DECISION_TEMPLATE.md +53 -0
- package/templates/decisions/README.md +19 -0
- package/templates/decisions/example-decision.md +45 -0
- package/templates/domains/DOMAIN_TEMPLATE.md +43 -0
- package/templates/domains/README.md +18 -0
- package/templates/domains/api.md +33 -0
- package/templates/domains/core.md +33 -0
- package/templates/domains/domains.json +19 -0
- package/templates/domains/ui.md +34 -0
- package/templates/foundation/goals.md +35 -0
- package/templates/foundation/project-overview.md +35 -0
- package/templates/foundation/prompt.md +23 -0
- package/templates/foundation/scope.md +35 -0
- package/templates/foundation/user-journey.md +37 -0
- package/templates/gap-closure/GAP_CLOSURE_TEMPLATE.md +50 -0
- package/templates/gap-closure/README.md +19 -0
- package/templates/gap-closure/example-gap-closure.md +43 -0
- package/templates/validation-hooks/.githooks/pre-commit +4 -0
- package/templates/validation-hooks/README.md +20 -0
- 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
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/create-project-arch)
|
|
4
|
+
[](LICENSE)
|
|
4
5
|
|
|
5
|
-
|
|
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
|
-
|
|
25
|
+
Or with pnpm:
|
|
8
26
|
|
|
9
27
|
```bash
|
|
10
|
-
|
|
28
|
+
pnpm create project-arch my-awesome-project
|
|
11
29
|
```
|
|
12
30
|
|
|
13
|
-
|
|
31
|
+
Or with yarn:
|
|
14
32
|
|
|
15
|
-
|
|
33
|
+
```bash
|
|
34
|
+
yarn create project-arch my-awesome-project
|
|
35
|
+
```
|
|
16
36
|
|
|
17
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
+
```
|