-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Context
Multi-package repositories (e.g., dart_custom_lint with 5 sub-packages) now have hierarchical support for changelogs and release notes — the compose and release-notes commands call SubPackageUtils.enrichPromptWithSubPackages() to inject per-package diff context and formatting instructions into the Gemini prompt, producing output like:
## [0.8.3] - 2026-02-24
### Summary
High-level summary covering ALL packages...
### custom_lint
#### Added
- ...
### custom_lint_core
#### Fixed
- ...However, autodoc (module documentation) and documentation (README.md generation) remain single-package-aware. This issue tracks adding hierarchical sub-package support to both.
Current State
| Artifact | Command | Sub-Package Support | Hierarchical Format |
|---|---|---|---|
| CHANGELOG.md | compose |
Full | Yes — per-package sections |
| Release Notes | release-notes |
Full | Yes — per-package sections |
| Module Autodocs | autodoc |
None | None |
| README.md | documentation |
None | None |
Problem
1. Autodoc (lib/src/cli/commands/autodoc_command.dart)
The autodoc command generates per-module documentation via autodoc.json configuration. Each module is documented independently with Gemini Pass 1 (Author) and Pass 2 (Reviewer). For multi-package repos:
- No sub-package grouping — modules from different sub-packages are documented in a flat list without knowing which package they belong to
- No cross-package awareness — Gemini can't describe how modules in
custom_lint_corerelate to modules incustom_lint_builder - No hierarchical output structure — generated docs don't organize by sub-package
- No call to
enrichPromptWithSubPackages()— the prompt lacks multi-package context entirely
2. Documentation (lib/src/cli/commands/documentation_command.dart)
The documentation command updates README.md using Gemini with commit_analysis.json and the current README as context:
- Treats repo as monolithic — no awareness of sub-package structure
- No per-package README generation — each sub-package may want its own README section or file
- No call to
enrichPromptWithSubPackages()— Gemini doesn't know which changes belong to which package
Implementation Plan
Phase 1: Autodoc Sub-Package Awareness
-
Extend
autodoc.jsonschema to support optionalsub_packagefield per module entry- When present, associates the module with a specific sub-package for grouping
- Example:
{ "modules": [ { "name": "custom_lint_core/analyzer", "sub_package": "custom_lint_core", "paths": ["packages/custom_lint_core/lib/src/analyzer/"], "description": "Core analyzer integration" } ] }
-
Enrich autodoc prompts with sub-package context
- Before running Gemini for each module, inject
SubPackageUtils.buildSubPackageDiffContext()context - Include which sub-package the module belongs to in the prompt
- Add cross-references: "This module is part of
custom_lint_core, which is used bycustom_lintandcustom_lint_builder"
- Before running Gemini for each module, inject
-
Organize generated docs hierarchically
- Group output files under
docs/{sub_package}/directories - Generate a top-level
docs/README.mdindex that links to per-package doc directories - Maintain backward compatibility: repos without sub-packages keep flat
docs/structure
- Group output files under
-
Update autodoc hashing to include sub-package metadata
- Incremental rebuild should detect when a module's sub-package assignment changes
Phase 2: Documentation Sub-Package Awareness
-
Call
enrichPromptWithSubPackages()inDocumentationCommand- Inject per-package diff context into the README generation prompt
- Add
buildHierarchicalDocumentationInstructions()toSubPackageUtils(new method, modeled after the existing changelog/release-notes instruction builders)
-
Hierarchical README structure
- Top-level summary covering the entire repo
- Per-package sections with package-specific details
- Example output:
# dart_custom_lint > A powerful custom lint framework for Dart and Flutter. ## Packages ### custom_lint The main CLI and plugin host... ### custom_lint_core Shared data models and utilities... ### custom_lint_builder Analyzer plugin integration...
-
Optional per-package README files
- Generate/update
{sub_package_path}/README.mdfor each sub-package - Cross-link between root README and per-package READMEs
- Generate/update
Phase 3: Pipeline Integration
-
Update release template to pass sub-package info through to autodoc and documentation stages
- The commands already receive
--repo-root, soloadSubPackages()can discover config automatically - No workflow template changes needed if commands self-discover
- The commands already receive
-
Update step summaries to show per-package doc generation stats
Files to Modify
Autodoc
lib/src/cli/commands/autodoc_command.dart— addenrichPromptWithSubPackages()call, organize output by sub-packagelib/src/cli/utils/sub_package_utils.dart— possibly addbuildHierarchicalAutodocInstructions()- Autodoc prompt templates (if they exist as separate files)
Documentation
lib/src/cli/commands/documentation_command.dart— addenrichPromptWithSubPackages()calllib/src/cli/utils/sub_package_utils.dart— addbuildHierarchicalDocumentationInstructions()
Shared
- Possibly
lib/src/cli/utils/sub_package_utils.dart— new instruction builder methods
Acceptance Criteria
-
autodoccommand generates docs grouped by sub-package whensub_packagesconfig exists -
autodocGemini prompts include which sub-package a module belongs to -
documentationcommand generates hierarchical README with per-package sections - Both commands gracefully fall back to current behavior for single-package repos
-
dart analyzepasses with zero issues - Generated docs render correctly in GitHub markdown preview
Related Work
- PR feat: multi-package support for CLI commands #18 — feat/multi-package-support (merged, added
SubPackageUtilsand hierarchical changelog/release-notes) feat/audit-commandsbranch — added pubspec audit infrastructure + sibling dep conversionconfigs/external_workspace_packages.yaml— all 5dart_custom_lintsub-packages registered withtag_patternandgit_path