@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/skills-tool.ts
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import type { Context } from '@deepseek-ai/cordis'
|
|
2
|
-
import { defineTool } from '@deepseek-ai/dsh-tools'
|
|
3
|
-
import type {} from '@deepseek-ai/dsh-agent'
|
|
4
|
-
|
|
5
|
-
export const name = 'maestro-skills-tool'
|
|
6
|
-
export const inject = ['skills', 'tools']
|
|
7
|
-
|
|
8
|
-
export type ReviewSkillProfile = 'magento2' | 'laravel' | 'symfony' | 'wordpress' | 'generic'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Exact skill names rather than a fuzzy search: a review must not silently
|
|
12
|
-
* omit a security or quality pass just because a similarly named skill exists.
|
|
13
|
-
*/
|
|
14
|
-
export const REVIEW_PROFILE_SKILLS: Record<ReviewSkillProfile, readonly string[]> = {
|
|
15
|
-
magento2: [
|
|
16
|
-
'govard-toolbox',
|
|
17
|
-
'govard-magento',
|
|
18
|
-
'magento2-dev-core',
|
|
19
|
-
// Frontend passes: without these a Hyvä/Tailwind MR is reviewed on model
|
|
20
|
-
// priors alone (utility-class claims were unverifiable and wrong in practice).
|
|
21
|
-
'magento2-frontend-dev',
|
|
22
|
-
'magento2-hyva-dev',
|
|
23
|
-
'magento2-code-review',
|
|
24
|
-
'magento2-linter',
|
|
25
|
-
'magento2-security-scan',
|
|
26
|
-
'magento2-performance-audit',
|
|
27
|
-
],
|
|
28
|
-
laravel: [
|
|
29
|
-
'govard-toolbox',
|
|
30
|
-
'govard-laravel',
|
|
31
|
-
'php-dev-core',
|
|
32
|
-
],
|
|
33
|
-
symfony: [
|
|
34
|
-
'govard-toolbox',
|
|
35
|
-
'govard-symfony',
|
|
36
|
-
'php-dev-core',
|
|
37
|
-
],
|
|
38
|
-
wordpress: [
|
|
39
|
-
'govard-toolbox',
|
|
40
|
-
'govard-wordpress',
|
|
41
|
-
'php-dev-core',
|
|
42
|
-
],
|
|
43
|
-
/** Diff review against general best practices; no project skill set required. */
|
|
44
|
-
generic: [],
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export const MAESTRO_SKILLS_INSTALL_COMMAND = 'curl -fsSL https://raw.githubusercontent.com/ddtcorex/maestro-skills/master/install.sh | bash -s -- --scope personal --target dsh --skills govard-toolbox,govard-magento,govard-laravel,govard-symfony,govard-wordpress,php-dev-core,magento2-dev-core,magento2-frontend-dev,magento2-hyva-dev,magento2-code-review,magento2-linter,magento2-security-scan,magento2-performance-audit -y'
|
|
48
|
-
|
|
49
|
-
// Keyed by the reviewer's Agent object itself, not a Cordis context: `ctx.agent`
|
|
50
|
-
// is not an actual injectable Cordis service anywhere in this composition (it
|
|
51
|
-
// throws "cannot get property agent without inject" whenever read, silently
|
|
52
|
-
// making every post-turn profile check report "not loaded" even after the
|
|
53
|
-
// tool above successfully set it — root-caused 2026-09-14 against a real
|
|
54
|
-
// failed review, reproduced deterministically against real
|
|
55
|
-
// @deepseek-ai/cordis). The tool's own `exec.agent` (a plain, non-Cordis
|
|
56
|
-
// property `ToolExecutionInput` always carries, "set by the agent loop") is
|
|
57
|
-
// the reliable handle — callers pass `handle.agent` from the same
|
|
58
|
-
// `AgentHandle` the orchestrator already holds, which is the identical object.
|
|
59
|
-
const loadedReviewProfiles = new WeakMap<object, ReviewSkillProfile>()
|
|
60
|
-
|
|
61
|
-
export function loadedReviewProfile(agent: object | undefined): ReviewSkillProfile | undefined {
|
|
62
|
-
return agent === undefined ? undefined : loadedReviewProfiles.get(agent)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Mirrors @deepseek-ai/dsh-skill's consumer-facing `SkillRegistry` (verified
|
|
66
|
-
// against ../../deepseek-harness/packages/skill/skill/lib/types/index.d.ts):
|
|
67
|
-
// `list()` returns bare `SkillSummary`-shaped entries (no `locator`/`rank` —
|
|
68
|
-
// those belong only to the `SkillProvider` interface a provider implements
|
|
69
|
-
// inside `registerProvider()`), and `get()` takes a plain name string, not a
|
|
70
|
-
// candidate object.
|
|
71
|
-
interface SkillSummaryLike {
|
|
72
|
-
name: string
|
|
73
|
-
description: string
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
interface SkillDefinitionLike {
|
|
77
|
-
name: string
|
|
78
|
-
description: string
|
|
79
|
-
content: string
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
interface SkillsServiceLike {
|
|
83
|
-
list(): Promise<SkillSummaryLike[]>
|
|
84
|
-
get(name: string): Promise<SkillDefinitionLike | undefined>
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/** Single owned access path to the skills service (declared via `inject`). */
|
|
88
|
-
export function skillsService(ctx: Context): SkillsServiceLike {
|
|
89
|
-
return (ctx as unknown as { skills: SkillsServiceLike }).skills
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export function apply(ctx: Context): void {
|
|
93
|
-
ctx.tools.register(defineTool({
|
|
94
|
-
name: 'maestro_get_skills',
|
|
95
|
-
description: 'Search the DSH skill knowledge base by keyword (matches skill name or description) and return the full content of every matching skill.',
|
|
96
|
-
parameters: {
|
|
97
|
-
query: { type: 'string', required: true, description: 'Keyword to match against skill name/description, e.g. "magento2" or "govard-laravel".' },
|
|
98
|
-
},
|
|
99
|
-
output: {
|
|
100
|
-
// The resolved skill content is part of the validated schema (matching
|
|
101
|
-
// dsh-tools' own `job_output` pattern of declaring every render-needed
|
|
102
|
-
// field on `output.schema`) rather than smuggled past validation on a
|
|
103
|
-
// key excluded from `properties`: `render(args, value)` has no third
|
|
104
|
-
// `extra` argument (verified against
|
|
105
|
-
// node_modules/@deepseek-ai/dsh-tools/lib/types/schema.d.ts), and an
|
|
106
|
-
// `additionalProperties: false` object schema REJECTS undeclared keys
|
|
107
|
-
// outright rather than merely leaving them unvalidated, so a hidden
|
|
108
|
-
// field would fail every call at the registry's output-validation step.
|
|
109
|
-
schema: {
|
|
110
|
-
type: 'object',
|
|
111
|
-
additionalProperties: false,
|
|
112
|
-
properties: {
|
|
113
|
-
matches: { type: 'number', required: true },
|
|
114
|
-
skills: {
|
|
115
|
-
type: 'array',
|
|
116
|
-
required: true,
|
|
117
|
-
items: {
|
|
118
|
-
type: 'object',
|
|
119
|
-
additionalProperties: false,
|
|
120
|
-
properties: {
|
|
121
|
-
name: { type: 'string', required: true },
|
|
122
|
-
content: { type: 'string', required: true },
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
render: (_args, value) => {
|
|
129
|
-
if (value.skills.length === 0) {
|
|
130
|
-
return [{ type: 'text', text: 'No skills matched that query.' }]
|
|
131
|
-
}
|
|
132
|
-
const text = value.skills
|
|
133
|
-
.map(s => `## ${s.name}\n\n${s.content}`)
|
|
134
|
-
.join('\n\n---\n\n')
|
|
135
|
-
return [{ type: 'text', text }]
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
async execute(args) {
|
|
139
|
-
const skills = skillsService(ctx)
|
|
140
|
-
const summaries = await skills.list()
|
|
141
|
-
const query = args.query.toLowerCase()
|
|
142
|
-
const matched = summaries.filter(s =>
|
|
143
|
-
s.name.toLowerCase().includes(query) || s.description.toLowerCase().includes(query))
|
|
144
|
-
if (matched.length === 0) {
|
|
145
|
-
throw new Error(`No skill matched query "${args.query}".`)
|
|
146
|
-
}
|
|
147
|
-
const resolved: SkillDefinitionLike[] = []
|
|
148
|
-
for (const summary of matched) {
|
|
149
|
-
const def = await skills.get(summary.name)
|
|
150
|
-
if (def !== undefined) resolved.push(def)
|
|
151
|
-
}
|
|
152
|
-
return {
|
|
153
|
-
matches: resolved.length,
|
|
154
|
-
skills: resolved.map(s => ({ name: s.name, content: s.content })),
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
}))
|
|
158
|
-
|
|
159
|
-
ctx.tools.register(defineTool({
|
|
160
|
-
name: 'maestro_load_review_profile',
|
|
161
|
-
description: 'Load the complete, exact skill set required for a configured review profile. Fails if any required skill is unavailable.',
|
|
162
|
-
parameters: {
|
|
163
|
-
profile: { type: 'string', required: true, description: 'Review profile configured for the project. Supported: "magento2" (full Magento skill set), "laravel" (Govard Laravel + PHP), "symfony" (Govard Symfony + PHP), "wordpress" (Govard WordPress + PHP), "generic" (no skills required).' },
|
|
164
|
-
},
|
|
165
|
-
output: {
|
|
166
|
-
schema: {
|
|
167
|
-
type: 'object',
|
|
168
|
-
additionalProperties: false,
|
|
169
|
-
properties: {
|
|
170
|
-
profile: { type: 'string', required: true },
|
|
171
|
-
skills: {
|
|
172
|
-
type: 'array',
|
|
173
|
-
required: true,
|
|
174
|
-
items: {
|
|
175
|
-
type: 'object',
|
|
176
|
-
additionalProperties: false,
|
|
177
|
-
properties: {
|
|
178
|
-
name: { type: 'string', required: true },
|
|
179
|
-
content: { type: 'string', required: true },
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
render: (_args, value) => [{
|
|
186
|
-
type: 'text',
|
|
187
|
-
text: value.skills.length === 0
|
|
188
|
-
? `Review profile "${value.profile}" loaded. No project-specific skills are required; review the diff against general correctness, security, and performance best practices.`
|
|
189
|
-
: value.skills.map(s => `## ${s.name}\n\n${s.content}`).join('\n\n---\n\n'),
|
|
190
|
-
}],
|
|
191
|
-
},
|
|
192
|
-
async execute(args, exec) {
|
|
193
|
-
const required = REVIEW_PROFILE_SKILLS[args.profile as ReviewSkillProfile]
|
|
194
|
-
if (required === undefined) {
|
|
195
|
-
throw new Error(`Unsupported review skill profile "${args.profile}". Supported profiles: ${Object.keys(REVIEW_PROFILE_SKILLS).map(name => `"${name}"`).join(', ')}.`)
|
|
196
|
-
}
|
|
197
|
-
if (exec.agent === undefined) {
|
|
198
|
-
throw new Error('Review profile loader is not running inside an agent context.')
|
|
199
|
-
}
|
|
200
|
-
const skills = skillsService(ctx)
|
|
201
|
-
const available = new Set((await skills.list()).map(skill => skill.name))
|
|
202
|
-
const missing = required.filter(skill => !available.has(skill))
|
|
203
|
-
if (missing.length > 0) {
|
|
204
|
-
throw new Error(`Missing required review skill(s) for profile "${args.profile}": ${missing.join(', ')}. Install maestro-skills for DSH with: ${MAESTRO_SKILLS_INSTALL_COMMAND}`)
|
|
205
|
-
}
|
|
206
|
-
const resolved = await Promise.all(required.map(skill => skills.get(skill)))
|
|
207
|
-
const unavailable = required.filter((_, index) => resolved[index] === undefined)
|
|
208
|
-
if (unavailable.length > 0) {
|
|
209
|
-
throw new Error(`Required review skill(s) could not be loaded: ${unavailable.join(', ')}. Reinstall maestro-skills for DSH with: ${MAESTRO_SKILLS_INSTALL_COMMAND}`)
|
|
210
|
-
}
|
|
211
|
-
loadedReviewProfiles.set(exec.agent, args.profile as ReviewSkillProfile)
|
|
212
|
-
return {
|
|
213
|
-
profile: args.profile,
|
|
214
|
-
skills: resolved.map(skill => ({ name: skill!.name, content: skill!.content })),
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
}))
|
|
218
|
-
}
|
package/src/host/source.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The producer-owned source kind this plugin stamps on every message it injects
|
|
3
|
-
* into a review session.
|
|
4
|
-
*
|
|
5
|
-
* Session format v4 requires the producer to name itself (`plugin:<package>`)
|
|
6
|
-
* and rejects the retired bare `kind: 'plugin'`. `kind: 'user'` is admissible
|
|
7
|
-
* but false: these prompts are machine-initiated, and consumers classify a turn
|
|
8
|
-
* by this kind — dsh-maestro-memory's write guard documents that
|
|
9
|
-
* plugin-initiated turns carry no per-turn write duty.
|
|
10
|
-
*
|
|
11
|
-
* The reviewer and auditor sessions keep their own explicit
|
|
12
|
-
* `sessionTitle.rename(...)`: the harness only auto-titles a `kind: 'user'`
|
|
13
|
-
* message, so a plugin-attributed prompt feeds no title.
|
|
14
|
-
*/
|
|
15
|
-
export const REVIEW_SOURCE_KIND = 'plugin:@ddtcorex/dsh-maestro-review'
|
|
16
|
-
|
|
17
|
-
// `MessageSourceMap` is the harness's merge-extensible sum type: each producer
|
|
18
|
-
// declares its own kind in its own module (see `goal-round-driver` and
|
|
19
|
-
// `schedule`), and there is deliberately no shared catch-all kind to reuse.
|
|
20
|
-
import type {} from '@deepseek-ai/dsh-llm'
|
|
21
|
-
|
|
22
|
-
declare module '@deepseek-ai/dsh-llm' {
|
|
23
|
-
interface MessageSourceMap {
|
|
24
|
-
'plugin:@ddtcorex/dsh-maestro-review': { readonly kind: 'plugin:@ddtcorex/dsh-maestro-review' }
|
|
25
|
-
}
|
|
26
|
-
}
|
package/src/host/tool-policy.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { Context } from '@deepseek-ai/cordis'
|
|
2
|
-
import type { PreToolDecision, ToolExecution } from '@deepseek-ai/dsh-tools'
|
|
3
|
-
|
|
4
|
-
export const name = 'maestro-review-tool-policy'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Host-level tools that leak into every agent but make no sense for a review
|
|
8
|
-
* agent: review sessions must stay read-only on the worktree and side-effect
|
|
9
|
-
* free on the harness (no personal memory writes, no todo lists, no plugin
|
|
10
|
-
* marketplace suggestions, no sidebar UI, no nested subagents).
|
|
11
|
-
*
|
|
12
|
-
* Deny-listed rather than allow-listed on purpose: DSH has no per-agent tool
|
|
13
|
-
* scoping yet, and a reviewer genuinely needs the shared search/read/gitlab
|
|
14
|
-
* surface — an allow-list would break on every new host capability.
|
|
15
|
-
*/
|
|
16
|
-
export const REVIEW_DENIED_TOOLS: readonly string[] = [
|
|
17
|
-
'memory',
|
|
18
|
-
'memory_suggest',
|
|
19
|
-
'dtodo',
|
|
20
|
-
'find_dsh_plugin',
|
|
21
|
-
'sidebar_open',
|
|
22
|
-
'subagent_claude_code',
|
|
23
|
-
'subagent_codex',
|
|
24
|
-
'maestro_write_file',
|
|
25
|
-
]
|
|
26
|
-
|
|
27
|
-
/** Pure predicate: returns the denial reason for denied tools, else undefined. */
|
|
28
|
-
export function deniedToolForReview(toolName: string): string | undefined {
|
|
29
|
-
if (!REVIEW_DENIED_TOOLS.includes(toolName)) return undefined
|
|
30
|
-
return `Tool "${toolName}" is not available to Maestro review agents: reviews stay read-only on the worktree and side-effect free on the harness.`
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function createReviewToolPolicyHandler(): (
|
|
34
|
-
exec: ToolExecution,
|
|
35
|
-
next: () => Promise<PreToolDecision>,
|
|
36
|
-
) => Promise<PreToolDecision> {
|
|
37
|
-
return async (exec, next) => {
|
|
38
|
-
const toolName = exec.name ?? ''
|
|
39
|
-
const reason = deniedToolForReview(toolName)
|
|
40
|
-
if (reason !== undefined) return { kind: 'deny', reason }
|
|
41
|
-
return next()
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** Agent-scoped: register inside an agent setup fiber so the policy dies with that agent. */
|
|
46
|
-
export function apply(ctx: Context): void {
|
|
47
|
-
const handler = createReviewToolPolicyHandler()
|
|
48
|
-
ctx.effect(() => ctx.on('tools/pre-execute', handler))
|
|
49
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
# ddtcorex/maestro-reviewer — dedicated reviewer project
|
|
2
|
-
stages: [review]
|
|
3
|
-
|
|
4
|
-
variables:
|
|
5
|
-
# Image registry — pin the SHA for reproducibility
|
|
6
|
-
REVIEWER_IMAGE: "ddtcorex/maestro-reviewer:0.10.0"
|
|
7
|
-
# Or use $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA when building the image in the same project
|
|
8
|
-
|
|
9
|
-
review:
|
|
10
|
-
stage: review
|
|
11
|
-
image: $REVIEWER_IMAGE
|
|
12
|
-
# Only runs when triggered from the source project (or manually)
|
|
13
|
-
rules:
|
|
14
|
-
- if: $CI_PIPELINE_SOURCE == "pipeline" # bridge trigger
|
|
15
|
-
- if: $CI_PIPELINE_SOURCE == "trigger" # token trigger
|
|
16
|
-
- if: $CI_PIPELINE_SOURCE == "web" # manual retry
|
|
17
|
-
when: manual
|
|
18
|
-
variables:
|
|
19
|
-
GIT_STRATEGY: none # no need to check out the reviewer repo
|
|
20
|
-
# Every parameter comes from env (SOURCE_PROJECT_ID, MR_IID, GITLAB_HOST, REVIEW_MODE) — no CLI args.
|
|
21
|
-
script:
|
|
22
|
-
- /entrypoint.sh
|
|
23
|
-
# History cache — the push-gate (skip already-reviewed head SHAs) and incremental
|
|
24
|
-
# context read $DSH_HOME/dsh-maestro-review/reviews.json, which is ephemeral in a
|
|
25
|
-
# fresh container. entrypoint.sh symlinks it at this cached path (one store, many
|
|
26
|
-
# MRs — entries are keyed per MR inside). Cache miss fails open toward reviewing.
|
|
27
|
-
cache:
|
|
28
|
-
key: maestro-review-history
|
|
29
|
-
paths:
|
|
30
|
-
- .maestro-history/
|
|
31
|
-
artifacts:
|
|
32
|
-
when: always
|
|
33
|
-
expire_in: 1 week
|
|
34
|
-
paths:
|
|
35
|
-
- review-report.json
|
|
36
|
-
- review-report.md
|
|
37
|
-
# Secrets — Protected + Masked, only available on the reviewer project's protected branches.
|
|
38
|
-
# MAESTRO_GITLAB_TOKEN is REQUIRED and must be a user PAT or Group/Project
|
|
39
|
-
# Access Token (api scope). CI_JOB_TOKEN is NOT enough: proven 2026-09-04 on
|
|
40
|
-
# GitLab 18.11 that reads work (GET=200) but posting the review comment fails
|
|
41
|
-
# (POST /notes=401) even with the source project allowlisting this reviewer —
|
|
42
|
-
# the run would "complete" without ever posting. A human-tied PAT needs yearly
|
|
43
|
-
# rotation; prefer a bot/group token where the instance allows creating one.
|
|
44
|
-
# MAESTRO_GITLAB_TOKEN (api scope) — required
|
|
45
|
-
# Model route selection — deepseek is the sole baked default; set
|
|
46
|
-
# REVIEW_LLM_API_KEY to overlay any OpenAI-compatible endpoint instead:
|
|
47
|
-
# DEEPSEEK_API_KEY (required unless using the route below) — deepseek-official
|
|
48
|
-
# straight from api.deepseek.com.
|
|
49
|
-
# REVIEW_LLM_API_KEY / REVIEW_LLM_BASE_URL / REVIEW_LLM_MODEL — bring-your-own
|
|
50
|
-
# OpenAI-compatible endpoint (self-hosted, Azure OpenAI, OpenRouter, a
|
|
51
|
-
# private gateway, ...). All three required together; the job fails closed
|
|
52
|
-
# if REVIEW_LLM_API_KEY is set without the other two. Optional
|
|
53
|
-
# REVIEW_LLM_API selects the wire protocol (openai-completions [default]
|
|
54
|
-
# or openai-responses).
|
|
55
|
-
# TELEGRAM_BOT_TOKEN / TELEGRAM_CHAT_ID (optional)
|
|
56
|
-
# Model pin (optional, as a pair — unset both for the active route's default
|
|
57
|
-
# model, baked in docker/ci-settings.*.yaml):
|
|
58
|
-
# REVIEW_MODEL_PROVIDER: "deepseek-official" # or "custom-openai"
|
|
59
|
-
# REVIEW_MODEL: "deepseek-v4-flash" # the active route's model id
|
|
60
|
-
# Only the provider's key is needed — no settings mount required. ID without
|
|
61
|
-
# provider fails the review with a provider error (not silently the wrong
|
|
62
|
-
# model); provider without ID is ignored.
|
|
63
|
-
# Review skill profile (optional — unset for the legacy diff-only generic review):
|
|
64
|
-
# REVIEW_PROFILE: "magento2" # magento2 | laravel | symfony | wordpress | generic
|
|
65
|
-
# The reviewer must load the full skill set or the review fails closed
|
|
66
|
-
# (no half-skilled review). Runtime-backed checks still degrade without a
|
|
67
|
-
# checkout — the profile adds framework checklists, not a govard run.
|
|
68
|
-
# Review mode (default quick; deep runs on demand — no new variables):
|
|
69
|
-
# REVIEW_MODE: "deep" # manual downstream run with the same
|
|
70
|
-
# bridge variables (SOURCE_PROJECT_ID, MR_IID, GITLAB_HOST) + REVIEW_ON_PUSH=1
|
|
71
|
-
# to re-review pushes. The job clones the source at the MR head SHA with
|
|
72
|
-
# MAESTRO_GITLAB_TOKEN (api scope, oauth2) and runs reviewer (+auditor
|
|
73
|
-
# degraded to reviewer-only without a runtime). No govard in the container.
|
|
74
|
-
# CI yields to webhook: if the head SHA already has a completed review
|
|
75
|
-
# comment (either flow), the run skips instead of double-posting.
|
|
76
|
-
# Re-review pushes (optional — mirrors Settings UI autoRereviewOnPush, default off):
|
|
77
|
-
# REVIEW_ON_PUSH: "1" # re-review new pushes with incremental context;
|
|
78
|
-
# unset = only the first (opened) review runs; same head SHA always skips.
|
|
79
|
-
|
|
80
|
-
# Build the image inside the same reviewer project (optional):
|
|
81
|
-
#
|
|
82
|
-
# build:image:
|
|
83
|
-
# stage: .pre
|
|
84
|
-
# image: docker:27
|
|
85
|
-
# services: [docker:27-dind]
|
|
86
|
-
# rules:
|
|
87
|
-
# - if: $CI_COMMIT_BRANCH == "main"
|
|
88
|
-
# script:
|
|
89
|
-
# - docker build -f packages/dsh-maestro-review/docker/Dockerfile -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA -t $CI_REGISTRY_IMAGE:latest .
|
|
90
|
-
# - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
|
91
|
-
# - docker push $CI_REGISTRY_IMAGE:latest
|
|
92
|
-
# # Build context must be the maestro-harness workspace root (contains deepseek-harness/) —
|
|
93
|
-
# # the trailing "." above assumes this job checks out maestro-harness, not this repo alone.
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# example-group/example-project — source project (copy this template into YOUR source project)
|
|
2
|
-
stages: [review]
|
|
3
|
-
|
|
4
|
-
# Only runs when there is an MR (fork MRs run fine too — this job has no secrets)
|
|
5
|
-
maestro:trigger-review:
|
|
6
|
-
stage: review
|
|
7
|
-
# The job only fails on a reviewer-infra problem (LLM/API error, timeout,
|
|
8
|
-
# failed comment post) — it never fails because findings were reported.
|
|
9
|
-
# Non-blocking so an outage of the shared reviewer project (serving many
|
|
10
|
-
# source projects) can't block this project's merge/deploy; check the MR
|
|
11
|
-
# comment for the actual review result. Drop this line to hard-block merge
|
|
12
|
-
# on any reviewer-infra failure instead.
|
|
13
|
-
allow_failure: true
|
|
14
|
-
rules:
|
|
15
|
-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
16
|
-
# No image needed, no secrets needed
|
|
17
|
-
trigger:
|
|
18
|
-
project: ddtcorex/maestro-reviewer # ← reviewer project path
|
|
19
|
-
branch: main # ← the reviewer project's default branch (master on some instances)
|
|
20
|
-
strategy: depend # optional: wait for the reviewer pipeline, surface its status on the MR
|
|
21
|
-
variables:
|
|
22
|
-
SOURCE_PROJECT_ID: $CI_PROJECT_ID
|
|
23
|
-
MR_IID: $CI_MERGE_REQUEST_IID
|
|
24
|
-
GITLAB_HOST: $CI_SERVER_HOST
|
|
25
|
-
REVIEW_MODE: "quick" # or "deep" for a static-only audit (no govard runtime in CI)
|
|
26
|
-
REVIEW_PROFILE: "generic" # per-project skill profile: magento2 | laravel | symfony | wordpress | generic
|
|
27
|
-
# REVIEW_ON_PUSH: "1" # uncomment to re-review every push (default: only the opened review runs)
|
|
28
|
-
|
|
29
|
-
# Trigger Token fallback (when not using `trigger: project:`):
|
|
30
|
-
#
|
|
31
|
-
# maestro:trigger-review:token:
|
|
32
|
-
# stage: review
|
|
33
|
-
# rules:
|
|
34
|
-
# - if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
35
|
-
# image: curlimages/curl:8
|
|
36
|
-
# variables:
|
|
37
|
-
# REVIEWER_PROJECT_ID: "123" # id of the maestro-reviewer project
|
|
38
|
-
# script:
|
|
39
|
-
# - |
|
|
40
|
-
# curl --fail --request POST \
|
|
41
|
-
# --form token=$MAESTRO_TRIGGER_TOKEN \
|
|
42
|
-
# --form ref=main \
|
|
43
|
-
# --form variables[SOURCE_PROJECT_ID]=$CI_PROJECT_ID \
|
|
44
|
-
# --form variables[MR_IID]=$CI_MERGE_REQUEST_IID \
|
|
45
|
-
# --form variables[GITLAB_HOST]=$CI_SERVER_HOST \
|
|
46
|
-
# "https://${CI_SERVER_HOST}/api/v4/projects/${REVIEWER_PROJECT_ID}/trigger/pipeline"
|
|
47
|
-
# # MAESTRO_TRIGGER_TOKEN is the reviewer project's Trigger Token, stored in the source project
|
|
48
|
-
# # (can only trigger, never read/write code — safer than GITLAB_TOKEN)
|