@promptbook/cli 0.114.0-49 → 0.114.0-50

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 (168) hide show
  1. package/README.md +3 -3
  2. package/apps/agents-server/src/app/globals.css +15 -0
  3. package/apps/agents-server/src/components/ContextMenu/ContextMenuPanel.tsx +1 -11
  4. package/apps/agents-server/src/utils/applicationFonts.ts +4 -25
  5. package/esm/index.es.js +36124 -33191
  6. package/esm/index.es.js.map +1 -1
  7. package/esm/scripts/run-codex-prompts/checks/CoderCheckExecutionError.d.ts +6 -0
  8. package/esm/scripts/run-codex-prompts/checks/CoderCheckFailedError.d.ts +6 -0
  9. package/esm/scripts/run-codex-prompts/checks/buildCheckBeforeScriptPath.d.ts +2 -0
  10. package/esm/scripts/run-codex-prompts/checks/createCheckBeforeRepairPrompt.d.ts +3 -1
  11. package/esm/scripts/run-codex-prompts/checks/runCheckBefore.d.ts +5 -0
  12. package/esm/scripts/run-codex-prompts/checks/runCoderCheck.d.ts +17 -0
  13. package/esm/scripts/run-codex-prompts/checks/runCoderCheckRepair.d.ts +40 -0
  14. package/esm/scripts/run-codex-prompts/checks/runPromptWithCheckFeedback.d.ts +5 -0
  15. package/esm/scripts/run-codex-prompts/common/createFreeDiskSpaceGuard.d.ts +3 -0
  16. package/esm/scripts/run-codex-prompts/common/resolveCoderProjectContext.d.ts +2 -0
  17. package/esm/scripts/run-codex-prompts/common/runGoScript/$spawnLoggedBashScript.d.ts +2 -0
  18. package/esm/scripts/run-codex-prompts/common/runGoScript/buildCoderExecutionArtifactPaths.d.ts +2 -0
  19. package/esm/scripts/run-codex-prompts/common/runGoScript/scriptExecutionLog.d.ts +1 -1
  20. package/esm/scripts/run-codex-prompts/common/sleepWithCountdown.d.ts +2 -0
  21. package/esm/scripts/run-codex-prompts/common/waitForSkippableWorldTimeDeadline.d.ts +1 -0
  22. package/esm/scripts/run-codex-prompts/common/withCoderWorkspaceLock.d.ts +9 -0
  23. package/esm/scripts/run-codex-prompts/git/CoderGitOperationError.d.ts +9 -0
  24. package/esm/scripts/run-codex-prompts/git/CoderPhasePersistence.d.ts +105 -0
  25. package/esm/scripts/run-codex-prompts/git/CoderPhaseRecovery.d.ts +43 -0
  26. package/esm/scripts/run-codex-prompts/git/buildCoderCheckCommitMessage.d.ts +11 -0
  27. package/esm/scripts/run-codex-prompts/git/coderCommitScope.d.ts +14 -1
  28. package/esm/scripts/run-codex-prompts/git/coderFinalizationFiles.d.ts +14 -0
  29. package/esm/scripts/run-codex-prompts/git/coderIndexLease.d.ts +11 -0
  30. package/esm/scripts/run-codex-prompts/git/coderRepositoryFiles.d.ts +6 -0
  31. package/esm/scripts/run-codex-prompts/git/coderRepositorySnapshot.d.ts +62 -0
  32. package/esm/scripts/run-codex-prompts/git/coderRepositoryView.d.ts +30 -0
  33. package/esm/scripts/run-codex-prompts/git/commitChanges.d.ts +36 -3
  34. package/esm/scripts/run-codex-prompts/git/gitLongPathsSupport.d.ts +1 -1
  35. package/esm/scripts/run-codex-prompts/git/pullLatestChanges.d.ts +3 -1
  36. package/esm/scripts/run-codex-prompts/git/quoteGitArgument.d.ts +5 -0
  37. package/esm/scripts/run-codex-prompts/git/runGitCommand.d.ts +4 -0
  38. package/esm/scripts/run-codex-prompts/git/runWorkspaceGitWithIndexReadRetry.d.ts +7 -0
  39. package/esm/scripts/run-codex-prompts/git/workingTreeChanges.d.ts +1 -1
  40. package/esm/scripts/run-codex-prompts/isolation/coderIsolationArtifacts.d.ts +16 -0
  41. package/esm/scripts/run-codex-prompts/isolation/coderIsolationIgnoredFiles.d.ts +18 -0
  42. package/esm/scripts/run-codex-prompts/isolation/createCoderIsolationWorktree.d.ts +1 -2
  43. package/esm/scripts/run-codex-prompts/isolation/mergeCoderIsolationWorktree.d.ts +5 -5
  44. package/esm/scripts/run-codex-prompts/isolation/preserveCoderIsolationRecovery.d.ts +3 -0
  45. package/esm/scripts/run-codex-prompts/isolation/runIsolatedPromptRound.d.ts +2 -2
  46. package/esm/scripts/run-codex-prompts/main/prepareCoderPromptExecution.d.ts +18 -0
  47. package/esm/scripts/run-codex-prompts/main/runCoderFix.d.ts +24 -0
  48. package/esm/scripts/run-codex-prompts/main/runPromptRound.d.ts +12 -2
  49. package/esm/scripts/run-codex-prompts/prompts/buildPromptRunTraceContent.d.ts +5 -2
  50. package/esm/scripts/run-codex-prompts/prompts/refreshPromptSelection.d.ts +6 -0
  51. package/esm/scripts/run-codex-prompts/prompts/writePromptErrorLog.d.ts +4 -0
  52. package/esm/scripts/run-codex-prompts/prompts/writePromptFile.d.ts +2 -0
  53. package/esm/scripts/run-codex-prompts/prompts/writePromptRunTrace.d.ts +2 -0
  54. package/esm/scripts/run-codex-prompts/server/buildCoderServerPromptResponse.d.ts +1 -1
  55. package/esm/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +1 -1
  56. package/esm/scripts/run-codex-prompts/ui/buildCoderCheckRepairUiFrame.d.ts +3 -0
  57. package/esm/scripts/run-codex-prompts/ui/output/CoderOutputEvent.d.ts +1 -1
  58. package/esm/scripts/run-codex-prompts/ui/output/CoderRunOutput.d.ts +2 -2
  59. package/esm/scripts/run-codex-prompts/ui/renderCoderRunUi.d.ts +4 -0
  60. package/esm/src/cli/cli-commands/coder/add.d.ts +7 -2
  61. package/esm/src/cli/cli-commands/coder/ensureCoderGitattributesFile.d.ts +13 -0
  62. package/esm/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +1 -1
  63. package/esm/src/cli/cli-commands/coder/fix.d.ts +7 -0
  64. package/esm/src/cli/cli-commands/coder/fix.test.d.ts +1 -0
  65. package/esm/src/cli/cli-commands/coder/fixWorkflow.test.d.ts +1 -0
  66. package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +1 -0
  67. package/esm/src/cli/cli-commands/coder.d.ts +1 -0
  68. package/esm/src/cli/cli-commands/common/coderCheckCliOptions.d.ts +1 -1
  69. package/esm/src/cli/cli-commands/common/ensureProjectTextFile.d.ts +7 -0
  70. package/esm/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +3 -1
  71. package/esm/src/cli/cli-commands/common/validateCoderRunOptions.d.ts +1 -1
  72. package/esm/src/cli/cli-commands/common/workspaceRepository.d.ts +12 -0
  73. package/esm/src/version.d.ts +1 -1
  74. package/package.json +1 -1
  75. package/src/cli/cli-commands/coder/add.ts +20 -3
  76. package/src/cli/cli-commands/coder/ensureCoderGitattributesFile.ts +25 -0
  77. package/src/cli/cli-commands/coder/ensureCoderGitignoreFile.ts +3 -3
  78. package/src/cli/cli-commands/coder/ensureCoderMarkdownFile.ts +2 -20
  79. package/src/cli/cli-commands/coder/fix.ts +166 -0
  80. package/src/cli/cli-commands/coder/fixtures/fix.cjs +29 -0
  81. package/src/cli/cli-commands/coder/fixtures/healthyDisk.cjs +4 -0
  82. package/src/cli/cli-commands/coder/getCoderInitializationCommitPaths.ts +2 -0
  83. package/src/cli/cli-commands/coder/init.ts +3 -1
  84. package/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.ts +7 -0
  85. package/src/cli/cli-commands/coder/planning/fixtures/coding.cjs +4 -0
  86. package/src/cli/cli-commands/coder/printInitializationSummary.ts +2 -0
  87. package/src/cli/cli-commands/coder/promptsReadmeTemplate.ts +25 -1
  88. package/src/cli/cli-commands/coder/run.ts +17 -8
  89. package/src/cli/cli-commands/coder/server.ts +9 -6
  90. package/src/cli/cli-commands/coder.ts +4 -0
  91. package/src/cli/cli-commands/common/coderCheckCliOptions.ts +7 -6
  92. package/src/cli/cli-commands/common/ensureProjectTextFile.ts +35 -0
  93. package/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.ts +13 -0
  94. package/src/cli/cli-commands/common/validateCoderRunOptions.ts +16 -1
  95. package/src/cli/cli-commands/common/workspaceRepository.ts +61 -13
  96. package/src/other/templates/getTemplatesPipelineCollection.ts +1825 -1089
  97. package/src/utils/execCommand/$execCommand.ts +2 -1
  98. package/src/version.ts +2 -2
  99. package/src/versions.txt +1 -0
  100. package/umd/index.umd.js +36204 -33273
  101. package/umd/index.umd.js.map +1 -1
  102. package/umd/scripts/run-codex-prompts/checks/CoderCheckExecutionError.d.ts +6 -0
  103. package/umd/scripts/run-codex-prompts/checks/CoderCheckFailedError.d.ts +6 -0
  104. package/umd/scripts/run-codex-prompts/checks/buildCheckBeforeScriptPath.d.ts +2 -0
  105. package/umd/scripts/run-codex-prompts/checks/createCheckBeforeRepairPrompt.d.ts +3 -1
  106. package/umd/scripts/run-codex-prompts/checks/runCheckBefore.d.ts +5 -0
  107. package/umd/scripts/run-codex-prompts/checks/runCoderCheck.d.ts +17 -0
  108. package/umd/scripts/run-codex-prompts/checks/runCoderCheckRepair.d.ts +40 -0
  109. package/umd/scripts/run-codex-prompts/checks/runPromptWithCheckFeedback.d.ts +5 -0
  110. package/umd/scripts/run-codex-prompts/common/createFreeDiskSpaceGuard.d.ts +3 -0
  111. package/umd/scripts/run-codex-prompts/common/resolveCoderProjectContext.d.ts +2 -0
  112. package/umd/scripts/run-codex-prompts/common/runGoScript/$spawnLoggedBashScript.d.ts +2 -0
  113. package/umd/scripts/run-codex-prompts/common/runGoScript/buildCoderExecutionArtifactPaths.d.ts +2 -0
  114. package/umd/scripts/run-codex-prompts/common/runGoScript/scriptExecutionLog.d.ts +1 -1
  115. package/umd/scripts/run-codex-prompts/common/sleepWithCountdown.d.ts +2 -0
  116. package/umd/scripts/run-codex-prompts/common/waitForSkippableWorldTimeDeadline.d.ts +1 -0
  117. package/umd/scripts/run-codex-prompts/common/withCoderWorkspaceLock.d.ts +9 -0
  118. package/umd/scripts/run-codex-prompts/git/CoderGitOperationError.d.ts +9 -0
  119. package/umd/scripts/run-codex-prompts/git/CoderPhasePersistence.d.ts +105 -0
  120. package/umd/scripts/run-codex-prompts/git/CoderPhaseRecovery.d.ts +43 -0
  121. package/umd/scripts/run-codex-prompts/git/buildCoderCheckCommitMessage.d.ts +11 -0
  122. package/umd/scripts/run-codex-prompts/git/coderCommitScope.d.ts +14 -1
  123. package/umd/scripts/run-codex-prompts/git/coderFinalizationFiles.d.ts +14 -0
  124. package/umd/scripts/run-codex-prompts/git/coderIndexLease.d.ts +11 -0
  125. package/umd/scripts/run-codex-prompts/git/coderRepositoryFiles.d.ts +6 -0
  126. package/umd/scripts/run-codex-prompts/git/coderRepositorySnapshot.d.ts +62 -0
  127. package/umd/scripts/run-codex-prompts/git/coderRepositoryView.d.ts +30 -0
  128. package/umd/scripts/run-codex-prompts/git/commitChanges.d.ts +36 -3
  129. package/umd/scripts/run-codex-prompts/git/gitLongPathsSupport.d.ts +1 -1
  130. package/umd/scripts/run-codex-prompts/git/pullLatestChanges.d.ts +3 -1
  131. package/umd/scripts/run-codex-prompts/git/quoteGitArgument.d.ts +5 -0
  132. package/umd/scripts/run-codex-prompts/git/runGitCommand.d.ts +4 -0
  133. package/umd/scripts/run-codex-prompts/git/runWorkspaceGitWithIndexReadRetry.d.ts +7 -0
  134. package/umd/scripts/run-codex-prompts/git/workingTreeChanges.d.ts +1 -1
  135. package/umd/scripts/run-codex-prompts/isolation/coderIsolationArtifacts.d.ts +16 -0
  136. package/umd/scripts/run-codex-prompts/isolation/coderIsolationIgnoredFiles.d.ts +18 -0
  137. package/umd/scripts/run-codex-prompts/isolation/createCoderIsolationWorktree.d.ts +1 -2
  138. package/umd/scripts/run-codex-prompts/isolation/mergeCoderIsolationWorktree.d.ts +5 -5
  139. package/umd/scripts/run-codex-prompts/isolation/preserveCoderIsolationRecovery.d.ts +3 -0
  140. package/umd/scripts/run-codex-prompts/isolation/runIsolatedPromptRound.d.ts +2 -2
  141. package/umd/scripts/run-codex-prompts/main/prepareCoderPromptExecution.d.ts +18 -0
  142. package/umd/scripts/run-codex-prompts/main/runCoderFix.d.ts +24 -0
  143. package/umd/scripts/run-codex-prompts/main/runPromptRound.d.ts +12 -2
  144. package/umd/scripts/run-codex-prompts/prompts/buildPromptRunTraceContent.d.ts +5 -2
  145. package/umd/scripts/run-codex-prompts/prompts/refreshPromptSelection.d.ts +6 -0
  146. package/umd/scripts/run-codex-prompts/prompts/writePromptErrorLog.d.ts +4 -0
  147. package/umd/scripts/run-codex-prompts/prompts/writePromptFile.d.ts +2 -0
  148. package/umd/scripts/run-codex-prompts/prompts/writePromptRunTrace.d.ts +2 -0
  149. package/umd/scripts/run-codex-prompts/server/buildCoderServerPromptResponse.d.ts +1 -1
  150. package/umd/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +1 -1
  151. package/umd/scripts/run-codex-prompts/ui/buildCoderCheckRepairUiFrame.d.ts +3 -0
  152. package/umd/scripts/run-codex-prompts/ui/output/CoderOutputEvent.d.ts +1 -1
  153. package/umd/scripts/run-codex-prompts/ui/output/CoderRunOutput.d.ts +2 -2
  154. package/umd/scripts/run-codex-prompts/ui/renderCoderRunUi.d.ts +4 -0
  155. package/umd/src/cli/cli-commands/coder/add.d.ts +7 -2
  156. package/umd/src/cli/cli-commands/coder/ensureCoderGitattributesFile.d.ts +13 -0
  157. package/umd/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +1 -1
  158. package/umd/src/cli/cli-commands/coder/fix.d.ts +7 -0
  159. package/umd/src/cli/cli-commands/coder/fix.test.d.ts +1 -0
  160. package/umd/src/cli/cli-commands/coder/fixWorkflow.test.d.ts +1 -0
  161. package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +1 -0
  162. package/umd/src/cli/cli-commands/coder.d.ts +1 -0
  163. package/umd/src/cli/cli-commands/common/coderCheckCliOptions.d.ts +1 -1
  164. package/umd/src/cli/cli-commands/common/ensureProjectTextFile.d.ts +7 -0
  165. package/umd/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +3 -1
  166. package/umd/src/cli/cli-commands/common/validateCoderRunOptions.d.ts +1 -1
  167. package/umd/src/cli/cli-commands/common/workspaceRepository.d.ts +12 -0
  168. package/umd/src/version.d.ts +1 -1
@@ -1,17 +1,13 @@
1
- import { execFile } from 'child_process';
1
+ import { spawn } from 'child_process';
2
2
  import { lstat, realpath } from 'fs/promises';
3
3
  import { dirname, join } from 'path';
4
4
  import { spaceTrim } from 'spacetrim';
5
- import { promisify } from 'util';
6
5
  import { EnvironmentMismatchError } from '../../../errors/EnvironmentMismatchError';
7
6
  import { NotAllowed } from '../../../errors/NotAllowed';
8
7
  import { loadPromptsModule } from '../../common/loadPromptsModule';
9
8
  import type { NormalizedQuestionsCliOptions } from './questionsCliOptions';
10
9
  import { resolveProjectDirectory } from './projectCliOptions';
11
10
 
12
- /** Shell-free Git execution, also usable from the packaged CLI. */
13
- const EXECUTE_FILE = promisify(execFile);
14
-
15
11
  /**
16
12
  * Resolved project directory and its enclosing working tree. Project artifacts belong to `projectPath`;
17
13
  * Git paths and synchronization belong to `repositoryRoot`, which may be an enclosing monorepo.
@@ -212,15 +208,67 @@ async function $assertNoBrokenRepositoryMetadata(projectPath: string, repository
212
208
  }
213
209
  }
214
210
 
215
- /** Executes Git without a shell, optional index locks, or credential prompts. */
216
- async function $runWorkspaceGit(projectPath: string, argumentsList: ReadonlyArray<string>): Promise<string> {
217
- const result = await EXECUTE_FILE('git', [...argumentsList], {
218
- cwd: projectPath,
219
- env: { ...process.env, LC_ALL: 'C', GIT_OPTIONAL_LOCKS: '0', GIT_TERMINAL_PROMPT: '0' },
220
- windowsHide: true,
221
- maxBuffer: 8 * 1024 * 1024,
211
+ /**
212
+ * Executes Git without a shell, optional index locks, or credential prompts, retaining raw output boundaries.
213
+ * Drains both output streams without execFile's fixed buffer limit so large repository listings remain complete.
214
+ * @private shared Git discovery and commit-scope inspection
215
+ */
216
+ export async function $runWorkspaceGit(
217
+ projectPath: string,
218
+ argumentsList: ReadonlyArray<string>,
219
+ options?: {
220
+ readonly env?: Record<string, string>;
221
+ readonly signal?: AbortSignal;
222
+ readonly input?: string | Buffer;
223
+ },
224
+ ): Promise<string> {
225
+ return new Promise((resolve, reject) => {
226
+ const child = spawn('git', [...argumentsList], {
227
+ cwd: projectPath,
228
+ env: { ...process.env, LC_ALL: 'C', GIT_OPTIONAL_LOCKS: '0', GIT_TERMINAL_PROMPT: '0', ...options?.env },
229
+ windowsHide: true,
230
+ signal: options?.signal,
231
+ });
232
+ const stdoutChunks: string[] = [];
233
+ const stderrChunks: string[] = [];
234
+ let processError: Error | undefined;
235
+ let inputError: Error | undefined;
236
+ // Stream decoding preserves multibyte filenames even when a character spans two output chunks.
237
+ child.stdout.setEncoding('utf8');
238
+ child.stderr.setEncoding('utf8');
239
+ child.stdout.on('data', (chunk: string) => stdoutChunks.push(chunk));
240
+ child.stderr.on('data', (chunk: string) => stderrChunks.push(chunk));
241
+ child.on('error', (error) => {
242
+ processError = error;
243
+ });
244
+ child.stdin.on('error', (error) => {
245
+ // A failed Git command may close stdin early. Keep its exit status and stderr as the primary error.
246
+ inputError = error;
247
+ });
248
+ child.on('close', (code, signal) => {
249
+ const stdout = stdoutChunks.join('');
250
+ const stderr = stderrChunks.join('');
251
+ if (processError) {
252
+ reject(Object.assign(processError, { stdout, stderr }));
253
+ } else if (code !== 0 || signal) {
254
+ reject(
255
+ Object.assign(new Error(`Command failed: git ${argumentsList.join(' ')}\n${stderr}`), {
256
+ code,
257
+ signal,
258
+ killed: child.killed,
259
+ stdout,
260
+ stderr,
261
+ }),
262
+ );
263
+ } else if (inputError) {
264
+ reject(Object.assign(inputError, { stdout, stderr }));
265
+ } else {
266
+ resolve(stdout);
267
+ }
268
+ });
269
+ // Index-info uses NUL-delimited input. Closing stdin also lets commands finish when input is empty.
270
+ child.stdin.end(options?.input);
222
271
  });
223
- return result.stdout;
224
272
  }
225
273
 
226
274
  /** Translates discovery failures without ever treating an ownership or executable error as permission to init. */