feat: Add a "watch" command,an opt-in auto sync and analysis loop#2493
feat: Add a "watch" command,an opt-in auto sync and analysis loop#2493im-fan wants to merge 8 commits into
Conversation
…h [init|start|restart|stop|status]
…h [init|start|restart|stop|status]
|
Someone is attempting to deploy a commit to the NexusCore Team on Vercel. A member of the Team first needs to authorize it. |
|
I checked the new watch-command PR locally at What I ran:
The two failures were both in existing hook-owner-guard cases ( Actionable cleanup before review: run Prettier on the two README files and update/rebase the branch, since GitHub currently reports the PR as dirty against |
|
run Prettier README file is done . @koriyoshi2041 |
|
Confirmed at |
# Conflicts: # README.md # gitnexus/README.md # gitnexus/test/unit/cli-index-help.test.ts
|
The complete branch merge has been completed @koriyoshi2041 |
|
Thanks for updating the branch. I rechecked the current head against current I am still seeing a blocker in the existing shallow-clone branch fallback path. In For a repo originally cloned as a single-branch shallow clone, for example That means Please fetch/update an explicit branch ref and check out/reset from that ref, for example fetch |
azizur100389
left a comment
There was a problem hiding this comment.
Requesting changes: the shallow single-branch fallback bug is still present.
In gitnexus/src/server/git-clone.ts, the existing-clone branch path still runs git fetch --depth 1 origin <branch> and then git checkout <branch>. For a repo originally cloned with --depth 1 --branch master, fetching main this way can update only FETCH_HEAD; it does not create origin/main or a local main branch, so git checkout main fails with pathspec 'main' did not match any file(s) known to git.
Please fetch an explicit branch ref, for example refs/heads/<branch>:refs/remotes/origin/<branch>, then create/reset the local branch from origin/<branch>. Please also add a regression test using a real shallow single-branch clone, since the current tests do not exercise this Git behavior.
Summary
Adds an explicit
gitnexus watchCLI entrypoint for long-running auto-sync, replacing env-flag startup with config-driven watch lifecycle controls. The watch flow now supportsbranch fallback, per-repo git timeouts, status/lock files, commit info output, and analyze failure threshold skipping.
Motivation / context
Auto-sync needed a safer and more inspectable operating model than implicit startup via
AUTO_UPDATE_AND_ANALYZE_FLAG. This change makes watch behavior explicit throughGITNEXUS_HOME/watch_config. yml, prevents duplicate watch processes perGITNEXUS_HOME, and records runtime state for operators.Areas touched
gitnexus/(CLI / core / MCP server)gitnexus-web/(Vite / React UI). github/(workflows, actions)eval/or other toolingREADME. md, package README)Scope & constraints
In scope
gitnexus watch [init|start|restart|stop|status].GITNEXUS_HOME/watch_config.yml.GITNEXUS_HOME/watch/.brancheswith legacybranchcompatibility.github.com,gitlab.com, andgitee.com.repo_git_timeout.analyze_failure_threshold.project_commit_info.txt.Explicitly out of scope / not done here
gitnexus analyze.GITNEXUS_HOME.Implementation notes
watch initcreates a default config without overwriting an existing file.GITNEXUS_HOME/watch/auto-sync-state.json.project_commit_info.txtis inspection-only; machine state remains JSON.extractWebRepoName, while auto-sync keeps stricter remote/repo validation.Testing & verification
cd gitnexus && npm testFocused unit coverage added/updated for:
watch initand CLI help outputRisk & rollout
This changes the auto-sync operating model from implicit env startup to explicit
gitnexus watch. Operators usingAUTO_UPDATE_AND_ANALYZE_FLAGmust switch togitnexus watch startand createGITNEXUS_HOME/watch_config.yml.Runtime artifacts now move under
GITNEXUS_HOME/watch/; stale older auto-sync state files outside that directory are not migrated automatically.Index refresh is not required for existing repositories, but watch-managed repos will re-analyze when their configured branch commit changes or prior analysis failed.