mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-19 20:49:33 +01:00
chore: replace the em-dashes this release added with plain punctuation
The merged PRs (mostly #714's git fetch) added about 120 em-dashes in comments, docs, test names and three settings strings. Each one is now a comma, colon, semicolon or parentheses. The English settings strings in index.html and their i18n.js keys change together, and the zh-CN value for the fetch interval uses full-width parentheses instead of a double dash. The one left is the regex in constants.js that matches a dash typed as a word, which is behaviour, not punctuation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
de1aab9b86
commit
c04fa97f78
28 files changed
+91
-91
No files matched your search
+1
-1
@@ -594,7 +594,7 @@ export async function isHomeDirectory(directory: string): Promise<boolean> {
|
||||
return a === b;
|
||||
}
|
||||
|
||||
/** `agent spawn` — start in a project directory or named case, preserving lineage and mode readiness. */
|
||||
/** `agent spawn`: start in a project directory or named case, preserving lineage and mode readiness. */
|
||||
export async function agentSpawn(deps: AgentDeps, options: SpawnOptions): Promise<number> {
|
||||
const cli = getCli(options.mode);
|
||||
if (!cli) return fail(deps, `Unknown mode: ${options.mode}`, EXIT.refused);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
* stop at the first frame end, and the supported range still includes those
|
||||
* versions: measured on a real 56-line transcript, Node returned 158 bytes /
|
||||
* 1 line where the CLI returned 43,747 bytes / 56 lines. That is a silent
|
||||
* truncation to the session header — every call would have reported "no answer
|
||||
* truncation to the session header: every call would have reported "no answer
|
||||
* yet" forever. `decodeZstdFrames()` below walks the frame headers itself and
|
||||
* decompresses each frame, and `test/deepseek-transcript.test.ts` pins it
|
||||
* against multi-frame fixtures.
|
||||
|
||||
+10
-10
@@ -3,8 +3,8 @@
|
||||
* (`src/git-fetch-scheduler.ts`, wired in `src/web/server.ts`).
|
||||
*
|
||||
* The fetch module (src/git-fetch.ts) is the only git command the Git panel runs that writes, and on a timer
|
||||
* it is the only one that can run without being asked — cloning and worktree management write too, but those
|
||||
* happen when the user asks for them. Which is why the whole feature is off until the user turns it on, in
|
||||
* it is the only one that can run without being asked (cloning and worktree management write too, but those
|
||||
* happen when the user asks for them). Which is why the whole feature is off until the user turns it on, in
|
||||
* Settings → Bottom bar, per session in Session Options → Git.
|
||||
*
|
||||
* The scheduler holds no timers of its own. The server ticks it (`GIT_FETCH_TICK_INTERVAL_MS`) and every
|
||||
@@ -15,7 +15,7 @@
|
||||
* Rules the code keeps and the tests pin:
|
||||
* - Nothing runs when nothing is on: no repository set is read and nothing is spawned, so a quiet
|
||||
* install costs one settings read per tick. A session that turned itself on still runs even while the
|
||||
* app-wide switch is off — that is what a per-session switch has to mean.
|
||||
* app-wide switch is off: that is what a per-session switch has to mean.
|
||||
* - Remote and Docker sessions are never fetched, exactly as the Git panel excludes them, and the Docker
|
||||
* workspace roots are checked again every tick, so a session whose case became a Docker case stops
|
||||
* fetching at the next tick. A Docker case list that cannot be read fails CLOSED: the tick fetches
|
||||
@@ -24,7 +24,7 @@
|
||||
* until a read succeeds again.
|
||||
* - A folder is fetched by at most one run at a time, and the run belongs to the FOLDER, not to one
|
||||
* session: two sessions open on the same folder are the same clone, so they share one run and both get
|
||||
* its result. State is keyed by `resolve(workingDir)` — deliberately not `realpath`, because `realpath`
|
||||
* its result. State is keyed by `resolve(workingDir)`, deliberately not `realpath`, because `realpath`
|
||||
* is itself one of the unbounded fs calls rule #516 bounds; the bounded probe below is the fs read.
|
||||
* Every session open on a folder is remembered, so closing the one holding the override does not stop
|
||||
* the folder's fetching while another session is still on it. A folder is due when ANY session open on it
|
||||
@@ -101,7 +101,7 @@ export interface GitFetchPorts {
|
||||
dockerWorkspaces(): Promise<string[]>;
|
||||
/**
|
||||
* Bounded probe (rule #516), default options: a bulk scan keeps the stall cap, so this must not be called
|
||||
* with `pastCap`. Anything that is not `directory` — including `unknown`, which is never `absent` — is
|
||||
* with `pastCap`. Anything that is not `directory` (including `unknown`, which is never `absent`) is
|
||||
* skipped, not fetched.
|
||||
*/
|
||||
probePath(path: string): Promise<PathProbeKind>;
|
||||
@@ -170,7 +170,7 @@ export class GitFetchScheduler {
|
||||
}
|
||||
this.settingsUnreadable = false;
|
||||
|
||||
// Pass 1 — who is on what, before anything is decided. Every session open on a folder is recorded here,
|
||||
// Pass 1: who is on what, before anything is decided. Every session open on a folder is recorded here,
|
||||
// not only the one that would get picked, so `remove()` can still see who is open on it when the session
|
||||
// holding the override is the one that closes.
|
||||
const groups = new Map<string, GroupMember[]>();
|
||||
@@ -187,10 +187,10 @@ export class GitFetchScheduler {
|
||||
else groups.set(folder, [member]);
|
||||
}
|
||||
|
||||
// Pass 2 — the folder's turn, decided from the whole group rather than from whichever session happened to
|
||||
// Pass 2: the folder's turn, decided from the whole group rather than from whichever session happened to
|
||||
// be read first. A folder is due when ANY session open on it is due: a session on a 30 s interval on a
|
||||
// folder a 3600 s session last fetched ten minutes ago has to be fetched now, because that same run
|
||||
// satisfies the long interval too. Deciding in one pass means the session read first owns the clock — a
|
||||
// satisfies the long interval too. Deciding in one pass means the session read first owns the clock: a
|
||||
// group ordered [short, long] and a group ordered [long, short] would have behaved differently, and the
|
||||
// run belongs to the folder, so no session in the group should.
|
||||
const due = new Map<string, GroupMember[]>();
|
||||
@@ -244,7 +244,7 @@ export class GitFetchScheduler {
|
||||
// run would let `FETCH_CONCURRENCY` folders × `MAX_REPOS_LIMIT` processes run at once.
|
||||
const fetches = createLimiter(FETCH_CONCURRENCY);
|
||||
// The folders get their OWN bound, because the same semaphore cannot serve both levels: a folder that
|
||||
// holds a slot and then waits for a slot for its own fetch is waiting on itself — once
|
||||
// holds a slot and then waits for a slot for its own fetch is waiting on itself: once
|
||||
// `FETCH_CONCURRENCY` folders fill the bound, the ones holding slots are exactly the ones that can
|
||||
// never get one back. Both bounds are `FETCH_CONCURRENCY`, so the tick still never runs more git
|
||||
// processes than the module's ceiling.
|
||||
@@ -280,7 +280,7 @@ export class GitFetchScheduler {
|
||||
|
||||
/**
|
||||
* A session that closed or was detached: its schedule goes with it, but the FOLDER's stays while another
|
||||
* session is still open on it — the run belongs to the clone, not to the session that asked for it.
|
||||
* session is still open on it: the run belongs to the clone, not to the session that asked for it.
|
||||
*/
|
||||
remove(id: string): void {
|
||||
const folder = this.folderOf.get(id);
|
||||
|
||||
+16
-16
@@ -22,7 +22,7 @@
|
||||
* - The repository set is `resolveWorkspaceRepos`, the single source the panel and the diff route
|
||||
* already use, so Fetch cannot reach a repository the panel would not show. The Docker rule is
|
||||
* checked before any git runs: a repository a container can write to is refused outright, because a
|
||||
* planted config would run on the host — and `git fetch` is exactly the command that can run a
|
||||
* planted config would run on the host, and `git fetch` is exactly the command that can run a
|
||||
* repository's own hooks (`reference-transaction`, and `pre-auto-gc` through the automatic maintenance
|
||||
* that follows a fetch) and its config commands such as `credential.helper`, which is why a timer only
|
||||
* runs it after the user opts in.
|
||||
@@ -30,7 +30,7 @@
|
||||
* instead of starting a second one, because two fetches in one clone collide on the ref lock.
|
||||
* - Bounded: the git timeout from Settings → Bottom bar per repository, `MAX_REPOS_LIMIT` repositories at
|
||||
* most, a hard wall-clock bound on each spawn, and `FETCH_CONCURRENCY` git processes at a time for the
|
||||
* whole run — one `Limiter`, shared by the scheduler's tick, not one bound per folder.
|
||||
* whole run: one `Limiter`, shared by the scheduler's tick, not one bound per folder.
|
||||
* - Non-interactive: `GIT_TERMINAL_PROMPT=0` and BatchMode ssh, so a private repository that needs a
|
||||
* login fails fast instead of hanging the request on an invisible username prompt. Codeman collects
|
||||
* no credentials; a repository the user's own git is already signed in to works because that is the
|
||||
@@ -38,11 +38,11 @@
|
||||
* a default, never an override: `fetchEnvFor` keeps whatever the repository's `core.sshCommand`, the
|
||||
* user's own `GIT_SSH_COMMAND` or a `GIT_SSH` already says, because on a machine with several ssh setups
|
||||
* that choice is usually the one that works. ⚠️ The default still leaves a record: `StrictHostKeyChecking=accept-new`
|
||||
* writes an unknown host key into `~/.ssh/known_hosts` without asking — BatchMode stops a prompt, not a
|
||||
* writes an unknown host key into `~/.ssh/known_hosts` without asking: BatchMode stops a prompt, not a
|
||||
* write.
|
||||
* - The timeout kills the PROCESS GROUP, not just the `git` parent. A fetch over http spawns
|
||||
* `git-remote-http` children, and `execFile`'s `timeout` signals the parent only, so the answer can go
|
||||
* out while a helper is still running — and on a timer that repeats every tick with nobody watching.
|
||||
* out while a helper is still running, and on a timer that repeats every tick with nobody watching.
|
||||
* `spawn` with `detached: true` puts the tree in its own group so the escalation (SIGTERM, then SIGKILL
|
||||
* `FETCH_KILL_ESCALATION_MS` later) reaches the children too, which is why the negative pid is used
|
||||
* rather than `child.kill()`. Same shape as `runGit` in git-clone.ts, without that module's slot queue:
|
||||
@@ -69,10 +69,10 @@ import {
|
||||
const execFileAsync = promisify(execFile);
|
||||
|
||||
/**
|
||||
* Git processes in flight at once, for one run — and for a whole scheduler tick, because the tick hands ONE
|
||||
* Git processes in flight at once, for one run, and for a whole scheduler tick, because the tick hands ONE
|
||||
* bound to every run (see `createLimiter`): each fetch is one git process, and a folder can hold up to
|
||||
* `MAX_REPOS_LIMIT`. The tick bounds its folders separately, because the same semaphore cannot serve both
|
||||
* levels — a folder holding a slot would then wait for a slot its own fetch needs.
|
||||
* levels: a folder holding a slot would then wait for a slot its own fetch needs.
|
||||
*/
|
||||
export const FETCH_CONCURRENCY = 4;
|
||||
/** A fetch on a busy remote can print a lot; a bound on what we will hold. */
|
||||
@@ -123,7 +123,7 @@ export function gitFetchSettingsFrom(settings: Record<string, unknown> | undefin
|
||||
|
||||
/**
|
||||
* The only git command this module runs. Kept as a function so a test can pin the verb: nothing here
|
||||
* commits, checks out, merges or prunes, and no operand is interpolated — the repository is the process
|
||||
* commits, checks out, merges or prunes, and no operand is interpolated: the repository is the process
|
||||
* `cwd` and the argv is fixed.
|
||||
*/
|
||||
export function buildFetchArgs(): string[] {
|
||||
@@ -135,8 +135,8 @@ export function buildFetchArgs(): string[] {
|
||||
* so pinning the verb here does not have to say anything about maintenance, and so both can be tested
|
||||
* without spawning.
|
||||
*
|
||||
* A repository with no remote is a fact, not a fault. Git's wordings for it differ by version — 2.47
|
||||
* exits quietly and this code is never reached, older git says "no default remote repository" — so the
|
||||
* A repository with no remote is a fact, not a fault. Git's wordings for it differ by version (2.47
|
||||
* exits quietly and this code is never reached, older git says "no default remote repository"), so the
|
||||
* branch is pinned on literal fixtures and the code the panel shows is the code this writes.
|
||||
*/
|
||||
export type FetchFailureCode = GitFailureCode | 'NO_REMOTE';
|
||||
@@ -151,7 +151,7 @@ export interface FetchFailure {
|
||||
|
||||
/**
|
||||
* A thrown git error as the panel should show it. `classifyGitFailure` (git-clone.ts) already knows the
|
||||
* network reasons — auth, an unreachable host, a missing git — so they are reused here; only its timeout
|
||||
* network reasons (auth, an unreachable host, a missing git), so they are reused here; only its timeout
|
||||
* wording is written for clones, so the fetch path replaces it with what the user can actually do.
|
||||
*/
|
||||
export function describeFetchFailure(err: unknown): FetchFailure {
|
||||
@@ -179,7 +179,7 @@ export function describeFetchFailure(err: unknown): FetchFailure {
|
||||
*
|
||||
* `gitNonInteractiveEnv` supplies the BatchMode default, and the default is only a default: git reads
|
||||
* `GIT_SSH_COMMAND` from the environment ahead of the repository's `core.sshCommand`, so setting it would
|
||||
* override a repository that already chose its own ssh — an alternative host, an identity file, a jump box —
|
||||
* override a repository that already chose its own ssh (an alternative host, an identity file, a jump box)
|
||||
* and break a setup that works today. The server's own `GIT_SSH` is the same kind of answer: git reads it
|
||||
* after both of those (`GIT_SSH_COMMAND`, then `core.sshCommand`, then `GIT_SSH`), so a written default would
|
||||
* hide it too. That is the only case where this module makes an ssh choice on the user's behalf, so it is the
|
||||
@@ -202,7 +202,7 @@ export function fetchEnvFor(base: NodeJS.ProcessEnv, repoSshCommand: string | nu
|
||||
* hook or filter runs on the way to it.
|
||||
*
|
||||
* The read happens inside the same slot and the same wall-clock bound as the fetch it serves, so it cannot
|
||||
* add a fifth git process or push a fetch past the user's timeout — it spends part of it.
|
||||
* add a fifth git process or push a fetch past the user's timeout: it spends part of it.
|
||||
*/
|
||||
export async function readRepoSshCommand(cwd: string, timeoutMs: number): Promise<string | null> {
|
||||
try {
|
||||
@@ -232,7 +232,7 @@ export async function readRepoSshCommand(cwd: string, timeoutMs: number): Promis
|
||||
*
|
||||
* The thrown error keeps the shape `describeFetchFailure` reads: `stderr` for the reason, `message` for a
|
||||
* spawn failure (`spawn git ENOENT` → GIT_MISSING), `killed` and `code` for the timeout. A non-zero exit
|
||||
* rejects the way `execFile` would — `code` is then the exit code — because resolving it would report a real
|
||||
* rejects the way `execFile` would (`code` is then the exit code), because resolving it would report a real
|
||||
* failure as a clean run with an empty reason.
|
||||
*
|
||||
* `timeoutMs` bounds the `core.sshCommand` read and the fetch TOGETHER: the spawn is armed with what the read
|
||||
@@ -320,7 +320,7 @@ export const runFetch: GitRunner = async (cwd, args, opts) => {
|
||||
if (settled) return;
|
||||
// execFile's contract, which `describeFetchFailure` depends on: a non-zero exit rejects, so a real
|
||||
// git failure keeps its reason in `stderr` instead of becoming a green row with an empty one. `null`
|
||||
// means a signal, reachable only when something outside this runner killed the group — our own timeout
|
||||
// means a signal, reachable only when something outside this runner killed the group: our own timeout
|
||||
// has already answered by then, and `settled` above is what keeps that answer the answer.
|
||||
if (code !== 0) return fail(undefined, code);
|
||||
settled = true;
|
||||
@@ -468,14 +468,14 @@ export async function fetchGitWorkspaceOverview(cwd: string, opts: GitFetchOptio
|
||||
* Runs already going, keyed by the resolved folder. A request for a folder another run is already working on
|
||||
* JOINS that run instead of starting a second `git fetch` in the same clone: two fetches there collide on
|
||||
* git's ref lock (`cannot lock ref 'refs/remotes/origin/main'`), which is what a click during a tick would
|
||||
* otherwise do. A joiner gets the run already going's answer, including its limits and its trigger — the point
|
||||
* otherwise do. A joiner gets the run already going's answer, including its limits and its trigger: the point
|
||||
* is not to fetch twice, not to fetch with the freshest options, and a click that fetched nothing cannot
|
||||
* report itself as the fetch.
|
||||
*
|
||||
* Keyed by `resolve`, not `realpath`, because `realpath` is itself one of the unbounded fs calls rule #516
|
||||
* bounds for user-chosen paths; the scheduler probes the folder bounded and calls this. Two paths that
|
||||
* resolve the same are the same folder here; a workspace reached through a symlink resolves to the link, so
|
||||
* a link and its target can be fetched by two runs — the accepted trade for keeping the probe bounded.
|
||||
* a link and its target can be fetched by two runs, the accepted trade for keeping the probe bounded.
|
||||
*/
|
||||
const lane = new Map<string, Promise<GitFetchRun>>();
|
||||
|
||||
|
||||
@@ -600,7 +600,7 @@ const discoveryCache = new Map<string, { at: number; value: { dirs: string[]; tr
|
||||
/**
|
||||
* A slot count fixed ONCE, so callers share it instead of each getting its own bound (see the fetch path):
|
||||
* the count lives in the closure, so `limit` is the ceiling for everything going through THIS limiter at
|
||||
* once, not for each call to it — which is what makes a scheduler tick's bound honest.
|
||||
* once, not for each call to it, which is what makes a scheduler tick's bound honest.
|
||||
* ⚠️ One limiter cannot bound two levels of the same work: a caller that holds a slot and then waits for
|
||||
* another slot for the work IT starts cannot get one, because the holders are exactly the ones waiting. The
|
||||
* outer level needs its own bound (`mapLimited`), which is why the tick shares one for fetches and keeps a
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
* repository, so the "behind" number reflects the last `git fetch`, which the panel footer says. Fetching
|
||||
* happens when the user clicks Fetch in that window's header (`POST /api/sessions/:id/git-fetch`,
|
||||
* src/git-fetch.ts), or on the interval when the session is on: this is the only git command the Git panel
|
||||
* runs that writes, and the only one Codeman runs on a timer — cloning and worktree management write too,
|
||||
* but only when the user asked for them at that moment. Remote (SSH)
|
||||
* runs that writes, and the only one Codeman runs on a timer (cloning and worktree management write too,
|
||||
* but only when the user asked for them at that moment). Remote (SSH)
|
||||
* and Docker sessions answer `unsupported`, show no indicator, and cannot be fetched.
|
||||
*
|
||||
* Everything that comes from git (file names, commit subjects, author names) is untrusted text: it is
|
||||
@@ -273,7 +273,7 @@ Object.assign(CodemanApp.prototype, {
|
||||
* Fetch, on this click only: one `git fetch --quiet` per repository the panel shows
|
||||
* (`POST /api/sessions/:id/git-fetch`). It is the only git command the Git panel runs that writes, and the
|
||||
* only one Codeman runs on a timer, and it updates remote-tracking refs only: nothing here commits or
|
||||
* touches the working tree, so an agent's own work is left alone — though a fetch does hold git's ref lock,
|
||||
* touches the working tree, so an agent's own work is left alone, though a fetch does hold git's ref lock,
|
||||
* so an agent's `git pull` in the same repository can hit the same `cannot lock ref` while it runs. One
|
||||
* click means one fetch per repository: the button is busy and a second click is ignored while it runs, and
|
||||
* a click that joins a fetch already running reports that run, not itself. The panel then re-reads, so the
|
||||
@@ -532,7 +532,7 @@ Object.assign(CodemanApp.prototype, {
|
||||
if (data.behind) {
|
||||
const behind = el('span', 'git-status-chip', `↓ ${data.behind} behind`);
|
||||
behind.title =
|
||||
'As of the last git fetch — click Fetch in this window, or turn on the fetch interval in Settings, to bring it current.';
|
||||
'As of the last git fetch. Click Fetch in this window, or turn on the fetch interval in Settings, to bring it current.';
|
||||
line.append(behind);
|
||||
}
|
||||
} else if (data.hasRemote) {
|
||||
|
||||
@@ -533,7 +533,7 @@
|
||||
// scope tag. The Session Options → Git strings are in that group's own block further down.
|
||||
'Bottom bar': '底部栏',
|
||||
'Git status': 'Git 状态',
|
||||
"Shows, at the right of the bottom bar, when the active session's repository (or each repository inside its folder, up to two levels down) has uncommitted files or commits that are not pushed. Click it for the list. Read-only apart from Fetch: Codeman never commits or changes the repository, and `git fetch` — the only git command the Git window runs that writes, and the only one Codeman runs on a timer (cloning and worktree management write too, but only when you asked for them at the moment you asked) — runs when you click Fetch in that window, or on the interval below if you turned it on. Not shown for Docker or remote sessions. Off by default.":
|
||||
"Shows, at the right of the bottom bar, when the active session's repository (or each repository inside its folder, up to two levels down) has uncommitted files or commits that are not pushed. Click it for the list. Read-only apart from Fetch: Codeman never commits or changes the repository, and `git fetch` runs only when you click Fetch in that window, or on the interval below if you turned it on. It is the only git command the Git window runs that writes, and the only one Codeman runs on a timer (cloning and worktree management write too, but only when you asked for them at the moment you asked). Not shown for Docker or remote sessions. Off by default.":
|
||||
'在底部栏右侧显示当前会话的仓库(或其文件夹内向下两层以内的每个仓库)是否有未提交的文件或未推送的提交。点击可查看列表。除拉取外只读:{name} 从不提交或更改仓库,而拉取是 Git 窗口运行的唯一会写入的 git 命令,也是 {name} 唯一会按间隔自行运行的命令(克隆和工作树管理也会写入,但只在您当时要求时才运行),它只在您点击该窗口中的拉取按钮时运行,或在您开启了下方的定时后按间隔运行。Docker 和远程会话不显示。默认关闭。',
|
||||
'Git status: group files by folder': 'Git 状态:按文件夹分组显示文件',
|
||||
'In the Git window, show changed files under their folders, collapsed until you click a folder. Off lists every file by its full path. On by default.':
|
||||
@@ -548,8 +548,8 @@
|
||||
'Runs `git fetch` for the repositories the Git window lists on a timer, so the "behind" number is current without a click. Off by default: this is the only git command the Git panel runs that writes, and the only one Codeman runs on a timer (cloning and worktree management write too, but only when you asked for them at the moment you asked), so nothing runs until you turn it on. A session can override both the switch and the interval in Session Options → Git.':
|
||||
'按间隔为 Git 窗口列出的仓库运行拉取,这样“落后”的数字无需点击就是最新的。默认关闭:这是 Git 窗口运行的唯一会写入的 git 命令,也是 {name} 唯一会按间隔自行运行的命令(克隆和工作树管理也会写入,但只在您当时要求时才运行),所以在您开启之前不会有任何运行。会话可以在“会话选项 → Git”中同时覆盖开关和间隔。',
|
||||
'Git fetch: how often': 'Git 定时拉取:多久一次',
|
||||
'Seconds between runs for a session that has no override of its own (30 to 3600, default 300). Only a session that is on — here, or in Session Options → Git — is fetched, and sessions sharing one folder are fetched by one run.':
|
||||
'没有自己覆盖设置的会话,两次运行之间的秒数(30 到 3600,默认 300)。只有已开启的会话——这里,或在“会话选项 → Git”——才会被拉取,共用一个文件夹的会话由一次运行拉取。',
|
||||
'Seconds between runs for a session that has no override of its own (30 to 3600, default 300). Only a session that is on (here, or in Session Options → Git) is fetched, and sessions sharing one folder are fetched by one run.':
|
||||
'没有自己覆盖设置的会话,两次运行之间的秒数(30 到 3600,默认 300)。只有已开启的会话(这里,或在“会话选项 → Git”)才会被拉取,共用一个文件夹的会话由一次运行拉取。',
|
||||
'Fetch git status': '拉取 Git 状态',
|
||||
'Refresh git status': '刷新 Git 状态',
|
||||
'Close git status': '关闭 Git 状态',
|
||||
@@ -860,7 +860,7 @@
|
||||
// by updateGitFetchStatus, and 'Git' stays a technical name.
|
||||
"Whether Codeman fetches this session's repositories on a timer.": '{name} 是否按间隔拉取此会话的仓库。',
|
||||
'Fetch on an interval': '按间隔拉取',
|
||||
"Fetching is the only git command the Git panel runs that writes, and the only one Codeman runs on a timer, so nothing runs until you turn it on — here, or in App Settings → Bottom bar. Cloning and worktree management write too, but only when you asked for them at the moment you asked. The panel's Fetch button is always just a click.":
|
||||
"Fetching is the only git command the Git panel runs that writes, and the only one Codeman runs on a timer, so nothing runs until you turn it on (here, or in App Settings → Bottom bar). Cloning and worktree management write too, but only when you asked for them at the moment you asked. The panel's Fetch button is always just a click.":
|
||||
'拉取是 Git 窗口运行的唯一会写入的 git 命令,也是 {name} 唯一会按间隔自行运行的命令,所以在您开启之前(这里,或“应用设置 → 底部栏”)不会有任何运行。克隆和工作树管理也会写入,但只在您当时要求时才运行。该窗口中的拉取按钮始终只是一次点击。',
|
||||
'Follow the app setting': '跟随应用设置',
|
||||
'Uses the app-wide switch and interval for this session. Switch it off to pick your own.':
|
||||
|
||||
@@ -1738,7 +1738,7 @@
|
||||
|
||||
<div class="set-group">
|
||||
<div class="set-group-head"><h4>Fetch on an interval</h4></div>
|
||||
<p class="set-group-hint">Fetching is the only git command the Git panel runs that writes, and the only one Codeman runs on a timer, so nothing runs until you turn it on — here, or in App Settings → Bottom bar. Cloning and worktree management write too, but only when you asked for them at the moment you asked. The panel's Fetch button is always just a click.</p>
|
||||
<p class="set-group-hint">Fetching is the only git command the Git panel runs that writes, and the only one Codeman runs on a timer, so nothing runs until you turn it on (here, or in App Settings → Bottom bar). Cloning and worktree management write too, but only when you asked for them at the moment you asked. The panel's Fetch button is always just a click.</p>
|
||||
<div class="set-group-body">
|
||||
<!-- Live from the session's own last run (session-ui.js: updateGitFetchStatus), which is the
|
||||
run its folder got: several sessions on one folder share one run and read the same row. -->
|
||||
@@ -2266,7 +2266,7 @@
|
||||
<div class="set-row" data-search="git status uncommitted unpushed commit push indicator bottom bar toolbar">
|
||||
<div class="set-row-text">
|
||||
<span class="set-row-label">Git status <span class="set-scope">device</span></span>
|
||||
<span class="set-row-desc">Shows, at the right of the bottom bar, when the active session's repository (or each repository inside its folder, up to two levels down) has uncommitted files or commits that are not pushed. Click it for the list. Read-only apart from Fetch: Codeman never commits or changes the repository, and `git fetch` — the only git command the Git window runs that writes, and the only one Codeman runs on a timer (cloning and worktree management write too, but only when you asked for them at the moment you asked) — runs when you click Fetch in that window, or on the interval below if you turned it on. Not shown for Docker or remote sessions. Off by default.</span>
|
||||
<span class="set-row-desc">Shows, at the right of the bottom bar, when the active session's repository (or each repository inside its folder, up to two levels down) has uncommitted files or commits that are not pushed. Click it for the list. Read-only apart from Fetch: Codeman never commits or changes the repository, and `git fetch` runs only when you click Fetch in that window, or on the interval below if you turned it on. It is the only git command the Git window runs that writes, and the only one Codeman runs on a timer (cloning and worktree management write too, but only when you asked for them at the moment you asked). Not shown for Docker or remote sessions. Off by default.</span>
|
||||
</div>
|
||||
<label class="switch switch-sm"><input type="checkbox" id="appSettingsShowGitStatus"><span class="slider"></span></label>
|
||||
</div>
|
||||
@@ -2301,7 +2301,7 @@
|
||||
<div class="set-row" data-search="git fetch how often seconds between runs interval case override session options">
|
||||
<div class="set-row-text">
|
||||
<span class="set-row-label">Git fetch: how often <span class="set-scope">synced</span></span>
|
||||
<span class="set-row-desc">Seconds between runs for a session that has no override of its own (30 to 3600, default 300). Only a session that is on — here, or in Session Options → Git — is fetched, and sessions sharing one folder are fetched by one run.</span>
|
||||
<span class="set-row-desc">Seconds between runs for a session that has no override of its own (30 to 3600, default 300). Only a session that is on (here, or in Session Options → Git) is fetched, and sessions sharing one folder are fetched by one run.</span>
|
||||
</div>
|
||||
<input type="number" id="appSettingsGitFetchIntervalSeconds" class="set-num" value="300" min="30" max="3600" step="1">
|
||||
</div>
|
||||
|
||||
@@ -3101,7 +3101,7 @@ Object.assign(CodemanApp.prototype, {
|
||||
statusEl.hidden = false;
|
||||
},
|
||||
|
||||
/** 'just now', '4m', '2h' — the short stamps the tab rows use, measured from a run's start. */
|
||||
/** 'just now', '4m', '2h': the short stamps the tab rows use, measured from a run's start. */
|
||||
_gitFetchAgo(ts) {
|
||||
const seconds = Math.max(0, Math.round((Date.now() - ts) / 1000));
|
||||
if (seconds < 60) return seconds < 10 ? 'just now' : `${seconds}s`;
|
||||
|
||||
@@ -606,7 +606,7 @@ Object.assign(CodemanApp.prototype, {
|
||||
document.getElementById('appSettingsGitStatusTimeout').value = settings.gitStatusTimeoutSeconds ?? defaults.gitStatusTimeoutSeconds ?? 30;
|
||||
// Git fetch on an interval: synced, default OFF, interval default 300 s (DEFAULT_GIT_FETCH_INTERVAL_SECONDS).
|
||||
// Synced means the SERVER decides whether to fetch, so these keys stay out of the per-device display list
|
||||
// below and are not stripped from a save — a stripped key would never reach the scheduler.
|
||||
// below and are not stripped from a save: a stripped key would never reach the scheduler.
|
||||
document.getElementById('appSettingsGitFetchEnabled').checked = settings.gitFetchEnabled === true;
|
||||
document.getElementById('appSettingsGitFetchIntervalSeconds').value = settings.gitFetchIntervalSeconds ?? 300;
|
||||
// Gesture control lives in the Input section (alongside Local Echo / CJK Input)
|
||||
|
||||
@@ -36,7 +36,7 @@ import type { EventPort, SessionPort } from '../ports/index.js';
|
||||
|
||||
/**
|
||||
* Host paths of every Docker case workspace: repositories at or inside these are never inspected.
|
||||
* Exported so the interval scheduler (src/git-fetch-scheduler.ts) uses the SAME list — the Docker rule has
|
||||
* Exported so the interval scheduler (src/git-fetch-scheduler.ts) uses the SAME list: the Docker rule has
|
||||
* to be one rule, checked by every path that could run git.
|
||||
*
|
||||
* REJECTS when `docker-cases.json` exists but cannot be read or parsed (its writer truncates and rewrites it
|
||||
@@ -142,11 +142,11 @@ export function registerGitStatusRoutes(
|
||||
// Fetch, and only because the user clicked Fetch in the panel (src/git-fetch.ts): one
|
||||
// `git fetch --quiet` per repository the panel would show, through the same resolver so the two cannot
|
||||
// disagree about which repositories belong to the workspace. This is the only git command the Git panel runs
|
||||
// that writes, and it writes remote-tracking refs only — nothing commits, checks out or merges. Cloning and
|
||||
// that writes, and it writes remote-tracking refs only: nothing commits, checks out or merges. Cloning and
|
||||
// worktree management write too, but those happen when the user asked for them; this route is the one that
|
||||
// can also run later, on a timer. It is not as harmless as a read though: a fetch holds git's ref lock, so
|
||||
// an agent's own `git pull` in the same clone can collide with it, which is why the run goes through
|
||||
// `fetchWorkspaceOnce` — a click while a tick is already fetching this folder joins that run instead of
|
||||
// `fetchWorkspaceOnce`: a click while a tick is already fetching this folder joins that run instead of
|
||||
// starting a second one. It can also run a
|
||||
// repository's own hooks (`reference-transaction`, `pre-auto-gc` through the maintenance git runs after a
|
||||
// fetch) and its config commands such as `credential.helper`, so the `FETCH_CONFIG_ARGS` overrides turn
|
||||
|
||||
@@ -3682,7 +3682,7 @@ export function registerSessionRoutes(
|
||||
// fetched when the first of them is due. `null` on either field clears this session's choice so the
|
||||
// app-wide setting applies again, and a field left out of the body leaves the other half as it was: the
|
||||
// Session Options rows save on their own. Refused for a remote or Docker session, exactly as the Git
|
||||
// panel excludes them — a container can write to the repository it mounts, so git there would run that
|
||||
// panel excludes them: a container can write to the repository it mounts, so git there would run that
|
||||
// repository's own configuration on the host.
|
||||
app.post('/api/sessions/:id/git-fetch-settings', async (req) => {
|
||||
const { id } = req.params as { id: string };
|
||||
|
||||
+2
-2
@@ -1491,8 +1491,8 @@ export const SettingsUpdateSchema = z
|
||||
/**
|
||||
* Git fetch on an interval (src/git-fetch-scheduler.ts): `git fetch` for the repositories the Git panel
|
||||
* lists, run on a timer instead of only on the panel's Fetch click. SYNCED, default OFF, because the
|
||||
* server is what runs it: `git fetch` is the only git command the Git panel runs that writes — cloning
|
||||
* and worktree management write too, but only when the user asked for them at the moment they asked — and
|
||||
* server is what runs it: `git fetch` is the only git command the Git panel runs that writes (cloning
|
||||
* and worktree management write too, but only when the user asked for them at the moment they asked), and
|
||||
* the only one that can run later by itself, on a timer, and the only one that can run a repository's own
|
||||
* hooks (`reference-transaction`, `pre-auto-gc` through the automatic maintenance a fetch triggers, config
|
||||
* commands such as `credential.helper`), so nothing runs on a timer until the user turns this on. Cap in seconds between runs (30 to 3600, default 300). A
|
||||
|
||||
+4
-4
@@ -399,8 +399,8 @@ export class WebServer extends EventEmitter {
|
||||
});
|
||||
// Git fetch on an interval (git-fetch-scheduler.ts): the due-tracking lives in the service; the server
|
||||
// lends it the facts a decision needs and stores what it reports on the session. A field initializer for
|
||||
// the same reason as the keep-warm one above, and the scheduler reads the app setting FRESH on every tick
|
||||
// — that is what makes a live toggle take effect on the next tick, and what makes turning it off actually
|
||||
// the same reason as the keep-warm one above, and the scheduler reads the app setting FRESH on every tick:
|
||||
// that is what makes a live toggle take effect on the next tick, and what makes turning it off actually
|
||||
// stop the fetching. Default OFF, so an install that never enabled it spawns nothing at all.
|
||||
private readonly gitFetchScheduler = new GitFetchScheduler({
|
||||
sessionIds: () => this.sessions.keys(),
|
||||
@@ -413,7 +413,7 @@ export class WebServer extends EventEmitter {
|
||||
// never be handed `pastCap`. A folder on a mount that stopped answering is skipped, not fetched.
|
||||
probePath: (path) => probePathKind(path),
|
||||
// Through the join, so the tick and the panel's Fetch button are the same run: a click on a folder the
|
||||
// tick is already fetching joins it rather than starting a second `git fetch` in the same clone — and the
|
||||
// tick is already fetching joins it rather than starting a second `git fetch` in the same clone, and the
|
||||
// run that gets published is the one that ran, with its own trigger.
|
||||
fetch: (cwd, opts, trigger) => fetchWorkspaceOnce(cwd, opts, trigger),
|
||||
publish: (id, status) => {
|
||||
@@ -1287,7 +1287,7 @@ export class WebServer extends EventEmitter {
|
||||
registerReadMyMindRoutes(this.app, ctx);
|
||||
registerGitStatusRoutes(this.app, ctx);
|
||||
// Git fetch on an interval: this is only the wake-up, the scheduler itself decides what is due. Off in
|
||||
// tests for the same reason as the polls below — a test drives `tick()` directly instead of waiting on
|
||||
// tests for the same reason as the polls below: a test drives `tick()` directly instead of waiting on
|
||||
// a timer the harness would have to keep alive. The setting is read FRESH inside `tick()`, so turning
|
||||
// it on takes effect on the next tick and turning it off actually stops the fetching.
|
||||
if (!this.testMode) {
|
||||
|
||||
Reference in new issue
Block a user