|
1 | | -# NEXT_ACTIONS.md - commitprompt |
| 1 | +# NEXT_ACTIONS - commitprompt |
2 | 2 |
|
3 | | -## Priority Order |
| 3 | +## Current State |
4 | 4 |
|
5 | | -### ~~1. npm publish~~ (DONE) |
6 | | -- Published as `@elvatis_com/commitprompt@0.1.0` |
7 | | -- Live at: https://www.npmjs.com/package/@elvatis_com/commitprompt |
| 5 | +v0.1.0 published on npm. 59/59 tests passing. All quality gates (lint, type check, tests) green. |
| 6 | +GitHub Actions and GitLab CI live. ESLint with typescript-eslint and custom no-em-dash rule configured. |
8 | 7 |
|
9 | | -### 2. --context flag enhancement (LOW) |
10 | | -- Currently reads package.json name |
11 | | -- Extend to read first paragraph of README.md |
12 | | -- Include in prompt header as context block |
| 8 | +## Ready - Work These Next |
13 | 9 |
|
14 | | -### 3. ESLint setup (LOW) |
15 | | -- Add eslint with typescript-eslint |
16 | | -- Add `npm run lint` to CI |
17 | | -- Enforce no-em-dash rule via custom lint rule |
| 10 | +### T-004: Add --copy flag for clipboard output [medium] (issue #1) |
18 | 11 |
|
19 | | -### 4. GitLab CI support (LOW) |
20 | | -- Add `.gitlab-ci.yml` template |
21 | | -- Mirror the GitHub Actions workflow |
| 12 | +- **Goal:** Copy the generated prompt directly to the system clipboard, eliminating the manual copy step |
| 13 | +- **Context:** The entire value proposition is "paste into an LLM". Right now users must manually select and copy terminal output. A `--copy` flag closes the last-mile UX gap. Use Node.js child_process to call the platform-native clipboard command (`clip` on Windows, `pbcopy` on macOS, `xclip`/`xsel` on Linux) - no new dependencies needed. |
| 14 | +- **What to do:** |
| 15 | + 1. Add a `copyToClipboard(text: string): void` helper in a new `clipboard.ts` module |
| 16 | + 2. Detect platform via `process.platform` and spawn the appropriate command (`clip`, `pbcopy`, `xclip -selection clipboard`) |
| 17 | + 3. Pipe the prompt text to the spawned process via stdin |
| 18 | + 4. Add `--copy` flag to CLI in `index.ts` - when set, copy output AND still print to stdout |
| 19 | + 5. Print a confirmation line to stderr (e.g., "Copied to clipboard") so stdout stays clean for piping |
| 20 | + 6. Add unit tests for the clipboard module (mock `child_process.execSync`) |
| 21 | + 7. Update README.md with the new flag |
| 22 | +- **Files:** `src/clipboard.ts` (new), `src/index.ts`, `src/__tests__/clipboard.test.ts` (new), `README.md` |
| 23 | +- **Definition of Done:** |
| 24 | + - [ ] `commitprompt --copy` copies prompt to clipboard and prints confirmation to stderr |
| 25 | + - [ ] `commitprompt --copy --mode pr` works with all modes |
| 26 | + - [ ] Graceful error when clipboard command unavailable (warning, not crash) |
| 27 | + - [ ] Tests pass including new clipboard tests |
| 28 | + - [ ] README documents the flag |
22 | 29 |
|
23 | | -### 5. Shell autocomplete (OPTIONAL) |
24 | | -- Add `commitprompt completion` command via commander |
25 | | -- Support bash/zsh/fish |
| 30 | +### T-005: Support reading diff from stdin [medium] (issue #2) |
26 | 31 |
|
27 | | -## Completed |
| 32 | +- **Goal:** Enable piping diffs into commitprompt via stdin (e.g., `git diff HEAD~3 | commitprompt --mode pr`) |
| 33 | +- **Context:** Currently the tool only reads from `git diff --staged` or a file via `--diff`. Unix convention expects CLI tools to accept stdin when no file argument is given. This unlocks workflows like comparing arbitrary refs, using with other diff tools, or chaining in shell scripts. When neither `--diff` nor `--staged` is specified and stdin is not a TTY, read from stdin. |
| 34 | +- **What to do:** |
| 35 | + 1. In `diff-reader.ts`, add `readStdin(): string` that reads from `process.stdin` synchronously (use `fs.readFileSync('/dev/stdin', 'utf-8')` or `fs.readFileSync(0, 'utf-8')`) |
| 36 | + 2. In `index.ts`, detect piped input: if no `--diff` and no `--staged` flag, check `process.stdin.isTTY` - if falsy, read stdin instead of running `git diff --staged` |
| 37 | + 3. Add integration test: write a diff to a temp file, then test the stdin reading path |
| 38 | + 4. Update README.md with piping examples |
| 39 | +- **Files:** `src/diff-reader.ts`, `src/index.ts`, `src/__tests__/integration.test.ts`, `README.md` |
| 40 | +- **Definition of Done:** |
| 41 | + - [ ] `git diff HEAD~3 | commitprompt` works and produces correct prompt |
| 42 | + - [ ] `cat changes.diff | commitprompt --mode pr` works |
| 43 | + - [ ] When stdin is a TTY and no flags given, default behavior (staged diff) is preserved |
| 44 | + - [ ] Tests cover the stdin code path |
| 45 | + - [ ] README shows piping examples |
28 | 46 |
|
29 | | -- [x] Initial implementation: diff reader, parser, prompt builder, CLI |
30 | | -- [x] 42/42 tests passing using real fixtures |
31 | | -- [x] GitHub Actions CI live |
32 | | -- [x] E2E test verified (output in src/fixtures/e2e-output.txt) |
33 | | -- [x] AAHP handoff files created |
34 | | -- [x] Published to npm as `@elvatis_com/commitprompt@0.1.0` (2026-02-21) |
| 47 | +### T-006: Add --branch flag for branch diff comparison [medium] (issue #3) |
| 48 | + |
| 49 | +- **Goal:** Generate prompts from the full diff between current branch and a base branch, ideal for PR descriptions |
| 50 | +- **Context:** The `--mode pr` flag exists but reads only staged changes. For PR workflows, users need the complete branch diff. A `--branch <base>` flag that runs `git diff <base>...HEAD` provides the full picture. This makes `commitprompt --mode pr --branch main` the natural workflow before opening a PR. |
| 51 | +- **What to do:** |
| 52 | + 1. In `diff-reader.ts`, add `readBranchDiff(base: string, cwd?: string): string` that runs `git diff <base>...HEAD` |
| 53 | + 2. Add `--branch <base>` option to CLI in `index.ts` |
| 54 | + 3. Make `--branch` mutually exclusive with `--diff` and `--staged` (error if combined) |
| 55 | + 4. Add a fixture for a multi-commit branch diff and write tests |
| 56 | + 5. Update README.md with branch comparison examples |
| 57 | +- **Files:** `src/diff-reader.ts`, `src/index.ts`, `src/__tests__/integration.test.ts`, `README.md` |
| 58 | +- **Definition of Done:** |
| 59 | + - [ ] `commitprompt --branch main --mode pr` outputs a prompt with the full branch diff |
| 60 | + - [ ] Error message when `--branch` combined with `--diff` |
| 61 | + - [ ] Error message when branch name is invalid or not found |
| 62 | + - [ ] Tests cover the branch diff code path |
| 63 | + - [ ] README documents the flag with examples |
| 64 | + |
| 65 | +### T-007: Add --type flag to override change type detection [low] (issue #4) |
| 66 | + |
| 67 | +- **Goal:** Let users override the auto-detected change type when heuristics get it wrong |
| 68 | +- **Context:** The TRUST.md notes that `changeType` heuristics are path-based and can misclassify mixed-purpose changes. A `--type fix` flag gives users control. This is a small addition with clear value for edge cases. |
| 69 | +- **What to do:** |
| 70 | + 1. Add `--type <type>` option to CLI in `index.ts` with choices matching the `ChangeType` union |
| 71 | + 2. When provided, override `parsedDiff.changeType` before passing to `buildPrompt` |
| 72 | + 3. Validate the value against known types; show clear error for invalid types |
| 73 | + 4. Add tests for the override behavior |
| 74 | + 5. Update README.md |
| 75 | +- **Files:** `src/index.ts`, `src/__tests__/integration.test.ts`, `README.md` |
| 76 | +- **Definition of Done:** |
| 77 | + - [ ] `commitprompt --type fix` forces changeType to 'fix' regardless of heuristics |
| 78 | + - [ ] Invalid type values produce a clear error message |
| 79 | + - [ ] Tests verify override behavior |
| 80 | + - [ ] README documents the flag |
| 81 | + |
| 82 | +### T-008: Shell autocomplete [low] (issue #5) |
| 83 | + |
| 84 | +- **Goal:** Add tab completion for commitprompt flags in bash, zsh, and fish shells |
| 85 | +- **Context:** Commander v12 has built-in support for generating shell completion scripts. This is polish that improves discoverability of flags for regular users. |
| 86 | +- **What to do:** |
| 87 | + 1. Research Commander's `program.completions()` API or use a helper like `tabtab` |
| 88 | + 2. Add a `commitprompt completion` subcommand that outputs the completion script |
| 89 | + 3. Document installation instructions for bash, zsh, and fish in README.md |
| 90 | + 4. Test that the completion script is valid shell syntax |
| 91 | +- **Files:** `src/index.ts`, `README.md` |
| 92 | +- **Definition of Done:** |
| 93 | + - [ ] `commitprompt completion` outputs a working completion script |
| 94 | + - [ ] At least bash and zsh are supported |
| 95 | + - [ ] README includes installation instructions for completions |
| 96 | + |
| 97 | +## Blocked |
| 98 | + |
| 99 | +(none) |
| 100 | + |
| 101 | +## Recently Completed |
| 102 | + |
| 103 | + T-003: Add GitLab CI support (.gitlab-ci.yml template) |
| 104 | + T-001: Add --context flag (reads first paragraph of README.md into prompt) |
| 105 | + T-002: ESLint setup with typescript-eslint and no-em-dash rule |
0 commit comments