@nitsan-ai/ragsuite-test 0.1.1 → 0.1.2
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 +35 -54
- package/package.json +2 -2
- package/src/commands/init.js +28 -102
- package/src/index.js +3 -3
- package/src/utils/distribution.js +9 -11
package/README.md
CHANGED
|
@@ -1,64 +1,48 @@
|
|
|
1
1
|
# RAGSuite test CLI (`ragsuite-test`)
|
|
2
2
|
|
|
3
|
-
> **TESTING PACKAGE** —
|
|
4
|
-
> **Not** the final production `@nitsan-ai/ragsuite` / `ragsuite` CLI (later release).
|
|
3
|
+
> **TESTING PACKAGE** — temporary. Final public CLI will be `ragsuite` later.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Requires **Node.js 18+**. **Docker is optional.** Public deploy path: **`npm` → `init --from-git`**.
|
|
9
|
-
|
|
10
|
-
## Prerequisites
|
|
11
|
-
|
|
12
|
-
| Need | Why | How to get it |
|
|
13
|
-
|------|-----|----------------|
|
|
14
|
-
| Node.js 18+ | CLI + native frontend tooling | https://nodejs.org · `brew install node` · `sudo apt install nodejs` |
|
|
15
|
-
| git | `--from-git` clone | `xcode-select --install` · `brew install git` · `sudo apt install git` |
|
|
16
|
-
| **SMTP** | No prompts. Real values only in **local `.env`** (gitignored) | Gmail App Password → edit `.env` |
|
|
17
|
-
| LLM API key | Default in `.env.example` / `.env` — no prompt | Override in `.env` or `--llm-api-key` |
|
|
18
|
-
| **Either Docker** *or* **native data stores** | Run the stack | See modes below |
|
|
19
|
-
|
|
20
|
-
### Mode A — Docker (optional)
|
|
21
|
-
|
|
22
|
-
- Docker Desktop / daemon + `docker compose`
|
|
23
|
-
- https://www.docker.com/products/docker-desktop/
|
|
24
|
-
|
|
25
|
-
### Mode B — Native (no Docker)
|
|
26
|
-
|
|
27
|
-
- `python3`, `yarn` (or corepack)
|
|
28
|
-
- Postgres on **localhost:5436**, database `ragsuite_v3`
|
|
29
|
-
- Redis on **localhost:6382**
|
|
30
|
-
|
|
31
|
-
## Install (public)
|
|
5
|
+
**One-command public install** (GitHub repo must be public):
|
|
32
6
|
|
|
33
7
|
```bash
|
|
34
8
|
npm install -g @nitsan-ai/ragsuite-test
|
|
35
|
-
|
|
36
|
-
ragsuite-test init --yes \
|
|
37
|
-
--from-git \
|
|
38
|
-
--install-dir ~/ragsuite-test \
|
|
39
|
-
--mode docker
|
|
40
|
-
|
|
9
|
+
ragsuite-test init
|
|
41
10
|
ragsuite-test start --repo-root ~/ragsuite-test --detach
|
|
42
|
-
# API http://localhost:9090 · Web http://localhost:9091
|
|
43
11
|
```
|
|
44
12
|
|
|
45
|
-
|
|
13
|
+
That clones `https://github.com/nitsan-ai/RAGSUITE.git` into `~/ragsuite-test`, writes `.env` (no SMTP/LLM questions), and picks **Docker** if the daemon is up, otherwise **native**.
|
|
46
14
|
|
|
47
|
-
|
|
15
|
+
- API: http://localhost:9090
|
|
16
|
+
- Web (Docker): http://localhost:9091
|
|
17
|
+
- Web (native): http://localhost:9191
|
|
48
18
|
|
|
49
19
|
```bash
|
|
50
|
-
ragsuite-test
|
|
51
|
-
ragsuite-test start --repo-root ~/ragsuite-test
|
|
52
|
-
# API :9090 · Expo web :9191
|
|
20
|
+
ragsuite-test stop --repo-root ~/ragsuite-test
|
|
53
21
|
```
|
|
54
22
|
|
|
55
|
-
|
|
23
|
+
## Prerequisites
|
|
24
|
+
|
|
25
|
+
| Need | Required? | How |
|
|
26
|
+
|------|-----------|-----|
|
|
27
|
+
| Node.js 18+ | Yes | https://nodejs.org · `brew install node` |
|
|
28
|
+
| git | Yes | `xcode-select --install` · `brew install git` |
|
|
29
|
+
| Docker | No | Optional; without it init uses native (needs Postgres `:5436` + Redis `:6382`) |
|
|
30
|
+
|
|
31
|
+
Real SMTP belongs only in local `.env` (gitignored). Init never asks for it.
|
|
32
|
+
|
|
33
|
+
## Advanced (optional)
|
|
56
34
|
|
|
57
35
|
```bash
|
|
58
|
-
|
|
59
|
-
|
|
36
|
+
# Force native / docker
|
|
37
|
+
ragsuite-test init --mode native
|
|
38
|
+
ragsuite-test init --mode docker
|
|
60
39
|
|
|
61
|
-
|
|
40
|
+
# Custom install dir
|
|
41
|
+
ragsuite-test init --install-dir ~/my-ragsuite
|
|
42
|
+
|
|
43
|
+
# Existing checkout (CI / developers)
|
|
44
|
+
ragsuite-test init --repo-root /path/to/RAGSUITE
|
|
45
|
+
```
|
|
62
46
|
|
|
63
47
|
## Ports
|
|
64
48
|
|
|
@@ -70,28 +54,25 @@ Interactive: `ragsuite-test init`
|
|
|
70
54
|
| Postgres | 5436 |
|
|
71
55
|
| Redis | 6382 |
|
|
72
56
|
|
|
73
|
-
|
|
74
|
-
ragsuite-test stop --repo-root ~/ragsuite-test
|
|
75
|
-
lsof -nP -iTCP:9090 -sTCP:LISTEN
|
|
76
|
-
docker ps
|
|
77
|
-
```
|
|
57
|
+
Busy ports: `ragsuite-test stop --repo-root ~/ragsuite-test` · `lsof -nP -iTCP:9090 -sTCP:LISTEN`
|
|
78
58
|
|
|
79
59
|
## Commands
|
|
80
60
|
|
|
81
61
|
| Command | Behavior |
|
|
82
62
|
|---------|----------|
|
|
83
|
-
| `init` |
|
|
84
|
-
| `start` / `stop` |
|
|
85
|
-
| `doctor` |
|
|
63
|
+
| `init` | Clone public repo → `.env` + config (default) |
|
|
64
|
+
| `start` / `stop` | Docker or native scripts |
|
|
65
|
+
| `doctor` | Health / prereq hints |
|
|
86
66
|
| `logs` / `update` / `version` | As before |
|
|
87
67
|
|
|
88
68
|
## Publish
|
|
89
69
|
|
|
90
|
-
See [PUBLISH.md](./PUBLISH.md)
|
|
70
|
+
See [PUBLISH.md](./PUBLISH.md).
|
|
91
71
|
|
|
92
72
|
```bash
|
|
93
73
|
cd cli && npm run prepublish:check
|
|
94
|
-
|
|
74
|
+
# Only when approved:
|
|
75
|
+
RAGSUITE_TEST_ALLOW_PUBLISH=1 npm publish --access public
|
|
95
76
|
```
|
|
96
77
|
|
|
97
78
|
## Windows
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nitsan-ai/ragsuite-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "RAGSuite testing CLI (ragsuite-test) — install
|
|
5
|
+
"description": "RAGSuite testing CLI (ragsuite-test) — public install: npm i -g && ragsuite-test init (clones GitHub). Temporary name before public ragsuite release.",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"ragsuite-test": "./bin/ragsuite-test.js"
|
package/src/commands/init.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const { writeConfig, CONFIG_DIR } = require('../utils/config');
|
|
5
|
-
const { ensureRagsuiteDir, resolveRepoRoot
|
|
5
|
+
const { ensureRagsuiteDir, resolveRepoRoot } = require('../utils/paths');
|
|
6
6
|
const { assertSupportedInstall, installHint } = require('../utils/distribution');
|
|
7
7
|
const {
|
|
8
8
|
DEFAULT_GIT_URL,
|
|
@@ -13,20 +13,17 @@ const { detectOs } = require('../utils/os-detect');
|
|
|
13
13
|
const {
|
|
14
14
|
printPrereqs,
|
|
15
15
|
resolvePreferredMode,
|
|
16
|
-
dockerDaemonRunning,
|
|
17
|
-
commandExists,
|
|
18
16
|
} = require('../utils/prereqs');
|
|
19
|
-
const { ask, choose } = require('../utils/prompt');
|
|
20
17
|
const {
|
|
21
18
|
generateJwtSecret,
|
|
22
19
|
isPlaceholderSecret,
|
|
23
20
|
writeInstallEnv,
|
|
24
21
|
} = require('../utils/env-file');
|
|
25
22
|
const { assertPortsFree } = require('../utils/port');
|
|
26
|
-
const { info,
|
|
23
|
+
const { info, error } = require('../utils/log');
|
|
27
24
|
|
|
28
25
|
const name = 'init';
|
|
29
|
-
const summary = '
|
|
26
|
+
const summary = 'One-command install: clone public GitHub repo → .env + config';
|
|
30
27
|
|
|
31
28
|
function printSuccess(repoRoot, mode) {
|
|
32
29
|
info('');
|
|
@@ -42,9 +39,6 @@ function printSuccess(repoRoot, mode) {
|
|
|
42
39
|
info(' Web http://localhost:9091 (Docker nginx)');
|
|
43
40
|
}
|
|
44
41
|
info('');
|
|
45
|
-
info(' Docker is optional: native mode needs host Postgres :5436 + Redis :6382.');
|
|
46
|
-
info(' Each install directory is one deployment / one organization.');
|
|
47
|
-
info('');
|
|
48
42
|
info('Next steps:');
|
|
49
43
|
info(` 1. ragsuite-test start --repo-root ${repoRoot}${mode === 'docker' ? ' --detach' : ''}`);
|
|
50
44
|
if (mode === 'native') {
|
|
@@ -60,29 +54,23 @@ function printSuccess(repoRoot, mode) {
|
|
|
60
54
|
function help() {
|
|
61
55
|
return `Usage: ragsuite-test init [options]
|
|
62
56
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
- checks ports 9090, 9091, 5436, 6382
|
|
69
|
-
|
|
70
|
-
Install sources (pick one):
|
|
71
|
-
--from-git [url] Clone public monorepo (default: ${DEFAULT_GIT_URL})
|
|
72
|
-
--repo-root <path> Use an existing monorepo checkout
|
|
57
|
+
Simple public install (default — no questions):
|
|
58
|
+
clones ${DEFAULT_GIT_URL}
|
|
59
|
+
into ~/ragsuite-test
|
|
60
|
+
picks docker mode if Docker is running, otherwise native
|
|
61
|
+
writes .env (JWT auto; SMTP/LLM from .env.example — no prompts)
|
|
73
62
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
--mode docker Full compose stack (needs Docker Desktop / daemon)
|
|
63
|
+
ragsuite-test init
|
|
64
|
+
ragsuite-test start --repo-root ~/ragsuite-test --detach
|
|
77
65
|
|
|
78
|
-
|
|
79
|
-
--
|
|
80
|
-
--
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
--install-dir <path> Target for --from-git (default: ~/ragsuite-test)
|
|
66
|
+
Advanced (optional):
|
|
67
|
+
--from-git [url] Clone this URL instead of the default
|
|
68
|
+
--repo-root <path> Use an existing checkout (no clone)
|
|
69
|
+
--install-dir <path> Clone target (default: ~/ragsuite-test)
|
|
70
|
+
--mode <docker|native> Force run mode
|
|
84
71
|
--force Overwrite non-empty install dir / existing .env
|
|
85
|
-
--yes, -y
|
|
72
|
+
--yes, -y Same defaults; for scripts/CI
|
|
73
|
+
--llm-api-key / --smtp-* Optional overrides (usually not needed)
|
|
86
74
|
`;
|
|
87
75
|
}
|
|
88
76
|
|
|
@@ -100,7 +88,7 @@ function resolveLlmOverride(g, env) {
|
|
|
100
88
|
if (env.RAGSUITE_TEST_LLM_API_KEY && !isPlaceholderSecret(env.RAGSUITE_TEST_LLM_API_KEY)) {
|
|
101
89
|
return env.RAGSUITE_TEST_LLM_API_KEY;
|
|
102
90
|
}
|
|
103
|
-
return null;
|
|
91
|
+
return null;
|
|
104
92
|
}
|
|
105
93
|
|
|
106
94
|
function countSources(fromGit, repoRootFlag) {
|
|
@@ -113,10 +101,9 @@ function countSources(fromGit, repoRootFlag) {
|
|
|
113
101
|
async function run(ctx) {
|
|
114
102
|
assertSupportedInstall();
|
|
115
103
|
const g = ctx.globals;
|
|
116
|
-
const interactive = Boolean(process.stdin.isTTY) && !g.yes;
|
|
117
104
|
|
|
118
105
|
if (g.fromRelease) {
|
|
119
|
-
error('--from-release is not supported. Use --from-git or --repo-root.');
|
|
106
|
+
error('--from-release is not supported. Use default init, --from-git, or --repo-root.');
|
|
120
107
|
return 1;
|
|
121
108
|
}
|
|
122
109
|
|
|
@@ -130,78 +117,17 @@ async function run(ctx) {
|
|
|
130
117
|
|
|
131
118
|
let fromGit = g.fromGit;
|
|
132
119
|
let repoRootFlag = g.repoRoot;
|
|
133
|
-
|
|
134
|
-
let mode = g.mode || null;
|
|
120
|
+
const installDir = g.installDir || defaultInstallDir();
|
|
135
121
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
} else if (interactive && fromGit === null && !repoRootFlag) {
|
|
142
|
-
const method = await choose(
|
|
143
|
-
'Install method:',
|
|
144
|
-
[
|
|
145
|
-
{
|
|
146
|
-
id: 'git',
|
|
147
|
-
label: 'Public git clone (--from-git) — recommended',
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
id: 'checkout',
|
|
151
|
-
label: 'Existing checkout (--repo-root)',
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
{ defaultIndex: 0 },
|
|
155
|
-
);
|
|
156
|
-
if (method.id === 'git') {
|
|
157
|
-
const url = await ask('Git repository URL', {
|
|
158
|
-
defaultValue: DEFAULT_GIT_URL,
|
|
159
|
-
yesMode: false,
|
|
160
|
-
});
|
|
161
|
-
fromGit = url || DEFAULT_GIT_URL;
|
|
162
|
-
installDir = await ask('Install directory', {
|
|
163
|
-
defaultValue: defaultInstallDir(),
|
|
164
|
-
yesMode: false,
|
|
165
|
-
});
|
|
166
|
-
} else {
|
|
167
|
-
repoRootFlag = await ask('Path to existing RAGSUITE checkout', { yesMode: false });
|
|
168
|
-
if (!repoRootFlag || !looksLikeRepoRoot(path.resolve(repoRootFlag))) {
|
|
169
|
-
error('Not a valid checkout (need scripts/docker-start.sh)');
|
|
170
|
-
return 1;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
const dockerOk = commandExists('docker') && dockerDaemonRunning();
|
|
175
|
-
const modeChoice = await choose(
|
|
176
|
-
'Run mode (Docker is optional — native works without Docker):',
|
|
177
|
-
[
|
|
178
|
-
{
|
|
179
|
-
id: 'native',
|
|
180
|
-
label: 'Native — no Docker; needs Postgres :5436 + Redis :6382 on this machine',
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
id: 'docker',
|
|
184
|
-
label: dockerOk
|
|
185
|
-
? 'Docker — full compose stack (Docker Desktop / daemon)'
|
|
186
|
-
: 'Docker — not available on this machine (install Docker Desktop first)',
|
|
187
|
-
},
|
|
188
|
-
],
|
|
189
|
-
{ defaultIndex: 0 },
|
|
190
|
-
);
|
|
191
|
-
mode = modeChoice.id;
|
|
192
|
-
if (mode === 'docker' && !dockerOk) {
|
|
193
|
-
warn('Docker is not available — switching to native mode.');
|
|
194
|
-
mode = 'native';
|
|
195
|
-
}
|
|
196
|
-
} else if (fromGit === null && !repoRootFlag) {
|
|
197
|
-
error('Pass --from-git / --repo-root, or run in a TTY for the interactive wizard');
|
|
198
|
-
return 1;
|
|
122
|
+
// Default public path: no menus, no path prompts — clone GitHub → ~/ragsuite-test
|
|
123
|
+
if (fromGit === null && !repoRootFlag) {
|
|
124
|
+
fromGit = '';
|
|
125
|
+
info(`Install: clone ${DEFAULT_GIT_URL}`);
|
|
126
|
+
info(`Target: ${path.resolve(installDir)}`);
|
|
199
127
|
}
|
|
200
128
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
info(`Run mode: ${mode} (Docker is optional; pass --mode docker|native to force)`);
|
|
204
|
-
}
|
|
129
|
+
const mode = g.mode || resolvePreferredMode(null);
|
|
130
|
+
info(`Run mode: ${mode} (Docker optional — pass --mode docker|native to force)`);
|
|
205
131
|
|
|
206
132
|
const needGit = fromGit !== null && fromGit !== undefined;
|
|
207
133
|
if (!printPrereqs(mode, { needGit })) {
|
|
@@ -211,7 +137,7 @@ async function run(ctx) {
|
|
|
211
137
|
|
|
212
138
|
const jwtSecret = generateJwtSecret();
|
|
213
139
|
info(`JWT_SECRET_KEY will be auto-generated (…${jwtSecret.slice(-8)})`);
|
|
214
|
-
info('SMTP + LLM:
|
|
140
|
+
info('SMTP + LLM: from .env.example into .env (no prompts).');
|
|
215
141
|
|
|
216
142
|
const llmKey = resolveLlmOverride(g, ctx.env);
|
|
217
143
|
const smtp = optionalSmtpOverrides(g, ctx.env);
|
package/src/index.js
CHANGED
|
@@ -31,15 +31,15 @@ function globalHelp() {
|
|
|
31
31
|
'Global options:',
|
|
32
32
|
' --help, -h Show help',
|
|
33
33
|
' --repo-root <path> Monorepo / install root',
|
|
34
|
-
' --from-git [url] init: clone public
|
|
35
|
-
' --install-dir <path> init: target
|
|
34
|
+
' --from-git [url] init: clone this URL (default: public nitsan-ai/RAGSUITE)',
|
|
35
|
+
' --install-dir <path> init: clone target (default ~/ragsuite-test)',
|
|
36
36
|
' --llm-api-key <key> init: optional override for CUSTOM_LLM_INTERNAL_API_KEY',
|
|
37
37
|
' --smtp-host <host> init: optional SMTP override',
|
|
38
38
|
' --smtp-user <user> init: optional SMTP override',
|
|
39
39
|
' --smtp-password <pass> init: optional SMTP override',
|
|
40
40
|
' --email-from <email> init: optional SMTP override',
|
|
41
41
|
' --force init: overwrite non-empty install dir / .env',
|
|
42
|
-
' --yes, -y Non-interactive',
|
|
42
|
+
' --yes, -y Non-interactive (same defaults as plain init)',
|
|
43
43
|
' --mode <docker|native> Override config (Docker optional)',
|
|
44
44
|
' --dry-run Print actions without running (start/stop/doctor/logs)',
|
|
45
45
|
'',
|
|
@@ -3,22 +3,19 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Distribution modes for the testing CLI.
|
|
5
5
|
*
|
|
6
|
-
* - git-clone:
|
|
7
|
-
* - local-checkout: --repo-root
|
|
8
|
-
* Registry/GHCR compose remains stubbed.
|
|
6
|
+
* - git-clone: default `ragsuite-test init` (public GitHub)
|
|
7
|
+
* - local-checkout: --repo-root (advanced / CI)
|
|
9
8
|
*/
|
|
10
9
|
|
|
11
10
|
const MODE_LOCAL = 'local-checkout';
|
|
12
11
|
const MODE_GIT = 'git-clone';
|
|
13
12
|
const MODE_REGISTRY = 'registry-compose';
|
|
14
13
|
|
|
15
|
-
function assertSupportedInstall() {
|
|
16
|
-
// git + checkout supported
|
|
17
|
-
}
|
|
14
|
+
function assertSupportedInstall() {}
|
|
18
15
|
|
|
19
16
|
function resolveComposeBundle() {
|
|
20
17
|
const err = new Error(
|
|
21
|
-
'Registry/compose (GHCR) install is not available yet.
|
|
18
|
+
'Registry/compose (GHCR) install is not available yet. Run: ragsuite-test init',
|
|
22
19
|
);
|
|
23
20
|
err.code = 'DIST_NOT_READY';
|
|
24
21
|
throw err;
|
|
@@ -26,10 +23,11 @@ function resolveComposeBundle() {
|
|
|
26
23
|
|
|
27
24
|
function installHint() {
|
|
28
25
|
return [
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
-
'
|
|
26
|
+
'Simple deploy:',
|
|
27
|
+
' npm install -g @nitsan-ai/ragsuite-test',
|
|
28
|
+
' ragsuite-test init',
|
|
29
|
+
' ragsuite-test start --repo-root ~/ragsuite-test --detach',
|
|
30
|
+
'Docker is optional — init picks native automatically if Docker is not running.',
|
|
33
31
|
].join('\n');
|
|
34
32
|
}
|
|
35
33
|
|