@ranger-testing/ranger-cli 1.0.14 → 1.1.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 (85) hide show
  1. package/README.md +87 -324
  2. package/build/cli.js +76 -64
  3. package/build/cli.js.map +1 -1
  4. package/build/commands/addEnv.js +1 -1
  5. package/build/commands/addEnv.js.map +1 -1
  6. package/build/commands/clean.js +1 -1
  7. package/build/commands/clean.js.map +1 -1
  8. package/build/commands/dataMcpServer.js +1 -1
  9. package/build/commands/feature.js +94 -34
  10. package/build/commands/feature.js.map +1 -1
  11. package/build/commands/hook.js +28 -0
  12. package/build/commands/hook.js.map +1 -0
  13. package/build/commands/hooks/disable.js +30 -0
  14. package/build/commands/hooks/disable.js.map +1 -0
  15. package/build/commands/hooks/enable.js +48 -0
  16. package/build/commands/hooks/enable.js.map +1 -0
  17. package/build/commands/hooks/exitPlanMode.js +35 -0
  18. package/build/commands/hooks/exitPlanMode.js.map +1 -0
  19. package/build/commands/hooks/index.js +11 -0
  20. package/build/commands/hooks/index.js.map +1 -0
  21. package/build/commands/hooks/output.js +53 -0
  22. package/build/commands/hooks/output.js.map +1 -0
  23. package/build/commands/hooks/planReminder.js +46 -0
  24. package/build/commands/hooks/planReminder.js.map +1 -0
  25. package/build/commands/hooks/planStart.js +30 -0
  26. package/build/commands/hooks/planStart.js.map +1 -0
  27. package/build/commands/hooks/postEdit.js +43 -0
  28. package/build/commands/hooks/postEdit.js.map +1 -0
  29. package/build/commands/hooks/preCompact.js +30 -0
  30. package/build/commands/hooks/preCompact.js.map +1 -0
  31. package/build/commands/hooks/sessionEnd.js +21 -0
  32. package/build/commands/hooks/sessionEnd.js.map +1 -0
  33. package/build/commands/hooks/sessionStart.js +75 -0
  34. package/build/commands/hooks/sessionStart.js.map +1 -0
  35. package/build/commands/hooks/stopHook.js +54 -0
  36. package/build/commands/hooks/stopHook.js.map +1 -0
  37. package/build/commands/index.js +1 -3
  38. package/build/commands/index.js.map +1 -1
  39. package/build/commands/skillup.js +36 -70
  40. package/build/commands/skillup.js.map +1 -1
  41. package/build/commands/start.js +1 -1
  42. package/build/commands/start.js.map +1 -1
  43. package/build/commands/status.js +17 -21
  44. package/build/commands/status.js.map +1 -1
  45. package/build/commands/updateEnv.js +1 -1
  46. package/build/commands/updateEnv.js.map +1 -1
  47. package/build/commands/useEnv.js +1 -1
  48. package/build/commands/utils/browserSessionsApi.js +1 -1
  49. package/build/commands/utils/claudePlugin.js +85 -0
  50. package/build/commands/utils/claudePlugin.js.map +1 -0
  51. package/build/commands/utils/cliSecret.js +1 -1
  52. package/build/commands/utils/desirePathLog.js +133 -0
  53. package/build/commands/utils/desirePathLog.js.map +1 -0
  54. package/build/commands/utils/featureApi.js +23 -0
  55. package/build/commands/utils/featureApi.js.map +1 -1
  56. package/build/commands/utils/git.js +44 -0
  57. package/build/commands/utils/git.js.map +1 -0
  58. package/build/commands/utils/keychain.js +1 -1
  59. package/build/commands/utils/localAgentInstallationsApi.js +1 -1
  60. package/build/commands/utils/sessionCache.js +282 -0
  61. package/build/commands/utils/sessionCache.js.map +1 -0
  62. package/build/commands/utils/skillContent.js +3 -3
  63. package/build/commands/utils/skillContent.js.map +1 -1
  64. package/build/commands/utils/skills.js +1 -1
  65. package/build/commands/utils/skills.js.map +1 -1
  66. package/build/commands/verifyFeature.js +32 -3
  67. package/build/commands/verifyFeature.js.map +1 -1
  68. package/build/commands/verifyInBrowser.js +1 -1
  69. package/build/skills/ranger/SKILL.md +170 -0
  70. package/build/skills/ranger/create.md +151 -0
  71. package/build/skills/ranger/start.md +122 -0
  72. package/build/skills/{feature-tracker → ranger}/verify.md +48 -3
  73. package/package.json +2 -3
  74. package/build/commands/postEditHook.js +0 -25
  75. package/build/commands/postEditHook.js.map +0 -1
  76. package/build/commands/preCompactHook.js +0 -85
  77. package/build/commands/preCompactHook.js.map +0 -1
  78. package/build/commands/sessionStartHook.js +0 -64
  79. package/build/commands/sessionStartHook.js.map +0 -1
  80. package/build/commands/utils/mcpConfig.js +0 -1
  81. package/build/commands/utils/mcpConfig.js.map +0 -1
  82. package/build/skills/feature-tracker/SKILL.md +0 -163
  83. package/build/skills/feature-tracker/create.md +0 -114
  84. package/build/skills/feature-tracker/report.md +0 -159
  85. package/build/skills/feature-tracker/start.md +0 -93
package/README.md CHANGED
@@ -2,394 +2,157 @@
2
2
 
3
3
  The Ranger CLI sets up your project to use Ranger's AI-powered testing tools with Claude Code.
4
4
 
5
- ## Installation
5
+ ## Getting Started
6
6
 
7
- ```bash
8
- npm install -g @ranger-testing/ranger-cli
9
- ```
10
-
11
- ## Quick Start
12
-
13
- Go to [dashboard.ranger.net/cli](https://dashboard.ranger.net/cli) to get started.
14
-
15
- ## Claude Code Plugin
16
-
17
- For the best experience with Claude Code, install the Ranger plugin. Run these commands **inside Claude Code**:
18
-
19
- ```
20
- /plugin marketplace add ranger-testing/trailhead
21
- /plugin install ranger@trailhead
22
- ```
23
-
24
- The plugin provides:
25
- - **Auto-firing hooks** - Automatically loads Ranger context at session start
26
- - **MCP tools** - Access to Ranger's test management and browser verification tools
27
- - **Feature tracking** - Track feature development with verifiable checklist items
28
-
29
- > **Note:** The plugin requires the CLI to be configured. Run `ranger start <token>` in a regular terminal first.
30
-
31
- ## Commands
32
-
33
- ### `ranger start <token>`
34
-
35
- Initialize Ranger in your project. Get your token from [dashboard.ranger.net/cli](https://dashboard.ranger.net/cli).
36
-
37
- This command:
38
- - Validates your API token
39
- - Creates `.mcp.json` with the Ranger MCP server configuration
40
- - Creates the `.ranger/` directory for environment configs
41
- - Creates `.ranger/.gitignore` to exclude local environment (contains auth state)
42
-
43
- ```bash
44
- ranger start rngr_abc123...
45
- ```
46
-
47
- ### `ranger skillup`
48
-
49
- Install Ranger skills for Claude Code. This command installs AI agents that help with testing and bug hunting:
50
-
51
- - **e2e-test-recommender** - Installed if you have an API token. Analyzes code changes and suggests end-to-end tests.
52
- - **bug-bash** - Installed if you have an API token AND an active environment. Explores new features via browser to find bugs.
53
-
54
- Skills are installed to `.claude/skills/` and can be invoked in Claude Code conversations.
55
-
56
- ```bash
57
- ranger skillup
58
- ```
59
-
60
- **Important:** Run this command in the directory where you want to use Ranger skills. Skills are installed relative to your current working directory.
61
-
62
- Run this command after `ranger start` and again after `ranger add env` to install all available skills.
63
-
64
- ### `ranger add env <env-name>`
65
-
66
- Add a new environment configuration. You'll be prompted to:
67
- - Manually authenticate into your app to save session (if needed)
68
- - Log in via browser (captures auth cookies/storage)
69
-
70
- ```bash
71
- ranger add env local
72
- ranger add env staging
73
- ranger add env prod
74
- ```
75
-
76
- ### `ranger use <env-name>`
77
-
78
- Switch to a different environment.
7
+ ### Step 1: Install Ranger
79
8
 
80
9
  ```bash
81
- ranger use staging
10
+ npm install -g @ranger-testing/ranger-cli
82
11
  ```
83
12
 
84
- ### `ranger env update <env-name>`
85
-
86
- Update authentication for an existing environment (re-capture cookies/storage).
13
+ ### Step 2: Get Your Token
87
14
 
88
- ```bash
89
- ranger env update staging
90
- ```
15
+ Go to [dashboard.ranger.net/cli](https://dashboard.ranger.net/cli) to get your API token.
91
16
 
92
- ### `ranger update`
17
+ ### Step 3: Initialize Your Project
93
18
 
94
- Update Ranger CLI to the latest version.
19
+ In your project repo (must be a git repository), run:
95
20
 
96
21
  ```bash
97
- ranger update
22
+ ranger start <your-token>
98
23
  ```
99
24
 
100
- This command updates the globally installed `@ranger-testing/ranger-cli` package and reinstalls skills to ensure compatibility.
25
+ This will guide you through setup. If you skipped any steps, run them manually:
101
26
 
102
- ### `ranger config`
27
+ - Add a browser environment for verification:
28
+ ```bash
29
+ ranger add env local
30
+ ```
31
+ - Install Claude Code skills:
32
+ ```bash
33
+ ranger skillup
34
+ ```
35
+ - Install the Claude Code plugin:
36
+ ```bash
37
+ claude plugin marketplace add ranger-testing/trailhead
38
+ claude plugin install ranger@trailhead --scope user
39
+ ```
103
40
 
104
- Manage browser configuration for environments (userAgent, headers, etc.).
41
+ ## Using Ranger with Claude
105
42
 
106
- #### `ranger config set <env> <key> <value>`
43
+ Once set up, here's the typical workflow:
107
44
 
108
- Set a config value. Supports dot notation for nested keys.
45
+ 1. Start a Claude Code session in your project
46
+ 2. In your Claude Code session, run `/ranger:enable` to activate Ranger
47
+ 3. Enter plan mode with `/plan` to begin planning your feature
48
+ 4. Accept the plan - Ranger tracks your feature automatically
49
+ 5. Watch Ranger verify your feature in the browser
109
50
 
110
- ```bash
111
- # Set user agent
112
- ranger config set ci userAgent "Mozilla/5.0 (CI Bot)"
51
+ Ranger stays enabled on your branch across sessions. Use `/ranger:disable` to turn it off.
113
52
 
114
- # Set custom headers
115
- ranger config set ci header.X-Test-Mode "true"
116
- ranger config set ci header.Authorization '${AUTH_TOKEN}'
53
+ **Note:** Commands starting with `/` (like `/ranger:enable`, `/plan`, `/ranger:disable`) are slash commands entered inside the Claude Code chat interface. Terminal commands like `ranger start` are run in your shell.
117
54
 
118
- # Run browser in headless mode (useful for CI)
119
- ranger config set ci headless true
120
- ```
55
+ ## Commands Reference
121
56
 
122
- **Environment variable substitution**: Values like `${VAR_NAME}` are stored as-is and resolved at runtime when `verify-in-browser` runs.
57
+ ### Setup Commands
123
58
 
124
- #### `ranger config get <env> <key>`
59
+ | Command | Description |
60
+ |---------|-------------|
61
+ | `ranger start <token>` | Initialize Ranger in your project |
62
+ | `ranger status` | Show Ranger status and configuration |
63
+ | `ranger update` | Update Ranger CLI to latest version |
64
+ | `ranger clean` | Remove all Ranger artifacts from project |
125
65
 
126
- Get a config value.
66
+ ### Environment Commands
127
67
 
128
- ```bash
129
- ranger config get ci userAgent
130
- # Mozilla/5.0 (CI Bot)
131
- ```
68
+ | Command | Description |
69
+ |---------|-------------|
70
+ | `ranger add env <name>` | Add a new browser environment |
71
+ | `ranger use <name>` | Switch to a different environment |
72
+ | `ranger env ls` | List all configured environments |
73
+ | `ranger env update <name>` | Re-capture auth for an environment |
132
74
 
133
- #### `ranger config list <env>`
75
+ ### Config Commands
134
76
 
135
- List all config for an environment.
77
+ | Command | Description |
78
+ |---------|-------------|
79
+ | `ranger config set <env> <key> <value>` | Set a config value |
80
+ | `ranger config get <env> <key>` | Get a config value |
81
+ | `ranger config list <env>` | List all config for an environment |
82
+ | `ranger config unset <env> <key>` | Remove a config value |
136
83
 
137
- ```bash
138
- ranger config list ci
139
- # userAgent: Mozilla/5.0 (CI Bot)
140
- # headless: true
141
- # headers:
142
- # X-Test-Mode: true
143
- # Authorization: ${AUTH_TOKEN}
144
- ```
84
+ ## Detailed Command Reference
145
85
 
146
- #### `ranger config unset <env> <key>`
86
+ ### `ranger feature create`
147
87
 
148
- Remove a config value.
149
-
150
- ```bash
151
- ranger config unset ci header.X-Test-Mode
152
- ```
153
-
154
- ### `ranger verify-in-browser --url <url> --task <task>`
155
-
156
- Verify a UI flow in an isolated browser session. Returns structured results with any issues found.
157
-
158
- ```bash
159
- ranger verify-in-browser \
160
- --url "http://localhost:3000/login" \
161
- --task "Enter valid credentials and verify successful login"
162
- ```
163
-
164
- ### Feature Tracking Commands
165
-
166
- Track feature development progress with verifiable checklist items. Each item can be verified in the browser with evidence (screenshots, traces, conversation logs).
167
-
168
- #### `ranger feature create <name>`
169
-
170
- Create a new feature with a checklist. Automatically captures git context (repo URL, branch).
88
+ Create a new feature with checklist items:
171
89
 
172
90
  ```bash
173
91
  ranger feature create "User Authentication" \
174
- --description "Login, signup, and password reset flows" \
175
- -c "Login works" \
176
- -c "Signup creates account" \
177
- -c "Password reset sends email"
92
+ --description "Login and signup flows" \
93
+ -c "User can log in" \
94
+ -c "User can sign up"
178
95
  ```
179
96
 
180
- #### `ranger feature list`
181
-
182
- List all features with session status.
97
+ ### `ranger feature list`
183
98
 
184
99
  ```bash
185
100
  ranger feature list # All features
186
101
  ranger feature list --current-branch # Features for current git branch
187
102
  ```
188
103
 
189
- #### `ranger feature show [id]`
190
-
191
- Show feature details. Uses active feature if no ID provided.
192
-
193
- ```bash
194
- ranger feature show
195
- ranger feature show feat_abc123
196
- ```
197
-
198
- #### `ranger feature use <id>`
199
-
200
- Set the active feature.
201
-
202
- ```bash
203
- ranger feature use feat_abc123
204
- ```
205
-
206
- #### `ranger feature resume [id]`
207
-
208
- Find and use a feature matching the current git context (repo + branch). If multiple features match, prompts for selection.
209
-
210
- Optionally pass a feature ID to resume directly (bypasses search/prompt - useful for automation).
211
-
212
- ```bash
213
- ranger feature resume # Search by git context
214
- ranger feature resume feat_abc123 # Resume specific feature directly
215
- ```
216
-
217
- #### `ranger feature report [id]`
218
-
219
- Generate a markdown report with all verification evidence.
220
-
221
- ```bash
222
- ranger feature report # Uses active feature
223
- ranger feature report feat_abc123
224
- ranger feature report --output ./my-report.md
225
- ```
226
-
227
104
  ### `ranger verify-feature`
228
105
 
229
- Verify a checklist item in the browser. Requires an active feature.
106
+ Verify checklist items in the browser:
230
107
 
231
108
  ```bash
232
109
  ranger verify-feature \
110
+ --item 1 \
233
111
  --task "Log in with valid credentials and verify redirect to dashboard"
112
+
113
+ # Start on a specific page instead of the base URL
114
+ ranger verify-feature \
115
+ --start-path /dashboard \
116
+ --task "Verify dashboard shows user stats"
234
117
  ```
235
118
 
236
- The URL is derived from your active environment's `baseUrl` setting.
119
+ The URL is derived from your active environment's `baseUrl` setting. Use `--start-path` to append a path.
237
120
 
238
121
  Options:
239
- - `--env`: Environment to use (defaults to active environment)
122
+ - `--item <index>`: Checklist item to verify by index (1-based, required in non-interactive mode)
240
123
  - `--task`: Task description (defaults to checklist item description)
241
- - `--item <index>`: Verify specific item by index (1-based)
124
+ - `--env`: Environment to use (defaults to active environment)
125
+ - `--start-path`: Path to start on (e.g., `/dashboard`)
242
126
 
243
- ### `ranger clean`
127
+ ### `ranger config`
244
128
 
245
- Remove all Ranger artifacts from the project (`.ranger/`, `.mcp.json` entries).
129
+ Configure browser settings for environments:
246
130
 
247
131
  ```bash
248
- ranger clean
249
- ```
250
-
251
- ## Configuring agents.md
252
-
253
- Create or update `.claude/agents.md` in your project to help Claude Code understand your environment setup. This file should include:
254
-
255
- - **Environment URLs** - Which URLs correspond to which environments
256
- - **Product context** - What each environment is used for
257
-
258
- Example `.claude/agents.md`:
259
-
260
- ```markdown
261
- ## Environments
262
-
263
- - `localhost:4000` - Customer-facing product (main app)
264
- - `localhost:3000` - Internal admin dashboard
265
- - `staging.example.com` - Staging environment
266
-
267
- ## Notes
268
-
269
- - Use the `local` environment for development testing
270
- - Staging requires VPN access
271
- ```
272
-
273
- This helps Ranger skills understand where to test and what each environment represents.
274
-
275
- ## Using with Claude Code
276
-
277
- Once Ranger is set up, you can use it with Claude Code in several ways:
278
-
279
- ### 1. Ranger MCP Tools
280
-
281
- After running `ranger start`, the Ranger MCP server is configured in your project. Claude Code can use these tools:
282
-
283
- - `mcp__ranger__get_product_docs` - Get your product's sitemap and entity documentation
284
- - `mcp__ranger__get_test_suite` - List all tests in your test suite
285
- - `mcp__ranger__get_test_details` - Get details for a specific test
286
- - `mcp__ranger__create_draft_test` - Create a new draft test
287
- - `mcp__ranger__generate_test_plan` - Generate a test plan with steps
288
-
289
- ### 2. Browser Tools (after `ranger add env`)
290
-
291
- Once you add an environment, Claude Code can interact with your app via browser:
292
-
293
- - `mcp__ranger-browser__browser_navigate` - Navigate to a URL
294
- - `mcp__ranger-browser__browser_snapshot` - Get page accessibility snapshot
295
- - `mcp__ranger-browser__browser_click` - Click an element
296
- - `mcp__ranger-browser__browser_type` - Type text
297
- - `mcp__ranger-browser__browser_fill_form` - Fill form fields
298
- - And more...
299
-
300
- ### 3. Bug Bash Skill
301
-
302
- The **bug-bash** skill explores new features to find bugs. Invoke it in Claude Code:
303
-
304
- ```
305
- /bug-bash
306
- ```
307
-
308
- Or ask Claude to explore your changes:
309
-
310
- > "Explore the new settings page I just built and look for bugs"
311
-
312
- The bug-bash skill will:
313
- 1. Analyze your git diff to understand what changed
314
- 2. Generate exploration ideas based on the changes
315
- 3. Systematically test flows using `ranger verify-in-browser`
316
- 4. Report any issues found with severity levels
317
-
318
- ### 4. E2E Test Recommender Skill
319
-
320
- The **e2e-test-recommender** skill analyzes your code changes and suggests end-to-end tests. Invoke it:
321
-
322
- ```
323
- /e2e-test-recommender
132
+ ranger config set ci headless true
133
+ ranger config set ci userAgent "Mozilla/5.0 (CI Bot)"
134
+ ranger config set ci header.Authorization '${AUTH_TOKEN}'
324
135
  ```
325
136
 
326
- Or ask Claude:
137
+ Environment variables like `${AUTH_TOKEN}` are resolved at runtime, not when the config is set.
327
138
 
328
- > "What e2e tests should I add for my recent changes?"
139
+ ## Claude Code Plugin
329
140
 
330
- ### 5. Direct Browser Verification
141
+ The `ranger start` command attempts to install the plugin automatically. However, installation may be skipped or fail.
331
142
 
332
- Use the `verify-in-browser` command directly for quick UI checks:
143
+ To install manually:
333
144
 
334
145
  ```bash
335
- # Verify login works
336
- ranger verify-in-browser \
337
- --url "http://localhost:3000/login" \
338
- --task "Log in with test@example.com / password123, verify dashboard loads"
339
-
340
- # Verify form validation
341
- ranger verify-in-browser \
342
- --url "http://localhost:3000/signup" \
343
- --task "Submit form with empty email, verify error message appears"
146
+ claude plugin marketplace add ranger-testing/trailhead
147
+ claude plugin install ranger@trailhead --scope user
344
148
  ```
345
149
 
346
- The command returns:
347
- - `success`: Whether the flow completed without issues
348
- - `summary`: Description of what happened
349
- - `issues`: Array of problems found (BLOCKER, MAJOR, MINOR)
350
- - Exit code 0 for success, 1 for issues found
351
-
352
- ## Environment Variables
353
-
354
- | Variable | Description |
355
- |----------|-------------|
356
- | `MCP_SERVER_URL` | Override the default Ranger MCP server URL |
357
- | `ANTHROPIC_API_KEY` | Required for publishing skills to Anthropic API |
358
-
359
- ## Example Workflow
360
-
361
- ```bash
362
- # Set up Ranger
363
- ranger start rngr_your_token_here
364
-
365
- # Add your local development environment
366
- ranger add env local
367
- # (Browser opens, log in if needed, close when done)
368
-
369
- # Install skills for Claude Code
370
- ranger skillup
371
-
372
- # Now use Claude Code to test your app
373
- # Claude can now browse your app, find bugs, and suggest tests!
374
-
375
- # When switching to test staging:
376
- ranger add env staging
377
- ranger use staging
378
-
379
- # Clean up when done
380
- ranger clean
381
- ```
150
+ Check status with `ranger status`.
382
151
 
383
152
  ## Troubleshooting
384
153
 
385
- ### "No active environment" error
386
-
387
- Run `ranger use <env-name>` to set an active environment before using `verify-in-browser`.
388
-
389
- ### "Ranger Browser MCP not configured" error
390
-
391
- Run `ranger add env <name>` to configure browser access for an environment.
392
-
393
- ### Authentication expired
154
+ **"No active environment" error**
155
+ Run `ranger use <env-name>` to set an active environment.
394
156
 
395
- Run `ranger env update <env-name>` to refresh authentication cookies/storage.
157
+ **Authentication expired**
158
+ Run `ranger env update <env-name>` to refresh auth.