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.cjs +9 -96
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -96
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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);
|
|
@@ -4279,7 +4202,10 @@ function downloadSkillFromSkillsSh(identifier) {
|
|
|
4279
4202
|
if ((0, import_fs2.statSync)(full).isDirectory()) {
|
|
4280
4203
|
walkStack.push({ dir: full, prefix: rel });
|
|
4281
4204
|
} else if (entry !== "SKILL.md") {
|
|
4282
|
-
|
|
4205
|
+
try {
|
|
4206
|
+
files.push({ path: rel, content: (0, import_fs2.readFileSync)(full, "utf-8") });
|
|
4207
|
+
} catch {
|
|
4208
|
+
}
|
|
4283
4209
|
}
|
|
4284
4210
|
}
|
|
4285
4211
|
}
|
|
@@ -4303,7 +4229,7 @@ function makeSkillTools(ctx) {
|
|
|
4303
4229
|
}
|
|
4304
4230
|
return {
|
|
4305
4231
|
gitlab_skill_list: (0, import_plugin6.tool)({
|
|
4306
|
-
description: "List available project skills and optionally draft skills.\nSkills define step-by-step procedures for common tasks (e.g., incident retros, debugging, deployments)
|
|
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).",
|
|
4307
4233
|
args: {
|
|
4308
4234
|
project_id: z6.string().describe(PROJECT_ID_DESC2),
|
|
4309
4235
|
include_drafts: z6.boolean().optional().describe("Also list draft skills (default: false)"),
|
|
@@ -4314,25 +4240,12 @@ function makeSkillTools(ctx) {
|
|
|
4314
4240
|
const auth = authAndValidate(args.project_id);
|
|
4315
4241
|
const { scope, id } = resolveScope2(args);
|
|
4316
4242
|
try {
|
|
4317
|
-
const published = await
|
|
4318
|
-
auth.instanceUrl,
|
|
4319
|
-
auth.token,
|
|
4320
|
-
scope,
|
|
4321
|
-
id,
|
|
4322
|
-
SKILLS_PREFIX,
|
|
4323
|
-
SKILLS_INDEX
|
|
4324
|
-
);
|
|
4243
|
+
const published = await readIndex(auth.instanceUrl, auth.token, scope, id, SKILLS_INDEX);
|
|
4325
4244
|
let drafts = [];
|
|
4326
4245
|
if (args.include_drafts) {
|
|
4327
|
-
drafts = await
|
|
4328
|
-
|
|
4329
|
-
auth.token,
|
|
4330
|
-
scope,
|
|
4331
|
-
id,
|
|
4332
|
-
DRAFTS_PREFIX,
|
|
4333
|
-
DRAFTS_INDEX
|
|
4246
|
+
drafts = (await readIndex(auth.instanceUrl, auth.token, scope, id, DRAFTS_INDEX)).map(
|
|
4247
|
+
(e) => ({ ...e, draft: true })
|
|
4334
4248
|
);
|
|
4335
|
-
drafts = drafts.map((e) => ({ ...e, draft: true }));
|
|
4336
4249
|
}
|
|
4337
4250
|
const all = [...published, ...drafts];
|
|
4338
4251
|
if (all.length === 0) return "No skills found. Use gitlab_skill_save to create one.";
|
|
@@ -4581,7 +4494,7 @@ Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")\``
|
|
|
4581
4494
|
args.project_id,
|
|
4582
4495
|
`skill:${downloaded.name}`,
|
|
4583
4496
|
`Scripts for skill "${downloaded.name}" (installed from skills.sh:${args.name})`,
|
|
4584
|
-
scriptFiles.map((f) => ({ file_path: f.path, content: f.content })),
|
|
4497
|
+
scriptFiles.map((f) => ({ file_path: f.path, content: f.content || "\n" })),
|
|
4585
4498
|
"private"
|
|
4586
4499
|
);
|
|
4587
4500
|
snippetId = snippet.id;
|