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.cjs CHANGED
@@ -4105,83 +4105,6 @@ async function removeIndexEntry(instanceUrl, token, scope, id, indexSlug, name)
4105
4105
  await writeIndex(instanceUrl, token, scope, id, indexSlug, filtered);
4106
4106
  }
4107
4107
  }
4108
- function extractSkillNames(pages, prefix) {
4109
- const skillSuffix = "/SKILL";
4110
- const names = /* @__PURE__ */ new Set();
4111
- for (const p of pages) {
4112
- if (p.slug.startsWith(prefix + "/") && p.slug.endsWith(skillSuffix)) {
4113
- const middle = p.slug.slice(prefix.length + 1, -skillSuffix.length);
4114
- if (middle && !middle.includes("/")) {
4115
- names.add(middle);
4116
- }
4117
- }
4118
- }
4119
- return [...names];
4120
- }
4121
- async function rebuildIndex(instanceUrl, token, scope, id, prefix, indexSlug) {
4122
- const pages = await listWikiPages(instanceUrl, token, scope, id);
4123
- const actualNames = extractSkillNames(pages, prefix);
4124
- const currentEntries = await readIndex(instanceUrl, token, scope, id, indexSlug);
4125
- const indexed = new Set(currentEntries.map((e) => e.name));
4126
- const actual = new Set(actualNames);
4127
- let dirty = false;
4128
- const removed = currentEntries.filter((e) => !actual.has(e.name));
4129
- if (removed.length > 0) dirty = true;
4130
- const added = [];
4131
- for (const name of actualNames) {
4132
- if (!indexed.has(name)) {
4133
- added.push(name);
4134
- dirty = true;
4135
- }
4136
- }
4137
- const staleDescriptions = currentEntries.filter(
4138
- (e) => actual.has(e.name) && (e.description.startsWith("(auto-indexed") || e.description.startsWith("(no description"))
4139
- );
4140
- if (staleDescriptions.length > 0) dirty = true;
4141
- if (!dirty && added.length === 0) return currentEntries;
4142
- const kept = [];
4143
- for (const e of currentEntries) {
4144
- if (!actual.has(e.name)) continue;
4145
- if (e.description.startsWith("(auto-indexed") || e.description.startsWith("(no description")) {
4146
- let description = "";
4147
- try {
4148
- const page = await getWikiPage(instanceUrl, token, scope, id, `${prefix}/${e.name}/SKILL`);
4149
- const content = page.content ?? "";
4150
- const fmMatch = content.match(/^---\s*\n[\s\S]*?description:\s*(.+)\n[\s\S]*?---/);
4151
- if (fmMatch) {
4152
- description = fmMatch[1].trim();
4153
- } else {
4154
- description = content.replace(/^---[\s\S]*?---\s*\n/, "").replace(/^#[^\n]*\n+/, "").split("\n\n")[0].replace(/\n/g, " ").trim().slice(0, 200);
4155
- }
4156
- } catch {
4157
- }
4158
- kept.push({ ...e, description: description || e.description });
4159
- } else {
4160
- kept.push(e);
4161
- }
4162
- }
4163
- for (const name of added) {
4164
- let description = "";
4165
- try {
4166
- const page = await getWikiPage(instanceUrl, token, scope, id, `${prefix}/${name}/SKILL`);
4167
- const content = page.content ?? "";
4168
- const fmMatch = content.match(/^---\s*\n[\s\S]*?description:\s*(.+)\n[\s\S]*?---/);
4169
- if (fmMatch) {
4170
- description = fmMatch[1].trim();
4171
- } else {
4172
- description = content.replace(/^---[\s\S]*?---\s*\n/, "").replace(/^#[^\n]*\n+/, "").split("\n\n")[0].replace(/\n/g, " ").trim().slice(0, 200);
4173
- }
4174
- } catch {
4175
- }
4176
- kept.push({
4177
- name,
4178
- description: description || "(no description \u2014 update with gitlab_skill_save)",
4179
- draft: prefix === DRAFTS_PREFIX
4180
- });
4181
- }
4182
- await writeIndex(instanceUrl, token, scope, id, indexSlug, kept);
4183
- return kept;
4184
- }
4185
4108
  async function upsertPage(instanceUrl, token, scope, id, slug, content) {
4186
4109
  try {
4187
4110
  await updateWikiPage(instanceUrl, token, scope, id, slug, content);
@@ -4306,7 +4229,7 @@ function makeSkillTools(ctx) {
4306
4229
  }
4307
4230
  return {
4308
4231
  gitlab_skill_list: (0, import_plugin6.tool)({
4309
- 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.",
4232
+ description: "List available project skills and optionally draft skills.\nSkills define step-by-step procedures for common tasks (e.g., incident retros, debugging, deployments).",
4310
4233
  args: {
4311
4234
  project_id: z6.string().describe(PROJECT_ID_DESC2),
4312
4235
  include_drafts: z6.boolean().optional().describe("Also list draft skills (default: false)"),
@@ -4317,25 +4240,12 @@ function makeSkillTools(ctx) {
4317
4240
  const auth = authAndValidate(args.project_id);
4318
4241
  const { scope, id } = resolveScope2(args);
4319
4242
  try {
4320
- const published = await rebuildIndex(
4321
- auth.instanceUrl,
4322
- auth.token,
4323
- scope,
4324
- id,
4325
- SKILLS_PREFIX,
4326
- SKILLS_INDEX
4327
- );
4243
+ const published = await readIndex(auth.instanceUrl, auth.token, scope, id, SKILLS_INDEX);
4328
4244
  let drafts = [];
4329
4245
  if (args.include_drafts) {
4330
- drafts = await rebuildIndex(
4331
- auth.instanceUrl,
4332
- auth.token,
4333
- scope,
4334
- id,
4335
- DRAFTS_PREFIX,
4336
- DRAFTS_INDEX
4246
+ drafts = (await readIndex(auth.instanceUrl, auth.token, scope, id, DRAFTS_INDEX)).map(
4247
+ (e) => ({ ...e, draft: true })
4337
4248
  );
4338
- drafts = drafts.map((e) => ({ ...e, draft: true }));
4339
4249
  }
4340
4250
  const all = [...published, ...drafts];
4341
4251
  if (all.length === 0) return "No skills found. Use gitlab_skill_save to create one.";