@h-rig/bundle-default-lifecycle 0.0.6-alpha.154 → 0.0.6-alpha.156

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,15 @@
1
+ /**
2
+ * Sanitize an arbitrary string into a valid, lowercase git branch fragment.
3
+ * Strips quotes, collapses separators, limits to 64 chars.
4
+ */
5
+ export declare function sanitizeBranchFragment(raw: string): string;
6
+ /**
7
+ * Sanitize a string into a `feature/…` branch name.
8
+ * Preserves an existing `feature/` prefix or slash-separated namespace.
9
+ */
10
+ export declare function sanitizeFeatureBranchName(raw: string): string;
11
+ /**
12
+ * Resolve a unique `feature/…` branch name that doesn't collide with
13
+ * any existing branch. Appends a numeric suffix when needed.
14
+ */
15
+ export declare function resolveAutoFeatureBranchName(existingBranchNames: readonly string[], preferredBranch?: string): string;
@@ -0,0 +1,33 @@
1
+ // @bun
2
+ // packages/bundle-default-lifecycle/src/branch-naming.ts
3
+ function sanitizeBranchFragment(raw) {
4
+ const normalized = raw.trim().toLowerCase().replace(/['"`]/g, "").replace(/^[./\s_-]+|[./\s_-]+$/g, "");
5
+ const branchFragment = normalized.replace(/[^a-z0-9/_-]+/g, "-").replace(/\/+/g, "/").replace(/-+/g, "-").replace(/^[./_-]+|[./_-]+$/g, "").slice(0, 64).replace(/[./_-]+$/g, "");
6
+ return branchFragment.length > 0 ? branchFragment : "update";
7
+ }
8
+ function sanitizeFeatureBranchName(raw) {
9
+ const sanitized = sanitizeBranchFragment(raw);
10
+ if (sanitized.includes("/")) {
11
+ return sanitized.startsWith("feature/") ? sanitized : `feature/${sanitized}`;
12
+ }
13
+ return `feature/${sanitized}`;
14
+ }
15
+ var AUTO_FEATURE_BRANCH_FALLBACK = "feature/update";
16
+ function resolveAutoFeatureBranchName(existingBranchNames, preferredBranch) {
17
+ const preferred = preferredBranch?.trim();
18
+ const resolvedBase = sanitizeFeatureBranchName(preferred && preferred.length > 0 ? preferred : AUTO_FEATURE_BRANCH_FALLBACK);
19
+ const existingNames = new Set(existingBranchNames.map((branch) => branch.toLowerCase()));
20
+ if (!existingNames.has(resolvedBase)) {
21
+ return resolvedBase;
22
+ }
23
+ let suffix = 2;
24
+ while (existingNames.has(`${resolvedBase}-${suffix}`)) {
25
+ suffix += 1;
26
+ }
27
+ return `${resolvedBase}-${suffix}`;
28
+ }
29
+ export {
30
+ sanitizeFeatureBranchName,
31
+ sanitizeBranchFragment,
32
+ resolveAutoFeatureBranchName
33
+ };
package/dist/src/cli.js CHANGED
@@ -148,11 +148,11 @@ function defaultKernelStatusData() {
148
148
  const plugin = createDefaultKernelPlugin();
149
149
  const resolved = resolveDefaultLifecycle();
150
150
  const capabilities = {};
151
- for (const capability of plugin.provides)
152
- capabilities[capability] = plugin.meta.id;
151
+ for (const capability of plugin.provides ?? [])
152
+ capabilities[capability] = plugin.name;
153
153
  return {
154
- kernelProviderId: plugin.meta.id,
155
- kernelVersion: plugin.meta.version,
154
+ kernelProviderId: plugin.name,
155
+ kernelVersion: plugin.version ?? "0.0.0-alpha.1",
156
156
  capabilities,
157
157
  pipelineStageCount: resolved.order.length,
158
158
  stageOrder: [...resolved.order]
@@ -1,4 +1,4 @@
1
- import type { InProcessCloseoutResult } from "@rig/runtime/control-plane/native/in-process-closeout";
1
+ import type { InProcessCloseoutResult } from "./native/in-process-closeout";
2
2
  export declare const CLOSEOUT_EQUIVALENCE_ARTIFACTS: readonly ["review-status.txt", "review-feedback.md", "review-state.json", "pr-state.json", "git-state.txt", "validation-summary.json"];
3
3
  export declare const CLOSEOUT_EQUIVALENCE_STATE_FILES: readonly ["task-repo-commits.json", "failed_approaches.md"];
4
4
  export type CloseoutEquivalenceArtifactName = typeof CLOSEOUT_EQUIVALENCE_ARTIFACTS[number] | typeof CLOSEOUT_EQUIVALENCE_STATE_FILES[number];
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env bun
2
+ export type TaskSourceCloseoutResult = {
3
+ ok: boolean;
4
+ status: unknown;
5
+ message: string;
6
+ };
7
+ export declare function closeCompletedTaskSource(projectRoot: string, taskId: string): Promise<TaskSourceCloseoutResult>;
8
+ /**
9
+ * Run the completion-verification gate (validate, local verify, auto-commit,
10
+ * PR handoff, verifier review, auto-merge, source closeout) for the project's
11
+ * active task. Returns `{ ok }` instead of exiting the process so it can be
12
+ * driven both by the bundle plugin's typed Stop hook (mapped to a HookResult)
13
+ * and by the runtime's `rig-agent completion-verification` CLI (mapped to an
14
+ * exit code). The streamed `console.log` progress output is preserved.
15
+ */
16
+ export declare function runCompletionVerificationGate(projectRoot: string): Promise<{
17
+ ok: boolean;
18
+ }>;
19
+ export declare function formatCompletionBlockedMessage(taskId: string): string;