opencode-gitlab-dap 1.15.9 → 1.16.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/dist/index.cjs CHANGED
@@ -4089,7 +4089,8 @@ async function writeIndex(instanceUrl, token, scope, id, indexSlug, entries) {
4089
4089
  try {
4090
4090
  await updateWikiPage(instanceUrl, token, scope, id, indexSlug, content);
4091
4091
  } catch (updateErr) {
4092
- if (!updateErr.message?.includes("404")) throw updateErr;
4092
+ if (!updateErr.message?.includes("not found") && !updateErr.message?.includes("404"))
4093
+ throw updateErr;
4093
4094
  await createWikiPage(instanceUrl, token, scope, id, indexSlug, content);
4094
4095
  }
4095
4096
  }
@@ -4114,7 +4115,8 @@ async function upsertPage(instanceUrl, token, scope, id, slug, content) {
4114
4115
  try {
4115
4116
  await updateWikiPage(instanceUrl, token, scope, id, slug, content);
4116
4117
  } catch (updateErr) {
4117
- if (!updateErr.message?.includes("404")) throw updateErr;
4118
+ if (!updateErr.message?.includes("not found") && !updateErr.message?.includes("404"))
4119
+ throw updateErr;
4118
4120
  await createWikiPage(instanceUrl, token, scope, id, slug, content);
4119
4121
  }
4120
4122
  }
@@ -4371,15 +4373,102 @@ Run \`gitlab_skill_setup(name="${args.name}")\` to extract them to .agents/skill
4371
4373
  }
4372
4374
  }),
4373
4375
  gitlab_skill_promote: (0, import_plugin6.tool)({
4374
- description: "Promote a draft skill to published.\nMoves all skill pages from drafts to published and updates both indexes.",
4376
+ 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.",
4375
4377
  args: {
4376
4378
  project_id: z6.string().describe(PROJECT_ID_DESC2),
4377
4379
  name: z6.string().describe("Skill name to promote"),
4378
- scope: z6.enum(["projects", "groups"]).optional().describe("Scope (default: projects)"),
4379
- group_id: z6.string().optional().describe("Group path (required when scope is groups)")
4380
+ target: z6.enum(["published", "group"]).optional().describe(
4381
+ 'Promotion target: "published" (default, draft\u2192published) or "group" (project\u2192group wiki)'
4382
+ ),
4383
+ group_id: z6.string().optional().describe("Group path (required when target is group)"),
4384
+ scope: z6.enum(["projects", "groups"]).optional().describe("Scope (default: projects)")
4380
4385
  },
4381
4386
  execute: async (args) => {
4382
4387
  const auth = authAndValidate(args.project_id);
4388
+ const promotionTarget = args.target ?? "published";
4389
+ if (promotionTarget === "group") {
4390
+ if (!args.group_id) {
4391
+ return 'Error: group_id is required when target is "group".';
4392
+ }
4393
+ const projectScope = resolveScope2(args);
4394
+ try {
4395
+ const pages = await listWikiPages(
4396
+ auth.instanceUrl,
4397
+ auth.token,
4398
+ projectScope.scope,
4399
+ projectScope.id,
4400
+ true
4401
+ );
4402
+ const skillPrefix = `${SKILLS_PREFIX}/${args.name}/`;
4403
+ const skillPages = pages.filter(
4404
+ (p) => p.slug.startsWith(skillPrefix) && p.content
4405
+ );
4406
+ if (skillPages.length === 0) {
4407
+ return `Skill "${args.name}" not found in project. Use gitlab_skill_list to see available skills.`;
4408
+ }
4409
+ for (const page of skillPages) {
4410
+ await upsertPage(
4411
+ auth.instanceUrl,
4412
+ auth.token,
4413
+ "groups",
4414
+ args.group_id,
4415
+ page.slug,
4416
+ page.content
4417
+ );
4418
+ }
4419
+ const projectIndex = await readIndex(
4420
+ auth.instanceUrl,
4421
+ auth.token,
4422
+ projectScope.scope,
4423
+ projectScope.id,
4424
+ SKILLS_INDEX
4425
+ );
4426
+ const entry = projectIndex.find((e) => e.name === args.name);
4427
+ const description = entry?.description ?? "(promoted from project)";
4428
+ if (entry?.snippetId) {
4429
+ const bundleFiles = await listSnippetFiles(
4430
+ auth.instanceUrl,
4431
+ auth.token,
4432
+ args.project_id,
4433
+ entry.snippetId
4434
+ );
4435
+ for (const bf of bundleFiles) {
4436
+ const raw = await getSnippetFileRaw(
4437
+ auth.instanceUrl,
4438
+ auth.token,
4439
+ args.project_id,
4440
+ entry.snippetId,
4441
+ bf.path
4442
+ );
4443
+ await upsertPage(
4444
+ auth.instanceUrl,
4445
+ auth.token,
4446
+ "groups",
4447
+ args.group_id,
4448
+ `${SKILLS_PREFIX}/${args.name}/bundle/${bf.path}`,
4449
+ raw
4450
+ );
4451
+ }
4452
+ }
4453
+ await upsertIndexEntry(
4454
+ auth.instanceUrl,
4455
+ auth.token,
4456
+ "groups",
4457
+ args.group_id,
4458
+ SKILLS_INDEX,
4459
+ {
4460
+ name: args.name,
4461
+ description,
4462
+ source: `project:${args.project_id}`,
4463
+ snippetId: entry?.snippetId,
4464
+ draft: false
4465
+ }
4466
+ );
4467
+ return `Promoted skill "${args.name}" to group "${args.group_id}". ${skillPages.length} page(s) copied.`;
4468
+ } catch (err) {
4469
+ return `Error promoting skill to group: ${err.message}`;
4470
+ }
4471
+ }
4383
4472
  const { scope, id } = resolveScope2(args);
4384
4473
  try {
4385
4474
  const pages = await listWikiPages(auth.instanceUrl, auth.token, scope, id, true);