xedoc-cli 0.1.0 → 0.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.
- package/README.md +5 -11
- package/bin/xedoc.mjs +13 -17
- package/build/client/assets/app-layout-Bb7v-3GP.js +1 -0
- package/build/client/assets/app-shell-Bn5JIK3M.js +1 -0
- package/build/client/assets/chat-BoNZJwBl.js +1 -0
- package/build/client/assets/home-DUuienY0.js +1 -0
- package/build/client/assets/{manifest-9479dd15.js → manifest-9a2680ac.js} +1 -1
- package/build/server/index.js +1 -1
- package/package.json +1 -1
- package/prisma/schema.prisma +1 -1
- package/server/index.mjs +24 -2
- package/server/sqlite-setup.mjs +29 -19
- package/build/client/assets/app-layout-C1QtSnIO.js +0 -1
- package/build/client/assets/app-shell-Bcxy4tS4.js +0 -1
- package/build/client/assets/chat-DrelwLpW.js +0 -1
- package/build/client/assets/home-DSWMwIrE.js +0 -1
package/README.md
CHANGED
|
@@ -20,21 +20,16 @@ The easiest local install is the npm CLI:
|
|
|
20
20
|
npx xedoc
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
By default the CLI creates a
|
|
24
|
-
|
|
23
|
+
By default the CLI creates a SQLite database under the workspace root at
|
|
24
|
+
`<workspace-root>/.xedoc/xedoc.db`, prepares the schema, and serves the app at
|
|
25
25
|
`http://127.0.0.1:6354`. Open the app in a browser and set the server password
|
|
26
|
-
on first visit.
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npx xedoc --database-path ~/.local/share/xedoc.db
|
|
30
|
-
```
|
|
26
|
+
on first visit.
|
|
31
27
|
|
|
32
28
|
Common CLI options:
|
|
33
29
|
|
|
34
30
|
- `--port <port>` changes the web server port.
|
|
35
31
|
- `--workspace-root <path>` changes the directory tree visible to the app.
|
|
36
32
|
- `--accounts-home <path>` changes where Codex account state is stored.
|
|
37
|
-
- `--database-path <path>` changes where the SQLite database is stored.
|
|
38
33
|
- `--skip-setup` skips SQLite schema setup.
|
|
39
34
|
|
|
40
35
|
For repository development:
|
|
@@ -52,9 +47,8 @@ hashed password plus token signing secret in the SQLite database. Later browser
|
|
|
52
47
|
sessions exchange that password for a bearer token, then store the token,
|
|
53
48
|
browser user id, and active account id in local storage.
|
|
54
49
|
|
|
55
|
-
The
|
|
56
|
-
|
|
57
|
-
specific database file.
|
|
50
|
+
The SQLite database path is derived from `CODEX_WORKSPACE_ROOT` and is always
|
|
51
|
+
stored at `<workspace-root>/.xedoc/xedoc.db`.
|
|
58
52
|
|
|
59
53
|
## Scripts
|
|
60
54
|
|
package/bin/xedoc.mjs
CHANGED
|
@@ -37,16 +37,9 @@ const accountsHome = resolveHomePath(
|
|
|
37
37
|
const workspaceRoot = resolveHomePath(
|
|
38
38
|
options.workspaceRoot ?? process.env.CODEX_WORKSPACE_ROOT ?? homedir(),
|
|
39
39
|
)
|
|
40
|
-
const databasePath =
|
|
41
|
-
options.databasePath ??
|
|
42
|
-
process.env.XEDOC_DATABASE ??
|
|
43
|
-
join(appHome, "xedoc.db"),
|
|
44
|
-
)
|
|
40
|
+
const databasePath = join(workspaceRoot, ".xedoc", "xedoc.db")
|
|
45
41
|
await mkdir(dirname(databasePath), { recursive: true, mode: 0o700 })
|
|
46
|
-
const databaseUrl =
|
|
47
|
-
options.databaseUrl ??
|
|
48
|
-
process.env.DATABASE_URL ??
|
|
49
|
-
`file:${databasePath}`
|
|
42
|
+
const databaseUrl = sqliteDatabaseUrl(databasePath)
|
|
50
43
|
|
|
51
44
|
const codexBin = require.resolve("@openai/codex/bin/codex.js")
|
|
52
45
|
const env = {
|
|
@@ -114,12 +107,6 @@ function assignOption(parsed, name, value) {
|
|
|
114
107
|
case "--codex-command":
|
|
115
108
|
parsed.codexCommand = value
|
|
116
109
|
return
|
|
117
|
-
case "--database-url":
|
|
118
|
-
parsed.databaseUrl = value
|
|
119
|
-
return
|
|
120
|
-
case "--database-path":
|
|
121
|
-
parsed.databasePath = value
|
|
122
|
-
return
|
|
123
110
|
case "--home":
|
|
124
111
|
parsed.home = value
|
|
125
112
|
return
|
|
@@ -160,7 +147,9 @@ async function runServer(env) {
|
|
|
160
147
|
|
|
161
148
|
async function setupSqliteDatabase(env) {
|
|
162
149
|
const previousDatabaseUrl = process.env.DATABASE_URL
|
|
150
|
+
const previousWorkspaceRoot = process.env.CODEX_WORKSPACE_ROOT
|
|
163
151
|
process.env.DATABASE_URL = env.DATABASE_URL
|
|
152
|
+
process.env.CODEX_WORKSPACE_ROOT = env.CODEX_WORKSPACE_ROOT
|
|
164
153
|
try {
|
|
165
154
|
const { setupSqliteDatabase } = await import(
|
|
166
155
|
join(packageRoot, "server/sqlite-setup.mjs")
|
|
@@ -172,6 +161,11 @@ async function setupSqliteDatabase(env) {
|
|
|
172
161
|
} else {
|
|
173
162
|
process.env.DATABASE_URL = previousDatabaseUrl
|
|
174
163
|
}
|
|
164
|
+
if (previousWorkspaceRoot === undefined) {
|
|
165
|
+
delete process.env.CODEX_WORKSPACE_ROOT
|
|
166
|
+
} else {
|
|
167
|
+
process.env.CODEX_WORKSPACE_ROOT = previousWorkspaceRoot
|
|
168
|
+
}
|
|
175
169
|
}
|
|
176
170
|
}
|
|
177
171
|
|
|
@@ -205,6 +199,10 @@ function resolveHomePath(path) {
|
|
|
205
199
|
return resolve(path)
|
|
206
200
|
}
|
|
207
201
|
|
|
202
|
+
function sqliteDatabaseUrl(databasePath) {
|
|
203
|
+
return `file:${databasePath}?connection_limit=1&pool_timeout=30`
|
|
204
|
+
}
|
|
205
|
+
|
|
208
206
|
function fail(message) {
|
|
209
207
|
console.error(message)
|
|
210
208
|
process.exit(1)
|
|
@@ -221,8 +219,6 @@ Options:
|
|
|
221
219
|
--host <host> Web server host. Defaults to 127.0.0.1.
|
|
222
220
|
--workspace-root <path> Directory tree visible in the app. Defaults to your home directory.
|
|
223
221
|
--accounts-home <path> Codex account state directory. Defaults to ~/.xedoc/accounts.
|
|
224
|
-
--database-path <path> SQLite database path. Defaults to ~/.xedoc/xedoc.db.
|
|
225
|
-
--database-url <url> SQLite DATABASE_URL. Defaults to file:<database-path>.
|
|
226
222
|
--skip-setup Do not create the SQLite database schema.
|
|
227
223
|
--codex-command <command> Codex command used for new accounts.
|
|
228
224
|
--codex-args <args> Codex command arguments used for new accounts.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r,t as s}from"./jsx-runtime-B9QlDcuB.js";import{t}from"./app-shell-Bn5JIK3M.js";var a=s(),o=r(function(){return(0,a.jsx)(t,{})});export{o as default};
|