@surething/cockpit 1.0.177 → 1.0.178
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/.next-prod/BUILD_ID +1 -1
- package/.next-prod/app-path-routes-manifest.json +9 -9
- package/.next-prod/build-manifest.json +2 -2
- package/.next-prod/prerender-manifest.json +3 -3
- package/.next-prod/server/app/_global-error.html +2 -2
- package/.next-prod/server/app/_global-error.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.html +2 -2
- package/.next-prod/server/app/_not-found.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next-prod/server/app-paths-manifest.json +9 -9
- package/.next-prod/server/pages/404.html +2 -2
- package/.next-prod/server/pages/500.html +2 -2
- package/.next-prod/server/server-reference-manifest.json +1 -1
- package/.next-prod/trace +12 -12
- package/.next-prod/trace-build +1 -1
- package/README.md +9 -1
- package/README.zh.md +9 -1
- package/bin/cock.mjs +71 -15
- package/package.json +1 -1
- package/server.mjs +3 -1
- /package/.next-prod/static/{GxqgcsR_qHg08TC1-Wj7V → 7AsMj_iNkeEBoqPIBmtH6}/_buildManifest.js +0 -0
- /package/.next-prod/static/{GxqgcsR_qHg08TC1-Wj7V → 7AsMj_iNkeEBoqPIBmtH6}/_ssgManifest.js +0 -0
package/.next-prod/trace-build
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"name":"run-webpack","duration":
|
|
1
|
+
[{"name":"run-webpack","duration":11649582,"timestamp":135689337,"id":17,"parentId":1,"tags":{},"startTime":1774508096181,"traceId":"f2d23f9ead8f3bf6"},{"name":"run-typescript","duration":13425343,"timestamp":147342493,"id":1412,"parentId":1,"tags":{},"startTime":1774508107834,"traceId":"f2d23f9ead8f3bf6"},{"name":"static-check","duration":730191,"timestamp":160788440,"id":1415,"parentId":1,"tags":{},"startTime":1774508121280,"traceId":"f2d23f9ead8f3bf6"},{"name":"static-generation","duration":5296546,"timestamp":161692933,"id":1615,"parentId":1,"tags":{},"startTime":1774508122185,"traceId":"f2d23f9ead8f3bf6"},{"name":"collect-build-traces","duration":17187755,"timestamp":161519340,"id":1612,"parentId":1,"tags":{},"startTime":1774508122011,"traceId":"f2d23f9ead8f3bf6"},{"name":"telemetry-flush","duration":52,"timestamp":178710150,"id":1624,"parentId":1,"tags":{},"startTime":1774508139202,"traceId":"f2d23f9ead8f3bf6"},{"name":"next-build","duration":43376548,"timestamp":135333665,"id":1,"tags":{"buildMode":"default","version":"16.1.6","bundler":"webpack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1774508095826,"traceId":"f2d23f9ead8f3bf6"}]
|
package/README.md
CHANGED
|
@@ -53,13 +53,21 @@ A unified development cockpit built on **Claude Code (Agent SDK)** — chat, cod
|
|
|
53
53
|
- Chrome extension (Manifest V3) for browser automation bridge
|
|
54
54
|
- CLI tools: `cock browser` / `cock terminal` for headless automation
|
|
55
55
|
|
|
56
|
+
## Prerequisites
|
|
57
|
+
|
|
58
|
+
- **Node.js ≥ 20** — [nodejs.org](https://nodejs.org/)
|
|
59
|
+
- **Claude Code** — [docs.anthropic.com](https://docs.anthropic.com/en/docs/claude-code) (Cockpit uses Claude Code Agent SDK under the hood)
|
|
60
|
+
- **Git** — for git features (blame, diff, branch switching, etc.)
|
|
61
|
+
- **Chrome** — (optional) for Browser Bubble automation, install the bundled extension from `~/.cockpit/chrome-extension`
|
|
62
|
+
|
|
56
63
|
## Install
|
|
57
64
|
|
|
58
65
|
```bash
|
|
59
66
|
npm install -g @surething/cockpit
|
|
60
67
|
cock # Start server → http://localhost:3457
|
|
68
|
+
cock . # Open current directory as project
|
|
69
|
+
cock ~/my-project # Open specified directory
|
|
61
70
|
cock -h # Show help
|
|
62
|
-
cock -v # Show version
|
|
63
71
|
```
|
|
64
72
|
|
|
65
73
|
### From Source
|
package/README.zh.md
CHANGED
|
@@ -59,13 +59,21 @@
|
|
|
59
59
|
- Chrome 插件 (Manifest V3) 浏览器自动化桥接
|
|
60
60
|
- CLI 工具:`cock browser` / `cock terminal` 无头自动化
|
|
61
61
|
|
|
62
|
+
## 前置依赖
|
|
63
|
+
|
|
64
|
+
- **Node.js ≥ 20** — [nodejs.org](https://nodejs.org/)
|
|
65
|
+
- **Claude Code** — [docs.anthropic.com](https://docs.anthropic.com/en/docs/claude-code)(Cockpit 底层使用 Claude Code Agent SDK)
|
|
66
|
+
- **Git** — 用于 Git 相关功能(blame、diff、分支切换等)
|
|
67
|
+
- **Chrome** —(可选)浏览器气泡自动化,需安装 `~/.cockpit/chrome-extension` 中的扩展
|
|
68
|
+
|
|
62
69
|
## 安装
|
|
63
70
|
|
|
64
71
|
```bash
|
|
65
72
|
npm install -g @surething/cockpit
|
|
66
73
|
cock # 启动服务 → http://localhost:3457
|
|
74
|
+
cock . # 打开当前目录为项目
|
|
75
|
+
cock ~/my-project # 打开指定目录
|
|
67
76
|
cock -h # 查看帮助
|
|
68
|
-
cock -v # 查看版本
|
|
69
77
|
```
|
|
70
78
|
|
|
71
79
|
### 从源码安装
|
package/bin/cock.mjs
CHANGED
|
@@ -13,19 +13,21 @@ if (process.argv[2] === '--help' || process.argv[2] === '-h' || process.argv[2]
|
|
|
13
13
|
const pkg = JSON.parse(readFileSync(resolve(PROJECT_ROOT, 'package.json'), 'utf8'));
|
|
14
14
|
console.log(`Cockpit v${pkg.version} - One seat. One AI. Everything under control.
|
|
15
15
|
|
|
16
|
-
Usage: cock [
|
|
16
|
+
Usage: cock [path] [options]
|
|
17
17
|
|
|
18
18
|
Commands:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
cock Start server, open last project
|
|
20
|
+
cock . Start server, open current directory
|
|
21
|
+
cock <path> Start server, open specified directory
|
|
22
|
+
browser <id> <action> Control browser bubbles
|
|
23
|
+
terminal <id> <action> Control terminal bubbles
|
|
24
|
+
update Update to latest version
|
|
23
25
|
|
|
24
26
|
Options:
|
|
25
|
-
--port <port>
|
|
26
|
-
--no-open
|
|
27
|
-
-v, --version
|
|
28
|
-
-h, --help
|
|
27
|
+
--port <port> Set server port (default: 3457)
|
|
28
|
+
--no-open Don't open browser after start
|
|
29
|
+
-v, --version Show version
|
|
30
|
+
-h, --help Show this help`);
|
|
29
31
|
process.exit(0);
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -58,8 +60,7 @@ if (!process.env.COCKPIT_PORT) {
|
|
|
58
60
|
|
|
59
61
|
// Subcommand routing
|
|
60
62
|
if (process.argv[2] === 'browser') {
|
|
61
|
-
|
|
62
|
-
process.argv.splice(2, 1); // Remove 'browser' so cock-browser.mjs parses from argv[2]
|
|
63
|
+
process.argv.splice(2, 1);
|
|
63
64
|
const mod = await import('./cock-browser.mjs');
|
|
64
65
|
await mod.done;
|
|
65
66
|
process.exit(0);
|
|
@@ -83,17 +84,72 @@ if (process.argv[2] === 'update') {
|
|
|
83
84
|
process.exit(result.status ?? 1);
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
//
|
|
87
|
+
// ============================================
|
|
88
|
+
// Resolve project directory (if provided)
|
|
89
|
+
// ============================================
|
|
90
|
+
const { existsSync, mkdirSync } = await import('fs');
|
|
91
|
+
const { homedir } = await import('os');
|
|
92
|
+
|
|
93
|
+
const knownCommands = new Set(['browser', 'terminal', 'update', 'help']);
|
|
94
|
+
const arg = process.argv[2];
|
|
95
|
+
let projectDir = null;
|
|
96
|
+
|
|
97
|
+
// 第一个参数不是 flag 且不是已知子命令 → 视为目录路径
|
|
98
|
+
if (arg && !arg.startsWith('-') && !knownCommands.has(arg)) {
|
|
99
|
+
// 展开 ~ 为 home 目录
|
|
100
|
+
const raw = arg.startsWith('~') ? arg.replace(/^~/, homedir()) : arg;
|
|
101
|
+
projectDir = resolve(raw);
|
|
102
|
+
// 目录不存在则创建
|
|
103
|
+
if (!existsSync(projectDir)) {
|
|
104
|
+
mkdirSync(projectDir, { recursive: true });
|
|
105
|
+
console.log(`Created ${projectDir}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// ============================================
|
|
110
|
+
// Check if server is already running
|
|
111
|
+
// ============================================
|
|
112
|
+
const port = process.env.PORT || process.env.COCKPIT_PORT || '3457';
|
|
113
|
+
|
|
114
|
+
async function isServerRunning() {
|
|
115
|
+
try {
|
|
116
|
+
const res = await fetch(`http://localhost:${port}/api/version`, { signal: AbortSignal.timeout(1000) });
|
|
117
|
+
return res.ok;
|
|
118
|
+
} catch {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const { exec } = await import('child_process');
|
|
124
|
+
const running = await isServerRunning();
|
|
125
|
+
|
|
126
|
+
if (running) {
|
|
127
|
+
// 服务已运行 → 打开浏览器,立即退出
|
|
128
|
+
const base = `http://localhost:${port}`;
|
|
129
|
+
const url = projectDir ? `${base}/?cwd=${encodeURIComponent(projectDir)}` : base;
|
|
130
|
+
if (!process.env.COCKPIT_NO_OPEN) {
|
|
131
|
+
const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
|
|
132
|
+
exec(`${cmd} ${url}`);
|
|
133
|
+
}
|
|
134
|
+
console.log(`Cockpit is already running → ${url}`);
|
|
135
|
+
process.exit(0);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// ============================================
|
|
139
|
+
// Start server (foreground, Ctrl+C to stop)
|
|
140
|
+
// ============================================
|
|
87
141
|
const isDev = process.env.COCKPIT_ENV === 'dev';
|
|
88
|
-
const { existsSync } = await import('fs');
|
|
89
|
-
// prod mode requires a pre-built artifact; dev mode is compiled on-the-fly by Next.js
|
|
90
142
|
if (!isDev && !existsSync(resolve(PROJECT_ROOT, '.next-prod', 'BUILD_ID'))) {
|
|
91
143
|
console.error('No production build found.\n');
|
|
92
144
|
console.error('Run: npm run build');
|
|
93
145
|
process.exit(1);
|
|
94
146
|
}
|
|
95
147
|
|
|
148
|
+
// 传递项目目录给 server.mjs,让它打开正确的 URL
|
|
149
|
+
if (projectDir) {
|
|
150
|
+
process.env.COCKPIT_OPEN_PROJECT = projectDir;
|
|
151
|
+
}
|
|
152
|
+
|
|
96
153
|
console.log('Starting Cockpit...');
|
|
97
|
-
// dev: tsx for on-the-fly TS compilation; prod: pre-compiled dist/
|
|
98
154
|
const args = isDev ? ['--import', 'tsx', 'server.mjs'] : ['server.mjs'];
|
|
99
155
|
spawnSync('node', args, { cwd: PROJECT_ROOT, stdio: 'inherit' });
|
package/package.json
CHANGED
package/server.mjs
CHANGED
|
@@ -71,8 +71,10 @@ app.prepare().then(async () => {
|
|
|
71
71
|
|
|
72
72
|
// prod 模式自动打开浏览器(--no-open 禁用)
|
|
73
73
|
if (!dev && !process.env.COCKPIT_NO_OPEN) {
|
|
74
|
+
const openProject = process.env.COCKPIT_OPEN_PROJECT;
|
|
75
|
+
const openUrl = openProject ? `${url}/?cwd=${encodeURIComponent(openProject)}` : url;
|
|
74
76
|
const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
|
|
75
|
-
exec(`${cmd} ${
|
|
77
|
+
exec(`${cmd} ${openUrl}`);
|
|
76
78
|
}
|
|
77
79
|
});
|
|
78
80
|
|
/package/.next-prod/static/{GxqgcsR_qHg08TC1-Wj7V → 7AsMj_iNkeEBoqPIBmtH6}/_buildManifest.js
RENAMED
|
File without changes
|
|
File without changes
|