Skip to content

gstack-gbrain-sync.ts auto-generates invalid source IDs from github remote URLs (>32 chars, contains dots) #1331

@WilliamCourterWelch

Description

@WilliamCourterWelch

The orchestrator at bin/gstack-gbrain-sync.ts auto-generates a source ID from the git remote URL, producing IDs like:

gstack-code-github.com-someuser-some-repo-name

This is 56+ chars and contains dots (.), which exceeds gbrain's source-ID constraint (1-32 lowercase alnum + interior hyphens only).

Reproduction

  1. gh repo create user/some-repo --private && cd some-repo
  2. bun run ~/.claude/skills/gstack/bin/gstack-gbrain-sync.ts --full

Observed

ERR   code   source registration failed: gbrain sources add gstack-code-github.com-... failed:
       Invalid source id "gstack-code-github.com-...". Must be 1-32 lowercase alnum chars
       with optional interior hyphens (e.g. "wiki", "yc-media").

The code stage of /sync-gbrain --full fails with that error. memory and brain-sync stages still succeed, but the repo's code is never indexed for gbrain search / gbrain code-def.

Expected

Source ID derived from REPO NAME ONLY (e.g., gstack-code-some-repo), not the full remote URL with github.com prefix and user/org segment.

Suggested fix

Strip github.com/ prefix, drop the user/org segment, slugify the remaining repo name, truncate to <=32 chars. The constraint regex [a-z0-9-]{1,32} already exists in gbrain — gstack just needs to respect it.

Workaround

Manually register the source first with a valid short ID:

gbrain sources add gstack-code-<short-name> --path "$(pwd)"

Then /sync-gbrain can proceed. But auto-generation should produce valid IDs without manual intervention.

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