@promptbook/cli 0.114.0-32 → 0.114.0-34

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.
Files changed (177) hide show
  1. package/esm/index.es.js +1417 -400
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/scripts/run-codex-prompts/common/createFreeDiskSpaceGuard.d.ts +25 -0
  4. package/esm/scripts/run-codex-prompts/common/formatUnknownErrorDetails.d.ts +4 -0
  5. package/esm/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +21 -3
  6. package/esm/scripts/run-codex-prompts/main/listCoderPrompts.d.ts +20 -0
  7. package/esm/scripts/run-codex-prompts/prompts/buildPromptRunTraceContent.d.ts +77 -0
  8. package/esm/scripts/run-codex-prompts/prompts/buildPromptRunTracePath.d.ts +10 -0
  9. package/esm/scripts/run-codex-prompts/prompts/isPromptCompatibleWithRunner.d.ts +11 -6
  10. package/esm/scripts/run-codex-prompts/prompts/loadPromptFiles.d.ts +1 -1
  11. package/esm/scripts/run-codex-prompts/prompts/writePromptRunTrace.d.ts +19 -0
  12. package/esm/scripts/run-codex-prompts/runners/common/buildHarnessAuthenticationError.d.ts +20 -0
  13. package/esm/scripts/run-codex-prompts/runners/common/createAuthenticationAwarePromptRunner.d.ts +11 -0
  14. package/esm/scripts/run-codex-prompts/runners/common/extractHarnessAuthenticationFailureReason.d.ts +9 -0
  15. package/esm/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +3 -0
  16. package/esm/src/book-2.0/book-language-documentation/getSafeCodeBlock.d.ts +1 -1
  17. package/esm/src/book-components/Chat/MockedChat/MockedChat.test.d.ts +2 -0
  18. package/esm/src/cli/cli-commands/coder/$ensureCoderHarnessGitignoreRules.d.ts +2 -1
  19. package/esm/src/cli/cli-commands/coder/agentCliOptions.d.ts +21 -0
  20. package/esm/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +8 -21
  21. package/esm/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +33 -0
  22. package/esm/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +4 -2
  23. package/esm/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +2 -0
  24. package/esm/src/cli/cli-commands/coder/ensureDirectory.d.ts +6 -0
  25. package/esm/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  26. package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +7 -5
  27. package/esm/src/cli/cli-commands/coder/list.d.ts +10 -0
  28. package/esm/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +19 -1
  29. package/esm/src/cli/cli-commands/coder/printCoderRunFailure.d.ts +6 -0
  30. package/esm/src/cli/cli-commands/coder.d.ts +1 -0
  31. package/esm/src/cli/cli-commands/common/$askForConfirmation.d.ts +4 -2
  32. package/esm/src/cli/cli-commands/common/$askForConfirmation.test.d.ts +1 -0
  33. package/esm/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.d.ts +12 -0
  34. package/esm/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.test.d.ts +1 -0
  35. package/esm/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.d.ts +11 -0
  36. package/esm/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.test.d.ts +1 -0
  37. package/esm/src/cli/cli-commands/common/disk-space/FreeDiskSpaceStatus.d.ts +33 -0
  38. package/esm/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.d.ts +6 -0
  39. package/esm/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.test.d.ts +1 -0
  40. package/esm/src/cli/cli-commands/common/disk-space/formatLowFreeDiskSpaceWarning.d.ts +10 -0
  41. package/esm/src/cli/cli-commands/common/disk-space/freeDiskSpaceConstants.d.ts +28 -0
  42. package/esm/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.d.ts +7 -0
  43. package/esm/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.test.d.ts +1 -0
  44. package/esm/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.d.ts +2 -1
  45. package/esm/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +3 -2
  46. package/esm/src/cli/cli-commands/common/harness/HarnessDefinition.d.ts +26 -0
  47. package/esm/src/cli/cli-commands/common/npm/$askForNpmPackageInstallationApproval.d.ts +4 -2
  48. package/esm/src/cli/cli-commands/common/promptPriorityCliOptions.d.ts +7 -0
  49. package/esm/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +2 -1
  50. package/esm/src/cli/cli-commands/common/questionsCliOptions.d.ts +45 -0
  51. package/esm/src/cli/cli-commands/common/questionsCliOptions.test.d.ts +1 -0
  52. package/esm/src/cli/common/$deprecateCliCommand.d.ts +3 -0
  53. package/esm/src/cli/common/$hideCliCommandFromHelp.d.ts +11 -0
  54. package/esm/src/cli/common/$hideCliCommandFromHelp.test.d.ts +1 -0
  55. package/esm/src/cli/common/$requireCliSubcommand.d.ts +18 -0
  56. package/esm/src/cli/common/$requireCliSubcommand.test.d.ts +1 -0
  57. package/esm/src/llm-providers/vercel/VercelExecutionToolsOptions.d.ts +5 -2
  58. package/esm/src/version.d.ts +1 -1
  59. package/package.json +8 -11
  60. package/src/book-2.0/book-language-documentation/getSafeCodeBlock.ts +1 -1
  61. package/src/book-components/Chat/MockedChat/MockedChat.tsx +25 -1
  62. package/src/cli/cli-commands/agent-folder.ts +2 -6
  63. package/src/cli/cli-commands/agent.ts +2 -6
  64. package/src/cli/cli-commands/agents-server.ts +2 -6
  65. package/src/cli/cli-commands/coder/$ensureCoderHarnessGitignoreRules.ts +3 -0
  66. package/src/cli/cli-commands/coder/add.ts +27 -2
  67. package/src/cli/cli-commands/coder/agentCliOptions.ts +32 -0
  68. package/src/cli/cli-commands/coder/boilerplateTemplates.ts +17 -44
  69. package/src/cli/cli-commands/coder/coderReferencedArtifacts.ts +106 -0
  70. package/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.ts +4 -2
  71. package/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.ts +5 -1
  72. package/src/cli/cli-commands/coder/ensureDirectory.ts +27 -1
  73. package/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.ts +99 -10
  74. package/src/cli/cli-commands/coder/init.ts +23 -14
  75. package/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.ts +18 -27
  76. package/src/cli/cli-commands/coder/list.ts +89 -0
  77. package/src/cli/cli-commands/coder/mergeStringRecordJsonFile.ts +31 -7
  78. package/src/cli/cli-commands/coder/ping.ts +25 -22
  79. package/src/cli/cli-commands/coder/printCoderRunFailure.ts +14 -0
  80. package/src/cli/cli-commands/coder/printInitializationSummary.ts +23 -16
  81. package/src/cli/cli-commands/coder/run.ts +36 -39
  82. package/src/cli/cli-commands/coder/server.ts +45 -48
  83. package/src/cli/cli-commands/coder.ts +6 -6
  84. package/src/cli/cli-commands/common/$askForConfirmation.ts +12 -2
  85. package/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.ts +35 -0
  86. package/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.ts +37 -0
  87. package/src/cli/cli-commands/common/disk-space/FreeDiskSpaceStatus.ts +39 -0
  88. package/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.ts +26 -0
  89. package/src/cli/cli-commands/common/disk-space/formatLowFreeDiskSpaceWarning.ts +33 -0
  90. package/src/cli/cli-commands/common/disk-space/freeDiskSpaceConstants.ts +33 -0
  91. package/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.ts +21 -0
  92. package/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.ts +17 -5
  93. package/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.ts +8 -3
  94. package/src/cli/cli-commands/common/harness/HarnessDefinition.ts +36 -0
  95. package/src/cli/cli-commands/common/npm/$askForNpmPackageInstallationApproval.ts +8 -3
  96. package/src/cli/cli-commands/common/promptPriorityCliOptions.ts +30 -0
  97. package/src/cli/cli-commands/common/promptRunnerCliOptions.ts +5 -5
  98. package/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.ts +13 -2
  99. package/src/cli/cli-commands/common/questionsCliOptions.ts +89 -0
  100. package/src/cli/cli-commands/run.ts +3 -1
  101. package/src/cli/common/$deprecateCliCommand.ts +5 -0
  102. package/src/cli/common/$hideCliCommandFromHelp.ts +27 -0
  103. package/src/cli/common/$requireCliSubcommand.ts +35 -0
  104. package/src/cli/promptbookCli.ts +13 -9
  105. package/src/llm-providers/vercel/VercelExecutionToolsOptions.ts +7 -2
  106. package/src/llm-providers/vercel/createExecutionToolsFromVercelProvider.ts +18 -17
  107. package/src/other/templates/getTemplatesPipelineCollection.ts +695 -707
  108. package/src/version.ts +2 -2
  109. package/src/versions.txt +2 -0
  110. package/umd/index.umd.js +1416 -399
  111. package/umd/index.umd.js.map +1 -1
  112. package/umd/scripts/run-codex-prompts/common/createFreeDiskSpaceGuard.d.ts +25 -0
  113. package/umd/scripts/run-codex-prompts/common/formatUnknownErrorDetails.d.ts +4 -0
  114. package/umd/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +21 -3
  115. package/umd/scripts/run-codex-prompts/main/listCoderPrompts.d.ts +20 -0
  116. package/umd/scripts/run-codex-prompts/prompts/buildPromptRunTraceContent.d.ts +77 -0
  117. package/umd/scripts/run-codex-prompts/prompts/buildPromptRunTracePath.d.ts +10 -0
  118. package/umd/scripts/run-codex-prompts/prompts/isPromptCompatibleWithRunner.d.ts +11 -6
  119. package/umd/scripts/run-codex-prompts/prompts/loadPromptFiles.d.ts +1 -1
  120. package/umd/scripts/run-codex-prompts/prompts/writePromptRunTrace.d.ts +19 -0
  121. package/umd/scripts/run-codex-prompts/runners/common/buildHarnessAuthenticationError.d.ts +20 -0
  122. package/umd/scripts/run-codex-prompts/runners/common/createAuthenticationAwarePromptRunner.d.ts +11 -0
  123. package/umd/scripts/run-codex-prompts/runners/common/extractHarnessAuthenticationFailureReason.d.ts +9 -0
  124. package/umd/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +3 -0
  125. package/umd/src/book-2.0/book-language-documentation/getSafeCodeBlock.d.ts +1 -1
  126. package/umd/src/book-components/Chat/MockedChat/MockedChat.test.d.ts +2 -0
  127. package/umd/src/cli/cli-commands/coder/$ensureCoderHarnessGitignoreRules.d.ts +2 -1
  128. package/umd/src/cli/cli-commands/coder/agentCliOptions.d.ts +21 -0
  129. package/umd/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +8 -21
  130. package/umd/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +33 -0
  131. package/umd/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +4 -2
  132. package/umd/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +2 -0
  133. package/umd/src/cli/cli-commands/coder/ensureDirectory.d.ts +6 -0
  134. package/umd/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  135. package/umd/src/cli/cli-commands/coder/init.test.d.ts +1 -0
  136. package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +7 -5
  137. package/umd/src/cli/cli-commands/coder/list.d.ts +10 -0
  138. package/umd/src/cli/cli-commands/coder/list.test.d.ts +1 -0
  139. package/umd/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +19 -1
  140. package/umd/src/cli/cli-commands/coder/printCoderRunFailure.d.ts +6 -0
  141. package/umd/src/cli/cli-commands/coder.d.ts +1 -0
  142. package/umd/src/cli/cli-commands/common/$askForConfirmation.d.ts +4 -2
  143. package/umd/src/cli/cli-commands/common/$askForConfirmation.test.d.ts +1 -0
  144. package/umd/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.d.ts +12 -0
  145. package/umd/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.test.d.ts +1 -0
  146. package/umd/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.d.ts +11 -0
  147. package/umd/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.test.d.ts +1 -0
  148. package/umd/src/cli/cli-commands/common/disk-space/FreeDiskSpaceStatus.d.ts +33 -0
  149. package/umd/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.d.ts +6 -0
  150. package/umd/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.test.d.ts +1 -0
  151. package/umd/src/cli/cli-commands/common/disk-space/formatLowFreeDiskSpaceWarning.d.ts +10 -0
  152. package/umd/src/cli/cli-commands/common/disk-space/freeDiskSpaceConstants.d.ts +28 -0
  153. package/umd/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.d.ts +7 -0
  154. package/umd/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.test.d.ts +1 -0
  155. package/umd/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.d.ts +2 -1
  156. package/umd/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +3 -2
  157. package/umd/src/cli/cli-commands/common/harness/HarnessDefinition.d.ts +26 -0
  158. package/umd/src/cli/cli-commands/common/npm/$askForNpmPackageInstallationApproval.d.ts +4 -2
  159. package/umd/src/cli/cli-commands/common/promptPriorityCliOptions.d.ts +7 -0
  160. package/umd/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +2 -1
  161. package/umd/src/cli/cli-commands/common/questionsCliOptions.d.ts +45 -0
  162. package/umd/src/cli/cli-commands/common/questionsCliOptions.test.d.ts +1 -0
  163. package/umd/src/cli/common/$deprecateCliCommand.d.ts +3 -0
  164. package/umd/src/cli/common/$hideCliCommandFromHelp.d.ts +11 -0
  165. package/umd/src/cli/common/$hideCliCommandFromHelp.test.d.ts +1 -0
  166. package/umd/src/cli/common/$requireCliSubcommand.d.ts +18 -0
  167. package/umd/src/cli/common/$requireCliSubcommand.test.d.ts +1 -0
  168. package/umd/src/llm-providers/vercel/VercelExecutionToolsOptions.d.ts +5 -2
  169. package/umd/src/version.d.ts +1 -1
  170. package/esm/src/cli/cli-commands/coder/agentCodingFile.d.ts +0 -13
  171. package/esm/src/cli/cli-commands/common/harnessUpdateCliOptions.d.ts +0 -29
  172. package/src/cli/cli-commands/coder/agentCodingFile.ts +0 -25
  173. package/src/cli/cli-commands/common/harnessUpdateCliOptions.ts +0 -46
  174. package/umd/src/cli/cli-commands/coder/agentCodingFile.d.ts +0 -13
  175. package/umd/src/cli/cli-commands/common/harnessUpdateCliOptions.d.ts +0 -29
  176. /package/esm/src/cli/cli-commands/{common/harnessUpdateCliOptions.test.d.ts → coder/init.test.d.ts} +0 -0
  177. /package/{umd/src/cli/cli-commands/common/harnessUpdateCliOptions.test.d.ts → esm/src/cli/cli-commands/coder/list.test.d.ts} +0 -0
@@ -0,0 +1,33 @@
1
+ /**
2
+ * How much free disk space is left, measured against the `ptbk coder` free disk space limits.
3
+ *
4
+ * - `sufficient` - there is enough free disk space to start a run and to keep it running
5
+ * - `low` - there is not enough free disk space to start a new run
6
+ * - `critical` - there is not enough free disk space to keep a started run going
7
+ *
8
+ * @private internal utility of `promptbookCli`
9
+ */
10
+ export type FreeDiskSpaceLevel = 'sufficient' | 'low' | 'critical';
11
+ /**
12
+ * One measurement of the free disk space on the filesystem which hosts the inspected path.
13
+ *
14
+ * @private internal utility of `promptbookCli`
15
+ */
16
+ export type FreeDiskSpaceStatus = {
17
+ /**
18
+ * Path whose filesystem was measured.
19
+ */
20
+ readonly inspectedPath: string;
21
+ /**
22
+ * Bytes which are still available to the current user on that filesystem.
23
+ */
24
+ readonly availableBytes: number;
25
+ /**
26
+ * Total size of that filesystem in bytes.
27
+ */
28
+ readonly totalBytes: number;
29
+ /**
30
+ * Severity of the measured free disk space.
31
+ */
32
+ readonly level: FreeDiskSpaceLevel;
33
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Writes one byte count as a compact human-readable amount of disk space, for example `812 MB` or `1.5 GB`.
3
+ *
4
+ * @private internal utility of `promptbookCli`
5
+ */
6
+ export declare function formatFreeDiskSpaceBytes(bytes: number): string;
@@ -0,0 +1,10 @@
1
+ import type { FreeDiskSpaceStatus } from './FreeDiskSpaceStatus';
2
+ /**
3
+ * Writes the shared warning which explains one low free disk space measurement and how to get out of it.
4
+ *
5
+ * The very same wording is used by the check which refuses to start a run and by the check which pauses
6
+ * a run that ran out of disk space while it was working.
7
+ *
8
+ * @private internal utility of `promptbookCli`
9
+ */
10
+ export declare function formatLowFreeDiskSpaceWarning(freeDiskSpaceStatus: FreeDiskSpaceStatus): string;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Free disk space below which `ptbk coder` refuses to start a new run.
3
+ *
4
+ * A coding round writes prompt and log artifacts, lets the harness rewrite the project, may install npm packages,
5
+ * may create a git worktree for `--isolate` and usually runs a build, so a run started with less than this
6
+ * would very likely die somewhere in the middle with a filesystem error.
7
+ *
8
+ * @private internal utility of `promptbookCli`
9
+ */
10
+ export declare const LOW_FREE_DISK_SPACE_BYTES: number;
11
+ /**
12
+ * Free disk space below which a started `ptbk coder` run stops at its next checkpoint and waits until space is freed.
13
+ *
14
+ * This limit is lower than `LOW_FREE_DISK_SPACE_BYTES`, because interrupting a run which is already in progress
15
+ * is more expensive than not starting one at all.
16
+ *
17
+ * @private internal utility of `promptbookCli`
18
+ */
19
+ export declare const CRITICALLY_LOW_FREE_DISK_SPACE_BYTES: number;
20
+ /**
21
+ * How long one free disk space measurement is reused before the filesystem is measured again during a run.
22
+ *
23
+ * Pause checkpoints are passed very often - for example on every tick of a timed wait - so without this
24
+ * interval the filesystem would be measured many times per second.
25
+ *
26
+ * @private internal utility of `promptbookCli`
27
+ */
28
+ export declare const FREE_DISK_SPACE_RECHECK_INTERVAL_MS: number;
@@ -0,0 +1,7 @@
1
+ import type { FreeDiskSpaceLevel } from './FreeDiskSpaceStatus';
2
+ /**
3
+ * Classifies one measured amount of free disk space against the `ptbk coder` free disk space limits.
4
+ *
5
+ * @private internal utility of `promptbookCli`
6
+ */
7
+ export declare function resolveFreeDiskSpaceLevel(availableBytes: number): FreeDiskSpaceLevel;
@@ -1,3 +1,4 @@
1
+ import type { NormalizedQuestionsCliOptions } from '../questionsCliOptions';
1
2
  import type { HarnessInstallationStatus } from './HarnessInstallationStatus';
2
3
  /**
3
4
  * Reports one detected harness installation status and offers to install or update the harness.
@@ -6,4 +7,4 @@ import type { HarnessInstallationStatus } from './HarnessInstallationStatus';
6
7
  *
7
8
  * @private internal utility of `promptbookCli`
8
9
  */
9
- export declare function $applyHarnessInstallationStatus(status: HarnessInstallationStatus): Promise<void>;
10
+ export declare function $applyHarnessInstallationStatus(status: HarnessInstallationStatus, questionsOptions: NormalizedQuestionsCliOptions): Promise<void>;
@@ -1,6 +1,7 @@
1
1
  import type { PromptRunnerHarnessName } from '../promptRunnerCliOptions';
2
+ import type { NormalizedQuestionsCliOptions } from '../questionsCliOptions';
2
3
  /**
3
- * Checks that every given CLI coding harness is installed globally and, when enabled, up to date.
4
+ * Checks that every given CLI coding harness is installed globally and, when the questions are enabled, up to date.
4
5
  * Offers to install missing harnesses and update outdated ones.
5
6
  *
6
7
  * Harness names which are `undefined`, for example when no `--harness` is selected in a dry run,
@@ -10,4 +11,4 @@ import type { PromptRunnerHarnessName } from '../promptRunnerCliOptions';
10
11
  *
11
12
  * @private internal utility of `promptbookCli`
12
13
  */
13
- export declare function $ensureHarnessInstallations(harnessNames: ReadonlyArray<PromptRunnerHarnessName | undefined>, isHarnessUpdateCheckEnabled?: boolean): Promise<void>;
14
+ export declare function $ensureHarnessInstallations(harnessNames: ReadonlyArray<PromptRunnerHarnessName | undefined>, questionsOptions: NormalizedQuestionsCliOptions): Promise<void>;
@@ -19,6 +19,28 @@ export type HarnessStandaloneInstallation = {
19
19
  */
20
20
  readonly updateCommand: string;
21
21
  };
22
+ /**
23
+ * Description of how the user signs in to one CLI coding harness again.
24
+ *
25
+ * Every harness refuses to work once its login is missing or its session has expired, and each of them is
26
+ * signed in differently - some have a dedicated login command, others sign in from their own interactive UI.
27
+ *
28
+ * @private internal utility of `promptbookCli`
29
+ */
30
+ export type HarnessAuthenticationMethod = {
31
+ /**
32
+ * Command which starts the sign-in flow of the harness.
33
+ */
34
+ readonly command: string;
35
+ /**
36
+ * Step which finishes the sign-in inside the started command.
37
+ *
38
+ * Harnesses which sign in from their own interactive user interface leave the user in that interface, so
39
+ * naming just the command would not be enough to get them signed in. Harnesses with a dedicated login
40
+ * command leave this undefined.
41
+ */
42
+ readonly interactiveStep?: string;
43
+ };
22
44
  /**
23
45
  * Static description of one supported CLI coding harness.
24
46
  *
@@ -49,6 +71,10 @@ export type HarnessDefinition = {
49
71
  * Project-local files or directories which this harness can create and which should not be committed.
50
72
  */
51
73
  readonly projectGitignoreRules: ReadonlyArray<string>;
74
+ /**
75
+ * How the user signs in to this harness again after its login is missing or has expired.
76
+ */
77
+ readonly authenticationMethod: HarnessAuthenticationMethod;
52
78
  /**
53
79
  * How a standalone installation of this harness is recognized and updated.
54
80
  *
@@ -1,9 +1,11 @@
1
+ import type { NormalizedQuestionsCliOptions } from '../questionsCliOptions';
1
2
  /**
2
3
  * Asks the user in the terminal whether an npm package should be installed or updated now.
3
4
  *
4
5
  * Note: `$` is used to indicate that this function is not a pure function - it reads the answer from stdin
5
6
  *
6
- * @returns `true` when the user confirms, `false` when the user declines or the terminal is not interactive
7
+ * @returns `true` when the user confirms, `false` when the user declines, the terminal is not interactive
8
+ * or the questions are disabled by `--no-questions`
7
9
  * @private internal utility of `promptbookCli`
8
10
  */
9
- export declare function $askForNpmPackageInstallationApproval(question: string): Promise<boolean>;
11
+ export declare function $askForNpmPackageInstallationApproval(question: string, questionsOptions: NormalizedQuestionsCliOptions): Promise<boolean>;
@@ -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;
@@ -1,3 +1,4 @@
1
+ import type { NormalizedQuestionsCliOptions } from '../questionsCliOptions';
1
2
  /**
2
3
  * Checks local and global Promptbook CLI installations before an interactive coder run and offers to update them.
3
4
  *
@@ -11,4 +12,4 @@
11
12
  * @returns `true` when at least one installation was updated and the current coder run should stop
12
13
  * @private internal utility of `promptbookCli`
13
14
  */
14
- export declare function $ensurePromptbookCliInstallations(): Promise<boolean>;
15
+ export declare function $ensurePromptbookCliInstallations(questionsOptions: NormalizedQuestionsCliOptions): Promise<boolean>;
@@ -0,0 +1,45 @@
1
+ import type { Command as Program } from 'commander';
2
+ /**
3
+ * Commander option bag for opting out of every interactive question.
4
+ *
5
+ * @private internal utility of `promptbookCli`
6
+ */
7
+ export type QuestionsCliOptions = {
8
+ readonly questions: boolean;
9
+ };
10
+ /**
11
+ * Normalized interactive-questions option shared by every `ptbk coder` command which can ask something.
12
+ *
13
+ * @private internal utility of `promptbookCli`
14
+ */
15
+ export type NormalizedQuestionsCliOptions = {
16
+ readonly isAskingQuestionsEnabled: boolean;
17
+ };
18
+ /**
19
+ * Description block shared by the `ptbk coder` commands which can ask interactive questions.
20
+ *
21
+ * @private internal utility of `promptbookCli`
22
+ */
23
+ export declare const QUESTIONS_DESCRIPTION: string;
24
+ /**
25
+ * Registers the shared `--no-questions` option on a `ptbk coder` command which can ask interactive questions.
26
+ *
27
+ * @private internal utility of `promptbookCli`
28
+ */
29
+ export declare function addQuestionsOption(command: Program): void;
30
+ /**
31
+ * Converts the Commander questions flag into the normalized interactive-questions option.
32
+ *
33
+ * @private internal utility of `promptbookCli`
34
+ */
35
+ export declare function normalizeQuestionsCliOptions(cliOptions: QuestionsCliOptions): NormalizedQuestionsCliOptions;
36
+ /**
37
+ * Asserts that a command which waits for a user confirmation before each prompt is allowed to ask for it.
38
+ *
39
+ * @throws {NotAllowed} when `--no-auto` is combined with `--no-questions`
40
+ * @private internal utility of `promptbookCli`
41
+ */
42
+ export declare function assertUserConfirmationIsAllowed(options: {
43
+ readonly isAskingQuestionsEnabled: boolean;
44
+ readonly isWaitingForUser: boolean;
45
+ }): void;
@@ -3,6 +3,9 @@ import type { $side_effect } from '../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Marks one CLI command as deprecated while keeping it available for existing callers.
5
5
  *
6
+ * Deprecated commands are not advertised anymore - they are hidden from the list of commands in the help of their
7
+ * parent command, they warn when they are used and they explain the deprecation in their own help.
8
+ *
6
9
  * @private utility of CLI
7
10
  */
8
11
  export declare function $deprecateCliCommand(command: Command, deprecationMessage: string): $side_effect;
@@ -0,0 +1,11 @@
1
+ import type { Command } from 'commander';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
+ /**
4
+ * Keeps one already registered CLI command out of the help of its parent command while the command itself stays
5
+ * fully usable - it can still be run, it still has its own help and it is still reachable through `ptbk help <command>`.
6
+ *
7
+ * Note: `$` is used to indicate that this function is not a pure function - it changes how the CLI renders its help
8
+ *
9
+ * @private utility of CLI
10
+ */
11
+ export declare function $hideCliCommandFromHelp(command: Command): $side_effect;
@@ -0,0 +1,18 @@
1
+ import type { Command } from 'commander';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
+ /**
4
+ * Makes one CLI command which only groups subcommands ask for a subcommand instead of doing anything on its own.
5
+ *
6
+ * Note: `$` is used to indicate that this function is not a pure function - it registers an action in the CLI
7
+ *
8
+ * @private utility of CLI
9
+ */
10
+ export declare function $requireCliSubcommand(command: Command): $side_effect;
11
+ /**
12
+ * Asks for a subcommand of one CLI command, prints its help and exits the process.
13
+ *
14
+ * Note: `$` is used to indicate that this function is not a pure function - it writes to the console and exits the process
15
+ *
16
+ * @private utility of CLI
17
+ */
18
+ export declare function $reportMissingCliSubcommand(command: Command): never;
@@ -0,0 +1 @@
1
+ export {};
@@ -17,7 +17,10 @@ export type VercelExecutionToolsOptions = CommonToolsOptions & Pick<LlmExecution
17
17
  */
18
18
  readonly availableModels: ReadonlyArray<AvailableModel>;
19
19
  /**
20
- * Additional settings for chat models when calling `vercelProvider.chat('model-name', settings)`
20
+ * Additional settings for chat models, for example `temperature` or `providerOptions`
21
+ *
22
+ * Note: Since Vercel AI SDK v5 these settings belong to the model call, not to
23
+ * `vercelProvider.chat('model-name')` which takes just the model name
21
24
  */
22
- readonly additionalChatSettings?: Partial<Parameters<VercelProvider['chat']>[1]>;
25
+ readonly additionalChatSettings?: Partial<Omit<Parameters<ReturnType<VercelProvider['chat']>['doGenerate']>[0], 'prompt'>>;
23
26
  };
@@ -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-33`).
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-34",
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,
@@ -92,12 +92,9 @@
92
92
  "node": ">=18.18.0",
93
93
  "npm": ">=8.0.0"
94
94
  },
95
- "overrides": {
96
- "zod": "$zod"
97
- },
98
95
  "dependencies": {
99
- "@ai-sdk/deepseek": "0.1.17",
100
- "@ai-sdk/google": "1.0.17",
96
+ "@ai-sdk/deepseek": "1.0.56",
97
+ "@ai-sdk/google": "2.0.97",
101
98
  "@anthropic-ai/sdk": "0.68.0",
102
99
  "@azure/openai": "1.0.0-beta.13",
103
100
  "@mozilla/readability": "0.6.0",
@@ -129,10 +126,8 @@
129
126
  "socket.io-client": "4.7.5",
130
127
  "spacetrim": "0.11.60",
131
128
  "swagger-ui-express": "5.0.1",
132
- "type-fest": "4.5.0",
133
129
  "userhome": "1.0.1",
134
130
  "waitasecond": "1.11.164",
135
- "zod": "4.3.6",
136
131
  "typescript": "5.2.2",
137
132
  "ts-node": "10.9.2",
138
133
  "next": "15.4.11",
@@ -142,7 +137,7 @@
142
137
  "@tailwindcss/typography": "0.5.19",
143
138
  "postcss": "8.5.12",
144
139
  "autoprefixer": "10.4.27",
145
- "@ai-sdk/openai": "1.0.20",
140
+ "@ai-sdk/openai": "2.0.127",
146
141
  "@aws-sdk/client-s3": "3.936.0",
147
142
  "@dnd-kit/core": "6.3.1",
148
143
  "@dnd-kit/sortable": "10.0.0",
@@ -180,15 +175,17 @@
180
175
  "node-gzip": "1.1.2",
181
176
  "nodemailer": "^7.0.13",
182
177
  "qrcode": "1.5.4",
183
- "swagger-ui-react": "5.31.2",
178
+ "swagger-ui-react": "5.32.15",
184
179
  "turndown": "7.2.4",
180
+ "type-fest": "4.5.0",
185
181
  "web-push": "^3.6.7",
186
182
  "y-monaco": "0.1.6",
187
183
  "y-protocols": "1.0.7",
188
184
  "y-websocket": "3.0.0",
189
185
  "y-websocket-server": "1.0.2",
190
186
  "yjs": "13.6.30",
191
- "zeptomail": "7.0.2"
187
+ "zeptomail": "7.0.2",
188
+ "zod": "4.3.6"
192
189
  },
193
190
  "bin": {
194
191
  "promptbook": "bin/promptbook-cli.js",
@@ -5,7 +5,7 @@
5
5
  * @param language - Optional info-string language label.
6
6
  * @returns Fenced code block.
7
7
  *
8
- * @private internal utility of `createStandaloneBookLanguageMarkdown`
8
+ * @private internal utility of `createStandaloneBookLanguageMarkdown` and of the `ptbk coder` run traces
9
9
  */
10
10
  export function getSafeCodeBlock(content: string, language = 'markdown'): string {
11
11
  const maxBacktickCount = Math.max(0, ...(content.match(/`+/g) || []).map((match) => match.length));
@@ -155,6 +155,28 @@ type SimulateMockedChatPlaybackProps = {
155
155
  readonly isCancelledRef: () => boolean;
156
156
  };
157
157
 
158
+ /**
159
+ * Provides stable identifiers for mocked messages that omit them.
160
+ *
161
+ * Incremental typing changes the message content on every word. A stable id
162
+ * lets the chat renderer preserve the message element instead of treating
163
+ * every content update as a new message.
164
+ *
165
+ * @private function of `MockedChat`
166
+ */
167
+ function ensureMockedChatMessageIds(messages: ReadonlyArray<ChatMessage>): ReadonlyArray<ChatMessage> {
168
+ return messages.map((message, messageIndex) => {
169
+ if (message.id) {
170
+ return message;
171
+ }
172
+
173
+ return {
174
+ ...message,
175
+ id: `mocked-chat-message-${messageIndex}`,
176
+ };
177
+ });
178
+ }
179
+
158
180
  /**
159
181
  * Resolves one delay value, including random ranges.
160
182
  *
@@ -560,7 +582,7 @@ async function simulateMockedChatPlayback(props: SimulateMockedChatPlaybackProps
560
582
  export function MockedChat(props: MockedChatProps) {
561
583
  const {
562
584
  delayConfig,
563
- messages: originalMessages,
585
+ messages: sourceMessages,
564
586
  isResettable = true,
565
587
  isPausable = true,
566
588
  messageOffsetsMs,
@@ -570,6 +592,8 @@ export function MockedChat(props: MockedChatProps) {
570
592
  ...chatProps
571
593
  } = props;
572
594
 
595
+ const originalMessages = useMemo(() => ensureMockedChatMessageIds(sourceMessages), [sourceMessages]);
596
+
573
597
  const delays = {
574
598
  ...MOCKED_CHAT_DELAY_CONFIGS.NORMAL_FLOW,
575
599
  ...delayConfig,
@@ -1,9 +1,9 @@
1
- import colors from 'colors';
2
1
  import type {
3
2
  Command as Program /* <- Note: [🔸] Using Program because Command is misleading name */,
4
3
  } from 'commander';
5
4
  import { spaceTrim } from 'spacetrim';
6
5
  import type { $side_effect } from '../../utils/organization/$side_effect';
6
+ import { $requireCliSubcommand } from '../common/$requireCliSubcommand';
7
7
  import { $initializeAgentInitCommand } from './agent-folder/init';
8
8
  import { $initializeAgentRunMultipleCommand } from './agent-folder/runMultiple';
9
9
  import { $initializeAgentRunCommand } from './agent-folder/run';
@@ -41,11 +41,7 @@ export function $initializeAgentFolderCommand(program: Program): $side_effect {
41
41
  $initializeAgentRunCommand(agentFolderCommand);
42
42
  $initializeAgentRunMultipleCommand(agentFolderCommand);
43
43
 
44
- agentFolderCommand.action(() => {
45
- console.info(colors.yellow('Please specify a subcommand.'));
46
- console.info('');
47
- agentFolderCommand.help();
48
- });
44
+ $requireCliSubcommand(agentFolderCommand);
49
45
  }
50
46
 
51
47
  // Note: [🟡] Code for CLI command [agent-folder](src/cli/cli-commands/agent-folder.ts) should never be published outside of `@promptbook/cli`
@@ -1,9 +1,9 @@
1
- import colors from 'colors';
2
1
  import type {
3
2
  Command as Program /* <- Note: [🔸] Using Program because Command is misleading name */,
4
3
  } from 'commander';
5
4
  import { spaceTrim } from 'spacetrim';
6
5
  import type { $side_effect } from '../../utils/organization/$side_effect';
6
+ import { $requireCliSubcommand } from '../common/$requireCliSubcommand';
7
7
  import { $initializeAgentChatCommand } from './agent/chat';
8
8
  import { $initializeAgentExecCommand } from './agent/exec';
9
9
 
@@ -33,11 +33,7 @@ export function $initializeAgentCommand(program: Program): $side_effect {
33
33
  $initializeAgentChatCommand(agentCommand);
34
34
  $initializeAgentExecCommand(agentCommand);
35
35
 
36
- agentCommand.action(() => {
37
- console.info(colors.yellow('Please specify a subcommand.'));
38
- console.info('');
39
- agentCommand.help();
40
- });
36
+ $requireCliSubcommand(agentCommand);
41
37
  }
42
38
 
43
39
  // Note: [🟡] Code for CLI command [agent](src/cli/cli-commands/agent.ts) should never be published outside of `@promptbook/cli`
@@ -1,9 +1,9 @@
1
- import colors from 'colors';
2
1
  import type {
3
2
  Command as Program /* <- Note: [🔸] Using Program because Command is misleading name */,
4
3
  } from 'commander';
5
4
  import { spaceTrim } from 'spacetrim';
6
5
  import type { $side_effect } from '../../utils/organization/$side_effect';
6
+ import { $requireCliSubcommand } from '../common/$requireCliSubcommand';
7
7
  import { $initializeAgentsServerInitCommand } from './agents-server/init';
8
8
  import {
9
9
  $initializeAgentsServerBuildCommand,
@@ -35,11 +35,7 @@ export function $initializeAgentsServerCommand(program: Program): $side_effect {
35
35
  $initializeAgentsServerInitCommand(agentsServerCommand);
36
36
  $initializeAgentsServerStartCommand(agentsServerCommand);
37
37
 
38
- agentsServerCommand.action(() => {
39
- console.info(colors.yellow('Please specify a subcommand.'));
40
- console.info('');
41
- agentsServerCommand.help();
42
- });
38
+ $requireCliSubcommand(agentsServerCommand);
43
39
  }
44
40
 
45
41
  // Note: [🟡] Code for CLI command [agents-server](src/cli/cli-commands/agents-server.ts) should never be published outside of `@promptbook/cli`
@@ -1,5 +1,6 @@
1
1
  import colors from 'colors';
2
2
  import type { PromptRunnerHarnessName } from '../common/promptRunnerCliOptions';
3
+ import type { NormalizedQuestionsCliOptions } from '../common/questionsCliOptions';
3
4
  import { $askForConfirmation } from '../common/$askForConfirmation';
4
5
  import { getHarnessDefinition } from '../common/harness/HarnessDefinition';
5
6
  import { ensureCoderGitignoreRules, getMissingCoderHarnessGitignoreRules } from './ensureCoderGitignoreFile';
@@ -14,6 +15,7 @@ import { ensureCoderGitignoreRules, getMissingCoderHarnessGitignoreRules } from
14
15
  export async function $ensureCoderHarnessGitignoreRules(
15
16
  projectPath: string,
16
17
  harnessName: PromptRunnerHarnessName | undefined,
18
+ questionsOptions: NormalizedQuestionsCliOptions,
17
19
  ): Promise<void> {
18
20
  if (harnessName === undefined) {
19
21
  return;
@@ -30,6 +32,7 @@ export async function $ensureCoderHarnessGitignoreRules(
30
32
  const entryLabel = missingRules.length === 1 ? 'entry' : 'entries';
31
33
  const isAdditionApproved = await $askForConfirmation(
32
34
  `Add the missing ${label} ignore ${entryLabel} ${formattedRules} to \`.gitignore\` now?`,
35
+ questionsOptions,
33
36
  );
34
37
 
35
38
  if (!isAdditionApproved) {
@@ -17,6 +17,13 @@ import {
17
17
  normalizeCoderGitSyncCliOptions,
18
18
  } from '../common/coderGitSyncCliOptions';
19
19
  import { handleActionErrors } from '../common/handleActionErrors';
20
+ import {
21
+ addQuestionsOption,
22
+ normalizeQuestionsCliOptions,
23
+ QUESTIONS_DESCRIPTION,
24
+ type NormalizedQuestionsCliOptions,
25
+ type QuestionsCliOptions,
26
+ } from '../common/questionsCliOptions';
20
27
  import {
21
28
  buildCoderPromptSection,
22
29
  getDefaultCoderPromptTemplateDefinitions,
@@ -66,6 +73,8 @@ export function $initializeCoderAddCommand(program: Program): $side_effect {
66
73
  - \`ptbk coder add\`
67
74
 
68
75
  ${block(CODER_GIT_SYNC_DESCRIPTION)}
76
+
77
+ ${block(QUESTIONS_DESCRIPTION)}
69
78
  `,
70
79
  ),
71
80
  );
@@ -88,6 +97,7 @@ export function $initializeCoderAddCommand(program: Program): $side_effect {
88
97
  `),
89
98
  );
90
99
  addCoderGitSyncOptions(command);
100
+ addQuestionsOption(command);
91
101
 
92
102
  command.action(
93
103
  handleActionErrors(async (descriptionArgument: string | undefined, cliOptions) => {
@@ -97,9 +107,10 @@ export function $initializeCoderAddCommand(program: Program): $side_effect {
97
107
  } & CoderGitSyncCliOptions;
98
108
 
99
109
  const gitSync = normalizeCoderGitSyncCliOptions(cliOptions as CoderGitSyncCliOptions);
110
+ const questionsOptions = normalizeQuestionsCliOptions(cliOptions as QuestionsCliOptions);
100
111
  const projectPath = process.cwd();
101
112
 
102
- const description = await resolveCoderPromptDescription(descriptionArgument);
113
+ const description = await resolveCoderPromptDescription(descriptionArgument, questionsOptions);
103
114
 
104
115
  // Note: Import the git synchronization dynamically to keep the CLI fast for runs without `--commit`
105
116
  const { $commitCoderChanges, $startCoderGitSync } = await import(
@@ -221,7 +232,10 @@ export async function addCoderPrompt({
221
232
  *
222
233
  * @private internal utility of `coder add` command
223
234
  */
224
- async function resolveCoderPromptDescription(descriptionArgument: string | undefined): Promise<string> {
235
+ async function resolveCoderPromptDescription(
236
+ descriptionArgument: string | undefined,
237
+ { isAskingQuestionsEnabled }: NormalizedQuestionsCliOptions,
238
+ ): Promise<string> {
225
239
  if (descriptionArgument !== undefined && descriptionArgument.trim() !== '') {
226
240
  return descriptionArgument.trim();
227
241
  }
@@ -243,6 +257,17 @@ async function resolveCoderPromptDescription(descriptionArgument: string | undef
243
257
  return standardInputDescription;
244
258
  }
245
259
 
260
+ if (!isAskingQuestionsEnabled) {
261
+ throw new ParseError(
262
+ spaceTrim(`
263
+ Cannot add a prompt without a description.
264
+
265
+ The description can not be typed interactively because \`--no-questions\` is used — provide it as an argument or pipe it through stdin instead:
266
+ - \`ptbk coder add --no-questions "some new feature"\`
267
+ `),
268
+ );
269
+ }
270
+
246
271
  const { default: prompts } = await loadPromptsModule();
247
272
  const response = await prompts({
248
273
  type: 'text',
@@ -0,0 +1,32 @@
1
+ import type {
2
+ Command as Program /* <- Note: [🔸] Using Program because Command is misleading name */,
3
+ } from 'commander';
4
+
5
+ /**
6
+ * Commander option bag for an optional Book agent used by coder commands.
7
+ *
8
+ * @private internal utility of `ptbk coder`
9
+ */
10
+ export type CoderAgentCliOptions = {
11
+ readonly agent?: string;
12
+ };
13
+
14
+ /**
15
+ * Description shared by coder commands which accept an agent Book.
16
+ *
17
+ * @private internal utility of `ptbk coder`
18
+ */
19
+ export const CODER_AGENT_OPTION_DESCRIPTION =
20
+ 'Path to a .book file used to personalize coding prompts and select agent-specific tasks';
21
+
22
+ /**
23
+ * Registers the shared `--agent` option for coder commands.
24
+ *
25
+ * @private internal utility of `ptbk coder`
26
+ */
27
+ export function addCoderAgentOption(command: Program): void {
28
+ command.option('--agent <agent-book-path>', CODER_AGENT_OPTION_DESCRIPTION);
29
+ }
30
+
31
+ // Note: [🟡] Code for CLI coder agent options should never be published outside of `@promptbook/cli`
32
+ // Note: [💞] Ignore a discrepancy between file name and exported helper names