dev-prism 0.4.0 → 0.6.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.
Files changed (84) hide show
  1. package/README.md +262 -70
  2. package/bin/dev-prism.js +46 -44
  3. package/dist/chunk-24OM3LGM.js +35 -0
  4. package/dist/chunk-3FYEGH2G.js +217 -0
  5. package/dist/chunk-3Q454U3I.js +71 -0
  6. package/dist/chunk-76LSQIZI.js +31 -0
  7. package/dist/chunk-7OSTLJLO.js +219 -0
  8. package/dist/chunk-7YEZWM6Y.js +97 -0
  9. package/dist/chunk-AEVARZQ4.js +203 -0
  10. package/dist/chunk-AIVPJ467.js +70 -0
  11. package/dist/chunk-BXYXWNGH.js +30 -0
  12. package/dist/chunk-CUQVGZBX.js +44 -0
  13. package/dist/chunk-DQER5GNG.js +72 -0
  14. package/dist/chunk-DTE5YQMI.js +41 -0
  15. package/dist/chunk-EXRHG5KQ.js +60 -0
  16. package/dist/chunk-H3L73URT.js +65 -0
  17. package/dist/chunk-HZBJF67X.js +60 -0
  18. package/dist/chunk-I3U6JK77.js +66 -0
  19. package/dist/chunk-JMKE3ZKI.js +61 -0
  20. package/dist/chunk-JZ2VPQXP.js +132 -0
  21. package/dist/chunk-KDYKLH6P.js +40 -0
  22. package/dist/chunk-LAOWFCQL.js +21 -0
  23. package/dist/chunk-MRBTH5PL.js +66 -0
  24. package/dist/chunk-OOJ6YOGS.js +53 -0
  25. package/dist/chunk-OPEZFBBI.js +219 -0
  26. package/dist/chunk-Q5DPX4WL.js +219 -0
  27. package/dist/chunk-RQ245R7T.js +67 -0
  28. package/dist/chunk-SD3TON6N.js +32 -0
  29. package/dist/chunk-SEKH4ZV6.js +60 -0
  30. package/dist/chunk-UKYQN4A3.js +38 -0
  31. package/dist/chunk-URGGS3XM.js +95 -0
  32. package/dist/chunk-VUNPVDSO.js +74 -0
  33. package/dist/chunk-VXP2SPRI.js +51 -0
  34. package/dist/chunk-W54CPPSK.js +217 -0
  35. package/dist/chunk-X2PXZRYU.js +41 -0
  36. package/dist/chunk-YSO3IDZZ.js +40 -0
  37. package/dist/chunk-YY5DA35Z.js +40 -0
  38. package/dist/chunk-Z2ISJMLW.js +92 -0
  39. package/dist/chunk-ZKHNUDSL.js +119 -0
  40. package/dist/commands/create.d.ts +2 -1
  41. package/dist/commands/create.js +6 -5
  42. package/dist/commands/destroy.d.ts +1 -1
  43. package/dist/commands/destroy.js +4 -3
  44. package/dist/commands/info.js +3 -2
  45. package/dist/commands/list.d.ts +1 -3
  46. package/dist/commands/list.js +3 -5
  47. package/dist/commands/logs.d.ts +1 -1
  48. package/dist/commands/logs.js +3 -2
  49. package/dist/commands/prune.d.ts +1 -1
  50. package/dist/commands/prune.js +4 -3
  51. package/dist/commands/start.d.ts +1 -1
  52. package/dist/commands/start.js +3 -2
  53. package/dist/commands/stop-all.d.ts +1 -1
  54. package/dist/commands/stop-all.js +3 -4
  55. package/dist/commands/stop.d.ts +1 -1
  56. package/dist/commands/stop.js +3 -2
  57. package/dist/index.d.ts +4 -2
  58. package/dist/index.js +36 -18
  59. package/dist/lib/compose.d.ts +12 -0
  60. package/dist/lib/compose.js +12 -0
  61. package/dist/lib/config.d.ts +4 -0
  62. package/dist/lib/config.test.d.ts +1 -0
  63. package/dist/lib/config.test.js +32 -0
  64. package/dist/lib/docker-inspect.d.ts +24 -0
  65. package/dist/lib/docker-inspect.js +16 -0
  66. package/dist/lib/env.d.ts +3 -3
  67. package/dist/lib/env.js +1 -1
  68. package/dist/lib/env.test.d.ts +1 -0
  69. package/dist/lib/env.test.js +68 -0
  70. package/dist/lib/ports.d.ts +3 -3
  71. package/dist/lib/ports.js +3 -3
  72. package/dist/lib/ports.test.d.ts +1 -0
  73. package/dist/lib/ports.test.js +61 -0
  74. package/dist/lib/session.d.ts +16 -0
  75. package/dist/lib/session.js +13 -0
  76. package/dist/lib/store.d.ts +5 -5
  77. package/dist/lib/store.js +1 -1
  78. package/dist/lib/store.test.d.ts +1 -0
  79. package/dist/lib/store.test.js +205 -0
  80. package/dist/lib/worktree.d.ts +1 -1
  81. package/dist/lib/worktree.js +1 -1
  82. package/dist/lib/worktree.test.d.ts +1 -0
  83. package/dist/lib/worktree.test.js +41 -0
  84. package/package.json +2 -5
@@ -2,6 +2,6 @@ interface StartOptions {
2
2
  mode?: string;
3
3
  without?: string[];
4
4
  }
5
- declare function startSession(projectRoot: string, sessionId: string, options: StartOptions): Promise<void>;
5
+ declare function startSession(workingDir: string, options: StartOptions): Promise<void>;
6
6
 
7
7
  export { type StartOptions, startSession };
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  startSession
3
- } from "../chunk-3TRRZEFR.js";
3
+ } from "../chunk-CUQVGZBX.js";
4
4
  import "../chunk-GBN67HYD.js";
5
5
  import "../chunk-25WQHUYW.js";
6
- import "../chunk-H4HPDIY3.js";
6
+ import "../chunk-DQER5GNG.js";
7
+ import "../chunk-JZ2VPQXP.js";
7
8
  export {
8
9
  startSession
9
10
  };
@@ -1,3 +1,3 @@
1
- declare function stopAllSessions(projectRoot: string): Promise<void>;
1
+ declare function stopAllSessions(): Promise<void>;
2
2
 
3
3
  export { stopAllSessions };
@@ -1,9 +1,8 @@
1
1
  import {
2
2
  stopAllSessions
3
- } from "../chunk-OL25TBYX.js";
4
- import "../chunk-GBN67HYD.js";
5
- import "../chunk-25WQHUYW.js";
6
- import "../chunk-H4HPDIY3.js";
3
+ } from "../chunk-KDYKLH6P.js";
4
+ import "../chunk-DQER5GNG.js";
5
+ import "../chunk-JZ2VPQXP.js";
7
6
  export {
8
7
  stopAllSessions
9
8
  };
@@ -1,3 +1,3 @@
1
- declare function stopSession(projectRoot: string, sessionId: string): Promise<void>;
1
+ declare function stopSession(workingDir: string): Promise<void>;
2
2
 
3
3
  export { stopSession };
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  stopSession
3
- } from "../chunk-SUMJLXT7.js";
4
- import "../chunk-H4HPDIY3.js";
3
+ } from "../chunk-76LSQIZI.js";
4
+ import "../chunk-DQER5GNG.js";
5
+ import "../chunk-JZ2VPQXP.js";
5
6
  export {
6
7
  stopSession
7
8
  };
package/dist/index.d.ts CHANGED
@@ -9,8 +9,10 @@ export { pruneSessions } from './commands/prune.js';
9
9
  export { streamLogs } from './commands/logs.js';
10
10
  export { ClaudeOptions, installClaude } from './commands/claude.js';
11
11
  export { SessionConfig, loadConfig } from './lib/config.js';
12
- export { calculatePorts } from './lib/ports.js';
12
+ export { extractPorts } from './lib/ports.js';
13
13
  export { generateDefaultBranchName } from './lib/worktree.js';
14
- export { SessionRow, SessionStore } from './lib/store.js';
15
14
  export { generateEnvContent, renderAppEnv, writeAppEnvFiles, writeEnvFile } from './lib/env.js';
16
15
  export { DockerComposeOptions, logs as dockerLogs, down, isRunning, ps, up } from './lib/docker.js';
16
+ export { ContainerInfo, PortMapping, getPortMappings, inspectContainer, listManagedContainers, sessionExists } from './lib/docker-inspect.js';
17
+ export { Session, getSession, listActiveSessions } from './lib/session.js';
18
+ export { generateComposeFile, writeComposeFile } from './lib/compose.js';
package/dist/index.js CHANGED
@@ -1,45 +1,49 @@
1
1
  import {
2
2
  startSession
3
- } from "./chunk-3TRRZEFR.js";
3
+ } from "./chunk-CUQVGZBX.js";
4
4
  import {
5
5
  stopAllSessions
6
- } from "./chunk-OL25TBYX.js";
6
+ } from "./chunk-KDYKLH6P.js";
7
7
  import {
8
8
  stopSession
9
- } from "./chunk-SUMJLXT7.js";
9
+ } from "./chunk-76LSQIZI.js";
10
10
  import {
11
11
  installClaude
12
12
  } from "./chunk-7YGOMAJG.js";
13
13
  import {
14
14
  createSession
15
- } from "./chunk-KZJE62TK.js";
15
+ } from "./chunk-Q5DPX4WL.js";
16
+ import {
17
+ extractPorts
18
+ } from "./chunk-LAOWFCQL.js";
19
+ import {
20
+ generateComposeFile,
21
+ writeComposeFile
22
+ } from "./chunk-MRBTH5PL.js";
16
23
  import {
17
24
  generateEnvContent,
18
25
  renderAppEnv,
19
26
  writeAppEnvFiles,
20
27
  writeEnvFile
21
- } from "./chunk-J36LRUXM.js";
28
+ } from "./chunk-HZBJF67X.js";
22
29
  import {
23
30
  destroySession
24
- } from "./chunk-3NW2OWIU.js";
31
+ } from "./chunk-7YEZWM6Y.js";
25
32
  import {
26
33
  showInfo
27
- } from "./chunk-JIU574KX.js";
34
+ } from "./chunk-YSO3IDZZ.js";
28
35
  import {
29
36
  listSessions
30
- } from "./chunk-NNVP5F6I.js";
31
- import {
32
- calculatePorts
33
- } from "./chunk-3ATDGV4Y.js";
37
+ } from "./chunk-24OM3LGM.js";
34
38
  import {
35
39
  streamLogs
36
- } from "./chunk-RC2AUYZ7.js";
40
+ } from "./chunk-OOJ6YOGS.js";
37
41
  import {
38
42
  pruneSessions
39
- } from "./chunk-63II3EL4.js";
43
+ } from "./chunk-Z2ISJMLW.js";
40
44
  import {
41
45
  generateDefaultBranchName
42
- } from "./chunk-Y3GR6XK7.js";
46
+ } from "./chunk-3Q454U3I.js";
43
47
  import {
44
48
  down,
45
49
  isRunning,
@@ -51,24 +55,37 @@ import {
51
55
  loadConfig
52
56
  } from "./chunk-25WQHUYW.js";
53
57
  import {
54
- SessionStore
55
- } from "./chunk-H4HPDIY3.js";
58
+ getSession,
59
+ listActiveSessions
60
+ } from "./chunk-DQER5GNG.js";
61
+ import {
62
+ getPortMappings,
63
+ inspectContainer,
64
+ listManagedContainers,
65
+ sessionExists
66
+ } from "./chunk-JZ2VPQXP.js";
56
67
  export {
57
- SessionStore,
58
- calculatePorts,
59
68
  createSession,
60
69
  destroySession,
61
70
  logs as dockerLogs,
62
71
  down,
72
+ extractPorts,
73
+ generateComposeFile,
63
74
  generateDefaultBranchName,
64
75
  generateEnvContent,
76
+ getPortMappings,
77
+ getSession,
78
+ inspectContainer,
65
79
  installClaude,
66
80
  isRunning,
81
+ listActiveSessions,
82
+ listManagedContainers,
67
83
  listSessions,
68
84
  loadConfig,
69
85
  pruneSessions,
70
86
  ps,
71
87
  renderAppEnv,
88
+ sessionExists,
72
89
  showInfo,
73
90
  startSession,
74
91
  stopAllSessions,
@@ -76,5 +93,6 @@ export {
76
93
  streamLogs,
77
94
  up,
78
95
  writeAppEnvFiles,
96
+ writeComposeFile,
79
97
  writeEnvFile
80
98
  };
@@ -0,0 +1,12 @@
1
+ declare function generateComposeFile(workingDir: string, projectName: string, services: Array<{
2
+ name: string;
3
+ internalPort: number;
4
+ }>): string;
5
+ declare function writeComposeFile(workingDir: string, projectName: string, services: Array<{
6
+ name: string;
7
+ internalPort: number;
8
+ }>): string;
9
+ declare function generateEnvStub(workingDir: string, projectName: string): string;
10
+ declare function getComposeProjectName(workingDir: string, projectName: string): string;
11
+
12
+ export { generateComposeFile, generateEnvStub, getComposeProjectName, writeComposeFile };
@@ -0,0 +1,12 @@
1
+ import {
2
+ generateComposeFile,
3
+ generateEnvStub,
4
+ getComposeProjectName,
5
+ writeComposeFile
6
+ } from "../chunk-MRBTH5PL.js";
7
+ export {
8
+ generateComposeFile,
9
+ generateEnvStub,
10
+ getComposeProjectName,
11
+ writeComposeFile
12
+ };
@@ -7,6 +7,10 @@ interface SessionConfig {
7
7
  apps?: string[];
8
8
  envFiles?: string[];
9
9
  setup: string[];
10
+ services?: Array<{
11
+ name: string;
12
+ internalPort: number;
13
+ }>;
10
14
  }
11
15
  declare function loadConfig(projectRoot: string): Promise<SessionConfig>;
12
16
  declare function getSessionsDir(config: SessionConfig, projectRoot: string): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,32 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { getSessionsDir, getSessionDir } from './config.js';
3
+ const baseConfig = {
4
+ portBase: 47000,
5
+ sessionsDir: '../sessions',
6
+ ports: {},
7
+ setup: [],
8
+ };
9
+ describe('getSessionsDir', () => {
10
+ it('resolves sessions dir relative to project root', () => {
11
+ const result = getSessionsDir(baseConfig, '/home/user/project');
12
+ expect(result).toBe('/home/user/sessions');
13
+ });
14
+ it('handles absolute sessionsDir', () => {
15
+ const config = {
16
+ ...baseConfig,
17
+ sessionsDir: '/var/sessions',
18
+ };
19
+ const result = getSessionsDir(config, '/home/user/project');
20
+ expect(result).toBe('/var/sessions');
21
+ });
22
+ });
23
+ describe('getSessionDir', () => {
24
+ it('returns path to specific session directory', () => {
25
+ const result = getSessionDir(baseConfig, '/home/user/project', '001');
26
+ expect(result).toBe('/home/user/sessions/session-001');
27
+ });
28
+ it('handles different session IDs', () => {
29
+ const result = getSessionDir(baseConfig, '/home/user/project', '042');
30
+ expect(result).toBe('/home/user/sessions/session-042');
31
+ });
32
+ });
@@ -0,0 +1,24 @@
1
+ interface ContainerInfo {
2
+ id: string;
3
+ name: string;
4
+ state: string;
5
+ labels: Record<string, string>;
6
+ ports: Array<{
7
+ privatePort: number;
8
+ publicPort?: number;
9
+ type: string;
10
+ }>;
11
+ }
12
+ interface PortMapping {
13
+ service: string;
14
+ internalPort: number;
15
+ externalPort: number;
16
+ }
17
+ declare function listManagedContainers(): Promise<ContainerInfo[]>;
18
+ declare function inspectContainer(containerId: string): Promise<ContainerInfo | null>;
19
+ declare function getPortMappings(workingDir: string): Promise<PortMapping[]>;
20
+ declare function groupContainersByWorkingDir(containers: ContainerInfo[]): Map<string, ContainerInfo[]>;
21
+ declare function sessionExists(workingDir: string): Promise<boolean>;
22
+ declare function getComposeProject(workingDir: string): Promise<string | null>;
23
+
24
+ export { type ContainerInfo, type PortMapping, getComposeProject, getPortMappings, groupContainersByWorkingDir, inspectContainer, listManagedContainers, sessionExists };
@@ -0,0 +1,16 @@
1
+ import {
2
+ getComposeProject,
3
+ getPortMappings,
4
+ groupContainersByWorkingDir,
5
+ inspectContainer,
6
+ listManagedContainers,
7
+ sessionExists
8
+ } from "../chunk-JZ2VPQXP.js";
9
+ export {
10
+ getComposeProject,
11
+ getPortMappings,
12
+ groupContainersByWorkingDir,
13
+ inspectContainer,
14
+ listManagedContainers,
15
+ sessionExists
16
+ };
package/dist/lib/env.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { SessionConfig } from './config.js';
2
2
 
3
- declare function generateEnvContent(sessionId: string, ports: Record<string, number>, projectName: string): string;
4
- declare function writeEnvFile(sessionDir: string, sessionId: string, ports: Record<string, number>, projectName: string): string;
3
+ declare function generateEnvContent(workingDir: string, ports: Record<string, number>, projectName: string): string;
4
+ declare function writeEnvFile(workingDir: string, ports: Record<string, number>, composeProjectName: string): string;
5
5
  declare function renderAppEnv(template: Record<string, string>, ports: Record<string, number>): Record<string, string>;
6
- declare function writeAppEnvFiles(config: SessionConfig, sessionDir: string, sessionId: string, ports: Record<string, number>): string[];
6
+ declare function writeAppEnvFiles(config: SessionConfig, workingDir: string, ports: Record<string, number>): string[];
7
7
 
8
8
  export { generateEnvContent, renderAppEnv, writeAppEnvFiles, writeEnvFile };
package/dist/lib/env.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  renderAppEnv,
4
4
  writeAppEnvFiles,
5
5
  writeEnvFile
6
- } from "../chunk-J36LRUXM.js";
6
+ } from "../chunk-HZBJF67X.js";
7
7
  export {
8
8
  generateEnvContent,
9
9
  renderAppEnv,
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,68 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { generateEnvContent, renderAppEnv } from './env.js';
3
+ describe('generateEnvContent', () => {
4
+ it('generates env file content with session info and ports', () => {
5
+ const content = generateEnvContent('001', { POSTGRES_PORT: 47110 }, 'myproject');
6
+ expect(content).toContain('SESSION_ID=001');
7
+ expect(content).toContain('COMPOSE_PROJECT_NAME=myproject-001');
8
+ expect(content).toContain('POSTGRES_PORT=47110');
9
+ });
10
+ it('includes all provided ports', () => {
11
+ const ports = {
12
+ POSTGRES_PORT: 47110,
13
+ REDIS_PORT: 47111,
14
+ APP_PORT: 47100,
15
+ };
16
+ const content = generateEnvContent('005', ports, 'project');
17
+ expect(content).toContain('POSTGRES_PORT=47110');
18
+ expect(content).toContain('REDIS_PORT=47111');
19
+ expect(content).toContain('APP_PORT=47100');
20
+ });
21
+ it('ends with newline', () => {
22
+ const content = generateEnvContent('001', {}, 'project');
23
+ expect(content.endsWith('\n')).toBe(true);
24
+ });
25
+ it('handles empty ports', () => {
26
+ const content = generateEnvContent('001', {}, 'project');
27
+ expect(content).toContain('SESSION_ID=001');
28
+ expect(content).toContain('COMPOSE_PROJECT_NAME=project-001');
29
+ });
30
+ });
31
+ describe('renderAppEnv', () => {
32
+ it('substitutes port variables in template', () => {
33
+ const template = {
34
+ DATABASE_URL: 'postgres://localhost:${POSTGRES_PORT}/db',
35
+ };
36
+ const ports = { POSTGRES_PORT: 47110 };
37
+ const result = renderAppEnv(template, ports);
38
+ expect(result).toEqual({
39
+ DATABASE_URL: 'postgres://localhost:47110/db',
40
+ });
41
+ });
42
+ it('substitutes multiple variables in one value', () => {
43
+ const template = {
44
+ CACHE_URL: 'redis://${REDIS_HOST}:${REDIS_PORT}',
45
+ };
46
+ const ports = { REDIS_HOST: 47120, REDIS_PORT: 47111 };
47
+ const result = renderAppEnv(template, ports);
48
+ expect(result).toEqual({
49
+ CACHE_URL: 'redis://47120:47111',
50
+ });
51
+ });
52
+ it('handles templates with no variables', () => {
53
+ const template = { API_KEY: 'secret123' };
54
+ const ports = { POSTGRES_PORT: 47110 };
55
+ const result = renderAppEnv(template, ports);
56
+ expect(result).toEqual({ API_KEY: 'secret123' });
57
+ });
58
+ it('leaves unmatched variables as-is', () => {
59
+ const template = { URL: 'http://localhost:${UNKNOWN_PORT}' };
60
+ const ports = { POSTGRES_PORT: 47110 };
61
+ const result = renderAppEnv(template, ports);
62
+ expect(result).toEqual({ URL: 'http://localhost:${UNKNOWN_PORT}' });
63
+ });
64
+ it('handles empty template', () => {
65
+ const result = renderAppEnv({}, { PORT: 3000 });
66
+ expect(result).toEqual({});
67
+ });
68
+ });
@@ -1,6 +1,6 @@
1
- import { SessionConfig } from './config.js';
1
+ import { PortMapping } from './docker-inspect.js';
2
2
 
3
- declare function calculatePorts(config: SessionConfig, sessionId: string): Record<string, number>;
3
+ declare function extractPorts(portMappings: PortMapping[]): Record<string, number>;
4
4
  declare function formatPortsTable(ports: Record<string, number>): string;
5
5
 
6
- export { calculatePorts, formatPortsTable };
6
+ export { extractPorts, formatPortsTable };
package/dist/lib/ports.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
- calculatePorts,
2
+ extractPorts,
3
3
  formatPortsTable
4
- } from "../chunk-3ATDGV4Y.js";
4
+ } from "../chunk-LAOWFCQL.js";
5
5
  export {
6
- calculatePorts,
6
+ extractPorts,
7
7
  formatPortsTable
8
8
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,61 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { calculatePorts, formatPortsTable } from './ports.js';
3
+ const baseConfig = {
4
+ portBase: 47000,
5
+ sessionsDir: '../sessions',
6
+ ports: {
7
+ POSTGRES_PORT: 10,
8
+ REDIS_PORT: 11,
9
+ APP_PORT: 0,
10
+ },
11
+ setup: [],
12
+ };
13
+ describe('calculatePorts', () => {
14
+ it('calculates ports for session 001', () => {
15
+ const ports = calculatePorts(baseConfig, '001');
16
+ expect(ports).toEqual({
17
+ POSTGRES_PORT: 47110,
18
+ REDIS_PORT: 47111,
19
+ APP_PORT: 47100,
20
+ });
21
+ });
22
+ it('calculates ports for session 005', () => {
23
+ const ports = calculatePorts(baseConfig, '005');
24
+ expect(ports).toEqual({
25
+ POSTGRES_PORT: 47510,
26
+ REDIS_PORT: 47511,
27
+ APP_PORT: 47500,
28
+ });
29
+ });
30
+ it('handles empty ports config', () => {
31
+ const config = {
32
+ ...baseConfig,
33
+ ports: {},
34
+ };
35
+ const ports = calculatePorts(config, '001');
36
+ expect(ports).toEqual({});
37
+ });
38
+ it('handles different port base', () => {
39
+ const config = {
40
+ ...baseConfig,
41
+ portBase: 50000,
42
+ };
43
+ const ports = calculatePorts(config, '002');
44
+ expect(ports.POSTGRES_PORT).toBe(50210);
45
+ });
46
+ });
47
+ describe('formatPortsTable', () => {
48
+ it('formats ports as indented lines', () => {
49
+ const ports = { POSTGRES_PORT: 47110, REDIS_PORT: 47111 };
50
+ const result = formatPortsTable(ports);
51
+ expect(result).toBe(' POSTGRES_PORT: http://localhost:47110\n REDIS_PORT: http://localhost:47111');
52
+ });
53
+ it('handles empty ports', () => {
54
+ const result = formatPortsTable({});
55
+ expect(result).toBe('');
56
+ });
57
+ it('handles single port', () => {
58
+ const result = formatPortsTable({ PORT: 3000 });
59
+ expect(result).toBe(' PORT: http://localhost:3000');
60
+ });
61
+ });
@@ -0,0 +1,16 @@
1
+ import { ContainerInfo, PortMapping } from './docker-inspect.js';
2
+
3
+ interface Session {
4
+ sessionId: string;
5
+ workingDir: string;
6
+ running: boolean;
7
+ containers: ContainerInfo[];
8
+ ports: PortMapping[];
9
+ createdAt: string | null;
10
+ }
11
+ declare function buildSession(workingDir: string, containers: ContainerInfo[]): Promise<Session>;
12
+ declare function listActiveSessions(): Promise<Session[]>;
13
+ declare function getSession(workingDir: string): Promise<Session | null>;
14
+ declare function formatPorts(ports: PortMapping[]): string;
15
+
16
+ export { type Session, buildSession, formatPorts, getSession, listActiveSessions };
@@ -0,0 +1,13 @@
1
+ import {
2
+ buildSession,
3
+ formatPorts,
4
+ getSession,
5
+ listActiveSessions
6
+ } from "../chunk-DQER5GNG.js";
7
+ import "../chunk-JZ2VPQXP.js";
8
+ export {
9
+ buildSession,
10
+ formatPorts,
11
+ getSession,
12
+ listActiveSessions
13
+ };
@@ -33,14 +33,14 @@ declare class SessionStore {
33
33
  mode?: string;
34
34
  inPlace?: boolean;
35
35
  }): SessionRow;
36
- listByProject(projectRoot: string): SessionRow[];
37
36
  listAll(): SessionRow[];
38
- findSession(projectRoot: string, sessionId: string): SessionRow | undefined;
37
+ findSession(sessionId: string): SessionRow | undefined;
39
38
  findByDir(sessionDir: string): SessionRow | undefined;
40
- getUsedSessionIds(projectRoot: string): Set<string>;
41
- markDestroyed(projectRoot: string, sessionId: string): boolean;
42
- remove(projectRoot: string, sessionId: string): boolean;
39
+ getUsedSessionIds(): Set<string>;
40
+ markDestroyed(sessionId: string): boolean;
41
+ remove(sessionId: string): boolean;
43
42
  close(): void;
43
+ private migrate;
44
44
  }
45
45
 
46
46
  export { type SessionRow, SessionStore };
package/dist/lib/store.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SessionStore
3
- } from "../chunk-H4HPDIY3.js";
3
+ } from "../chunk-ZKHNUDSL.js";
4
4
  export {
5
5
  SessionStore
6
6
  };
@@ -0,0 +1 @@
1
+ export {};