@promptbook/cli 0.114.0-48 → 0.114.0-49
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/README.md +59 -25
- package/apps/agents-server/tests/e2e/mockSupabaseServer.cjs +79 -2
- package/apps/agents-server/tests/e2e/support/ChatHistoryNavigationSupport.ts +12 -2
- package/apps/agents-server/tests/e2e/support/auth.ts +6 -0
- package/esm/index.es.js +1327 -478
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/checks/CheckBeforeMode.d.ts +20 -0
- package/esm/scripts/run-codex-prompts/checks/checkRepairInstructions.d.ts +4 -0
- package/esm/scripts/run-codex-prompts/checks/createCheckBeforeRepairPrompt.d.ts +9 -0
- package/esm/scripts/run-codex-prompts/checks/limitCheckOutput.d.ts +4 -0
- package/esm/scripts/run-codex-prompts/checks/projectCheck.d.ts +26 -0
- package/esm/scripts/run-codex-prompts/checks/projectScriptReferences.d.ts +7 -0
- package/esm/scripts/run-codex-prompts/checks/runCheckBefore.d.ts +26 -0
- package/esm/scripts/run-codex-prompts/checks/runPromptCheckCommand.d.ts +16 -0
- package/esm/scripts/run-codex-prompts/{testing/runPromptWithTestFeedback.d.ts → checks/runPromptWithCheckFeedback.d.ts} +9 -9
- package/esm/scripts/run-codex-prompts/common/resolveCoderContext.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/common/resolveCoderProjectContext.d.ts +17 -0
- package/esm/scripts/run-codex-prompts/common/resolveInlineOrFileText.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/common/runGoScript/quoteBashArgument.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/isolation/mapProjectReferenceToWorktree.d.ts +5 -0
- package/esm/scripts/run-codex-prompts/main/runPromptRound.d.ts +3 -1
- package/esm/scripts/run-codex-prompts/prompts/buildPromptLabel.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/prompts/buildPromptLabelForDisplay.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/prompts/buildPromptRunTraceContent.d.ts +3 -1
- package/esm/scripts/run-codex-prompts/prompts/formatCoderRunSteps.d.ts +2 -2
- package/esm/scripts/run-codex-prompts/prompts/listUpcomingTasks.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/prompts/printPromptsToBeWritten.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/server/buildCoderServerPromptResponse.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/team/createCoderTeamPromptRunner.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/agentCliOptions.d.ts +5 -0
- package/esm/src/cli/cli-commands/coder/coderAgentRole.d.ts +5 -0
- package/esm/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +2 -2
- package/esm/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +3 -2
- package/esm/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/findLegacyCoderCheckCallers.d.ts +5 -0
- package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +6 -0
- package/esm/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +5 -3
- package/esm/src/cli/cli-commands/coder/planning/runPlanningSession.d.ts +3 -0
- package/esm/src/cli/cli-commands/coder/prepareCoderPackageJsonScripts.d.ts +12 -0
- package/esm/src/cli/cli-commands/coder.d.ts +1 -1
- package/esm/src/cli/cli-commands/common/coderCheckCliOptions.d.ts +21 -0
- package/esm/src/cli/cli-commands/common/coderCheckCliOptions.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/projectCliOptions.d.ts +30 -0
- package/esm/src/cli/cli-commands/common/projectCliOptions.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.d.ts +1 -1
- package/esm/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +1 -1
- package/esm/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.d.ts +1 -1
- package/esm/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.d.ts +1 -1
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/_packages/cli.readme.md +15 -0
- package/src/cli/cli-commands/agent/chat.ts +11 -2
- package/src/cli/cli-commands/agent/exec.ts +11 -2
- package/src/cli/cli-commands/agent-folder/init.ts +6 -2
- package/src/cli/cli-commands/agent-folder/initializeAgentRunnerCommand.ts +9 -2
- package/src/cli/cli-commands/coder/add.ts +7 -1
- package/src/cli/cli-commands/coder/agentCliOptions.ts +11 -1
- package/src/cli/cli-commands/coder/coderAgentRole.ts +6 -0
- package/src/cli/cli-commands/coder/coderReferencedArtifacts.ts +3 -3
- package/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.ts +22 -3
- package/src/cli/cli-commands/coder/find-fresh-emoji-tags.ts +3 -0
- package/src/cli/cli-commands/coder/find-refactor-candidates.ts +3 -0
- package/src/cli/cli-commands/coder/find-unwritten.ts +3 -0
- package/src/cli/cli-commands/coder/findLegacyCoderCheckCallers.ts +87 -0
- package/src/cli/cli-commands/coder/generate-boilerplates.ts +3 -0
- package/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.ts +6 -7
- package/src/cli/cli-commands/coder/init.ts +8 -2
- package/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.ts +16 -4
- package/src/cli/cli-commands/coder/list.ts +6 -1
- package/src/cli/cli-commands/coder/mergeStringRecordJsonFile.ts +14 -4
- package/src/cli/cli-commands/coder/ping.ts +7 -1
- package/src/cli/cli-commands/coder/plan.ts +17 -5
- package/src/cli/cli-commands/coder/planning/README.md +5 -3
- package/src/cli/cli-commands/coder/planning/fixtures/coding.cjs +22 -0
- package/src/cli/cli-commands/coder/planning/runPlanningSession.ts +14 -3
- package/src/cli/cli-commands/coder/planning/savePlanningChanges.ts +1 -3
- package/src/cli/cli-commands/coder/prepareCoderPackageJsonScripts.ts +304 -0
- package/src/cli/cli-commands/coder/printInitializationSummary.ts +5 -1
- package/src/cli/cli-commands/coder/promptsReadmeTemplate.ts +31 -13
- package/src/cli/cli-commands/coder/run.ts +31 -65
- package/src/cli/cli-commands/coder/server.ts +21 -39
- package/src/cli/cli-commands/coder/verify.ts +3 -0
- package/src/cli/cli-commands/coder.ts +2 -2
- package/src/cli/cli-commands/common/coderCheckCliOptions.ts +107 -0
- package/src/cli/cli-commands/common/projectCliOptions.ts +78 -0
- package/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.ts +4 -2
- package/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.ts +3 -2
- package/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.ts +8 -4
- package/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.ts +5 -2
- package/src/cli/cli-commands/common/validateCoderRunOptions.ts +12 -5
- package/src/cli/cli-commands/common/workspaceRepository.ts +7 -19
- package/src/cli/cli-commands/common/workspaceRepositoryCliOptions.ts +2 -0
- package/src/execution/translation/automatic-translate/translateMessages.ts +1 -3
- package/src/other/templates/getTemplatesPipelineCollection.ts +1074 -1210
- package/src/version.ts +2 -2
- package/src/versions.txt +1 -0
- package/umd/index.umd.js +1324 -475
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/checks/CheckBeforeMode.d.ts +20 -0
- package/umd/scripts/run-codex-prompts/checks/checkRepairInstructions.d.ts +4 -0
- package/umd/scripts/run-codex-prompts/checks/createCheckBeforeRepairPrompt.d.ts +9 -0
- package/umd/scripts/run-codex-prompts/checks/limitCheckOutput.d.ts +4 -0
- package/umd/scripts/run-codex-prompts/checks/projectCheck.d.ts +26 -0
- package/umd/scripts/run-codex-prompts/checks/projectScriptReferences.d.ts +7 -0
- package/umd/scripts/run-codex-prompts/checks/runCheckBefore.d.ts +26 -0
- package/umd/scripts/run-codex-prompts/checks/runPromptCheckCommand.d.ts +16 -0
- package/umd/scripts/run-codex-prompts/{testing/runPromptWithTestFeedback.d.ts → checks/runPromptWithCheckFeedback.d.ts} +9 -9
- package/umd/scripts/run-codex-prompts/common/resolveCoderContext.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/common/resolveCoderProjectContext.d.ts +17 -0
- package/umd/scripts/run-codex-prompts/common/resolveInlineOrFileText.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/common/runGoScript/quoteBashArgument.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/isolation/mapProjectReferenceToWorktree.d.ts +5 -0
- package/umd/scripts/run-codex-prompts/main/runPromptRound.d.ts +3 -1
- package/umd/scripts/run-codex-prompts/prompts/buildPromptLabel.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/prompts/buildPromptLabelForDisplay.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/prompts/buildPromptRunTraceContent.d.ts +3 -1
- package/umd/scripts/run-codex-prompts/prompts/formatCoderRunSteps.d.ts +2 -2
- package/umd/scripts/run-codex-prompts/prompts/listUpcomingTasks.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/prompts/printPromptsToBeWritten.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/server/buildCoderServerPromptResponse.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/team/createCoderTeamPromptRunner.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +1 -1
- package/umd/src/cli/cli-commands/coder/agentCliOptions.d.ts +5 -0
- package/umd/src/cli/cli-commands/coder/coderAgentRole.d.ts +5 -0
- package/umd/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +2 -2
- package/umd/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +3 -2
- package/umd/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/findLegacyCoderCheckCallers.d.ts +5 -0
- package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +6 -0
- package/umd/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +5 -3
- package/umd/src/cli/cli-commands/coder/planning/runPlanningSession.d.ts +3 -0
- package/umd/src/cli/cli-commands/coder/prepareCoderPackageJsonScripts.d.ts +12 -0
- package/umd/src/cli/cli-commands/coder.d.ts +1 -1
- package/umd/src/cli/cli-commands/common/coderCheckCliOptions.d.ts +21 -0
- package/umd/src/cli/cli-commands/common/coderCheckCliOptions.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/projectCliOptions.d.ts +30 -0
- package/umd/src/cli/cli-commands/common/projectCliOptions.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.d.ts +1 -1
- package/umd/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +1 -1
- package/umd/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.d.ts +1 -1
- package/umd/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.d.ts +1 -1
- package/umd/src/version.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/testing/TestBeforeMode.d.ts +0 -16
- package/esm/scripts/run-codex-prompts/testing/createTestBeforeRepairPrompt.d.ts +0 -9
- package/esm/scripts/run-codex-prompts/testing/limitTestOutput.d.ts +0 -4
- package/esm/scripts/run-codex-prompts/testing/runPromptTestCommand.d.ts +0 -14
- package/esm/scripts/run-codex-prompts/testing/runTestBefore.d.ts +0 -24
- package/umd/scripts/run-codex-prompts/testing/TestBeforeMode.d.ts +0 -16
- package/umd/scripts/run-codex-prompts/testing/createTestBeforeRepairPrompt.d.ts +0 -9
- package/umd/scripts/run-codex-prompts/testing/limitTestOutput.d.ts +0 -4
- package/umd/scripts/run-codex-prompts/testing/runPromptTestCommand.d.ts +0 -14
- package/umd/scripts/run-codex-prompts/testing/runTestBefore.d.ts +0 -24
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spaceTrim } from 'spacetrim';
|
|
2
2
|
import type { RunOptions } from '../../../../scripts/run-codex-prompts/cli/RunOptions';
|
|
3
|
-
import {
|
|
3
|
+
import { isCheckBeforeMode } from '../../../../scripts/run-codex-prompts/checks/CheckBeforeMode';
|
|
4
4
|
import { DatabaseError } from '../../../errors/DatabaseError';
|
|
5
5
|
import { NotAllowed } from '../../../errors/NotAllowed';
|
|
6
6
|
|
|
@@ -9,10 +9,17 @@ import { NotAllowed } from '../../../errors/NotAllowed';
|
|
|
9
9
|
* @private shared validation for Coder execution commands
|
|
10
10
|
*/
|
|
11
11
|
export function validateCoderRunOptions(options: RunOptions): void {
|
|
12
|
-
if (
|
|
12
|
+
if (options.checkCommand !== undefined && !options.checkCommand.trim()) {
|
|
13
13
|
throw new NotAllowed(
|
|
14
14
|
spaceTrim(`
|
|
15
|
-
|
|
15
|
+
Option \`--check\` requires a non-empty shell command, for example \`npm run check\`.
|
|
16
|
+
`),
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
if (!isCheckBeforeMode(options.checkBefore ?? 'no')) {
|
|
20
|
+
throw new NotAllowed(
|
|
21
|
+
spaceTrim(`
|
|
22
|
+
Invalid ${'`--check-before`'} mode: \`${String(options.checkBefore)}\`.
|
|
16
23
|
|
|
17
24
|
Use one of: \`no\`, \`yes-and-fail\`, \`yes-and-fix\`.
|
|
18
25
|
`),
|
|
@@ -67,10 +74,10 @@ export function validateCoderRunOptions(options: RunOptions): void {
|
|
|
67
74
|
);
|
|
68
75
|
}
|
|
69
76
|
|
|
70
|
-
if (options.gitChanges === 'continue' && options.
|
|
77
|
+
if (options.gitChanges === 'continue' && options.checkBefore === 'yes-and-fix') {
|
|
71
78
|
throw new NotAllowed(
|
|
72
79
|
spaceTrim(`
|
|
73
|
-
Flag \`--git-changes continue\` cannot be combined with \`--
|
|
80
|
+
Flag \`--git-changes continue\` cannot be combined with \`--check-before yes-and-fix\`.
|
|
74
81
|
|
|
75
82
|
An interrupted prompt already has changes in progress, so there is no unmodified project state for pre-coding verification to repair.
|
|
76
83
|
`),
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { execFile } from 'child_process';
|
|
2
|
-
import { lstat, realpath
|
|
3
|
-
import { dirname, join
|
|
2
|
+
import { lstat, realpath } from 'fs/promises';
|
|
3
|
+
import { dirname, join } from 'path';
|
|
4
4
|
import { spaceTrim } from 'spacetrim';
|
|
5
5
|
import { promisify } from 'util';
|
|
6
6
|
import { EnvironmentMismatchError } from '../../../errors/EnvironmentMismatchError';
|
|
7
7
|
import { NotAllowed } from '../../../errors/NotAllowed';
|
|
8
8
|
import { loadPromptsModule } from '../../common/loadPromptsModule';
|
|
9
9
|
import type { NormalizedQuestionsCliOptions } from './questionsCliOptions';
|
|
10
|
+
import { resolveProjectDirectory } from './projectCliOptions';
|
|
10
11
|
|
|
11
12
|
/** Shell-free Git execution, also usable from the packaged CLI. */
|
|
12
13
|
const EXECUTE_FILE = promisify(execFile);
|
|
@@ -40,22 +41,7 @@ export type WorkspaceRepositoryPolicy = 'initialize' | 'mutate' | 'read-only';
|
|
|
40
41
|
export async function $resolveWorkspaceRepository(
|
|
41
42
|
projectDirectory = process.cwd(),
|
|
42
43
|
): Promise<WorkspaceRepositoryContext> {
|
|
43
|
-
const
|
|
44
|
-
let projectPath: string;
|
|
45
|
-
try {
|
|
46
|
-
projectPath = await realpath(requestedPath);
|
|
47
|
-
if (!(await stat(projectPath)).isDirectory()) {
|
|
48
|
-
throw new EnvironmentMismatchError(`The project path \`${requestedPath}\` is not a directory.`);
|
|
49
|
-
}
|
|
50
|
-
} catch (error) {
|
|
51
|
-
throw new EnvironmentMismatchError(
|
|
52
|
-
spaceTrim(
|
|
53
|
-
`Cannot access project directory \`${requestedPath}\`. Check that it exists and is accessible.\n\n${describeWorkspaceError(
|
|
54
|
-
error,
|
|
55
|
-
)}`,
|
|
56
|
-
),
|
|
57
|
-
);
|
|
58
|
-
}
|
|
44
|
+
const projectPath = await resolveProjectDirectory(projectDirectory);
|
|
59
45
|
return $inspectWorkspaceRepository(projectPath);
|
|
60
46
|
}
|
|
61
47
|
|
|
@@ -192,7 +178,9 @@ async function $inspectWorkspaceRepository(projectPath: string): Promise<Workspa
|
|
|
192
178
|
// Git may skip damaged inner metadata and find a valid parent. Do not silently use that parent
|
|
193
179
|
// for a project whose own checkout needs repair.
|
|
194
180
|
await $assertNoBrokenRepositoryMetadata(projectPath, repositoryRoot);
|
|
195
|
-
const gitDirectory =
|
|
181
|
+
const gitDirectory = await realpath(
|
|
182
|
+
(await $runWorkspaceGit(projectPath, ['rev-parse', '--absolute-git-dir'])).trim(),
|
|
183
|
+
);
|
|
196
184
|
// Also validate the index and metadata, without refreshing the index or depending on an existing commit.
|
|
197
185
|
await $runWorkspaceGit(projectPath, ['status', '--porcelain', '--untracked-files=no']);
|
|
198
186
|
return { projectPath, repositoryRoot, gitDirectory, repositoryStatus: 'reused' };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
2
|
import { spaceTrim } from 'spacetrim';
|
|
3
3
|
import { addQuestionsOption } from './questionsCliOptions';
|
|
4
|
+
import { addProjectPathOption } from './projectCliOptions';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Shared explanation of the workspace prerequisite, independent of commit and synchronization settings.
|
|
@@ -21,6 +22,7 @@ export const WORKSPACE_REPOSITORY_DESCRIPTION = spaceTrim(`
|
|
|
21
22
|
* @private internal registration helper for workspace CLI commands
|
|
22
23
|
*/
|
|
23
24
|
export function addWorkspaceRepositoryOptions(command: Command): void {
|
|
25
|
+
addProjectPathOption(command);
|
|
24
26
|
if (!command.options.some((option) => option.long === '--no-questions')) addQuestionsOption(command);
|
|
25
27
|
command.addHelpText('after', `\n${WORKSPACE_REPOSITORY_DESCRIPTION}\n`);
|
|
26
28
|
}
|
|
@@ -19,9 +19,7 @@ export async function translateMessages({
|
|
|
19
19
|
from,
|
|
20
20
|
to,
|
|
21
21
|
}: { automaticTranslator: AutomaticTranslator } & TranslatorOptions) {
|
|
22
|
-
for (const filename of await findFilesByGlob(
|
|
23
|
-
join(__dirname, '../../translations/', from || 'en', '/**/*.json5'),
|
|
24
|
-
)) {
|
|
22
|
+
for (const filename of await findFilesByGlob(join(__dirname, '../../translations/', from || 'en', '/**/*.json5'))) {
|
|
25
23
|
// <- TODO: [😶]
|
|
26
24
|
const fileData = JSON5.parse(await promisify(readFile)(filename, 'utf-8'));
|
|
27
25
|
|