Skip to content

adf migrate writes the generic pointer for GEMINI.md/AGENTS.md: POINTER_TEMPLATES built during a circular import #355

Closed

Description

@stackbilt-admin

Found in review of #353. Exists on main.

packages/cli/src/commands/adf-migrate.ts:102 builds POINTER_TEMPLATES at module load from constants exported by adf.ts. The CLI entry loads index → doctor → adf → adf-migrate, so adf.ts is still half-initialised and the template constants are undefined. As a result, charter adf migrate --source GEMINI.md (and AGENTS.md) run from the CLI writes the generic "This project uses [ADF]…" pointer instead of the named template.

Loading ./adf-migrate first gives the right template; loading ./adf, ./bootstrap, ./doctor, ./adf-tidy or ../index first gives the generic one. This explains why unit tests pass and the binary misbehaves.

Impact is cosmetic today (doctor and tidy still recognise the result as a pointer), but it is a latent circular-import hazard. Fix: resolve the template at call time, as restoreTemplate in #353 does. Add a test that imports ../index first and then asserts the GEMINI.md and AGENTS.md pointer text.

Activity

  1. added a commit that references this issue on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions