You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add api.GenerateOptions.BaseDir for path resolution and label stripping
Restore the dir context that vanished with the io.Reader switch, but as
a single optional field. BaseDir is the directory relative paths in the
config (schema, queries, output) are resolved against, and the prefix
stripped from file paths shown in parse errors and diff labels. When
empty, BaseDir defaults to the current working directory.
A small resolvePath helper sits in api/generate.go and is called from
processQuerySets and ProcessResult; absolute paths pass through
unchanged. Parse errors and diff labels reuse the same BaseDir for
relative formatting.
Side-effects:
* The endtoend tests no longer pre-rewrite paths to absolute — they
just pass BaseDir = test directory. The absolutizePaths helper is
gone.
* The CLI sets BaseDir to the config's directory (returned by
loadConfig) but keeps the chdir for now since other cmd paths
(vet, push) still use cwd-relative resolution.
Tradeoff vs. the strictly-cosmetic option: GenerateOptions still has
six fields, but BaseDir's semantics are coherent with how it's used
(resolution + label) and library callers don't need to chdir or
hand-rewrite paths.
https://claude.ai/code/session_01RCzB2JR5Y5ScFDUmwcxGVZ
0 commit comments