@gogoai/index1 0.0.1 → 1.1.1

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.
Files changed (3) hide show
  1. package/bin/index1.js +75 -0
  2. package/package.json +27 -5
  3. package/index.js +0 -1
package/bin/index1.js ADDED
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const { spawnSync } = require('child_process');
5
+ const os = require('os');
6
+
7
+ const args = process.argv.slice(2);
8
+ const isWin = os.platform() === 'win32';
9
+
10
+ // --- helpers ---
11
+
12
+ function run(cmd, cmdArgs, opts) {
13
+ return spawnSync(cmd, cmdArgs, { stdio: 'inherit', shell: isWin, ...opts });
14
+ }
15
+
16
+ function hasCmd(cmd) {
17
+ const r = spawnSync(isWin ? 'where' : 'which', [cmd], { stdio: 'pipe', shell: isWin });
18
+ return r.status === 0;
19
+ }
20
+
21
+ function fail(msg) {
22
+ process.stderr.write(msg + '\n');
23
+ process.exit(1);
24
+ }
25
+
26
+ // --- main ---
27
+
28
+ // 1. Already installed? Forward directly.
29
+ if (hasCmd('index1')) {
30
+ const r = run('index1', args);
31
+ process.exit(r.status || 0);
32
+ }
33
+
34
+ // 2. Not installed. Try auto-install.
35
+ process.stderr.write('index1 未找到,尝试自动安装...\n');
36
+
37
+ if (hasCmd('pipx')) {
38
+ process.stderr.write('→ pipx install index1\n');
39
+ const install = run('pipx', ['install', 'index1']);
40
+ if (install.status !== 0) {
41
+ fail('❌ pipx install 失败。请手动运行: pipx install index1');
42
+ }
43
+ } else if (hasCmd('pip3')) {
44
+ process.stderr.write('→ pip3 install index1\n');
45
+ const install = run('pip3', ['install', 'index1']);
46
+ if (install.status !== 0) {
47
+ fail('❌ pip3 install 失败。请手动运行: pip3 install index1');
48
+ }
49
+ } else if (hasCmd('pip')) {
50
+ process.stderr.write('→ pip install index1\n');
51
+ const install = run('pip', ['install', 'index1']);
52
+ if (install.status !== 0) {
53
+ fail('❌ pip install 失败。请手动运行: pip install index1');
54
+ }
55
+ } else {
56
+ fail(
57
+ '❌ 未找到 pipx 或 pip。请先安装 Python:\n' +
58
+ ' macOS: brew install python\n' +
59
+ ' Ubuntu: sudo apt install python3-pip\n' +
60
+ ' Windows: https://python.org/downloads\n\n' +
61
+ ' 然后运行: pipx install index1'
62
+ );
63
+ }
64
+
65
+ // 3. Run the command after installation.
66
+ if (hasCmd('index1')) {
67
+ const r = run('index1', args);
68
+ process.exit(r.status || 0);
69
+ } else {
70
+ fail(
71
+ '❌ 安装完成但 index1 不在 PATH 中。\n' +
72
+ ' 尝试: pipx ensurepath && source ~/.bashrc\n' +
73
+ ' 然后重新运行命令。'
74
+ );
75
+ }
package/package.json CHANGED
@@ -1,8 +1,30 @@
1
1
  {
2
2
  "name": "@gogoai/index1",
3
- "version": "0.0.1",
4
- "description": "AI-native document knowledge base with hybrid search",
5
- "main": "index.js",
6
- "license": "MIT",
7
- "repository": { "type": "git", "url": "https://github.com/gladego/index1" }
3
+ "version": "1.1.1",
4
+ "description": "AI-native project knowledge base. BM25 + vector hybrid search, MCP Server interface.",
5
+ "bin": {
6
+ "index1": "./bin/index1.js"
7
+ },
8
+ "keywords": [
9
+ "ai",
10
+ "knowledge-base",
11
+ "mcp",
12
+ "semantic-search",
13
+ "bm25",
14
+ "rag",
15
+ "claude-code",
16
+ "cursor",
17
+ "code-search"
18
+ ],
19
+ "license": "Apache-2.0",
20
+ "author": "gladego",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/gladego/index1"
24
+ },
25
+ "engines": {
26
+ "node": ">=16"
27
+ },
28
+ "os": ["darwin", "linux", "win32"],
29
+ "files": ["bin/", "package.json"]
8
30
  }
package/index.js DELETED
@@ -1 +0,0 @@
1
- // @gogoai/index1 - AI-native document knowledge base