@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.
@@ -0,0 +1,20 @@
1
+ import { type PriorityFilterInput } from '../prompts/priorityFilter';
2
+ import type { PromptRunnerIdentity } from '../prompts/isPromptCompatibleWithRunner';
3
+ /**
4
+ * Options which select the ready prompts listed by `ptbk coder list`.
5
+ *
6
+ * @public exported from `@promptbook/cli`
7
+ */
8
+ export type ListCoderPromptsOptions = PriorityFilterInput & {
9
+ /**
10
+ * Optional harness and model selection used to omit prompts routed to other runners.
11
+ */
12
+ readonly promptRunnerIdentity?: PromptRunnerIdentity;
13
+ };
14
+ /**
15
+ * Lists ready, fully authored coding prompts in descending priority groups without starting a coding harness.
16
+ *
17
+ * @returns The number of prompts printed.
18
+ * @public exported from `@promptbook/cli`
19
+ */
20
+ export declare function listCoderPrompts(options?: ListCoderPromptsOptions): Promise<number>;
@@ -0,0 +1,10 @@
1
+ import type { Command as Program } from 'commander';
2
+ import type { $side_effect } from '../../../utils/organization/$side_effect';
3
+ /**
4
+ * Initializes `coder list` command for Promptbook CLI utilities.
5
+ *
6
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
7
+ *
8
+ * @private internal function of `promptbookCli`
9
+ */
10
+ export declare function $initializeCoderListCommand(program: Program): $side_effect;
@@ -0,0 +1 @@
1
+ export {};
@@ -8,6 +8,7 @@ import type { $side_effect } from '../../utils/organization/$side_effect';
8
8
  * - add: Add one ready-to-run prompt file to the queue
9
9
  * - generate-boilerplates: Generate prompt boilerplate files
10
10
  * - find-refactor-candidates: Find files that need refactoring
11
+ * - list: List ready prompts in priority order without running them
11
12
  * - run: Run coding prompts with AI agents
12
13
  * - ping: Test one harness and model with a tiny dummy prompt
13
14
  * - verify: Verify completed prompts
@@ -0,0 +1,7 @@
1
+ import type { Command as Program } from 'commander';
2
+ /**
3
+ * Registers the shared prompt-priority filter options on a queue-based `ptbk coder` command.
4
+ *
5
+ * @private internal utility of `promptbookCli`
6
+ */
7
+ export declare function addPromptPriorityOptions(command: Program): void;
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.114.0-31`).
18
+ * It follows semantic versioning (e.g., `0.114.0-32`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/cli",
3
- "version": "0.114.0-32",
3
+ "version": "0.114.0-33",
4
4
  "description": "Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -0,0 +1,77 @@
1
+ import type {
2
+ Command as Program /* <- Note: [🔸] Using Program because Command is misleading name */,
3
+ } from 'commander';
4
+ import { spaceTrim } from 'spacetrim';
5
+ import type { $side_effect } from '../../../utils/organization/$side_effect';
6
+ import { handleActionErrors } from '../common/handleActionErrors';
7
+ import { addPromptPriorityOptions } from '../common/promptPriorityCliOptions';
8
+ import type { PromptRunnerSelectionCliOptions } from '../common/promptRunnerCliOptions';
9
+ import {
10
+ addPromptRunnerSelectionOptions,
11
+ normalizePromptRunnerSelectionCliOptions,
12
+ PROMPT_RUNNER_DESCRIPTION,
13
+ } from '../common/promptRunnerCliOptions';
14
+
15
+ /**
16
+ * Initializes `coder list` command for Promptbook CLI utilities.
17
+ *
18
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
19
+ *
20
+ * @private internal function of `promptbookCli`
21
+ */
22
+ export function $initializeCoderListCommand(program: Program): $side_effect {
23
+ const command = program.command('list');
24
+ command.description(
25
+ spaceTrim(`
26
+ List ready coding prompts by priority without executing them
27
+
28
+ ${PROMPT_RUNNER_DESCRIPTION}
29
+
30
+ Features:
31
+ - Lists only ready, fully authored prompts
32
+ - Groups prompts from highest to lowest priority
33
+ - Optional --harness and --model filters show only prompts compatible with that runner
34
+ - Does not start a coding harness or modify prompt files
35
+ `),
36
+ );
37
+
38
+ addPromptRunnerSelectionOptions(command);
39
+ addPromptPriorityOptions(command);
40
+
41
+ command.action(
42
+ handleActionErrors(async (cliOptions) => {
43
+ const {
44
+ priority,
45
+ minPriority: minimumPriority,
46
+ maxPriority: maximumPriority,
47
+ } = cliOptions as {
48
+ readonly priority?: number;
49
+ readonly minPriority?: number;
50
+ readonly maxPriority?: number;
51
+ } & PromptRunnerSelectionCliOptions;
52
+ const runnerOptions = normalizePromptRunnerSelectionCliOptions(
53
+ cliOptions as PromptRunnerSelectionCliOptions,
54
+ { isAgentRequired: false },
55
+ );
56
+ const promptRunnerIdentity =
57
+ runnerOptions.agentName === undefined && runnerOptions.model === undefined
58
+ ? undefined
59
+ : {
60
+ harnessName: runnerOptions.agentName,
61
+ modelName: runnerOptions.model,
62
+ };
63
+
64
+ // Note: Import dynamically to avoid loading prompt parsing dependencies until this command is used.
65
+ const { listCoderPrompts } = await import('../../../../scripts/run-codex-prompts/main/listCoderPrompts');
66
+ await listCoderPrompts({
67
+ priority,
68
+ minimumPriority,
69
+ maximumPriority,
70
+ promptRunnerIdentity,
71
+ });
72
+ }),
73
+ );
74
+ }
75
+
76
+ // Note: [🟡] Code for CLI command [list](src/cli/cli-commands/coder/list.ts) should never be published outside of `@promptbook/cli`
77
+ // Note: [💞] Ignore a discrepancy between file name and entity name
@@ -6,7 +6,6 @@ import {
6
6
  import { spaceTrim } from 'spacetrim';
7
7
  import { assertsError } from '../../../errors/assertsError';
8
8
  import type { $side_effect } from '../../../utils/organization/$side_effect';
9
- import { createNonNegativeIntegerOptionParser } from '../common/createNonNegativeIntegerOptionParser';
10
9
  import { createPositiveIntegerOptionParser } from '../common/createPositiveIntegerOptionParser';
11
10
  import { handleActionErrors } from '../common/handleActionErrors';
12
11
  import { $ensureHarnessInstallations } from '../common/harness/$ensureHarnessInstallations';
@@ -23,6 +22,7 @@ import {
23
22
  normalizePromptRunnerCliOptions,
24
23
  PROMPT_RUNNER_DESCRIPTION,
25
24
  } from '../common/promptRunnerCliOptions';
25
+ import { addPromptPriorityOptions } from '../common/promptPriorityCliOptions';
26
26
  import {
27
27
  DEFAULT_CODER_TEST_COMMAND,
28
28
  TEST_BEFORE_MODE_VALUES,
@@ -107,21 +107,7 @@ export function $initializeCoderRunCommand(program: Program): $side_effect {
107
107
  `),
108
108
  false,
109
109
  );
110
- command.option(
111
- '--priority <minimum-priority>',
112
- 'Alias for --min-priority; filter prompts by minimum priority level',
113
- createNonNegativeIntegerOptionParser('--priority'),
114
- );
115
- command.option(
116
- '--min-priority <minimum-priority>',
117
- 'Filter prompts by minimum priority level',
118
- createNonNegativeIntegerOptionParser('--min-priority'),
119
- );
120
- command.option(
121
- '--max-priority <maximum-priority>',
122
- 'Filter prompts by maximum priority level',
123
- createNonNegativeIntegerOptionParser('--max-priority'),
124
- );
110
+ addPromptPriorityOptions(command);
125
111
  command.option(
126
112
  '--limit <run-count>',
127
113
  'Stop after processing this many prompt runs',
@@ -9,7 +9,6 @@ import { assertsError } from '../../../errors/assertsError';
9
9
  import { NotAllowed } from '../../../errors/NotAllowed';
10
10
  import type { number_port } from '../../../types/number_positive';
11
11
  import type { $side_effect } from '../../../utils/organization/$side_effect';
12
- import { createNonNegativeIntegerOptionParser } from '../common/createNonNegativeIntegerOptionParser';
13
12
  import { handleActionErrors } from '../common/handleActionErrors';
14
13
  import { $ensureHarnessInstallations } from '../common/harness/$ensureHarnessInstallations';
15
14
  import {
@@ -24,6 +23,7 @@ import {
24
23
  normalizePromptRunnerCliOptions,
25
24
  PROMPT_RUNNER_DESCRIPTION,
26
25
  } from '../common/promptRunnerCliOptions';
26
+ import { addPromptPriorityOptions } from '../common/promptPriorityCliOptions';
27
27
  import { DEFAULT_WAIT_AFTER_ERROR_MS, parseOptionalWaitDuration } from './waitOptions';
28
28
  import { $ensureCoderHarnessGitignoreRules } from './$ensureCoderHarnessGitignoreRules';
29
29
 
@@ -90,21 +90,7 @@ export function $initializeCoderServerCommand(program: Program): $side_effect {
90
90
  false,
91
91
  );
92
92
  addPromptRunnerExecutionOptions(command);
93
- command.option(
94
- '--priority <minimum-priority>',
95
- 'Alias for --min-priority; filter prompts by minimum priority level',
96
- createNonNegativeIntegerOptionParser('--priority'),
97
- );
98
- command.option(
99
- '--min-priority <minimum-priority>',
100
- 'Filter prompts by minimum priority level',
101
- createNonNegativeIntegerOptionParser('--min-priority'),
102
- );
103
- command.option(
104
- '--max-priority <maximum-priority>',
105
- 'Filter prompts by maximum priority level',
106
- createNonNegativeIntegerOptionParser('--max-priority'),
107
- );
93
+ addPromptPriorityOptions(command);
108
94
  command.option(
109
95
  '--wait-after-prompt <duration>',
110
96
  spaceTrim(`
@@ -10,6 +10,7 @@ import { $initializeCoderFindRefactorCandidatesCommand } from './coder/find-refa
10
10
  import { $initializeCoderFindUnwrittenCommand } from './coder/find-unwritten';
11
11
  import { $initializeCoderGenerateBoilerplatesCommand } from './coder/generate-boilerplates';
12
12
  import { $initializeCoderInitCommand } from './coder/init';
13
+ import { $initializeCoderListCommand } from './coder/list';
13
14
  import { $initializeCoderPingCommand } from './coder/ping';
14
15
  import { $initializeCoderRunCommand } from './coder/run';
15
16
  import { $initializeCoderServerCommand } from './coder/server';
@@ -23,6 +24,7 @@ import { $initializeCoderVerifyCommand } from './coder/verify';
23
24
  * - add: Add one ready-to-run prompt file to the queue
24
25
  * - generate-boilerplates: Generate prompt boilerplate files
25
26
  * - find-refactor-candidates: Find files that need refactoring
27
+ * - list: List ready prompts in priority order without running them
26
28
  * - run: Run coding prompts with AI agents
27
29
  * - ping: Test one harness and model with a tiny dummy prompt
28
30
  * - verify: Verify completed prompts
@@ -44,6 +46,7 @@ export function $initializeCoderCommand(program: Program): $side_effect {
44
46
  - generate-boilerplates: Generate prompt boilerplate files
45
47
  - find-refactor-candidates: Find files that need refactoring
46
48
  - find-unwritten: List prompt sections that still need to be authored
49
+ - list: List ready prompts in priority order without running them
47
50
  - run: Run coding prompts with AI agents
48
51
  - ping: Test the connection, response time and quota of one harness and model
49
52
  - server: Start a long-running coder server with a kanban web UI
@@ -58,6 +61,7 @@ export function $initializeCoderCommand(program: Program): $side_effect {
58
61
  $initializeCoderGenerateBoilerplatesCommand(coderCommand);
59
62
  $initializeCoderFindRefactorCandidatesCommand(coderCommand);
60
63
  $initializeCoderFindUnwrittenCommand(coderCommand);
64
+ $initializeCoderListCommand(coderCommand);
61
65
  $initializeCoderRunCommand(coderCommand);
62
66
  $initializeCoderPingCommand(coderCommand);
63
67
  $initializeCoderServerCommand(coderCommand);
@@ -0,0 +1,30 @@
1
+ import type {
2
+ Command as Program /* <- Note: [🔸] Using Program because Command is misleading name */,
3
+ } from 'commander';
4
+ import { createNonNegativeIntegerOptionParser } from './createNonNegativeIntegerOptionParser';
5
+
6
+ /**
7
+ * Registers the shared prompt-priority filter options on a queue-based `ptbk coder` command.
8
+ *
9
+ * @private internal utility of `promptbookCli`
10
+ */
11
+ export function addPromptPriorityOptions(command: Program): void {
12
+ command.option(
13
+ '--priority <minimum-priority>',
14
+ 'Alias for --min-priority; filter prompts by minimum priority level',
15
+ createNonNegativeIntegerOptionParser('--priority'),
16
+ );
17
+ command.option(
18
+ '--min-priority <minimum-priority>',
19
+ 'Filter prompts by minimum priority level',
20
+ createNonNegativeIntegerOptionParser('--min-priority'),
21
+ );
22
+ command.option(
23
+ '--max-priority <maximum-priority>',
24
+ 'Filter prompts by maximum priority level',
25
+ createNonNegativeIntegerOptionParser('--max-priority'),
26
+ );
27
+ }
28
+
29
+ // Note: [🟡] Code for CLI prompt priority options [promptPriorityCliOptions](src/cli/cli-commands/common/promptPriorityCliOptions.ts) should never be published outside of `@promptbook/cli`
30
+ // Note: [💞] Ignore a discrepancy between file name and exported helper names
@@ -94,13 +94,13 @@ export type NormalizedPromptRunnerSelectionCliOptions = Pick<
94
94
  */
95
95
  export const PROMPT_RUNNER_DESCRIPTION = spaceTrim(`
96
96
  Runners:
97
- - openai-codex: OpenAI Codex integration (requires --model)
97
+ - openai-codex: OpenAI Codex integration (requires --model when executing)
98
98
  - github-copilot: GitHub Copilot CLI integration
99
99
  - cline: Cline CLI integration
100
100
  - claude-code: Claude Code integration
101
101
  - opencode: Opencode integration
102
- - gemini: Google Gemini CLI integration (requires --model)
103
- - qwen-code: Qwen Code CLI integration (requires --model)
102
+ - gemini: Google Gemini CLI integration (requires --model when executing)
103
+ - qwen-code: Qwen Code CLI integration (requires --model when executing)
104
104
  `);
105
105
 
106
106
  /**
@@ -110,7 +110,7 @@ export const PROMPT_RUNNER_DESCRIPTION = spaceTrim(`
110
110
  */
111
111
  export const PROMPT_RUNNER_HARNESS_OPTION_DESCRIPTION = `Select runner: ${PROMPT_RUNNER_HARNESS_NAMES.join(
112
112
  ', ',
113
- )} (required for non-dry-run)`;
113
+ )} (required when executing prompts)`;
114
114
 
115
115
  /**
116
116
  * Runner harness names listed as alternatives of the `--harness` option in error messages.
@@ -125,7 +125,7 @@ export const PROMPT_RUNNER_HARNESS_OPTION_HINT = `--harness <${PROMPT_RUNNER_HAR
125
125
  * @private internal utility of `promptbookCli`
126
126
  */
127
127
  export const PROMPT_RUNNER_MODEL_OPTION_DESCRIPTION = spaceTrim(`
128
- Model to use (required for openai-codex, gemini and qwen-code)
128
+ Model to use or filter by (required when executing with openai-codex, gemini and qwen-code)
129
129
 
130
130
  OpenAI examples: gpt-5.2-codex, default
131
131
  Gemini examples: gemini-3-flash-preview, default