@delorenj/pjangler 1.2.2 → 1.2.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delorenj/pjangler",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Project subsystem bootstrapper CLI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env bash
2
+ # Mise enter hook: ensure the CodeGraph CLI is available and initialize the
3
+ # project index. If `codegraph` is not installed, this script installs it
4
+ # non-interactively into the project-local .mise/bin directory and retries.
5
+ #
6
+ # This is intended to run from a mise enter hook so onboarding a new host is
7
+ # fully automatic.
8
+
9
+ set -euo pipefail
10
+
11
+ REPO_ROOT="${MISE_PROJECT_ROOT:-$(cd "$(dirname "$0")/../.." && pwd)}"
12
+ PROJECT_BIN_DIR="$REPO_ROOT/.mise/bin"
13
+ mkdir -p "$PROJECT_BIN_DIR"
14
+
15
+ # Install the CodeGraph CLI into the project-local bin directory.
16
+ install_codegraph() {
17
+ echo "[mise] codegraph not found. Installing non-interactively..."
18
+ export CODEGRAPH_BIN_DIR="$PROJECT_BIN_DIR"
19
+ curl -fsSL https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.sh | sh
20
+
21
+ if [ -x "$PROJECT_BIN_DIR/codegraph" ]; then
22
+ export PATH="$PROJECT_BIN_DIR:$PATH"
23
+ else
24
+ echo "[mise] codegraph install did not place a binary at $PROJECT_BIN_DIR/codegraph" >&2
25
+ return 1
26
+ fi
27
+ }
28
+
29
+ # Ensure a codegraph binary is available on PATH.
30
+ ensure_codegraph() {
31
+ if command -v codegraph >/dev/null 2>&1; then
32
+ return 0
33
+ fi
34
+
35
+ # Check the project-local bin dir first (previous install from this hook).
36
+ if [ -x "$PROJECT_BIN_DIR/codegraph" ]; then
37
+ export PATH="$PROJECT_BIN_DIR:$PATH"
38
+ return 0
39
+ fi
40
+
41
+ # Check typical user-level install locations before fetching anything.
42
+ for d in "$HOME/.local/bin" "$HOME/.codegraph/current/bin"; do
43
+ if [ -x "$d/codegraph" ]; then
44
+ export PATH="$d:$PATH"
45
+ return 0
46
+ fi
47
+ done
48
+
49
+ install_codegraph
50
+ }
51
+
52
+ # Attempt to initialize the project graph. If the command is missing, install
53
+ # it and retry once.
54
+ init_project() {
55
+ local err_file
56
+ err_file="$(mktemp)"
57
+ trap 'rm -f "$err_file"' RETURN
58
+
59
+ if codegraph init -i "$REPO_ROOT" 2>"$err_file"; then
60
+ return 0
61
+ fi
62
+
63
+ # If the failure looks like a missing binary, install and retry.
64
+ if grep -qiE 'command not found|not installed|No such file|executable file not found' "$err_file" 2>/dev/null; then
65
+ ensure_codegraph
66
+ codegraph init -i "$REPO_ROOT"
67
+ return 0
68
+ fi
69
+
70
+ cat "$err_file" >&2
71
+ return 1
72
+ }
73
+
74
+ init_project
@@ -15,7 +15,7 @@ _.file = [".env"]
15
15
  enter = [
16
16
  "{% raw %}{{config_root}}{% endraw %}/.mise/scripts/link-agentfiles.sh",
17
17
  "op inject -i .env.op > .env",
18
- "codegraph sync",
18
+ "{% raw %}{{config_root}}{% endraw %}/.mise/scripts/codegraph.sh",
19
19
  "{% raw %}{{config_root}}{% endraw %}/.mise/scripts/link-project-skills-to-clis.sh",
20
20
  "{% raw %}{{config_root}}{% endraw %}/.agents/hooks/sync.py --install --quiet",
21
21
  ]