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 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`;
@@ -4113,6 +4114,22 @@ async function upsertPage(instanceUrl, token, scope, id, slug, content) {
4113
4114
  }
4114
4115
  }
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
+ }
4116
4133
  function isMarkdownFile(path) {
4117
4134
  return path === "SKILL.md" || path.endsWith(".md") || path.endsWith(".markdown");
4118
4135
  }
@@ -4489,16 +4506,14 @@ Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")\``
4489
4506
  }
4490
4507
  let snippetId;
4491
4508
  if (scriptFiles.length > 0) {
4509
+ const packed = packFiles(scriptFiles);
4492
4510
  const snippet = await createProjectSnippet(
4493
4511
  auth.instanceUrl,
4494
4512
  auth.token,
4495
4513
  args.project_id,
4496
4514
  `skill:${downloaded.name}`,
4497
- `Scripts for skill "${downloaded.name}" (installed from skills.sh:${args.name})`,
4498
- scriptFiles.map((f) => ({
4499
- file_path: f.path,
4500
- content: f.content.trim() ? f.content : EMPTY_FILE_SENTINEL
4501
- })),
4515
+ `Scripts for skill "${downloaded.name}" (${scriptFiles.length} files, installed from skills.sh:${args.name})`,
4516
+ [{ file_path: `${downloaded.name}.bundle`, content: packed }],
4502
4517
  "private"
4503
4518
  );
4504
4519
  snippetId = snippet.id;
@@ -4646,27 +4661,37 @@ Install: \`gitlab_skill_install(name="${r.identifier}", source="skills.sh")\``
4646
4661
  );
4647
4662
  const entry = [...indexEntries, ...draftsEntries].find((e) => e.name === args.name);
4648
4663
  if (entry?.snippetId) {
4649
- const files = await listSnippetFiles(
4664
+ const bundleFiles = await listSnippetFiles(
4650
4665
  auth.instanceUrl,
4651
4666
  auth.token,
4652
4667
  args.project_id,
4653
4668
  entry.snippetId
4654
4669
  );
4655
- for (const file of files) {
4656
- const filePath = (0, import_path2.join)(targetDir, file.path);
4657
- (0, import_fs2.mkdirSync)((0, import_path2.dirname)(filePath), { recursive: true });
4658
- const content = await getSnippetFileRaw(
4670
+ for (const bf of bundleFiles) {
4671
+ const raw = await getSnippetFileRaw(
4659
4672
  auth.instanceUrl,
4660
4673
  auth.token,
4661
4674
  args.project_id,
4662
4675
  entry.snippetId,
4663
- file.path
4676
+ bf.path
4664
4677
  );
4665
- (0, import_fs2.writeFileSync)(filePath, content.trim() === EMPTY_FILE_SENTINEL ? "" : content);
4666
- if (file.path.endsWith(".sh")) {
4667
- (0, import_fs2.chmodSync)(filePath, 493);
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++;
4668
4694
  }
4669
- scriptCount++;
4670
4695
  }
4671
4696
  }
4672
4697
  ensureGitignore(process.cwd());