@driftless-sh/cli 0.1.26 → 0.1.28
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 +35 -35
- 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.27";
|
|
214543
214543
|
} catch {
|
|
214544
214544
|
return "0.0.0";
|
|
214545
214545
|
}
|
|
@@ -215602,11 +215602,11 @@ async function contextCommand(args) {
|
|
|
215602
215602
|
}
|
|
215603
215603
|
return;
|
|
215604
215604
|
}
|
|
215605
|
-
if (subCommand === "
|
|
215605
|
+
if (subCommand === "sync") {
|
|
215606
215606
|
const slug = positional[1];
|
|
215607
215607
|
if (!slug) {
|
|
215608
|
-
console.error('Usage: driftless context
|
|
215609
|
-
console.error(' driftless context
|
|
215608
|
+
console.error('Usage: driftless context sync <topic> --doc <path> --files "<glob>"');
|
|
215609
|
+
console.error(' driftless context sync <topic> --note "..." --files "<glob>"');
|
|
215610
215610
|
process.exit(1);
|
|
215611
215611
|
}
|
|
215612
215612
|
const docFlag = flags["doc"];
|
|
@@ -215632,7 +215632,7 @@ async function contextCommand(args) {
|
|
|
215632
215632
|
if (noteFlag) updates.decisions = noteFlag;
|
|
215633
215633
|
if (filesFlag) updates.where_files = filesFlag.split(",").map((f) => f.trim()).filter(Boolean);
|
|
215634
215634
|
if (patternFlag) updates.pattern = patternFlag;
|
|
215635
|
-
updates._event_detail = `
|
|
215635
|
+
updates._event_detail = `SYNC_ADDED: doc=${!!fileContent}, note=${!!noteFlag}, files=${filesFlag || "none"}`;
|
|
215636
215636
|
if (flags["dry-run"]) {
|
|
215637
215637
|
console.log(`Would anchor topic '${slug}':`);
|
|
215638
215638
|
if (docFlag) console.log(` doc: ${docFlag} (${fileContent ? fileContent.length : 0} chars)`);
|
|
@@ -215643,7 +215643,7 @@ async function contextCommand(args) {
|
|
|
215643
215643
|
console.log("\n(Dry run \u2014 no changes written to Driftless Cloud)");
|
|
215644
215644
|
}
|
|
215645
215645
|
if (isJSON) {
|
|
215646
|
-
emitJSON2({ dry_run: true, action: "
|
|
215646
|
+
emitJSON2({ dry_run: true, action: "sync", topic: slug, doc: docFlag, note: noteFlag, files: filesFlag, pattern: patternFlag });
|
|
215647
215647
|
}
|
|
215648
215648
|
process.exit(0);
|
|
215649
215649
|
}
|
|
@@ -215659,22 +215659,22 @@ async function contextCommand(args) {
|
|
|
215659
215659
|
}));
|
|
215660
215660
|
emitJSON2(sanitized);
|
|
215661
215661
|
} else {
|
|
215662
|
-
console.log(`Topic '${slug}'
|
|
215662
|
+
console.log(`Topic '${slug}' synced.`);
|
|
215663
215663
|
if (docFlag) console.log(` doc: ${docFlag} (${fileContent ? fileContent.length : 0} chars)`);
|
|
215664
215664
|
if (noteFlag) console.log(` note: ${noteFlag}`);
|
|
215665
215665
|
if (filesFlag) console.log(` files: ${filesFlag}`);
|
|
215666
215666
|
if (patternFlag) console.log(` pattern: ${patternFlag}`);
|
|
215667
215667
|
}
|
|
215668
215668
|
} catch (e) {
|
|
215669
|
-
console.error(`
|
|
215669
|
+
console.error(`Sync failed: ${formatError(e)}`);
|
|
215670
215670
|
process.exit(1);
|
|
215671
215671
|
}
|
|
215672
215672
|
return;
|
|
215673
215673
|
}
|
|
215674
|
-
if (subCommand === "
|
|
215674
|
+
if (subCommand === "load") {
|
|
215675
215675
|
const filesFlag = flags["files"];
|
|
215676
215676
|
if (!filesFlag) {
|
|
215677
|
-
console.error('Usage: driftless context
|
|
215677
|
+
console.error('Usage: driftless context load --files "path1,path2,path3"');
|
|
215678
215678
|
process.exit(1);
|
|
215679
215679
|
}
|
|
215680
215680
|
const files = filesFlag.split(",").map((f) => f.trim()).filter(Boolean);
|
|
@@ -215745,7 +215745,7 @@ Warnings:`);
|
|
|
215745
215745
|
}
|
|
215746
215746
|
}
|
|
215747
215747
|
} catch (e) {
|
|
215748
|
-
console.error(`
|
|
215748
|
+
console.error(`Load failed: ${formatError(e)}`);
|
|
215749
215749
|
process.exit(1);
|
|
215750
215750
|
}
|
|
215751
215751
|
return;
|
|
@@ -215901,7 +215901,7 @@ Done: ${created} created, ${updated} updated.`);
|
|
|
215901
215901
|
}
|
|
215902
215902
|
return;
|
|
215903
215903
|
}
|
|
215904
|
-
console.log(`Usage: driftless context <list|get|add|update|delete|search|
|
|
215904
|
+
console.log(`Usage: driftless context <list|get|add|update|delete|search|load> [args]
|
|
215905
215905
|
|
|
215906
215906
|
Run 'driftless help context' for full reference.`);
|
|
215907
215907
|
}
|
|
@@ -216062,7 +216062,7 @@ Rules that will be evaluated:`);
|
|
|
216062
216062
|
}
|
|
216063
216063
|
console.log("\nBefore finishing:");
|
|
216064
216064
|
console.log(" driftless scan --diff");
|
|
216065
|
-
console.log(" driftless session
|
|
216065
|
+
console.log(" driftless session end");
|
|
216066
216066
|
}
|
|
216067
216067
|
} catch (e) {
|
|
216068
216068
|
console.error(`Session start failed: ${formatError(e)}`);
|
|
@@ -216070,7 +216070,7 @@ Rules that will be evaluated:`);
|
|
|
216070
216070
|
}
|
|
216071
216071
|
return;
|
|
216072
216072
|
}
|
|
216073
|
-
if (subCommand === "
|
|
216073
|
+
if (subCommand === "end") {
|
|
216074
216074
|
const files = getChangedFilesList();
|
|
216075
216075
|
if (files.length === 0 && !isJSON) {
|
|
216076
216076
|
console.log("No local changes detected. Session clean.");
|
|
@@ -216120,7 +216120,7 @@ Rules that will be evaluated:`);
|
|
|
216120
216120
|
context_matched: contextResults.map((r) => r.context.topic)
|
|
216121
216121
|
});
|
|
216122
216122
|
} else {
|
|
216123
|
-
console.log(`Session
|
|
216123
|
+
console.log(`Session end \u2014 ${files.length} file(s) changed:
|
|
216124
216124
|
`);
|
|
216125
216125
|
for (const f of files) {
|
|
216126
216126
|
console.log(` \u270E ${f}`);
|
|
@@ -216161,24 +216161,24 @@ Context touched:`);
|
|
|
216161
216161
|
process.exit(1);
|
|
216162
216162
|
}
|
|
216163
216163
|
} catch (e) {
|
|
216164
|
-
console.error(`Session
|
|
216164
|
+
console.error(`Session end failed: ${formatError(e)}`);
|
|
216165
216165
|
process.exit(1);
|
|
216166
216166
|
}
|
|
216167
216167
|
return;
|
|
216168
216168
|
}
|
|
216169
|
-
console.log(`Usage: driftless session <start|
|
|
216169
|
+
console.log(`Usage: driftless session <start|end> [args]
|
|
216170
216170
|
|
|
216171
|
-
start
|
|
216171
|
+
start \u2014 Show relevant context before editing
|
|
216172
216172
|
--files "path1,path2" Files to check (default: local changes)
|
|
216173
216173
|
--json Output as JSON
|
|
216174
216174
|
|
|
216175
|
-
|
|
216175
|
+
end \u2014 Scan changes, check violations, suggest context updates
|
|
216176
216176
|
--json Output as JSON
|
|
216177
216177
|
|
|
216178
216178
|
Examples:
|
|
216179
216179
|
driftless session start --files "src/auth/**"
|
|
216180
216180
|
driftless session start # uses local changes
|
|
216181
|
-
driftless session
|
|
216181
|
+
driftless session end # scan + context report`);
|
|
216182
216182
|
}
|
|
216183
216183
|
|
|
216184
216184
|
// src/commands/login.ts
|
|
@@ -216398,7 +216398,7 @@ function pad2(s, n) {
|
|
|
216398
216398
|
}
|
|
216399
216399
|
|
|
216400
216400
|
// src/index.ts
|
|
216401
|
-
var VERSION = "0.1.
|
|
216401
|
+
var VERSION = "0.1.27";
|
|
216402
216402
|
var HELP_TEXT = `Driftless CLI v${VERSION} \u2014 Living repo context for humans and coding agents
|
|
216403
216403
|
|
|
216404
216404
|
Install: npm install -g @driftless-sh/cli
|
|
@@ -216407,7 +216407,7 @@ API: https://api.driftless.icu/api/v1
|
|
|
216407
216407
|
|
|
216408
216408
|
Agent loop:
|
|
216409
216409
|
driftless session start Show context before editing
|
|
216410
|
-
driftless session
|
|
216410
|
+
driftless session end Scan changes + context report
|
|
216411
216411
|
driftless context list List all context topics
|
|
216412
216412
|
driftless context get <topic> Live view of one topic before editing
|
|
216413
216413
|
driftless context get --diff What context matters for my local changes?
|
|
@@ -216424,7 +216424,7 @@ Commands:
|
|
|
216424
216424
|
init Smart init: scan \u2192 detect patterns \u2192 create topics + rules + anchor docs
|
|
216425
216425
|
scan Evaluate staged + uncommitted changes against rules
|
|
216426
216426
|
scan --diff Evaluate uncommitted changes only
|
|
216427
|
-
session Agent session: start (context) \u2192
|
|
216427
|
+
session Agent session: start (context) \u2192 end (scan + report)
|
|
216428
216428
|
context Live repo context (topics, search, anchors)
|
|
216429
216429
|
install-skill Install AGENTS.md into current repo
|
|
216430
216430
|
doctor Check environment health (auth, API, git, workspace, repo, baseline)
|
|
@@ -216437,18 +216437,18 @@ Context subcommands:
|
|
|
216437
216437
|
get --diff Match topics for local uncommitted changes
|
|
216438
216438
|
search "<query>" Full-text search across topics
|
|
216439
216439
|
add "<name>" --what "..." Create a new topic
|
|
216440
|
-
|
|
216441
|
-
|
|
216440
|
+
sync <topic> --doc <path> Sync a doc to a topic
|
|
216441
|
+
sync <topic> --note "..." Add a note to a topic
|
|
216442
216442
|
update <topic> --what "..." Update topic fields
|
|
216443
216443
|
update <topic> --gotcha "..." Append a gotcha
|
|
216444
216444
|
update <topic> --invariant ".." Append an invariant
|
|
216445
216445
|
update <topic> --check "..." Append a required check
|
|
216446
216446
|
delete <topic> Delete a topic
|
|
216447
|
-
|
|
216447
|
+
load --files "p1,p2" Match topics by file paths
|
|
216448
216448
|
|
|
216449
216449
|
Session subcommands:
|
|
216450
216450
|
start [--files "p1,p2"] Show relevant context before editing
|
|
216451
|
-
|
|
216451
|
+
end Scan changes, check violations, suggest updates
|
|
216452
216452
|
|
|
216453
216453
|
Flags:
|
|
216454
216454
|
--json Output as JSON (default is human-readable)
|
|
@@ -216468,7 +216468,7 @@ Output format:
|
|
|
216468
216468
|
|
|
216469
216469
|
Examples:
|
|
216470
216470
|
driftless session start --files "src/auth/**"
|
|
216471
|
-
driftless session
|
|
216471
|
+
driftless session end
|
|
216472
216472
|
|
|
216473
216473
|
driftless context add "b2b-guard" \\
|
|
216474
216474
|
--what "Guard que protege endpoints B2B" \\
|
|
@@ -216478,7 +216478,7 @@ Examples:
|
|
|
216478
216478
|
driftless context get sdk
|
|
216479
216479
|
driftless context search "auth"
|
|
216480
216480
|
driftless scan --diff
|
|
216481
|
-
driftless context
|
|
216481
|
+
driftless context load --files "src/auth/auth.controller.ts" --dry-run
|
|
216482
216482
|
`;
|
|
216483
216483
|
function showCommandHelp(cmd) {
|
|
216484
216484
|
const help = {
|
|
@@ -216536,11 +216536,11 @@ Subcommands:
|
|
|
216536
216536
|
get --diff Match topics for local uncommitted changes
|
|
216537
216537
|
search "<query>" Full-text search across topics
|
|
216538
216538
|
add "<name>" [opts] Create a new topic
|
|
216539
|
-
|
|
216540
|
-
|
|
216539
|
+
sync <topic> --doc <path> Sync a doc to a topic
|
|
216540
|
+
sync <topic> --note "..." Add a note to a topic
|
|
216541
216541
|
update <topic> [opts] Update topic fields
|
|
216542
216542
|
delete <topic> Delete a topic
|
|
216543
|
-
|
|
216543
|
+
load --files "p1,p2,..." Match topics for given file paths
|
|
216544
216544
|
|
|
216545
216545
|
List filters:
|
|
216546
216546
|
--stale Only stale topics
|
|
@@ -216561,8 +216561,8 @@ Examples:
|
|
|
216561
216561
|
driftless context search "auth"
|
|
216562
216562
|
driftless context add "sdk" --pattern "src/sdk/**" --what "Public SDK"
|
|
216563
216563
|
driftless context update sdk --gotchas "Reset token on org switch"
|
|
216564
|
-
driftless context
|
|
216565
|
-
driftless context
|
|
216564
|
+
driftless context sync auth --doc docs/auth.md --files "src/auth/**"
|
|
216565
|
+
driftless context load --files "src/auth/guard.ts" --dry-run
|
|
216566
216566
|
`,
|
|
216567
216567
|
"install-skill": `driftless install-skill
|
|
216568
216568
|
|