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.cjs
CHANGED
|
@@ -4018,6 +4018,7 @@ var import_child_process = require("child_process");
|
|
|
4018
4018
|
var import_fs2 = require("fs");
|
|
4019
4019
|
var import_path2 = require("path");
|
|
4020
4020
|
var import_os2 = require("os");
|
|
4021
|
+
var import_zlib = require("zlib");
|
|
4021
4022
|
var z6 = import_plugin6.tool.schema;
|
|
4022
4023
|
var PREFIX2 = "agents";
|
|
4023
4024
|
var SKILLS_PREFIX = `${PREFIX2}/skills`;
|
|
@@ -4112,6 +4113,23 @@ async function upsertPage(instanceUrl, token, scope, id, slug, content) {
|
|
|
4112
4113
|
await createWikiPage(instanceUrl, token, scope, id, slug, content);
|
|
4113
4114
|
}
|
|
4114
4115
|
}
|
|
4116
|
+
var EMPTY_FILE_SENTINEL = "__EMPTY_FILE__";
|
|
4117
|
+
function packFiles(files) {
|
|
4118
|
+
const manifest = files.map((f) => ({
|
|
4119
|
+
path: f.path,
|
|
4120
|
+
content: f.content.trim() ? f.content : EMPTY_FILE_SENTINEL
|
|
4121
|
+
}));
|
|
4122
|
+
const json = JSON.stringify(manifest);
|
|
4123
|
+
return (0, import_zlib.gzipSync)(Buffer.from(json, "utf-8")).toString("base64");
|
|
4124
|
+
}
|
|
4125
|
+
function unpackFiles(packed) {
|
|
4126
|
+
const json = (0, import_zlib.gunzipSync)(Buffer.from(packed, "base64")).toString("utf-8");
|
|
4127
|
+
const manifest = JSON.parse(json);
|
|
4128
|
+
return manifest.map((f) => ({
|
|
4129
|
+
path: f.path,
|
|
4130
|
+
content: f.content === EMPTY_FILE_SENTINEL ? "" : f.content
|
|
4131
|
+
}));
|
|
4132
|
+
}
|
|
4115
4133
|
function isMarkdownFile(path) {
|
|
4116
4134
|
return path === "SKILL.md" || path.endsWith(".md") || path.endsWith(".markdown");
|
|
4117
4135
|
}
|
|
@@ -4488,13 +4506,14 @@ Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")\``
|
|
|
4488
4506
|
}
|
|
4489
4507
|
let snippetId;
|
|
4490
4508
|
if (scriptFiles.length > 0) {
|
|
4509
|
+
const packed = packFiles(scriptFiles);
|
|
4491
4510
|
const snippet = await createProjectSnippet(
|
|
4492
4511
|
auth.instanceUrl,
|
|
4493
4512
|
auth.token,
|
|
4494
4513
|
args.project_id,
|
|
4495
4514
|
`skill:${downloaded.name}`,
|
|
4496
|
-
`Scripts for skill "${downloaded.name}" (installed from skills.sh:${args.name})`,
|
|
4497
|
-
|
|
4515
|
+
`Scripts for skill "${downloaded.name}" (${scriptFiles.length} files, installed from skills.sh:${args.name})`,
|
|
4516
|
+
[{ file_path: `${downloaded.name}.bundle`, content: packed }],
|
|
4498
4517
|
"private"
|
|
4499
4518
|
);
|
|
4500
4519
|
snippetId = snippet.id;
|
|
@@ -4642,27 +4661,37 @@ Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")\``
|
|
|
4642
4661
|
);
|
|
4643
4662
|
const entry = [...indexEntries, ...draftsEntries].find((e) => e.name === args.name);
|
|
4644
4663
|
if (entry?.snippetId) {
|
|
4645
|
-
const
|
|
4664
|
+
const bundleFiles = await listSnippetFiles(
|
|
4646
4665
|
auth.instanceUrl,
|
|
4647
4666
|
auth.token,
|
|
4648
4667
|
args.project_id,
|
|
4649
4668
|
entry.snippetId
|
|
4650
4669
|
);
|
|
4651
|
-
for (const
|
|
4652
|
-
const
|
|
4653
|
-
(0, import_fs2.mkdirSync)((0, import_path2.dirname)(filePath), { recursive: true });
|
|
4654
|
-
const content = await getSnippetFileRaw(
|
|
4670
|
+
for (const bf of bundleFiles) {
|
|
4671
|
+
const raw = await getSnippetFileRaw(
|
|
4655
4672
|
auth.instanceUrl,
|
|
4656
4673
|
auth.token,
|
|
4657
4674
|
args.project_id,
|
|
4658
4675
|
entry.snippetId,
|
|
4659
|
-
|
|
4676
|
+
bf.path
|
|
4660
4677
|
);
|
|
4661
|
-
(
|
|
4662
|
-
|
|
4663
|
-
(
|
|
4678
|
+
if (bf.path.endsWith(".bundle")) {
|
|
4679
|
+
const unpacked = unpackFiles(raw);
|
|
4680
|
+
for (const file of unpacked) {
|
|
4681
|
+
const filePath = (0, import_path2.join)(targetDir, file.path);
|
|
4682
|
+
(0, import_fs2.mkdirSync)((0, import_path2.dirname)(filePath), { recursive: true });
|
|
4683
|
+
(0, import_fs2.writeFileSync)(filePath, file.content);
|
|
4684
|
+
if (file.path.endsWith(".sh")) {
|
|
4685
|
+
(0, import_fs2.chmodSync)(filePath, 493);
|
|
4686
|
+
}
|
|
4687
|
+
scriptCount++;
|
|
4688
|
+
}
|
|
4689
|
+
} else {
|
|
4690
|
+
const filePath = (0, import_path2.join)(targetDir, bf.path);
|
|
4691
|
+
(0, import_fs2.mkdirSync)((0, import_path2.dirname)(filePath), { recursive: true });
|
|
4692
|
+
(0, import_fs2.writeFileSync)(filePath, raw);
|
|
4693
|
+
scriptCount++;
|
|
4664
4694
|
}
|
|
4665
|
-
scriptCount++;
|
|
4666
4695
|
}
|
|
4667
4696
|
}
|
|
4668
4697
|
ensureGitignore(process.cwd());
|