opencode-gitlab-dap 1.15.4 → 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 +40 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +40 -15
- 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`;
|
|
@@ -3954,6 +3955,22 @@ async function upsertPage(instanceUrl, token, scope, id, slug, content) {
|
|
|
3954
3955
|
}
|
|
3955
3956
|
}
|
|
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
|
+
}
|
|
3957
3974
|
function isMarkdownFile(path) {
|
|
3958
3975
|
return path === "SKILL.md" || path.endsWith(".md") || path.endsWith(".markdown");
|
|
3959
3976
|
}
|
|
@@ -4330,16 +4347,14 @@ Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")\``
|
|
|
4330
4347
|
}
|
|
4331
4348
|
let snippetId;
|
|
4332
4349
|
if (scriptFiles.length > 0) {
|
|
4350
|
+
const packed = packFiles(scriptFiles);
|
|
4333
4351
|
const snippet = await createProjectSnippet(
|
|
4334
4352
|
auth.instanceUrl,
|
|
4335
4353
|
auth.token,
|
|
4336
4354
|
args.project_id,
|
|
4337
4355
|
`skill:${downloaded.name}`,
|
|
4338
|
-
`Scripts for skill "${downloaded.name}" (installed from skills.sh:${args.name})`,
|
|
4339
|
-
|
|
4340
|
-
file_path: f.path,
|
|
4341
|
-
content: f.content.trim() ? f.content : EMPTY_FILE_SENTINEL
|
|
4342
|
-
})),
|
|
4356
|
+
`Scripts for skill "${downloaded.name}" (${scriptFiles.length} files, installed from skills.sh:${args.name})`,
|
|
4357
|
+
[{ file_path: `${downloaded.name}.bundle`, content: packed }],
|
|
4343
4358
|
"private"
|
|
4344
4359
|
);
|
|
4345
4360
|
snippetId = snippet.id;
|
|
@@ -4487,27 +4502,37 @@ Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")\``
|
|
|
4487
4502
|
);
|
|
4488
4503
|
const entry = [...indexEntries, ...draftsEntries].find((e) => e.name === args.name);
|
|
4489
4504
|
if (entry?.snippetId) {
|
|
4490
|
-
const
|
|
4505
|
+
const bundleFiles = await listSnippetFiles(
|
|
4491
4506
|
auth.instanceUrl,
|
|
4492
4507
|
auth.token,
|
|
4493
4508
|
args.project_id,
|
|
4494
4509
|
entry.snippetId
|
|
4495
4510
|
);
|
|
4496
|
-
for (const
|
|
4497
|
-
const
|
|
4498
|
-
mkdirSync(dirname(filePath), { recursive: true });
|
|
4499
|
-
const content = await getSnippetFileRaw(
|
|
4511
|
+
for (const bf of bundleFiles) {
|
|
4512
|
+
const raw = await getSnippetFileRaw(
|
|
4500
4513
|
auth.instanceUrl,
|
|
4501
4514
|
auth.token,
|
|
4502
4515
|
args.project_id,
|
|
4503
4516
|
entry.snippetId,
|
|
4504
|
-
|
|
4517
|
+
bf.path
|
|
4505
4518
|
);
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
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++;
|
|
4509
4535
|
}
|
|
4510
|
-
scriptCount++;
|
|
4511
4536
|
}
|
|
4512
4537
|
}
|
|
4513
4538
|
ensureGitignore(process.cwd());
|