@miphamai/cli 0.7.7 → 0.7.8
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.
- package/package.json +1 -1
- package/src/ui/app.tsx +6 -6
- package/src/ui/commands.ts +53 -63
package/package.json
CHANGED
package/src/ui/app.tsx
CHANGED
|
@@ -175,12 +175,12 @@ export function App({
|
|
|
175
175
|
return
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
let
|
|
178
|
+
let forwardToAI: string | undefined
|
|
179
179
|
|
|
180
180
|
const handler = getCommand(command)
|
|
181
181
|
if (handler) {
|
|
182
182
|
const result = await handler(mkCtx(), args)
|
|
183
|
-
|
|
183
|
+
forwardToAI = result.forwardToAI
|
|
184
184
|
setMessages((prev) => [
|
|
185
185
|
...prev,
|
|
186
186
|
{ role: 'user', content: input },
|
|
@@ -206,12 +206,12 @@ export function App({
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
// Bridge: if command set
|
|
210
|
-
if (
|
|
211
|
-
input =
|
|
209
|
+
// Bridge: if command set forwardToAI, route the message to AI processing
|
|
210
|
+
if (forwardToAI) {
|
|
211
|
+
input = forwardToAI
|
|
212
212
|
// fall through to normal AI processing below
|
|
213
213
|
} else {
|
|
214
|
-
//
|
|
214
|
+
// No handler matched or handler didn't request AI routing — stop here
|
|
215
215
|
return
|
|
216
216
|
}
|
|
217
217
|
}
|
package/src/ui/commands.ts
CHANGED
|
@@ -40,8 +40,9 @@ export interface CommandResult {
|
|
|
40
40
|
clearMessages?: boolean
|
|
41
41
|
/** Content to copy to clipboard (handled by caller) */
|
|
42
42
|
copyContent?: string
|
|
43
|
-
/** If set,
|
|
44
|
-
|
|
43
|
+
/** If set, route this message to the AI engine — bridges slash commands → skill/agent invocation.
|
|
44
|
+
* The app layer replaces the user input with this string and falls through to AI processing. */
|
|
45
|
+
forwardToAI?: string
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
type CommandHandler = (
|
|
@@ -1196,7 +1197,7 @@ const loopCmd: CommandHandler = async (_ctx, args) => {
|
|
|
1196
1197
|
|
|
1197
1198
|
return {
|
|
1198
1199
|
content: `── Loop Started ──\n\nInterval: ${interval} (${seconds}s)\nPrompt: "${prompt}"\n\nScheduling via ScheduleWakeup — the prompt will re-schedule itself each cycle.\nUse /schedule to view active loops.`,
|
|
1199
|
-
|
|
1200
|
+
forwardToAI: `use ScheduleWakeup to set up a recurring loop. delaySeconds=${seconds}, prompt: "${prompt}". Include at the end of the prompt: "Then call ScheduleWakeup again with delaySeconds=${seconds} and the same prompt to continue the loop."`,
|
|
1200
1201
|
}
|
|
1201
1202
|
}
|
|
1202
1203
|
|
|
@@ -1430,82 +1431,71 @@ const issueCmd: CommandHandler = async () => {
|
|
|
1430
1431
|
}
|
|
1431
1432
|
}
|
|
1432
1433
|
|
|
1433
|
-
// ═══════════════════════════════════════════════════════════════
|
|
1434
|
-
// Code Quality Commands (Claude Code parity)
|
|
1435
|
-
// ═══════════════════════════════════════════════════════════════
|
|
1436
|
-
|
|
1437
1434
|
// ═══════════════════════════════════════════════════════════════
|
|
1438
1435
|
// Code Quality — bridge slash commands to skills (Claude Code parity)
|
|
1439
1436
|
// ═══════════════════════════════════════════════════════════════
|
|
1440
1437
|
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1438
|
+
/** Factory for git-diff-based commands that bridge to AI skills via forwardToAI. */
|
|
1439
|
+
function gitDiffBridgeCmd(opts: {
|
|
1440
|
+
label: string
|
|
1441
|
+
noChangesHint: string
|
|
1442
|
+
runningMsg: string
|
|
1443
|
+
forwardToAI: string
|
|
1444
|
+
}): CommandHandler {
|
|
1445
|
+
return async () => {
|
|
1446
|
+
try {
|
|
1447
|
+
const { execSync } = await import('node:child_process')
|
|
1448
|
+
const diff = execSync('git diff --stat', { encoding: 'utf-8', timeout: 5000 }).trim()
|
|
1449
|
+
if (!diff) {
|
|
1450
|
+
return { content: `─ ${opts.label} ─\n\n${opts.noChangesHint}` }
|
|
1449
1451
|
}
|
|
1450
|
-
}
|
|
1451
|
-
return {
|
|
1452
|
-
content:
|
|
1453
|
-
'─ Code Review ─\n\nReviewing uncommitted changes with the code-review skill (7 dimensions: correctness, security, performance, code quality, architecture, testing, language-specific)...',
|
|
1454
|
-
injectMessage:
|
|
1455
|
-
'use the code-review skill to review all uncommitted changes. Check all 7 dimensions: correctness, security, performance, code quality, architecture & design, testing, and language-specific issues.',
|
|
1456
|
-
}
|
|
1457
|
-
} catch {
|
|
1458
|
-
return { content: '─ Code Review ─\n\nCould not detect changes. Are you in a git repository?' }
|
|
1459
|
-
}
|
|
1460
|
-
}
|
|
1461
|
-
|
|
1462
|
-
const simplifyCmd: CommandHandler = async () => {
|
|
1463
|
-
try {
|
|
1464
|
-
const { execSync } = await import('node:child_process')
|
|
1465
|
-
const diff = execSync('git diff --stat', { encoding: 'utf-8', timeout: 5000 }).trim()
|
|
1466
|
-
if (!diff) {
|
|
1467
1452
|
return {
|
|
1468
|
-
content:
|
|
1469
|
-
|
|
1453
|
+
content: `─ ${opts.label} ─\n\n${opts.runningMsg}\n\nChanged files:\n${diff}`,
|
|
1454
|
+
forwardToAI: opts.forwardToAI,
|
|
1470
1455
|
}
|
|
1471
|
-
}
|
|
1472
|
-
return {
|
|
1473
|
-
content:
|
|
1474
|
-
'─ Simplify ─\n\nRunning cleanup review — 4 passes: reuse, simplification, efficiency, abstraction level...',
|
|
1475
|
-
injectMessage:
|
|
1476
|
-
'use the self-review skill to review these uncommitted changes. Focus on 4 cleanup passes: 1) Reuse — find duplicated logic, replace with existing helpers; 2) Simplification — flatten nesting, remove redundant state and dead code; 3) Efficiency — fix repeated object creation, unnecessary I/O, memory issues; 4) Abstraction Level — ensure code sits at the right architectural layer. Apply equivalent transformations only — do NOT change logic or fix bugs.',
|
|
1477
|
-
}
|
|
1478
|
-
} catch {
|
|
1479
|
-
return { content: '─ Simplify ─\n\nCould not detect changes. Are you in a git repository?' }
|
|
1480
|
-
}
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
|
-
const verifyCmd: CommandHandler = async () => {
|
|
1484
|
-
try {
|
|
1485
|
-
const { execSync } = await import('node:child_process')
|
|
1486
|
-
const diff = execSync('git diff --stat', { encoding: 'utf-8', timeout: 5000 }).trim()
|
|
1487
|
-
if (!diff) {
|
|
1456
|
+
} catch {
|
|
1488
1457
|
return {
|
|
1489
|
-
content:
|
|
1490
|
-
'─ Verify ─\n\nNo uncommitted changes to verify.\n\nMake changes first, then run /verify for runtime verification.',
|
|
1458
|
+
content: `─ ${opts.label} ─\n\nCould not detect changes. Are you in a git repository?`,
|
|
1491
1459
|
}
|
|
1492
1460
|
}
|
|
1493
|
-
return {
|
|
1494
|
-
content:
|
|
1495
|
-
'─ Verify ─\n\nRunning runtime verification — observing actual execution behavior (not tests, not typecheck)...',
|
|
1496
|
-
injectMessage:
|
|
1497
|
-
'verify these uncommitted changes through runtime observation only. For each change: 1) Find the user-facing surface (CLI command, API endpoint, UI interaction); 2) Drive the changed code to execute; 3) Push boundaries — pass null, repeated values, wrong types, interrupt mid-flow (Ctrl-C), resize window; 4) Report verdict per change: PASS (works as expected), FAIL (does not work or breaks something), BLOCKED (cannot reach observable state), SKIP (no runtime surface, e.g. pure documentation). Do NOT run the test suite — observe real execution behavior only.',
|
|
1498
|
-
}
|
|
1499
|
-
} catch {
|
|
1500
|
-
return { content: '─ Verify ─\n\nCould not detect changes. Are you in a git repository?' }
|
|
1501
1461
|
}
|
|
1502
1462
|
}
|
|
1503
1463
|
|
|
1504
|
-
const
|
|
1464
|
+
const codeReviewCmd = gitDiffBridgeCmd({
|
|
1465
|
+
label: 'Code Review',
|
|
1466
|
+
noChangesHint:
|
|
1467
|
+
'No uncommitted changes to review.\n\nTo review a specific file: /code-review path/to/file.ts',
|
|
1468
|
+
runningMsg:
|
|
1469
|
+
'Reviewing uncommitted changes with the code-review skill (7 dimensions: correctness, security, performance, code quality, architecture, testing, language-specific)...',
|
|
1470
|
+
forwardToAI:
|
|
1471
|
+
'use the code-review skill to review all uncommitted changes. Check all 7 dimensions: correctness, security, performance, code quality, architecture & design, testing, and language-specific issues.',
|
|
1472
|
+
})
|
|
1473
|
+
|
|
1474
|
+
const simplifyCmd = gitDiffBridgeCmd({
|
|
1475
|
+
label: 'Simplify',
|
|
1476
|
+
noChangesHint:
|
|
1477
|
+
'No uncommitted changes to simplify.\n\nMake changes first, then run /simplify for cleanup review.',
|
|
1478
|
+
runningMsg:
|
|
1479
|
+
'Running cleanup review — 4 passes: reuse, simplification, efficiency, abstraction level...',
|
|
1480
|
+
forwardToAI:
|
|
1481
|
+
'use the self-review skill to review these uncommitted changes. Focus on 4 cleanup passes: 1) Reuse — find duplicated logic, replace with existing helpers; 2) Simplification — flatten nesting, remove redundant state and dead code; 3) Efficiency — fix repeated object creation, unnecessary I/O, memory issues; 4) Abstraction Level — ensure code sits at the right architectural layer. Apply equivalent transformations only — do NOT change logic or fix bugs.',
|
|
1482
|
+
})
|
|
1483
|
+
|
|
1484
|
+
const verifyCmd = gitDiffBridgeCmd({
|
|
1485
|
+
label: 'Verify',
|
|
1486
|
+
noChangesHint:
|
|
1487
|
+
'No uncommitted changes to verify.\n\nMake changes first, then run /verify for runtime verification.',
|
|
1488
|
+
runningMsg:
|
|
1489
|
+
'Running runtime verification — observing actual execution behavior (not tests, not typecheck)...',
|
|
1490
|
+
forwardToAI:
|
|
1491
|
+
'verify these uncommitted changes through runtime observation only. For each change: 1) Find the user-facing surface (CLI command, API endpoint, UI interaction); 2) Drive the changed code to execute; 3) Push boundaries — pass null, repeated values, wrong types, interrupt mid-flow (Ctrl-C), resize window; 4) Report verdict per change: PASS (works as expected), FAIL (does not work or breaks something), BLOCKED (cannot reach observable state), SKIP (no runtime surface, e.g. pure documentation). Do NOT run the test suite — observe real execution behavior only.',
|
|
1492
|
+
})
|
|
1493
|
+
|
|
1494
|
+
const designCmd: CommandHandler = (_ctx, args) => {
|
|
1505
1495
|
const topic = args.join(' ') || 'the current task'
|
|
1506
1496
|
return {
|
|
1507
1497
|
content: `─ Design ─\n\nStarting architectural design session for: ${topic}\n\nExploring approaches, trade-offs, component breakdown, data flow...`,
|
|
1508
|
-
|
|
1498
|
+
forwardToAI: `help me design the architecture for ${topic}. Explore 2-3 approaches with trade-offs, then present a design covering: component breakdown, data flow, interfaces between components, error handling strategy, and testing approach. Use the plan sub-agent if deeper analysis would help. Prefer simplicity — YAGNI.`,
|
|
1509
1499
|
}
|
|
1510
1500
|
}
|
|
1511
1501
|
|