deepflow 0.1.73 → 0.1.75
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 +2 -0
- package/bin/install.js +95 -12
- package/package.json +1 -1
- package/src/commands/df/execute.md +7 -2
- package/src/skills/context-hub/SKILL.md +87 -0
package/README.md
CHANGED
|
@@ -49,6 +49,8 @@ npx deepflow
|
|
|
49
49
|
npx deepflow --uninstall
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
The installer configures granular permissions so background agents can read, write, run git, and execute health checks (build/test/typecheck/lint) without blocking on approval prompts. All permissions are scoped and cleaned up on uninstall.
|
|
53
|
+
|
|
52
54
|
## Two Modes
|
|
53
55
|
|
|
54
56
|
### Interactive (human-in-the-loop)
|
package/bin/install.js
CHANGED
|
@@ -184,13 +184,14 @@ async function main() {
|
|
|
184
184
|
console.log('');
|
|
185
185
|
console.log(`Installed to ${c.cyan}${CLAUDE_DIR}${c.reset}:`);
|
|
186
186
|
console.log(' commands/df/ — /df:discover, /df:debate, /df:spec, /df:plan, /df:execute, /df:verify, /df:auto, /df:note, /df:resume, /df:update');
|
|
187
|
-
console.log(' skills/ — gap-discovery, atomic-commits, code-completeness');
|
|
187
|
+
console.log(' skills/ — gap-discovery, atomic-commits, code-completeness, context-hub');
|
|
188
188
|
console.log(' agents/ — reasoner (/df:auto — autonomous execution via /loop)');
|
|
189
189
|
if (level === 'global') {
|
|
190
190
|
console.log(' hooks/ — statusline, update checker');
|
|
191
191
|
}
|
|
192
192
|
console.log(' hooks/df-spec-* — spec validation (auto-enforced by /df:spec and /df:plan)');
|
|
193
193
|
console.log(' env/ — ENABLE_LSP_TOOL (code navigation via goToDefinition, findReferences, workspaceSymbol)');
|
|
194
|
+
console.log(' permissions/ — granular allow-list for background agents (git, build, test, read/write)');
|
|
194
195
|
console.log('');
|
|
195
196
|
if (level === 'project') {
|
|
196
197
|
console.log(`${c.dim}Note: Statusline is only available with global install.${c.reset}`);
|
|
@@ -252,6 +253,10 @@ async function configureHooks(claudeDir) {
|
|
|
252
253
|
settings.env.ENABLE_LSP_TOOL = "1";
|
|
253
254
|
log('LSP tool enabled');
|
|
254
255
|
|
|
256
|
+
// Configure permissions for background agents
|
|
257
|
+
configurePermissions(settings);
|
|
258
|
+
log('Agent permissions configured');
|
|
259
|
+
|
|
255
260
|
// Configure statusline
|
|
256
261
|
if (settings.statusLine) {
|
|
257
262
|
const answer = await ask(
|
|
@@ -319,8 +324,72 @@ function configureProjectSettings(claudeDir) {
|
|
|
319
324
|
if (!settings.env) settings.env = {};
|
|
320
325
|
settings.env.ENABLE_LSP_TOOL = "1";
|
|
321
326
|
|
|
327
|
+
// Configure permissions for background agents
|
|
328
|
+
configurePermissions(settings);
|
|
329
|
+
|
|
322
330
|
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
|
323
|
-
log('LSP tool enabled (project)');
|
|
331
|
+
log('LSP tool enabled + agent permissions configured (project)');
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// Permissions required for background agents to work without blocking
|
|
335
|
+
const DEEPFLOW_PERMISSIONS = [
|
|
336
|
+
// Agents need to read/write code
|
|
337
|
+
"Edit",
|
|
338
|
+
"Write",
|
|
339
|
+
"Read",
|
|
340
|
+
// Agents need to search codebase
|
|
341
|
+
"Glob",
|
|
342
|
+
"Grep",
|
|
343
|
+
// Git operations (orchestrator handles worktrees, agents read status)
|
|
344
|
+
"Bash(git status:*)",
|
|
345
|
+
"Bash(git diff:*)",
|
|
346
|
+
"Bash(git add:*)",
|
|
347
|
+
"Bash(git commit:*)",
|
|
348
|
+
"Bash(git log:*)",
|
|
349
|
+
"Bash(git stash:*)",
|
|
350
|
+
"Bash(git checkout:*)",
|
|
351
|
+
"Bash(git branch:*)",
|
|
352
|
+
"Bash(git revert:*)",
|
|
353
|
+
"Bash(git worktree:*)",
|
|
354
|
+
"Bash(git ls-files:*)",
|
|
355
|
+
"Bash(git merge:*)",
|
|
356
|
+
// Build & test (ratchet health checks)
|
|
357
|
+
"Bash(npm run build:*)",
|
|
358
|
+
"Bash(npm test:*)",
|
|
359
|
+
"Bash(npm run lint:*)",
|
|
360
|
+
"Bash(npx tsc:*)",
|
|
361
|
+
"Bash(cargo build:*)",
|
|
362
|
+
"Bash(cargo test:*)",
|
|
363
|
+
"Bash(go build:*)",
|
|
364
|
+
"Bash(go test:*)",
|
|
365
|
+
"Bash(pytest:*)",
|
|
366
|
+
"Bash(python -m pytest:*)",
|
|
367
|
+
"Bash(ruff:*)",
|
|
368
|
+
"Bash(mypy:*)",
|
|
369
|
+
// Utility
|
|
370
|
+
"Bash(node:*)",
|
|
371
|
+
"Bash(ls:*)",
|
|
372
|
+
"Bash(cat:*)",
|
|
373
|
+
"Bash(mkdir:*)",
|
|
374
|
+
"Bash(date:*)",
|
|
375
|
+
"Bash(wc:*)",
|
|
376
|
+
"Bash(head:*)",
|
|
377
|
+
"Bash(tail:*)",
|
|
378
|
+
];
|
|
379
|
+
|
|
380
|
+
function configurePermissions(settings) {
|
|
381
|
+
if (!settings.permissions) settings.permissions = {};
|
|
382
|
+
if (!settings.permissions.allow) settings.permissions.allow = [];
|
|
383
|
+
|
|
384
|
+
const existing = new Set(settings.permissions.allow);
|
|
385
|
+
let added = 0;
|
|
386
|
+
|
|
387
|
+
for (const perm of DEEPFLOW_PERMISSIONS) {
|
|
388
|
+
if (!existing.has(perm)) {
|
|
389
|
+
settings.permissions.allow.push(perm);
|
|
390
|
+
added++;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
324
393
|
}
|
|
325
394
|
|
|
326
395
|
function ask(question) {
|
|
@@ -400,6 +469,7 @@ async function uninstall() {
|
|
|
400
469
|
'skills/atomic-commits',
|
|
401
470
|
'skills/code-completeness',
|
|
402
471
|
'skills/gap-discovery',
|
|
472
|
+
'skills/context-hub',
|
|
403
473
|
'agents/reasoner.md'
|
|
404
474
|
];
|
|
405
475
|
|
|
@@ -449,23 +519,30 @@ async function uninstall() {
|
|
|
449
519
|
}
|
|
450
520
|
}
|
|
451
521
|
|
|
452
|
-
// Remove ENABLE_LSP_TOOL from global settings
|
|
522
|
+
// Remove ENABLE_LSP_TOOL and deepflow permissions from global settings
|
|
453
523
|
if (fs.existsSync(settingsPath)) {
|
|
454
524
|
try {
|
|
455
525
|
const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
|
|
456
526
|
if (settings.env?.ENABLE_LSP_TOOL) {
|
|
457
527
|
delete settings.env.ENABLE_LSP_TOOL;
|
|
458
528
|
if (settings.env && Object.keys(settings.env).length === 0) delete settings.env;
|
|
459
|
-
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
|
460
529
|
console.log(` ${c.green}✓${c.reset} Removed ENABLE_LSP_TOOL from settings`);
|
|
461
530
|
}
|
|
531
|
+
if (settings.permissions?.allow) {
|
|
532
|
+
const dfPerms = new Set(DEEPFLOW_PERMISSIONS);
|
|
533
|
+
settings.permissions.allow = settings.permissions.allow.filter(p => !dfPerms.has(p));
|
|
534
|
+
if (settings.permissions.allow.length === 0) delete settings.permissions.allow;
|
|
535
|
+
if (settings.permissions && Object.keys(settings.permissions).length === 0) delete settings.permissions;
|
|
536
|
+
console.log(` ${c.green}✓${c.reset} Removed deepflow permissions from settings`);
|
|
537
|
+
}
|
|
538
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
|
462
539
|
} catch (e) {
|
|
463
540
|
// Fail silently
|
|
464
541
|
}
|
|
465
542
|
}
|
|
466
543
|
}
|
|
467
544
|
|
|
468
|
-
// Remove ENABLE_LSP_TOOL from project settings.local.json
|
|
545
|
+
// Remove ENABLE_LSP_TOOL and deepflow permissions from project settings.local.json
|
|
469
546
|
if (level === 'project') {
|
|
470
547
|
const localSettingsPath = path.join(PROJECT_DIR, 'settings.local.json');
|
|
471
548
|
if (fs.existsSync(localSettingsPath)) {
|
|
@@ -474,13 +551,19 @@ async function uninstall() {
|
|
|
474
551
|
if (localSettings.env?.ENABLE_LSP_TOOL) {
|
|
475
552
|
delete localSettings.env.ENABLE_LSP_TOOL;
|
|
476
553
|
if (localSettings.env && Object.keys(localSettings.env).length === 0) delete localSettings.env;
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
554
|
+
}
|
|
555
|
+
if (localSettings.permissions?.allow) {
|
|
556
|
+
const dfPerms = new Set(DEEPFLOW_PERMISSIONS);
|
|
557
|
+
localSettings.permissions.allow = localSettings.permissions.allow.filter(p => !dfPerms.has(p));
|
|
558
|
+
if (localSettings.permissions.allow.length === 0) delete localSettings.permissions.allow;
|
|
559
|
+
if (localSettings.permissions && Object.keys(localSettings.permissions).length === 0) delete localSettings.permissions;
|
|
560
|
+
}
|
|
561
|
+
if (Object.keys(localSettings).length === 0) {
|
|
562
|
+
fs.unlinkSync(localSettingsPath);
|
|
563
|
+
console.log(` ${c.green}✓${c.reset} Removed settings.local.json (empty after cleanup)`);
|
|
564
|
+
} else {
|
|
565
|
+
fs.writeFileSync(localSettingsPath, JSON.stringify(localSettings, null, 2));
|
|
566
|
+
console.log(` ${c.green}✓${c.reset} Removed deepflow settings from settings.local.json`);
|
|
484
567
|
}
|
|
485
568
|
} catch (e) {
|
|
486
569
|
// Fail silently
|
package/package.json
CHANGED
|
@@ -24,6 +24,7 @@ Implement tasks from PLAN.md with parallel agents, atomic commits, ratchet-drive
|
|
|
24
24
|
|
|
25
25
|
## Skills & Agents
|
|
26
26
|
- Skill: `atomic-commits` — Clean commit protocol
|
|
27
|
+
- Skill: `context-hub` — Fetch external API docs before coding (when task involves external libraries)
|
|
27
28
|
|
|
28
29
|
**Use Task tool to spawn agents:**
|
|
29
30
|
| Agent | subagent_type | Purpose |
|
|
@@ -453,8 +454,11 @@ Files: {target files}
|
|
|
453
454
|
Spec: {spec_name}
|
|
454
455
|
|
|
455
456
|
Steps:
|
|
456
|
-
1.
|
|
457
|
-
|
|
457
|
+
1. If the task involves external APIs/SDKs, run: chub search "<library>" --json → chub get <id> --lang <lang>
|
|
458
|
+
Use fetched docs as ground truth for API signatures. Annotate any gaps: chub annotate <id> "note"
|
|
459
|
+
Skip this step if chub is not installed or the task only touches internal code.
|
|
460
|
+
2. Implement the task
|
|
461
|
+
3. Commit as feat({spec}): {description}
|
|
458
462
|
|
|
459
463
|
Your ONLY job is to write code and commit. The orchestrator will run health checks after you finish.
|
|
460
464
|
```
|
|
@@ -546,6 +550,7 @@ After spawning wave agents, your turn ENDS. Completion notifications drive the l
|
|
|
546
550
|
| Machine-selected winner | Fewer regressions > better coverage > fewer files changed; no LLM judge |
|
|
547
551
|
| Failed probe insights logged | `.deepflow/auto-memory.yaml` in main tree; persists across cycles |
|
|
548
552
|
| Winner cherry-picked to shared worktree | Downstream tasks see winning approach via shared worktree |
|
|
553
|
+
| External APIs → chub first | Agents fetch curated docs before implementing external API calls; skip if chub unavailable |
|
|
549
554
|
|
|
550
555
|
## Example
|
|
551
556
|
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context-hub
|
|
3
|
+
description: Fetches curated API docs for external libraries before coding. Use when implementing code that uses external APIs/SDKs (Stripe, OpenAI, MongoDB, etc.) to avoid hallucinating APIs and reduce token usage.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Hub
|
|
7
|
+
|
|
8
|
+
Fetch curated, versioned docs for external libraries instead of guessing APIs.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
Before writing code that calls an external API or SDK:
|
|
13
|
+
- New library integration (e.g., Stripe payments, AWS S3)
|
|
14
|
+
- Unfamiliar API version or method
|
|
15
|
+
- Complex API with many options (e.g., MongoDB aggregation)
|
|
16
|
+
|
|
17
|
+
**Skip when:** Working with internal code (use LSP instead) or well-known stdlib APIs.
|
|
18
|
+
|
|
19
|
+
## Prerequisites
|
|
20
|
+
|
|
21
|
+
Requires `chub` CLI: `npm install -g @aisuite/chub`
|
|
22
|
+
|
|
23
|
+
If `chub` is not installed, tell the user and skip — don't block implementation.
|
|
24
|
+
|
|
25
|
+
## Workflow
|
|
26
|
+
|
|
27
|
+
### 1. Search for docs
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
chub search "<library or API>" --json
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Example:
|
|
34
|
+
```bash
|
|
35
|
+
chub search "stripe payments" --json
|
|
36
|
+
chub search "mongodb aggregation" --json
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 2. Fetch relevant docs
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
chub get <id> --lang <py|js|ts>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Use `--lang` matching the project language. Use `--full` only if the summary lacks what you need.
|
|
46
|
+
|
|
47
|
+
### 3. Write code using fetched docs
|
|
48
|
+
|
|
49
|
+
Use the retrieved documentation as ground truth for API signatures, parameter names, and patterns.
|
|
50
|
+
|
|
51
|
+
### 4. Annotate discoveries
|
|
52
|
+
|
|
53
|
+
When you find something the docs missed or got wrong:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
chub annotate <id> "Note: method X requires param Y since v2.0"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
This persists locally and appears on future `chub get` calls — the agent learns across sessions.
|
|
60
|
+
|
|
61
|
+
### 5. Rate docs (optional)
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
chub feedback <id> up --label accurate
|
|
65
|
+
chub feedback <id> down --label outdated
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Labels: `accurate`, `outdated`, `incomplete`, `wrong-version`, `helpful`
|
|
69
|
+
|
|
70
|
+
## Integration with LSP
|
|
71
|
+
|
|
72
|
+
| Need | Tool |
|
|
73
|
+
|------|------|
|
|
74
|
+
| Internal code navigation | LSP (`goToDefinition`, `findReferences`) |
|
|
75
|
+
| External API signatures | Context Hub (`chub get`) |
|
|
76
|
+
| Symbol search in project | LSP (`workspaceSymbol`) |
|
|
77
|
+
| Library usage patterns | Context Hub (`chub search`) |
|
|
78
|
+
|
|
79
|
+
**Combined approach:** Use LSP to understand how the project currently uses a library, then use Context Hub to verify correct API usage and discover better patterns.
|
|
80
|
+
|
|
81
|
+
## Rules
|
|
82
|
+
|
|
83
|
+
- Always search before implementing external API calls
|
|
84
|
+
- Trust chub docs over training data for API specifics
|
|
85
|
+
- Annotate gaps so future sessions benefit
|
|
86
|
+
- Don't block on chub failures — fall back to best knowledge
|
|
87
|
+
- Prefer `--json` flag for programmatic parsing in automated workflows
|