@driftless-sh/cli 0.1.33 → 0.1.35

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/README.md CHANGED
@@ -12,10 +12,11 @@ npm install -g @driftless-sh/cli
12
12
 
13
13
  ```bash
14
14
  driftless login --key <api-key> # Generate one at driftless.icu → Settings → API keys
15
- driftless init # Scan repo, bootstrap context, suggest rules
16
- driftless session start # See relevant context before editing
15
+ driftless init # Scan repo, upload baseline, install skill
16
+ driftless init --suggest # Also auto-generate rules + context topics
17
+ driftless sync # Pull stale topics, violations, and suggested topics
18
+ driftless context get <slug> # Load context before editing
17
19
  driftless scan --diff # Check changes against rules before pushing
18
- driftless session end # Scan + context report + stale detection
19
20
  driftless install-skill # Write AGENTS.md for Claude Code / Cursor
20
21
  ```
21
22
 
@@ -48,34 +49,38 @@ Auth is stored in `~/.driftless/config.json`. You can also set `DRIFTLESS_API_KE
48
49
 
49
50
  ### `driftless init`
50
51
 
51
- Full repo initialization. Runs a 3-pass scan:
52
+ Smart repo initialization:
52
53
 
53
- 1. **Identity** — detects framework, system type, auth patterns (zero tokens)
54
- 2. **AST extraction** — extracts endpoints, guards, services, modules, DTOs with fields + validations, and their relations (zero tokens)
54
+ 1. **Identity** — detects framework, system type, auth patterns (local, zero tokens)
55
+ 2. **AST extraction** — extracts endpoints, guards, services, modules, relations (local, zero tokens)
55
56
  3. **Upload** — sends baseline + components + relations to Cloud
57
+ 4. **Skill install** — writes `AGENTS.md` and `.driftless/skill.md`
56
58
 
57
59
  ```bash
58
60
  cd my-nestjs-repo
59
61
  driftless init
60
62
  ```
61
63
 
62
- After init, Driftless suggests architectural rules based on detected patterns and creates context topics for each module.
64
+ #### Flags
63
65
 
64
- ---
65
-
66
- ### `driftless session`
67
-
68
- The agent loop — start with context, finish with a report.
66
+ | Flag | Description |
67
+ |------|-------------|
68
+ | `--suggest` | Also auto-generate rules and context topics from detected patterns. Off by default. |
69
+ | `--src <path>` | **Monorepo support** — scan from a subpath while git root stays at cwd. Example: `--src apps/api/src` |
69
70
 
70
71
  ```bash
71
- driftless session start # Show context for local changes
72
- driftless session start --files "src/auth/**" # Show context for specific files
73
- driftless session end # Scan changes, check violations, suggest updates
74
- ```
72
+ # Standard repo
73
+ driftless init
74
+
75
+ # Standard repo with auto-generated topics + rules
76
+ driftless init --suggest
75
77
 
76
- **Before editing:** `session start` tells you which context topics, docs, and gotchas apply to the files you're about to touch.
78
+ # Monorepo: NestJS app lives at apps/api/src
79
+ driftless init --src apps/api/src
77
80
 
78
- **Before pushing:** `session end` runs `scan --diff`, reports violations, and flags stale context that needs updating.
81
+ # Monorepo with auto-generated topics + rules
82
+ driftless init --src apps/api/src --suggest
83
+ ```
79
84
 
80
85
  ---
81
86
 
@@ -153,7 +158,7 @@ driftless context sync auth --doc docs/auth.md --dry-run
153
158
 
154
159
  A topic can track components in two ways:
155
160
 
156
- - **`--pattern`** — glob pattern that resolves dynamically (e.g. `src/sdk/**`)
161
+ - **`--pattern`** — glob pattern that resolves dynamically (e.g. `src/sdk/**`). One glob per topic — commas are not supported.
157
162
  - **`--where`** — explicit file path
158
163
 
159
164
  ```bash
@@ -173,6 +178,17 @@ driftless context add "b2b-guard" \
173
178
  --how "Verifies org_id in the token"
174
179
  ```
175
180
 
181
+ #### Appending multiple gotchas at once
182
+
183
+ `--gotcha` can be passed multiple times in one call — all values are appended:
184
+
185
+ ```bash
186
+ driftless context update auth \
187
+ --gotcha "Reset token on org switch" \
188
+ --gotcha "Test tokens never include production claims" \
189
+ --gotcha "Clerk JWTs expire after 1h"
190
+ ```
191
+
176
192
  #### Fields
177
193
 
178
194
  | Field | Description |
@@ -254,6 +270,11 @@ Show help for all commands or a specific command.
254
270
  driftless help # All commands
255
271
  driftless help context # Context subcommands
256
272
  driftless help scan # Scan details
273
+
274
+ # --help also works on any command without hitting the API
275
+ driftless init --help
276
+ driftless scan --help
277
+ driftless context --help
257
278
  ```
258
279
 
259
280
  ---
@@ -283,14 +304,15 @@ This creates `AGENTS.md` with instructions for Claude Code to use Driftless befo
283
304
  ### Custom Agents
284
305
 
285
306
  ```bash
286
- # Before starting work
287
- driftless session start --files "src/auth/**"
307
+ # Load context for the files you're about to touch
308
+ driftless context get <slug>
309
+ driftless context load --files "src/auth/**"
288
310
 
289
- # Before finishing work
290
- driftless session end
311
+ # Before pushing
312
+ driftless scan --diff
291
313
 
292
314
  # After discovering new context
293
- driftless context add "name" --what "..." --how "..." --where "..."
315
+ driftless context update <slug> --gotcha "..." --decisions "..."
294
316
  ```
295
317
 
296
318
  Use `--json` flag for machine-readable output that agents can parse.