Skip to content

Feature: Allow configuring default branch and skipping context file generation #243

@arashpropo

Description

@arashpropo

Problem

The analyze command generates AGENTS.md and CLAUDE.md context files with a hardcoded base_ref: "main" in the debugging section (line 48 of ai-context.js):

For regressions: gitnexus_detect_changes({scope: "compare", base_ref: "main"}) — see what your branch changed

Many projects use develop, master, or other branch names as their default branch. Every time gitnexus analyze runs, it overwrites any manual fix back to "main" within the <!-- gitnexus:start --> / <!-- gitnexus:end --> markers.

Proposed Solution

1. defaultBranch configuration

Allow users to configure the default branch name, either via:

  • A config file (e.g. .gitnexus/config.json or a field in meta.json):
    {
      "defaultBranch": "develop"
    }
  • Auto-detection from git symbolic-ref refs/remotes/origin/HEAD or git remote show origin | grep 'HEAD branch'
  • A CLI flag: gitnexus analyze --default-branch develop

The generated context would then use the configured branch instead of hardcoding "main".

2. Option to skip context file generation

For projects that maintain their own AGENTS.md / CLAUDE.md with custom content, provide a way to skip regeneration:

  • CLI flag: gitnexus analyze --no-context or --skip-context-files
  • Config option: { "skipContextFiles": true } in the config file

This would still build the knowledge graph index but skip the generateAIContextFiles() call.

3. Option to skip skills installation

Similarly, gitnexus analyze --no-skills or a config option to skip overwriting .claude/skills/gitnexus/.

Context

We're using GitNexus in a monorepo that uses develop as the default branch. The auto-generated context is valuable, but every analyze run resets our base_ref fix. Currently the only workaround is running sed after every analyze.

Environment

  • GitNexus CLI (via npx gitnexus@latest)
  • macOS / Node.js v22
  • Monorepo with ~11,500 symbols

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions