@iflow-mcp/joungminsung-opendocuments 0.2.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.
- package/README.md +144 -0
- package/dist/commands/ask.d.ts +3 -0
- package/dist/commands/ask.d.ts.map +1 -0
- package/dist/commands/ask.js +99 -0
- package/dist/commands/ask.js.map +1 -0
- package/dist/commands/auth.d.ts +3 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +87 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/completion.d.ts +3 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +88 -0
- package/dist/commands/completion.js.map +1 -0
- package/dist/commands/config-cmd.d.ts +3 -0
- package/dist/commands/config-cmd.d.ts.map +1 -0
- package/dist/commands/config-cmd.js +61 -0
- package/dist/commands/config-cmd.js.map +1 -0
- package/dist/commands/connector.d.ts +3 -0
- package/dist/commands/connector.d.ts.map +1 -0
- package/dist/commands/connector.js +84 -0
- package/dist/commands/connector.js.map +1 -0
- package/dist/commands/doctor.d.ts +3 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +151 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/document.d.ts +3 -0
- package/dist/commands/document.d.ts.map +1 -0
- package/dist/commands/document.js +78 -0
- package/dist/commands/document.js.map +1 -0
- package/dist/commands/export-cmd.d.ts +3 -0
- package/dist/commands/export-cmd.d.ts.map +1 -0
- package/dist/commands/export-cmd.js +44 -0
- package/dist/commands/export-cmd.js.map +1 -0
- package/dist/commands/import-cmd.d.ts +3 -0
- package/dist/commands/import-cmd.d.ts.map +1 -0
- package/dist/commands/import-cmd.js +39 -0
- package/dist/commands/import-cmd.js.map +1 -0
- package/dist/commands/index-cmd.d.ts +3 -0
- package/dist/commands/index-cmd.d.ts.map +1 -0
- package/dist/commands/index-cmd.js +76 -0
- package/dist/commands/index-cmd.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +408 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/plugin.d.ts +3 -0
- package/dist/commands/plugin.d.ts.map +1 -0
- package/dist/commands/plugin.js +296 -0
- package/dist/commands/plugin.js.map +1 -0
- package/dist/commands/search.d.ts +3 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +40 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/start.d.ts +3 -0
- package/dist/commands/start.d.ts.map +1 -0
- package/dist/commands/start.js +120 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/stop.d.ts +3 -0
- package/dist/commands/stop.d.ts.map +1 -0
- package/dist/commands/stop.js +55 -0
- package/dist/commands/stop.js.map +1 -0
- package/dist/commands/upgrade.d.ts +3 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +16 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/commands/workspace.d.ts +3 -0
- package/dist/commands/workspace.d.ts.map +1 -0
- package/dist/commands/workspace.js +85 -0
- package/dist/commands/workspace.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/bootstrap.d.ts +4 -0
- package/dist/utils/bootstrap.d.ts.map +1 -0
- package/dist/utils/bootstrap.js +17 -0
- package/dist/utils/bootstrap.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { log } from 'opendocuments-core';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { getContext, shutdownContext } from '../utils/bootstrap.js';
|
|
5
|
+
import { writeFileSync, readFileSync, existsSync } from 'node:fs';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
const CURRENT_WS_FILE = join(process.env.HOME || '~', '.opendocuments', 'current-workspace');
|
|
8
|
+
function getCurrentWorkspace() {
|
|
9
|
+
try {
|
|
10
|
+
return existsSync(CURRENT_WS_FILE) ? readFileSync(CURRENT_WS_FILE, 'utf-8').trim() : 'default';
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return 'default';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function setCurrentWorkspace(name) {
|
|
17
|
+
const dir = join(process.env.HOME || '~', '.opendocuments');
|
|
18
|
+
const { mkdirSync } = require('node:fs');
|
|
19
|
+
mkdirSync(dir, { recursive: true });
|
|
20
|
+
writeFileSync(CURRENT_WS_FILE, name);
|
|
21
|
+
}
|
|
22
|
+
export function workspaceCommand() {
|
|
23
|
+
const cmd = new Command('workspace').description('Manage workspaces');
|
|
24
|
+
cmd.command('list').description('List workspaces').action(async () => {
|
|
25
|
+
const ctx = await getContext();
|
|
26
|
+
try {
|
|
27
|
+
const current = getCurrentWorkspace();
|
|
28
|
+
const workspaces = ctx.workspaceManager.list();
|
|
29
|
+
log.heading('Workspaces');
|
|
30
|
+
for (const ws of workspaces) {
|
|
31
|
+
const marker = ws.name === current ? chalk.cyan(' (current)') : '';
|
|
32
|
+
log.ok(`${ws.name.padEnd(20)} ${ws.mode}${marker}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
await shutdownContext();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
cmd.command('create <name>').description('Create workspace').option('--mode <mode>', 'personal or team', 'personal').action(async (name, opts) => {
|
|
40
|
+
const ctx = await getContext();
|
|
41
|
+
try {
|
|
42
|
+
ctx.workspaceManager.create(name, opts.mode);
|
|
43
|
+
log.ok(`Workspace "${name}" created`);
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
await shutdownContext();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
cmd.command('switch <name>').description('Switch active workspace').action(async (name) => {
|
|
50
|
+
const ctx = await getContext();
|
|
51
|
+
try {
|
|
52
|
+
const ws = ctx.workspaceManager.getByName(name);
|
|
53
|
+
if (!ws) {
|
|
54
|
+
log.fail(`Workspace "${name}" not found`);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
setCurrentWorkspace(name);
|
|
58
|
+
log.ok(`Switched to workspace "${name}"`);
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
await shutdownContext();
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
cmd.command('delete <name>').description('Delete workspace').action(async (name) => {
|
|
65
|
+
const ctx = await getContext();
|
|
66
|
+
try {
|
|
67
|
+
if (name === 'default') {
|
|
68
|
+
log.fail('Cannot delete default workspace');
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const ws = ctx.workspaceManager.getByName(name);
|
|
72
|
+
if (!ws) {
|
|
73
|
+
log.fail(`Workspace "${name}" not found`);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
ctx.workspaceManager.delete(ws.id);
|
|
77
|
+
log.ok(`Workspace "${name}" deleted`);
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
await shutdownContext();
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return cmd;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/commands/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AACxC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,eA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M;YAAC,CAAC;YAC9D,mBAAmB,CAAC,IAAI,CAAC,CAAA;YACzB,GAAG,CAAC,EAAE,CAAC,0BAA0B,IAAI,GAAG,CAAC,CAAA;QAC3C,CAAC;gBAAS,CAAC;YAAC,MAAM,eAAe,EAAE,CAAA;QAAC,CAAC;IACvC,CAAC,CAAC,CAAA;IAEF,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACjF,MAAM,GAAG,GAAG,MAAM,UAAU,EAAE,CAAA;QAC9B,IAAI,CAAC;YACH,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBAAC,GAAG,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;gBAAC,OAAM;YAAC,CAAC;YAC/E,MAAM,EAAE,GAAG,GAAG,CAAC,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;YAC/C,IAAI,CAAC,EAAE,EAAE,CAAC;gBAAC,GAAG,CAAC,IAAI,CAAC,cAAc,IAAI,aAAa,CAAC,CAAC;gBAAC,OAAM;YAAC,CAAC;YAC9D,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;YAClC,GAAG,CAAC,EAAE,CAAC,cAAc,IAAI,WAAW,CAAC,CAAA;QACvC,CAAC;gBAAS,CAAC;YAAC,MAAM,eAAe,EAAE,CAAA;QAAC,CAAC;IACvC,CAAC,CAAC,CAAA;IAEF,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { startCommand } from './commands/start.js';
|
|
4
|
+
import { askCommand } from './commands/ask.js';
|
|
5
|
+
import { indexCommand } from './commands/index-cmd.js';
|
|
6
|
+
import { doctorCommand } from './commands/doctor.js';
|
|
7
|
+
import { configCommand } from './commands/config-cmd.js';
|
|
8
|
+
import { initCommand } from './commands/init.js';
|
|
9
|
+
import { connectorCommand } from './commands/connector.js';
|
|
10
|
+
import { authCommand } from './commands/auth.js';
|
|
11
|
+
import { pluginCommand } from './commands/plugin.js';
|
|
12
|
+
import { exportCommand } from './commands/export-cmd.js';
|
|
13
|
+
import { importCommand } from './commands/import-cmd.js';
|
|
14
|
+
import { documentCommand } from './commands/document.js';
|
|
15
|
+
import { workspaceCommand } from './commands/workspace.js';
|
|
16
|
+
import { stopCommand } from './commands/stop.js';
|
|
17
|
+
import { searchCommand } from './commands/search.js';
|
|
18
|
+
import { completionCommand } from './commands/completion.js';
|
|
19
|
+
import { upgradeCommand } from './commands/upgrade.js';
|
|
20
|
+
const program = new Command();
|
|
21
|
+
program
|
|
22
|
+
.name('opendocuments')
|
|
23
|
+
.description('OpenDocuments - Self-hosted RAG platform for organizational documents')
|
|
24
|
+
.version('0.1.0');
|
|
25
|
+
program.addCommand(startCommand());
|
|
26
|
+
program.addCommand(askCommand());
|
|
27
|
+
program.addCommand(indexCommand());
|
|
28
|
+
program.addCommand(doctorCommand());
|
|
29
|
+
program.addCommand(configCommand());
|
|
30
|
+
program.addCommand(initCommand());
|
|
31
|
+
program.addCommand(connectorCommand());
|
|
32
|
+
program.addCommand(authCommand());
|
|
33
|
+
program.addCommand(pluginCommand());
|
|
34
|
+
program.addCommand(exportCommand());
|
|
35
|
+
program.addCommand(importCommand());
|
|
36
|
+
program.addCommand(documentCommand());
|
|
37
|
+
program.addCommand(workspaceCommand());
|
|
38
|
+
program.addCommand(stopCommand());
|
|
39
|
+
program.addCommand(searchCommand());
|
|
40
|
+
program.addCommand(completionCommand());
|
|
41
|
+
program.addCommand(upgradeCommand());
|
|
42
|
+
program.parse();
|
|
43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 +1,17 @@
|
|
|
1
|
+
import { bootstrap } from 'opendocuments-server';
|
|
2
|
+
// Module-level cache: single CLI invocation shares one context.
|
|
3
|
+
// This is intentional for CLI use. Tests should import from @opendocuments/server directly.
|
|
4
|
+
let cachedCtx = null;
|
|
5
|
+
export async function getContext() {
|
|
6
|
+
if (cachedCtx)
|
|
7
|
+
return cachedCtx;
|
|
8
|
+
cachedCtx = await bootstrap();
|
|
9
|
+
return cachedCtx;
|
|
10
|
+
}
|
|
11
|
+
export async function shutdownContext() {
|
|
12
|
+
if (cachedCtx) {
|
|
13
|
+
await cachedCtx.shutdown();
|
|
14
|
+
cachedCtx = null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/utils/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,sBAAsB,CAAA;AAEjE,gEAAgE;AAChE,4FAA4F;AAC5F,IAAI,SAAS,GAAsB,IAAI,CAAA;AAEvC,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,IAAI,SAAS;QAAE,OAAO,SAAS,CAAA;IAC/B,SAAS,GAAG,MAAM,SAAS,EAAE,CAAA;IAC7B,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,SAAS,CAAC,QAAQ,EAAE,CAAA;QAC1B,SAAS,GAAG,IAAI,CAAA;IAClB,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@iflow-mcp/joungminsung-opendocuments",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"bin": {
|
|
6
|
+
"iflow-mcp-joungminsung-opendocuments": "./dist/index.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"test": "vitest run",
|
|
11
|
+
"typecheck": "tsc --noEmit",
|
|
12
|
+
"clean": "rm -rf dist",
|
|
13
|
+
"dev": "tsc --watch"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@hono/node-server": "^1.13.0",
|
|
17
|
+
"@inquirer/prompts": "^8.3.2",
|
|
18
|
+
"chalk": "^5.3.0",
|
|
19
|
+
"commander": "^12.1.0",
|
|
20
|
+
"opendocuments-core": "*",
|
|
21
|
+
"opendocuments-server": "*",
|
|
22
|
+
"opendocuments-model-ollama": "*"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"typescript": "^5.5.0",
|
|
26
|
+
"vitest": "^2.1.0"
|
|
27
|
+
},
|
|
28
|
+
"description": "Self-hosted RAG platform for organizational documents - CLI and server",
|
|
29
|
+
"homepage": "https://github.com/joungminsung/OpenDocuments",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/joungminsung/OpenDocuments/issues"
|
|
32
|
+
},
|
|
33
|
+
"author": "OpenDocuments Contributors",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/joungminsung/OpenDocuments.git",
|
|
38
|
+
"directory": "packages/cli"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"rag",
|
|
42
|
+
"llm",
|
|
43
|
+
"cli",
|
|
44
|
+
"self-hosted",
|
|
45
|
+
"document-search",
|
|
46
|
+
"mcp",
|
|
47
|
+
"ai",
|
|
48
|
+
"knowledge-base"
|
|
49
|
+
],
|
|
50
|
+
"files": [
|
|
51
|
+
"dist/**/*"
|
|
52
|
+
]
|
|
53
|
+
}
|