@slopus/beer 0.1.2 → 0.1.4
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/dist/_workflows/_index.d.ts +1 -1
- package/dist/_workflows/_index.js +7 -7
- package/dist/_workflows/bootstrap.d.ts +1 -1
- package/dist/_workflows/bootstrap.js +14 -14
- package/dist/_workflows/checkpointWorkflow.d.ts +1 -1
- package/dist/_workflows/checkpointWorkflow.js +2 -2
- package/dist/_workflows/context/context.d.ts +2 -2
- package/dist/_workflows/context/context.js +11 -11
- package/dist/_workflows/context/context.spec.js +1 -1
- package/dist/_workflows/context/utils/contextApplyConfig.d.ts +1 -1
- package/dist/_workflows/context/utils/contextApplyConfig.js +1 -1
- package/dist/_workflows/context/utils/contextApplyConfig.spec.js +1 -1
- package/dist/_workflows/context/utils/contextAskGithubRepo.d.ts +1 -1
- package/dist/_workflows/context/utils/contextAskGithubRepo.js +3 -3
- package/dist/_workflows/context/utils/contextAskGithubRepo.spec.js +1 -1
- package/dist/_workflows/context/utils/contextGitignoreEnsure.spec.js +1 -1
- package/dist/_workflows/context/utils/progressMultilineStart.spec.js +1 -1
- package/dist/_workflows/planWorkflow.d.ts +1 -1
- package/dist/_workflows/planWorkflow.js +9 -9
- package/dist/_workflows/ralphLoopWorkflow.d.ts +1 -1
- package/dist/_workflows/ralphLoopWorkflow.js +5 -5
- package/dist/_workflows/ralphWorkflow.d.ts +1 -1
- package/dist/_workflows/ralphWorkflow.js +5 -5
- package/dist/_workflows/researchWorkflow.d.ts +1 -1
- package/dist/_workflows/researchWorkflow.js +3 -3
- package/dist/_workflows/steps/generate.d.ts +2 -2
- package/dist/_workflows/steps/generate.js +3 -3
- package/dist/_workflows/steps/generateCommit.d.ts +1 -1
- package/dist/_workflows/steps/generateCommit.js +2 -2
- package/dist/_workflows/steps/generateDocument.d.ts +2 -2
- package/dist/_workflows/steps/generateDocument.js +3 -3
- package/dist/_workflows/steps/generateFrontmatter.d.ts +2 -2
- package/dist/_workflows/steps/generateFrontmatter.js +1 -1
- package/dist/_workflows/steps/generateProgressMessageResolve.d.ts +1 -1
- package/dist/_workflows/steps/generateReadme.d.ts +1 -1
- package/dist/_workflows/steps/generateReadme.js +2 -2
- package/dist/_workflows/steps/ralphExecute.d.ts +1 -1
- package/dist/_workflows/steps/ralphExecute.js +2 -2
- package/dist/_workflows/steps/ralphLoopExecute.d.ts +1 -1
- package/dist/_workflows/steps/ralphLoopExecute.js +2 -2
- package/dist/_workflows/steps/ralphLoopPlanGenerate.d.ts +1 -1
- package/dist/_workflows/steps/ralphLoopPlanGenerate.js +3 -3
- package/dist/_workflows/steps/ralphLoopPlanPathResolve.d.ts +1 -1
- package/dist/_workflows/steps/ralphLoopReviewRound.d.ts +1 -1
- package/dist/_workflows/steps/ralphLoopReviewRound.js +2 -2
- package/dist/_workflows/steps/ralphPlan.d.ts +1 -1
- package/dist/_workflows/steps/ralphPlan.js +6 -6
- package/dist/_workflows/steps/ralphPlanPathResolve.d.ts +1 -1
- package/dist/_workflows/steps/ralphReview.d.ts +1 -1
- package/dist/_workflows/steps/ralphReview.js +4 -4
- package/dist/main.js +5 -5
- package/dist/modules/ai/aiOutputExtract.spec.js +1 -1
- package/dist/modules/ai/generate.d.ts +2 -2
- package/dist/modules/ai/generate.js +5 -5
- package/dist/modules/ai/generate.spec.js +1 -1
- package/dist/modules/ai/generate.unit.spec.js +1 -1
- package/dist/modules/ai/generateEventTypes.d.ts +2 -2
- package/dist/modules/ai/generateFile.d.ts +2 -2
- package/dist/modules/ai/generateFile.js +2 -2
- package/dist/modules/ai/generateFile.spec.js +1 -1
- package/dist/modules/ai/generatePureSessionCreate.d.ts +3 -3
- package/dist/modules/ai/generatePureSessionCreate.js +1 -1
- package/dist/modules/ai/generatePureSessionCreate.spec.js +1 -1
- package/dist/modules/ai/generatePureText.d.ts +2 -2
- package/dist/modules/ai/generatePureText.js +5 -5
- package/dist/modules/ai/generatePureText.spec.js +1 -1
- package/dist/modules/ai/generateSessionCreate.d.ts +2 -2
- package/dist/modules/ai/generateSessionCreate.js +1 -1
- package/dist/modules/ai/generateSessionCreate.spec.js +1 -1
- package/dist/modules/ai/generateText.d.ts +2 -2
- package/dist/modules/ai/generateText.js +1 -1
- package/dist/modules/ai/generateText.spec.js +1 -1
- package/dist/modules/ai/generateVerify.spec.js +1 -1
- package/dist/modules/ai/providerGenerate.d.ts +3 -3
- package/dist/modules/ai/providerGenerate.js +2 -2
- package/dist/modules/ai/providerGenerate.spec.js +2 -2
- package/dist/modules/ai/providerGenerate.unit.spec.js +1 -1
- package/dist/modules/ai/providers/commandJSONL.d.ts +1 -1
- package/dist/modules/ai/providers/commandJSONL.js +2 -2
- package/dist/modules/ai/providers/commandJSONL.spec.js +1 -1
- package/dist/modules/ai/providers/piProviderGenerate.d.ts +1 -1
- package/dist/modules/ai/providers/piProviderGenerate.js +1 -1
- package/dist/modules/ai/providers/piProviderGenerate.spec.js +1 -1
- package/dist/modules/beer/beerOriginalPathResolve.spec.js +1 -1
- package/dist/modules/beer/beerSettingsRead.d.ts +1 -1
- package/dist/modules/beer/beerSettingsRead.spec.js +1 -1
- package/dist/modules/beer/beerSettingsTypes.d.ts +2 -2
- package/dist/modules/beer/beerSettingsWrite.d.ts +1 -1
- package/dist/modules/git/gitPush.js +1 -1
- package/dist/modules/git/gitRemoteEnsure.js +1 -1
- package/dist/modules/git/gitRepoCheckout.js +1 -1
- package/dist/modules/git/gitRepoCheckout.spec.js +2 -2
- package/dist/modules/git/gitRepoEnsure.js +1 -1
- package/dist/modules/git/gitRepoEnsure.spec.js +1 -1
- package/dist/modules/git/gitStageAndCommit.js +1 -1
- package/dist/modules/git/gitignoreEnsure.spec.js +1 -1
- package/dist/modules/github/githubCliEnsure.js +2 -2
- package/dist/modules/github/githubOwnerChoicesGet.js +1 -1
- package/dist/modules/github/githubRepoCreate.js +1 -1
- package/dist/modules/github/githubRepoExists.js +1 -1
- package/dist/modules/github/githubRepoNameResolve.d.ts +1 -1
- package/dist/modules/github/githubRepoNameResolve.js +1 -1
- package/dist/modules/github/githubRepoNameResolve.spec.js +1 -1
- package/dist/modules/github/githubRepoParse.d.ts +1 -1
- package/dist/modules/github/githubRepoParse.spec.js +1 -1
- package/dist/modules/github/githubRepoStatusGet.d.ts +1 -1
- package/dist/modules/github/githubRepoStatusGet.js +2 -2
- package/dist/modules/github/githubViewerGet.js +2 -2
- package/dist/modules/plan/planPromptChildren.d.ts +2 -2
- package/dist/modules/plan/planPromptChildren.spec.js +1 -1
- package/dist/modules/plan/planPromptDocument.d.ts +2 -2
- package/dist/modules/plan/planPromptDocument.spec.js +1 -1
- package/dist/modules/plan/planPromptPicker.d.ts +1 -1
- package/dist/modules/plan/planPromptPicker.js +1 -1
- package/dist/modules/plan/planPromptPicker.spec.js +1 -1
- package/dist/modules/plan/planPromptRoot.d.ts +1 -1
- package/dist/modules/plan/planPromptRoot.spec.js +1 -1
- package/dist/modules/plan/planSourceDocumentsResolve.d.ts +1 -1
- package/dist/modules/plan/planSourceDocumentsResolve.spec.js +1 -1
- package/dist/modules/providers/providerDetect.d.ts +1 -1
- package/dist/modules/providers/providerDetect.js +2 -2
- package/dist/modules/providers/providerDetect.spec.js +1 -1
- package/dist/modules/providers/providerModelSelect.d.ts +1 -1
- package/dist/modules/providers/providerModelSelect.spec.js +1 -1
- package/dist/modules/providers/providerModelsGet.d.ts +1 -1
- package/dist/modules/providers/providerModelsGet.js +1 -1
- package/dist/modules/providers/providerModelsGet.spec.js +1 -1
- package/dist/modules/providers/providerPriorityList.d.ts +1 -1
- package/dist/modules/providers/providerPriorityList.spec.js +1 -1
- package/dist/modules/sandbox/sandboxInferenceFilesystemPolicy.d.ts +1 -1
- package/dist/modules/sandbox/sandboxInferenceFilesystemPolicy.js +1 -1
- package/dist/modules/sandbox/sandboxInferenceFilesystemPolicy.spec.js +1 -1
- package/dist/modules/sandbox/sandboxInferenceGet.d.ts +2 -2
- package/dist/modules/sandbox/sandboxInferenceGet.js +1 -1
- package/dist/modules/sandbox/sandboxPassthrough.d.ts +1 -1
- package/dist/modules/sandbox/sandboxPassthrough.spec.js +1 -1
- package/dist/modules/tree/treeChildrenParse.d.ts +1 -1
- package/dist/modules/tree/treeChildrenRead.d.ts +1 -1
- package/dist/modules/tree/treeChildrenRead.spec.js +1 -1
- package/dist/modules/tree/treeChildrenWrite.d.ts +1 -1
- package/dist/modules/tree/treeChildrenWrite.spec.js +1 -1
- package/dist/modules/tree/treeInferenceProgressRun.d.ts +1 -1
- package/dist/modules/tree/treeInferenceProgressRun.js +1 -1
- package/dist/modules/tree/treeInferenceProgressRun.spec.js +1 -1
- package/dist/modules/tree/treeLeafPick.d.ts +1 -1
- package/dist/modules/tree/treeLeafPick.js +8 -8
- package/dist/modules/tree/treeLeafPick.spec.js +1 -1
- package/dist/modules/tree/treeNodeExpand.d.ts +1 -1
- package/dist/modules/tree/treeNodeExpand.js +8 -8
- package/dist/modules/tree/treeNodeExpand.spec.js +3 -3
- package/dist/modules/tree/treeNodePathResolve.d.ts +1 -1
- package/dist/modules/tree/treeNodeRead.d.ts +1 -1
- package/dist/modules/tree/treeNodeRead.spec.js +1 -1
- package/dist/modules/tree/treeNodeSlug.spec.js +1 -1
- package/dist/modules/tree/treeNodeWrite.d.ts +1 -1
- package/dist/modules/tree/treeNodeWrite.spec.js +1 -1
- package/dist/modules/tree/treeSearchRun.d.ts +1 -1
- package/dist/modules/tree/treeSearchRun.js +12 -12
- package/dist/modules/tree/treeSearchRun.spec.js +3 -3
- package/dist/modules/tree/treeSearchTypes.d.ts +1 -1
- package/dist/modules/tree/treeStateLeaves.d.ts +1 -1
- package/dist/modules/tree/treeStateLeaves.spec.js +1 -1
- package/dist/modules/tree/treeStateRead.d.ts +1 -1
- package/dist/modules/tree/treeStateRead.js +2 -2
- package/dist/modules/tree/treeStateRead.spec.js +1 -1
- package/dist/modules/tree/treeStateRender.d.ts +1 -1
- package/dist/modules/tree/treeStateRender.spec.js +1 -1
- package/dist/modules/util/asyncLock.spec.js +1 -1
- package/dist/modules/util/commandRun.d.ts +1 -1
- package/dist/modules/util/commandRun.js +2 -2
- package/dist/modules/util/commandRun.spec.js +1 -1
- package/dist/modules/util/pathLock.js +2 -2
- package/dist/modules/util/pathLock.spec.js +1 -1
- package/dist/modules/util/pathLockOverlap.spec.js +1 -1
- package/dist/release/releaseRun.js +3 -3
- package/dist/release/releaseVersionPrompt.js +3 -3
- package/dist/text/text.d.ts +2 -2
- package/dist/text/text.js +1 -1
- package/dist/text/text.spec.js +1 -1
- package/dist/text/textGenBuild.js +1 -1
- package/dist/text/textGenGenerate.spec.js +1 -1
- package/dist/types.d.ts +9 -9
- package/dist/types.js +1 -1
- package/package.json +3 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { beerLogLine } from "
|
|
3
|
-
import { providerGenerate } from "
|
|
4
|
-
import { providerModelSelect } from "
|
|
5
|
-
import { providerPriorityList } from "
|
|
6
|
-
import { sandboxInferenceGet } from "
|
|
2
|
+
import { beerLogLine } from "../../text/text.js";
|
|
3
|
+
import { providerGenerate } from "../../modules/ai/providerGenerate.js";
|
|
4
|
+
import { providerModelSelect } from "../../modules/providers/providerModelSelect.js";
|
|
5
|
+
import { providerPriorityList } from "../../modules/providers/providerPriorityList.js";
|
|
6
|
+
import { sandboxInferenceGet } from "../../modules/sandbox/sandboxInferenceGet.js";
|
|
7
7
|
function inferMessage(message, options) {
|
|
8
8
|
options?.onMessage?.(`[beer][infer] ${message}`);
|
|
9
9
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { generate } from "
|
|
3
|
+
import { generate } from "../../modules/ai/generate.js";
|
|
4
4
|
const TEST_TIMEOUT_MS = 180_000;
|
|
5
5
|
function commandExists(command) {
|
|
6
6
|
const result = spawnSync("zsh", ["-lc", `command -v ${command}`], {
|
|
@@ -15,7 +15,7 @@ vi.mock("@/modules/sandbox/sandboxInferenceGet.js", () => ({
|
|
|
15
15
|
vi.mock("@/modules/ai/providerGenerate.js", () => ({
|
|
16
16
|
providerGenerate: providerGenerateMock
|
|
17
17
|
}));
|
|
18
|
-
import { generate } from "
|
|
18
|
+
import { generate } from "../../modules/ai/generate.js";
|
|
19
19
|
describe("generate event parsing", () => {
|
|
20
20
|
beforeEach(() => {
|
|
21
21
|
providerPriorityListMock.mockReset();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ProviderEvent, ProviderTokenUsage } from "
|
|
2
|
-
import type { ProviderId } from "
|
|
1
|
+
import type { ProviderEvent, ProviderTokenUsage } from "../../modules/ai/providerEventTypes.js";
|
|
2
|
+
import type { ProviderId } from "../../modules/providers/providerTypes.js";
|
|
3
3
|
export interface GenerateProviderFailure {
|
|
4
4
|
providerId: ProviderId;
|
|
5
5
|
exitCode: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type GenerateExpectedFileOutputVerify, type GeneratePermissions } from "
|
|
2
|
-
import type { Context } from "
|
|
1
|
+
import { type GenerateExpectedFileOutputVerify, type GeneratePermissions } from "../../modules/ai/generate.js";
|
|
2
|
+
import type { Context } from "../../types.js";
|
|
3
3
|
export interface GenerateFilePermissions extends Omit<GeneratePermissions, "expectedOutput"> {
|
|
4
4
|
retries?: number;
|
|
5
5
|
verify?: GenerateExpectedFileOutputVerify;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mkdir, stat } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { generate } from "
|
|
4
|
-
import { beerOriginalPathResolve } from "
|
|
3
|
+
import { generate } from "../../modules/ai/generate.js";
|
|
4
|
+
import { beerOriginalPathResolve } from "../../modules/beer/beerOriginalPathResolve.js";
|
|
5
5
|
/**
|
|
6
6
|
* Generates content and asks the model to write it into a specific file path only.
|
|
7
7
|
* Retries when inference succeeds but the target file does not appear on disk.
|
|
@@ -6,7 +6,7 @@ const generateMock = vi.hoisted(() => vi.fn());
|
|
|
6
6
|
vi.mock("./generate.js", () => ({
|
|
7
7
|
generate: generateMock
|
|
8
8
|
}));
|
|
9
|
-
import { generateFile } from "
|
|
9
|
+
import { generateFile } from "../../modules/ai/generateFile.js";
|
|
10
10
|
describe("generateFile", () => {
|
|
11
11
|
beforeEach(() => {
|
|
12
12
|
generateMock.mockReset();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { GenerateResult } from "
|
|
2
|
-
import { type GeneratePureTextPermissions } from "
|
|
3
|
-
import type { Context } from "
|
|
1
|
+
import type { GenerateResult } from "../../modules/ai/generate.js";
|
|
2
|
+
import { type GeneratePureTextPermissions } from "../../modules/ai/generatePureText.js";
|
|
3
|
+
import type { Context } from "../../types.js";
|
|
4
4
|
export interface PureSession {
|
|
5
5
|
readonly sessionId?: string;
|
|
6
6
|
generate(prompt: string, permissions?: PureSessionGeneratePermissions): Promise<GenerateResult>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generatePureText } from "
|
|
1
|
+
import { generatePureText } from "../../modules/ai/generatePureText.js";
|
|
2
2
|
/**
|
|
3
3
|
* Creates a stateful pure-inference session that carries provider sessionId between calls.
|
|
4
4
|
* Expects: caller persists sessionId when they need to resume later.
|
|
@@ -3,7 +3,7 @@ const generatePureTextMock = vi.hoisted(() => vi.fn());
|
|
|
3
3
|
vi.mock("@/modules/ai/generatePureText.js", () => ({
|
|
4
4
|
generatePureText: generatePureTextMock
|
|
5
5
|
}));
|
|
6
|
-
import { generatePureSessionCreate } from "
|
|
6
|
+
import { generatePureSessionCreate } from "../../modules/ai/generatePureSessionCreate.js";
|
|
7
7
|
describe("generatePureSessionCreate", () => {
|
|
8
8
|
beforeEach(() => {
|
|
9
9
|
generatePureTextMock.mockReset();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { GenerateResult } from "
|
|
2
|
-
import type { Context, GenerateEvent, ProviderId, ProviderModelSelectionMode } from "
|
|
1
|
+
import type { GenerateResult } from "../../modules/ai/generate.js";
|
|
2
|
+
import type { Context, GenerateEvent, ProviderId, ProviderModelSelectionMode } from "../../types.js";
|
|
3
3
|
export interface GeneratePureTextPermissions {
|
|
4
4
|
sessionId?: string;
|
|
5
5
|
providerPriority?: readonly ProviderId[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { beerLogLine } from "
|
|
2
|
-
import { providerGenerate } from "
|
|
3
|
-
import { providerModelSelect } from "
|
|
4
|
-
import { providerPriorityList } from "
|
|
5
|
-
import { sandboxPassthrough } from "
|
|
1
|
+
import { beerLogLine } from "../../text/text.js";
|
|
2
|
+
import { providerGenerate } from "../../modules/ai/providerGenerate.js";
|
|
3
|
+
import { providerModelSelect } from "../../modules/providers/providerModelSelect.js";
|
|
4
|
+
import { providerPriorityList } from "../../modules/providers/providerPriorityList.js";
|
|
5
|
+
import { sandboxPassthrough } from "../../modules/sandbox/sandboxPassthrough.js";
|
|
6
6
|
function inferMessage(message, options) {
|
|
7
7
|
options?.onMessage?.(`[beer][infer] ${message}`);
|
|
8
8
|
}
|
|
@@ -11,7 +11,7 @@ vi.mock("@/modules/providers/providerModelSelect.js", () => ({
|
|
|
11
11
|
vi.mock("@/modules/ai/providerGenerate.js", () => ({
|
|
12
12
|
providerGenerate: providerGenerateMock
|
|
13
13
|
}));
|
|
14
|
-
import { generatePureText } from "
|
|
14
|
+
import { generatePureText } from "../../modules/ai/generatePureText.js";
|
|
15
15
|
describe("generatePureText", () => {
|
|
16
16
|
beforeEach(() => {
|
|
17
17
|
providerPriorityListMock.mockReset();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type GeneratePermissions, type GenerateResult } from "
|
|
2
|
-
import type { Context } from "
|
|
1
|
+
import { type GeneratePermissions, type GenerateResult } from "../../modules/ai/generate.js";
|
|
2
|
+
import type { Context } from "../../types.js";
|
|
3
3
|
export interface Session {
|
|
4
4
|
readonly sessionId?: string;
|
|
5
5
|
generate(prompt: string, permissions?: SessionGeneratePermissions): Promise<GenerateResult>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generate } from "
|
|
1
|
+
import { generate } from "../../modules/ai/generate.js";
|
|
2
2
|
/**
|
|
3
3
|
* Creates a stateful generate session that carries provider sessionId between calls.
|
|
4
4
|
* Expects: callers persist sessionId externally when they want to resume later.
|
|
@@ -3,7 +3,7 @@ const generateMock = vi.hoisted(() => vi.fn());
|
|
|
3
3
|
vi.mock("@/modules/ai/generate.js", () => ({
|
|
4
4
|
generate: generateMock
|
|
5
5
|
}));
|
|
6
|
-
import { generateSessionCreate } from "
|
|
6
|
+
import { generateSessionCreate } from "../../modules/ai/generateSessionCreate.js";
|
|
7
7
|
describe("generateSessionCreate", () => {
|
|
8
8
|
beforeEach(() => {
|
|
9
9
|
generateMock.mockReset();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type GenerateExpectedTextOutputVerify, type GeneratePermissions, type GenerateResult } from "
|
|
2
|
-
import type { Context } from "
|
|
1
|
+
import { type GenerateExpectedTextOutputVerify, type GeneratePermissions, type GenerateResult } from "../../modules/ai/generate.js";
|
|
2
|
+
import type { Context } from "../../types.js";
|
|
3
3
|
export interface GenerateTextPermissions extends Omit<GeneratePermissions, "expectedOutput"> {
|
|
4
4
|
verify?: GenerateExpectedTextOutputVerify;
|
|
5
5
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generate } from "
|
|
1
|
+
import { generate } from "../../modules/ai/generate.js";
|
|
2
2
|
/**
|
|
3
3
|
* Shortcut for text generation with default text expectation.
|
|
4
4
|
* Expects: prompt is inference task text and permissions optionally constrain provider/write policy.
|
|
@@ -3,7 +3,7 @@ const generateMock = vi.hoisted(() => vi.fn());
|
|
|
3
3
|
vi.mock("./generate.js", () => ({
|
|
4
4
|
generate: generateMock
|
|
5
5
|
}));
|
|
6
|
-
import { generateText } from "
|
|
6
|
+
import { generateText } from "../../modules/ai/generateText.js";
|
|
7
7
|
describe("generateText", () => {
|
|
8
8
|
beforeEach(() => {
|
|
9
9
|
generateMock.mockReset();
|
|
@@ -10,7 +10,7 @@ vi.mock("@/modules/ai/providerGenerate.js", () => ({
|
|
|
10
10
|
vi.mock("@/modules/sandbox/sandboxInferenceGet.js", () => ({
|
|
11
11
|
sandboxInferenceGet: sandboxInferenceGetMock
|
|
12
12
|
}));
|
|
13
|
-
import { generate } from "
|
|
13
|
+
import { generate } from "../../modules/ai/generate.js";
|
|
14
14
|
describe("generate expectedOutput verification", () => {
|
|
15
15
|
beforeEach(() => {
|
|
16
16
|
providerGenerateMock.mockReset();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { InferenceWritePolicy } from "
|
|
2
|
-
import type { CommandSandbox } from "
|
|
3
|
-
import type { ProviderEvent, ProviderId, ProviderTokenUsage } from "
|
|
1
|
+
import type { InferenceWritePolicy } from "../../modules/sandbox/sandboxInferenceTypes.js";
|
|
2
|
+
import type { CommandSandbox } from "../../modules/sandbox/sandboxTypes.js";
|
|
3
|
+
import type { ProviderEvent, ProviderId, ProviderTokenUsage } from "../../types.js";
|
|
4
4
|
export interface ProviderGenerateInput {
|
|
5
5
|
providerId: ProviderId;
|
|
6
6
|
command: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { aiOutputExtract } from "
|
|
2
|
-
import { piProviderGenerate } from "
|
|
1
|
+
import { aiOutputExtract } from "../../modules/ai/aiOutputExtract.js";
|
|
2
|
+
import { piProviderGenerate } from "../../modules/ai/providers/piProviderGenerate.js";
|
|
3
3
|
const OUTPUT_RETRY_PROMPT = "Error: your previous response did not include <output> tags. Continue this session and return only <output>...</output>.";
|
|
4
4
|
/**
|
|
5
5
|
* Runs provider inference through CLI and extracts response wrapped in <output> tags.
|
|
@@ -3,8 +3,8 @@ import { chmod, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { describe, expect, it } from "vitest";
|
|
6
|
-
import { providerGenerate } from "
|
|
7
|
-
import { sandboxInferenceGet } from "
|
|
6
|
+
import { providerGenerate } from "../../modules/ai/providerGenerate.js";
|
|
7
|
+
import { sandboxInferenceGet } from "../../modules/sandbox/sandboxInferenceGet.js";
|
|
8
8
|
const TEST_TIMEOUT_MS = 180_000;
|
|
9
9
|
function commandExists(command) {
|
|
10
10
|
const result = spawnSync("zsh", ["-lc", `command -v ${command}`], {
|
|
@@ -3,7 +3,7 @@ const piProviderGenerateMock = vi.hoisted(() => vi.fn());
|
|
|
3
3
|
vi.mock("@/modules/ai/providers/piProviderGenerate.js", () => ({
|
|
4
4
|
piProviderGenerate: piProviderGenerateMock
|
|
5
5
|
}));
|
|
6
|
-
import { providerGenerate } from "
|
|
6
|
+
import { providerGenerate } from "../../modules/ai/providerGenerate.js";
|
|
7
7
|
describe("providerGenerate", () => {
|
|
8
8
|
beforeEach(() => {
|
|
9
9
|
piProviderGenerateMock.mockReset();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
-
import { textFormatKey } from "
|
|
3
|
-
import { pathResolveFromInitCwd } from "
|
|
2
|
+
import { textFormatKey } from "../../../text/text.js";
|
|
3
|
+
import { pathResolveFromInitCwd } from "../../../modules/util/pathResolveFromInitCwd.js";
|
|
4
4
|
/**
|
|
5
5
|
* Runs a sandboxed CLI command, streams stdout/stderr, and emits parsed JSONL events.
|
|
6
6
|
* Expects: stdout emits JSON Lines; malformed JSON lines are ignored.
|
|
@@ -4,7 +4,7 @@ const spawnMock = vi.hoisted(() => vi.fn());
|
|
|
4
4
|
vi.mock("node:child_process", () => ({
|
|
5
5
|
spawn: spawnMock
|
|
6
6
|
}));
|
|
7
|
-
import { commandJSONL } from "
|
|
7
|
+
import { commandJSONL } from "../../../modules/ai/providers/commandJSONL.js";
|
|
8
8
|
function spawnChildCreate() {
|
|
9
9
|
const child = new EventEmitter();
|
|
10
10
|
child.stdout = new EventEmitter();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { commandJSONL } from "
|
|
1
|
+
import { commandJSONL } from "../../../modules/ai/providers/commandJSONL.js";
|
|
2
2
|
/**
|
|
3
3
|
* Runs PI CLI in JSON mode and resolves the latest assistant message_end text.
|
|
4
4
|
* Expects: PI emits JSONL events on stdout.
|
|
@@ -3,7 +3,7 @@ const commandJSONLMock = vi.hoisted(() => vi.fn());
|
|
|
3
3
|
vi.mock("@/modules/ai/providers/commandJSONL.js", () => ({
|
|
4
4
|
commandJSONL: commandJSONLMock
|
|
5
5
|
}));
|
|
6
|
-
import { piProviderGenerate } from "
|
|
6
|
+
import { piProviderGenerate } from "../../../modules/ai/providers/piProviderGenerate.js";
|
|
7
7
|
describe("piProviderGenerate", () => {
|
|
8
8
|
beforeEach(() => {
|
|
9
9
|
commandJSONLMock.mockReset();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { beerOriginalPathResolve } from "
|
|
3
|
+
import { beerOriginalPathResolve } from "../../modules/beer/beerOriginalPathResolve.js";
|
|
4
4
|
describe("beerOriginalPathResolve", () => {
|
|
5
5
|
it("resolves to .beer/local/original under the provided project path", () => {
|
|
6
6
|
const projectPath = "/tmp/test-project";
|
|
@@ -2,7 +2,7 @@ import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { describe, expect, it } from "vitest";
|
|
5
|
-
import { beerSettingsRead } from "
|
|
5
|
+
import { beerSettingsRead } from "../../modules/beer/beerSettingsRead.js";
|
|
6
6
|
describe("beerSettingsRead", () => {
|
|
7
7
|
it("ignores legacy providers field from settings.json", async () => {
|
|
8
8
|
const tempDir = await mkdtemp(path.join(os.tmpdir(), "holdmybeer-settings-read-"));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GitHubRepoRef } from "
|
|
1
|
+
import type { GitHubRepoRef } from "../../modules/github/githubTypes.js";
|
|
2
2
|
export interface BeerSettings {
|
|
3
3
|
version: 1;
|
|
4
4
|
sourceRepo?: GitHubRepoRef;
|
|
@@ -8,5 +8,5 @@ export interface BeerSettings {
|
|
|
8
8
|
productName?: string;
|
|
9
9
|
updatedAt: number;
|
|
10
10
|
}
|
|
11
|
-
export type { ProviderDetection } from "
|
|
11
|
+
export type { ProviderDetection } from "../../modules/providers/providerTypes.js";
|
|
12
12
|
//# sourceMappingURL=beerSettingsTypes.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mkdir, rm } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { commandRun } from "
|
|
3
|
+
import { commandRun } from "../../modules/util/commandRun.js";
|
|
4
4
|
/**
|
|
5
5
|
* Recreates a shallow clone of the repository at targetDir.
|
|
6
6
|
* Returns the HEAD commit hash of the checkout for reproducibility.
|
|
@@ -2,8 +2,8 @@ import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { describe, expect, it } from "vitest";
|
|
5
|
-
import { gitRepoCheckout } from "
|
|
6
|
-
import { commandRun } from "
|
|
5
|
+
import { gitRepoCheckout } from "../../modules/git/gitRepoCheckout.js";
|
|
6
|
+
import { commandRun } from "../../modules/util/commandRun.js";
|
|
7
7
|
describe("gitRepoCheckout", () => {
|
|
8
8
|
it("recreates a shallow clone at target path", async () => {
|
|
9
9
|
const tempRoot = await mkdtemp(path.join(os.tmpdir(), "beer-git-"));
|
|
@@ -3,7 +3,7 @@ const commandRunMock = vi.hoisted(() => vi.fn());
|
|
|
3
3
|
vi.mock("@/modules/util/commandRun.js", () => ({
|
|
4
4
|
commandRun: commandRunMock
|
|
5
5
|
}));
|
|
6
|
-
import { gitRepoEnsure } from "
|
|
6
|
+
import { gitRepoEnsure } from "../../modules/git/gitRepoEnsure.js";
|
|
7
7
|
describe("gitRepoEnsure", () => {
|
|
8
8
|
beforeEach(() => {
|
|
9
9
|
commandRunMock.mockReset();
|
|
@@ -2,7 +2,7 @@ import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { afterEach, describe, expect, it } from "vitest";
|
|
5
|
-
import { gitignoreEnsure } from "
|
|
5
|
+
import { gitignoreEnsure } from "../../modules/git/gitignoreEnsure.js";
|
|
6
6
|
const tempDirs = [];
|
|
7
7
|
afterEach(async () => {
|
|
8
8
|
await Promise.all(tempDirs.splice(0).map((dir) => rm(dir, { recursive: true, force: true })));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { text } from "
|
|
2
|
-
import { commandRun } from "
|
|
1
|
+
import { text } from "../../text/text.js";
|
|
2
|
+
import { commandRun } from "../../modules/util/commandRun.js";
|
|
3
3
|
/**
|
|
4
4
|
* Verifies GitHub CLI is installed and callable.
|
|
5
5
|
* Throws with a clear message when unavailable.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { githubRepoNameResolve } from "
|
|
2
|
+
import { githubRepoNameResolve } from "../../modules/github/githubRepoNameResolve.js";
|
|
3
3
|
describe("githubRepoNameResolve", () => {
|
|
4
4
|
it("keeps requested name when missing", async () => {
|
|
5
5
|
const result = await githubRepoNameResolve({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { githubRepoParse } from "
|
|
2
|
+
import { githubRepoParse } from "../../modules/github/githubRepoParse.js";
|
|
3
3
|
describe("githubRepoParse", () => {
|
|
4
4
|
it("parses owner/repo shorthand", () => {
|
|
5
5
|
expect(githubRepoParse("ex3ndr/holdmybeer")?.fullName).toBe("ex3ndr/holdmybeer");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GitHubRepoStatus } from "
|
|
1
|
+
import type { GitHubRepoStatus } from "../../modules/github/githubTypes.js";
|
|
2
2
|
/**
|
|
3
3
|
* Checks repository status for publish targeting.
|
|
4
4
|
* missing: not found, empty: exists with no content, nonEmpty: contains content.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { textFormatKey } from "
|
|
2
|
-
import { commandRun } from "
|
|
1
|
+
import { textFormatKey } from "../../text/text.js";
|
|
2
|
+
import { commandRun } from "../../modules/util/commandRun.js";
|
|
3
3
|
/**
|
|
4
4
|
* Checks repository status for publish targeting.
|
|
5
5
|
* missing: not found, empty: exists with no content, nonEmpty: contains content.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { text } from "
|
|
2
|
-
import { commandRun } from "
|
|
1
|
+
import { text } from "../../text/text.js";
|
|
2
|
+
import { commandRun } from "../../modules/util/commandRun.js";
|
|
3
3
|
/**
|
|
4
4
|
* Returns the authenticated GitHub login from gh auth.
|
|
5
5
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PlanSourceDocument } from "
|
|
2
|
-
import type { TreeNode } from "
|
|
1
|
+
import type { PlanSourceDocument } from "../../modules/plan/planSourceDocumentTypes.js";
|
|
2
|
+
import type { TreeNode } from "../../types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Builds the node-children prompt for decomposing one task node into sub-tasks.
|
|
5
5
|
* Expects: node document has been generated in the same session before this call.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { planPromptChildren } from "
|
|
2
|
+
import { planPromptChildren } from "../../modules/plan/planPromptChildren.js";
|
|
3
3
|
describe("planPromptChildren", () => {
|
|
4
4
|
it("requires json-only child output contract", () => {
|
|
5
5
|
const node = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PlanSourceDocument } from "
|
|
2
|
-
import type { TreeNode } from "
|
|
1
|
+
import type { PlanSourceDocument } from "../../modules/plan/planSourceDocumentTypes.js";
|
|
2
|
+
import type { TreeNode } from "../../types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Builds the node document prompt for a single task node in the planning tree.
|
|
5
5
|
* Expects: node is the currently expanded planning node and source docs are readable.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { planPromptDocument } from "
|
|
2
|
+
import { planPromptDocument } from "../../modules/plan/planPromptDocument.js";
|
|
3
3
|
describe("planPromptDocument", () => {
|
|
4
4
|
it("contains frontmatter and section requirements for the node", () => {
|
|
5
5
|
const node = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TreeNode } from "
|
|
1
|
+
import type { TreeNode } from "../../types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Builds a picker prompt that prioritizes dependency-first planning of unexpanded leaves.
|
|
4
4
|
* Expects: treeOutline is a rendered state and leaves contains only unexpanded candidates.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { treeNodePathResolve } from "
|
|
1
|
+
import { treeNodePathResolve } from "../../modules/tree/treeNodePathResolve.js";
|
|
2
2
|
/**
|
|
3
3
|
* Builds a picker prompt that prioritizes dependency-first planning of unexpanded leaves.
|
|
4
4
|
* Expects: treeOutline is a rendered state and leaves contains only unexpanded candidates.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { planPromptPicker } from "
|
|
2
|
+
import { planPromptPicker } from "../../modules/plan/planPromptPicker.js";
|
|
3
3
|
describe("planPromptPicker", () => {
|
|
4
4
|
it("renders candidate leaf paths and output requirement", () => {
|
|
5
5
|
const leaves = [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PlanSourceDocument } from "
|
|
1
|
+
import type { PlanSourceDocument } from "../../modules/plan/planSourceDocumentTypes.js";
|
|
2
2
|
/**
|
|
3
3
|
* Builds the root planning prompt that enumerates exhaustive level-1 task streams.
|
|
4
4
|
* Expects: sourceDocuments contains at least one planning input document path.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { planPromptRoot } from "
|
|
2
|
+
import { planPromptRoot } from "../../modules/plan/planPromptRoot.js";
|
|
3
3
|
describe("planPromptRoot", () => {
|
|
4
4
|
it("embeds source document paths and output contract", () => {
|
|
5
5
|
const prompt = planPromptRoot([
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PlanSourceDocument } from "
|
|
1
|
+
import type { PlanSourceDocument } from "../../modules/plan/planSourceDocumentTypes.js";
|
|
2
2
|
/**
|
|
3
3
|
* Resolves available planning source documents from standard repository paths.
|
|
4
4
|
* Expects: projectPath is repository root and candidate files are regular markdown documents.
|