opencode-gitlab-dap 1.16.5 → 1.17.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 +159 -22
- package/dist/index.cjs +120 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +120 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# OpenCode GitLab Duo Agent Platform Plugin
|
|
2
2
|
|
|
3
3
|
An [opencode](https://opencode.ai) plugin for the [GitLab Duo Agent Platform (DAP)](https://docs.gitlab.com/user/duo_agent_platform/).
|
|
4
4
|
Discovers agents and flows from the GitLab AI Catalog, injects them into opencode,
|
|
@@ -39,6 +39,12 @@ On startup, the plugin discovers all agents and flows enabled for your project:
|
|
|
39
39
|
- Agents appear in `/agents` dialog and Tab agent picker
|
|
40
40
|
- Flows appear in the `@` mention menu as subagents
|
|
41
41
|
|
|
42
|
+
**Use cases:**
|
|
43
|
+
|
|
44
|
+
- **Switch to a specialized agent mid-conversation** — press Tab or open `/agents` to pick a Data Analyst, Security Analyst, or any custom agent enabled for your project
|
|
45
|
+
- **Discover what automation is available** — browse the `@` menu to see all flows your project has access to, including both foundational and custom flows
|
|
46
|
+
- **Use foundational agents for specialized tasks** — switch to the Planner agent for project planning, or the Security Analyst for vulnerability assessment, without any setup
|
|
47
|
+
|
|
42
48
|
### Flow Execution via `@` Menu
|
|
43
49
|
|
|
44
50
|
Type `@Flow Name` followed by your goal to execute a flow:
|
|
@@ -56,6 +62,14 @@ The plugin:
|
|
|
56
62
|
5. Executes the flow via `POST /api/v4/ai/duo_workflows/workflows`
|
|
57
63
|
6. Monitors workflow status and reports the workflow URL for tracking in GitLab UI
|
|
58
64
|
|
|
65
|
+
**Use cases:**
|
|
66
|
+
|
|
67
|
+
- **Trigger a code review** — `@Code Review 🦊 review MR !42` to get automated code review feedback on a specific merge request
|
|
68
|
+
- **Fix a broken pipeline** — `@Fix CI/CD Pipeline diagnose and fix the failing pipeline on branch feature/auth` to get automated pipeline diagnosis
|
|
69
|
+
- **Resolve a security vulnerability** — `@Security Vulnerability Fix fix vulnerability #123` to get an automated fix generated and pushed as an MR
|
|
70
|
+
- **Generate test coverage** — `@Auto Fix generate tests for the UserService class` to get unit tests created automatically
|
|
71
|
+
- **Natural language goal resolution** — describe what you want in plain English and the plugin resolves it to the exact parameter the flow needs (e.g., "MR !12" → IID `12`)
|
|
72
|
+
|
|
59
73
|
### Parallel Multi-Flow Dispatch
|
|
60
74
|
|
|
61
75
|
Mention multiple flows in a single message to execute them simultaneously:
|
|
@@ -73,6 +87,13 @@ When multiple flows are mentioned:
|
|
|
73
87
|
|
|
74
88
|
The `experimental.chat.system.transform` hook injects system prompt guidelines that instruct the main agent on how to handle multi-flow and batch dispatch scenarios.
|
|
75
89
|
|
|
90
|
+
**Use cases:**
|
|
91
|
+
|
|
92
|
+
- **Run security and code review simultaneously** — `@AppSec Security MR Reviewer @Code Review 🦊 review MR !42` to get both security analysis and code quality feedback in parallel
|
|
93
|
+
- **Batch review all open MRs** — `@Code Review 🦊 review all open MRs` to dispatch one flow execution per open MR, all running concurrently
|
|
94
|
+
- **Multi-flow batch operations** — combine multiple flows with "for each" semantics: the plugin lists all matching resources, then dispatches N flows × M resources in parallel
|
|
95
|
+
- **Reduce wait time with concurrency** — instead of running flows one by one, mention them all at once for simultaneous execution with a single summary at the end
|
|
96
|
+
|
|
76
97
|
### Custom Agent Creation
|
|
77
98
|
|
|
78
99
|
Create custom agents interactively:
|
|
@@ -91,6 +112,14 @@ The plugin guides you through an interactive workflow:
|
|
|
91
112
|
|
|
92
113
|
The `confirmed` parameter on `gitlab_create_agent` enforces the interactive workflow — the tool returns instructions instead of creating the agent when called without explicit confirmation.
|
|
93
114
|
|
|
115
|
+
**Use cases:**
|
|
116
|
+
|
|
117
|
+
- **Build a domain-specific assistant** — create an agent with a system prompt tuned to your team's domain (e.g., payments, infrastructure, data pipelines) and the relevant tools
|
|
118
|
+
- **Create a creative writing agent** — build an agent that responds in a specific format (poems, haiku, bullet points) for fun or specialized output needs
|
|
119
|
+
- **Set up a security-focused reviewer** — create an agent with security scanning tools and a system prompt that emphasizes OWASP, CVE checks, and secure coding practices
|
|
120
|
+
- **Connect an agent to external services** — assign MCP servers to an agent so it can interact with third-party APIs and services during conversations
|
|
121
|
+
- **Share agents across your organization** — create a public agent in the AI Catalog that any project in your GitLab instance can enable and use
|
|
122
|
+
|
|
94
123
|
### Custom Flow Creation
|
|
95
124
|
|
|
96
125
|
Design and create custom flows interactively:
|
|
@@ -110,40 +139,91 @@ The plugin provides a multi-round design workflow:
|
|
|
110
139
|
|
|
111
140
|
The vendored `flow_v2.json` schema from GitLab Rails powers client-side validation using `ajv`, catching errors before hitting the API.
|
|
112
141
|
|
|
142
|
+
**Use cases:**
|
|
143
|
+
|
|
144
|
+
- **Automate MR summarization** — create a flow that fetches MR diffs, analyzes the changes, and posts a summary comment with key observations
|
|
145
|
+
- **Build a deployment checklist flow** — design a multi-step flow that verifies prerequisites, runs pre-deployment checks, and triggers deployment
|
|
146
|
+
- **Create a release notes generator** — build a flow that collects commits since the last tag, categorizes changes, and generates formatted release notes
|
|
147
|
+
- **Design a conditional flow with routing** — create a flow with branching logic (e.g., different review steps based on file types changed in the MR)
|
|
148
|
+
- **Validate flow definitions before submission** — catch YAML schema errors locally before hitting the GitLab API, reducing back-and-forth during flow development
|
|
149
|
+
- **Iterate on flow design interactively** — use the multi-round design workflow to refine component architecture and step definitions with guided assistance
|
|
150
|
+
|
|
113
151
|
### 35 Tools
|
|
114
152
|
|
|
115
153
|
#### DAP Tools (20)
|
|
116
154
|
|
|
155
|
+
##### Flow Execution
|
|
156
|
+
|
|
157
|
+
| Tool | Description |
|
|
158
|
+
| ----------------------------- | ------------------------------------------ |
|
|
159
|
+
| `gitlab_execute_project_flow` | Execute a flow via DWS REST API |
|
|
160
|
+
| `gitlab_get_flow_definition` | Get flow YAML config (inputs, components) |
|
|
161
|
+
| `gitlab_get_workflow_status` | Monitor workflow execution status and logs |
|
|
162
|
+
|
|
163
|
+
**Use cases:**
|
|
164
|
+
|
|
165
|
+
- **Run a code review flow on a merge request** — trigger the "Code Review" flow for a specific MR to get automated review feedback posted as comments
|
|
166
|
+
- **Fix a failing CI/CD pipeline** — execute the "Fix CI/CD Pipeline" flow with the pipeline URL to get automated diagnosis and fix suggestions
|
|
167
|
+
- **Batch-execute flows across multiple MRs** — run a security review flow on all open MRs simultaneously by listing resources first, then dispatching N flows in parallel
|
|
168
|
+
- **Inspect flow requirements before execution** — use `gitlab_get_flow_definition` to check what inputs a flow expects (e.g., `merge_request_iid`, `pipeline_url`, `vulnerability_id`) before triggering it
|
|
169
|
+
- **Monitor long-running workflows** — poll `gitlab_get_workflow_status` to track progress, retrieve the agent conversation log, and get the GitLab UI URL for the workflow session
|
|
170
|
+
- **Debug flow execution failures** — check workflow status messages to understand where a flow failed and what the agent attempted
|
|
171
|
+
|
|
172
|
+
##### Catalog CRUD
|
|
173
|
+
|
|
117
174
|
| Tool | Description |
|
|
118
175
|
| --------------------------------- | ------------------------------------------------------- |
|
|
119
|
-
| `gitlab_list_agents` | Search agents in the global AI Catalog |
|
|
120
|
-
| `gitlab_get_agent` | Get agent details by ID |
|
|
121
|
-
| `gitlab_list_project_agents` | List agents enabled for a project |
|
|
122
|
-
| `gitlab_enable_project_agent` | Enable an agent in a project |
|
|
123
|
-
| `gitlab_disable_project_agent` | Disable an agent in a project |
|
|
124
176
|
| `gitlab_create_agent` | Create a custom agent (interactive, confirmation-gated) |
|
|
125
177
|
| `gitlab_update_agent` | Update an existing custom agent |
|
|
126
178
|
| `gitlab_list_builtin_tools` | List available built-in tools for agent/flow config |
|
|
127
179
|
| `gitlab_design_flow` | Interactive flow design + YAML validation |
|
|
128
180
|
| `gitlab_create_flow` | Create a custom flow (confirmation-gated) |
|
|
129
181
|
| `gitlab_update_flow` | Update an existing custom flow |
|
|
130
|
-
| `gitlab_list_flows` | Search flows in the global AI Catalog |
|
|
131
|
-
| `gitlab_get_flow` | Get flow details by ID |
|
|
132
|
-
| `gitlab_list_project_flows` | List flows enabled for a project |
|
|
133
|
-
| `gitlab_enable_project_flow` | Enable a flow in a project |
|
|
134
|
-
| `gitlab_disable_project_flow` | Disable a flow in a project |
|
|
135
|
-
| `gitlab_execute_project_flow` | Execute a flow via DWS REST API |
|
|
136
|
-
| `gitlab_get_flow_definition` | Get flow YAML config (inputs, components) |
|
|
137
|
-
| `gitlab_get_workflow_status` | Monitor workflow execution status and logs |
|
|
138
182
|
| `gitlab_list_project_mcp_servers` | List MCP servers available for project agents |
|
|
139
183
|
|
|
140
|
-
|
|
184
|
+
**Use cases:**
|
|
185
|
+
|
|
186
|
+
- **Create a project-specific code reviewer agent** — interactively define a custom agent with a tailored system prompt, assign it the MR and code search tools, and connect it to your project's MCP servers
|
|
187
|
+
- **Build a team-specific incident responder agent** — create an agent with security scanning tools and a system prompt tuned to your team's runbooks and escalation procedures
|
|
188
|
+
- **Design a custom flow from scratch** — use `gitlab_design_flow` to get the YAML schema reference and examples, propose a component architecture, validate the YAML client-side, and submit it
|
|
189
|
+
- **Create a vulnerability triage flow** — design a multi-step flow that fetches vulnerability details, evaluates severity, and posts remediation guidance
|
|
190
|
+
- **Iterate on an agent's system prompt** — use `gitlab_update_agent` to refine the prompt after testing, bump the version, and release
|
|
191
|
+
- **Add MCP servers to an existing agent** — discover available MCP servers with `gitlab_list_project_mcp_servers`, then update the agent to include them
|
|
192
|
+
- **Validate flow YAML before submission** — catch schema errors locally with `gitlab_design_flow(action="validate")` before hitting the API
|
|
193
|
+
- **Discover available tools for agent configuration** — use `gitlab_list_builtin_tools` to see all tool categories (search, issues, MRs, epics, files, git, CI/CD, security, audit, planning, wiki)
|
|
194
|
+
|
|
195
|
+
##### Catalog Item Management
|
|
196
|
+
|
|
197
|
+
| Tool | Description |
|
|
198
|
+
| ------------------------------ | -------------------------------------- |
|
|
199
|
+
| `gitlab_list_agents` | Search agents in the global AI Catalog |
|
|
200
|
+
| `gitlab_get_agent` | Get agent details by ID |
|
|
201
|
+
| `gitlab_list_project_agents` | List agents enabled for a project |
|
|
202
|
+
| `gitlab_enable_project_agent` | Enable an agent in a project |
|
|
203
|
+
| `gitlab_disable_project_agent` | Disable an agent in a project |
|
|
204
|
+
| `gitlab_list_flows` | Search flows in the global AI Catalog |
|
|
205
|
+
| `gitlab_get_flow` | Get flow details by ID |
|
|
206
|
+
| `gitlab_list_project_flows` | List flows enabled for a project |
|
|
207
|
+
| `gitlab_enable_project_flow` | Enable a flow in a project |
|
|
208
|
+
| `gitlab_disable_project_flow` | Disable a flow in a project |
|
|
209
|
+
|
|
210
|
+
**Use cases:**
|
|
211
|
+
|
|
212
|
+
- **Browse the AI Catalog for useful agents** — search the global catalog by name or description to discover agents built by other teams or the community
|
|
213
|
+
- **Set up a new project with standard agents** — enable your organization's standard set of agents and flows on a newly created project
|
|
214
|
+
- **Audit which agents are enabled** — list all agents and flows enabled for a project to verify compliance with team standards or security policies
|
|
215
|
+
- **Enable a flow after creation** — after creating a custom flow, enable it on your project so it appears in the `@` mention menu
|
|
216
|
+
- **Disable a misbehaving flow** — temporarily disable a flow that is producing incorrect results while you debug and update its definition
|
|
217
|
+
- **Inspect agent details before enabling** — check an agent's creator, version, description, and permissions before adding it to your project
|
|
218
|
+
- **Find the consumer ID for flow execution** — list project flows to retrieve the consumer ID required by `gitlab_execute_project_flow`
|
|
219
|
+
|
|
220
|
+
#### Project Knowledge Tools (15)
|
|
141
221
|
|
|
142
222
|
Persistent project memory and reusable skills. Knowledge is stored in GitLab project/group wikis but tools abstract the storage — the agent works with facts, decisions, patterns, and skills.
|
|
143
223
|
|
|
144
224
|
Say **"bootstrap project memory"** to automatically inspect a project and build its knowledge base. If memory already exists, it does a smart refresh — updating stale facts and archiving outdated entries.
|
|
145
225
|
|
|
146
|
-
##### Memory Tools
|
|
226
|
+
##### Memory Tools (7)
|
|
147
227
|
|
|
148
228
|
| Tool | Description |
|
|
149
229
|
| --------------------------- | --------------------------------------------------------------- |
|
|
@@ -155,7 +235,24 @@ Say **"bootstrap project memory"** to automatically inspect a project and build
|
|
|
155
235
|
| `gitlab_memory_recall` | Search project knowledge for relevant information |
|
|
156
236
|
| `gitlab_memory_log_session` | Log a session summary with learnings |
|
|
157
237
|
|
|
158
|
-
|
|
238
|
+
**Use cases:**
|
|
239
|
+
|
|
240
|
+
- **Bootstrap project knowledge from scratch** — run "bootstrap project memory" to inspect README, issues, MRs, pipelines, and team members, then record everything as structured facts, architecture, conventions, and people entries
|
|
241
|
+
- **Preserve context across sessions** — record facts about tech stack, dependencies, and deployment targets so future sessions start with full context instead of re-exploring
|
|
242
|
+
- **Document architectural decisions with reasoning** — record why the team chose PostgreSQL over MySQL, or React over Vue, with full rationale for future reference
|
|
243
|
+
- **Track recurring patterns** — record observations like "CI pipelines fail on Mondays due to cache expiry" or "test suite is flaky on the `payments` module" so they aren't rediscovered each time
|
|
244
|
+
- **Maintain a living architecture document** — record and update system design, module structure, data flow, and key abstractions as the codebase evolves
|
|
245
|
+
- **Codify coding conventions** — record naming patterns, commit message formats, review processes, and coding standards so the agent follows them consistently
|
|
246
|
+
- **Document known issues and workarounds** — record troubleshooting steps for common errors so the agent can suggest solutions without investigation
|
|
247
|
+
- **Track team roles and ownership** — record who owns which modules, who to contact for specific subsystems, and team members' areas of expertise
|
|
248
|
+
- **Record implementation plans** — document feature designs, task breakdowns, and roadmap items that persist across sessions
|
|
249
|
+
- **Refresh stale knowledge** — use `gitlab_memory_update` to correct outdated facts (e.g., updated issue counts, new team members, changed dependencies)
|
|
250
|
+
- **Archive superseded decisions** — when a decision is reversed or a fact becomes obsolete, archive it with a reason so there's a historical record
|
|
251
|
+
- **Periodic memory housekeeping** — use `gitlab_memory_consolidate` to identify stale, duplicate, or contradictory records and clean them up
|
|
252
|
+
- **Search before investigating** — use `gitlab_memory_recall` to check if something is already known about a topic before spending time exploring the codebase
|
|
253
|
+
- **Log session summaries** — at the end of a significant work session, record what was accomplished, what was learned, and suggestions for next steps
|
|
254
|
+
|
|
255
|
+
##### Skill Tools (8)
|
|
159
256
|
|
|
160
257
|
| Tool | Description |
|
|
161
258
|
| ----------------------- | ------------------------------------------------------------- |
|
|
@@ -168,17 +265,51 @@ Say **"bootstrap project memory"** to automatically inspect a project and build
|
|
|
168
265
|
| `gitlab_skill_setup` | Extract skill to `.agents/skills/<name>/` for local execution |
|
|
169
266
|
| `gitlab_skill_delete` | Delete skill (wiki pages + snippet + index entry) |
|
|
170
267
|
|
|
171
|
-
**
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
268
|
+
**Use cases:**
|
|
269
|
+
|
|
270
|
+
- **Create a reusable incident retrospective procedure** — save a step-by-step skill that guides the agent through conducting incident retros with checklists and templates
|
|
271
|
+
- **Share skills across projects via group wiki** — save a skill at the group level so all projects in the group can discover and install it
|
|
272
|
+
- **Discover team-shared skills** — search the group wiki and skills.sh registry to find skills other teams have built (e.g., Helm rollback procedures, database migration checklists)
|
|
273
|
+
- **Install a skill from the community** — install a skill from skills.sh into your project wiki with one command, bringing in both documentation and executable scripts
|
|
274
|
+
- **Draft and iterate on a skill before publishing** — save a skill as a draft, test it in practice, refine the instructions, then promote it to published when ready
|
|
275
|
+
- **Bundle executable scripts with a skill** — save Python, JavaScript, or Shell scripts alongside skill instructions using hybrid storage (wiki for markdown, project snippet for executables)
|
|
276
|
+
- **Extract skills for local execution** — use `gitlab_skill_setup` to download a skill's scripts to `.agents/skills/<name>/` so opencode auto-discovers and uses them locally
|
|
277
|
+
- **Maintain a skill index for fast discovery** — the index at `agents/skills/index` is auto-rebuilt on every `gitlab_skill_list` call, keeping it in sync with actual skill pages
|
|
278
|
+
- **Promote a proven draft skill** — after validating a draft skill works well, promote it to published to make it available to all users of the project
|
|
279
|
+
- **Remove an obsolete skill** — delete a skill and its associated snippet, automatically cleaning up the index entry
|
|
280
|
+
- **Audit available skills** — list all published and draft skills with their descriptions to understand what automation is available for the project
|
|
281
|
+
|
|
282
|
+
##### Security Audits for skills.sh Skills
|
|
283
|
+
|
|
284
|
+
When discovering or installing skills from skills.sh, the plugin automatically checks security audit results from three independent providers:
|
|
285
|
+
|
|
286
|
+
- **Gen Agent Trust Hub** — AI-powered threat detection for malware, data exfiltration, and prompt injection
|
|
287
|
+
- **Socket** — Supply chain security analysis for suspicious patterns and anomalies
|
|
288
|
+
- **Snyk** — Vulnerability scanning and risk assessment
|
|
289
|
+
|
|
290
|
+
**Behavior:**
|
|
291
|
+
|
|
292
|
+
- **Block on Fail** — if any audit provider reports a failure, installation is blocked with details and a link to review the audit findings
|
|
293
|
+
- **Warn on Warn** — if any provider reports a warning, the skill is installed but warnings are displayed with links to the audit details
|
|
294
|
+
- **Graceful degradation** — if skills.sh is unreachable or audit data is unavailable, installation proceeds with a note
|
|
295
|
+
|
|
296
|
+
**Use cases:**
|
|
297
|
+
|
|
298
|
+
- **Discover skills with security status** — `gitlab_skill_discover` shows audit results (Pass/Warn/Fail) inline for each skills.sh result, so you can assess risk before installing
|
|
299
|
+
- **Block installation of risky skills** — skills with audit failures from any provider are automatically blocked with a link to the full audit report
|
|
300
|
+
- **Review audit warnings before proceeding** — skills with warnings install successfully but display the warnings so you can make an informed decision
|
|
301
|
+
- **Graceful handling of unavailable audit data** — if skills.sh is unreachable, install proceeds with a note rather than failing
|
|
176
302
|
|
|
177
303
|
### Dynamic Refresh
|
|
178
304
|
|
|
179
305
|
After enabling or disabling an agent/flow, the plugin automatically refreshes the
|
|
180
306
|
agent list. Restart opencode to update the `@` menu.
|
|
181
307
|
|
|
308
|
+
**Use cases:**
|
|
309
|
+
|
|
310
|
+
- **Enable an agent and use it immediately** — after enabling a new agent or flow, the plugin refreshes the catalog cache so tools immediately reflect the change without restarting
|
|
311
|
+
- **Disable a broken flow mid-session** — disable a flow that is misbehaving and the agent list updates in real time for subsequent tool calls
|
|
312
|
+
|
|
182
313
|
### Vendored Foundational Flow Configs
|
|
183
314
|
|
|
184
315
|
Foundational flow definitions (from `gitlab-org/modelops/applied-ml/code-suggestions/ai-assist`)
|
|
@@ -188,6 +319,12 @@ foundational flows whose configs are not available via the GitLab API.
|
|
|
188
319
|
The `flow_v2.json` JSON schema is also vendored from GitLab Rails and bundled
|
|
189
320
|
inline for client-side YAML validation via `ajv`.
|
|
190
321
|
|
|
322
|
+
**Use cases:**
|
|
323
|
+
|
|
324
|
+
- **Execute foundational flows without API calls** — flow input schemas for built-in flows are bundled in the plugin, enabling instant flow definition lookup without network requests
|
|
325
|
+
- **Validate custom flow YAML offline** — the vendored `flow_v2.json` schema enables client-side validation via `ajv` without requiring a GitLab API connection
|
|
326
|
+
- **Stay up to date with new flow versions** — run `npm run vendor` to pull the latest foundational flow definitions when DWS releases updates
|
|
327
|
+
|
|
191
328
|
## Agent Types
|
|
192
329
|
|
|
193
330
|
### Foundational Agents
|
package/dist/index.cjs
CHANGED
|
@@ -4052,7 +4052,16 @@ function searchSkillsSh(query) {
|
|
|
4052
4052
|
function downloadSkillFromSkillsSh(identifier) {
|
|
4053
4053
|
const tmp = (0, import_fs2.mkdtempSync)((0, import_path2.join)((0, import_os2.tmpdir)(), "skill-install-"));
|
|
4054
4054
|
try {
|
|
4055
|
-
|
|
4055
|
+
const atIdx = identifier.indexOf("@");
|
|
4056
|
+
let cmd;
|
|
4057
|
+
if (atIdx !== -1) {
|
|
4058
|
+
const repo = identifier.slice(0, atIdx);
|
|
4059
|
+
const skill = identifier.slice(atIdx + 1);
|
|
4060
|
+
cmd = `npx skills add ${JSON.stringify(repo)} --skill ${JSON.stringify(skill)} -y --copy`;
|
|
4061
|
+
} else {
|
|
4062
|
+
cmd = `npx skills add ${JSON.stringify(identifier)} -y --copy`;
|
|
4063
|
+
}
|
|
4064
|
+
(0, import_child_process.execSync)(cmd, {
|
|
4056
4065
|
timeout: 6e4,
|
|
4057
4066
|
cwd: tmp,
|
|
4058
4067
|
encoding: "utf-8",
|
|
@@ -4105,6 +4114,73 @@ function downloadSkillFromSkillsSh(identifier) {
|
|
|
4105
4114
|
}
|
|
4106
4115
|
}
|
|
4107
4116
|
|
|
4117
|
+
// src/tools/skill-audit.ts
|
|
4118
|
+
var PROVIDER_NAMES = {
|
|
4119
|
+
"agent-trust-hub": "Gen Agent Trust Hub",
|
|
4120
|
+
socket: "Socket",
|
|
4121
|
+
snyk: "Snyk"
|
|
4122
|
+
};
|
|
4123
|
+
function parseIdentifierToUrl(identifier) {
|
|
4124
|
+
const atIdx = identifier.indexOf("@");
|
|
4125
|
+
if (atIdx === -1) return null;
|
|
4126
|
+
const ownerRepo = identifier.slice(0, atIdx);
|
|
4127
|
+
const skillName = identifier.slice(atIdx + 1);
|
|
4128
|
+
if (!ownerRepo.includes("/") || !skillName) return null;
|
|
4129
|
+
return `https://skills.sh/${ownerRepo}/${skillName}`;
|
|
4130
|
+
}
|
|
4131
|
+
function parseAuditHtml(html, auditUrl) {
|
|
4132
|
+
const secIdx = html.indexOf("Security Audits");
|
|
4133
|
+
if (secIdx === -1) return null;
|
|
4134
|
+
const section = html.slice(secIdx, secIdx + 5e3);
|
|
4135
|
+
const providerPattern = /href="[^"]*\/security\/(agent-trust-hub|socket|snyk)"[\s\S]*?>(Pass|Fail|Warn)</g;
|
|
4136
|
+
const results = [];
|
|
4137
|
+
let match;
|
|
4138
|
+
while ((match = providerPattern.exec(section)) !== null) {
|
|
4139
|
+
const slug = match[1];
|
|
4140
|
+
const status = match[2];
|
|
4141
|
+
results.push({
|
|
4142
|
+
provider: PROVIDER_NAMES[slug] ?? slug,
|
|
4143
|
+
status,
|
|
4144
|
+
detailUrl: `${auditUrl}/security/${slug}`
|
|
4145
|
+
});
|
|
4146
|
+
}
|
|
4147
|
+
if (results.length === 0) return null;
|
|
4148
|
+
return {
|
|
4149
|
+
results,
|
|
4150
|
+
hasFailure: results.some((r) => r.status === "Fail"),
|
|
4151
|
+
hasWarning: results.some((r) => r.status === "Warn"),
|
|
4152
|
+
auditUrl
|
|
4153
|
+
};
|
|
4154
|
+
}
|
|
4155
|
+
async function fetchSkillAudit(identifier) {
|
|
4156
|
+
const url = parseIdentifierToUrl(identifier);
|
|
4157
|
+
if (!url) return null;
|
|
4158
|
+
try {
|
|
4159
|
+
const resp = await fetch(url, {
|
|
4160
|
+
signal: AbortSignal.timeout(1e4),
|
|
4161
|
+
headers: { Accept: "text/html" }
|
|
4162
|
+
});
|
|
4163
|
+
if (!resp.ok) return null;
|
|
4164
|
+
const html = await resp.text();
|
|
4165
|
+
return parseAuditHtml(html, url);
|
|
4166
|
+
} catch {
|
|
4167
|
+
return null;
|
|
4168
|
+
}
|
|
4169
|
+
}
|
|
4170
|
+
function formatAuditLine(audit) {
|
|
4171
|
+
return audit.results.map((r) => {
|
|
4172
|
+
const icon = r.status === "Fail" ? "\u{1F534}" : r.status === "Warn" ? "\u{1F7E1}" : "\u{1F7E2}";
|
|
4173
|
+
return `${icon} ${r.provider}: ${r.status}`;
|
|
4174
|
+
}).join(" | ");
|
|
4175
|
+
}
|
|
4176
|
+
function formatAuditRate(audit) {
|
|
4177
|
+
const total = audit.results.length;
|
|
4178
|
+
const passed = audit.results.filter((r) => r.status === "Pass").length;
|
|
4179
|
+
if (passed === total) return `Security: ${passed}/${total} audits passed \u2705`;
|
|
4180
|
+
if (audit.hasFailure) return `Security: ${passed}/${total} audits passed \u274C`;
|
|
4181
|
+
return `Security: ${passed}/${total} audits passed \u26A0\uFE0F`;
|
|
4182
|
+
}
|
|
4183
|
+
|
|
4108
4184
|
// src/tools/skill-tools.ts
|
|
4109
4185
|
var z6 = import_plugin6.tool.schema;
|
|
4110
4186
|
var PROJECT_ID_DESC2 = "Project path from git remote";
|
|
@@ -4389,14 +4465,32 @@ Install: \`gitlab_skill_install(name="${e.name}", source="group", group_id="${ar
|
|
|
4389
4465
|
}
|
|
4390
4466
|
const shResults = searchSkillsSh(args.query);
|
|
4391
4467
|
if (shResults.length > 0) {
|
|
4468
|
+
const audits = await Promise.all(shResults.map((r) => fetchSkillAudit(r.identifier)));
|
|
4392
4469
|
sections.push(
|
|
4393
4470
|
`### skills.sh (${shResults.length})
|
|
4394
4471
|
|
|
4395
|
-
` + shResults.map(
|
|
4396
|
-
|
|
4472
|
+
` + shResults.map((r, i) => {
|
|
4473
|
+
const audit = audits[i];
|
|
4474
|
+
let line = `**${r.identifier}** (${r.installs})`;
|
|
4475
|
+
if (audit) {
|
|
4476
|
+
line += `
|
|
4477
|
+
${formatAuditRate(audit)}`;
|
|
4478
|
+
line += `
|
|
4479
|
+
${formatAuditLine(audit)}`;
|
|
4480
|
+
if (audit.hasFailure) {
|
|
4481
|
+
line += `
|
|
4482
|
+
\u26D4 BLOCKED \u2014 security audit failures detected. Review: ${audit.auditUrl}`;
|
|
4483
|
+
return line;
|
|
4484
|
+
}
|
|
4485
|
+
} else {
|
|
4486
|
+
line += `
|
|
4487
|
+
Security: unknown (audit data unavailable)`;
|
|
4488
|
+
}
|
|
4489
|
+
line += `
|
|
4397
4490
|
${r.url}
|
|
4398
|
-
Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")
|
|
4399
|
-
|
|
4491
|
+
Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")\``;
|
|
4492
|
+
return line;
|
|
4493
|
+
}).join("\n\n")
|
|
4400
4494
|
);
|
|
4401
4495
|
}
|
|
4402
4496
|
if (sections.length === 0) {
|
|
@@ -4419,6 +4513,14 @@ Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")\``
|
|
|
4419
4513
|
const projectScope = resolveScope2(args);
|
|
4420
4514
|
const targetPrefix = args.draft ? DRAFTS_PREFIX : SKILLS_PREFIX;
|
|
4421
4515
|
if (args.source === "skills.sh") {
|
|
4516
|
+
const audit = await fetchSkillAudit(args.name);
|
|
4517
|
+
if (audit?.hasFailure) {
|
|
4518
|
+
const failures = audit.results.filter((r) => r.status === "Fail").map((r) => ` \u{1F534} ${r.provider}: Fail (${r.detailUrl})`).join("\n");
|
|
4519
|
+
return `\u26D4 Installation BLOCKED \u2014 security audit failure(s) detected:
|
|
4520
|
+
${failures}
|
|
4521
|
+
|
|
4522
|
+
Review the audit details before proceeding: ${audit.auditUrl}`;
|
|
4523
|
+
}
|
|
4422
4524
|
const downloaded = downloadSkillFromSkillsSh(args.name);
|
|
4423
4525
|
if (!downloaded) {
|
|
4424
4526
|
return `Failed to download skill "${args.name}" from skills.sh.`;
|
|
@@ -4470,7 +4572,19 @@ Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")\``
|
|
|
4470
4572
|
}
|
|
4471
4573
|
const parts = [`${wikiCount} wiki page(s)`];
|
|
4472
4574
|
if (hasBundle) parts.push(`${scriptFiles.length} bundled script(s)`);
|
|
4473
|
-
|
|
4575
|
+
let result = `Installed skill "${downloaded.name}" from skills.sh. ${parts.join(", ")}. Use gitlab_skill_setup to extract scripts.`;
|
|
4576
|
+
if (audit?.hasWarning) {
|
|
4577
|
+
const warnings = audit.results.filter((r) => r.status === "Warn").map((r) => ` \u26A0\uFE0F ${r.provider}: Warn (${r.detailUrl})`).join("\n");
|
|
4578
|
+
result += `
|
|
4579
|
+
|
|
4580
|
+
\u26A0\uFE0F Security audit warnings:
|
|
4581
|
+
${warnings}`;
|
|
4582
|
+
} else if (!audit) {
|
|
4583
|
+
result += `
|
|
4584
|
+
|
|
4585
|
+
(security audit data unavailable \u2014 skills.sh may be unreachable)`;
|
|
4586
|
+
}
|
|
4587
|
+
return result;
|
|
4474
4588
|
} catch (err) {
|
|
4475
4589
|
return `Error installing from skills.sh: ${err.message}`;
|
|
4476
4590
|
}
|