@generacy-ai/generacy 0.3.4 → 0.4.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 +40 -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 +287 -0
- package/dist/cli/commands/cockpit/mcp/schemas.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/mcp/schemas.js +84 -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 +62 -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 +43 -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 +68 -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_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 +85 -0
- package/dist/cli/commands/cockpit/queue.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/queue.js +438 -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/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 +8 -0
- package/dist/cli/commands/cockpit/status/group.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/status/group.js +35 -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 +138 -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 +29 -0
- package/dist/cli/commands/cockpit/watch/diff.d.ts.map +1 -0
- package/dist/cli/commands/cockpit/watch/diff.js +85 -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/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 +11 -5
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { runQueue } from '../../queue.js';
|
|
2
|
+
import { normalizeIssueRef } from '../ref-input.js';
|
|
3
|
+
import { wrapToolBoundary } from '../errors.js';
|
|
4
|
+
import { CockpitQueueInputSchema } from '../schemas.js';
|
|
5
|
+
function buildQueueData(epicOwner, epicRepo, epicNumber, phase, result) {
|
|
6
|
+
const queued = [];
|
|
7
|
+
const skipped = [];
|
|
8
|
+
for (const row of result.rows) {
|
|
9
|
+
if (row.eligibility.kind === 'eligible') {
|
|
10
|
+
queued.push({
|
|
11
|
+
repo: row.ref.repo,
|
|
12
|
+
number: row.ref.number,
|
|
13
|
+
url: `https://github.com/${row.ref.repo}/issues/${row.ref.number}`,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
skipped.push({
|
|
18
|
+
repo: row.ref.repo,
|
|
19
|
+
number: row.ref.number,
|
|
20
|
+
reason: row.eligibility.reason,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
epic: { owner: epicOwner, repo: epicRepo, number: epicNumber },
|
|
26
|
+
phase,
|
|
27
|
+
queued,
|
|
28
|
+
skipped,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export function cockpitQueue(input, deps = {}) {
|
|
32
|
+
return wrapToolBoundary(async () => {
|
|
33
|
+
const parsed = CockpitQueueInputSchema.safeParse(input);
|
|
34
|
+
if (!parsed.success) {
|
|
35
|
+
return {
|
|
36
|
+
status: 'error',
|
|
37
|
+
class: 'invalid-args',
|
|
38
|
+
detail: parsed.error.issues.map((i) => i.message).join('; '),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const normalized = await normalizeIssueRef(parsed.data.epic, {
|
|
42
|
+
expects: 'issue',
|
|
43
|
+
...(deps.runner != null ? { runner: deps.runner } : {}),
|
|
44
|
+
...(deps.gh != null ? { gh: deps.gh } : {}),
|
|
45
|
+
});
|
|
46
|
+
if (!normalized.ok)
|
|
47
|
+
return normalized.error;
|
|
48
|
+
const captured = [];
|
|
49
|
+
const stderrLines = [];
|
|
50
|
+
const queueDeps = {
|
|
51
|
+
gh: deps.gh ?? normalized.value.gh,
|
|
52
|
+
...(deps.cockpitGh != null ? { cockpitGh: deps.cockpitGh } : {}),
|
|
53
|
+
...(deps.runner != null ? { runner: deps.runner } : {}),
|
|
54
|
+
...(deps.loadConfig != null ? { loadConfig: deps.loadConfig } : {}),
|
|
55
|
+
...(deps.fetchPlan != null ? { fetchPlan: deps.fetchPlan } : {}),
|
|
56
|
+
stdout: (line) => captured.push(line),
|
|
57
|
+
stderr: (line) => stderrLines.push(line),
|
|
58
|
+
prompt: async () => true,
|
|
59
|
+
};
|
|
60
|
+
const epicArg = `${normalized.value.ref.nwo}#${normalized.value.ref.number}`;
|
|
61
|
+
const result = await runQueue(epicArg, parsed.data.phase, { yes: true }, queueDeps);
|
|
62
|
+
return {
|
|
63
|
+
status: 'ok',
|
|
64
|
+
data: buildQueueData(normalized.value.ref.owner, normalized.value.ref.repo, normalized.value.ref.number, parsed.data.phase, result),
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=cockpit_queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cockpit_queue.js","sourceRoot":"","sources":["../../../../../../src/cli/commands/cockpit/mcp/tools/cockpit_queue.ts"],"names":[],"mappings":"AASA,OAAO,E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
|
4
|
+
* Wraps `runResume`. On happy-path, parses the "resumed ... added=[...] removed=[...]"
|
|
5
|
+
* stdout line to recover the label mutation set for structured output.
|
|
6
|
+
*
|
|
7
|
+
* Non-failed issue no-op (resume.ts:189-193): CLI prints "issue ... is not in
|
|
8
|
+
* a failed state" and exits 0. Represent as
|
|
9
|
+
* `{status: "ok", data: {action: "no-op", targetPhase: null, precedingGate: null,
|
|
10
|
+
* labelsAdded: [], labelsRemoved: []}}`.
|
|
11
|
+
*/
|
|
12
|
+
import type { CommandRunner, GhWrapper } from '@generacy-ai/cockpit';
|
|
13
|
+
import { type ResumeCommandDeps } from '../../resume.js';
|
|
14
|
+
import { type ToolResult } from '../errors.js';
|
|
15
|
+
import { type IssueRefInput } from '../schemas.js';
|
|
16
|
+
export interface CockpitResumeInput {
|
|
17
|
+
issue: IssueRefInput;
|
|
18
|
+
}
|
|
19
|
+
export interface CockpitResumeData {
|
|
20
|
+
ref: {
|
|
21
|
+
owner: string;
|
|
22
|
+
repo: string;
|
|
23
|
+
number: number;
|
|
24
|
+
nwo: string;
|
|
25
|
+
};
|
|
26
|
+
action: 'resumed' | 'no-op';
|
|
27
|
+
targetPhase: string | null;
|
|
28
|
+
precedingGate: string | null;
|
|
29
|
+
labelsAdded: string[];
|
|
30
|
+
labelsRemoved: string[];
|
|
31
|
+
}
|
|
32
|
+
export interface CockpitResumeDeps {
|
|
33
|
+
runner?: CommandRunner;
|
|
34
|
+
gh?: GhWrapper;
|
|
35
|
+
loadConfig?: ResumeCommandDeps['loadConfig'];
|
|
36
|
+
}
|
|
37
|
+
export declare function cockpitResume(input: CockpitResumeInput, deps?: CockpitResumeDeps): Promise<ToolResult<CockpitResumeData>>;
|
|
38
|
+
//# sourceMappingURL=cockpit_resume.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cockpit_resume.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/cockpit/mcp/tools/cockpit_resume.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAa,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAA4B,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAE7E,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,aAAa,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,UAAU,CAAC,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;CAC9C;AAKD,wBAAgB,aAAa,CAC3B,KAAK,EAAE,kBAAkB,EACzB,IAAI,GAAE,iBAAsB,GAC3B,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CA6ExC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { runResume } from '../../resume.js';
|
|
2
|
+
import { normalizeIssueRef } from '../ref-input.js';
|
|
3
|
+
import { wrapToolBoundary } from '../errors.js';
|
|
4
|
+
import { CockpitResumeInputSchema } from '../schemas.js';
|
|
5
|
+
const RESUMED_LINE = /^resumed .* re-armed phase=([^ ]+) via preceding-gate=([^;]+); added=\[([^\]]*)\] removed=\[([^\]]*)\]/;
|
|
6
|
+
export function cockpitResume(input, deps = {}) {
|
|
7
|
+
return wrapToolBoundary(async () => {
|
|
8
|
+
const parsed = CockpitResumeInputSchema.safeParse(input);
|
|
9
|
+
if (!parsed.success) {
|
|
10
|
+
return {
|
|
11
|
+
status: 'error',
|
|
12
|
+
class: 'invalid-args',
|
|
13
|
+
detail: parsed.error.issues.map((i) => i.message).join('; '),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const normalized = await normalizeIssueRef(parsed.data.issue, {
|
|
17
|
+
expects: 'issue',
|
|
18
|
+
...(deps.runner != null ? { runner: deps.runner } : {}),
|
|
19
|
+
...(deps.gh != null ? { gh: deps.gh } : {}),
|
|
20
|
+
});
|
|
21
|
+
if (!normalized.ok)
|
|
22
|
+
return normalized.error;
|
|
23
|
+
const captured = [];
|
|
24
|
+
const stderrLines = [];
|
|
25
|
+
const resumeDeps = {
|
|
26
|
+
gh: deps.gh ?? normalized.value.gh,
|
|
27
|
+
...(deps.runner != null ? { runner: deps.runner } : {}),
|
|
28
|
+
...(deps.loadConfig != null ? { loadConfig: deps.loadConfig } : {}),
|
|
29
|
+
stdout: (line) => captured.push(line),
|
|
30
|
+
stderr: (line) => stderrLines.push(line),
|
|
31
|
+
};
|
|
32
|
+
const issueArg = `${normalized.value.ref.nwo}#${normalized.value.ref.number}`;
|
|
33
|
+
await runResume(issueArg, {}, resumeDeps);
|
|
34
|
+
const noop = captured.some((l) => l.includes('is not in a failed state'));
|
|
35
|
+
if (noop) {
|
|
36
|
+
return {
|
|
37
|
+
status: 'ok',
|
|
38
|
+
data: {
|
|
39
|
+
ref: normalized.value.ref,
|
|
40
|
+
action: 'no-op',
|
|
41
|
+
targetPhase: null,
|
|
42
|
+
precedingGate: null,
|
|
43
|
+
labelsAdded: [],
|
|
44
|
+
labelsRemoved: [],
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const resumedLine = captured.find((l) => l.startsWith('resumed '));
|
|
49
|
+
if (resumedLine != null) {
|
|
50
|
+
const m = RESUMED_LINE.exec(resumedLine);
|
|
51
|
+
if (m) {
|
|
52
|
+
const [, phase, gate, added, removed] = m;
|
|
53
|
+
return {
|
|
54
|
+
status: 'ok',
|
|
55
|
+
data: {
|
|
56
|
+
ref: normalized.value.ref,
|
|
57
|
+
action: 'resumed',
|
|
58
|
+
targetPhase: phase,
|
|
59
|
+
precedingGate: gate,
|
|
60
|
+
labelsAdded: added.split(',').filter((s) => s.length > 0),
|
|
61
|
+
labelsRemoved: removed.split(',').filter((s) => s.length > 0),
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
status: 'ok',
|
|
68
|
+
data: {
|
|
69
|
+
ref: normalized.value.ref,
|
|
70
|
+
action: 'resumed',
|
|
71
|
+
targetPhase: '',
|
|
72
|
+
precedingGate: '',
|
|
73
|
+
labelsAdded: [],
|
|
74
|
+
labelsRemoved: [],
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=cockpit_resume.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cockpit_resume.js","sourceRoot":"","sources":["../../../../../../src/cli/commands/cockpit/mcp/tools/cockpit_resume.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,SAAS,EAA0B,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAsB,MAAM,eAAe,CAAC;AAqB7E,MAAM,YAAY,GAChB,wGAAwG,CAAC;AAE3G,MAAM,UAAU,aAAa,CAC3B,KAAyB,EACzB,OAA0B,EAAE;IAE5B,OAAO,gBAAgB,CAAoB,KA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O;oBACL,MAAM,EAAE,IAAI;oBACZ,IAAI,EAAE;wBACJ,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG;wBACzB,MAAM,EAAE,SAAS;wBACjB,WAAW,EAAE,KAAM;wBACnB,aAAa,EAAE,IAAK;wBACpB,WAAW,EAAE,KAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;wBAC1D,aAAa,EAAE,OAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;qBAC/D;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO;YACL,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE;gBACJ,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG;gBACzB,MAAM,EAAE,SAAS;gBACjB,WAAW,EAAE,EAAE;gBACf,aAAa,EAAE,EAAE;gBACjB,WAAW,EAAE,EAAE;gBACf,aAAa,EAAE,EAAE;aAClB;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cockpit_status` MCP tool handler.
|
|
3
|
+
*
|
|
4
|
+
* Wraps `runStatus({json: true})` with an in-memory stdout sink; parses the
|
|
5
|
+
* single-line JSON envelope the CLI already emits and returns it verbatim
|
|
6
|
+
* as `data`. No stdout ever reaches the MCP transport (which uses stdout
|
|
7
|
+
* for JSON-RPC).
|
|
8
|
+
*/
|
|
9
|
+
import type { CommandRunner, GhWrapper } from '@generacy-ai/cockpit';
|
|
10
|
+
import { type ToolResult } from '../errors.js';
|
|
11
|
+
import { type EpicRefInput } from '../schemas.js';
|
|
12
|
+
export interface CockpitStatusInput {
|
|
13
|
+
epic: EpicRefInput;
|
|
14
|
+
}
|
|
15
|
+
export type CockpitStatusData = unknown;
|
|
16
|
+
export interface CockpitStatusDeps {
|
|
17
|
+
runner?: CommandRunner;
|
|
18
|
+
gh?: GhWrapper;
|
|
19
|
+
}
|
|
20
|
+
export declare function cockpitStatus(input: CockpitStatusInput, deps?: CockpitStatusDeps): Promise<ToolResult<CockpitStatusData>>;
|
|
21
|
+
//# sourceMappingURL=cockpit_status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cockpit_status.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/cockpit/mcp/tools/cockpit_status.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGrE,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,YAAY,CAAC;CACpB;AAED,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAExC,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,EAAE,CAAC,EAAE,SAAS,CAAC;CAChB;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,kBAAkB,EACzB,IAAI,GAAE,iBAAsB,GAC3B,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAwDxC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { runStatus } from '../../status.js';
|
|
2
|
+
import { normalizeIssueRef } from '../ref-input.js';
|
|
3
|
+
import { wrapToolBoundary } from '../errors.js';
|
|
4
|
+
import { CockpitStatusInputSchema, } from '../schemas.js';
|
|
5
|
+
export function cockpitStatus(input, deps = {}) {
|
|
6
|
+
return wrapToolBoundary(async () => {
|
|
7
|
+
const parsed = CockpitStatusInputSchema.safeParse(input);
|
|
8
|
+
if (!parsed.success) {
|
|
9
|
+
return {
|
|
10
|
+
status: 'error',
|
|
11
|
+
class: 'invalid-args',
|
|
12
|
+
detail: parsed.error.issues.map((i) => i.message).join('; '),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const normalized = await normalizeIssueRef(parsed.data.epic, {
|
|
16
|
+
expects: 'issue',
|
|
17
|
+
...(deps.runner != null ? { runner: deps.runner } : {}),
|
|
18
|
+
...(deps.gh != null ? { gh: deps.gh } : {}),
|
|
19
|
+
});
|
|
20
|
+
if (!normalized.ok)
|
|
21
|
+
return normalized.error;
|
|
22
|
+
const captured = [];
|
|
23
|
+
const stderrLines = [];
|
|
24
|
+
const statusDeps = {
|
|
25
|
+
gh: deps.gh ?? normalized.value.gh,
|
|
26
|
+
...(deps.runner != null ? { runner: deps.runner } : {}),
|
|
27
|
+
stdout: (line) => captured.push(line),
|
|
28
|
+
stderr: (line) => stderrLines.push(line),
|
|
29
|
+
};
|
|
30
|
+
const epicArg = `${normalized.value.ref.nwo}#${normalized.value.ref.number}`;
|
|
31
|
+
const code = await runStatus(epicArg, { json: true }, statusDeps);
|
|
32
|
+
if (code !== 0) {
|
|
33
|
+
const detail = stderrLines.join('\n') || `runStatus exited ${code}`;
|
|
34
|
+
const cls = code === 2 ? 'invalid-args' : 'transport';
|
|
35
|
+
return { status: 'error', class: cls, detail };
|
|
36
|
+
}
|
|
37
|
+
const line = captured.find((l) => l.trim().length > 0);
|
|
38
|
+
if (line == null) {
|
|
39
|
+
return {
|
|
40
|
+
status: 'error',
|
|
41
|
+
class: 'internal',
|
|
42
|
+
detail: 'runStatus produced no JSON envelope',
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
let parsedJson;
|
|
46
|
+
try {
|
|
47
|
+
parsedJson = JSON.parse(line);
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
return {
|
|
51
|
+
status: 'error',
|
|
52
|
+
class: 'internal',
|
|
53
|
+
detail: `runStatus JSON envelope parse failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return { status: 'ok', data: parsedJson };
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=cockpit_status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cockpit_status.js","sourceRoot":"","sources":["../../../../../../src/cli/commands/cockpit/mcp/tools/cockpit_status.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAmB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,wBAAwB,GAEzB,MAAM,eAAe,CAAC;AAavB,MAAM,UAAU,aAAa,CAC3B,KAAyB,EACzB,OAA0B,EAAE;IAE5B,OAAO,gBAAgB,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,MAAM,GAAG,wBAAwB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO;gBACL,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,cAAc;gBACrB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;aAC7D,CAAC;QACJ,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;YAC3D,OAAO,EAAE,OAAO;YAChB,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACvD,GAAG,CAAC,I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AG,EAAE,MAAM,EAAE,CAAC;QACjD,CAAC;QAED,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACvD,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;YACjB,OAAO;gBACL,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,UAAU;gBACjB,MAAM,EAAE,qCAAqC;aAC9C,CAAC;QACJ,CAAC;QACD,IAAI,UAAmB,CAAC;QACxB,IAAI,CAAC;YACH,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO;gBACL,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,UAAU;gBACjB,MAAM,EAAE,yCAAyC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;aACpG,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import type { Logger } from 'pino';
|
|
3
|
+
import type { GhWrapper } from '@generacy-ai/cockpit';
|
|
4
|
+
export interface RunMergeInput {
|
|
5
|
+
gh: GhWrapper;
|
|
6
|
+
issue: number;
|
|
7
|
+
repo: string;
|
|
8
|
+
logger: Logger;
|
|
9
|
+
}
|
|
10
|
+
export interface RunMergeResult {
|
|
11
|
+
exitCode: 0 | 1 | 2 | 3;
|
|
12
|
+
stdout: string;
|
|
13
|
+
/**
|
|
14
|
+
* #928 — the PR number the CLI operated on. Set on exit-0 (the PR that was
|
|
15
|
+
* merged), on the pr-flag paths (mirrors the caller's `--pr <n>`), and on
|
|
16
|
+
* the resolver's non-terminal red paths where a PR was identified. Absent
|
|
17
|
+
* on `unresolved` / `pr-number` (no PR to name).
|
|
18
|
+
*/
|
|
19
|
+
prNumber?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface RunMergeWithExplicitPrInput {
|
|
22
|
+
gh: GhWrapper;
|
|
23
|
+
/** The `<ref>` issue number — authorization source for `completed:validate`. */
|
|
24
|
+
issue: number;
|
|
25
|
+
repo: string;
|
|
26
|
+
/** The operator-supplied `--pr <number>` value. Positive integer, validated. */
|
|
27
|
+
prNumber: number;
|
|
28
|
+
logger: Logger;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* FR-005 — Commander parser for `--pr <number>`. See contracts/pr-flag-cli.md §2.
|
|
32
|
+
* Throws `CockpitExit(2)` on any malformed input.
|
|
33
|
+
*/
|
|
34
|
+
export declare function parsePrFlag(input: string): number;
|
|
35
|
+
export declare function runMerge(input: RunMergeInput): Promise<RunMergeResult>;
|
|
36
|
+
/**
|
|
37
|
+
* FR-005..FR-008 — `--pr <number>` escape hatch. Skips the tier-1/2/3 resolver
|
|
38
|
+
* chain but keeps every safety precondition. Gate order per contracts/pr-flag-cli.md §3.
|
|
39
|
+
*/
|
|
40
|
+
export declare function runMergeWithExplicitPr(input: RunMergeWithExplicitPrInput): Promise<RunMergeResult>;
|
|
41
|
+
export declare function cockpitMergeCommand(): Command;
|
|
42
|
+
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/cockpit/merge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,KAAK,EACV,SAAS,EAIV,MAAM,sBAAsB,CAAC;AA8B9B,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,SAAS,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,SAAS,CAAC;IACd,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgBjD;AAsOD,wBAAsB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CA8G5E;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,2BAA2B,GACjC,OAAO,CAAC,cAAc,CAAC,CAsEzB;AAED,wBAAgB,mBAAmB,IAAI,OAAO,CA4C7C"}
|