Skip to content

feat: REST API layer for github-projects-client + MCP coordinator refactor#40

Merged
BigLep merged 12 commits into
masterfrom
005-rest-api-layer
May 12, 2026
Merged

feat: REST API layer for github-projects-client + MCP coordinator refactor#40
BigLep merged 12 commits into
masterfrom
005-rest-api-layer

Conversation

@BigLep
Copy link
Copy Markdown
Contributor

@BigLep BigLep commented May 8, 2026

Summary

Adds a REST API layer for github-projects-client, refactors filozzy-mcp to a thin coordinator, and updates board sweep rules based on live sweep runs.

Library / API changes

  • REST API server inside github-projects-client — board operations as HTTP endpoints callable via curl, data goes directly to disk without entering LLM context
  • Consolidated mutation endpoint: PUT /items/field/{field_name} handles both single and bulk updates (was two separate endpoints with different response shapes)
  • Bug fixes: iteration fields (Cycle) returning empty — REST API returns title as {raw, html} dict; empty-string stripping silently dropping fields from responses; sub-issues progress now renders as N/N
  • MCP coordinator refactor: filozzy-mcp reduced to single get_board_context tool — no longer makes GitHub API calls or requires GITHUB_TOKEN
  • Dev mode: github-projects-api-dev entry point with auto-reload for development
  • Tests: 68 unit tests (mutation routes, all field types with real API response shapes, build_display_items)

Board rule changes (from live sweep feedback)

  • R-SL-007: Add skip-if when author pushed commits after changes-requested review (avoids conflict with R-PR-006 case 3)
  • R-FC-001: Verify assignment persisted (API silently succeeds without write access); exclude bot-created Done items from assignee requirement
  • R-PR-006: Clarify cases 2/3 with timestamp comparison language
  • Phase 2 triggers: Tighten guidance — skip when PR is already in correct status with no competing rule trigger

Sweep playbook improvements

  • foc_gh_get/foc_gh_put helper scripts with env.sh (token resolved at runtime via gh auth token, never written to disk)
  • Fresh-shell handling: always use full path (each Bash tool call is a new shell)
  • Dev mode server start, port check before starting, jq -e pagination fix
  • Single-pass jq action list generation (R-PR-002/003/004 included), output to disk not context

Test plan

  • 68 unit tests pass (items, mutations, queries)
  • filoszy-mcp tests pass (10/10)
  • Server starts, /openapi.json returns all endpoints matching contract
  • Live API calls verified iteration field rendering against real board data
  • Sweep agent ran full Stage 1 + Stage 4 with updated rules and playbook

BigLep and others added 4 commits May 8, 2026 11:06
Specifies a stateless REST API that wraps the existing Python client,
enabling LLM agents to fetch board data directly to disk via curl
instead of piping through MCP context. Audit logging moves from
filozzy-mcp into the API layer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Phase 0 (research) and Phase 1 (design) artifacts: plan, research
decisions, data model, REST API contracts, and quickstart guide.
API server lives inside github-projects-client as a server/ subpackage
rather than a separate package.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Generate Phase 2 tasks (32 total) organized by user story. Update plan
and research to use FastAPI — auto-generates OpenAPI spec from route
definitions, eliminating a separate spec file. MCP coordinator will
reference the OpenAPI URL for agent discoverability.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…coordinator

Add a FastAPI REST API server inside github-projects-client that exposes
board operations as HTTP endpoints callable via curl. This enables agents
to pipe board data directly to disk without entering LLM context.

Key changes:
- New server/ subpackage with FastAPI app, auth, routes, models, formats
- Audit log moved from filozzy-mcp to github-projects-client with caller/endpoint fields
- Query syntax reference extracted to shared query_syntax.py (single source of truth)
- Rich OpenAPI endpoint descriptions with full parameter docs
- filozzy-mcp refactored to thin coordinator (get_board_context tool only)
- filozzy-mcp no longer requires GITHUB_TOKEN
- .mcp.json updated: removed GITHUB_TOKEN from filozzy, added API_BASE_URL
- README rewritten with tool comparison table and project tenet
- Future ideas added for removing compact format and field options endpoint

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@FilOzzy FilOzzy added this to FOC May 8, 2026
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC May 8, 2026
Replace all MCP tool references (list_board_items, get_board_item,
set_board_item_field, bulk_set_board_item_field, list_board_field_options)
with REST API curl patterns and gh CLI equivalents. Agent now discovers
board identity and API base URL from get_board_context (FilOzzy MCP
coordinator) rather than hardcoded values.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@BigLep BigLep moved this from 📌 Triage to ⌨️ In Progress in FOC May 8, 2026
@BigLep BigLep self-assigned this May 8, 2026
BigLep and others added 2 commits May 8, 2026 13:30
…gs, add tests

- Consolidate single-item and bulk mutation endpoints into one:
  PUT /items/field/{field_name} (was separate PUT /items/{ref}/fields/{name}
  and PUT /fields/{name}/bulk)
- Remove field_name body override from BulkSetFieldRequest (URL-encoding
  spaces in field names works fine)
- Fix iteration fields (Cycle) returning "" — REST API returns title as
  {"raw": "...", "html": "..."} not a plain string
- Fix empty-string stripping that silently dropped fields with no value
  from responses (build_display_items and get_item route)
- Add sub-issues progress rendering ("N/N" instead of silent data loss)
- Add dev mode server entry point (github-projects-api-dev) with auto-reload
- Add mutation route tests (9 tests) with real API response shapes
- Rewrite item unit tests to use real REST API field shapes (33 tests)
- Update README, spec contract, and filoszy MCP server docs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rule changes:
- R-SL-007: Add "skip if" for new commits after changes-requested review
  (consistent with R-PR-006 case 3 — avoids cross-rule conflict)
- R-FC-001: Verify assignment persisted (API silently succeeds without
  write access); exclude bot-created Done items from assignee requirement
- R-PR-006: Clarify cases 2/3 with timestamp comparison language and
  R-SL-001 re-request exception note
- Phase 2 trigger: Tighten guidance — skip when PR is already in correct
  status with no competing rule trigger

Sweep playbook:
- Add foc_gh_get/foc_gh_put helper scripts (Stage 0) with env.sh for
  non-sensitive config; token resolved at runtime via gh auth token
- Switch to dev mode server start (github-projects-api-dev, auto-reload)
- Fix @ in sweep dir name (breaks zsh PATH lookup)
- Note fresh-shell behavior: always use full path "$SWEEP/bin/foc_gh_get"
- Fix jq -e pagination check (exit code 1 cancels parallel siblings)
- Add R-PR-002/003/004 to single-pass jq action list examples
- Add guidance to write action lists to disk, not context

Agent prompt:
- Consolidate pitfalls — move procedural details to playbook, keep
  only non-obvious gotchas (fresh shell, jq -e, context bucketing)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@BigLep BigLep requested review from Copilot and rjan90 May 8, 2026 20:33
@BigLep BigLep moved this from ⌨️ In Progress to 🔎 Awaiting review in FOC May 8, 2026
@BigLep
Copy link
Copy Markdown
Contributor Author

BigLep commented May 8, 2026

Lots of changes here. I think the key thing to look at is the READMEs, which attempt to provide justification for any of this code. Ideally a lot of this is code that wouldn't need to be written and we could just have a ruleset that can use out-of-the-box tools...

Tests asserted "/fields" in context output but endpoint was renamed
from /fields/{name}/bulk to /items/field/{name}. Update assertions
to match.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@BigLep BigLep marked this pull request as ready for review May 8, 2026 20:36
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a FastAPI-based REST server inside github-projects-client to expose board read/mutation operations as stateless HTTP endpoints, and refactors filozzy-mcp into a thin coordinator that only returns board/API usage context (no GitHub API calls). It also updates sweep playbooks/rules/docs to use the new API-first workflow and adds/updates tests around the new behavior.

Changes:

  • Add a REST API server (github_projects_client.server) with items/fields/mutations endpoints, auth dependency, formatting helpers, and centralized error handling.
  • Move/extend mutation audit logging into github-projects-client and refactor filozzy-mcp to a single get_board_context coordinator tool.
  • Update board sweep playbooks/rules/docs and expand tests to cover new API shapes + field formatting fixes.

Reviewed changes

Copilot reviewed 37 out of 41 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
specs/005-rest-api-layer/tasks.md Implementation task breakdown for REST API layer + MCP refactor.
specs/005-rest-api-layer/spec.md Feature spec and acceptance scenarios for the REST API + coordinator.
specs/005-rest-api-layer/research.md Framework/auth/logging design decisions and tradeoffs.
specs/005-rest-api-layer/quickstart.md Curl-first quickstart for running/using the REST API and coordinator.
specs/005-rest-api-layer/plan.md Repository structure + execution plan for the feature.
specs/005-rest-api-layer/data-model.md Request/response entities and audit log schema definition.
specs/005-rest-api-layer/contracts/rest-api.md REST endpoint contract and error/response shapes.
specs/005-rest-api-layer/checklists/requirements.md Spec quality checklist completion.
github-projects-client/tests/test_mutations_route.py Unit tests for consolidated mutation endpoint and audit logging behavior.
github-projects-client/tests/test_items_unit.py Updated unit tests using real REST API response shapes + formatting fixes.
github-projects-client/README.md Document REST API server usage and positioning vs GitHub tools.
github-projects-client/pyproject.toml Add FastAPI/uvicorn deps and server entry points; add httpx for tests.
github-projects-client/github_projects_client/server/routes/mutations.py Mutation + audit-log endpoints (bulk/single via consolidated route).
github-projects-client/github_projects_client/server/routes/items.py Item list/get/view endpoints with formatting + query syntax reference.
github-projects-client/github_projects_client/server/routes/fields.py Field listing and field options endpoints.
github-projects-client/github_projects_client/server/routes/init.py Route package initializer.
github-projects-client/github_projects_client/server/models.py Pydantic request/response models for OpenAPI.
github-projects-client/github_projects_client/server/formats.py Compact/columnar formatting + display-item sanitization helper.
github-projects-client/github_projects_client/server/auth.py Bearer token extraction dependency + requests session builder.
github-projects-client/github_projects_client/server/app.py FastAPI app factory, router registration, and exception mapping.
github-projects-client/github_projects_client/server/init.py Server package marker.
github-projects-client/github_projects_client/query_syntax.py Shared query syntax reference (API + coordinator).
github-projects-client/github_projects_client/items.py Field-value formatting fixes (iteration title dict; sub-issues progress).
github-projects-client/github_projects_client/audit_log.py Audit log implementation (env-configurable path; caller/endpoint fields).
foc-board-rules/sweep-playbook.md Update sweep workflow to use curl + helper scripts + REST API.
foc-board-rules/sweep-agent-prompt.md Update agent instructions for coordinator + REST API workflow.
foc-board-rules/status-lifecycle.md Update/clarify rules to reference REST API endpoints and add skip logic.
foc-board-rules/README.md Update rule application guidance to reference coordinator + REST API.
foc-board-rules/pr-hygiene.md Clarify R-PR-006 cases with timestamp comparison language.
foc-board-rules/future-ideas.md Update/retire ideas based on new REST-API-to-disk architecture.
foc-board-rules/field-completeness.md Update rules to reference REST API and add assignment-persistence guidance.
filozzy-mcp/uv.lock Lockfile updates reflecting dependency changes.
filozzy-mcp/tests/test_integration.py Replace live GitHub API integration tests with coordinator tool checks.
filozzy-mcp/tests/test_format.py Replace formatting tests with coordinator output tests.
filozzy-mcp/README.md Reposition to coordinator-only server; update setup/config.
filozzy-mcp/pyproject.toml Remove requests dep; ensure editable client source configured.
filozzy-mcp/filozzy_mcp/server.py Remove GitHub API tools; add get_board_context tool and shared query docs.
CLAUDE.md Add repo guidance: prefer GitHub-supported tools where possible.
.gitignore Broaden ignore pattern for .mcp.json*.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread github-projects-client/github_projects_client/server/auth.py
Comment thread github-projects-client/github_projects_client/server/formats.py
Comment thread github-projects-client/github_projects_client/server/app.py
Comment thread github-projects-client/README.md Outdated
Comment thread filozzy-mcp/README.md Outdated
- Fix typo "Ssee" → "See" in github-projects-client README
- Fix typo "githut-projects-turbo" → "github-projects-client" in
  filozzy-mcp README
- Stop leaking exception details in catch-all error handler — return
  generic "Internal server error" message, log full exception server-side

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread github-projects-client/github_projects_client/server/app.py
BigLep and others added 3 commits May 11, 2026 15:17
Incorporates 7 improvements observed during a live sweep:
- Fix dependabot author format in jq examples (app/dependabot, not [bot])
- Add title-based exclusion for bot/release PRs in R-PR-006 filter
- Add Phase 2 skip heuristic for In Progress + CHANGES_REQUESTED
- Note that ~75% of unassigned PRs are bots (filter before reading)
- Narrow unlinked PR discovery to current cycle (low historical yield)
- Document empty objects in cross-reference GraphQL results
- Add pitfall: verify assignee mutations stuck (GitHub silent 201)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ub errors

Audit log endpoint now validates bearer tokens against GitHub API before
returning entries (FR-008). GraphQL auth/scope failures surface as 401
with actionable message instead of being swallowed as generic 500s.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add timing instrumentation helper (foc_timer) to Stage 0
- Add Phase 2 jq summary template — never print raw review JSON into context
- Add single-pass action bucketing with counts-first verification
- Add field-gap jq filtering example (bots, external repos)
- Add Stage 5 unassigned-issue investigation with cross-reference priority order
- Consolidate prompt pitfalls 9-13 into two lean entries pointing to playbook

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@BigLep BigLep requested a review from rjan90 May 11, 2026 23:13
Copy link
Copy Markdown
Contributor

@rjan90 rjan90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-project-automation github-project-automation Bot moved this from 🔎 Awaiting review to ✔️ Approved by reviewer in FOC May 12, 2026
@BigLep BigLep merged commit 8af8477 into master May 12, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from ✔️ Approved by reviewer to 🎉 Done in FOC May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

4 participants