@ai-sdlc/orchestrator 0.5.0 → 0.9.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 (227) hide show
  1. package/dist/action-enforcement.d.ts +26 -0
  2. package/dist/action-enforcement.js +70 -0
  3. package/dist/admission-composite.d.ts +67 -0
  4. package/dist/admission-composite.js +158 -0
  5. package/dist/admission-enrichment.d.ts +142 -0
  6. package/dist/admission-enrichment.js +331 -0
  7. package/dist/admission-hc.d.ts +62 -0
  8. package/dist/admission-hc.js +83 -0
  9. package/dist/admission-score.d.ts +148 -0
  10. package/dist/admission-score.js +237 -0
  11. package/dist/analysis/analyzer.js +3 -2
  12. package/dist/analysis/convention-detector.d.ts +85 -2
  13. package/dist/analysis/convention-detector.js +375 -70
  14. package/dist/analysis/diff-analyzer.d.ts +33 -0
  15. package/dist/analysis/diff-analyzer.js +122 -0
  16. package/dist/analysis/hotspot-analyzer.js +3 -1
  17. package/dist/analysis/index.d.ts +2 -1
  18. package/dist/analysis/index.js +2 -1
  19. package/dist/artifacts/index.d.ts +65 -0
  20. package/dist/artifacts/index.js +142 -0
  21. package/dist/backlog-adapter.d.ts +121 -0
  22. package/dist/backlog-adapter.js +438 -0
  23. package/dist/calibration.d.ts +43 -0
  24. package/dist/calibration.js +76 -0
  25. package/dist/cli/commands/agents.d.ts +24 -0
  26. package/dist/cli/commands/agents.js +66 -1
  27. package/dist/cli/commands/git-remote.d.ts +49 -0
  28. package/dist/cli/commands/git-remote.js +91 -0
  29. package/dist/cli/commands/health.d.ts +4 -0
  30. package/dist/cli/commands/health.js +13 -1
  31. package/dist/cli/commands/init.d.ts +26 -0
  32. package/dist/cli/commands/init.js +164 -22
  33. package/dist/cli/commands/mcp-setup.d.ts +31 -0
  34. package/dist/cli/commands/mcp-setup.js +78 -8
  35. package/dist/cli/formatters/table.js +15 -2
  36. package/dist/cli/index.d.ts +14 -1
  37. package/dist/cli/index.js +81 -20
  38. package/dist/cli/versions.d.ts +57 -0
  39. package/dist/cli/versions.js +128 -0
  40. package/dist/code-area-classifier.d.ts +21 -0
  41. package/dist/code-area-classifier.js +48 -0
  42. package/dist/config.d.ts +33 -1
  43. package/dist/config.js +78 -8
  44. package/dist/cycle-utils.d.ts +51 -0
  45. package/dist/cycle-utils.js +77 -0
  46. package/dist/database/adapters/external.d.ts +24 -0
  47. package/dist/database/adapters/external.js +80 -0
  48. package/dist/database/adapters/neon.d.ts +41 -0
  49. package/dist/database/adapters/neon.js +98 -0
  50. package/dist/database/adapters/pg-snapshot-restore.d.ts +28 -0
  51. package/dist/database/adapters/pg-snapshot-restore.js +68 -0
  52. package/dist/database/adapters/sqlite-copy.d.ts +32 -0
  53. package/dist/database/adapters/sqlite-copy.js +145 -0
  54. package/dist/database/connection-injection.d.ts +35 -0
  55. package/dist/database/connection-injection.js +93 -0
  56. package/dist/database/index.d.ts +12 -0
  57. package/dist/database/index.js +23 -0
  58. package/dist/database/registry.d.ts +13 -0
  59. package/dist/database/registry.js +27 -0
  60. package/dist/database/topology.d.ts +52 -0
  61. package/dist/database/topology.js +44 -0
  62. package/dist/database/types.d.ts +89 -0
  63. package/dist/database/types.js +26 -0
  64. package/dist/defaults.d.ts +5 -0
  65. package/dist/defaults.js +5 -0
  66. package/dist/design-authority.d.ts +40 -0
  67. package/dist/design-authority.js +71 -0
  68. package/dist/design-lookahead.d.ts +64 -0
  69. package/dist/design-lookahead.js +86 -0
  70. package/dist/design-quality-trend.d.ts +87 -0
  71. package/dist/design-quality-trend.js +190 -0
  72. package/dist/design-system-context.d.ts +46 -0
  73. package/dist/design-system-context.js +80 -0
  74. package/dist/design-system-correction-loop.d.ts +64 -0
  75. package/dist/design-system-correction-loop.js +128 -0
  76. package/dist/design-system-metrics.d.ts +61 -0
  77. package/dist/design-system-metrics.js +104 -0
  78. package/dist/design-system-stewardship.d.ts +22 -0
  79. package/dist/design-system-stewardship.js +85 -0
  80. package/dist/design-system-validation.d.ts +37 -0
  81. package/dist/design-system-validation.js +88 -0
  82. package/dist/dispatch/index.d.ts +4 -0
  83. package/dist/dispatch/index.js +4 -0
  84. package/dist/dispatch/merge-gate.d.ts +46 -0
  85. package/dist/dispatch/merge-gate.js +90 -0
  86. package/dist/dispatch/requeue.d.ts +57 -0
  87. package/dist/dispatch/requeue.js +131 -0
  88. package/dist/dispatch/worker-pool.d.ts +62 -0
  89. package/dist/dispatch/worker-pool.js +60 -0
  90. package/dist/execute.d.ts +40 -0
  91. package/dist/execute.js +295 -30
  92. package/dist/fix-ci.js +40 -3
  93. package/dist/fix-review.d.ts +66 -0
  94. package/dist/fix-review.js +448 -0
  95. package/dist/harness/adapters/claude-code.d.ts +29 -0
  96. package/dist/harness/adapters/claude-code.js +191 -0
  97. package/dist/harness/adapters/codex.d.ts +25 -0
  98. package/dist/harness/adapters/codex.js +61 -0
  99. package/dist/harness/independence.d.ts +51 -0
  100. package/dist/harness/independence.js +67 -0
  101. package/dist/harness/index.d.ts +14 -0
  102. package/dist/harness/index.js +20 -0
  103. package/dist/harness/registry.d.ts +17 -0
  104. package/dist/harness/registry.js +31 -0
  105. package/dist/harness/types.d.ts +123 -0
  106. package/dist/harness/types.js +8 -0
  107. package/dist/harness/version-probe.d.ts +14 -0
  108. package/dist/harness/version-probe.js +123 -0
  109. package/dist/index.d.ts +39 -5
  110. package/dist/index.js +48 -3
  111. package/dist/models/classifier.d.ts +76 -0
  112. package/dist/models/classifier.js +221 -0
  113. package/dist/models/index.d.ts +3 -0
  114. package/dist/models/index.js +3 -0
  115. package/dist/models/registry.d.ts +97 -0
  116. package/dist/models/registry.js +173 -0
  117. package/dist/pillar-breakdown.d.ts +63 -0
  118. package/dist/pillar-breakdown.js +153 -0
  119. package/dist/pipeline-cycle-detector.d.ts +70 -0
  120. package/dist/pipeline-cycle-detector.js +111 -0
  121. package/dist/priority.d.ts +7 -76
  122. package/dist/priority.js +18 -5
  123. package/dist/review-meta.d.ts +65 -0
  124. package/dist/review-meta.js +149 -0
  125. package/dist/review.d.ts +35 -0
  126. package/dist/review.js +84 -0
  127. package/dist/runners/claude-code-sdk.d.ts +31 -0
  128. package/dist/runners/claude-code-sdk.js +238 -0
  129. package/dist/runners/claude-code.d.ts +3 -0
  130. package/dist/runners/claude-code.js +319 -73
  131. package/dist/runners/codex.js +4 -1
  132. package/dist/runners/copilot.js +4 -1
  133. package/dist/runners/cursor.js +4 -1
  134. package/dist/runners/git-utils.d.ts +81 -0
  135. package/dist/runners/git-utils.js +201 -0
  136. package/dist/runners/index.d.ts +5 -1
  137. package/dist/runners/index.js +4 -0
  138. package/dist/runners/review-agent.d.ts +67 -0
  139. package/dist/runners/review-agent.js +350 -0
  140. package/dist/runners/runner-registry.js +10 -0
  141. package/dist/runners/sdk-review-runner.d.ts +65 -0
  142. package/dist/runners/sdk-review-runner.js +185 -0
  143. package/dist/runners/security-triage.d.ts +20 -4
  144. package/dist/runners/security-triage.js +42 -14
  145. package/dist/runners/types.d.ts +25 -0
  146. package/dist/runtime/attestations.d.ts +274 -0
  147. package/dist/runtime/attestations.js +460 -0
  148. package/dist/runtime/git-env.d.ts +53 -0
  149. package/dist/runtime/git-env.js +60 -0
  150. package/dist/runtime/index.d.ts +7 -0
  151. package/dist/runtime/index.js +7 -0
  152. package/dist/runtime/parallelism-flag.d.ts +10 -0
  153. package/dist/runtime/parallelism-flag.js +18 -0
  154. package/dist/runtime/port-allocator.d.ts +21 -0
  155. package/dist/runtime/port-allocator.js +66 -0
  156. package/dist/runtime/worktree-pool.d.ts +86 -0
  157. package/dist/runtime/worktree-pool.js +204 -0
  158. package/dist/runtime/worktree.d.ts +25 -0
  159. package/dist/runtime/worktree.js +111 -0
  160. package/dist/sa-scoring/auto-calibrate.d.ts +69 -0
  161. package/dist/sa-scoring/auto-calibrate.js +107 -0
  162. package/dist/sa-scoring/c1-sa2-computable.d.ts +42 -0
  163. package/dist/sa-scoring/c1-sa2-computable.js +59 -0
  164. package/dist/sa-scoring/composite.d.ts +107 -0
  165. package/dist/sa-scoring/composite.js +139 -0
  166. package/dist/sa-scoring/depparse-client.d.ts +79 -0
  167. package/dist/sa-scoring/depparse-client.js +187 -0
  168. package/dist/sa-scoring/did-compiler.d.ts +122 -0
  169. package/dist/sa-scoring/did-compiler.js +286 -0
  170. package/dist/sa-scoring/drift-monitor.d.ts +84 -0
  171. package/dist/sa-scoring/drift-monitor.js +186 -0
  172. package/dist/sa-scoring/exemplar-bank.d.ts +78 -0
  173. package/dist/sa-scoring/exemplar-bank.js +154 -0
  174. package/dist/sa-scoring/feedback-store.d.ts +100 -0
  175. package/dist/sa-scoring/feedback-store.js +156 -0
  176. package/dist/sa-scoring/index.d.ts +71 -0
  177. package/dist/sa-scoring/index.js +158 -0
  178. package/dist/sa-scoring/layer1-deterministic.d.ts +115 -0
  179. package/dist/sa-scoring/layer1-deterministic.js +298 -0
  180. package/dist/sa-scoring/layer2-structural.d.ts +71 -0
  181. package/dist/sa-scoring/layer2-structural.js +151 -0
  182. package/dist/sa-scoring/layer3-llm.d.ts +86 -0
  183. package/dist/sa-scoring/layer3-llm.js +282 -0
  184. package/dist/sa-scoring/rescore-orchestrator.d.ts +52 -0
  185. package/dist/sa-scoring/rescore-orchestrator.js +47 -0
  186. package/dist/scheduling/burn-down.d.ts +27 -0
  187. package/dist/scheduling/burn-down.js +43 -0
  188. package/dist/scheduling/calibration.d.ts +42 -0
  189. package/dist/scheduling/calibration.js +150 -0
  190. package/dist/scheduling/index.d.ts +8 -0
  191. package/dist/scheduling/index.js +8 -0
  192. package/dist/scheduling/ledger.d.ts +59 -0
  193. package/dist/scheduling/ledger.js +216 -0
  194. package/dist/scheduling/off-peak.d.ts +27 -0
  195. package/dist/scheduling/off-peak.js +112 -0
  196. package/dist/scheduling/schedule-decision.d.ts +39 -0
  197. package/dist/scheduling/schedule-decision.js +89 -0
  198. package/dist/scheduling/tier-analysis.d.ts +47 -0
  199. package/dist/scheduling/tier-analysis.js +81 -0
  200. package/dist/scheduling/types.d.ts +140 -0
  201. package/dist/scheduling/types.js +11 -0
  202. package/dist/shared.d.ts +13 -0
  203. package/dist/shared.js +32 -0
  204. package/dist/state/index.d.ts +1 -1
  205. package/dist/state/schema.d.ts +6 -1
  206. package/dist/state/schema.js +276 -1
  207. package/dist/state/store.d.ts +71 -1
  208. package/dist/state/store.js +464 -7
  209. package/dist/state/types.d.ts +174 -0
  210. package/dist/types.d.ts +1 -1
  211. package/dist/validate-agent-output.js +4 -1
  212. package/dist/watch.js +6 -0
  213. package/dist/workflow-patterns/artifact-writer.d.ts +16 -0
  214. package/dist/workflow-patterns/artifact-writer.js +34 -0
  215. package/dist/workflow-patterns/classifiers.d.ts +10 -0
  216. package/dist/workflow-patterns/classifiers.js +72 -0
  217. package/dist/workflow-patterns/detector.d.ts +27 -0
  218. package/dist/workflow-patterns/detector.js +186 -0
  219. package/dist/workflow-patterns/index.d.ts +8 -0
  220. package/dist/workflow-patterns/index.js +7 -0
  221. package/dist/workflow-patterns/proposal-generator.d.ts +15 -0
  222. package/dist/workflow-patterns/proposal-generator.js +183 -0
  223. package/dist/workflow-patterns/telemetry-ingest.d.ts +27 -0
  224. package/dist/workflow-patterns/telemetry-ingest.js +103 -0
  225. package/dist/workflow-patterns/types.d.ts +61 -0
  226. package/dist/workflow-patterns/types.js +11 -0
  227. package/package.json +2 -2
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Proposal generator — creates draft automation artifacts from detected patterns.
3
+ * Each pattern type maps to a specific artifact: command, skill, hook, or workflow.
4
+ */
5
+ /**
6
+ * Generate an automation proposal from a detected pattern.
7
+ */
8
+ export function generateProposal(pattern) {
9
+ const name = generateName(pattern);
10
+ switch (pattern.suggestedArtifactType) {
11
+ case 'command':
12
+ return {
13
+ proposalType: pattern.patternType,
14
+ artifactType: 'command',
15
+ artifactPath: `.claude/commands/${name}.md`,
16
+ draftContent: generateCommandTemplate(name, pattern),
17
+ confidence: computeProposalConfidence(pattern),
18
+ status: 'pending',
19
+ };
20
+ case 'skill':
21
+ return {
22
+ proposalType: pattern.patternType,
23
+ artifactType: 'skill',
24
+ artifactPath: `.claude/skills/${name}/SKILL.md`,
25
+ draftContent: generateSkillTemplate(name, pattern),
26
+ confidence: computeProposalConfidence(pattern),
27
+ status: 'pending',
28
+ };
29
+ case 'workflow':
30
+ return {
31
+ proposalType: pattern.patternType,
32
+ artifactType: 'workflow',
33
+ artifactPath: `.github/workflows/auto-${name}.yml`,
34
+ draftContent: generateWorkflowTemplate(name, pattern),
35
+ confidence: computeProposalConfidence(pattern),
36
+ status: 'pending',
37
+ };
38
+ case 'hook':
39
+ return {
40
+ proposalType: pattern.patternType,
41
+ artifactType: 'hook',
42
+ artifactPath: `.claude/hooks/${name}.sh`,
43
+ draftContent: generateHookTemplate(name, pattern),
44
+ confidence: computeProposalConfidence(pattern),
45
+ status: 'pending',
46
+ };
47
+ default:
48
+ return {
49
+ proposalType: pattern.patternType,
50
+ artifactType: 'command',
51
+ artifactPath: `.claude/commands/${name}.md`,
52
+ draftContent: generateCommandTemplate(name, pattern),
53
+ confidence: computeProposalConfidence(pattern),
54
+ status: 'pending',
55
+ };
56
+ }
57
+ }
58
+ /**
59
+ * Generate a kebab-case name from the pattern's steps.
60
+ */
61
+ export function generateName(pattern) {
62
+ // Take the most distinctive tool+action pairs
63
+ const parts = [];
64
+ for (const step of pattern.steps) {
65
+ const action = step.action
66
+ .replace(/[^a-zA-Z0-9\s]/g, '')
67
+ .trim()
68
+ .split(/\s+/)
69
+ .slice(0, 2)
70
+ .join('-')
71
+ .toLowerCase();
72
+ if (action && !parts.includes(action)) {
73
+ parts.push(action);
74
+ }
75
+ if (parts.length >= 3)
76
+ break;
77
+ }
78
+ const name = parts.length > 0 ? `auto-${parts.join('-')}` : `auto-pattern-${pattern.hash.slice(0, 8)}`;
79
+ return name.slice(0, 50);
80
+ }
81
+ function stepsToMarkdown(steps) {
82
+ return steps
83
+ .map((s, i) => {
84
+ const desc = s.action.includes(':') ? `${s.tool}: ${s.action}` : `Run \`${s.action}\``;
85
+ return `${i + 1}. ${desc}`;
86
+ })
87
+ .join('\n');
88
+ }
89
+ function generateCommandTemplate(name, pattern) {
90
+ return `---
91
+ name: ${name}
92
+ description: Auto-generated from detected workflow pattern (${pattern.patternType})
93
+ argument-hint: [optional-args]
94
+ ---
95
+
96
+ # ${name}
97
+
98
+ > Auto-generated from pattern detection. Confidence: ${(pattern.confidence * 100).toFixed(0)}%
99
+ > Observed ${pattern.frequency} times across ${pattern.sessionCount} sessions.
100
+
101
+ ## Steps
102
+
103
+ ${stepsToMarkdown(pattern.steps)}
104
+
105
+ ## Notes
106
+
107
+ This command was auto-generated by the workflow pattern detection engine.
108
+ Review and customize before using in production.
109
+ `;
110
+ }
111
+ function generateSkillTemplate(name, pattern) {
112
+ return `---
113
+ name: ${name}
114
+ description: Auto-generated skill from detected ${pattern.patternType} pattern
115
+ ---
116
+
117
+ # ${name}
118
+
119
+ > Auto-generated from pattern detection. Confidence: ${(pattern.confidence * 100).toFixed(0)}%
120
+ > Observed ${pattern.frequency} times across ${pattern.sessionCount} sessions.
121
+
122
+ ## Workflow
123
+
124
+ ${stepsToMarkdown(pattern.steps)}
125
+
126
+ ## Customization
127
+
128
+ This skill was auto-generated. Modify the steps above to match your
129
+ specific use case.
130
+ `;
131
+ }
132
+ function generateWorkflowTemplate(name, pattern) {
133
+ const schedule = '0 9 * * 1'; // Default: Monday 9am
134
+ return `# Auto-generated workflow from pattern detection
135
+ # Pattern: ${pattern.patternType}
136
+ # Confidence: ${(pattern.confidence * 100).toFixed(0)}%
137
+ # Observed ${pattern.frequency} times across ${pattern.sessionCount} sessions
138
+
139
+ name: Auto ${name}
140
+
141
+ on:
142
+ schedule:
143
+ - cron: '${schedule}'
144
+ workflow_dispatch:
145
+
146
+ jobs:
147
+ run:
148
+ runs-on: ubuntu-latest
149
+ steps:
150
+ - uses: actions/checkout@v4
151
+ ${pattern.steps.map((s) => ` - name: ${s.tool} ${s.action}\n run: echo "TODO: implement ${s.action}"`).join('\n')}
152
+ `;
153
+ }
154
+ function generateHookTemplate(name, pattern) {
155
+ return `#!/bin/bash
156
+ # Auto-generated hook from pattern detection
157
+ # Pattern: ${pattern.patternType}
158
+ # Confidence: ${(pattern.confidence * 100).toFixed(0)}%
159
+
160
+ set -euo pipefail
161
+
162
+ # TODO: Implement hook logic for pattern:
163
+ ${pattern.steps.map((s) => `# - ${s.tool}: ${s.action}`).join('\n')}
164
+
165
+ exit 0
166
+ `;
167
+ }
168
+ function computeProposalConfidence(pattern) {
169
+ // Base confidence from pattern detection
170
+ let confidence = pattern.confidence;
171
+ // Template fit: commands and skills have better template mapping
172
+ if (pattern.suggestedArtifactType === 'command' || pattern.suggestedArtifactType === 'skill') {
173
+ confidence *= 1.0; // Perfect fit
174
+ }
175
+ else if (pattern.suggestedArtifactType === 'workflow') {
176
+ confidence *= 0.8; // Periodic tasks need schedule tuning
177
+ }
178
+ else {
179
+ confidence *= 0.7; // Hooks need manual implementation
180
+ }
181
+ return Math.min(1.0, confidence);
182
+ }
183
+ //# sourceMappingURL=proposal-generator.js.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Telemetry ingestion — reads tool sequence JSONL and session-meta
3
+ * JSON files into ToolSequenceEvent format for pattern detection.
4
+ */
5
+ import type { ToolSequenceEvent } from '../state/types.js';
6
+ import type { SessionMeta, CanonicalStep } from './types.js';
7
+ /**
8
+ * Read tool sequence entries from a JSONL file.
9
+ * Each line is a JSON object with ts, sid, tool, action, project.
10
+ */
11
+ export declare function readToolSequenceJSONL(filePath: string): ToolSequenceEvent[];
12
+ /**
13
+ * Read session metadata from the Claude Code usage-data directory.
14
+ * Returns metadata for all sessions found.
15
+ */
16
+ export declare function readSessionMetaFiles(usageDataDir: string): SessionMeta[];
17
+ /**
18
+ * Convert session-meta tool_counts into synthetic ToolSequenceEvents.
19
+ * Since session-meta only has aggregate counts (no ordering), these
20
+ * events are useful for frequency analysis but not sequence mining.
21
+ */
22
+ export declare function sessionMetaToEvents(meta: SessionMeta): ToolSequenceEvent[];
23
+ /**
24
+ * Categorize a tool action into a workflow category.
25
+ */
26
+ export declare function categorizeAction(tool: string, action: string): CanonicalStep['category'];
27
+ //# sourceMappingURL=telemetry-ingest.d.ts.map
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Telemetry ingestion — reads tool sequence JSONL and session-meta
3
+ * JSON files into ToolSequenceEvent format for pattern detection.
4
+ */
5
+ import { readFileSync, readdirSync, existsSync } from 'node:fs';
6
+ import { join } from 'node:path';
7
+ /**
8
+ * Read tool sequence entries from a JSONL file.
9
+ * Each line is a JSON object with ts, sid, tool, action, project.
10
+ */
11
+ export function readToolSequenceJSONL(filePath) {
12
+ if (!existsSync(filePath))
13
+ return [];
14
+ const content = readFileSync(filePath, 'utf-8');
15
+ const events = [];
16
+ for (const line of content.split('\n')) {
17
+ const trimmed = line.trim();
18
+ if (!trimmed)
19
+ continue;
20
+ try {
21
+ const raw = JSON.parse(trimmed);
22
+ events.push({
23
+ sessionId: raw.sid,
24
+ toolName: raw.tool,
25
+ actionCanonical: raw.action,
26
+ projectPath: raw.project,
27
+ timestamp: raw.ts,
28
+ });
29
+ }
30
+ catch {
31
+ // Skip malformed lines
32
+ }
33
+ }
34
+ return events;
35
+ }
36
+ /**
37
+ * Read session metadata from the Claude Code usage-data directory.
38
+ * Returns metadata for all sessions found.
39
+ */
40
+ export function readSessionMetaFiles(usageDataDir) {
41
+ const metaDir = join(usageDataDir, 'session-meta');
42
+ if (!existsSync(metaDir))
43
+ return [];
44
+ const files = readdirSync(metaDir).filter((f) => f.endsWith('.json'));
45
+ const sessions = [];
46
+ for (const file of files) {
47
+ try {
48
+ const content = readFileSync(join(metaDir, file), 'utf-8');
49
+ const meta = JSON.parse(content);
50
+ if (meta.session_id && meta.tool_counts) {
51
+ sessions.push(meta);
52
+ }
53
+ }
54
+ catch {
55
+ // Skip malformed files
56
+ }
57
+ }
58
+ return sessions;
59
+ }
60
+ /**
61
+ * Convert session-meta tool_counts into synthetic ToolSequenceEvents.
62
+ * Since session-meta only has aggregate counts (no ordering), these
63
+ * events are useful for frequency analysis but not sequence mining.
64
+ */
65
+ export function sessionMetaToEvents(meta) {
66
+ const events = [];
67
+ const timestamp = meta.start_time;
68
+ for (const [tool, count] of Object.entries(meta.tool_counts)) {
69
+ for (let i = 0; i < count; i++) {
70
+ events.push({
71
+ sessionId: meta.session_id,
72
+ toolName: tool,
73
+ actionCanonical: tool.toLowerCase(),
74
+ projectPath: meta.project_path,
75
+ timestamp,
76
+ });
77
+ }
78
+ }
79
+ return events;
80
+ }
81
+ /**
82
+ * Categorize a tool action into a workflow category.
83
+ */
84
+ export function categorizeAction(tool, action) {
85
+ const lower = action.toLowerCase();
86
+ if (tool === 'Read' || lower.startsWith('read:'))
87
+ return 'read';
88
+ if (tool === 'Edit' ||
89
+ tool === 'Write' ||
90
+ lower.startsWith('edit:') ||
91
+ lower.startsWith('write:'))
92
+ return 'write';
93
+ if (lower.includes('test') || lower.includes('vitest') || lower.includes('jest'))
94
+ return 'test';
95
+ if (lower.includes('build') || lower.includes('tsc') || lower.includes('compile'))
96
+ return 'build';
97
+ if (lower.startsWith('git ') || lower.startsWith('gh '))
98
+ return 'git';
99
+ if (tool === 'Grep' || tool === 'Glob' || lower.startsWith('grep:') || lower.startsWith('glob:'))
100
+ return 'search';
101
+ return 'other';
102
+ }
103
+ //# sourceMappingURL=telemetry-ingest.js.map
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Types for the workflow pattern detection system.
3
+ */
4
+ export interface CanonicalStep {
5
+ tool: string;
6
+ action: string;
7
+ /** Category for grouping: read, write, test, build, git, search, other */
8
+ category: 'read' | 'write' | 'test' | 'build' | 'git' | 'search' | 'other';
9
+ }
10
+ export interface NGram {
11
+ steps: CanonicalStep[];
12
+ hash: string;
13
+ sessionId: string;
14
+ }
15
+ export interface DetectedPattern {
16
+ hash: string;
17
+ steps: CanonicalStep[];
18
+ frequency: number;
19
+ sessionCount: number;
20
+ confidence: number;
21
+ patternType: 'command-sequence' | 'copy-paste-cycle' | 'periodic-task';
22
+ suggestedArtifactType: 'command' | 'skill' | 'hook' | 'workflow';
23
+ firstSeen: string;
24
+ lastSeen: string;
25
+ exampleSessionIds: string[];
26
+ }
27
+ export interface DetectionOptions {
28
+ minSequenceLength: number;
29
+ maxSequenceLength: number;
30
+ minFrequency: number;
31
+ minSessionCount: number;
32
+ minConfidence: number;
33
+ projectFilter?: string;
34
+ since?: string;
35
+ }
36
+ export declare const DEFAULT_DETECTION_OPTIONS: DetectionOptions;
37
+ /** Raw tool sequence entry from the JSONL file. */
38
+ export interface RawToolSequenceEntry {
39
+ ts: string;
40
+ sid: string;
41
+ tool: string;
42
+ action: string;
43
+ project: string;
44
+ }
45
+ /** Session metadata from Claude Code usage data. */
46
+ export interface SessionMeta {
47
+ session_id: string;
48
+ project_path: string;
49
+ start_time: string;
50
+ duration_minutes: number;
51
+ user_message_count: number;
52
+ assistant_message_count: number;
53
+ tool_counts: Record<string, number>;
54
+ git_commits: number;
55
+ git_pushes: number;
56
+ first_prompt: string;
57
+ tool_errors: number;
58
+ lines_added: number;
59
+ files_modified: number;
60
+ }
61
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Types for the workflow pattern detection system.
3
+ */
4
+ export const DEFAULT_DETECTION_OPTIONS = {
5
+ minSequenceLength: 3,
6
+ maxSequenceLength: 8,
7
+ minFrequency: 3,
8
+ minSessionCount: 3,
9
+ minConfidence: 0.6,
10
+ };
11
+ //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdlc/orchestrator",
3
- "version": "0.5.0",
3
+ "version": "0.9.0",
4
4
  "description": "AI-SDLC Orchestrator — long-running runtime that drives issues through the complete SDLC with AI agents",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -45,7 +45,7 @@
45
45
  "better-sqlite3": "^11.0.0",
46
46
  "commander": "^12.0.0",
47
47
  "yaml": "^2.7.0",
48
- "@ai-sdlc/reference": "0.5.0"
48
+ "@ai-sdlc/reference": "0.9.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/better-sqlite3": "^7.6.0",