@promptbook/cli 0.114.0-32 → 0.114.0-33

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/esm/index.es.js CHANGED
@@ -48,7 +48,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
48
48
  * @generated
49
49
  * @see https://github.com/webgptorg/promptbook
50
50
  */
51
- const PROMPTBOOK_ENGINE_VERSION = '0.114.0-32';
51
+ const PROMPTBOOK_ENGINE_VERSION = '0.114.0-33';
52
52
  /**
53
53
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
54
54
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1812,20 +1812,20 @@ const PROMPT_RUNNER_HARNESS_NAMES = CLI_AGENT_HARNESS_NAMES;
1812
1812
  */
1813
1813
  const PROMPT_RUNNER_DESCRIPTION = spaceTrim$1(`
1814
1814
  Runners:
1815
- - openai-codex: OpenAI Codex integration (requires --model)
1815
+ - openai-codex: OpenAI Codex integration (requires --model when executing)
1816
1816
  - github-copilot: GitHub Copilot CLI integration
1817
1817
  - cline: Cline CLI integration
1818
1818
  - claude-code: Claude Code integration
1819
1819
  - opencode: Opencode integration
1820
- - gemini: Google Gemini CLI integration (requires --model)
1821
- - qwen-code: Qwen Code CLI integration (requires --model)
1820
+ - gemini: Google Gemini CLI integration (requires --model when executing)
1821
+ - qwen-code: Qwen Code CLI integration (requires --model when executing)
1822
1822
  `);
1823
1823
  /**
1824
1824
  * Commander description for the `--harness` option.
1825
1825
  *
1826
1826
  * @private internal utility of `promptbookCli`
1827
1827
  */
1828
- const PROMPT_RUNNER_HARNESS_OPTION_DESCRIPTION = `Select runner: ${PROMPT_RUNNER_HARNESS_NAMES.join(', ')} (required for non-dry-run)`;
1828
+ const PROMPT_RUNNER_HARNESS_OPTION_DESCRIPTION = `Select runner: ${PROMPT_RUNNER_HARNESS_NAMES.join(', ')} (required when executing prompts)`;
1829
1829
  /**
1830
1830
  * Runner harness names listed as alternatives of the `--harness` option in error messages.
1831
1831
  *
@@ -1838,7 +1838,7 @@ const PROMPT_RUNNER_HARNESS_OPTION_HINT = `--harness <${PROMPT_RUNNER_HARNESS_NA
1838
1838
  * @private internal utility of `promptbookCli`
1839
1839
  */
1840
1840
  const PROMPT_RUNNER_MODEL_OPTION_DESCRIPTION = spaceTrim$1(`
1841
- Model to use (required for openai-codex, gemini and qwen-code)
1841
+ Model to use or filter by (required when executing with openai-codex, gemini and qwen-code)
1842
1842
 
1843
1843
  OpenAI examples: gpt-5.2-codex, default
1844
1844
  Gemini examples: gemini-3-flash-preview, default
@@ -42130,19 +42130,19 @@ function normalizeCoderGitSyncCliOptions(cliOptions) {
42130
42130
  *
42131
42131
  * @private internal utility of `ptbk coder`
42132
42132
  */
42133
- const PROMPTS_DIRECTORY_PATH = 'prompts';
42133
+ const PROMPTS_DIRECTORY_PATH$1 = 'prompts';
42134
42134
  /**
42135
42135
  * Relative path to the archive directory used by `coder verify`.
42136
42136
  *
42137
42137
  * @private internal utility of `ptbk coder`
42138
42138
  */
42139
- const PROMPTS_DONE_DIRECTORY_PATH = join(PROMPTS_DIRECTORY_PATH, 'done');
42139
+ const PROMPTS_DONE_DIRECTORY_PATH = join(PROMPTS_DIRECTORY_PATH$1, 'done');
42140
42140
  /**
42141
42141
  * Relative path to the project-owned boilerplate templates directory.
42142
42142
  *
42143
42143
  * @private internal utility of `ptbk coder`
42144
42144
  */
42145
- const PROMPTS_TEMPLATES_DIRECTORY_PATH = join(PROMPTS_DIRECTORY_PATH, 'templates');
42145
+ const PROMPTS_TEMPLATES_DIRECTORY_PATH = join(PROMPTS_DIRECTORY_PATH$1, 'templates');
42146
42146
  /**
42147
42147
  * Built-in boilerplate templates available to `coder generate-boilerplates`.
42148
42148
  *
@@ -42426,7 +42426,7 @@ async function addCoderPrompt({ projectPath, description, priority, templateOpti
42426
42426
  // Note: Import these dynamically to avoid circular dependencies and keep the CLI fast
42427
42427
  const { buildPromptFilename, getPromptNumbering } = await Promise.resolve().then(function () { return getPromptNumbering$1; });
42428
42428
  const { formatPromptEmojiTag, getFreshPromptEmojiTags } = await Promise.resolve().then(function () { return promptEmojiTags; });
42429
- const promptsDirectory = join(projectPath, PROMPTS_DIRECTORY_PATH);
42429
+ const promptsDirectory = join(projectPath, PROMPTS_DIRECTORY_PATH$1);
42430
42430
  mkdirSync(promptsDirectory, { recursive: true });
42431
42431
  const promptTemplate = await resolveCoderPromptTemplate({ projectPath, templateOption });
42432
42432
  const promptNumbering = await getPromptNumbering({
@@ -42450,7 +42450,7 @@ async function addCoderPrompt({ projectPath, description, priority, templateOpti
42450
42450
  });
42451
42451
  const slug = buildAddPromptSlug(promptTemplate.slugPrefix, title);
42452
42452
  const filename = buildPromptFilename(promptNumbering.datePrefix, promptNumbering.startNumber, slug);
42453
- const filePath = join(PROMPTS_DIRECTORY_PATH, filename);
42453
+ const filePath = join(PROMPTS_DIRECTORY_PATH$1, filename);
42454
42454
  const absoluteFilePath = join(projectPath, filePath);
42455
42455
  writeFileSync(absoluteFilePath, `${section}\n`, 'utf-8');
42456
42456
  console.info(colors.green(`✓ Added prompt ${emojiTag} in ${filePath}`));
@@ -43042,10 +43042,10 @@ async function generatePromptBoilerplate({ projectPath, boilerplateCount, templa
43042
43042
  const { buildPromptFilename, getPromptNumbering } = await Promise.resolve().then(function () { return getPromptNumbering$1; });
43043
43043
  const { formatPromptEmojiTag, getFreshPromptEmojiTags } = await Promise.resolve().then(function () { return promptEmojiTags; });
43044
43044
  console.info(`🚀 Generate prompt boilerplate files`);
43045
- mkdirSync(join(projectPath, PROMPTS_DIRECTORY_PATH), { recursive: true });
43045
+ mkdirSync(join(projectPath, PROMPTS_DIRECTORY_PATH$1), { recursive: true });
43046
43046
  const promptTemplate = await resolveCoderPromptTemplate({ projectPath, templateOption });
43047
43047
  const promptNumbering = await getPromptNumbering({
43048
- promptsDir: join(projectPath, PROMPTS_DIRECTORY_PATH),
43048
+ promptsDir: join(projectPath, PROMPTS_DIRECTORY_PATH$1),
43049
43049
  step: 10,
43050
43050
  ignoreGlobs: ['**/node_modules/**'],
43051
43051
  });
@@ -43069,7 +43069,7 @@ async function generatePromptBoilerplate({ projectPath, boilerplateCount, templa
43069
43069
  const title = titles[i % titles.length];
43070
43070
  const emojiTag = formatPromptEmojiTag(selectedEmojis[i]);
43071
43071
  const filename = buildPromptFilename(promptNumbering.datePrefix, number, buildPromptSlug$1(promptTemplate.slugPrefix, title));
43072
- const filepath = join(PROMPTS_DIRECTORY_PATH, filename);
43072
+ const filepath = join(PROMPTS_DIRECTORY_PATH$1, filename);
43073
43073
  const absoluteFilepath = join(projectPath, filepath);
43074
43074
  const content = buildBoilerplatePromptFileContent({
43075
43075
  emojiTag,
@@ -44349,7 +44349,7 @@ function resolveDefaultCoderVscodeSettingsEntry() {
44349
44349
  * @private internal utility of `coder init` command
44350
44350
  */
44351
44351
  async function initializeCoderProjectConfiguration(projectPath) {
44352
- const promptsDirectoryStatus = await ensureDirectory(projectPath, PROMPTS_DIRECTORY_PATH);
44352
+ const promptsDirectoryStatus = await ensureDirectory(projectPath, PROMPTS_DIRECTORY_PATH$1);
44353
44353
  const promptsDoneDirectoryStatus = await ensureDirectory(projectPath, PROMPTS_DONE_DIRECTORY_PATH);
44354
44354
  const promptsTemplatesDirectoryStatus = await ensureDirectory(projectPath, PROMPTS_TEMPLATES_DIRECTORY_PATH);
44355
44355
  const promptTemplateFileStatuses = await ensureDefaultCoderPromptTemplateFiles(projectPath);
@@ -44511,6 +44511,87 @@ function listDefaultCoderProjectPromptTemplateDisplayPaths() {
44511
44511
  // Note: [🟡] Code for CLI command [init](src/cli/cli-commands/coder/init.ts) should never be published outside of `@promptbook/cli`
44512
44512
  // Note: [💞] Ignore a discrepancy between file name and entity name
44513
44513
 
44514
+ /**
44515
+ * Creates a Commander argument parser that accepts only non-negative integers.
44516
+ *
44517
+ * The returned parser is meant to be passed as the coercion callback of `command.option(...)`.
44518
+ * It throws a branded `NotAllowed` error with a clear message referencing the given option name
44519
+ * when the provided value is not a non-negative integer.
44520
+ *
44521
+ * @private internal utility of `promptbookCli`
44522
+ */
44523
+ function createNonNegativeIntegerOptionParser(optionName) {
44524
+ return (value) => {
44525
+ const parsedValue = Number(value);
44526
+ if (!Number.isInteger(parsedValue) || parsedValue < 0) {
44527
+ throw new NotAllowed(spaceTrim$1(`
44528
+ Invalid value for \`${optionName}\`: \`${value}\`.
44529
+
44530
+ Use a non-negative integer.
44531
+ `));
44532
+ }
44533
+ return parsedValue;
44534
+ };
44535
+ }
44536
+ // Note: [🟡] Code for CLI option parser [createNonNegativeIntegerOptionParser](src/cli/cli-commands/common/createNonNegativeIntegerOptionParser.ts) should never be published outside of `@promptbook/cli`
44537
+
44538
+ /**
44539
+ * Registers the shared prompt-priority filter options on a queue-based `ptbk coder` command.
44540
+ *
44541
+ * @private internal utility of `promptbookCli`
44542
+ */
44543
+ function addPromptPriorityOptions(command) {
44544
+ command.option('--priority <minimum-priority>', 'Alias for --min-priority; filter prompts by minimum priority level', createNonNegativeIntegerOptionParser('--priority'));
44545
+ command.option('--min-priority <minimum-priority>', 'Filter prompts by minimum priority level', createNonNegativeIntegerOptionParser('--min-priority'));
44546
+ command.option('--max-priority <maximum-priority>', 'Filter prompts by maximum priority level', createNonNegativeIntegerOptionParser('--max-priority'));
44547
+ }
44548
+ // Note: [🟡] Code for CLI prompt priority options [promptPriorityCliOptions](src/cli/cli-commands/common/promptPriorityCliOptions.ts) should never be published outside of `@promptbook/cli`
44549
+ // Note: [💞] Ignore a discrepancy between file name and exported helper names
44550
+
44551
+ /**
44552
+ * Initializes `coder list` command for Promptbook CLI utilities.
44553
+ *
44554
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
44555
+ *
44556
+ * @private internal function of `promptbookCli`
44557
+ */
44558
+ function $initializeCoderListCommand(program) {
44559
+ const command = program.command('list');
44560
+ command.description(spaceTrim$1(`
44561
+ List ready coding prompts by priority without executing them
44562
+
44563
+ ${PROMPT_RUNNER_DESCRIPTION}
44564
+
44565
+ Features:
44566
+ - Lists only ready, fully authored prompts
44567
+ - Groups prompts from highest to lowest priority
44568
+ - Optional --harness and --model filters show only prompts compatible with that runner
44569
+ - Does not start a coding harness or modify prompt files
44570
+ `));
44571
+ addPromptRunnerSelectionOptions(command);
44572
+ addPromptPriorityOptions(command);
44573
+ command.action(handleActionErrors(async (cliOptions) => {
44574
+ const { priority, minPriority: minimumPriority, maxPriority: maximumPriority, } = cliOptions;
44575
+ const runnerOptions = normalizePromptRunnerSelectionCliOptions(cliOptions, { isAgentRequired: false });
44576
+ const promptRunnerIdentity = runnerOptions.agentName === undefined && runnerOptions.model === undefined
44577
+ ? undefined
44578
+ : {
44579
+ harnessName: runnerOptions.agentName,
44580
+ modelName: runnerOptions.model,
44581
+ };
44582
+ // Note: Import dynamically to avoid loading prompt parsing dependencies until this command is used.
44583
+ const { listCoderPrompts } = await Promise.resolve().then(function () { return listCoderPrompts$1; });
44584
+ await listCoderPrompts({
44585
+ priority,
44586
+ minimumPriority,
44587
+ maximumPriority,
44588
+ promptRunnerIdentity,
44589
+ });
44590
+ }));
44591
+ }
44592
+ // Note: [🟡] Code for CLI command [list](src/cli/cli-commands/coder/list.ts) should never be published outside of `@promptbook/cli`
44593
+ // Note: [💞] Ignore a discrepancy between file name and entity name
44594
+
44514
44595
  /**
44515
44596
  * Default wait duration applied before retrying a prompt round after an error (10 minutes).
44516
44597
  *
@@ -44651,30 +44732,6 @@ function $initializeCoderPingCommand(program) {
44651
44732
  // Note: [🟡] Code for CLI command [ping](src/cli/cli-commands/coder/ping.ts) should never be published outside of `@promptbook/cli`
44652
44733
  // Note: [💞] Ignore a discrepancy between file name and entity name
44653
44734
 
44654
- /**
44655
- * Creates a Commander argument parser that accepts only non-negative integers.
44656
- *
44657
- * The returned parser is meant to be passed as the coercion callback of `command.option(...)`.
44658
- * It throws a branded `NotAllowed` error with a clear message referencing the given option name
44659
- * when the provided value is not a non-negative integer.
44660
- *
44661
- * @private internal utility of `promptbookCli`
44662
- */
44663
- function createNonNegativeIntegerOptionParser(optionName) {
44664
- return (value) => {
44665
- const parsedValue = Number(value);
44666
- if (!Number.isInteger(parsedValue) || parsedValue < 0) {
44667
- throw new NotAllowed(spaceTrim$1(`
44668
- Invalid value for \`${optionName}\`: \`${value}\`.
44669
-
44670
- Use a non-negative integer.
44671
- `));
44672
- }
44673
- return parsedValue;
44674
- };
44675
- }
44676
- // Note: [🟡] Code for CLI option parser [createNonNegativeIntegerOptionParser](src/cli/cli-commands/common/createNonNegativeIntegerOptionParser.ts) should never be published outside of `@promptbook/cli`
44677
-
44678
44735
  /**
44679
44736
  * Npm packages which directly provide the `ptbk` executable.
44680
44737
  *
@@ -45131,9 +45188,7 @@ function $initializeCoderRunCommand(program) {
45131
45188
  A verified task is merged back into the branch the coder runs on and the worktree is deleted.
45132
45189
  A task that cannot be merged is marked as failed and its worktree is kept for a manual merge.
45133
45190
  `), false);
45134
- command.option('--priority <minimum-priority>', 'Alias for --min-priority; filter prompts by minimum priority level', createNonNegativeIntegerOptionParser('--priority'));
45135
- command.option('--min-priority <minimum-priority>', 'Filter prompts by minimum priority level', createNonNegativeIntegerOptionParser('--min-priority'));
45136
- command.option('--max-priority <maximum-priority>', 'Filter prompts by maximum priority level', createNonNegativeIntegerOptionParser('--max-priority'));
45191
+ addPromptPriorityOptions(command);
45137
45192
  command.option('--limit <run-count>', 'Stop after processing this many prompt runs', createPositiveIntegerOptionParser('--limit'));
45138
45193
  command.option('--wait-after-prompt <duration>', spaceTrim$1(`
45139
45194
  Wait this long after each prompt has been implemented, verified and committed before starting the next prompt.
@@ -45284,9 +45339,7 @@ function $initializeCoderServerCommand(program) {
45284
45339
  command.option('--test <test-command...>', 'Run a verification command after each prompt; quote it when the command itself contains top-level flags');
45285
45340
  command.option('--preserve-logs', 'Keep generated temp prompt/log artifacts after successful rounds for debugging and analytics', false);
45286
45341
  addPromptRunnerExecutionOptions(command);
45287
- command.option('--priority <minimum-priority>', 'Alias for --min-priority; filter prompts by minimum priority level', createNonNegativeIntegerOptionParser('--priority'));
45288
- command.option('--min-priority <minimum-priority>', 'Filter prompts by minimum priority level', createNonNegativeIntegerOptionParser('--min-priority'));
45289
- command.option('--max-priority <maximum-priority>', 'Filter prompts by maximum priority level', createNonNegativeIntegerOptionParser('--max-priority'));
45342
+ addPromptPriorityOptions(command);
45290
45343
  command.option('--wait-after-prompt <duration>', spaceTrim$1(`
45291
45344
  Wait this long after each prompt has been implemented, verified and committed before starting the next prompt.
45292
45345
  Accepts durations like 1h, 30m, 5s. Defaults to 0 (no wait).
@@ -45501,6 +45554,7 @@ function collectStringOption(value, previousValues) {
45501
45554
  * - add: Add one ready-to-run prompt file to the queue
45502
45555
  * - generate-boilerplates: Generate prompt boilerplate files
45503
45556
  * - find-refactor-candidates: Find files that need refactoring
45557
+ * - list: List ready prompts in priority order without running them
45504
45558
  * - run: Run coding prompts with AI agents
45505
45559
  * - ping: Test one harness and model with a tiny dummy prompt
45506
45560
  * - verify: Verify completed prompts
@@ -45521,6 +45575,7 @@ function $initializeCoderCommand(program) {
45521
45575
  - generate-boilerplates: Generate prompt boilerplate files
45522
45576
  - find-refactor-candidates: Find files that need refactoring
45523
45577
  - find-unwritten: List prompt sections that still need to be authored
45578
+ - list: List ready prompts in priority order without running them
45524
45579
  - run: Run coding prompts with AI agents
45525
45580
  - ping: Test the connection, response time and quota of one harness and model
45526
45581
  - server: Start a long-running coder server with a kanban web UI
@@ -45533,6 +45588,7 @@ function $initializeCoderCommand(program) {
45533
45588
  $initializeCoderGenerateBoilerplatesCommand(coderCommand);
45534
45589
  $initializeCoderFindRefactorCandidatesCommand(coderCommand);
45535
45590
  $initializeCoderFindUnwrittenCommand(coderCommand);
45591
+ $initializeCoderListCommand(coderCommand);
45536
45592
  $initializeCoderRunCommand(coderCommand);
45537
45593
  $initializeCoderPingCommand(coderCommand);
45538
45594
  $initializeCoderServerCommand(coderCommand);
@@ -74899,6 +74955,88 @@ var findUnwrittenPrompts$1 = /*#__PURE__*/Object.freeze({
74899
74955
  findUnwrittenPrompts: findUnwrittenPrompts
74900
74956
  });
74901
74957
 
74958
+ /**
74959
+ * Lists todo prompts that are ready to run (no authoring placeholders).
74960
+ */
74961
+ function listRunnablePrompts(files, priorityFilter = {}, promptRunnerIdentity) {
74962
+ return listTodoPrompts(files).filter((prompt) => !isPromptToBeWritten(prompt.file, prompt.section) &&
74963
+ isPromptInPriorityFilter(prompt.section, priorityFilter) &&
74964
+ isPromptCompatibleWithRunner(prompt.file, prompt.section, promptRunnerIdentity));
74965
+ }
74966
+
74967
+ /**
74968
+ * Lists upcoming tasks that are ready to run (no authoring placeholders).
74969
+ */
74970
+ function listUpcomingTasks(files, priorityFilter = {}, promptRunnerIdentity) {
74971
+ return listRunnablePrompts(files, priorityFilter, promptRunnerIdentity).map(({ file, section }) => ({
74972
+ label: buildPromptLabelForDisplay(file, section),
74973
+ summary: buildPromptSummary(file, section),
74974
+ priority: section.priority,
74975
+ }));
74976
+ }
74977
+
74978
+ /**
74979
+ * Groups upcoming tasks by priority, high to low.
74980
+ */
74981
+ function groupUpcomingTasksByPriority(tasks) {
74982
+ const grouped = new Map();
74983
+ for (const task of tasks) {
74984
+ const group = grouped.get(task.priority);
74985
+ if (group) {
74986
+ group.push(task);
74987
+ }
74988
+ else {
74989
+ grouped.set(task.priority, [task]);
74990
+ }
74991
+ }
74992
+ return Array.from(grouped.entries())
74993
+ .sort((a, b) => b[0] - a[0])
74994
+ .map(([priority, groupedTasks]) => ({ priority, tasks: groupedTasks }));
74995
+ }
74996
+
74997
+ /**
74998
+ * Prints upcoming tasks grouped by priority.
74999
+ */
75000
+ function printUpcomingTasks(tasks) {
75001
+ if (tasks.length === 0) {
75002
+ console.info(colors.green('No upcoming tasks.'));
75003
+ return;
75004
+ }
75005
+ console.info(colors.cyan('Upcoming tasks (grouped by priority):'));
75006
+ for (const group of groupUpcomingTasksByPriority(tasks)) {
75007
+ console.info(colors.cyan(`Priority ${group.priority}:`));
75008
+ for (const [index, task] of group.tasks.entries()) {
75009
+ const summary = task.summary ? ` - ${task.summary}` : '';
75010
+ console.info(` ${index + 1}. ${task.label}${summary}`);
75011
+ }
75012
+ }
75013
+ }
75014
+
75015
+ /**
75016
+ * Directory containing the prompt queue of the current project.
75017
+ *
75018
+ * @private internal constant of `listCoderPrompts`
75019
+ */
75020
+ const PROMPTS_DIRECTORY_PATH = join(process.cwd(), 'prompts');
75021
+ /**
75022
+ * Lists ready, fully authored coding prompts in descending priority groups without starting a coding harness.
75023
+ *
75024
+ * @returns The number of prompts printed.
75025
+ * @public exported from `@promptbook/cli`
75026
+ */
75027
+ async function listCoderPrompts(options = {}) {
75028
+ const priorityFilter = normalizePriorityFilter(options);
75029
+ const promptFiles = await loadPromptFiles(PROMPTS_DIRECTORY_PATH);
75030
+ const upcomingTasks = listUpcomingTasks(promptFiles, priorityFilter, options.promptRunnerIdentity);
75031
+ printUpcomingTasks(upcomingTasks);
75032
+ return upcomingTasks.length;
75033
+ }
75034
+
75035
+ var listCoderPrompts$1 = /*#__PURE__*/Object.freeze({
75036
+ __proto__: null,
75037
+ listCoderPrompts: listCoderPrompts
75038
+ });
75039
+
74902
75040
  /**
74903
75041
  * Formats one unknown error-like value into its readable message without the stack trace.
74904
75042
  *
@@ -78771,15 +78909,6 @@ function toProjectRelativeGitPath(projectPath, path) {
78771
78909
  return relative(projectPath, path).replace(/\\/gu, '/');
78772
78910
  }
78773
78911
 
78774
- /**
78775
- * Lists todo prompts that are ready to run (no authoring placeholders).
78776
- */
78777
- function listRunnablePrompts(files, priorityFilter = {}, promptRunnerIdentity) {
78778
- return listTodoPrompts(files).filter((prompt) => !isPromptToBeWritten(prompt.file, prompt.section) &&
78779
- isPromptInPriorityFilter(prompt.section, priorityFilter) &&
78780
- isPromptCompatibleWithRunner(prompt.file, prompt.section, promptRunnerIdentity));
78781
- }
78782
-
78783
78912
  /**
78784
78913
  * Selects the next runnable prompt based on priority.
78785
78914
  */
@@ -78793,54 +78922,6 @@ function findNextTodoPrompt(files, priorityFilter = {}, promptRunnerIdentity) {
78793
78922
  return nextPrompt;
78794
78923
  }
78795
78924
 
78796
- /**
78797
- * Lists upcoming tasks that are ready to run (no authoring placeholders).
78798
- */
78799
- function listUpcomingTasks(files, priorityFilter = {}, promptRunnerIdentity) {
78800
- return listRunnablePrompts(files, priorityFilter, promptRunnerIdentity).map(({ file, section }) => ({
78801
- label: buildPromptLabelForDisplay(file, section),
78802
- summary: buildPromptSummary(file, section),
78803
- priority: section.priority,
78804
- }));
78805
- }
78806
-
78807
- /**
78808
- * Groups upcoming tasks by priority, high to low.
78809
- */
78810
- function groupUpcomingTasksByPriority(tasks) {
78811
- const grouped = new Map();
78812
- for (const task of tasks) {
78813
- const group = grouped.get(task.priority);
78814
- if (group) {
78815
- group.push(task);
78816
- }
78817
- else {
78818
- grouped.set(task.priority, [task]);
78819
- }
78820
- }
78821
- return Array.from(grouped.entries())
78822
- .sort((a, b) => b[0] - a[0])
78823
- .map(([priority, groupedTasks]) => ({ priority, tasks: groupedTasks }));
78824
- }
78825
-
78826
- /**
78827
- * Prints upcoming tasks grouped by priority.
78828
- */
78829
- function printUpcomingTasks(tasks) {
78830
- if (tasks.length === 0) {
78831
- console.info(colors.green('No upcoming tasks.'));
78832
- return;
78833
- }
78834
- console.info(colors.cyan('Upcoming tasks (grouped by priority):'));
78835
- for (const group of groupUpcomingTasksByPriority(tasks)) {
78836
- console.info(colors.cyan(`Priority ${group.priority}:`));
78837
- for (const [index, task] of group.tasks.entries()) {
78838
- const summary = task.summary ? ` - ${task.summary}` : '';
78839
- console.info(` ${index + 1}. ${task.label}${summary}`);
78840
- }
78841
- }
78842
- }
78843
-
78844
78925
  /**
78845
78926
  * Builds a label that identifies the prompt section by index.
78846
78927
  */