Skip to content

Add lint command for StructKit YAML definitions#141

Draft
httpdss wants to merge 2 commits intomainfrom
codex/implement-feature-from-issue-137
Draft

Add lint command for StructKit YAML definitions#141
httpdss wants to merge 2 commits intomainfrom
codex/implement-feature-from-issue-137

Conversation

@httpdss
Copy link
Copy Markdown
Owner

@httpdss httpdss commented May 8, 2026

Motivation

  • Provide a targeted linting command to detect quality and safety issues in StructKit YAML definitions that go beyond schema validation, such as unpinned remote URLs, risky hooks, undeclared/unused variables, duplicates and naming problems.

Description

  • Add a new CLI subcommand lint implemented in structkit/commands/lint.py with support for multiple targets, --all, -s/--structures-path, and --json output.
  • Implement a suite of lint checks including baseline schema validation via ValidateCommand helpers, missing top-level description, duplicate file/folder entries, undeclared and unused template variables, suspicious/unsafe hook patterns, unpinned GitHub/raw URLs, and invalid entry names.
  • Register the lint subcommand in get_parser() in structkit/main.py and document the command, rules, usage and examples in docs/cli-reference.md.
  • Add focused unit tests in tests/test_lint_command.py that cover command registration, variable/template checks, duplicates, hook and remote URL detection, JSON output and error exit behavior, and --all discovery.

Testing

  • Ran pytest tests/test_lint_command.py and the tests passed (7 passed).
  • Ran the full test suite with pytest and all tests passed (161 passed).
  • Exercised the CLI end-to-end with python -m structkit.main lint --all --json which produced a JSON report of warnings/errors and returned non-zero exit when errors were present as expected.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant