@synity/bitrix-skills 1.3.3 → 1.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.5
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(install): add generic handler for target:global skill features (bx, bx-crm, bx-calendar)
8
+
9
+ Previously, installing bx, bx-crm, or bx-calendar printed "No install handler" and exited with failure. All three are target:global features — their assets now get copied to ~/.claude/skills/{name}/ via a new installGlobalSkill() helper that resolves the assets dir relative to the package root across all build contexts.
10
+
3
11
  ## 1.3.1
4
12
 
5
13
  ### Patch Changes
package/dist/cli.js CHANGED
@@ -947,8 +947,11 @@ init_esm_shims();
947
947
  import { Command, Option } from "clipanion";
948
948
  import chalk from "chalk";
949
949
  import { existsSync as existsSync4 } from "fs";
950
+ import { access as access4, mkdir as mkdir4, copyFile as copyFile3, readdir as readdir2 } from "fs/promises";
950
951
  import { createInterface } from "readline";
951
- import { join as join4, relative as relative2 } from "path";
952
+ import { dirname as dirname3, join as join4, relative as relative2, resolve as resolve2 } from "path";
953
+ import { fileURLToPath as fileURLToPath5 } from "url";
954
+ import { homedir as homedir2 } from "os";
952
955
 
953
956
  // src/lib/feature-registry.ts
954
957
  init_esm_shims();
@@ -1046,11 +1049,11 @@ function computeChecksum(filepath) {
1046
1049
 
1047
1050
  // src/commands/install.ts
1048
1051
  function promptKey() {
1049
- return new Promise((resolve2) => {
1052
+ return new Promise((resolve3) => {
1050
1053
  const rl = createInterface({ input: process.stdin, output: process.stdout });
1051
1054
  rl.question(chalk.cyan("License key (Enter to skip \u2014 free tier only): "), (answer) => {
1052
1055
  rl.close();
1053
- resolve2(answer.trim());
1056
+ resolve3(answer.trim());
1054
1057
  });
1055
1058
  });
1056
1059
  }
@@ -1086,6 +1089,55 @@ async function installTaskSync(cwd) {
1086
1089
  return { ok: false, message: `task-sync: ${err.message}` };
1087
1090
  }
1088
1091
  }
1092
+ async function getGlobalSkillAssetsDir(name) {
1093
+ const here = dirname3(fileURLToPath5(import.meta.url));
1094
+ const candidates = [
1095
+ resolve2(here, `../../src/features/${name}/assets`),
1096
+ // dist/commands/install.js
1097
+ resolve2(here, `../src/features/${name}/assets`),
1098
+ // dist/cli.js (inlined bundle)
1099
+ resolve2(here, `../features/${name}/assets`)
1100
+ // src/commands/ (dev/ts-node)
1101
+ ];
1102
+ for (const c of candidates) {
1103
+ try {
1104
+ await access4(c);
1105
+ return c;
1106
+ } catch {
1107
+ }
1108
+ }
1109
+ return candidates[0];
1110
+ }
1111
+ async function copyDirRecursive(srcDir, destDir, files) {
1112
+ await mkdir4(destDir, { recursive: true });
1113
+ const entries = await readdir2(srcDir, { withFileTypes: true });
1114
+ for (const entry of entries) {
1115
+ const srcPath = join4(srcDir, entry.name);
1116
+ const destPath = join4(destDir, entry.name);
1117
+ if (entry.isDirectory()) {
1118
+ await copyDirRecursive(srcPath, destPath, files);
1119
+ } else {
1120
+ await copyFile3(srcPath, destPath);
1121
+ files.push(destPath);
1122
+ }
1123
+ }
1124
+ }
1125
+ async function installGlobalSkill(name) {
1126
+ const skillDest = resolve2(homedir2(), ".claude", "skills", name);
1127
+ const installedAbsPaths = [];
1128
+ try {
1129
+ const assetsDir = await getGlobalSkillAssetsDir(name);
1130
+ await copyDirRecursive(assetsDir, skillDest, installedAbsPaths);
1131
+ return {
1132
+ ok: true,
1133
+ message: `${name}: ${installedAbsPaths.length} files \u2192 ${skillDest}`,
1134
+ installPath: skillDest,
1135
+ installedAbsPaths
1136
+ };
1137
+ } catch (err) {
1138
+ return { ok: false, message: `${name}: ${err.message}`, installPath: skillDest, installedAbsPaths };
1139
+ }
1140
+ }
1089
1141
  async function installBxTask(cwd) {
1090
1142
  try {
1091
1143
  const { install: install2 } = await Promise.resolve().then(() => (init_install2(), install_exports2));
@@ -1207,10 +1259,15 @@ Installing ${chalk.bold(name)}...
1207
1259
  ok = r.ok;
1208
1260
  message = r.message;
1209
1261
  if (r.installPath) {
1210
- const { homedir: homedir2 } = await import("os");
1211
- installPath = join4(homedir2(), ".claude", "skills", "bx-task");
1262
+ installPath = resolve2(homedir2(), ".claude", "skills", "bx-task");
1212
1263
  }
1213
1264
  installedAbsPaths = r.installedAbsPaths ?? [];
1265
+ } else if (featureInfo.target === "global") {
1266
+ const r = await installGlobalSkill(name);
1267
+ ok = r.ok;
1268
+ message = r.message;
1269
+ installPath = r.installPath;
1270
+ installedAbsPaths = r.installedAbsPaths;
1214
1271
  } else {
1215
1272
  this.context.stderr.write(chalk.yellow(` ! No install handler for feature: ${name}
1216
1273
  `));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synity/bitrix-skills",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "Multi-feature Bitrix24 tooling CLI for Synity projects",
5
5
  "type": "module",
6
6
  "bin": {