# _docs/_repo-config.yaml — schema and example
#
# Generated by monorepo-discover. Reviewed by a human. Consumed by:
#   - monorepo-document  (reads docs.* and components.*.primary_doc/secondary_docs)
#   - monorepo-cicd      (reads ci.* and components.*.ci_config)
#   - monorepo-onboard   (reads all sections; writes new component entries)
#   - monorepo-status    (reads all sections; writes nothing)
#
# Every entry has a `confirmed:` flag:
#   true  = human reviewed and approved
#   false = inferred by monorepo-discover; needs review
# And an `evidence:` list documenting why discovery made the inference.

# ---------------------------------------------------------------------------
# Metadata
# ---------------------------------------------------------------------------
version: 1
last_updated: 2026-04-17
confirmed_by_user: false  # HUMAN ONLY: flip to true after reviewing

# ---------------------------------------------------------------------------
# Repo identity
# ---------------------------------------------------------------------------
repo:
  name: example-monorepo
  type: git-submodules  # git-submodules | npm-workspaces | cargo-workspace | pnpm-workspace | go-workspace | adhoc
  component_registry: .gitmodules
  root_readme: README.md
  work_branch: dev

# ---------------------------------------------------------------------------
# Components
# ---------------------------------------------------------------------------
components:
  - name: annotations
    path: annotations/
    stack: .NET 10
    confirmed: true
    evidence: [gitmodules_entry, csproj_present]
    primary_doc: _docs/01_annotations.md
    secondary_docs:
      - _docs/00_database_schema.md
      - _docs/00_roles_permissions.md
    ci_config: annotations/.woodpecker/
    deployment_tier: api-layer
    ports:
      - "5001/http"
    depends_on: []
    env_vars:
      - ANNOTATIONS_DB_URL

  - name: loader
    path: loader/
    stack: Python 3.12
    confirmed: false  # inferred, needs review
    evidence: [gitmodules_entry, pyproject_present]
    primary_doc: _docs/07_admin.md
    primary_doc_section: "Model delivery"
    secondary_docs:
      - _docs/00_top_level_architecture.md
    ci_config: loader/.woodpecker/
    deployment_tier: edge
    ports: []
    depends_on: [admin]
    env_vars: []

# ---------------------------------------------------------------------------
# Documentation
# ---------------------------------------------------------------------------
docs:
  root: _docs/
  index: _docs/README.md
  file_convention: "NN_<name>.md"
  next_unused_prefix: "13"

  cross_cutting:
    - path: _docs/00_top_level_architecture.md
      owns:
        - deployment topology
        - component communication
        - infrastructure inventory
      confirmed: true

    - path: _docs/00_database_schema.md
      owns:
        - database schema changes
        - ER diagram
      confirmed: true

    - path: _docs/00_roles_permissions.md
      owns:
        - permission codes
        - role-to-feature mapping
      confirmed: true

# ---------------------------------------------------------------------------
# CI/CD
# ---------------------------------------------------------------------------
ci:
  tooling: Woodpecker  # GitHub Actions | GitLab CI | Woodpecker | Drone | Jenkins | ...
  service_registry_doc: ci_steps.md
  orchestration_files:
    - docker-compose.ci.yml
    - docker-compose.run.yml
    - docker-compose.ci-agent-amd64.yml
  install_scripts:
    - ci-server-install.sh
    - ci-client-install.sh
    - ci-agent-amd64-install.sh
  env_template: .env.example
  image_tag_format: "${REGISTRY}/${NAME}:${BRANCH}-${ARCH_TAG}"
  branch_triggers: [stage, main]
  expected_files_per_component:
    - path_glob: "<component>/.woodpecker/build-*.yml"
      required: at-least-one
  pipeline_template: |
    when:
      branch: [stage, main]
    labels:
      platform: arm64
    steps:
      - name: build-push
        image: docker
        commands:
          - docker build -f Dockerfile -t localhost:5000/<service>:${CI_COMMIT_BRANCH}-arm .
          - docker push localhost:5000/<service>:${CI_COMMIT_BRANCH}-arm
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock
  confirmed: false

# ---------------------------------------------------------------------------
# Conventions
# ---------------------------------------------------------------------------
conventions:
  commit_prefix: "[suite]"
  meta_commit_fallback: "[meta]"
  ticket_id_pattern: "AZ-\\d+"
  component_naming: lowercase-hyphen
  deployment_tiers:
    - edge
    - remote
    - operator-station
    - api-layer
  confirmed: false

# ---------------------------------------------------------------------------
# Unresolved questions (populated by monorepo-discover)
# ---------------------------------------------------------------------------
# Every question discovery couldn't resolve goes here. Action skills refuse
# to touch entries that map to `unresolved:` items until the human resolves them.
unresolved:
  - id: satellite-provider-doc-slot
    question: "Component `satellite-provider` has no matching doc. Create new file or extend an existing doc?"
    options:
      - "new _docs/13_satellite_provider.md"
      - "extend _docs/11_gps_denied.md with a Satellite section"
      - "no doc needed (internal utility)"

# ---------------------------------------------------------------------------
# Assumptions log (append-only, audit trail)
# ---------------------------------------------------------------------------
# monorepo-discover appends a new entry each run.
# monorepo-document, monorepo-cicd, monorepo-onboard also append their
# per-run assumptions here so the user can audit what was taken on faith.
assumptions_log:
  - date: 2026-04-17
    skill: monorepo-discover
    run_notes: "Initial discovery"
    assumptions:
      - "Treated _docs/ as unified-docs root (only candidate found)"
      - "Inferred component→doc mappings via name matching for 9/11 components"
      - "Commit prefix [suite] observed in 14 of last 20 commits"
