dev-prism 0.4.0 → 0.7.0
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 +180 -131
- package/bin/dev-prism.js +77 -97
- package/dist/{chunk-7YGOMAJG.js → chunk-3CIXBEXK.js} +22 -28
- package/dist/chunk-AHC6CD7F.js +92 -0
- package/dist/chunk-FQTS57VO.js +64 -0
- package/dist/chunk-GWQPK7MZ.js +50 -0
- package/dist/chunk-HDGBJGIH.js +55 -0
- package/dist/chunk-ILICQAU7.js +60 -0
- package/dist/chunk-IWZN6P6M.js +155 -0
- package/dist/chunk-KP56QH72.js +133 -0
- package/dist/{chunk-Y3GR6XK7.js → chunk-NJAITOCG.js} +3 -13
- package/dist/{chunk-25WQHUYW.js → chunk-TSNFAXVQ.js} +5 -12
- package/dist/chunk-VAPRJUC7.js +67 -0
- package/dist/chunk-VL56YPMK.js +45 -0
- package/dist/commands/claude.js +1 -1
- package/dist/commands/create.d.ts +1 -4
- package/dist/commands/create.js +5 -7
- package/dist/commands/destroy.d.ts +1 -1
- package/dist/commands/destroy.js +4 -5
- package/dist/commands/env.d.ts +7 -0
- package/dist/commands/env.js +9 -0
- package/dist/commands/info.js +4 -2
- package/dist/commands/list.d.ts +1 -3
- package/dist/commands/list.js +2 -5
- package/dist/commands/prune.d.ts +1 -1
- package/dist/commands/prune.js +2 -5
- package/dist/commands/with-env.d.ts +3 -0
- package/dist/commands/with-env.js +9 -0
- package/dist/index.d.ts +9 -12
- package/dist/index.js +58 -56
- package/dist/lib/config.d.ts +4 -7
- package/dist/lib/config.js +1 -3
- package/dist/lib/db.d.ts +26 -0
- package/dist/lib/db.js +28 -0
- package/dist/lib/env.d.ts +7 -5
- package/dist/lib/env.js +9 -9
- package/dist/lib/worktree.d.ts +2 -3
- package/dist/lib/worktree.js +1 -3
- package/package.json +8 -8
- package/dist/chunk-35SHBLIZ.js +0 -69
- package/dist/chunk-3ATDGV4Y.js +0 -22
- package/dist/chunk-3MSC3CGG.js +0 -78
- package/dist/chunk-3NW2OWIU.js +0 -78
- package/dist/chunk-3TRRZEFR.js +0 -38
- package/dist/chunk-4UNCSJRM.js +0 -70
- package/dist/chunk-5KDDYO6Y.js +0 -168
- package/dist/chunk-63II3EL4.js +0 -98
- package/dist/chunk-6YMQTISJ.js +0 -84
- package/dist/chunk-AOM6BONB.js +0 -98
- package/dist/chunk-AW2FJGXA.js +0 -38
- package/dist/chunk-C4WLIOBR.js +0 -67
- package/dist/chunk-D6QWWXZD.js +0 -49
- package/dist/chunk-FKTFCSU7.js +0 -78
- package/dist/chunk-GBN67HYD.js +0 -57
- package/dist/chunk-GKXXK2ZH.js +0 -203
- package/dist/chunk-GWDGC2OE.js +0 -116
- package/dist/chunk-H4HPDIY3.js +0 -95
- package/dist/chunk-HCCZKLC4.js +0 -64
- package/dist/chunk-HZUN6NRB.js +0 -70
- package/dist/chunk-J36LRUXM.js +0 -60
- package/dist/chunk-JHR4WADC.js +0 -200
- package/dist/chunk-JIU574KX.js +0 -41
- package/dist/chunk-KZJE62TK.js +0 -203
- package/dist/chunk-LDK6QMR6.js +0 -67
- package/dist/chunk-LEHA65A7.js +0 -59
- package/dist/chunk-LNIOSGC4.js +0 -78
- package/dist/chunk-LOVO4P3Y.js +0 -41
- package/dist/chunk-NNVP5F6I.js +0 -77
- package/dist/chunk-OL25TBYX.js +0 -67
- package/dist/chunk-P3ETW2KK.js +0 -166
- package/dist/chunk-PJKUD2N2.js +0 -22
- package/dist/chunk-PKC2ZED2.js +0 -168
- package/dist/chunk-PS76Q3HD.js +0 -168
- package/dist/chunk-QSG5CXPX.js +0 -171
- package/dist/chunk-QUMZI5KK.js +0 -98
- package/dist/chunk-RC2AUYZ7.js +0 -49
- package/dist/chunk-SMFAL2VP.js +0 -69
- package/dist/chunk-SSQ7XBY2.js +0 -30
- package/dist/chunk-SUMJLXT7.js +0 -30
- package/dist/chunk-UHI2QJFI.js +0 -200
- package/dist/chunk-VR3QWHHB.js +0 -57
- package/dist/chunk-X5A6H4Q7.js +0 -70
- package/dist/chunk-X6FHBEAS.js +0 -200
- package/dist/chunk-XUWQUDLT.js +0 -67
- package/dist/commands/logs.d.ts +0 -8
- package/dist/commands/logs.js +0 -8
- package/dist/commands/start.d.ts +0 -7
- package/dist/commands/start.js +0 -9
- package/dist/commands/stop-all.d.ts +0 -3
- package/dist/commands/stop-all.js +0 -9
- package/dist/commands/stop.d.ts +0 -3
- package/dist/commands/stop.js +0 -7
- package/dist/lib/docker.d.ts +0 -12
- package/dist/lib/docker.js +0 -14
- package/dist/lib/ports.d.ts +0 -6
- package/dist/lib/ports.js +0 -8
- package/dist/lib/store.d.ts +0 -46
- package/dist/lib/store.js +0 -6
|
@@ -12,18 +12,9 @@ async function branchExists(projectRoot, branchName) {
|
|
|
12
12
|
return false;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (!usedIds.has(sessionId)) {
|
|
19
|
-
return sessionId;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
throw new Error("No available session IDs (001-999 all in use)");
|
|
23
|
-
}
|
|
24
|
-
function generateDefaultBranchName(sessionId) {
|
|
25
|
-
const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
26
|
-
return `session/${today}/${sessionId}`;
|
|
15
|
+
function generateDefaultBranchName() {
|
|
16
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, -5);
|
|
17
|
+
return `session/${timestamp}`;
|
|
27
18
|
}
|
|
28
19
|
async function createWorktree(projectRoot, sessionDir, branchName) {
|
|
29
20
|
if (existsSync(sessionDir)) {
|
|
@@ -64,7 +55,6 @@ async function removeWorktree(projectRoot, sessionDir, branchName) {
|
|
|
64
55
|
}
|
|
65
56
|
|
|
66
57
|
export {
|
|
67
|
-
findNextSessionId,
|
|
68
58
|
generateDefaultBranchName,
|
|
69
59
|
createWorktree,
|
|
70
60
|
removeWorktree
|
|
@@ -3,20 +3,17 @@ import { existsSync } from "fs";
|
|
|
3
3
|
import { resolve } from "path";
|
|
4
4
|
import { pathToFileURL } from "url";
|
|
5
5
|
var DEFAULT_CONFIG = {
|
|
6
|
-
portBase: 47e3,
|
|
7
6
|
sessionsDir: "../sessions",
|
|
8
|
-
ports:
|
|
9
|
-
POSTGRES_PORT: 10
|
|
10
|
-
},
|
|
7
|
+
ports: [],
|
|
11
8
|
setup: ["pnpm install"]
|
|
12
9
|
};
|
|
13
10
|
async function loadConfig(projectRoot) {
|
|
14
|
-
let configPath = resolve(projectRoot, "
|
|
11
|
+
let configPath = resolve(projectRoot, "prism.config.mjs");
|
|
15
12
|
if (!existsSync(configPath)) {
|
|
16
|
-
configPath = resolve(projectRoot, "
|
|
13
|
+
configPath = resolve(projectRoot, "prism.config.js");
|
|
17
14
|
}
|
|
18
15
|
if (!existsSync(configPath)) {
|
|
19
|
-
console.warn("No
|
|
16
|
+
console.warn("No prism.config.mjs found, using defaults");
|
|
20
17
|
return DEFAULT_CONFIG;
|
|
21
18
|
}
|
|
22
19
|
try {
|
|
@@ -35,12 +32,8 @@ async function loadConfig(projectRoot) {
|
|
|
35
32
|
function getSessionsDir(config, projectRoot) {
|
|
36
33
|
return resolve(projectRoot, config.sessionsDir);
|
|
37
34
|
}
|
|
38
|
-
function getSessionDir(config, projectRoot, sessionId) {
|
|
39
|
-
return resolve(getSessionsDir(config, projectRoot), `session-${sessionId}`);
|
|
40
|
-
}
|
|
41
35
|
|
|
42
36
|
export {
|
|
43
37
|
loadConfig,
|
|
44
|
-
getSessionsDir
|
|
45
|
-
getSessionDir
|
|
38
|
+
getSessionsDir
|
|
46
39
|
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildSessionEnv
|
|
3
|
+
} from "./chunk-GWQPK7MZ.js";
|
|
4
|
+
import {
|
|
5
|
+
loadConfig
|
|
6
|
+
} from "./chunk-TSNFAXVQ.js";
|
|
7
|
+
import {
|
|
8
|
+
findProjectRoot,
|
|
9
|
+
getDbSession,
|
|
10
|
+
getPortAllocations,
|
|
11
|
+
openDatabase
|
|
12
|
+
} from "./chunk-IWZN6P6M.js";
|
|
13
|
+
|
|
14
|
+
// src/commands/info.ts
|
|
15
|
+
import chalk from "chalk";
|
|
16
|
+
async function showInfo(cwd) {
|
|
17
|
+
let projectRoot;
|
|
18
|
+
try {
|
|
19
|
+
projectRoot = findProjectRoot(cwd);
|
|
20
|
+
} catch {
|
|
21
|
+
console.log(chalk.yellow("No session found (no prism.config.mjs in parent directories)."));
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
const db = openDatabase();
|
|
25
|
+
try {
|
|
26
|
+
const session = getDbSession(db, cwd);
|
|
27
|
+
if (!session) {
|
|
28
|
+
console.log(chalk.yellow("No session found for this directory."));
|
|
29
|
+
console.log(
|
|
30
|
+
chalk.gray("Run `dev-prism create --in-place` to create a session here.")
|
|
31
|
+
);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
const ports = getPortAllocations(db, session.id);
|
|
35
|
+
const config = await loadConfig(projectRoot);
|
|
36
|
+
const env = buildSessionEnv(config, cwd, ports);
|
|
37
|
+
console.log(chalk.blue("\nSession"));
|
|
38
|
+
console.log(chalk.gray(`Directory: ${session.id}`));
|
|
39
|
+
if (session.branch) {
|
|
40
|
+
console.log(chalk.gray(`Branch: ${session.branch}`));
|
|
41
|
+
}
|
|
42
|
+
console.log(chalk.gray(`Created: ${session.created_at}`));
|
|
43
|
+
if (ports.length > 0) {
|
|
44
|
+
console.log(chalk.gray("\nPorts:"));
|
|
45
|
+
for (const port of ports) {
|
|
46
|
+
console.log(
|
|
47
|
+
chalk.cyan(
|
|
48
|
+
` ${port.service}: http://localhost:${port.port}`
|
|
49
|
+
)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (Object.keys(env).length > 0) {
|
|
54
|
+
console.log(chalk.gray("\nEnvironment:"));
|
|
55
|
+
for (const [key, value] of Object.entries(env)) {
|
|
56
|
+
console.log(chalk.gray(` ${key}=${value}`));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
console.log("");
|
|
60
|
+
} finally {
|
|
61
|
+
db.close();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
showInfo
|
|
67
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getPortAllocations,
|
|
3
|
+
listDbSessions,
|
|
4
|
+
openDatabase
|
|
5
|
+
} from "./chunk-IWZN6P6M.js";
|
|
6
|
+
|
|
7
|
+
// src/commands/list.ts
|
|
8
|
+
import chalk from "chalk";
|
|
9
|
+
async function listSessions() {
|
|
10
|
+
const db = openDatabase();
|
|
11
|
+
try {
|
|
12
|
+
const sessions = listDbSessions(db);
|
|
13
|
+
if (sessions.length === 0) {
|
|
14
|
+
console.log(chalk.gray("No sessions found."));
|
|
15
|
+
console.log(chalk.gray("\nTo create a session:"));
|
|
16
|
+
console.log(chalk.cyan(" dev-prism create"));
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
console.log(chalk.blue("Sessions:"));
|
|
20
|
+
console.log(chalk.gray("=========\n"));
|
|
21
|
+
for (const session of sessions) {
|
|
22
|
+
const ports = getPortAllocations(db, session.id);
|
|
23
|
+
console.log(chalk.white(` ${session.id}`));
|
|
24
|
+
if (session.branch) {
|
|
25
|
+
console.log(chalk.gray(` Branch: ${session.branch}`));
|
|
26
|
+
}
|
|
27
|
+
console.log(chalk.gray(` Created: ${session.created_at}`));
|
|
28
|
+
if (ports.length > 0) {
|
|
29
|
+
console.log(chalk.gray(" Ports:"));
|
|
30
|
+
for (const port of ports) {
|
|
31
|
+
console.log(
|
|
32
|
+
chalk.cyan(` ${port.service}: ${port.port}`)
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
console.log("");
|
|
37
|
+
}
|
|
38
|
+
} finally {
|
|
39
|
+
db.close();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
listSessions
|
|
45
|
+
};
|
package/dist/commands/claude.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
interface CreateOptions {
|
|
2
|
-
mode?: 'docker' | 'native';
|
|
3
2
|
branch?: string;
|
|
4
|
-
detach?: boolean;
|
|
5
|
-
without?: string[];
|
|
6
3
|
inPlace?: boolean;
|
|
7
4
|
}
|
|
8
|
-
declare function createSession(projectRoot: string,
|
|
5
|
+
declare function createSession(projectRoot: string, options: CreateOptions): Promise<void>;
|
|
9
6
|
|
|
10
7
|
export { type CreateOptions, createSession };
|
package/dist/commands/create.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSession
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-25WQHUYW.js";
|
|
9
|
-
import "../chunk-H4HPDIY3.js";
|
|
3
|
+
} from "../chunk-KP56QH72.js";
|
|
4
|
+
import "../chunk-NJAITOCG.js";
|
|
5
|
+
import "../chunk-GWQPK7MZ.js";
|
|
6
|
+
import "../chunk-TSNFAXVQ.js";
|
|
7
|
+
import "../chunk-IWZN6P6M.js";
|
|
10
8
|
export {
|
|
11
9
|
createSession
|
|
12
10
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface DestroyOptions {
|
|
2
2
|
all?: boolean;
|
|
3
3
|
}
|
|
4
|
-
declare function destroySession(
|
|
4
|
+
declare function destroySession(workingDir: string, options: DestroyOptions): Promise<void>;
|
|
5
5
|
|
|
6
6
|
export { type DestroyOptions, destroySession };
|
package/dist/commands/destroy.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
destroySession
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-H4HPDIY3.js";
|
|
3
|
+
} from "../chunk-AHC6CD7F.js";
|
|
4
|
+
import "../chunk-NJAITOCG.js";
|
|
5
|
+
import "../chunk-TSNFAXVQ.js";
|
|
6
|
+
import "../chunk-IWZN6P6M.js";
|
|
8
7
|
export {
|
|
9
8
|
destroySession
|
|
10
9
|
};
|
package/dist/commands/info.js
CHANGED
package/dist/commands/list.d.ts
CHANGED
package/dist/commands/list.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listSessions
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-GBN67HYD.js";
|
|
6
|
-
import "../chunk-25WQHUYW.js";
|
|
7
|
-
import "../chunk-H4HPDIY3.js";
|
|
3
|
+
} from "../chunk-VL56YPMK.js";
|
|
4
|
+
import "../chunk-IWZN6P6M.js";
|
|
8
5
|
export {
|
|
9
6
|
listSessions
|
|
10
7
|
};
|
package/dist/commands/prune.d.ts
CHANGED
package/dist/commands/prune.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pruneSessions
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-GBN67HYD.js";
|
|
6
|
-
import "../chunk-25WQHUYW.js";
|
|
7
|
-
import "../chunk-H4HPDIY3.js";
|
|
3
|
+
} from "../chunk-FQTS57VO.js";
|
|
4
|
+
import "../chunk-IWZN6P6M.js";
|
|
8
5
|
export {
|
|
9
6
|
pruneSessions
|
|
10
7
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
export { createSession } from './commands/create.js';
|
|
2
|
-
export { destroySession } from './commands/destroy.js';
|
|
1
|
+
export { CreateOptions, createSession } from './commands/create.js';
|
|
2
|
+
export { DestroyOptions, destroySession } from './commands/destroy.js';
|
|
3
3
|
export { listSessions } from './commands/list.js';
|
|
4
4
|
export { showInfo } from './commands/info.js';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export { pruneSessions } from './commands/prune.js';
|
|
9
|
-
export { streamLogs } from './commands/logs.js';
|
|
5
|
+
export { withEnv } from './commands/with-env.js';
|
|
6
|
+
export { EnvOptions, showEnv } from './commands/env.js';
|
|
7
|
+
export { PruneOptions, pruneSessions } from './commands/prune.js';
|
|
10
8
|
export { ClaudeOptions, installClaude } from './commands/claude.js';
|
|
11
9
|
export { SessionConfig, loadConfig } from './lib/config.js';
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
|
|
16
|
-
export { DockerComposeOptions, logs as dockerLogs, down, isRunning, ps, up } from './lib/docker.js';
|
|
10
|
+
export { DbSession, PortAllocation, allocatePorts, createDbSession, deleteDbSession, findProjectRoot, getAllocatedPorts, getDbSession, getPortAllocations, getReservedPorts, listDbSessions, openDatabase, reservePort, unreservePort } from './lib/db.js';
|
|
11
|
+
export { buildSessionEnv, formatEnvFile, getComposeProjectName, renderTemplate } from './lib/env.js';
|
|
12
|
+
export { createWorktree, generateDefaultBranchName, removeWorktree } from './lib/worktree.js';
|
|
13
|
+
import 'better-sqlite3';
|
package/dist/index.js
CHANGED
|
@@ -1,80 +1,82 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
stopAllSessions
|
|
6
|
-
} from "./chunk-OL25TBYX.js";
|
|
7
|
-
import {
|
|
8
|
-
stopSession
|
|
9
|
-
} from "./chunk-SUMJLXT7.js";
|
|
2
|
+
withEnv
|
|
3
|
+
} from "./chunk-ILICQAU7.js";
|
|
10
4
|
import {
|
|
11
5
|
installClaude
|
|
12
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3CIXBEXK.js";
|
|
13
7
|
import {
|
|
14
8
|
createSession
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import {
|
|
17
|
-
generateEnvContent,
|
|
18
|
-
renderAppEnv,
|
|
19
|
-
writeAppEnvFiles,
|
|
20
|
-
writeEnvFile
|
|
21
|
-
} from "./chunk-J36LRUXM.js";
|
|
9
|
+
} from "./chunk-KP56QH72.js";
|
|
22
10
|
import {
|
|
23
11
|
destroySession
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import {
|
|
26
|
-
showInfo
|
|
27
|
-
} from "./chunk-JIU574KX.js";
|
|
28
|
-
import {
|
|
29
|
-
listSessions
|
|
30
|
-
} from "./chunk-NNVP5F6I.js";
|
|
12
|
+
} from "./chunk-AHC6CD7F.js";
|
|
31
13
|
import {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} from "./chunk-RC2AUYZ7.js";
|
|
14
|
+
createWorktree,
|
|
15
|
+
generateDefaultBranchName,
|
|
16
|
+
removeWorktree
|
|
17
|
+
} from "./chunk-NJAITOCG.js";
|
|
37
18
|
import {
|
|
38
|
-
|
|
39
|
-
} from "./chunk-
|
|
19
|
+
showEnv
|
|
20
|
+
} from "./chunk-HDGBJGIH.js";
|
|
40
21
|
import {
|
|
41
|
-
|
|
42
|
-
} from "./chunk-
|
|
22
|
+
showInfo
|
|
23
|
+
} from "./chunk-VAPRJUC7.js";
|
|
43
24
|
import {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} from "./chunk-GBN67HYD.js";
|
|
25
|
+
buildSessionEnv,
|
|
26
|
+
formatEnvFile,
|
|
27
|
+
getComposeProjectName,
|
|
28
|
+
renderTemplate
|
|
29
|
+
} from "./chunk-GWQPK7MZ.js";
|
|
50
30
|
import {
|
|
51
31
|
loadConfig
|
|
52
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-TSNFAXVQ.js";
|
|
53
33
|
import {
|
|
54
|
-
|
|
55
|
-
} from "./chunk-
|
|
34
|
+
listSessions
|
|
35
|
+
} from "./chunk-VL56YPMK.js";
|
|
36
|
+
import {
|
|
37
|
+
pruneSessions
|
|
38
|
+
} from "./chunk-FQTS57VO.js";
|
|
39
|
+
import {
|
|
40
|
+
allocatePorts,
|
|
41
|
+
createDbSession,
|
|
42
|
+
deleteDbSession,
|
|
43
|
+
findProjectRoot,
|
|
44
|
+
getAllocatedPorts,
|
|
45
|
+
getDbSession,
|
|
46
|
+
getPortAllocations,
|
|
47
|
+
getReservedPorts,
|
|
48
|
+
listDbSessions,
|
|
49
|
+
openDatabase,
|
|
50
|
+
reservePort,
|
|
51
|
+
unreservePort
|
|
52
|
+
} from "./chunk-IWZN6P6M.js";
|
|
56
53
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
allocatePorts,
|
|
55
|
+
buildSessionEnv,
|
|
56
|
+
createDbSession,
|
|
59
57
|
createSession,
|
|
58
|
+
createWorktree,
|
|
59
|
+
deleteDbSession,
|
|
60
60
|
destroySession,
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
findProjectRoot,
|
|
62
|
+
formatEnvFile,
|
|
63
63
|
generateDefaultBranchName,
|
|
64
|
-
|
|
64
|
+
getAllocatedPorts,
|
|
65
|
+
getComposeProjectName,
|
|
66
|
+
getDbSession,
|
|
67
|
+
getPortAllocations,
|
|
68
|
+
getReservedPorts,
|
|
65
69
|
installClaude,
|
|
66
|
-
|
|
70
|
+
listDbSessions,
|
|
67
71
|
listSessions,
|
|
68
72
|
loadConfig,
|
|
73
|
+
openDatabase,
|
|
69
74
|
pruneSessions,
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
removeWorktree,
|
|
76
|
+
renderTemplate,
|
|
77
|
+
reservePort,
|
|
78
|
+
showEnv,
|
|
72
79
|
showInfo,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
stopSession,
|
|
76
|
-
streamLogs,
|
|
77
|
-
up,
|
|
78
|
-
writeAppEnvFiles,
|
|
79
|
-
writeEnvFile
|
|
80
|
+
unreservePort,
|
|
81
|
+
withEnv
|
|
80
82
|
};
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
interface SessionConfig {
|
|
2
2
|
projectName?: string;
|
|
3
|
-
portBase: number;
|
|
4
3
|
sessionsDir: string;
|
|
5
|
-
ports:
|
|
6
|
-
|
|
7
|
-
apps?: string
|
|
8
|
-
envFiles?: string[];
|
|
4
|
+
ports: string[];
|
|
5
|
+
env?: Record<string, string>;
|
|
6
|
+
apps?: Record<string, Record<string, string>>;
|
|
9
7
|
setup: string[];
|
|
10
8
|
}
|
|
11
9
|
declare function loadConfig(projectRoot: string): Promise<SessionConfig>;
|
|
12
10
|
declare function getSessionsDir(config: SessionConfig, projectRoot: string): string;
|
|
13
|
-
declare function getSessionDir(config: SessionConfig, projectRoot: string, sessionId: string): string;
|
|
14
11
|
|
|
15
|
-
export { type SessionConfig,
|
|
12
|
+
export { type SessionConfig, getSessionsDir, loadConfig };
|
package/dist/lib/config.js
CHANGED
package/dist/lib/db.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Database from 'better-sqlite3';
|
|
2
|
+
|
|
3
|
+
interface DbSession {
|
|
4
|
+
id: string;
|
|
5
|
+
branch: string | null;
|
|
6
|
+
created_at: string;
|
|
7
|
+
}
|
|
8
|
+
interface PortAllocation {
|
|
9
|
+
session_id: string;
|
|
10
|
+
service: string;
|
|
11
|
+
port: number;
|
|
12
|
+
}
|
|
13
|
+
declare function openDatabase(): Database.Database;
|
|
14
|
+
declare function findProjectRoot(startDir: string): string;
|
|
15
|
+
declare function createDbSession(db: Database.Database, session: DbSession): void;
|
|
16
|
+
declare function deleteDbSession(db: Database.Database, sessionId: string): void;
|
|
17
|
+
declare function getDbSession(db: Database.Database, sessionId: string): DbSession | undefined;
|
|
18
|
+
declare function listDbSessions(db: Database.Database): DbSession[];
|
|
19
|
+
declare function getPortAllocations(db: Database.Database, sessionId: string): PortAllocation[];
|
|
20
|
+
declare function getAllocatedPorts(db: Database.Database): number[];
|
|
21
|
+
declare function getReservedPorts(db: Database.Database): number[];
|
|
22
|
+
declare function reservePort(db: Database.Database, port: number, reason?: string): void;
|
|
23
|
+
declare function unreservePort(db: Database.Database, port: number): void;
|
|
24
|
+
declare function allocatePorts(db: Database.Database, sessionId: string, services: string[]): Promise<PortAllocation[]>;
|
|
25
|
+
|
|
26
|
+
export { type DbSession, type PortAllocation, allocatePorts, createDbSession, deleteDbSession, findProjectRoot, getAllocatedPorts, getDbSession, getPortAllocations, getReservedPorts, listDbSessions, openDatabase, reservePort, unreservePort };
|
package/dist/lib/db.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
allocatePorts,
|
|
3
|
+
createDbSession,
|
|
4
|
+
deleteDbSession,
|
|
5
|
+
findProjectRoot,
|
|
6
|
+
getAllocatedPorts,
|
|
7
|
+
getDbSession,
|
|
8
|
+
getPortAllocations,
|
|
9
|
+
getReservedPorts,
|
|
10
|
+
listDbSessions,
|
|
11
|
+
openDatabase,
|
|
12
|
+
reservePort,
|
|
13
|
+
unreservePort
|
|
14
|
+
} from "../chunk-IWZN6P6M.js";
|
|
15
|
+
export {
|
|
16
|
+
allocatePorts,
|
|
17
|
+
createDbSession,
|
|
18
|
+
deleteDbSession,
|
|
19
|
+
findProjectRoot,
|
|
20
|
+
getAllocatedPorts,
|
|
21
|
+
getDbSession,
|
|
22
|
+
getPortAllocations,
|
|
23
|
+
getReservedPorts,
|
|
24
|
+
listDbSessions,
|
|
25
|
+
openDatabase,
|
|
26
|
+
reservePort,
|
|
27
|
+
unreservePort
|
|
28
|
+
};
|
package/dist/lib/env.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { SessionConfig } from './config.js';
|
|
2
|
+
import { PortAllocation } from './db.js';
|
|
3
|
+
import 'better-sqlite3';
|
|
2
4
|
|
|
3
|
-
declare function
|
|
4
|
-
declare function
|
|
5
|
-
declare function
|
|
6
|
-
declare function
|
|
5
|
+
declare function renderTemplate(template: Record<string, string>, ports: Record<string, number>): Record<string, string>;
|
|
6
|
+
declare function buildSessionEnv(config: SessionConfig, workingDir: string, allocations: PortAllocation[], appName?: string): Record<string, string>;
|
|
7
|
+
declare function formatEnvFile(env: Record<string, string>): string;
|
|
8
|
+
declare function getComposeProjectName(workingDir: string, projectName?: string): string;
|
|
7
9
|
|
|
8
|
-
export {
|
|
10
|
+
export { buildSessionEnv, formatEnvFile, getComposeProjectName, renderTemplate };
|
package/dist/lib/env.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "../chunk-
|
|
2
|
+
buildSessionEnv,
|
|
3
|
+
formatEnvFile,
|
|
4
|
+
getComposeProjectName,
|
|
5
|
+
renderTemplate
|
|
6
|
+
} from "../chunk-GWQPK7MZ.js";
|
|
7
7
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
buildSessionEnv,
|
|
9
|
+
formatEnvFile,
|
|
10
|
+
getComposeProjectName,
|
|
11
|
+
renderTemplate
|
|
12
12
|
};
|
package/dist/lib/worktree.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
declare function generateDefaultBranchName(sessionId: string): string;
|
|
1
|
+
declare function generateDefaultBranchName(): string;
|
|
3
2
|
declare function createWorktree(projectRoot: string, sessionDir: string, branchName: string): Promise<void>;
|
|
4
3
|
declare function removeWorktree(projectRoot: string, sessionDir: string, branchName: string): Promise<void>;
|
|
5
4
|
|
|
6
|
-
export { createWorktree,
|
|
5
|
+
export { createWorktree, generateDefaultBranchName, removeWorktree };
|
package/dist/lib/worktree.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createWorktree,
|
|
3
|
-
findNextSessionId,
|
|
4
3
|
generateDefaultBranchName,
|
|
5
4
|
removeWorktree
|
|
6
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-NJAITOCG.js";
|
|
7
6
|
export {
|
|
8
7
|
createWorktree,
|
|
9
|
-
findNextSessionId,
|
|
10
8
|
generateDefaultBranchName,
|
|
11
9
|
removeWorktree
|
|
12
10
|
};
|