issue-flow 0.7.6 → 0.7.7
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/{analyze-TNFTUMOO.js → analyze-2RVGY5OK.js} +10 -8
- package/dist/{analyze-TNFTUMOO.js.map → analyze-2RVGY5OK.js.map} +1 -1
- package/dist/{chunk-5IRBHUYO.js → chunk-3E6KASSE.js} +11 -9
- package/dist/{chunk-5IRBHUYO.js.map → chunk-3E6KASSE.js.map} +1 -1
- package/dist/{chunk-A42R36BX.js → chunk-6IOPYFUM.js} +10 -8
- package/dist/{chunk-A42R36BX.js.map → chunk-6IOPYFUM.js.map} +1 -1
- package/dist/{chunk-JECNPBBO.js → chunk-6L2BPOE3.js} +11 -9
- package/dist/{chunk-JECNPBBO.js.map → chunk-6L2BPOE3.js.map} +1 -1
- package/dist/{chunk-DWF46N65.js → chunk-6UTVPKNF.js} +11 -9
- package/dist/{chunk-DWF46N65.js.map → chunk-6UTVPKNF.js.map} +1 -1
- package/dist/{chunk-6S2XT3JE.js → chunk-EOTULFWV.js} +10 -8
- package/dist/{chunk-6S2XT3JE.js.map → chunk-EOTULFWV.js.map} +1 -1
- package/dist/{chunk-CD7BMWXW.js → chunk-EYVXLRRD.js} +3 -3
- package/dist/{chunk-OE7RYTUT.js → chunk-G37JNQKB.js} +2 -2
- package/dist/chunk-JOK7VXRV.js +447 -0
- package/dist/chunk-JOK7VXRV.js.map +1 -0
- package/dist/{chunk-DF7SUHT5.js → chunk-KHTLN54U.js} +2 -2
- package/dist/{chunk-D56VWHSM.js → chunk-OPIDR2DC.js} +2 -2
- package/dist/{chunk-5NLLEWJD.js → chunk-RUTDK6ZF.js} +12 -2
- package/dist/{chunk-5NLLEWJD.js.map → chunk-RUTDK6ZF.js.map} +1 -1
- package/dist/chunk-SLHZPB3C.js +50 -0
- package/dist/chunk-SLHZPB3C.js.map +1 -0
- package/dist/{chunk-BMRBQ23Q.js → chunk-WGDLUPSF.js} +9 -7
- package/dist/{chunk-BMRBQ23Q.js.map → chunk-WGDLUPSF.js.map} +1 -1
- package/dist/{chunk-5Q2TMW7K.js → chunk-WO6ERABE.js} +2 -1
- package/dist/{chunk-QLVAEDVD.js → chunk-XPW46TI5.js} +3 -3
- package/dist/{chunk-I7FTA5FI.js → chunk-ZYBYMEWG.js} +2 -47
- package/dist/chunk-ZYBYMEWG.js.map +1 -0
- package/dist/cli.js +28 -13
- package/dist/cli.js.map +1 -1
- package/dist/{config-U3FC4WH6.js → config-OAZG7KIK.js} +3 -3
- package/dist/execute-AOEM52CD.js +14 -0
- package/dist/{generate-RHPOWGDX.js → generate-BEJF3SVJ.js} +10 -8
- package/dist/{generate-RHPOWGDX.js.map → generate-BEJF3SVJ.js.map} +1 -1
- package/dist/init-TBC3WI74.js +9 -0
- package/dist/plan-YDZYB2BO.js +16 -0
- package/dist/pr-SIXMJIZF.js +16 -0
- package/dist/pr-review-AY56ZPJR.js +16 -0
- package/dist/prd-MBSSBLGO.js +16 -0
- package/dist/review-2MDDHZ4X.js +14 -0
- package/dist/{run-Z6ZDXZB6.js → run-SEB6F3W4.js} +23 -196
- package/dist/run-SEB6F3W4.js.map +1 -0
- package/dist/web-3SBYL7QJ.js +188 -0
- package/dist/web-3SBYL7QJ.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-I7FTA5FI.js.map +0 -1
- package/dist/execute-BNBA77WJ.js +0 -13
- package/dist/init-IF72GR7O.js +0 -9
- package/dist/plan-FITZZXZQ.js +0 -15
- package/dist/pr-GO244D7M.js +0 -15
- package/dist/pr-review-XY6VL62M.js +0 -15
- package/dist/prd-2Y6RMVTF.js +0 -15
- package/dist/review-ITKXJMX3.js +0 -13
- package/dist/run-Z6ZDXZB6.js.map +0 -1
- /package/dist/{chunk-CD7BMWXW.js.map → chunk-EYVXLRRD.js.map} +0 -0
- /package/dist/{chunk-OE7RYTUT.js.map → chunk-G37JNQKB.js.map} +0 -0
- /package/dist/{chunk-DF7SUHT5.js.map → chunk-KHTLN54U.js.map} +0 -0
- /package/dist/{chunk-D56VWHSM.js.map → chunk-OPIDR2DC.js.map} +0 -0
- /package/dist/{chunk-5Q2TMW7K.js.map → chunk-WO6ERABE.js.map} +0 -0
- /package/dist/{chunk-QLVAEDVD.js.map → chunk-XPW46TI5.js.map} +0 -0
- /package/dist/{config-U3FC4WH6.js.map → config-OAZG7KIK.js.map} +0 -0
- /package/dist/{execute-BNBA77WJ.js.map → execute-AOEM52CD.js.map} +0 -0
- /package/dist/{init-IF72GR7O.js.map → init-TBC3WI74.js.map} +0 -0
- /package/dist/{plan-FITZZXZQ.js.map → plan-YDZYB2BO.js.map} +0 -0
- /package/dist/{pr-GO244D7M.js.map → pr-SIXMJIZF.js.map} +0 -0
- /package/dist/{pr-review-XY6VL62M.js.map → pr-review-AY56ZPJR.js.map} +0 -0
- /package/dist/{prd-2Y6RMVTF.js.map → prd-MBSSBLGO.js.map} +0 -0
- /package/dist/{review-ITKXJMX3.js.map → review-2MDDHZ4X.js.map} +0 -0
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts","../src/cli-options.ts","../src/issues/cli-flags.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { Command, InvalidArgumentError } from 'commander';\nimport { CliFlagError, resolveRunPhaseFlags } from './cli-options.js';\nimport { setIssuesCliOverrides, setWebCliOverrides } from './config.js';\nimport { setGlobalTimeout, setVerbose } from './core/verbose.js';\nimport {\n IssueFlagError,\n resolveGenerateTarget,\n resolveIssuesOverrides,\n} from './issues/cli-flags.js';\nimport type { IssueGenerateTarget } from './issues/types.js';\nimport type { WebConfig } from './schemas.js';\nimport { printError } from './ui/logger.js';\n\nconst require = createRequire(import.meta.url);\nconst { version } = require('../package.json') as { version: string };\n\n/**\n * Parse a numeric string, throwing InvalidArgumentError if not a valid number.\n */\nfunction parseInteger(value: string): number {\n const parsed = parseInt(value, 10);\n if (Number.isNaN(parsed) || parsed < 0) {\n throw new InvalidArgumentError('Must be a non-negative integer.');\n }\n return parsed;\n}\n\n/**\n * Add shared options (--verbose) to a subcommand.\n */\nfunction withGlobalOptions(cmd: Command): Command {\n return cmd\n .option('-v, --verbose', 'Show Claude progress output in real time')\n .option(\n '-t, --timeout <seconds>',\n 'Override headless timeout in seconds (0 = no limit)',\n parseInteger,\n );\n}\n\n/**\n * Add web monitoring options to a subcommand (run and execute only).\n * The values are resolved into CLI overrides by the preAction hook below;\n * loadWebConfig() applies the flag > env > file > defaults precedence.\n */\nfunction withWebOptions(cmd: Command): Command {\n return cmd\n .option('--web', 'Enable the web monitoring server')\n .option('--serve', 'Alias for --web')\n .option('--port <n>', 'Web server port (default: 3737)', parseInteger)\n .option('--host <h>', 'Web server host (default: 0.0.0.0)')\n .option('--refresh <s>', 'Suggested UI polling interval in seconds', parseInteger)\n .option('--web-log-limit <n>', 'Max log entries kept in the snapshot', parseInteger)\n .option('--web-no-logs', 'Exclude logs from the published snapshot');\n}\n\n/**\n * Add the Issue provider options to a subcommand.\n *\n * Declared once here (like withWebOptions) so no command repeats the flag\n * list; the preAction hook below turns them into config overrides, and\n * loadIssuesConfig() applies the flag > .issue-flow.json > defaults precedence.\n */\nfunction withIssueOptions(cmd: Command): Command {\n return cmd\n .option('--local', 'Prefer the local file Issue provider')\n .option('--github', 'Prefer the GitHub Issue provider')\n .option('--prefer-local', 'On divergence, use the local version without asking')\n .option('--prefer-github', 'On divergence, use the GitHub version without asking')\n .option('--ask', 'On divergence, ask which version to use (interactive only)');\n}\n\n/**\n * Extract the web-related CLI flags from a command's options, keeping only\n * the ones the user actually set.\n */\nfunction resolveWebOverrides(opts: Record<string, unknown>): Partial<WebConfig> {\n const overrides: Partial<WebConfig> = {};\n if (opts.web === true || opts.serve === true) {\n overrides.enabled = true;\n }\n if (opts.port !== undefined) {\n overrides.port = opts.port as number;\n }\n if (opts.host !== undefined) {\n overrides.host = opts.host as string;\n }\n if (opts.refresh !== undefined) {\n overrides.refreshSeconds = opts.refresh as number;\n }\n if (opts.webLogLimit !== undefined) {\n overrides.logLimit = opts.webLogLimit as number;\n }\n if (opts.webNoLogs === true) {\n overrides.includeLogs = false;\n }\n return overrides;\n}\n\nconst program = new Command();\n\nprogram\n .name('issue-flow')\n .description(\n 'Unified CLI for orchestrating the full issue-flow pipeline via Claude Code Headless.',\n )\n .version(version);\n\nprogram.hook('preAction', (_thisCommand, actionCommand) => {\n const opts = actionCommand.opts();\n if (opts.verbose) {\n setVerbose(true);\n }\n if (opts.timeout !== undefined) {\n setGlobalTimeout(opts.timeout * 1000);\n }\n setWebCliOverrides(resolveWebOverrides(opts));\n try {\n setIssuesCliOverrides(resolveIssuesOverrides(opts));\n } catch (error) {\n if (error instanceof IssueFlagError) {\n printError(error.message);\n process.exit(1);\n }\n throw error;\n }\n});\n\n// ── init ────────────────────────────────────────────────────────────────────\nwithIssueOptions(\n withGlobalOptions(\n program.command('init').description('Verify that all prerequisites (claude, gh, git) are met'),\n ),\n).action(async () => {\n const { loadIssuesConfig } = await import('./config.js');\n const { runInit } = await import('./commands/init.js');\n const { preferredProvider } = await loadIssuesConfig();\n const code = await runInit(preferredProvider);\n process.exit(code);\n});\n\n// ── generate ────────────────────────────────────────────────────────────────\nwithGlobalOptions(\n program\n .command('generate')\n .description('Draft an issue via Claude Code Headless and create it')\n .requiredOption('--prompt <text>', 'Issue description text')\n .option('--github', 'Create the issue on GitHub')\n .option('--local', 'Create the issue under issues/<n>/ only')\n .option('--both', 'Create the issue on GitHub and mirror it locally'),\n).action(async (options: { prompt: string; github?: boolean; local?: boolean; both?: boolean }) => {\n let target: IssueGenerateTarget | undefined;\n try {\n target = resolveGenerateTarget(options);\n } catch (error) {\n if (error instanceof IssueFlagError) {\n printError(error.message);\n process.exit(1);\n }\n throw error;\n }\n\n const { runGenerate } = await import('./commands/generate.js');\n const code = await runGenerate(options.prompt, target);\n process.exit(code);\n});\n\n// ── run ─────────────────────────────────────────────────────────────────────\nwithWebOptions(\n withIssueOptions(\n withGlobalOptions(\n program\n .command('run')\n .description(\n 'Execute the full pipeline: prd → plan → execute → review → pr (→ pr-review, optional)',\n )\n .argument('<issue>', 'Issue number')\n .option('--mode <mode>', 'Execution mode: auto | manual', 'auto')\n .option('--from <phase>', 'Resume from a specific phase')\n .option('--no-branch', 'Run pipeline on current branch without creating a new branch or PR')\n .option('--pr-review', 'Review the created Pull Request after the pr phase'),\n ),\n ),\n).action(\n async (\n issue: string,\n options: { mode: string; from?: string; branch?: boolean; prReview?: boolean },\n ) => {\n let phases: ReturnType<typeof resolveRunPhaseFlags>;\n try {\n phases = resolveRunPhaseFlags(options);\n } catch (error) {\n if (error instanceof CliFlagError) {\n printError(error.message);\n process.exit(1);\n }\n throw error;\n }\n\n const { runPipeline } = await import('./commands/run.js');\n const code = await runPipeline(\n issue,\n options.mode,\n options.from,\n phases.noBranch,\n phases.prReview,\n );\n process.exit(code);\n },\n);\n\n// ── analyze ─────────────────────────────────────────────────────────────────\nwithIssueOptions(\n withGlobalOptions(\n program\n .command('analyze')\n .description('Analyze an issue via Claude Code Headless')\n .argument('<issue>', 'Issue number'),\n ),\n).action(async (issue: string) => {\n const { runAnalyze } = await import('./commands/analyze.js');\n const code = await runAnalyze(issue);\n process.exit(code);\n});\n\n// ── prd ─────────────────────────────────────────────────────────────────────\nwithIssueOptions(\n withGlobalOptions(\n program\n .command('prd')\n .description('Generate a PRD from an analyzed issue via Claude Code Headless')\n .argument('<issue>', 'Issue number'),\n ),\n).action(async (issue: string) => {\n const { runPrd } = await import('./commands/prd.js');\n const code = await runPrd(issue);\n process.exit(code);\n});\n\n// ── plan ────────────────────────────────────────────────────────────────────\nwithIssueOptions(\n withGlobalOptions(\n program\n .command('plan')\n .description('Convert a PRD to a tasks.json task plan via Claude Code Headless')\n .argument('<issue>', 'Issue number'),\n ),\n).action(async (issue: string) => {\n const { runPlan } = await import('./commands/plan.js');\n const code = await runPlan(issue);\n process.exit(code);\n});\n\n// ── execute ─────────────────────────────────────────────────────────────────\nwithWebOptions(\n withGlobalOptions(\n program\n .command('execute')\n .description('Run the iterative story execution loop (issue-flow engine)')\n .option('--issue <number>', 'Issue number — reads artifacts from issues/N/')\n .option('--max-iterations <number>', 'Stop after N iterations', parseInteger)\n .option(\n '--retry-limit <number>',\n 'Retry transient Claude failures up to N consecutive times',\n parseInteger,\n )\n .option('--retry-forever', 'Retry transient Claude failures indefinitely')\n .argument(\n '[max-iterations]',\n 'Backward-compatible alias for --max-iterations N',\n parseInteger,\n ),\n ),\n).action(\n async (\n positionalMaxIter: number | undefined,\n options: {\n issue?: string;\n maxIterations?: number;\n retryLimit?: number;\n retryForever?: boolean;\n },\n ) => {\n try {\n const { runExecute } = await import('./commands/execute.js');\n const code = await runExecute(positionalMaxIter, options);\n process.exit(code);\n } catch (error) {\n printError(error instanceof Error ? error.message : String(error));\n process.exit(1);\n }\n },\n);\n\n// ── review ──────────────────────────────────────────────────────────────────\nwithIssueOptions(\n withGlobalOptions(\n program\n .command('review')\n .description('Validate an issue resolution via Claude Code Headless')\n .argument('<issue>', 'Issue number'),\n ),\n).action(async (issue: string) => {\n const { runReview } = await import('./commands/review.js');\n const code = await runReview(issue);\n process.exit(code);\n});\n\n// ── pr ──────────────────────────────────────────────────────────────────────\nwithIssueOptions(\n withGlobalOptions(\n program\n .command('pr')\n .description('Create a pull request via Claude Code Headless')\n .argument('<issue>', 'Issue number'),\n ),\n).action(async (issue: string) => {\n const { runPr } = await import('./commands/pr.js');\n const code = await runPr(issue);\n process.exit(code);\n});\n\n// ── pr-review ───────────────────────────────────────────────────────────────\nwithGlobalOptions(\n program\n .command('pr-review')\n .description('Review a Pull Request as a whole via Claude Code Headless')\n .argument('[pr]', 'Pull Request number (discovered from the session when omitted)')\n .option('--issue <n>', 'Issue the Pull Request belongs to')\n .option('--round <n>', 'Rewrite a specific review round instead of appending a new one')\n .option('--yes', 'Skip the confirmation of the discovered Pull Request')\n .option(\n '--fail-on <level>',\n 'Verdict that fails the command: request-changes | suggestions | none',\n ),\n).action(\n async (\n pr: string | undefined,\n options: { issue?: string; round?: string; yes?: boolean; failOn?: string },\n ) => {\n const { runPrReview } = await import('./commands/pr-review.js');\n const code = await runPrReview(pr, options);\n process.exit(code);\n },\n);\n\nprogram.parse();\n","/**\n * Pure mappings from parsed CLI options to command arguments.\n *\n * They live outside cli.ts because that module runs `program.parse()` on\n * import, so anything defined there is untestable.\n */\n\n/** Shape commander produces for a negated boolean option (`--no-branch`). */\nexport interface BranchFlagOptions {\n branch?: boolean;\n}\n\n/**\n * Translate commander's `--no-branch` into the tri-state `runPipeline` expects.\n *\n * Commander stores a negated option under its positive name: `--no-branch`\n * yields `{ branch: false }` and never a `noBranch` key. Reading `noBranch`\n * silently dropped the flag, so the pipeline always created a branch and opened\n * a PR.\n *\n * `undefined` (flag absent) is preserved on purpose: `runPipeline` uses it to\n * tell \"the user said nothing, keep the mode persisted in tasks.json\" apart\n * from an explicit choice.\n */\nexport function resolveNoBranch(options: BranchFlagOptions): boolean | undefined {\n return options.branch === false ? true : undefined;\n}\n\n/** Invalid flag combination on a command, reported as a CLI error. */\nexport class CliFlagError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'CliFlagError';\n }\n}\n\n/** Options `run` accepts that select which phases the pipeline executes. */\nexport interface RunPhaseFlagOptions extends BranchFlagOptions {\n prReview?: boolean;\n}\n\n/** Phase selection `runPipeline` expects, both entries tri-state. */\nexport interface RunPhaseFlags {\n noBranch: boolean | undefined;\n prReview: boolean | undefined;\n}\n\n/**\n * Resolve the phase-selection flags of `run`, rejecting the one combination\n * that cannot work.\n *\n * `--no-branch` skips the `pr` phase, so there is no Pull Request for\n * `--pr-review` to review. Failing here — before any phase runs — beats\n * discovering it at the end of a full pipeline.\n *\n * Both values stay `undefined` when the user passed nothing: `runPipeline`\n * uses that to tell \"no opinion, keep what tasks.json persisted\" apart from an\n * explicit choice.\n *\n * @throws CliFlagError when `--pr-review` is combined with `--no-branch`.\n */\nexport function resolveRunPhaseFlags(options: RunPhaseFlagOptions): RunPhaseFlags {\n const noBranch = resolveNoBranch(options);\n const prReview = options.prReview === true ? true : undefined;\n\n if (prReview === true && noBranch === true) {\n throw new CliFlagError(\n '--pr-review cannot be combined with --no-branch: --no-branch skips the pr phase, ' +\n 'so there is no Pull Request to review.',\n );\n }\n\n return { noBranch, prReview };\n}\n","import type { IssueGenerateTarget, IssuesConfig } from './types.js';\n\n/**\n * Mapping from the Issue provider CLI flags to configuration overrides.\n *\n * Kept out of cli.ts (which runs `program.parse()` on import) so the\n * precedence rules stay unit-testable. Only the keys the user actually passed\n * are returned: a key present with `undefined` would override .issue-flow.json\n * when the layers are merged.\n */\n\nexport interface IssueCliFlags {\n local?: boolean;\n github?: boolean;\n preferLocal?: boolean;\n preferGithub?: boolean;\n ask?: boolean;\n}\n\n/** Invalid flag combination, reported to the user as a CLI error. */\nexport class IssueFlagError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'IssueFlagError';\n }\n}\n\n/**\n * Translate the parsed options of a command into `IssuesConfig` overrides.\n *\n * @throws IssueFlagError when mutually exclusive flags are combined.\n */\nexport function resolveIssuesOverrides(opts: IssueCliFlags): Partial<IssuesConfig> {\n const overrides: Partial<IssuesConfig> = {};\n\n if (opts.local === true && opts.github === true) {\n throw new IssueFlagError('--local and --github are mutually exclusive; pass only one.');\n }\n if (opts.local === true) {\n overrides.preferredProvider = 'local';\n }\n if (opts.github === true) {\n overrides.preferredProvider = 'github';\n }\n\n const conflictFlags = [\n opts.preferLocal === true ? '--prefer-local' : null,\n opts.preferGithub === true ? '--prefer-github' : null,\n opts.ask === true ? '--ask' : null,\n ].filter((flag): flag is string => flag !== null);\n\n if (conflictFlags.length > 1) {\n throw new IssueFlagError(\n `${conflictFlags.join(', ')} are mutually exclusive; pass only one conflict policy.`,\n );\n }\n if (opts.preferLocal === true) {\n overrides.conflictPolicy = 'prefer-local';\n }\n if (opts.preferGithub === true) {\n overrides.conflictPolicy = 'prefer-github';\n }\n if (opts.ask === true) {\n overrides.conflictPolicy = 'ask';\n }\n\n return overrides;\n}\n\n/** Destination flags accepted by `generate`. */\nexport interface GenerateTargetFlags {\n github?: boolean;\n local?: boolean;\n both?: boolean;\n}\n\n/**\n * Destination the generated Issue is created in, or `undefined` when the user\n * passed no flag (the caller then falls back to `defaultGenerateTarget`).\n *\n * @throws IssueFlagError when more than one destination is requested.\n */\nexport function resolveGenerateTarget(opts: GenerateTargetFlags): IssueGenerateTarget | undefined {\n const selected: IssueGenerateTarget[] = [];\n if (opts.github === true) selected.push('github');\n if (opts.local === true) selected.push('local');\n if (opts.both === true) selected.push('both');\n\n if (selected.length > 1) {\n throw new IssueFlagError(\n `${selected.map((target) => `--${target}`).join(', ')} are mutually exclusive; ` +\n 'pass only one destination.',\n );\n }\n\n return selected[0];\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,SAAS,4BAA4B;;;ACuBvC,SAAS,gBAAgB,SAAiD;AAC/E,SAAO,QAAQ,WAAW,QAAQ,OAAO;AAC3C;AAGO,IAAM,eAAN,cAA2B,MAAM;AAAA,EACtC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AA2BO,SAAS,qBAAqB,SAA6C;AAChF,QAAM,WAAW,gBAAgB,OAAO;AACxC,QAAM,WAAW,QAAQ,aAAa,OAAO,OAAO;AAEpD,MAAI,aAAa,QAAQ,aAAa,MAAM;AAC1C,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AAEA,SAAO,EAAE,UAAU,SAAS;AAC9B;;;ACrDO,IAAM,iBAAN,cAA6B,MAAM;AAAA,EACxC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAOO,SAAS,uBAAuB,MAA4C;AACjF,QAAM,YAAmC,CAAC;AAE1C,MAAI,KAAK,UAAU,QAAQ,KAAK,WAAW,MAAM;AAC/C,UAAM,IAAI,eAAe,6DAA6D;AAAA,EACxF;AACA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AI,MAAM,OAAO,kBAAkB;AACjD,QAAM,OAAO,MAAM,MAAM,KAAK;AAC9B,UAAQ,KAAK,IAAI;AACnB,CAAC;AAGD;AAAA,EACE,QACG,QAAQ,WAAW,EACnB,YAAY,2DAA2D,EACvE,SAAS,QAAQ,gEAAgE,EACjF,OAAO,eAAe,mCAAmC,EACzD,OAAO,eAAe,gEAAgE,EACtF,OAAO,SAAS,sDAAsD,EACtE;AAAA,IACC;AAAA,IACA;AAAA,EACF;AACJ,EAAE;AAAA,EACA,OACE,IACA,YACG;AACH,UAAM,EAAE,YAAY,IAAI,MAAM,OAAO,yBAAyB;AAC9D,UAAM,OAAO,MAAM,YAAY,IAAI,OAAO;AAC1C,YAAQ,KAAK,IAAI;AAAA,EACnB;AACF;AAEA,QAAQ,MAAM;","names":["require"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../src/cli-options.ts","../src/issues/cli-flags.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { Command, InvalidArgumentError } from 'commander';\nimport { CliFlagError, resolveRunPhaseFlags } from './cli-options.js';\nimport { setIssuesCliOverrides, setWebCliOverrides } from './config.js';\nimport { setGlobalTimeout, setVerbose } from './core/verbose.js';\nimport {\n IssueFlagError,\n resolveGenerateTarget,\n resolveIssuesOverrides,\n} from './issues/cli-flags.js';\nimport type { IssueGenerateTarget } from './issues/types.js';\nimport type { WebConfig } from './schemas.js';\nimport { printError } from './ui/logger.js';\n\nconst require = createRequire(import.meta.url);\nconst { version } = require('../package.json') as { version: string };\n\n/**\n * Parse a numeric string, throwing InvalidArgumentError if not a valid number.\n */\nfunction parseInteger(value: string): number {\n const parsed = parseInt(value, 10);\n if (Number.isNaN(parsed) || parsed < 0) {\n throw new InvalidArgumentError('Must be a non-negative integer.');\n }\n return parsed;\n}\n\n/**\n * Add shared options (--verbose) to a subcommand.\n */\nfunction withGlobalOptions(cmd: Command): Command {\n return cmd\n .option('-v, --verbose', 'Show Claude progress output in real time')\n .option(\n '-t, --timeout <seconds>',\n 'Override headless timeout in seconds (0 = no limit)',\n parseInteger,\n );\n}\n\n/**\n * Add web monitoring options to a subcommand (run and execute only).\n * The values are resolved into CLI overrides by the preAction hook below;\n * loadWebConfig() applies the flag > env > file > defaults precedence.\n */\nfunction withWebOptions(cmd: Command): Command {\n return cmd\n .option('--web', 'Enable the web monitoring server')\n .option('--serve', 'Alias for --web')\n .option('--port <n>', 'Web server port (default: 3737)', parseInteger)\n .option('--host <h>', 'Web server host (default: 0.0.0.0)')\n .option('--refresh <s>', 'Suggested UI polling interval in seconds', parseInteger)\n .option('--web-log-limit <n>', 'Max log entries kept in the snapshot', parseInteger)\n .option('--web-no-logs', 'Exclude logs from the published snapshot');\n}\n\n/**\n * Add the Issue provider options to a subcommand.\n *\n * Declared once here (like withWebOptions) so no command repeats the flag\n * list; the preAction hook below turns them into config overrides, and\n * loadIssuesConfig() applies the flag > .issue-flow.json > defaults precedence.\n */\nfunction withIssueOptions(cmd: Command): Command {\n return cmd\n .option('--local', 'Prefer the local file Issue provider')\n .option('--github', 'Prefer the GitHub Issue provider')\n .option('--prefer-local', 'On divergence, use the local version without asking')\n .option('--prefer-github', 'On divergence, use the GitHub version without asking')\n .option('--ask', 'On divergence, ask which version to use (interactive only)');\n}\n\n/**\n * Extract the web-related CLI flags from a command's options, keeping only\n * the ones the user actually set.\n */\nfunction resolveWebOverrides(opts: Record<string, unknown>): Partial<WebConfig> {\n const overrides: Partial<WebConfig> = {};\n if (opts.web === true || opts.serve === true) {\n overrides.enabled = true;\n }\n if (opts.port !== undefined) {\n overrides.port = opts.port as number;\n }\n if (opts.host !== undefined) {\n overrides.host = opts.host as string;\n }\n if (opts.refresh !== undefined) {\n overrides.refreshSeconds = opts.refresh as number;\n }\n if (opts.webLogLimit !== undefined) {\n overrides.logLimit = opts.webLogLimit as number;\n }\n if (opts.webNoLogs === true) {\n overrides.includeLogs = false;\n }\n return overrides;\n}\n\nconst program = new Command();\n\nprogram\n .name('issue-flow')\n .description(\n 'Unified CLI for orchestrating the full issue-flow pipeline via Claude Code Headless.',\n )\n .version(version);\n\nprogram.hook('preAction', (_thisCommand, actionCommand) => {\n const opts = actionCommand.opts();\n if (opts.verbose) {\n setVerbose(true);\n }\n if (opts.timeout !== undefined) {\n setGlobalTimeout(opts.timeout * 1000);\n }\n setWebCliOverrides(resolveWebOverrides(opts));\n try {\n setIssuesCliOverrides(resolveIssuesOverrides(opts));\n } catch (error) {\n if (error instanceof IssueFlagError) {\n printError(error.message);\n process.exit(1);\n }\n throw error;\n }\n});\n\n// ── init ────────────────────────────────────────────────────────────────────\nwithIssueOptions(\n withGlobalOptions(\n program.command('init').description('Verify that all prerequisites (claude, gh, git) are met'),\n ),\n).action(async () => {\n const { loadIssuesConfig } = await import('./config.js');\n const { runInit } = await import('./commands/init.js');\n const { preferredProvider } = await loadIssuesConfig();\n const code = await runInit(preferredProvider);\n process.exit(code);\n});\n\n// ── generate ────────────────────────────────────────────────────────────────\nwithGlobalOptions(\n program\n .command('generate')\n .description('Draft an issue via Claude Code Headless and create it')\n .requiredOption('--prompt <text>', 'Issue description text')\n .option('--github', 'Create the issue on GitHub')\n .option('--local', 'Create the issue under issues/<n>/ only')\n .option('--both', 'Create the issue on GitHub and mirror it locally'),\n).action(async (options: { prompt: string; github?: boolean; local?: boolean; both?: boolean }) => {\n let target: IssueGenerateTarget | undefined;\n try {\n target = resolveGenerateTarget(options);\n } catch (error) {\n if (error instanceof IssueFlagError) {\n printError(error.message);\n process.exit(1);\n }\n throw error;\n }\n\n const { runGenerate } = await import('./commands/generate.js');\n const code = await runGenerate(options.prompt, target);\n process.exit(code);\n});\n\n// ── run ─────────────────────────────────────────────────────────────────────\nwithWebOptions(\n withIssueOptions(\n withGlobalOptions(\n program\n .command('run')\n .description(\n 'Execute the full pipeline: prd → plan → execute → review → pr (→ pr-review, optional)',\n )\n .argument('<issue>', 'Issue number')\n .option('--mode <mode>', 'Execution mode: auto | manual', 'auto')\n .option('--from <phase>', 'Resume from a specific phase')\n .option('--no-branch', 'Run pipeline on current branch without creating a new branch or PR')\n .option('--pr-review', 'Review the created Pull Request after the pr phase'),\n ),\n ),\n).action(\n async (\n issue: string,\n options: { mode: string; from?: string; branch?: boolean; prReview?: boolean },\n ) => {\n let phases: ReturnType<typeof resolveRunPhaseFlags>;\n try {\n phases = resolveRunPhaseFlags(options);\n } catch (error) {\n if (error instanceof CliFlagError) {\n printError(error.message);\n process.exit(1);\n }\n throw error;\n }\n\n const { runPipeline } = await import('./commands/run.js');\n const code = await runPipeline(\n issue,\n options.mode,\n options.from,\n phases.noBranch,\n phases.prReview,\n );\n process.exit(code);\n },\n);\n\n// ── analyze ─────────────────────────────────────────────────────────────────\nwithIssueOptions(\n withGlobalOptions(\n program\n .command('analyze')\n .description('Analyze an issue via Claude Code Headless')\n .argument('<issue>', 'Issue number'),\n ),\n).action(async (issue: string) => {\n const { runAnalyze } = await import('./commands/analyze.js');\n const code = await runAnalyze(issue);\n process.exit(code);\n});\n\n// ── prd ─────────────────────────────────────────────────────────────────────\nwithIssueOptions(\n withGlobalOptions(\n program\n .command('prd')\n .description('Generate a PRD from an analyzed issue via Claude Code Headless')\n .argument('<issue>', 'Issue number'),\n ),\n).action(async (issue: string) => {\n const { runPrd } = await import('./commands/prd.js');\n const code = await runPrd(issue);\n process.exit(code);\n});\n\n// ── plan ────────────────────────────────────────────────────────────────────\nwithIssueOptions(\n withGlobalOptions(\n program\n .command('plan')\n .description('Convert a PRD to a tasks.json task plan via Claude Code Headless')\n .argument('<issue>', 'Issue number'),\n ),\n).action(async (issue: string) => {\n const { runPlan } = await import('./commands/plan.js');\n const code = await runPlan(issue);\n process.exit(code);\n});\n\n// ── execute ─────────────────────────────────────────────────────────────────\nwithWebOptions(\n withGlobalOptions(\n program\n .command('execute')\n .description('Run the iterative story execution loop (issue-flow engine)')\n .option('--issue <number>', 'Issue number — reads artifacts from issues/N/')\n .option('--max-iterations <number>', 'Stop after N iterations', parseInteger)\n .option(\n '--retry-limit <number>',\n 'Retry transient Claude failures up to N consecutive times',\n parseInteger,\n )\n .option('--retry-forever', 'Retry transient Claude failures indefinitely')\n .argument(\n '[max-iterations]',\n 'Backward-compatible alias for --max-iterations N',\n parseInteger,\n ),\n ),\n).action(\n async (\n positionalMaxIter: number | undefined,\n options: {\n issue?: string;\n maxIterations?: number;\n retryLimit?: number;\n retryForever?: boolean;\n },\n ) => {\n try {\n const { runExecute } = await import('./commands/execute.js');\n const code = await runExecute(positionalMaxIter, options);\n process.exit(code);\n } catch (error) {\n printError(error instanceof Error ? error.message : String(error));\n process.exit(1);\n }\n },\n);\n\n// ── review ──────────────────────────────────────────────────────────────────\nwithIssueOptions(\n withGlobalOptions(\n program\n .command('review')\n .description('Validate an issue resolution via Claude Code Headless')\n .argument('<issue>', 'Issue number'),\n ),\n).action(async (issue: string) => {\n const { runReview } = await import('./commands/review.js');\n const code = await runReview(issue);\n process.exit(code);\n});\n\n// ── pr ──────────────────────────────────────────────────────────────────────\nwithIssueOptions(\n withGlobalOptions(\n program\n .command('pr')\n .description('Create a pull request via Claude Code Headless')\n .argument('<issue>', 'Issue number'),\n ),\n).action(async (issue: string) => {\n const { runPr } = await import('./commands/pr.js');\n const code = await runPr(issue);\n process.exit(code);\n});\n\n// ── web ─────────────────────────────────────────────────────────────────────\nconst webCommand = program.command('web').description('Manage the web monitoring server');\n\nwebCommand\n .command('serve')\n .description(\n 'Run the web monitor server in the foreground (internal — spawned detached by --web)',\n )\n .option('--port <n>', 'Web server port (default: 3737)', parseInteger)\n .option('--host <h>', 'Web server host (default: 0.0.0.0)')\n .option('--refresh <s>', 'Suggested UI polling interval in seconds', parseInteger)\n .action(async (options: { port?: number; host?: string; refresh?: number }) => {\n const { runWebServe } = await import('./commands/web.js');\n const code = await runWebServe(options);\n // On success this process stays alive for as long as the server is bound\n // (server.ts binds it with unref: false) — only a failure exits here.\n if (code !== 0) {\n process.exit(code);\n }\n });\n\nwebCommand\n .command('stop')\n .description('Stop the running web monitor server')\n .action(async () => {\n const { runWebStop } = await import('./commands/web.js');\n const code = await runWebStop();\n process.exit(code);\n });\n\n// ── pr-review ───────────────────────────────────────────────────────────────\nwithGlobalOptions(\n program\n .command('pr-review')\n .description('Review a Pull Request as a whole via Claude Code Headless')\n .argument('[pr]', 'Pull Request number (discovered from the session when omitted)')\n .option('--issue <n>', 'Issue the Pull Request belongs to')\n .option('--round <n>', 'Rewrite a specific review round instead of appending a new one')\n .option('--yes', 'Skip the confirmation of the discovered Pull Request')\n .option(\n '--fail-on <level>',\n 'Verdict that fails the command: request-changes | suggestions | none',\n ),\n).action(\n async (\n pr: string | undefined,\n options: { issue?: string; round?: string; yes?: boolean; failOn?: string },\n ) => {\n const { runPrReview } = await import('./commands/pr-review.js');\n const code = await runPrReview(pr, options);\n process.exit(code);\n },\n);\n\nprogram.parse();\n","/**\n * Pure mappings from parsed CLI options to command arguments.\n *\n * They live outside cli.ts because that module runs `program.parse()` on\n * import, so anything defined there is untestable.\n */\n\n/** Shape commander produces for a negated boolean option (`--no-branch`). */\nexport interface BranchFlagOptions {\n branch?: boolean;\n}\n\n/**\n * Translate commander's `--no-branch` into the tri-state `runPipeline` expects.\n *\n * Commander stores a negated option under its positive name: `--no-branch`\n * yields `{ branch: false }` and never a `noBranch` key. Reading `noBranch`\n * silently dropped the flag, so the pipeline always created a branch and opened\n * a PR.\n *\n * `undefined` (flag absent) is preserved on purpose: `runPipeline` uses it to\n * tell \"the user said nothing, keep the mode persisted in tasks.json\" apart\n * from an explicit choice.\n */\nexport function resolveNoBranch(options: BranchFlagOptions): boolean | undefined {\n return options.branch === false ? true : undefined;\n}\n\n/** Invalid flag combination on a command, reported as a CLI error. */\nexport class CliFlagError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'CliFlagError';\n }\n}\n\n/** Options `run` accepts that select which phases the pipeline executes. */\nexport interface RunPhaseFlagOptions extends BranchFlagOptions {\n prReview?: boolean;\n}\n\n/** Phase selection `runPipeline` expects, both entries tri-state. */\nexport interface RunPhaseFlags {\n noBranch: boolean | undefined;\n prReview: boolean | undefined;\n}\n\n/**\n * Resolve the phase-selection flags of `run`, rejecting the one combination\n * that cannot work.\n *\n * `--no-branch` skips the `pr` phase, so there is no Pull Request for\n * `--pr-review` to review. Failing here — before any phase runs — beats\n * discovering it at the end of a full pipeline.\n *\n * Both values stay `undefined` when the user passed nothing: `runPipeline`\n * uses that to tell \"no opinion, keep what tasks.json persisted\" apart from an\n * explicit choice.\n *\n * @throws CliFlagError when `--pr-review` is combined with `--no-branch`.\n */\nexport function resolveRunPhaseFlags(options: RunPhaseFlagOptions): RunPhaseFlags {\n const noBranch = resolveNoBranch(options);\n const prReview = options.prReview === true ? true : undefined;\n\n if (prReview === true && noBranch === true) {\n throw new CliFlagError(\n '--pr-review cannot be combined with --no-branch: --no-branch skips the pr phase, ' +\n 'so there is no Pull Request to review.',\n );\n }\n\n return { noBranch, prReview };\n}\n","import type { IssueGenerateTarget, IssuesConfig } from './types.js';\n\n/**\n * Mapping from the Issue provider CLI flags to configuration overrides.\n *\n * Kept out of cli.ts (which runs `program.parse()` on import) so the\n * precedence rules stay unit-testable. Only the keys the user actually passed\n * are returned: a key present with `undefined` would override .issue-flow.json\n * when the layers are merged.\n */\n\nexport interface IssueCliFlags {\n local?: boolean;\n github?: boolean;\n preferLocal?: boolean;\n preferGithub?: boolean;\n ask?: boolean;\n}\n\n/** Invalid flag combination, reported to the user as a CLI error. */\nexport class IssueFlagError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'IssueFlagError';\n }\n}\n\n/**\n * Translate the parsed options of a command into `IssuesConfig` overrides.\n *\n * @throws IssueFlagError when mutually exclusive flags are combined.\n */\nexport function resolveIssuesOverrides(opts: IssueCliFlags): Partial<IssuesConfig> {\n const overrides: Partial<IssuesConfig> = {};\n\n if (opts.local === true && opts.github === true) {\n throw new IssueFlagError('--local and --github are mutually exclusive; pass only one.');\n }\n if (opts.local === true) {\n overrides.preferredProvider = 'local';\n }\n if (opts.github === true) {\n overrides.preferredProvider = 'github';\n }\n\n const conflictFlags = [\n opts.preferLocal === true ? '--prefer-local' : null,\n opts.preferGithub === true ? '--prefer-github' : null,\n opts.ask === true ? '--ask' : null,\n ].filter((flag): flag is string => flag !== null);\n\n if (conflictFlags.length > 1) {\n throw new IssueFlagError(\n `${conflictFlags.join(', ')} are mutually exclusive; pass only one conflict policy.`,\n );\n }\n if (opts.preferLocal === true) {\n overrides.conflictPolicy = 'prefer-local';\n }\n if (opts.preferGithub === true) {\n overrides.conflictPolicy = 'prefer-github';\n }\n if (opts.ask === true) {\n overrides.conflictPolicy = 'ask';\n }\n\n return overrides;\n}\n\n/** Destination flags accepted by `generate`. */\nexport interface GenerateTargetFlags {\n github?: boolean;\n local?: boolean;\n both?: boolean;\n}\n\n/**\n * Destination the generated Issue is created in, or `undefined` when the user\n * passed no flag (the caller then falls back to `defaultGenerateTarget`).\n *\n * @throws IssueFlagError when more than one destination is requested.\n */\nexport function resolveGenerateTarget(opts: GenerateTargetFlags): IssueGenerateTarget | undefined {\n const selected: IssueGenerateTarget[] = [];\n if (opts.github === true) selected.push('github');\n if (opts.local === true) selected.push('local');\n if (opts.both === true) selected.push('both');\n\n if (selected.length > 1) {\n throw new IssueFlagError(\n `${selected.map((target) => `--${target}`).join(', ')} are mutually exclusive; ` +\n 'pass only one destination.',\n );\n }\n\n return selected[0];\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,SAAS,4BAA4B;;;ACuBvC,SAAS,gBAAgB,SAAiD;AAC/E,SAAO,QAAQ,WAAW,QAAQ,OAAO;AAC3C;AAGO,IAAM,eAAN,cAA2B,MAAM;AAAA,EACtC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AA2BO,SAAS,qBAAqB,SAA6C;AAChF,QAAM,WAAW,gBAAgB,OAAO;AACxC,QAAM,WAAW,QAAQ,aAAa,OAAO,OAAO;AAEpD,MAAI,aAAa,QAAQ,aAAa,MAAM;AAC1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ACA,OACE,IACA,YACG;AACH,UAAM,EAAE,YAAY,IAAI,MAAM,OAAO,yBAAyB;AAC9D,UAAM,OAAO,MAAM,YAAY,IAAI,OAAO;AAC1C,YAAQ,KAAK,IAAI;AAAA,EACnB;AACF;AAEA,QAAQ,MAAM;","names":["require"]}
|
|
@@ -15,8 +15,8 @@ import {
|
|
|
15
15
|
setIssuesCliOverrides,
|
|
16
16
|
setWebCliOverrides,
|
|
17
17
|
validateDependencies
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-RUTDK6ZF.js";
|
|
19
|
+
import "./chunk-WO6ERABE.js";
|
|
20
20
|
export {
|
|
21
21
|
DEFAULTS,
|
|
22
22
|
GLOBAL_CONFIG_FILENAME,
|
|
@@ -34,4 +34,4 @@ export {
|
|
|
34
34
|
setWebCliOverrides,
|
|
35
35
|
validateDependencies
|
|
36
36
|
};
|
|
37
|
-
//# sourceMappingURL=config-
|
|
37
|
+
//# sourceMappingURL=config-OAZG7KIK.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
runExecute
|
|
4
|
+
} from "./chunk-WGDLUPSF.js";
|
|
5
|
+
import "./chunk-HDV3YDTG.js";
|
|
6
|
+
import "./chunk-XPW46TI5.js";
|
|
7
|
+
import "./chunk-ZYBYMEWG.js";
|
|
8
|
+
import "./chunk-SLHZPB3C.js";
|
|
9
|
+
import "./chunk-RUTDK6ZF.js";
|
|
10
|
+
import "./chunk-WO6ERABE.js";
|
|
11
|
+
export {
|
|
12
|
+
runExecute
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=execute-AOEM52CD.js.map
|
|
@@ -3,25 +3,27 @@ import {
|
|
|
3
3
|
ensureProvidersRegistered,
|
|
4
4
|
getProvider,
|
|
5
5
|
localIssueRef
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-EYVXLRRD.js";
|
|
7
7
|
import {
|
|
8
8
|
runHeadless
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KHTLN54U.js";
|
|
10
10
|
import {
|
|
11
|
-
applyPlaceholders,
|
|
12
|
-
loadPrompt,
|
|
13
11
|
publishPhaseMetrics
|
|
14
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZYBYMEWG.js";
|
|
13
|
+
import {
|
|
14
|
+
applyPlaceholders,
|
|
15
|
+
loadPrompt
|
|
16
|
+
} from "./chunk-SLHZPB3C.js";
|
|
15
17
|
import {
|
|
16
18
|
loadIssuesConfig,
|
|
17
19
|
resolveProjectPaths
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-RUTDK6ZF.js";
|
|
19
21
|
import {
|
|
20
22
|
getGlobalTimeout,
|
|
21
23
|
isoNow,
|
|
22
24
|
printError,
|
|
23
25
|
printSuccess
|
|
24
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-WO6ERABE.js";
|
|
25
27
|
|
|
26
28
|
// src/issues/draft.ts
|
|
27
29
|
var DRAFT_TAG = "issue-draft";
|
|
@@ -151,4 +153,4 @@ async function runGenerate(promptText, target) {
|
|
|
151
153
|
export {
|
|
152
154
|
runGenerate
|
|
153
155
|
};
|
|
154
|
-
//# sourceMappingURL=generate-
|
|
156
|
+
//# sourceMappingURL=generate-BEJF3SVJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/issues/draft.ts","../src/commands/generate.ts"],"sourcesContent":["import type { IssueDraft } from './types.js';\n\n/**\n * Structured Issue draft emitted by the `generate` prompt.\n *\n * The agent no longer creates the Issue itself: it returns the content and the\n * providers persist it, so the same draft can reach GitHub, the local files, or\n * both. Capturing the result therefore has to be exact — the old approach of\n * fishing an issue URL out of free-form prose only ever worked for GitHub.\n *\n * The block mirrors the `<issue-body>` convention already used by the phase\n * templates, which keeps a multi-line markdown body readable and free of the\n * escaping a JSON payload would demand.\n */\n\n/** Wrapper the agent must emit around the draft. */\nexport const DRAFT_TAG = 'issue-draft';\n\n/** Failure to capture a draft from the agent output. */\nexport class IssueDraftParseError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'IssueDraftParseError';\n }\n}\n\n/**\n * Last occurrence of `<tag>...</tag>` in `source`, or `null`.\n *\n * The last one wins: an agent that shows the format before filling it in (or\n * restates the draft after a correction) would otherwise have its first,\n * throwaway attempt captured. The closing tag is searched from the end for the\n * same reason a body may legitimately quote one.\n */\nfunction extractTag(source: string, tag: string): string | null {\n const open = `<${tag}>`;\n const close = `</${tag}>`;\n\n const start = source.lastIndexOf(open);\n if (start === -1) return null;\n\n const end = source.lastIndexOf(close);\n if (end === -1 || end < start) return null;\n\n return source.slice(start + open.length, end);\n}\n\nfunction parseLabels(raw: string | null): string[] {\n if (raw === null) return [];\n return raw\n .split(',')\n .map((label) => label.trim())\n .filter((label) => label.length > 0 && label.toLowerCase() !== '(none)');\n}\n\n/**\n * Read the draft the agent produced.\n *\n * @throws IssueDraftParseError when the block is absent or has no usable\n * title/body, so a malformed answer fails loudly instead of creating an empty\n * Issue.\n */\nexport function parseIssueDraft(output: string): IssueDraft {\n const normalized = output.replace(/\\r\\n?/g, '\\n');\n const block = extractTag(normalized, DRAFT_TAG);\n\n if (block === null) {\n throw new IssueDraftParseError(\n `The agent did not emit an <${DRAFT_TAG}> block, so there is no Issue to create. ` +\n `Output was: ${normalized.trim().slice(0, 300) || '(empty)'}`,\n );\n }\n\n const title = (extractTag(block, 'title') ?? '').trim();\n const body = (extractTag(block, 'body') ?? '').trim();\n\n if (title.length === 0) {\n throw new IssueDraftParseError(`The <${DRAFT_TAG}> block has no <title>.`);\n }\n if (body.length === 0) {\n throw new IssueDraftParseError(`The <${DRAFT_TAG}> block has no <body>.`);\n }\n\n return { title, body, labels: parseLabels(extractTag(block, 'labels')) };\n}\n","import { loadIssuesConfig } from '../config.js';\nimport { runHeadless } from '../core/headless.js';\nimport { applyPlaceholders, loadPrompt } from '../core/prompt-resolver.js';\nimport { publishPhaseMetrics } from '../core/session-metrics.js';\nimport { isoNow } from '../core/state-manager.js';\nimport { getGlobalTimeout } from '../core/verbose.js';\nimport { ensureProvidersRegistered } from '../issues/bootstrap.js';\nimport { localIssueRef } from '../issues/context.js';\nimport { IssueDraftParseError, parseIssueDraft } from '../issues/draft.js';\nimport { getProvider } from '../issues/registry.js';\nimport type { Issue, IssueDraft, IssueGenerateTarget } from '../issues/types.js';\nimport { resolveProjectPaths } from '../storage/resolve.js';\nimport { printError, printSuccess } from '../ui/logger.js';\n\n/** Human-readable pointer to a created Issue. */\nfunction issueLocation(issue: Issue): string {\n return issue.remoteRef ?? localIssueRef(issue.id);\n}\n\n/**\n * Ask the agent for the Issue content.\n *\n * The agent only drafts: creation belongs to the providers, so the same draft\n * can be persisted to GitHub, to the local files, or to both.\n */\nasync function draftIssue(promptText: string): Promise<IssueDraft> {\n // The duplicate check reads the local issues, which live in the global\n // storage: the path has to be handed over (and allowed) explicitly, since it\n // is outside the working directory the agent is started in.\n const { issuesDir } = await resolveProjectPaths();\n\n const template = await loadPrompt('generate');\n const prompt = applyPlaceholders(template, {\n __USER_PROMPT__: promptText,\n __LOCAL_ISSUES_DIR__: issuesDir,\n });\n\n const startedAtMs = Date.now();\n const result = await runHeadless({\n prompt,\n maxTurns: 15,\n timeout: getGlobalTimeout() ?? 300_000,\n // json (not text) so the CLI reports usage: the envelope's `result` field\n // carries the same assistant text parseIssueDraft() already consumed.\n outputFormat: 'json',\n allowedTools: ['Bash', 'Read', 'Glob', 'Grep'],\n addDirs: [issuesDir],\n statusMessage: 'Drafting issue...',\n });\n // Before the success check: the tokens were spent either way.\n publishPhaseMetrics('generate', result.cost, startedAtMs);\n\n if (!result.success) {\n throw new Error(`Issue creation failed: ${result.error}`);\n }\n\n return parseIssueDraft(result.result);\n}\n\n/**\n * Create the GitHub Issue and mirror it locally.\n *\n * The remote comes first on purpose: it owns the identifier, and the mirror has\n * to reuse it so both copies describe one demand. A remote failure therefore\n * leaves nothing behind, and a mirror failure is reported with the remote\n * reference that already exists.\n */\nasync function createBoth(draft: IssueDraft): Promise<Issue[]> {\n const remote = await getProvider('github').create(draft);\n\n try {\n const mirror = await getProvider('local').create({\n ...draft,\n id: remote.id,\n ...(remote.remoteRef\n ? {\n remote: {\n provider: 'github' as const,\n ref: remote.remoteRef,\n syncedAt: isoNow(),\n syncedContentHash: remote.contentHash,\n },\n }\n : {}),\n });\n return [remote, mirror];\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n throw new Error(\n `GitHub issue created at ${issueLocation(remote)}, but the local mirror was not written: ` +\n `${message}. Nothing else was persisted; re-run with --local to create the mirror.`,\n );\n }\n}\n\nasync function createIssues(target: IssueGenerateTarget, draft: IssueDraft): Promise<Issue[]> {\n if (target === 'both') {\n return createBoth(draft);\n }\n return [await getProvider(target).create(draft)];\n}\n\nexport async function runGenerate(\n promptText: string,\n target?: IssueGenerateTarget,\n): Promise<number> {\n const config = await loadIssuesConfig();\n const destination = target ?? config.defaultGenerateTarget;\n\n ensureProvidersRegistered();\n\n let draft: IssueDraft;\n try {\n draft = await draftIssue(promptText);\n } catch (err) {\n if (err instanceof IssueDraftParseError) {\n printError(`Could not read the generated Issue draft: ${err.message}`);\n } else {\n printError(err instanceof Error ? err.message : String(err));\n }\n return 1;\n }\n\n let created: Issue[];\n try {\n created = await createIssues(destination, draft);\n } catch (err) {\n printError(err instanceof Error ? err.message : String(err));\n return 1;\n }\n\n for (const issue of created) {\n printSuccess(`Issue created (${issue.source}): ${issueLocation(issue)}`);\n }\n return 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,IAAM,YAAY;AAGlB,IAAM,uBAAN,cAAmC,MAAM;AAAA,EAC9C,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAUA,SAAS,WAAW,QAAgB,KAA4B;AAC9D,QAAM,OAAO,IAAI,GAAG;AACpB,QAAM,QAAQ,KAAK,GAAG;A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AAY,MAAM,EAAE,OAAO,KAAK,CAAC;AACjD;AAEA,eAAsB,YACpB,YACA,QACiB;AACjB,QAAM,SAAS,MAAM,iBAAiB;AACtC,QAAM,cAAc,UAAU,OAAO;AAErC,4BAA0B;AAE1B,MAAI;AACJ,MAAI;AACF,YAAQ,MAAM,WAAW,UAAU;AAAA,EACrC,SAAS,KAAK;AACZ,QAAI,eAAe,sBAAsB;AACvC,iBAAW,6CAA6C,IAAI,OAAO,EAAE;AAAA,IACvE,OAAO;AACL,iBAAW,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAAA,IAC7D;AACA,WAAO;AAAA,EACT;AAEA,MAAI;AACJ,MAAI;AACF,cAAU,MAAM,aAAa,aAAa,KAAK;AAAA,EACjD,SAAS,KAAK;AACZ,eAAW,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAC3D,WAAO;AAAA,EACT;AAEA,aAAW,SAAS,SAAS;AAC3B,iBAAa,kBAAkB,MAAM,MAAM,MAAM,cAAc,KAAK,CAAC,EAAE;AAAA,EACzE;AACA,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/issues/draft.ts","../src/commands/generate.ts"],"sourcesContent":["import type { IssueDraft } from './types.js';\n\n/**\n * Structured Issue draft emitted by the `generate` prompt.\n *\n * The agent no longer creates the Issue itself: it returns the content and the\n * providers persist it, so the same draft can reach GitHub, the local files, or\n * both. Capturing the result therefore has to be exact — the old approach of\n * fishing an issue URL out of free-form prose only ever worked for GitHub.\n *\n * The block mirrors the `<issue-body>` convention already used by the phase\n * templates, which keeps a multi-line markdown body readable and free of the\n * escaping a JSON payload would demand.\n */\n\n/** Wrapper the agent must emit around the draft. */\nexport const DRAFT_TAG = 'issue-draft';\n\n/** Failure to capture a draft from the agent output. */\nexport class IssueDraftParseError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'IssueDraftParseError';\n }\n}\n\n/**\n * Last occurrence of `<tag>...</tag>` in `source`, or `null`.\n *\n * The last one wins: an agent that shows the format before filling it in (or\n * restates the draft after a correction) would otherwise have its first,\n * throwaway attempt captured. The closing tag is searched from the end for the\n * same reason a body may legitimately quote one.\n */\nfunction extractTag(source: string, tag: string): string | null {\n const open = `<${tag}>`;\n const close = `</${tag}>`;\n\n const start = source.lastIndexOf(open);\n if (start === -1) return null;\n\n const end = source.lastIndexOf(close);\n if (end === -1 || end < start) return null;\n\n return source.slice(start + open.length, end);\n}\n\nfunction parseLabels(raw: string | null): string[] {\n if (raw === null) return [];\n return raw\n .split(',')\n .map((label) => label.trim())\n .filter((label) => label.length > 0 && label.toLowerCase() !== '(none)');\n}\n\n/**\n * Read the draft the agent produced.\n *\n * @throws IssueDraftParseError when the block is absent or has no usable\n * title/body, so a malformed answer fails loudly instead of creating an empty\n * Issue.\n */\nexport function parseIssueDraft(output: string): IssueDraft {\n const normalized = output.replace(/\\r\\n?/g, '\\n');\n const block = extractTag(normalized, DRAFT_TAG);\n\n if (block === null) {\n throw new IssueDraftParseError(\n `The agent did not emit an <${DRAFT_TAG}> block, so there is no Issue to create. ` +\n `Output was: ${normalized.trim().slice(0, 300) || '(empty)'}`,\n );\n }\n\n const title = (extractTag(block, 'title') ?? '').trim();\n const body = (extractTag(block, 'body') ?? '').trim();\n\n if (title.length === 0) {\n throw new IssueDraftParseError(`The <${DRAFT_TAG}> block has no <title>.`);\n }\n if (body.length === 0) {\n throw new IssueDraftParseError(`The <${DRAFT_TAG}> block has no <body>.`);\n }\n\n return { title, body, labels: parseLabels(extractTag(block, 'labels')) };\n}\n","import { loadIssuesConfig } from '../config.js';\nimport { runHeadless } from '../core/headless.js';\nimport { applyPlaceholders, loadPrompt } from '../core/prompt-resolver.js';\nimport { publishPhaseMetrics } from '../core/session-metrics.js';\nimport { isoNow } from '../core/state-manager.js';\nimport { getGlobalTimeout } from '../core/verbose.js';\nimport { ensureProvidersRegistered } from '../issues/bootstrap.js';\nimport { localIssueRef } from '../issues/context.js';\nimport { IssueDraftParseError, parseIssueDraft } from '../issues/draft.js';\nimport { getProvider } from '../issues/registry.js';\nimport type { Issue, IssueDraft, IssueGenerateTarget } from '../issues/types.js';\nimport { resolveProjectPaths } from '../storage/resolve.js';\nimport { printError, printSuccess } from '../ui/logger.js';\n\n/** Human-readable pointer to a created Issue. */\nfunction issueLocation(issue: Issue): string {\n return issue.remoteRef ?? localIssueRef(issue.id);\n}\n\n/**\n * Ask the agent for the Issue content.\n *\n * The agent only drafts: creation belongs to the providers, so the same draft\n * can be persisted to GitHub, to the local files, or to both.\n */\nasync function draftIssue(promptText: string): Promise<IssueDraft> {\n // The duplicate check reads the local issues, which live in the global\n // storage: the path has to be handed over (and allowed) explicitly, since it\n // is outside the working directory the agent is started in.\n const { issuesDir } = await resolveProjectPaths();\n\n const template = await loadPrompt('generate');\n const prompt = applyPlaceholders(template, {\n __USER_PROMPT__: promptText,\n __LOCAL_ISSUES_DIR__: issuesDir,\n });\n\n const startedAtMs = Date.now();\n const result = await runHeadless({\n prompt,\n maxTurns: 15,\n timeout: getGlobalTimeout() ?? 300_000,\n // json (not text) so the CLI reports usage: the envelope's `result` field\n // carries the same assistant text parseIssueDraft() already consumed.\n outputFormat: 'json',\n allowedTools: ['Bash', 'Read', 'Glob', 'Grep'],\n addDirs: [issuesDir],\n statusMessage: 'Drafting issue...',\n });\n // Before the success check: the tokens were spent either way.\n publishPhaseMetrics('generate', result.cost, startedAtMs);\n\n if (!result.success) {\n throw new Error(`Issue creation failed: ${result.error}`);\n }\n\n return parseIssueDraft(result.result);\n}\n\n/**\n * Create the GitHub Issue and mirror it locally.\n *\n * The remote comes first on purpose: it owns the identifier, and the mirror has\n * to reuse it so both copies describe one demand. A remote failure therefore\n * leaves nothing behind, and a mirror failure is reported with the remote\n * reference that already exists.\n */\nasync function createBoth(draft: IssueDraft): Promise<Issue[]> {\n const remote = await getProvider('github').create(draft);\n\n try {\n const mirror = await getProvider('local').create({\n ...draft,\n id: remote.id,\n ...(remote.remoteRef\n ? {\n remote: {\n provider: 'github' as const,\n ref: remote.remoteRef,\n syncedAt: isoNow(),\n syncedContentHash: remote.contentHash,\n },\n }\n : {}),\n });\n return [remote, mirror];\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n throw new Error(\n `GitHub issue created at ${issueLocation(remote)}, but the local mirror was not written: ` +\n `${message}. Nothing else was persisted; re-run with --local to create the mirror.`,\n );\n }\n}\n\nasync function createIssues(target: IssueGenerateTarget, draft: IssueDraft): Promise<Issue[]> {\n if (target === 'both') {\n return createBoth(draft);\n }\n return [await getProvider(target).create(draft)];\n}\n\nexport async function runGenerate(\n promptText: string,\n target?: IssueGenerateTarget,\n): Promise<number> {\n const config = await loadIssuesConfig();\n const destination = target ?? config.defaultGenerateTarget;\n\n ensureProvidersRegistered();\n\n let draft: IssueDraft;\n try {\n draft = await draftIssue(promptText);\n } catch (err) {\n if (err instanceof IssueDraftParseError) {\n printError(`Could not read the generated Issue draft: ${err.message}`);\n } else {\n printError(err instanceof Error ? err.message : String(err));\n }\n return 1;\n }\n\n let created: Issue[];\n try {\n created = await createIssues(destination, draft);\n } catch (err) {\n printError(err instanceof Error ? err.message : String(err));\n return 1;\n }\n\n for (const issue of created) {\n printSuccess(`Issue created (${issue.source}): ${issueLocation(issue)}`);\n }\n return 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,IAAM,YAAY;AAGlB,IAAM,uBAAN,cAAmC,MAAM;AAAA,EAC9C,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAUA,SAAS,WAAW,QAAgB,KAA4B;AAC9D,QAAM,OAAO,IAAI,GAAG;AACpB,QAAM,QAAQ,KAAK,GAAG;AAEtB,QAAM,QAAQ,OAAO,YAAY,IAAI;AACrC,MAAI,UAAU,GAAI,QAAO;AAEzB,QAAM,MAAM,OAAO,YAAY,KAAK;AACpC,MAAI,QAAQ,MAAM,MAAM,MAAO,QAAO;AAEtC,SAAO,OAAO,MAAM,QAA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,YAAQ,MAAM,WAAW,UAAU;AAAA,EACrC,SAAS,KAAK;AACZ,QAAI,eAAe,sBAAsB;AACvC,iBAAW,6CAA6C,IAAI,OAAO,EAAE;AAAA,IACvE,OAAO;AACL,iBAAW,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAAA,IAC7D;AACA,WAAO;AAAA,EACT;AAEA,MAAI;AACJ,MAAI;AACF,cAAU,MAAM,aAAa,aAAa,KAAK;AAAA,EACjD,SAAS,KAAK;AACZ,eAAW,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAC3D,WAAO;AAAA,EACT;AAEA,aAAW,SAAS,SAAS;AAC3B,iBAAa,kBAAkB,MAAM,MAAM,MAAM,cAAc,KAAK,CAAC,EAAE;AAAA,EACzE;AACA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
runPlan
|
|
4
|
+
} from "./chunk-3E6KASSE.js";
|
|
5
|
+
import "./chunk-OPIDR2DC.js";
|
|
6
|
+
import "./chunk-EYVXLRRD.js";
|
|
7
|
+
import "./chunk-HDV3YDTG.js";
|
|
8
|
+
import "./chunk-KHTLN54U.js";
|
|
9
|
+
import "./chunk-ZYBYMEWG.js";
|
|
10
|
+
import "./chunk-SLHZPB3C.js";
|
|
11
|
+
import "./chunk-RUTDK6ZF.js";
|
|
12
|
+
import "./chunk-WO6ERABE.js";
|
|
13
|
+
export {
|
|
14
|
+
runPlan
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=plan-YDZYB2BO.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
runPr
|
|
4
|
+
} from "./chunk-6UTVPKNF.js";
|
|
5
|
+
import "./chunk-OPIDR2DC.js";
|
|
6
|
+
import "./chunk-EYVXLRRD.js";
|
|
7
|
+
import "./chunk-HDV3YDTG.js";
|
|
8
|
+
import "./chunk-KHTLN54U.js";
|
|
9
|
+
import "./chunk-ZYBYMEWG.js";
|
|
10
|
+
import "./chunk-SLHZPB3C.js";
|
|
11
|
+
import "./chunk-RUTDK6ZF.js";
|
|
12
|
+
import "./chunk-WO6ERABE.js";
|
|
13
|
+
export {
|
|
14
|
+
runPr
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=pr-SIXMJIZF.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
exitCodeFor,
|
|
4
|
+
runPrReview
|
|
5
|
+
} from "./chunk-6IOPYFUM.js";
|
|
6
|
+
import "./chunk-XPW46TI5.js";
|
|
7
|
+
import "./chunk-KHTLN54U.js";
|
|
8
|
+
import "./chunk-ZYBYMEWG.js";
|
|
9
|
+
import "./chunk-SLHZPB3C.js";
|
|
10
|
+
import "./chunk-RUTDK6ZF.js";
|
|
11
|
+
import "./chunk-WO6ERABE.js";
|
|
12
|
+
export {
|
|
13
|
+
exitCodeFor,
|
|
14
|
+
runPrReview
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=pr-review-AY56ZPJR.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
runPrd
|
|
4
|
+
} from "./chunk-6L2BPOE3.js";
|
|
5
|
+
import "./chunk-OPIDR2DC.js";
|
|
6
|
+
import "./chunk-EYVXLRRD.js";
|
|
7
|
+
import "./chunk-HDV3YDTG.js";
|
|
8
|
+
import "./chunk-KHTLN54U.js";
|
|
9
|
+
import "./chunk-ZYBYMEWG.js";
|
|
10
|
+
import "./chunk-SLHZPB3C.js";
|
|
11
|
+
import "./chunk-RUTDK6ZF.js";
|
|
12
|
+
import "./chunk-WO6ERABE.js";
|
|
13
|
+
export {
|
|
14
|
+
runPrd
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=prd-MBSSBLGO.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
runReview
|
|
4
|
+
} from "./chunk-EOTULFWV.js";
|
|
5
|
+
import "./chunk-EYVXLRRD.js";
|
|
6
|
+
import "./chunk-KHTLN54U.js";
|
|
7
|
+
import "./chunk-ZYBYMEWG.js";
|
|
8
|
+
import "./chunk-SLHZPB3C.js";
|
|
9
|
+
import "./chunk-RUTDK6ZF.js";
|
|
10
|
+
import "./chunk-WO6ERABE.js";
|
|
11
|
+
export {
|
|
12
|
+
runReview
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=review-2MDDHZ4X.js.map
|
|
@@ -1,49 +1,52 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
runPrd
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6L2BPOE3.js";
|
|
5
5
|
import {
|
|
6
6
|
runReview
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-EOTULFWV.js";
|
|
8
|
+
import {
|
|
9
|
+
ensureWebMonitor
|
|
10
|
+
} from "./chunk-JOK7VXRV.js";
|
|
8
11
|
import {
|
|
9
12
|
runInit
|
|
10
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-G37JNQKB.js";
|
|
11
14
|
import {
|
|
12
15
|
printRunSummary,
|
|
13
16
|
runExecute
|
|
14
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-WGDLUPSF.js";
|
|
15
18
|
import {
|
|
16
19
|
runPlan
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-3E6KASSE.js";
|
|
18
21
|
import {
|
|
19
22
|
runPr
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-6UTVPKNF.js";
|
|
24
|
+
import "./chunk-OPIDR2DC.js";
|
|
22
25
|
import {
|
|
23
26
|
getProvider,
|
|
24
27
|
resolveCommandIssue
|
|
25
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-EYVXLRRD.js";
|
|
26
29
|
import "./chunk-HDV3YDTG.js";
|
|
27
30
|
import {
|
|
28
31
|
mostRecent,
|
|
29
32
|
prReviewDir,
|
|
30
33
|
readPrReviewIndex,
|
|
31
34
|
runPrReview
|
|
32
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-6IOPYFUM.js";
|
|
33
36
|
import {
|
|
34
37
|
listPullRequests,
|
|
35
38
|
publishGitState
|
|
36
|
-
} from "./chunk-
|
|
37
|
-
import "./chunk-
|
|
39
|
+
} from "./chunk-XPW46TI5.js";
|
|
40
|
+
import "./chunk-KHTLN54U.js";
|
|
38
41
|
import {
|
|
39
|
-
getRunUsageTotals
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
getRunUsageTotals
|
|
43
|
+
} from "./chunk-ZYBYMEWG.js";
|
|
44
|
+
import "./chunk-SLHZPB3C.js";
|
|
42
45
|
import {
|
|
43
46
|
loadIssuesConfig,
|
|
44
47
|
loadWebConfig,
|
|
45
48
|
resolveIssuePaths
|
|
46
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-RUTDK6ZF.js";
|
|
47
50
|
import {
|
|
48
51
|
FilePublisher,
|
|
49
52
|
NullPublisher,
|
|
@@ -57,12 +60,12 @@ import {
|
|
|
57
60
|
setOutputCallback,
|
|
58
61
|
setSessionPublisher,
|
|
59
62
|
setStoryUpdateCallback
|
|
60
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-WO6ERABE.js";
|
|
61
64
|
|
|
62
65
|
// src/commands/run.ts
|
|
63
66
|
import { randomUUID } from "crypto";
|
|
64
67
|
import { mkdir } from "fs/promises";
|
|
65
|
-
import { join
|
|
68
|
+
import { join } from "path";
|
|
66
69
|
import { execa } from "execa";
|
|
67
70
|
|
|
68
71
|
// src/core/pipeline.ts
|
|
@@ -326,180 +329,6 @@ async function runPipelineWithRenderer(options) {
|
|
|
326
329
|
};
|
|
327
330
|
}
|
|
328
331
|
|
|
329
|
-
// src/web/server.ts
|
|
330
|
-
import { readFile } from "fs/promises";
|
|
331
|
-
import { createServer } from "http";
|
|
332
|
-
import { createRequire } from "module";
|
|
333
|
-
import { join } from "path";
|
|
334
|
-
import chalk from "chalk";
|
|
335
|
-
var require2 = createRequire(import.meta.url);
|
|
336
|
-
function readPackageVersion() {
|
|
337
|
-
try {
|
|
338
|
-
return require2("../../package.json").version;
|
|
339
|
-
} catch {
|
|
340
|
-
return "0.0.0";
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
var JSON_TYPE = "application/json; charset=utf-8";
|
|
344
|
-
var STATIC_ROUTES = {
|
|
345
|
-
"/": { file: "index.html", contentType: "text/html; charset=utf-8" },
|
|
346
|
-
"/app.css": { file: "app.css", contentType: "text/css; charset=utf-8" },
|
|
347
|
-
"/app.js": { file: "app.js", contentType: "text/javascript; charset=utf-8" }
|
|
348
|
-
};
|
|
349
|
-
async function loadStaticAssets(publicDir) {
|
|
350
|
-
const assets = /* @__PURE__ */ new Map();
|
|
351
|
-
if (publicDir === null) return assets;
|
|
352
|
-
for (const [route, { file, contentType }] of Object.entries(STATIC_ROUTES)) {
|
|
353
|
-
try {
|
|
354
|
-
const body = await readFile(join(publicDir, file), "utf-8");
|
|
355
|
-
assets.set(route, { body, contentType });
|
|
356
|
-
} catch {
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
return assets;
|
|
360
|
-
}
|
|
361
|
-
function baseHeaders(res) {
|
|
362
|
-
res.setHeader("Cache-Control", "no-store");
|
|
363
|
-
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
364
|
-
res.setHeader("Referrer-Policy", "no-referrer");
|
|
365
|
-
res.setHeader("X-Robots-Tag", "noindex, nofollow");
|
|
366
|
-
}
|
|
367
|
-
function respond(res, status, contentType, body) {
|
|
368
|
-
res.statusCode = status;
|
|
369
|
-
res.setHeader("Content-Type", contentType);
|
|
370
|
-
res.end(body);
|
|
371
|
-
}
|
|
372
|
-
function respondJson(res, status, payload) {
|
|
373
|
-
respond(res, status, JSON_TYPE, JSON.stringify(payload));
|
|
374
|
-
}
|
|
375
|
-
async function startWebServer(options) {
|
|
376
|
-
const info = options.info ?? printInfo;
|
|
377
|
-
const warn = options.warn ?? printWarning;
|
|
378
|
-
const version = options.version ?? readPackageVersion();
|
|
379
|
-
const startedAtMs = Date.now();
|
|
380
|
-
const assets = await loadStaticAssets(
|
|
381
|
-
options.publicDir ?? resolvePackageDir(join("web", "public"))
|
|
382
|
-
);
|
|
383
|
-
let cached = null;
|
|
384
|
-
const statusPayload = () => {
|
|
385
|
-
const v = options.publisher.version();
|
|
386
|
-
if (cached === null || cached.version !== v) {
|
|
387
|
-
cached = { version: v, body: JSON.stringify(options.publisher.snapshot()), etag: `"${v}"` };
|
|
388
|
-
}
|
|
389
|
-
return cached;
|
|
390
|
-
};
|
|
391
|
-
const handleRequest = (req, res) => {
|
|
392
|
-
baseHeaders(res);
|
|
393
|
-
const path = new URL(req.url ?? "/", "http://localhost").pathname;
|
|
394
|
-
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
395
|
-
respondJson(res, 404, { error: "Not found" });
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
if (path === "/api/status" || path === "/status.json") {
|
|
399
|
-
const { body, etag } = statusPayload();
|
|
400
|
-
res.setHeader("ETag", etag);
|
|
401
|
-
if (req.headers["if-none-match"] === etag) {
|
|
402
|
-
res.statusCode = 304;
|
|
403
|
-
res.end();
|
|
404
|
-
return;
|
|
405
|
-
}
|
|
406
|
-
respond(res, 200, JSON_TYPE, body);
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
if (path === "/api/sessions") {
|
|
410
|
-
const snapshot = options.publisher.snapshot();
|
|
411
|
-
respondJson(res, 200, [
|
|
412
|
-
{
|
|
413
|
-
sessionId: snapshot.sessionId,
|
|
414
|
-
issueNumber: snapshot.issue.number,
|
|
415
|
-
status: snapshot.status,
|
|
416
|
-
startedAt: snapshot.startedAt,
|
|
417
|
-
updatedAt: snapshot.updatedAt,
|
|
418
|
-
statusUrl: "/api/status"
|
|
419
|
-
}
|
|
420
|
-
]);
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
if (path === "/api/health") {
|
|
424
|
-
respondJson(res, 200, {
|
|
425
|
-
ok: true,
|
|
426
|
-
uptime: Math.round((Date.now() - startedAtMs) / 1e3),
|
|
427
|
-
version,
|
|
428
|
-
refreshSeconds: options.refreshSeconds ?? 5
|
|
429
|
-
});
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
const asset = assets.get(path);
|
|
433
|
-
if (asset) {
|
|
434
|
-
respond(res, 200, asset.contentType, asset.body);
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
respondJson(res, 404, { error: "Not found" });
|
|
438
|
-
};
|
|
439
|
-
const server = createServer((req, res) => {
|
|
440
|
-
try {
|
|
441
|
-
handleRequest(req, res);
|
|
442
|
-
} catch (err) {
|
|
443
|
-
try {
|
|
444
|
-
respondJson(res, 500, { error: err instanceof Error ? err.message : String(err) });
|
|
445
|
-
} catch {
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
const listening = await new Promise((resolve) => {
|
|
450
|
-
const onError = (err) => {
|
|
451
|
-
if (err.code === "EADDRINUSE") {
|
|
452
|
-
warn(
|
|
453
|
-
`Web monitor port ${options.port} is already in use. Continuing without the web server.`
|
|
454
|
-
);
|
|
455
|
-
} else {
|
|
456
|
-
warn(`Web monitor failed to start (${err.message}). Continuing without the web server.`);
|
|
457
|
-
}
|
|
458
|
-
resolve(false);
|
|
459
|
-
};
|
|
460
|
-
server.once("error", onError);
|
|
461
|
-
server.listen(options.port, options.host, () => {
|
|
462
|
-
server.removeListener("error", onError);
|
|
463
|
-
resolve(true);
|
|
464
|
-
});
|
|
465
|
-
});
|
|
466
|
-
if (!listening) return null;
|
|
467
|
-
server.unref();
|
|
468
|
-
server.on("error", (err) => {
|
|
469
|
-
warn(`Web monitor server error: ${err.message}`);
|
|
470
|
-
});
|
|
471
|
-
const address = server.address();
|
|
472
|
-
const port = address.port;
|
|
473
|
-
const displayHost = options.host === "0.0.0.0" ? "localhost" : options.host;
|
|
474
|
-
const url = `http://${displayHost}:${port}`;
|
|
475
|
-
if (options.host === "0.0.0.0") {
|
|
476
|
-
warn("Web monitor bound to 0.0.0.0: anyone on your local network can view the session state.");
|
|
477
|
-
}
|
|
478
|
-
info(`Web monitor running at ${chalk.bold.cyan(url)}`);
|
|
479
|
-
let closed = false;
|
|
480
|
-
let closePromise = null;
|
|
481
|
-
const doClose = () => new Promise((resolve) => {
|
|
482
|
-
process.removeListener("SIGINT", onSignal);
|
|
483
|
-
process.removeListener("SIGTERM", onSignal);
|
|
484
|
-
server.close(() => resolve());
|
|
485
|
-
server.closeAllConnections();
|
|
486
|
-
});
|
|
487
|
-
const close = () => {
|
|
488
|
-
if (closed) return closePromise ?? Promise.resolve();
|
|
489
|
-
closed = true;
|
|
490
|
-
closePromise = doClose();
|
|
491
|
-
return closePromise;
|
|
492
|
-
};
|
|
493
|
-
const onSignal = (signal) => {
|
|
494
|
-
void close().finally(() => {
|
|
495
|
-
process.kill(process.pid, signal);
|
|
496
|
-
});
|
|
497
|
-
};
|
|
498
|
-
process.once("SIGINT", onSignal);
|
|
499
|
-
process.once("SIGTERM", onSignal);
|
|
500
|
-
return { server, host: options.host, port, url, close };
|
|
501
|
-
}
|
|
502
|
-
|
|
503
332
|
// src/commands/run.ts
|
|
504
333
|
function toIssueNumber(id) {
|
|
505
334
|
const parsed = Number.parseInt(id, 10);
|
|
@@ -541,7 +370,7 @@ async function readPrReviewOutcome(issue, tasksPath, requestedChanges) {
|
|
|
541
370
|
null
|
|
542
371
|
);
|
|
543
372
|
if (last) {
|
|
544
|
-
outcome.reportPath =
|
|
373
|
+
outcome.reportPath = join(dir, last.reportPath);
|
|
545
374
|
outcome.recommendation ??= last.recommendation;
|
|
546
375
|
}
|
|
547
376
|
}
|
|
@@ -562,9 +391,8 @@ async function runPipeline(issue, mode, from, noBranch, prReview) {
|
|
|
562
391
|
});
|
|
563
392
|
}
|
|
564
393
|
setSessionPublisher(publisher);
|
|
565
|
-
let webServer = null;
|
|
566
394
|
if (webConfig.enabled) {
|
|
567
|
-
|
|
395
|
+
await ensureWebMonitor({
|
|
568
396
|
publisher,
|
|
569
397
|
port: webConfig.port,
|
|
570
398
|
host: webConfig.host,
|
|
@@ -589,7 +417,6 @@ async function runPipeline(issue, mode, from, noBranch, prReview) {
|
|
|
589
417
|
at: isoNow(),
|
|
590
418
|
status: exitCode === 0 ? "completed" : "failed"
|
|
591
419
|
});
|
|
592
|
-
await webServer?.close();
|
|
593
420
|
await publisher.close();
|
|
594
421
|
setSessionPublisher(void 0);
|
|
595
422
|
}
|
|
@@ -903,4 +730,4 @@ export {
|
|
|
903
730
|
publishStorySeed,
|
|
904
731
|
runPipeline
|
|
905
732
|
};
|
|
906
|
-
//# sourceMappingURL=run-
|
|
733
|
+
//# sourceMappingURL=run-SEB6F3W4.js.map
|