skissue 0.1.17 → 0.1.18

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/entry.js CHANGED
@@ -350,6 +350,13 @@ import chalk from "chalk";
350
350
  import { existsSync as existsSync3, statSync as statSync2 } from "node:fs";
351
351
  import { mkdir as mkdir3, writeFile as writeFile2 } from "node:fs/promises";
352
352
  import { join as join3, resolve as resolve2 } from "node:path";
353
+
354
+ // src/commands/prompt-validators.ts
355
+ function requiredTrimmed(v) {
356
+ return String(v ?? "").trim() ? void 0 : "Required";
357
+ }
358
+
359
+ // src/commands/init-registry.ts
353
360
  function validateSkillId(raw) {
354
361
  const id = raw.trim();
355
362
  if (!id) return "Skill id is required";
@@ -357,6 +364,9 @@ function validateSkillId(raw) {
357
364
  if (id === "." || id === ".." || id.includes("..")) return "Invalid skill id";
358
365
  return void 0;
359
366
  }
367
+ function validateSkillIdPrompt(v) {
368
+ return validateSkillId(String(v ?? ""));
369
+ }
360
370
  function registryLayoutExists(root) {
361
371
  const jsonPath = join3(root, "registry.json");
362
372
  const regDir = join3(root, "registry");
@@ -440,7 +450,7 @@ async function promptMinimalRegistryScaffold(root) {
440
450
  const idRaw = await p.text({
441
451
  message: "Sample skill id (folder name under registry/)",
442
452
  initialValue: "sample-skill",
443
- validate: (v) => validateSkillId(String(v ?? ""))
453
+ validate: validateSkillIdPrompt
444
454
  });
445
455
  if (p.isCancel(idRaw)) {
446
456
  return null;
@@ -494,6 +504,7 @@ async function runInitRegistry(cwd) {
494
504
  if (p.isCancel(where)) {
495
505
  p.cancel("Aborted.");
496
506
  process.exit(0);
507
+ return;
497
508
  }
498
509
  let root;
499
510
  if (where === "here") {
@@ -502,11 +513,12 @@ async function runInitRegistry(cwd) {
502
513
  const raw = await p.text({
503
514
  message: "Path to registry root (absolute or relative to current directory)",
504
515
  placeholder: "../my-skill-registry",
505
- validate: (v) => v?.trim() ? void 0 : "Required"
516
+ validate: requiredTrimmed
506
517
  });
507
518
  if (p.isCancel(raw)) {
508
519
  p.cancel("Aborted.");
509
520
  process.exit(0);
521
+ return;
510
522
  }
511
523
  root = resolve2(cwd, String(raw).trim());
512
524
  }
@@ -514,6 +526,7 @@ async function runInitRegistry(cwd) {
514
526
  if (!prompted) {
515
527
  p.cancel("Aborted. No files were changed.");
516
528
  process.exit(0);
529
+ return;
517
530
  }
518
531
  const { skillId, runGitInit, hadGit } = prompted;
519
532
  try {
@@ -626,7 +639,7 @@ async function runInit(cwd) {
626
639
  message: "Path to registry repo root (relative to this project or absolute). Must contain registry/ and be a git repository.",
627
640
  placeholder: ".",
628
641
  initialValue: ".",
629
- validate: (v) => v?.trim() ? void 0 : "Required"
642
+ validate: requiredTrimmed
630
643
  });
631
644
  if (p2.isCancel(regPath)) {
632
645
  p2.cancel("Aborted.");
@@ -637,7 +650,7 @@ async function runInit(cwd) {
637
650
  const branch = await p2.text({
638
651
  message: "Branch label (stored in config; installs use git HEAD from that directory)",
639
652
  initialValue: branchDefault,
640
- validate: (v) => v?.trim() ? void 0 : "Required"
653
+ validate: requiredTrimmed
641
654
  });
642
655
  if (p2.isCancel(branch)) {
643
656
  p2.cancel("Aborted.");
@@ -655,7 +668,7 @@ async function runInit(cwd) {
655
668
  message: "Path for the new registry root (relative to this project or absolute)",
656
669
  placeholder: "./skill-registry",
657
670
  initialValue: "./skill-registry",
658
- validate: (v) => v?.trim() ? void 0 : "Required"
671
+ validate: requiredTrimmed
659
672
  });
660
673
  if (p2.isCancel(pathRaw)) {
661
674
  p2.cancel("Aborted.");
@@ -701,7 +714,7 @@ async function runInit(cwd) {
701
714
  const branch = await p2.text({
702
715
  message: "Branch label (stored in config; installs use git HEAD from that directory)",
703
716
  initialValue: branchDefault,
704
- validate: (v) => v?.trim() ? void 0 : "Required"
717
+ validate: requiredTrimmed
705
718
  });
706
719
  if (p2.isCancel(branch)) {
707
720
  p2.cancel("Aborted.");
@@ -719,7 +732,7 @@ async function runInit(cwd) {
719
732
  const owner = await p2.text({
720
733
  message: "GitHub registry owner (org or user)",
721
734
  placeholder: "acme",
722
- validate: (v) => v?.trim() ? void 0 : "Required"
735
+ validate: requiredTrimmed
723
736
  });
724
737
  if (p2.isCancel(owner)) {
725
738
  p2.cancel("Aborted.");
@@ -728,7 +741,7 @@ async function runInit(cwd) {
728
741
  const repo = await p2.text({
729
742
  message: "Registry repository name",
730
743
  placeholder: "skill-registry",
731
- validate: (v) => v?.trim() ? void 0 : "Required"
744
+ validate: requiredTrimmed
732
745
  });
733
746
  if (p2.isCancel(repo)) {
734
747
  p2.cancel("Aborted.");
@@ -737,7 +750,7 @@ async function runInit(cwd) {
737
750
  const branch = await p2.text({
738
751
  message: "Branch to track",
739
752
  initialValue: "main",
740
- validate: (v) => v?.trim() ? void 0 : "Required"
753
+ validate: requiredTrimmed
741
754
  });
742
755
  if (p2.isCancel(branch)) {
743
756
  p2.cancel("Aborted.");
@@ -755,7 +768,7 @@ async function runInit(cwd) {
755
768
  const skillsRoot = await p2.text({
756
769
  message: "Install skills under (relative to project root)",
757
770
  initialValue: cfg.skillsRoot,
758
- validate: (v) => v?.trim() ? void 0 : "Required"
771
+ validate: requiredTrimmed
759
772
  });
760
773
  if (p2.isCancel(skillsRoot)) {
761
774
  p2.cancel("Aborted.");
@@ -1054,7 +1067,7 @@ async function runUpdate(cwd, skillId) {
1054
1067
  // src/commands/manage.ts
1055
1068
  import * as p3 from "@clack/prompts";
1056
1069
  import chalk9 from "chalk";
1057
- import readline from "node:readline";
1070
+ import { emitKeypressEvents } from "node:readline";
1058
1071
 
1059
1072
  // src/commands/banner.ts
1060
1073
  import chalk8 from "chalk";
@@ -1156,7 +1169,7 @@ async function promptMainMenuSelect(availableCount, installedCount) {
1156
1169
  };
1157
1170
  const { stdin } = process;
1158
1171
  if (stdin.isTTY) {
1159
- readline.emitKeypressEvents(stdin);
1172
+ emitKeypressEvents(stdin);
1160
1173
  stdin.prependListener("keypress", onCtrlC);
1161
1174
  }
1162
1175
  try {
@@ -1461,8 +1474,9 @@ async function runDoctor(cwd) {
1461
1474
  process.exitCode = 1;
1462
1475
  return;
1463
1476
  }
1464
- if (!isLocalRegistry(config)) {
1465
- console.log(chalk10.dim(`\u2022 ${authHint(config)}`));
1477
+ const hint = authHint(config);
1478
+ if (hint) {
1479
+ console.log(chalk10.dim(`\u2022 ${hint}`));
1466
1480
  }
1467
1481
  try {
1468
1482
  const { path: repoPath, head } = await ensureRegistryCheckout(cwd, config);
@@ -1545,7 +1559,7 @@ program.command("update").description("Re-fetch and overwrite installed skill(s)
1545
1559
  process.exitCode = 1;
1546
1560
  }
1547
1561
  });
1548
- program.command("doctor").description("Check Node, config, and sync registry checkout").option("-C, --cwd <path>", "Project root", process.cwd()).action(async (opts) => {
1562
+ program.command("doctor").description("Check Node, config, and sync registry checkout").option("-C, --cwd <path>", "Project root").action(async (opts) => {
1549
1563
  const cwd = resolve4(opts.cwd ?? process.cwd());
1550
1564
  try {
1551
1565
  await runDoctor(cwd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skissue",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,23 +10,29 @@ import { chmodSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
10
10
  import { dirname, join, sep } from "node:path";
11
11
  import { fileURLToPath } from "node:url";
12
12
 
13
- const scriptPath = fileURLToPath(import.meta.url);
14
- if (scriptPath.split(sep).includes("node_modules")) {
15
- process.exit(0);
16
- }
13
+ /**
14
+ * @param {string} scriptPath Absolute path to this file (or a test fixture path with the same layout).
15
+ */
16
+ export function runEnsureLocalBin(scriptPath) {
17
+ if (scriptPath.split(sep).includes("node_modules")) {
18
+ return;
19
+ }
17
20
 
18
- const root = dirname(dirname(scriptPath));
19
- const dist = join(root, "dist", "entry.js");
20
- const binDir = join(root, "node_modules", ".bin");
21
- const out = join(binDir, "skissue");
21
+ const root = dirname(dirname(scriptPath));
22
+ const dist = join(root, "dist", "entry.js");
23
+ const binDir = join(root, "node_modules", ".bin");
24
+ const out = join(binDir, "skissue");
22
25
 
23
- if (!existsSync(dist)) {
24
- process.exit(0);
25
- }
26
+ if (!existsSync(dist)) {
27
+ return;
28
+ }
26
29
 
27
- mkdirSync(binDir, { recursive: true });
28
- const content = `#!/usr/bin/env sh
30
+ mkdirSync(binDir, { recursive: true });
31
+ const content = `#!/usr/bin/env sh
29
32
  exec node "${dist}" "$@"
30
33
  `;
31
- writeFileSync(out, content, { mode: 0o755 });
32
- chmodSync(out, 0o755);
34
+ writeFileSync(out, content, { mode: 0o755 });
35
+ chmodSync(out, 0o755);
36
+ }
37
+
38
+ runEnsureLocalBin(fileURLToPath(import.meta.url));