opencode-gitlab-dap 1.14.0 → 1.14.2

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
@@ -3893,12 +3893,48 @@ async function rebuildIndex(instanceUrl, token, scope, id, prefix, indexSlug) {
3893
3893
  dirty = true;
3894
3894
  }
3895
3895
  }
3896
+ const staleDescriptions = currentEntries.filter(
3897
+ (e) => actual.has(e.name) && (e.description.startsWith("(auto-indexed") || e.description.startsWith("(no description"))
3898
+ );
3899
+ if (staleDescriptions.length > 0) dirty = true;
3896
3900
  if (!dirty && added.length === 0) return currentEntries;
3897
- const kept = currentEntries.filter((e) => actual.has(e.name));
3901
+ const kept = [];
3902
+ for (const e of currentEntries) {
3903
+ if (!actual.has(e.name)) continue;
3904
+ if (e.description.startsWith("(auto-indexed") || e.description.startsWith("(no description")) {
3905
+ let description = "";
3906
+ try {
3907
+ const page = await getWikiPage(instanceUrl, token, scope, id, `${prefix}/${e.name}/SKILL`);
3908
+ const content = page.content ?? "";
3909
+ const fmMatch = content.match(/^---\s*\n[\s\S]*?description:\s*(.+)\n[\s\S]*?---/);
3910
+ if (fmMatch) {
3911
+ description = fmMatch[1].trim();
3912
+ } else {
3913
+ description = content.replace(/^---[\s\S]*?---\s*\n/, "").replace(/^#[^\n]*\n+/, "").split("\n\n")[0].replace(/\n/g, " ").trim().slice(0, 200);
3914
+ }
3915
+ } catch {
3916
+ }
3917
+ kept.push({ ...e, description: description || e.description });
3918
+ } else {
3919
+ kept.push(e);
3920
+ }
3921
+ }
3898
3922
  for (const name of added) {
3923
+ let description = "";
3924
+ try {
3925
+ const page = await getWikiPage(instanceUrl, token, scope, id, `${prefix}/${name}/SKILL`);
3926
+ const content = page.content ?? "";
3927
+ const fmMatch = content.match(/^---\s*\n[\s\S]*?description:\s*(.+)\n[\s\S]*?---/);
3928
+ if (fmMatch) {
3929
+ description = fmMatch[1].trim();
3930
+ } else {
3931
+ description = content.replace(/^---[\s\S]*?---\s*\n/, "").replace(/^#[^\n]*\n+/, "").split("\n\n")[0].replace(/\n/g, " ").trim().slice(0, 200);
3932
+ }
3933
+ } catch {
3934
+ }
3899
3935
  kept.push({
3900
3936
  name,
3901
- description: "(auto-indexed \u2014 update description with gitlab_skill_save)",
3937
+ description: description || "(no description \u2014 update with gitlab_skill_save)",
3902
3938
  draft: prefix === DRAFTS_PREFIX
3903
3939
  });
3904
3940
  }