opencode-gitlab-dap 1.15.10 → 1.16.1

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/dist/index.js CHANGED
@@ -4214,15 +4214,130 @@ Run \`gitlab_skill_setup(name="${args.name}")\` to extract them to .agents/skill
4214
4214
  }
4215
4215
  }),
4216
4216
  gitlab_skill_promote: tool6({
4217
- description: "Promote a draft skill to published.\nMoves all skill pages from drafts to published and updates both indexes.",
4217
+ description: "Promote a skill.\nDefault (target='published'): moves a draft skill to published within the same scope.\nTarget 'group': copies a published project skill to the group wiki, making it available to all projects in the group.",
4218
4218
  args: {
4219
4219
  project_id: z6.string().describe(PROJECT_ID_DESC2),
4220
4220
  name: z6.string().describe("Skill name to promote"),
4221
- scope: z6.enum(["projects", "groups"]).optional().describe("Scope (default: projects)"),
4222
- group_id: z6.string().optional().describe("Group path (required when scope is groups)")
4221
+ target: z6.enum(["published", "group"]).optional().describe(
4222
+ 'Promotion target: "published" (default, draft\u2192published) or "group" (project\u2192group wiki)'
4223
+ ),
4224
+ group_id: z6.string().optional().describe("Group path (required when target is group)"),
4225
+ scope: z6.enum(["projects", "groups"]).optional().describe("Scope (default: projects)")
4223
4226
  },
4224
4227
  execute: async (args) => {
4225
4228
  const auth = authAndValidate(args.project_id);
4229
+ const promotionTarget = args.target ?? "published";
4230
+ if (promotionTarget === "group") {
4231
+ if (!args.group_id) {
4232
+ return 'Error: group_id is required when target is "group".';
4233
+ }
4234
+ const projectScope = resolveScope2(args);
4235
+ try {
4236
+ const pages = await listWikiPages(
4237
+ auth.instanceUrl,
4238
+ auth.token,
4239
+ projectScope.scope,
4240
+ projectScope.id,
4241
+ true
4242
+ );
4243
+ const skillPrefix = `${SKILLS_PREFIX}/${args.name}/`;
4244
+ const skillPages = pages.filter(
4245
+ (p) => p.slug.startsWith(skillPrefix) && p.content
4246
+ );
4247
+ if (skillPages.length === 0) {
4248
+ return `Skill "${args.name}" not found in project. Use gitlab_skill_list to see available skills.`;
4249
+ }
4250
+ for (const page of skillPages) {
4251
+ await upsertPage(
4252
+ auth.instanceUrl,
4253
+ auth.token,
4254
+ "groups",
4255
+ args.group_id,
4256
+ page.slug,
4257
+ page.content
4258
+ );
4259
+ }
4260
+ const projectIndex = await readIndex(
4261
+ auth.instanceUrl,
4262
+ auth.token,
4263
+ projectScope.scope,
4264
+ projectScope.id,
4265
+ SKILLS_INDEX
4266
+ );
4267
+ const entry = projectIndex.find((e) => e.name === args.name);
4268
+ const description = entry?.description ?? "(promoted from project)";
4269
+ if (entry?.snippetId) {
4270
+ const bundleFiles = await listSnippetFiles(
4271
+ auth.instanceUrl,
4272
+ auth.token,
4273
+ args.project_id,
4274
+ entry.snippetId
4275
+ );
4276
+ for (const bf of bundleFiles) {
4277
+ const raw = await getSnippetFileRaw(
4278
+ auth.instanceUrl,
4279
+ auth.token,
4280
+ args.project_id,
4281
+ entry.snippetId,
4282
+ bf.path
4283
+ );
4284
+ await upsertPage(
4285
+ auth.instanceUrl,
4286
+ auth.token,
4287
+ "groups",
4288
+ args.group_id,
4289
+ `${SKILLS_PREFIX}/${args.name}/bundle/${bf.path}`,
4290
+ raw
4291
+ );
4292
+ }
4293
+ }
4294
+ await upsertIndexEntry(
4295
+ auth.instanceUrl,
4296
+ auth.token,
4297
+ "groups",
4298
+ args.group_id,
4299
+ SKILLS_INDEX,
4300
+ {
4301
+ name: args.name,
4302
+ description,
4303
+ source: `project:${args.project_id}`,
4304
+ snippetId: entry?.snippetId,
4305
+ draft: false
4306
+ }
4307
+ );
4308
+ for (const page of skillPages) {
4309
+ await deleteWikiPage(
4310
+ auth.instanceUrl,
4311
+ auth.token,
4312
+ projectScope.scope,
4313
+ projectScope.id,
4314
+ page.slug
4315
+ );
4316
+ }
4317
+ if (entry?.snippetId) {
4318
+ try {
4319
+ await deleteProjectSnippet(
4320
+ auth.instanceUrl,
4321
+ auth.token,
4322
+ args.project_id,
4323
+ entry.snippetId
4324
+ );
4325
+ } catch {
4326
+ }
4327
+ }
4328
+ await removeIndexEntry(
4329
+ auth.instanceUrl,
4330
+ auth.token,
4331
+ projectScope.scope,
4332
+ projectScope.id,
4333
+ SKILLS_INDEX,
4334
+ args.name
4335
+ );
4336
+ return `Promoted skill "${args.name}" to group "${args.group_id}". ${skillPages.length} page(s) moved (removed from project).`;
4337
+ } catch (err) {
4338
+ return `Error promoting skill to group: ${err.message}`;
4339
+ }
4340
+ }
4226
4341
  const { scope, id } = resolveScope2(args);
4227
4342
  try {
4228
4343
  const pages = await listWikiPages(auth.instanceUrl, auth.token, scope, id, true);