mintree 0.1.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 (64) hide show
  1. package/README.md +188 -0
  2. package/dist/cli.d.ts +2 -0
  3. package/dist/cli.js +12 -0
  4. package/dist/commands/dashboard.d.ts +2 -0
  5. package/dist/commands/dashboard.js +849 -0
  6. package/dist/commands/doctor.d.ts +2 -0
  7. package/dist/commands/doctor.js +327 -0
  8. package/dist/commands/helpers/index.d.ts +1 -0
  9. package/dist/commands/helpers/index.js +1 -0
  10. package/dist/commands/helpers/session-signal/end.d.ts +2 -0
  11. package/dist/commands/helpers/session-signal/end.js +9 -0
  12. package/dist/commands/helpers/session-signal/index.d.ts +1 -0
  13. package/dist/commands/helpers/session-signal/index.js +1 -0
  14. package/dist/commands/helpers/session-signal/install.d.ts +2 -0
  15. package/dist/commands/helpers/session-signal/install.js +25 -0
  16. package/dist/commands/helpers/session-signal/notification.d.ts +2 -0
  17. package/dist/commands/helpers/session-signal/notification.js +9 -0
  18. package/dist/commands/helpers/session-signal/prompt.d.ts +2 -0
  19. package/dist/commands/helpers/session-signal/prompt.js +9 -0
  20. package/dist/commands/helpers/session-signal/stop.d.ts +2 -0
  21. package/dist/commands/helpers/session-signal/stop.js +9 -0
  22. package/dist/commands/helpers/shell-init.d.ts +11 -0
  23. package/dist/commands/helpers/shell-init.js +111 -0
  24. package/dist/commands/index.d.ts +2 -0
  25. package/dist/commands/index.js +6 -0
  26. package/dist/commands/init.d.ts +2 -0
  27. package/dist/commands/init.js +129 -0
  28. package/dist/commands/worktree/clean.d.ts +11 -0
  29. package/dist/commands/worktree/clean.js +206 -0
  30. package/dist/commands/worktree/create.d.ts +18 -0
  31. package/dist/commands/worktree/create.js +93 -0
  32. package/dist/commands/worktree/index.d.ts +1 -0
  33. package/dist/commands/worktree/index.js +1 -0
  34. package/dist/commands/worktree/list.d.ts +10 -0
  35. package/dist/commands/worktree/list.js +143 -0
  36. package/dist/commands/worktree/remove.d.ts +12 -0
  37. package/dist/commands/worktree/remove.js +46 -0
  38. package/dist/commands/worktree/work.d.ts +15 -0
  39. package/dist/commands/worktree/work.js +192 -0
  40. package/dist/lib/branch.d.ts +26 -0
  41. package/dist/lib/branch.js +57 -0
  42. package/dist/lib/claude.d.ts +26 -0
  43. package/dist/lib/claude.js +67 -0
  44. package/dist/lib/dashboard.d.ts +50 -0
  45. package/dist/lib/dashboard.js +139 -0
  46. package/dist/lib/exec.d.ts +2 -0
  47. package/dist/lib/exec.js +15 -0
  48. package/dist/lib/git.d.ts +110 -0
  49. package/dist/lib/git.js +320 -0
  50. package/dist/lib/github.d.ts +7 -0
  51. package/dist/lib/github.js +15 -0
  52. package/dist/lib/markers.d.ts +21 -0
  53. package/dist/lib/markers.js +43 -0
  54. package/dist/lib/metadata.d.ts +18 -0
  55. package/dist/lib/metadata.js +44 -0
  56. package/dist/lib/session-signal.d.ts +63 -0
  57. package/dist/lib/session-signal.js +160 -0
  58. package/dist/lib/worktreeCreate.d.ts +36 -0
  59. package/dist/lib/worktreeCreate.js +184 -0
  60. package/dist/lib/worktreeRemove.d.ts +21 -0
  61. package/dist/lib/worktreeRemove.js +84 -0
  62. package/package.json +63 -0
  63. package/shell/init.bash +106 -0
  64. package/shell/init.zsh +125 -0
package/README.md ADDED
@@ -0,0 +1,188 @@
1
+ # mintree
2
+
3
+ > Issue-driven worktrees + Claude Code sessions for repos with an opinionated SDD+TDD flow.
4
+
5
+ mintree wraps the steps you do manually every time a feature begins:
6
+
7
+ 1. Pick an issue assigned to you on GitHub.
8
+ 2. Create a git worktree on a branch named after that issue, following the project's convention.
9
+ 3. Launch Claude Code inside the worktree with a session ID you can resume later.
10
+ 4. Live-track which Claude sessions are active, idle, or waiting.
11
+
12
+ It is a smaller, opinionated cousin of [santree](https://github.com/santiagotoscanini/santree) — built on the same TypeScript + Ink + Pastel stack but stripped to GitHub-only and aligned with the `<type>/<issue>-<desc>` branch convention.
13
+
14
+ ---
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ # mintree isn't on npm yet. Install via git clone + npm link — the
20
+ # `npm install -g github:user/repo` flow has a known bug in npm 10+
21
+ # where dependencies don't make it into the global install dir.
22
+ git clone git@github.com:minex-labs/mintree.git ~/dev/mintree
23
+ cd ~/dev/mintree
24
+ npm install
25
+ npm link
26
+
27
+ # To upgrade later:
28
+ # cd ~/dev/mintree && git pull && npm install && npm run build
29
+
30
+ # Verify
31
+ mintree --version # → 0.1.0
32
+ mintree doctor # checks toolchain (git, gh, claude, tmux, ...)
33
+
34
+ # Enable the shell wrapper so `mintree worktree create` and the
35
+ # dashboard can `cd` your shell into the new worktree.
36
+ #
37
+ # Use the cache-aware one-liner — it sources a cached copy on every
38
+ # subsequent shell instead of spawning node, which keeps shell
39
+ # startup fast. The cache regenerates itself when mintree is updated.
40
+ cat >> ~/.zshrc <<'EOF'
41
+ _MT=${XDG_CACHE_HOME:-$HOME/.cache}/mintree/init-zsh.zsh
42
+ [[ -f $_MT ]] && source $_MT || eval "$(mintree helpers shell-init zsh)"
43
+ EOF
44
+ exec zsh
45
+
46
+ # Bash users:
47
+ cat >> ~/.bashrc <<'EOF'
48
+ _MT=${XDG_CACHE_HOME:-$HOME/.cache}/mintree/init-bash.bash
49
+ [[ -f "$_MT" ]] && source "$_MT" || eval "$(mintree helpers shell-init bash)"
50
+ EOF
51
+ ```
52
+
53
+ `mintree doctor` should report **all required checks pass** before you continue. The most common gaps are:
54
+
55
+ - `gh` not authenticated → `gh auth login`
56
+ - Claude Code not installed → `npm install -g @anthropic-ai/claude-code`
57
+ - Shell integration not loaded → re-run the `echo … >> ~/.zshrc` step and start a new shell
58
+
59
+ ---
60
+
61
+ ## Per-repo setup
62
+
63
+ In every repository where you want to use mintree:
64
+
65
+ ```bash
66
+ cd path/to/repo
67
+ mintree init # creates .mintree/, updates .gitignore
68
+ mintree helpers session-signal install # optional: live session state in the dashboard
69
+ ```
70
+
71
+ `init` is idempotent — re-running it is a no-op when everything is already in place.
72
+
73
+ ---
74
+
75
+ ## Daily flow
76
+
77
+ ### Interactive dashboard
78
+
79
+ ```bash
80
+ mintree dashboard
81
+ ```
82
+
83
+ Opens a full-screen TUI listing your assigned open issues, each row marked with the live state of its Claude session (`● active`, `! waiting`, `○ idle`, `— exited`, `· no session`). The right pane shows the issue body, labels, worktree info, PR status, and live session message.
84
+
85
+ | Shortcut | Action |
86
+ |----------|-----------------------------------------------------------------------|
87
+ | `↑/↓` or `j/k` | Move between issues |
88
+ | `↵` | Resume Claude in the existing worktree, or open the create overlay if there's none |
89
+ | `w` | Always open the create overlay (type + kebab description) |
90
+ | `d` | Remove the selected worktree (confirmation overlay) |
91
+ | `r` | Manual refresh (auto-refreshes silently every 30s) |
92
+ | `o` | Open the issue in your browser |
93
+ | `q`/`Esc`| Quit (or cancel an open overlay) |
94
+
95
+ The dashboard runs in the alternate screen buffer, so closing it leaves your shell exactly as it was.
96
+
97
+ ### CLI
98
+
99
+ Same building blocks, scriptable from any shell:
100
+
101
+ ```bash
102
+ # Create a worktree, optionally launch Claude with an initial prompt
103
+ mintree worktree create feat/100-validar-patente
104
+ mintree worktree create feat/100-validar-patente --work --prompt "empezar issue #100"
105
+
106
+ # Resume Claude in the worktree you're currently inside
107
+ cd .mintree/worktrees/100-validar-patente
108
+ mintree worktree work
109
+
110
+ # Inspect / clean up
111
+ mintree worktree list # tabular view, dirty + ahead/behind
112
+ mintree worktree list --pr # also fetch PR status per branch (slower)
113
+ mintree worktree remove fix/55-bug # drop worktree but keep branch + session_id
114
+ mintree worktree remove fix/55-bug --force # discard uncommitted changes too
115
+ mintree worktree clean # sweep worktrees whose PR is merged/closed
116
+ ```
117
+
118
+ `mt`, `mtw`, `mtn` are shell aliases the wrapper installs for `mintree`, `mintree worktree`, and an interactive "name a branch" shortcut.
119
+
120
+ ---
121
+
122
+ ## Branch convention
123
+
124
+ mintree enforces:
125
+
126
+ ```
127
+ <type>/<issue>-<kebab-desc>
128
+ ```
129
+
130
+ `<type>` is one of:
131
+
132
+ > `feat`, `fix`, `docs`, `chore`, `refactor`, `test`, `build`, `ci`, `perf`, `style`, `revert`
133
+
134
+ `<issue>` is the GitHub issue number (no `#`), `<desc>` is lowercase kebab-case. Examples: `feat/42-validacion-patente`, `fix/55-selfie-upload-timeout`.
135
+
136
+ When the dashboard's `w` overlay opens, it suggests a kebab description capped at 5 words. If your repo has a `docs/conventions/git-workflow.md`, `CONTRIBUTING.md`, or `.claude/skills/` directory, mintree mentions it on the overlay so you can verify the suggestion against your project's rules — then edit the description to match.
137
+
138
+ ---
139
+
140
+ ## What gets stored where
141
+
142
+ ```
143
+ <repo>/
144
+ ├── .gitignore # gets `.mintree/worktrees/` + session-states/ + metadata.json appended
145
+ └── .mintree/
146
+ ├── metadata.json # gitignored. <issue-id> → { base_branch?, session_id? }
147
+ ├── worktrees/ # gitignored
148
+ │ └── 100-validar-patente/ # one directory per active worktree (named <issue>-<desc>)
149
+ ├── session-states/ # gitignored
150
+ │ └── 100.json # live state written by Claude hooks (active/waiting/idle/exited)
151
+ └── init.sh # opt-in. Runs in the new worktree post-create (copy .env, install deps, …)
152
+ ```
153
+
154
+ `metadata.json` is gitignored because the `session_id` is local to your machine — sharing it would only generate noise.
155
+
156
+ ---
157
+
158
+ ## Claude Code integrations
159
+
160
+ - **Sessions persist by issue**: each issue gets a UUID stored in `metadata.json`. Subsequent `worktree work` calls pass `--resume <uuid>` so Claude reopens the same conversation.
161
+ - **Live state** (optional): the four hooks installed by `mintree helpers session-signal install` write the current Claude state to `.mintree/session-states/<issue>.json` on every prompt / stop / notification / session-end. The dashboard reads those files to colour each row in real time.
162
+ - **Remote Control** (optional): `mintree doctor` checks `~/.claude.json` for `remoteControlAtStartup: true`. Enabling it lets you continue a local session from a different device.
163
+
164
+ ---
165
+
166
+ ## Troubleshooting
167
+
168
+ - `mintree doctor` is the first stop. It surfaces missing tools, unauthenticated CLIs, missing hooks, and gitignore drift.
169
+ - The shell wrapper exports `MINTREE_SHELL_INTEGRATION=1` — if doctor says it's missing, the wrapper isn't being loaded by your shell init file.
170
+ - If the dashboard ever opens with a stale session state, press `r` to force a refetch (the auto-refresh runs every 30s).
171
+
172
+ ---
173
+
174
+ ## Why not santree
175
+
176
+ mintree was written for projects that have:
177
+
178
+ - GitHub Issues as the only tracker (santree supports both Linear and GitHub).
179
+ - An established branch convention without the `gh-` prefix santree imposes.
180
+ - Skills (`.claude/skills/`) that own the SDD + TDD flow — mintree intentionally leaves the rich PR-create / PR-review prompts out of scope.
181
+
182
+ The implementation copies santree's stack (TypeScript + Ink + Pastel + Zod) and visual style (split pane, alt-screen, marker-based shell wrapper) so the two feel similar in use.
183
+
184
+ ---
185
+
186
+ ## License
187
+
188
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import Pastel from "pastel";
3
+ import { createRequire } from "module";
4
+ const require = createRequire(import.meta.url);
5
+ const { version } = require("../package.json");
6
+ const app = new Pastel({
7
+ importMeta: import.meta,
8
+ name: "mintree",
9
+ version,
10
+ description: "Issue-driven worktrees + Claude Code sessions for repos that already have an opinionated SDD+TDD flow.",
11
+ });
12
+ await app.run();
@@ -0,0 +1,2 @@
1
+ export declare const description = "Interactive dashboard listing open issues assigned to you with worktree + session state";
2
+ export default function Dashboard(): import("react/jsx-runtime").JSX.Element;