Skip to content

Commit 442dce2

Browse files
zrosenbauerclaude
andauthored
fix(repo): set proper turbo deps for test tasks (#4)
* fix(repo): set proper turbo deps for test tasks Root test scripts bypassed turbo entirely (vitest run), so workspace packages were never built before their dependents' tests tried to import from dist/. Additionally, examples/ used workspace:* deps but were not in the pnpm workspace. - Route root test scripts through turbo run test - Change test.dependsOn from ^build to build so each package builds itself before running tests - Add examples/* to pnpm-workspace.yaml - Fix CliLogger method calls in advanced example (trace/debug -> info) - Add missing @types/node to authenticated-service example Co-Authored-By: Claude <noreply@anthropic.com> * chore: include all fixes * chore: upgrade laufen --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent d8064fa commit 442dce2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1011
-549
lines changed

.changeset/rename-packages.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
"@kidd-cli/core": patch
3-
"@kidd-cli/cli": patch
4-
"@kidd-cli/bundler": patch
5-
"@kidd-cli/config": patch
6-
"@kidd-cli/utils": patch
2+
'@kidd-cli/core': patch
3+
'@kidd-cli/cli': patch
4+
'@kidd-cli/bundler': patch
5+
'@kidd-cli/config': patch
6+
'@kidd-cli/utils': patch
77
---
88

99
Rename `kidd` to `@kidd-cli/core` and `kidd-cli` to `@kidd-cli/cli` to comply with npm's package naming policy. All imports, docs, and references updated.

.changeset/scaffold-kidd-config.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@kidd-cli/cli': patch
3+
---
4+
5+
scaffold `kidd.config.ts` instead of `tsdown.config.ts` in init templates

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
"titleBar.inactiveForeground": "#e7e7e799"
2020
},
2121
"peacock.color": "#873e99"
22-
}
22+
}

contributing/concepts/architecture.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ packages/
1616
└── cli/ # CLI entrypoint and DX tooling (init, dev, build, compile)
1717
```
1818

19-
| Package | Purpose |
20-
| ----------- | ------------------------------------------------------------- |
19+
| Package | Purpose |
20+
| ---------------- | ------------------------------------------------------------- |
2121
| `@kidd-cli/core` | Core framework: `cli()`, `command()`, `middleware()`, context |
2222
| `@kidd-cli/cli` | DX companion CLI: scaffolding, dev mode, build, compile |
2323

docs/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ flowchart LR
5151

5252
## Packages
5353

54-
| Package | Purpose | Runtime |
55-
| ---------------------------------------- | -------------------------------------------------------- | -------- |
56-
| [`@kidd-cli/core`](./reference/kidd.md) | Core CLI framework (commands, middleware, config, store) | CLI |
57-
| [`@kidd-cli/cli`](./reference/cli.md) | DX companion CLI (init, build, doctor, add) | CLI |
58-
| `@kidd-cli/config` | Configuration loading, validation, and schema (internal) | Library |
59-
| `@kidd-cli/utils` | Shared functional utilities (internal) | Library |
60-
| `@kidd-cli/bundler` | tsdown bundling and binary compilation (internal) | CLI |
54+
| Package | Purpose | Runtime |
55+
| --------------------------------------- | -------------------------------------------------------- | ------- |
56+
| [`@kidd-cli/core`](./reference/kidd.md) | Core CLI framework (commands, middleware, config, store) | CLI |
57+
| [`@kidd-cli/cli`](./reference/cli.md) | DX companion CLI (init, build, doctor, add) | CLI |
58+
| `@kidd-cli/config` | Configuration loading, validation, and schema (internal) | Library |
59+
| `@kidd-cli/utils` | Shared functional utilities (internal) | Library |
60+
| `@kidd-cli/bundler` | tsdown bundling and binary compilation (internal) | CLI |
6161

6262
## Concepts
6363

docs/concepts/authentication.md

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ This split allows commands to work without auth when no credential is found, and
1919

2020
All credentials use a discriminated union on the `type` field:
2121

22-
| Type | Interface | HTTP Header |
23-
| --------- | ------------------- | --------------------------------------- |
24-
| `bearer` | `BearerCredential` | `Authorization: Bearer <token>` |
25-
| `basic` | `BasicCredential` | `Authorization: Basic base64(user:pass)` |
26-
| `api-key` | `ApiKeyCredential` | `<headerName>: <key>` |
27-
| `custom` | `CustomCredential` | Arbitrary `headers` record |
22+
| Type | Interface | HTTP Header |
23+
| --------- | ------------------ | ---------------------------------------- |
24+
| `bearer` | `BearerCredential` | `Authorization: Bearer <token>` |
25+
| `basic` | `BasicCredential` | `Authorization: Basic base64(user:pass)` |
26+
| `api-key` | `ApiKeyCredential` | `<headerName>: <key>` |
27+
| `custom` | `CustomCredential` | Arbitrary `headers` record |
2828

2929
```ts
3030
interface BearerCredential {
@@ -54,10 +54,10 @@ interface CustomCredential {
5454

5555
Credentials are persisted as JSON files using kidd's file store system.
5656

57-
| Location | Path | Resolution order |
58-
| -------- | ------------------------------- | ---------------- |
59-
| Local | `./<cli-name>/auth.json` | Checked first |
60-
| Global | `~/<cli-name>/auth.json` | Checked second |
57+
| Location | Path | Resolution order |
58+
| -------- | ------------------------ | ---------------- |
59+
| Local | `./<cli-name>/auth.json` | Checked first |
60+
| Global | `~/<cli-name>/auth.json` | Checked second |
6161

6262
The file contains the raw credential object:
6363

@@ -80,9 +80,9 @@ Reads a bearer token from `process.env`.
8080
{ source: 'env', tokenVar: 'GITHUB_TOKEN' }
8181
```
8282

83-
| Option | Type | Default | Description |
84-
| ---------- | -------- | --------------------- | ------------------------------- |
85-
| `tokenVar` | `string` | `<CLI_NAME>_TOKEN` | Environment variable name |
83+
| Option | Type | Default | Description |
84+
| ---------- | -------- | ------------------ | ------------------------- |
85+
| `tokenVar` | `string` | `<CLI_NAME>_TOKEN` | Environment variable name |
8686

8787
The default variable name is derived from the CLI name: `my-app` becomes `MY_APP_TOKEN`.
8888

@@ -94,10 +94,10 @@ Reads a bearer token from a `.env` file without mutating `process.env`.
9494
{ source: 'dotenv', tokenVar: 'API_TOKEN', path: './.env.local' }
9595
```
9696

97-
| Option | Type | Default | Description |
98-
| ---------- | -------- | ------------------ | ------------------------------- |
99-
| `tokenVar` | `string` | `<CLI_NAME>_TOKEN` | Variable name within the file |
100-
| `path` | `string` | `$CWD/.env` | Path to the dotenv file |
97+
| Option | Type | Default | Description |
98+
| ---------- | -------- | ------------------ | ----------------------------- |
99+
| `tokenVar` | `string` | `<CLI_NAME>_TOKEN` | Variable name within the file |
100+
| `path` | `string` | `$CWD/.env` | Path to the dotenv file |
101101

102102
### `file` -- JSON File
103103

@@ -107,10 +107,10 @@ Reads any credential type from a JSON file on disk via kidd's store system.
107107
{ source: 'file', filename: 'auth.json', dirName: '.my-app' }
108108
```
109109

110-
| Option | Type | Default | Description |
111-
| ---------- | -------- | ----------------- | --------------------------------- |
112-
| `filename` | `string` | `'auth.json'` | Filename within the store dir |
113-
| `dirName` | `string` | `.<cli-name>` | Store directory name |
110+
| Option | Type | Default | Description |
111+
| ---------- | -------- | ------------- | ----------------------------- |
112+
| `filename` | `string` | `'auth.json'` | Filename within the store dir |
113+
| `dirName` | `string` | `.<cli-name>` | Store directory name |
114114

115115
### `oauth` -- OAuth Browser Flow
116116

@@ -120,12 +120,12 @@ Opens the user's browser to an auth URL, starts a local HTTP server to receive t
120120
{ source: 'oauth', authUrl: 'https://example.com/auth', port: 0, timeout: 120_000 }
121121
```
122122

123-
| Option | Type | Default | Description |
124-
| -------------- | -------- | -------------- | -------------------------------------------- |
125-
| `authUrl` | `string` | -- | Authorization URL (required) |
126-
| `port` | `number` | `0` (random) | Local server port |
127-
| `callbackPath` | `string` | `'/callback'` | Callback endpoint path |
128-
| `timeout` | `number` | `120_000` | Timeout in milliseconds |
123+
| Option | Type | Default | Description |
124+
| -------------- | -------- | ------------- | ---------------------------- |
125+
| `authUrl` | `string` | -- | Authorization URL (required) |
126+
| `port` | `number` | `0` (random) | Local server port |
127+
| `callbackPath` | `string` | `'/callback'` | Callback endpoint path |
128+
| `timeout` | `number` | `120_000` | Timeout in milliseconds |
129129

130130
The auth URL receives a `callback_url` query parameter pointing to the local server. The OAuth provider must POST a JSON body `{ "token": "<value>" }` to this URL on success.
131131

@@ -137,9 +137,9 @@ Prompts the user for a token via a masked password input.
137137
{ source: 'prompt', message: 'Enter your API token:' }
138138
```
139139

140-
| Option | Type | Default | Description |
141-
| --------- | -------- | ------------------------ | --------------------- |
142-
| `message` | `string` | `'Enter your API key'` | Prompt message |
140+
| Option | Type | Default | Description |
141+
| --------- | -------- | ---------------------- | -------------- |
142+
| `message` | `string` | `'Enter your API key'` | Prompt message |
143143

144144
### `custom` -- User-Provided Function
145145

@@ -155,19 +155,19 @@ Calls a user-supplied function that returns a credential or null.
155155
}
156156
```
157157

158-
| Option | Type | Description |
159-
| ---------- | -------------------------------------------------------- | ------------------- |
158+
| Option | Type | Description |
159+
| ---------- | ----------------------------------------------------------------- | ----------------- |
160160
| `resolver` | `() => Promise<AuthCredential \| null> \| AuthCredential \| null` | Resolver function |
161161

162162
## AuthContext
163163

164164
The auth middleware decorates `ctx.auth` with an `AuthContext`:
165165

166-
| Property | Type | Description |
167-
| ----------------- | --------------------------------------------- | ---------------------------------------------- |
168-
| `credential()` | `AuthCredential \| null` | Passively resolved credential (file, env) |
169-
| `authenticated()` | `boolean` | Whether a passive credential exists |
170-
| `authenticate()` | `AsyncResult<AuthCredential, LoginError>` | Run interactive resolvers, persist, and return |
166+
| Property | Type | Description |
167+
| ----------------- | ----------------------------------------- | ---------------------------------------------- |
168+
| `credential()` | `AuthCredential \| null` | Passively resolved credential (file, env) |
169+
| `authenticated()` | `boolean` | Whether a passive credential exists |
170+
| `authenticate()` | `AsyncResult<AuthCredential, LoginError>` | Run interactive resolvers, persist, and return |
171171

172172
### `ctx.auth.authenticate()`
173173

@@ -180,10 +180,10 @@ if (error) {
180180
}
181181
```
182182

183-
| LoginError `type` | Description |
184-
| ------------------- | ---------------------------------------------- |
185-
| `'no_credential'` | No resolver produced a credential |
186-
| `'save_failed'` | Credential resolved but failed to persist |
183+
| LoginError `type` | Description |
184+
| ----------------- | ----------------------------------------- |
185+
| `'no_credential'` | No resolver produced a credential |
186+
| `'save_failed'` | Credential resolved but failed to persist |
187187

188188
## HTTP Integration
189189

docs/concepts/configuration.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ The configuration system for kidd CLIs. Supports multiple file formats, automati
44

55
## Supported Formats
66

7-
| Format | Extensions | Notes |
8-
| ------ | ------------------ | ----------------------- |
9-
| JSONC | `.jsonc` | JSON with comments |
10-
| JSON | `.json` | Standard JSON |
11-
| YAML | `.yaml` | YAML format |
7+
| Format | Extensions | Notes |
8+
| ------ | ---------- | ------------------ |
9+
| JSONC | `.jsonc` | JSON with comments |
10+
| JSON | `.json` | Standard JSON |
11+
| YAML | `.yaml` | YAML format |
1212

1313
Config files are named `.<name>.jsonc`, `.<name>.json`, or `.<name>.yaml`, where `<name>` is the CLI name passed to `cli({ name })` or `createConfigClient({ name })`.
1414

@@ -51,10 +51,10 @@ cli({
5151
})
5252
```
5353

54-
| Field | Type | Default | Description |
55-
| -------- | --------- | ------------------- | -------------------------------------------------------- |
54+
| Field | Type | Default | Description |
55+
| -------- | --------- | ------------------- | ------------------------------------------------------------------- |
5656
| `schema` | `ZodType` | -- | Zod schema to validate the loaded config. Infers `ctx.config` type. |
57-
| `name` | `string` | Derived from `name` | Override the config file name for file discovery |
57+
| `name` | `string` | Derived from `name` | Override the config file name for file discovery |
5858

5959
## Config Client
6060

@@ -72,11 +72,11 @@ const config = createConfigClient({
7272

7373
### `ConfigOptions`
7474

75-
| Field | Type | Description |
76-
| ------------- | ---------- | ---------------------------------------------- |
75+
| Field | Type | Description |
76+
| ------------- | ---------- | -------------------------------------------------------------- |
7777
| `name` | `string` | Config file name (e.g. `'my-app'` resolves to `.my-app.jsonc`) |
78-
| `schema` | `ZodType` | Zod schema for validation |
79-
| `searchPaths` | `string[]` | Additional directories to search |
78+
| `schema` | `ZodType` | Zod schema for validation |
79+
| `searchPaths` | `string[]` | Additional directories to search |
8080

8181
### `config.find(cwd?)`
8282

@@ -96,11 +96,11 @@ Load and validate a config file. Returns a Result tuple.
9696
const result = await config.load()
9797
```
9898

99-
| Return value | Meaning |
100-
| ---------------------------------- | ------------------------------------ |
101-
| `[error, null]` | Load or validation failed |
99+
| Return value | Meaning |
100+
| -------------------------------------- | --------------------------------- |
101+
| `[error, null]` | Load or validation failed |
102102
| `[null, { config, filePath, format }]` | Successfully loaded and validated |
103-
| `[null, null]` | No config file found |
103+
| `[null, null]` | No config file found |
104104

105105
### `config.write(data, options?)`
106106

@@ -113,11 +113,11 @@ const [error, result] = await config.write(
113113
)
114114
```
115115

116-
| Option | Type | Description |
117-
| ---------- | -------------- | ---------------------------------------- |
118-
| `dir` | `string` | Target directory (defaults to cwd) |
116+
| Option | Type | Description |
117+
| ---------- | -------------- | --------------------------------------------- |
118+
| `dir` | `string` | Target directory (defaults to cwd) |
119119
| `format` | `ConfigFormat` | Output format (`'jsonc'`, `'json'`, `'yaml'`) |
120-
| `filePath` | `string` | Explicit output path (overrides `dir`) |
120+
| `filePath` | `string` | Explicit output path (overrides `dir`) |
121121

122122
## Discovery Order
123123

0 commit comments

Comments
 (0)