@minhduydev/mdpi 0.5.0 → 0.6.0
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/dist/index.js +4 -2
- package/dist/template/.pi/AGENTS.md +1 -1
- package/dist/template/.pi/README.md +2 -3
- package/dist/template/.pi/agents/explore.md +1 -1
- package/dist/template/.pi/agents/scout.md +1 -1
- package/dist/template/.pi/prompts/gc.md +2 -1
- package/dist/template/.pi/prompts/verify.md +24 -0
- package/dist/template/.pi/skills/INDEX.md +1 -0
- package/package.json +1 -1
- package/dist/template/.pi/context/fallow.md +0 -137
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { spawn, spawnSync } from "node:child_process";
|
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
import { mkdir, readdir } from "node:fs/promises";
|
|
12
12
|
//#region package.json
|
|
13
|
-
var version = "0.
|
|
13
|
+
var version = "0.6.0";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/utils/manifest.ts
|
|
16
16
|
/**
|
|
@@ -950,12 +950,14 @@ async function initCommand(options = {}) {
|
|
|
950
950
|
if (only) adaptSettingsJson(piDir, only);
|
|
951
951
|
const manifest = generateManifest(piDir, version);
|
|
952
952
|
const fileCount = Object.keys(manifest.files).length;
|
|
953
|
+
const hasSkills = !only || only.has("skills");
|
|
953
954
|
if (quiet) {
|
|
954
955
|
const subset = only ? ` subset=[${[...only].join(",")}]` : "";
|
|
955
956
|
console.log(`mdpi: installed ${fileCount} files to ${piDir} (v${version})${subset}`);
|
|
956
957
|
} else {
|
|
957
958
|
const subsetNote = only ? `Subset: ${[...only].join(", ")} (+ always-on config).\n\nsettings.json trimmed to drop references to excluded\nskills/prompts/extensions dirs.\n\nNote: mdpi upgrade compares against the FULL template —\nrun \`mdpi upgrade --check\` before applying.\n\n` : "";
|
|
958
|
-
|
|
959
|
+
const fallowHint = hasSkills ? "Fallow skill included (codebase intelligence: dead code,\nduplication, complexity). For JS/TS projects, run `/init`\nin a pi session to generate `.fallowrc.json`; other stacks skip it.\n\n" : "";
|
|
960
|
+
p.note(`Pi kit installed at:\n${piDir}\n\n${fileCount} template files tracked via manifest.\n\n` + subsetNote + fallowHint + `Next: run ${color.cyan("mdpi install")} to install the kit's npm packages,\nthen open pi in this repo to use the kit.`, "Installation complete");
|
|
959
961
|
p.outro(color.green("Ready!"));
|
|
960
962
|
}
|
|
961
963
|
}
|
|
@@ -21,7 +21,7 @@ For project-wide rules (kernel, drift signals, hard constraints, output style),
|
|
|
21
21
|
| `prompts/` | slash commands | Dispatched by primary agent |
|
|
22
22
|
| `workflows/` | DAG workflows | Executed via subagent tool |
|
|
23
23
|
| `templates/` | project context templates | Referenced via auto-inject |
|
|
24
|
-
| `context/` | reference docs (architecture
|
|
24
|
+
| `context/` | reference docs (architecture) | Manual reference only, never auto-injected |
|
|
25
25
|
| `extensions/` | TypeScript extensions | Compiled JS code, gated by pi extension SDK |
|
|
26
26
|
|
|
27
27
|
---
|
|
@@ -95,9 +95,8 @@ pi
|
|
|
95
95
|
├── scripts/ # 1 utility script
|
|
96
96
|
│ └── gc-check.sh # Structural invariants for /gc
|
|
97
97
|
│
|
|
98
|
-
├── context/ #
|
|
99
|
-
│
|
|
100
|
-
│ └── fallow.md # Fallow CLI reference
|
|
98
|
+
├── context/ # 1 reference doc
|
|
99
|
+
│ └── architecture.md # Pi 5-layer architecture
|
|
101
100
|
│
|
|
102
101
|
├── state/ # Runtime state (gitignored)
|
|
103
102
|
│ └── session-summary.{json,md}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: explore
|
|
3
3
|
description: "Fast read-only codebase cartographer — locate files, symbols, and usage patterns with file:line evidence"
|
|
4
4
|
tools: read, grep, find, ls, bash, semantic_query, semantic_inspect, semantic_grep, semantic_show
|
|
5
|
-
model:
|
|
5
|
+
model: opencode-go/deepseek-v4-flash
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
You are Pi — a read-only codebase explorer.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: scout
|
|
3
3
|
description: External research specialist for library docs, API references, and real-world code patterns
|
|
4
4
|
tools: read, bash, find, ls, websearch, codesearch, context7, grepsearch, web_fetch
|
|
5
|
-
model:
|
|
5
|
+
model: opencode-go/deepseek-v4-flash
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
You are Pi — an external research specialist.
|
|
@@ -41,8 +41,9 @@ This command delegates to the `garbage-collection` workflow via the `run_workflo
|
|
|
41
41
|
|
|
42
42
|
1. **Run Fallow scan:**
|
|
43
43
|
```bash
|
|
44
|
-
npx fallow --format json --quiet
|
|
44
|
+
npx fallow --format json --quiet || true
|
|
45
45
|
```
|
|
46
|
+
> Append `|| true`: exit 1 means "issues found" (normal for GC), not a runtime error. Only exit 2 (invalid config/parse) is a real failure — see `fallow` skill Agent Rule 2.
|
|
46
47
|
2. Extract findings: dead code, duplication, complexity hotspots, unused exports
|
|
47
48
|
|
|
48
49
|
### Phase 2: Quality Grade Update
|
|
@@ -41,6 +41,7 @@ Check implementation against PRD before shipping.
|
|
|
41
41
|
| `verification-before-completion` | Always | Evidence-before-claims; phantom detection; verification cache protocol; Worker Distrust Protocol |
|
|
42
42
|
| `code-review-and-quality` | Phase 4 coherence check | Cross-reference artifacts for correctness |
|
|
43
43
|
| `testing-anti-patterns` | Phase 3 after tests pass | Detect mock-only tests, production pollution, and fragile assertions |
|
|
44
|
+
| `fallow` | Phase 2b (advisory) | Changed-file structural risk — dead code, complexity, duplication introduced by this change. Non-blocking. |
|
|
44
45
|
| `dcp-hygiene` | Phase 5 Report | Compress the closed gate output (typecheck/lint/test) when `compress` is available |
|
|
45
46
|
|
|
46
47
|
## Phase 0: Verification Cache
|
|
@@ -84,6 +85,7 @@ Report results with mode column:
|
|
|
84
85
|
| Lint | PASS | incremental | 0.3s |
|
|
85
86
|
| Test | PASS | incremental | 1.2s |
|
|
86
87
|
| Build | SKIP | — | — |
|
|
88
|
+
| Fallow | ADVISORY | new-only | 0.8s |
|
|
87
89
|
```
|
|
88
90
|
|
|
89
91
|
After all gates pass, load `testing-anti-patterns` skill and audit tests for mock-only coverage, fragile assertions, and production code pollution.
|
|
@@ -92,6 +94,27 @@ If `--fix` flag provided, run the project's auto-fix command (e.g., `npm run lin
|
|
|
92
94
|
|
|
93
95
|
**After all gates pass**, record to verification cache per `verification-before-completion` skill's cache protocol.
|
|
94
96
|
|
|
97
|
+
### Phase 2b: Structural Risk Advisory (fallow)
|
|
98
|
+
|
|
99
|
+
After the hard gates pass, run a **non-blocking** structural-risk scan over the change set. This surfaces dead code, complexity, and duplication **introduced by this change** — it never blocks `/verify` or `/ship`.
|
|
100
|
+
|
|
101
|
+
Load the `fallow` skill. Determine the PR base, then run the changed-file audit:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
BASE=$(git merge-base HEAD origin/main 2>/dev/null || git merge-base HEAD main 2>/dev/null || echo "HEAD~1")
|
|
105
|
+
npx fallow audit --base "$BASE" --gate new-only --format json --quiet 2>/dev/null || true
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
> `--gate new-only` restricts to issues introduced since `$BASE` so pre-existing findings don't noise the report. `|| true` + `2>/dev/null`: exit 1 = issues found (normal), exit 2 = real error. If fallow is not installed, the project is not JS/TS, or there is no git base, this step is a **silent no-op** — never block on it.
|
|
109
|
+
|
|
110
|
+
Parse the JSON `verdict` (`pass` | `warn` | `fail`) and `issues[]`. Report as the **ADVISORY** row in the Phase 2 table above.
|
|
111
|
+
|
|
112
|
+
**Blocking policy — never blocks:**
|
|
113
|
+
- Fallow findings are logged to `.pi/artifacts/$SLUG/progress.md` as advisory and surfaced in the Phase 5 Report under "Structural risk (advisory)".
|
|
114
|
+
- They are candidates for a follow-up `/gc --scope <path>` or `/fix` — NOT a ship blocker.
|
|
115
|
+
|
|
116
|
+
**Escalate (agent judgment, still no auto-block):** if verdict is `fail` with >5 NEW issues or any NEW circular dependency / architecture boundary violation, surface it prominently to the user and suggest running `/gc --scope <path>` before shipping.
|
|
117
|
+
|
|
95
118
|
## Phase 3: Coherence (skip with --quick)
|
|
96
119
|
|
|
97
120
|
Cross-reference artifacts for contradictions:
|
|
@@ -155,3 +178,4 @@ Append to `.pi/artifacts/$SLUG/progress.md`: `Verification: [PASS|PARTIAL|FAIL]
|
|
|
155
178
|
- `verification-before-completion` — evidence gate, cache protocol, phantom detection, Worker Distrust Protocol (all phases)
|
|
156
179
|
- `code-review-and-quality` — coherence cross-reference (Phase 3)
|
|
157
180
|
- `testing-anti-patterns` — mock-only test detection (Phase 2 post-gate)
|
|
181
|
+
- `fallow` — changed-file structural risk advisory, non-blocking (Phase 2b)
|
|
@@ -47,6 +47,7 @@ When the user's prompt contains these keywords (case-insensitive), the listed sk
|
|
|
47
47
|
| performance, slow, latency, optimize, profile, bundle size | `performance-optimization` |
|
|
48
48
|
| bug, fix, error, crash, broken, debug, trace | `debugging-and-error-recovery`, `root-cause-tracing` |
|
|
49
49
|
| refactor, cleanup, simplify, clean code, complex | `code-cleanup`, `code-simplification`, `deep-module-design` |
|
|
50
|
+
| dead code, duplication, circular dependency, unused exports, unused dependencies, complexity hotspot, codebase health, fallow | `fallow` |
|
|
50
51
|
| test, spec, verify, assert, coverage, TDD | `test-driven-development`, `testing-anti-patterns` |
|
|
51
52
|
| review, audit, quality, check, PR | `code-review-and-quality`, `agent-code-quality-gate` |
|
|
52
53
|
| design, UI, component, style, layout, CSS, tailwind, DESIGN.md, design identity, design token, brand identity | `frontend-design`, `design-taste-frontend` |
|
package/package.json
CHANGED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
purpose: Fallow codebase intelligence commands for AI agents — dead code, duplication, complexity, and audit gating
|
|
3
|
-
updated: 2026-06-04
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Fallow — Codebase Intelligence Reference
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
Fallow is a Rust-native, deterministic static analysis tool for TypeScript/JavaScript codebases.
|
|
11
|
-
**No AI inside the analyzer** — same input always produces the same output.
|
|
12
|
-
It builds a complete module graph to find issues no linter or type checker can see.
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## Commands
|
|
17
|
-
|
|
18
|
-
### Full Analysis (single pass)
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npx fallow # All analyses: dead code + duplication + health
|
|
22
|
-
npx fallow --format json # Structured output for agent parsing
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### Dead Code
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npx fallow dead-code # Full dead code report
|
|
29
|
-
npx fallow dead-code --format json --quiet # JSON for agents
|
|
30
|
-
npx fallow dead-code --unused-exports # Only unused exports
|
|
31
|
-
npx fallow dead-code --unused-dependencies # Only unused deps
|
|
32
|
-
npx fallow dead-code --circular # Only circular deps
|
|
33
|
-
npx fallow fix --dry-run # Preview safe auto-fixes
|
|
34
|
-
npx fallow fix --yes # Apply auto-fixes
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### Trace (investigate before deleting)
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npx fallow dead-code --trace FILE:EXPORT_NAME # Why is this export flagged?
|
|
41
|
-
npx fallow dead-code --trace-dependency PACKAGE_NAME # Where is this dep imported?
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### Duplication
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
npx fallow dupes # Find code clones
|
|
48
|
-
npx fallow dupes --mode strict # Exact matches only
|
|
49
|
-
npx fallow dupes --mode weak # Structural matches
|
|
50
|
-
npx fallow dupes --trace FILE:LINE # Deep-dive a specific clone group
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Health (complexity)
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
npx fallow health # Complexity hotspots + refactoring targets
|
|
57
|
-
npx fallow health --format json # Structured output
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Audit Gate (for CI / pre-commit)
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
npx fallow audit # Check changed files (verdict: pass/warn/fail)
|
|
64
|
-
npx fallow audit --format json # Structured verdict for agents
|
|
65
|
-
npx fallow audit --gate new-only # Only flag new issues, not pre-existing
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
## Workflow Patterns
|
|
71
|
-
|
|
72
|
-
### Post-Edit Verification Loop
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
# 1. Make changes
|
|
76
|
-
# 2. Run audit
|
|
77
|
-
npx fallow audit --format json --quiet
|
|
78
|
-
# 3. If verdict is "fail", inspect findings
|
|
79
|
-
# 4. Fix or investigate with --trace
|
|
80
|
-
# 5. Re-run audit until pass
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Codebase Cleanup
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
npx fallow # Full picture
|
|
87
|
-
npx fallow dead-code --format json # Find unused code
|
|
88
|
-
npx fallow fix --dry-run # Preview auto-removals
|
|
89
|
-
npx fallow fix --yes # Apply auto-fixes
|
|
90
|
-
npx fallow dupes # Find duplication
|
|
91
|
-
npx fallow health # Find complexity hotspots
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### Monorepo / Workspace
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
npx fallow --workspace # Analyze all workspaces
|
|
98
|
-
npx fallow --workspace packages/pkg # Analyze specific workspace
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## Understanding Output
|
|
104
|
-
|
|
105
|
-
Every finding in `--format json` includes:
|
|
106
|
-
|
|
107
|
-
```json
|
|
108
|
-
{
|
|
109
|
-
"path": "src/utils/example.ts:42",
|
|
110
|
-
"issue_type": "unused-exports",
|
|
111
|
-
"actions": [
|
|
112
|
-
{
|
|
113
|
-
"type": "delete-export",
|
|
114
|
-
"auto_fixable": true,
|
|
115
|
-
"description": "Remove unused export"
|
|
116
|
-
}
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
The `actions[]` array is machine-actionable. Agents can inspect `auto_fixable` flags and apply safe fixes programmatically.
|
|
122
|
-
|
|
123
|
-
---
|
|
124
|
-
|
|
125
|
-
## Config
|
|
126
|
-
|
|
127
|
-
Fallow auto-detects your project. For custom config, run:
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
npx fallow init # Generates .fallow/config.yaml with auto-detected settings
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Common config patterns:
|
|
134
|
-
- `ignorePatterns` — exclude directories from analysis (e.g., `.pi/`)
|
|
135
|
-
- `entry` — declare additional entry points
|
|
136
|
-
- `publicPackages` — packages with public API surface
|
|
137
|
-
- `rules` — custom issue severity rules
|