@dev-loops/core 0.1.0

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 (54) hide show
  1. package/bin/capture-deep-persona-signals.mjs +143 -0
  2. package/bin/ensure-phase-files.mjs +7 -0
  3. package/bin/log-bash-exit-1.mjs +7 -0
  4. package/bin/parse-review-threads.mjs +7 -0
  5. package/package.json +78 -0
  6. package/src/analysis/change-classifier.mjs +146 -0
  7. package/src/analysis/diff-analyzer.mjs +285 -0
  8. package/src/bash-exit-one.mjs +130 -0
  9. package/src/cli/helpers.mjs +22 -0
  10. package/src/cli/primitives.mjs +70 -0
  11. package/src/cli/retry-wrapper.mjs +169 -0
  12. package/src/cli/subcommand-runner.mjs +246 -0
  13. package/src/config/config.mjs +965 -0
  14. package/src/debt/cluster.mjs +240 -0
  15. package/src/debt/debt-finding.mjs +68 -0
  16. package/src/debt/debt-signal.mjs +46 -0
  17. package/src/debt/deep-persona-signals.mjs +266 -0
  18. package/src/debt/remediation-to-issue.mjs +121 -0
  19. package/src/debt/score.mjs +127 -0
  20. package/src/debt/shape.mjs +214 -0
  21. package/src/github/copilot-helpers.mjs +343 -0
  22. package/src/github/repo-slug.mjs +105 -0
  23. package/src/github/review-threads.mjs +343 -0
  24. package/src/harness/adapter.mjs +57 -0
  25. package/src/harness/index.mjs +3 -0
  26. package/src/harness/noop-adapter.mjs +22 -0
  27. package/src/harness/pi-adapter.mjs +47 -0
  28. package/src/loop/async-start-contract.mjs +170 -0
  29. package/src/loop/conductor-routing.mjs +817 -0
  30. package/src/loop/copilot-ci-status.mjs +255 -0
  31. package/src/loop/copilot-loop-iterations.mjs +161 -0
  32. package/src/loop/copilot-loop-state.mjs +510 -0
  33. package/src/loop/handoff-envelope.mjs +800 -0
  34. package/src/loop/issue-refinement-artifact.mjs +268 -0
  35. package/src/loop/lifecycle-state.mjs +342 -0
  36. package/src/loop/phase-files.mjs +187 -0
  37. package/src/loop/policy-constants.mjs +17 -0
  38. package/src/loop/pr-gate-coordination.mjs +1278 -0
  39. package/src/loop/public-dev-loop-routing-contract.mjs +277 -0
  40. package/src/loop/public-dev-loop-routing.mjs +1746 -0
  41. package/src/loop/queue-board-ordering.mjs +38 -0
  42. package/src/loop/queue-board-sync.mjs +223 -0
  43. package/src/loop/queue-driver.mjs +164 -0
  44. package/src/loop/queue-parallel.mjs +190 -0
  45. package/src/loop/queue-state.mjs +230 -0
  46. package/src/loop/retrospective-checkpoint.mjs +178 -0
  47. package/src/loop/reviewer-loop-state.mjs +456 -0
  48. package/src/loop/run-inspection.mjs +604 -0
  49. package/src/loop/steering.mjs +793 -0
  50. package/src/loop/timeout-policy.mjs +73 -0
  51. package/src/loop/tracker-first-loop-state.mjs +87 -0
  52. package/src/loop/tracker-pr-state.mjs +301 -0
  53. package/src/loop/worktree-guard.mjs +141 -0
  54. package/src/refinement/ac-dod-matrix.mjs +95 -0
@@ -0,0 +1,95 @@
1
+ import { z } from "zod";
2
+
3
+ // ---------------------------------------------------------------------------
4
+ // AC/DoD matrix item — one row in the refinement coverage matrix
5
+ // ---------------------------------------------------------------------------
6
+
7
+ export const AC_DOD_ITEM_TYPE = Object.freeze({
8
+ AC: "AC",
9
+ DOD: "DoD",
10
+ NON_GOAL: "Non-goal",
11
+ });
12
+
13
+ export const AC_DOD_ITEM_STATUS = Object.freeze({
14
+ MET: "Met",
15
+ PARTIAL: "Partial",
16
+ UNMET: "Unmet",
17
+ UNVERIFIED: "Unverified",
18
+ });
19
+
20
+ /**
21
+ * A single row in the AC/DoD coverage matrix.
22
+ * Matches the refiner persona's required table output shape.
23
+ */
24
+ export const AcDodMatrixItemSchema = z.strictObject({
25
+ /** Exact item text from the source issue/plan/spec */
26
+ item: z.string().trim().min(1),
27
+ /** Type classification */
28
+ type: z.enum(Object.values(AC_DOD_ITEM_TYPE)),
29
+ /** Verification status */
30
+ status: z.enum(Object.values(AC_DOD_ITEM_STATUS)),
31
+ /** Reference to supporting evidence (file, test, doc path, or URL) */
32
+ evidence: z.string(),
33
+ /** Additional context or caveats */
34
+ notes: z.string(),
35
+ });
36
+
37
+ /**
38
+ * The full AC/DoD/Non-goal coverage matrix.
39
+ * Emitted by the refiner during issue refinement, consumed by implementation
40
+ * agents via the handoff envelope as a structured contract.
41
+ */
42
+ export const AcDodMatrixSchema = z.strictObject({
43
+ /** Schema identifier for dispatch and validation */
44
+ schema: z.literal("ac-dod-matrix/v1"),
45
+ /** Ordered list of matrix items */
46
+ items: z.array(AcDodMatrixItemSchema).min(1),
47
+ /** Source reference (issue URL, plan-doc path, etc.) */
48
+ source: z.string().trim().min(1).optional(),
49
+ /** ISO 8601 timestamp of matrix generation */
50
+ generatedAt: z.string().datetime(),
51
+ /**
52
+ * True when every item has status "Met" — the contract is fully satisfied.
53
+ * Implementation agents use this to gate merge-readiness.
54
+ */
55
+ isComplete: z.boolean(),
56
+ }).refine(
57
+ (data) => isMatrixComplete(data) === data.isComplete,
58
+ {
59
+ message: "isComplete must be true when (and only when) every item has status 'Met'",
60
+ path: ["isComplete"],
61
+ }
62
+ );
63
+
64
+ // ---------------------------------------------------------------------------
65
+ // Convenience helpers
66
+ // ---------------------------------------------------------------------------
67
+
68
+ /**
69
+ * Check whether a matrix is fully satisfied (all items Met).
70
+ * Pure function — does not require a parsed Zod result.
71
+ */
72
+ export function isMatrixComplete(matrix) {
73
+ if (!matrix || !Array.isArray(matrix.items) || matrix.items.length === 0) {
74
+ return false;
75
+ }
76
+ return matrix.items.every((item) => item.status === AC_DOD_ITEM_STATUS.MET);
77
+ }
78
+
79
+ /**
80
+ * Collect all items that are not "Met" — the outstanding work contract.
81
+ */
82
+ export function outstandingItems(matrix) {
83
+ if (!matrix || !Array.isArray(matrix.items)) {
84
+ return [];
85
+ }
86
+ return matrix.items.filter((item) => item.status !== AC_DOD_ITEM_STATUS.MET);
87
+ }
88
+
89
+ /**
90
+ * Validate raw data against the AC/DoD matrix schema.
91
+ * Returns a Zod safeParse result.
92
+ */
93
+ export function validateAcDodMatrix(data) {
94
+ return AcDodMatrixSchema.safeParse(data);
95
+ }