prjct-cli 0.11.0 → 0.11.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/bin/serve.js +90 -26
- package/package.json +11 -1
- package/packages/shared/dist/index.d.ts +615 -0
- package/packages/shared/dist/index.js +204 -0
- package/packages/shared/package.json +29 -0
- package/packages/shared/src/index.ts +9 -0
- package/packages/shared/src/schemas.ts +124 -0
- package/packages/shared/src/types.ts +187 -0
- package/packages/shared/src/utils.ts +148 -0
- package/packages/shared/tsconfig.json +18 -0
- package/packages/web/README.md +36 -0
- package/packages/web/app/api/claude/sessions/route.ts +44 -0
- package/packages/web/app/api/claude/status/route.ts +34 -0
- package/packages/web/app/api/projects/[id]/delete/route.ts +21 -0
- package/packages/web/app/api/projects/[id]/icon/route.ts +33 -0
- package/packages/web/app/api/projects/[id]/route.ts +29 -0
- package/packages/web/app/api/projects/[id]/stats/route.ts +36 -0
- package/packages/web/app/api/projects/[id]/status/route.ts +21 -0
- package/packages/web/app/api/projects/route.ts +16 -0
- package/packages/web/app/api/sessions/history/route.ts +122 -0
- package/packages/web/app/api/stats/route.ts +38 -0
- package/packages/web/app/error.tsx +34 -0
- package/packages/web/app/favicon.ico +0 -0
- package/packages/web/app/globals.css +155 -0
- package/packages/web/app/layout.tsx +43 -0
- package/packages/web/app/loading.tsx +7 -0
- package/packages/web/app/not-found.tsx +25 -0
- package/packages/web/app/page.tsx +227 -0
- package/packages/web/app/project/[id]/error.tsx +41 -0
- package/packages/web/app/project/[id]/loading.tsx +9 -0
- package/packages/web/app/project/[id]/not-found.tsx +27 -0
- package/packages/web/app/project/[id]/page.tsx +253 -0
- package/packages/web/app/project/[id]/stats/page.tsx +447 -0
- package/packages/web/app/sessions/page.tsx +165 -0
- package/packages/web/app/settings/page.tsx +150 -0
- package/packages/web/components/AppSidebar.tsx +113 -0
- package/packages/web/components/CommandButton.tsx +39 -0
- package/packages/web/components/ConnectionStatus.tsx +29 -0
- package/packages/web/components/Logo.tsx +65 -0
- package/packages/web/components/MarkdownContent.tsx +123 -0
- package/packages/web/components/ProjectAvatar.tsx +54 -0
- package/packages/web/components/TechStackBadges.tsx +20 -0
- package/packages/web/components/TerminalTab.tsx +84 -0
- package/packages/web/components/TerminalTabs.tsx +210 -0
- package/packages/web/components/charts/SessionsChart.tsx +172 -0
- package/packages/web/components/providers.tsx +45 -0
- package/packages/web/components/ui/alert-dialog.tsx +157 -0
- package/packages/web/components/ui/badge.tsx +46 -0
- package/packages/web/components/ui/button.tsx +60 -0
- package/packages/web/components/ui/card.tsx +92 -0
- package/packages/web/components/ui/chart.tsx +385 -0
- package/packages/web/components/ui/dropdown-menu.tsx +257 -0
- package/packages/web/components/ui/scroll-area.tsx +58 -0
- package/packages/web/components/ui/sheet.tsx +139 -0
- package/packages/web/components/ui/tabs.tsx +66 -0
- package/packages/web/components/ui/tooltip.tsx +61 -0
- package/packages/web/components.json +22 -0
- package/packages/web/context/TerminalContext.tsx +45 -0
- package/packages/web/context/TerminalTabsContext.tsx +136 -0
- package/packages/web/eslint.config.mjs +18 -0
- package/packages/web/hooks/useClaudeTerminal.ts +375 -0
- package/packages/web/hooks/useProjectStats.ts +38 -0
- package/packages/web/hooks/useProjects.ts +73 -0
- package/packages/web/hooks/useStats.ts +28 -0
- package/packages/web/lib/format.ts +23 -0
- package/packages/web/lib/parse-prjct-files.ts +1122 -0
- package/packages/web/lib/projects.ts +452 -0
- package/packages/web/lib/pty.ts +101 -0
- package/packages/web/lib/query-config.ts +44 -0
- package/packages/web/lib/utils.ts +6 -0
- package/packages/web/next-env.d.ts +6 -0
- package/packages/web/next.config.ts +7 -0
- package/packages/web/package.json +53 -0
- package/packages/web/postcss.config.mjs +7 -0
- package/packages/web/public/file.svg +1 -0
- package/packages/web/public/globe.svg +1 -0
- package/packages/web/public/next.svg +1 -0
- package/packages/web/public/vercel.svg +1 -0
- package/packages/web/public/window.svg +1 -0
- package/packages/web/server.ts +262 -0
- package/packages/web/tsconfig.json +34 -0
package/bin/serve.js
CHANGED
|
@@ -5,27 +5,94 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Launches the prjct web interface with Claude Code CLI integration.
|
|
7
7
|
* Uses your existing Claude subscription via PTY - no API costs!
|
|
8
|
+
*
|
|
9
|
+
* Auto-installs dependencies on first run.
|
|
8
10
|
*/
|
|
9
11
|
|
|
10
|
-
const { spawn } = require('child_process')
|
|
12
|
+
const { spawn, spawnSync } = require('child_process')
|
|
11
13
|
const path = require('path')
|
|
12
14
|
const fs = require('fs')
|
|
13
15
|
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
+
const packagesDir = path.join(__dirname, '..', 'packages')
|
|
17
|
+
const sharedDir = path.join(packagesDir, 'shared')
|
|
18
|
+
const webDir = path.join(packagesDir, 'web')
|
|
16
19
|
|
|
17
20
|
// Parse arguments
|
|
18
21
|
const args = process.argv.slice(2)
|
|
19
|
-
const portArg = args.find(a => a.startsWith('--port='))
|
|
20
|
-
const port = portArg ? portArg.split('=')[1] : '
|
|
21
|
-
const webPort = '3000'
|
|
22
|
+
const portArg = args.find((a) => a.startsWith('--port='))
|
|
23
|
+
const port = portArg ? portArg.split('=')[1] : '3000'
|
|
22
24
|
|
|
23
|
-
// Check if
|
|
24
|
-
if (!fs.existsSync(
|
|
25
|
-
console.error('❌ Web
|
|
25
|
+
// Check if web package exists
|
|
26
|
+
if (!fs.existsSync(webDir)) {
|
|
27
|
+
console.error('❌ Web package not found.')
|
|
28
|
+
console.error(' This might be a broken installation.')
|
|
29
|
+
console.error(' Try reinstalling: npm install -g prjct-cli')
|
|
26
30
|
process.exit(1)
|
|
27
31
|
}
|
|
28
32
|
|
|
33
|
+
// Check if dependencies are installed
|
|
34
|
+
const sharedNodeModules = path.join(sharedDir, 'node_modules')
|
|
35
|
+
const webNodeModules = path.join(webDir, 'node_modules')
|
|
36
|
+
const needsSharedInstall = fs.existsSync(sharedDir) && !fs.existsSync(sharedNodeModules)
|
|
37
|
+
const needsWebInstall = !fs.existsSync(webNodeModules)
|
|
38
|
+
|
|
39
|
+
if (needsSharedInstall || needsWebInstall) {
|
|
40
|
+
console.log(`
|
|
41
|
+
╔═══════════════════════════════════════════════════════════╗
|
|
42
|
+
║ ║
|
|
43
|
+
║ ⚡ prjct - First Time Setup ║
|
|
44
|
+
║ ║
|
|
45
|
+
║ Installing web dependencies... ║
|
|
46
|
+
║ This only happens once. ║
|
|
47
|
+
║ ║
|
|
48
|
+
╚═══════════════════════════════════════════════════════════╝
|
|
49
|
+
`)
|
|
50
|
+
|
|
51
|
+
// Install shared dependencies first (if exists)
|
|
52
|
+
if (needsSharedInstall) {
|
|
53
|
+
console.log('📦 Installing packages/shared dependencies...')
|
|
54
|
+
const sharedInstall = spawnSync('npm', ['install'], {
|
|
55
|
+
cwd: sharedDir,
|
|
56
|
+
stdio: 'inherit',
|
|
57
|
+
shell: true,
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
if (sharedInstall.status !== 0) {
|
|
61
|
+
console.error('❌ Failed to install shared dependencies')
|
|
62
|
+
process.exit(1)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Build shared package
|
|
66
|
+
console.log('🔨 Building shared package...')
|
|
67
|
+
const sharedBuild = spawnSync('npm', ['run', 'build'], {
|
|
68
|
+
cwd: sharedDir,
|
|
69
|
+
stdio: 'inherit',
|
|
70
|
+
shell: true,
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
if (sharedBuild.status !== 0) {
|
|
74
|
+
console.error('⚠️ Warning: Failed to build shared package')
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Install web dependencies
|
|
79
|
+
if (needsWebInstall) {
|
|
80
|
+
console.log('📦 Installing packages/web dependencies...')
|
|
81
|
+
const webInstall = spawnSync('npm', ['install'], {
|
|
82
|
+
cwd: webDir,
|
|
83
|
+
stdio: 'inherit',
|
|
84
|
+
shell: true,
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
if (webInstall.status !== 0) {
|
|
88
|
+
console.error('❌ Failed to install web dependencies')
|
|
89
|
+
process.exit(1)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
console.log('✅ Dependencies installed!\n')
|
|
94
|
+
}
|
|
95
|
+
|
|
29
96
|
console.log(`
|
|
30
97
|
╔═══════════════════════════════════════════════════════════╗
|
|
31
98
|
║ ║
|
|
@@ -33,34 +100,35 @@ console.log(`
|
|
|
33
100
|
║ ║
|
|
34
101
|
║ Starting web server... ║
|
|
35
102
|
║ ║
|
|
36
|
-
║
|
|
37
|
-
║ Web: http://localhost:${webPort} ║
|
|
38
|
-
║ Claude: ws://localhost:${port}/ws/claude ║
|
|
103
|
+
║ Web: http://localhost:${port} ║
|
|
39
104
|
║ ║
|
|
40
105
|
║ Using your Claude subscription - $0 API costs ║
|
|
41
106
|
║ ║
|
|
42
107
|
╚═══════════════════════════════════════════════════════════╝
|
|
43
108
|
`)
|
|
44
109
|
|
|
45
|
-
// Start server
|
|
46
|
-
const server = spawn('npm', ['run', 'dev'], {
|
|
47
|
-
cwd: serverDir,
|
|
48
|
-
stdio: 'inherit',
|
|
49
|
-
shell: true,
|
|
50
|
-
env: { ...process.env, PORT: port }
|
|
51
|
-
})
|
|
52
|
-
|
|
53
110
|
// Start web dev server
|
|
54
111
|
const web = spawn('npm', ['run', 'dev'], {
|
|
55
112
|
cwd: webDir,
|
|
56
113
|
stdio: 'inherit',
|
|
57
|
-
shell: true
|
|
114
|
+
shell: true,
|
|
115
|
+
env: { ...process.env, PORT: port },
|
|
58
116
|
})
|
|
59
117
|
|
|
118
|
+
// Open browser after a short delay
|
|
119
|
+
setTimeout(() => {
|
|
120
|
+
const openCmd =
|
|
121
|
+
process.platform === 'darwin'
|
|
122
|
+
? 'open'
|
|
123
|
+
: process.platform === 'win32'
|
|
124
|
+
? 'start'
|
|
125
|
+
: 'xdg-open'
|
|
126
|
+
spawn(openCmd, [`http://localhost:${port}`], { shell: true })
|
|
127
|
+
}, 3000)
|
|
128
|
+
|
|
60
129
|
// Handle shutdown
|
|
61
130
|
const cleanup = () => {
|
|
62
131
|
console.log('\n👋 Shutting down prjct server...')
|
|
63
|
-
server.kill()
|
|
64
132
|
web.kill()
|
|
65
133
|
process.exit(0)
|
|
66
134
|
}
|
|
@@ -69,10 +137,6 @@ process.on('SIGINT', cleanup)
|
|
|
69
137
|
process.on('SIGTERM', cleanup)
|
|
70
138
|
|
|
71
139
|
// Handle errors
|
|
72
|
-
server.on('error', (err) => {
|
|
73
|
-
console.error('Server error:', err.message)
|
|
74
|
-
})
|
|
75
|
-
|
|
76
140
|
web.on('error', (err) => {
|
|
77
141
|
console.error('Web error:', err.message)
|
|
78
142
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prjct-cli",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.2",
|
|
4
4
|
"description": "Built for Claude - Ship fast, track progress, stay focused. Developer momentum tool for indie hackers.",
|
|
5
5
|
"main": "core/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -79,6 +79,16 @@
|
|
|
79
79
|
"files": [
|
|
80
80
|
"bin/",
|
|
81
81
|
"core/",
|
|
82
|
+
"packages/shared/",
|
|
83
|
+
"packages/web/app/",
|
|
84
|
+
"packages/web/components/",
|
|
85
|
+
"packages/web/context/",
|
|
86
|
+
"packages/web/hooks/",
|
|
87
|
+
"packages/web/lib/",
|
|
88
|
+
"packages/web/public/",
|
|
89
|
+
"packages/web/*.ts",
|
|
90
|
+
"packages/web/*.json",
|
|
91
|
+
"packages/web/*.mjs",
|
|
82
92
|
"templates/",
|
|
83
93
|
"scripts/postinstall.js",
|
|
84
94
|
"scripts/install.sh",
|