clairo 0.1.0 → 0.2.0

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 +22 -241
  2. package/dist/cli.js +1008 -84
  3. package/package.json +8 -1
package/README.md CHANGED
@@ -1,254 +1,35 @@
1
1
  # clairo
2
2
 
3
- ## Overview
3
+ Terminal dashboard for GitHub PRs and Jira tickets.
4
4
 
5
- clairo is a terminal-based user interface (TUI) application that consolidates GitHub pull requests, Jira ticket management, and personal daily logging into a single keyboard-driven interface. Built with TypeScript, it auto-detects your current git context and eliminates context-switching between web UIs, preventing tasks from falling through the cracks.
5
+ ## Requirements
6
6
 
7
- ## Problem Statement
7
+ - Node.js 18+
8
+ - [GitHub CLI](https://cli.github.com/) (`gh`) installed and authenticated
8
9
 
9
- Software engineers working with GitHub and Jira face constant context-switching:
10
-
11
- - Opening GitHub web UI to create/manage PRs
12
- - Navigating to Jira web UI to update ticket statuses
13
- - Maintaining personal work logs in separate text files
14
- - Forgetting to update systems (e.g., merged PR but ticket still "In Progress")
15
-
16
- This fragmented workflow leads to:
17
-
18
- - Wasted time switching between tools
19
- - Incomplete/outdated ticket statuses
20
- - Lost context about what was worked on
21
- - Mental overhead tracking multiple systems
22
-
23
- ## Target User
24
-
25
- Software engineers (particularly full-stack developers) who:
26
-
27
- - Work with both GitHub and Jira daily
28
- - Prefer terminal/keyboard-driven workflows
29
- - Maintain personal work logs
30
- - Want to reduce context-switching overhead
31
-
32
- ## User Stories
33
-
34
- ### Core Workflows
35
-
36
- 1. **As a developer**, I want clairo to auto-detect my current git branch and repository, so it knows what I'm working on without manual input
37
- 2. **As a developer**, I want to see if a PR already exists for my current branch, so I don't accidentally create duplicates
38
- 3. **As a developer**, I want to create GitHub PRs linked to Jira tickets from the TUI, so I don't have to open a browser
39
- 4. **As a developer**, I want to view and modify existing PRs for my branch, so I can update them without leaving the terminal
40
- 5. **As a developer**, I want to browse my Jira tickets using saved views/filters, so I can quickly find relevant work
41
- 6. **As a developer**, I want to maintain daily work logs in markdown, so I have a record of what I accomplished
42
- 7. **As a developer**, I want optional prompts to log PR/ticket actions, so I can choose when to document my work
43
- 8. **As a developer**, I want to view previous logs easily, so I can reference what I did on past days
44
-
45
- ### Quality of Life
46
-
47
- 9. **As a developer**, I want all navigation to be keyboard-driven with tabs, so I can stay in flow
48
- 10. **As a developer**, I want the tool to handle GitHub 2FA via PAT, so authentication is seamless
49
- 11. **As a developer**, I want my credentials stored securely locally, so I don't re-authenticate constantly
50
- 12. **As a developer**, I want clairo to handle multiple PRs from the same branch, so I can work with different base branches
51
-
52
- ## Features
53
-
54
- ### MVP (v1.0)
55
-
56
- #### Core Interface Structure
57
-
58
- clairo uses a tab-based navigation system with three main tabs:
59
-
60
- **Tab 1: PR View**
61
-
62
- - Auto-detects current git branch and repository (via git remote parsing)
63
- - Shows different states:
64
- - **No git repo**: Display "Not in a git repository" message
65
- - **No PR exists**: Show "Create PR" interface
66
- - **Single PR exists**: Display PR details with edit capabilities
67
- - **Multiple PRs exist**: List all PRs from current branch (different base branches), allow selection
68
- - Create PR flow:
69
- - Pre-populate branch information
70
- - Link to Jira ticket (searchable dropdown)
71
- - Title and description fields
72
- - Optional: auto-fill title/description from selected Jira ticket
73
- - View/Edit PR:
74
- - PR title, description, status
75
- - CI/CD checks status
76
- - Reviewers
77
- - Option to update PR details
78
-
79
- **Tab 2: Jira View**
80
-
81
- - Display saved Jira views/filters (configured in setup)
82
- - Browse tickets in a scrollable list (title, key, status, assignee)
83
- - Select ticket to view details:
84
- - Full description
85
- - Current status
86
- - Comments (read-only for v1)
87
- - Available transitions
88
- - Update ticket status (transition to different states)
89
- - Search/filter within current view
90
-
91
- **Tab 3: Logs View**
92
-
93
- - Split-pane layout:
94
- - **Left pane**: Today's log file (editable markdown)
95
- - **Right pane**: List of previous log files (by date)
96
- - Navigate to previous days by selecting from right pane
97
- - Auto-create today's log if it doesn't exist
98
- - Optional prompt after PR/ticket actions: "Log this? (y/n)"
99
- - Auto-append timestamped entries to today's log
100
- - Format: `## HH:MM - Action description`
101
-
102
- #### Git Context Detection
103
-
104
- - Parse `git remote get-url origin` to extract owner/repo
105
- - Fallback handling:
106
- - If `origin` doesn't exist, list all remotes
107
- - Filter for GitHub URLs
108
- - Prompt user to select if multiple GitHub remotes exist
109
- - Cache repo context per session to avoid repeated parsing
110
- - Handle non-GitHub repositories gracefully
111
-
112
- #### GitHub Integration
113
-
114
- - Query PRs by head branch: `GET /repos/{owner}/{repo}/pulls?head={user}:{branch}&state=open`
115
- - Create new PRs: `POST /repos/{owner}/{repo}/pulls`
116
- - Update PR details: `PATCH /repos/{owner}/{repo}/pulls/{number}`
117
- - Fetch PR status, checks, and reviewers
118
- - Handle authentication via Personal Access Token (PAT)
119
-
120
- #### Jira Integration
121
-
122
- - Authenticate via API token
123
- - Fetch saved views/filters (JQL queries configured in setup)
124
- - Search issues: `GET /rest/api/3/search`
125
- - Get issue details: `GET /rest/api/3/issue/{issueKey}`
126
- - Get available transitions: `GET /rest/api/3/issue/{issueKey}/transitions`
127
- - Transition issue: `POST /rest/api/3/issue/{issueKey}/transitions`
128
- - **Note**: Transition IDs are fetched dynamically (workflow-dependent)
129
-
130
- #### Daily Logging
131
-
132
- - Markdown files stored at `~/.clairo/logs/YYYY-MM-DD.md`
133
- - Auto-create file for current day if missing
134
- - Simple text editor within TUI (Ink text input component)
135
- - Optional auto-logging after actions:
136
-
137
- - Prompt: "Log this? (y/n)"
138
- - Auto-generated format:
139
-
140
- ```markdown
141
- ## 14:23 - Created PR #234
142
-
143
- Fixed auth bug in user service
144
- Jira: PROJ-123
145
- ```
146
-
147
- - Navigate historical logs via right pane
148
-
149
- #### Configuration & Setup
150
-
151
- - First-run setup wizard:
152
- - GitHub PAT creation guide
153
- - Jira API token creation guide
154
- - Jira instance URL
155
- - Configure Jira saved views (JQL queries)
156
- - Set default auto-log behavior (prompt/always/never)
157
- - Configuration stored at `~/.clairo/config.json`
158
- - Settings accessible via settings menu in TUI
159
-
160
- ### Future Enhancements (Post-MVP)
161
-
162
- - **CLI quick actions**: `clairo pr create`, `clairo ticket update PROJ-123 done`
163
- - Notifications for PR review requests
164
- - PR templates
165
- - Inline PR review workflow
166
- - GitHub Actions status visualization
167
- - Batch ticket operations
168
- - Export logs to different formats
169
- - Customizable keybindings
170
- - Support for GitLab, Bitbucket
171
- - Support for Linear, Asana
172
- - Multi-repo workspace mode
173
- - Offline mode with cache
174
-
175
- ## Technical Architecture
176
-
177
- ### Tech Stack
178
-
179
- - **Language**: TypeScript
180
- - **TUI Framework**: Ink (React for CLIs)
181
- - **GitHub API**: `@octokit/rest`
182
- - **Jira API**: `axios` or `node-fetch` (direct REST calls)
183
- - **Configuration**: `conf` package or custom JSON file handling
184
- - **File System**: Node.js built-in `fs/promises`
185
-
186
- ### Data Storage
10
+ ## Install
187
11
 
12
+ ```bash
13
+ pnpm install
14
+ pnpm build
188
15
  ```
189
- ~/.clairo/
190
- ├── config.json # API tokens, settings, preferences
191
- └── logs/
192
- ├── 2026-02-07.md # Daily log files
193
- ├── 2026-02-06.md
194
- └── ...
195
- ```
196
-
197
- ### API Integration Details
198
-
199
- #### Git Context Detection
200
-
201
- - Parse git remote URL using `git remote get-url origin`
202
- - Extract owner/repo from URLs:
203
- - HTTPS: `https://github.com/owner/repo.git`
204
- - SSH: `git@github.com:owner/repo.git`
205
- - Fallback strategy:
206
- 1. Try `origin` remote first
207
- 2. If not found, run `git remote` to list all remotes
208
- 3. Filter for GitHub URLs
209
- 4. If multiple GitHub remotes, prompt user to select
210
- 5. Cache selection for current session
211
- - Get current branch: `git rev-parse --abbrev-ref HEAD`
212
-
213
- #### GitHub
214
16
 
215
- - Authentication: Personal Access Token (PAT)
216
- - Permissions needed: `repo` scope
217
- - Key endpoints:
218
- - List PRs by branch: `GET /repos/{owner}/{repo}/pulls?head={user}:{branch}&state=open`
219
- - Create PR: `POST /repos/{owner}/{repo}/pulls`
220
- - Get PR details: `GET /repos/{owner}/{repo}/pulls/{number}`
221
- - Update PR: `PATCH /repos/{owner}/{repo}/pulls/{number}`
17
+ ## Run
222
18
 
223
- #### Jira
224
-
225
- - Authentication: API Token
226
- - Key endpoints:
227
- - Search issues (using JQL): `GET /rest/api/3/search?jql={query}`
228
- - Get issue: `GET /rest/api/3/issue/{issueKey}`
229
- - Get transitions: `GET /rest/api/3/issue/{issueKey}/transitions`
230
- - Transition issue: `POST /rest/api/3/issue/{issueKey}/transitions`
231
-
232
- **Note**: Jira transition IDs vary by workflow configuration and must be fetched dynamically.
233
-
234
- ### Security Considerations
235
-
236
- - Store credentials in `~/.clairo/config.json` with restrictive file permissions (0600)
237
- - Never log tokens/credentials
238
- - Consider using system keychain in future iterations
239
- - # Validate all user inputs before API calls
19
+ ```bash
20
+ pnpm start
21
+ ```
240
22
 
241
- ### Important (High Priority)
23
+ Or for development:
242
24
 
243
- 3. **Jira Saved Views Configuration**: How should users configure their saved views during setup? Manual JQL entry, or UI to build queries?
244
- 4. **PR Title Auto-fill**: When creating a PR linked to a Jira ticket, should title come from ticket title, ticket key + title, or be fully manual?
245
- 5. **Multiple PRs Handling**: When multiple PRs exist for a branch, should there be a "primary" PR concept, or treat all equally?
246
- 6. **Log Entry Format**: Finalize fields for auto-generated entries (currently: timestamp, action, PR #, Jira key)
25
+ ```bash
26
+ pnpm dev
27
+ ```
247
28
 
248
- ## Out of Scope (v1.0)
29
+ ## Keyboard
249
30
 
250
- - CLI quick actions (saved for v2)
251
- - Real-time notifications
252
- - Inline code review within TUI
253
- - Comment creation on Jira tickets (read-only for v1)
254
- - PR merge functionality (use `gh` CLI or web UI)
31
+ - `1-4` - Switch between boxes
32
+ - `j/k` - Navigate lists
33
+ - `Enter` - Select
34
+ - `Esc` - Cancel
35
+ - `Ctrl+C` - Quit