@ai-sdlc/orchestrator 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 (203) hide show
  1. package/dist/adapters.d.ts +60 -0
  2. package/dist/adapters.js +160 -0
  3. package/dist/admission.d.ts +49 -0
  4. package/dist/admission.js +90 -0
  5. package/dist/analysis/analyzer.d.ts +10 -0
  6. package/dist/analysis/analyzer.js +67 -0
  7. package/dist/analysis/complexity-scorer.d.ts +24 -0
  8. package/dist/analysis/complexity-scorer.js +39 -0
  9. package/dist/analysis/context-builder.d.ts +14 -0
  10. package/dist/analysis/context-builder.js +79 -0
  11. package/dist/analysis/convention-detector.d.ts +9 -0
  12. package/dist/analysis/convention-detector.js +177 -0
  13. package/dist/analysis/dependency-parser.d.ts +17 -0
  14. package/dist/analysis/dependency-parser.js +167 -0
  15. package/dist/analysis/file-walker.d.ts +18 -0
  16. package/dist/analysis/file-walker.js +158 -0
  17. package/dist/analysis/hotspot-analyzer.d.ts +28 -0
  18. package/dist/analysis/hotspot-analyzer.js +85 -0
  19. package/dist/analysis/index.d.ts +13 -0
  20. package/dist/analysis/index.js +12 -0
  21. package/dist/analysis/pattern-detector.d.ts +10 -0
  22. package/dist/analysis/pattern-detector.js +86 -0
  23. package/dist/analysis/types.d.ts +94 -0
  24. package/dist/analysis/types.js +5 -0
  25. package/dist/audit-archival.d.ts +48 -0
  26. package/dist/audit-archival.js +72 -0
  27. package/dist/audit-export.d.ts +45 -0
  28. package/dist/audit-export.js +100 -0
  29. package/dist/audit-extended.d.ts +28 -0
  30. package/dist/audit-extended.js +38 -0
  31. package/dist/audit-scheduler.d.ts +32 -0
  32. package/dist/audit-scheduler.js +52 -0
  33. package/dist/audit-sqlite-sink.d.ts +11 -0
  34. package/dist/audit-sqlite-sink.js +51 -0
  35. package/dist/autonomy-tracker.d.ts +76 -0
  36. package/dist/autonomy-tracker.js +277 -0
  37. package/dist/check-runs.d.ts +37 -0
  38. package/dist/check-runs.js +72 -0
  39. package/dist/cli/commands/agents.d.ts +6 -0
  40. package/dist/cli/commands/agents.js +33 -0
  41. package/dist/cli/commands/complexity.d.ts +6 -0
  42. package/dist/cli/commands/complexity.js +35 -0
  43. package/dist/cli/commands/cost.d.ts +6 -0
  44. package/dist/cli/commands/cost.js +53 -0
  45. package/dist/cli/commands/dashboard.d.ts +9 -0
  46. package/dist/cli/commands/dashboard.js +50 -0
  47. package/dist/cli/commands/health.d.ts +6 -0
  48. package/dist/cli/commands/health.js +33 -0
  49. package/dist/cli/commands/init.d.ts +6 -0
  50. package/dist/cli/commands/init.js +127 -0
  51. package/dist/cli/commands/routing.d.ts +6 -0
  52. package/dist/cli/commands/routing.js +46 -0
  53. package/dist/cli/commands/run.d.ts +6 -0
  54. package/dist/cli/commands/run.js +36 -0
  55. package/dist/cli/commands/start.d.ts +6 -0
  56. package/dist/cli/commands/start.js +26 -0
  57. package/dist/cli/commands/status.d.ts +6 -0
  58. package/dist/cli/commands/status.js +34 -0
  59. package/dist/cli/dashboard-renderer.d.ts +24 -0
  60. package/dist/cli/dashboard-renderer.js +129 -0
  61. package/dist/cli/formatters/index.d.ts +6 -0
  62. package/dist/cli/formatters/index.js +18 -0
  63. package/dist/cli/formatters/json.d.ts +5 -0
  64. package/dist/cli/formatters/json.js +7 -0
  65. package/dist/cli/formatters/minimal.d.ts +5 -0
  66. package/dist/cli/formatters/minimal.js +36 -0
  67. package/dist/cli/formatters/table.d.ts +5 -0
  68. package/dist/cli/formatters/table.js +184 -0
  69. package/dist/cli/index.d.ts +6 -0
  70. package/dist/cli/index.js +35 -0
  71. package/dist/compliance-extended.d.ts +41 -0
  72. package/dist/compliance-extended.js +58 -0
  73. package/dist/config.d.ts +26 -0
  74. package/dist/config.js +66 -0
  75. package/dist/context-enrichment.d.ts +33 -0
  76. package/dist/context-enrichment.js +125 -0
  77. package/dist/cost-governance.d.ts +22 -0
  78. package/dist/cost-governance.js +106 -0
  79. package/dist/cost-tracker.d.ts +75 -0
  80. package/dist/cost-tracker.js +177 -0
  81. package/dist/defaults.d.ts +140 -0
  82. package/dist/defaults.js +218 -0
  83. package/dist/deploy/flyio-target.d.ts +19 -0
  84. package/dist/deploy/flyio-target.js +114 -0
  85. package/dist/deploy/index.d.ts +15 -0
  86. package/dist/deploy/index.js +11 -0
  87. package/dist/deploy/kubernetes-target.d.ts +25 -0
  88. package/dist/deploy/kubernetes-target.js +124 -0
  89. package/dist/deploy/metrics-collector.d.ts +31 -0
  90. package/dist/deploy/metrics-collector.js +75 -0
  91. package/dist/deploy/rollout-controller.d.ts +42 -0
  92. package/dist/deploy/rollout-controller.js +192 -0
  93. package/dist/deploy/rollout-types.d.ts +86 -0
  94. package/dist/deploy/rollout-types.js +5 -0
  95. package/dist/deploy/types.d.ts +47 -0
  96. package/dist/deploy/types.js +5 -0
  97. package/dist/deploy/vercel-target.d.ts +16 -0
  98. package/dist/deploy/vercel-target.js +115 -0
  99. package/dist/discovery.d.ts +26 -0
  100. package/dist/discovery.js +46 -0
  101. package/dist/episodic-enhanced.d.ts +88 -0
  102. package/dist/episodic-enhanced.js +212 -0
  103. package/dist/execute.d.ts +81 -0
  104. package/dist/execute.js +703 -0
  105. package/dist/fix-ci.d.ts +61 -0
  106. package/dist/fix-ci.js +380 -0
  107. package/dist/handoff-executor.d.ts +61 -0
  108. package/dist/handoff-executor.js +119 -0
  109. package/dist/index.d.ts +70 -0
  110. package/dist/index.js +87 -0
  111. package/dist/instrumented.d.ts +27 -0
  112. package/dist/instrumented.js +34 -0
  113. package/dist/logger.d.ts +17 -0
  114. package/dist/logger.js +37 -0
  115. package/dist/multi-repo/impact-analyzer.d.ts +22 -0
  116. package/dist/multi-repo/impact-analyzer.js +95 -0
  117. package/dist/multi-repo/index.d.ts +5 -0
  118. package/dist/multi-repo/index.js +4 -0
  119. package/dist/multi-repo/monorepo-detector.d.ts +16 -0
  120. package/dist/multi-repo/monorepo-detector.js +246 -0
  121. package/dist/multi-repo/service-map-builder.d.ts +24 -0
  122. package/dist/multi-repo/service-map-builder.js +235 -0
  123. package/dist/multi-repo/types.d.ts +54 -0
  124. package/dist/multi-repo/types.js +5 -0
  125. package/dist/notifications/index.d.ts +4 -0
  126. package/dist/notifications/index.js +4 -0
  127. package/dist/notifications/notification-router.d.ts +62 -0
  128. package/dist/notifications/notification-router.js +206 -0
  129. package/dist/notifications/slack-messenger.d.ts +26 -0
  130. package/dist/notifications/slack-messenger.js +69 -0
  131. package/dist/notifications/teams-messenger.d.ts +21 -0
  132. package/dist/notifications/teams-messenger.js +85 -0
  133. package/dist/notifications.d.ts +13 -0
  134. package/dist/notifications.js +15 -0
  135. package/dist/orchestration.d.ts +20 -0
  136. package/dist/orchestration.js +53 -0
  137. package/dist/orchestrator.d.ts +160 -0
  138. package/dist/orchestrator.js +372 -0
  139. package/dist/otel-exporter.d.ts +37 -0
  140. package/dist/otel-exporter.js +128 -0
  141. package/dist/plugin.d.ts +45 -0
  142. package/dist/plugin.js +8 -0
  143. package/dist/policy-evaluators.d.ts +40 -0
  144. package/dist/policy-evaluators.js +57 -0
  145. package/dist/process-escalation.d.ts +38 -0
  146. package/dist/process-escalation.js +129 -0
  147. package/dist/progressive-gates.d.ts +54 -0
  148. package/dist/progressive-gates.js +135 -0
  149. package/dist/provenance.d.ts +29 -0
  150. package/dist/provenance.js +61 -0
  151. package/dist/reconcilers.d.ts +28 -0
  152. package/dist/reconcilers.js +37 -0
  153. package/dist/runners/claude-code.d.ts +17 -0
  154. package/dist/runners/claude-code.js +200 -0
  155. package/dist/runners/codex.d.ts +19 -0
  156. package/dist/runners/codex.js +153 -0
  157. package/dist/runners/copilot-stub.d.ts +9 -0
  158. package/dist/runners/copilot-stub.js +15 -0
  159. package/dist/runners/copilot.d.ts +15 -0
  160. package/dist/runners/copilot.js +119 -0
  161. package/dist/runners/cursor-stub.d.ts +9 -0
  162. package/dist/runners/cursor-stub.js +15 -0
  163. package/dist/runners/cursor.d.ts +20 -0
  164. package/dist/runners/cursor.js +140 -0
  165. package/dist/runners/devin-stub.d.ts +9 -0
  166. package/dist/runners/devin-stub.js +15 -0
  167. package/dist/runners/generic-llm.d.ts +51 -0
  168. package/dist/runners/generic-llm.js +125 -0
  169. package/dist/runners/index.d.ts +8 -0
  170. package/dist/runners/index.js +7 -0
  171. package/dist/runners/runner-registry.d.ts +50 -0
  172. package/dist/runners/runner-registry.js +156 -0
  173. package/dist/runners/types.d.ts +59 -0
  174. package/dist/runners/types.js +7 -0
  175. package/dist/security.d.ts +51 -0
  176. package/dist/security.js +70 -0
  177. package/dist/shared.d.ts +134 -0
  178. package/dist/shared.js +284 -0
  179. package/dist/state/index.d.ts +4 -0
  180. package/dist/state/index.js +3 -0
  181. package/dist/state/schema.d.ts +16 -0
  182. package/dist/state/schema.js +264 -0
  183. package/dist/state/store.d.ts +109 -0
  184. package/dist/state/store.js +644 -0
  185. package/dist/state/types.d.ts +190 -0
  186. package/dist/state/types.js +5 -0
  187. package/dist/structured-logger.d.ts +20 -0
  188. package/dist/structured-logger.js +64 -0
  189. package/dist/task-decomposer.d.ts +61 -0
  190. package/dist/task-decomposer.js +265 -0
  191. package/dist/telemetry-extended.d.ts +24 -0
  192. package/dist/telemetry-extended.js +31 -0
  193. package/dist/types.d.ts +9 -0
  194. package/dist/types.js +7 -0
  195. package/dist/validate-agent-output.d.ts +30 -0
  196. package/dist/validate-agent-output.js +81 -0
  197. package/dist/validate-issue.d.ts +25 -0
  198. package/dist/validate-issue.js +102 -0
  199. package/dist/watch.d.ts +43 -0
  200. package/dist/watch.js +99 -0
  201. package/dist/webhook-manager.d.ts +38 -0
  202. package/dist/webhook-manager.js +66 -0
  203. package/package.json +59 -0
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Process escalation — detects complexity band transitions and
3
+ * returns escalation actions to tighten or relax the pipeline.
4
+ *
5
+ * RFC reference: progressive process adaptation.
6
+ */
7
+ import type { Gate } from '@ai-sdlc/reference';
8
+ import type { ComplexityBand } from './defaults.js';
9
+ export type EscalationActionType = 'add-gate' | 'remove-gate' | 'tighten-gate' | 'relax-gate' | 'require-review' | 'remove-review-requirement' | 'notify';
10
+ export interface EscalationAction {
11
+ type: EscalationActionType;
12
+ gateName?: string;
13
+ reason: string;
14
+ fromBand: ComplexityBand;
15
+ toBand: ComplexityBand;
16
+ details?: Record<string, unknown>;
17
+ }
18
+ export interface EscalationResult {
19
+ escalated: boolean;
20
+ fromBand: ComplexityBand;
21
+ toBand: ComplexityBand;
22
+ actions: EscalationAction[];
23
+ }
24
+ /**
25
+ * Evaluate whether a complexity score change triggers process escalation.
26
+ * Returns a list of escalation actions when the band changes.
27
+ */
28
+ export declare function evaluateProcessEscalation(prevScore: number, curScore: number, gates: Gate[]): EscalationResult;
29
+ /**
30
+ * Check if a band transition represents a significant escalation
31
+ * (jumping 2+ bands).
32
+ */
33
+ export declare function isSignificantEscalation(fromBand: ComplexityBand, toBand: ComplexityBand): boolean;
34
+ /**
35
+ * Get escalation summary for logging/notification.
36
+ */
37
+ export declare function formatEscalationSummary(result: EscalationResult): string;
38
+ //# sourceMappingURL=process-escalation.d.ts.map
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Process escalation — detects complexity band transitions and
3
+ * returns escalation actions to tighten or relax the pipeline.
4
+ *
5
+ * RFC reference: progressive process adaptation.
6
+ */
7
+ import { getComplexityBand } from './progressive-gates.js';
8
+ /**
9
+ * Band ordering for comparison.
10
+ */
11
+ function bandOrd(band) {
12
+ switch (band) {
13
+ case 'trivial':
14
+ return 0;
15
+ case 'standard':
16
+ return 1;
17
+ case 'complex':
18
+ return 2;
19
+ case 'critical':
20
+ return 3;
21
+ default:
22
+ return 1;
23
+ }
24
+ }
25
+ /**
26
+ * Evaluate whether a complexity score change triggers process escalation.
27
+ * Returns a list of escalation actions when the band changes.
28
+ */
29
+ export function evaluateProcessEscalation(prevScore, curScore, gates) {
30
+ const fromBand = getComplexityBand(prevScore);
31
+ const toBand = getComplexityBand(curScore);
32
+ if (fromBand === toBand) {
33
+ return { escalated: false, fromBand, toBand, actions: [] };
34
+ }
35
+ const fromOrd = bandOrd(fromBand);
36
+ const toOrd = bandOrd(toBand);
37
+ const escalating = toOrd > fromOrd;
38
+ const actions = [];
39
+ if (escalating) {
40
+ // Complexity increased — tighten process
41
+ actions.push({
42
+ type: 'notify',
43
+ reason: `Complexity band escalated from ${fromBand} to ${toBand}`,
44
+ fromBand,
45
+ toBand,
46
+ });
47
+ // Tighten all existing gates
48
+ for (const gate of gates) {
49
+ actions.push({
50
+ type: 'tighten-gate',
51
+ gateName: gate.name,
52
+ reason: `Gate enforcement tightened due to band change ${fromBand} -> ${toBand}`,
53
+ fromBand,
54
+ toBand,
55
+ });
56
+ }
57
+ // Add review requirement if moving to complex or critical
58
+ if (toOrd >= 2) {
59
+ actions.push({
60
+ type: 'require-review',
61
+ reason: `Review required for ${toBand} complexity band`,
62
+ fromBand,
63
+ toBand,
64
+ });
65
+ }
66
+ // Add security gate if moving to complex or critical and none exists
67
+ if (toOrd >= 2 && !gates.some((g) => g.name.toLowerCase().includes('security'))) {
68
+ actions.push({
69
+ type: 'add-gate',
70
+ gateName: 'security-scan',
71
+ reason: `Security scan required for ${toBand} complexity band`,
72
+ fromBand,
73
+ toBand,
74
+ details: { enforcement: 'hard-mandatory' },
75
+ });
76
+ }
77
+ }
78
+ else {
79
+ // Complexity decreased — relax process
80
+ actions.push({
81
+ type: 'notify',
82
+ reason: `Complexity band de-escalated from ${fromBand} to ${toBand}`,
83
+ fromBand,
84
+ toBand,
85
+ });
86
+ // Relax all existing gates
87
+ for (const gate of gates) {
88
+ actions.push({
89
+ type: 'relax-gate',
90
+ gateName: gate.name,
91
+ reason: `Gate enforcement relaxed due to band change ${fromBand} -> ${toBand}`,
92
+ fromBand,
93
+ toBand,
94
+ });
95
+ }
96
+ // Remove review requirement if moving to trivial
97
+ if (toOrd === 0) {
98
+ actions.push({
99
+ type: 'remove-review-requirement',
100
+ reason: 'Review not required for trivial complexity band',
101
+ fromBand,
102
+ toBand,
103
+ });
104
+ }
105
+ }
106
+ return { escalated: true, fromBand, toBand, actions };
107
+ }
108
+ /**
109
+ * Check if a band transition represents a significant escalation
110
+ * (jumping 2+ bands).
111
+ */
112
+ export function isSignificantEscalation(fromBand, toBand) {
113
+ return Math.abs(bandOrd(toBand) - bandOrd(fromBand)) >= 2;
114
+ }
115
+ /**
116
+ * Get escalation summary for logging/notification.
117
+ */
118
+ export function formatEscalationSummary(result) {
119
+ if (!result.escalated) {
120
+ return `No escalation: band remains ${result.fromBand}`;
121
+ }
122
+ const direction = bandOrd(result.toBand) > bandOrd(result.fromBand) ? 'escalated' : 'de-escalated';
123
+ const actionSummary = result.actions
124
+ .filter((a) => a.type !== 'notify')
125
+ .map((a) => `${a.type}${a.gateName ? ` (${a.gateName})` : ''}`)
126
+ .join(', ');
127
+ return `Process ${direction}: ${result.fromBand} -> ${result.toBand}. Actions: ${actionSummary || 'none'}`;
128
+ }
129
+ //# sourceMappingURL=process-escalation.js.map
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Progressive gate adjustment — adapts gate enforcement and thresholds
3
+ * based on codebase complexity score.
4
+ *
5
+ * RFC reference: Lines 217-228 (progressive gate matrix).
6
+ */
7
+ import type { Gate, EnforcementLevel } from '@ai-sdlc/reference';
8
+ import { type ComplexityBand, type GateProfile } from './defaults.js';
9
+ import type { StateStore } from './state/store.js';
10
+ import type { GateThresholdOverride } from './state/types.js';
11
+ export interface AdjustedGate extends Gate {
12
+ originalEnforcement: EnforcementLevel;
13
+ complexityBand: ComplexityBand;
14
+ adjustedThresholds?: Record<string, unknown>;
15
+ }
16
+ export interface GateAdjustment {
17
+ gateName: string;
18
+ originalEnforcement: EnforcementLevel;
19
+ adjustedEnforcement: EnforcementLevel;
20
+ band: ComplexityBand;
21
+ thresholdChanges: Record<string, unknown>;
22
+ }
23
+ /**
24
+ * Determine the complexity band for a given score (1-10).
25
+ */
26
+ export declare function getComplexityBand(score: number): ComplexityBand;
27
+ /**
28
+ * Get the gate profile for a given complexity score.
29
+ */
30
+ export declare function getGateProfile(score: number): GateProfile;
31
+ /**
32
+ * Determine the adjusted enforcement level for a gate given a complexity band.
33
+ * Rules:
34
+ * - Trivial band: enforcement can be relaxed (hard-mandatory -> soft-mandatory, soft-mandatory -> advisory)
35
+ * - Standard band: no change
36
+ * - Complex/critical bands: enforcement is tightened (advisory -> soft-mandatory, soft-mandatory -> hard-mandatory)
37
+ */
38
+ export declare function adjustEnforcement(original: EnforcementLevel, band: ComplexityBand): EnforcementLevel;
39
+ /**
40
+ * Adjust a single gate for the given complexity score.
41
+ * Applies profile-based enforcement adjustment and threshold overrides.
42
+ */
43
+ export declare function adjustGateForComplexity(score: number, gate: Gate, overrides?: GateThresholdOverride[]): AdjustedGate;
44
+ /**
45
+ * Adjust all gates for the given complexity score.
46
+ * Optionally loads overrides from the state store.
47
+ */
48
+ export declare function adjustGatesForComplexity(score: number, gates: Gate[], store?: StateStore): AdjustedGate[];
49
+ /**
50
+ * Compute the set of adjustments that would be made to gates.
51
+ * Useful for reporting/logging without mutating.
52
+ */
53
+ export declare function computeGateAdjustments(score: number, gates: Gate[]): GateAdjustment[];
54
+ //# sourceMappingURL=progressive-gates.d.ts.map
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Progressive gate adjustment — adapts gate enforcement and thresholds
3
+ * based on codebase complexity score.
4
+ *
5
+ * RFC reference: Lines 217-228 (progressive gate matrix).
6
+ */
7
+ import { PROGRESSIVE_GATE_PROFILES } from './defaults.js';
8
+ /**
9
+ * Determine the complexity band for a given score (1-10).
10
+ */
11
+ export function getComplexityBand(score) {
12
+ const clamped = Math.max(1, Math.min(10, Math.round(score)));
13
+ for (const profile of PROGRESSIVE_GATE_PROFILES) {
14
+ if (clamped >= profile.minScore && clamped <= profile.maxScore) {
15
+ return profile.band;
16
+ }
17
+ }
18
+ return 'standard';
19
+ }
20
+ /**
21
+ * Get the gate profile for a given complexity score.
22
+ */
23
+ export function getGateProfile(score) {
24
+ const band = getComplexityBand(score);
25
+ return PROGRESSIVE_GATE_PROFILES.find((p) => p.band === band) ?? PROGRESSIVE_GATE_PROFILES[1];
26
+ }
27
+ /**
28
+ * Map an enforcement level string to an ordered numeric value for comparison.
29
+ */
30
+ function enforcementOrd(level) {
31
+ switch (level) {
32
+ case 'advisory':
33
+ return 0;
34
+ case 'soft-mandatory':
35
+ return 1;
36
+ case 'hard-mandatory':
37
+ return 2;
38
+ default:
39
+ return 1;
40
+ }
41
+ }
42
+ /**
43
+ * Determine the adjusted enforcement level for a gate given a complexity band.
44
+ * Rules:
45
+ * - Trivial band: enforcement can be relaxed (hard-mandatory -> soft-mandatory, soft-mandatory -> advisory)
46
+ * - Standard band: no change
47
+ * - Complex/critical bands: enforcement is tightened (advisory -> soft-mandatory, soft-mandatory -> hard-mandatory)
48
+ */
49
+ export function adjustEnforcement(original, band) {
50
+ const ord = enforcementOrd(original);
51
+ switch (band) {
52
+ case 'trivial': {
53
+ // Relax by one level, floor at advisory
54
+ const newOrd = Math.max(0, ord - 1);
55
+ return ['advisory', 'soft-mandatory', 'hard-mandatory'][newOrd];
56
+ }
57
+ case 'standard':
58
+ return original;
59
+ case 'complex':
60
+ case 'critical': {
61
+ // Tighten by one level, cap at hard-mandatory
62
+ const newOrd = Math.min(2, ord + 1);
63
+ return ['advisory', 'soft-mandatory', 'hard-mandatory'][newOrd];
64
+ }
65
+ default:
66
+ return original;
67
+ }
68
+ }
69
+ /**
70
+ * Build threshold adjustments for a gate based on the profile.
71
+ */
72
+ function buildThresholdAdjustments(profile) {
73
+ return {
74
+ testCoverageThreshold: profile.testCoverageThreshold,
75
+ reviewRequired: profile.reviewRequired,
76
+ securityScanRequired: profile.securityScanRequired,
77
+ documentationRequired: profile.documentationRequired,
78
+ };
79
+ }
80
+ /**
81
+ * Adjust a single gate for the given complexity score.
82
+ * Applies profile-based enforcement adjustment and threshold overrides.
83
+ */
84
+ export function adjustGateForComplexity(score, gate, overrides) {
85
+ const profile = getGateProfile(score);
86
+ const band = profile.band;
87
+ // Check for DB override first
88
+ const override = overrides?.find((o) => o.gateName === gate.name && o.complexityBand === band);
89
+ let adjustedEnforcement;
90
+ let adjustedThresholds;
91
+ if (override) {
92
+ adjustedEnforcement = override.enforcementLevel;
93
+ adjustedThresholds = override.thresholdOverrides
94
+ ? JSON.parse(override.thresholdOverrides)
95
+ : buildThresholdAdjustments(profile);
96
+ }
97
+ else {
98
+ adjustedEnforcement = adjustEnforcement(gate.enforcement, band);
99
+ adjustedThresholds = buildThresholdAdjustments(profile);
100
+ }
101
+ return {
102
+ ...gate,
103
+ enforcement: adjustedEnforcement,
104
+ originalEnforcement: gate.enforcement,
105
+ complexityBand: band,
106
+ adjustedThresholds,
107
+ };
108
+ }
109
+ /**
110
+ * Adjust all gates for the given complexity score.
111
+ * Optionally loads overrides from the state store.
112
+ */
113
+ export function adjustGatesForComplexity(score, gates, store) {
114
+ const band = getComplexityBand(score);
115
+ const overrides = store?.getGateThresholdOverrides(undefined, band);
116
+ return gates.map((gate) => adjustGateForComplexity(score, gate, overrides));
117
+ }
118
+ /**
119
+ * Compute the set of adjustments that would be made to gates.
120
+ * Useful for reporting/logging without mutating.
121
+ */
122
+ export function computeGateAdjustments(score, gates) {
123
+ const profile = getGateProfile(score);
124
+ return gates.map((gate) => {
125
+ const adjusted = adjustEnforcement(gate.enforcement, profile.band);
126
+ return {
127
+ gateName: gate.name,
128
+ originalEnforcement: gate.enforcement,
129
+ adjustedEnforcement: adjusted,
130
+ band: profile.band,
131
+ thresholdChanges: buildThresholdAdjustments(profile),
132
+ };
133
+ });
134
+ }
135
+ //# sourceMappingURL=progressive-gates.js.map
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Provenance tracking module — creates, validates, and serializes
3
+ * provenance records for AI-generated changes (PRD Section 14.3).
4
+ */
5
+ import { provenanceToAnnotations, provenanceFromAnnotations, PROVENANCE_ANNOTATION_PREFIX, type ProvenanceRecord, type ReviewDecision, type CostReceipt } from '@ai-sdlc/reference';
6
+ /**
7
+ * Create a provenance record for a pipeline execution.
8
+ */
9
+ export declare function createPipelineProvenance(opts: {
10
+ model?: string;
11
+ tool?: string;
12
+ promptText?: string;
13
+ humanReviewer?: string;
14
+ cost?: CostReceipt;
15
+ }): ProvenanceRecord;
16
+ /**
17
+ * Generate a provenance block for inclusion in PR descriptions.
18
+ */
19
+ export declare function attachProvenanceToPR(provenance: ProvenanceRecord): string;
20
+ /**
21
+ * Validate a provenance record for completeness.
22
+ */
23
+ export declare function validatePipelineProvenance(provenance: Partial<ProvenanceRecord>): {
24
+ valid: boolean;
25
+ missing: string[];
26
+ };
27
+ export { provenanceToAnnotations, provenanceFromAnnotations, PROVENANCE_ANNOTATION_PREFIX };
28
+ export type { ProvenanceRecord, ReviewDecision };
29
+ //# sourceMappingURL=provenance.d.ts.map
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Provenance tracking module — creates, validates, and serializes
3
+ * provenance records for AI-generated changes (PRD Section 14.3).
4
+ */
5
+ import { createProvenance, provenanceToAnnotations, provenanceFromAnnotations, validateProvenance, PROVENANCE_ANNOTATION_PREFIX, } from '@ai-sdlc/reference';
6
+ import { createHash } from 'node:crypto';
7
+ import { DEFAULT_MODEL } from './defaults.js';
8
+ /**
9
+ * Create a provenance record for a pipeline execution.
10
+ */
11
+ export function createPipelineProvenance(opts) {
12
+ const promptHash = opts.promptText
13
+ ? createHash('sha256').update(opts.promptText).digest('hex').slice(0, 16)
14
+ : 'no-prompt';
15
+ return createProvenance({
16
+ model: opts.model ?? DEFAULT_MODEL,
17
+ tool: opts.tool ?? 'claude-code',
18
+ promptHash,
19
+ humanReviewer: opts.humanReviewer,
20
+ cost: opts.cost,
21
+ });
22
+ }
23
+ /**
24
+ * Generate a provenance block for inclusion in PR descriptions.
25
+ */
26
+ export function attachProvenanceToPR(provenance) {
27
+ const annotations = provenanceToAnnotations(provenance);
28
+ const lines = [
29
+ '## Provenance',
30
+ '',
31
+ `- **Model**: ${provenance.model}`,
32
+ `- **Tool**: ${provenance.tool}`,
33
+ `- **Prompt Hash**: \`${provenance.promptHash}\``,
34
+ `- **Timestamp**: ${provenance.timestamp}`,
35
+ `- **Review Status**: ${provenance.reviewDecision}`,
36
+ ];
37
+ if (provenance.humanReviewer) {
38
+ lines.push(`- **Reviewer**: ${provenance.humanReviewer}`);
39
+ }
40
+ if (provenance.cost) {
41
+ const exec = provenance.cost.execution;
42
+ const costLine = exec
43
+ ? `- **Cost**: $${provenance.cost.totalCost.toFixed(4)} (${exec.inputTokens.toLocaleString()} in / ${exec.outputTokens.toLocaleString()} out)`
44
+ : `- **Cost**: $${provenance.cost.totalCost.toFixed(4)}`;
45
+ lines.push(costLine);
46
+ }
47
+ lines.push('', '<!-- provenance-annotations');
48
+ for (const [key, value] of Object.entries(annotations)) {
49
+ lines.push(`${key}: ${value}`);
50
+ }
51
+ lines.push('-->');
52
+ return lines.join('\n');
53
+ }
54
+ /**
55
+ * Validate a provenance record for completeness.
56
+ */
57
+ export function validatePipelineProvenance(provenance) {
58
+ return validateProvenance(provenance);
59
+ }
60
+ export { provenanceToAnnotations, provenanceFromAnnotations, PROVENANCE_ANNOTATION_PREFIX };
61
+ //# sourceMappingURL=provenance.js.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Specialized reconciler integration — wraps pipeline/gate/autonomy reconcilers
3
+ * and diff utilities for smarter reconciliation in watch mode.
4
+ */
5
+ import { createPipelineReconciler as _createPipelineReconciler, createGateReconciler as _createGateReconciler, createAutonomyReconciler as _createAutonomyReconciler, resourceFingerprint, hasSpecChanged, calculateBackoff, reconcileOnce, createResourceCache, DEFAULT_RECONCILER_CONFIG, type ReconcilerFn, type ReconcilerConfig, type ReconcileResult, type ResourceCache, type AnyResource, type Pipeline, type QualityGate, type AutonomyPolicy, type PipelineReconcilerDeps, type GateReconcilerDeps, type AutonomyReconcilerDeps } from '@ai-sdlc/reference';
6
+ /**
7
+ * Create a pipeline reconciler that watches for pipeline resource changes.
8
+ */
9
+ export declare function createPipelineReconciler(deps: PipelineReconcilerDeps): ReconcilerFn<Pipeline>;
10
+ /**
11
+ * Create a gate reconciler that re-evaluates quality gates when they change.
12
+ */
13
+ export declare function createGateReconciler(deps: GateReconcilerDeps): ReconcilerFn<QualityGate>;
14
+ /**
15
+ * Create an autonomy reconciler that checks for promotion/demotion.
16
+ */
17
+ export declare function createAutonomyReconciler(deps: AutonomyReconcilerDeps): ReconcilerFn<AutonomyPolicy>;
18
+ /**
19
+ * Check if a resource's spec has changed since a previous version.
20
+ */
21
+ export declare function hasResourceChanged(previous: AnyResource, current: AnyResource): boolean;
22
+ /**
23
+ * Generate a fingerprint for a resource (used for change detection).
24
+ */
25
+ export declare function fingerprintResource(resource: AnyResource): string;
26
+ export { _createPipelineReconciler as createRefPipelineReconciler, _createGateReconciler as createRefGateReconciler, _createAutonomyReconciler as createRefAutonomyReconciler, resourceFingerprint, hasSpecChanged, calculateBackoff, reconcileOnce, createResourceCache, DEFAULT_RECONCILER_CONFIG, };
27
+ export type { ReconcilerFn, ReconcilerConfig, ReconcileResult, ResourceCache, PipelineReconcilerDeps, GateReconcilerDeps, AutonomyReconcilerDeps, };
28
+ //# sourceMappingURL=reconcilers.d.ts.map
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Specialized reconciler integration — wraps pipeline/gate/autonomy reconcilers
3
+ * and diff utilities for smarter reconciliation in watch mode.
4
+ */
5
+ import { createPipelineReconciler as _createPipelineReconciler, createGateReconciler as _createGateReconciler, createAutonomyReconciler as _createAutonomyReconciler, resourceFingerprint, hasSpecChanged, calculateBackoff, reconcileOnce, createResourceCache, DEFAULT_RECONCILER_CONFIG, } from '@ai-sdlc/reference';
6
+ /**
7
+ * Create a pipeline reconciler that watches for pipeline resource changes.
8
+ */
9
+ export function createPipelineReconciler(deps) {
10
+ return _createPipelineReconciler(deps);
11
+ }
12
+ /**
13
+ * Create a gate reconciler that re-evaluates quality gates when they change.
14
+ */
15
+ export function createGateReconciler(deps) {
16
+ return _createGateReconciler(deps);
17
+ }
18
+ /**
19
+ * Create an autonomy reconciler that checks for promotion/demotion.
20
+ */
21
+ export function createAutonomyReconciler(deps) {
22
+ return _createAutonomyReconciler(deps);
23
+ }
24
+ /**
25
+ * Check if a resource's spec has changed since a previous version.
26
+ */
27
+ export function hasResourceChanged(previous, current) {
28
+ return hasSpecChanged(previous, current);
29
+ }
30
+ /**
31
+ * Generate a fingerprint for a resource (used for change detection).
32
+ */
33
+ export function fingerprintResource(resource) {
34
+ return resourceFingerprint(resource);
35
+ }
36
+ export { _createPipelineReconciler as createRefPipelineReconciler, _createGateReconciler as createRefGateReconciler, _createAutonomyReconciler as createRefAutonomyReconciler, resourceFingerprint, hasSpecChanged, calculateBackoff, reconcileOnce, createResourceCache, DEFAULT_RECONCILER_CONFIG, };
37
+ //# sourceMappingURL=reconcilers.js.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Claude Code runner — invokes Claude Code CLI in --print mode
3
+ * and collects the result via git diff.
4
+ */
5
+ import type { AgentRunner, AgentContext, AgentResult, TokenUsage } from './types.js';
6
+ export declare function buildPrompt(ctx: AgentContext): string;
7
+ /**
8
+ * Parse token usage from Claude CLI stderr output.
9
+ * Claude Code CLI outputs token info to stderr in various formats.
10
+ */
11
+ export declare function parseTokenUsage(stderr: string, model: string): TokenUsage | undefined;
12
+ export declare class ClaudeCodeRunner implements AgentRunner {
13
+ run(ctx: AgentContext): Promise<AgentResult>;
14
+ }
15
+ /** @deprecated Use ClaudeCodeRunner instead */
16
+ export declare const GitHubActionsRunner: typeof ClaudeCodeRunner;
17
+ //# sourceMappingURL=claude-code.d.ts.map