diff --git a/install.js b/install.js index 646bcef..9f439ad 100644 --- a/install.js +++ b/install.js @@ -976,12 +976,11 @@ async function install() { return 1; } - // Point at the dashboard first: the `plan2code` command when it installed, the skill otherwise. - const dashboardWhere = launcherFailed ? 'Open the dashboard in your agent:' : 'Open the dashboard from any project:'; - const dashboardCommand = launcherFailed ? '/plan2code' : LAUNCHER_COMMAND; + // The steps come first: where to start, the ways in, and what to do without an agent. + printGettingStarted({ commandInstalled: !launcherFailed }); console.log(`${COLORS.GREEN} ╭───╮${COLORS.RESET} ${COLORS.BRIGHT}All done! Happy coding!${COLORS.RESET}`); - console.log(`${COLORS.GREEN} ╲│ ${COLORS.CYAN}★${COLORS.GREEN} │╱${COLORS.RESET} ${COLORS.BRIGHT}${dashboardWhere}${COLORS.RESET}`); - console.log(`${COLORS.GREEN} │ ${COLORS.BRIGHT}◡${COLORS.GREEN} │${COLORS.RESET} ${COLORS.BRIGHT}${COLORS.CYAN}${dashboardCommand}${COLORS.RESET}`); + console.log(`${COLORS.GREEN} ╲│ ${COLORS.CYAN}★${COLORS.GREEN} │╱${COLORS.RESET}`); + console.log(`${COLORS.GREEN} │ ${COLORS.BRIGHT}◡${COLORS.GREEN} │${COLORS.RESET}`); console.log(`${COLORS.GREEN} ╰┬─┬╯${COLORS.RESET} ${COLORS.DIM}Docs:${COLORS.RESET} ${COLORS.BRIGHT}https://github.com/jparkerweb/plan2code${COLORS.RESET}`); console.log(''); console.log(`${COLORS.DIM} Update later with:${COLORS.RESET} ${COLORS.CYAN}npx skills update -g${COLORS.RESET}`); @@ -990,6 +989,42 @@ async function install() { return launcherFailed ? 1 : 0; } +/** + * Print what to do after installing: where to start, the ways in, and what to do when no AI + * agent is installed. Used at the end of every install route so they all end the same way. + */ +function printGettingStarted({ commandInstalled }) { + const agents = ['claude', 'devin', 'codex'].filter((name) => isCommandOnPath(name)); + const line = (text = '') => console.log(` ${text}`); + console.log(`${COLORS.CYAN}╔═══════════════════════════════════════════════════════════════════════════╗${COLORS.RESET}`); + console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}HOW TO USE PLAN2CODE${COLORS.RESET}`, 76) + `${COLORS.CYAN}║${COLORS.RESET}`); + console.log(`${COLORS.CYAN}╚═══════════════════════════════════════════════════════════════════════════╝${COLORS.RESET}`); + console.log(''); + line(`${COLORS.BRIGHT}1. Open a terminal IN the project you want to work on${COLORS.RESET}`); + line(' Plan2Code works on the folder you start it in.'); + line(` ${COLORS.CYAN}cd path/to/your-project${COLORS.RESET}`); + console.log(''); + line(`${COLORS.BRIGHT}2. Start Plan2Code${COLORS.RESET}`); + if (commandInstalled) { + line(` ${COLORS.CYAN}${LAUNCHER_COMMAND}${COLORS.RESET} opens your AI agent on the Plan2Code dashboard`); + line(` or, inside the agent itself: ${COLORS.CYAN}/plan2code${COLORS.RESET} (Claude Code, Devin) ${COLORS.CYAN}$plan2code${COLORS.RESET} (Codex)`); + } else { + line(` Inside your AI agent, type ${COLORS.CYAN}/plan2code${COLORS.RESET} (Claude Code, Devin) or ${COLORS.CYAN}$plan2code${COLORS.RESET} (Codex)`); + } + console.log(''); + line(`${COLORS.BRIGHT}3. Pick a card on the page that opens in your browser${COLORS.RESET}`); + line(' Any AI agent that reads Agent Skills can run Plan2Code the same way.'); + console.log(''); + if (agents.length === 0) { + console.log(` ${COLORS.YELLOW}${SYMBOLS.WARNING} NO AI AGENT FOUND ON THIS COMPUTER${COLORS.RESET}`); + line('Plan2Code runs inside an AI coding agent. Install one, open a new terminal, then follow the steps above:'); + line(` Claude Code ${COLORS.CYAN}npm i -g @anthropic-ai/claude-code${COLORS.RESET}`); + line(` Codex ${COLORS.CYAN}npm i -g @openai/codex${COLORS.RESET}`); + line(' Devin https://devin.ai'); + console.log(''); + } +} + // ============================================================================ // UNINSTALLATION // ============================================================================ @@ -1109,47 +1144,30 @@ function runInteractive() { console.log(`${COLORS.CYAN}╔═════════════════════════════════════════════════════════╗${COLORS.RESET}`); console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}INSTALL PLAN2CODE${COLORS.RESET}`, 58) + `${COLORS.CYAN}║${COLORS.RESET}`); console.log(`${COLORS.CYAN}╠═════════════════════════════════════════════════════════╣${COLORS.RESET}`); - console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}I.${COLORS.RESET} ${COLORS.GREEN}INSTALL${COLORS.RESET} Install Plan2Code skills everywhere`, 58) + `${COLORS.CYAN}║${COLORS.RESET}`); - console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}A.${COLORS.RESET} ${COLORS.MAGENTA}ALL${COLORS.RESET} Install Plan2Code + dev tools`, 58) + `${COLORS.CYAN}║${COLORS.RESET}`); - console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}U.${COLORS.RESET} ${COLORS.RED}UNINSTALL${COLORS.RESET} Remove Plan2Code skills and dev tools`, 58) + `${COLORS.CYAN}║${COLORS.RESET}`); - console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}C.${COLORS.RESET} ${COLORS.BLUE}CUSTOM${COLORS.RESET} Advanced options`, 58) + `${COLORS.CYAN}║${COLORS.RESET}`); + console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}I.${COLORS.RESET} ${COLORS.GREEN}INSTALL${COLORS.RESET} Install skills + the plan2code command`, 58) + `${COLORS.CYAN}║${COLORS.RESET}`); + console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}U.${COLORS.RESET} ${COLORS.RED}UNINSTALL${COLORS.RESET} Remove everything Plan2Code installed`, 58) + `${COLORS.CYAN}║${COLORS.RESET}`); + console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}A.${COLORS.RESET} ${COLORS.BLUE}ADVANCED${COLORS.RESET} Project install, dev tools, and more`, 58) + `${COLORS.CYAN}║${COLORS.RESET}`); console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}Q.${COLORS.RESET} ${COLORS.DIM}QUIT${COLORS.RESET} Exit`, 58) + `${COLORS.CYAN}║${COLORS.RESET}`); console.log(`${COLORS.CYAN}╚═════════════════════════════════════════════════════════╝${COLORS.RESET}`); console.log(''); // Input prompt console.log(''); - const answer = await question(`${COLORS.CYAN}${SYMBOLS.SELECT} SELECT OPTION${COLORS.RESET} (I, A, U, C, Q) [I]: `); + const answer = await question(`${COLORS.CYAN}${SYMBOLS.SELECT} SELECT OPTION${COLORS.RESET} (I, U, A, Q) [I]: `); const input = answer.trim().toUpperCase() || 'I'; - // I path — skills only. The loop remains optional via A or Custom → O. + // I path: skills and the plan2code command. The dev tools stay optional under Advanced. if (input === 'I') { rl.close(); process.exit(await install()); } - // A path — Install Everything (skills + loop + bot + metrics + Claude status line) - if (input === 'A') { - rl.close(); - const loopResult = installPlan2CodeLoop(); - console.log(''); - const botResult = installPlan2CodeBot(); - console.log(''); - const metricsResult = installPlan2CodeMetrics(); - console.log(''); - const statusLineResult = await installStatusLine(); - console.log(''); - const installResult = await install(); - const exitCode = loopResult !== 0 ? loopResult : botResult !== 0 ? botResult : metricsResult !== 0 ? metricsResult : statusLineResult !== 0 ? statusLineResult : installResult; - process.exit(exitCode); - } - // U path — Uninstall All if (input === 'U') { console.log(''); console.log(`${COLORS.RED} ╭───╮${COLORS.RESET}`); console.log(`${COLORS.RED} ╲│ ${COLORS.YELLOW}★${COLORS.RED} │╱${COLORS.RESET} ${COLORS.YELLOW}!${COLORS.RESET}`); - console.log(`${COLORS.RED} │ ${COLORS.YELLOW}~${COLORS.RED} │${COLORS.RESET} ${COLORS.DIM}Are you sure? This will remove Plan2Code from all platforms.${COLORS.RESET}`); + console.log(`${COLORS.RED} │ ${COLORS.YELLOW}~${COLORS.RED} │${COLORS.RESET} ${COLORS.DIM}Are you sure? This removes everything Plan2Code installed: skills, the plan2code command and any dev tools.${COLORS.RESET}`); console.log(`${COLORS.RED} ╰┬─┬╯${COLORS.RESET}`); console.log(''); const confirmAnswer = await question(`${COLORS.RED}${SYMBOLS.SELECT} CONFIRM UNINSTALL${COLORS.RESET} (Y/N) [N]: `); @@ -1172,11 +1190,11 @@ function runInteractive() { } } - // C path — CUSTOM sub-menu - if (input === 'C') { + // A path: ADVANCED sub-menu + if (input === 'A') { console.log(''); console.log(`${COLORS.CYAN}╔════════════════════════════════════════════════════════════════╗${COLORS.RESET}`); - console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}CUSTOM OPTIONS${COLORS.RESET}`, 65) + `${COLORS.CYAN}║${COLORS.RESET}`); + console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}ADVANCED OPTIONS${COLORS.RESET}`, 65) + `${COLORS.CYAN}║${COLORS.RESET}`); console.log(`${COLORS.CYAN}╠════════════════════════════════════════════════════════════════╣${COLORS.RESET}`); console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}L.${COLORS.RESET} ${COLORS.BLUE}LOCAL${COLORS.RESET} Install skills into the current project only`, 65) + `${COLORS.CYAN}║${COLORS.RESET}`); console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}O.${COLORS.RESET} ${COLORS.GREEN}LOOP CLI${COLORS.RESET} Install plan2code-loop CLI only`, 65) + `${COLORS.CYAN}║${COLORS.RESET}`); @@ -1184,53 +1202,70 @@ function runInteractive() { console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}S.${COLORS.RESET} ${COLORS.GREEN}STATUS${COLORS.RESET} Install Claude Code status line`, 65) + `${COLORS.CYAN}║${COLORS.RESET}`); console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}B.${COLORS.RESET} ${COLORS.GREEN}BOT${COLORS.RESET} Install plan2code-bot CLI only`, 65) + `${COLORS.CYAN}║${COLORS.RESET}`); console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}D.${COLORS.RESET} ${COLORS.GREEN}P2C CMD${COLORS.RESET} Install the plan2code command only`, 65) + `${COLORS.CYAN}║${COLORS.RESET}`); + console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}E.${COLORS.RESET} ${COLORS.MAGENTA}EVERYTHING${COLORS.RESET} Install Plan2Code + all dev tools`, 65) + `${COLORS.CYAN}║${COLORS.RESET}`); console.log(padEndVisible(`${COLORS.CYAN}║${COLORS.RESET} ${COLORS.BRIGHT}Q.${COLORS.RESET} ${COLORS.DIM}BACK${COLORS.RESET} Return to main menu`, 65) + `${COLORS.CYAN}║${COLORS.RESET}`); console.log(`${COLORS.CYAN}╚════════════════════════════════════════════════════════════════╝${COLORS.RESET}`); console.log(''); - const customAnswer = await question(`${COLORS.CYAN}${SYMBOLS.SELECT} SELECT OPTION${COLORS.RESET} (L, O, M, S, B, D, Q) [Q]: `); + const customAnswer = await question(`${COLORS.CYAN}${SYMBOLS.SELECT} SELECT OPTION${COLORS.RESET} (L, O, M, S, B, D, E, Q) [Q]: `); const customInput = customAnswer.trim().toUpperCase() || 'Q'; - // C > L — install skills into the current project + // A > E: install everything (skills + loop + bot + metrics + Claude status line) + if (customInput === 'E') { + rl.close(); + const loopResult = installPlan2CodeLoop(); + console.log(''); + const botResult = installPlan2CodeBot(); + console.log(''); + const metricsResult = installPlan2CodeMetrics(); + console.log(''); + const statusLineResult = await installStatusLine(); + console.log(''); + const installResult = await install(); + const exitCode = loopResult !== 0 ? loopResult : botResult !== 0 ? botResult : metricsResult !== 0 ? metricsResult : statusLineResult !== 0 ? statusLineResult : installResult; + process.exit(exitCode); + } + + // A > L: install skills into the current project if (customInput === 'L') { rl.close(); process.exit(installProjectSkills()); } - // C > O — install loop CLI only + // A > O: install loop CLI only if (customInput === 'O') { rl.close(); const result = installPlan2CodeLoop(); process.exit(result); } - // C > M — install metrics CLI only + // A > M: install metrics CLI only if (customInput === 'M') { rl.close(); const result = installPlan2CodeMetrics(); process.exit(result); } - // C > S — install status line + // A > S: install status line if (customInput === 'S') { rl.close(); const result = await installStatusLine(); process.exit(result); } - // C > B — install bot CLI only + // A > B: install bot CLI only if (customInput === 'B') { rl.close(); const result = installPlan2CodeBot(); process.exit(result); } - // C > D — install the global `plan2code` command (opens the dashboard in Claude Code or Devin) + // A > D: install the global `plan2code` command (opens the dashboard in Claude Code or Devin) if (customInput === 'D') { rl.close(); process.exit(await installLauncher()); } - // C > Q — back to main menu + // A > Q: back to main menu return main(); } @@ -1242,7 +1277,7 @@ function runInteractive() { } // Invalid input — loop back - console.log(`\n${COLORS.RED}${SYMBOLS.ERROR} Invalid option. Please choose I, A, U, C, or Q.${COLORS.RESET}\n`); + console.log(`\n${COLORS.RED}${SYMBOLS.ERROR} Invalid option. Please choose I, U, A, or Q.${COLORS.RESET}\n`); return main(); } @@ -2559,14 +2594,12 @@ async function installLauncher({ quiet = false } = {}) { if (!isDirOnPath(binDir)) { console.log(` ${COLORS.YELLOW}${SYMBOLS.WARNING}${COLORS.RESET} ${binDir} is not on your PATH — add it to use ${COLORS.BRIGHT}${LAUNCHER_COMMAND}${COLORS.RESET} from any directory`); } - if (!isCommandOnPath('claude') && !isCommandOnPath('devin')) { - console.log(` ${COLORS.YELLOW}${SYMBOLS.WARNING}${COLORS.RESET} Neither the ${COLORS.BRIGHT}claude${COLORS.RESET} nor the ${COLORS.BRIGHT}devin${COLORS.RESET} CLI is on your PATH — install one before running ${COLORS.BRIGHT}${LAUNCHER_COMMAND}${COLORS.RESET}`); - } // The shortcut is a convenience on top of the command, so a failure here only warns. await offerDesktopShortcut(binDir); - console.log(` ${COLORS.DIM}Run '${LAUNCHER_COMMAND}' in any project to open the Plan2Code dashboard in Claude Code or Devin${COLORS.RESET}`); - console.log(` ${COLORS.YELLOW}${SYMBOLS.WARNING}${COLORS.RESET} It starts the agent with permission prompts off (${COLORS.CYAN}--permission-mode bypassPermissions${COLORS.RESET} in Claude Code, ${COLORS.CYAN}bypass${COLORS.RESET} in Devin). Run ${COLORS.CYAN}claude /plan2code${COLORS.RESET} yourself if you want prompts.`); + console.log(` ${COLORS.YELLOW}${SYMBOLS.WARNING}${COLORS.RESET} The ${LAUNCHER_COMMAND} command starts the agent with permission prompts off (${COLORS.CYAN}--permission-mode bypassPermissions${COLORS.RESET} in Claude Code, ${COLORS.CYAN}bypass${COLORS.RESET} in Devin). Run ${COLORS.CYAN}claude /plan2code${COLORS.RESET} yourself if you want prompts.`); console.log(''); + // Inside install() the final summary prints the steps once, after everything else. + if (!quiet) printGettingStarted({ commandInstalled: true }); return 0; } diff --git a/plan2code-bot/README.md b/plan2code-bot/README.md index 12df073..807a046 100644 --- a/plan2code-bot/README.md +++ b/plan2code-bot/README.md @@ -13,7 +13,7 @@ From the plan2code root: ```bash node install.js -# Select C > B to install bot only, or I to install everything +# Select A > B to install the bot only, or A > E to install everything ``` Or manually: diff --git a/plan2code-metrics/README.md b/plan2code-metrics/README.md index d68fd31..8e939da 100644 --- a/plan2code-metrics/README.md +++ b/plan2code-metrics/README.md @@ -6,8 +6,8 @@ Recursive self-improvement toolchain for plan2code contributors. Collects metric ```bash # Install (one-time, from the plan2code root) -node install.js # → "A" (Install All + dev tools) includes metrics - # → or "M" (Metrics only) under the CUSTOM sub-menu +node install.js # → "A" then "E" (Everything) includes metrics + # → or "M" (Metrics only) under the ADVANCED sub-menu # After finishing any project spec (steps 1-4): cd your-project