ai-summon 0.0.1

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 (61) hide show
  1. package/.claude/commands/speckit.analyze.md +184 -0
  2. package/.claude/commands/speckit.checklist.md +294 -0
  3. package/.claude/commands/speckit.clarify.md +177 -0
  4. package/.claude/commands/speckit.constitution.md +78 -0
  5. package/.claude/commands/speckit.implement.md +121 -0
  6. package/.claude/commands/speckit.plan.md +81 -0
  7. package/.claude/commands/speckit.specify.md +204 -0
  8. package/.claude/commands/speckit.tasks.md +108 -0
  9. package/.claude/settings.local.json +23 -0
  10. package/.prettierignore +5 -0
  11. package/.prettierrc.json +10 -0
  12. package/.specify/memory/constitution.md +72 -0
  13. package/.specify/scripts/bash/check-prerequisites.sh +166 -0
  14. package/.specify/scripts/bash/common.sh +113 -0
  15. package/.specify/scripts/bash/create-new-feature.sh +97 -0
  16. package/.specify/scripts/bash/setup-plan.sh +60 -0
  17. package/.specify/scripts/bash/update-agent-context.sh +738 -0
  18. package/.specify/templates/agent-file-template.md +28 -0
  19. package/.specify/templates/checklist-template.md +40 -0
  20. package/.specify/templates/plan-template.md +111 -0
  21. package/.specify/templates/spec-template.md +115 -0
  22. package/.specify/templates/tasks-template.md +250 -0
  23. package/CLAUDE.md +199 -0
  24. package/PRD.md +268 -0
  25. package/README.md +171 -0
  26. package/dist/ai-summon.d.ts +2 -0
  27. package/dist/ai-summon.js +73 -0
  28. package/dist/commands/ide/index.d.ts +3 -0
  29. package/dist/commands/ide/index.js +253 -0
  30. package/dist/commands/init.d.ts +4 -0
  31. package/dist/commands/init.js +55 -0
  32. package/dist/commands/url.d.ts +4 -0
  33. package/dist/commands/url.js +223 -0
  34. package/dist/types/index.d.ts +40 -0
  35. package/dist/types/index.js +1 -0
  36. package/dist/util.d.ts +16 -0
  37. package/dist/util.js +109 -0
  38. package/eslint.config.js +47 -0
  39. package/package.json +47 -0
  40. package/specs/001-cloud-login-feature/contracts/cloud-command.ts +82 -0
  41. package/specs/001-cloud-login-feature/contracts/config-service.ts +170 -0
  42. package/specs/001-cloud-login-feature/data-model.md +269 -0
  43. package/specs/001-cloud-login-feature/plan.md +91 -0
  44. package/specs/001-cloud-login-feature/quickstart.md +366 -0
  45. package/specs/001-cloud-login-feature/research.md +290 -0
  46. package/specs/001-cloud-login-feature/spec.md +195 -0
  47. package/specs/001-cloud-login-feature/tasks.md +235 -0
  48. package/specs/001-cloud-scp-command/contracts/cloud-scp-api.ts +402 -0
  49. package/specs/001-cloud-scp-command/data-model.md +424 -0
  50. package/specs/001-cloud-scp-command/plan.md +124 -0
  51. package/specs/001-cloud-scp-command/quickstart.md +536 -0
  52. package/specs/001-cloud-scp-command/research.md +345 -0
  53. package/specs/001-cloud-scp-command/spec.md +248 -0
  54. package/specs/001-cloud-scp-command/tasks.md +434 -0
  55. package/src/ai-summon.ts +88 -0
  56. package/src/commands/ide/index.ts +322 -0
  57. package/src/commands/init.ts +64 -0
  58. package/src/commands/url.ts +262 -0
  59. package/src/types/index.ts +49 -0
  60. package/src/util.ts +146 -0
  61. package/tsconfig.json +21 -0
package/CLAUDE.md ADDED
@@ -0,0 +1,199 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ This is **hsh19900502**, a TypeScript-based CLI tool that provides Git workflow automation and IDE project management utilities. It's built as an ESM module and designed to be installed globally as a command-line utility.
8
+
9
+ ## Development Setup
10
+
11
+ ### Building and Installation
12
+
13
+ ```bash
14
+ # Install dependencies
15
+ yarn install
16
+
17
+ # Build the project (TypeScript compilation)
18
+ yarn build
19
+
20
+ # Build and install globally for testing
21
+ yarn build:install
22
+
23
+ # Development mode (requires ts-node)
24
+ yarn dev
25
+
26
+ # Start compiled version
27
+ yarn start
28
+ ```
29
+
30
+ ### Key Dependencies
31
+
32
+ - **commander**: CLI framework for command parsing
33
+ - **inquirer**: Interactive command-line prompts with autocomplete support
34
+ - **zx**: Shell scripting utilities (provides `$` template literal)
35
+ - **chalk**: Terminal string styling
36
+ - **ora**: Terminal spinners and progress indicators
37
+ - **typescript**: TypeScript compiler and language support
38
+ - **ts-node**: TypeScript execution for development
39
+
40
+ ## Architecture
41
+
42
+ ### Project Structure
43
+
44
+ ```text
45
+ src/
46
+ ├── hsh.ts # Main CLI entry point with command definitions
47
+ ├── commands/
48
+ │ ├── git.ts # Git workflow commands (gcm, push, merge, mr, branchout)
49
+ │ ├── mono.ts # Monorepo management (init, cd)
50
+ │ ├── ide.ts # IDE integration (cursor, claude)
51
+ │ └── mcp.ts # MCP server synchronization
52
+ ├── types/
53
+ │ └── index.ts # TypeScript type definitions
54
+ └── util.ts # Utility functions (package.json reading)
55
+ ```
56
+
57
+ ### Command Architecture
58
+
59
+ The CLI follows a modular command structure using Commander.js:
60
+
61
+ - **Main commands**: Defined in `hsh.ts` with action handlers
62
+ - **Command modules**: Organized by feature domain (git, mono, ide)
63
+ - **Interactive prompts**: Heavy use of inquirer for user input with validation
64
+ - **Shell integration**: Uses `zx` for executing shell commands with `$` template literals
65
+
66
+ ### Key Design Patterns
67
+
68
+ - **ESM modules**: Uses ES module imports/exports throughout
69
+ - **Async/await**: All shell operations are async with proper error handling
70
+ - **Interactive CLI**: Extensive use of inquirer prompts with autocomplete
71
+ - **Configuration-based**: IDE command uses `~/.ai/config.json` for project paths
72
+ - **Monorepo aware**: Special handling for multi-repository workflows
73
+ - **TypeScript strict mode**: Full type safety with comprehensive type checking
74
+
75
+ ## Command Categories
76
+
77
+ ### Git Workflow Commands
78
+
79
+ - `gcm <message> [--push]`: Add all, commit with message, optionally push
80
+ - `push`: Interactive branch selection for pushing to remote
81
+ - `merge <branch>`: Safe merge with branch switching and pulling
82
+ - `mr create`: Create merge requests with JIRA integration (uses `glab`)
83
+ - `branchout <branch>`: Create new branch from master
84
+
85
+ ### Monorepo Management
86
+
87
+ - `mono init`: Initialize workspace with `.hsh` marker file
88
+ - `mono cd <level> [--repo <name>]`: Navigate to repo directories (root/client/server)
89
+
90
+ ### IDE Integration
91
+
92
+ - `cursor`: Open project in Cursor editor with config-based project selection
93
+
94
+ ### MCP Server Management
95
+
96
+ - `mcp sync`: Synchronize MCP server configurations from `~/.mcp/servers.json` to all projects in `~/.claude.json`
97
+ - This addresses the limitation that Claude Code cannot install MCP servers globally
98
+ - Automatically updates all project configurations with centralized MCP server definitions
99
+ - Idempotent operation - safe to run multiple times
100
+ - Useful for maintaining consistent MCP configurations across multiple projects
101
+
102
+ ## Configuration Requirements
103
+
104
+ ### IDE Configuration
105
+
106
+ The `cursor` and `claude` commands require a configuration file at `~/.ai/config.json`:
107
+
108
+ ```json
109
+ {
110
+ "category1": {
111
+ "project1": "/path/to/project1",
112
+ "project2": "/path/to/project2"
113
+ },
114
+ "category2": {
115
+ "project3": "/path/to/project3"
116
+ }
117
+ }
118
+ ```
119
+
120
+ ### Monorepo Setup
121
+
122
+ For monorepo commands, projects should have:
123
+
124
+ - `.hsh` marker file in the root (created by `mono init`)
125
+ - Directory structure: `<repo-name>/client/` and `<repo-name>/server/`
126
+
127
+ ### MCP Server Configuration
128
+
129
+ MCP (Model Context Protocol) servers can be centrally managed:
130
+
131
+ - Create `~/.mcp/servers.json` with your global MCP server configurations
132
+ - Run `hsh mcp sync` to propagate configurations to all projects in `~/.claude.json`
133
+ - Each project's `mcpServers` field will be updated with the latest configuration
134
+
135
+ Example `~/.mcp/servers.json`:
136
+
137
+ ```json
138
+ {
139
+ "chrome-devtools": {
140
+ "type": "stdio",
141
+ "command": "npx",
142
+ "args": ["chrome-devtools-mcp@latest"],
143
+ "env": {}
144
+ },
145
+ "GitLab communication server": {
146
+ "command": "npx",
147
+ "args": ["-y", "@zereight/mcp-gitlab"],
148
+ "env": {
149
+ "GITLAB_PERSONAL_ACCESS_TOKEN": "your-token",
150
+ "GITLAB_API_URL": "https://gitlab.example.com/api/v4"
151
+ }
152
+ }
153
+ }
154
+ ```
155
+
156
+ ## External Dependencies
157
+
158
+ ### Required CLI Tools
159
+
160
+ - **git**: For all git operations
161
+ - **glab**: GitLab CLI for merge request creation (used in `mr create`)
162
+ - **cursor**: Cursor editor executable (for `cursor` command)
163
+
164
+ ### Shell Integration
165
+
166
+ - Commands extensively use shell execution via `zx`
167
+ - Relies on system PATH for external tools
168
+ - Uses `process.chdir()` for directory navigation in monorepo commands
169
+
170
+ ## Development Patterns
171
+
172
+ ### Error Handling
173
+
174
+ - Uses chalk for colored terminal output (green for success, yellow for warnings)
175
+ - Interactive prompts include validation functions
176
+ - Shell commands use async/await with implicit error propagation
177
+
178
+ ### User Experience
179
+
180
+ - Extensive use of default values in prompts (e.g., current branch for push)
181
+ - Autocomplete support for directory/project selection
182
+ - Branch name parsing for JIRA integration in MR creation
183
+ - Progress feedback with colored console output
184
+
185
+ ### TypeScript Configuration
186
+
187
+ - Strict mode enabled with comprehensive type checking
188
+ - ESNext module resolution with bundler strategy
189
+ - Declaration files generated for distribution
190
+ - Paths configuration for clean imports
191
+ - Uses ES2020 target with modern JavaScript features
192
+
193
+ ## Important Notes
194
+
195
+ - All commands use **Yarn** as the package manager
196
+ - Built as ES modules with `.js` extensions in imports
197
+ - Requires Node.js with ES module support
198
+ - TypeScript compilation outputs to `dist/` directory with declaration files
199
+ - Pls ensure no ts error or eslint error after each code change
package/PRD.md ADDED
@@ -0,0 +1,268 @@
1
+ # Product Requirements Document: IDE Command Enhancement
2
+
3
+ ## Overview
4
+
5
+ This PRD describes enhancements to the IDE integration commands (`hsh cursor` and `hsh claude`) to support automatic Git repository discovery through a configurable working directory approach.
6
+
7
+ ## Problem Statement
8
+
9
+ Currently, users must manually configure every project path in `~/.ai/config.json` under category structures. This becomes cumbersome when managing many Git repositories, especially in environments with multiple projects organized under common parent directories.
10
+
11
+ ## Proposed Solution
12
+
13
+ Introduce a `workingDirectory` configuration option in `~/.ai/config.json` that enables automatic Git repository discovery. When configured, the IDE commands will automatically scan for Git repositories (directories containing `.git` folders) within the specified working directory.
14
+
15
+ ## Requirements
16
+
17
+ ### Functional Requirements
18
+
19
+ #### FR1: Working Directory Configuration
20
+ - **Description**: Support optional `workingDirectory` field in `~/.ai/config.json`
21
+ - **Behavior**: When set, `workingDirectory` takes precedence and the system ONLY uses auto-discovered Git repositories
22
+ - **Precedence Rule**: If `workingDirectory` exists, manually configured category-based projects are ignored
23
+ - **Example Configuration**:
24
+ ```json
25
+ {
26
+ "workingDirectory": "/Users/username/dev"
27
+ }
28
+ ```
29
+
30
+ #### FR2: Automatic Git Repository Discovery
31
+ - **Description**: Scan working directory for subdirectories containing `.git` folders
32
+ - **Behavior**:
33
+ - Recursively search for `.git` folders within the working directory
34
+ - Treat each `.git` folder as a project root marker
35
+ - Stop recursive search when `.git` is found (don't search deeper within Git repos)
36
+ - **Output**: Generate a list of discovered Git repositories for project selection
37
+
38
+ #### FR3: Project Selection Interface
39
+ - **Description**: Present discovered projects in the interactive prompt
40
+ - **Behavior**:
41
+ - Display all auto-discovered Git repositories from working directory
42
+ - Use autocomplete-enabled inquirer prompt
43
+ - Show project name (directory name) and full path for clarity
44
+ - Format: `project-name (/full/path/to/project-name)`
45
+
46
+ #### FR4: Backward Compatibility
47
+ - **Description**: Ensure existing configurations continue to work without modification
48
+ - **Behavior**:
49
+ - If `workingDirectory` is NOT configured → use manual project configurations (existing behavior)
50
+ - If `workingDirectory` IS configured → ignore manual configurations, use only auto-discovery
51
+ - Existing category-based project structures remain fully functional when `workingDirectory` is absent
52
+ - No breaking changes to current user workflows
53
+
54
+ ### Non-Functional Requirements
55
+
56
+ #### NFR1: Performance
57
+ - Repository scanning should complete within reasonable time (< 5 seconds for typical directories)
58
+ - Consider implementing caching if scan performance becomes an issue
59
+
60
+ #### NFR2: Error Handling
61
+ - Gracefully handle permission errors when scanning directories
62
+ - Provide clear error messages if `workingDirectory` path doesn't exist
63
+ - Continue operation even if some subdirectories are inaccessible
64
+
65
+ #### NFR3: User Experience
66
+ - Clear and consistent project listing format
67
+ - Fast autocomplete search functionality
68
+ - Alphabetically sorted project list
69
+ - Helpful defaults and suggestions
70
+
71
+ ## Configuration Schema
72
+
73
+ ### Enhanced `~/.ai/config.json` Structure
74
+
75
+ **Option 1: With Working Directory (Auto-Discovery Mode)**
76
+ ```json
77
+ {
78
+ "workingDirectory": "/Users/username/dev/projects"
79
+ }
80
+ ```
81
+
82
+ **Option 2: Without Working Directory (Manual Configuration Mode - Existing Behavior)**
83
+ ```json
84
+ {
85
+ "category1": {
86
+ "manually-configured-project": "/path/to/project"
87
+ },
88
+ "category2": {
89
+ "another-project": "/different/path"
90
+ }
91
+ }
92
+ ```
93
+
94
+ ### Configuration Precedence
95
+ - **If `workingDirectory` is present**: Use ONLY auto-discovered Git repositories, ignore manual configurations
96
+ - **If `workingDirectory` is absent**: Use manual category-based project configurations (existing behavior)
97
+
98
+ ## Implementation Notes
99
+
100
+ ### Target File
101
+ - **File**: `src/commands/ide/index.ts`
102
+ - **Affected Functions**: Project discovery and selection logic
103
+
104
+ ### Technical Approach
105
+ 1. Add `workingDirectory` field to configuration type definition
106
+ 2. Implement Git repository scanner utility function
107
+ 3. Modify project loading logic:
108
+ - Check if `workingDirectory` exists in config
109
+ - If yes: use auto-discovered projects only
110
+ - If no: use manual configurations (existing behavior)
111
+ 4. Update inquirer prompts to display discovered projects
112
+ 5. Ensure backward compatibility by making `workingDirectory` optional
113
+
114
+ ### Git Repository Detection
115
+ - Use Node.js `fs` module to recursively scan directories
116
+ - Check for `.git` folder existence using `fs.existsSync()`
117
+ - Stop recursion at `.git` boundaries to avoid scanning repo contents
118
+ - Extract project name from directory name
119
+
120
+ ## Success Criteria
121
+
122
+ 1. ✅ Users can configure `workingDirectory` and auto-discover Git repos
123
+ 2. ✅ When `workingDirectory` is set, manual configurations are ignored (precedence working correctly)
124
+ 3. ✅ When `workingDirectory` is absent, existing manual configurations work unchanged
125
+ 4. ✅ Auto-discovered project list appears in IDE command prompts
126
+ 5. ✅ No TypeScript or ESLint errors introduced
127
+ 6. ✅ Backward compatible with existing `~/.hsh/config.json` files (legacy location)
128
+ 7. ✅ Clear error handling for edge cases
129
+
130
+ ## Out of Scope
131
+
132
+ - Ignoring specific directories (e.g., `node_modules`) - can be added later
133
+ - Caching of discovered repositories - performance optimization for future
134
+ - Multiple working directories - single directory for MVP
135
+ - GUI configuration management - remains CLI-based
136
+
137
+ ## Open Questions
138
+
139
+ ### Q1: Project Display Format
140
+ When displaying auto-discovered projects in the inquirer prompt, what format should be used?
141
+
142
+ **Option A: Simple format (directory name with path)**
143
+ ```
144
+ ? Select a project: (Use arrow keys or type to search)
145
+ ❯ my-awesome-project (/Users/username/dev/my-awesome-project)
146
+ another-repo (/Users/username/dev/another-repo)
147
+ cool-app (/Users/username/dev/nested/cool-app)
148
+ ```
149
+
150
+ **Option B: Show relative path from working directory**
151
+ ```
152
+ ? Select a project: (Use arrow keys or type to search)
153
+ ❯ my-awesome-project (./my-awesome-project)
154
+ another-repo (./another-repo)
155
+ cool-app (./nested/cool-app)
156
+ ```
157
+
158
+ **Option C: Directory name only, with full path on selection**
159
+ ```
160
+ ? Select a project: (Use arrow keys or type to search)
161
+ ❯ my-awesome-project
162
+ another-repo
163
+ cool-app
164
+
165
+ Selected: /Users/username/dev/my-awesome-project
166
+ ```
167
+
168
+ **Option D: Flattened list with top-level folder separators (SELECTED)**
169
+ ```
170
+ ? Select a project: (Use arrow keys or type to search)
171
+ --------- work ---------
172
+ ❯ project-a (/Users/username/dev/work/project-a)
173
+ project-b (/Users/username/dev/work/project-b)
174
+ --------- personal ---------
175
+ my-app (/Users/username/dev/personal/my-app)
176
+ my-tool (/Users/username/dev/personal/my-tool)
177
+ --------- / (root) ---------
178
+ standalone-repo (/Users/username/dev/standalone-repo)
179
+ ```
180
+ - Pro: Visual organization while maintaining flat, searchable list
181
+ - Pro: Shows top-level folder context without nested tree structure
182
+ - Pro: Works well with autocomplete search (separators are ignored/filtered out)
183
+ - Pro: Easy to scan and understand repository organization
184
+
185
+ **Your Answer:** **D** - Flattened list with visual separators for top-level folders
186
+
187
+ ---
188
+
189
+ ### Q2: Project Naming for Auto-Discovered Repositories
190
+ Auto-discovered projects use the directory name as the project name (e.g., `/Users/username/dev/my-repo` → display as "my-repo"). Should users be able to customize these names?
191
+
192
+ No, no need to customize
193
+
194
+ ---
195
+
196
+ ### Q3: Repository Scanning Strategy
197
+ Git repository discovery could be expensive if working directory has many nested folders. When should scanning happen?
198
+
199
+ **Option A: Scan on every command execution (always fresh) - SELECTED**
200
+ - Pro: Always shows latest repositories, handles newly cloned repos immediately
201
+ - Pro: For 200 repos, scan takes ~300-800ms (barely noticeable)
202
+ - Pro: Simple implementation, no cache management complexity
203
+ - Con: May have slight delay on each command execution
204
+ - **Performance notes**:
205
+ - Flat structure (200 repos at depth 1): ~100-300ms
206
+ - Typical structure (2-3 levels deep): ~300-800ms
207
+ - Can optimize by skipping `node_modules`, `dist`, `.git` internals if needed
208
+
209
+ **Option B: Scan once and cache results (with manual refresh command)**
210
+ - Add `hsh refresh` or `hsh ide refresh` command to rebuild cache
211
+ - Pro: Fast command execution
212
+ - Con: Users must remember to refresh after cloning new repos
213
+
214
+ **Option C: Smart caching with TTL (e.g., cache for 1 hour)**
215
+ - Cache results but auto-refresh after time threshold
216
+ - Pro: Balance between performance and freshness
217
+ - Con: More complex implementation
218
+
219
+ **Option D: Scan on-demand with progress indicator**
220
+ - Show spinner/progress while scanning: "🔍 Discovering repositories..."
221
+ - Pro: Users know why there's a delay, always fresh
222
+ - Con: For typical use (200 repos), overhead of showing spinner (~300-800ms) may not be worth it
223
+
224
+ **Your Answer:** **A** - Scan on every command execution. With 200 repos, the 300-800ms scan time is barely noticeable and provides the best user experience (always fresh, no cache maintenance needed).
225
+
226
+ ---
227
+
228
+ ### Q4: Nested Git Repository Handling
229
+ What should happen when a Git repository contains other Git repositories (e.g., Git submodules)?
230
+
231
+ **Answer:** Not a concern for MVP. The natural scanning behavior handles this correctly:
232
+ - When `.git` folder is found, mark that directory as a repository
233
+ - Stop recursing into that directory's subdirectories
234
+ - This automatically prevents scanning inside repositories
235
+ - Edge case of nested repos (submodules, manually nested repos) is rare enough to ignore
236
+
237
+ **Implementation note**: The recursive scanner will:
238
+ ```typescript
239
+ // Pseudo-code
240
+ function findGitRepos(dir) {
241
+ if (containsGitFolder(dir)) {
242
+ return [dir]; // Found a repo, stop recursing
243
+ }
244
+
245
+ // Continue scanning subdirectories
246
+ return subdirs.flatMap(subdir => findGitRepos(subdir));
247
+ }
248
+ ```
249
+
250
+ This naturally handles the nested case without special logic.
251
+
252
+ ---
253
+
254
+ ### Q5: Error Handling for Inaccessible Directories
255
+ During scanning, some directories might be inaccessible due to permissions or symlink issues. How should the system behave?
256
+
257
+ **Answer:** Handle in future iteration. For MVP:
258
+ - Let Node.js filesystem errors propagate naturally
259
+ - Most users won't encounter permission issues in their working directory
260
+ - Can add proper error handling (silent skip, warnings, etc.) based on real-world feedback
261
+
262
+ **Your Answer:** Defer to future iteration - not critical for MVP
263
+
264
+ ## References
265
+
266
+ - Existing Implementation: `src/commands/ide/index.ts`
267
+ - Configuration File: `~/.ai/config.json`
268
+ - Related Commands: `hsh cursor`, `hsh claude`
package/README.md ADDED
@@ -0,0 +1,171 @@
1
+ # ai-summon
2
+
3
+ A small TypeScript CLI (binary name: `ai`) for:
4
+
5
+ - Opening projects in **Cursor** or **Claude** via an interactive fuzzy search
6
+ - Managing personal **URL bookmarks** and **URL groups** (open in Chrome)
7
+ - Bootstrapping `~/.ai/config.json`
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ yarn install
13
+ yarn build:install
14
+ ```
15
+
16
+ After install, you should have the `ai` command available:
17
+
18
+ ```bash
19
+ ai --help
20
+ ```
21
+
22
+ ## Commands
23
+
24
+ ### `ai init`
25
+
26
+ Initialize `~/.ai/config.json`.
27
+
28
+ ```bash
29
+ ai init
30
+ ai init --working-directory /Users/you/dev
31
+ ai init --force
32
+ ```
33
+
34
+ Options:
35
+
36
+ - `-w, --working-directory <path>`: set `workingDirectory` without prompting
37
+ - `-f, --force`: overwrite existing config without confirmation
38
+
39
+ ### `ai cursor [search]`
40
+
41
+ Open a project in **Cursor**.
42
+
43
+ ```bash
44
+ ai cursor
45
+ ai cursor payments
46
+ ```
47
+
48
+ ### `ai claude [search]`
49
+
50
+ Open a project in **Claude Code**.
51
+
52
+ ```bash
53
+ ai claude
54
+ ai claude impactful
55
+ ```
56
+
57
+ ### `ai cursor refresh` / `ai claude refresh`
58
+
59
+ Refresh the cached auto-discovered repositories (only applies when `workingDirectory` mode is enabled).
60
+
61
+ ```bash
62
+ ai cursor refresh
63
+ ai claude refresh
64
+ ```
65
+
66
+ ### `ai url ...`
67
+
68
+ URL bookmark management (stored in `~/.ai/config.json`).
69
+
70
+ #### `ai url add <name> <url>`
71
+
72
+ ```bash
73
+ ai url add jira https://your-jira.example.com
74
+ ```
75
+
76
+ #### `ai url remove [name]`
77
+
78
+ If `name` is omitted, you’ll enter interactive search mode.
79
+
80
+ ```bash
81
+ ai url remove jira
82
+ ai url remove
83
+ ```
84
+
85
+ #### `ai url search [--suppress]`
86
+
87
+ Interactively search bookmarks and open the selected URL in **Google Chrome**.
88
+
89
+ ```bash
90
+ ai url search
91
+ ai url search --suppress
92
+ ```
93
+
94
+ Options:
95
+
96
+ - `--suppress`: auto-dismiss popups by simulating the Enter key after opening (macOS via `osascript`)
97
+
98
+ #### `ai url group`
99
+
100
+ Select a configured URL group and open all URLs in a new Chrome window.
101
+
102
+ ```bash
103
+ ai url group
104
+ ```
105
+
106
+ ## Configuration (`~/.ai/config.json`)
107
+
108
+ Run `ai init` to create the file. The CLI supports **two modes** for project selection:
109
+
110
+ ### Auto-discovery mode (recommended)
111
+
112
+ Set `workingDirectory` to a folder containing your git repositories. The CLI will recursively scan for repos (by `.git`) and cache results to speed up future runs (cache file: `~/.ai/ide-repos-cache.json`).
113
+
114
+ Example:
115
+
116
+ ```json
117
+ {
118
+ "workingDirectory": "/Users/you/dev",
119
+ "repos": {},
120
+ "yiren": {},
121
+ "urls": {},
122
+ "urlGroups": {}
123
+ }
124
+ ```
125
+
126
+ ### Manual mode (grouped projects)
127
+
128
+ If `workingDirectory` is not set, `ai cursor` / `ai claude` will use `repos` (two-step selection: category → project).
129
+
130
+ Example:
131
+
132
+ ```json
133
+ {
134
+ "repos": {
135
+ "work": {
136
+ "impactful": "/Users/you/dev/impactful",
137
+ "payments": "/Users/you/dev/payments"
138
+ },
139
+ "personal": {
140
+ "dotfiles": "/Users/you/dev/dotfiles"
141
+ }
142
+ },
143
+ "yiren": {},
144
+ "urls": {
145
+ "jira": "https://your-jira.example.com",
146
+ "gitlab": "https://your-gitlab.example.com"
147
+ },
148
+ "urlGroups": {
149
+ "daily": ["https://example.com", "https://example.org"]
150
+ }
151
+ }
152
+ ```
153
+
154
+ ## Development
155
+
156
+ ```bash
157
+ yarn install
158
+ yarn build
159
+ yarn dev
160
+ ```
161
+
162
+ ## Requirements / Notes
163
+
164
+ - **Node.js**: required to run the CLI
165
+ - **Cursor**: `ai cursor` shells out to `cursor <path>`
166
+ - **Claude Code**: `ai claude` shells out to `claude` (and runs it in the selected repo directory)
167
+ - **Chrome + macOS**: `ai url ...` currently uses `open -a "Google Chrome" ...` (and `osascript` for `--suppress`)
168
+
169
+ ## License
170
+
171
+ ISC
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};