mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-18 21:01:19 -08:00
Add Codex to the plan2code command and explain what to do without an agent
AI Assisted
This commit is contained in:
1 parent
9cd39f6ce8
commit
b639c8945d
4 files changed
+69
-16
No files matched your search
+5
-5
@@ -1259,7 +1259,7 @@ function runInteractive() {
|
|||||||
process.exit(result);
|
process.exit(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// A > 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, Devin or Codex)
|
||||||
if (customInput === 'D') {
|
if (customInput === 'D') {
|
||||||
rl.close();
|
rl.close();
|
||||||
process.exit(await installLauncher());
|
process.exit(await installLauncher());
|
||||||
@@ -2244,7 +2244,7 @@ function uninstallPlan2CodeBot() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// PLAN2CODE COMMAND (global `plan2code` → dashboard in Claude Code or Devin)
|
// PLAN2CODE COMMAND (global `plan2code` → dashboard in Claude Code, Devin or Codex)
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2479,7 +2479,7 @@ function installDesktopShortcut(binDir, file) {
|
|||||||
P2C_FILE: file,
|
P2C_FILE: file,
|
||||||
P2C_SCRIPT: `${shim}.ps1`,
|
P2C_SCRIPT: `${shim}.ps1`,
|
||||||
P2C_ARGS: LAUNCHER_PICK_FOLDER_FLAG,
|
P2C_ARGS: LAUNCHER_PICK_FOLDER_FLAG,
|
||||||
P2C_DESCRIPTION: 'Open the Plan2Code dashboard in Claude Code or Devin',
|
P2C_DESCRIPTION: 'Open the Plan2Code dashboard in Claude Code, Devin or Codex',
|
||||||
P2C_ICON: icon,
|
P2C_ICON: icon,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -2499,7 +2499,7 @@ function installDesktopShortcut(binDir, file) {
|
|||||||
`# ${LAUNCHER_MARKER}`,
|
`# ${LAUNCHER_MARKER}`,
|
||||||
'Type=Application',
|
'Type=Application',
|
||||||
`Name=${SHORTCUT_NAME}`,
|
`Name=${SHORTCUT_NAME}`,
|
||||||
'Comment=Open the Plan2Code dashboard in Claude Code or Devin',
|
'Comment=Open the Plan2Code dashboard in Claude Code, Devin or Codex',
|
||||||
`Exec="${shim}" ${LAUNCHER_PICK_FOLDER_FLAG}`,
|
`Exec="${shim}" ${LAUNCHER_PICK_FOLDER_FLAG}`,
|
||||||
...(icon ? [`Icon=${icon}`] : []),
|
...(icon ? [`Icon=${icon}`] : []),
|
||||||
'Terminal=true',
|
'Terminal=true',
|
||||||
@@ -2596,7 +2596,7 @@ async function installLauncher({ quiet = false } = {}) {
|
|||||||
}
|
}
|
||||||
// The shortcut is a convenience on top of the command, so a failure here only warns.
|
// The shortcut is a convenience on top of the command, so a failure here only warns.
|
||||||
await offerDesktopShortcut(binDir);
|
await offerDesktopShortcut(binDir);
|
||||||
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(` ${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, ${COLORS.CYAN}--dangerously-bypass-approvals-and-sandbox${COLORS.RESET} in Codex). Run ${COLORS.CYAN}claude /plan2code${COLORS.RESET} yourself if you want prompts.`);
|
||||||
console.log('');
|
console.log('');
|
||||||
// Inside install() the final summary prints the steps once, after everything else.
|
// Inside install() the final summary prints the steps once, after everything else.
|
||||||
if (!quiet) printGettingStarted({ commandInstalled: true });
|
if (!quiet) printGettingStarted({ commandInstalled: true });
|
||||||
|
|||||||
@@ -77,6 +77,29 @@ test("launcher: Devin keeps its args ahead of the -- and the prompt", (t) => {
|
|||||||
assert.deepEqual(box.argsOf("devin"), ["--permission-mode", "bypass", "--verbose", "--", "/plan2code"]);
|
assert.deepEqual(box.argsOf("devin"), ["--permission-mode", "bypass", "--verbose", "--", "/plan2code"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("launcher: Codex gets the bypass flag, the forwarded args, then the $plan2code prompt", (t) => {
|
||||||
|
const box = sandbox(["codex"]);
|
||||||
|
t.after(box.cleanup);
|
||||||
|
const result = box.run(["--verbose"]);
|
||||||
|
assert.equal(result.status, 0, result.stderr);
|
||||||
|
assert.deepEqual(box.argsOf("codex"), ["--dangerously-bypass-approvals-and-sandbox", "--verbose", "$plan2code"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("launcher: --cli codex picks Codex when it is installed beside another CLI", (t) => {
|
||||||
|
const box = sandbox(["claude", "codex"]);
|
||||||
|
t.after(box.cleanup);
|
||||||
|
const result = box.run(["--cli", "codex"]);
|
||||||
|
assert.equal(result.status, 0, result.stderr);
|
||||||
|
assert.equal(box.argsOf("claude"), null);
|
||||||
|
assert.ok(box.argsOf("codex"));
|
||||||
|
});
|
||||||
|
|
||||||
|
test("launcher: the shipped models.json lists every CLI, and every entry has an id and a label", () => {
|
||||||
|
const shipped = JSON.parse(fs.readFileSync(path.join(path.dirname(LAUNCHER), "models.json"), "utf8"));
|
||||||
|
assert.ok(Array.isArray(shipped.codex));
|
||||||
|
for (const { id, label } of shipped.codex) assert.ok(id && label);
|
||||||
|
});
|
||||||
|
|
||||||
test("launcher: a forwarded --model skips the model notice", (t) => {
|
test("launcher: a forwarded --model skips the model notice", (t) => {
|
||||||
const box = sandbox(["claude"]);
|
const box = sandbox(["claude"]);
|
||||||
t.after(box.cleanup);
|
t.after(box.cleanup);
|
||||||
@@ -119,11 +142,12 @@ test("launcher: an unknown --cli exits 2, a missing CLI 127, and nothing is star
|
|||||||
|
|
||||||
const unknown = box.run(["--cli", "bogus"]);
|
const unknown = box.run(["--cli", "bogus"]);
|
||||||
assert.equal(unknown.status, 2);
|
assert.equal(unknown.status, 2);
|
||||||
assert.match(unknown.stderr, /--cli takes claude or devin, not "bogus"/);
|
assert.match(unknown.stderr, /--cli takes claude, devin, codex, not "bogus"/);
|
||||||
|
|
||||||
const missing = box.run(["--cli", "devin"]);
|
const missing = box.run(["--cli", "devin"]);
|
||||||
assert.equal(missing.status, 127);
|
assert.equal(missing.status, 127);
|
||||||
assert.match(missing.stderr, /the `devin` CLI was not found/);
|
assert.match(missing.stderr, /the `devin` CLI was not found/);
|
||||||
|
assert.ok(missing.stderr.includes("$plan2code"));
|
||||||
|
|
||||||
assert.equal(box.argsOf("claude"), null);
|
assert.equal(box.argsOf("claude"), null);
|
||||||
});
|
});
|
||||||
@@ -150,12 +174,15 @@ test("launcher: the shipped models.json is curated Devin at low/medium/high only
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test("launcher: with neither CLI installed it exits 127 naming both", (t) => {
|
test("launcher: with no CLI installed it exits 127 and says how to run the skill from an agent", (t) => {
|
||||||
const box = sandbox([]);
|
const box = sandbox([]);
|
||||||
t.after(box.cleanup);
|
t.after(box.cleanup);
|
||||||
const result = box.run([]);
|
const result = box.run([]);
|
||||||
assert.equal(result.status, 127);
|
assert.equal(result.status, 127);
|
||||||
assert.match(result.stderr, /neither `claude` nor `devin` was found/);
|
assert.match(result.stderr, /none of `claude`, `devin` or `codex` was found/);
|
||||||
|
assert.ok(result.stderr.includes("type /plan2code"));
|
||||||
|
assert.ok(result.stderr.includes("$plan2code (Codex)"));
|
||||||
|
assert.match(result.stderr, /cd into the project/);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("launcher: a forwarded argument with a space and a cmd metacharacter arrives unchanged", (t) => {
|
test("launcher: a forwarded argument with a space and a cmd metacharacter arrives unchanged", (t) => {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"_note": "Curated model menu for the plan2code launcher. Maintained by the Plan2Code authors; every install overwrites this file. Users add models in User Preferences (kept in ~/.plan2code/models.json). Devin entries are explicit ids at Low, Medium and High effort only, verified against `devin models list`.",
|
"_note": "Curated model menu for the plan2code launcher. Maintained by the Plan2Code authors; every install overwrites this file. Users add models in User Preferences (kept in ~/.plan2code/models.json). Devin entries are explicit ids at Low, Medium and High effort only, verified against `devin models list`. Codex has no curated entries yet (its docs name none to verify): the launcher skips the model question for it. Pass --model <name> to choose one.",
|
||||||
"claude": [
|
"claude": [
|
||||||
{
|
{
|
||||||
"id": "default",
|
"id": "default",
|
||||||
@@ -111,5 +111,6 @@
|
|||||||
"id": "glm-5-3-high",
|
"id": "glm-5-3-high",
|
||||||
"label": "GLM-5.3 High"
|
"label": "GLM-5.3 High"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"codex": []
|
||||||
}
|
}
|
||||||
@@ -2,14 +2,15 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* `plan2code` — open the Plan2Code dashboard skill in Claude Code or Devin, in the current
|
* `plan2code` — open the Plan2Code dashboard skill in Claude Code, Devin or Codex, in the
|
||||||
* directory.
|
* current directory.
|
||||||
*
|
*
|
||||||
* Runs one of:
|
* Runs one of:
|
||||||
* claude /plan2code --permission-mode bypassPermissions [extra args]
|
* claude /plan2code --permission-mode bypassPermissions [extra args]
|
||||||
* devin --permission-mode bypass [extra args] -- /plan2code
|
* devin --permission-mode bypass [extra args] -- /plan2code
|
||||||
|
* codex --dangerously-bypass-approvals-and-sandbox [extra args] $plan2code
|
||||||
*
|
*
|
||||||
* When both CLIs are installed it asks which one, with the last pick as the default; with only
|
* Codex starts a skill with `$name` rather than `/name`. When more than one CLI is installed it asks which one, with the last pick as the default; with only
|
||||||
* one installed it uses that. `--cli claude` / `--cli devin` skips the question. Before starting
|
* one installed it uses that. `--cli claude` / `--cli devin` skips the question. Before starting
|
||||||
* it asks which model to run, from the curated list in models.json (shipped with every
|
* it asks which model to run, from the curated list in models.json (shipped with every
|
||||||
* install) plus any models the user added in User Preferences; Enter keeps the model the CLI
|
* install) plus any models the user added in User Preferences; Enter keeps the model the CLI
|
||||||
@@ -107,8 +108,28 @@ const CLIS = [
|
|||||||
label: 'Devin',
|
label: 'Devin',
|
||||||
args: (extra) => ['--permission-mode', 'bypass', ...extra, '--', '/plan2code'],
|
args: (extra) => ['--permission-mode', 'bypass', ...extra, '--', '/plan2code'],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'codex',
|
||||||
|
label: 'Codex',
|
||||||
|
// Codex mentions a skill with `$name`; the prompt is its one positional argument.
|
||||||
|
args: (extra) => ['--dangerously-bypass-approvals-and-sandbox', ...extra, '$plan2code'],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** What to do when no agent is installed: how to get one and how to run the skill from it. */
|
||||||
|
const SKILL_STEPS = [
|
||||||
|
'Plan2Code runs inside an AI coding agent. To use it:',
|
||||||
|
' 1. Install one: Claude Code (npm i -g @anthropic-ai/claude-code), Codex (npm i -g @openai/codex) or Devin (https://devin.ai).',
|
||||||
|
' 2. Open a new terminal and cd into the project you want to work on.',
|
||||||
|
' 3. Start your agent there, then type /plan2code (Claude Code, Devin) or $plan2code (Codex).',
|
||||||
|
];
|
||||||
|
|
||||||
|
/** The CLI ids as prose: "`claude`, `devin` or `codex`". */
|
||||||
|
function cliIdList() {
|
||||||
|
const ids = CLIS.map((cli) => '`' + cli.id + '`');
|
||||||
|
return `${ids.slice(0, -1).join(', ')} or ${ids[ids.length - 1]}`;
|
||||||
|
}
|
||||||
|
|
||||||
// The curated menu ships beside this file (models.json, overwritten by every install); models
|
// The curated menu ships beside this file (models.json, overwritten by every install); models
|
||||||
// the user adds in User Preferences live in ~/.plan2code/models.json and are merged in.
|
// the user adds in User Preferences live in ~/.plan2code/models.json and are merged in.
|
||||||
const SHIPPED_MODELS_FILE = path.join(__dirname, 'models.json');
|
const SHIPPED_MODELS_FILE = path.join(__dirname, 'models.json');
|
||||||
@@ -341,21 +362,25 @@ async function chooseCli(requested) {
|
|||||||
if (requested !== undefined) {
|
if (requested !== undefined) {
|
||||||
const known = CLIS.find((cli) => cli.id === requested);
|
const known = CLIS.find((cli) => cli.id === requested);
|
||||||
if (!known) {
|
if (!known) {
|
||||||
console.error(`${ce.red('plan2code:')} --cli takes ${CLIS.map((cli) => cli.id).join(' or ')}${requested ? `, not "${requested}"` : ''}.`);
|
console.error(`${ce.red('plan2code:')} --cli takes ${CLIS.map((cli) => cli.id).join(', ')}${requested ? `, not "${requested}"` : ''}.`);
|
||||||
return { code: 2 };
|
return { code: 2 };
|
||||||
}
|
}
|
||||||
const found = installed.find((cli) => cli.id === requested);
|
const found = installed.find((cli) => cli.id === requested);
|
||||||
if (!found) {
|
if (!found) {
|
||||||
console.error(`${ce.red('plan2code:')} the \`${known.id}\` CLI was not found on your PATH.`);
|
console.error(`${ce.red('plan2code:')} the \`${known.id}\` CLI was not found on your PATH.`);
|
||||||
console.error(`Install ${known.label}, open a new terminal, and run \`plan2code\` again.`);
|
console.error(`Install ${known.label}, open a new terminal, and run \`plan2code\` again.`);
|
||||||
|
for (const step of SKILL_STEPS) console.error(step);
|
||||||
}
|
}
|
||||||
if (found) announceCli(found);
|
if (found) announceCli(found);
|
||||||
return found ? { cli: found } : { code: 127 };
|
return found ? { cli: found } : { code: 127 };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (installed.length === 0) {
|
if (installed.length === 0) {
|
||||||
console.error(`${ce.red('plan2code:')} neither ${CLIS.map((cli) => `\`${cli.id}\``).join(' nor ')} was found on your PATH.`);
|
console.error(`${ce.red('plan2code:')} none of ${cliIdList()} was found on your PATH.`);
|
||||||
console.error(`Install ${CLIS.map((cli) => cli.label).join(' or ')}, open a new terminal, and run \`plan2code\` again.`);
|
console.error('');
|
||||||
|
for (const step of SKILL_STEPS) console.error(step);
|
||||||
|
console.error('');
|
||||||
|
console.error('Already have an agent? Open it in your project and type /plan2code ($plan2code in Codex), or install it and run `plan2code` again.');
|
||||||
return { code: 127 };
|
return { code: 127 };
|
||||||
}
|
}
|
||||||
if (installed.length === 1 || !process.stdin.isTTY) {
|
if (installed.length === 1 || !process.stdin.isTTY) {
|
||||||
|
|||||||
Reference in new issue
Block a user