refactor: simplify pass (trekexecute)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-10-28 16:34:32 +01:00
commit c75ae2d3f5
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
4 changed files with 39 additions and 33 deletions

View file

@ -330,7 +330,9 @@ function atomicWriteText(repo, rel, text) {
* 1 = not ignored; a spawn error or any exit other than 0, 1 or 128 is a
* failed check. Exit 128 means "not a git repository" only some of the time:
* inside a repository it also comes from a path beyond a symbolic link, a
* broken `.git/HEAD` or a `GIT_DIR` that does not exist (CKI). So on 128 a
* broken `.git/HEAD` or a `GIT_DIR` that does not exist (CKI), and the probe's
* own `git rev-parse --git-dir` exits 128 too on dubious ownership, a bad
* `.git/config` or a garbage `.git/HEAD`. So on 128 a
* probe decides (see notARepoReason), and only a directory that is truly no
* repository gives `no-git-repo`; everything else, including a probe that
* throws, is `failed`. No branch reads git's message text, so the answer does
@ -360,9 +362,8 @@ function lessonsIgnored(repo, rel) {
/**
* After a check-ignore exit 128: null when `repo` is no git repository, else
* the reason it may be one. `git rev-parse --git-dir` exit 0 proves a
* repository; its exit 128 alone proves nothing (dubious ownership, a bad
* `.git/config` and a garbage `.git/HEAD` all exit 128 there), so then the
* answer is null only when GIT_DIR is unset and no `.git` entry (file or
* repository; its exit 128 alone proves nothing (see lessonsIgnored), so then
* the answer is null only when GIT_DIR is unset and no `.git` entry (file or
* directory) is found by gitEntryDir. A spawn error or any other exit is a
* reason too. May throw (realpath of a vanished repo); the caller reads that
* as a failed check.
@ -417,10 +418,10 @@ export function withPointer(claudeText) {
* The result's `pointer` (when written): 'written' | 'present' | 'no-claude-md' |
* 'symlink-skipped' (CLAUDE.md is a symlink, DJ4) | 'ignored-skipped' (git
* ignores the lessons file, PTR) | 'check-failed' (git check-ignore did not
* answer, or answered exit 128 for a directory that may be a repository: a
* path beyond a symbolic link, a broken repository, GIT_DIR set, or a `.git`
* entry found; `pointer_note` says how, and always names check-ignore). Only
* a directory that is truly no repository gets the pointer without the check.
* answer, or answered exit 128 for a directory that may be a repository, see
* lessonsIgnored; `pointer_note` says how, and always names check-ignore).
* Only a directory that is truly no repository gets the pointer without the
* check.
* Nothing is written through a symlinked
* lessons file or a lessons directory outside the repo (R3): written false.
* @returns {{ written: boolean, reason: string, path?: string, pointer?: string, pointer_note?: string }}