feat: CLI restoration with all flags and config manager (Phase 1 — T1.1, T1.2, T1.3)#38
Open
canonical-muhammadbassiony wants to merge 5 commits into
Open
Conversation
added 3 commits
May 20, 2026 12:51
- T1.1: rewrite cmd/bauer/main.go with all flags restored + config resolver - T1.2: fix --dry-run semantics (skip Copilot in standalone, skip PR in --open-pr) - T1.3: update Taskfile with build, run, run-api, test, verify-figma tasks
…emantics - Fix .gitignore: use /bauer (root-anchored) to stop ignoring cmd/bauer/ directory - Extract checkMutualExclusion() helper from main() for testability - Test --open-pr + --open-issue returns descriptive error - Test runOpenIssue/runOpenPR stubs return 'not yet implemented' - Test dry-run standalone mode skips ExecuteChunk via trackingAgent spy
Contributor
There was a problem hiding this comment.
Pull request overview
This PR restores and rewrites the Bauer CLI entrypoint to use the layered config resolver, reintroduces the full set of CLI flags, and updates developer workflows in the Taskfile.
Changes:
- Rewrote
cmd/bauer/main.goto useflag.FlagSet, resolve layered config viaconfig.NewResolver, and dispatch between standalone /--open-pr/--open-issuemodes (with Phase 2 stubs). - Extended config flag plumbing (
CLIFlags,FlagsSource, defaults) to includeBranchPrefix,OpenPR, andOpenIssue, plus a default credentials path fallback. - Updated
Taskfile.ymlto split CLI vs API build/run flows and enhanceverify-figma.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Taskfile.yml | Splits build targets (CLI vs API), updates run/test/lint tasks, improves verify-figma checks. |
| internal/config/manager.go | Adds default CredentialsPath fallback; maps additional CLI flag fields into resolved config. |
| internal/config/cli.go | Extends CLIFlags with branch prefix and PR/issue mode booleans. |
| docs/implementation-log.md | Marks Phase 1 branch as done and fills in the phase summary/files list. |
| cmd/bauer/main.go | Replaces old workflow-based main with layered config + flagset parsing + mode dispatch helpers. |
| cmd/bauer/main_test.go | Adds unit tests for resolver precedence, mutual exclusion, dry-run behavior, and mode stubs. |
| .gitignore | Adjusts ignore rule for the built bauer binary to be repo-root specific. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+16
to
+17
| fs := flag.NewFlagSet(os.Args[0], flag.ExitOnError) | ||
|
|
| os.Exit(1) | ||
| } | ||
|
|
||
| cfg.ApplyDefaults() |
Comment on lines
18
to
+23
| SummaryModel string | ||
| TargetRepo string | ||
| ArtifactsDir string | ||
| BranchPrefix string | ||
| OpenPR *bool | ||
| OpenIssue *bool |
Comment on lines
+95
to
111
| ctx := context.Background() | ||
|
|
||
| cwd, err := os.Getwd() | ||
| if err != nil { | ||
| fmt.Fprintf(os.Stderr, "ERROR: failed to get working directory: %v\n", err) | ||
| fmt.Fprintln(os.Stderr, "ERROR: failed to get working directory:", err) | ||
| os.Exit(1) | ||
| } | ||
|
|
||
| copilotAgent, err := copilotcli.NewClient(cwd) | ||
| if err != nil { | ||
| fmt.Fprintf(os.Stderr, "ERROR: failed to create Copilot client: %v\n", err) | ||
| fmt.Fprintln(os.Stderr, "ERROR: failed to create Copilot client:", err) | ||
| os.Exit(1) | ||
| } | ||
|
|
||
| sources := source.NewManager(absCredentials) | ||
| arts := artifacts.NewManager("") | ||
| sources := source.NewManager(cfg.CredentialsPath) | ||
| arts := artifacts.NewManager(cfg.ArtifactsDir) | ||
| orch := orchestrator.New(copilotAgent, sources, arts) |
Comment on lines
+35
to
+44
| fmt.Fprintf(os.Stderr, "\nEnvironment variables:\n\n") | ||
| fmt.Fprintf(os.Stderr, "\tBAUER_DOC_ID Override for --doc-id\n") | ||
| fmt.Fprintf(os.Stderr, "\tBAUER_CREDENTIALS_PATH Override for --credentials\n") | ||
| fmt.Fprintf(os.Stderr, "\tGOOGLE_APPLICATION_CREDENTIALS Fallback credentials path\n") | ||
| fmt.Fprintf(os.Stderr, "\tBAUER_MODEL Override for --model\n") | ||
| fmt.Fprintf(os.Stderr, "\tBAUER_SUMMARY_MODEL Override for --summary-model\n") | ||
| fmt.Fprintf(os.Stderr, "\tBAUER_DRY_RUN Override for --dry-run (true/false)\n") | ||
| fmt.Fprintf(os.Stderr, "\tBAUER_ARTIFACTS_DIR Override for --artifacts-dir\n") | ||
| fmt.Fprintf(os.Stderr, "\tBAUER_BRANCH_PREFIX Override for --branch-prefix\n") | ||
| fmt.Fprintf(os.Stderr, "\n") |
Comment on lines
+45
to
+56
| TOKEN="${BAUER_FIGMA_TOKEN:-$FIGMA_TOKEN}" | ||
| if [ -z "$TOKEN" ]; then | ||
| echo "ERROR: set BAUER_FIGMA_TOKEN or FIGMA_TOKEN"; exit 1 | ||
| fi | ||
| - | | ||
| if [ -z "{{.FILE_KEY}}" ]; then | ||
| echo "ERROR: provide FILE_KEY=your-figma-file-key"; exit 1 | ||
| fi | ||
| echo "Figma token is set." | ||
| - | | ||
| curl -sf -H "Authorization: Bearer ${BAUER_FIGMA_TOKEN:-$FIGMA_TOKEN}" \ | ||
| "https://api.figma.com/v1/files/{{.FILE_KEY}}/meta" \ | ||
| | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('name','?'), d.get('lastModified','?'))" |
Comment on lines
+20
to
+24
| credentialsPath := fs.String("credentials", "", "Path to service account credentials JSON\n\t(falls back to BAUER_CREDENTIALS_PATH → GOOGLE_APPLICATION_CREDENTIALS → credentials.json)") | ||
| chunkSize := fs.Int("chunk-size", 0, "Total number of chunks (default: 1, or 5 if --page-refresh)") | ||
| pageRefresh := fs.Bool("page-refresh", false, "Use page-refresh-instructions template (default chunk-size: 5)") | ||
| model := fs.String("model", "", "Copilot model for sessions (default: gpt-5-mini-high)") | ||
| summaryModel := fs.String("summary-model", "", "Copilot model for summary session (default: gpt-5-mini-high)") |
| // In standalone dry-run mode, skip Copilot client initialization | ||
| // so the CLI works on machines without the Copilot CLI installed. | ||
| var copilotAgent agent.Agent | ||
| if !(*dryRun && !*openPR && !*openIssue) { |
Comment on lines
103
to
+110
| return &Config{ | ||
| Model: "gpt-5-mini-high", | ||
| SummaryModel: "gpt-5-mini-high", | ||
| ChunkSize: 1, | ||
| ArtifactsDir: "./bauer-artifacts", | ||
| BranchPrefix: "bauer", | ||
| PageRefresh: BoolPtr(false), | ||
| DryRun: BoolPtr(false), | ||
| OpenPR: BoolPtr(false), | ||
| OpenIssue: BoolPtr(false), | ||
| Model: "gpt-5-mini-high", | ||
| SummaryModel: "gpt-5-mini-high", | ||
| ChunkSize: 1, | ||
| ArtifactsDir: "./bauer-artifacts", | ||
| BranchPrefix: "bauer", | ||
| CredentialsPath: "credentials.json", | ||
| PageRefresh: BoolPtr(false), |
Comment on lines
+104
to
+107
| spy := &trackingAgent{} | ||
| arts := artifacts.NewManager(t.TempDir()) | ||
| src := source.NewManager("") // no credentials needed; Fetch is not called in this test | ||
|
|
Comment on lines
+164
to
+166
| copy := *original | ||
| copy.DryRun = config.BoolPtr(false) | ||
| return © |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rewrites
cmd/bauer/main.goto use the layered config resolver, restores all original CLI flags, and fixes dry-run semantics.Tasks Implemented
--doc-id,--credentials,--chunk-size,--page-refresh,--model,--summary-model,--dry-run,--artifacts-dir,--open-pr,--open-issue,--branch-prefix). Switched toflag.FlagSetfor testability. Wired throughconfig.NewResolver.--dry-runsemantics — standalone mode skips Copilot entirely;--open-prmode applies changes locally but skips PR creation.Taskfile.yml— splitbuild/build-api,runuses{{.CLI_ARGS}}, addedrun-api,test,lint, enhancedverify-figma.Files Changed
cmd/bauer/main.go— full rewrite withflag.FlagSet, all flags, mutual-exclusion guard, mode dispatchinternal/config/cli.go—CLIFlagsextended withBranchPrefix,OpenPR,OpenIssueinternal/config/manager.go—DefaultsSourceaddsCredentialsPath: "credentials.json"fallbackTaskfile.yml— build/run/test/lint tasksPart of the Bauer v2 stacked PR series (Branch 3 of 12).