jettypod 4.4.13 → 4.4.15
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/apps/dashboard/lib/db.ts +9 -4
- package/jettypod.js +48 -1
- package/package.json +1 -1
package/apps/dashboard/lib/db.ts
CHANGED
|
@@ -31,17 +31,22 @@ export interface Decision {
|
|
|
31
31
|
created_at: string;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
function
|
|
34
|
+
function getProjectRoot(): string {
|
|
35
|
+
// Use JETTYPOD_PROJECT_PATH if set (passed by jettypod CLI)
|
|
36
|
+
// Otherwise fall back to git root (for dev mode)
|
|
37
|
+
if (process.env.JETTYPOD_PROJECT_PATH) {
|
|
38
|
+
return process.env.JETTYPOD_PROJECT_PATH;
|
|
39
|
+
}
|
|
35
40
|
try {
|
|
36
41
|
return execSync('git rev-parse --show-toplevel', { encoding: 'utf-8' }).trim();
|
|
37
42
|
} catch {
|
|
38
|
-
throw new Error('Not in a git repository');
|
|
43
|
+
throw new Error('Not in a git repository and JETTYPOD_PROJECT_PATH not set');
|
|
39
44
|
}
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
function getDbPath(): string {
|
|
43
|
-
const
|
|
44
|
-
return path.join(
|
|
48
|
+
const projectRoot = getProjectRoot();
|
|
49
|
+
return path.join(projectRoot, '.jettypod', 'work.db');
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
function getDb(): Database.Database {
|
package/jettypod.js
CHANGED
|
@@ -1944,10 +1944,57 @@ switch (command) {
|
|
|
1944
1944
|
// New project - auto-initialize
|
|
1945
1945
|
await initializeProject();
|
|
1946
1946
|
} else {
|
|
1947
|
-
// Project exists -
|
|
1947
|
+
// Project exists - launch dashboard and regenerate CLAUDE.md
|
|
1948
1948
|
const currentConfig = config.read();
|
|
1949
1949
|
await generateClaude();
|
|
1950
1950
|
|
|
1951
|
+
// Launch dashboard
|
|
1952
|
+
const dashboardPath = path.join(__dirname, 'apps', 'dashboard');
|
|
1953
|
+
const DASHBOARD_PORT = 3456;
|
|
1954
|
+
const { spawn, exec } = require('child_process');
|
|
1955
|
+
|
|
1956
|
+
// Check if a port is available
|
|
1957
|
+
const isPortAvailable = (port) => new Promise((resolve) => {
|
|
1958
|
+
const net = require('net');
|
|
1959
|
+
const server = net.createServer();
|
|
1960
|
+
server.once('error', () => resolve(false)); // Port in use
|
|
1961
|
+
server.once('listening', () => {
|
|
1962
|
+
server.close();
|
|
1963
|
+
resolve(true); // Port available
|
|
1964
|
+
});
|
|
1965
|
+
server.listen(port);
|
|
1966
|
+
});
|
|
1967
|
+
|
|
1968
|
+
const portAvailable = await isPortAvailable(DASHBOARD_PORT);
|
|
1969
|
+
|
|
1970
|
+
if (portAvailable) {
|
|
1971
|
+
// Start dashboard in background with project path
|
|
1972
|
+
console.log('🚀 Starting dashboard...');
|
|
1973
|
+
const dashboardProcess = spawn('npm', ['run', 'dev', '--', '-p', String(DASHBOARD_PORT)], {
|
|
1974
|
+
cwd: dashboardPath,
|
|
1975
|
+
detached: true,
|
|
1976
|
+
stdio: 'ignore',
|
|
1977
|
+
env: {
|
|
1978
|
+
...process.env,
|
|
1979
|
+
JETTYPOD_PROJECT_PATH: process.cwd()
|
|
1980
|
+
}
|
|
1981
|
+
});
|
|
1982
|
+
dashboardProcess.unref();
|
|
1983
|
+
|
|
1984
|
+
// Wait a moment for server to start, then open browser
|
|
1985
|
+
setTimeout(() => {
|
|
1986
|
+
const openCmd = process.platform === 'darwin' ? 'open' :
|
|
1987
|
+
process.platform === 'win32' ? 'start' : 'xdg-open';
|
|
1988
|
+
exec(`${openCmd} http://localhost:${DASHBOARD_PORT}`);
|
|
1989
|
+
}, 2000);
|
|
1990
|
+
} else {
|
|
1991
|
+
// Dashboard likely already running, just open browser
|
|
1992
|
+
console.log('📊 Dashboard running');
|
|
1993
|
+
const openCmd = process.platform === 'darwin' ? 'open' :
|
|
1994
|
+
process.platform === 'win32' ? 'start' : 'xdg-open';
|
|
1995
|
+
exec(`${openCmd} http://localhost:${DASHBOARD_PORT}`);
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1951
1998
|
const discovery = currentConfig.project_discovery;
|
|
1952
1999
|
|
|
1953
2000
|
if (discovery && discovery.status === 'in_progress') {
|