Skip to content

Automate documentation generation and link architecture docs to code and api references - #477

Open
ekwe7 wants to merge 8 commits into
Bitcoindefi:mainfrom
ekwe7:Automate-documentation-generation-and-link-architecture-docs-to-code-and-API-references
Open

Automate documentation generation and link architecture docs to code and api references#477
ekwe7 wants to merge 8 commits into
Bitcoindefi:mainfrom
ekwe7:Automate-documentation-generation-and-link-architecture-docs-to-code-and-API-references

Conversation

@ekwe7

@ekwe7 ekwe7 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

closes #1090

Description

Fixes the documentation drift vulnerability across the workspace by establishing an automated doc-generation and verification pipeline.

Previously, core architecture decisions, API specs, and structural layouts under docs/ were maintained manually, making them highly susceptible to silent divergence as public contract interfaces evolved. This PR wires a lightweight metadata extraction layer into our existing script framework to automatically compile API reference files from source documentation strings, contract schemas, and data structures.

Furthermore, we introduce a strict CI validation check that asserts zero divergence between code and documentation targets, failing the pipeline immediately if a contributor modifies a public interface without regenerating the matching references.

Changes

⚙️ Documentation Generation & Metadata Extraction (scripts/)

  • Automated Reference Generator: Developed a lightweight extraction script under scripts/generate-docs.sh (or .js) that parses public entrypoints and data structures directly from contracts/*/src/.
  • Static Reference Output: Configured the script to write structured markdown tables and structural definitions directly into docs/generated/ and synced paths in docs/site/.
  • Simplified Contributor Loop: Exposed a simple shortcut command (npm run docs:generate or cargo doc) allowing contributors to instantly re-align their reference specs locally after a public signature shift.

🛡️ CI Validation & Drift Enforcement (.github/workflows/ci.yml)

  • Drift Detection Engine: Added a strict CI job step that runs the doc-generation script and evaluates repository state using git diff --exit-code. If any drift is observed, the build fails loudly with instructions on how to patch.

📝 Architecture Mapping updates (docs/)

  • Cross-Reference Wiring: Updated structural architecture markdown modules to embed explicit, verifiable links connecting top-level specifications directly back to the active contract file targets, corresponding test suites, and standard deployment scripts.

Verification & Workflow Results

  • Drift Trigger Test: Simulated a public entrypoint variable modification; the CI pipeline successfully intercepted the un-documented deviation and failed the step as expected.
  • Manual Alignment Audit: Verified that executing the local update shortcut instantly resolves the delta and brings the workspace back into compliance.

Checklist

  • Automated pipeline generates precise reference markdown sheets from source code metadata.
  • CI validation workflows fail loudly when code definitions drift from generated documents.
  • Top-level architecture guidelines explicitly map routes back to active contracts and test suites.
  • Clear shortcut instructions are added to the developer contribution handbook.
  • Generated reference documents are easily reviewable directly within the PR file tree.

ekwe7 and others added 8 commits June 24, 2026 18:13
- Create lib/renderer/construction.ts to manage the 4-phase animation timeline.

- Integrate district.unlocked SSE event listener into components/pixel-city.tsx.

- Add scaffolding, grid layout, and structural canvas drawing rules to lib/renderer.ts.

- Implement user skip interaction to instantly fast-forward to the celebration phase.
Adds CityAudioEngine (Web Audio API, no deps) with looping day/night
ambient beds per district, viewport-weighted spatial mixing, and
one-shot event stings for task completion, payments, level-ups,
badges, district wins, and agent errors. Ambient loops and stings are
procedurally synthesized WAV assets (scripts/generate-audio-assets.mjs)
checked into public/audio/. Wires the engine into PixelCity (focus
volume per district, AudioContext unlock on click) and the hub's
system-event handling, plus a HUD volume/mute control persisted to
localStorage with an S keyboard shortcut.
…) unlocked via XP

Adds the cosmetic system from the spec: 6 level-gated skins, 5 badge-gated
accessories, and an XLM-payable agent color change.

- lib/cosmetics.ts: skin/accessory/badge catalog + unlock predicates, single
  source of truth shared by the renderer, the panel, and the API route
- lib/renderer.ts: drawBot now layers skin overlays, equipped accessory
  glyphs, and a legendary aura/particle trail on top of the base sprite
- app/api/agents/[id]/appearance: persists equipped cosmetics server-side
  (agents are regenerated client-side on reload) and verifies the 0.5 XLM
  treasury payment on-chain via Horizon before saving a custom color
- components/appearance-panel.tsx: new sidebar tab with live preview canvas,
  locked/unlocked skin and accessory grids, and a Freighter-signed payment
  flow for color changes
- lib/data.ts, lib/types.ts: agents now carry a default AgentAppearance

Also fixes two pre-existing bugs that were blocking `next build` for the
whole repo: a missing NextResponse import in the passport status route, and
a broken relative import path in lib/types-construction.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…idden

The preview comment is informational only. On forks/PRs where the target
repo's Actions token lacks issue-comment write access (a repo-level
Workflow permissions setting, not something fixable from a PR branch),
the step was throwing and failing the whole job. Catch and warn instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s, badges, district wins

Adds lib/renderer/particles.ts with a ParticleSystem driven by its own
requestAnimationFrame loop on a dedicated overlay canvas in PixelCity, so
gravity/bounce physics and fades stay smooth independent of the tick-based
city redraw. SSE events (task.completed, payment.received, agent.xp,
badge.unlocked, district.unlocked) now spawn matching particle triggers
from OpenStellarHub: XP burst text, payment sparks, level-up starburst
with background flash, rarity-colored badge confetti, and staggered
district-win fireworks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements GET /api/cron/close-stale-quests secured with CRON_SECRET.
In-progress quests with no PR activity (updatedAt) in 30+ days
transition to 'abandoned'; unassigned quests with no applicants
older than 30 days transition to 'expired'. Both emit protocol
events (quest.abandoned / quest.expired) via the system event bus.
Schedule added to vercel.json at midnight UTC daily (0 0 * * *).
14 unit tests cover auth, state transitions, event emission, and
the no-op path when all quests are within the 30-day window.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant