@driftless-sh/cli 0.1.26 → 0.1.29
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 +10 -10
- package/dist/index.js +37 -57
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ driftless login --key <api-key> # Generate one at driftless.icu → Settin
|
|
|
15
15
|
driftless init # Scan repo, bootstrap context, suggest rules
|
|
16
16
|
driftless session start # See relevant context before editing
|
|
17
17
|
driftless scan --diff # Check changes against rules before pushing
|
|
18
|
-
driftless session
|
|
18
|
+
driftless session end # Scan + context report + stale detection
|
|
19
19
|
driftless install-skill # Write AGENTS.md for Claude Code / Cursor
|
|
20
20
|
```
|
|
21
21
|
|
|
@@ -70,12 +70,12 @@ The agent loop — start with context, finish with a report.
|
|
|
70
70
|
```bash
|
|
71
71
|
driftless session start # Show context for local changes
|
|
72
72
|
driftless session start --files "src/auth/**" # Show context for specific files
|
|
73
|
-
driftless session
|
|
73
|
+
driftless session end # Scan changes, check violations, suggest updates
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
**Before editing:** `session start` tells you which context topics, docs, and gotchas apply to the files you're about to touch.
|
|
77
77
|
|
|
78
|
-
**Before pushing:** `session
|
|
78
|
+
**Before pushing:** `session end` runs `scan --diff`, reports violations, and flags stale context that needs updating.
|
|
79
79
|
|
|
80
80
|
---
|
|
81
81
|
|
|
@@ -134,8 +134,8 @@ driftless context get auth-boundaries --json
|
|
|
134
134
|
| `context update <slug>` | Update topic fields |
|
|
135
135
|
| `context delete <slug>` | Delete a topic |
|
|
136
136
|
| `context search <query>` | Full-text search across topics |
|
|
137
|
-
| `context
|
|
138
|
-
| `context
|
|
137
|
+
| `context sync <slug>` | Sync a doc to a topic |
|
|
138
|
+
| `context load --files` | Match topics for given file paths |
|
|
139
139
|
| `context export` | Export all watchers to `.driftless/watchers/*.yaml` |
|
|
140
140
|
| `context import` | Import watchers from `.driftless/watchers/*.yaml` |
|
|
141
141
|
|
|
@@ -144,9 +144,9 @@ driftless context get auth-boundaries --json
|
|
|
144
144
|
All write commands support `--dry-run` to preview changes without writing to Cloud:
|
|
145
145
|
|
|
146
146
|
```bash
|
|
147
|
-
driftless context
|
|
147
|
+
driftless context load --files "src/auth/**" --dry-run
|
|
148
148
|
driftless context update auth --what "..." --dry-run
|
|
149
|
-
driftless context
|
|
149
|
+
driftless context sync auth --doc docs/auth.md --dry-run
|
|
150
150
|
```
|
|
151
151
|
|
|
152
152
|
#### Creating topics
|
|
@@ -204,8 +204,8 @@ driftless context update sdk --what "SDK v2 with streaming"
|
|
|
204
204
|
# Append a gotcha
|
|
205
205
|
driftless context update sdk --gotchas "Reset token on org switch"
|
|
206
206
|
|
|
207
|
-
#
|
|
208
|
-
driftless context
|
|
207
|
+
# Sync a doc
|
|
208
|
+
driftless context sync auth --doc docs/auth.md --files "src/auth/**"
|
|
209
209
|
|
|
210
210
|
# Export all watchers to .driftless/watchers/*.yaml
|
|
211
211
|
driftless context export
|
|
@@ -287,7 +287,7 @@ This creates `AGENTS.md` with instructions for Claude Code to use Driftless befo
|
|
|
287
287
|
driftless session start --files "src/auth/**"
|
|
288
288
|
|
|
289
289
|
# Before finishing work
|
|
290
|
-
driftless session
|
|
290
|
+
driftless session end
|
|
291
291
|
|
|
292
292
|
# After discovering new context
|
|
293
293
|
driftless context add "name" --what "..." --how "..." --where "..."
|
package/dist/index.js
CHANGED
|
@@ -214442,7 +214442,7 @@ var AGENTS_BLOCK = `
|
|
|
214442
214442
|
## Driftless \u2014 Context Integrity
|
|
214443
214443
|
|
|
214444
214444
|
Before touching files:
|
|
214445
|
-
driftless context
|
|
214445
|
+
driftless context load --files "<files you're about to edit>"
|
|
214446
214446
|
|
|
214447
214447
|
Before pushing:
|
|
214448
214448
|
driftless scan --diff
|
|
@@ -214539,7 +214539,7 @@ async function installSkillCommand() {
|
|
|
214539
214539
|
// src/commands/init.ts
|
|
214540
214540
|
function getVersion() {
|
|
214541
214541
|
try {
|
|
214542
|
-
return "0.1.
|
|
214542
|
+
return "0.1.29";
|
|
214543
214543
|
} catch {
|
|
214544
214544
|
return "0.0.0";
|
|
214545
214545
|
}
|
|
@@ -214984,27 +214984,7 @@ async function initCommand(args) {
|
|
|
214984
214984
|
}
|
|
214985
214985
|
step("creating context", `${watchersCreated} watchers \u2713`);
|
|
214986
214986
|
const existingDocs = detectExistingDocs(cwd);
|
|
214987
|
-
|
|
214988
|
-
for (const doc of existingDocs) {
|
|
214989
|
-
try {
|
|
214990
|
-
const fullPath = (0, import_node_path4.resolve)(cwd, doc.path);
|
|
214991
|
-
const fileContent = (0, import_node_fs4.readFileSync)(fullPath, "utf-8");
|
|
214992
|
-
await api.post(`/workspaces/${workspaceSlug}/watchers`, {
|
|
214993
|
-
name: doc.name,
|
|
214994
|
-
what: doc.what,
|
|
214995
|
-
how: "Anchored documentation",
|
|
214996
|
-
pattern: doc.pattern,
|
|
214997
|
-
decisions: fileContent.slice(0, 2e3),
|
|
214998
|
-
file_content: fileContent,
|
|
214999
|
-
ownership: "@team",
|
|
215000
|
-
where_repos: [repo.id],
|
|
215001
|
-
created_by: "driftless-init"
|
|
215002
|
-
});
|
|
215003
|
-
docsAnchored++;
|
|
215004
|
-
} catch {
|
|
215005
|
-
}
|
|
215006
|
-
}
|
|
215007
|
-
step("anchoring docs", `${docsAnchored} docs \u2713`);
|
|
214987
|
+
step("detecting docs", `${existingDocs.length} found (not auto-synced)`);
|
|
215008
214988
|
let skillLine = "skipped";
|
|
215009
214989
|
try {
|
|
215010
214990
|
const skillResult = await runInstallSkill(cwd);
|
|
@@ -215018,7 +214998,7 @@ async function initCommand(args) {
|
|
|
215018
214998
|
console.log("\u2713 repo context bootstrapped");
|
|
215019
214999
|
console.log(` \u251C\u2500 watchers ${watchersCreated}`);
|
|
215020
215000
|
console.log(` \u251C\u2500 rules ${rulesCreated}`);
|
|
215021
|
-
console.log(` \u251C\u2500 docs
|
|
215001
|
+
console.log(` \u251C\u2500 docs found ${existingDocs.length} (ask your agent to sync them)`);
|
|
215022
215002
|
console.log(` \u251C\u2500 components ${components.length}`);
|
|
215023
215003
|
console.log(` \u2514\u2500 relations ${relationCount}`);
|
|
215024
215004
|
console.log("");
|
|
@@ -215602,11 +215582,11 @@ async function contextCommand(args) {
|
|
|
215602
215582
|
}
|
|
215603
215583
|
return;
|
|
215604
215584
|
}
|
|
215605
|
-
if (subCommand === "
|
|
215585
|
+
if (subCommand === "sync") {
|
|
215606
215586
|
const slug = positional[1];
|
|
215607
215587
|
if (!slug) {
|
|
215608
|
-
console.error('Usage: driftless context
|
|
215609
|
-
console.error(' driftless context
|
|
215588
|
+
console.error('Usage: driftless context sync <topic> --doc <path> --files "<glob>"');
|
|
215589
|
+
console.error(' driftless context sync <topic> --note "..." --files "<glob>"');
|
|
215610
215590
|
process.exit(1);
|
|
215611
215591
|
}
|
|
215612
215592
|
const docFlag = flags["doc"];
|
|
@@ -215632,7 +215612,7 @@ async function contextCommand(args) {
|
|
|
215632
215612
|
if (noteFlag) updates.decisions = noteFlag;
|
|
215633
215613
|
if (filesFlag) updates.where_files = filesFlag.split(",").map((f) => f.trim()).filter(Boolean);
|
|
215634
215614
|
if (patternFlag) updates.pattern = patternFlag;
|
|
215635
|
-
updates._event_detail = `
|
|
215615
|
+
updates._event_detail = `SYNC_ADDED: doc=${!!fileContent}, note=${!!noteFlag}, files=${filesFlag || "none"}`;
|
|
215636
215616
|
if (flags["dry-run"]) {
|
|
215637
215617
|
console.log(`Would anchor topic '${slug}':`);
|
|
215638
215618
|
if (docFlag) console.log(` doc: ${docFlag} (${fileContent ? fileContent.length : 0} chars)`);
|
|
@@ -215643,7 +215623,7 @@ async function contextCommand(args) {
|
|
|
215643
215623
|
console.log("\n(Dry run \u2014 no changes written to Driftless Cloud)");
|
|
215644
215624
|
}
|
|
215645
215625
|
if (isJSON) {
|
|
215646
|
-
emitJSON2({ dry_run: true, action: "
|
|
215626
|
+
emitJSON2({ dry_run: true, action: "sync", topic: slug, doc: docFlag, note: noteFlag, files: filesFlag, pattern: patternFlag });
|
|
215647
215627
|
}
|
|
215648
215628
|
process.exit(0);
|
|
215649
215629
|
}
|
|
@@ -215659,22 +215639,22 @@ async function contextCommand(args) {
|
|
|
215659
215639
|
}));
|
|
215660
215640
|
emitJSON2(sanitized);
|
|
215661
215641
|
} else {
|
|
215662
|
-
console.log(`Topic '${slug}'
|
|
215642
|
+
console.log(`Topic '${slug}' synced.`);
|
|
215663
215643
|
if (docFlag) console.log(` doc: ${docFlag} (${fileContent ? fileContent.length : 0} chars)`);
|
|
215664
215644
|
if (noteFlag) console.log(` note: ${noteFlag}`);
|
|
215665
215645
|
if (filesFlag) console.log(` files: ${filesFlag}`);
|
|
215666
215646
|
if (patternFlag) console.log(` pattern: ${patternFlag}`);
|
|
215667
215647
|
}
|
|
215668
215648
|
} catch (e) {
|
|
215669
|
-
console.error(`
|
|
215649
|
+
console.error(`Sync failed: ${formatError(e)}`);
|
|
215670
215650
|
process.exit(1);
|
|
215671
215651
|
}
|
|
215672
215652
|
return;
|
|
215673
215653
|
}
|
|
215674
|
-
if (subCommand === "
|
|
215654
|
+
if (subCommand === "load") {
|
|
215675
215655
|
const filesFlag = flags["files"];
|
|
215676
215656
|
if (!filesFlag) {
|
|
215677
|
-
console.error('Usage: driftless context
|
|
215657
|
+
console.error('Usage: driftless context load --files "path1,path2,path3"');
|
|
215678
215658
|
process.exit(1);
|
|
215679
215659
|
}
|
|
215680
215660
|
const files = filesFlag.split(",").map((f) => f.trim()).filter(Boolean);
|
|
@@ -215745,7 +215725,7 @@ Warnings:`);
|
|
|
215745
215725
|
}
|
|
215746
215726
|
}
|
|
215747
215727
|
} catch (e) {
|
|
215748
|
-
console.error(`
|
|
215728
|
+
console.error(`Load failed: ${formatError(e)}`);
|
|
215749
215729
|
process.exit(1);
|
|
215750
215730
|
}
|
|
215751
215731
|
return;
|
|
@@ -215901,7 +215881,7 @@ Done: ${created} created, ${updated} updated.`);
|
|
|
215901
215881
|
}
|
|
215902
215882
|
return;
|
|
215903
215883
|
}
|
|
215904
|
-
console.log(`Usage: driftless context <list|get|add|update|delete|search|
|
|
215884
|
+
console.log(`Usage: driftless context <list|get|add|update|delete|search|load> [args]
|
|
215905
215885
|
|
|
215906
215886
|
Run 'driftless help context' for full reference.`);
|
|
215907
215887
|
}
|
|
@@ -216062,7 +216042,7 @@ Rules that will be evaluated:`);
|
|
|
216062
216042
|
}
|
|
216063
216043
|
console.log("\nBefore finishing:");
|
|
216064
216044
|
console.log(" driftless scan --diff");
|
|
216065
|
-
console.log(" driftless session
|
|
216045
|
+
console.log(" driftless session end");
|
|
216066
216046
|
}
|
|
216067
216047
|
} catch (e) {
|
|
216068
216048
|
console.error(`Session start failed: ${formatError(e)}`);
|
|
@@ -216070,7 +216050,7 @@ Rules that will be evaluated:`);
|
|
|
216070
216050
|
}
|
|
216071
216051
|
return;
|
|
216072
216052
|
}
|
|
216073
|
-
if (subCommand === "
|
|
216053
|
+
if (subCommand === "end") {
|
|
216074
216054
|
const files = getChangedFilesList();
|
|
216075
216055
|
if (files.length === 0 && !isJSON) {
|
|
216076
216056
|
console.log("No local changes detected. Session clean.");
|
|
@@ -216120,7 +216100,7 @@ Rules that will be evaluated:`);
|
|
|
216120
216100
|
context_matched: contextResults.map((r) => r.context.topic)
|
|
216121
216101
|
});
|
|
216122
216102
|
} else {
|
|
216123
|
-
console.log(`Session
|
|
216103
|
+
console.log(`Session end \u2014 ${files.length} file(s) changed:
|
|
216124
216104
|
`);
|
|
216125
216105
|
for (const f of files) {
|
|
216126
216106
|
console.log(` \u270E ${f}`);
|
|
@@ -216161,24 +216141,24 @@ Context touched:`);
|
|
|
216161
216141
|
process.exit(1);
|
|
216162
216142
|
}
|
|
216163
216143
|
} catch (e) {
|
|
216164
|
-
console.error(`Session
|
|
216144
|
+
console.error(`Session end failed: ${formatError(e)}`);
|
|
216165
216145
|
process.exit(1);
|
|
216166
216146
|
}
|
|
216167
216147
|
return;
|
|
216168
216148
|
}
|
|
216169
|
-
console.log(`Usage: driftless session <start|
|
|
216149
|
+
console.log(`Usage: driftless session <start|end> [args]
|
|
216170
216150
|
|
|
216171
|
-
start
|
|
216151
|
+
start \u2014 Show relevant context before editing
|
|
216172
216152
|
--files "path1,path2" Files to check (default: local changes)
|
|
216173
216153
|
--json Output as JSON
|
|
216174
216154
|
|
|
216175
|
-
|
|
216155
|
+
end \u2014 Scan changes, check violations, suggest context updates
|
|
216176
216156
|
--json Output as JSON
|
|
216177
216157
|
|
|
216178
216158
|
Examples:
|
|
216179
216159
|
driftless session start --files "src/auth/**"
|
|
216180
216160
|
driftless session start # uses local changes
|
|
216181
|
-
driftless session
|
|
216161
|
+
driftless session end # scan + context report`);
|
|
216182
216162
|
}
|
|
216183
216163
|
|
|
216184
216164
|
// src/commands/login.ts
|
|
@@ -216398,7 +216378,7 @@ function pad2(s, n) {
|
|
|
216398
216378
|
}
|
|
216399
216379
|
|
|
216400
216380
|
// src/index.ts
|
|
216401
|
-
var VERSION = "0.1.
|
|
216381
|
+
var VERSION = "0.1.29";
|
|
216402
216382
|
var HELP_TEXT = `Driftless CLI v${VERSION} \u2014 Living repo context for humans and coding agents
|
|
216403
216383
|
|
|
216404
216384
|
Install: npm install -g @driftless-sh/cli
|
|
@@ -216407,7 +216387,7 @@ API: https://api.driftless.icu/api/v1
|
|
|
216407
216387
|
|
|
216408
216388
|
Agent loop:
|
|
216409
216389
|
driftless session start Show context before editing
|
|
216410
|
-
driftless session
|
|
216390
|
+
driftless session end Scan changes + context report
|
|
216411
216391
|
driftless context list List all context topics
|
|
216412
216392
|
driftless context get <topic> Live view of one topic before editing
|
|
216413
216393
|
driftless context get --diff What context matters for my local changes?
|
|
@@ -216424,7 +216404,7 @@ Commands:
|
|
|
216424
216404
|
init Smart init: scan \u2192 detect patterns \u2192 create topics + rules + anchor docs
|
|
216425
216405
|
scan Evaluate staged + uncommitted changes against rules
|
|
216426
216406
|
scan --diff Evaluate uncommitted changes only
|
|
216427
|
-
session Agent session: start (context) \u2192
|
|
216407
|
+
session Agent session: start (context) \u2192 end (scan + report)
|
|
216428
216408
|
context Live repo context (topics, search, anchors)
|
|
216429
216409
|
install-skill Install AGENTS.md into current repo
|
|
216430
216410
|
doctor Check environment health (auth, API, git, workspace, repo, baseline)
|
|
@@ -216437,18 +216417,18 @@ Context subcommands:
|
|
|
216437
216417
|
get --diff Match topics for local uncommitted changes
|
|
216438
216418
|
search "<query>" Full-text search across topics
|
|
216439
216419
|
add "<name>" --what "..." Create a new topic
|
|
216440
|
-
|
|
216441
|
-
|
|
216420
|
+
sync <topic> --doc <path> Sync a doc to a topic
|
|
216421
|
+
sync <topic> --note "..." Add a note to a topic
|
|
216442
216422
|
update <topic> --what "..." Update topic fields
|
|
216443
216423
|
update <topic> --gotcha "..." Append a gotcha
|
|
216444
216424
|
update <topic> --invariant ".." Append an invariant
|
|
216445
216425
|
update <topic> --check "..." Append a required check
|
|
216446
216426
|
delete <topic> Delete a topic
|
|
216447
|
-
|
|
216427
|
+
load --files "p1,p2" Match topics by file paths
|
|
216448
216428
|
|
|
216449
216429
|
Session subcommands:
|
|
216450
216430
|
start [--files "p1,p2"] Show relevant context before editing
|
|
216451
|
-
|
|
216431
|
+
end Scan changes, check violations, suggest updates
|
|
216452
216432
|
|
|
216453
216433
|
Flags:
|
|
216454
216434
|
--json Output as JSON (default is human-readable)
|
|
@@ -216468,7 +216448,7 @@ Output format:
|
|
|
216468
216448
|
|
|
216469
216449
|
Examples:
|
|
216470
216450
|
driftless session start --files "src/auth/**"
|
|
216471
|
-
driftless session
|
|
216451
|
+
driftless session end
|
|
216472
216452
|
|
|
216473
216453
|
driftless context add "b2b-guard" \\
|
|
216474
216454
|
--what "Guard que protege endpoints B2B" \\
|
|
@@ -216478,7 +216458,7 @@ Examples:
|
|
|
216478
216458
|
driftless context get sdk
|
|
216479
216459
|
driftless context search "auth"
|
|
216480
216460
|
driftless scan --diff
|
|
216481
|
-
driftless context
|
|
216461
|
+
driftless context load --files "src/auth/auth.controller.ts" --dry-run
|
|
216482
216462
|
`;
|
|
216483
216463
|
function showCommandHelp(cmd) {
|
|
216484
216464
|
const help = {
|
|
@@ -216536,11 +216516,11 @@ Subcommands:
|
|
|
216536
216516
|
get --diff Match topics for local uncommitted changes
|
|
216537
216517
|
search "<query>" Full-text search across topics
|
|
216538
216518
|
add "<name>" [opts] Create a new topic
|
|
216539
|
-
|
|
216540
|
-
|
|
216519
|
+
sync <topic> --doc <path> Sync a doc to a topic
|
|
216520
|
+
sync <topic> --note "..." Add a note to a topic
|
|
216541
216521
|
update <topic> [opts] Update topic fields
|
|
216542
216522
|
delete <topic> Delete a topic
|
|
216543
|
-
|
|
216523
|
+
load --files "p1,p2,..." Match topics for given file paths
|
|
216544
216524
|
|
|
216545
216525
|
List filters:
|
|
216546
216526
|
--stale Only stale topics
|
|
@@ -216561,8 +216541,8 @@ Examples:
|
|
|
216561
216541
|
driftless context search "auth"
|
|
216562
216542
|
driftless context add "sdk" --pattern "src/sdk/**" --what "Public SDK"
|
|
216563
216543
|
driftless context update sdk --gotchas "Reset token on org switch"
|
|
216564
|
-
driftless context
|
|
216565
|
-
driftless context
|
|
216544
|
+
driftless context sync auth --doc docs/auth.md --files "src/auth/**"
|
|
216545
|
+
driftless context load --files "src/auth/guard.ts" --dry-run
|
|
216566
216546
|
`,
|
|
216567
216547
|
"install-skill": `driftless install-skill
|
|
216568
216548
|
|