@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,60 @@
1
+ /**
2
+ * Adapter ecosystem integration — wraps all community adapter stubs,
3
+ * webhook bridge, git-based adapter resolver, and adapter registry/scanner
4
+ * into the dogfood pipeline.
5
+ */
6
+ import { type AdapterRegistry, type ScanOptions, type ScanResult, type WebhookBridge, type GitAdapterFetcher, type GitResolveResult, type AuditLog, type AuditSink, type Sandbox, type SecretStore, type MemoryStore, type EventBus, type CIPipeline } from '@ai-sdlc/reference';
7
+ /**
8
+ * Create an adapter registry pre-loaded with all built-in and community adapters.
9
+ */
10
+ export declare function createPipelineAdapterRegistry(): AdapterRegistry;
11
+ export interface InfrastructureConfig {
12
+ /** Working directory for file-based adapters (audit log, memory). */
13
+ workDir: string;
14
+ /** Override the audit log file path (defaults to `<workDir>/.ai-sdlc/audit.jsonl`). */
15
+ auditFilePath?: string;
16
+ }
17
+ /**
18
+ * Resolved infrastructure adapters, ready for use by orchestrators.
19
+ */
20
+ export interface InfrastructureContext {
21
+ auditLog: AuditLog;
22
+ auditSink: AuditSink;
23
+ sandbox: Sandbox;
24
+ secretStore: SecretStore;
25
+ memoryStore: MemoryStore;
26
+ eventBus: EventBus;
27
+ }
28
+ /**
29
+ * Resolve all infrastructure adapters from the registry.
30
+ *
31
+ * AuditSink is created with a config-dependent file path (the registry
32
+ * `file-audit-sink` entry is metadata-only since the path is deployment-
33
+ * specific). All other adapters are resolved from the registry.
34
+ */
35
+ export declare function resolveInfrastructure(registry: AdapterRegistry, config: InfrastructureConfig): InfrastructureContext;
36
+ /**
37
+ * Create a webhook bridge for converting external events to pipeline triggers.
38
+ */
39
+ export declare function createPipelineWebhookBridge(): WebhookBridge<unknown>;
40
+ /**
41
+ * Create a pipeline adapter fetcher.
42
+ * Returns the real git fetcher unless `AI_SDLC_ADAPTER_FETCH=stub`.
43
+ */
44
+ export declare function createPipelineAdapterFetcher(): GitAdapterFetcher;
45
+ /**
46
+ * Resolve a git-based adapter reference and fetch its metadata.
47
+ */
48
+ export declare function resolveAdapterFromGit(ref: string, fetcher?: GitAdapterFetcher): Promise<GitResolveResult>;
49
+ /**
50
+ * Scan a local directory for adapter metadata files.
51
+ */
52
+ export declare function scanPipelineAdapters(options: ScanOptions): Promise<ScanResult>;
53
+ /**
54
+ * Create a GitHub Actions CI adapter for the pipeline.
55
+ * Requires `GITHUB_REPOSITORY_OWNER` and `GITHUB_REPOSITORY` env vars.
56
+ */
57
+ export declare function createPipelineCIAdapter(): CIPipeline;
58
+ export { createGitHubCIPipeline, createDockerSandbox, createLinearIssueTracker, resolveSecret, createGitLabSourceControl, createGitLabCIPipeline, createJiraIssueTracker, createWebhookServer, createGitHubWebhookProvider, verifyGitHubSignature, createGitLabWebhookProvider, verifyGitLabToken, createJiraWebhookProvider, createLinearWebhookProvider, verifyLinearSignature, createAdapterRegistry, validateAdapterMetadata, parseMetadataYaml, scanLocalAdapters, createStubCodeAnalysis, createStubMessenger, createStubDeploymentTarget, createStubGitLabCI, createStubGitLabSource, createStubJira, createStubBitbucket, createStubSonarQube, createStubSemgrep, createInMemoryAuditSink, createFileSink, createEnvSecretStore, createInMemoryMemoryStore, createInProcessEventBus, createStubSandbox, createWebhookBridge, parseGitAdapterRef, buildRawUrl, createGitAdapterFetcher, createStubGitAdapterFetcher, resolveGitAdapter, } from '@ai-sdlc/reference';
59
+ export type { AdapterRegistry, AdapterMetadata, AdapterStability, AdapterFactory, MetadataValidationResult, ScanOptions, ScanResult, WebhookBridge, WebhookTransformer, GitAdapterReference, GitAdapterFetcher, GitResolveResult, CIPipeline, CodeAnalysis, Messenger, DeploymentTarget, EventBus, IssueTracker, LinearClientLike, IssueComment, AdapterInterfaces, EventStream, IssueFilter, CommitStatus, TestResults, CoverageReport, Finding, SeveritySummary, DeploymentStatus, StubCodeAnalysisConfig, StubCodeAnalysisAdapter, NotificationLogEntry, StubMessengerAdapter, StubDeploymentTargetAdapter, StubGitLabCIAdapter, StubGitLabSourceAdapter, StubJiraAdapter, StubBitbucketAdapter, StubSonarQubeConfig, StubSonarQubeAdapter, StubSemgrepConfig, StubSemgrepAdapter, AuditSink, AuditLog, InMemoryAuditSink, SecretStore, Sandbox, MemoryStore, InMemoryMemoryStore, InProcessEventBus, DockerSandboxConfig, BuildStatus, GitLabConfig, JiraConfig, WebhookServer, WebhookServerConfig, WebhookProviderConfig, GitHubWebhookConfig, GitHubWebhookBridges, GitLabWebhookConfig, JiraWebhookConfig, LinearWebhookConfig, } from '@ai-sdlc/reference';
60
+ //# sourceMappingURL=adapters.d.ts.map
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Adapter ecosystem integration — wraps all community adapter stubs,
3
+ * webhook bridge, git-based adapter resolver, and adapter registry/scanner
4
+ * into the dogfood pipeline.
5
+ */
6
+ import { join } from 'node:path';
7
+ import { DEFAULT_CONFIG_DIR_NAME, DEFAULT_DOCKER_IMAGE, DEFAULT_WORKFLOW_FILE, } from './defaults.js';
8
+ import {
9
+ // Registry & scanner (used in function bodies)
10
+ createAdapterRegistry, scanLocalAdapters,
11
+ // Community stubs (used in registry registration)
12
+ createStubCodeAnalysis, createStubMessenger, createStubDeploymentTarget, createStubGitLabCI, createStubGitLabSource, createStubJira, createStubBitbucket, createStubSonarQube, createStubSemgrep,
13
+ // Infrastructure adapter stubs
14
+ createInMemoryAuditSink, createFileSink, createAuditLog, createEnvSecretStore, createInMemoryMemoryStore, createInProcessEventBus, createStubSandbox,
15
+ // Docker sandbox
16
+ createDockerSandbox,
17
+ // Webhook bridge (used in function body)
18
+ createWebhookBridge,
19
+ // Git resolver (used in function bodies)
20
+ createStubGitAdapterFetcher, createGitAdapterFetcher, resolveGitAdapter,
21
+ // GitHub CI adapter
22
+ createGitHubCIPipeline, } from '@ai-sdlc/reference';
23
+ /**
24
+ * Create an adapter registry pre-loaded with all built-in and community adapters.
25
+ */
26
+ export function createPipelineAdapterRegistry() {
27
+ const registry = createAdapterRegistry();
28
+ const stubMeta = (name, displayName, iface, _type) => ({
29
+ name,
30
+ displayName,
31
+ description: `Stub ${displayName} adapter for testing`,
32
+ version: '0.1.0',
33
+ stability: 'alpha',
34
+ interfaces: [iface],
35
+ owner: 'ai-sdlc',
36
+ specVersions: ['v1alpha1'],
37
+ });
38
+ // Register built-in adapter factories
39
+ registry.register(stubMeta('code-analysis-stub', 'Code Analysis', 'CodeAnalysis', 'stub'), () => createStubCodeAnalysis());
40
+ registry.register(stubMeta('messenger-stub', 'Messenger', 'Messenger', 'stub'), () => createStubMessenger());
41
+ registry.register(stubMeta('deployment-stub', 'Deployment', 'DeploymentTarget', 'stub'), () => createStubDeploymentTarget());
42
+ registry.register(stubMeta('gitlab-ci-stub', 'GitLab CI', 'CIPipeline', 'gitlab'), () => createStubGitLabCI());
43
+ registry.register(stubMeta('gitlab-source-stub', 'GitLab Source', 'SourceControl', 'gitlab'), () => createStubGitLabSource());
44
+ registry.register(stubMeta('jira-stub', 'Jira', 'IssueTracker', 'jira'), () => createStubJira());
45
+ registry.register(stubMeta('bitbucket-stub', 'Bitbucket', 'SourceControl', 'bitbucket'), () => createStubBitbucket());
46
+ registry.register(stubMeta('sonarqube-stub', 'SonarQube', 'CodeAnalysis', 'sonarqube'), () => createStubSonarQube());
47
+ registry.register(stubMeta('semgrep-stub', 'Semgrep', 'CodeAnalysis', 'semgrep'), () => createStubSemgrep());
48
+ // Infrastructure adapter stubs
49
+ registry.register(stubMeta('memory-audit-sink', 'In-Memory Audit Sink', 'AuditSink@v1', 'memory'), () => createInMemoryAuditSink());
50
+ // file-audit-sink is registered metadata-only; the actual file path is
51
+ // determined at resolution time by resolveInfrastructure().
52
+ registry.register(stubMeta('file-audit-sink', 'File Audit Sink', 'AuditSink@v1', 'file'));
53
+ registry.register(stubMeta('stub-sandbox', 'Stub Sandbox', 'Sandbox@v1', 'stub'), () => createStubSandbox());
54
+ registry.register(stubMeta('docker-sandbox', 'Docker Sandbox', 'Sandbox@v1', 'docker'), () => {
55
+ const exec = async (cmd) => {
56
+ const { execFile } = await import('node:child_process');
57
+ const { promisify } = await import('node:util');
58
+ const execAsync = promisify(execFile);
59
+ const [bin, ...args] = cmd.split(' ');
60
+ const { stdout } = await execAsync(bin, args);
61
+ return stdout;
62
+ };
63
+ const config = {
64
+ image: process.env.AI_SDLC_DOCKER_IMAGE ?? DEFAULT_DOCKER_IMAGE,
65
+ network: process.env.AI_SDLC_DOCKER_NETWORK,
66
+ };
67
+ return createDockerSandbox(exec, config);
68
+ });
69
+ registry.register(stubMeta('env-secret-store', 'Environment Secret Store', 'SecretStore@v1', 'env'), () => createEnvSecretStore());
70
+ registry.register(stubMeta('memory-store', 'In-Memory Memory Store', 'MemoryStore@v1', 'memory'), () => createInMemoryMemoryStore());
71
+ registry.register(stubMeta('in-process-event-bus', 'In-Process Event Bus', 'EventBus@v1', 'in-process'), () => createInProcessEventBus());
72
+ return registry;
73
+ }
74
+ /**
75
+ * Resolve all infrastructure adapters from the registry.
76
+ *
77
+ * AuditSink is created with a config-dependent file path (the registry
78
+ * `file-audit-sink` entry is metadata-only since the path is deployment-
79
+ * specific). All other adapters are resolved from the registry.
80
+ */
81
+ export function resolveInfrastructure(registry, config) {
82
+ const auditFilePath = config.auditFilePath ?? join(config.workDir, DEFAULT_CONFIG_DIR_NAME, 'audit.jsonl');
83
+ const auditSink = createFileSink(auditFilePath);
84
+ const auditLog = createAuditLog(auditSink);
85
+ // Resolve from registry — factories are guaranteed present when using
86
+ // createPipelineAdapterRegistry(), but we guard for custom registries.
87
+ const sandboxProvider = process.env.AI_SDLC_SANDBOX_PROVIDER === 'docker' ? 'docker-sandbox' : 'stub-sandbox';
88
+ const sandbox = registry.getFactory(sandboxProvider)?.() ?? createStubSandbox();
89
+ const secretStore = registry.getFactory('env-secret-store')?.() ??
90
+ createEnvSecretStore();
91
+ const memoryStore = registry.getFactory('memory-store')?.() ??
92
+ createInMemoryMemoryStore();
93
+ const eventBus = registry.getFactory('in-process-event-bus')?.() ??
94
+ createInProcessEventBus();
95
+ return { auditLog, auditSink, sandbox, secretStore, memoryStore, eventBus };
96
+ }
97
+ /**
98
+ * Create a webhook bridge for converting external events to pipeline triggers.
99
+ */
100
+ export function createPipelineWebhookBridge() {
101
+ return createWebhookBridge((payload) => payload);
102
+ }
103
+ /**
104
+ * Create a pipeline adapter fetcher.
105
+ * Returns the real git fetcher unless `AI_SDLC_ADAPTER_FETCH=stub`.
106
+ */
107
+ export function createPipelineAdapterFetcher() {
108
+ if (process.env.AI_SDLC_ADAPTER_FETCH === 'stub') {
109
+ return createStubGitAdapterFetcher(new Map());
110
+ }
111
+ return createGitAdapterFetcher();
112
+ }
113
+ /**
114
+ * Resolve a git-based adapter reference and fetch its metadata.
115
+ */
116
+ export async function resolveAdapterFromGit(ref, fetcher) {
117
+ const actualFetcher = fetcher ?? createPipelineAdapterFetcher();
118
+ return resolveGitAdapter(ref, actualFetcher);
119
+ }
120
+ /**
121
+ * Scan a local directory for adapter metadata files.
122
+ */
123
+ export async function scanPipelineAdapters(options) {
124
+ return scanLocalAdapters(options);
125
+ }
126
+ /**
127
+ * Create a GitHub Actions CI adapter for the pipeline.
128
+ * Requires `GITHUB_REPOSITORY_OWNER` and `GITHUB_REPOSITORY` env vars.
129
+ */
130
+ export function createPipelineCIAdapter() {
131
+ const org = process.env.GITHUB_REPOSITORY_OWNER ?? '';
132
+ const repo = process.env.GITHUB_REPOSITORY?.split('/')[1] ?? '';
133
+ return createGitHubCIPipeline({
134
+ org,
135
+ repo,
136
+ token: { secretRef: 'github-token' },
137
+ workflowFile: process.env.AI_SDLC_WORKFLOW_FILE ?? DEFAULT_WORKFLOW_FILE,
138
+ });
139
+ }
140
+ // Direct re-exports (passthrough)
141
+ export {
142
+ // Core adapters
143
+ createGitHubCIPipeline, createDockerSandbox, createLinearIssueTracker, resolveSecret,
144
+ // Production adapters
145
+ createGitLabSourceControl, createGitLabCIPipeline, createJiraIssueTracker,
146
+ // Webhook server
147
+ createWebhookServer,
148
+ // Webhook providers
149
+ createGitHubWebhookProvider, verifyGitHubSignature, createGitLabWebhookProvider, verifyGitLabToken, createJiraWebhookProvider, createLinearWebhookProvider, verifyLinearSignature,
150
+ // Registry & scanner
151
+ createAdapterRegistry, validateAdapterMetadata, parseMetadataYaml, scanLocalAdapters,
152
+ // Community stubs
153
+ createStubCodeAnalysis, createStubMessenger, createStubDeploymentTarget, createStubGitLabCI, createStubGitLabSource, createStubJira, createStubBitbucket, createStubSonarQube, createStubSemgrep,
154
+ // Infrastructure adapter stubs
155
+ createInMemoryAuditSink, createFileSink, createEnvSecretStore, createInMemoryMemoryStore, createInProcessEventBus, createStubSandbox,
156
+ // Webhook bridge
157
+ createWebhookBridge,
158
+ // Git resolver
159
+ parseGitAdapterRef, buildRawUrl, createGitAdapterFetcher, createStubGitAdapterFetcher, resolveGitAdapter, } from '@ai-sdlc/reference';
160
+ //# sourceMappingURL=adapters.js.map
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Admission pipeline module — composes authentication, authorization,
3
+ * mutating gates, and enforcement into a single admission flow.
4
+ */
5
+ import { admitResource, applyMutatingGates, enforce, type AdmissionPipeline, type AdmissionRequest, type AdmissionResult, type QualityGate, type AnyResource, type EvaluationContext, type AuthorizationHook, type AuthIdentity, type Authenticator, type AuthenticationResult, type ResourceKind, type ValidationResult } from '@ai-sdlc/reference';
6
+ export interface PipelineAdmissionConfig {
7
+ qualityGate: QualityGate;
8
+ evaluationContext: Partial<EvaluationContext>;
9
+ authorizer?: AuthorizationHook;
10
+ labels?: Record<string, string>;
11
+ annotations?: Record<string, string>;
12
+ reviewers?: string[];
13
+ reviewerMinComplexity?: number;
14
+ /** Override the authenticator (defaults to token-based when GITHUB_TOKEN is set). */
15
+ authenticator?: Authenticator;
16
+ }
17
+ /**
18
+ * Create a pipeline authenticator.
19
+ * When `GITHUB_TOKEN` is set, uses token-based authentication with an
20
+ * identity derived from `GITHUB_ACTOR`. Falls back to always-authenticator
21
+ * for local dev and test environments.
22
+ */
23
+ export declare function createPipelineAuthenticator(): Authenticator;
24
+ /**
25
+ * Authenticate a request token against the pipeline authenticator.
26
+ */
27
+ export declare function authenticateRequest(authenticator: Authenticator, token: string): Promise<AuthenticationResult>;
28
+ /**
29
+ * Validate pipeline resources (Pipeline, AgentRole, etc.) against JSON Schemas.
30
+ * Returns validation results for each resource.
31
+ */
32
+ export declare function validatePipelineResources(resources: Array<{
33
+ kind: ResourceKind;
34
+ data: unknown;
35
+ }>): ValidationResult[];
36
+ /**
37
+ * Create a fully configured admission pipeline for the orchestrator.
38
+ */
39
+ export declare function createPipelineAdmission(config: PipelineAdmissionConfig): AdmissionPipeline;
40
+ /**
41
+ * Run the full admission pipeline on a resource.
42
+ */
43
+ export declare function admitIssueResource(resource: AnyResource, pipeline: AdmissionPipeline, opts?: {
44
+ overrideRole?: string;
45
+ overrideJustification?: string;
46
+ }): Promise<AdmissionResult>;
47
+ export { admitResource, applyMutatingGates, enforce };
48
+ export type { AdmissionPipeline, AdmissionResult, AdmissionRequest, Authenticator, AuthIdentity, AuthenticationResult, ValidationResult, };
49
+ //# sourceMappingURL=admission.d.ts.map
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Admission pipeline module — composes authentication, authorization,
3
+ * mutating gates, and enforcement into a single admission flow.
4
+ */
5
+ import { admitResource, createAlwaysAuthenticator, createTokenAuthenticator, createLabelInjector, createMetadataEnricher, createReviewerAssigner, applyMutatingGates, enforce, validate, } from '@ai-sdlc/reference';
6
+ const DEFAULT_PIPELINE_IDENTITY = {
7
+ actor: 'ai-sdlc-pipeline',
8
+ actorType: 'ai-agent',
9
+ roles: ['pipeline-executor'],
10
+ groups: ['ai-agents'],
11
+ scopes: ['repo:read', 'repo:write'],
12
+ };
13
+ /**
14
+ * Create a pipeline authenticator.
15
+ * When `GITHUB_TOKEN` is set, uses token-based authentication with an
16
+ * identity derived from `GITHUB_ACTOR`. Falls back to always-authenticator
17
+ * for local dev and test environments.
18
+ */
19
+ export function createPipelineAuthenticator() {
20
+ const token = process.env.GITHUB_TOKEN;
21
+ const actor = process.env.GITHUB_ACTOR;
22
+ if (token && actor) {
23
+ const identity = {
24
+ actor,
25
+ actorType: 'bot',
26
+ roles: ['pipeline-executor'],
27
+ groups: ['github-actions'],
28
+ scopes: ['repo:read', 'repo:write'],
29
+ };
30
+ const tokenMap = new Map([[token, identity]]);
31
+ return createTokenAuthenticator(tokenMap);
32
+ }
33
+ return createAlwaysAuthenticator(DEFAULT_PIPELINE_IDENTITY);
34
+ }
35
+ /**
36
+ * Authenticate a request token against the pipeline authenticator.
37
+ */
38
+ export async function authenticateRequest(authenticator, token) {
39
+ return authenticator.authenticate(token);
40
+ }
41
+ /**
42
+ * Validate pipeline resources (Pipeline, AgentRole, etc.) against JSON Schemas.
43
+ * Returns validation results for each resource.
44
+ */
45
+ export function validatePipelineResources(resources) {
46
+ return resources.map(({ kind, data }) => validate(kind, data));
47
+ }
48
+ /**
49
+ * Create a fully configured admission pipeline for the orchestrator.
50
+ */
51
+ export function createPipelineAdmission(config) {
52
+ const mutatingGates = [];
53
+ // Inject standard labels (e.g., 'managed-by: ai-sdlc')
54
+ if (config.labels) {
55
+ mutatingGates.push(createLabelInjector(config.labels));
56
+ }
57
+ // Enrich metadata with annotations (e.g., compliance tags)
58
+ if (config.annotations) {
59
+ mutatingGates.push(createMetadataEnricher(config.annotations));
60
+ }
61
+ // Auto-assign reviewers based on complexity threshold
62
+ if (config.reviewers && config.reviewers.length > 0) {
63
+ const reviewerList = config.reviewers;
64
+ mutatingGates.push(createReviewerAssigner(() => reviewerList));
65
+ }
66
+ const authenticator = config.authenticator ?? createPipelineAuthenticator();
67
+ return {
68
+ authenticator,
69
+ authorizer: config.authorizer,
70
+ mutatingGates: mutatingGates.length > 0 ? mutatingGates : undefined,
71
+ qualityGate: config.qualityGate,
72
+ evaluationContext: config.evaluationContext,
73
+ };
74
+ }
75
+ /**
76
+ * Run the full admission pipeline on a resource.
77
+ */
78
+ export async function admitIssueResource(resource, pipeline, opts) {
79
+ const request = {
80
+ resource,
81
+ token: process.env.GITHUB_TOKEN || 'pipeline-token',
82
+ action: 'write',
83
+ target: resource.metadata.name,
84
+ overrideRole: opts?.overrideRole,
85
+ overrideJustification: opts?.overrideJustification,
86
+ };
87
+ return admitResource(request, pipeline);
88
+ }
89
+ export { admitResource, applyMutatingGates, enforce };
90
+ //# sourceMappingURL=admission.js.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Facade: analyzeCodebase(options) → CodebaseProfile
3
+ * Composes all analysis modules into a single pipeline.
4
+ */
5
+ import type { AnalyzerOptions, CodebaseProfile } from './types.js';
6
+ /**
7
+ * Run full codebase analysis and return a CodebaseProfile.
8
+ */
9
+ export declare function analyzeCodebase(options: AnalyzerOptions): Promise<CodebaseProfile>;
10
+ //# sourceMappingURL=analyzer.d.ts.map
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Facade: analyzeCodebase(options) → CodebaseProfile
3
+ * Composes all analysis modules into a single pipeline.
4
+ */
5
+ import { walkFiles, detectModules } from './file-walker.js';
6
+ import { parseImports, buildModuleGraph } from './dependency-parser.js';
7
+ import { detectConventions } from './convention-detector.js';
8
+ import { detectPatterns } from './pattern-detector.js';
9
+ import { analyzeHotspots } from './hotspot-analyzer.js';
10
+ import { computeComplexityScore } from './complexity-scorer.js';
11
+ import { DEFAULT_ANALYSIS_EXCLUDE, DEFAULT_GIT_HISTORY_DAYS, DEFAULT_HOTSPOT_THRESHOLD, } from '../defaults.js';
12
+ /**
13
+ * Run full codebase analysis and return a CodebaseProfile.
14
+ */
15
+ export async function analyzeCodebase(options) {
16
+ const exclude = options.exclude ?? DEFAULT_ANALYSIS_EXCLUDE;
17
+ const historyDays = options.gitHistoryDays ?? DEFAULT_GIT_HISTORY_DAYS;
18
+ const hotspotThreshold = options.hotspotThreshold ?? DEFAULT_HOTSPOT_THRESHOLD;
19
+ // Step 1: Walk filesystem
20
+ const files = await walkFiles(options.repoPath, { exclude });
21
+ // Step 2: Detect module boundaries
22
+ const modules = await detectModules(options.repoPath, { exclude });
23
+ // Step 3: Parse imports for all files
24
+ const importsByFile = new Map();
25
+ for (const file of files) {
26
+ const imports = await parseImports(file.path);
27
+ importsByFile.set(file.relativePath, imports);
28
+ }
29
+ // Step 4: Build module dependency graph
30
+ const moduleGraph = await buildModuleGraph(files, modules, options.repoPath);
31
+ // Step 5: Detect architectural patterns
32
+ const architecturalPatterns = detectPatterns(files, modules);
33
+ // Step 6: Detect conventions
34
+ const conventions = detectConventions(files);
35
+ // Step 7: Analyze hotspots
36
+ const hotspots = await analyzeHotspots(options.repoPath, files, importsByFile, {
37
+ historyDays,
38
+ threshold: hotspotThreshold,
39
+ });
40
+ // Step 8: Compute overall complexity
41
+ const allImportCounts = [...importsByFile.values()].map((imps) => imps.length);
42
+ const avgFileComplexity = allImportCounts.length > 0
43
+ ? allImportCounts.reduce((a, b) => a + b, 0) / allImportCounts.length
44
+ : 0;
45
+ const score = computeComplexityScore({
46
+ filesCount: files.length,
47
+ modulesCount: modules.length,
48
+ dependencyCount: moduleGraph.externalDependencies.length,
49
+ avgFileComplexity,
50
+ cycleCount: moduleGraph.cycles.length,
51
+ hotspotCount: hotspots.length,
52
+ });
53
+ return {
54
+ repoPath: options.repoPath,
55
+ score,
56
+ filesCount: files.length,
57
+ modulesCount: modules.length,
58
+ dependencyCount: moduleGraph.externalDependencies.length,
59
+ modules,
60
+ moduleGraph,
61
+ architecturalPatterns,
62
+ hotspots,
63
+ conventions,
64
+ analyzedAt: new Date().toISOString(),
65
+ };
66
+ }
67
+ //# sourceMappingURL=analyzer.js.map
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Compute overall codebase complexity score 1-10 from all analysis signals.
3
+ *
4
+ * Weighted formula:
5
+ * fileCount weight: 0.2 (more files = more complex)
6
+ * moduleCount weight: 0.15 (more modules = more complex)
7
+ * dependencyCount weight: 0.15 (more deps = more complex)
8
+ * avgFileComplexity weight: 0.2 (average file complexity)
9
+ * cycleCount weight: 0.15 (cycles = structural complexity)
10
+ * hotspotRatio weight: 0.15 (more hotspots = more risk)
11
+ */
12
+ export interface ComplexityInputs {
13
+ filesCount: number;
14
+ modulesCount: number;
15
+ dependencyCount: number;
16
+ avgFileComplexity: number;
17
+ cycleCount: number;
18
+ hotspotCount: number;
19
+ }
20
+ /**
21
+ * Compute overall codebase complexity score on a 1-10 scale.
22
+ */
23
+ export declare function computeComplexityScore(inputs: ComplexityInputs): number;
24
+ //# sourceMappingURL=complexity-scorer.d.ts.map
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Compute overall codebase complexity score 1-10 from all analysis signals.
3
+ *
4
+ * Weighted formula:
5
+ * fileCount weight: 0.2 (more files = more complex)
6
+ * moduleCount weight: 0.15 (more modules = more complex)
7
+ * dependencyCount weight: 0.15 (more deps = more complex)
8
+ * avgFileComplexity weight: 0.2 (average file complexity)
9
+ * cycleCount weight: 0.15 (cycles = structural complexity)
10
+ * hotspotRatio weight: 0.15 (more hotspots = more risk)
11
+ */
12
+ /**
13
+ * Normalize a value to 0-1 using a sigmoid-like curve.
14
+ * The midpoint parameter controls where the curve is at 0.5.
15
+ */
16
+ function normalize(value, midpoint) {
17
+ return value / (value + midpoint);
18
+ }
19
+ /**
20
+ * Compute overall codebase complexity score on a 1-10 scale.
21
+ */
22
+ export function computeComplexityScore(inputs) {
23
+ const fileScore = normalize(inputs.filesCount, 200); // 200 files ≈ 0.5
24
+ const moduleScore = normalize(inputs.modulesCount, 10); // 10 modules ≈ 0.5
25
+ const depScore = normalize(inputs.dependencyCount, 50); // 50 deps ≈ 0.5
26
+ const complexityScore = inputs.avgFileComplexity / 10; // Already 0-1 range (1-10 / 10)
27
+ const cycleScore = normalize(inputs.cycleCount, 2); // 2 cycles ≈ 0.5
28
+ const hotspotScore = normalize(inputs.hotspotCount, 5); // 5 hotspots ≈ 0.5
29
+ const weighted = fileScore * 0.2 +
30
+ moduleScore * 0.15 +
31
+ depScore * 0.15 +
32
+ complexityScore * 0.2 +
33
+ cycleScore * 0.15 +
34
+ hotspotScore * 0.15;
35
+ // Scale from [0, 1] to [1, 10]
36
+ const score = 1 + weighted * 9;
37
+ return Math.round(score * 10) / 10;
38
+ }
39
+ //# sourceMappingURL=complexity-scorer.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Build CodebaseContext from a CodebaseProfile for agent prompt injection.
3
+ */
4
+ import type { CodebaseProfile, CodebaseContext } from './types.js';
5
+ /**
6
+ * Build a CodebaseContext from a CodebaseProfile.
7
+ * This is injected into agent prompts as the "## Codebase Context" section.
8
+ */
9
+ export declare function buildCodebaseContext(profile: CodebaseProfile): CodebaseContext;
10
+ /**
11
+ * Format a CodebaseContext into a markdown section for prompt injection.
12
+ */
13
+ export declare function formatContextForPrompt(ctx: CodebaseContext): string;
14
+ //# sourceMappingURL=context-builder.d.ts.map
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Build CodebaseContext from a CodebaseProfile for agent prompt injection.
3
+ */
4
+ /**
5
+ * Build architecture summary string from profile patterns.
6
+ */
7
+ function buildArchitectureSummary(profile) {
8
+ if (profile.architecturalPatterns.length === 0) {
9
+ return 'No dominant architectural patterns detected.';
10
+ }
11
+ const lines = [];
12
+ for (const pattern of profile.architecturalPatterns.slice(0, 3)) {
13
+ const pct = Math.round(pattern.confidence * 100);
14
+ lines.push(`This codebase uses a ${pattern.name} architecture (${pct}% confidence). ${pattern.description}.`);
15
+ }
16
+ return lines.join(' ');
17
+ }
18
+ /**
19
+ * Build conventions summary string from profile conventions.
20
+ */
21
+ function buildConventionsSummary(profile) {
22
+ if (profile.conventions.length === 0) {
23
+ return 'No conventions detected.';
24
+ }
25
+ const lines = [];
26
+ for (const conv of profile.conventions) {
27
+ lines.push(`- **${conv.category}**: ${conv.pattern}`);
28
+ }
29
+ return lines.join('\n');
30
+ }
31
+ /**
32
+ * Build hotspots summary string from profile hotspots.
33
+ */
34
+ function buildHotspotsSummary(profile) {
35
+ if (profile.hotspots.length === 0) {
36
+ return 'No hotspots detected.';
37
+ }
38
+ const lines = [];
39
+ for (const spot of profile.hotspots.slice(0, 5)) {
40
+ const churnPct = Math.round(spot.churnRate * 100);
41
+ lines.push(`- \`${spot.filePath}\` — churn: ${churnPct}%, complexity: ${spot.complexity}/10`);
42
+ }
43
+ return lines.join('\n');
44
+ }
45
+ /**
46
+ * Build a CodebaseContext from a CodebaseProfile.
47
+ * This is injected into agent prompts as the "## Codebase Context" section.
48
+ */
49
+ export function buildCodebaseContext(profile) {
50
+ return {
51
+ score: profile.score,
52
+ filesCount: profile.filesCount,
53
+ modulesCount: profile.modulesCount,
54
+ dependencyCount: profile.dependencyCount,
55
+ architectureSummary: buildArchitectureSummary(profile),
56
+ conventionsSummary: buildConventionsSummary(profile),
57
+ hotspotsSummary: buildHotspotsSummary(profile),
58
+ };
59
+ }
60
+ /**
61
+ * Format a CodebaseContext into a markdown section for prompt injection.
62
+ */
63
+ export function formatContextForPrompt(ctx) {
64
+ const lines = [
65
+ '## Codebase Context',
66
+ `Complexity: ${ctx.score}/10 | ${ctx.filesCount} files | ${ctx.modulesCount} modules | ${ctx.dependencyCount} dependencies`,
67
+ '',
68
+ '### Architecture',
69
+ ctx.architectureSummary,
70
+ '',
71
+ '### Conventions (follow these)',
72
+ ctx.conventionsSummary,
73
+ '',
74
+ '### Hotspots (extra care required)',
75
+ ctx.hotspotsSummary,
76
+ ];
77
+ return lines.join('\n');
78
+ }
79
+ //# sourceMappingURL=context-builder.js.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Detect coding conventions: naming style, test organization, import style.
3
+ */
4
+ import type { FileInfo, DetectedConvention } from './types.js';
5
+ /**
6
+ * Detect coding conventions from the file list.
7
+ */
8
+ export declare function detectConventions(files: FileInfo[]): DetectedConvention[];
9
+ //# sourceMappingURL=convention-detector.d.ts.map