Skip to content

feat(cli): check for stale metadata before graph indexing #38

@lsmonki

Description

@lsmonki

Summary

specd graph index should check for stale/missing spec metadata before indexing and prompt the user to regenerate it.

Motivation

Since commit 13597ee, the indexer no longer falls back to parsing spec.md for title and dependsOn — it uses .specd-metadata.yaml exclusively (defaulting to title = specId, description = '', dependsOn = [] when metadata is absent). This is correct, but means specs without up-to-date metadata will be indexed with degraded information.

A pre-flight check would catch this and give the user the chance to fix it before indexing.

Proposed behavior

  1. Before opening the provider, run the equivalent of spec list --metadata-status stale,missing,invalid
  2. If any specs are found:
    • In interactive TTY mode: display the list and ask "Regenerate metadata before indexing? [Y/n]"
    • If yes: run spec generate-metadata for each, then proceed with indexing
    • If no: proceed with indexing (specs will use default title/empty dependsOn)
    • In non-interactive mode (CI, piped): print a warning to stderr and proceed

Notes

  • This is a CLI-layer concern only — @specd/code-graph should not depend on metadata generation
  • The check uses Kernel.specs which is already available via resolveCliContext()
  • Could also support --regenerate-metadata flag to skip the prompt

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    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