@keepgoingdev/cli 0.3.0 → 0.3.2

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.
Files changed (3) hide show
  1. package/README.md +9 -7
  2. package/dist/index.js +57 -19
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @keepgoing/cli
1
+ # @keepgoingdev/cli
2
2
 
3
3
  Terminal CLI for [KeepGoing](https://keepgoing.dev) — resume side projects without the mental friction.
4
4
 
@@ -6,13 +6,13 @@ Terminal CLI for [KeepGoing](https://keepgoing.dev) — resume side projects wit
6
6
 
7
7
  ```bash
8
8
  # Run without installing
9
- npx @keepgoing/cli status
9
+ npx @keepgoingdev/cli status
10
10
 
11
11
  # Install globally
12
- npm install -g @keepgoing/cli
12
+ npm install -g @keepgoingdev/cli
13
13
 
14
14
  # Or add to a project
15
- npm install --save-dev @keepgoing/cli
15
+ npm install --save-dev @keepgoingdev/cli
16
16
  ```
17
17
 
18
18
  ## Commands
@@ -50,17 +50,19 @@ Git branch and touched files are auto-detected from the workspace.
50
50
 
51
51
  Install a shell hook that runs `keepgoing status --quiet` automatically whenever you `cd` into a directory that contains `.keepgoing/`.
52
52
 
53
- Supports **zsh** and **bash**. Detected from `$SHELL`.
53
+ Supports **zsh**, **bash**, and **fish**. Detected from `$SHELL`.
54
54
 
55
55
  ```bash
56
56
  keepgoing hook install
57
57
  # → Reload your shell:
58
- source ~/.zshrc # or ~/.bashrc
58
+ source ~/.zshrc # zsh
59
+ source ~/.bashrc # bash
60
+ source ~/.config/fish/config.fish # fish
59
61
  ```
60
62
 
61
63
  ### `keepgoing hook uninstall`
62
64
 
63
- Remove the shell hook from your `~/.zshrc` or `~/.bashrc`.
65
+ Remove the shell hook from your shell config file.
64
66
 
65
67
  ```bash
66
68
  keepgoing hook uninstall
package/dist/index.js CHANGED
@@ -140,7 +140,6 @@ var STALE_SESSION_MS = 2 * 60 * 60 * 1e3;
140
140
  function pruneStaleTasks(tasks) {
141
141
  const now = Date.now();
142
142
  return tasks.filter((t) => {
143
- if (t.sessionActive) return true;
144
143
  const updatedAt = new Date(t.updatedAt).getTime();
145
144
  return !isNaN(updatedAt) && now - updatedAt < STALE_SESSION_MS;
146
145
  });
@@ -633,7 +632,7 @@ import { spawn } from "child_process";
633
632
  import { readFileSync, existsSync } from "fs";
634
633
  import path6 from "path";
635
634
  import os2 from "os";
636
- var CLI_VERSION = "0.3.0";
635
+ var CLI_VERSION = "0.3.2";
637
636
  var NPM_REGISTRY_URL = "https://registry.npmjs.org/@keepgoingdev/cli/latest";
638
637
  var FETCH_TIMEOUT_MS = 5e3;
639
638
  var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
@@ -808,6 +807,7 @@ async function saveCommand(opts) {
808
807
  import fs5 from "fs";
809
808
  import path8 from "path";
810
809
  import os3 from "os";
810
+ import { execSync } from "child_process";
811
811
  var HOOK_MARKER_START = "# keepgoing-hook-start";
812
812
  var HOOK_MARKER_END = "# keepgoing-hook-end";
813
813
  var ZSH_HOOK = `${HOOK_MARKER_START}
@@ -831,27 +831,61 @@ if command -v keepgoing >/dev/null 2>&1; then
831
831
  }
832
832
  fi
833
833
  ${HOOK_MARKER_END}`;
834
- function detectShellRcFile() {
835
- const shellEnv = process.env["SHELL"] ?? "";
834
+ var FISH_HOOK = `${HOOK_MARKER_START}
835
+ # KeepGoing shell hook, auto-injected by 'keepgoing hook install'
836
+ if command -v keepgoing >/dev/null 2>&1
837
+ function __keepgoing_on_pwd_change --on-variable PWD
838
+ if test -d .keepgoing
839
+ keepgoing status --quiet
840
+ end
841
+ end
842
+ end
843
+ ${HOOK_MARKER_END}`;
844
+ function detectShellRcFile(shellOverride) {
836
845
  const home = os3.homedir();
837
- if (shellEnv.endsWith("zsh")) {
846
+ let shell;
847
+ if (shellOverride) {
848
+ shell = shellOverride.toLowerCase();
849
+ } else {
850
+ try {
851
+ const parentComm = execSync(`ps -o comm= -p ${process.ppid}`, {
852
+ encoding: "utf-8",
853
+ stdio: ["pipe", "pipe", "pipe"]
854
+ }).trim();
855
+ if (parentComm.includes("fish")) shell = "fish";
856
+ else if (parentComm.includes("zsh")) shell = "zsh";
857
+ else if (parentComm.includes("bash")) shell = "bash";
858
+ } catch {
859
+ }
860
+ if (!shell) {
861
+ const shellEnv = process.env["SHELL"] ?? "";
862
+ if (shellEnv.endsWith("fish")) shell = "fish";
863
+ else if (shellEnv.endsWith("zsh")) shell = "zsh";
864
+ else if (shellEnv.endsWith("bash")) shell = "bash";
865
+ }
866
+ }
867
+ if (shell === "zsh") {
838
868
  return { shell: "zsh", rcFile: path8.join(home, ".zshrc") };
839
869
  }
840
- if (shellEnv.endsWith("bash")) {
870
+ if (shell === "bash") {
841
871
  return { shell: "bash", rcFile: path8.join(home, ".bashrc") };
842
872
  }
873
+ if (shell === "fish") {
874
+ const xdgConfig = process.env["XDG_CONFIG_HOME"] || path8.join(home, ".config");
875
+ return { shell: "fish", rcFile: path8.join(xdgConfig, "fish", "config.fish") };
876
+ }
843
877
  return void 0;
844
878
  }
845
- function hookInstallCommand() {
846
- const detected = detectShellRcFile();
879
+ function hookInstallCommand(shellOverride) {
880
+ const detected = detectShellRcFile(shellOverride);
847
881
  if (!detected) {
848
882
  console.error(
849
- 'Could not detect your shell. Set $SHELL to "zsh" or "bash" and try again.'
883
+ 'Could not detect your shell. Set $SHELL to "zsh", "bash", or "fish" and try again.'
850
884
  );
851
885
  process.exit(1);
852
886
  }
853
887
  const { shell, rcFile } = detected;
854
- const hookBlock = shell === "zsh" ? ZSH_HOOK : BASH_HOOK;
888
+ const hookBlock = shell === "zsh" ? ZSH_HOOK : shell === "fish" ? FISH_HOOK : BASH_HOOK;
855
889
  let existing = "";
856
890
  try {
857
891
  existing = fs5.readFileSync(rcFile, "utf-8");
@@ -869,11 +903,11 @@ ${hookBlock}
869
903
  `);
870
904
  console.log(` source ${rcFile}`);
871
905
  }
872
- function hookUninstallCommand() {
873
- const detected = detectShellRcFile();
906
+ function hookUninstallCommand(shellOverride) {
907
+ const detected = detectShellRcFile(shellOverride);
874
908
  if (!detected) {
875
909
  console.error(
876
- 'Could not detect your shell. Set $SHELL to "zsh" or "bash" and try again.'
910
+ 'Could not detect your shell. Set $SHELL to "zsh", "bash", or "fish" and try again.'
877
911
  );
878
912
  process.exit(1);
879
913
  }
@@ -1008,11 +1042,12 @@ Options:
1008
1042
  --cwd <path> Override the working directory (default: current directory)
1009
1043
  --json Output raw JSON (status only)
1010
1044
  --quiet Output a single summary line (status only)
1045
+ --shell <name> Override shell detection (zsh, bash, fish) for hook commands
1011
1046
  -v, --version Show the CLI version
1012
1047
  -h, --help Show this help text
1013
1048
 
1014
1049
  Hook subcommands:
1015
- keepgoing hook install Install the shell hook into ~/.zshrc or ~/.bashrc
1050
+ keepgoing hook install Install the shell hook (zsh, bash, fish)
1016
1051
  keepgoing hook uninstall Remove the shell hook
1017
1052
  `;
1018
1053
  function parseArgs(argv) {
@@ -1022,10 +1057,13 @@ function parseArgs(argv) {
1022
1057
  let cwd = process.cwd();
1023
1058
  let json = false;
1024
1059
  let quiet = false;
1060
+ let shell = "";
1025
1061
  for (let i = 0; i < args.length; i++) {
1026
1062
  const arg = args[i];
1027
1063
  if (arg === "--cwd" && i + 1 < args.length) {
1028
1064
  cwd = args[++i];
1065
+ } else if (arg === "--shell" && i + 1 < args.length) {
1066
+ shell = args[++i];
1029
1067
  } else if (arg === "--json") {
1030
1068
  json = true;
1031
1069
  } else if (arg === "--quiet") {
@@ -1041,10 +1079,10 @@ function parseArgs(argv) {
1041
1079
  }
1042
1080
  }
1043
1081
  cwd = findGitRoot(cwd);
1044
- return { command, subcommand, cwd, json, quiet };
1082
+ return { command, subcommand, cwd, json, quiet, shell };
1045
1083
  }
1046
1084
  async function main() {
1047
- const { command, subcommand, cwd, json, quiet } = parseArgs(process.argv);
1085
+ const { command, subcommand, cwd, json, quiet, shell } = parseArgs(process.argv);
1048
1086
  switch (command) {
1049
1087
  case "status":
1050
1088
  await statusCommand({ cwd, json, quiet });
@@ -1054,9 +1092,9 @@ async function main() {
1054
1092
  break;
1055
1093
  case "hook":
1056
1094
  if (subcommand === "install") {
1057
- hookInstallCommand();
1095
+ hookInstallCommand(shell || void 0);
1058
1096
  } else if (subcommand === "uninstall") {
1059
- hookUninstallCommand();
1097
+ hookUninstallCommand(shell || void 0);
1060
1098
  } else {
1061
1099
  console.error(
1062
1100
  `Unknown hook subcommand: "${subcommand}". Use "install" or "uninstall".`
@@ -1065,7 +1103,7 @@ async function main() {
1065
1103
  }
1066
1104
  break;
1067
1105
  case "version":
1068
- console.log(`keepgoing v${"0.3.0"}`);
1106
+ console.log(`keepgoing v${"0.3.2"}`);
1069
1107
  break;
1070
1108
  case "activate":
1071
1109
  await activateCommand({ licenseKey: subcommand });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keepgoingdev/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Terminal CLI for KeepGoing. Resume side projects without the mental friction.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",