@generacy-ai/generacy 0.3.4 → 0.5.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.
- package/README.md +153 -0
- package/dist/cli/commands/cluster/scaffolder.d.ts.map +1 -1
- package/dist/cli/commands/cluster/scaffolder.js +2 -0
- package/dist/cli/commands/cluster/scaffolder.js.map +1 -1
- package/dist/cli/commands/cockpit/advance.d.ts +42 -0
- package/dist/cli/commands/cockpit/advance.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/advance.js +136 -0
- package/dist/cli/commands/cockpit/advance.js.map +1 -0
- package/dist/cli/commands/cockpit/clarification-comment-finder.d.ts +13 -0
- package/dist/cli/commands/cockpit/clarification-comment-finder.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/clarification-comment-finder.js +31 -0
- package/dist/cli/commands/cockpit/clarification-comment-finder.js.map +1 -0
- package/dist/cli/commands/cockpit/code-references.d.ts +27 -0
- package/dist/cli/commands/cockpit/code-references.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/code-references.js +48 -0
- package/dist/cli/commands/cockpit/code-references.js.map +1 -0
- package/dist/cli/commands/cockpit/context.d.ts +90 -0
- package/dist/cli/commands/cockpit/context.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/context.js +280 -0
- package/dist/cli/commands/cockpit/context.js.map +1 -0
- package/dist/cli/commands/cockpit/exit.d.ts +12 -0
- package/dist/cli/commands/cockpit/exit.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/exit.js +18 -0
- package/dist/cli/commands/cockpit/exit.js.map +1 -0
- package/dist/cli/commands/cockpit/gate-vocabulary.d.ts +48 -0
- package/dist/cli/commands/cockpit/gate-vocabulary.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/gate-vocabulary.js +96 -0
- package/dist/cli/commands/cockpit/gate-vocabulary.js.map +1 -0
- package/dist/cli/commands/cockpit/index.d.ts +20 -0
- package/dist/cli/commands/cockpit/index.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/index.js +42 -0
- package/dist/cli/commands/cockpit/index.js.map +1 -0
- package/dist/cli/commands/cockpit/manual-advance-marker.d.ts +18 -0
- package/dist/cli/commands/cockpit/manual-advance-marker.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/manual-advance-marker.js +43 -0
- package/dist/cli/commands/cockpit/manual-advance-marker.js.map +1 -0
- package/dist/cli/commands/cockpit/mcp/errors.d.ts +54 -0
- package/dist/cli/commands/cockpit/mcp/errors.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/mcp/errors.js +190 -0
- package/dist/cli/commands/cockpit/mcp/errors.js.map +1 -0
- package/dist/cli/commands/cockpit/mcp/event-bus-registry.d.ts +59 -0
- package/dist/cli/commands/cockpit/mcp/event-bus-registry.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/mcp/event-bus-registry.js +305 -0
- package/dist/cli/commands/cockpit/mcp/event-bus-registry.js.map +1 -0
- package/dist/cli/commands/cockpit/mcp/event-bus.d.ts +82 -0
- package/dist/cli/commands/cockpit/mcp/event-bus.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/mcp/event-bus.js +230 -0
- package/dist/cli/commands/cockpit/mcp/event-bus.js.map +1 -0
- package/dist/cli/commands/cockpit/mcp/index.d.ts +17 -0
- package/dist/cli/commands/cockpit/mcp/index.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/mcp/index.js +37 -0
- package/dist/cli/commands/cockpit/mcp/index.js.map +1 -0
- package/dist/cli/commands/cockpit/mcp/ref-input.d.ts +52 -0
- package/dist/cli/commands/cockpit/mcp/ref-input.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/mcp/ref-input.js +132 -0
- package/dist/cli/commands/cockpit/mcp/ref-input.js.map +1 -0
- package/dist/cli/commands/cockpit/mcp/schemas.d.ts +422 -0
- package/dist/cli/commands/cockpit/mcp/schemas.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/mcp/schemas.js +97 -0
- package/dist/cli/commands/cockpit/mcp/schemas.js.map +1 -0
- package/dist/cli/commands/cockpit/mcp/server.d.ts +17 -0
- package/dist/cli/commands/cockpit/mcp/server.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/mcp/server.js +72 -0
- package/dist/cli/commands/cockpit/mcp/server.js.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_advance.d.ts +42 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_advance.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_advance.js +73 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_advance.js.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_await_events.d.ts +34 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_await_events.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_await_events.js +115 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_await_events.js.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_context.d.ts +21 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_context.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_context.js +35 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_context.js.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_merge.d.ts +43 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_merge.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_merge.js +99 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_merge.js.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_queue.d.ts +59 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_queue.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_queue.js +106 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_queue.js.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_resume.d.ts +38 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_resume.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_resume.js +79 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_resume.js.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_scope_add.d.ts +31 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_scope_add.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_scope_add.js +81 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_scope_add.js.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_scope_remove.d.ts +30 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_scope_remove.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_scope_remove.js +80 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_scope_remove.js.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_status.d.ts +21 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_status.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_status.js +59 -0
- package/dist/cli/commands/cockpit/mcp/tools/cockpit_status.js.map +1 -0
- package/dist/cli/commands/cockpit/merge.d.ts +42 -0
- package/dist/cli/commands/cockpit/merge.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/merge.js +360 -0
- package/dist/cli/commands/cockpit/merge.js.map +1 -0
- package/dist/cli/commands/cockpit/plan-dependency-extractor.d.ts +30 -0
- package/dist/cli/commands/cockpit/plan-dependency-extractor.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/plan-dependency-extractor.js +135 -0
- package/dist/cli/commands/cockpit/plan-dependency-extractor.js.map +1 -0
- package/dist/cli/commands/cockpit/queue.d.ts +100 -0
- package/dist/cli/commands/cockpit/queue.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/queue.js +551 -0
- package/dist/cli/commands/cockpit/queue.js.map +1 -0
- package/dist/cli/commands/cockpit/resolver.d.ts +70 -0
- package/dist/cli/commands/cockpit/resolver.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/resolver.js +117 -0
- package/dist/cli/commands/cockpit/resolver.js.map +1 -0
- package/dist/cli/commands/cockpit/resume.d.ts +38 -0
- package/dist/cli/commands/cockpit/resume.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/resume.js +167 -0
- package/dist/cli/commands/cockpit/resume.js.map +1 -0
- package/dist/cli/commands/cockpit/scope/errors.d.ts +21 -0
- package/dist/cli/commands/cockpit/scope/errors.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/scope/errors.js +17 -0
- package/dist/cli/commands/cockpit/scope/errors.js.map +1 -0
- package/dist/cli/commands/cockpit/scope/retry.d.ts +24 -0
- package/dist/cli/commands/cockpit/scope/retry.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/scope/retry.js +52 -0
- package/dist/cli/commands/cockpit/scope/retry.js.map +1 -0
- package/dist/cli/commands/cockpit/scope/writer.d.ts +21 -0
- package/dist/cli/commands/cockpit/scope/writer.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/scope/writer.js +141 -0
- package/dist/cli/commands/cockpit/scope/writer.js.map +1 -0
- package/dist/cli/commands/cockpit/scope.d.ts +22 -0
- package/dist/cli/commands/cockpit/scope.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/scope.js +110 -0
- package/dist/cli/commands/cockpit/scope.js.map +1 -0
- package/dist/cli/commands/cockpit/shared/classify-issue.d.ts +12 -0
- package/dist/cli/commands/cockpit/shared/classify-issue.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/shared/classify-issue.js +10 -0
- package/dist/cli/commands/cockpit/shared/classify-issue.js.map +1 -0
- package/dist/cli/commands/cockpit/shared/failing-check-json.d.ts +53 -0
- package/dist/cli/commands/cockpit/shared/failing-check-json.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/shared/failing-check-json.js +170 -0
- package/dist/cli/commands/cockpit/shared/failing-check-json.js.map +1 -0
- package/dist/cli/commands/cockpit/shared/identity.d.ts +54 -0
- package/dist/cli/commands/cockpit/shared/identity.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/shared/identity.js +65 -0
- package/dist/cli/commands/cockpit/shared/identity.js.map +1 -0
- package/dist/cli/commands/cockpit/shared/is-done-snapshot.d.ts +16 -0
- package/dist/cli/commands/cockpit/shared/is-done-snapshot.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/shared/is-done-snapshot.js +17 -0
- package/dist/cli/commands/cockpit/shared/is-done-snapshot.js.map +1 -0
- package/dist/cli/commands/cockpit/shared/pagination.d.ts +17 -0
- package/dist/cli/commands/cockpit/shared/pagination.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/shared/pagination.js +50 -0
- package/dist/cli/commands/cockpit/shared/pagination.js.map +1 -0
- package/dist/cli/commands/cockpit/shared/pr-link.d.ts +8 -0
- package/dist/cli/commands/cockpit/shared/pr-link.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/shared/pr-link.js +15 -0
- package/dist/cli/commands/cockpit/shared/pr-link.js.map +1 -0
- package/dist/cli/commands/cockpit/shared/required-checks.d.ts +17 -0
- package/dist/cli/commands/cockpit/shared/required-checks.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/shared/required-checks.js +38 -0
- package/dist/cli/commands/cockpit/shared/required-checks.js.map +1 -0
- package/dist/cli/commands/cockpit/shared/review-context-json.d.ts +29 -0
- package/dist/cli/commands/cockpit/shared/review-context-json.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/shared/review-context-json.js +28 -0
- package/dist/cli/commands/cockpit/shared/review-context-json.js.map +1 -0
- package/dist/cli/commands/cockpit/status/color.d.ts +11 -0
- package/dist/cli/commands/cockpit/status/color.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/status/color.js +33 -0
- package/dist/cli/commands/cockpit/status/color.js.map +1 -0
- package/dist/cli/commands/cockpit/status/group.d.ts +10 -0
- package/dist/cli/commands/cockpit/status/group.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/status/group.js +50 -0
- package/dist/cli/commands/cockpit/status/group.js.map +1 -0
- package/dist/cli/commands/cockpit/status/render-table.d.ts +24 -0
- package/dist/cli/commands/cockpit/status/render-table.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/status/render-table.js +71 -0
- package/dist/cli/commands/cockpit/status/render-table.js.map +1 -0
- package/dist/cli/commands/cockpit/status/row.d.ts +18 -0
- package/dist/cli/commands/cockpit/status/row.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/status/row.js +17 -0
- package/dist/cli/commands/cockpit/status/row.js.map +1 -0
- package/dist/cli/commands/cockpit/status.d.ts +18 -0
- package/dist/cli/commands/cockpit/status.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/status.js +153 -0
- package/dist/cli/commands/cockpit/status.js.map +1 -0
- package/dist/cli/commands/cockpit/watch/actionable.d.ts +15 -0
- package/dist/cli/commands/cockpit/watch/actionable.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/watch/actionable.js +32 -0
- package/dist/cli/commands/cockpit/watch/actionable.js.map +1 -0
- package/dist/cli/commands/cockpit/watch/aggregate-emit.d.ts +107 -0
- package/dist/cli/commands/cockpit/watch/aggregate-emit.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/watch/aggregate-emit.js +41 -0
- package/dist/cli/commands/cockpit/watch/aggregate-emit.js.map +1 -0
- package/dist/cli/commands/cockpit/watch/aggregate.d.ts +25 -0
- package/dist/cli/commands/cockpit/watch/aggregate.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/watch/aggregate.js +67 -0
- package/dist/cli/commands/cockpit/watch/aggregate.js.map +1 -0
- package/dist/cli/commands/cockpit/watch/check-rollup.d.ts +9 -0
- package/dist/cli/commands/cockpit/watch/check-rollup.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/watch/check-rollup.js +22 -0
- package/dist/cli/commands/cockpit/watch/check-rollup.js.map +1 -0
- package/dist/cli/commands/cockpit/watch/diff.d.ts +33 -0
- package/dist/cli/commands/cockpit/watch/diff.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/watch/diff.js +93 -0
- package/dist/cli/commands/cockpit/watch/diff.js.map +1 -0
- package/dist/cli/commands/cockpit/watch/emit.d.ts +58 -0
- package/dist/cli/commands/cockpit/watch/emit.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/watch/emit.js +30 -0
- package/dist/cli/commands/cockpit/watch/emit.js.map +1 -0
- package/dist/cli/commands/cockpit/watch/poll-loop.d.ts +29 -0
- package/dist/cli/commands/cockpit/watch/poll-loop.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/watch/poll-loop.js +81 -0
- package/dist/cli/commands/cockpit/watch/poll-loop.js.map +1 -0
- package/dist/cli/commands/cockpit/watch/pr-state.d.ts +17 -0
- package/dist/cli/commands/cockpit/watch/pr-state.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/watch/pr-state.js +33 -0
- package/dist/cli/commands/cockpit/watch/pr-state.js.map +1 -0
- package/dist/cli/commands/cockpit/watch/snapshot.d.ts +33 -0
- package/dist/cli/commands/cockpit/watch/snapshot.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/watch/snapshot.js +30 -0
- package/dist/cli/commands/cockpit/watch/snapshot.js.map +1 -0
- package/dist/cli/commands/cockpit/watch/stream-event.d.ts +82 -0
- package/dist/cli/commands/cockpit/watch/stream-event.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/watch/stream-event.js +9 -0
- package/dist/cli/commands/cockpit/watch/stream-event.js.map +1 -0
- package/dist/cli/commands/cockpit/watch.d.ts +22 -0
- package/dist/cli/commands/cockpit/watch.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/watch.js +186 -0
- package/dist/cli/commands/cockpit/watch.js.map +1 -0
- package/dist/cli/commands/setup/build.d.ts.map +1 -1
- package/dist/cli/commands/setup/build.js +59 -0
- package/dist/cli/commands/setup/build.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/config/schema.d.ts +788 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +12 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +12 -6
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { isActionableSnapshot } from './actionable.js';
|
|
2
|
+
function nowIso() {
|
|
3
|
+
return new Date().toISOString();
|
|
4
|
+
}
|
|
5
|
+
function makeEvent(curr, event, from, to, sourceLabel, ts, opts = {}) {
|
|
6
|
+
const out = {
|
|
7
|
+
type: 'issue-transition',
|
|
8
|
+
ts,
|
|
9
|
+
repo: curr.repo,
|
|
10
|
+
kind: curr.kind,
|
|
11
|
+
number: curr.number,
|
|
12
|
+
from,
|
|
13
|
+
to,
|
|
14
|
+
sourceLabel,
|
|
15
|
+
url: curr.url,
|
|
16
|
+
event,
|
|
17
|
+
labels: [...curr.labels],
|
|
18
|
+
};
|
|
19
|
+
if (opts.initial === true)
|
|
20
|
+
out.initial = true;
|
|
21
|
+
return out;
|
|
22
|
+
}
|
|
23
|
+
function diffIssue(prev, curr, ts, out) {
|
|
24
|
+
if (prev.classified.state !== curr.classified.state ||
|
|
25
|
+
prev.classified.sourceLabel !== curr.classified.sourceLabel) {
|
|
26
|
+
out.push(makeEvent(curr, 'label-change', prev.classified.state, curr.classified.state, curr.classified.sourceLabel, ts));
|
|
27
|
+
}
|
|
28
|
+
if (prev.state === 'OPEN' && curr.state === 'CLOSED') {
|
|
29
|
+
out.push(makeEvent(curr, 'issue-closed', curr.classified.state, 'terminal', null, ts));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function diffPr(prev, curr, ts, out) {
|
|
33
|
+
if (prev.classified.state !== curr.classified.state ||
|
|
34
|
+
prev.classified.sourceLabel !== curr.classified.sourceLabel) {
|
|
35
|
+
out.push(makeEvent(curr, 'label-change', prev.classified.state, curr.classified.state, curr.classified.sourceLabel, ts));
|
|
36
|
+
}
|
|
37
|
+
if (prev.lifecycle !== 'merged' && curr.lifecycle === 'merged') {
|
|
38
|
+
out.push(makeEvent(curr, 'pr-merged', curr.classified.state, 'terminal', null, ts));
|
|
39
|
+
}
|
|
40
|
+
else if (prev.lifecycle !== 'closed' && curr.lifecycle === 'closed') {
|
|
41
|
+
out.push(makeEvent(curr, 'pr-closed', curr.classified.state, 'terminal', null, ts));
|
|
42
|
+
}
|
|
43
|
+
if (prev.checksRollup !== curr.checksRollup) {
|
|
44
|
+
out.push(makeEvent(curr, 'pr-checks', curr.classified.state, curr.classified.state, null, ts));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function computeInitialSweep(curr, ts) {
|
|
48
|
+
const out = [];
|
|
49
|
+
const sortedKeys = [...curr.keys()].sort();
|
|
50
|
+
for (const key of sortedKeys) {
|
|
51
|
+
const snap = curr.get(key);
|
|
52
|
+
if (!isActionableSnapshot(snap))
|
|
53
|
+
continue;
|
|
54
|
+
out.push(makeEvent(snap, 'label-change', null, snap.classified.state, snap.classified.sourceLabel, ts, { initial: true }));
|
|
55
|
+
}
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Compute the set of transitions between two SnapshotMaps. Events for the same
|
|
60
|
+
* key are emitted in the order: label-change → lifecycle → pr-checks.
|
|
61
|
+
*
|
|
62
|
+
* First-poll (prev empty): emits one line per actionable snapshot in `curr`,
|
|
63
|
+
* each marked `initial: true`. Non-actionable snapshots stay silent.
|
|
64
|
+
*
|
|
65
|
+
* Mid-stream first-sight (#935): on polls 2..N, a key present in `curr` but
|
|
66
|
+
* absent from `prev` (e.g. `cockpit scope add` appended a new ref to the epic
|
|
67
|
+
* body) emits one `label-change` event with `initial: true` if actionable —
|
|
68
|
+
* matching `computeInitialSweep`'s per-key shape. Non-actionable snapshots
|
|
69
|
+
* stay silent. Removals stay silent (mirrors FR-002 "removal emits nothing").
|
|
70
|
+
*/
|
|
71
|
+
export function computeTransitions(prev, curr, now = nowIso) {
|
|
72
|
+
const ts = now();
|
|
73
|
+
if (prev.size === 0)
|
|
74
|
+
return computeInitialSweep(curr, ts);
|
|
75
|
+
const out = [];
|
|
76
|
+
for (const [key, currSnap] of curr) {
|
|
77
|
+
const prevSnap = prev.get(key);
|
|
78
|
+
if (prevSnap == null) {
|
|
79
|
+
if (isActionableSnapshot(currSnap)) {
|
|
80
|
+
out.push(makeEvent(currSnap, 'label-change', null, currSnap.classified.state, currSnap.classified.sourceLabel, ts, { initial: true }));
|
|
81
|
+
}
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (prevSnap.kind === 'issue' && currSnap.kind === 'issue') {
|
|
85
|
+
diffIssue(prevSnap, currSnap, ts, out);
|
|
86
|
+
}
|
|
87
|
+
else if (prevSnap.kind === 'pr' && currSnap.kind === 'pr') {
|
|
88
|
+
diffPr(prevSnap, currSnap, ts, out);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return out;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../../../../src/cli/commands/cockpit/watch/diff.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AA+BvD,SAAS,MAAM;IACb,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAClC,CAAC;AAED,SAAS,SAAS,CAChB,IAAc,EACd,KAAgC,EAChC,IAAyB,EACzB,EAAuB,EACvB,WAA0B,EAC1B,EAAU,EACV,OAA2B,EAAE;IAE7B,MAAM,GAAG,GAAiB;QACxB,IAAI,EAAE,kBAAkB;QACxB,EAAE;QACF,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,MAAM,EAAE,IAAI,CAAC,MAAM;Q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,CAAC;aAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,IAAI,IAAI,QAAQ,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YAC5D,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { CockpitEvent } from './diff.js';
|
|
3
|
+
export declare const CockpitEventSchema: z.ZodObject<{
|
|
4
|
+
type: z.ZodLiteral<"issue-transition">;
|
|
5
|
+
ts: z.ZodString;
|
|
6
|
+
repo: z.ZodString;
|
|
7
|
+
kind: z.ZodEnum<["issue", "pr"]>;
|
|
8
|
+
number: z.ZodNumber;
|
|
9
|
+
from: z.ZodUnion<[z.ZodEnum<["pending", "active", "waiting", "error", "terminal", "stage-complete", "unknown"]>, z.ZodNull]>;
|
|
10
|
+
to: z.ZodUnion<[z.ZodEnum<["pending", "active", "waiting", "error", "terminal", "stage-complete", "unknown"]>, z.ZodNull]>;
|
|
11
|
+
sourceLabel: z.ZodNullable<z.ZodString>;
|
|
12
|
+
url: z.ZodString;
|
|
13
|
+
event: z.ZodEnum<["label-change", "issue-closed", "pr-merged", "pr-closed", "pr-checks"]>;
|
|
14
|
+
labels: z.ZodArray<z.ZodString, "many">;
|
|
15
|
+
initial: z.ZodOptional<z.ZodLiteral<true>>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
number: number;
|
|
18
|
+
event: "label-change" | "issue-closed" | "pr-merged" | "pr-closed" | "pr-checks";
|
|
19
|
+
repo: string;
|
|
20
|
+
from: "error" | "pending" | "unknown" | "active" | "waiting" | "terminal" | "stage-complete" | null;
|
|
21
|
+
to: "error" | "pending" | "unknown" | "active" | "waiting" | "terminal" | "stage-complete" | null;
|
|
22
|
+
type: "issue-transition";
|
|
23
|
+
url: string;
|
|
24
|
+
sourceLabel: string | null;
|
|
25
|
+
labels: string[];
|
|
26
|
+
kind: "issue" | "pr";
|
|
27
|
+
ts: string;
|
|
28
|
+
initial?: true | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
number: number;
|
|
31
|
+
event: "label-change" | "issue-closed" | "pr-merged" | "pr-closed" | "pr-checks";
|
|
32
|
+
repo: string;
|
|
33
|
+
from: "error" | "pending" | "unknown" | "active" | "waiting" | "terminal" | "stage-complete" | null;
|
|
34
|
+
to: "error" | "pending" | "unknown" | "active" | "waiting" | "terminal" | "stage-complete" | null;
|
|
35
|
+
type: "issue-transition";
|
|
36
|
+
url: string;
|
|
37
|
+
sourceLabel: string | null;
|
|
38
|
+
labels: string[];
|
|
39
|
+
kind: "issue" | "pr";
|
|
40
|
+
ts: string;
|
|
41
|
+
initial?: true | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
export type CockpitEventValidated = z.infer<typeof CockpitEventSchema>;
|
|
44
|
+
export interface EmitOptions {
|
|
45
|
+
stdout?: {
|
|
46
|
+
write(chunk: string): boolean | void;
|
|
47
|
+
};
|
|
48
|
+
skipValidate?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Emit one NDJSON-encoded line per CockpitEvent.
|
|
52
|
+
*
|
|
53
|
+
* Validation runs by default (dev-time defense). Writes via a single
|
|
54
|
+
* `process.stdout.write` (no `console.log` — that interleaves under high
|
|
55
|
+
* concurrency).
|
|
56
|
+
*/
|
|
57
|
+
export declare function emit(event: CockpitEvent, opts?: EmitOptions): void;
|
|
58
|
+
//# sourceMappingURL=emit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/cockpit/watch/emit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa7B,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEvE,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;KAAE,CAAC;IAClD,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,GAAE,WAAgB,GAAG,IAAI,CAKtE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { COCKPIT_STATES } from '@generacy-ai/cockpit';
|
|
3
|
+
export const CockpitEventSchema = z.object({
|
|
4
|
+
type: z.literal('issue-transition'),
|
|
5
|
+
ts: z.string().datetime(),
|
|
6
|
+
repo: z.string().regex(/^[^/]+\/[^/]+$/),
|
|
7
|
+
kind: z.enum(['issue', 'pr']),
|
|
8
|
+
number: z.number().int().positive(),
|
|
9
|
+
from: z.union([z.enum(COCKPIT_STATES), z.null()]),
|
|
10
|
+
to: z.union([z.enum(COCKPIT_STATES), z.null()]),
|
|
11
|
+
sourceLabel: z.string().nullable(),
|
|
12
|
+
url: z.string().url(),
|
|
13
|
+
event: z.enum(['label-change', 'issue-closed', 'pr-merged', 'pr-closed', 'pr-checks']),
|
|
14
|
+
labels: z.array(z.string()),
|
|
15
|
+
initial: z.literal(true).optional(),
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Emit one NDJSON-encoded line per CockpitEvent.
|
|
19
|
+
*
|
|
20
|
+
* Validation runs by default (dev-time defense). Writes via a single
|
|
21
|
+
* `process.stdout.write` (no `console.log` — that interleaves under high
|
|
22
|
+
* concurrency).
|
|
23
|
+
*/
|
|
24
|
+
export function emit(event, opts = {}) {
|
|
25
|
+
const out = opts.stdout ?? process.stdout;
|
|
26
|
+
const stamped = { ...event, type: 'issue-transition' };
|
|
27
|
+
const validated = opts.skipValidate === true ? stamped : CockpitEventSchema.parse(stamped);
|
|
28
|
+
out.write(`${JSON.stringify(validated)}\n`);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=emit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.js","sourceRoot":"","sources":["../../../../../src/cli/commands/cockpit/watch/emit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACnC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC;IACxC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC7B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACnC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACjD,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACrB,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IACtF,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC;AASH;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAAC,KAAmB,EAAE,OAAoB,EAAE;IAC9D,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAC1C,MAAM,OAAO,GAAG,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,kBAA2B,EAAE,CAAC;IAChE,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3F,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { GhWrapper, IssueRef } from '@generacy-ai/cockpit';
|
|
2
|
+
import { type CockpitEvent } from './diff.js';
|
|
3
|
+
import { type SnapshotMap } from './snapshot.js';
|
|
4
|
+
export interface PollDeps {
|
|
5
|
+
gh: GhWrapper;
|
|
6
|
+
/** Refs resolved from the epic body for this tick. */
|
|
7
|
+
refs: IssueRef[];
|
|
8
|
+
/** `owner/repo` of the epic itself — used only as the zero-refs fallback query target. */
|
|
9
|
+
epicOwnerRepo: string;
|
|
10
|
+
safetyCap?: number;
|
|
11
|
+
pageSize?: number;
|
|
12
|
+
logger?: {
|
|
13
|
+
warn: (msg: string) => void;
|
|
14
|
+
};
|
|
15
|
+
now?: () => string;
|
|
16
|
+
}
|
|
17
|
+
export interface PollResult {
|
|
18
|
+
curr: SnapshotMap;
|
|
19
|
+
events: CockpitEvent[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Run one poll cycle: list issues per repo, classify, snapshot, fetch PR checks,
|
|
23
|
+
* derive PR lifecycle, compute transitions vs `prev`.
|
|
24
|
+
*
|
|
25
|
+
* Pure over its deps — all I/O goes through `deps.gh`. The shell (`watch.ts`)
|
|
26
|
+
* owns the loop, sleep, resolver call, and signal handling.
|
|
27
|
+
*/
|
|
28
|
+
export declare function runOnePoll(prev: SnapshotMap, deps: PollDeps): Promise<PollResult>;
|
|
29
|
+
//# sourceMappingURL=poll-loop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poll-loop.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/cockpit/watch/poll-loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EAET,QAAQ,EACT,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAElE,OAAO,EAML,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,SAAS,CAAC;IACd,sDAAsD;IACtD,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,0FAA0F;IAC1F,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC;IACzC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,YAAY,EAAE,CAAC;CACxB;AA8BD;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,QAAQ,GACb,OAAO,CAAC,UAAU,CAAC,CAwCrB"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { classifyIssue } from '../shared/classify-issue.js';
|
|
2
|
+
import { listAllIssues } from '../shared/pagination.js';
|
|
3
|
+
import { rollup } from './check-rollup.js';
|
|
4
|
+
import { computeTransitions } from './diff.js';
|
|
5
|
+
import { derivePrLifecycle } from './pr-state.js';
|
|
6
|
+
import { buildIssueSnapshot, buildPrSnapshot, snapshotKey, } from './snapshot.js';
|
|
7
|
+
function isPullRequest(issue) {
|
|
8
|
+
if (issue.url != null && /\/pull\/\d+/.test(issue.url))
|
|
9
|
+
return true;
|
|
10
|
+
return issue.labels.includes('type:pr');
|
|
11
|
+
}
|
|
12
|
+
function queryForRepo(refs, repo) {
|
|
13
|
+
const numbers = refs.filter((r) => r.repo === repo).map((r) => r.number);
|
|
14
|
+
const nums = numbers.map((n) => String(n)).join(' ');
|
|
15
|
+
if (nums.length === 0) {
|
|
16
|
+
// Zero-result sentinel to keep the poll shape consistent.
|
|
17
|
+
return `repo:${repo} is:issue no:label cockpit-no-match-sentinel`;
|
|
18
|
+
}
|
|
19
|
+
return `repo:${repo} ${nums}`;
|
|
20
|
+
}
|
|
21
|
+
function reposFromRefs(refs, fallback) {
|
|
22
|
+
const seen = new Set();
|
|
23
|
+
const out = [];
|
|
24
|
+
for (const ref of refs) {
|
|
25
|
+
if (!seen.has(ref.repo)) {
|
|
26
|
+
seen.add(ref.repo);
|
|
27
|
+
out.push(ref.repo);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (out.length === 0)
|
|
31
|
+
return [fallback];
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Run one poll cycle: list issues per repo, classify, snapshot, fetch PR checks,
|
|
36
|
+
* derive PR lifecycle, compute transitions vs `prev`.
|
|
37
|
+
*
|
|
38
|
+
* Pure over its deps — all I/O goes through `deps.gh`. The shell (`watch.ts`)
|
|
39
|
+
* owns the loop, sleep, resolver call, and signal handling.
|
|
40
|
+
*/
|
|
41
|
+
export async function runOnePoll(prev, deps) {
|
|
42
|
+
const curr = new Map();
|
|
43
|
+
const repos = reposFromRefs(deps.refs, deps.epicOwnerRepo);
|
|
44
|
+
for (const repo of repos) {
|
|
45
|
+
const query = queryForRepo(deps.refs, repo);
|
|
46
|
+
const issues = await listAllIssues(deps.gh, query, {
|
|
47
|
+
...(deps.safetyCap != null ? { safetyCap: deps.safetyCap } : {}),
|
|
48
|
+
...(deps.pageSize != null ? { pageSize: deps.pageSize } : {}),
|
|
49
|
+
...(deps.logger != null ? { logger: deps.logger } : {}),
|
|
50
|
+
});
|
|
51
|
+
for (const issue of issues) {
|
|
52
|
+
const classified = classifyIssue(issue.labels);
|
|
53
|
+
let snapshot;
|
|
54
|
+
if (isPullRequest(issue)) {
|
|
55
|
+
const key = snapshotKey(repo, 'pr', issue.number);
|
|
56
|
+
const prevSnap = prev.get(key);
|
|
57
|
+
const lifecycle = await derivePrLifecycle(repo, prevSnap, issue, {
|
|
58
|
+
getPullRequest: deps.gh.getPullRequest.bind(deps.gh),
|
|
59
|
+
});
|
|
60
|
+
let checksResult;
|
|
61
|
+
try {
|
|
62
|
+
checksResult = rollup(await deps.gh.getPullRequestCheckRuns(repo, issue.number));
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
checksResult = 'error';
|
|
66
|
+
}
|
|
67
|
+
snapshot = buildPrSnapshot(repo, issue, classified, lifecycle, checksResult);
|
|
68
|
+
curr.set(key, snapshot);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
const key = snapshotKey(repo, 'issue', issue.number);
|
|
72
|
+
snapshot = buildIssueSnapshot(repo, issue, classified);
|
|
73
|
+
curr.set(key, snapshot);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const now = deps.now;
|
|
78
|
+
const events = now != null ? computeTransitions(prev, curr, now) : computeTransitions(prev, curr);
|
|
79
|
+
return { curr, events };
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=poll-loop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poll-loop.js","sourceRoot":"","sources":["../../../../../src/cli/commands/cockpit/watch/poll-loop.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAqB,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,WAAW,GAIZ,MAAM,eAAe,CAAC;AAmBvB,SAAS,aAAa,CAAC,KAAY;IACjC,IAAI,KAAK,CAAC,GAAG,IAAI,IAAI,IAAI,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACpE,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,YAAY,CAAC,IAAgB,EAAE,IAAY;IAClD,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACzE,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,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;YAC1B,CAAC;iBAAM,CAAC;gBACN,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBACrD,QAAQ,GAAG,kBAAkB,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;gBACvD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IACrB,MAAM,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { GhWrapper, Issue } from '@generacy-ai/cockpit';
|
|
2
|
+
import type { PrLifecycle, Snapshot } from './snapshot.js';
|
|
3
|
+
export interface DerivePrLifecycleDeps {
|
|
4
|
+
getPullRequest: GhWrapper['getPullRequest'];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Derive the lifecycle of a PR (`open` | `closed` | `merged`).
|
|
8
|
+
*
|
|
9
|
+
* Plan D5: avoid an extra `gh pr view` call per cycle for stable PRs. Only call
|
|
10
|
+
* `getPullRequest` when:
|
|
11
|
+
* - the previous snapshot was OPEN (or absent) AND the current issue state is
|
|
12
|
+
* CLOSED — i.e. the PR just flipped to closed and we don't yet know if it
|
|
13
|
+
* was merged.
|
|
14
|
+
* Otherwise reuse the prior lifecycle (or default 'open' if no prev).
|
|
15
|
+
*/
|
|
16
|
+
export declare function derivePrLifecycle(repo: string, prev: Snapshot | undefined, issue: Pick<Issue, 'number' | 'state'>, deps: DerivePrLifecycleDeps): Promise<PrLifecycle>;
|
|
17
|
+
//# sourceMappingURL=pr-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-state.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/cockpit/watch/pr-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAsB,MAAM,sBAAsB,CAAC;AACjF,OAAO,KAAK,EAAE,WAAW,EAAc,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEvE,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;CAC7C;AAED;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,QAAQ,GAAG,SAAS,EAC1B,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,EACtC,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,WAAW,CAAC,CAiBtB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derive the lifecycle of a PR (`open` | `closed` | `merged`).
|
|
3
|
+
*
|
|
4
|
+
* Plan D5: avoid an extra `gh pr view` call per cycle for stable PRs. Only call
|
|
5
|
+
* `getPullRequest` when:
|
|
6
|
+
* - the previous snapshot was OPEN (or absent) AND the current issue state is
|
|
7
|
+
* CLOSED — i.e. the PR just flipped to closed and we don't yet know if it
|
|
8
|
+
* was merged.
|
|
9
|
+
* Otherwise reuse the prior lifecycle (or default 'open' if no prev).
|
|
10
|
+
*/
|
|
11
|
+
export async function derivePrLifecycle(repo, prev, issue, deps) {
|
|
12
|
+
const wasMerged = prev != null && prev.kind === 'pr' && prev.lifecycle === 'merged';
|
|
13
|
+
const wasClosed = prev != null && prev.kind === 'pr' && prev.lifecycle === 'closed';
|
|
14
|
+
if (issue.state === 'OPEN')
|
|
15
|
+
return 'open';
|
|
16
|
+
if (wasMerged)
|
|
17
|
+
return 'merged';
|
|
18
|
+
if (wasClosed)
|
|
19
|
+
return 'closed';
|
|
20
|
+
// Issue state flipped to CLOSED — disambiguate via getPullRequest.
|
|
21
|
+
let summary;
|
|
22
|
+
try {
|
|
23
|
+
summary = await deps.getPullRequest(repo, issue.number);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return 'closed';
|
|
27
|
+
}
|
|
28
|
+
if (summary.state === 'MERGED' || (summary.mergedAt != null && summary.mergedAt.length > 0)) {
|
|
29
|
+
return 'merged';
|
|
30
|
+
}
|
|
31
|
+
return 'closed';
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=pr-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-state.js","sourceRoot":"","sources":["../../../../../src/cli/commands/cockpit/watch/pr-state.ts"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAAY,EACZ,IAA0B,EAC1B,KAAsC,EACtC,IAA2B;IAE3B,MAAM,SAAS,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,SAAS,KAAK,QAAQ,CAAC;IACpF,MAAM,SAAS,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,SAAS,KAAK,QAAQ,CAAC;IACpF,IAAI,KAAK,CAAC,KAAK,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1C,IAAI,SAAS;QAAE,OAAO,QAAQ,CAAC;IAC/B,IAAI,SAAS;QAAE,OAAO,QAAQ,CAAC;IAC/B,mEAAmE;IACnE,IAAI,OAA2B,CAAC;IAChC,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC;QAC5F,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Issue } from '@generacy-ai/cockpit';
|
|
2
|
+
import type { ClassifiedIssue } from '../shared/classify-issue.js';
|
|
3
|
+
export type SnapshotKey = string;
|
|
4
|
+
export type ChecksRollup = 'pending' | 'success' | 'failure' | 'none' | 'error';
|
|
5
|
+
export type PrLifecycle = 'open' | 'closed' | 'merged';
|
|
6
|
+
export interface IssueSnapshot {
|
|
7
|
+
kind: 'issue';
|
|
8
|
+
repo: string;
|
|
9
|
+
number: number;
|
|
10
|
+
url: string;
|
|
11
|
+
state: 'OPEN' | 'CLOSED';
|
|
12
|
+
stateReason: 'COMPLETED' | 'NOT_PLANNED' | null;
|
|
13
|
+
labels: string[];
|
|
14
|
+
classified: ClassifiedIssue;
|
|
15
|
+
}
|
|
16
|
+
export interface PrSnapshot {
|
|
17
|
+
kind: 'pr';
|
|
18
|
+
repo: string;
|
|
19
|
+
number: number;
|
|
20
|
+
url: string;
|
|
21
|
+
lifecycle: PrLifecycle;
|
|
22
|
+
state: 'OPEN' | 'CLOSED';
|
|
23
|
+
stateReason: 'COMPLETED' | 'NOT_PLANNED' | null;
|
|
24
|
+
labels: string[];
|
|
25
|
+
classified: ClassifiedIssue;
|
|
26
|
+
checksRollup: ChecksRollup;
|
|
27
|
+
}
|
|
28
|
+
export type Snapshot = IssueSnapshot | PrSnapshot;
|
|
29
|
+
export type SnapshotMap = Map<SnapshotKey, Snapshot>;
|
|
30
|
+
export declare function snapshotKey(repo: string, kind: 'issue' | 'pr', number: number): SnapshotKey;
|
|
31
|
+
export declare function buildIssueSnapshot(repo: string, issue: Pick<Issue, 'number' | 'url' | 'state' | 'stateReason' | 'labels'>, classified: ClassifiedIssue): IssueSnapshot;
|
|
32
|
+
export declare function buildPrSnapshot(repo: string, issue: Pick<Issue, 'number' | 'url' | 'state' | 'stateReason' | 'labels'>, classified: ClassifiedIssue, lifecycle: PrLifecycle, rollup: ChecksRollup): PrSnapshot;
|
|
33
|
+
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/cockpit/watch/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AAEjC,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAChF,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEvD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC;IACzB,WAAW,EAAE,WAAW,GAAG,aAAa,GAAG,IAAI,CAAC;IAChD,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,eAAe,CAAC;CAC7B;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,WAAW,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC;IACzB,WAAW,EAAE,WAAW,GAAG,aAAa,GAAG,IAAI,CAAC;IAChD,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,eAAe,CAAC;IAC5B,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,UAAU,CAAC;AAClD,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AAErD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAE3F;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,aAAa,GAAG,QAAQ,CAAC,EACzE,UAAU,EAAE,eAAe,GAC1B,aAAa,CAWf;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,aAAa,GAAG,QAAQ,CAAC,EACzE,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,WAAW,EACtB,MAAM,EAAE,YAAY,GACnB,UAAU,CAaZ"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export function snapshotKey(repo, kind, number) {
|
|
2
|
+
return `${repo}#${kind}#${number}`;
|
|
3
|
+
}
|
|
4
|
+
export function buildIssueSnapshot(repo, issue, classified) {
|
|
5
|
+
return {
|
|
6
|
+
kind: 'issue',
|
|
7
|
+
repo,
|
|
8
|
+
number: issue.number,
|
|
9
|
+
url: issue.url,
|
|
10
|
+
state: issue.state,
|
|
11
|
+
stateReason: issue.stateReason,
|
|
12
|
+
labels: [...issue.labels],
|
|
13
|
+
classified,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function buildPrSnapshot(repo, issue, classified, lifecycle, rollup) {
|
|
17
|
+
return {
|
|
18
|
+
kind: 'pr',
|
|
19
|
+
repo,
|
|
20
|
+
number: issue.number,
|
|
21
|
+
url: issue.url,
|
|
22
|
+
state: issue.state,
|
|
23
|
+
stateReason: issue.stateReason,
|
|
24
|
+
lifecycle,
|
|
25
|
+
labels: [...issue.labels],
|
|
26
|
+
classified,
|
|
27
|
+
checksRollup: rollup,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../../../src/cli/commands/cockpit/watch/snapshot.ts"],"names":[],"mappings":"AAmCA,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,IAAoB,EAAE,MAAc;IAC5E,OAAO,GAAG,IAAI,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,IAAY,EACZ,KAAyE,EACzE,UAA2B;IAE3B,OAAO;QACL,IAAI,EAAE,OAAO;QACb,IAAI;QACJ,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;QACzB,UAAU;KACX,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,IAAY,EACZ,KAAyE,EACzE,UAA2B,EAC3B,SAAsB,EACtB,MAAoB;IAEpB,OAAO;QACL,IAAI,EAAE,IAAI;QACV,IAAI;QACJ,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,SAAS;QACT,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;QACzB,UAAU;QACV,YAAY,EAAE,MAAM;KACrB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const CockpitStreamEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"issue-transition">;
|
|
4
|
+
ts: z.ZodString;
|
|
5
|
+
repo: z.ZodString;
|
|
6
|
+
kind: z.ZodEnum<["issue", "pr"]>;
|
|
7
|
+
number: z.ZodNumber;
|
|
8
|
+
from: z.ZodUnion<[z.ZodEnum<["pending", "active", "waiting", "error", "terminal", "stage-complete", "unknown"]>, z.ZodNull]>;
|
|
9
|
+
to: z.ZodUnion<[z.ZodEnum<["pending", "active", "waiting", "error", "terminal", "stage-complete", "unknown"]>, z.ZodNull]>;
|
|
10
|
+
sourceLabel: z.ZodNullable<z.ZodString>;
|
|
11
|
+
url: z.ZodString;
|
|
12
|
+
event: z.ZodEnum<["label-change", "issue-closed", "pr-merged", "pr-closed", "pr-checks"]>;
|
|
13
|
+
labels: z.ZodArray<z.ZodString, "many">;
|
|
14
|
+
initial: z.ZodOptional<z.ZodLiteral<true>>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
number: number;
|
|
17
|
+
event: "label-change" | "issue-closed" | "pr-merged" | "pr-closed" | "pr-checks";
|
|
18
|
+
repo: string;
|
|
19
|
+
from: "error" | "pending" | "unknown" | "active" | "waiting" | "terminal" | "stage-complete" | null;
|
|
20
|
+
to: "error" | "pending" | "unknown" | "active" | "waiting" | "terminal" | "stage-complete" | null;
|
|
21
|
+
type: "issue-transition";
|
|
22
|
+
url: string;
|
|
23
|
+
sourceLabel: string | null;
|
|
24
|
+
labels: string[];
|
|
25
|
+
kind: "issue" | "pr";
|
|
26
|
+
ts: string;
|
|
27
|
+
initial?: true | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
number: number;
|
|
30
|
+
event: "label-change" | "issue-closed" | "pr-merged" | "pr-closed" | "pr-checks";
|
|
31
|
+
repo: string;
|
|
32
|
+
from: "error" | "pending" | "unknown" | "active" | "waiting" | "terminal" | "stage-complete" | null;
|
|
33
|
+
to: "error" | "pending" | "unknown" | "active" | "waiting" | "terminal" | "stage-complete" | null;
|
|
34
|
+
type: "issue-transition";
|
|
35
|
+
url: string;
|
|
36
|
+
sourceLabel: string | null;
|
|
37
|
+
labels: string[];
|
|
38
|
+
kind: "issue" | "pr";
|
|
39
|
+
ts: string;
|
|
40
|
+
initial?: true | undefined;
|
|
41
|
+
}>, z.ZodObject<{
|
|
42
|
+
type: z.ZodLiteral<"phase-complete">;
|
|
43
|
+
phase: z.ZodString;
|
|
44
|
+
epicRepo: z.ZodString;
|
|
45
|
+
epicNumber: z.ZodNumber;
|
|
46
|
+
ts: z.ZodString;
|
|
47
|
+
initial: z.ZodOptional<z.ZodLiteral<true>>;
|
|
48
|
+
}, "strict", z.ZodTypeAny, {
|
|
49
|
+
phase: string;
|
|
50
|
+
type: "phase-complete";
|
|
51
|
+
ts: string;
|
|
52
|
+
epicRepo: string;
|
|
53
|
+
epicNumber: number;
|
|
54
|
+
initial?: true | undefined;
|
|
55
|
+
}, {
|
|
56
|
+
phase: string;
|
|
57
|
+
type: "phase-complete";
|
|
58
|
+
ts: string;
|
|
59
|
+
epicRepo: string;
|
|
60
|
+
epicNumber: number;
|
|
61
|
+
initial?: true | undefined;
|
|
62
|
+
}>, z.ZodObject<{
|
|
63
|
+
type: z.ZodLiteral<"epic-complete">;
|
|
64
|
+
epicRepo: z.ZodString;
|
|
65
|
+
epicNumber: z.ZodNumber;
|
|
66
|
+
ts: z.ZodString;
|
|
67
|
+
initial: z.ZodOptional<z.ZodLiteral<true>>;
|
|
68
|
+
}, "strict", z.ZodTypeAny, {
|
|
69
|
+
type: "epic-complete";
|
|
70
|
+
ts: string;
|
|
71
|
+
epicRepo: string;
|
|
72
|
+
epicNumber: number;
|
|
73
|
+
initial?: true | undefined;
|
|
74
|
+
}, {
|
|
75
|
+
type: "epic-complete";
|
|
76
|
+
ts: string;
|
|
77
|
+
epicRepo: string;
|
|
78
|
+
epicNumber: number;
|
|
79
|
+
initial?: true | undefined;
|
|
80
|
+
}>]>;
|
|
81
|
+
export type CockpitStreamEvent = z.infer<typeof CockpitStreamEventSchema>;
|
|
82
|
+
//# sourceMappingURL=stream-event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-event.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/cockpit/watch/stream-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAInC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CockpitEventSchema } from './emit.js';
|
|
3
|
+
import { PhaseCompleteEventSchema, EpicCompleteEventSchema } from './aggregate-emit.js';
|
|
4
|
+
export const CockpitStreamEventSchema = z.discriminatedUnion('type', [
|
|
5
|
+
CockpitEventSchema,
|
|
6
|
+
PhaseCompleteEventSchema,
|
|
7
|
+
EpicCompleteEventSchema,
|
|
8
|
+
]);
|
|
9
|
+
//# sourceMappingURL=stream-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-event.js","sourceRoot":"","sources":["../../../../../src/cli/commands/cockpit/watch/stream-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAExF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IACnE,kBAAkB;IAClB,wBAAwB;IACxB,uBAAuB;CACxB,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { type CommandRunner, type GhWrapper } from '@generacy-ai/cockpit';
|
|
3
|
+
interface WatchOptions {
|
|
4
|
+
interval?: string;
|
|
5
|
+
safetyCap?: string;
|
|
6
|
+
exitOnEpicComplete?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface WatchDeps {
|
|
9
|
+
gh?: GhWrapper;
|
|
10
|
+
runner?: CommandRunner;
|
|
11
|
+
logger?: {
|
|
12
|
+
warn: (msg: string) => void;
|
|
13
|
+
};
|
|
14
|
+
intervalOverride?: number;
|
|
15
|
+
onTick?: () => void;
|
|
16
|
+
/** Optional external abort — used by tests to stop the loop deterministically. */
|
|
17
|
+
abortSignal?: AbortSignal;
|
|
18
|
+
}
|
|
19
|
+
export declare function runWatch(epicRef: string | undefined, options: WatchOptions, deps?: WatchDeps): Promise<number>;
|
|
20
|
+
export declare function watchCommand(): Command;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=watch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/cockpit/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,SAAS,EAEf,MAAM,sBAAsB,CAAC;AAY9B,UAAU,YAAY;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AA8CD,MAAM,WAAW,SAAS;IACxB,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,kFAAkF;IAClF,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,YAAY,EACrB,IAAI,GAAE,SAAc,GACnB,OAAO,CAAC,MAAM,CAAC,CA4IjB;AAED,wBAAgB,YAAY,IAAI,OAAO,CActC"}
|