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.js CHANGED
@@ -3930,7 +3930,8 @@ async function writeIndex(instanceUrl, token, scope, id, indexSlug, entries) {
3930
3930
  try {
3931
3931
  await updateWikiPage(instanceUrl, token, scope, id, indexSlug, content);
3932
3932
  } catch (updateErr) {
3933
- if (!updateErr.message?.includes("404")) throw updateErr;
3933
+ if (!updateErr.message?.includes("not found") && !updateErr.message?.includes("404"))
3934
+ throw updateErr;
3934
3935
  await createWikiPage(instanceUrl, token, scope, id, indexSlug, content);
3935
3936
  }
3936
3937
  }
@@ -3955,7 +3956,8 @@ async function upsertPage(instanceUrl, token, scope, id, slug, content) {
3955
3956
  try {
3956
3957
  await updateWikiPage(instanceUrl, token, scope, id, slug, content);
3957
3958
  } catch (updateErr) {
3958
- if (!updateErr.message?.includes("404")) throw updateErr;
3959
+ if (!updateErr.message?.includes("not found") && !updateErr.message?.includes("404"))
3960
+ throw updateErr;
3959
3961
  await createWikiPage(instanceUrl, token, scope, id, slug, content);
3960
3962
  }
3961
3963
  }
@@ -4212,15 +4214,102 @@ Run \`gitlab_skill_setup(name="${args.name}")\` to extract them to .agents/skill
4212
4214
  }
4213
4215
  }),
4214
4216
  gitlab_skill_promote: tool6({
4215
- 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.",
4216
4218
  args: {
4217
4219
  project_id: z6.string().describe(PROJECT_ID_DESC2),
4218
4220
  name: z6.string().describe("Skill name to promote"),
4219
- scope: z6.enum(["projects", "groups"]).optional().describe("Scope (default: projects)"),
4220
- 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)")
4221
4226
  },
4222
4227
  execute: async (args) => {
4223
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
+ return `Promoted skill "${args.name}" to group "${args.group_id}". ${skillPages.length} page(s) copied.`;
4309
+ } catch (err) {
4310
+ return `Error promoting skill to group: ${err.message}`;
4311
+ }
4312
+ }
4224
4313
  const { scope, id } = resolveScope2(args);
4225
4314
  try {
4226
4315
  const pages = await listWikiPages(auth.instanceUrl, auth.token, scope, id, true);