opencode-gitlab-dap 1.15.1 → 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);
@@ -4120,7 +4043,10 @@ function downloadSkillFromSkillsSh(identifier) {
4120
4043
  if (statSync(full).isDirectory()) {
4121
4044
  walkStack.push({ dir: full, prefix: rel });
4122
4045
  } else if (entry !== "SKILL.md") {
4123
- files.push({ path: rel, content: readFileSync2(full, "utf-8") });
4046
+ try {
4047
+ files.push({ path: rel, content: readFileSync2(full, "utf-8") });
4048
+ } catch {
4049
+ }
4124
4050
  }
4125
4051
  }
4126
4052
  }
@@ -4144,7 +4070,7 @@ function makeSkillTools(ctx) {
4144
4070
  }
4145
4071
  return {
4146
4072
  gitlab_skill_list: tool6({
4147
- 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).",
4148
4074
  args: {
4149
4075
  project_id: z6.string().describe(PROJECT_ID_DESC2),
4150
4076
  include_drafts: z6.boolean().optional().describe("Also list draft skills (default: false)"),
@@ -4155,25 +4081,12 @@ function makeSkillTools(ctx) {
4155
4081
  const auth = authAndValidate(args.project_id);
4156
4082
  const { scope, id } = resolveScope2(args);
4157
4083
  try {
4158
- const published = await rebuildIndex(
4159
- auth.instanceUrl,
4160
- auth.token,
4161
- scope,
4162
- id,
4163
- SKILLS_PREFIX,
4164
- SKILLS_INDEX
4165
- );
4084
+ const published = await readIndex(auth.instanceUrl, auth.token, scope, id, SKILLS_INDEX);
4166
4085
  let drafts = [];
4167
4086
  if (args.include_drafts) {
4168
- drafts = await rebuildIndex(
4169
- auth.instanceUrl,
4170
- auth.token,
4171
- scope,
4172
- id,
4173
- DRAFTS_PREFIX,
4174
- DRAFTS_INDEX
4087
+ drafts = (await readIndex(auth.instanceUrl, auth.token, scope, id, DRAFTS_INDEX)).map(
4088
+ (e) => ({ ...e, draft: true })
4175
4089
  );
4176
- drafts = drafts.map((e) => ({ ...e, draft: true }));
4177
4090
  }
4178
4091
  const all = [...published, ...drafts];
4179
4092
  if (all.length === 0) return "No skills found. Use gitlab_skill_save to create one.";
@@ -4422,7 +4335,7 @@ Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")\``
4422
4335
  args.project_id,
4423
4336
  `skill:${downloaded.name}`,
4424
4337
  `Scripts for skill "${downloaded.name}" (installed from skills.sh:${args.name})`,
4425
- scriptFiles.map((f) => ({ file_path: f.path, content: f.content })),
4338
+ scriptFiles.map((f) => ({ file_path: f.path, content: f.content || "\n" })),
4426
4339
  "private"
4427
4340
  );
4428
4341
  snippetId = snippet.id;