opencode-gitlab-dap 1.15.5 → 1.15.6

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
@@ -4136,8 +4136,9 @@ function makeSkillTools(ctx) {
4136
4136
  `${prefix}/${args.name}/SKILL`
4137
4137
  );
4138
4138
  const pages = await listWikiPages(auth.instanceUrl, auth.token, scope, id);
4139
- const refPrefix = `${prefix}/${args.name}/references/`;
4140
- const refs = pages.filter((p) => p.slug.startsWith(refPrefix)).map((p) => p.slug.slice(refPrefix.length));
4139
+ const skillPrefix = `${prefix}/${args.name}/`;
4140
+ const skillSlug = `${prefix}/${args.name}/SKILL`;
4141
+ const refs = pages.filter((p) => p.slug.startsWith(skillPrefix) && p.slug !== skillSlug).map((p) => p.slug.slice(skillPrefix.length));
4141
4142
  const isDraft = prefix === DRAFTS_PREFIX;
4142
4143
  let result = isDraft ? `[DRAFT SKILL]
4143
4144
 
@@ -4247,16 +4248,21 @@ Run \`gitlab_skill_setup(name="${args.name}")\` to extract them to .agents/skill
4247
4248
  }
4248
4249
  }),
4249
4250
  gitlab_skill_discover: tool6({
4250
- description: "Search for skills in the group wiki and the skills.sh public registry.\nGroup wiki skills are searched first, then skills.sh for community skills.\nUse gitlab_skill_install to install a discovered skill into your project.",
4251
+ description: "Search for skills in the skills.sh public registry and optionally a group wiki.\nUse gitlab_skill_install to install a discovered skill into your project.\nIMPORTANT: project_id is only needed when searching a group wiki. For skills.sh only, it is optional.",
4251
4252
  args: {
4252
- project_id: z6.string().describe(PROJECT_ID_DESC2),
4253
4253
  query: z6.string().describe("Search query (matches skill name and description)"),
4254
+ project_id: z6.string().optional().describe(PROJECT_ID_DESC2 + " Only needed for group wiki search."),
4254
4255
  group_id: z6.string().optional().describe("Group path to search for shared skills (optional)")
4255
4256
  },
4256
4257
  execute: async (args) => {
4257
- const auth = authAndValidate(args.project_id);
4258
+ let auth = null;
4259
+ if (args.project_id) {
4260
+ auth = authAndValidate(args.project_id);
4261
+ } else if (args.group_id) {
4262
+ return "Error: project_id is required when searching a group wiki.";
4263
+ }
4258
4264
  const sections = [];
4259
- if (args.group_id) {
4265
+ if (args.group_id && auth) {
4260
4266
  try {
4261
4267
  const entries = await readIndex(
4262
4268
  auth.instanceUrl,
@@ -4334,7 +4340,7 @@ Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")\``
4334
4340
  const mdFiles = downloaded.files.filter((f) => isMarkdownFile(f.path));
4335
4341
  const scriptFiles = downloaded.files.filter((f) => !isMarkdownFile(f.path));
4336
4342
  for (const file of mdFiles) {
4337
- const slug = `${targetPrefix}/${downloaded.name}/references/${file.path.replace(/\.[^.]+$/, "")}`;
4343
+ const slug = `${targetPrefix}/${downloaded.name}/${file.path.replace(/\.[^.]+$/, "")}`;
4338
4344
  await upsertPage(
4339
4345
  auth.instanceUrl,
4340
4346
  auth.token,
@@ -4473,15 +4479,15 @@ Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")\``
4473
4479
  const pages = await listWikiPages(auth.instanceUrl, auth.token, scope, id, true);
4474
4480
  let refCount = 0;
4475
4481
  for (const prefix of [SKILLS_PREFIX, DRAFTS_PREFIX]) {
4476
- const refPrefix = `${prefix}/${args.name}/references/`;
4477
- const refPages = pages.filter(
4478
- (p) => p.slug.startsWith(refPrefix) && p.content
4482
+ const skillPagePrefix = `${prefix}/${args.name}/`;
4483
+ const extraPages = pages.filter(
4484
+ (p) => p.slug.startsWith(skillPagePrefix) && p.slug !== `${prefix}/${args.name}/SKILL` && p.content
4479
4485
  );
4480
- for (const ref of refPages) {
4481
- const refName = ref.slug.slice(refPrefix.length);
4482
- const refDir = join2(targetDir, "references");
4483
- mkdirSync(refDir, { recursive: true });
4484
- writeFileSync(join2(refDir, `${refName}.md`), ref.content);
4486
+ for (const page of extraPages) {
4487
+ const relPath = page.slug.slice(skillPagePrefix.length);
4488
+ const filePath = join2(targetDir, `${relPath}.md`);
4489
+ mkdirSync(dirname(filePath), { recursive: true });
4490
+ writeFileSync(filePath, page.content);
4485
4491
  refCount++;
4486
4492
  }
4487
4493
  }