opencode-gitlab-dap 1.15.2 → 1.15.3

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
@@ -3946,83 +3946,6 @@ async function removeIndexEntry(instanceUrl, token, scope, id, indexSlug, name)
3946
3946
  await writeIndex(instanceUrl, token, scope, id, indexSlug, filtered);
3947
3947
  }
3948
3948
  }
3949
- function extractSkillNames(pages, prefix) {
3950
- const skillSuffix = "/SKILL";
3951
- const names = /* @__PURE__ */ new Set();
3952
- for (const p of pages) {
3953
- if (p.slug.startsWith(prefix + "/") && p.slug.endsWith(skillSuffix)) {
3954
- const middle = p.slug.slice(prefix.length + 1, -skillSuffix.length);
3955
- if (middle && !middle.includes("/")) {
3956
- names.add(middle);
3957
- }
3958
- }
3959
- }
3960
- return [...names];
3961
- }
3962
- async function rebuildIndex(instanceUrl, token, scope, id, prefix, indexSlug) {
3963
- const pages = await listWikiPages(instanceUrl, token, scope, id);
3964
- const actualNames = extractSkillNames(pages, prefix);
3965
- const currentEntries = await readIndex(instanceUrl, token, scope, id, indexSlug);
3966
- const indexed = new Set(currentEntries.map((e) => e.name));
3967
- const actual = new Set(actualNames);
3968
- let dirty = false;
3969
- const removed = currentEntries.filter((e) => !actual.has(e.name));
3970
- if (removed.length > 0) dirty = true;
3971
- const added = [];
3972
- for (const name of actualNames) {
3973
- if (!indexed.has(name)) {
3974
- added.push(name);
3975
- dirty = true;
3976
- }
3977
- }
3978
- const staleDescriptions = currentEntries.filter(
3979
- (e) => actual.has(e.name) && (e.description.startsWith("(auto-indexed") || e.description.startsWith("(no description"))
3980
- );
3981
- if (staleDescriptions.length > 0) dirty = true;
3982
- if (!dirty && added.length === 0) return currentEntries;
3983
- const kept = [];
3984
- for (const e of currentEntries) {
3985
- if (!actual.has(e.name)) continue;
3986
- if (e.description.startsWith("(auto-indexed") || e.description.startsWith("(no description")) {
3987
- let description = "";
3988
- try {
3989
- const page = await getWikiPage(instanceUrl, token, scope, id, `${prefix}/${e.name}/SKILL`);
3990
- const content = page.content ?? "";
3991
- const fmMatch = content.match(/^---\s*\n[\s\S]*?description:\s*(.+)\n[\s\S]*?---/);
3992
- if (fmMatch) {
3993
- description = fmMatch[1].trim();
3994
- } else {
3995
- description = content.replace(/^---[\s\S]*?---\s*\n/, "").replace(/^#[^\n]*\n+/, "").split("\n\n")[0].replace(/\n/g, " ").trim().slice(0, 200);
3996
- }
3997
- } catch {
3998
- }
3999
- kept.push({ ...e, description: description || e.description });
4000
- } else {
4001
- kept.push(e);
4002
- }
4003
- }
4004
- for (const name of added) {
4005
- let description = "";
4006
- try {
4007
- const page = await getWikiPage(instanceUrl, token, scope, id, `${prefix}/${name}/SKILL`);
4008
- const content = page.content ?? "";
4009
- const fmMatch = content.match(/^---\s*\n[\s\S]*?description:\s*(.+)\n[\s\S]*?---/);
4010
- if (fmMatch) {
4011
- description = fmMatch[1].trim();
4012
- } else {
4013
- description = content.replace(/^---[\s\S]*?---\s*\n/, "").replace(/^#[^\n]*\n+/, "").split("\n\n")[0].replace(/\n/g, " ").trim().slice(0, 200);
4014
- }
4015
- } catch {
4016
- }
4017
- kept.push({
4018
- name,
4019
- description: description || "(no description \u2014 update with gitlab_skill_save)",
4020
- draft: prefix === DRAFTS_PREFIX
4021
- });
4022
- }
4023
- await writeIndex(instanceUrl, token, scope, id, indexSlug, kept);
4024
- return kept;
4025
- }
4026
3949
  async function upsertPage(instanceUrl, token, scope, id, slug, content) {
4027
3950
  try {
4028
3951
  await updateWikiPage(instanceUrl, token, scope, id, slug, content);
@@ -4147,7 +4070,7 @@ function makeSkillTools(ctx) {
4147
4070
  }
4148
4071
  return {
4149
4072
  gitlab_skill_list: tool6({
4150
- description: "List available project skills and optionally draft skills.\nSkills define step-by-step procedures for common tasks (e.g., incident retros, debugging, deployments).\nAuto-rebuilds the skill index if it is out of sync with actual skill pages.",
4073
+ description: "List available project skills and optionally draft skills.\nSkills define step-by-step procedures for common tasks (e.g., incident retros, debugging, deployments).",
4151
4074
  args: {
4152
4075
  project_id: z6.string().describe(PROJECT_ID_DESC2),
4153
4076
  include_drafts: z6.boolean().optional().describe("Also list draft skills (default: false)"),
@@ -4158,25 +4081,12 @@ function makeSkillTools(ctx) {
4158
4081
  const auth = authAndValidate(args.project_id);
4159
4082
  const { scope, id } = resolveScope2(args);
4160
4083
  try {
4161
- const published = await rebuildIndex(
4162
- auth.instanceUrl,
4163
- auth.token,
4164
- scope,
4165
- id,
4166
- SKILLS_PREFIX,
4167
- SKILLS_INDEX
4168
- );
4084
+ const published = await readIndex(auth.instanceUrl, auth.token, scope, id, SKILLS_INDEX);
4169
4085
  let drafts = [];
4170
4086
  if (args.include_drafts) {
4171
- drafts = await rebuildIndex(
4172
- auth.instanceUrl,
4173
- auth.token,
4174
- scope,
4175
- id,
4176
- DRAFTS_PREFIX,
4177
- DRAFTS_INDEX
4087
+ drafts = (await readIndex(auth.instanceUrl, auth.token, scope, id, DRAFTS_INDEX)).map(
4088
+ (e) => ({ ...e, draft: true })
4178
4089
  );
4179
- drafts = drafts.map((e) => ({ ...e, draft: true }));
4180
4090
  }
4181
4091
  const all = [...published, ...drafts];
4182
4092
  if (all.length === 0) return "No skills found. Use gitlab_skill_save to create one.";