gatelight 0.19.3 → 0.40.1
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/.antigravity-plugin/plugin.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +2 -2
- package/package.json +1 -1
- package/skills/merge/SKILL.md +1 -1
- package/skills/modular/SKILL.md +6 -6
- package/skills/setup/SKILL.md +2 -2
- package/skills/setup-codekeep/SKILL.md +61 -17
- package/skills/setup-codekeep/frontend.eslint.mjs +287 -0
- package/skills/setup-modwall/SKILL.md +10 -11
- package/skills/setup-testcraft/SKILL.md +9 -3
- package/skills/setup-testcraft/checklist/dev-login.md +3 -3
- package/skills/setup-testcraft/checklist/same-number.md +26 -0
- package/skills/write-tests/SKILL.md +12 -12
- package/src/base/baseline.ts +2 -2
- package/src/base/commands.ts +2 -40
- package/src/base/execute.ts +1 -11
- package/src/base/exit.ts +1 -1
- package/src/base/full.ts +7 -10
- package/src/base/git.ts +34 -3
- package/src/base/hook.ts +71 -17
- package/src/base/hookformat.ts +16 -6
- package/src/base/layermap.ts +6 -3
- package/src/base/module.ts +8 -8
- package/src/base/repo.ts +8 -34
- package/src/base/sessions.ts +45 -13
- package/src/base/shell.ts +18 -10
- package/src/base/stop.ts +20 -6
- package/src/base/store.ts +15 -30
- package/src/cli.ts +3 -16
- package/src/craft/commands.ts +7 -1
- package/src/craft/defaults.ts +59 -0
- package/src/craft/session.ts +8 -4
- package/src/keep/check.ts +107 -40
- package/src/keep/config.ts +56 -26
- package/src/keep/eslint.ts +144 -6
- package/src/keep/loosen.ts +11 -61
- package/src/keep/session.ts +19 -5
- package/src/keep/styles.ts +72 -0
- package/src/pace/commands.ts +9 -3
- package/src/pace/full.ts +14 -25
- package/src/pace/index.ts +3 -0
- package/src/pace/record.ts +12 -6
- package/src/pace/results.ts +43 -2
- package/src/pace/run/playwright-reporter.mjs +5 -4
- package/src/pace/run/runner.ts +13 -7
- package/src/pace/run/targets.ts +3 -2
- package/src/pace/session.ts +3 -3
- package/src/pace/unfinished.ts +87 -0
- package/src/pace/unmerged.ts +87 -0
- package/src/pace/verify.ts +2 -2
- package/src/wall/commands.ts +92 -26
- package/src/wall/database.ts +12 -1
- package/src/wall/dbcheck.ts +2 -2
- package/src/wall/dbrules.ts +60 -19
- package/src/wall/literals.ts +162 -0
- package/src/wall/migrate.ts +248 -0
- package/src/wall/project.ts +29 -9
- package/src/wall/receipt.ts +2 -1
- package/src/wall/session.ts +5 -5
- package/src/wall/store.ts +3 -1
package/src/base/hookformat.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { PLUGIN_NAME } from './version.ts'
|
|
|
8
8
|
|
|
9
9
|
interface Session {
|
|
10
10
|
sessionId: string
|
|
11
|
-
/**
|
|
11
|
+
/** 这次 hook 给的目录:agent 现在所在的目录(cd 会留住,会话所在目录按第一次见到的认,见 sessions.ts 的 sessionHome)。 */
|
|
12
12
|
cwd: string
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ interface Session {
|
|
|
16
16
|
export type HookEvent = Session &
|
|
17
17
|
(
|
|
18
18
|
| { kind: 'start' }
|
|
19
|
-
/**
|
|
19
|
+
/** 要用改文件的工具改一个文件:路径(相对 cwd,或绝对路径),和这次要写进去的新文字(拿得到时)。可以拒绝。 */
|
|
20
20
|
| { kind: 'edit'; file: string; text?: string }
|
|
21
21
|
/** 要用一段补丁改这几个文件(Codex 的 apply_patch):只记下改到的工作区,不检查(一段补丁里有几个文件,修改的部分只有差异)。 */
|
|
22
22
|
| { kind: 'patch'; files: string[] }
|
|
@@ -24,7 +24,8 @@ export type HookEvent = Session &
|
|
|
24
24
|
| { kind: 'command'; command: string }
|
|
25
25
|
/** 一条命令执行完了。放到后台的,agent 这时还没看到它的输出。 */
|
|
26
26
|
| { kind: 'ran'; command: string; background: boolean }
|
|
27
|
-
|
|
27
|
+
/** 要结束这一轮。busy:会话放到后台的 agent(子代理、workflow、队友)还在干活,这一轮结束不是活干完了,它们干完会再叫醒会话。 */
|
|
28
|
+
| { kind: 'stop'; busy?: boolean }
|
|
28
29
|
/**
|
|
29
30
|
* 要调 gatelight 自己的 MCP 服务(src/mcp.ts,只有确认工具 confirm_with_user):text 是要给用户看的原文(调用里填的,没填是 undefined)。
|
|
30
31
|
* 只有工具自己不能保证每次弹窗的 agent 才读出这种事件(Antigravity);Claude Code 靠工具自己的标记弹窗,不经过 hook。
|
|
@@ -67,8 +68,13 @@ interface ClaudeInput {
|
|
|
67
68
|
tool_name?: string
|
|
68
69
|
tool_input?: { command?: unknown; run_in_background?: unknown; file_path?: unknown; content?: unknown; new_string?: unknown; edits?: unknown }
|
|
69
70
|
tool_response?: unknown
|
|
71
|
+
/** Stop 时还在跑的后台任务(Claude Code 给;老版本没有这个字段)。type 是 subagent、workflow、teammate、shell、monitor 这类。 */
|
|
72
|
+
background_tasks?: Array<{ type?: unknown }>
|
|
70
73
|
}
|
|
71
74
|
|
|
75
|
+
/** 会在本机替会话改文件、跑命令的后台任务。shell、monitor 不算:开着的开发服务、监视器会一直在,算上它们停止门就再也不问了。 */
|
|
76
|
+
const WORKING_TASKS = new Set(['subagent', 'workflow', 'teammate'])
|
|
77
|
+
|
|
72
78
|
/** 改文件的工具(Claude Code 的,和 hooks.json 里的 matcher 一样)。Codex 的 apply_patch 另算(patchFiles)。 */
|
|
73
79
|
const EDIT_TOOLS = new Set(['Edit', 'Write', 'MultiEdit'])
|
|
74
80
|
|
|
@@ -88,7 +94,7 @@ function writtenText(input: ClaudeInput['tool_input']): string | undefined {
|
|
|
88
94
|
|
|
89
95
|
/**
|
|
90
96
|
* Codex 的 apply_patch 补丁(tool_input.command 是补丁正文)要改的文件:新建、修改、删除的,和改名后的新路径。
|
|
91
|
-
*
|
|
97
|
+
* 路径相对 cwd,也可以是绝对路径。
|
|
92
98
|
*/
|
|
93
99
|
function patchFiles(patch: string): string[] {
|
|
94
100
|
return patch.split('\n').flatMap(line => /^\*\*\* (?:(?:Add|Update|Delete) File|Move to): (.+?)\s*$/.exec(line)?.[1] ?? [])
|
|
@@ -112,7 +118,10 @@ export const CLAUDE_HOOKS: HookFormat = {
|
|
|
112
118
|
const session: Session = { sessionId: input.session_id ?? 'unknown', cwd: input.cwd ?? process.cwd() }
|
|
113
119
|
const event = input.hook_event_name
|
|
114
120
|
if (event === 'SessionStart') return { ...session, kind: 'start' }
|
|
115
|
-
if (event === 'Stop')
|
|
121
|
+
if (event === 'Stop') {
|
|
122
|
+
const busy = Array.isArray(input.background_tasks) && input.background_tasks.some(task => WORKING_TASKS.has(task?.type as string))
|
|
123
|
+
return { ...session, kind: 'stop', ...(busy ? { busy } : {}) }
|
|
124
|
+
}
|
|
116
125
|
const tool = input.tool_name ?? ''
|
|
117
126
|
if (event === 'PreToolUse' && EDIT_TOOLS.has(tool)) {
|
|
118
127
|
const file = input.tool_input?.file_path
|
|
@@ -199,7 +208,7 @@ function oneParagraph(text: string): string {
|
|
|
199
208
|
}
|
|
200
209
|
|
|
201
210
|
/**
|
|
202
|
-
* Antigravity(桌面 App)的 hook 格式,按 2026-11-24
|
|
211
|
+
* Antigravity(桌面 App)的 hook 格式,按 2026-11-24 的实测:
|
|
203
212
|
* - 跑命令是 run_command(args.CommandLine);改文件的专门工具只有 write_file(args.Path 是绝对路径、args.Content)和
|
|
204
213
|
* edit_file(args.Path、args.Replacement 是换进去的文字;它的输入没实际见过,照工具定义)。删文件、移动文件只能走 run_command,和 Claude Code 下走 Bash 一样不在改文件的检查里。
|
|
205
214
|
* - 不干预时什么都不能输出:PreToolUse 输出 {}、空的 decision、退出码非 0 都会把这次工具调用拦掉。所以这里没有要说的就返回 undefined,
|
|
@@ -244,6 +253,7 @@ export const ANTIGRAVITY_HOOKS: HookFormat = {
|
|
|
244
253
|
]
|
|
245
254
|
return steps.length > 0 ? { injectSteps: steps } : undefined
|
|
246
255
|
}
|
|
256
|
+
// Stop 的输出里没有只给用户看、不拦的写法:提醒类的话只能不说,并进 reason 就成了拦 agent
|
|
247
257
|
if (event.kind === 'stop') return verdict.block ? { decision: 'continue', reason: verdict.block } : undefined
|
|
248
258
|
// force_ask:每次都弹窗问用户,"总是允许"在弹窗里选不了(实测);用户拒绝时工具不执行
|
|
249
259
|
if (verdict.ask) return { decision: 'force_ask', reason: oneParagraph(verdict.ask) }
|
package/src/base/layermap.ts
CHANGED
|
@@ -13,7 +13,7 @@ export const LAYERMAP_MINIMUM = '0.1.48'
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* 插件不把命令放进 PATH 的地方怎么有 layermap 命令:Claude Code 把 LayerMap 插件的命令放进它跑命令的 PATH,
|
|
16
|
-
* Codex 的命令、终端、git 钩子里没有,要用 LayerMap
|
|
16
|
+
* Codex 的命令、终端、git 钩子里没有,要用 LayerMap 自己放的固定入口(它运行的是本机各个 LayerMap 插件跑的同一版)。
|
|
17
17
|
* 入口由 LayerMap 放、归它管,这里只说怎么放;各处"找不到命令"的提示都接这一句。
|
|
18
18
|
*/
|
|
19
19
|
export const LAYERMAP_COMMAND = 'Codex 和终端里还要跑一次 npx layermap setup command,在 ~/.local/bin 放上 layermap 命令'
|
|
@@ -27,12 +27,15 @@ export type LayermapFailure = {
|
|
|
27
27
|
|
|
28
28
|
export type LayermapAnswer = { ok: true; value: unknown } | LayermapFailure
|
|
29
29
|
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* 版本太旧的说法:模块在输出里读不到要的字段时也用它。
|
|
32
|
+
* 新版 LayerMap 自己跟着 npm 的最新版走,只有插件和 setup 放的入口还是旧版时才会太旧,所以这里说的是升一次插件和入口。
|
|
33
|
+
*/
|
|
31
34
|
export function tooOld(): LayermapFailure {
|
|
32
35
|
return {
|
|
33
36
|
ok: false,
|
|
34
37
|
kind: 'old',
|
|
35
|
-
problem: `layermap 版本太旧,要 ${LAYERMAP_MINIMUM}
|
|
38
|
+
problem: `layermap 版本太旧,要 ${LAYERMAP_MINIMUM} 以上:升级一次 LayerMap 插件(Claude Code 里是 claude plugin marketplace update layermap 再 claude plugin update layermap@layermap,Codex 里是 codex plugin marketplace upgrade layermap),~/.local/bin 的 layermap 命令再跑一次 npx layermap setup command;之后它自己跟着 npm 的最新版更新。开新会话后再跑`,
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
|
package/src/base/module.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// 检查模块交给底座的入口。底座(这个目录)不认识任何模块:合并门、停止门、会话说明、整组都按这里的入口去问,
|
|
2
2
|
// 模块(比如 ../pace 跑测试)把自己的实现登记进来。登记由装配的文件做(src/modules.ts),底座的代码不引用模块。
|
|
3
|
-
// 设计见仓库根目录的 整体设计方案.md。
|
|
4
3
|
|
|
5
4
|
import type { Repo } from './repo.ts'
|
|
6
5
|
import type { RunRecord } from './store.ts'
|
|
@@ -16,8 +15,6 @@ export interface FullStep {
|
|
|
16
15
|
header: string
|
|
17
16
|
command: string
|
|
18
17
|
args: string[]
|
|
19
|
-
/** 这一段要借用工作区(比如建副本):底座把这一轮的运行 id 给它(见 execute.ts 的 RUN_ENV),它借用时不另占。只给测试之前跑的检查。 */
|
|
20
|
-
borrows?: boolean
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
/** 一个模块在这一轮整组里的部分。 */
|
|
@@ -30,10 +27,11 @@ export interface FullPart {
|
|
|
30
27
|
/**
|
|
31
28
|
* 各段跑完(没被中断)以后:模块往这次的运行记录里加自己的字段(fields),在记录写下之后说给 agent 的话(notes,
|
|
32
29
|
* 拿得到写好的记录和这之前的全部记录)。
|
|
30
|
+
* failedStep 是没过的那一段的 name(各段都过了时没有):模块自己的段跑了、没过的,照样可以核对它跑到了什么,写进 notes。
|
|
33
31
|
* problems:按跑完交回来的东西核对出的问题(比如该跑到的没跑到),一条一句、写明怎么改。各段都过了、却有问题的,整组算没过;
|
|
34
|
-
*
|
|
32
|
+
* 有哪一段没过时不看(已经算没过了)。
|
|
35
33
|
*/
|
|
36
|
-
finish?(): { fields?: Record<string, unknown>; problems?: string[]; notes?(record: RunRecord, before: RunRecord[]): string[] }
|
|
34
|
+
finish?(failedStep?: string): { fields?: Record<string, unknown>; problems?: string[]; notes?(record: RunRecord, before: RunRecord[]): string[] }
|
|
37
35
|
/** 这一轮结束(不管怎么结束)时收拾模块自己的临时文件。 */
|
|
38
36
|
dispose?(): void
|
|
39
37
|
}
|
|
@@ -69,10 +67,12 @@ export interface Module {
|
|
|
69
67
|
beforeEdit?(repo: Repo, path: string, text?: string): string | undefined
|
|
70
68
|
|
|
71
69
|
/**
|
|
72
|
-
* 停止门:这个会话在这个仓库里还有没处理完的事。keys
|
|
73
|
-
*
|
|
70
|
+
* 停止门:这个会话在这个仓库里还有没处理完的事。keys 是这几件事各自的记号,写成"模块:项:内容的样子"(比如 wall:check:<摘要>),
|
|
71
|
+
* 底座记下拦过的,每件只拦一次;seen 说一个记号该不该当作拦过(拦过的,和这个会话上次为同一项被拦之后没再动过手的,见 stop.ts);
|
|
72
|
+
* named 为真时话里要写明是哪个仓库(会话不是在这个仓库里开始的)。
|
|
73
|
+
* notice 是同时直接给用户看的一行(agent 转述可能被一句带过的事),不给就只说给 agent。
|
|
74
74
|
*/
|
|
75
|
-
unfinished?(repo: Repo, sessionId: string, seen:
|
|
75
|
+
unfinished?(repo: Repo, sessionId: string, seen: (key: string) => boolean, named: boolean): { keys: string[]; text: string; notice?: string } | undefined
|
|
76
76
|
|
|
77
77
|
/** 整组里这个模块的部分;现在跑不了(配置不对、没有要跑的)时给出原因。 */
|
|
78
78
|
fullPart?(repo: Repo): FullPart | { problem: string }
|
package/src/base/repo.ts
CHANGED
|
@@ -5,11 +5,11 @@ import { currentAgent } from './agent.ts'
|
|
|
5
5
|
import { CONTRACT_FILE } from './contract.ts'
|
|
6
6
|
import { type Coverage, findCoverage } from './coverage.ts'
|
|
7
7
|
import { failureExcerpt } from './excerpt.ts'
|
|
8
|
-
import { type Execution, execute
|
|
8
|
+
import { type Execution, execute } from './execute.ts'
|
|
9
9
|
import { duration, when } from './format.ts'
|
|
10
10
|
import { changedPaths, commonDir, defaultBranch, refTip, repoRoot } from './git.ts'
|
|
11
11
|
import { matcher } from './glob.ts'
|
|
12
|
-
import {
|
|
12
|
+
import { newRunId, processAlive, type RunMarker, type RunRecord, Store } from './store.ts'
|
|
13
13
|
import { VERSION } from './version.ts'
|
|
14
14
|
|
|
15
15
|
export interface Repo {
|
|
@@ -65,25 +65,22 @@ export function defaultTips(repo: Repo): Record<string, string> {
|
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* 在跑的那次是什么时候、哪个进程起的。testpace 被强杀后测试可能还在跑,说清楚怎么停。
|
|
68
|
-
* 借用工作区的登记只认那一个进程,列得出来就是它还在。
|
|
69
68
|
*/
|
|
70
|
-
export function started(marker:
|
|
71
|
-
const owner =
|
|
69
|
+
export function started(marker: RunMarker): string {
|
|
70
|
+
const owner = processAlive(marker.pid)
|
|
72
71
|
? `进程 ${marker.pid}`
|
|
73
72
|
: `起它的 testpace 已经退出,测试进程组 ${marker.group} 还在跑,不要了用 kill -- -${marker.group} 停掉`
|
|
74
73
|
return `开始于 ${when(marker.startedAt)},${owner}`
|
|
75
74
|
}
|
|
76
75
|
|
|
77
|
-
/**
|
|
78
|
-
|
|
79
|
-
if (isHold(marker)) return `这个工作区正被 ${marker.by} 占着(${started(marker)})`
|
|
76
|
+
/** 这个工作区在跑的是哪种命令、什么时候哪个进程起的。 */
|
|
77
|
+
function runningText(marker: RunMarker): string {
|
|
80
78
|
const what = marker.kind === 'full' ? '整组' : ` ${marker.kind} `
|
|
81
79
|
return `这个工作区正在跑${what}(${started(marker)})`
|
|
82
80
|
}
|
|
83
81
|
|
|
84
82
|
/** 因为这个工作区已经在跑测试而不跑时的说明。 */
|
|
85
|
-
export function busyText(marker:
|
|
86
|
-
if (isHold(marker)) return `${runningText(marker)},占着时不跑测试,等它放开再跑。`
|
|
83
|
+
export function busyText(marker: RunMarker, tree: string): string {
|
|
87
84
|
const stale = marker.kind === 'full' && marker.tree !== tree ? '那次整组开始后代码改过,它跑完的结果不算当前代码的记录。' : ''
|
|
88
85
|
return `${runningText(marker)},同一个工作区一次只跑一轮测试,等它结束再跑。${stale}`
|
|
89
86
|
}
|
|
@@ -99,7 +96,7 @@ export async function runClaimed(
|
|
|
99
96
|
args: string[],
|
|
100
97
|
tree: string,
|
|
101
98
|
env: Record<string, string> = {},
|
|
102
|
-
): Promise<{ id: string; startedAt: number; log: string; execution: Execution } | { busy:
|
|
99
|
+
): Promise<{ id: string; startedAt: number; log: string; execution: Execution } | { busy: RunMarker }> {
|
|
103
100
|
const startedAt = Date.now()
|
|
104
101
|
const id = newRunId(startedAt)
|
|
105
102
|
const log = repo.store.logPath(id)
|
|
@@ -113,29 +110,6 @@ export async function runClaimed(
|
|
|
113
110
|
}
|
|
114
111
|
}
|
|
115
112
|
|
|
116
|
-
/**
|
|
117
|
-
* 借用这个工作区(只占这个工作区,别的工作区不管):要复制或接着用工作区的时候用,比如建一次性副本。
|
|
118
|
-
* 借用期间别的 testpace 命令不跑,免得跑到一半的状态(锁文件、临时文件)被带进副本。
|
|
119
|
-
* 查有没有在跑的和占上是同一步(同 runClaimed 的登记),问完到用完之间不会有新起的插进来。
|
|
120
|
-
* 登记的是借用的那个进程(pid):它被杀了,占用跟着作废,不会把工作区永远锁住。
|
|
121
|
-
* 在跑的正是调用它的这一轮(环境变量 RUN_ENV 里的运行 id 和登记的一样)时不另占、没有 id:只有整组里测试之前的段拿得到它,
|
|
122
|
-
* 那时还没有测试在跑,工作区已经是这一轮的。已经有在跑的、被借用着的,返回它。
|
|
123
|
-
*/
|
|
124
|
-
export function borrow(repo: Repo, pid: number, by: string): { id?: string } | { busy: RunningMarker } {
|
|
125
|
-
const current = repo.store.running().find(marker => marker.worktree === repo.root)
|
|
126
|
-
if (current && current.id === process.env[RUN_ENV]) return {}
|
|
127
|
-
const startedAt = Date.now()
|
|
128
|
-
const id = newRunId(startedAt)
|
|
129
|
-
const busy = repo.store.claim({ id, kind: 'hold', by, pid, worktree: repo.root, startedAt })
|
|
130
|
-
return busy ? { busy } : { id }
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/** 放开 borrow 占的工作区。只放借用的登记:跑着的命令自己结束时放开。已经放开、借用的进程已经不在的,什么也不做。 */
|
|
134
|
-
export function giveBack(repo: Repo, id: string): void {
|
|
135
|
-
const current = repo.store.running().find(marker => marker.worktree === repo.root)
|
|
136
|
-
if (current && isHold(current) && current.id === id) repo.store.release(repo.root, id)
|
|
137
|
-
}
|
|
138
|
-
|
|
139
113
|
/** 命令为什么算失败:退出码、信号,或没能启动。 */
|
|
140
114
|
export function failureCause(execution: Execution): string {
|
|
141
115
|
if (execution.exitCode !== null) return `退出码 ${execution.exitCode}`
|
package/src/base/sessions.ts
CHANGED
|
@@ -9,8 +9,12 @@ import { SESSION_KEEP_MS, writeWhole } from './store.ts'
|
|
|
9
9
|
interface SessionRepos {
|
|
10
10
|
updatedAt: number
|
|
11
11
|
repos: string[]
|
|
12
|
+
/** 会话所在的目录:第一次见到这个会话时 hook 给的目录。 */
|
|
13
|
+
home?: string
|
|
12
14
|
}
|
|
13
15
|
|
|
16
|
+
const DAY_MS = 24 * 60 * 60 * 1000
|
|
17
|
+
|
|
14
18
|
function sessionsDir(): string | undefined {
|
|
15
19
|
const data = process.env.CLAUDE_PLUGIN_DATA || process.env.PLUGIN_DATA
|
|
16
20
|
return data ? join(data, 'sessions') : undefined
|
|
@@ -35,21 +39,49 @@ export function sessionRepos(id: string): string[] {
|
|
|
35
39
|
return read(fileOf(dir, id))?.repos ?? []
|
|
36
40
|
}
|
|
37
41
|
|
|
38
|
-
/**
|
|
39
|
-
|
|
42
|
+
/** 清掉过期的会话。 */
|
|
43
|
+
function prune(dir: string, now: number): void {
|
|
44
|
+
for (const name of readdirSync(dir).filter(name => name.endsWith('.json'))) {
|
|
45
|
+
const file = join(dir, name)
|
|
46
|
+
const state = read(file)
|
|
47
|
+
if (!state || now - state.updatedAt > SESSION_KEEP_MS) rmSync(file, { force: true })
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 改这个会话的记录:change 拿到现在记着的(没有时是空的),返回要记的;返回 undefined 不用改。
|
|
53
|
+
* 第一次记这个会话时顺手清掉过期的会话。
|
|
54
|
+
*/
|
|
55
|
+
function update(id: string, now: number, change: (known: SessionRepos | undefined) => Omit<SessionRepos, 'updatedAt'> | undefined): void {
|
|
40
56
|
const dir = sessionsDir()
|
|
41
|
-
if (!dir
|
|
57
|
+
if (!dir) return
|
|
42
58
|
const path = fileOf(dir, id)
|
|
43
59
|
const known = existsSync(path) ? read(path) : undefined
|
|
44
|
-
|
|
60
|
+
const next = change(known)
|
|
61
|
+
if (!next) return
|
|
45
62
|
mkdirSync(dir, { recursive: true })
|
|
46
|
-
if (!known)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
63
|
+
if (!known) prune(dir, now)
|
|
64
|
+
writeWhole(path, JSON.stringify({ ...next, updatedAt: now } satisfies SessionRepos))
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** 记下这个会话碰到的仓库。 */
|
|
68
|
+
export function noteSessionRepos(id: string, roots: string[], now: number): void {
|
|
69
|
+
if (roots.length === 0) return
|
|
70
|
+
update(id, now, known => (known && roots.every(root => known.repos.includes(root)) ? undefined : { ...known, repos: [...new Set([...(known?.repos ?? []), ...roots])] }))
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 会话所在的目录:记下第一次见到这个会话时的目录,以后都按它认,不跟着 hook 给的目录变。
|
|
75
|
+
* Claude Code 主会话里 cd 会留到下一条命令,之后 hook 给的就是 cd 进去的目录:按它认,只进去看过的别人的工作区会被当成会话干活的地方。
|
|
76
|
+
* 隔一天刷新一次记录的时间:会话还在用,不能当过期清掉、再按那时 cd 进去的目录重记。
|
|
77
|
+
* 没有插件数据目录(不在 hook 里)时记不下,用这次给的目录。
|
|
78
|
+
*/
|
|
79
|
+
export function sessionHome(id: string, cwd: string, now: number): string {
|
|
80
|
+
let home = cwd
|
|
81
|
+
update(id, now, known => {
|
|
82
|
+
home = known?.home ?? cwd
|
|
83
|
+
if (known?.home && now - known.updatedAt < DAY_MS) return undefined
|
|
84
|
+
return { repos: known?.repos ?? [], home }
|
|
85
|
+
})
|
|
86
|
+
return home
|
|
55
87
|
}
|
package/src/base/shell.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// 大致读懂 agent 要跑的 Bash 命令:拆成一条条命令,跟着 cd 算出每条在哪个目录跑。
|
|
2
|
-
//
|
|
3
|
-
//
|
|
2
|
+
// 用于提示(节奏说明、直接跑整组命令时的提醒、前台跑完整组算看过结果)和停止门认会话动没动手(hook.ts),不用来拦命令:
|
|
3
|
+
// 认错了最多是停止门多问或少问一次。认得出:引号、转义、&& || ; | & 换行、cd、环境变量前缀、sh -c、往文件里写的重定向。
|
|
4
4
|
|
|
5
5
|
import { homedir } from 'node:os'
|
|
6
6
|
import { basename, resolve } from 'node:path'
|
|
@@ -8,12 +8,14 @@ import { basename, resolve } from 'node:path'
|
|
|
8
8
|
export interface Invocation {
|
|
9
9
|
cwd: string
|
|
10
10
|
argv: string[]
|
|
11
|
+
/** 输出重定向到了文件(> file、>> file、&> file;/dev/null 和 2>&1 这类不算)。 */
|
|
12
|
+
writes: boolean
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
const OPERATORS = ['&&', '||', ';;', ';', '|&', '|', '&', '\n', '(', ')']
|
|
14
16
|
|
|
15
17
|
/** 重定向:`>`、`2>&1`、`&>file`、`<<EOF` 这类。不带目标时目标是下一个词。 */
|
|
16
|
-
const REDIRECT = /^(?:\d+|&)?(
|
|
18
|
+
const REDIRECT = /^(?:\d+|&)?(>>|>&|>\||>|<<<|<<-?|<&|<>|<)(.*)$/s
|
|
17
19
|
const HEREDOC = /^\d*<<(?!<)(-?)(.*)$/s
|
|
18
20
|
|
|
19
21
|
/**
|
|
@@ -105,15 +107,20 @@ export function tokenize(command: string): string[] {
|
|
|
105
107
|
return tokens
|
|
106
108
|
}
|
|
107
109
|
|
|
108
|
-
/**
|
|
109
|
-
function withoutRedirects(argv: string[]): string[] {
|
|
110
|
+
/** 去掉重定向和它的目标;有没有往文件里写。 */
|
|
111
|
+
function withoutRedirects(argv: string[]): { argv: string[]; writes: boolean } {
|
|
110
112
|
const out: string[] = []
|
|
113
|
+
let writes = false
|
|
111
114
|
for (let i = 0; i < argv.length; i++) {
|
|
112
115
|
const redirect = REDIRECT.exec(argv[i]!)
|
|
113
|
-
if (!redirect)
|
|
114
|
-
|
|
116
|
+
if (!redirect) {
|
|
117
|
+
out.push(argv[i]!)
|
|
118
|
+
continue
|
|
119
|
+
}
|
|
120
|
+
const target = redirect[2] === '' ? argv[++i] : redirect[2]
|
|
121
|
+
if (redirect[1]!.includes('>') && !/^(?:\/dev\/null|&?\d+|-)$/.test(target ?? '')) writes = true
|
|
115
122
|
}
|
|
116
|
-
return out
|
|
123
|
+
return { argv: out, writes }
|
|
117
124
|
}
|
|
118
125
|
|
|
119
126
|
const WRAPPERS = new Set(['command', 'exec', 'nohup', 'time', 'builtin'])
|
|
@@ -128,7 +135,8 @@ export function invocations(command: string, cwd: string): Invocation[] {
|
|
|
128
135
|
let here = cwd
|
|
129
136
|
let segment: string[] = []
|
|
130
137
|
const flush = (): void => {
|
|
131
|
-
|
|
138
|
+
const redirected = withoutRedirects(segment)
|
|
139
|
+
let argv = redirected.argv
|
|
132
140
|
segment = []
|
|
133
141
|
// 跳过环境变量前缀和 env、command 这类包装
|
|
134
142
|
for (;;) {
|
|
@@ -154,7 +162,7 @@ export function invocations(command: string, cwd: string): Invocation[] {
|
|
|
154
162
|
return
|
|
155
163
|
}
|
|
156
164
|
}
|
|
157
|
-
result.push({ cwd: here, argv })
|
|
165
|
+
result.push({ cwd: here, argv, writes: redirected.writes })
|
|
158
166
|
}
|
|
159
167
|
for (const token of tokenize(command)) {
|
|
160
168
|
if (OPERATORS.includes(token)) flush()
|
package/src/base/stop.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// 停止门:agent 要结束这一轮时,这个会话起的整组还在跑、或跑完还没看结果,就拦一次。
|
|
2
|
-
// 各模块在这个会话里还没处理完的事(module.ts 的 unfinished
|
|
3
|
-
//
|
|
2
|
+
// 各模块在这个会话里还没处理完的事(module.ts 的 unfinished,比如改了代码还没跑过 testpace focused、提交了却还有没合进默认分支的提交、
|
|
3
|
+
// 还没有 modwall check 的通过记录),每件也拦一次,要紧的同时直接给用户看一行;
|
|
4
|
+
// 只问会话干活的工作区(所在目录的、用改文件的工具改过的),只在命令里 cd 进去看过的别人的工作区不问;
|
|
5
|
+
// 会话在那里没动过手的不问,拦过一项之后没再动手的同一项不再拦(SessionState.acted);放到后台的 agent 还在干活时不问。
|
|
4
6
|
// 每次整组只拦一次(还在跑时一次、跑完没看结果时一次),拦过的记在会话状态里,不靠 agent 给的 stop_hook_active:
|
|
5
7
|
// 有的 agent 不给或总是 false,靠它会反复拦。
|
|
6
8
|
// 谁起的整组看记录里的会话号(testpace full 从命令环境里 agent 的会话号记下,见 agent.ts);
|
|
@@ -20,6 +22,8 @@ export interface StopInput {
|
|
|
20
22
|
cwd: string
|
|
21
23
|
/** 仓库不是会话所在目录的(会话从仓库外开始),话里写上是哪个仓库。 */
|
|
22
24
|
named?: boolean
|
|
25
|
+
/** 会话放到后台的 agent 还在干活。 */
|
|
26
|
+
busy?: boolean
|
|
23
27
|
now: number
|
|
24
28
|
}
|
|
25
29
|
|
|
@@ -59,13 +63,21 @@ export function stopCheck(input: StopInput): StopResult {
|
|
|
59
63
|
|
|
60
64
|
// 各模块在这个会话里还没处理完的事(比如改了代码还没有 modwall check 的通过记录):每件拦一次,免得一句带过。
|
|
61
65
|
// 只问这个会话干活的工作区(会话所在目录的、用改文件的工具改过的,见 SessionState.worked):只 cd 进去看过的,那里后来的改动是别的会话的
|
|
62
|
-
|
|
66
|
+
// 放到后台的 agent 还在干活时不问:内容还会变,每轮结束都拦一次只会空跑;它们干完会叫醒会话,那时再问
|
|
67
|
+
const works = input.busy !== true && (input.named !== true || session.worked?.includes(repo.root) === true)
|
|
68
|
+
// 起点只说"这之后变了",不说是谁变的:同一个工作区里别的会话、用户自己改的也算进去。会话在这里没动过手,变化就不是它的;
|
|
69
|
+
// 拦过一项、之后没再动手(只跑了检查),后来的变化也不是它的,同一项不再拦
|
|
70
|
+
const acts = session.acted?.[repo.root] ?? 0
|
|
71
|
+
const blockedActs = { ...session.blockedActs }
|
|
72
|
+
const item = (key: string): string => `${repo.root}\0${key.split(':').slice(0, 2).join(':')}`
|
|
73
|
+
const seen = (key: string): boolean => acts === 0 || blocked.includes(key) || blockedActs[item(key)] === acts
|
|
63
74
|
const moduleProblems: string[] = []
|
|
75
|
+
const moduleNotices: string[] = []
|
|
64
76
|
for (const module of works ? modules() : []) {
|
|
65
77
|
if (result.block) break
|
|
66
78
|
let left: ReturnType<NonNullable<typeof module.unfinished>>
|
|
67
79
|
try {
|
|
68
|
-
left = module.unfinished?.(repo, input.sessionId,
|
|
80
|
+
left = module.unfinished?.(repo, input.sessionId, seen, input.named === true)
|
|
69
81
|
} catch (error) {
|
|
70
82
|
// 一个模块出错不挡别的检查,但要让人看得到
|
|
71
83
|
moduleProblems.push(`testpace:停止门里"${module.name}"这一项检查出错,这次没查它(${(error as Error).message.split('\n')[0]})。`)
|
|
@@ -73,12 +85,14 @@ export function stopCheck(input: StopInput): StopResult {
|
|
|
73
85
|
}
|
|
74
86
|
if (!left) continue
|
|
75
87
|
blocked.push(...left.keys)
|
|
88
|
+
for (const key of left.keys) blockedActs[item(key)] = acts
|
|
76
89
|
result.block = left.text
|
|
90
|
+
if (left.notice) moduleNotices.push(left.notice)
|
|
77
91
|
}
|
|
78
92
|
|
|
79
93
|
// 没经过合并门的落地:默认分支在这个会话里有了新提交,却没有整组通过记录
|
|
80
94
|
const warned = [...session.warned]
|
|
81
|
-
const warns: string[] = [...moduleProblems]
|
|
95
|
+
const warns: string[] = [...moduleNotices, ...moduleProblems]
|
|
82
96
|
for (const [ref, commit] of Object.entries(defaultTips(repo))) {
|
|
83
97
|
if (commit === session.tipsAtStart[ref] || warned.includes(commit)) continue
|
|
84
98
|
const tip = refTip(repo.root, ref)
|
|
@@ -95,6 +109,6 @@ export function stopCheck(input: StopInput): StopResult {
|
|
|
95
109
|
warns.push(`testpace:${input.named ? `${repo.root} 的 ` : ''}${name} 的最新提交 ${short(commit)} 没有整组通过记录(${how})。`)
|
|
96
110
|
}
|
|
97
111
|
if (warns.length > 0) result.warn = warns.join('\n')
|
|
98
|
-
if (warns.length > 0 || result.block) repo.store.saveSession(input.sessionId, { ...session, warned, blocked })
|
|
112
|
+
if (warns.length > 0 || result.block) repo.store.saveSession(input.sessionId, { ...session, warned, blocked, blockedActs })
|
|
99
113
|
return result
|
|
100
114
|
}
|
package/src/base/store.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// 结果记录:放在仓库共用的 .git/testpace/ 下,不进版本库,也不影响工作区内容哈希。
|
|
2
2
|
// runs.jsonl 每次运行一行,只追加
|
|
3
|
-
// running/
|
|
3
|
+
// running/ 每个工作区正在跑的命令一份,结束时删掉;等着用整组结果的会话另记一份
|
|
4
4
|
// logs/ 每次运行的完整输出
|
|
5
5
|
// flaky/ 时好时坏的测试的名单,一个测试一份(所有工作区共用)
|
|
6
6
|
// rounds/ 每个工作区里各测试连着几轮没过
|
|
@@ -53,7 +53,7 @@ export interface RunStep {
|
|
|
53
53
|
/** testpace 跑项目命令时占着工作区的登记。 */
|
|
54
54
|
export interface RunMarker {
|
|
55
55
|
id: string
|
|
56
|
-
/** 跑的什么:整组是 full
|
|
56
|
+
/** 跑的什么:整组是 full,别的由模块定。 */
|
|
57
57
|
kind: string
|
|
58
58
|
/** testpace 进程。 */
|
|
59
59
|
pid: number
|
|
@@ -67,25 +67,6 @@ export interface RunMarker {
|
|
|
67
67
|
log: string
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
/** 别的工具借用工作区时的登记(testpace hold),比如 testcraft 建副本:占着时不跑测试。 */
|
|
71
|
-
export interface HoldMarker {
|
|
72
|
-
id: string
|
|
73
|
-
kind: 'hold'
|
|
74
|
-
/** 谁、为什么占着,比如"testcraft 建副本"。 */
|
|
75
|
-
by: string
|
|
76
|
-
/** 借用工作区的那个进程:它不在了,占用就作废。 */
|
|
77
|
-
pid: number
|
|
78
|
-
worktree: string
|
|
79
|
-
startedAt: number
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export type RunningMarker = RunMarker | HoldMarker
|
|
83
|
-
|
|
84
|
-
/** 这份登记是借用工作区的(testpace hold),不是在跑命令。 */
|
|
85
|
-
export function isHold(marker: RunningMarker): marker is HoldMarker {
|
|
86
|
-
return marker.kind === 'hold'
|
|
87
|
-
}
|
|
88
|
-
|
|
89
70
|
export interface SessionState {
|
|
90
71
|
startedAt: number
|
|
91
72
|
/** 会话开始时本地和远程默认分支(引用 → 提交):之后变了才检查落地的代码有没有整组通过记录。 */
|
|
@@ -101,6 +82,10 @@ export interface SessionState {
|
|
|
101
82
|
* 只在命令里 cd 进去看过的工作区不算,那里后来的改动是别的会话的。
|
|
102
83
|
*/
|
|
103
84
|
worked?: string[]
|
|
85
|
+
/** 这个会话在各工作区动过几次手:用改文件的工具改了那里的文件,或在那里跑了不只是 gatelight 检查的命令(hook.ts 的 noteActing)。 */
|
|
86
|
+
acted?: Record<string, number>
|
|
87
|
+
/** 停止门上次为各项拦下时(工作区 + 项,见 stop.ts)这个会话在那个工作区动过几次手:之后没再动手,同一项不再拦。 */
|
|
88
|
+
blockedActs?: Record<string, number>
|
|
104
89
|
/** 停止门拦过的:running:<运行 id>(还在跑时拦过)、unread:<运行 id>(跑完没看结果时拦过)、flaky:<testKey>(认出的时好时坏测试)。每种只拦一次。 */
|
|
105
90
|
blocked?: string[]
|
|
106
91
|
/** 执行命令之前只能拒绝、不能只加一句话的 agent(Antigravity):为了说这几段提示已经拦过一次命令,同样的不再拦(hook.ts)。 */
|
|
@@ -169,7 +154,7 @@ export class Store {
|
|
|
169
154
|
* 占住这个工作区来跑 marker 这次命令:原子地创建这个工作区唯一的一份登记。
|
|
170
155
|
* 已经有在跑的,返回它,不占;登记的进程都不在了的(被强杀、机器重启)清掉再占。
|
|
171
156
|
*/
|
|
172
|
-
claim(marker:
|
|
157
|
+
claim(marker: RunMarker): RunMarker | undefined {
|
|
173
158
|
mkdirSync(this.runningDir, { recursive: true })
|
|
174
159
|
const path = this.markerPath(marker.worktree)
|
|
175
160
|
// 先写好一份完整的,再用 link 原子地放到位:别人看到的登记总是完整的,不会把写了一半的当成坏了清掉
|
|
@@ -245,7 +230,7 @@ export class Store {
|
|
|
245
230
|
}
|
|
246
231
|
|
|
247
232
|
/** 正在等这次运行结果的会话。 */
|
|
248
|
-
waiting(marker:
|
|
233
|
+
waiting(marker: RunMarker): string[] {
|
|
249
234
|
const path = this.waitingPath(marker.worktree)
|
|
250
235
|
if (!existsSync(path)) return []
|
|
251
236
|
return readFileSync(path, 'utf8')
|
|
@@ -295,12 +280,12 @@ export class Store {
|
|
|
295
280
|
}
|
|
296
281
|
|
|
297
282
|
/** 各工作区正在跑的命令。进程都不在了的登记不算,留给下一次 claim 清掉。 */
|
|
298
|
-
running():
|
|
283
|
+
running(): RunMarker[] {
|
|
299
284
|
if (!existsSync(this.runningDir)) return []
|
|
300
285
|
return readdirSync(this.runningDir)
|
|
301
286
|
.filter(name => name.endsWith('.json'))
|
|
302
287
|
.map(name => readMarker(join(this.runningDir, name)))
|
|
303
|
-
.filter((marker): marker is
|
|
288
|
+
.filter((marker): marker is RunMarker => marker !== undefined && markerAlive(marker))
|
|
304
289
|
}
|
|
305
290
|
}
|
|
306
291
|
|
|
@@ -319,17 +304,17 @@ export function writeWhole(path: string, text: string): void {
|
|
|
319
304
|
renameSync(next, path)
|
|
320
305
|
}
|
|
321
306
|
|
|
322
|
-
function readMarker(path: string):
|
|
307
|
+
function readMarker(path: string): RunMarker | undefined {
|
|
323
308
|
try {
|
|
324
|
-
return JSON.parse(readFileSync(path, 'utf8')) as
|
|
309
|
+
return JSON.parse(readFileSync(path, 'utf8')) as RunMarker
|
|
325
310
|
} catch {
|
|
326
311
|
return undefined
|
|
327
312
|
}
|
|
328
313
|
}
|
|
329
314
|
|
|
330
|
-
/**
|
|
331
|
-
function markerAlive(marker:
|
|
332
|
-
return processAlive(marker.pid) || (
|
|
315
|
+
/** 登记的 testpace 进程或测试的进程组还有一个在。 */
|
|
316
|
+
function markerAlive(marker: RunMarker): boolean {
|
|
317
|
+
return processAlive(marker.pid) || (marker.group !== undefined && processAlive(-marker.group))
|
|
333
318
|
}
|
|
334
319
|
|
|
335
320
|
/** 进程(pid 为负时是进程组)还在。 */
|
package/src/cli.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// testpace 命令行入口:focused、files、full、status、
|
|
1
|
+
// testpace 命令行入口:focused、files、full、status、report、verify、install、run,以及 git 钩子调用的 gate。
|
|
2
2
|
// 这里只做装配和分发:底座的命令在 base/commands.ts、base/full.ts,"跑测试"的命令在 pace/commands.ts;
|
|
3
3
|
// status 把底座和各模块的情况合在一起说,也放在这里。这个文件的路径不能变:bin/testpace 和固定入口都按它找。
|
|
4
4
|
|
|
5
5
|
import './modules.ts'
|
|
6
6
|
import { AGENT, runCommandLine } from './base/commandline.ts'
|
|
7
|
-
import { context, gate,
|
|
7
|
+
import { context, gate, install } from './base/commands.ts'
|
|
8
8
|
import { CONTRACT_FILE, joined } from './base/contract.ts'
|
|
9
9
|
import { ENTRY_COMMANDS, type EntryState, entryDir, entryState } from './base/entry.ts'
|
|
10
10
|
import { EXIT } from './base/exit.ts'
|
|
@@ -12,8 +12,7 @@ import { duration, short, when } from './base/format.ts'
|
|
|
12
12
|
import { full } from './base/full.ts'
|
|
13
13
|
import { danglingNote, gateProblem } from './base/gate.ts'
|
|
14
14
|
import { workTreeId } from './base/git.ts'
|
|
15
|
-
import { coverageOf, defaultTips, describeCoverage,
|
|
16
|
-
import { isHold } from './base/store.ts'
|
|
15
|
+
import { coverageOf, defaultTips, describeCoverage, started } from './base/repo.ts'
|
|
17
16
|
import { files, focused, report, run, verify } from './pace/commands.ts'
|
|
18
17
|
import { commandExists, COMMAND_KEYS, loadConfig } from './pace/config.ts'
|
|
19
18
|
import { LAYERMAP_HINT } from './pace/focused.ts'
|
|
@@ -32,10 +31,6 @@ const USAGE = `用法:
|
|
|
32
31
|
testpace full 跑整组:接入了的检查(modwall check、testcraft checklist、codekeep check)、full(测试以外的检查),再把 tests 规则找到的全部测试交给 files,
|
|
33
32
|
一段没过就停,按当前工作区完整内容记录结果。要跑几分钟,能放到后台的就放后台
|
|
34
33
|
testpace status 当前代码有没有整组通过记录、有没有正在跑的整组、最近一次结果、配置检查
|
|
35
|
-
testpace hold PID 说明 借用这个工作区(比如要复制一份工作区的工具):占着时别的 testpace 命令不跑,说明是谁占着。
|
|
36
|
-
PID 是借用的那个进程,它不在了占用就作废。占上时输出这次的 id,退出码 0;有在跑的、占着的,说明是谁,退出码 3。
|
|
37
|
-
整组里要建副本的检查带着这一轮的 TESTPACE_RUN,工作区已经是这一轮的,不另占、什么也不输出,退出码 0
|
|
38
|
-
testpace release ID 放开 hold 占的工作区
|
|
39
34
|
testpace report [--days N] 计时诊断,默认最近 28 天
|
|
40
35
|
testpace verify [测试文件...] 核对接入守不守约定:三条命令找得到、合并门在把关、files 对不存在的文件报失败、认 文件:行号;每种测试各给一个文件
|
|
41
36
|
testpace install 这台机器配一次:在全局 git 配置里配上合并门(agent 移动默认分支时,要求落地的代码有整组通过记录),
|
|
@@ -59,10 +54,6 @@ function status(): number {
|
|
|
59
54
|
lines.push(`当前代码(${short(tree)}):${describeCoverage(coverageOf(ctx, config.ignore, tree, runs))}`)
|
|
60
55
|
|
|
61
56
|
for (const marker of ctx.store.running().filter(m => m.worktree === ctx.root)) {
|
|
62
|
-
if (isHold(marker)) {
|
|
63
|
-
lines.push(`${runningText(marker)},已 ${duration(Date.now() - marker.startedAt)}`)
|
|
64
|
-
continue
|
|
65
|
-
}
|
|
66
57
|
const changed = marker.tree === tree ? '开始后代码没改过' : '开始后代码改过,跑完的结果不算当前代码的记录'
|
|
67
58
|
lines.push(`正在跑:${marker.kind},${started(marker)}(已 ${duration(Date.now() - marker.startedAt)}),${changed}`)
|
|
68
59
|
}
|
|
@@ -150,10 +141,6 @@ async function dispatch([command, ...rest]: string[]): Promise<number> {
|
|
|
150
141
|
return runFull()
|
|
151
142
|
case 'status':
|
|
152
143
|
return status()
|
|
153
|
-
case 'hold':
|
|
154
|
-
return hold(rest, USAGE)
|
|
155
|
-
case 'release':
|
|
156
|
-
return release(rest, USAGE)
|
|
157
144
|
case 'report':
|
|
158
145
|
return report(rest)
|
|
159
146
|
case 'verify':
|