@ddtcorex/dsh-maestro-review 0.12.0 → 0.14.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 +31 -58
- package/cordis.patch.yml +23 -18
- package/lib/config-store.d.ts +9 -1
- package/lib/config-store.d.ts.map +1 -1
- package/lib/config-store.js +1 -1
- package/lib/config-store.js.map +1 -1
- package/lib/events.d.ts +5 -45
- package/lib/events.d.ts.map +1 -1
- package/lib/host-orchestrator.d.ts +128 -0
- package/lib/host-orchestrator.d.ts.map +1 -0
- package/lib/host-orchestrator.js +408 -0
- package/lib/host-orchestrator.js.map +1 -0
- package/lib/index.d.ts +7 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -43
- package/lib/index.js.map +1 -1
- package/lib/review-intake.d.ts +1 -1
- package/lib/review-intake.d.ts.map +1 -1
- package/lib/settings-rpc.js +1 -1
- package/lib/settings-rpc.js.map +1 -1
- package/package.json +19 -36
- package/src/client/index.tsx +1 -1
- package/src/host/augment.d.ts +3 -1
- package/src/host/config-store.ts +2 -2
- package/src/host/events.ts +5 -45
- package/src/host/host-orchestrator.ts +461 -0
- package/src/host/index.ts +7 -35
- package/src/host/providers/gitlab.ts +1 -1
- package/src/host/review-intake.ts +1 -1
- package/src/host/settings-rpc.ts +1 -1
- package/lib/ci-clone.d.ts +0 -21
- package/lib/ci-clone.d.ts.map +0 -1
- package/lib/ci-clone.js +0 -35
- package/lib/ci-clone.js.map +0 -1
- package/lib/ci-coexist.d.ts +0 -11
- package/lib/ci-coexist.d.ts.map +0 -1
- package/lib/ci-coexist.js +0 -38
- package/lib/ci-coexist.js.map +0 -1
- package/lib/gitlab-auth.d.ts +0 -11
- package/lib/gitlab-auth.d.ts.map +0 -1
- package/lib/gitlab-auth.js +0 -15
- package/lib/gitlab-auth.js.map +0 -1
- package/lib/gitlab-client.d.ts +0 -78
- package/lib/gitlab-client.d.ts.map +0 -1
- package/lib/gitlab-client.js +0 -270
- package/lib/gitlab-client.js.map +0 -1
- package/lib/govard-lint-detection.d.ts +0 -20
- package/lib/govard-lint-detection.d.ts.map +0 -1
- package/lib/govard-lint-detection.js +0 -48
- package/lib/govard-lint-detection.js.map +0 -1
- package/lib/hyva-csp-scan-tool.d.ts +0 -11
- package/lib/hyva-csp-scan-tool.d.ts.map +0 -1
- package/lib/hyva-csp-scan-tool.js +0 -193
- package/lib/hyva-csp-scan-tool.js.map +0 -1
- package/lib/hyva-theme-inspect-tool.d.ts +0 -10
- package/lib/hyva-theme-inspect-tool.d.ts.map +0 -1
- package/lib/hyva-theme-inspect-tool.js +0 -299
- package/lib/hyva-theme-inspect-tool.js.map +0 -1
- package/lib/incremental.d.ts +0 -28
- package/lib/incremental.d.ts.map +0 -1
- package/lib/incremental.js +0 -62
- package/lib/incremental.js.map +0 -1
- package/lib/layout-xml-tool.d.ts +0 -11
- package/lib/layout-xml-tool.d.ts.map +0 -1
- package/lib/layout-xml-tool.js +0 -239
- package/lib/layout-xml-tool.js.map +0 -1
- package/lib/module-check-tool.d.ts +0 -11
- package/lib/module-check-tool.d.ts.map +0 -1
- package/lib/module-check-tool.js +0 -303
- package/lib/module-check-tool.js.map +0 -1
- package/lib/orchestrator.d.ts +0 -357
- package/lib/orchestrator.d.ts.map +0 -1
- package/lib/orchestrator.js +0 -1497
- package/lib/orchestrator.js.map +0 -1
- package/lib/perf-log-stats-tool.d.ts +0 -13
- package/lib/perf-log-stats-tool.d.ts.map +0 -1
- package/lib/perf-log-stats-tool.js +0 -245
- package/lib/perf-log-stats-tool.js.map +0 -1
- package/lib/phtml-escape-scan-tool.d.ts +0 -11
- package/lib/phtml-escape-scan-tool.d.ts.map +0 -1
- package/lib/phtml-escape-scan-tool.js +0 -166
- package/lib/phtml-escape-scan-tool.js.map +0 -1
- package/lib/providers/ci-trigger.d.ts +0 -44
- package/lib/providers/ci-trigger.d.ts.map +0 -1
- package/lib/providers/ci-trigger.js +0 -150
- package/lib/providers/ci-trigger.js.map +0 -1
- package/lib/review-findings-tool.d.ts +0 -20
- package/lib/review-findings-tool.d.ts.map +0 -1
- package/lib/review-findings-tool.js +0 -39
- package/lib/review-findings-tool.js.map +0 -1
- package/lib/review-history.d.ts +0 -40
- package/lib/review-history.d.ts.map +0 -1
- package/lib/review-history.js +0 -136
- package/lib/review-history.js.map +0 -1
- package/lib/review-marker.d.ts +0 -17
- package/lib/review-marker.d.ts.map +0 -1
- package/lib/review-marker.js +0 -23
- package/lib/review-marker.js.map +0 -1
- package/lib/review-signals.d.ts +0 -17
- package/lib/review-signals.d.ts.map +0 -1
- package/lib/review-signals.js +0 -79
- package/lib/review-signals.js.map +0 -1
- package/lib/scope-split-tool.d.ts +0 -42
- package/lib/scope-split-tool.d.ts.map +0 -1
- package/lib/scope-split-tool.js +0 -108
- package/lib/scope-split-tool.js.map +0 -1
- package/lib/search-tool.d.ts +0 -15
- package/lib/search-tool.d.ts.map +0 -1
- package/lib/search-tool.js +0 -144
- package/lib/search-tool.js.map +0 -1
- package/lib/skill-provider.d.ts +0 -19
- package/lib/skill-provider.d.ts.map +0 -1
- package/lib/skill-provider.js +0 -101
- package/lib/skill-provider.js.map +0 -1
- package/lib/skills-tool.d.ts +0 -29
- package/lib/skills-tool.d.ts.map +0 -1
- package/lib/skills-tool.js +0 -185
- package/lib/skills-tool.js.map +0 -1
- package/lib/source.d.ts +0 -23
- package/lib/source.d.ts.map +0 -1
- package/lib/source.js +0 -16
- package/lib/source.js.map +0 -1
- package/lib/tool-policy.d.ts +0 -20
- package/lib/tool-policy.d.ts.map +0 -1
- package/lib/tool-policy.js +0 -42
- package/lib/tool-policy.js.map +0 -1
- package/presets/maestro-auditor.patch.yml +0 -54
- package/presets/maestro-coder/agent.cordis.yml +0 -223
- package/presets/maestro-coder/preset.yml +0 -2
- package/presets/maestro-reviewer.patch.yml +0 -55
- package/profiles/reviewer-ci/cordis.patch.yml +0 -78
- package/profiles/reviewer-ci/package.json +0 -19
- package/profiles/reviewer-ci/pnpm-lock.yaml +0 -8207
- package/profiles/reviewer-ci/pnpm-workspace.yaml +0 -36
- package/skills/dsh-native-tools/SKILL.md +0 -80
- package/src/host/ci-clone.ts +0 -54
- package/src/host/ci-coexist.ts +0 -45
- package/src/host/dsh-skill.d.ts +0 -72
- package/src/host/gitlab-auth.ts +0 -13
- package/src/host/gitlab-client.ts +0 -332
- package/src/host/govard-lint-detection.ts +0 -47
- package/src/host/hyva-csp-scan-tool.ts +0 -165
- package/src/host/hyva-theme-inspect-tool.ts +0 -258
- package/src/host/incremental.ts +0 -86
- package/src/host/layout-xml-tool.ts +0 -190
- package/src/host/module-check-tool.ts +0 -187
- package/src/host/orchestrator.ts +0 -1641
- package/src/host/perf-log-stats-tool.ts +0 -224
- package/src/host/phtml-escape-scan-tool.ts +0 -112
- package/src/host/providers/ci-trigger.ts +0 -168
- package/src/host/review-findings-tool.ts +0 -59
- package/src/host/review-history.ts +0 -168
- package/src/host/review-marker.ts +0 -25
- package/src/host/review-signals.ts +0 -83
- package/src/host/scope-split-tool.ts +0 -109
- package/src/host/search-tool.ts +0 -152
- package/src/host/skill-provider.ts +0 -94
- package/src/host/skills-tool.ts +0 -218
- package/src/host/source.ts +0 -26
- package/src/host/tool-policy.ts +0 -49
- package/templates/reviewer-project.gitlab-ci.yml +0 -93
- package/templates/source-project.gitlab-ci.yml +0 -48
package/src/host/index.ts
CHANGED
|
@@ -1,37 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Package entry of @ddtcorex/dsh-maestro-review (row `maestro-review-plugin`).
|
|
3
|
+
* Every capability is its own row in cordis.patch.yml (webhook, host
|
|
4
|
+
* orchestrator, settings RPC); the root row exists so DSH serves the client
|
|
5
|
+
* bundle, and apply() itself registers nothing.
|
|
6
|
+
*/
|
|
4
7
|
export const name = '@ddtcorex/dsh-maestro-review'
|
|
5
8
|
|
|
6
|
-
export function apply(
|
|
7
|
-
// The bundled DSH tool map is served from here, not from the public
|
|
8
|
-
// `maestro-skills` plugin: that repo's catalog test requires its skill content
|
|
9
|
-
// to stay tool-neutral, and this map names harness tools. Wrapped like the
|
|
10
|
-
// rest of apply(): a missing service or a throwing registration must never
|
|
11
|
-
// take down the whole plugin tree.
|
|
12
|
-
try {
|
|
13
|
-
const skills = (ctx as unknown as { get?: (key: string) => any }).get?.('skills')
|
|
14
|
-
if (skills?.registerProvider) {
|
|
15
|
-
ctx.effect(() => {
|
|
16
|
-
let unregister: (() => void) | undefined
|
|
17
|
-
try {
|
|
18
|
-
// Package-root skills/ is resolved at runtime by walking to the
|
|
19
|
-
// nearest package.json (robust to lib/ vs src/host/ layouts).
|
|
20
|
-
unregister = skills.registerProvider(() => makeSkillProvider(resolveSkillsDir(__dirname)))
|
|
21
|
-
} catch (e: any) {
|
|
22
|
-
try { (ctx as any).logger?.warn?.(`[review] skill provider failed: ${e?.message ?? String(e)}`) } catch {}
|
|
23
|
-
}
|
|
24
|
-
return () => { try { unregister?.() } catch {} }
|
|
25
|
-
}, 'maestro-review:skill')
|
|
26
|
-
}
|
|
27
|
-
} catch (e: any) {
|
|
28
|
-
try { (ctx as any).logger?.warn?.(`[review] skill provider effect failed: ${e?.message ?? String(e)}`) } catch {}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// No RPC registration here on purpose. The channel belongs to settings-rpc.ts
|
|
32
|
-
// (row `maestro-review-settings-rpc`), which implements the real endpoints. A
|
|
33
|
-
// stub in this file used to claim the same channel; that stayed invisible only
|
|
34
|
-
// because apply() was never mounted. Once the `maestro-review-host` row made
|
|
35
|
-
// apply() run, both registrations collided and the Settings card died with:
|
|
36
|
-
// webserver: duplicate prefix route "/dsh-maestro-review"
|
|
37
|
-
}
|
|
9
|
+
export function apply(): void {}
|
|
@@ -3,7 +3,7 @@ import type { Context } from '@deepseek-ai/cordis'
|
|
|
3
3
|
import z from '@deepseek-ai/schemastery'
|
|
4
4
|
import { loadUserConfig } from '../config-store.js'
|
|
5
5
|
import { secretsMatch } from '../secure-compare.js'
|
|
6
|
-
import type { MrOpenedPayload, ReviewRequest as OrchestratorReviewRequest } from '
|
|
6
|
+
import type { MrOpenedPayload, ReviewRequest as OrchestratorReviewRequest } from '@ddtcorex/maestro-reviewer/lib/events.js'
|
|
7
7
|
import { describeDrop, routeGitlabReviewRequest } from '../review-intake.js'
|
|
8
8
|
|
|
9
9
|
export const name = 'maestro-review-webhook'
|
package/src/host/settings-rpc.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type {} from '@deepseek-ai/dsh-client-connection'
|
|
|
3
3
|
import type { RpcErrorDetailsMap, RpcResult } from '@deepseek-ai/dsh-client-connection'
|
|
4
4
|
import { existsSync, statSync } from 'node:fs'
|
|
5
5
|
import { loadUserConfig, saveUserConfig, type MaestroUserConfig } from './config-store.js'
|
|
6
|
-
import { listReviews } from '
|
|
6
|
+
import { listReviews } from '@ddtcorex/maestro-reviewer/lib/review-history.js'
|
|
7
7
|
|
|
8
8
|
export const name = 'maestro-settings-rpc'
|
|
9
9
|
/**
|
package/lib/ci-clone.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Source checkout for CI deep reviews (spec §3): clone the source project at
|
|
3
|
-
* the MR head SHA with the PAT over oauth2. The token lives only in the clone
|
|
4
|
-
* URL passed to git — errors rethrown here are redacted, and the clone dir is
|
|
5
|
-
* ephemeral (fresh container per job; the orchestrator removes it in `finally`).
|
|
6
|
-
*/
|
|
7
|
-
export type RunFn = (cmd: string, args: string[], cwd?: string) => Promise<void>;
|
|
8
|
-
/** Production runner (execFile — no shell, argv cannot leak into shell history). */
|
|
9
|
-
export declare const defaultRun: RunFn;
|
|
10
|
-
export declare function redactCloneUrl(url: string): string;
|
|
11
|
-
export declare function cloneSourceRepo(opts: {
|
|
12
|
-
fetcher: typeof fetch;
|
|
13
|
-
run: RunFn;
|
|
14
|
-
host: string;
|
|
15
|
-
projectId: number;
|
|
16
|
-
sourceBranch: string;
|
|
17
|
-
headSha: string;
|
|
18
|
-
token: string;
|
|
19
|
-
dir: string;
|
|
20
|
-
}): Promise<string>;
|
|
21
|
-
//# sourceMappingURL=ci-clone.d.ts.map
|
package/lib/ci-clone.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ci-clone.d.ts","sourceRoot":"","sources":["../src/host/ci-clone.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,MAAM,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAIhF,oFAAoF;AACpF,eAAO,MAAM,UAAU,EAAE,KAExB,CAAA;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAUD,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,OAAO,EAAE,OAAO,KAAK,CAAA;IACrB,GAAG,EAAE,KAAK,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACZ,GAAG,OAAO,CAAC,MAAM,CAAC,CAYlB"}
|
package/lib/ci-clone.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { execFile } from 'node:child_process';
|
|
2
|
-
import { promisify } from 'node:util';
|
|
3
|
-
import { gitlabAuthHeaders } from './gitlab-auth.js';
|
|
4
|
-
const execFileAsync = promisify(execFile);
|
|
5
|
-
/** Production runner (execFile — no shell, argv cannot leak into shell history). */
|
|
6
|
-
export const defaultRun = async (cmd, args, cwd) => {
|
|
7
|
-
await execFileAsync(cmd, args, { cwd, timeout: 120_000 });
|
|
8
|
-
};
|
|
9
|
-
export function redactCloneUrl(url) {
|
|
10
|
-
return url.replace(/oauth2:[^@]+@/, 'oauth2:***@');
|
|
11
|
-
}
|
|
12
|
-
async function repoHttpUrl(fetcher, host, projectId, token) {
|
|
13
|
-
const res = await fetcher(`https://${host}/api/v4/projects/${projectId}`, { headers: gitlabAuthHeaders(token) });
|
|
14
|
-
if (!res.ok)
|
|
15
|
-
throw new Error(`GitLab API error ${res.status}: ${(await res.text()).slice(0, 200)}`);
|
|
16
|
-
const body = (await res.json());
|
|
17
|
-
if (!body.http_url_to_repo)
|
|
18
|
-
throw new Error('project has no http_url_to_repo');
|
|
19
|
-
return body.http_url_to_repo;
|
|
20
|
-
}
|
|
21
|
-
export async function cloneSourceRepo(opts) {
|
|
22
|
-
const httpUrl = await repoHttpUrl(opts.fetcher, opts.host, opts.projectId, opts.token);
|
|
23
|
-
const authed = httpUrl.replace('https://', `https://oauth2:${opts.token}@`);
|
|
24
|
-
try {
|
|
25
|
-
await opts.run('git', ['clone', '--depth', '50', '--branch', opts.sourceBranch, '--', authed, opts.dir]);
|
|
26
|
-
await opts.run('git', ['fetch', '--depth', '50', 'origin', opts.headSha], opts.dir);
|
|
27
|
-
await opts.run('git', ['checkout', '--detach', opts.headSha], opts.dir);
|
|
28
|
-
}
|
|
29
|
-
catch (err) {
|
|
30
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
31
|
-
throw new Error(redactCloneUrl(message));
|
|
32
|
-
}
|
|
33
|
-
return opts.dir;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=ci-clone.js.map
|
package/lib/ci-clone.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ci-clone.js","sourceRoot":"","sources":["../src/host/ci-clone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAWpD,MAAM,aA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AO,CAAC,OAAO,CAAC,UAAU,EAAE,kBAAkB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA;IAC3E,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;QACxG,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;QACnF,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;IACzE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAChE,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAA;IAC1C,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAA;AACjB,CAAC"}
|
package/lib/ci-coexist.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Coexistence checks (spec §4): the CI flow yields to a completed review of
|
|
3
|
-
* the same head SHA carrying a review marker (i.e. an earlier CI review —
|
|
4
|
-
* webhook reviews post marker-free and stay invisible here) and to an
|
|
5
|
-
* in-flight review (eyes running-marker). Fetch failures fail open toward
|
|
6
|
-
* running — a missing signal must never block a review, only a present one
|
|
7
|
-
* skips it.
|
|
8
|
-
*/
|
|
9
|
-
export declare function hasCompletedReviewForSha(fetcher: typeof fetch, baseUrl: string, token: string, projectId: number, mrIid: number, sha: string): Promise<boolean>;
|
|
10
|
-
export declare function hasRunningEyes(fetcher: typeof fetch, baseUrl: string, token: string, projectId: number, mrIid: number): Promise<boolean>;
|
|
11
|
-
//# sourceMappingURL=ci-coexist.d.ts.map
|
package/lib/ci-coexist.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ci-coexist.d.ts","sourceRoot":"","sources":["../src/host/ci-coexist.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GACnG,OAAO,CAAC,OAAO,CAAC,CAelB;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GACtF,OAAO,CAAC,OAAO,CAAC,CAYlB"}
|
package/lib/ci-coexist.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { gitlabAuthHeaders } from './gitlab-auth.js';
|
|
2
|
-
import { parseReviewMarker } from './review-marker.js';
|
|
3
|
-
/**
|
|
4
|
-
* Coexistence checks (spec §4): the CI flow yields to a completed review of
|
|
5
|
-
* the same head SHA carrying a review marker (i.e. an earlier CI review —
|
|
6
|
-
* webhook reviews post marker-free and stay invisible here) and to an
|
|
7
|
-
* in-flight review (eyes running-marker). Fetch failures fail open toward
|
|
8
|
-
* running — a missing signal must never block a review, only a present one
|
|
9
|
-
* skips it.
|
|
10
|
-
*/
|
|
11
|
-
export async function hasCompletedReviewForSha(fetcher, baseUrl, token, projectId, mrIid, sha) {
|
|
12
|
-
try {
|
|
13
|
-
const res = await fetcher(`${baseUrl}/api/v4/projects/${projectId}/merge_requests/${mrIid}/notes?per_page=100&sort=desc&order_by=created_at`, { headers: gitlabAuthHeaders(token) });
|
|
14
|
-
if (!res.ok)
|
|
15
|
-
return false;
|
|
16
|
-
const notes = (await res.json());
|
|
17
|
-
return notes.some((n) => {
|
|
18
|
-
const m = typeof n.body === 'string' ? parseReviewMarker(n.body) : undefined;
|
|
19
|
-
return m?.sha.toLowerCase() === sha.toLowerCase() && m?.status === 'completed';
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export async function hasRunningEyes(fetcher, baseUrl, token, projectId, mrIid) {
|
|
27
|
-
try {
|
|
28
|
-
const res = await fetcher(`${baseUrl}/api/v4/projects/${projectId}/merge_requests/${mrIid}/award_emoji`, { headers: gitlabAuthHeaders(token) });
|
|
29
|
-
if (!res.ok)
|
|
30
|
-
return false;
|
|
31
|
-
const awards = (await res.json());
|
|
32
|
-
return awards.some((a) => a.name === 'eyes');
|
|
33
|
-
}
|
|
34
|
-
catch {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=ci-coexist.js.map
|
package/lib/ci-coexist.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ci-coexist.js","sourceRoot":"","sources":["../src/host/ci-coexist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAEtD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,OAAqB,EAAE,OAAe,EAAE,KAAa,EAAE,SAAiB,EAAE,KAAa,EAAE,GAAW;IAEpG,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,OAAO,CACvB,GAAG,OAAO,oBAAoB,SA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CAAC;AACH,CAAC"}
|
package/lib/gitlab-auth.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centralized GitLab API auth header (spec: token-kind aware).
|
|
3
|
-
*
|
|
4
|
-
* Personal / project / group tokens authenticate with `PRIVATE-TOKEN`.
|
|
5
|
-
* A CI job token (`CI_JOB_TOKEN`, cross-project via the target's job-token
|
|
6
|
-
* allowlist) authenticates with `JOB-TOKEN` instead — `PRIVATE-TOKEN` 401s.
|
|
7
|
-
* The kind comes from `GITLAB_TOKEN_KIND=job` (set by docker/entrypoint.sh
|
|
8
|
-
* when it falls back to `CI_JOB_TOKEN`); anything else means PRIVATE-TOKEN.
|
|
9
|
-
*/
|
|
10
|
-
export declare function gitlabAuthHeaders(token: string): Record<string, string>;
|
|
11
|
-
//# sourceMappingURL=gitlab-auth.d.ts.map
|
package/lib/gitlab-auth.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gitlab-auth.d.ts","sourceRoot":"","sources":["../src/host/gitlab-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGvE"}
|
package/lib/gitlab-auth.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centralized GitLab API auth header (spec: token-kind aware).
|
|
3
|
-
*
|
|
4
|
-
* Personal / project / group tokens authenticate with `PRIVATE-TOKEN`.
|
|
5
|
-
* A CI job token (`CI_JOB_TOKEN`, cross-project via the target's job-token
|
|
6
|
-
* allowlist) authenticates with `JOB-TOKEN` instead — `PRIVATE-TOKEN` 401s.
|
|
7
|
-
* The kind comes from `GITLAB_TOKEN_KIND=job` (set by docker/entrypoint.sh
|
|
8
|
-
* when it falls back to `CI_JOB_TOKEN`); anything else means PRIVATE-TOKEN.
|
|
9
|
-
*/
|
|
10
|
-
export function gitlabAuthHeaders(token) {
|
|
11
|
-
if (process.env.GITLAB_TOKEN_KIND === 'job')
|
|
12
|
-
return { 'JOB-TOKEN': token };
|
|
13
|
-
return { 'PRIVATE-TOKEN': token };
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=gitlab-auth.js.map
|
package/lib/gitlab-auth.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gitlab-auth.js","sourceRoot":"","sources":["../src/host/gitlab-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,KAAK,KAAK;QAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAA;IAC1E,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,CAAA;AACnC,CAAC"}
|
package/lib/gitlab-client.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
-
import z from '@deepseek-ai/schemastery';
|
|
3
|
-
export declare const name = "maestro-gitlab-client";
|
|
4
|
-
export declare const inject: string[];
|
|
5
|
-
export interface Config {
|
|
6
|
-
baseUrl: string;
|
|
7
|
-
projectId: string | number;
|
|
8
|
-
mrIid: number;
|
|
9
|
-
token: string;
|
|
10
|
-
botUsername: string;
|
|
11
|
-
}
|
|
12
|
-
export declare const Config: z<Config>;
|
|
13
|
-
interface GitlabDiff {
|
|
14
|
-
old_path: string;
|
|
15
|
-
new_path: string;
|
|
16
|
-
diff: string;
|
|
17
|
-
}
|
|
18
|
-
export interface DiffFileEntry {
|
|
19
|
-
path: string;
|
|
20
|
-
bytes: number;
|
|
21
|
-
}
|
|
22
|
-
/** Per-file inventory of the MR diff — small enough to return inline. Pure. */
|
|
23
|
-
export declare function diffFileList(diffs: GitlabDiff[]): DiffFileEntry[];
|
|
24
|
-
/** Unified text for one file, or undefined when the path is not in the MR. Pure. */
|
|
25
|
-
export declare function selectFileDiff(diffs: GitlabDiff[], path: string): string | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* `fetch` with a hard ceiling: aborts the request after `ms` (default 15s)
|
|
28
|
-
* and throws `GitLab API timeout after <ms>ms` on abort. The timer is always
|
|
29
|
-
* cleared on settle. Pre-agent lookups degrade the throw to `undefined` at
|
|
30
|
-
* their own call site; post-agent callers let it reach `writeFailedReport`.
|
|
31
|
-
*/
|
|
32
|
-
export declare function fetchWithTimeout(url: string, init: RequestInit | undefined, ms?: number): Promise<Response>;
|
|
33
|
-
interface GitlabDiscussionNote {
|
|
34
|
-
body: string;
|
|
35
|
-
author: {
|
|
36
|
-
username: string;
|
|
37
|
-
};
|
|
38
|
-
position?: {
|
|
39
|
-
new_path: string;
|
|
40
|
-
new_line: number | null;
|
|
41
|
-
};
|
|
42
|
-
resolved: boolean;
|
|
43
|
-
}
|
|
44
|
-
interface GitlabDiscussion {
|
|
45
|
-
id: string;
|
|
46
|
-
notes: GitlabDiscussionNote[];
|
|
47
|
-
}
|
|
48
|
-
interface OwnThread {
|
|
49
|
-
discussionId: string;
|
|
50
|
-
path: string;
|
|
51
|
-
line: number | null;
|
|
52
|
-
lastCommentBody: string;
|
|
53
|
-
resolved: boolean;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Resolve the in-workspace spill path for the MR diff. The DSH runtime
|
|
57
|
-
* spills large tool outputs to /tmp/dsh-spill-*, which sits outside the
|
|
58
|
-
* agent's cwd — and Guard blocks the agent from reading it back
|
|
59
|
-
* ("path outside cwd", tickets g-dd0d1679/g-716cd436). Writing the diff
|
|
60
|
-
* inside the workspace root keeps it readable via maestro_read_file.
|
|
61
|
-
*/
|
|
62
|
-
export declare function resolveDiffSpillPath(workspaceRoot: string, mrIid: number): string;
|
|
63
|
-
export declare function writeDiffSpill(workspaceRoot: string, mrIid: number, text: string): {
|
|
64
|
-
path: string;
|
|
65
|
-
bytes: number;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Pick this bot's inline threads out of the MR discussions list, including
|
|
69
|
-
* resolved ones (flagged) so a same-SHA re-review can reply-update instead
|
|
70
|
-
* of posting duplicates. Pure for unit testing.
|
|
71
|
-
*/
|
|
72
|
-
export declare function selectOwnThreads(discussions: GitlabDiscussion[], botUsername: string): {
|
|
73
|
-
threads: OwnThread[];
|
|
74
|
-
totalDiscussions: number;
|
|
75
|
-
};
|
|
76
|
-
export declare function apply(ctx: Context, config: Config): void;
|
|
77
|
-
export {};
|
|
78
|
-
//# sourceMappingURL=gitlab-client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gitlab-client.d.ts","sourceRoot":"","sources":["../src/host/gitlab-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAMxC,eAAO,MAAM,IAAI,0BAA0B,CAAA;AAC3C,eAAO,MAAM,MAAM,UAAY,CAAA;AAE/B,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,MAAM,CAM3B,CAAA;AAEF,UAAU,UAAU;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,aAAa,EAAE,CAEjE;AAED,oFAAoF;AACpF,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,MAAM,CAAA;CAAE,CAWpD;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CA8LxD"}
|
package/lib/gitlab-client.js
DELETED
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import z from '@deepseek-ai/schemastery';
|
|
2
|
-
import { defineTool } from '@deepseek-ai/dsh-tools';
|
|
3
|
-
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
4
|
-
import { join, resolve } from 'node:path';
|
|
5
|
-
import { gitlabAuthHeaders } from './gitlab-auth.js';
|
|
6
|
-
export const name = 'maestro-gitlab-client';
|
|
7
|
-
export const inject = ['tools'];
|
|
8
|
-
export const Config = z.object({
|
|
9
|
-
baseUrl: z.string().required(),
|
|
10
|
-
projectId: z.union([z.string(), z.number()]).required(),
|
|
11
|
-
mrIid: z.number().required(),
|
|
12
|
-
token: z.string().role('secret').required(),
|
|
13
|
-
botUsername: z.string().required(),
|
|
14
|
-
});
|
|
15
|
-
/** Per-file inventory of the MR diff — small enough to return inline. Pure. */
|
|
16
|
-
export function diffFileList(diffs) {
|
|
17
|
-
return diffs.map((d) => ({ path: d.new_path, bytes: Buffer.byteLength(d.diff, 'utf8') }));
|
|
18
|
-
}
|
|
19
|
-
/** Unified text for one file, or undefined when the path is not in the MR. Pure. */
|
|
20
|
-
export function selectFileDiff(diffs, path) {
|
|
21
|
-
const d = diffs.find((x) => x.new_path === path || x.old_path === path);
|
|
22
|
-
if (d === undefined)
|
|
23
|
-
return undefined;
|
|
24
|
-
return `--- ${d.old_path}\n+++ ${d.new_path}\n${d.diff}`;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* `fetch` with a hard ceiling: aborts the request after `ms` (default 15s)
|
|
28
|
-
* and throws `GitLab API timeout after <ms>ms` on abort. The timer is always
|
|
29
|
-
* cleared on settle. Pre-agent lookups degrade the throw to `undefined` at
|
|
30
|
-
* their own call site; post-agent callers let it reach `writeFailedReport`.
|
|
31
|
-
*/
|
|
32
|
-
export async function fetchWithTimeout(url, init, ms = 15_000) {
|
|
33
|
-
const controller = new AbortController();
|
|
34
|
-
const timer = setTimeout(() => controller.abort(), ms);
|
|
35
|
-
try {
|
|
36
|
-
return await fetch(url, { ...init, signal: controller.signal });
|
|
37
|
-
}
|
|
38
|
-
catch (err) {
|
|
39
|
-
if (err?.name === 'AbortError')
|
|
40
|
-
throw new Error(`GitLab API timeout after ${ms}ms`);
|
|
41
|
-
throw err;
|
|
42
|
-
}
|
|
43
|
-
finally {
|
|
44
|
-
clearTimeout(timer);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Resolve the in-workspace spill path for the MR diff. The DSH runtime
|
|
49
|
-
* spills large tool outputs to /tmp/dsh-spill-*, which sits outside the
|
|
50
|
-
* agent's cwd — and Guard blocks the agent from reading it back
|
|
51
|
-
* ("path outside cwd", tickets g-dd0d1679/g-716cd436). Writing the diff
|
|
52
|
-
* inside the workspace root keeps it readable via maestro_read_file.
|
|
53
|
-
*/
|
|
54
|
-
export function resolveDiffSpillPath(workspaceRoot, mrIid) {
|
|
55
|
-
return join(resolve(workspaceRoot), '.maestro', `mr-${mrIid}.diff`);
|
|
56
|
-
}
|
|
57
|
-
export function writeDiffSpill(workspaceRoot, mrIid, text) {
|
|
58
|
-
const abs = resolveDiffSpillPath(workspaceRoot, mrIid);
|
|
59
|
-
mkdirSync(join(resolve(workspaceRoot), '.maestro'), { recursive: true });
|
|
60
|
-
writeFileSync(abs, text, 'utf-8');
|
|
61
|
-
return { path: join('.maestro', `mr-${mrIid}.diff`), bytes: Buffer.byteLength(text, 'utf8') };
|
|
62
|
-
}
|
|
63
|
-
function sessionCwd(e) {
|
|
64
|
-
const cwd = e?.agent?.session?.header?.cwd;
|
|
65
|
-
return typeof cwd === 'string' && cwd !== '' ? cwd : undefined;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Pick this bot's inline threads out of the MR discussions list, including
|
|
69
|
-
* resolved ones (flagged) so a same-SHA re-review can reply-update instead
|
|
70
|
-
* of posting duplicates. Pure for unit testing.
|
|
71
|
-
*/
|
|
72
|
-
export function selectOwnThreads(discussions, botUsername) {
|
|
73
|
-
const threads = discussions
|
|
74
|
-
.filter(d => d.notes.length > 0 && d.notes[0].author.username === botUsername && d.notes[0].position !== undefined)
|
|
75
|
-
.map(d => ({
|
|
76
|
-
discussionId: d.id,
|
|
77
|
-
path: d.notes[0].position.new_path,
|
|
78
|
-
line: d.notes[0].position.new_line,
|
|
79
|
-
lastCommentBody: d.notes[d.notes.length - 1].body,
|
|
80
|
-
resolved: d.notes[0].resolved === true,
|
|
81
|
-
}));
|
|
82
|
-
return { threads, totalDiscussions: discussions.length };
|
|
83
|
-
}
|
|
84
|
-
export function apply(ctx, config) {
|
|
85
|
-
const apiBase = `${config.baseUrl}/api/v4/projects/${config.projectId}/merge_requests/${config.mrIid}`;
|
|
86
|
-
const headers = gitlabAuthHeaders(config.token);
|
|
87
|
-
let cachedDiffRefs;
|
|
88
|
-
let cachedDiffs;
|
|
89
|
-
async function getDiffs() {
|
|
90
|
-
if (cachedDiffs !== undefined)
|
|
91
|
-
return cachedDiffs;
|
|
92
|
-
const response = await fetch(`${apiBase}/diffs`, { headers });
|
|
93
|
-
if (!response.ok) {
|
|
94
|
-
throw new Error(`GitLab API error ${response.status}: ${await response.text()}`);
|
|
95
|
-
}
|
|
96
|
-
cachedDiffs = (await response.json());
|
|
97
|
-
return cachedDiffs;
|
|
98
|
-
}
|
|
99
|
-
async function getDiffRefs() {
|
|
100
|
-
if (cachedDiffRefs !== undefined)
|
|
101
|
-
return cachedDiffRefs;
|
|
102
|
-
const response = await fetch(apiBase, { headers });
|
|
103
|
-
if (!response.ok) {
|
|
104
|
-
throw new Error(`GitLab API error ${response.status}: ${await response.text()}`);
|
|
105
|
-
}
|
|
106
|
-
cachedDiffRefs = (await response.json()).diff_refs;
|
|
107
|
-
return cachedDiffRefs;
|
|
108
|
-
}
|
|
109
|
-
ctx.tools.register(defineTool({
|
|
110
|
-
name: 'gitlab_get_mr_diff',
|
|
111
|
-
description: 'Fetch the current unified diff for this merge request. The full diff is written to path (inside your workspace, readable via maestro_read_file); bytes is its size and files lists per-file sizes. Prefer gitlab_get_file_diff per file you inspect — small inline results never spill. Do not look for anything under /tmp.',
|
|
112
|
-
parameters: {},
|
|
113
|
-
output: {
|
|
114
|
-
schema: { type: 'object', additionalProperties: false, properties: { path: { type: 'string', required: true }, bytes: { type: 'number', required: true }, files: { type: 'array', items: { type: 'object', additionalProperties: false, properties: { path: { type: 'string', required: true }, bytes: { type: 'number', required: true } } } } } },
|
|
115
|
-
render: (_args, value) => [{ type: 'text', text: `diff written to ${value.path} (${value.bytes} bytes, ${value.files.length} files)` }],
|
|
116
|
-
},
|
|
117
|
-
async execute(_args, exec) {
|
|
118
|
-
const diffs = await getDiffs();
|
|
119
|
-
const text = diffs.map(d => `--- ${d.old_path}\n+++ ${d.new_path}\n${d.diff}`).join('\n\n');
|
|
120
|
-
const cwd = sessionCwd(exec);
|
|
121
|
-
// No session cwd (should not happen for review agents): fall back to
|
|
122
|
-
// the legacy inline text, which the runtime may spill to /tmp.
|
|
123
|
-
if (cwd === undefined)
|
|
124
|
-
return { path: '', bytes: Buffer.byteLength(text, 'utf8'), files: diffFileList(diffs) };
|
|
125
|
-
const spilled = writeDiffSpill(cwd, config.mrIid, text);
|
|
126
|
-
return { ...spilled, files: diffFileList(diffs) };
|
|
127
|
-
},
|
|
128
|
-
}));
|
|
129
|
-
ctx.tools.register(defineTool({
|
|
130
|
-
name: 'gitlab_get_file_diff',
|
|
131
|
-
description: "Return one file's unified diff inline (small results never spill to /tmp). Use after gitlab_get_mr_diff to inspect files one by one.",
|
|
132
|
-
parameters: {
|
|
133
|
-
path: { type: 'string', required: true, description: 'New path of the file, as listed in files.' },
|
|
134
|
-
},
|
|
135
|
-
output: {
|
|
136
|
-
schema: { type: 'object', additionalProperties: false, properties: { path: { type: 'string', required: true }, text: { type: 'string', required: true } } },
|
|
137
|
-
render: (_args, value) => [{ type: 'text', text: value.text }],
|
|
138
|
-
},
|
|
139
|
-
async execute(args) {
|
|
140
|
-
const diffs = await getDiffs();
|
|
141
|
-
const text = selectFileDiff(diffs, args.path);
|
|
142
|
-
if (text === undefined) {
|
|
143
|
-
throw new Error(`path not in this MR diff: ${args.path}`);
|
|
144
|
-
}
|
|
145
|
-
return { path: args.path, text };
|
|
146
|
-
},
|
|
147
|
-
}));
|
|
148
|
-
ctx.tools.register(defineTool({
|
|
149
|
-
name: 'gitlab_post_mr_comment',
|
|
150
|
-
description: 'Post a Markdown comment (discussion note) on this merge request.',
|
|
151
|
-
parameters: {
|
|
152
|
-
body: { type: 'string', required: true, description: 'Markdown comment body.' },
|
|
153
|
-
},
|
|
154
|
-
output: {
|
|
155
|
-
schema: { type: 'object', additionalProperties: false, properties: { posted: { type: 'boolean', required: true } } },
|
|
156
|
-
render: () => [{ type: 'text', text: 'Comment posted.' }],
|
|
157
|
-
},
|
|
158
|
-
async execute(args) {
|
|
159
|
-
const response = await fetch(`${apiBase}/notes`, {
|
|
160
|
-
method: 'POST',
|
|
161
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
162
|
-
body: JSON.stringify({ body: args.body }),
|
|
163
|
-
});
|
|
164
|
-
if (!response.ok) {
|
|
165
|
-
throw new Error(`GitLab API error ${response.status}: ${await response.text()}`);
|
|
166
|
-
}
|
|
167
|
-
return { posted: true };
|
|
168
|
-
},
|
|
169
|
-
}));
|
|
170
|
-
ctx.tools.register(defineTool({
|
|
171
|
-
name: 'gitlab_list_own_review_threads',
|
|
172
|
-
description: 'List this merge request\'s inline discussion threads previously created by this bot account (both unresolved and resolved, flagged), so you can reply instead of duplicating. Returns {threads, totalDiscussions}.',
|
|
173
|
-
parameters: {},
|
|
174
|
-
output: {
|
|
175
|
-
schema: {
|
|
176
|
-
type: 'object',
|
|
177
|
-
additionalProperties: false,
|
|
178
|
-
properties: {
|
|
179
|
-
threads: {
|
|
180
|
-
type: 'array',
|
|
181
|
-
items: {
|
|
182
|
-
type: 'object',
|
|
183
|
-
additionalProperties: false,
|
|
184
|
-
properties: {
|
|
185
|
-
discussionId: { type: 'string', required: true },
|
|
186
|
-
path: { type: 'string', required: true },
|
|
187
|
-
line: { type: 'number' },
|
|
188
|
-
lastCommentBody: { type: 'string', required: true },
|
|
189
|
-
resolved: { type: 'boolean', required: true },
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
totalDiscussions: { type: 'number', required: true },
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
render: (_args, value) => [{
|
|
197
|
-
type: 'text',
|
|
198
|
-
text: `${value.totalDiscussions} discussion(s) on this MR, ${value.threads.length} own inline thread(s):\n${JSON.stringify(value.threads)}`,
|
|
199
|
-
}],
|
|
200
|
-
},
|
|
201
|
-
async execute() {
|
|
202
|
-
const response = await fetch(`${apiBase}/discussions`, { headers });
|
|
203
|
-
if (!response.ok) {
|
|
204
|
-
throw new Error(`GitLab API error ${response.status}: ${await response.text()}`);
|
|
205
|
-
}
|
|
206
|
-
const discussions = await response.json();
|
|
207
|
-
return selectOwnThreads(discussions, config.botUsername);
|
|
208
|
-
},
|
|
209
|
-
}));
|
|
210
|
-
ctx.tools.register(defineTool({
|
|
211
|
-
name: 'gitlab_post_inline_comment',
|
|
212
|
-
description: 'Create a new inline discussion at a specific file and line in this merge request\'s current diff.',
|
|
213
|
-
parameters: {
|
|
214
|
-
path: { type: 'string', required: true, description: 'File path on the new (target) side of the diff.' },
|
|
215
|
-
line: { type: 'number', required: true, description: 'Line number on the new (target) side of the diff.' },
|
|
216
|
-
body: { type: 'string', required: true, description: 'Markdown comment body.' },
|
|
217
|
-
},
|
|
218
|
-
output: {
|
|
219
|
-
schema: { type: 'object', additionalProperties: false, properties: { posted: { type: 'boolean', required: true } } },
|
|
220
|
-
render: () => [{ type: 'text', text: 'Inline comment posted.' }],
|
|
221
|
-
},
|
|
222
|
-
async execute(args) {
|
|
223
|
-
const diffRefs = await getDiffRefs();
|
|
224
|
-
const response = await fetch(`${apiBase}/discussions`, {
|
|
225
|
-
method: 'POST',
|
|
226
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
227
|
-
body: JSON.stringify({
|
|
228
|
-
body: args.body,
|
|
229
|
-
position: {
|
|
230
|
-
position_type: 'text',
|
|
231
|
-
base_sha: diffRefs.base_sha,
|
|
232
|
-
start_sha: diffRefs.start_sha,
|
|
233
|
-
head_sha: diffRefs.head_sha,
|
|
234
|
-
old_path: args.path,
|
|
235
|
-
new_path: args.path,
|
|
236
|
-
new_line: args.line,
|
|
237
|
-
},
|
|
238
|
-
}),
|
|
239
|
-
});
|
|
240
|
-
if (!response.ok) {
|
|
241
|
-
throw new Error(`GitLab API error ${response.status}: ${await response.text()}`);
|
|
242
|
-
}
|
|
243
|
-
return { posted: true };
|
|
244
|
-
},
|
|
245
|
-
}));
|
|
246
|
-
ctx.tools.register(defineTool({
|
|
247
|
-
name: 'gitlab_reply_to_thread',
|
|
248
|
-
description: 'Reply to an existing inline discussion thread (discussionId from gitlab_list_own_review_threads) without resolving it.',
|
|
249
|
-
parameters: {
|
|
250
|
-
discussionId: { type: 'string', required: true },
|
|
251
|
-
body: { type: 'string', required: true, description: 'Markdown reply body.' },
|
|
252
|
-
},
|
|
253
|
-
output: {
|
|
254
|
-
schema: { type: 'object', additionalProperties: false, properties: { posted: { type: 'boolean', required: true } } },
|
|
255
|
-
render: () => [{ type: 'text', text: 'Reply posted.' }],
|
|
256
|
-
},
|
|
257
|
-
async execute(args) {
|
|
258
|
-
const response = await fetch(`${apiBase}/discussions/${args.discussionId}/notes`, {
|
|
259
|
-
method: 'POST',
|
|
260
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
261
|
-
body: JSON.stringify({ body: args.body }),
|
|
262
|
-
});
|
|
263
|
-
if (!response.ok) {
|
|
264
|
-
throw new Error(`GitLab API error ${response.status}: ${await response.text()}`);
|
|
265
|
-
}
|
|
266
|
-
return { posted: true };
|
|
267
|
-
},
|
|
268
|
-
}));
|
|
269
|
-
}
|
|
270
|
-
//# sourceMappingURL=gitlab-client.js.map
|
package/lib/gitlab-client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gitlab-client.js","sourceRoot":"","sources":["../src/host/gitlab-client.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,0BAA0B,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEpD,MAAM,CAAC,MAAM,IAAI,GAAG,uBAAuB,CAAA;AAC3C,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,CAAA;AAU/B,MAAM,CAAC,MAAM,MAAM,GAAc,CAAC,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE;IACvD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE;IAC3C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAA;AAaF,+EAA+E;AAC/E,MAAM,UAAU,YAAY,CAAC,KAAmB;IAC9C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAA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,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;QACzB,CAAC;KACF,CAAC,CAAC,CAAA;AACL,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Whether a binary named `govard` is executable on the host PATH. The lint and
|
|
3
|
-
* environment commands the review prompts demand run through the shell tool, so
|
|
4
|
-
* a host without the binary must not be told to run them.
|
|
5
|
-
*/
|
|
6
|
-
export declare function govardOnPath(env?: NodeJS.ProcessEnv): boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Whether the reviewer prompt may demand the govard CLI lint run: the shell
|
|
9
|
-
* tool (`bash`, from `@deepseek-ai/dsh-tool-bash`) must resolve for the agent
|
|
10
|
-
* scope AND the `govard` binary must be on PATH.
|
|
11
|
-
*
|
|
12
|
-
* The tool answer comes from the harness registry, read as
|
|
13
|
-
* `tools.get(name, scope)`. A registry that cannot be read is NOT evidence that
|
|
14
|
-
* the tool exists, so every failure path answers false and none of them
|
|
15
|
-
* throws: a lint signal that is merely absent must never fail a review.
|
|
16
|
-
*/
|
|
17
|
-
export declare function detectGovardLint(ctx: {
|
|
18
|
-
get?: (name: string) => unknown;
|
|
19
|
-
}, scope: unknown, env?: NodeJS.ProcessEnv): boolean;
|
|
20
|
-
//# sourceMappingURL=govard-lint-detection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"govard-lint-detection.d.ts","sourceRoot":"","sources":["../src/host/govard-lint-detection.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAa1E;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE;IAAE,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;CAAE,EACxC,KAAK,EAAE,OAAO,EACd,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAST"}
|