@hasna/skills 0.1.45 → 0.1.46

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/bin/index.js CHANGED
@@ -36860,7 +36860,7 @@ var package_default;
36860
36860
  var init_package = __esm(() => {
36861
36861
  package_default = {
36862
36862
  name: "@hasna/skills",
36863
- version: "0.1.45",
36863
+ version: "0.1.46",
36864
36864
  description: "Skills library for AI coding agents",
36865
36865
  type: "module",
36866
36866
  bin: {
@@ -39089,12 +39089,47 @@ function ensurePortableSkillFiles(skillPath, manifest) {
39089
39089
  writeFileSync2(join5(skillPath, "skill.json"), renderSkillJson(next));
39090
39090
  if (!existsSync5(join5(skillPath, "AGENTS.md")))
39091
39091
  writeFileSync2(join5(skillPath, "AGENTS.md"), renderAgentsMd(next));
39092
- if (!existsSync5(join5(skillPath, "package.json")))
39093
- writeFileSync2(join5(skillPath, "package.json"), renderPackageJson(next));
39092
+ ensurePackageJson(skillPath, next);
39094
39093
  if (!existsSync5(join5(skillPath, "tsconfig.json")))
39095
39094
  writeFileSync2(join5(skillPath, "tsconfig.json"), renderTsconfig());
39096
39095
  return readPortableSkillManifest(skillPath, next.name);
39097
39096
  }
39097
+ function ensurePackageJson(skillPath, manifest) {
39098
+ const pkgPath = join5(skillPath, "package.json");
39099
+ const first = manifest.commands[0] ?? { name: manifest.name, entry: "src/index.ts" };
39100
+ const commandName = normalizePortableSkillName(first.name || manifest.name);
39101
+ const entry = (first.entry ?? "src/index.ts").replace(/^\.\//, "");
39102
+ if (!existsSync5(pkgPath)) {
39103
+ writeFileSync2(pkgPath, renderPackageJson(manifest));
39104
+ return;
39105
+ }
39106
+ const existing = readJsonObject(pkgPath);
39107
+ const bin = {};
39108
+ if (isRecord(existing.bin)) {
39109
+ for (const [name, value] of Object.entries(existing.bin)) {
39110
+ if (typeof value === "string" && value.trim())
39111
+ bin[normalizePortableSkillName(name)] = value.replace(/^\.\//, "");
39112
+ }
39113
+ } else {
39114
+ const binEntry = stringValue(existing.bin);
39115
+ if (binEntry)
39116
+ bin[manifest.name] = binEntry.replace(/^\.\//, "");
39117
+ }
39118
+ bin[commandName] = entry;
39119
+ const scripts = isRecord(existing.scripts) ? { ...existing.scripts } : {};
39120
+ if (!stringValue(scripts.dev))
39121
+ scripts.dev = `bun run ${entry}`;
39122
+ writeFileSync2(pkgPath, `${JSON.stringify({
39123
+ ...existing,
39124
+ name: manifest.name,
39125
+ version: manifest.version,
39126
+ description: manifest.description,
39127
+ type: stringValue(existing.type) ?? "module",
39128
+ bin,
39129
+ scripts
39130
+ }, null, 2)}
39131
+ `);
39132
+ }
39098
39133
  function copySkillDirectory(source, destination) {
39099
39134
  mkdirSync2(destination, { recursive: true });
39100
39135
  cpSync(source, destination, {
package/bin/mcp.js CHANGED
@@ -21797,7 +21797,7 @@ class StdioServerTransport {
21797
21797
  // package.json
21798
21798
  var package_default = {
21799
21799
  name: "@hasna/skills",
21800
- version: "0.1.45",
21800
+ version: "0.1.46",
21801
21801
  description: "Skills library for AI coding agents",
21802
21802
  type: "module",
21803
21803
  bin: {
@@ -30121,12 +30121,47 @@ function ensurePortableSkillFiles(skillPath, manifest) {
30121
30121
  writeFileSync2(join3(skillPath, "skill.json"), renderSkillJson(next));
30122
30122
  if (!existsSync3(join3(skillPath, "AGENTS.md")))
30123
30123
  writeFileSync2(join3(skillPath, "AGENTS.md"), renderAgentsMd(next));
30124
- if (!existsSync3(join3(skillPath, "package.json")))
30125
- writeFileSync2(join3(skillPath, "package.json"), renderPackageJson(next));
30124
+ ensurePackageJson(skillPath, next);
30126
30125
  if (!existsSync3(join3(skillPath, "tsconfig.json")))
30127
30126
  writeFileSync2(join3(skillPath, "tsconfig.json"), renderTsconfig());
30128
30127
  return readPortableSkillManifest(skillPath, next.name);
30129
30128
  }
30129
+ function ensurePackageJson(skillPath, manifest) {
30130
+ const pkgPath = join3(skillPath, "package.json");
30131
+ const first = manifest.commands[0] ?? { name: manifest.name, entry: "src/index.ts" };
30132
+ const commandName = normalizePortableSkillName(first.name || manifest.name);
30133
+ const entry = (first.entry ?? "src/index.ts").replace(/^\.\//, "");
30134
+ if (!existsSync3(pkgPath)) {
30135
+ writeFileSync2(pkgPath, renderPackageJson(manifest));
30136
+ return;
30137
+ }
30138
+ const existing = readJsonObject(pkgPath);
30139
+ const bin = {};
30140
+ if (isRecord(existing.bin)) {
30141
+ for (const [name, value] of Object.entries(existing.bin)) {
30142
+ if (typeof value === "string" && value.trim())
30143
+ bin[normalizePortableSkillName(name)] = value.replace(/^\.\//, "");
30144
+ }
30145
+ } else {
30146
+ const binEntry = stringValue(existing.bin);
30147
+ if (binEntry)
30148
+ bin[manifest.name] = binEntry.replace(/^\.\//, "");
30149
+ }
30150
+ bin[commandName] = entry;
30151
+ const scripts = isRecord(existing.scripts) ? { ...existing.scripts } : {};
30152
+ if (!stringValue(scripts.dev))
30153
+ scripts.dev = `bun run ${entry}`;
30154
+ writeFileSync2(pkgPath, `${JSON.stringify({
30155
+ ...existing,
30156
+ name: manifest.name,
30157
+ version: manifest.version,
30158
+ description: manifest.description,
30159
+ type: stringValue(existing.type) ?? "module",
30160
+ bin,
30161
+ scripts
30162
+ }, null, 2)}
30163
+ `);
30164
+ }
30130
30165
  function copySkillDirectory(source, destination) {
30131
30166
  mkdirSync2(destination, { recursive: true });
30132
30167
  cpSync(source, destination, {
package/dist/index.js CHANGED
@@ -1320,12 +1320,47 @@ function ensurePortableSkillFiles(skillPath, manifest) {
1320
1320
  writeFileSync2(join3(skillPath, "skill.json"), renderSkillJson(next));
1321
1321
  if (!existsSync3(join3(skillPath, "AGENTS.md")))
1322
1322
  writeFileSync2(join3(skillPath, "AGENTS.md"), renderAgentsMd(next));
1323
- if (!existsSync3(join3(skillPath, "package.json")))
1324
- writeFileSync2(join3(skillPath, "package.json"), renderPackageJson(next));
1323
+ ensurePackageJson(skillPath, next);
1325
1324
  if (!existsSync3(join3(skillPath, "tsconfig.json")))
1326
1325
  writeFileSync2(join3(skillPath, "tsconfig.json"), renderTsconfig());
1327
1326
  return readPortableSkillManifest(skillPath, next.name);
1328
1327
  }
1328
+ function ensurePackageJson(skillPath, manifest) {
1329
+ const pkgPath = join3(skillPath, "package.json");
1330
+ const first = manifest.commands[0] ?? { name: manifest.name, entry: "src/index.ts" };
1331
+ const commandName = normalizePortableSkillName(first.name || manifest.name);
1332
+ const entry = (first.entry ?? "src/index.ts").replace(/^\.\//, "");
1333
+ if (!existsSync3(pkgPath)) {
1334
+ writeFileSync2(pkgPath, renderPackageJson(manifest));
1335
+ return;
1336
+ }
1337
+ const existing = readJsonObject(pkgPath);
1338
+ const bin = {};
1339
+ if (isRecord(existing.bin)) {
1340
+ for (const [name, value] of Object.entries(existing.bin)) {
1341
+ if (typeof value === "string" && value.trim())
1342
+ bin[normalizePortableSkillName(name)] = value.replace(/^\.\//, "");
1343
+ }
1344
+ } else {
1345
+ const binEntry = stringValue(existing.bin);
1346
+ if (binEntry)
1347
+ bin[manifest.name] = binEntry.replace(/^\.\//, "");
1348
+ }
1349
+ bin[commandName] = entry;
1350
+ const scripts = isRecord(existing.scripts) ? { ...existing.scripts } : {};
1351
+ if (!stringValue(scripts.dev))
1352
+ scripts.dev = `bun run ${entry}`;
1353
+ writeFileSync2(pkgPath, `${JSON.stringify({
1354
+ ...existing,
1355
+ name: manifest.name,
1356
+ version: manifest.version,
1357
+ description: manifest.description,
1358
+ type: stringValue(existing.type) ?? "module",
1359
+ bin,
1360
+ scripts
1361
+ }, null, 2)}
1362
+ `);
1363
+ }
1329
1364
  function copySkillDirectory(source, destination) {
1330
1365
  mkdirSync2(destination, { recursive: true });
1331
1366
  cpSync(source, destination, {
@@ -18776,7 +18811,7 @@ import { dirname as dirname4, relative as relative3 } from "path";
18776
18811
  // package.json
18777
18812
  var package_default = {
18778
18813
  name: "@hasna/skills",
18779
- version: "0.1.45",
18814
+ version: "0.1.46",
18780
18815
  description: "Skills library for AI coding agents",
18781
18816
  type: "module",
18782
18817
  bin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/skills",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "description": "Skills library for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {