@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,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `generacy cockpit context <issue>` — classify the issue's current
|
|
3
|
+
* `waiting-for:*` gate and emit the bundle that gate needs. Single JSON line
|
|
4
|
+
* on stdout.
|
|
5
|
+
*
|
|
6
|
+
* Gates and bundle shapes are defined in
|
|
7
|
+
* `specs/807-epic-generacy-ai-tetrad/contracts/*.schema.json`.
|
|
8
|
+
*
|
|
9
|
+
* Exit codes (per FR-004):
|
|
10
|
+
* 0 — bundle emitted
|
|
11
|
+
* 1 — gh IO failure
|
|
12
|
+
* 2 — ref-parse failure (bare number without inferrable origin, etc.)
|
|
13
|
+
* 3 — gate refusal (no waiting-for:*, completed:validate, unsupported gate,
|
|
14
|
+
* PR-scoped gate with no resolvable PR)
|
|
15
|
+
*/
|
|
16
|
+
import { Command } from 'commander';
|
|
17
|
+
import { type CommandRunner, type GhWrapper } from '@generacy-ai/cockpit';
|
|
18
|
+
type ArtifactPathsGate = 'waiting-for:spec-review' | 'waiting-for:plan-review' | 'waiting-for:tasks-review';
|
|
19
|
+
export interface ArtifactOutput {
|
|
20
|
+
path: string;
|
|
21
|
+
body: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ClarificationCommentOutput {
|
|
24
|
+
body: string;
|
|
25
|
+
author: string;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
url: string;
|
|
28
|
+
}
|
|
29
|
+
export interface CodeReferencesOutput {
|
|
30
|
+
prUrl: string;
|
|
31
|
+
touchedFiles: string[];
|
|
32
|
+
diffPatch: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ClarificationBundle {
|
|
35
|
+
issue: string;
|
|
36
|
+
gate: 'waiting-for:clarification';
|
|
37
|
+
clarificationComment: ClarificationCommentOutput | null;
|
|
38
|
+
spec: ArtifactOutput | null;
|
|
39
|
+
plan: ArtifactOutput | null;
|
|
40
|
+
codeReferences: CodeReferencesOutput | null;
|
|
41
|
+
}
|
|
42
|
+
export interface ImplementationReviewBundle {
|
|
43
|
+
issue: string;
|
|
44
|
+
gate: 'waiting-for:implementation-review';
|
|
45
|
+
pr: {
|
|
46
|
+
number: number;
|
|
47
|
+
title: string;
|
|
48
|
+
url: string;
|
|
49
|
+
base: string;
|
|
50
|
+
head: string;
|
|
51
|
+
body: string;
|
|
52
|
+
author: string | null;
|
|
53
|
+
state: 'OPEN' | 'CLOSED' | 'MERGED';
|
|
54
|
+
draft: boolean;
|
|
55
|
+
};
|
|
56
|
+
diff: string;
|
|
57
|
+
diffTruncated: boolean;
|
|
58
|
+
checks: Array<{
|
|
59
|
+
name: string;
|
|
60
|
+
state: 'SUCCESS' | 'FAILURE' | 'PENDING' | 'NEUTRAL' | 'SKIPPED' | 'CANCELLED';
|
|
61
|
+
conclusion?: string;
|
|
62
|
+
url?: string;
|
|
63
|
+
}>;
|
|
64
|
+
}
|
|
65
|
+
export interface ArtifactPathsBundle {
|
|
66
|
+
issue: string;
|
|
67
|
+
gate: ArtifactPathsGate;
|
|
68
|
+
artifacts: {
|
|
69
|
+
spec: ArtifactOutput | null;
|
|
70
|
+
plan: ArtifactOutput | null;
|
|
71
|
+
tasks: ArtifactOutput | null;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export type ContextBundle = ClarificationBundle | ImplementationReviewBundle | ArtifactPathsBundle;
|
|
75
|
+
export interface ContextCommandDeps {
|
|
76
|
+
runner?: CommandRunner;
|
|
77
|
+
gh?: GhWrapper;
|
|
78
|
+
/** Override `git branch --show-current`. */
|
|
79
|
+
getBranch?: () => Promise<string>;
|
|
80
|
+
/** Repo root for `specs/<branch>/…` lookup; defaults to `process.cwd()`. */
|
|
81
|
+
cwd?: string;
|
|
82
|
+
/** Base branch for the `git diff` fallback; defaults to `develop`. */
|
|
83
|
+
baseBranch?: string;
|
|
84
|
+
stdout?: (line: string) => void;
|
|
85
|
+
stderr?: (line: string) => void;
|
|
86
|
+
}
|
|
87
|
+
export declare function contextCommand(deps?: ContextCommandDeps): Command;
|
|
88
|
+
export declare function runContext(issueArg: string, deps?: ContextCommandDeps): Promise<ContextBundle>;
|
|
89
|
+
export {};
|
|
90
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/cockpit/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,sBAAsB,CAAC;AAM9B,KAAK,iBAAiB,GAClB,yBAAyB,GACzB,yBAAyB,GACzB,0BAA0B,CAAC;AAE/B,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,2BAA2B,CAAC;IAClC,oBAAoB,EAAE,0BAA0B,GAAG,IAAI,CAAC;IACxD,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IAC5B,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IAC5B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AAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,4EAA4E;IAC5E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAWD,wBAAgB,cAAc,CAAC,IAAI,GAAE,kBAAuB,GAAG,OAAO,CAoBrE;AAED,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,kBAAuB,GAC5B,OAAO,CAAC,aAAa,CAAC,CA0DxB"}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `generacy cockpit context <issue>` — classify the issue's current
|
|
3
|
+
* `waiting-for:*` gate and emit the bundle that gate needs. Single JSON line
|
|
4
|
+
* on stdout.
|
|
5
|
+
*
|
|
6
|
+
* Gates and bundle shapes are defined in
|
|
7
|
+
* `specs/807-epic-generacy-ai-tetrad/contracts/*.schema.json`.
|
|
8
|
+
*
|
|
9
|
+
* Exit codes (per FR-004):
|
|
10
|
+
* 0 — bundle emitted
|
|
11
|
+
* 1 — gh IO failure
|
|
12
|
+
* 2 — ref-parse failure (bare number without inferrable origin, etc.)
|
|
13
|
+
* 3 — gate refusal (no waiting-for:*, completed:validate, unsupported gate,
|
|
14
|
+
* PR-scoped gate with no resolvable PR)
|
|
15
|
+
*/
|
|
16
|
+
import { Command } from 'commander';
|
|
17
|
+
import { readFile, readdir, stat } from 'node:fs/promises';
|
|
18
|
+
import { existsSync } from 'node:fs';
|
|
19
|
+
import { join, resolve } from 'node:path';
|
|
20
|
+
import { WAITING_PIPELINE_ORDER, nodeChildProcessRunner, } from '@generacy-ai/cockpit';
|
|
21
|
+
import { resolveIssueContext } from './resolver.js';
|
|
22
|
+
import { findClarificationComment } from './clarification-comment-finder.js';
|
|
23
|
+
import { buildReviewContextPayload } from './shared/review-context-json.js';
|
|
24
|
+
import { CockpitExit, isCockpitExit } from './exit.js';
|
|
25
|
+
const CLARIFICATION_GATE = 'waiting-for:clarification';
|
|
26
|
+
const IMPLEMENTATION_REVIEW_GATE = 'waiting-for:implementation-review';
|
|
27
|
+
const ARTIFACT_PATH_GATES = [
|
|
28
|
+
'waiting-for:spec-review',
|
|
29
|
+
'waiting-for:plan-review',
|
|
30
|
+
'waiting-for:tasks-review',
|
|
31
|
+
];
|
|
32
|
+
const COMPLETED_VALIDATE = 'completed:validate';
|
|
33
|
+
export function contextCommand(deps = {}) {
|
|
34
|
+
const cmd = new Command('context');
|
|
35
|
+
cmd
|
|
36
|
+
.description('Classify the issue gate and emit the bundle that gate needs (single JSON line on stdout).')
|
|
37
|
+
.argument('<issue>', 'Issue ref — <owner>/<repo>#<n> or full URL.')
|
|
38
|
+
.action(async (issue) => {
|
|
39
|
+
try {
|
|
40
|
+
await runContext(issue, deps);
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
if (isCockpitExit(err)) {
|
|
44
|
+
const stderr = deps.stderr ?? ((line) => process.stderr.write(`${line}\n`));
|
|
45
|
+
stderr(err.message);
|
|
46
|
+
process.exit(err.code);
|
|
47
|
+
}
|
|
48
|
+
throw err;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return cmd;
|
|
52
|
+
}
|
|
53
|
+
export async function runContext(issueArg, deps = {}) {
|
|
54
|
+
const print = deps.stdout ?? ((line) => process.stdout.write(`${line}\n`));
|
|
55
|
+
const runner = deps.runner ?? nodeChildProcessRunner;
|
|
56
|
+
let ref;
|
|
57
|
+
let gh;
|
|
58
|
+
try {
|
|
59
|
+
const resolvedCtx = await resolveIssueContext({ issue: issueArg, runner: deps.runner });
|
|
60
|
+
ref = resolvedCtx.ref;
|
|
61
|
+
gh = deps.gh ?? resolvedCtx.gh;
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
throw new CockpitExit(2, `Error: cockpit context: ${err.message}`);
|
|
65
|
+
}
|
|
66
|
+
let labels;
|
|
67
|
+
try {
|
|
68
|
+
labels = (await gh.fetchIssueLabels(ref.nwo, ref.number)).labels;
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
throw new CockpitExit(1, `Error: cockpit context: gh issue view: ${err.message}`);
|
|
72
|
+
}
|
|
73
|
+
if (labels.includes(COMPLETED_VALIDATE)) {
|
|
74
|
+
throw new CockpitExit(3, `Error: cockpit context: gate refusal: issue ${ref.nwo}#${ref.number} carries ` +
|
|
75
|
+
`completed:validate — use \`cockpit merge\``);
|
|
76
|
+
}
|
|
77
|
+
const gate = firstWaitingGate(labels);
|
|
78
|
+
if (gate == null) {
|
|
79
|
+
throw new CockpitExit(3, `Error: cockpit context: gate refusal: no waiting-for:* label on ${ref.nwo}#${ref.number} ` +
|
|
80
|
+
`(labels: ${labels.length === 0 ? '<none>' : labels.join(', ')})`);
|
|
81
|
+
}
|
|
82
|
+
const issueRepr = `${ref.nwo}#${ref.number}`;
|
|
83
|
+
let bundle;
|
|
84
|
+
if (gate === CLARIFICATION_GATE) {
|
|
85
|
+
bundle = await buildClarificationBundle(ref, issueRepr, gh, runner, deps);
|
|
86
|
+
}
|
|
87
|
+
else if (gate === IMPLEMENTATION_REVIEW_GATE) {
|
|
88
|
+
bundle = await buildImplementationReviewBundle(ref, issueRepr, gh);
|
|
89
|
+
}
|
|
90
|
+
else if (ARTIFACT_PATH_GATES.includes(gate)) {
|
|
91
|
+
bundle = await buildArtifactPathsBundle(ref, issueRepr, gate, deps);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
throw new CockpitExit(3, `Error: cockpit context: gate refusal: unsupported gate "${gate}" on ${issueRepr}`);
|
|
95
|
+
}
|
|
96
|
+
print(JSON.stringify(bundle));
|
|
97
|
+
return bundle;
|
|
98
|
+
}
|
|
99
|
+
function firstWaitingGate(labels) {
|
|
100
|
+
for (const listed of WAITING_PIPELINE_ORDER) {
|
|
101
|
+
if (labels.includes(listed))
|
|
102
|
+
return listed;
|
|
103
|
+
}
|
|
104
|
+
for (const label of labels) {
|
|
105
|
+
if (label.startsWith('waiting-for:'))
|
|
106
|
+
return label;
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
async function buildClarificationBundle(ref, issueRepr, gh, runner, deps) {
|
|
111
|
+
let comment;
|
|
112
|
+
try {
|
|
113
|
+
comment = await findClarificationComment(gh, ref.nwo, ref.number);
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
throw new CockpitExit(1, `Error: cockpit context: clarification lookup: ${err.message}`);
|
|
117
|
+
}
|
|
118
|
+
const branch = await (deps.getBranch ?? defaultGetBranch(runner))();
|
|
119
|
+
const cwd = deps.cwd ?? process.cwd();
|
|
120
|
+
const { spec, plan } = await readSpecArtifacts(cwd, branch, ref.number);
|
|
121
|
+
const codeReferences = await buildCodeReferences(ref.nwo, branch, deps.baseBranch ?? 'develop', gh);
|
|
122
|
+
return {
|
|
123
|
+
issue: issueRepr,
|
|
124
|
+
gate: 'waiting-for:clarification',
|
|
125
|
+
clarificationComment: comment
|
|
126
|
+
? {
|
|
127
|
+
body: comment.body,
|
|
128
|
+
author: comment.author,
|
|
129
|
+
createdAt: comment.createdAt,
|
|
130
|
+
url: comment.url,
|
|
131
|
+
}
|
|
132
|
+
: null,
|
|
133
|
+
spec,
|
|
134
|
+
plan,
|
|
135
|
+
codeReferences,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
async function buildImplementationReviewBundle(ref, issueRepr, gh) {
|
|
139
|
+
let resolution;
|
|
140
|
+
try {
|
|
141
|
+
resolution = await gh.resolveIssueToPRRef(ref.nwo, ref.number);
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
throw new CockpitExit(1, `Error: cockpit context: gh pr resolve: ${err.message}`);
|
|
145
|
+
}
|
|
146
|
+
if (resolution.kind === 'pr-is-draft') {
|
|
147
|
+
const nums = resolution.candidates.map((c) => `#${c.number}`).join(', ');
|
|
148
|
+
throw new CockpitExit(3, `Error: cockpit context: gate refusal: issue ${issueRepr} at ` +
|
|
149
|
+
`${IMPLEMENTATION_REVIEW_GATE} but linked PR(s) are drafts ` +
|
|
150
|
+
`(via ${resolution.linkMethod}): ${nums}`);
|
|
151
|
+
}
|
|
152
|
+
if (resolution.kind === 'ambiguous') {
|
|
153
|
+
const nums = resolution.candidates.map((c) => `#${c.number}`).join(', ');
|
|
154
|
+
throw new CockpitExit(3, `Error: cockpit context: gate refusal: issue ${issueRepr} at ` +
|
|
155
|
+
`${IMPLEMENTATION_REVIEW_GATE} but multiple PRs match ` +
|
|
156
|
+
`via ${resolution.linkMethod}: ${nums}`);
|
|
157
|
+
}
|
|
158
|
+
if (resolution.kind === 'unresolved') {
|
|
159
|
+
throw new CockpitExit(3, `Error: cockpit context: gate refusal: issue ${issueRepr} at ` +
|
|
160
|
+
`${IMPLEMENTATION_REVIEW_GATE} but no linked PR resolved`);
|
|
161
|
+
}
|
|
162
|
+
if (resolution.kind === 'pr-number') {
|
|
163
|
+
throw new CockpitExit(3, `Error: cockpit context: gate refusal: ${issueRepr} is a pull request; ` +
|
|
164
|
+
`pass the issue number (e.g. the issue whose closing PR is #${ref.number}).`);
|
|
165
|
+
}
|
|
166
|
+
const prRef = resolution.ref;
|
|
167
|
+
// Exhaustiveness guard — a new kind on PullRequestRefResolution surfaces here at build time.
|
|
168
|
+
const _exhaustive = resolution.kind;
|
|
169
|
+
void _exhaustive;
|
|
170
|
+
let pr, checks;
|
|
171
|
+
try {
|
|
172
|
+
[pr, checks] = await Promise.all([
|
|
173
|
+
gh.getPullRequestDetail(ref.nwo, prRef.number),
|
|
174
|
+
gh.getPullRequestCheckRuns(ref.nwo, prRef.number),
|
|
175
|
+
]);
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
throw new CockpitExit(1, `Error: cockpit context: gh pr detail: ${err.message}`);
|
|
179
|
+
}
|
|
180
|
+
const payload = buildReviewContextPayload({ pr, checks });
|
|
181
|
+
return {
|
|
182
|
+
issue: issueRepr,
|
|
183
|
+
gate: 'waiting-for:implementation-review',
|
|
184
|
+
pr: payload.pr,
|
|
185
|
+
diff: payload.diff,
|
|
186
|
+
diffTruncated: payload.diffTruncated,
|
|
187
|
+
checks: payload.checks,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
async function buildArtifactPathsBundle(ref, issueRepr, gate, deps) {
|
|
191
|
+
const runner = deps.runner ?? nodeChildProcessRunner;
|
|
192
|
+
const branch = await (deps.getBranch ?? defaultGetBranch(runner))();
|
|
193
|
+
const cwd = deps.cwd ?? process.cwd();
|
|
194
|
+
const specDir = await findSpecDir(cwd, branch, ref.number);
|
|
195
|
+
const artifacts = specDir == null
|
|
196
|
+
? { spec: null, plan: null, tasks: null }
|
|
197
|
+
: {
|
|
198
|
+
spec: await readArtifact(join(specDir, 'spec.md')),
|
|
199
|
+
plan: await readArtifact(join(specDir, 'plan.md')),
|
|
200
|
+
tasks: await readArtifact(join(specDir, 'tasks.md')),
|
|
201
|
+
};
|
|
202
|
+
return { issue: issueRepr, gate, artifacts };
|
|
203
|
+
}
|
|
204
|
+
async function buildCodeReferences(repo, branch, baseBranch, gh) {
|
|
205
|
+
if (branch === '' || branch === baseBranch)
|
|
206
|
+
return null;
|
|
207
|
+
const pr = await gh.findOpenPrForBranch(repo, branch);
|
|
208
|
+
if (pr == null)
|
|
209
|
+
return null;
|
|
210
|
+
let touchedFiles = [];
|
|
211
|
+
let diffPatch = '';
|
|
212
|
+
try {
|
|
213
|
+
touchedFiles = await gh.prDiffNames(repo, pr.number);
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
touchedFiles = [];
|
|
217
|
+
}
|
|
218
|
+
try {
|
|
219
|
+
diffPatch = await gh.prDiffPatch(repo, pr.number);
|
|
220
|
+
}
|
|
221
|
+
catch {
|
|
222
|
+
diffPatch = '';
|
|
223
|
+
}
|
|
224
|
+
return { prUrl: pr.url, touchedFiles, diffPatch };
|
|
225
|
+
}
|
|
226
|
+
async function readSpecArtifacts(cwd, branch, issueNumber) {
|
|
227
|
+
const specDir = await findSpecDir(cwd, branch, issueNumber);
|
|
228
|
+
if (specDir == null)
|
|
229
|
+
return { spec: null, plan: null };
|
|
230
|
+
return {
|
|
231
|
+
spec: await readArtifact(join(specDir, 'spec.md')),
|
|
232
|
+
plan: await readArtifact(join(specDir, 'plan.md')),
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
async function findSpecDir(cwd, branch, issueNumber) {
|
|
236
|
+
const specsRoot = resolve(cwd, 'specs');
|
|
237
|
+
if (branch !== '' && existsSync(join(specsRoot, branch))) {
|
|
238
|
+
return join(specsRoot, branch);
|
|
239
|
+
}
|
|
240
|
+
try {
|
|
241
|
+
const stats = await stat(specsRoot);
|
|
242
|
+
if (!stats.isDirectory())
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
245
|
+
catch {
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
const prefix = `${issueNumber}-`;
|
|
249
|
+
let entries;
|
|
250
|
+
try {
|
|
251
|
+
entries = await readdir(specsRoot);
|
|
252
|
+
}
|
|
253
|
+
catch {
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
for (const entry of entries) {
|
|
257
|
+
if (entry.startsWith(prefix)) {
|
|
258
|
+
return join(specsRoot, entry);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
async function readArtifact(path) {
|
|
264
|
+
try {
|
|
265
|
+
const body = await readFile(path, 'utf-8');
|
|
266
|
+
return { path, body };
|
|
267
|
+
}
|
|
268
|
+
catch {
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function defaultGetBranch(runner) {
|
|
273
|
+
return async () => {
|
|
274
|
+
const res = await runner('git', ['branch', '--show-current']);
|
|
275
|
+
if (res.exitCode !== 0)
|
|
276
|
+
return '';
|
|
277
|
+
return res.stdout.trim();
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/cli/commands/cockpit/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GAGvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAiB,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAsFvD,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AACvD,MAAM,0BAA0B,GAAG,mCAAmC,CAAC;AACvE,MAAM,mBAAmB,GAAiC;IACxD,yBAAyB;IACzB,yBAAyB;IACzB,0BAA0B;CAC3B,CAAC;AACF,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEhD,MAAM,UAAU,cAAc,CAAC,OAA2B,EAAE;IAC1D,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IACnC,GAAG;SACA,WAAW,CACV,2FAA2F,CAC5F;SACA,QAAQ,CAAC,SAAS,EAAE,6CAA6C,CAAC;SAClE,MAAM,CAAC,KAAK,EAAE,KAAa,EAAE,EA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AY,CAAC,IAAY;IACtC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAqB;IAC7C,OAAO,KAAK,IAAI,EAAE;QAChB,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC;QAC9D,IAAI,GAAG,CAAC,QAAQ,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QAClC,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exit-code carrier for the cockpit verbs. The Commander action handler
|
|
3
|
+
* catches `CockpitExit` and translates it to `process.exit(code)` after
|
|
4
|
+
* writing the message to stderr. Tests intercept by catching the thrown
|
|
5
|
+
* error directly — no `process.exit` needed.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CockpitExit extends Error {
|
|
8
|
+
readonly code: number;
|
|
9
|
+
constructor(code: number, message: string);
|
|
10
|
+
}
|
|
11
|
+
export declare function isCockpitExit(err: unknown): err is CockpitExit;
|
|
12
|
+
//# sourceMappingURL=exit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exit.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/cockpit/exit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBACV,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK1C;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,WAAW,CAE9D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exit-code carrier for the cockpit verbs. The Commander action handler
|
|
3
|
+
* catches `CockpitExit` and translates it to `process.exit(code)` after
|
|
4
|
+
* writing the message to stderr. Tests intercept by catching the thrown
|
|
5
|
+
* error directly — no `process.exit` needed.
|
|
6
|
+
*/
|
|
7
|
+
export class CockpitExit extends Error {
|
|
8
|
+
code;
|
|
9
|
+
constructor(code, message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.code = code;
|
|
12
|
+
this.name = 'CockpitExit';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function isCockpitExit(err) {
|
|
16
|
+
return err instanceof Error && err.name === 'CockpitExit';
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=exit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exit.js","sourceRoot":"","sources":["../../../../src/cli/commands/cockpit/exit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,IAAI,CAAS;IACtB,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AAED,MAAM,UAAU,aAAa,CAAC,GAAY;IACxC,OAAO,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,IAAI,KAAK,aAAa,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type WorkflowPhase } from '@generacy-ai/orchestrator';
|
|
2
|
+
export interface GateDefinition {
|
|
3
|
+
/** Gate name (e.g. "clarification", "plan-review"). */
|
|
4
|
+
name: string;
|
|
5
|
+
/** Full label name "waiting-for:<name>". */
|
|
6
|
+
waitingLabel: string;
|
|
7
|
+
/** Full label name "completed:<name>". */
|
|
8
|
+
completedLabel: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const GATES: ReadonlyMap<string, GateDefinition>;
|
|
11
|
+
/** List gate names in `WORKFLOW_LABELS` order — stable for `--help-gates`. */
|
|
12
|
+
export declare function listGates(): string[];
|
|
13
|
+
/**
|
|
14
|
+
* A gate whose completion causes the resolver to pick the failed phase as
|
|
15
|
+
* `startPhase`. Returned by `resolvePrecedingGate`.
|
|
16
|
+
*/
|
|
17
|
+
export interface PrecedingGate {
|
|
18
|
+
/** Gate name — e.g. "implementation-review", "tasks-review". */
|
|
19
|
+
name: string;
|
|
20
|
+
/** Full label name "waiting-for:<name>". */
|
|
21
|
+
waitingLabel: string;
|
|
22
|
+
/** Full label name "completed:<name>". */
|
|
23
|
+
completedLabel: string;
|
|
24
|
+
/** The phase this gate belongs to (from GATE_MAPPING[name].phase). */
|
|
25
|
+
sourcePhase: WorkflowPhase;
|
|
26
|
+
/** True when sourcePhase === the phase being re-entered (documented tie-break). */
|
|
27
|
+
isSelfLoop: boolean;
|
|
28
|
+
}
|
|
29
|
+
export type ResolvePrecedingGateResult = {
|
|
30
|
+
kind: 'found';
|
|
31
|
+
gate: PrecedingGate;
|
|
32
|
+
} | {
|
|
33
|
+
kind: 'no-preceding-gate';
|
|
34
|
+
targetPhase: WorkflowPhase;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Resolve the preceding gate for a failed phase.
|
|
38
|
+
*
|
|
39
|
+
* Algorithm (deterministic; mirrors `PhaseResolver.getEffectiveGateMapping`):
|
|
40
|
+
* 1. Build effective mapping = GATE_MAPPING overlaid with WORKFLOW_GATE_MAPPING[workflowName].
|
|
41
|
+
* 2. Filter entries where `resumeFrom === phase`.
|
|
42
|
+
* 3. If empty: return `no-preceding-gate`.
|
|
43
|
+
* 4. Partition into `crossPhase` (gatePhase !== phase) and `selfLoop`.
|
|
44
|
+
* 5. If crossPhase non-empty: pick nearest predecessor by PHASE_SEQUENCE.indexOf descending.
|
|
45
|
+
* 6. Otherwise: pick the first selfLoop entry in stable Object.entries order.
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolvePrecedingGate(phase: WorkflowPhase, workflowName?: string): ResolvePrecedingGateResult;
|
|
48
|
+
//# sourceMappingURL=gate-vocabulary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate-vocabulary.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/cockpit/gate-vocabulary.ts"],"names":[],"mappings":"AAgBA,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,cAAc;IAC7B,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAC;CACxB;AAuBD,eAAO,MAAM,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAgB,CAAC;AAEvE,8EAA8E;AAC9E,wBAAgB,SAAS,IAAI,MAAM,EAAE,CAEpC;AAID;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,WAAW,EAAE,aAAa,CAAC;IAC3B,mFAAmF;IACnF,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,0BAA0B,GAClC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,WAAW,EAAE,aAAa,CAAA;CAAE,CAAC;AAE9D;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,aAAa,EACpB,YAAY,CAAC,EAAE,MAAM,GACpB,0BAA0B,CA8C5B"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gate vocabulary derived from `WORKFLOW_LABELS`.
|
|
3
|
+
*
|
|
4
|
+
* A gate is any `waiting-for:<x>` label that has a matching `completed:<x>` partner.
|
|
5
|
+
* Labels with only one side of the pair are NOT valid gates.
|
|
6
|
+
*
|
|
7
|
+
* This is the single source of truth for `--gate <name>` validation in `cockpit advance`,
|
|
8
|
+
* and for `--help-gates` output. Per SC-005, no other file in `cockpit/` may hard-code a
|
|
9
|
+
* `completed:` literal list.
|
|
10
|
+
*
|
|
11
|
+
* Also exposes `resolvePrecedingGate(phase, workflowName?)` — the inverse view of
|
|
12
|
+
* `GATE_MAPPING` keyed by `resumeFrom` — used by `cockpit resume` (#891) to
|
|
13
|
+
* derive the gate whose completion causes the resolver to pick `<phase>` as
|
|
14
|
+
* `startPhase`.
|
|
15
|
+
*/
|
|
16
|
+
import { WORKFLOW_LABELS } from '@generacy-ai/workflow-engine';
|
|
17
|
+
import { GATE_MAPPING, WORKFLOW_GATE_MAPPING, PHASE_SEQUENCE, } from '@generacy-ai/orchestrator';
|
|
18
|
+
function buildGates() {
|
|
19
|
+
const gates = new Map();
|
|
20
|
+
const completedNames = new Set();
|
|
21
|
+
for (const label of WORKFLOW_LABELS) {
|
|
22
|
+
if (label.name.startsWith('completed:')) {
|
|
23
|
+
completedNames.add(label.name.slice('completed:'.length));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
for (const label of WORKFLOW_LABELS) {
|
|
27
|
+
if (!label.name.startsWith('waiting-for:'))
|
|
28
|
+
continue;
|
|
29
|
+
const name = label.name.slice('waiting-for:'.length);
|
|
30
|
+
if (!completedNames.has(name))
|
|
31
|
+
continue;
|
|
32
|
+
gates.set(name, {
|
|
33
|
+
name,
|
|
34
|
+
waitingLabel: `waiting-for:${name}`,
|
|
35
|
+
completedLabel: `completed:${name}`,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return gates;
|
|
39
|
+
}
|
|
40
|
+
export const GATES = buildGates();
|
|
41
|
+
/** List gate names in `WORKFLOW_LABELS` order — stable for `--help-gates`. */
|
|
42
|
+
export function listGates() {
|
|
43
|
+
return Array.from(GATES.keys());
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Resolve the preceding gate for a failed phase.
|
|
47
|
+
*
|
|
48
|
+
* Algorithm (deterministic; mirrors `PhaseResolver.getEffectiveGateMapping`):
|
|
49
|
+
* 1. Build effective mapping = GATE_MAPPING overlaid with WORKFLOW_GATE_MAPPING[workflowName].
|
|
50
|
+
* 2. Filter entries where `resumeFrom === phase`.
|
|
51
|
+
* 3. If empty: return `no-preceding-gate`.
|
|
52
|
+
* 4. Partition into `crossPhase` (gatePhase !== phase) and `selfLoop`.
|
|
53
|
+
* 5. If crossPhase non-empty: pick nearest predecessor by PHASE_SEQUENCE.indexOf descending.
|
|
54
|
+
* 6. Otherwise: pick the first selfLoop entry in stable Object.entries order.
|
|
55
|
+
*/
|
|
56
|
+
export function resolvePrecedingGate(phase, workflowName) {
|
|
57
|
+
const effective = workflowName && WORKFLOW_GATE_MAPPING[workflowName]
|
|
58
|
+
? { ...GATE_MAPPING, ...WORKFLOW_GATE_MAPPING[workflowName] }
|
|
59
|
+
: GATE_MAPPING;
|
|
60
|
+
const candidates = [];
|
|
61
|
+
for (const [gateName, entry] of Object.entries(effective)) {
|
|
62
|
+
if (entry.resumeFrom === phase) {
|
|
63
|
+
candidates.push({ name: gateName, sourcePhase: entry.phase });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (candidates.length === 0) {
|
|
67
|
+
return { kind: 'no-preceding-gate', targetPhase: phase };
|
|
68
|
+
}
|
|
69
|
+
const crossPhase = candidates.filter((c) => c.sourcePhase !== phase);
|
|
70
|
+
if (crossPhase.length > 0) {
|
|
71
|
+
crossPhase.sort((a, b) => PHASE_SEQUENCE.indexOf(b.sourcePhase) - PHASE_SEQUENCE.indexOf(a.sourcePhase));
|
|
72
|
+
const winner = crossPhase[0];
|
|
73
|
+
return {
|
|
74
|
+
kind: 'found',
|
|
75
|
+
gate: {
|
|
76
|
+
name: winner.name,
|
|
77
|
+
waitingLabel: `waiting-for:${winner.name}`,
|
|
78
|
+
completedLabel: `completed:${winner.name}`,
|
|
79
|
+
sourcePhase: winner.sourcePhase,
|
|
80
|
+
isSelfLoop: false,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const selfLoop = candidates[0];
|
|
85
|
+
return {
|
|
86
|
+
kind: 'found',
|
|
87
|
+
gate: {
|
|
88
|
+
name: selfLoop.name,
|
|
89
|
+
waitingLabel: `waiting-for:${selfLoop.name}`,
|
|
90
|
+
completedLabel: `completed:${selfLoop.name}`,
|
|
91
|
+
sourcePhase: selfLoop.sourcePhase,
|
|
92
|
+
isSelfLoop: true,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=gate-vocabulary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate-vocabulary.js","sourceRoot":"","sources":["../../../../src/cli/commands/cockpit/gate-vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,cAAc,GAEf,MAAM,2BAA2B,CAAC;AAWnC,SAAS,UAAU;IACjB,MAAM,KAAK,GAAG,IAAI,GAAG,EAA0B,CAAC;IAChD,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;IACzC,KAAK,MAAM,KAAK,IAAI,eAAe,EAAE,CAAC;QACpC,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YACxC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CA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;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `generacy cockpit` command group.
|
|
3
|
+
*
|
|
4
|
+
* Observability verbs (read-only) for Generacy epics and repos:
|
|
5
|
+
* - watch — poll an epic's issues/PRs and emit cockpit events on state changes
|
|
6
|
+
* - status — render a grouped, colorized table of the epic's current state
|
|
7
|
+
*
|
|
8
|
+
* Single-issue verbs that inspect and drive workflow state for one issue:
|
|
9
|
+
* - context — classify the current waiting-for:* gate and emit its bundle
|
|
10
|
+
* - advance — manually advance a waiting gate (flip waiting-for → completed)
|
|
11
|
+
* - resume — re-arm a failed phase in place (clears failed:*, restores the
|
|
12
|
+
* preceding gate's waiting-for/completed pair + agent:paused)
|
|
13
|
+
*
|
|
14
|
+
* Epic merge/review verbs:
|
|
15
|
+
* - merge — merge a PR once its required checks are green
|
|
16
|
+
* - queue — enqueue eligible refs under a phase heading to the cluster pipeline
|
|
17
|
+
*/
|
|
18
|
+
import { Command } from 'commander';
|
|
19
|
+
export declare function cockpitCommand(): Command;
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/cockpit/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,wBAAgB,cAAc,IAAI,OAAO,CAexC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `generacy cockpit` command group.
|
|
3
|
+
*
|
|
4
|
+
* Observability verbs (read-only) for Generacy epics and repos:
|
|
5
|
+
* - watch — poll an epic's issues/PRs and emit cockpit events on state changes
|
|
6
|
+
* - status — render a grouped, colorized table of the epic's current state
|
|
7
|
+
*
|
|
8
|
+
* Single-issue verbs that inspect and drive workflow state for one issue:
|
|
9
|
+
* - context — classify the current waiting-for:* gate and emit its bundle
|
|
10
|
+
* - advance — manually advance a waiting gate (flip waiting-for → completed)
|
|
11
|
+
* - resume — re-arm a failed phase in place (clears failed:*, restores the
|
|
12
|
+
* preceding gate's waiting-for/completed pair + agent:paused)
|
|
13
|
+
*
|
|
14
|
+
* Epic merge/review verbs:
|
|
15
|
+
* - merge — merge a PR once its required checks are green
|
|
16
|
+
* - queue — enqueue eligible refs under a phase heading to the cluster pipeline
|
|
17
|
+
*/
|
|
18
|
+
import { Command } from 'commander';
|
|
19
|
+
import { watchCommand } from './watch.js';
|
|
20
|
+
import { statusCommand } from './status.js';
|
|
21
|
+
import { advanceCommand } from './advance.js';
|
|
22
|
+
import { contextCommand } from './context.js';
|
|
23
|
+
import { cockpitMergeCommand } from './merge.js';
|
|
24
|
+
import { queueCommand } from './queue.js';
|
|
25
|
+
import { resumeCommand } from './resume.js';
|
|
26
|
+
import { scopeCommand } from './scope.js';
|
|
27
|
+
import { cockpitMcpCommand } from './mcp/index.js';
|
|
28
|
+
export function cockpitCommand() {
|
|
29
|
+
const command = new Command('cockpit');
|
|
30
|
+
command.description('Cockpit — inspect and drive workflow state for Generacy epics and issues.');
|
|
31
|
+
command.addCommand(watchCommand());
|
|
32
|
+
command.addCommand(statusCommand());
|
|
33
|
+
command.addCommand(advanceCommand());
|
|
34
|
+
command.addCommand(contextCommand());
|
|
35
|
+
command.addCommand(cockpitMergeCommand());
|
|
36
|
+
command.addCommand(queueCommand());
|
|
37
|
+
command.addCommand(resumeCommand());
|
|
38
|
+
command.addCommand(scopeCommand());
|
|
39
|
+
command.addCommand(cockpitMcpCommand());
|
|
40
|
+
return command;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=index.js.map
|