opencode-gitlab-dap 1.15.3 → 1.15.5
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 +41 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3859,6 +3859,7 @@ import {
|
|
|
3859
3859
|
} from "fs";
|
|
3860
3860
|
import { join as join2, dirname } from "path";
|
|
3861
3861
|
import { tmpdir } from "os";
|
|
3862
|
+
import { gzipSync, gunzipSync } from "zlib";
|
|
3862
3863
|
var z6 = tool6.schema;
|
|
3863
3864
|
var PREFIX2 = "agents";
|
|
3864
3865
|
var SKILLS_PREFIX = `${PREFIX2}/skills`;
|
|
@@ -3953,6 +3954,23 @@ async function upsertPage(instanceUrl, token, scope, id, slug, content) {
|
|
|
3953
3954
|
await createWikiPage(instanceUrl, token, scope, id, slug, content);
|
|
3954
3955
|
}
|
|
3955
3956
|
}
|
|
3957
|
+
var EMPTY_FILE_SENTINEL = "__EMPTY_FILE__";
|
|
3958
|
+
function packFiles(files) {
|
|
3959
|
+
const manifest = files.map((f) => ({
|
|
3960
|
+
path: f.path,
|
|
3961
|
+
content: f.content.trim() ? f.content : EMPTY_FILE_SENTINEL
|
|
3962
|
+
}));
|
|
3963
|
+
const json = JSON.stringify(manifest);
|
|
3964
|
+
return gzipSync(Buffer.from(json, "utf-8")).toString("base64");
|
|
3965
|
+
}
|
|
3966
|
+
function unpackFiles(packed) {
|
|
3967
|
+
const json = gunzipSync(Buffer.from(packed, "base64")).toString("utf-8");
|
|
3968
|
+
const manifest = JSON.parse(json);
|
|
3969
|
+
return manifest.map((f) => ({
|
|
3970
|
+
path: f.path,
|
|
3971
|
+
content: f.content === EMPTY_FILE_SENTINEL ? "" : f.content
|
|
3972
|
+
}));
|
|
3973
|
+
}
|
|
3956
3974
|
function isMarkdownFile(path) {
|
|
3957
3975
|
return path === "SKILL.md" || path.endsWith(".md") || path.endsWith(".markdown");
|
|
3958
3976
|
}
|
|
@@ -4329,13 +4347,14 @@ Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")\``
|
|
|
4329
4347
|
}
|
|
4330
4348
|
let snippetId;
|
|
4331
4349
|
if (scriptFiles.length > 0) {
|
|
4350
|
+
const packed = packFiles(scriptFiles);
|
|
4332
4351
|
const snippet = await createProjectSnippet(
|
|
4333
4352
|
auth.instanceUrl,
|
|
4334
4353
|
auth.token,
|
|
4335
4354
|
args.project_id,
|
|
4336
4355
|
`skill:${downloaded.name}`,
|
|
4337
|
-
`Scripts for skill "${downloaded.name}" (installed from skills.sh:${args.name})`,
|
|
4338
|
-
|
|
4356
|
+
`Scripts for skill "${downloaded.name}" (${scriptFiles.length} files, installed from skills.sh:${args.name})`,
|
|
4357
|
+
[{ file_path: `${downloaded.name}.bundle`, content: packed }],
|
|
4339
4358
|
"private"
|
|
4340
4359
|
);
|
|
4341
4360
|
snippetId = snippet.id;
|
|
@@ -4483,27 +4502,37 @@ Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")\``
|
|
|
4483
4502
|
);
|
|
4484
4503
|
const entry = [...indexEntries, ...draftsEntries].find((e) => e.name === args.name);
|
|
4485
4504
|
if (entry?.snippetId) {
|
|
4486
|
-
const
|
|
4505
|
+
const bundleFiles = await listSnippetFiles(
|
|
4487
4506
|
auth.instanceUrl,
|
|
4488
4507
|
auth.token,
|
|
4489
4508
|
args.project_id,
|
|
4490
4509
|
entry.snippetId
|
|
4491
4510
|
);
|
|
4492
|
-
for (const
|
|
4493
|
-
const
|
|
4494
|
-
mkdirSync(dirname(filePath), { recursive: true });
|
|
4495
|
-
const content = await getSnippetFileRaw(
|
|
4511
|
+
for (const bf of bundleFiles) {
|
|
4512
|
+
const raw = await getSnippetFileRaw(
|
|
4496
4513
|
auth.instanceUrl,
|
|
4497
4514
|
auth.token,
|
|
4498
4515
|
args.project_id,
|
|
4499
4516
|
entry.snippetId,
|
|
4500
|
-
|
|
4517
|
+
bf.path
|
|
4501
4518
|
);
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4519
|
+
if (bf.path.endsWith(".bundle")) {
|
|
4520
|
+
const unpacked = unpackFiles(raw);
|
|
4521
|
+
for (const file of unpacked) {
|
|
4522
|
+
const filePath = join2(targetDir, file.path);
|
|
4523
|
+
mkdirSync(dirname(filePath), { recursive: true });
|
|
4524
|
+
writeFileSync(filePath, file.content);
|
|
4525
|
+
if (file.path.endsWith(".sh")) {
|
|
4526
|
+
chmodSync(filePath, 493);
|
|
4527
|
+
}
|
|
4528
|
+
scriptCount++;
|
|
4529
|
+
}
|
|
4530
|
+
} else {
|
|
4531
|
+
const filePath = join2(targetDir, bf.path);
|
|
4532
|
+
mkdirSync(dirname(filePath), { recursive: true });
|
|
4533
|
+
writeFileSync(filePath, raw);
|
|
4534
|
+
scriptCount++;
|
|
4505
4535
|
}
|
|
4506
|
-
scriptCount++;
|
|
4507
4536
|
}
|
|
4508
4537
|
}
|
|
4509
4538
|
ensureGitignore(process.cwd());
|