From 6290aa5850ddb45f191dcb502e960451bff53575 Mon Sep 17 00:00:00 2001 From: gititya Date: Wed, 25 Mar 2026 01:03:57 +0530 Subject: [PATCH] feat: add build confirmation prompt and --no-primer flag (V2 complete) - Prompt "Run build check? (~30s) [Y/n]:" before auto-running npm run build; --no-build still bypasses entirely - Add --no-primer flag to omit the Claude-specific HTML comment from output - Mark all V2 scope items complete in CLAUDE.md and SKILL.md Co-Authored-By: Claude Sonnet 4.6 (1M context) --- CLAUDE.md | 10 +++++----- SKILL.md | 12 ++++++++++++ bin/index.js | 18 ++++++++++++++++-- src/format.js | 4 ++-- 4 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 SKILL.md diff --git a/CLAUDE.md b/CLAUDE.md index 31bca74..8d73b80 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -29,11 +29,11 @@ src/collectors/config.js — Firebase env key presence check (never exposes val ## V1 scope (what's done) Detect framework → prompt for error → collect build/git/config → format → clipboard. -## V2 scope (from plan + security docs) -- `--no-build` flag to skip npm run build -- Confirmation prompt before build check (opt-in instead of auto) -- `--no-primer` flag to omit the embedded `` comment -- Hardened input validation (graceful failures, not crashes) +## V2 scope (complete as of 2026-03-25) +- ✅ `--no-build` flag to skip npm run build +- ✅ Confirmation prompt before build check (opt-in instead of auto) +- ✅ `--no-primer` flag to omit the embedded `` comment +- ✅ Hardened input validation (graceful failures, not crashes) ## V3 parking lot (explicitly not V1 or V2) - Code-level context: read actual file lines from stack trace references diff --git a/SKILL.md b/SKILL.md new file mode 100644 index 0000000..4efb7d1 --- /dev/null +++ b/SKILL.md @@ -0,0 +1,12 @@ +# SKILL.md — devdump session state + +## V2 status (as of 2026-03-25) +All V2 scope items complete: +- ✅ `--no-build` flag (bin/index.js) +- ✅ Confirmation prompt before build check — "Run build check? (~30s) [Y/n]:" (bin/index.js); `--no-build` bypasses prompt entirely +- ✅ `--no-primer` flag — omits `` comment from output (bin/index.js + src/format.js) +- ✅ Hardened input validation — try/catch on all collectors, 2-attempt retry in prompt.js + +## Ready for +- V3 features (parking lot in CLAUDE.md) +- Pre-publish checklist (remove PLAN.md, SECURITY.md before going public) diff --git a/bin/index.js b/bin/index.js index e235fc3..1f5f931 100755 --- a/bin/index.js +++ b/bin/index.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +import readline from 'readline'; import { execSync } from 'child_process'; import { existsSync } from 'fs'; import { join } from 'path'; @@ -29,7 +30,20 @@ console.log(`Detected: ${framework}${firebase ? ' + Firebase' : ''}`); // Step 2: Prompt for console error (highest value — ask first) const { error, filePaths } = await promptForError(); -const skipBuild = process.argv.includes('--no-build'); +let skipBuild = process.argv.includes('--no-build'); +const skipPrimer = process.argv.includes('--no-primer'); + +// Confirmation prompt before slow build check +if (!skipBuild) { + const runBuild = await new Promise(resolve => { + const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); + rl.question('Run build check? (~30s) [Y/n]: ', answer => { + rl.close(); + resolve(answer === '' || answer.toLowerCase() === 'y'); + }); + }); + if (!runBuild) skipBuild = true; +} // Step 3: Auto-collect (runs after user input) console.log('\n⏳ Collecting diagnostics...'); @@ -54,7 +68,7 @@ try { } catch {} // Step 4: Format -const output = formatOutput({ error, filePaths, build, git, configCommits, config, env: envLine }); +const output = formatOutput({ error, filePaths, build, git, configCommits, config, env: envLine, primer: !skipPrimer }); // Step 5: Copy to clipboard + print console.log('\n' + '─'.repeat(50)); diff --git a/src/format.js b/src/format.js index 54961ec..2ba1063 100644 --- a/src/format.js +++ b/src/format.js @@ -1,4 +1,4 @@ -export function formatOutput({ error, filePaths, build, git, configCommits, config, env }) { +export function formatOutput({ error, filePaths, build, git, configCommits, config, env, primer = true }) { const lines = []; lines.push('## devdump'); @@ -73,7 +73,7 @@ export function formatOutput({ error, filePaths, build, git, configCommits, conf lines.push(''); // Embedded instruction (invisible to most readers, visible to Claude) - lines.push(''); + if (primer) lines.push(''); return lines.join('\n'); }