Skip to content

Commit 907bed5

Browse files
committed
1.8.0: Add package manager auto-detection (npm/pnpm/yarn) and refactor git init workflow in fullstack command
1 parent ad7b444 commit 907bed5

34 files changed

+1206
-216
lines changed

CLAUDE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,21 @@ CONFLICT - same level:
126126
### Test Warnings
127127
Use `suppressWarnings: true` when creating Config instances in tests.
128128

129+
### Running lt CLI Commands (AI Agent Usage)
130+
When executing `lt` commands, prefer explicit parameters over interactive prompts where possible. The CLI will show a hint in non-interactive mode, but you can avoid it by providing the required flags:
131+
```bash
132+
# GOOD - explicit parameters
133+
lt fullstack init --name my-project --frontend nuxt --api-mode Rest --noConfirm
134+
lt server create --name my-server --api-mode GraphQL --noConfirm
135+
lt server module --name MyModule --controller auto --noConfirm
136+
137+
# BAD - will enter interactive mode
138+
lt fullstack init
139+
lt server create
140+
lt server module
141+
```
142+
Key flags: `--noConfirm` skips all confirmations, `--name` sets the project/module name. See `docs/commands.md` for all available parameters per command.
143+
129144
---
130145

131146
## Quick Checklist

__tests__/api-mode.test.ts

Lines changed: 445 additions & 0 deletions
Large diffs are not rendered by default.

docs/commands.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,10 +436,12 @@ lt fullstack init [options]
436436
| `--frontend-branch <branch>` | Branch of frontend starter to use (ng-base-starter or nuxt-base-starter) |
437437
| `--frontend-copy <path>` | Copy frontend from local template directory |
438438
| `--frontend-link <path>` | Symlink frontend to local template (fastest, changes affect original) |
439-
| `--git` | Initialize git repository |
440-
| `--git-link <url>` | Git repository URL |
439+
| `--git` | Push initial commit to remote repository (git is always initialized) |
440+
| `--git-link <url>` | Git remote repository URL (required when `--git` is true) |
441441
| `--noConfirm` | Skip confirmation prompts |
442442

443+
**Note:** Git is always initialized with the `dev` branch. The `--git` flag only controls whether the initial commit is pushed to a remote repository.
444+
443445
**Note:** For Nuxt frontends with `--frontend-copy` or `--frontend-link`, specify the path to the `nuxt-base-template/` subdirectory, not the repository root.
444446

445447
**Configuration:** `commands.fullstack.*`, `defaults.noConfirm`

docs/lt.config.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ The `defaults` section contains settings that apply across multiple commands. Th
101101
| `defaults.controller` | `'Rest'` \| `'GraphQL'` \| `'Both'` \| `'auto'` | `'Both'` | server/module, server/create |
102102
| `defaults.domain` | `string` | - | deployment/create (use `{name}` as placeholder) |
103103
| `defaults.noConfirm` | `boolean` | `false` | blocks/add, components/add, config/init, git/*, server/create, server/module, npm/reinit, cli/create, typescript/create, fullstack/init, deployment/create, frontend/angular |
104+
| `defaults.packageManager` | `'npm'` \| `'pnpm'` \| `'yarn'` | `'npm'` | Fallback when no lockfile is found. Auto-detection from lockfiles takes precedence. Used by: all commands that run package manager operations |
104105
| `defaults.skipInstall` | `boolean` | `false` | git/update |
105106
| `defaults.skipLint` | `boolean` | `false` | server/module, server/object, server/addProp |
106107

@@ -114,6 +115,7 @@ The `defaults` section contains settings that apply across multiple commands. Th
114115
"controller": "Both",
115116
"domain": "{name}.lenne.tech",
116117
"noConfirm": false,
118+
"packageManager": "npm",
117119
"skipInstall": false,
118120
"skipLint": false
119121
}
@@ -129,10 +131,23 @@ defaults:
129131
controller: Both
130132
domain: "{name}.lenne.tech"
131133
noConfirm: false
134+
packageManager: npm
132135
skipInstall: false
133136
skipLint: false
134137
```
135138
139+
### Package Manager Detection
140+
141+
The CLI automatically detects the package manager for your project. The detection order is:
142+
143+
1. **Lockfile in current directory**: `pnpm-lock.yaml` -> pnpm, `yarn.lock` -> yarn, `package-lock.json` -> npm
144+
2. **`packageManager` field in package.json** (Corepack standard): e.g., `"packageManager": "pnpm@8.15.0"`
145+
3. **Lockfile in parent directories** (monorepo support)
146+
4. **Config fallback**: `defaults.packageManager` from lt.config
147+
5. **Default**: `npm`
148+
149+
This means all CLI commands (`lt server create`, `lt fullstack init`, `lt npm reinit`, etc.) will use the correct package manager automatically without any configuration needed.
150+
136151
### Global vs Command-Specific Settings
137152

138153
Global defaults provide a convenient way to set organization-wide preferences. Command-specific settings override these when you need different behavior for a particular command.
@@ -525,8 +540,8 @@ Creates a new fullstack workspace with API and frontend.
525540
| `commands.fullstack.frontendBranch` | `string` | - | Branch of frontend starter to use (ng-base-starter or nuxt-base-starter) |
526541
| `commands.fullstack.frontendCopy` | `string` | - | Path to local frontend template directory to copy instead of cloning |
527542
| `commands.fullstack.frontendLink` | `string` | - | Path to local frontend template directory to symlink (fastest, changes affect original) |
528-
| `commands.fullstack.git` | `boolean` | - | Initialize git repository |
529-
| `commands.fullstack.gitLink` | `string` | - | Git repository URL |
543+
| `commands.fullstack.git` | `boolean` | - | Push initial commit to remote repository (git is always initialized with `dev` branch) |
544+
| `commands.fullstack.gitLink` | `string` | - | Git remote repository URL (required when `git` is true) |
530545

531546
**Example:**
532547
```json
@@ -912,6 +927,7 @@ The `meta` section stores project information.
912927
"controller": "Both",
913928
"domain": "{name}.lenne.tech",
914929
"noConfirm": false,
930+
"packageManager": "npm",
915931
"skipInstall": false,
916932
"skipLint": false
917933
},
@@ -924,7 +940,8 @@ The `meta` section stores project information.
924940
},
925941
"fullstack": {
926942
"frontend": "nuxt",
927-
"git": false
943+
"git": false,
944+
"gitLink": "https://github.com/myorg/myproject.git"
928945
},
929946
"git": {
930947
"defaultBranch": "develop",
@@ -959,6 +976,7 @@ defaults:
959976
controller: Both
960977
domain: "{name}.lenne.tech"
961978
noConfirm: false
979+
packageManager: npm
962980
skipInstall: false
963981
skipLint: false
964982
@@ -972,6 +990,7 @@ commands:
972990
fullstack:
973991
frontend: nuxt
974992
git: false
993+
gitLink: "https://github.com/myorg/myproject.git"
975994
976995
git:
977996
defaultBranch: develop

0 commit comments

Comments
 (0)