@miphamai/cli 0.2.4 → 0.3.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.
- package/package.json +4 -3
- package/skills/mipham/om-model-optimize.mipham-skill.md +55 -9
- package/skills/mipham/om-security.mipham-skill.md +82 -10
- package/skills/standard/doc-generator.SKILL.md +67 -11
- package/skills/standard/github-ops.SKILL.md +89 -13
- package/skills/standard/memory.SKILL.md +71 -11
- package/skills/standard/self-review.SKILL.md +49 -10
- package/skills/standard/superpower.SKILL.md +46 -8
- package/skills/standard/tdd.SKILL.md +85 -12
- package/skills/standard/web-search.SKILL.md +62 -13
- package/src/core/context.ts +73 -13
- package/src/core/engine.ts +159 -44
- package/src/core/permission.ts +31 -5
- package/src/core/session-store.ts +5 -1
- package/src/index.tsx +25 -0
- package/src/providers/anthropic.ts +2 -1
- package/src/providers/fetch-utils.ts +103 -0
- package/src/providers/openai-compat.ts +55 -8
- package/src/providers/registry.ts +1 -0
- package/src/ui/app.tsx +117 -14
- package/src/ui/chat.tsx +25 -7
- package/src/ui/commands.ts +31 -9
- package/src/ui/input.tsx +56 -35
package/src/ui/input.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react'
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react'
|
|
2
2
|
import { Box, Text } from 'ink'
|
|
3
3
|
import TextInput from 'ink-text-input'
|
|
4
4
|
|
|
@@ -7,32 +7,37 @@ interface InputBarProps {
|
|
|
7
7
|
isLoading: boolean
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
// ──
|
|
10
|
+
// ── Status verbs — English (Claude Code-aligned) + Chinese (Mipham originals) ──
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
'
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'融汇中', // Fusing
|
|
27
|
-
'觉照中', // Illuminating
|
|
28
|
-
'运转中', // Operating
|
|
29
|
-
'参详中', // Studying
|
|
30
|
-
'化合中', // Synthesizing
|
|
31
|
-
'浸润中', // Infusing
|
|
32
|
-
'焙烤中', // Baking
|
|
12
|
+
const STATUS_EN = [
|
|
13
|
+
'Doodling', 'Forging', 'Germinating', 'Mosmosing', 'Cerebrating',
|
|
14
|
+
'Boogieing', 'Finagling', 'Misting', 'Recombobulating', 'Slithering',
|
|
15
|
+
'Effecting', 'Roosting', 'Crystallizing', 'Canoodling', 'Billowing',
|
|
16
|
+
'Warping', 'Improvising', 'Metamorphing', 'Gusting', 'Whiring',
|
|
17
|
+
'Topsy-turvying', 'Flibbertigibetting', 'Wibbling', 'Thundering',
|
|
18
|
+
'Moseying', 'Julienning', 'Evaporating', 'Ruminating', 'Whisking',
|
|
19
|
+
'Scampering', 'Meandering', 'Concoting', 'Gesticulating', 'Flamebeing',
|
|
20
|
+
'Quantumizing', 'Waddling', 'Fluttering', 'Sprouting', 'Elucidating',
|
|
21
|
+
'Embellishing', 'Razzmatizing', 'Pondering', 'Cogitating', 'Garnishing',
|
|
22
|
+
'Actualizing', 'Zigzagging', 'Mustering', 'Frolicking', 'Hullaballooing',
|
|
23
|
+
'Doing', 'Fermenting', 'Considering', 'Skedaddling', 'Actioning',
|
|
24
|
+
'Orbiting', 'Perambulating', 'Drizzling', 'Schlepping', 'Ionizing',
|
|
25
|
+
'Scurrying',
|
|
33
26
|
]
|
|
34
27
|
|
|
35
|
-
const
|
|
28
|
+
const STATUS_CN = [
|
|
29
|
+
'思忖中', '推演中', '凝炼中', '熬煮中', '锻造中',
|
|
30
|
+
'研磨中', '解构中', '冥思中', '编织中', '萃取中',
|
|
31
|
+
'烹制中', '淬火中', '雕琢中', '融汇中', '觉照中',
|
|
32
|
+
'运转中', '参详中', '化合中', '浸润中', '焙烤中',
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
// Merge both — bilingual status verbs
|
|
36
|
+
const STATUS_GERUNDS = [...STATUS_EN, ...STATUS_CN]
|
|
37
|
+
|
|
38
|
+
const STATUS_PAST = [
|
|
39
|
+
'Brewed', 'Churned', 'Cooked', 'Sautéed', 'Cogitated', 'Crunched',
|
|
40
|
+
]
|
|
36
41
|
|
|
37
42
|
function pick<T>(arr: T[]): T {
|
|
38
43
|
return arr[Math.floor(Math.random() * arr.length)]!
|
|
@@ -40,25 +45,35 @@ function pick<T>(arr: T[]): T {
|
|
|
40
45
|
|
|
41
46
|
export function InputBar({ onSubmit, isLoading }: InputBarProps) {
|
|
42
47
|
const [value, setValue] = useState('')
|
|
43
|
-
const [verb, setVerb] = useState(() => pick(
|
|
44
|
-
const [
|
|
48
|
+
const [verb, setVerb] = useState(() => pick(STATUS_GERUNDS))
|
|
49
|
+
const [completionVerb, setCompletionVerb] = useState<string | null>(null)
|
|
50
|
+
const prevLoading = useRef(isLoading)
|
|
45
51
|
|
|
46
|
-
// Rotate
|
|
52
|
+
// Rotate gerunds while loading
|
|
47
53
|
useEffect(() => {
|
|
48
54
|
if (!isLoading) return
|
|
49
55
|
const interval = setInterval(() => {
|
|
50
|
-
setVerb(pick(
|
|
51
|
-
|
|
52
|
-
}, 2000)
|
|
56
|
+
setVerb(pick(STATUS_GERUNDS))
|
|
57
|
+
}, 1200)
|
|
53
58
|
return () => clearInterval(interval)
|
|
54
59
|
}, [isLoading])
|
|
55
60
|
|
|
56
|
-
//
|
|
61
|
+
// Pick a fresh gerund when loading starts
|
|
57
62
|
useEffect(() => {
|
|
58
63
|
if (isLoading) {
|
|
59
|
-
setVerb(pick(
|
|
60
|
-
|
|
64
|
+
setVerb(pick(STATUS_GERUNDS))
|
|
65
|
+
setCompletionVerb(null)
|
|
66
|
+
}
|
|
67
|
+
}, [isLoading])
|
|
68
|
+
|
|
69
|
+
// Flash a past participle when loading stops
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (prevLoading.current === true && isLoading === false) {
|
|
72
|
+
setCompletionVerb(pick(STATUS_PAST))
|
|
73
|
+
const timer = setTimeout(() => setCompletionVerb(null), 1500)
|
|
74
|
+
return () => clearTimeout(timer)
|
|
61
75
|
}
|
|
76
|
+
prevLoading.current = isLoading
|
|
62
77
|
}, [isLoading])
|
|
63
78
|
|
|
64
79
|
const handleSubmit = (val: string) => {
|
|
@@ -70,13 +85,19 @@ export function InputBar({ onSubmit, isLoading }: InputBarProps) {
|
|
|
70
85
|
return (
|
|
71
86
|
<Box marginTop={1}>
|
|
72
87
|
<Box marginRight={1}>
|
|
73
|
-
<Text color={isLoading ? 'yellow' : 'cyan'}>{
|
|
88
|
+
<Text color={isLoading ? 'yellow' : 'cyan'}>{'>'}</Text>
|
|
74
89
|
</Box>
|
|
75
90
|
<TextInput
|
|
76
91
|
value={value}
|
|
77
92
|
onChange={setValue}
|
|
78
93
|
onSubmit={handleSubmit}
|
|
79
|
-
placeholder={
|
|
94
|
+
placeholder={
|
|
95
|
+
isLoading
|
|
96
|
+
? `${verb}...`
|
|
97
|
+
: completionVerb
|
|
98
|
+
? completionVerb
|
|
99
|
+
: 'Type a message (Esc to cancel)...'
|
|
100
|
+
}
|
|
80
101
|
/>
|
|
81
102
|
</Box>
|
|
82
103
|
)
|