@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,99 @@
|
|
|
1
|
+
import { runMerge, runMergeWithExplicitPr } from '../../merge.js';
|
|
2
|
+
import { assertQualifiedString, normalizeIssueRef } from '../ref-input.js';
|
|
3
|
+
import { getLogger } from '../../../../utils/logger.js';
|
|
4
|
+
import { toMcpResult, wrapToolBoundary } from '../errors.js';
|
|
5
|
+
import { CockpitMergeInputSchema } from '../schemas.js';
|
|
6
|
+
export function cockpitMerge(input, deps = {}) {
|
|
7
|
+
return wrapToolBoundary(async () => {
|
|
8
|
+
const parsed = CockpitMergeInputSchema.safeParse(input);
|
|
9
|
+
if (!parsed.success) {
|
|
10
|
+
// Q5 → B: preserve the old-field-name redirection. If the caller sent
|
|
11
|
+
// a `pr` key whose value is NOT a positive integer (i.e. they meant
|
|
12
|
+
// the pre-#928 shape where `pr` carried the issue ref), surface the
|
|
13
|
+
// renamed-field guidance instead of Zod's raw unknown-key diagnosis.
|
|
14
|
+
if (isPrLikelyOldFieldName(input)) {
|
|
15
|
+
return {
|
|
16
|
+
status: 'error',
|
|
17
|
+
class: 'invalid-args',
|
|
18
|
+
detail: "the 'pr' field was renamed to 'issue'; pass the issue ref, not the PR number",
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
status: 'error',
|
|
23
|
+
class: 'invalid-args',
|
|
24
|
+
detail: parsed.error.issues.map((i) => i.message).join('; '),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
// Q1 → A: bare strings on the MCP transport must be qualified refs.
|
|
28
|
+
if (typeof parsed.data.issue === 'string') {
|
|
29
|
+
const qualified = assertQualifiedString(parsed.data.issue);
|
|
30
|
+
if (!qualified.ok) {
|
|
31
|
+
return { status: 'error', class: 'invalid-args', detail: qualified.error };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const normalized = await normalizeIssueRef(parsed.data.issue, {
|
|
35
|
+
expects: 'issue',
|
|
36
|
+
...(deps.runner != null ? { runner: deps.runner } : {}),
|
|
37
|
+
...(deps.gh != null ? { gh: deps.gh } : {}),
|
|
38
|
+
});
|
|
39
|
+
if (!normalized.ok)
|
|
40
|
+
return normalized.error;
|
|
41
|
+
const logger = getLogger();
|
|
42
|
+
const nwo = normalized.value.ref.nwo;
|
|
43
|
+
const issueNumber = normalized.value.ref.number;
|
|
44
|
+
const gh = deps.gh ?? normalized.value.gh;
|
|
45
|
+
const result = parsed.data.pr != null
|
|
46
|
+
? await runMergeWithExplicitPr({
|
|
47
|
+
gh,
|
|
48
|
+
issue: issueNumber,
|
|
49
|
+
repo: nwo,
|
|
50
|
+
prNumber: parsed.data.pr,
|
|
51
|
+
logger,
|
|
52
|
+
})
|
|
53
|
+
: await runMerge({
|
|
54
|
+
gh,
|
|
55
|
+
issue: issueNumber,
|
|
56
|
+
repo: nwo,
|
|
57
|
+
logger,
|
|
58
|
+
});
|
|
59
|
+
// Successful merge → synthesize a MCP payload. The CLI emits either an
|
|
60
|
+
// empty stdout (no notes) or a note followed by a branch-deletion suffix
|
|
61
|
+
// on success — neither is JSON. `result.prNumber` carries the resolved
|
|
62
|
+
// PR (or the caller's explicit `--pr <n>`).
|
|
63
|
+
if (result.exitCode === 0) {
|
|
64
|
+
const prNumber = result.prNumber ?? parsed.data.pr ?? issueNumber;
|
|
65
|
+
const url = `https://github.com/${nwo}/pull/${prNumber}`;
|
|
66
|
+
return {
|
|
67
|
+
status: 'ok',
|
|
68
|
+
data: {
|
|
69
|
+
pr: {
|
|
70
|
+
owner: normalized.value.ref.owner,
|
|
71
|
+
repo: normalized.value.ref.repo,
|
|
72
|
+
number: prNumber,
|
|
73
|
+
url,
|
|
74
|
+
},
|
|
75
|
+
action: 'merged',
|
|
76
|
+
checksState: 'success',
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return toMcpResult(result.stdout, result.exitCode);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Detects the pre-#928 field shape: a `pr` key whose value is NOT a positive
|
|
85
|
+
* integer (i.e. either a string, object, or non-integer number). Used to
|
|
86
|
+
* emit the renamed-field guidance instead of Zod's default error.
|
|
87
|
+
*/
|
|
88
|
+
function isPrLikelyOldFieldName(raw) {
|
|
89
|
+
if (raw == null || typeof raw !== 'object')
|
|
90
|
+
return false;
|
|
91
|
+
const r = raw;
|
|
92
|
+
if (!('pr' in r))
|
|
93
|
+
return false;
|
|
94
|
+
const pr = r.pr;
|
|
95
|
+
if (typeof pr === 'number' && Number.isInteger(pr) && pr > 0)
|
|
96
|
+
return false;
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=cockpit_merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cockpit_merge.js","sourceRoot":"","sources":["../../../../../../src/cli/commands/cockpit/mcp/tools/cockpit_merge.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAmB,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAsB,MAAM,eAAe,CAAC;AAqB5E,MAAM,UAAU,YAAY,CAC1B,KAAwB,EACxB,OAAyB,EAAE;IAE3B,OAAO,gBAAgB,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,MAAM,GAAG,uBAAuB,CAAC,SAAS,CAAC,KAAK,CAAC,CAA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AE,QAAQ;wBAChB,GAAG;qBACJ;oBACD,MAAM,EAAE,QAAQ;oBAChB,WAAW,EAAE,SAAS;iBACvB;aACF,CAAC;QACJ,CAAC;QAED,OAAO,WAAW,CAAmB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,SAAS,sBAAsB,CAAC,GAAY;IAC1C,IAAI,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACzD,MAAM,CAAC,GAAG,GAA8B,CAAC;IACzC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC/B,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;IAChB,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3E,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cockpit_queue` MCP tool handler.
|
|
3
|
+
*
|
|
4
|
+
* Wraps `runQueue` with the confirmation prompt short-circuited to `true`
|
|
5
|
+
* (agents don't type "y" — the whole point of the MCP transport is to
|
|
6
|
+
* eliminate that class of round). Returns the structured `queued`/`skipped`
|
|
7
|
+
* arrays derived from `QueueResult.rows`.
|
|
8
|
+
*/
|
|
9
|
+
import type { CommandRunner, GhWrapper } from '@generacy-ai/cockpit';
|
|
10
|
+
import { type QueueCommandDeps } from '../../queue.js';
|
|
11
|
+
import { type ToolResult } from '../errors.js';
|
|
12
|
+
import { type EpicRefInput, type IssueRefInput } from '../schemas.js';
|
|
13
|
+
export interface CockpitQueuePhaseInput {
|
|
14
|
+
epic: EpicRefInput;
|
|
15
|
+
phase: string;
|
|
16
|
+
}
|
|
17
|
+
export interface CockpitQueueIssueInputShape {
|
|
18
|
+
issue: IssueRefInput;
|
|
19
|
+
}
|
|
20
|
+
export type CockpitQueueInput = CockpitQueuePhaseInput | CockpitQueueIssueInputShape;
|
|
21
|
+
export interface CockpitQueueData {
|
|
22
|
+
epic: {
|
|
23
|
+
owner: string;
|
|
24
|
+
repo: string;
|
|
25
|
+
number: number;
|
|
26
|
+
};
|
|
27
|
+
phase: string;
|
|
28
|
+
queued: Array<{
|
|
29
|
+
repo: string;
|
|
30
|
+
number: number;
|
|
31
|
+
url: string;
|
|
32
|
+
}>;
|
|
33
|
+
skipped: Array<{
|
|
34
|
+
repo: string;
|
|
35
|
+
number: number;
|
|
36
|
+
reason: string;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
export interface CockpitQueueIssueData {
|
|
40
|
+
issue: {
|
|
41
|
+
owner: string;
|
|
42
|
+
repo: string;
|
|
43
|
+
number: number;
|
|
44
|
+
};
|
|
45
|
+
outcome: 'queued' | 'skipped';
|
|
46
|
+
reason?: 'closed' | 'already-labeled' | 'not-found';
|
|
47
|
+
workflowLabel: string;
|
|
48
|
+
assignee: string;
|
|
49
|
+
url: string;
|
|
50
|
+
}
|
|
51
|
+
export interface CockpitQueueDeps {
|
|
52
|
+
runner?: CommandRunner;
|
|
53
|
+
gh?: GhWrapper;
|
|
54
|
+
cockpitGh?: GhWrapper;
|
|
55
|
+
loadConfig?: QueueCommandDeps['loadConfig'];
|
|
56
|
+
fetchPlan?: QueueCommandDeps['fetchPlan'];
|
|
57
|
+
}
|
|
58
|
+
export declare function cockpitQueue(input: CockpitQueueInput, deps?: CockpitQueueDeps): Promise<ToolResult<CockpitQueueData | CockpitQueueIssueData>>;
|
|
59
|
+
//# sourceMappingURL=cockpit_queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cockpit_queue.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/cockpit/mcp/tools/cockpit_queue.ts"],"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E,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;CAC3C;AAkCD,wBAAgB,YAAY,CAC1B,KAAK,EAAE,iBAAiB,EACxB,IAAI,GAAE,gBAAqB,GAC1B,OAAO,CAAC,UAAU,CAAC,gBAAgB,GAAG,qBAAqB,CAAC,CAAC,CA2F/D"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { runQueue, runQueueSingleIssue, } 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
|
+
// Discriminated union: `issue` = single-issue form, `epic + phase` = phase form.
|
|
42
|
+
if ('issue' in parsed.data) {
|
|
43
|
+
const refN = await normalizeIssueRef(parsed.data.issue, {
|
|
44
|
+
expects: 'issue',
|
|
45
|
+
...(deps.runner != null ? { runner: deps.runner } : {}),
|
|
46
|
+
...(deps.gh != null ? { gh: deps.gh } : {}),
|
|
47
|
+
});
|
|
48
|
+
if (!refN.ok)
|
|
49
|
+
return refN.error;
|
|
50
|
+
const captured = [];
|
|
51
|
+
const stderrLines = [];
|
|
52
|
+
const queueDeps = {
|
|
53
|
+
gh: deps.gh ?? refN.value.gh,
|
|
54
|
+
...(deps.cockpitGh != null ? { cockpitGh: deps.cockpitGh } : {}),
|
|
55
|
+
...(deps.runner != null ? { runner: deps.runner } : {}),
|
|
56
|
+
...(deps.loadConfig != null ? { loadConfig: deps.loadConfig } : {}),
|
|
57
|
+
stdout: (line) => captured.push(line),
|
|
58
|
+
stderr: (line) => stderrLines.push(line),
|
|
59
|
+
prompt: async () => true,
|
|
60
|
+
};
|
|
61
|
+
const issueArg = `${refN.value.ref.nwo}#${refN.value.ref.number}`;
|
|
62
|
+
const result = await runQueueSingleIssue(issueArg, { yes: true }, queueDeps);
|
|
63
|
+
const data = {
|
|
64
|
+
issue: {
|
|
65
|
+
owner: refN.value.ref.owner,
|
|
66
|
+
repo: refN.value.ref.repo,
|
|
67
|
+
number: refN.value.ref.number,
|
|
68
|
+
},
|
|
69
|
+
outcome: result.row.eligibility.kind === 'eligible' ? 'queued' : 'skipped',
|
|
70
|
+
workflowLabel: result.workflowLabel,
|
|
71
|
+
assignee: result.assignee,
|
|
72
|
+
url: `https://github.com/${result.ref.repo}/issues/${result.ref.number}`,
|
|
73
|
+
};
|
|
74
|
+
if (result.row.eligibility.kind === 'skip') {
|
|
75
|
+
data.reason = result.row.eligibility.reason;
|
|
76
|
+
}
|
|
77
|
+
return { status: 'ok', data };
|
|
78
|
+
}
|
|
79
|
+
const normalized = await normalizeIssueRef(parsed.data.epic, {
|
|
80
|
+
expects: 'issue',
|
|
81
|
+
...(deps.runner != null ? { runner: deps.runner } : {}),
|
|
82
|
+
...(deps.gh != null ? { gh: deps.gh } : {}),
|
|
83
|
+
});
|
|
84
|
+
if (!normalized.ok)
|
|
85
|
+
return normalized.error;
|
|
86
|
+
const captured = [];
|
|
87
|
+
const stderrLines = [];
|
|
88
|
+
const queueDeps = {
|
|
89
|
+
gh: deps.gh ?? normalized.value.gh,
|
|
90
|
+
...(deps.cockpitGh != null ? { cockpitGh: deps.cockpitGh } : {}),
|
|
91
|
+
...(deps.runner != null ? { runner: deps.runner } : {}),
|
|
92
|
+
...(deps.loadConfig != null ? { loadConfig: deps.loadConfig } : {}),
|
|
93
|
+
...(deps.fetchPlan != null ? { fetchPlan: deps.fetchPlan } : {}),
|
|
94
|
+
stdout: (line) => captured.push(line),
|
|
95
|
+
stderr: (line) => stderrLines.push(line),
|
|
96
|
+
prompt: async () => true,
|
|
97
|
+
};
|
|
98
|
+
const epicArg = `${normalized.value.ref.nwo}#${normalized.value.ref.number}`;
|
|
99
|
+
const result = await runQueue(epicArg, parsed.data.phase, { yes: true }, queueDeps);
|
|
100
|
+
return {
|
|
101
|
+
status: 'ok',
|
|
102
|
+
data: buildQueueData(normalized.value.ref.owner, normalized.value.ref.repo, normalized.value.ref.number, parsed.data.phase, result),
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
//# 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,EACL,QAAQ,EACR,mBAAmB,GAGpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,uBAAuB,GAGxB,MAAM,eAAe,CAAC;AAqCvB,SAAS,cAAc,CACrB,SAAiB,EACjB,QAAgB,EAChB,UAAkB,EAClB,KAAa,EACb,MAAmB;IAEnB,MAAM,MAAM,GAA+B,EAAE,CAAC;IAC9C,MAAM,OAAO,GAAgC,EAAE,CAAC;IAChD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAC9B,IAAI,GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACxC,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI;gBAClB,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM;gBACtB,GAAG,EAAE,sBAAsB,GAAG,CAAC,GAAG,CAAC,IAAI,WAAW,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE;aACnE,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC;gBACX,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI;gBAClB,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM;gBACtB,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,MAAM;aAC/B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO;QACL,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,E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AC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cockpit_resume` MCP tool handler.
|
|
3
|
+
*
|
|
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,CAA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;YACzC,IAAI,CAAC,EAAE,CAAC;gBACN,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;gBAC1C,OAAO;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,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cockpit_scope_add` MCP tool handler.
|
|
3
|
+
*
|
|
4
|
+
* Appends a task-list ref to a scope (epic or tracking) issue's body,
|
|
5
|
+
* concurrency-safe via bounded retry (see scope/retry.ts).
|
|
6
|
+
*/
|
|
7
|
+
import type { CommandRunner, GhWrapper } from '@generacy-ai/cockpit';
|
|
8
|
+
import { type ToolResult } from '../errors.js';
|
|
9
|
+
import { type CockpitScopeAddInput } from '../schemas.js';
|
|
10
|
+
import type { BodyShape } from '../../scope/writer.js';
|
|
11
|
+
export interface CockpitScopeAddData {
|
|
12
|
+
scope: {
|
|
13
|
+
owner: string;
|
|
14
|
+
repo: string;
|
|
15
|
+
number: number;
|
|
16
|
+
};
|
|
17
|
+
ref: {
|
|
18
|
+
owner: string;
|
|
19
|
+
repo: string;
|
|
20
|
+
number: number;
|
|
21
|
+
};
|
|
22
|
+
shape: BodyShape;
|
|
23
|
+
alreadyPresent: boolean;
|
|
24
|
+
attempts: number;
|
|
25
|
+
}
|
|
26
|
+
export interface CockpitScopeAddDeps {
|
|
27
|
+
runner?: CommandRunner;
|
|
28
|
+
gh?: GhWrapper;
|
|
29
|
+
}
|
|
30
|
+
export declare function cockpitScopeAdd(input: CockpitScopeAddInput, deps?: CockpitScopeAddDeps): Promise<ToolResult<CockpitScopeAddData>>;
|
|
31
|
+
//# sourceMappingURL=cockpit_scope_add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cockpit_scope_add.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/cockpit/mcp/tools/cockpit_scope_add.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACvD,GAAG,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,KAAK,EAAE,SAAS,CAAC;IACjB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,EAAE,CAAC,EAAE,SAAS,CAAC;CAChB;AAOD,wBAAgB,eAAe,CAC7B,KAAK,EAAE,oBAAoB,EAC3B,IAAI,GAAE,mBAAwB,GAC7B,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAuE1C"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { normalizeIssueRef } from '../ref-input.js';
|
|
2
|
+
import { wrapToolBoundary } from '../errors.js';
|
|
3
|
+
import { CockpitScopeAddInputSchema, } from '../schemas.js';
|
|
4
|
+
import { writeScopeWithRetry } from '../../scope/retry.js';
|
|
5
|
+
import { ScopeContendedError } from '../../scope/errors.js';
|
|
6
|
+
function isScopeNotFoundError(err) {
|
|
7
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
8
|
+
return /404|not found|no such/i.test(msg);
|
|
9
|
+
}
|
|
10
|
+
export function cockpitScopeAdd(input, deps = {}) {
|
|
11
|
+
return wrapToolBoundary(async () => {
|
|
12
|
+
const parsed = CockpitScopeAddInputSchema.safeParse(input);
|
|
13
|
+
if (!parsed.success) {
|
|
14
|
+
return {
|
|
15
|
+
status: 'error',
|
|
16
|
+
class: 'invalid-args',
|
|
17
|
+
detail: parsed.error.issues.map((i) => i.message).join('; '),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const scopeN = await normalizeIssueRef(parsed.data.scope, {
|
|
21
|
+
expects: 'issue',
|
|
22
|
+
...(deps.runner != null ? { runner: deps.runner } : {}),
|
|
23
|
+
...(deps.gh != null ? { gh: deps.gh } : {}),
|
|
24
|
+
});
|
|
25
|
+
if (!scopeN.ok)
|
|
26
|
+
return scopeN.error;
|
|
27
|
+
const refN = await normalizeIssueRef(parsed.data.issue, {
|
|
28
|
+
expects: 'issue',
|
|
29
|
+
...(deps.runner != null ? { runner: deps.runner } : {}),
|
|
30
|
+
...(deps.gh != null ? { gh: deps.gh } : {}),
|
|
31
|
+
});
|
|
32
|
+
if (!refN.ok)
|
|
33
|
+
return refN.error;
|
|
34
|
+
const gh = deps.gh ?? scopeN.value.gh;
|
|
35
|
+
const scope = { repo: scopeN.value.ref.nwo, number: scopeN.value.ref.number };
|
|
36
|
+
const ref = { repo: refN.value.ref.nwo, number: refN.value.ref.number };
|
|
37
|
+
try {
|
|
38
|
+
const result = await writeScopeWithRetry({
|
|
39
|
+
gh,
|
|
40
|
+
scope,
|
|
41
|
+
mutation: { kind: 'add', ref },
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
status: 'ok',
|
|
45
|
+
data: {
|
|
46
|
+
scope: {
|
|
47
|
+
owner: scopeN.value.ref.owner,
|
|
48
|
+
repo: scopeN.value.ref.repo,
|
|
49
|
+
number: scopeN.value.ref.number,
|
|
50
|
+
},
|
|
51
|
+
ref: {
|
|
52
|
+
owner: refN.value.ref.owner,
|
|
53
|
+
repo: refN.value.ref.repo,
|
|
54
|
+
number: refN.value.ref.number,
|
|
55
|
+
},
|
|
56
|
+
shape: result.shape,
|
|
57
|
+
alreadyPresent: result.noop,
|
|
58
|
+
attempts: result.attempts,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
if (err instanceof ScopeContendedError) {
|
|
64
|
+
return {
|
|
65
|
+
status: 'error',
|
|
66
|
+
class: 'contended',
|
|
67
|
+
detail: `${err.code} after ${err.attempts} attempts`,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (isScopeNotFoundError(err)) {
|
|
71
|
+
return {
|
|
72
|
+
status: 'error',
|
|
73
|
+
class: 'scope-not-found',
|
|
74
|
+
detail: `scope issue ${scope.repo}#${scope.number} not found`,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
throw err;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=cockpit_scope_add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cockpit_scope_add.js","sourceRoot":"","sources":["../../../../../../src/cli/commands/cockpit/mcp/tools/cockpit_scope_add.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,0BAA0B,GAE3B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAgB5D,SAAS,oBAAoB,CAAC,GAAY;IACxC,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7D,OAAO,wBAAwB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,KAA2B,EAC3B,OAA4B,EAAE;IAE9B,OAAO,gBAAgB,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,MAAM,GAAG,0BAA0B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC3D,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,MAAM,GAAG,MAAM,iBAAiB,CAA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,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,YAAY;iBAC9D,CAAC;YACJ,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cockpit_scope_remove` MCP tool handler.
|
|
3
|
+
*
|
|
4
|
+
* Removes the first task-list line matching the ref from a scope issue's
|
|
5
|
+
* body. Same envelope and error classes as `cockpit_scope_add`; the shared
|
|
6
|
+
* `SCOPE_ADD_CONTENDED` code covers both mutations per spec Q5.
|
|
7
|
+
*/
|
|
8
|
+
import type { CommandRunner, GhWrapper } from '@generacy-ai/cockpit';
|
|
9
|
+
import { type ToolResult } from '../errors.js';
|
|
10
|
+
import { type CockpitScopeRemoveInput } from '../schemas.js';
|
|
11
|
+
export interface CockpitScopeRemoveData {
|
|
12
|
+
scope: {
|
|
13
|
+
owner: string;
|
|
14
|
+
repo: string;
|
|
15
|
+
number: number;
|
|
16
|
+
};
|
|
17
|
+
ref: {
|
|
18
|
+
owner: string;
|
|
19
|
+
repo: string;
|
|
20
|
+
number: number;
|
|
21
|
+
};
|
|
22
|
+
alreadyAbsent: boolean;
|
|
23
|
+
attempts: number;
|
|
24
|
+
}
|
|
25
|
+
export interface CockpitScopeRemoveDeps {
|
|
26
|
+
runner?: CommandRunner;
|
|
27
|
+
gh?: GhWrapper;
|
|
28
|
+
}
|
|
29
|
+
export declare function cockpitScopeRemove(input: CockpitScopeRemoveInput, deps?: CockpitScopeRemoveDeps): Promise<ToolResult<CockpitScopeRemoveData>>;
|
|
30
|
+
//# sourceMappingURL=cockpit_scope_remove.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cockpit_scope_remove.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/cockpit/mcp/tools/cockpit_scope_remove.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,eAAe,CAAC;AAIvB,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACvD,GAAG,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,EAAE,CAAC,EAAE,SAAS,CAAC;CAChB;AAOD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,uBAAuB,EAC9B,IAAI,GAAE,sBAA2B,GAChC,OAAO,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC,CAsE7C"}
|