Skip to content

[Feature] Add tnmsc check command: front matter validation, language detection, path existence, AI-friendly fix prompts #25

@TrueNine

Description

@TrueNine

Feature Description

Add tnmsc check as a full pipeline that runs validation and existence checks before or instead of sync, with AI-friendly, copyable prompt output for fixing issues.

Scope of the check command:

  1. Simple front matter format check — Validate YAML front matter syntax and required/shape of fields per prompt type (skill, rule, fast command, sub-agent, etc.).
  2. Simple front matter field language detection — Detect language of text fields (e.g. description, name) to spot mismatches (e.g. config expects Chinese but field is in English) and report for consistency or i18n.
  3. Existence checks for configured paths — Verify that src / dist and key paths exist: e.g. skill.src, rule.src, fastCommand.src, globalMemory.src, workspaceMemory.src, project.src / app, rules, and that expected files or directories are present under shadow source project and workspace.
  4. Friendly, copyable, AI-friendly output — Emit errors and suggestions in a format that is easy to copy and paste into an AI chat (e.g. structured bullet list or a single block of prompt text) so users can get “fix this” prompts and apply fixes with minimal editing.

Problem Statement

  • Current behaviour: tnmsc has no dedicated check subcommand. Config validation happens at load time (e.g. in ConfigLoader); front matter is parsed during the sync pipeline. There is no single command to “only validate” the repo and get a clear, actionable report.
  • Problem: Users cannot quickly validate front matter format, field language, or path existence without running a full sync or inspecting code. When something fails, getting an AI-friendly, copy-pasteable description of what’s wrong and how to fix it is cumbersome.

Proposed Solution (Optional)

  • Introduce a check subcommand that:
    • Loads the same config as sync (including shadowSourceProject and path pairs).
    • Runs: (1) front matter format validation per file type, (2) optional language detection on front matter text fields, (3) existence checks for all configured src/dist and key dirs (e.g. src/skills, src/rules, app, app/global.cn.mdx).
    • Outputs a report (CLI + optional JSON) and, for each error or warning, a short “prompt snippet” that the user can copy into an AI to request a fix (e.g. “Fix the following: …” with file path, current content snippet, and expected shape).
  • Reuse existing types and config (e.g. ShadowSourceProjectConfig, ConfigLoader) so check stays aligned with sync behaviour.

User Scenario

  1. User runs tnmsc check in a workspace (or with --config).
  2. CLI validates front matter format and optional language of fields, then checks existence of src, app, rules, and other configured paths.
  3. For each issue, CLI prints a clear message and a copyable, AI-friendly prompt block (e.g. “Copy the following to your AI assistant to fix: …”).
  4. User copies the block into Cursor/Claude/etc., gets a suggested fix, and re-runs tnmsc check until clean (then runs tnmsc sync as needed).

Expected Outcome

  • New subcommand check (e.g. in Subcommand and VALID_SUBCOMMANDS in PluginPipeline.ts).
  • A CheckCommand (or equivalent) that runs the validation pipeline and prints:
    • Front matter format errors (and optionally warnings) per file.
    • Optional language-detection results for front matter text fields.
    • Existence check results for configured paths (e.g. skill.src, rule.src, app, rules, globalMemory.src, etc.).
    • For each finding: a short, copyable, AI-friendly prompt snippet for error fixing.
  • Output format: human-readable by default, with optional machine-readable (e.g. --json) for tooling.
  • Scope: CLI only; affected areas: cli/src/PluginPipeline.ts, cli/src/commands/, config loading and path resolution, plus optional use of @truenine/md-compiler for front matter parsing.

Context Information

  • Branch: dev
  • Latest commit: 83fe32b chore: update version number in package.json to 2026.10219.10518
  • OS: Windows (win32)
  • Relevant config: ShadowSourceProjectConfig defines skill, fastCommand, subAgent, rule, globalMemory, workspaceMemory, project with src/dist pairs (e.g. src/skills, src/rules, app, app/global.cn.mdx). No check subcommand exists today.

Additional Notes

  • Consider --fix or a separate “suggest” mode that outputs suggested edits without writing (e.g. for AI to consume).
  • Language detection can be best-effort (e.g. script/locale hints) to avoid heavy dependencies; focus on “likely wrong language” hints for key fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions