@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.
- package/README.md +3 -3
- package/apps/agents-server/src/app/globals.css +15 -0
- package/apps/agents-server/src/components/ContextMenu/ContextMenuPanel.tsx +1 -11
- package/apps/agents-server/src/utils/applicationFonts.ts +4 -25
- package/esm/index.es.js +36124 -33191
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/checks/CoderCheckExecutionError.d.ts +6 -0
- package/esm/scripts/run-codex-prompts/checks/CoderCheckFailedError.d.ts +6 -0
- package/esm/scripts/run-codex-prompts/checks/buildCheckBeforeScriptPath.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/checks/createCheckBeforeRepairPrompt.d.ts +3 -1
- package/esm/scripts/run-codex-prompts/checks/runCheckBefore.d.ts +5 -0
- package/esm/scripts/run-codex-prompts/checks/runCoderCheck.d.ts +17 -0
- package/esm/scripts/run-codex-prompts/checks/runCoderCheckRepair.d.ts +40 -0
- package/esm/scripts/run-codex-prompts/checks/runPromptWithCheckFeedback.d.ts +5 -0
- package/esm/scripts/run-codex-prompts/common/createFreeDiskSpaceGuard.d.ts +3 -0
- package/esm/scripts/run-codex-prompts/common/resolveCoderProjectContext.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/common/runGoScript/$spawnLoggedBashScript.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/common/runGoScript/buildCoderExecutionArtifactPaths.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/common/runGoScript/scriptExecutionLog.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/common/sleepWithCountdown.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/common/waitForSkippableWorldTimeDeadline.d.ts +1 -0
- package/esm/scripts/run-codex-prompts/common/withCoderWorkspaceLock.d.ts +9 -0
- package/esm/scripts/run-codex-prompts/git/CoderGitOperationError.d.ts +9 -0
- package/esm/scripts/run-codex-prompts/git/CoderPhasePersistence.d.ts +105 -0
- package/esm/scripts/run-codex-prompts/git/CoderPhaseRecovery.d.ts +43 -0
- package/esm/scripts/run-codex-prompts/git/buildCoderCheckCommitMessage.d.ts +11 -0
- package/esm/scripts/run-codex-prompts/git/coderCommitScope.d.ts +14 -1
- package/esm/scripts/run-codex-prompts/git/coderFinalizationFiles.d.ts +14 -0
- package/esm/scripts/run-codex-prompts/git/coderIndexLease.d.ts +11 -0
- package/esm/scripts/run-codex-prompts/git/coderRepositoryFiles.d.ts +6 -0
- package/esm/scripts/run-codex-prompts/git/coderRepositorySnapshot.d.ts +62 -0
- package/esm/scripts/run-codex-prompts/git/coderRepositoryView.d.ts +30 -0
- package/esm/scripts/run-codex-prompts/git/commitChanges.d.ts +36 -3
- package/esm/scripts/run-codex-prompts/git/gitLongPathsSupport.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/git/pullLatestChanges.d.ts +3 -1
- package/esm/scripts/run-codex-prompts/git/quoteGitArgument.d.ts +5 -0
- package/esm/scripts/run-codex-prompts/git/runGitCommand.d.ts +4 -0
- package/esm/scripts/run-codex-prompts/git/runWorkspaceGitWithIndexReadRetry.d.ts +7 -0
- package/esm/scripts/run-codex-prompts/git/workingTreeChanges.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/isolation/coderIsolationArtifacts.d.ts +16 -0
- package/esm/scripts/run-codex-prompts/isolation/coderIsolationIgnoredFiles.d.ts +18 -0
- package/esm/scripts/run-codex-prompts/isolation/createCoderIsolationWorktree.d.ts +1 -2
- package/esm/scripts/run-codex-prompts/isolation/mergeCoderIsolationWorktree.d.ts +5 -5
- package/esm/scripts/run-codex-prompts/isolation/preserveCoderIsolationRecovery.d.ts +3 -0
- package/esm/scripts/run-codex-prompts/isolation/runIsolatedPromptRound.d.ts +2 -2
- package/esm/scripts/run-codex-prompts/main/prepareCoderPromptExecution.d.ts +18 -0
- package/esm/scripts/run-codex-prompts/main/runCoderFix.d.ts +24 -0
- package/esm/scripts/run-codex-prompts/main/runPromptRound.d.ts +12 -2
- package/esm/scripts/run-codex-prompts/prompts/buildPromptRunTraceContent.d.ts +5 -2
- package/esm/scripts/run-codex-prompts/prompts/refreshPromptSelection.d.ts +6 -0
- package/esm/scripts/run-codex-prompts/prompts/writePromptErrorLog.d.ts +4 -0
- package/esm/scripts/run-codex-prompts/prompts/writePromptFile.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/prompts/writePromptRunTrace.d.ts +2 -0
- package/esm/scripts/run-codex-prompts/server/buildCoderServerPromptResponse.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/ui/buildCoderCheckRepairUiFrame.d.ts +3 -0
- package/esm/scripts/run-codex-prompts/ui/output/CoderOutputEvent.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/ui/output/CoderRunOutput.d.ts +2 -2
- package/esm/scripts/run-codex-prompts/ui/renderCoderRunUi.d.ts +4 -0
- package/esm/src/cli/cli-commands/coder/add.d.ts +7 -2
- package/esm/src/cli/cli-commands/coder/ensureCoderGitattributesFile.d.ts +13 -0
- package/esm/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/fix.d.ts +7 -0
- package/esm/src/cli/cli-commands/coder/fix.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/fixWorkflow.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/coderCheckCliOptions.d.ts +1 -1
- package/esm/src/cli/cli-commands/common/ensureProjectTextFile.d.ts +7 -0
- package/esm/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +3 -1
- package/esm/src/cli/cli-commands/common/validateCoderRunOptions.d.ts +1 -1
- package/esm/src/cli/cli-commands/common/workspaceRepository.d.ts +12 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/cli/cli-commands/coder/add.ts +20 -3
- package/src/cli/cli-commands/coder/ensureCoderGitattributesFile.ts +25 -0
- package/src/cli/cli-commands/coder/ensureCoderGitignoreFile.ts +3 -3
- package/src/cli/cli-commands/coder/ensureCoderMarkdownFile.ts +2 -20
- package/src/cli/cli-commands/coder/fix.ts +166 -0
- package/src/cli/cli-commands/coder/fixtures/fix.cjs +29 -0
- package/src/cli/cli-commands/coder/fixtures/healthyDisk.cjs +4 -0
- package/src/cli/cli-commands/coder/getCoderInitializationCommitPaths.ts +2 -0
- package/src/cli/cli-commands/coder/init.ts +3 -1
- package/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.ts +7 -0
- package/src/cli/cli-commands/coder/planning/fixtures/coding.cjs +4 -0
- package/src/cli/cli-commands/coder/printInitializationSummary.ts +2 -0
- package/src/cli/cli-commands/coder/promptsReadmeTemplate.ts +25 -1
- package/src/cli/cli-commands/coder/run.ts +17 -8
- package/src/cli/cli-commands/coder/server.ts +9 -6
- package/src/cli/cli-commands/coder.ts +4 -0
- package/src/cli/cli-commands/common/coderCheckCliOptions.ts +7 -6
- package/src/cli/cli-commands/common/ensureProjectTextFile.ts +35 -0
- package/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.ts +13 -0
- package/src/cli/cli-commands/common/validateCoderRunOptions.ts +16 -1
- package/src/cli/cli-commands/common/workspaceRepository.ts +61 -13
- package/src/other/templates/getTemplatesPipelineCollection.ts +1825 -1089
- package/src/utils/execCommand/$execCommand.ts +2 -1
- package/src/version.ts +2 -2
- package/src/versions.txt +1 -0
- package/umd/index.umd.js +36204 -33273
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/checks/CoderCheckExecutionError.d.ts +6 -0
- package/umd/scripts/run-codex-prompts/checks/CoderCheckFailedError.d.ts +6 -0
- package/umd/scripts/run-codex-prompts/checks/buildCheckBeforeScriptPath.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/checks/createCheckBeforeRepairPrompt.d.ts +3 -1
- package/umd/scripts/run-codex-prompts/checks/runCheckBefore.d.ts +5 -0
- package/umd/scripts/run-codex-prompts/checks/runCoderCheck.d.ts +17 -0
- package/umd/scripts/run-codex-prompts/checks/runCoderCheckRepair.d.ts +40 -0
- package/umd/scripts/run-codex-prompts/checks/runPromptWithCheckFeedback.d.ts +5 -0
- package/umd/scripts/run-codex-prompts/common/createFreeDiskSpaceGuard.d.ts +3 -0
- package/umd/scripts/run-codex-prompts/common/resolveCoderProjectContext.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/common/runGoScript/$spawnLoggedBashScript.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/common/runGoScript/buildCoderExecutionArtifactPaths.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/common/runGoScript/scriptExecutionLog.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/common/sleepWithCountdown.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/common/waitForSkippableWorldTimeDeadline.d.ts +1 -0
- package/umd/scripts/run-codex-prompts/common/withCoderWorkspaceLock.d.ts +9 -0
- package/umd/scripts/run-codex-prompts/git/CoderGitOperationError.d.ts +9 -0
- package/umd/scripts/run-codex-prompts/git/CoderPhasePersistence.d.ts +105 -0
- package/umd/scripts/run-codex-prompts/git/CoderPhaseRecovery.d.ts +43 -0
- package/umd/scripts/run-codex-prompts/git/buildCoderCheckCommitMessage.d.ts +11 -0
- package/umd/scripts/run-codex-prompts/git/coderCommitScope.d.ts +14 -1
- package/umd/scripts/run-codex-prompts/git/coderFinalizationFiles.d.ts +14 -0
- package/umd/scripts/run-codex-prompts/git/coderIndexLease.d.ts +11 -0
- package/umd/scripts/run-codex-prompts/git/coderRepositoryFiles.d.ts +6 -0
- package/umd/scripts/run-codex-prompts/git/coderRepositorySnapshot.d.ts +62 -0
- package/umd/scripts/run-codex-prompts/git/coderRepositoryView.d.ts +30 -0
- package/umd/scripts/run-codex-prompts/git/commitChanges.d.ts +36 -3
- package/umd/scripts/run-codex-prompts/git/gitLongPathsSupport.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/git/pullLatestChanges.d.ts +3 -1
- package/umd/scripts/run-codex-prompts/git/quoteGitArgument.d.ts +5 -0
- package/umd/scripts/run-codex-prompts/git/runGitCommand.d.ts +4 -0
- package/umd/scripts/run-codex-prompts/git/runWorkspaceGitWithIndexReadRetry.d.ts +7 -0
- package/umd/scripts/run-codex-prompts/git/workingTreeChanges.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/isolation/coderIsolationArtifacts.d.ts +16 -0
- package/umd/scripts/run-codex-prompts/isolation/coderIsolationIgnoredFiles.d.ts +18 -0
- package/umd/scripts/run-codex-prompts/isolation/createCoderIsolationWorktree.d.ts +1 -2
- package/umd/scripts/run-codex-prompts/isolation/mergeCoderIsolationWorktree.d.ts +5 -5
- package/umd/scripts/run-codex-prompts/isolation/preserveCoderIsolationRecovery.d.ts +3 -0
- package/umd/scripts/run-codex-prompts/isolation/runIsolatedPromptRound.d.ts +2 -2
- package/umd/scripts/run-codex-prompts/main/prepareCoderPromptExecution.d.ts +18 -0
- package/umd/scripts/run-codex-prompts/main/runCoderFix.d.ts +24 -0
- package/umd/scripts/run-codex-prompts/main/runPromptRound.d.ts +12 -2
- package/umd/scripts/run-codex-prompts/prompts/buildPromptRunTraceContent.d.ts +5 -2
- package/umd/scripts/run-codex-prompts/prompts/refreshPromptSelection.d.ts +6 -0
- package/umd/scripts/run-codex-prompts/prompts/writePromptErrorLog.d.ts +4 -0
- package/umd/scripts/run-codex-prompts/prompts/writePromptFile.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/prompts/writePromptRunTrace.d.ts +2 -0
- package/umd/scripts/run-codex-prompts/server/buildCoderServerPromptResponse.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/ui/buildCoderCheckRepairUiFrame.d.ts +3 -0
- package/umd/scripts/run-codex-prompts/ui/output/CoderOutputEvent.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/ui/output/CoderRunOutput.d.ts +2 -2
- package/umd/scripts/run-codex-prompts/ui/renderCoderRunUi.d.ts +4 -0
- package/umd/src/cli/cli-commands/coder/add.d.ts +7 -2
- package/umd/src/cli/cli-commands/coder/ensureCoderGitattributesFile.d.ts +13 -0
- package/umd/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +1 -1
- package/umd/src/cli/cli-commands/coder/fix.d.ts +7 -0
- package/umd/src/cli/cli-commands/coder/fix.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/fixWorkflow.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/coderCheckCliOptions.d.ts +1 -1
- package/umd/src/cli/cli-commands/common/ensureProjectTextFile.d.ts +7 -0
- package/umd/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +3 -1
- package/umd/src/cli/cli-commands/common/validateCoderRunOptions.d.ts +1 -1
- package/umd/src/cli/cli-commands/common/workspaceRepository.d.ts +12 -0
- package/umd/src/version.d.ts +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NotAllowed } from '../../../src/errors/NotAllowed';
|
|
2
|
+
/** A command which could not execute/finish is different from completed validation reporting a failure. */
|
|
3
|
+
export declare class CoderCheckExecutionError extends NotAllowed {
|
|
4
|
+
/** Retains the real execution error; this category never requests a paid check repair. */
|
|
5
|
+
constructor(command: string, details: string);
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NotAllowed } from '../../../src/errors/NotAllowed';
|
|
2
|
+
/** A real check failure after the bounded feedback policy, which must not start another round of retries. */
|
|
3
|
+
export declare class CoderCheckFailedError extends NotAllowed {
|
|
4
|
+
/** Creates a check failure with the selected command's diagnostic output. */
|
|
5
|
+
constructor(message: string);
|
|
6
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { PromptSelection } from '../prompts/types/PromptSelection';
|
|
2
2
|
/**
|
|
3
|
-
* Creates
|
|
3
|
+
* Creates one explicitly selected PRD to repair a pre-existing project check failure.
|
|
4
4
|
*/
|
|
5
5
|
export declare function createCheckBeforeRepairPrompt(options: {
|
|
6
6
|
readonly projectPath: string;
|
|
7
7
|
readonly checkCommand: string;
|
|
8
8
|
readonly checkOutput: string;
|
|
9
|
+
/** Run may return to its queue after this repair; fix must exit after repairing only these failures. */
|
|
10
|
+
readonly intent?: 'run' | 'fix';
|
|
9
11
|
}): Promise<PromptSelection>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { WaitForCoderRunPauseCheckpoint } from '../common/CoderRunPauseCheckpoint';
|
|
2
2
|
import { runPromptCheckCommand } from './runPromptCheckCommand';
|
|
3
|
+
import type { CoderPhasePersistence } from '../git/CoderPhasePersistence';
|
|
3
4
|
/**
|
|
4
5
|
* Result of the check command executed before coding starts.
|
|
5
6
|
*/
|
|
@@ -23,4 +24,8 @@ export declare function runCheckBefore(options: {
|
|
|
23
24
|
readonly runPromptCheckCommandExecutor?: typeof runPromptCheckCommand;
|
|
24
25
|
/** Optional cancellation forwarded to the shared command runner. */
|
|
25
26
|
readonly signal?: AbortSignal;
|
|
27
|
+
/** Preserve the initial check's successful script under the same artifact policy as repair checks. */
|
|
28
|
+
readonly preserveLogs?: boolean;
|
|
29
|
+
/** Shared phase ownership/persistence, independent of check reporting. */
|
|
30
|
+
readonly persistence?: CoderPhasePersistence;
|
|
26
31
|
}): Promise<CheckBeforeResult>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CoderPhasePersistence } from '../git/CoderPhasePersistence';
|
|
2
|
+
import type { CoderCheckOutcome } from './CoderCheckOutcome';
|
|
3
|
+
import { runPromptCheckCommand, type RunPromptCheckCommandOptions } from './runPromptCheckCommand';
|
|
4
|
+
/** Typed execution result separate from persistence, usable by initial checks and bounded check feedback. */
|
|
5
|
+
export type CoderCheckResult = {
|
|
6
|
+
readonly outcome: CoderCheckOutcome;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Executes one selected command, captures its content/index boundaries and persists its actual transformation.
|
|
10
|
+
* Persistence errors escape this service and must never be mistaken for check failures or model feedback.
|
|
11
|
+
*/
|
|
12
|
+
export declare function runCoderCheck(options: RunPromptCheckCommandOptions & {
|
|
13
|
+
readonly phase: 'pre-coding' | 'post-implementation';
|
|
14
|
+
readonly attempt?: number;
|
|
15
|
+
readonly persistence?: CoderPhasePersistence;
|
|
16
|
+
readonly executor?: typeof runPromptCheckCommand;
|
|
17
|
+
}): Promise<CoderCheckResult>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { WorkspaceRepositoryContext } from '../../../src/cli/cli-commands/common/workspaceRepository';
|
|
2
|
+
import type { WaitForCoderRunPauseCheckpoint } from '../common/CoderRunPauseCheckpoint';
|
|
3
|
+
import { type CoderCommitScope } from '../git/coderCommitScope';
|
|
4
|
+
import type { PromptSelection } from '../prompts/types/PromptSelection';
|
|
5
|
+
import type { CheckBeforeMode } from './CheckBeforeMode';
|
|
6
|
+
/** Explicit outcome of a check/repair job, independent of any ordinary prompt queue or terminal. */
|
|
7
|
+
export type CoderCheckRepairResult = {
|
|
8
|
+
readonly kind: 'skipped' | 'passed-without-repair' | 'repaired-and-verified' | 'checks-failed' | 'setup-error' | 'execution-error' | 'interrupted' | 'persistence-error';
|
|
9
|
+
readonly isCheckPassed: boolean;
|
|
10
|
+
readonly repairPrompt?: PromptSelection;
|
|
11
|
+
readonly error?: unknown;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Inputs to the shared check/repair phase. The caller owns the workspace mutation lock for its entire lifecycle.
|
|
15
|
+
* Execution is prepared lazily and receives the exact authored selection, never a scheduler result.
|
|
16
|
+
*/
|
|
17
|
+
export type CoderCheckRepairOptions = {
|
|
18
|
+
readonly projectPath: string;
|
|
19
|
+
readonly workspace?: WorkspaceRepositoryContext;
|
|
20
|
+
readonly checkCommand: string;
|
|
21
|
+
readonly mode: CheckBeforeMode;
|
|
22
|
+
readonly intent: 'run' | 'fix';
|
|
23
|
+
readonly isCommitEnabled: boolean;
|
|
24
|
+
readonly isAutoPushEnabled: boolean;
|
|
25
|
+
readonly isWorkingTreeCleanRequired: boolean;
|
|
26
|
+
readonly preserveLogs?: boolean;
|
|
27
|
+
readonly signal?: AbortSignal;
|
|
28
|
+
readonly ownershipScope?: CoderCommitScope;
|
|
29
|
+
readonly onScopeRetained?: (scope: CoderCommitScope) => void;
|
|
30
|
+
readonly waitForPauseCheckpoint?: WaitForCoderRunPauseCheckpoint;
|
|
31
|
+
readonly onInitialCheckStarted?: () => void;
|
|
32
|
+
readonly onInitialCheckFinished?: () => void;
|
|
33
|
+
readonly onRepairCreated?: (selection: PromptSelection) => Promise<void>;
|
|
34
|
+
readonly prepareRepair: () => Promise<(selection: PromptSelection, commitScope?: CoderCommitScope) => Promise<void>>;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Runs the initial check, records its scoped changes and optionally executes one repair with shared feedback.
|
|
38
|
+
* Run may continue its queue after this returns; fix always exits. This service never loads or selects queued work.
|
|
39
|
+
*/
|
|
40
|
+
export declare function runCoderCheckRepair(options: CoderCheckRepairOptions): Promise<CoderCheckRepairResult>;
|
|
@@ -4,6 +4,7 @@ import type { PromptRunOptions } from '../runners/types/PromptRunOptions';
|
|
|
4
4
|
import type { PromptRunResult } from '../runners/types/PromptRunResult';
|
|
5
5
|
import type { PromptRunner } from '../runners/types/PromptRunner';
|
|
6
6
|
import { runPromptCheckCommand } from './runPromptCheckCommand';
|
|
7
|
+
import type { CoderPhasePersistence } from '../git/CoderPhasePersistence';
|
|
7
8
|
/**
|
|
8
9
|
* Options for running one prompt with optional check feedback retries.
|
|
9
10
|
*/
|
|
@@ -12,12 +13,16 @@ type RunPromptWithCheckFeedbackOptions = PromptRunOptions & {
|
|
|
12
13
|
promptLabel: string;
|
|
13
14
|
checkCommand?: string;
|
|
14
15
|
onAttemptStarted?: (attemptCount: number) => void;
|
|
16
|
+
/** Completes scoped transformations before verification inspects the content to be persisted. */
|
|
17
|
+
onBeforeCheck?: () => Promise<void>;
|
|
15
18
|
/**
|
|
16
19
|
* Notified right before each implementation, checking and fixing step starts, so the caller can
|
|
17
20
|
* record the in-progress state of the prompt.
|
|
18
21
|
*/
|
|
19
22
|
onStepStarted?: OnCoderRunStepStarted;
|
|
20
23
|
runPromptCheckCommandExecutor?: typeof runPromptCheckCommand;
|
|
24
|
+
/** Shares exact phase attribution with pre-coding checks, server runs and repair-only jobs. */
|
|
25
|
+
persistence?: CoderPhasePersistence;
|
|
21
26
|
};
|
|
22
27
|
/**
|
|
23
28
|
* Successful prompt execution result enriched with the number of attempts it took and its per-step usage breakdown.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FreeDiskSpaceStatus } from '../../../src/cli/cli-commands/common/disk-space/FreeDiskSpaceStatus';
|
|
1
2
|
/**
|
|
2
3
|
* Measures the free disk space of a run which is already in progress and requests a pause when it became critical.
|
|
3
4
|
*
|
|
@@ -22,4 +23,6 @@ export declare function createFreeDiskSpaceGuard(options: {
|
|
|
22
23
|
* Whether the run may stop and wait for somebody to free the disk space, disabled by `--no-questions`.
|
|
23
24
|
*/
|
|
24
25
|
readonly isAskingQuestionsEnabled: boolean;
|
|
26
|
+
/** Finite jobs can stop through their own lifecycle instead of entering the global queue pause state. */
|
|
27
|
+
readonly onCriticalDiskSpace?: (status: FreeDiskSpaceStatus) => Promise<void>;
|
|
25
28
|
}): FreeDiskSpaceGuard;
|
|
@@ -14,4 +14,6 @@ export declare function resolveCoderProjectContext(options: {
|
|
|
14
14
|
readonly projectPath: string;
|
|
15
15
|
readonly agent?: string;
|
|
16
16
|
readonly context?: string;
|
|
17
|
+
/** Fix can defer the default Book until a failed check actually needs a coding agent. */
|
|
18
|
+
readonly isDefaultAgentDeferred?: boolean;
|
|
17
19
|
}): Promise<ResolvedCoderProjectContext>;
|
|
@@ -10,6 +10,8 @@ type SpawnLoggedBashScriptOptions = {
|
|
|
10
10
|
readonly projectPath?: string;
|
|
11
11
|
readonly scriptPath: string;
|
|
12
12
|
readonly logPath?: string;
|
|
13
|
+
/** Whether shell startup loads login profiles; harnesses retain the default login shell. */
|
|
14
|
+
readonly isLoginShell?: boolean;
|
|
13
15
|
/**
|
|
14
16
|
* Process which owns the temporary harness shell. Defaults to the current coder process.
|
|
15
17
|
*/
|
|
@@ -18,7 +18,7 @@ export declare const PTBK_CODER_CANCEL_COMMAND = "PTBK_CANCEL_OWNED_HARNESS";
|
|
|
18
18
|
/**
|
|
19
19
|
* Shapes one bash invocation that optionally mirrors live script output into a temporary log file.
|
|
20
20
|
*/
|
|
21
|
-
export declare function buildLoggedBashExecution(scriptPath: string, logPath?: string): {
|
|
21
|
+
export declare function buildLoggedBashExecution(scriptPath: string, logPath?: string, isLoginShell?: boolean): {
|
|
22
22
|
args: string[];
|
|
23
23
|
env?: Record<string, string>;
|
|
24
24
|
};
|
|
@@ -25,4 +25,6 @@ export declare function sleepWithCountdown(options: {
|
|
|
25
25
|
waitKind: CoderRunWaitKind;
|
|
26
26
|
isRichUiEnabled: boolean;
|
|
27
27
|
uiHandle?: CoderRunUiHandle;
|
|
28
|
+
/** Stops a finite repair's retry delay immediately when it is cancelled. */
|
|
29
|
+
signal?: AbortSignal;
|
|
28
30
|
}): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type WorkspaceRepositoryContext } from '../../../src/cli/cli-commands/common/workspaceRepository';
|
|
2
|
+
/**
|
|
3
|
+
* Owns checks, task creation, execution and persistence as one workspace job for run, server and fix.
|
|
4
|
+
* The baseline's `[^]` status excludes interrupted tasks but is not an atomic cross-process claim. This lease
|
|
5
|
+
* closes the creation/claim race without rewriting any backlog status. A stale lease needs explicit recovery.
|
|
6
|
+
*/
|
|
7
|
+
export declare function withCoderWorkspaceLock<T>(project: WorkspaceRepositoryContext | string, operation: () => Promise<T>, options?: {
|
|
8
|
+
readonly isNestedOwnershipAllowed?: boolean;
|
|
9
|
+
}): Promise<T>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NotAllowed } from '../../../src/errors/NotAllowed';
|
|
2
|
+
/** Persistence failures are terminal and must never cause another paid implementation attempt. */
|
|
3
|
+
export declare class CoderGitOperationError extends NotAllowed {
|
|
4
|
+
readonly operation: 'commit' | 'push' | 'pull' | 'record';
|
|
5
|
+
/** Genuine validation outcome when persistence failed after the command completed. */
|
|
6
|
+
checkOutcome?: 'passed' | 'failed' | 'execution-error' | 'interrupted';
|
|
7
|
+
/** Creates a diagnostic that distinguishes an uncommitted result from a commit awaiting push. */
|
|
8
|
+
constructor(operation: 'commit' | 'push' | 'pull' | 'record', details: string);
|
|
9
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { CoderCheckOutcome } from '../checks/CoderCheckOutcome';
|
|
2
|
+
import type { CoderCommitScope } from './coderCommitScope';
|
|
3
|
+
import { type CoderFinalizationFile } from './coderFinalizationFiles';
|
|
4
|
+
import { type CoderRepositorySnapshot } from './coderRepositorySnapshot';
|
|
5
|
+
/** Durable provenance of a locally persisted phase; Git failures never retry implementation. */
|
|
6
|
+
export type CoderPhaseCommitResult = {
|
|
7
|
+
readonly phase: 'implementation' | 'repair' | 'checks' | 'finalization';
|
|
8
|
+
readonly paths: ReadonlyArray<string>;
|
|
9
|
+
readonly commit?: string;
|
|
10
|
+
readonly checkOutcome?: CoderCheckOutcome['kind'];
|
|
11
|
+
readonly attempt?: number;
|
|
12
|
+
};
|
|
13
|
+
/** Repository and selected-project policy, passed explicitly by finite run, server and check repair. */
|
|
14
|
+
export type CoderPhasePersistenceOptions = {
|
|
15
|
+
readonly scope: CoderCommitScope;
|
|
16
|
+
readonly isCommitEnabled: boolean;
|
|
17
|
+
readonly isAutoPushEnabled: boolean;
|
|
18
|
+
readonly implementationMessage?: string;
|
|
19
|
+
readonly task?: string;
|
|
20
|
+
readonly excludedPaths?: ReadonlyArray<string>;
|
|
21
|
+
readonly signal?: AbortSignal;
|
|
22
|
+
readonly onPersisted?: (result: CoderPhaseCommitResult) => void;
|
|
23
|
+
/** Carries exact uncommitted ownership through the same finite/server/repair job. */
|
|
24
|
+
readonly onRetained?: (scope: CoderCommitScope) => void;
|
|
25
|
+
/** Existing interactive commit confirmation runs before the first actual phase commit. */
|
|
26
|
+
readonly beforePersist?: () => Promise<void>;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Serializes phase ownership and persists captured versions, never the dirty filenames at finalization.
|
|
30
|
+
* The caller holds the shared workspace lease. Boundary checks detect edits outside owned activity, HEAD/index
|
|
31
|
+
* drift and collisions with pre-existing user content; ambiguity stops persistence with all bytes retained.
|
|
32
|
+
*/
|
|
33
|
+
export declare class CoderPhasePersistence {
|
|
34
|
+
private readonly options;
|
|
35
|
+
readonly commits: CoderPhaseCommitResult[];
|
|
36
|
+
private boundary;
|
|
37
|
+
private persistedBoundary;
|
|
38
|
+
private isMutationActive;
|
|
39
|
+
private isCommitConfirmationCompleted;
|
|
40
|
+
private readonly operation;
|
|
41
|
+
private implementationBoundary?;
|
|
42
|
+
private readonly recovery;
|
|
43
|
+
private readonly excludedPaths;
|
|
44
|
+
private readonly ownedPaths;
|
|
45
|
+
private persistenceHead?;
|
|
46
|
+
private persistenceIndex;
|
|
47
|
+
private persistenceIndexFlags;
|
|
48
|
+
/** Starts before implementation (or repair PRD creation), while holding workspace ownership. */
|
|
49
|
+
constructor(options: CoderPhasePersistenceOptions);
|
|
50
|
+
/** Adopts repair authoring/Book setup performed by the same lease owner since its pre-authoring scope. */
|
|
51
|
+
adoptPreparation(): Promise<void>;
|
|
52
|
+
/** Captures a quiescent content/index boundary in the execution checkout, including nested projects. */
|
|
53
|
+
private capture;
|
|
54
|
+
/** Detects unexpected writers before handing ownership to another subprocess or status writer. */
|
|
55
|
+
assertRetained(): Promise<void>;
|
|
56
|
+
/** Refuses known Coder status/artifact writes before they can overwrite pre-existing user content. */
|
|
57
|
+
assertWritablePaths(absolutePaths: ReadonlyArray<string>): Promise<void>;
|
|
58
|
+
/** Performs boundary validation within an already owned serialized activity. */
|
|
59
|
+
private assertRetainedContent;
|
|
60
|
+
/** Owns one agent, check or Coder bookkeeping mutation, and waits for all of its writes before snapshotting. */
|
|
61
|
+
mutate<T>(operation: () => Promise<T>, phase?: CoderPhaseCommitResult['phase']): Promise<T>;
|
|
62
|
+
/**
|
|
63
|
+
* Owns a check's private content view instead of assuming every live edit during its runtime belongs to it.
|
|
64
|
+
* Execution returns a typed real outcome; boundary/import/persistence errors bypass the repair retry loop.
|
|
65
|
+
*/
|
|
66
|
+
mutateCheck(execute: (projectPath: string) => Promise<CoderCheckOutcome>): Promise<CoderCheckOutcome>;
|
|
67
|
+
/** Retains partial activity output before validating ownership, even when the owned subprocess failed. */
|
|
68
|
+
private captureOwnedMutationBoundary;
|
|
69
|
+
/** Boundary immediately before a check, after status writes, normalization and the harness have finished. */
|
|
70
|
+
beforeCheck(): Promise<CoderRepositorySnapshot>;
|
|
71
|
+
/** Freezes the harness-authored version before Coder normalization/status writes and the check command. */
|
|
72
|
+
freezeImplementation(): void;
|
|
73
|
+
/** Includes known execution artifacts in Coder finalization, rather than attributing wrapper/log writes to checks. */
|
|
74
|
+
includeDurableArtifacts(paths?: ReadonlyArray<string>): Promise<void>;
|
|
75
|
+
/** Persists implementation/repair then the command delta, including a completed failing check. */
|
|
76
|
+
afterCheck(options: {
|
|
77
|
+
readonly before: CoderRepositorySnapshot;
|
|
78
|
+
readonly phase: 'pre-coding' | 'post-implementation';
|
|
79
|
+
readonly command: string;
|
|
80
|
+
readonly outcome: CoderCheckOutcome;
|
|
81
|
+
readonly attempt?: number;
|
|
82
|
+
}): Promise<ReadonlyArray<CoderPhaseCommitResult>>;
|
|
83
|
+
/** Records only Coder status/trace/normalization writes after genuinely passing checks and phase persistence. */
|
|
84
|
+
finalize(message?: string, files?: ReadonlyArray<CoderFinalizationFile>): Promise<void>;
|
|
85
|
+
/** Pushes existing local history only; a remote rejection cannot create duplicate commits. */
|
|
86
|
+
push(): Promise<void>;
|
|
87
|
+
/** Stops completion before publishing done when already persisted raw content is still dirty to Git. */
|
|
88
|
+
private assertPersistedPathsAreClean;
|
|
89
|
+
/** Reports retained operation-owned changes under no-commit without claiming unrelated user work is clean. */
|
|
90
|
+
outstandingPaths(): ReadonlyArray<string>;
|
|
91
|
+
/** Keeps failure details beside phase trees without overwriting potentially concurrent user artifacts. */
|
|
92
|
+
recordFailure(error: unknown): Promise<string | undefined>;
|
|
93
|
+
/** Original protected user boundary, supplied to the private check view before any result is applied. */
|
|
94
|
+
get operationSnapshot(): CoderRepositorySnapshot;
|
|
95
|
+
/** Current retained content together with the protected original user boundary. */
|
|
96
|
+
get currentCommitScope(): CoderCommitScope;
|
|
97
|
+
/** Known Coder wrapper/log paths never belong to a check command's transformation. */
|
|
98
|
+
get excludedArtifactPaths(): ReadonlyArray<string>;
|
|
99
|
+
/** Reserves ownership synchronously before the first await, including snapshots and Git persistence. */
|
|
100
|
+
private withOwnership;
|
|
101
|
+
/** Writes one exact phase delta using the shared commit execution and configured identity/signing. */
|
|
102
|
+
private persist;
|
|
103
|
+
/** A successful private commit updates only owned real-index entries; refresh that intentional boundary. */
|
|
104
|
+
private refreshIndexBoundary;
|
|
105
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { CoderCommitScope } from './coderCommitScope';
|
|
2
|
+
import { type CoderRepositorySnapshot } from './coderRepositorySnapshot';
|
|
3
|
+
import type { CoderPhaseCommitResult } from './CoderPhasePersistence';
|
|
4
|
+
/** Exact persistence plan retained before Git can fail partway through the phase chronology. */
|
|
5
|
+
export type CoderPhasePersistenceRecord = {
|
|
6
|
+
readonly phase: CoderPhaseCommitResult['phase'];
|
|
7
|
+
readonly beforeTree: string;
|
|
8
|
+
readonly afterTree: string;
|
|
9
|
+
readonly retainedTree: string;
|
|
10
|
+
readonly message: string;
|
|
11
|
+
readonly paths: ReadonlyArray<string>;
|
|
12
|
+
readonly checkOutcome?: CoderPhaseCommitResult['checkOutcome'];
|
|
13
|
+
readonly attempt?: number;
|
|
14
|
+
readonly isCommitEnabled: boolean;
|
|
15
|
+
};
|
|
16
|
+
/** Durable original bytes/index and successive phase trees, outside the user's working tree. */
|
|
17
|
+
export declare class CoderPhaseRecovery {
|
|
18
|
+
private readonly scope;
|
|
19
|
+
private readonly id;
|
|
20
|
+
private directory?;
|
|
21
|
+
private sequence;
|
|
22
|
+
/** Records content from exactly the same explicit operation scope as commit persistence. */
|
|
23
|
+
constructor(scope: CoderCommitScope);
|
|
24
|
+
/** Saves originals before any owned writer can touch them, preserving raw bytes as well as staged blobs. */
|
|
25
|
+
initialize(snapshot: CoderRepositorySnapshot): Promise<void>;
|
|
26
|
+
/** Writes original raw files and immutable staging references before the first owned process starts. */
|
|
27
|
+
private initializeFiles;
|
|
28
|
+
/** Retains immutable trees through GC and names each boundary for interruption/manual persistence recovery. */
|
|
29
|
+
record(snapshot: CoderRepositorySnapshot, phase: string, details?: {
|
|
30
|
+
readonly viewPath: string;
|
|
31
|
+
readonly checkOutcome: string;
|
|
32
|
+
readonly output: string;
|
|
33
|
+
readonly ignoredFileHashes?: ReadonlyArray<readonly [string, string]>;
|
|
34
|
+
}): Promise<void>;
|
|
35
|
+
/** Records which version belongs to which authoring phase before any local commit is attempted. */
|
|
36
|
+
planPersistence(record: CoderPhasePersistenceRecord): Promise<string | undefined>;
|
|
37
|
+
/** Updates the same plan after successful local persistence, without claiming remote synchronization. */
|
|
38
|
+
finishPersistence(path: string | undefined, result: CoderPhaseCommitResult): Promise<void>;
|
|
39
|
+
/** Preserves a failure diagnostic in a unique supported recovery location without replacing user files. */
|
|
40
|
+
recordFailure(error: unknown, commits: ReadonlyArray<CoderPhaseCommitResult>): Promise<string | undefined>;
|
|
41
|
+
/** Location included in diagnostics, without dumping private user file contents into terminal output. */
|
|
42
|
+
get path(): string | undefined;
|
|
43
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CoderCheckOutcome } from '../checks/CoderCheckOutcome';
|
|
2
|
+
/** Subject shared by pre-coding checks and every post-implementation/recheck attempt. */
|
|
3
|
+
export declare const AUTOMATIC_CHECK_CHANGES_COMMIT_MESSAGE = "chore: Automatically commit changes made by checks";
|
|
4
|
+
/** Builds truthful phase/check/task metadata without promoting failed verification to a pass. */
|
|
5
|
+
export declare function buildCoderCheckCommitMessage(options: {
|
|
6
|
+
readonly phase: 'pre-coding' | 'post-implementation';
|
|
7
|
+
readonly command: string;
|
|
8
|
+
readonly outcome: CoderCheckOutcome;
|
|
9
|
+
readonly task?: string;
|
|
10
|
+
readonly attempt?: number;
|
|
11
|
+
}): string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type WorkspaceRepositoryContext } from '../../../src/cli/cli-commands/common/workspaceRepository';
|
|
2
2
|
import type { WorkingTreeChangesSnapshot } from './workingTreeChanges';
|
|
3
|
+
import { type CoderRepositorySnapshot } from './coderRepositorySnapshot';
|
|
3
4
|
/**
|
|
4
5
|
* Working tree state captured right before one `ptbk coder` operation starts changing the project.
|
|
5
6
|
*
|
|
@@ -17,6 +18,10 @@ export type CoderCommitScope = {
|
|
|
17
18
|
* Files which were already changed before the operation started.
|
|
18
19
|
*/
|
|
19
20
|
readonly snapshotBeforeOperation: WorkingTreeChangesSnapshot;
|
|
21
|
+
/** Content/index ownership boundary needed to persist successive versions of the same path. */
|
|
22
|
+
readonly repositorySnapshot?: CoderRepositorySnapshot;
|
|
23
|
+
/** Protected user boundary carried through uncommitted check/repair/queue phases of the same job. */
|
|
24
|
+
readonly ownershipSnapshot?: CoderRepositorySnapshot;
|
|
20
25
|
};
|
|
21
26
|
/**
|
|
22
27
|
* Captures the working tree state before one `ptbk coder` operation changes anything.
|
|
@@ -24,7 +29,15 @@ export type CoderCommitScope = {
|
|
|
24
29
|
* The captured scope is passed to the commit of the very same operation, which then commits exactly the files
|
|
25
30
|
* this operation has created, changed, moved or deleted.
|
|
26
31
|
*/
|
|
27
|
-
export declare function captureCoderCommitScope(project: string | WorkspaceRepositoryContext
|
|
32
|
+
export declare function captureCoderCommitScope(project: string | WorkspaceRepositoryContext, options?: {
|
|
33
|
+
readonly isContentSnapshotRequired?: boolean;
|
|
34
|
+
readonly excludePaths?: ReadonlyArray<string>;
|
|
35
|
+
}): Promise<CoderCommitScope>;
|
|
36
|
+
/**
|
|
37
|
+
* Carries proven Coder-owned content into the next no-commit phase. An unchanged filename is insufficient:
|
|
38
|
+
* new user bytes, staging entries or flags since the last retained boundary become protected user work.
|
|
39
|
+
*/
|
|
40
|
+
export declare function continueCoderCommitScopeOwnership(scope: CoderCommitScope, previous?: CoderCommitScope, ownedPreparationPaths?: ReadonlyArray<string>): CoderCommitScope;
|
|
28
41
|
/**
|
|
29
42
|
* Resolves the repository-relative paths which one `ptbk coder` operation has really changed.
|
|
30
43
|
*
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { type CoderRepositorySnapshot } from './coderRepositorySnapshot';
|
|
4
|
+
/** A Coder status/trace candidate which is persisted before it becomes visible to queue readers. */
|
|
5
|
+
export type CoderFinalizationFile = {
|
|
6
|
+
readonly path: string;
|
|
7
|
+
readonly content: Buffer;
|
|
8
|
+
};
|
|
9
|
+
/** Builds a candidate tree through the shared private-index service without rewriting the live task status. */
|
|
10
|
+
export declare function buildCoderFinalizationSnapshot(retained: CoderRepositorySnapshot, files: ReadonlyArray<CoderFinalizationFile>): Promise<CoderRepositorySnapshot>;
|
|
11
|
+
/** Publishes already persisted candidates in caller order, with the selected task status last. */
|
|
12
|
+
export declare function publishCoderFinalizationFiles(retained: CoderRepositorySnapshot, files: ReadonlyArray<CoderFinalizationFile>): Promise<void>;
|
|
13
|
+
/** Refuses known status/script/log writers before they can follow a user symlink or replace a special file. */
|
|
14
|
+
export declare function assertCoderRegularWriterPath(repositoryRoot: string, absolutePath: string): Promise<void>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CoderTreeEntry } from './coderRepositorySnapshot';
|
|
2
|
+
/** Git's real index lease, independent of the private index used by normal commit hooks/signing. */
|
|
3
|
+
export type CoderIndexLease = {
|
|
4
|
+
/** Publishes exact owned entries while retaining every other staging entry and its flags. */
|
|
5
|
+
publish(entries: ReadonlyMap<string, CoderTreeEntry>, paths: ReadonlyArray<string>): Promise<void>;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Holds Git's standard index.lock across capture, hooks, signing and publication. A post-hoc comparison
|
|
9
|
+
* followed by update-index has a race: another git add could be overwritten between those two operations.
|
|
10
|
+
*/
|
|
11
|
+
export declare function withCoderIndexLease<T>(repositoryRoot: string, operation: (lease: CoderIndexLease) => Promise<T>): Promise<T>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type CoderTreeEntry } from './coderRepositorySnapshot';
|
|
2
|
+
/**
|
|
3
|
+
* Imports an already attributed raw leaf delta into a checkout. Callers validate source quiescence and
|
|
4
|
+
* destination ownership before calling, then verify retained bytes afterward using the shared snapshot service.
|
|
5
|
+
*/
|
|
6
|
+
export declare function applyCoderRepositoryFileDelta(sourceRoot: string, repositoryRoot: string, entries: ReadonlyMap<string, CoderTreeEntry>, paths: ReadonlyArray<string>): Promise<void>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Full filesystem permissions copied from a private check result without widening access to its files. */
|
|
2
|
+
export declare const CODER_FILE_PERMISSIONS_MASK = 511;
|
|
3
|
+
/** Retained execution checkouts are separate repositories, including those below a selected nested project. */
|
|
4
|
+
export declare const CODER_ISOLATION_WORKTREE_PATH_PATTERN: RegExp;
|
|
5
|
+
/** Content and mode of one leaf of a Git tree (including symlinks and binary blobs). */
|
|
6
|
+
export type CoderTreeEntry = {
|
|
7
|
+
readonly mode: string;
|
|
8
|
+
readonly objectId: string;
|
|
9
|
+
};
|
|
10
|
+
/** Non-destructive content/index boundary of a serialized Coder phase. */
|
|
11
|
+
export type CoderRepositorySnapshot = {
|
|
12
|
+
readonly repositoryRoot: string;
|
|
13
|
+
readonly head?: string;
|
|
14
|
+
readonly tree: string;
|
|
15
|
+
readonly entries: ReadonlyMap<string, CoderTreeEntry>;
|
|
16
|
+
readonly indexEntries: ReadonlyMap<string, CoderTreeEntry>;
|
|
17
|
+
/** Includes skip-worktree/assume-unchanged flags, which can hide pre-existing content from status. */
|
|
18
|
+
readonly indexFlags: ReadonlyMap<string, string>;
|
|
19
|
+
readonly indexFingerprint: string;
|
|
20
|
+
/** Raw bytes and filesystem modes, also detecting changes hidden by Git attributes/filters. */
|
|
21
|
+
readonly workingFileHashes: ReadonlyMap<string, string>;
|
|
22
|
+
/** Git's actual initial dirtiness, independent of clean-checkout smudge/line-ending transformations. */
|
|
23
|
+
readonly dirtyPaths: ReadonlyArray<string>;
|
|
24
|
+
};
|
|
25
|
+
/** Literal filenames must not inherit globbing settings from the user's environment. */
|
|
26
|
+
export declare const CODER_LITERAL_GIT_ENV: {
|
|
27
|
+
GIT_LITERAL_PATHSPECS: string;
|
|
28
|
+
GIT_GLOB_PATHSPECS: string;
|
|
29
|
+
GIT_NOGLOB_PATHSPECS: string;
|
|
30
|
+
GIT_ICASE_PATHSPECS: string;
|
|
31
|
+
};
|
|
32
|
+
/** Reads a tree using raw NUL-delimited filenames instead of Git's display quoting. */
|
|
33
|
+
export declare function readCoderTree(repositoryRoot: string, tree: string, env?: Record<string, string>): Promise<Map<string, CoderTreeEntry>>;
|
|
34
|
+
/** Parses either ls-tree or stage-zero ls-files output; unresolved merges cannot be persisted safely. */
|
|
35
|
+
export declare function parseCoderTreeEntries(output: string): Map<string, CoderTreeEntry>;
|
|
36
|
+
/** Reads an optional HEAD without treating arbitrary Git errors as an unborn branch. */
|
|
37
|
+
export declare function readCoderHead(repositoryRoot: string, env?: Record<string, string>): Promise<string | undefined>;
|
|
38
|
+
/** Builds a private index outside the working tree; the user's staging area is never used for snapshots. */
|
|
39
|
+
export declare function withCoderSnapshotIndex<T>(repositoryRoot: string, operation: (indexPath: string) => Promise<T>, gitEnvironment?: Record<string, string>): Promise<T>;
|
|
40
|
+
/** Captures retained bytes, a staged tree and the real index after the phase's owned writers have stopped. */
|
|
41
|
+
export declare function captureCoderRepositorySnapshot(repositoryRoot: string, excludePaths?: ReadonlyArray<string>, gitEnvironment?: Record<string, string>): Promise<CoderRepositorySnapshot>;
|
|
42
|
+
/** Hashes bytes, symlink targets and executable modes without following symlinks out of the checkout. */
|
|
43
|
+
export declare function readCoderWorkingFileHashes(repositoryRoot: string, paths: ReadonlyArray<string>, objectFormat: string): Promise<Map<string, string>>;
|
|
44
|
+
/**
|
|
45
|
+
* Captures ignored files for check-view retention, using the same raw byte/mode hashing as eligible content.
|
|
46
|
+
* These hashes never make ignored files eligible for an automatic Git commit.
|
|
47
|
+
*/
|
|
48
|
+
export declare function captureCoderIgnoredFileHashes(repositoryRoot: string, excludePaths: ReadonlyArray<string>): Promise<Map<string, string>>;
|
|
49
|
+
/** Keeps explicitly ignored new Coder artifacts out of the private commit index, just as ordinary staging does. */
|
|
50
|
+
export declare function isCoderGitPathIgnored(repositoryRoot: string, path: string): Promise<boolean>;
|
|
51
|
+
/** Compares raw retained content, including deletions. */
|
|
52
|
+
export declare function areCoderFileHashesEqual(left: ReadonlyMap<string, string>, right: ReadonlyMap<string, string>): boolean;
|
|
53
|
+
/** Lists the actual content/mode delta, even when a check reverts an earlier edit back to HEAD. */
|
|
54
|
+
export declare function listCoderTreeDelta(before: ReadonlyMap<string, CoderTreeEntry>, after: ReadonlyMap<string, CoderTreeEntry>): string[];
|
|
55
|
+
/** Writes exact blob/mode entries, including removals, into an explicit index. */
|
|
56
|
+
export declare function updateCoderIndex(repositoryRoot: string, entries: ReadonlyMap<string, CoderTreeEntry>, paths: ReadonlyArray<string>, env?: Record<string, string>): Promise<void>;
|
|
57
|
+
/** Includes original user working bytes, staging entries, hidden index flags and executable-bit changes. */
|
|
58
|
+
export declare function getCoderProtectedPaths(operation: CoderRepositorySnapshot, headEntries: ReadonlyMap<string, CoderTreeEntry>): ReadonlySet<string>;
|
|
59
|
+
/** Refuses overlapping user work, including staged content which differs from the working file. */
|
|
60
|
+
export declare function assertCoderDeltaIsOwned(operation: CoderRepositorySnapshot, paths: ReadonlyArray<string>, headEntries: ReadonlyMap<string, CoderTreeEntry>): void;
|
|
61
|
+
/** Materializes immutable staged entries in a private index so recovery references also retain staged blobs. */
|
|
62
|
+
export declare function captureCoderIndexTree(snapshot: CoderRepositorySnapshot): Promise<string>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type CoderRepositorySnapshot } from './coderRepositorySnapshot';
|
|
2
|
+
/** Private content view owned exclusively by one check, sharing the snapshot/commit service's Git objects. */
|
|
3
|
+
export type CoderRepositoryView = {
|
|
4
|
+
readonly directory: string;
|
|
5
|
+
readonly repositoryRoot: string;
|
|
6
|
+
readonly projectPath: string;
|
|
7
|
+
readonly isLinkedWorktree: boolean;
|
|
8
|
+
readonly before: CoderRepositorySnapshot;
|
|
9
|
+
readonly beforeIgnoredFileHashes: ReadonlyMap<string, string>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Copies the selected content into a private check checkout. A lease cannot exclude an unrelated editor from
|
|
13
|
+
* the live checkout; running checks here makes attribution independent of that editor's writes. Ignored
|
|
14
|
+
* dependencies/environment files are copied too, never hard-linked to writable user files.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createCoderRepositoryView(before: CoderRepositorySnapshot, projectPath: string, excludedPaths: ReadonlyArray<string>): Promise<CoderRepositoryView>;
|
|
17
|
+
/**
|
|
18
|
+
* Imports only the private command's content/mode delta after checking the live boundary and original user
|
|
19
|
+
* ownership. The real staging area is left intact; the shared commit service persists the phase's exact tree.
|
|
20
|
+
*/
|
|
21
|
+
export declare function applyCoderRepositoryView(view: CoderRepositoryView, after: CoderRepositorySnapshot, operation: CoderRepositorySnapshot, retained: CoderRepositorySnapshot, excludedPaths: ReadonlyArray<string>, afterIgnoredFileHashes: ReadonlyMap<string, string>): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Linked check views already share objects. An unborn branch uses a shared clone whose newly written objects
|
|
24
|
+
* must be transferred before recovery refs or phase commits can reference them in the execution repository.
|
|
25
|
+
*/
|
|
26
|
+
export declare function retainCoderRepositoryViewSnapshot(view: CoderRepositoryView, snapshot: CoderRepositorySnapshot, repositoryRoot: string): Promise<void>;
|
|
27
|
+
/** Detects unrelated live edits while the check has exclusive ownership of its private copy. */
|
|
28
|
+
export declare function assertLiveCheckBoundary(before: CoderRepositorySnapshot, excludedPaths: ReadonlyArray<string>, ignoredFileHashes?: ReadonlyMap<string, string>): Promise<void>;
|
|
29
|
+
/** Removes only an imported disposable copy; failed/ambiguous/interrupted views are kept for recovery. */
|
|
30
|
+
export declare function removeCoderRepositoryView(view: CoderRepositoryView, originalRoot: string): Promise<void>;
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
import { type CoderRepositorySnapshot, type CoderTreeEntry } from './coderRepositorySnapshot';
|
|
2
|
+
/** Captured content to commit without checking out an earlier version or disturbing the user's index. */
|
|
3
|
+
export type CoderSnapshotCommit = {
|
|
4
|
+
readonly operation: CoderRepositorySnapshot;
|
|
5
|
+
readonly before: CoderRepositorySnapshot;
|
|
6
|
+
readonly after: CoderRepositorySnapshot;
|
|
7
|
+
/** The retained working tree can already contain the following check's transformation. */
|
|
8
|
+
readonly retained: CoderRepositorySnapshot;
|
|
9
|
+
readonly excludedPaths?: ReadonlyArray<string>;
|
|
10
|
+
/** Expected live Git boundary, refreshed only by this operation's preceding local commit. */
|
|
11
|
+
readonly expectedHead?: string;
|
|
12
|
+
readonly expectedIndex?: ReadonlyMap<string, CoderTreeEntry>;
|
|
13
|
+
readonly expectedIndexFlags?: ReadonlyMap<string, string>;
|
|
14
|
+
};
|
|
15
|
+
/** Exact local persistence identity; callers never infer a successful commit from an arbitrary later HEAD. */
|
|
16
|
+
export type CoderCommitResult = {
|
|
17
|
+
readonly commit: string;
|
|
18
|
+
readonly tree: string;
|
|
19
|
+
readonly paths: ReadonlyArray<string>;
|
|
20
|
+
};
|
|
1
21
|
/**
|
|
2
22
|
* Commits staged changes with the provided message using the dedicated coding-agent identity when configured,
|
|
3
23
|
* otherwise falls back to the default Git configuration. Remote pushing is opt-in via `options.autoPush`,
|
|
@@ -14,11 +34,24 @@ export declare function commitChanges(message: string, options?: {
|
|
|
14
34
|
* Repository-relative paths which are relevant for the current operation.
|
|
15
35
|
*
|
|
16
36
|
* Only these paths are staged and only they end up in the created commit, so unrelated changes of the
|
|
17
|
-
* project are left in the working tree. Everything is committed when the paths are not provided at all
|
|
18
|
-
*
|
|
37
|
+
* project are left in the working tree. Everything is committed when the paths are not provided at all.
|
|
38
|
+
* An empty scope is a no-op; an explicitly allowed empty commit never absorbs the user's index.
|
|
19
39
|
*/
|
|
20
40
|
relevantPaths?: ReadonlyArray<string>;
|
|
21
41
|
excludePaths?: ReadonlyArray<string>;
|
|
22
42
|
projectPath?: string;
|
|
23
43
|
isEmptyCommitAllowed?: boolean;
|
|
24
|
-
|
|
44
|
+
/** Cancels only this job's Git commands, hooks and remote subprocesses. */
|
|
45
|
+
signal?: AbortSignal;
|
|
46
|
+
/** Phase content, rather than the current working files, is authoritative for this commit. */
|
|
47
|
+
snapshot?: CoderSnapshotCommit;
|
|
48
|
+
}): Promise<CoderCommitResult | undefined>;
|
|
49
|
+
/**
|
|
50
|
+
* Pushes the current branch after a successful commit.
|
|
51
|
+
*
|
|
52
|
+
* Behavior:
|
|
53
|
+
* - Uses `git push` when upstream exists.
|
|
54
|
+
* - Uses `git push --set-upstream` on first push when upstream is missing.
|
|
55
|
+
* - Skips pushing when upstream exists and there is nothing to push.
|
|
56
|
+
*/
|
|
57
|
+
export declare function pushCommittedChanges(projectPath: string, agentEnv?: Record<string, string>, signal?: AbortSignal): Promise<void>;
|
|
@@ -3,7 +3,7 @@ import type { $side_effect } from '../../../src/utils/organization/$side_effect'
|
|
|
3
3
|
* Builds the environment variables which add `core.longpaths=true` to every Git process started with them.
|
|
4
4
|
*
|
|
5
5
|
* Git configuration passed through `GIT_CONFIG_COUNT` is inherited by child processes, so one single
|
|
6
|
-
* environment covers the Git commands of the coder, of the coding agent and of the
|
|
6
|
+
* environment covers the Git commands of the coder, of the coding agent and of the check command alike.
|
|
7
7
|
*
|
|
8
8
|
* Returns an empty record when the given environment already configures `core.longpaths`, which keeps an
|
|
9
9
|
* explicit user setting untouched and keeps repeated calls from stacking duplicate entries.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pulls the latest repository changes before the next prompt starts.
|
|
3
3
|
*/
|
|
4
|
-
export declare function pullLatestChanges(projectPath?: string
|
|
4
|
+
export declare function pullLatestChanges(projectPath?: string, options?: {
|
|
5
|
+
readonly signal?: AbortSignal;
|
|
6
|
+
}): Promise<void>;
|