@make-u-free/migi 0.3.7 → 0.3.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/bin/migi.js +16 -12
- package/package.json +1 -1
package/bin/migi.js
CHANGED
|
@@ -66,7 +66,17 @@ console.log(chalk.dim(' /exit 終了\n'))
|
|
|
66
66
|
|
|
67
67
|
const agent = new MigiAgent({ context, promptFn, apiKey, model, name: agentName, userName, teamsWebhookUrl })
|
|
68
68
|
|
|
69
|
-
function sep() {
|
|
69
|
+
function sep() {
|
|
70
|
+
const w = process.stdout.columns || 80
|
|
71
|
+
return chalk.dim('─'.repeat(w))
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function sepWithLabel(label) {
|
|
75
|
+
const w = process.stdout.columns || 80
|
|
76
|
+
const left = '── ' + label + ' '
|
|
77
|
+
const right = '─'.repeat(Math.max(0, w - left.length))
|
|
78
|
+
return chalk.dim(left + right)
|
|
79
|
+
}
|
|
70
80
|
|
|
71
81
|
// ---- 複数行入力(空行で送信)----
|
|
72
82
|
async function readMultiLine() {
|
|
@@ -75,7 +85,7 @@ async function readMultiLine() {
|
|
|
75
85
|
const onLine = (line) => {
|
|
76
86
|
if (line === '' && lines.length > 0) {
|
|
77
87
|
rl.removeListener('line', onLine)
|
|
78
|
-
//
|
|
88
|
+
// 入力ボックス下辺(欄の閉じ)+ 欄外ガイド
|
|
79
89
|
console.log(sep())
|
|
80
90
|
console.log(chalk.dim(` ✦ ${model} · Enterで改行 / 空行で送信`))
|
|
81
91
|
resolve(lines.join('\n'))
|
|
@@ -91,10 +101,8 @@ async function readMultiLine() {
|
|
|
91
101
|
|
|
92
102
|
// ---- メインループ ----
|
|
93
103
|
async function prompt() {
|
|
94
|
-
//
|
|
95
|
-
console.log('\n' +
|
|
96
|
-
console.log(chalk.bold.cyan(` ${userName || 'あなた'}`))
|
|
97
|
-
console.log(sep())
|
|
104
|
+
// 入力ボックス上辺(ユーザー名をセパレーターに埋め込む)
|
|
105
|
+
console.log('\n' + sepWithLabel(chalk.bold.cyan(userName || 'あなた')))
|
|
98
106
|
|
|
99
107
|
const input = (await readMultiLine()).trim()
|
|
100
108
|
if (!input) return prompt()
|
|
@@ -139,9 +147,7 @@ async function prompt() {
|
|
|
139
147
|
if (parsed) {
|
|
140
148
|
const skill = resolveSkill(parsed.name, process.cwd())
|
|
141
149
|
if (skill) {
|
|
142
|
-
console.log('\n' +
|
|
143
|
-
console.log(chalk.bold.cyan(` ${agentName}`) + chalk.dim(` [スキル: ${parsed.name}]`))
|
|
144
|
-
console.log(sep())
|
|
150
|
+
console.log('\n' + sepWithLabel(chalk.bold.cyan(agentName) + chalk.dim(` [スキル: ${parsed.name}]`)))
|
|
145
151
|
const expanded = expandSkill(skill.content, parsed.args)
|
|
146
152
|
try {
|
|
147
153
|
const reply = await agent.chat(expanded)
|
|
@@ -158,9 +164,7 @@ async function prompt() {
|
|
|
158
164
|
}
|
|
159
165
|
|
|
160
166
|
// --- 通常チャット ---
|
|
161
|
-
console.log('\n' +
|
|
162
|
-
console.log(chalk.bold.cyan(` ${agentName}`))
|
|
163
|
-
console.log(sep())
|
|
167
|
+
console.log('\n' + sepWithLabel(chalk.bold.cyan(agentName)))
|
|
164
168
|
try {
|
|
165
169
|
const reply = await agent.chat(input)
|
|
166
170
|
console.log('\n' + reply + '\n')
|