@miphamai/cli 0.16.2 → 0.16.4

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/bin/mipham.ts CHANGED
@@ -331,6 +331,32 @@ async function main() {
331
331
  process.exit(0)
332
332
  }
333
333
 
334
+ // ── Help flag ─────────────────────────────────────────────────────────────
335
+ if (
336
+ process.argv.includes('--help') ||
337
+ process.argv.includes('-h') ||
338
+ process.argv.slice(2).some((a) => a === 'help')
339
+ ) {
340
+ console.log(`Mipham Code — AI-powered coding terminal
341
+
342
+ Usage:
343
+ mipham Launch interactive CLI
344
+ mipham update Update to the latest version
345
+ mipham upgrade Same as 'mipham update'
346
+ mipham plugin <cmd> Plugin management (install, list, remove, etc.)
347
+ mipham workflow <cmd> Workflow orchestration (run, list, resume, etc.)
348
+ mipham --version Print version and exit
349
+ mipham --help Show this help
350
+
351
+ Flags:
352
+ --safe-mode Skip custom agents, skills, hooks, plugins
353
+ --version, -v, -V Print version
354
+
355
+ Docs: https://mipham.ai/code
356
+ npm: https://www.npmjs.com/package/@miphamai/cli`)
357
+ process.exit(0)
358
+ }
359
+
334
360
  // ── Update / upgrade ──────────────────────────────────────────────────────
335
361
  const handledUpdate = await runUpdate()
336
362
  if (handledUpdate) return
@@ -343,6 +369,41 @@ async function main() {
343
369
  const handled = await runWorkflowCLI()
344
370
  if (handled) return
345
371
 
372
+ // ── Unknown command detection ──────────────────────────────────────────────
373
+ // After all known subcommands are checked, any remaining positional argument
374
+ // is probably a typo. Show error + suggestions instead of silently launching CLI.
375
+ const KNOWN_COMMANDS = ['update', 'upgrade', 'plugin', 'workflow', 'help']
376
+ const firstArg = process.argv.slice(2).find((a) => !a.startsWith('-'))
377
+ if (firstArg) {
378
+ // Levenshtein distance to find closest match
379
+ const distance = (a: string, b: string): number => {
380
+ const m = a.length
381
+ const n = b.length
382
+ const dp: number[][] = Array.from({ length: m + 1 }, () => Array(n + 1).fill(0))
383
+ for (let i = 0; i <= m; i++) dp[i]![0] = i
384
+ for (let j = 0; j <= n; j++) dp[0]![j] = j
385
+ for (let i = 1; i <= m; i++)
386
+ for (let j = 1; j <= n; j++)
387
+ dp[i]![j] =
388
+ a[i - 1] === b[j - 1]
389
+ ? dp[i - 1]![j - 1]!
390
+ : 1 + Math.min(dp[i - 1]![j]!, dp[i]![j - 1]!, dp[i - 1]![j - 1]!)
391
+ return dp[m]![n]!
392
+ }
393
+
394
+ const best = KNOWN_COMMANDS.map((cmd) => ({ cmd, dist: distance(firstArg, cmd) }))
395
+ .filter((c) => c.dist <= 3)
396
+ .sort((a, b) => a.dist - b.dist)
397
+ const suggestions = best.map((c) => `'mipham ${c.cmd}'`).join(', ')
398
+
399
+ console.error(`Unknown command: mipham ${firstArg}`)
400
+ if (suggestions) {
401
+ console.error(`Did you mean: ${suggestions}?`)
402
+ }
403
+ console.error(`Run 'mipham --help' for usage.`)
404
+ process.exit(1)
405
+ }
406
+
346
407
  // Parse --safe-mode flag: skip custom agents, skills, hooks, plugins
347
408
  const safeModeFlag = process.argv.includes('--safe-mode')
348
409
  if (safeModeFlag) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miphamai/cli",
3
- "version": "0.16.2",
3
+ "version": "0.16.4",
4
4
  "description": "Mipham Code — Multi-model open-core intelligent coding terminal by MiphamAI",
5
5
  "keywords": [
6
6
  "ai",
package/src/ui/app.tsx CHANGED
@@ -59,16 +59,21 @@ interface AgentProgress {
59
59
  // Version is read fresh from package.json at startup via runApp prop
60
60
  // (bypasses Bun module caching after npm update)
61
61
 
62
+ // Cycle order: Claude Code modes first (manual → accept edits → bypass),
63
+ // then Mipham-specific modes (plan → auto → dont ask).
62
64
  const PERMISSION_MODES: PermissionMode[] = [
63
65
  'default',
64
66
  'acceptEdits',
67
+ 'bypassPermissions',
65
68
  'plan',
66
69
  'auto',
67
70
  'dontAsk',
68
- 'bypassPermissions',
69
71
  ]
72
+ // Labels aligned with Claude Code terminology: describe behavior, not capability.
73
+ // Claude Code modes: manual mode → accept edits on → bypass
74
+ // Mipham extends with 3 extra modes (plan, auto, dontAsk) for finer control.
70
75
  const PERMISSION_LABELS: Record<PermissionMode, string> = {
71
- default: 'reads free',
76
+ default: 'manual mode',
72
77
  acceptEdits: 'accept edits on',
73
78
  plan: 'plan mode · read-only',
74
79
  auto: 'auto mode',
@@ -608,7 +613,7 @@ export function App({
608
613
  {/* Agent status footer — shows running background agents */}
609
614
  <AgentFooter agents={Object.values(runningAgents)} gitBranch={gitBranch} tick={agentTick} />
610
615
 
611
- {/* Status line — Claude Code style: compact, action-oriented */}
616
+ {/* Status line — Claude Code style */}
612
617
  <Box marginTop={1} flexDirection="column">
613
618
  {goalText && (
614
619
  <Box>
@@ -619,8 +624,8 @@ export function App({
619
624
  <Text color={PERMISSION_COLORS[permissionMode]}>
620
625
  ⏵⏵ {PERMISSION_LABELS[permissionMode]} (shift+tab to cycle)
621
626
  </Text>
622
- <Text dimColor> · Esc to interrupt</Text>
623
- <Text dimColor> · ← agents</Text>
627
+ <Text dimColor> · esc to interrupt</Text>
628
+ <Text dimColor> · ← for agents</Text>
624
629
  </Box>
625
630
  </Box>
626
631
  </Box>