madrid hackathon#33
Draft
muhammadbassiony wants to merge 3 commits into
Draft
Conversation
Collaborator
muhammadbassiony
commented
May 13, 2026
- feat: implement T0.1, T0.2, T0.2a, T0.2b, T0.2c — agent interface, source layer, artifact history (feat: implement T0.1, T0.2, T0.2a, T0.2b, T0.2c — agent interface, source layer, artifact history #31)
- v2 cleanup and cli restoration (v2 cleanup and cli restoration #32)
- stage review
…urce layer, artifact history (#31) * feat: implement T0.1, T0.2, T0.2a, T0.2b, T0.2c — agent interface, source layer, artifact history T0.1 — Define Agent interface in orchestrator (Go convention: interface at consumer) - Agent interface with Start/ExecuteChunk/GenerateSummary/Stop in orchestrator package - copilotcli.Client satisfies it implicitly via structural typing - Compile-time check in orchestrator_test.go - Shared MockAgent in internal/agent/mock.go for any test package T0.2 — Refactor copilotcli to implement orchestrator.Agent - copilotcli.Client method signatures match Agent interface - Orchestrator depends on Agent interface, not concrete *copilotcli.Client - orchestrator no longer imports copilotcli in production code - Tests use agent.MockAgent T0.2a — Create internal/source with adapters and SourceBundle - Adapter interface (Name, Fetch) defined in source package (consumer = Manager) - GDocsAdapter creates gdocs.Client per-Fetch (credentials vary per-request) - SourceBundle type combines Document + Design (reserved for Figma) - Manager coordinates adapters and assembles SourceBundle - Tests cover: gdocs result, no adapters, error, unknown type T0.2b — Refactor orchestrator to consume source layer - Orchestrator calls source.Manager.Fetch() instead of gdocs directly - Orchestrator no longer imports internal/gdocs - OrchestrationResult uses *source.SourceBundle - PromptData unchanged (explicit named fields per spec) T0.2c — Add append-only artifact history foundation - internal/artifacts/manager.go: timestamped run dirs, runs.jsonl index - Run directories: extraction/, prompts/, outputs/, logs/, screenshots/ - --artifacts-dir CLI flag, BAUER_ARTIFACTS_DIR env var (default: ./bauer-artifacts) - Config.ArtifactsDir field with ApplyDefaults - .env.example with BAUER_ARTIFACTS_DIR and all env vars - bauer-artifacts/ added to .gitignore - Orchestrator writes extraction, prompts, outputs, metadata, and runs.jsonl Spec 001 updated: - T0.1/T0.2: interface defined at consumer (orchestrator), not standalone package - All T0.1-T0.2c marked DONE with acceptance criteria checked * fix: address 14 PR review comments 1. Move mock agent from internal/agent to internal/testutil (shared test doubles) 2. Clarify workflow vs orchestrator: orchestrator is the processing pipeline, workflow wraps it with GitHub clone/commit/PR steps 3. CLI bug fix: Copilot client created via factory after chdir to cloned repo, not at process startup (wrong cwd) 4. API bug fix: per-request Copilot client created with correct target repo cwd, not shared from server startup 5. Concurrency fix: per-request orchestrator in API handler eliminates shared mutable state across concurrent HTTP handlers 6. Fix chunk.Filename passed to WritePrompt: use filepath.Base() to extract just the filename, preventing nested directory structures 7. Fix finalizeRun called on errors: use defer in Execute() so failed runs are written to metadata.json/runs.jsonl with status="failed" 8. Fix ArtifactDir: use full relative path "bauer-artifacts/<run-id>" instead of just the run ID 9. Fix GenerateSummary: actually return fullSummary instead of empty string 10. Fix screenshots/ directory: created in NewRun alongside other subdirs 11. Fix run ID entropy: use crypto/rand with timestamp + 32 random bits instead of second-level timestamp with 16 bits 12. Fix SourceBundle.Document comment: clarify it can be nil when no gdocs adapter configured or fetch returns unrecognized type 13. Wire BAUER_* env vars as CLI fallbacks in cmd/bauer/main.go 14. Remove shared Orchestrator from RouteConfig; API builds per-request * fix: resolve artifacts/output dirs to absolute before chdir When ExecuteWorkflow chdirs into the cloned target repo, any relative paths passed to the orchestrator or artifacts manager are evaluated against the new cwd — meaning artifacts land inside the target repo. CommitChanges only excluded bauer-output/ and bauer-doc-suggestions.json, so bauer-artifacts/ files could be staged and committed into the PR. Two-part fix: 1. Resolve OutputDir and ArtifactsDir to absolute paths BEFORE chdir, both in cmd/bauer/main.go (the caller) and as a safety net in ExecuteWorkflow itself. The artifacts manager is also created with the absolute path. 2. Add bauer-artifacts/ to CommitChanges' exclude list as a defensive safety net, so even if a relative path slips through it won't be committed. Also add ArtifactsDir field to WorkflowInput so the workflow can propagate the absolute path to its caller-configured artifacts manager. --------- Co-authored-by: Bauer Agent <bauer@canonical.com>
* v2 cleanup: remove dead API/code, restore CLI with config manager, T0.3–T2.3 TR0 — Removal Sprint - Remove committed secrets: git rm --cached config.json credentials.json - Delete internal/config/json.go and all JSON config loading - Remove --config flag from internal/config/cli.go and cmd/app/types/config.go - Gut cmd/app/ to minimal health-only API stub (removes old /api/v1/job handler, models, types, middleware) - Delete internal/workflow/api.go (dead HTTP workflow handler) - Update Taskfile.yml: remove --config references, add build-api/run-api/run tasks - Update .gitignore: ignore config.json, credentials.json, binaries T0.3 — Unified Config Manager - Create internal/config/manager.go with Resolver and Source interface - EnvVarSource: reads all BAUER_* env vars with proper fallback chains - DefaultsSource: hardcoded defaults (model, chunk size, output dir, etc.) - FlagsSource: wraps parsed CLI flags with *bool tracking for explicit false - BoolPtr/BoolVal helpers for proper override semantics - Config.Validate() with helpful multi-field error messages - Full test coverage in manager_test.go T0.4 — Env Var Auth Support - Credentials: BAUER_CREDENTIALS_PATH → GOOGLE_APPLICATION_CREDENTIALS fallback - GitHub token: BAUER_GITHUB_TOKEN → GITHUB_TOKEN → GH_TOKEN → gh auth token - Update .env.example as canonical reference for all env vars T0.5 — JSON Config Removal - Complete removal of JSON config support across codebase - Verify .env.example completeness T1.1 — CLI Restoration - Rewrite cmd/bauer/main.go using config.ParseCLIFlags + NewResolver - Restore all flags: --doc-id, --credentials, --chunk-size, --page-refresh, --model, --summary-model, --output-dir, --dry-run, --open-pr, --open-issue, --branch-prefix, --figma-url - Three-mode dispatch: standalone, --open-pr, --open-issue - No --github-repo required; runs in current repo T1.2 — Dry-Run Semantics - Standalone + --dry-run: extraction only, no Copilot - --open-pr + --dry-run: Copilot runs, changes applied, PR creation skipped T1.3 — Taskfile Update - build, build-api, run, run-api, test, lint, clean all working T2.1 — --open-pr - Read remote from local git config - Create branch from main, commit, push, open PR via gh CLI - New helpers: github.ReadRemoteFromGitConfig, github.CreateAndPushBranch T2.2 — --open-issue - Skip Copilot; run extraction in dry-run mode - Format suggestions as markdown issue body - Create GitHub issue via gh CLI - New helper: github.CreateIssue T2.3 — Mutual Exclusion - Early validation: --open-pr and --open-issue together exits 1 immediately Spec Roadmaps - Mark parallelizable tasks in both 001 and 002 spec roadmaps * fix PR review comments: stash detection, flag parsing, bool validation, default branch - Rename CreateAndPushBranch -> CreateBranchFromDefault with accurate docstring - Fix stash detection: count stash entries before/after push to avoid spurious pop - ParseCLIFlags: flag.ExitOnError -> flag.ContinueOnError with stderr output - EnvVarSource: use strconv.ParseBool for all boolean env vars; return descriptive errors for invalid values - runOpenPR: use repo's actual default branch (via GetDefaultBranch) instead of hardcoded "main" - GetGitHubToken: error message lists all env vars (BAUER_GITHUB_TOKEN, GITHUB_TOKEN, GH_TOKEN) and wraps gh error - Add tests for ParseBool acceptance/rejection * docs: update specs and README to match implementation fixes * fix PR review batch 2: --help, chunk_size error, target-repo chdir, stash --include-untracked, taskfile summary - cmd/bauer/main.go: detect flag.ErrHelp and exit 0 so --help is not an error - cmd/bauer/main.go: chdir to cfg.TargetRepo (with deferred restore) so --target-repo actually affects all git/gh/agent operations - internal/config/manager.go: BAUER_CHUNK_SIZE now returns descriptive error on invalid integer (matching bool env vars) - internal/github/cli.go: git stash push uses --include-untracked so generated/untracked files don't block checkout - Taskfile.yml: run task summary now mentions both BAUER_CREDENTIALS_PATH and GOOGLE_APPLICATION_CREDENTIALS * fix PR review batch 3: --help exit 0, stash untracked, spec stale refs - cmd/bauer/main.go: detect flag.ErrHelp and exit 0 instead of treating --help as an error - internal/github/cli.go: git stash push uses --include-untracked so generated/untracked files are captured and don't block checkout; stash errors are now checked before proceeding - Taskfile.yml: run task summary now mentions both BAUER_CREDENTIALS_PATH and GOOGLE_APPLICATION_CREDENTIALS - docs/specs/001_v2_reconciliation.md: T4.3 note that WorkflowService should be created fresh (old API code was deleted) - docs/specs/002_figma_integration.md: remove references to deleted files cmd/app/models/v1/job.go, cmd/app/v1/api.go, internal/workflow/api.go from T2F.8 and T4F.1 --------- Co-authored-by: Bauer Agent <bauer@canonical.com>
Co-authored-by: Copilot <copilot@github.com>
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.