@donotdev/cli 0.3.6 → 0.3.8
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/dependencies-matrix.json +41 -21
- package/dist/bin/commands/agent-setup.js +927 -132
- package/dist/bin/commands/build.js +30 -33
- package/dist/bin/commands/bump.js +450 -329
- package/dist/bin/commands/create-project.js +61 -15
- package/dist/bin/commands/db-check.js +443 -222
- package/dist/bin/commands/db.js +443 -222
- package/dist/bin/commands/deploy.js +8487 -8064
- package/dist/bin/commands/dev.js +230 -2
- package/dist/bin/commands/make-admin.js +30 -33
- package/dist/bin/commands/seed.js +454 -229
- package/dist/bin/commands/setup-cicd.js +43 -209
- package/dist/bin/commands/setup.js +6382 -2851
- package/dist/bin/commands/staging.js +8087 -7816
- package/dist/bin/commands/sync-secrets.js +117 -116
- package/dist/bin/commands/type-check.js +30 -33
- package/dist/bin/commands/uat.js +26340 -0
- package/dist/bin/dndev.js +48 -37
- package/dist/index.js +9630 -8218
- package/package.json +1 -1
- package/templates/app-vite/src/pages/HomePage.tsx.example +0 -12
- package/templates/root-consumer/.claude/agents/coder.md.example +1 -1
- package/templates/root-consumer/.claude/agents/prompt-engineer.md.example +1 -1
- package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +11 -2
- package/templates/root-consumer/.claude/hooks/session-start.sh.example +33 -42
- package/templates/root-consumer/.claude/settings.json.example +11 -0
- package/templates/root-consumer/README.md.example +1 -3
package/package.json
CHANGED
|
@@ -120,18 +120,6 @@ export default function HomePage() {
|
|
|
120
120
|
]}
|
|
121
121
|
/>
|
|
122
122
|
|
|
123
|
-
<Card
|
|
124
|
-
title="Staging Environment"
|
|
125
|
-
subtitle="Separate Firebase project for testing"
|
|
126
|
-
content={[
|
|
127
|
-
'Create a second Firebase project (e.g. my-app-staging)',
|
|
128
|
-
'Add to .firebaserc: { "projects": { "staging": "my-app-staging" } }',
|
|
129
|
-
'Create .env.staging with staging Firebase config',
|
|
130
|
-
'Create service-account-key.staging.json',
|
|
131
|
-
'Deploy with: dndev staging',
|
|
132
|
-
]}
|
|
133
|
-
/>
|
|
134
|
-
|
|
135
123
|
<Card
|
|
136
124
|
title="Secrets (Stripe, OAuth, etc.)"
|
|
137
125
|
subtitle="Server-side API keys for Cloud Functions"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# .claude/hooks/guard-bash.sh
|
|
3
3
|
# PreToolUse hook for Bash commands.
|
|
4
4
|
# Blocks dangerous/wrong commands. Exit 2 = block, exit 0 = allow.
|
|
5
|
-
# tsc / install checks look at command words only (not heredocs, quotes, comments).
|
|
5
|
+
# tsc / install / test-runner checks look at command words only (not heredocs, quotes, comments).
|
|
6
6
|
# Uses bun -e for JSON parsing (bun-first project).
|
|
7
7
|
|
|
8
8
|
set -euo pipefail
|
|
@@ -16,7 +16,7 @@ COMMAND=$(echo "$INPUT" | bun -e "process.stdout.write(JSON.parse(await Bun.stdi
|
|
|
16
16
|
# Command-word analysis (tsc / package-manager install).
|
|
17
17
|
# Splits the command into simple commands (on ; & | ( ) and newlines), ignoring quoted strings,
|
|
18
18
|
# comments and heredoc bodies, then looks only at each command's leading words.
|
|
19
|
-
# Prints "tsc" or "install" for the first offending simple command, nothing otherwise.
|
|
19
|
+
# Prints "tsc", "test" or "install" for the first offending simple command, nothing otherwise.
|
|
20
20
|
ANALYZER=$(cat <<'JS'
|
|
21
21
|
const src = await Bun.stdin.text();
|
|
22
22
|
const cmds = [];
|
|
@@ -86,6 +86,7 @@ endCmd();
|
|
|
86
86
|
|
|
87
87
|
const base = (w) => w.slice(w.lastIndexOf('/') + 1);
|
|
88
88
|
const PM = ['bun', 'npm', 'yarn', 'pnpm'];
|
|
89
|
+
const TEST_RUNNERS = ['vitest', 'jest', 'playwright'];
|
|
89
90
|
let verdict = '';
|
|
90
91
|
for (const w0 of cmds) {
|
|
91
92
|
let w = w0;
|
|
@@ -100,6 +101,8 @@ for (const w0 of cmds) {
|
|
|
100
101
|
}
|
|
101
102
|
if (head === 'tsc') { verdict = 'tsc'; break; }
|
|
102
103
|
if (runner && rest.find((a) => !a.startsWith('-')) === 'tsc') { verdict = 'tsc'; break; }
|
|
104
|
+
if (PM.includes(head) && (rest[0] === 'test' || (rest[0] === 'run' && /^test(:|$)/.test(rest[1] ?? '')))) { verdict = 'test'; break; }
|
|
105
|
+
if (TEST_RUNNERS.includes(head) || (runner && TEST_RUNNERS.includes(rest.find((a) => !a.startsWith('-')) ?? ''))) { verdict = 'test'; break; }
|
|
103
106
|
if (PM.includes(head) && (rest[0] === 'install' || rest[0] === 'i') && !verdict) verdict = 'install';
|
|
104
107
|
}
|
|
105
108
|
process.stdout.write(verdict);
|
|
@@ -113,6 +116,12 @@ if [ "$VERDICT" = "tsc" ]; then
|
|
|
113
116
|
exit 2
|
|
114
117
|
fi
|
|
115
118
|
|
|
119
|
+
# Block raw test runners (must use dn test: raw runners pick up the Playwright e2e specs)
|
|
120
|
+
if [ "$VERDICT" = "test" ]; then
|
|
121
|
+
echo "BLOCKED: Run tests with 'dn test --app <app>' (UAT: 'dn test:uat'), never raw bun test / vitest / playwright: they pick up the e2e specs and report false failures." >&2
|
|
122
|
+
exit 2
|
|
123
|
+
fi
|
|
124
|
+
|
|
116
125
|
# Block reinstall once dependencies are installed (the first install of a fresh scaffold is allowed)
|
|
117
126
|
# bun add IS allowed — consumer projects may need additional packages
|
|
118
127
|
if [ "$VERDICT" = "install" ] && [ -d "${CLAUDE_PROJECT_DIR:-.}/node_modules" ]; then
|
|
@@ -1,50 +1,41 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# .claude/hooks/session-start.sh
|
|
3
|
-
#
|
|
4
|
-
#
|
|
2
|
+
# .claude/hooks/session-start.sh [subagent]
|
|
3
|
+
# SessionStart (startup, /clear, compaction): active phase + project lessons, plain text.
|
|
4
|
+
# SubagentStart (arg "subagent"): project lessons as additionalContext JSON, so every
|
|
5
|
+
# subagent gets them without a brief carrying them. Explore gets nothing (read-only search);
|
|
6
|
+
# Plan starts without CLAUDE.md, so it is told to read AGENTS.md and the rules.
|
|
7
|
+
# Lessons: .dndev/LESSONS.md bullets, deprecated and anti-pattern ones left out, score suffix stripped.
|
|
5
8
|
|
|
6
9
|
set -euo pipefail
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
cd "$CLAUDE_PROJECT_DIR"
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
bun -e '
|
|
14
|
+
const mode = process.argv[1] ?? "session";
|
|
15
|
+
const read = async (p) => ((await Bun.file(p).exists()) ? Bun.file(p).text() : "");
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const lessons = (await read(".dndev/LESSONS.md"))
|
|
18
|
+
.split("\n")
|
|
19
|
+
.filter((l) => l.startsWith("- [") && !/status:(deprecated|anti-pattern)/.test(l))
|
|
20
|
+
.map((l) => l.replace(/\s*\{helpful:\d+,harmful:\d+,lastSeen:[^}]+\}$/, ""));
|
|
21
|
+
const lessonsBlock = lessons.length
|
|
22
|
+
? "Project lessons (owner rules learned the hard way; they override your defaults):\n" + lessons.join("\n")
|
|
23
|
+
: "";
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
echo "WAI-WAY Phase: $CURRENT"
|
|
32
|
-
else
|
|
33
|
-
echo "WAI-WAY Phase: not started - call start_phase(0)"
|
|
34
|
-
fi
|
|
35
|
-
fi
|
|
25
|
+
if (mode === "subagent") {
|
|
26
|
+
const { agent_type } = JSON.parse(await Bun.stdin.text());
|
|
27
|
+
if (agent_type === "Explore") process.exit(0);
|
|
28
|
+
const parts = [lessonsBlock];
|
|
29
|
+
if (agent_type === "Plan") parts.unshift("Read AGENTS.md and every .claude/rules/*.md file before you plan: they are the project rules.");
|
|
30
|
+
const context = parts.filter(Boolean).join("\n\n");
|
|
31
|
+
if (context) process.stdout.write(JSON.stringify({ hookSpecificOutput: { hookEventName: "SubagentStart", additionalContext: context } }));
|
|
32
|
+
process.exit(0);
|
|
33
|
+
}
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
grep '^## ' "$LESSONS_FILE" | tail -3 | sed 's/^/ /'
|
|
45
|
-
fi
|
|
46
|
-
fi
|
|
47
|
-
|
|
48
|
-
echo ""
|
|
49
|
-
echo "REMINDER: Root instructions are in AGENTS.md. Use lookup_symbol before @donotdev imports."
|
|
50
|
-
echo "=== END CONTEXT ==="
|
|
35
|
+
const protocolText = await read(".dndev/protocol.json");
|
|
36
|
+
const protocol = protocolText ? JSON.parse(protocolText) : {};
|
|
37
|
+
const phaseLine = Number.isInteger(protocol.currentPhase)
|
|
38
|
+
? `DoNotDev phase: ${protocol.currentPhase} ${protocol.phaseName}. Call start_phase(${protocol.currentPhase}) before any work; if it fails, stop and report the exact error.`
|
|
39
|
+
: "DoNotDev phase: none started. Call start_phase(0) before any work; if it fails, stop and report the exact error.";
|
|
40
|
+
process.stdout.write([phaseLine, lessonsBlock].filter(Boolean).join("\n\n") + "\n");
|
|
41
|
+
' "${1:-session}"
|
|
@@ -11,6 +11,17 @@
|
|
|
11
11
|
]
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
+
"SubagentStart": [
|
|
15
|
+
{
|
|
16
|
+
"matcher": "",
|
|
17
|
+
"hooks": [
|
|
18
|
+
{
|
|
19
|
+
"type": "command",
|
|
20
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/session-start.sh\" subagent"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
],
|
|
14
25
|
"PreToolUse": [
|
|
15
26
|
{
|
|
16
27
|
"matcher": "Bash",
|
|
@@ -24,8 +24,7 @@ Open the app and follow the setup steps on the homepage (Git, Firebase, Stripe,
|
|
|
24
24
|
│ └── my-app/
|
|
25
25
|
│ ├── .env ← Vite reads THIS one
|
|
26
26
|
│ ├── .env.local ← Overrides .env (gitignored)
|
|
27
|
-
│
|
|
28
|
-
│ └── .env.staging ← Staging overrides (used by dndev staging)
|
|
27
|
+
│ └── .env.production ← Production overrides
|
|
29
28
|
└── functions/
|
|
30
29
|
└── .env ← Server-side secrets (Stripe, OAuth, etc.)
|
|
31
30
|
```
|
|
@@ -45,7 +44,6 @@ dndev emu start # Start Firebase emulators (Auth, Firestore, Functi
|
|
|
45
44
|
|
|
46
45
|
# Deployment
|
|
47
46
|
dndev deploy # Deploy to Firebase (hosting + functions + rules)
|
|
48
|
-
dndev staging # Deploy to staging environment
|
|
49
47
|
dndev sync-secrets # Push .dndev.secrets values to Firebase Secret Manager
|
|
50
48
|
|
|
51
49
|
# Quality
|