Skip to content

validate-toc: no way to disable/scope the toc-missing rule (hardcoded, ignores config) #53

Description

@ffedoroff

Summary

cfs validate-toc enforces a toc-missing rule on every Markdown file with headings, and there is no way to disable or scope it. The command accepts only --max-level and --verbose; it reads no workspace/project config and has no --ignore, no require_toc=false, and no min-heading threshold.

This makes it impractical to run across a real docs tree, where small reference docs (e.g. a 3-heading installation.md) legitimately don't want a Table of Contents.

Steps to reproduce

cfs validate-toc docs/installation.md   # 3 headings, no TOC
✗ {'code': 'toc-missing',
   'message': 'Document has headings but no Table of Contents section', ...}

Running it over a whole docs/ tree flags every TOC-less file:

✗ 31 file(s) validated, 23 error(s) found.

All 23 are toc-missing — not malformed TOCs, just files that have no TOC by design.

Root cause

The rule is hardcoded in the validator (skills/studio/scripts/studio/utils/toc.py):

# 1. TOC exists?
if toc_info is None:
    errors.append(error(
        "toc",
        "Document has headings but no Table of Contents section",
        code=EC.TOC_MISSING,
        ...
    ))

The CLI command (commands/validate_toc.py) parses only files, --max-level, --verbose and reads no config.

Inconsistency with the validate pipeline

The artifact pipeline already has a gate for this — utils/constraints.py:

# Phase 1b: TOC validation (only when toc=true in constraints)
if getattr(constraints, "toc", True):
    ...

So a registered artifact can opt out via toc = false in the kit's constraints.toml, but the standalone cfs validate-toc command ignores that flag entirely and cannot be turned off.

Requested change

Give validate-toc an off-switch / scoping, consistent with how check-language already reads policy from workspace config. Any of:

  1. Workspace config under [validation], e.g.
    [validation]
    require_toc = false          # disable the toc-missing rule outright
    toc_min_headings = 8         # only require a TOC past N headings
    toc_ignore_paths = ["docs/reference/**", "**/README.md"]
  2. CLI flags mirroring check-language: --ignore <glob> (repeatable) and a --no-require-toc / --min-headings N.
  3. At minimum, have the standalone command honor the same toc = false constraint that the validate pipeline already respects.

Environment

  • engine: v1.5.9
  • kit sdlc: v1.2.1
  • proxy: constructor-studio 0.1.dev1 (Python 3.14)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions