sequant 1.6.0 → 1.7.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.
@@ -19,7 +19,7 @@ export async function doctorCommand() {
19
19
  message: `Outdated: ${versionResult.currentVersion} → ${versionResult.latestVersion} available`,
20
20
  });
21
21
  // Show remediation steps
22
- console.log(chalk.yellow(` ⚠️ ${getVersionWarning(versionResult.currentVersion, versionResult.latestVersion)}`));
22
+ console.log(chalk.yellow(` ⚠️ ${getVersionWarning(versionResult.currentVersion, versionResult.latestVersion, versionResult.isLocalInstall)}`));
23
23
  console.log("");
24
24
  }
25
25
  else {
@@ -742,7 +742,7 @@ export async function runCommand(issues, options) {
742
742
  try {
743
743
  const versionResult = await checkVersionCached();
744
744
  if (versionResult.isOutdated && versionResult.latestVersion) {
745
- console.log(chalk.yellow(` ⚠️ ${getVersionWarning(versionResult.currentVersion, versionResult.latestVersion)}`));
745
+ console.log(chalk.yellow(` ⚠️ ${getVersionWarning(versionResult.currentVersion, versionResult.latestVersion, versionResult.isLocalInstall)}`));
746
746
  console.log("");
747
747
  }
748
748
  }
@@ -12,6 +12,7 @@ export interface VersionCheckResult {
12
12
  currentVersion: string;
13
13
  latestVersion: string | null;
14
14
  isOutdated: boolean;
15
+ isLocalInstall?: boolean;
15
16
  error?: string;
16
17
  }
17
18
  /**
@@ -26,6 +27,17 @@ export declare function getCachePath(): string;
26
27
  * Get the current version from package.json
27
28
  */
28
29
  export declare function getCurrentVersion(): string;
30
+ /**
31
+ * Check if running from a local node_modules install (vs npx cache)
32
+ *
33
+ * Local installs are in: <project>/node_modules/sequant/
34
+ * npx installs are in: ~/.npm/_npx/<hash>/node_modules/sequant/
35
+ *
36
+ * This matters because:
37
+ * - Local installs should be updated with: npm update sequant
38
+ * - npx installs should be updated with: npx sequant@latest
39
+ */
40
+ export declare function isLocalNodeModulesInstall(): boolean;
29
41
  /**
30
42
  * Read the version cache
31
43
  */
@@ -53,8 +65,11 @@ export declare function compareVersions(a: string, b: string): number;
53
65
  export declare function isOutdated(currentVersion: string, latestVersion: string): boolean;
54
66
  /**
55
67
  * Get the version warning message
68
+ *
69
+ * For local node_modules installs, recommends `npm update sequant`
70
+ * For npx usage, recommends `npx sequant@latest`
56
71
  */
57
- export declare function getVersionWarning(currentVersion: string, latestVersion: string): string;
72
+ export declare function getVersionWarning(currentVersion: string, latestVersion: string, isLocal?: boolean): string;
58
73
  /**
59
74
  * Check version freshness (thorough - for doctor command)
60
75
  * Always fetches from npm registry
@@ -54,6 +54,25 @@ export function getCurrentVersion() {
54
54
  return "0.0.0";
55
55
  }
56
56
  }
57
+ /**
58
+ * Check if running from a local node_modules install (vs npx cache)
59
+ *
60
+ * Local installs are in: <project>/node_modules/sequant/
61
+ * npx installs are in: ~/.npm/_npx/<hash>/node_modules/sequant/
62
+ *
63
+ * This matters because:
64
+ * - Local installs should be updated with: npm update sequant
65
+ * - npx installs should be updated with: npx sequant@latest
66
+ */
67
+ export function isLocalNodeModulesInstall() {
68
+ // Check if our path contains node_modules/sequant but NOT in .npm/_npx
69
+ const normalizedPath = __dirname.replace(/\\/g, "/");
70
+ // Running from local node_modules (not npx cache)
71
+ const inNodeModules = normalizedPath.includes("/node_modules/sequant");
72
+ const inNpxCache = normalizedPath.includes("/.npm/_npx/") ||
73
+ normalizedPath.includes("\\.npm\\_npx\\");
74
+ return inNodeModules && !inNpxCache;
75
+ }
57
76
  /**
58
77
  * Read the version cache
59
78
  */
@@ -158,10 +177,19 @@ export function isOutdated(currentVersion, latestVersion) {
158
177
  }
159
178
  /**
160
179
  * Get the version warning message
180
+ *
181
+ * For local node_modules installs, recommends `npm update sequant`
182
+ * For npx usage, recommends `npx sequant@latest`
161
183
  */
162
- export function getVersionWarning(currentVersion, latestVersion) {
184
+ export function getVersionWarning(currentVersion, latestVersion, isLocal) {
185
+ const isLocalInstall = isLocal ?? isLocalNodeModulesInstall();
186
+ if (isLocalInstall) {
187
+ return `sequant ${latestVersion} is available (you have ${currentVersion})
188
+ Run: npm update sequant
189
+ Note: You have sequant as a local dependency. npx uses your node_modules version.`;
190
+ }
163
191
  return `sequant ${latestVersion} is available (you have ${currentVersion})
164
- Run: npx sequant@latest or npm update sequant`;
192
+ Run: npx sequant@latest`;
165
193
  }
166
194
  /**
167
195
  * Check version freshness (thorough - for doctor command)
@@ -169,12 +197,14 @@ export function getVersionWarning(currentVersion, latestVersion) {
169
197
  */
170
198
  export async function checkVersionThorough() {
171
199
  const currentVersion = getCurrentVersion();
200
+ const isLocal = isLocalNodeModulesInstall();
172
201
  const latestVersion = await fetchLatestVersion();
173
202
  if (!latestVersion) {
174
203
  return {
175
204
  currentVersion,
176
205
  latestVersion: null,
177
206
  isOutdated: false,
207
+ isLocalInstall: isLocal,
178
208
  error: "Could not fetch latest version",
179
209
  };
180
210
  }
@@ -184,6 +214,7 @@ export async function checkVersionThorough() {
184
214
  currentVersion,
185
215
  latestVersion,
186
216
  isOutdated: isOutdated(currentVersion, latestVersion),
217
+ isLocalInstall: isLocal,
187
218
  };
188
219
  }
189
220
  /**
@@ -192,6 +223,7 @@ export async function checkVersionThorough() {
192
223
  */
193
224
  export async function checkVersionCached() {
194
225
  const currentVersion = getCurrentVersion();
226
+ const isLocal = isLocalNodeModulesInstall();
195
227
  // Check cache first
196
228
  const cache = readCache();
197
229
  if (cache && isCacheFresh(cache)) {
@@ -199,6 +231,7 @@ export async function checkVersionCached() {
199
231
  currentVersion,
200
232
  latestVersion: cache.latestVersion,
201
233
  isOutdated: isOutdated(currentVersion, cache.latestVersion),
234
+ isLocalInstall: isLocal,
202
235
  };
203
236
  }
204
237
  // Fetch new version (with timeout)
@@ -210,12 +243,14 @@ export async function checkVersionCached() {
210
243
  currentVersion,
211
244
  latestVersion: cache.latestVersion,
212
245
  isOutdated: isOutdated(currentVersion, cache.latestVersion),
246
+ isLocalInstall: isLocal,
213
247
  };
214
248
  }
215
249
  return {
216
250
  currentVersion,
217
251
  latestVersion: null,
218
252
  isOutdated: false,
253
+ isLocalInstall: isLocal,
219
254
  };
220
255
  }
221
256
  // Update cache
@@ -224,5 +259,6 @@ export async function checkVersionCached() {
224
259
  currentVersion,
225
260
  latestVersion,
226
261
  isOutdated: isOutdated(currentVersion, latestVersion),
262
+ isLocalInstall: isLocal,
227
263
  };
228
264
  }
@@ -15,6 +15,7 @@
15
15
  * console.log(log.summary.passed, log.summary.failed);
16
16
  * ```
17
17
  */
18
+ import { randomUUID } from "node:crypto";
18
19
  import { z } from "zod";
19
20
  /**
20
21
  * Available workflow phases
@@ -159,7 +160,7 @@ export function generateLogFilename(runId, startTime) {
159
160
  * @returns Initial RunLog structure
160
161
  */
161
162
  export function createEmptyRunLog(config) {
162
- const runId = crypto.randomUUID();
163
+ const runId = randomUUID();
163
164
  const startTime = new Date().toISOString();
164
165
  return {
165
166
  version: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sequant",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Quantize your development workflow - Sequential AI phases with quality gates",
5
5
  "type": "module",
6
6
  "bin": {
@@ -54,7 +54,7 @@
54
54
  "node": ">=18.0.0"
55
55
  },
56
56
  "dependencies": {
57
- "@anthropic-ai/claude-agent-sdk": "^0.2.1",
57
+ "@anthropic-ai/claude-agent-sdk": "^0.2.11",
58
58
  "chalk": "^5.3.0",
59
59
  "commander": "^12.1.0",
60
60
  "diff": "^7.0.0",
@@ -0,0 +1,655 @@
1
+ ---
2
+ name: improve
3
+ description: "Codebase analysis, improvement discovery, issue creation, and execution pipeline"
4
+ license: MIT
5
+ metadata:
6
+ author: sequant
7
+ version: "1.0"
8
+ allowed-tools:
9
+ - Read
10
+ - Glob
11
+ - Grep
12
+ - Bash(gh *)
13
+ - Bash(git *)
14
+ - Bash(npm run *)
15
+ - Bash(npx *)
16
+ - AskUserQuestion
17
+ ---
18
+
19
+ # Improve Command
20
+
21
+ You are the "Improvement Agent" for the current repository.
22
+
23
+ ## Purpose
24
+
25
+ When invoked as `/improve [area]`, your job is to:
26
+
27
+ 1. **Analyze** the codebase (or specified area) for potential improvements
28
+ 2. **Present** findings categorized by type and effort level
29
+ 3. **Create** GitHub issues for user-selected improvements
30
+ 4. **Offer** `sequant run` command for immediate execution
31
+
32
+ ## Invocation
33
+
34
+ ```bash
35
+ /improve # Analyze entire codebase
36
+ /improve src/utils # Focus on specific directory
37
+ /improve src/lib/api.ts # Focus on specific file
38
+ /improve performance # Focus on performance improvements
39
+ /improve tests # Focus on test coverage gaps
40
+ /improve docs # Focus on documentation gaps
41
+ /improve security # Focus on security concerns
42
+ ```
43
+
44
+ ## Workflow Overview
45
+
46
+ ```
47
+ /improve [area]
48
+ ├────────────────────────────────────────────────────────────┤
49
+ │ │
50
+ │ ┌──────────┐ │
51
+ │ │ ANALYZE │ Scan codebase for improvement opportunities │
52
+ │ └────┬─────┘ │
53
+ │ │ │
54
+ │ ▼ │
55
+ │ ┌──────────┐ │
56
+ │ │ PRESENT │ Show findings grouped by type and effort │
57
+ │ └────┬─────┘ │
58
+ │ │ │
59
+ │ ▼ │
60
+ │ ┌──────────┐ │
61
+ │ │ SELECT │ User selects which improvements to pursue │
62
+ │ └────┬─────┘ │
63
+ │ │ │
64
+ │ ▼ │
65
+ │ ┌──────────┐ │
66
+ │ │ CREATE │ Create GitHub issues for selected items │
67
+ │ └────┬─────┘ │
68
+ │ │ │
69
+ │ ▼ │
70
+ │ ┌──────────┐ │
71
+ │ │ EXECUTE │ Offer sequant run command │
72
+ │ └──────────┘ │
73
+ └────────────────────────────────────────────────────────────┘
74
+ ```
75
+
76
+ ## Phase 1: Analysis
77
+
78
+ ### 1.1 Scope Detection
79
+
80
+ Determine analysis scope based on invocation:
81
+
82
+ | Invocation | Scope |
83
+ |------------|-------|
84
+ | `/improve` | Entire `src/` directory (or project root) |
85
+ | `/improve src/utils` | Specific directory |
86
+ | `/improve file.ts` | Single file |
87
+ | `/improve performance` | Performance-focused analysis |
88
+ | `/improve tests` | Test coverage analysis |
89
+ | `/improve docs` | Documentation analysis |
90
+ | `/improve security` | Security-focused analysis |
91
+
92
+ ### 1.2 Analysis Categories
93
+
94
+ Scan for improvements in these categories:
95
+
96
+ #### Code Quality
97
+ - Inconsistent patterns across similar files
98
+ - Complex functions (high cyclomatic complexity)
99
+ - Code duplication
100
+ - Unused exports or dead code
101
+ - Missing error handling
102
+ - Type safety issues (`any` types, missing types)
103
+
104
+ **Detection strategies:**
105
+ ```bash
106
+ # Find 'any' types
107
+ grep -r ": any" --include="*.ts" --include="*.tsx"
108
+
109
+ # Find TODO/FIXME comments
110
+ grep -r "TODO\|FIXME" --include="*.ts" --include="*.tsx"
111
+
112
+ # Find large files (potential split candidates)
113
+ find src -name "*.ts" -exec wc -l {} \; | sort -rn | head -20
114
+
115
+ # Find duplicate code patterns
116
+ # (Analyze similar function signatures across files)
117
+ ```
118
+
119
+ #### Performance
120
+ - Inefficient loops or operations
121
+ - Missing memoization opportunities
122
+ - Unnecessary re-renders (React)
123
+ - Large bundle imports
124
+ - Missing lazy loading
125
+
126
+ **Detection strategies:**
127
+ ```bash
128
+ # Find large dependencies
129
+ grep -r "from ['\"]" --include="*.ts" | grep -E "lodash|moment|axios" | head -10
130
+
131
+ # Find potential N+1 patterns
132
+ grep -r "\.map\(.*await" --include="*.ts"
133
+ ```
134
+
135
+ #### Missing Tests
136
+ - Files without corresponding test files
137
+ - Exported functions without test coverage
138
+ - Edge cases not covered
139
+
140
+ **Detection strategies:**
141
+ ```bash
142
+ # Find files without tests
143
+ for f in src/**/*.ts; do
144
+ test_file="${f%.ts}.test.ts"
145
+ if [ ! -f "$test_file" ]; then
146
+ echo "Missing test: $f"
147
+ fi
148
+ done
149
+ ```
150
+
151
+ #### Documentation Gaps
152
+ - Public APIs without JSDoc
153
+ - Missing README sections
154
+ - Outdated documentation
155
+ - Missing usage examples
156
+
157
+ **Detection strategies:**
158
+ ```bash
159
+ # Find exported functions without JSDoc
160
+ grep -B5 "export function\|export const\|export class" --include="*.ts"
161
+ ```
162
+
163
+ #### Security Concerns
164
+ - Hardcoded secrets or credentials
165
+ - SQL injection risks
166
+ - XSS vulnerabilities
167
+ - Insecure dependencies
168
+
169
+ **Detection strategies:**
170
+ ```bash
171
+ # Find potential secrets
172
+ grep -r "password\|secret\|api_key\|apikey" --include="*.ts" -i
173
+
174
+ # Check for outdated dependencies
175
+ npm audit --json 2>/dev/null | jq '.vulnerabilities | length'
176
+ ```
177
+
178
+ #### Refactoring Candidates
179
+ - Functions > 50 lines
180
+ - Files > 500 lines
181
+ - Deeply nested code
182
+ - God objects/functions
183
+
184
+ **Detection strategies:**
185
+ ```bash
186
+ # Find long functions
187
+ # (Manual analysis based on function boundaries)
188
+
189
+ # Find long files
190
+ find src -name "*.ts" -exec wc -l {} \; | awk '$1 > 500'
191
+ ```
192
+
193
+ ### 1.3 MCP Enhancement (Optional)
194
+
195
+ If MCP servers are available, enhance analysis:
196
+
197
+ **Context7 (if available):**
198
+ - Check for outdated library patterns
199
+ - Suggest modern alternatives
200
+
201
+ **Sequential Thinking (if available):**
202
+ - Deep analysis of complex refactoring decisions
203
+
204
+ **Fallback:** All core functionality works with standard tools only.
205
+
206
+ ## Phase 2: Critical Self-Assessment (REQUIRED)
207
+
208
+ **Before presenting any findings, critically evaluate each one.**
209
+
210
+ The goal is to filter out busywork and only surface improvements that provide real value. Pattern-matching finds "issues" - honest assessment determines if they matter.
211
+
212
+ ### 2.1 Assessment Questions
213
+
214
+ For each potential finding, ask:
215
+
216
+ | Question | If "No" → Filter Out |
217
+ |----------|---------------------|
218
+ | Does this cause real problems today? | Skip theoretical issues |
219
+ | Would fixing this measurably improve the codebase? | Skip cosmetic changes |
220
+ | Is the fix worth the maintenance burden it adds? | Skip if tests/code add more complexity than value |
221
+ | Would a senior engineer care about this? | Skip pedantic findings |
222
+ | Is this the right time to fix this? | Skip if other priorities exist |
223
+
224
+ ### 2.2 Common False Positives to Filter
225
+
226
+ **Always skip these unless explicitly requested:**
227
+
228
+ | Pattern Match | Why It's Usually Noise |
229
+ |---------------|----------------------|
230
+ | `any` in test files | Test mocks are hard to type; ESLint disables are fine |
231
+ | `any` with eslint-disable comment | Already acknowledged and accepted |
232
+ | Missing tests for <100 line files | Maintenance burden exceeds value |
233
+ | Missing tests for files tested implicitly | Integration tests often suffice |
234
+ | TODOs that are "nice to have" | If it worked without it for months, it's low priority |
235
+ | Large files that work fine | Size alone isn't a problem if code is cohesive |
236
+ | Low-severity dependency vulns | DoS in dev tools rarely matters |
237
+ | Missing JSDoc on internal functions | Self-documenting code > comment maintenance |
238
+
239
+ ### 2.3 Honest Filtering
240
+
241
+ After filtering, you should typically have:
242
+ - **0-3 findings** for a well-maintained codebase
243
+ - **5-10 findings** for a codebase with real issues
244
+ - **10+ findings** only for neglected codebases
245
+
246
+ **If your initial scan found 10+ issues but filtering leaves 0-2, that's correct behavior.** Report honestly:
247
+
248
+ ```markdown
249
+ ## Codebase Improvement Analysis
250
+
251
+ **Scope:** `src/`
252
+ **Initial Scan:** 12 potential issues
253
+ **After Critical Assessment:** 2 worth addressing
254
+
255
+ The codebase is in good shape. Most findings were false positives:
256
+ - 8 "missing tests" for small files (not worth the maintenance)
257
+ - 1 `any` type in test file (already has eslint-disable)
258
+ - 1 TODO that's a nice-to-have, not a bug
259
+ ```
260
+
261
+ ### 2.4 When to Keep Findings
262
+
263
+ Keep findings that:
264
+ - Cause actual bugs or errors
265
+ - Block future development
266
+ - Create security vulnerabilities (real ones, not theoretical)
267
+ - Make the code significantly harder to understand
268
+ - Were explicitly requested by the user (e.g., `/improve tests`)
269
+
270
+ ## Phase 3: Present Findings
271
+
272
+ ### 3.1 Effort Classification
273
+
274
+ Categorize each finding by estimated effort:
275
+
276
+ | Category | Description | Typical Items |
277
+ |----------|-------------|---------------|
278
+ | **Quick Wins** | < 1 hour | Add missing types, fix linting, add JSDoc |
279
+ | **Medium Effort** | 1-4 hours | Add tests, refactor function, improve error handling |
280
+ | **Larger Refactors** | 4+ hours | Split large file, redesign module, add feature |
281
+
282
+ ### 3.2 Output Format
283
+
284
+ Present findings in a structured, actionable format:
285
+
286
+ ```markdown
287
+ ## Codebase Improvement Analysis
288
+
289
+ **Scope:** `src/` (or specified area)
290
+ **Files Analyzed:** 47
291
+ **Issues Found:** 12
292
+
293
+ ---
294
+
295
+ ### Quick Wins (< 1 hour)
296
+
297
+ | # | Type | Location | Description |
298
+ |---|------|----------|-------------|
299
+ | 1 | Type Safety | `src/lib/api.ts:45` | Replace `any` with proper type |
300
+ | 2 | Documentation | `src/utils/format.ts` | Add JSDoc to exported functions |
301
+ | 3 | Code Quality | `src/components/Button.tsx` | Remove unused import |
302
+
303
+ ### Medium Effort (1-4 hours)
304
+
305
+ | # | Type | Location | Description |
306
+ |---|------|----------|-------------|
307
+ | 4 | Tests | `src/lib/validation.ts` | Add unit tests (0% coverage) |
308
+ | 5 | Error Handling | `src/api/client.ts` | Add retry logic for network errors |
309
+ | 6 | Performance | `src/hooks/useData.ts` | Add memoization to prevent re-fetches |
310
+
311
+ ### Larger Refactors (4+ hours)
312
+
313
+ | # | Type | Location | Description |
314
+ |---|------|----------|-------------|
315
+ | 7 | Architecture | `src/lib/legacy.ts` | Split 800-line file into modules |
316
+ | 8 | Refactor | `src/components/Dashboard/` | Extract shared logic to hooks |
317
+
318
+ ---
319
+
320
+ **Select improvements to create issues for (enter numbers, e.g., "1,2,4,7"):**
321
+ ```
322
+
323
+ ## Phase 4: Selection
324
+
325
+ ### 4.1 User Selection
326
+
327
+ Use `AskUserQuestion` to let the user select improvements:
328
+
329
+ ```javascript
330
+ AskUserQuestion({
331
+ questions: [{
332
+ question: "Which improvements would you like to create issues for?",
333
+ header: "Select",
334
+ options: [
335
+ { label: "All Quick Wins", description: "Create issues for items 1-3" },
336
+ { label: "All Medium", description: "Create issues for items 4-6" },
337
+ { label: "Custom Selection", description: "Specify item numbers" }
338
+ ],
339
+ multiSelect: false
340
+ }]
341
+ })
342
+ ```
343
+
344
+ ### 4.2 Validation
345
+
346
+ - Validate selected numbers exist
347
+ - Confirm selections before creating issues
348
+ - Allow adding related items
349
+
350
+ ## Phase 5: Issue Creation
351
+
352
+ ### 5.1 Issue Template
353
+
354
+ For each selected improvement, create a well-formatted GitHub issue:
355
+
356
+ ```markdown
357
+ ## Summary
358
+
359
+ [Brief description of the improvement]
360
+
361
+ ## Current State
362
+
363
+ [What currently exists or the problem]
364
+
365
+ ## Proposed Change
366
+
367
+ [What should be done]
368
+
369
+ ## Acceptance Criteria
370
+
371
+ - [ ] [Specific, testable criteria]
372
+ - [ ] [Another criterion]
373
+
374
+ ## Context
375
+
376
+ - **Location:** `[file path]`
377
+ - **Type:** [Code Quality | Performance | Tests | Docs | Security | Refactor]
378
+ - **Effort:** [Quick Win | Medium | Large]
379
+ - **Identified by:** `/improve` analysis
380
+
381
+ ## Related
382
+
383
+ - Part of improvement batch from `/improve` analysis
384
+ - Related issues: [if any]
385
+ ```
386
+
387
+ ### 5.2 Label Mapping
388
+
389
+ Map improvement types to GitHub labels:
390
+
391
+ | Type | Labels |
392
+ |------|--------|
393
+ | Code Quality | `enhancement`, `code-quality` |
394
+ | Performance | `enhancement`, `performance` |
395
+ | Missing Tests | `enhancement`, `tests` |
396
+ | Documentation | `docs` |
397
+ | Security | `security`, `priority:high` |
398
+ | Refactoring | `enhancement`, `refactor` |
399
+
400
+ ### 5.3 Issue Creation
401
+
402
+ ```bash
403
+ gh issue create \
404
+ --title "improve(<scope>): <brief description>" \
405
+ --body "<issue body>" \
406
+ --label "<labels>"
407
+ ```
408
+
409
+ ### 5.4 Batch Creation
410
+
411
+ When creating multiple issues:
412
+ 1. Create issues sequentially
413
+ 2. Collect issue numbers
414
+ 3. Link related issues in comments
415
+ 4. Output summary
416
+
417
+ ```markdown
418
+ ## Issues Created
419
+
420
+ | # | Issue | Title | Labels |
421
+ |---|-------|-------|--------|
422
+ | 1 | #234 | improve(api): Add proper types to api.ts | enhancement, code-quality |
423
+ | 2 | #235 | improve(validation): Add unit tests | enhancement, tests |
424
+ | 3 | #236 | improve(legacy): Split into modules | enhancement, refactor |
425
+ ```
426
+
427
+ ## Phase 6: Execution Offer
428
+
429
+ ### 6.1 Output Command
430
+
431
+ After creating issues, offer the execution command:
432
+
433
+ ```markdown
434
+ ## Ready to Execute
435
+
436
+ Created issues: #234, #235, #236
437
+
438
+ **Run these improvements:**
439
+ ```bash
440
+ npx sequant run 234 235 236
441
+ ```
442
+
443
+ **Or run individually:**
444
+ ```bash
445
+ /fullsolve 234 # Quick win: Add types
446
+ /fullsolve 235 # Medium: Add tests
447
+ /fullsolve 236 # Large: Split legacy file
448
+ ```
449
+
450
+ > **Tip:** Quick wins (#234) are great candidates for batch execution.
451
+ > Larger refactors (#236) may benefit from `/fullsolve` for more thorough handling.
452
+ ```
453
+
454
+ ### 6.2 Execution Options
455
+
456
+ Provide context-aware recommendations:
457
+
458
+ - **Quick Wins:** Recommend batch execution with `sequant run`
459
+ - **Medium Effort:** Recommend sequential execution
460
+ - **Large Refactors:** Recommend individual `/fullsolve` with quality loop
461
+
462
+ ## Configuration
463
+
464
+ | Setting | Default | Description |
465
+ |---------|---------|-------------|
466
+ | MAX_FINDINGS | 20 | Maximum improvements to report |
467
+ | SKIP_NODE_MODULES | true | Ignore node_modules |
468
+ | INCLUDE_PATTERNS | `*.ts,*.tsx,*.js,*.jsx` | Files to analyze |
469
+ | EXCLUDE_PATTERNS | `*.test.*,*.spec.*` | Files to skip |
470
+
471
+ ## Examples
472
+
473
+ ### Example 1: Full Codebase Analysis
474
+
475
+ ```
476
+ User: /improve
477
+
478
+ Agent: Analyzing codebase for improvement opportunities...
479
+
480
+ ## Codebase Improvement Analysis
481
+
482
+ **Scope:** `src/`
483
+ **Files Analyzed:** 47
484
+ **Issues Found:** 8
485
+
486
+ ---
487
+
488
+ ### Quick Wins (< 1 hour)
489
+
490
+ | # | Type | Location | Description |
491
+ |---|------|----------|-------------|
492
+ | 1 | Type Safety | `src/lib/api.ts:45` | Replace `any` with `ApiResponse` type |
493
+ | 2 | Code Quality | `src/utils/index.ts` | Remove unused `formatDate` export |
494
+
495
+ ### Medium Effort (1-4 hours)
496
+
497
+ | # | Type | Location | Description |
498
+ |---|------|----------|-------------|
499
+ | 3 | Tests | `src/lib/validation.ts` | Add unit tests (currently 0% coverage) |
500
+ | 4 | Documentation | `src/hooks/` | Add JSDoc to custom hooks |
501
+
502
+ ### Larger Refactors (4+ hours)
503
+
504
+ | # | Type | Location | Description |
505
+ |---|------|----------|-------------|
506
+ | 5 | Architecture | `src/lib/legacy.ts` | Split 800-line file into modules |
507
+
508
+ ---
509
+
510
+ Which improvements would you like to create issues for?
511
+
512
+ User: 1, 3, 5
513
+
514
+ Agent: Creating 3 issues...
515
+
516
+ ## Issues Created
517
+
518
+ | # | Issue | Title | Labels |
519
+ |---|-------|-------|--------|
520
+ | 1 | #234 | improve(api): Replace any type with ApiResponse | enhancement |
521
+ | 2 | #235 | improve(validation): Add unit tests | enhancement, tests |
522
+ | 3 | #236 | improve(legacy): Split into modules | enhancement, refactor |
523
+
524
+ ## Ready to Execute
525
+
526
+ **Run these improvements:**
527
+ ```bash
528
+ npx sequant run 234 235 236
529
+ ```
530
+
531
+ > **Tip:** Issue #234 is a quick win - great for batch execution.
532
+ > Issue #236 has `refactor` label - quality loop will auto-enable.
533
+ ```
534
+
535
+ ### Example 2: Focused Analysis
536
+
537
+ ```
538
+ User: /improve src/lib/api.ts
539
+
540
+ Agent: Analyzing `src/lib/api.ts` for improvement opportunities...
541
+
542
+ ## File Improvement Analysis
543
+
544
+ **File:** `src/lib/api.ts`
545
+ **Lines:** 245
546
+ **Issues Found:** 4
547
+
548
+ ---
549
+
550
+ ### Quick Wins
551
+
552
+ | # | Type | Location | Description |
553
+ |---|------|----------|-------------|
554
+ | 1 | Type Safety | Line 45 | Replace `data: any` with proper type |
555
+ | 2 | Type Safety | Line 78 | Replace `options?: any` with `RequestOptions` |
556
+
557
+ ### Medium Effort
558
+
559
+ | # | Type | Location | Description |
560
+ |---|------|----------|-------------|
561
+ | 3 | Error Handling | Lines 89-120 | Add retry logic for transient errors |
562
+ | 4 | Tests | - | Add integration tests for API client |
563
+
564
+ ---
565
+
566
+ Which improvements would you like to create issues for?
567
+ ```
568
+
569
+ ### Example 3: Topic-Focused Analysis
570
+
571
+ ```
572
+ User: /improve security
573
+
574
+ Agent: Running security-focused analysis...
575
+
576
+ ## Security Analysis
577
+
578
+ **Scope:** Entire codebase
579
+ **Files Analyzed:** 47
580
+ **Security Issues Found:** 3
581
+
582
+ ---
583
+
584
+ ### Findings
585
+
586
+ | # | Severity | Location | Description |
587
+ |---|----------|----------|-------------|
588
+ | 1 | Medium | `src/config.ts:12` | API key in source (should use env var) |
589
+ | 2 | Low | `package.json` | 2 dependencies with known vulnerabilities |
590
+ | 3 | Info | `src/api/client.ts` | No request timeout configured |
591
+
592
+ ---
593
+
594
+ Which issues would you like to create?
595
+ ```
596
+
597
+ ## Error Handling
598
+
599
+ ### No Improvements Found
600
+
601
+ If analysis finds no improvements:
602
+
603
+ ```markdown
604
+ ## Codebase Improvement Analysis
605
+
606
+ **Scope:** `src/utils/`
607
+ **Files Analyzed:** 5
608
+ **Issues Found:** 0
609
+
610
+ No significant improvement opportunities identified in this area.
611
+
612
+ **Suggestions:**
613
+ - Try analyzing a larger scope: `/improve src/`
614
+ - Focus on a specific category: `/improve tests`
615
+ - The codebase may already be well-maintained
616
+ ```
617
+
618
+ ### Invalid Scope
619
+
620
+ If the specified path doesn't exist:
621
+
622
+ ```markdown
623
+ Error: Path `src/nonexistent/` not found.
624
+
625
+ **Did you mean:**
626
+ - `src/utils/`
627
+ - `src/lib/`
628
+
629
+ **Or try:**
630
+ - `/improve` (analyze entire codebase)
631
+ ```
632
+
633
+ ## Notes
634
+
635
+ - This skill is **interactive** - it analyzes, presents, and waits for user selection
636
+ - Issue creation requires user confirmation before proceeding
637
+ - All analysis uses standard tools (Glob, Grep, Read) - no MCP dependency
638
+ - Large codebases may be sampled to keep analysis manageable
639
+ - Focus arguments (`performance`, `tests`, etc.) narrow the analysis scope
640
+
641
+ ---
642
+
643
+ ## Output Verification
644
+
645
+ **Before responding, verify your output includes ALL of these:**
646
+
647
+ - [ ] **Analysis Summary** - Scope, files analyzed, issues found
648
+ - [ ] **Categorized Findings** - Quick Wins, Medium Effort, Larger Refactors tables
649
+ - [ ] **Selection Prompt** - Ask user which items to create issues for
650
+ - [ ] **Issues Created** - Table with issue numbers, titles, and labels (after selection)
651
+ - [ ] **Execution Command** - `npx sequant run <issue-numbers>` command
652
+ - [ ] **Recommendations** - Tips for running quick wins vs larger refactors
653
+
654
+ **DO NOT proceed to issue creation without user selection.**
655
+ **DO NOT respond until all items are verified.**