Skip to content

docs: golden context [DX-1029]#3270

Open
Michael Pham (michaelphamcf) wants to merge 23 commits into
mainfrom
docs/seed-golden-context
Open

docs: golden context [DX-1029]#3270
Michael Pham (michaelphamcf) wants to merge 23 commits into
mainfrom
docs/seed-golden-context

Conversation

@michaelphamcf
Copy link
Copy Markdown
Contributor

@michaelphamcf Michael Pham (michaelphamcf) commented May 4, 2026

DX-1029

Summary

  • Seeded Golden Context documentation for this repository
  • Generated from codebase analysis, git archaeology, and Glean research
  • Verified via factual audit and newcomer simulation

Artifacts Created

  • README.md — appended agent section, replaced stale CircleCI badge with GHA badge
  • ARCHITECTURE.md — internal structure, diagrams, domain concepts, operational knowledge, integration points
  • CONTRIBUTING.md — dev setup, workflow, source-cited commands, file-level guidance, code style
  • docs/ADRs/ — 8 architecture decision records
  • docs/specs/ — scaffolded directory for active implementation specs
  • AGENTS.md — agent-facing routing table (pure routing, no duplicate content)
  • .bito.yaml + .bito/guidelines/ — Bito review configuration

Newcomer Simulation Score

Score: 19/23 (83%) — above 80% threshold ✅

Remaining failures are structural mismatches (CLI tool vs. service-oriented questions):

  • Domain concept states/lifecycle (CMA-enforced, not CLI-specific)
  • High-traffic area warnings (N/A for CLI)
  • Detailed external dep failure scenarios (CLI surfaces HTTP errors directly)
  • Runbooks/response guides (no alerts exist — explicitly documented)

Flagged Items (require human action)

  • packageManager field is missing from package.json — recommend adding (e.g., "packageManager": "npm@10.x.x") for corepack support
  • .npmrc — present (ignore-scripts=true) ✅
  • .nvmrc — present (24) ✅

ADRs Generated

  • 001 — Yargs as CLI Framework — pinned at ~13.3.2 since 2017 inception
  • 002 — Talkback Integration Tests — HTTP proxy recording/replay for deterministic CI
  • 003 — Semantic Release — automated versioning and npm publishing with Angular commit convention
  • 004 — TypeScript Adoption — incremental migration with allowJs, strict mode for new files
  • 005 — GHA Publishing — migrated from CircleCI to GitHub Actions (DX-535)
  • 006 — LavaMoat allow-scripts — supply chain security via selective script allowlisting
  • 007 — yao-pkg Standalone Binaries — migrated from deprecated pkg to @yao-pkg/pkg
  • 008 — CMA.js v12 Migration — v4.0.0 breaking change, Node 22+ requirement (DX-780, DX-689)

Coverage Before / After

  • Before: 2/8 canonical artifacts present (README.md, CONTRIBUTING.md)
  • After: 8/8 canonical artifacts present

Generated with Claude Code

Summary by Bito

This PR seeds golden context documentation for the contentful-cli repository, providing comprehensive guidance on architecture, development workflow, and technical decisions. It adds core documentation files, configures AI review settings, and documents 8 architecture decision records covering the CLI's evolution. The changes enhance repository maintainability and newcomer onboarding without introducing any code modifications.

Detailed Changes
  • Introduces comprehensive documentation covering system architecture, development setup, and domain concepts in ARCHITECTURE.md.
  • Updates README.md to include agent guidance and replaces outdated CI badge with GitHub Actions badge.
  • Adds detailed contribution guidelines in CONTRIBUTING.md with setup instructions, code style, and file-level guidance.
  • Creates AGENTS.md as a routing table for AI agents working in the repository.
  • Configures Bito review settings with domain invariants, repository boundaries, and review posture guidelines.

@bito-code-review
Copy link
Copy Markdown

bito-code-review Bot commented May 4, 2026

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted Summary
Documentation - Core Documentation Setup
Added comprehensive documentation including architecture overview, contribution guidelines, and agent guidance for the repository.
Other Improvements - Bito AI Review Configuration
Configured Bito AI review settings with domain invariants, repository boundaries, and review posture guidelines.
Documentation - Architecture Decision Records
Documented 8 key architecture decisions including yargs framework, talkback integration, semantic release, TypeScript adoption, and recent migrations.
Documentation - Implementation Specs Scaffold
Created scaffold directory for active implementation specifications.

@bito-code-review
Copy link
Copy Markdown

bito-code-review Bot commented May 4, 2026

Functional Validation by Bito

SourceRequirement / Code AreaStatusNotes
DX-1029Seed a baseline golden context file in every DX-owned repository, covering purpose, stack, conventions, and key entry points✅ MetThe PR adds baseline golden context files including AGENTS.md, ARCHITECTURE.md, and guideline files in .bito/guidelines/ covering the repository's purpose, stack, conventions, and key entry points for the contentful-cli.
DX-689Replace deprecated pkg package in contentful-cli to support cma-v12✅ MetNo change in diff, but requirement already implemented in existing code: the deprecated pkg package has been replaced with @yao-pkg/pkg in package.json, and the build:standalone script uses pkg which resolves to the installed community-maintained fork.
DX-689Update the cli to use cma-v12✅ MetNo change in diff, but requirement already implemented in existing code: the CLI already uses contentful-management ^12.2.0 as specified in package.json.

@bito-code-review
Copy link
Copy Markdown

bito-code-review Bot commented May 4, 2026

Impact Analysis by Bito

Interaction Diagram
sequenceDiagram
participant User as User
participant Bin as bin/contentful.js
participant CLI as dist/lib/cli.js
participant Config as Configuration Handler
participant Cmd as Command Handler
participant CMA as contentful-management.js
participant API as Contentful Management API
User->>Bin: Run command (e.g. contentful space list)
Bin->>CLI: Execute compiled CLI entrypoint
CLI->>Config: Load user configuration
Config-->>CLI: Return config object
CLI->>Cmd: Parse command and delegate execution
Cmd->>CMA: Initialize API client
CMA->>API: Send HTTP request
API-->>CMA: Return API response
CMA-->>Cmd: Process and return data
Cmd-->>CLI: Format command output
CLI-->>User: Display results to terminal
Loading

This MR adds Bito AI configuration and review guidelines that document the CLI's build process (TypeScript compilation to CommonJS), runtime invariants (yargs version pinning, module system), and command interface stability. Changes to command names, flags, or output formats are treated as breaking changes affecting downstream CI pipelines and scripts. The guidelines also cover integration with satellite packages like contentful-migration and the Contentful Management API.

Code Paths Analyzed

Impact:
Documentation-only PR adding comprehensive project context files (.bito.yaml, AGENTS.md, ARCHITECTURE.md, CONTRIBUTING.md updates, README.md updates, 8 ADRs, and review guidelines). No code changes affecting runtime behavior.

Flow:
N/A - Documentation changes only. No code execution paths modified.

Direct Changes (Diff Files):
• .bito.yaml [1-17] — New configuration file for AI code review with comprehensive suggestion mode, custom guidelines, and feature flags
• .bito/guidelines/domain-invariants.txt [1-43] — New file documenting critical technical invariants (build/runtime, satellite packages, testing, security, release, command interface)
• .bito/guidelines/repo-truth-and-boundaries.txt [1-18] — New file defining review posture around documentation alignment and ADR requirements
• .bito/guidelines/review-posture.txt [1-18] — New file establishing review principles for CLI project (high-signal feedback, breaking change awareness)
• AGENTS.md [1-63] — New AI agent guide with quick reference table, sharp edges, key conventions, integration points, and build instructions
• ARCHITECTURE.md [1-132] — New comprehensive architecture document covering system context, internal structure, data flow, domain concepts, dependencies, configuration, and operational knowledge
• CONTRIBUTING.md [1-514] — Major update adding prerequisites, build instructions, development workflow, E2E testing, breaking change guidelines, branch strategy, release process, CI/CD details, and file-level guidance
• README.md [1-539] — Minor update: fixed CI badge from CircleCI to GitHub Actions, added AI agent reference section
• docs/ADRs/ [various] — 8 new Architecture Decision Records covering yargs, talkback, semantic-release, TypeScript, GitHub Actions, LavaMoat, yao-pkg, and CMA v12 migration
• docs/ADRs/README.md [1-12] — New ADR index with table of all decisions
• docs/specs/README.md [1-3] — New placeholder for active implementation specs

Repository Impact:
Developer onboarding: New AGENTS.md, ARCHITECTURE.md, and expanded CONTRIBUTING.md significantly improve new contributor experience with clear setup instructions, architecture overview, and development workflows
AI-assisted code review: .bito.yaml and guidelines files enable automated, context-aware code review with project-specific rules for breaking changes, satellite package alignment, and CLI interface stability
Architecture governance: 8 ADRs document key technical decisions (yargs 13.x, talkback testing, semantic-release, TypeScript migration, GHA CI/CD, LavaMoat security, yao-pkg binaries, CMA v12) providing decision history and rationale

Cross-Repository Dependencies:
None.

Database/Caching Impact:
• None

API Contract Violations:
None.

Infrastructure Dependencies:
None.

Additional Insights:
Documentation accuracy verification needed: CONTRIBUTING.md mentions lint job is 'commented out' in GHA workflow - verify this is still accurate. README.md CircleCI badge was replaced with GHA badge - confirm workflow filename matches ('main.yaml' vs actual filename)
Satellite package version alignment: Documentation captures critical invariant: contentful-management.js, contentful-migration, contentful-import, contentful-export, and contentful-batch-libs must be version-aligned. This is a recurring pain point noted in multiple guideline files

Testing Recommendations

Frontend Impact:
• No issues detected

Service Integration:
• No issues detected

Data Serialization:
• No issues detected

Privacy Compliance:
• No issues detected

Backward Compatibility:
• No issues detected

OAuth Functionality:
• None

Cross-Service Communication:
• No issues detected

Reliability Testing:
• None

Additional Insights:
• Verify all hyperlinks in new documentation files resolve correctly (relative paths like ./AGENTS.md, ./ARCHITECTURE.md)
• Confirm CI badge URL in README.md matches actual GitHub Actions workflow filename
• Validate that documented Node.js version requirements (Node 24 in .nvmrc, >=22 supported) match package.json engines field
• Check that ADR dates and PR references (#122, #1570, #3160, #3193) are accurate
• Ensure .bito.yaml exclude_files pattern 'package-lock.json' matches actual lockfile name (npm uses package-lock.json, yarn uses yarn.lock)

Analysis based on known dependency patterns and edges. Actual impact may vary.

Copy link
Copy Markdown

@bito-code-review bito-code-review Bot left a comment

Choose a reason for hiding this comment

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

Code Review Agent Run #767ef7

Actionable Suggestions - 1
  • docs/ADRs/2023-09-01-talkback-integration-tests.md - 1
    • CWE-540: Inclusion of Sensitive Information in Source Code · Line 21-27
Review Details
  • Files reviewed - 17 · Commit Range: ba05674..35414f9
    • .bito.yaml
    • .bito/guidelines/domain-invariants.txt
    • .bito/guidelines/repo-truth-and-boundaries.txt
    • .bito/guidelines/review-posture.txt
    • AGENTS.md
    • ARCHITECTURE.md
    • CONTRIBUTING.md
    • README.md
    • docs/ADRs/2017-08-31-yargs-cli-framework.md
    • docs/ADRs/2021-09-01-semantic-release.md
    • docs/ADRs/2022-07-29-typescript-adoption.md
    • docs/ADRs/2023-09-01-talkback-integration-tests.md
    • docs/ADRs/2025-11-14-gha-publishing.md
    • docs/ADRs/2025-12-02-lavamoat-allow-scripts.md
    • docs/ADRs/2026-04-10-yao-pkg-standalone-binaries.md
    • docs/ADRs/2026-04-22-cma-v12-migration.md
    • docs/ADRs/README.md
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jared.jolton@contentful.com.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread docs/ADRs/2018-08-30-talkback-integration-tests.md
@bito-code-review
Copy link
Copy Markdown

✅ Review Settings Overridden

Status: Overridden Successfully

Guidelines:

  • Accepted:

    • General : Domain Invariants
  • Rejected: Review Posture (parse error),Repo Truth And Alignment (parse error)

Note: Extra guidelines beyond 3 general purpose guidelines and 1 language specific guideline per language are not processed. Guidelines are fetched from the source branch.

… downstream

- Semantic-release ADR: 2021-09-01 → 2019-02-21 (actual adoption date, PR #122)
- Talkback ADR: 2023-09-01 → 2018-08-30 (actual introduction date)
- ADR index: reordered chronologically with corrected dates
- ARCHITECTURE.md: fix lib/config.js description (command auth lists, not config management)
- ARCHITECTURE.md: improve lib/context.js description (reads .contentfulrc.json)
- ARCHITECTURE.md: add sync command to top-level commands list and overview
- ARCHITECTURE.md: label @yao-pkg/pkg as dev dependency
- ARCHITECTURE.md: remove speculative EDS SDK downstream integration
- CONTRIBUTING.md: clarify Node >=22 supported alongside .nvmrc 24
@bito-code-review
Copy link
Copy Markdown

bito-code-review Bot commented May 4, 2026

Code Review Agent Run #ef1299

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 35414f9..7f31afa
    • ARCHITECTURE.md
    • CONTRIBUTING.md
    • docs/ADRs/README.md
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jared.jolton@contentful.com.

Documentation & Help

AI Code Review powered by Bito Logo

@michaelphamcf Michael Pham (michaelphamcf) changed the title docs: seed Golden Context docs: golden context [] May 4, 2026
Copy link
Copy Markdown

@bito-code-review bito-code-review Bot left a comment

Choose a reason for hiding this comment

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

Code Review Agent Run #c3f511

Actionable Suggestions - 2
  • ARCHITECTURE.md - 2
Review Details
  • Files reviewed - 3 · Commit Range: 7f31afa..15b54a7
    • ARCHITECTURE.md
    • AGENTS.md
    • docs/specs/README.md
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jared.jolton@contentful.com.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread ARCHITECTURE.md
Comment thread ARCHITECTURE.md Outdated
Address gaps identified by newcomer simulation (15/23 → target ≥80%):
- CONTRIBUTING: add type-check command, linting status note, direct-run examples, new command template
- AGENTS.md: add sensitive areas table, operational model section

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- CONTRIBUTING: clarify CLI is not a service (no npm start)
- AGENTS.md: add release diagnosis guidance (GitHub Issues, Slack, npm stats)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bito-code-review
Copy link
Copy Markdown

bito-code-review Bot commented May 4, 2026

Code Review Agent Run #67a29f

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 15b54a7..3c9887c
    • AGENTS.md
    • CONTRIBUTING.md
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jared.jolton@contentful.com.

Documentation & Help

AI Code Review powered by Bito Logo

- Add provenance markers to all agent-generated files
- ARCHITECTURE.md: add Domain Concepts section, add Operational Knowledge
  section (Deployment, Failure Modes, Monitoring, Incident Playbook)
- CONTRIBUTING.md: add source citations on all commands, add Code Style
  section, add File-Level Guidance table (moved from AGENTS.md)
- AGENTS.md: refactor to pure routing table — move sensitive files to
  CONTRIBUTING.md, move operational model to ARCHITECTURE.md, add new
  Quick Reference pointers for moved sections
- README.md: add provenance marker to agent section

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@bito-code-review bito-code-review Bot left a comment

Choose a reason for hiding this comment

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

Code Review Agent Run #7d849a

Actionable Suggestions - 2
Review Details
  • Files reviewed - 4 · Commit Range: 3c9887c..83981eb
    • AGENTS.md
    • ARCHITECTURE.md
    • CONTRIBUTING.md
    • README.md
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jared.jolton@contentful.com.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread CONTRIBUTING.md Outdated
Comment thread CONTRIBUTING.md Outdated
@michaelphamcf Michael Pham (michaelphamcf) marked this pull request as ready for review May 4, 2026 21:47
@michaelphamcf Michael Pham (michaelphamcf) requested a review from a team as a code owner May 4, 2026 21:47
- Standalone binaries can target Node 22, matching the runtime requirement
- Binary artifacts are attached to GitHub releases as `.zip` files (macOS, Linux, Windows)
- E2E tests validate the binaries work correctly on ubuntu and macOS runners
- ARM/Apple Silicon macOS binaries are not built — macOS x64 runs via Rosetta 2
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

today I learned.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…vely

Preserves the original file structure and tone, appends Golden Context
enrichments below a clear separator with provenance marker.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@michaelphamcf Michael Pham (michaelphamcf) changed the title docs: golden context [] docs: golden context [DX-1029] May 5, 2026
- Setup: npm ci + allow-scripts instead of npm install/yarn
- Code style: ESLint + Prettier instead of standard
- Integration tests: talkback starts automatically via concurrently, not after build:standalone
- Tests run in Node.js only (not browser), Babel used for Jest transpilation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Already covered in the Setup section above.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The sync command (space sync between regions) is registered and working.
It was incorrectly removed in an earlier commit based on a wrong assumption
that it wasn't in config.js — but config.js only tracks auth/space-id
exemptions, not command registration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…editorconfig

- .eslintrc.json → .eslintrc.js (actual filename)
- ES2022 → es2016 (actual tsconfig target)
- Remove .editorconfig reference (file doesn't exist)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bito-code-review
Copy link
Copy Markdown

bito-code-review Bot commented May 5, 2026

Code Review Agent Run #b46188

Actionable Suggestions - 0
Review Details
  • Files reviewed - 18 · Commit Range: ba05674..5fbad05
    • .bito.yaml
    • .bito/guidelines/domain-invariants.txt
    • .bito/guidelines/repo-truth-and-boundaries.txt
    • .bito/guidelines/review-posture.txt
    • AGENTS.md
    • ARCHITECTURE.md
    • CONTRIBUTING.md
    • README.md
    • docs/ADRs/2017-08-31-yargs-cli-framework.md
    • docs/ADRs/2018-08-30-talkback-integration-tests.md
    • docs/ADRs/2019-02-21-semantic-release.md
    • docs/ADRs/2022-07-29-typescript-adoption.md
    • docs/ADRs/2025-11-14-gha-publishing.md
    • docs/ADRs/2025-12-02-lavamoat-allow-scripts.md
    • docs/ADRs/2026-04-10-yao-pkg-standalone-binaries.md
    • docs/ADRs/2026-04-22-cma-v12-migration.md
    • docs/ADRs/README.md
    • docs/specs/README.md
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jared.jolton@contentful.com.

Documentation & Help

AI Code Review powered by Bito Logo

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.

3 participants