@make-u-free/migi 0.1.7 → 0.1.9
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 +1 -1
- package/package.json +10 -3
- package/src/agent.js +1 -1
- package/src/setup.js +9 -6
- package/src/tools.js +14 -1
package/bin/migi.js
CHANGED
|
@@ -18,7 +18,7 @@ const promptFn = (q) => new Promise((resolve) => rl.question(q, resolve))
|
|
|
18
18
|
|
|
19
19
|
// ---- APIキー・設定の解決(優先度: 環境変数 > グローバル設定 > セットアップ) ----
|
|
20
20
|
let apiKey = process.env.OPENAI_API_KEY
|
|
21
|
-
let model = 'gpt-
|
|
21
|
+
let model = 'gpt-4.1-2025-04-14'
|
|
22
22
|
let agentName = 'Migi'
|
|
23
23
|
|
|
24
24
|
if (!apiKey) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@make-u-free/migi",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Your AI right-hand agent. Works anywhere, with any LLM API.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -13,12 +13,19 @@
|
|
|
13
13
|
"chalk": "^5.3.0",
|
|
14
14
|
"dotenv": "^16.4.0",
|
|
15
15
|
"glob": "^11.0.0",
|
|
16
|
-
"openai": "^4.0.0"
|
|
16
|
+
"openai": "^4.0.0",
|
|
17
|
+
"xlsx": "^0.18.5"
|
|
17
18
|
},
|
|
18
19
|
"engines": {
|
|
19
20
|
"node": ">=18.0.0"
|
|
20
21
|
},
|
|
21
|
-
"keywords": [
|
|
22
|
+
"keywords": [
|
|
23
|
+
"ai",
|
|
24
|
+
"agent",
|
|
25
|
+
"cli",
|
|
26
|
+
"openai",
|
|
27
|
+
"secretary"
|
|
28
|
+
],
|
|
22
29
|
"author": "MAKE U FREE",
|
|
23
30
|
"license": "MIT"
|
|
24
31
|
}
|
package/src/agent.js
CHANGED
|
@@ -5,7 +5,7 @@ import { toolSchemas, executeTool } from './tools.js'
|
|
|
5
5
|
import { createPermissionChecker } from './permissions.js'
|
|
6
6
|
|
|
7
7
|
export class MigiAgent {
|
|
8
|
-
constructor({ context = '', promptFn = null, apiKey = null, model = 'gpt-
|
|
8
|
+
constructor({ context = '', promptFn = null, apiKey = null, model = 'gpt-4.1-2025-04-14', name = 'Migi' } = {}) {
|
|
9
9
|
this.client = new OpenAI({ apiKey: apiKey || process.env.OPENAI_API_KEY })
|
|
10
10
|
this.model = model
|
|
11
11
|
this.history = []
|
package/src/setup.js
CHANGED
|
@@ -73,17 +73,20 @@ export async function runSetup(promptFn = null) {
|
|
|
73
73
|
// ---- モデル選択 ----
|
|
74
74
|
console.log('')
|
|
75
75
|
console.log(chalk.dim(' 使用するモデルを選んでください。'))
|
|
76
|
-
console.log(chalk.dim(' 1) gpt-
|
|
77
|
-
console.log(chalk.dim(' 2) gpt-4o
|
|
78
|
-
console.log(chalk.dim(' 3)
|
|
76
|
+
console.log(chalk.dim(' 1) gpt-4.1-2025-04-14 (推奨・エージェント特化)'))
|
|
77
|
+
console.log(chalk.dim(' 2) gpt-4o (汎用)'))
|
|
78
|
+
console.log(chalk.dim(' 3) gpt-4o-mini (高速・低コスト)'))
|
|
79
|
+
console.log(chalk.dim(' 4) その他 (直接入力)\n'))
|
|
79
80
|
const modelChoice = await ask(chalk.white(' 選択 [1] > '))
|
|
80
81
|
|
|
81
|
-
let model = 'gpt-
|
|
82
|
+
let model = 'gpt-4.1-2025-04-14'
|
|
82
83
|
if (modelChoice.trim() === '2') {
|
|
83
|
-
model = 'gpt-4o
|
|
84
|
+
model = 'gpt-4o'
|
|
84
85
|
} else if (modelChoice.trim() === '3') {
|
|
86
|
+
model = 'gpt-4o-mini'
|
|
87
|
+
} else if (modelChoice.trim() === '4') {
|
|
85
88
|
const custom = await ask(chalk.white(' モデル名 > '))
|
|
86
|
-
model = custom.trim() || 'gpt-
|
|
89
|
+
model = custom.trim() || 'gpt-4.1-2025-04-14'
|
|
87
90
|
}
|
|
88
91
|
|
|
89
92
|
// ---- 名前(AIで解釈) ----
|
package/src/tools.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync, appendFileSync, existsSync, mkdirSync } from 'fs'
|
|
2
2
|
import { execSync } from 'child_process'
|
|
3
|
-
import { dirname } from 'path'
|
|
3
|
+
import { dirname, extname } from 'path'
|
|
4
4
|
import { glob } from 'glob'
|
|
5
|
+
import xlsxPkg from 'xlsx'
|
|
6
|
+
const { readFile: xlsxReadFile, utils: xlsxUtils } = xlsxPkg
|
|
5
7
|
|
|
6
8
|
// ---- OpenAI ツールスキーマ定義 ----
|
|
7
9
|
|
|
@@ -102,6 +104,17 @@ export async function executeTool(name, args) {
|
|
|
102
104
|
switch (name) {
|
|
103
105
|
case 'read_file': {
|
|
104
106
|
if (!existsSync(args.path)) return `エラー: ファイルが見つかりません: ${args.path}`
|
|
107
|
+
const ext = extname(args.path).toLowerCase()
|
|
108
|
+
if (ext === '.xlsx' || ext === '.xls') {
|
|
109
|
+
const workbook = xlsxReadFile(args.path)
|
|
110
|
+
const result = []
|
|
111
|
+
for (const sheetName of workbook.SheetNames) {
|
|
112
|
+
const sheet = workbook.Sheets[sheetName]
|
|
113
|
+
const csv = xlsxUtils.sheet_to_csv(sheet)
|
|
114
|
+
result.push(`## シート: ${sheetName}\n${csv}`)
|
|
115
|
+
}
|
|
116
|
+
return result.join('\n\n')
|
|
117
|
+
}
|
|
105
118
|
return readFileSync(args.path, 'utf-8')
|
|
106
119
|
}
|
|
107
120
|
|