Repository navigation
feat: add CGW_LOG_DIR and accept autosquash subjects - #114
Merged
Merged
Conversation
CGW_LOG_DIR (env or .cgw.conf) moves the log folder out of the project, so a linked worktree no longer gets a logs/ folder of its own. Empty keeps logs/ in the project root. A relative path is taken from the project root; cgw_log_dir in _common.sh resolves it. cgw_validate_commit_message removes leading fixup!/squash!/amend! markers (also nested) before it checks the subject, so commit_enhanced.sh can make the fixup commits that rebase_safe.sh --autosquash folds. An invalid rest is still refused. hooks/pre-push refuses such a commit on a guarded branch (source, target, protected), as it did before for every branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of PR 114: with a shared CGW_LOG_DIR, two worktrees could write the same <script>_<timestamp>.log in the same second, so the file names get the PID added when the setting is used. A folder that cannot be made now falls back to logs/ with a [WARN] (mkdir was unchecked). A root (/, C:/) keeps its slash, and a leading ~/ is expanded to HOME, since .cgw.conf values are read literally. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CGW_LOG_DIR: a new setting (environment or.cgw.conf, registry row in_config.sh) for the folder the scripts write their logs to. It is created if missing. An absolute path is used as written; a relative path is taken from the project root. Empty (the default) keepslogs/in the project root, as before. A leading~/means$HOME, and a root folder (/,C:/) keeps its slash. With the setting, the log file names get the PID added (<script>_<timestamp>_<pid>.log), so two worktrees that share the folder never write the same file. A folder that cannot be made falls back tologs/with a[WARN]. The newcgw_log_dirin_common.shgives the folder toinit_logging.cgw_validate_commit_messagenow removes leadingfixup!,squash!andamend!markers (also nested) before it checks the subject.commit_enhanced.sh "fixup! feat: x"passes;fixup! wip: xandfixup! add xare still refused. The subject-length caps already measure the text after the first colon, so the markers do not count.undo_last.sh amend-messageandhooks/pre-pushuse the same check.hooks/pre-pushrefuses an autosquash commit pushed to a guarded branch (source, target or protected), with therebase_safe.sh --squash-last <N> --autosquash --non-interactiveremedy. On a feature branch it is pushed. Before this change the hook refused these commits on every branch, so the guarded branches keep their old protection.cgw.conf.example, thedocs/configuration.mdoptions table,skill/SKILL.md,skill/references/script-reference.md,error-recovery.md,wrapper-recipes.md,CONTEXT.md(commit-message format) and aCHANGELOG.md"Unreleased" entry.Why
A retro of a HyprZero session on 2026-12-02 found two frictions with the vendored
scripts/git/:logs/folder from the wrappers. Claude Code's auto mode refused to delete it until the user added a narrow allow rule. A linked worktree reads the main worktree's.cgw.conf, so one absoluteCGW_LOG_DIRthere keepslogs/out of every worktree, and nothing must be deleted.fixup!commits.commit_enhanced.shrefused them as non-conventional, so they were made with rawgit commit --fixupand then squashed withrebase_safe.sh --squash-last 4 --autosquash --non-interactive. Now the wrapper can make them.Test plan
tests/unit/common.bats): absolute and relativeCGW_LOG_DIR, the empty default, Windows drive paths, root folders and~/, the PID in the file names, the fallback when the folder cannot be made,.cgw.confand the environment winning over it; autosquash subjects accepted, nested, withCGW_EXTRA_PREFIXES; invalid rests and malformed markers refused;cgw_is_autosquash_subject; subject length without the markers.fixup!commit throughcommit_enhanced.sh, thenrebase_safe.sh --autosquashfolds it;fixup! wip: bis still refused;CGW_LOG_DIRin the main.cgw.confkeeps a linked worktree free oflogs/; without it the logs still go tologs/(commit_enhanced.bats). Pre-push: afixup!commit on a feature branch is pushed, an invalid one is refused, asquash!commit tomainis refused (pre_push_hook.bats)._common.sh,_config.shandhooks/pre-push, 14 of the 19 new tests fail. The 5 that pass check behaviour that must stay the same (invalid rests refused, length measure, defaultlogs/).b1d5a83): the 13 logging tests (init_logging,cgw_log_dir,CGW_LOG_DIR) incommon.batsandcommit_enhanced.bats, andconfig_registry.bats, pass on Windows. The full Windows run below is frombb78a63; all CI checks are green onb1d5a83.bb78a63),tests/run.sh --all: 1,719 tests, 11 skipped, 1 failure:commit_enhanced_modes16 (index.lock wait). It passes 3 of 3 alone on this branch; PR fix: a project-owned .cmd shim no longer keeps a stale AGY install #109 reported the same timing flake under parallel load.--severity=erroron scripts, hooks and the changed.batsfiles),shfmt -d -i 2 -ci, markdownlint,tests/verify_skill_commands.shandtests/lint_doc_snippets.share clean.typosis not installed locally; CI runs it.The HyprZero copy of
scripts/git/gets this on its nextsync_cgw_tooling.shrun.🤖 Generated with Claude Code