scale-stack 0.0.1-alpha.2 → 0.0.1

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 (45) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +97 -3
  3. package/dist/index.js +3858 -124
  4. package/package.json +7 -2
  5. package/templates/ai-chat/chat-panel.tsx.ejs +70 -0
  6. package/templates/ai-chat/layout.tsx.ejs +39 -0
  7. package/templates/ai-chat/page.tsx.ejs +31 -0
  8. package/templates/ai-chat/route.ts.ejs +68 -0
  9. package/templates/ai-chat/use-chat.ts.ejs +26 -0
  10. package/templates/analytics/analytics-provider.tsx.ejs +32 -0
  11. package/templates/analytics/analytics.ts.ejs +40 -0
  12. package/templates/auth/auth-client.ts.ejs +7 -0
  13. package/templates/auth/auth.ts.ejs +45 -0
  14. package/templates/auth/route.ts.ejs +4 -0
  15. package/templates/auth/sign-in-page.tsx.ejs +122 -0
  16. package/templates/auth/sign-up-page.tsx.ejs +137 -0
  17. package/templates/auth/unauthorized.tsx.ejs +28 -0
  18. package/templates/core/layout.tsx.ejs +36 -0
  19. package/templates/core/loading.tsx.ejs +7 -0
  20. package/templates/core/next.config.ts.ejs +33 -0
  21. package/templates/error-handling/catch-all-not-found-page.tsx.ejs +5 -0
  22. package/templates/error-handling/error.tsx.ejs +33 -0
  23. package/templates/error-handling/global-error.tsx.ejs +32 -0
  24. package/templates/error-handling/not-found.tsx.ejs +28 -0
  25. package/templates/eslint-prettier/.prettierignore.ejs +29 -0
  26. package/templates/eslint-prettier/eslint.config.mjs.ejs +31 -0
  27. package/templates/form-handling/dashboard-page.tsx.ejs +33 -0
  28. package/templates/form-handling/example-form-action.ts.ejs +50 -0
  29. package/templates/form-handling/example-form-schema.ts.ejs +87 -0
  30. package/templates/form-handling/example-form.tsx.ejs +428 -0
  31. package/templates/i18n/ar.json.ejs +77 -0
  32. package/templates/i18n/en.json.ejs +77 -0
  33. package/templates/i18n/locale-layout.tsx.ejs +45 -0
  34. package/templates/i18n/navigation.ts.ejs +5 -0
  35. package/templates/i18n/next-intl.d.ts.ejs +9 -0
  36. package/templates/i18n/request.ts.ejs +15 -0
  37. package/templates/i18n/routing.ts.ejs +7 -0
  38. package/templates/orm/prisma.config.ts.ejs +12 -0
  39. package/templates/orm/prisma.ts.ejs +17 -0
  40. package/templates/orm/schema.prisma.ejs +8 -0
  41. package/templates/pre-commit/prek.toml.ejs +35 -0
  42. package/templates/proxy/proxy.ts.ejs +81 -0
  43. package/templates/server-actions/safe-action.ts.ejs +51 -0
  44. package/templates/ui/client-side-wrappers.tsx.ejs +19 -0
  45. package/templates/ui/page.tsx.ejs +111 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ ## 0.0.1
4
+
5
+ First stable release of the Scale Stack CLI.
6
+
7
+ ### Added
8
+
9
+ - `scale-stack init` with interactive and headless project generation for a Next.js 16.2+ App Router baseline.
10
+ - Generator DAG covering project bootstrap, agent skills, strict TypeScript config, Next config, environment validation, observability, shadcn/Tailwind UI, state, error handling, Docker, Prisma, Better Auth, server actions, forms, AI chat, CI, analytics, i18n, and agent guidance files.
11
+ - `scale-stack sync` for managed config updates with dry-run diffs, conflict detection, rollback snapshots, version guard, and sync logging.
12
+ - Release E2E coverage for the supported init matrix, generated project install/build checks, and sync against a generated project.
13
+
14
+ ### Notes
15
+
16
+ - `--a11y`, `--api-client`, `--jobs`, and CircleCI selection are accepted for forward compatibility but do not generate their future integrations yet.
17
+ - The published package includes `dist`, `templates`, `README.md`, and this changelog.
package/README.md CHANGED
@@ -1,11 +1,105 @@
1
1
  # Scale Stack
2
2
 
3
- An opinionated scaffolding engine for Next.js projects. Scale Stack automates the setup of a colocation-first architecture, type-safe data layers, and an AI-native development environment.
3
+ An opinionated scaffolding engine for Next.js projects. Scale Stack automates the setup of a colocation-first architecture, type-safe data layers, and an AI-native development environment — and keeps existing projects current via a `sync` command.
4
+
5
+ Status: **0.0.1 stable** — first public baseline for `scale-stack init` and `scale-stack sync`. Some advertised Smart-Fittings remain coming-soon placeholders and are called out below.
6
+
7
+ ## What's in the box
8
+
9
+ - **`scale-stack init`** — interactive or headless project generator. Shells out to `create-next-app@16.2.6` with a deterministic flag set, then layers Scale Stack overlays (strict `tsconfig.json`, `next.config.ts` with React Compiler / view transitions / typed routes / cache components, ESLint + Prettier, agent skills, …). See [PRD.md](PRD.md) for the full stack and [IMPLEMENTATION_PLAN.md](IMPLEMENTATION_PLAN.md) for phase status.
10
+ - **`scale-stack sync`** — patches tracked config files (`tsconfig.json`, `package.json`, `next.config.ts`, `eslint.config.mjs`, `.prettierrc`) against the current Scale Stack baseline. Conflict detection, dry-run mode, snapshot-based rollback, and a version guard are all built in (PRD §2.2).
11
+
12
+ ## Quick start
13
+
14
+ ```bash
15
+ # Interactive
16
+ npx scale-stack init my-app
17
+
18
+ # Headless — skip all prompts, accept defaults
19
+ npx scale-stack init --name my-app -y
20
+
21
+ # Generate a kitchen-sink project
22
+ npx scale-stack init my-app --orm --auth --chat --i18n --ci github --analytics plausible --pre-commit -y
23
+
24
+ # Preview changes to an existing project without writing
25
+ cd my-app
26
+ npx scale-stack sync --dry-run
27
+ ```
28
+
29
+ ## Commands
30
+
31
+ ### `scale-stack init [name]`
32
+
33
+ Assembles a new generated Next.js project. Run without `-y` for the interactive picker, or pass flags for headless generation.
34
+
35
+ Supported flags:
36
+
37
+ - `--name <name>` — project name; overrides the positional argument
38
+ - `--orm` — enable Prisma
39
+ - `--auth` — enable Better Auth
40
+ - `--chat` — scaffold the AI chat route
41
+ - `--i18n` — opt into internationalization Smart-Fitting
42
+ - `--a11y`, `--api-client` — accepted as coming-soon placeholders; currently skipped
43
+ - `--ci [provider]` — CI provider; bare `--ci` defaults to GitHub
44
+ - `--analytics [provider]` — analytics provider; bare `--analytics` defaults to Plausible
45
+ - `--pre-commit` — enable prek hooks
46
+ - `--jobs` — accepted for forward compatibility; currently skipped
47
+ - `-y, --yes` — skip prompts and accept defaults
48
+ - `--dry-run` — preview generated file changes without writing
49
+
50
+ ### `scale-stack sync`
51
+
52
+ Updates a generated project against the current Scale Stack baseline while preserving user-owned config keys.
53
+
54
+ Supported flags:
55
+
56
+ - `--dry-run` — print diffs without writing files
57
+ - `--force` — overwrite user-modified managed keys with Scale Stack baselines
58
+ - `--keep-backup` — retain `.scale-stack/pre-sync-backup/` after success
4
59
 
5
60
  ## Repository layout
6
61
 
7
62
  This repository contains the **Scale Stack CLI** — the scaffolding engine, DAG runner, generators, and `sync` command. Running the CLI produces a **generated application template** (a standalone Next.js project) with optional modules layered on via CLI flags.
8
63
 
9
- ## Status
64
+ ```
65
+ src/
66
+ cli/ # Commander entrypoint, commands, @clack/prompts flows, UI
67
+ engine/ # DAG runner, virtual FS, EJS template engine, logger
68
+ sync/ # `scale-stack sync` — config patcher + conflict detector
69
+ config/ # Canonical managed slices + baselines (shared by sync + generators)
70
+ lib/merge/ # Managed JSON / text merge engine
71
+ generators/ # DAG nodes — one module per generator
72
+ types/ # Shared TypeScript contracts
73
+ tests/ # Vitest (mirrors src/)
74
+ templates/ # EJS templates, organized by generator
75
+ ```
76
+
77
+ See [IMPLEMENTATION_PLAN.md](IMPLEMENTATION_PLAN.md) for the DAG, current phase coverage, and what's still to do.
78
+
79
+ ## Release verification
80
+
81
+ Before publishing a release, run:
82
+
83
+ ```bash
84
+ pnpm install --frozen-lockfile
85
+ pnpm lint
86
+ pnpm test
87
+ pnpm build
88
+ pnpm test:e2e
89
+ npm pack --dry-run
90
+ ```
91
+
92
+ The E2E suite generates the supported init matrix in temporary directories, runs `pnpm install && pnpm build` for each generated project, and covers `scale-stack sync` against a previously generated project.
93
+
94
+ ## Development
95
+
96
+ ```bash
97
+ pnpm install
98
+ pnpm build # bundle dist/index.js
99
+ pnpm test # fast Vitest suite
100
+ pnpm test:e2e # build CLI, generate tmp projects, run install/build checks
101
+ pnpm lint # eslint + prettier --check
102
+ pnpm cli -- init --name tmp -y # run the CLI from source via tsx
103
+ ```
10
104
 
11
- Under active development. No published packages yet.
105
+ See [.cursor/rules/](.cursor/rules/) for the TypeScript conventions, generator contract, and sync-managed-keys rules that the codebase follows.