@@ -28,30 +28,36 @@ package-manager detection). Keep command files thin and put logic there.
2828
2929## Project Initialization
3030
31- The init command creates new projects using templates from `assets/monorepo/` :
31+ The init command asks which template to generate (or takes `-t`) :
3232
3333```bash
34- npx @axiosleo/koapp init <app-name> -d <optional-dir>
34+ npx @axiosleo/koapp init <app-name> [ -d <optional-dir>] [-t simple-ts|simple-js|monorepo]
3535```
3636
37- This generates a pnpm monorepo:
38-
39- - `apps/services` - TypeScript koapp API service (admin Session auth,
40- `/openapi` Bearer Api-Key surface, SQLite metadata store)
41- - `packages/commands` + `bin/<app-name>.js` - project CLI
42- - `.agents/` - rules plus the koapp skills synced from `assets/skills/`
37+ | Template | Source | Result |
38+ | --- | --- | --- |
39+ | `simple-ts` (default) | `assets/simple/ts/` | One TypeScript HTTP service and sample routes. No database. |
40+ | `simple-js` | `assets/simple/js/` | The same service in CommonJS. No compile step. |
41+ | `monorepo` | `assets/monorepo/` | pnpm workspace: `apps/services` (admin Session auth, `/openapi` Bearer Api-Key, SQLite), `packages/commands`, `bin/<app-name>.js` |
4342
43+ Every template also receives `.agents/skills/` copied from `assets/skills/`.
4444After writing files, init probes for pnpm (offering to install the pinned
4545version) and then offers to run `pnpm install` and `pnpm dev`.
4646
47+ Template selection and file rendering live in [src/cli/scaffold.js](mdc:src/cli/scaffold.js)
48+ so they can be tested without a prompt.
49+
4750## Template System
4851
4952Templates use the `.tmpl` extension and are processed during project generation:
5053
51- - `assets/monorepo/**/*.tmpl` - rendered with `_render_with_file`, which replaces
52- `${name}` with the app name; the `.tmpl` suffix is stripped on output
54+ - `assets/simple/{ts,js}/**/*.tmpl` and `assets/monorepo/**/*.tmpl` - rendered
55+ with `_render_with_file`, which replaces `${name}` with the app name; the
56+ `.tmpl` suffix is stripped on output
5357- `assets/monorepo/bin/monoapp.js.tmpl` - renamed to `bin/<app-name>.js`
58+ (monorepo template only)
5459- `assets/skills/` - copied verbatim into `<app>/.agents/skills/`
60+ (`_sync` reback must stay off, or the copy writes back into this package)
5561
5662## Command Development
5763
@@ -66,10 +72,14 @@ When creating new CLI commands:
6672## Usage Examples
6773
6874```bash
69- # Initialize new project
75+ # Initialize new project (prompts for a template; default is simple-ts)
7076npx @axiosleo/koapp init my-app
7177
72- # Initialize in specific directory
78+ # Skip the prompt
79+ npx @axiosleo/koapp init my-app -t simple-js
80+ npx @axiosleo/koapp init my-app -t monorepo
81+
82+ # Initialize in a specific directory
7383npx @axiosleo/koapp init my-app -d ./projects
7484
7585# Show help
0 commit comments