@h-rig/bundle-default-lifecycle 0.0.6-alpha.155 → 0.0.6-alpha.157

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/src/branch-naming.d.ts +15 -0
  2. package/dist/src/branch-naming.js +33 -0
  3. package/dist/src/cli.js +4 -4
  4. package/dist/src/closeoutEquivalence.d.ts +1 -1
  5. package/dist/src/control-plane/completion-verification.d.ts +19 -0
  6. package/dist/src/control-plane/completion-verification.js +1917 -0
  7. package/dist/src/control-plane/pr-automation.d.ts +87 -0
  8. package/dist/src/control-plane/pr-automation.js +638 -0
  9. package/dist/src/control-plane/task-verify.d.ts +1 -0
  10. package/dist/src/control-plane/task-verify.js +1484 -0
  11. package/dist/src/control-plane/verifier.d.ts +138 -0
  12. package/dist/src/control-plane/verifier.js +1478 -0
  13. package/dist/src/defaultPipeline.js +4 -4
  14. package/dist/src/index.js +2716 -54
  15. package/dist/src/native/closeout-runners.d.ts +5 -0
  16. package/dist/src/native/closeout-runners.js +41 -0
  17. package/dist/src/native/in-process-closeout.d.ts +40 -0
  18. package/dist/src/native/in-process-closeout.js +802 -0
  19. package/dist/src/pipelineCloseout.d.ts +1 -1
  20. package/dist/src/pipelineCloseout.js +2712 -52
  21. package/dist/src/plugin.d.ts +4 -17
  22. package/dist/src/plugin.js +2029 -25
  23. package/dist/src/stages/auto-merge.d.ts +1 -2
  24. package/dist/src/stages/auto-merge.js +657 -3
  25. package/dist/src/stages/commit.d.ts +1 -1
  26. package/dist/src/stages/commit.js +657 -3
  27. package/dist/src/stages/isolation.js +3 -2
  28. package/dist/src/stages/merge-gate.d.ts +1 -2
  29. package/dist/src/stages/merge-gate.js +1 -1
  30. package/dist/src/stages/open-pr.d.ts +2 -2
  31. package/dist/src/stages/open-pr.js +657 -3
  32. package/dist/src/stages/push.d.ts +1 -1
  33. package/dist/src/stages/push.js +657 -3
  34. package/dist/src/stages/source-closeout.d.ts +1 -1
  35. package/dist/src/stages/source-closeout.js +657 -3
  36. package/dist/src/stages/validate.d.ts +1 -1
  37. package/package.json +32 -5
@@ -0,0 +1,5 @@
1
+ import type { GitCommandRunner, GitHubCommandRunner } from "@rig/contracts";
2
+ export declare function createEnvCloseoutRunners(env?: Record<string, string | undefined>): {
3
+ command: GitHubCommandRunner;
4
+ gitCommand: GitCommandRunner;
5
+ };
@@ -0,0 +1,41 @@
1
+ // @bun
2
+ // packages/bundle-default-lifecycle/src/native/closeout-runners.ts
3
+ import { resolveGitHubAuthToken } from "@rig/runtime/control-plane/github/token-env";
4
+ function commandEnv(env) {
5
+ const token = resolveGitHubAuthToken(env);
6
+ return token ? { ...env, RIG_GITHUB_TOKEN: token, GH_TOKEN: token, GITHUB_TOKEN: token } : { ...env };
7
+ }
8
+ function createBunCommandRunner(binary, env) {
9
+ return async (args, options) => {
10
+ try {
11
+ const child = Bun.spawn([binary, ...args], {
12
+ cwd: options?.cwd,
13
+ env: commandEnv(env),
14
+ stdin: "ignore",
15
+ stdout: "pipe",
16
+ stderr: "pipe"
17
+ });
18
+ const [exitCode, stdout, stderr] = await Promise.all([
19
+ child.exited,
20
+ new Response(child.stdout).text(),
21
+ new Response(child.stderr).text()
22
+ ]);
23
+ return { exitCode, stdout, stderr };
24
+ } catch (error) {
25
+ return {
26
+ exitCode: 1,
27
+ stdout: "",
28
+ stderr: error instanceof Error ? error.message : String(error)
29
+ };
30
+ }
31
+ };
32
+ }
33
+ function createEnvCloseoutRunners(env = process.env) {
34
+ return {
35
+ command: createBunCommandRunner("gh", env),
36
+ gitCommand: createBunCommandRunner("git", env)
37
+ };
38
+ }
39
+ export {
40
+ createEnvCloseoutRunners
41
+ };
@@ -0,0 +1,40 @@
1
+ import type { JournalCapability, RunCloseoutPhase, RunCloseoutPhaseOutcome } from "@rig/contracts";
2
+ import type { GitCommandRunner, GitHubCommandRunner, RigAutomationConfig, StrictPrGreptileApiOptions } from "@rig/contracts";
3
+ export type RunTaskSourceReflectStatus = "under_review" | "ci_fixing" | "merging" | "closed" | "needs_attention";
4
+ export type InProcessCloseoutStatus = "merged" | "opened" | "skipped" | "needs-attention";
5
+ export type InProcessCloseoutResult = {
6
+ status: InProcessCloseoutStatus;
7
+ prUrl?: string;
8
+ iterations: number;
9
+ feedback: readonly string[];
10
+ };
11
+ export type CloseoutValidationInput = {
12
+ projectRoot: string;
13
+ taskId: string;
14
+ };
15
+ export type CloseoutValidationRunner = (input: CloseoutValidationInput) => Promise<boolean> | boolean;
16
+ export declare class CloseoutValidationError extends Error {
17
+ readonly name = "CloseoutValidationError";
18
+ }
19
+ export type InProcessCloseoutInput = {
20
+ projectRoot: string;
21
+ runId: string;
22
+ taskId: string;
23
+ branch: string;
24
+ workspace: string;
25
+ artifactRoot?: string | null;
26
+ config?: RigAutomationConfig | null;
27
+ sourceTask?: Record<string, unknown> | null;
28
+ command: GitHubCommandRunner;
29
+ gitCommand: GitCommandRunner;
30
+ steerPi: (message: string) => Promise<void>;
31
+ greptileApi?: StrictPrGreptileApiOptions;
32
+ runValidation?: CloseoutValidationRunner;
33
+ onValidationStart?: () => Promise<void> | void;
34
+ kernelJournal?: JournalCapability | null;
35
+ journalPhase: (phase: RunCloseoutPhase, outcome: RunCloseoutPhaseOutcome, detail?: string | null) => Promise<void> | void;
36
+ reflect: (status: RunTaskSourceReflectStatus, summary: string, options?: {
37
+ errorText?: string | null;
38
+ }) => Promise<void> | void;
39
+ };
40
+ export declare function runInProcessCloseout(input: InProcessCloseoutInput): Promise<InProcessCloseoutResult>;