skillo 0.2.4 → 0.2.6

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/cli.js CHANGED
@@ -841,7 +841,7 @@ patternsCommand.command("ignore <id>").description("Ignore a pattern (never sugg
841
841
  patternsCommand.command("generate <id>").description("Generate a skill from a pattern").option("-n, --name <name>", "Custom skill name").option("--dry-run", "Preview without creating").action(async (id, options) => {
842
842
  const { getApiClient: getApiClient2 } = await import("./api-client-KUQW7FSC.js");
843
843
  const { writeFileSync: writeFileSync7, mkdirSync: mkdirSync3 } = await import("fs");
844
- const { join: join7 } = await import("path");
844
+ const { join: join8 } = await import("path");
845
845
  const { getSkillsDir: getSkillsDir2, ensureDirectory: ensureDirectory2 } = await import("./paths-INOKEM66.js");
846
846
  const dbPath = getDbPath();
847
847
  if (!existsSync5(dbPath)) {
@@ -895,8 +895,8 @@ patternsCommand.command("generate <id>").description("Generate a skill from a pa
895
895
  } else {
896
896
  const skillsDir = getSkillsDir2();
897
897
  ensureDirectory2(skillsDir);
898
- const skillDir = join7(skillsDir, skill.slug);
899
- const skillFile = join7(skillDir, "SKILL.md");
898
+ const skillDir = join8(skillsDir, skill.slug);
899
+ const skillFile = join8(skillDir, "SKILL.md");
900
900
  mkdirSync3(skillDir, { recursive: true });
901
901
  writeFileSync7(skillFile, skill.content, "utf-8");
902
902
  await db.updatePatternStatus(id, "converted");
@@ -1662,7 +1662,8 @@ async function uninstallShellIntegration(shell, home) {
1662
1662
 
1663
1663
  // src/commands/daemon.ts
1664
1664
  import { existsSync as existsSync8, readFileSync as readFileSync5, writeFileSync as writeFileSync3, unlinkSync as unlinkSync2 } from "fs";
1665
- import { fork } from "child_process";
1665
+ import { fork, spawn as spawn2 } from "child_process";
1666
+ import { join as join4 } from "path";
1666
1667
  import { Command as Command7 } from "commander";
1667
1668
  function isDaemonRunning2() {
1668
1669
  const pidFile = getPidFile();
@@ -1706,6 +1707,32 @@ function startDaemonProcess() {
1706
1707
  }
1707
1708
  return null;
1708
1709
  }
1710
+ function isTrayRunning() {
1711
+ const trayPidFile = join4(getDataDir(), "tray.pid");
1712
+ if (!existsSync8(trayPidFile)) return false;
1713
+ try {
1714
+ const pid = parseInt(readFileSync5(trayPidFile, "utf-8").trim(), 10);
1715
+ if (isNaN(pid)) return false;
1716
+ process.kill(pid, 0);
1717
+ return true;
1718
+ } catch {
1719
+ try {
1720
+ unlinkSync2(trayPidFile);
1721
+ } catch {
1722
+ }
1723
+ return false;
1724
+ }
1725
+ }
1726
+ function startTrayProcess() {
1727
+ if (isTrayRunning()) return;
1728
+ const cliScript = new URL("../cli.js", import.meta.url).pathname;
1729
+ const child = spawn2(process.execPath, [cliScript, "tray"], {
1730
+ detached: true,
1731
+ stdio: "ignore",
1732
+ env: { ...process.env }
1733
+ });
1734
+ child.unref();
1735
+ }
1709
1736
  async function ensureInitialized() {
1710
1737
  if (existsSync8(getConfigFile())) return;
1711
1738
  const { getDefaultConfig: getDefaultConfig2, saveConfig: saveConfig2 } = await import("./config-P5EM5L7N.js");
@@ -1802,6 +1829,9 @@ var startCommand = new Command7("start").description("Start the Skillo daemon").
1802
1829
  logger_default.dim("Auto-start service installed.");
1803
1830
  }
1804
1831
  }
1832
+ if (!isTrayRunning()) {
1833
+ startTrayProcess();
1834
+ }
1805
1835
  return;
1806
1836
  }
1807
1837
  if (options.foreground) {
@@ -1827,6 +1857,7 @@ var startCommand = new Command7("start").description("Start the Skillo daemon").
1827
1857
  if (serviceResult.success) {
1828
1858
  logger_default.dim("Auto-start & tray service installed. Daemon will survive reboots.");
1829
1859
  }
1860
+ startTrayProcess();
1830
1861
  logger_default.blank();
1831
1862
  logger_default.dim("Use 'skillo status' to check daemon status");
1832
1863
  logger_default.dim("Use 'skillo stop' to stop the daemon");
@@ -1843,6 +1874,18 @@ var stopCommand = new Command7("stop").description("Stop the Skillo daemon").act
1843
1874
  return;
1844
1875
  }
1845
1876
  logger_default.info(`Stopping daemon (PID: ${pid})...`);
1877
+ const trayPidFile = join4(getDataDir(), "tray.pid");
1878
+ if (existsSync8(trayPidFile)) {
1879
+ try {
1880
+ const trayPid = parseInt(readFileSync5(trayPidFile, "utf-8").trim(), 10);
1881
+ process.kill(trayPid, "SIGTERM");
1882
+ } catch {
1883
+ }
1884
+ try {
1885
+ unlinkSync2(trayPidFile);
1886
+ } catch {
1887
+ }
1888
+ }
1846
1889
  const serviceResult = await uninstallService();
1847
1890
  if (serviceResult.success) {
1848
1891
  logger_default.dim("Auto-start service removed.");
@@ -1876,8 +1919,8 @@ var logsCommand = new Command7("logs").description("Show daemon logs").option("-
1876
1919
  }
1877
1920
  const numLines = parseInt(options.lines, 10);
1878
1921
  if (options.follow) {
1879
- const { spawn: spawn2 } = await import("child_process");
1880
- const tail = spawn2("tail", ["-f", "-n", String(numLines), logFile], {
1922
+ const { spawn: spawn3 } = await import("child_process");
1923
+ const tail = spawn3("tail", ["-f", "-n", String(numLines), logFile], {
1881
1924
  stdio: "inherit"
1882
1925
  });
1883
1926
  tail.on("error", () => {
@@ -2404,7 +2447,7 @@ import { existsSync as existsSync11, writeFileSync as writeFileSync5 } from "fs"
2404
2447
 
2405
2448
  // src/utils/git.ts
2406
2449
  import { execSync as execSync2 } from "child_process";
2407
- import { join as join5, dirname as dirname2, basename as basename2 } from "path";
2450
+ import { join as join6, dirname as dirname2, basename as basename2 } from "path";
2408
2451
  function getGitInfo(projectPath) {
2409
2452
  const result = {
2410
2453
  isGitRepo: false,
@@ -2869,7 +2912,7 @@ var whoamiCommand = new Command11("whoami").description("Show current login stat
2869
2912
 
2870
2913
  // src/commands/sync.ts
2871
2914
  import { existsSync as existsSync12, writeFileSync as writeFileSync6, mkdirSync as mkdirSync2 } from "fs";
2872
- import { join as join6 } from "path";
2915
+ import { join as join7 } from "path";
2873
2916
  import { Command as Command12 } from "commander";
2874
2917
  var syncCommand = new Command12("sync").description("Sync data with Skillo platform").option("--push", "Push local data to platform").option("--pull", "Pull data from platform").option("--patterns", "Sync patterns only").option("--skills", "Sync skills only").option("--commands", "Sync commands only").action(
2875
2918
  async (options) => {
@@ -2987,8 +3030,8 @@ async function pullSkills(skills) {
2987
3030
  let downloaded = 0;
2988
3031
  for (const skill of skills) {
2989
3032
  if (!skill.content) continue;
2990
- const skillDir = join6(skillsDir, skill.slug);
2991
- const skillFile = join6(skillDir, "SKILL.md");
3033
+ const skillDir = join7(skillsDir, skill.slug);
3034
+ const skillFile = join7(skillDir, "SKILL.md");
2992
3035
  if (!existsSync12(skillDir)) {
2993
3036
  mkdirSync2(skillDir, { recursive: true });
2994
3037
  }
@@ -3003,7 +3046,7 @@ async function pullSkills(skills) {
3003
3046
  import { Command as Command13 } from "commander";
3004
3047
  var trayCommand = new Command13("tray").description("Start the system tray icon").action(async () => {
3005
3048
  try {
3006
- const { startTray } = await import("./tray-RZQV6GDP.js");
3049
+ const { startTray } = await import("./tray-UCAI2U2C.js");
3007
3050
  await startTray();
3008
3051
  } catch (error) {
3009
3052
  if (error instanceof Error && error.message.includes("Cannot find module")) {
@@ -3017,7 +3060,7 @@ var trayCommand = new Command13("tray").description("Start the system tray icon"
3017
3060
  });
3018
3061
 
3019
3062
  // src/cli.ts
3020
- var VERSION = "0.2.4";
3063
+ var VERSION = "0.2.6";
3021
3064
  var program = new Command14();
3022
3065
  program.name("skillo").description(
3023
3066
  `Skillo - Learn workflows by observation, not explanation.