@make-u-free/migi 0.1.7 → 0.1.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 +10 -3
- package/src/tools.js +14 -1
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.8",
|
|
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/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
|
|