shine-code-submit 0.2.9 → 0.2.11
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/.claude-plugin/plugin.json +1 -1
- package/dist/install.cjs +2 -2
- package/package.json +1 -1
- package/src/daemon/git.ts +11 -0
- package/src/daemon/server.ts +117 -2
- package/src/daemon/ui-assets.ts +1 -1
- package/src/hook/main.ts +1 -1
- package/src/install/main.ts +7 -5
- package/src/shared/types.ts +50 -0
- package/ui/.build/app.js +50 -50
- package/ui/components/App.tsx +3 -0
- package/ui/components/ReportModule.tsx +201 -0
- package/ui/components/SideNav.tsx +1 -0
- package/ui/types.ts +7 -1
package/src/hook/main.ts
CHANGED
|
@@ -59,7 +59,7 @@ async function main(): Promise<void> {
|
|
|
59
59
|
if (token) {
|
|
60
60
|
const url = `${PUBLIC_BASE_URL}/ui?t=${token}`; // 网卡 IP:显示与打开浏览器用同一地址,局域网通用
|
|
61
61
|
process.stdout.write(JSON.stringify({ systemMessage: `Shine Dashboard: ${url}` }));
|
|
62
|
-
openBrowser(url);
|
|
62
|
+
// openBrowser(url); // 自动弹浏览器暂时关闭——链接仍作 systemMessage 打印,用户可点开
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
package/src/install/main.ts
CHANGED
|
@@ -144,11 +144,13 @@ function openDashboard(): void {
|
|
|
144
144
|
const pid = readPidFile();
|
|
145
145
|
const url = pid ? `${PUBLIC_BASE_URL}/ui?t=${pid.token}` : `${PUBLIC_BASE_URL}/ui`;
|
|
146
146
|
console.log(`[shine-code-submit] Dashboard: ${url}`);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
147
|
+
// 自动弹浏览器暂时关闭——Dashboard 链接仍打印在上一行,用户可自行点开。
|
|
148
|
+
// 想恢复:把下面 try/catch 取消注释(openBrowser(url))。
|
|
149
|
+
// try {
|
|
150
|
+
// openBrowser(url);
|
|
151
|
+
// } catch {
|
|
152
|
+
// /* 打开失败不阻塞 */
|
|
153
|
+
// }
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
function sleep(ms: number): Promise<void> {
|
package/src/shared/types.ts
CHANGED
|
@@ -114,3 +114,53 @@ export interface CommitsResponse {
|
|
|
114
114
|
commits: CommitLog[];
|
|
115
115
|
error?: string;
|
|
116
116
|
}
|
|
117
|
+
|
|
118
|
+
// ---- GET /api/report:数据上报页用的跨项目聚合 ----
|
|
119
|
+
|
|
120
|
+
/** 报告里单个会话的 token 明细。tokenTotal 读不到 transcript 为 null。 */
|
|
121
|
+
export interface ReportSession {
|
|
122
|
+
sessionId: string;
|
|
123
|
+
lastActive: number;
|
|
124
|
+
tokenTotal: TokenUsage | null;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** 报告里单项目的提交汇总(窗口内)。 */
|
|
128
|
+
export interface ReportProjectCommits {
|
|
129
|
+
count: number;
|
|
130
|
+
added: number;
|
|
131
|
+
deleted: number;
|
|
132
|
+
lastTime: number | null; // 最近提交时间(ms),无提交 null
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** 报告里单个项目(=cwd)的聚合行。 */
|
|
136
|
+
export interface ReportProject {
|
|
137
|
+
cwd: string;
|
|
138
|
+
name: string; // shortDir(cwd),展示用
|
|
139
|
+
gitUser: string | null; // git config user.name
|
|
140
|
+
sessionCount: number;
|
|
141
|
+
sessions: ReportSession[]; // 每会话 token 明细
|
|
142
|
+
totalTokens: TokenUsage; // 该项目 token 合计
|
|
143
|
+
commits: ReportProjectCommits;
|
|
144
|
+
recentCommits: CommitLog[]; // 最近若干条(展示用,限 5)
|
|
145
|
+
gitError?: string;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** 报告全局合计。 */
|
|
149
|
+
export interface ReportTotals {
|
|
150
|
+
projects: number;
|
|
151
|
+
sessions: number;
|
|
152
|
+
tokens: TokenUsage;
|
|
153
|
+
commitCount: number;
|
|
154
|
+
added: number;
|
|
155
|
+
deleted: number;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** GET /api/report 响应。 */
|
|
159
|
+
export interface ReportResponse {
|
|
160
|
+
version: string;
|
|
161
|
+
generatedAt: number;
|
|
162
|
+
since: number; // 统计窗口起点(ms),0=全部
|
|
163
|
+
gitUser: string | null; // 全局代表(首个有 user.name 的项目)
|
|
164
|
+
projects: ReportProject[];
|
|
165
|
+
totals: ReportTotals;
|
|
166
|
+
}
|