opencode-gitlab-dap 1.15.2 → 1.15.4
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 +10 -96
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -96
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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);
|
|
@@ -4030,6 +3953,7 @@ async function upsertPage(instanceUrl, token, scope, id, slug, content) {
|
|
|
4030
3953
|
await createWikiPage(instanceUrl, token, scope, id, slug, content);
|
|
4031
3954
|
}
|
|
4032
3955
|
}
|
|
3956
|
+
var EMPTY_FILE_SENTINEL = "__EMPTY_FILE__";
|
|
4033
3957
|
function isMarkdownFile(path) {
|
|
4034
3958
|
return path === "SKILL.md" || path.endsWith(".md") || path.endsWith(".markdown");
|
|
4035
3959
|
}
|
|
@@ -4147,7 +4071,7 @@ function makeSkillTools(ctx) {
|
|
|
4147
4071
|
}
|
|
4148
4072
|
return {
|
|
4149
4073
|
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)
|
|
4074
|
+
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
4075
|
args: {
|
|
4152
4076
|
project_id: z6.string().describe(PROJECT_ID_DESC2),
|
|
4153
4077
|
include_drafts: z6.boolean().optional().describe("Also list draft skills (default: false)"),
|
|
@@ -4158,25 +4082,12 @@ function makeSkillTools(ctx) {
|
|
|
4158
4082
|
const auth = authAndValidate(args.project_id);
|
|
4159
4083
|
const { scope, id } = resolveScope2(args);
|
|
4160
4084
|
try {
|
|
4161
|
-
const published = await
|
|
4162
|
-
auth.instanceUrl,
|
|
4163
|
-
auth.token,
|
|
4164
|
-
scope,
|
|
4165
|
-
id,
|
|
4166
|
-
SKILLS_PREFIX,
|
|
4167
|
-
SKILLS_INDEX
|
|
4168
|
-
);
|
|
4085
|
+
const published = await readIndex(auth.instanceUrl, auth.token, scope, id, SKILLS_INDEX);
|
|
4169
4086
|
let drafts = [];
|
|
4170
4087
|
if (args.include_drafts) {
|
|
4171
|
-
drafts = await
|
|
4172
|
-
|
|
4173
|
-
auth.token,
|
|
4174
|
-
scope,
|
|
4175
|
-
id,
|
|
4176
|
-
DRAFTS_PREFIX,
|
|
4177
|
-
DRAFTS_INDEX
|
|
4088
|
+
drafts = (await readIndex(auth.instanceUrl, auth.token, scope, id, DRAFTS_INDEX)).map(
|
|
4089
|
+
(e) => ({ ...e, draft: true })
|
|
4178
4090
|
);
|
|
4179
|
-
drafts = drafts.map((e) => ({ ...e, draft: true }));
|
|
4180
4091
|
}
|
|
4181
4092
|
const all = [...published, ...drafts];
|
|
4182
4093
|
if (all.length === 0) return "No skills found. Use gitlab_skill_save to create one.";
|
|
@@ -4425,7 +4336,10 @@ Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")\``
|
|
|
4425
4336
|
args.project_id,
|
|
4426
4337
|
`skill:${downloaded.name}`,
|
|
4427
4338
|
`Scripts for skill "${downloaded.name}" (installed from skills.sh:${args.name})`,
|
|
4428
|
-
scriptFiles.map((f) => ({
|
|
4339
|
+
scriptFiles.map((f) => ({
|
|
4340
|
+
file_path: f.path,
|
|
4341
|
+
content: f.content.trim() ? f.content : EMPTY_FILE_SENTINEL
|
|
4342
|
+
})),
|
|
4429
4343
|
"private"
|
|
4430
4344
|
);
|
|
4431
4345
|
snippetId = snippet.id;
|
|
@@ -4589,7 +4503,7 @@ Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")\``
|
|
|
4589
4503
|
entry.snippetId,
|
|
4590
4504
|
file.path
|
|
4591
4505
|
);
|
|
4592
|
-
writeFileSync(filePath, content);
|
|
4506
|
+
writeFileSync(filePath, content.trim() === EMPTY_FILE_SENTINEL ? "" : content);
|
|
4593
4507
|
if (file.path.endsWith(".sh")) {
|
|
4594
4508
|
chmodSync(filePath, 493);
|
|
4595
4509
|
}
|