Skip to content

feat: gts validator cli#69

Merged
Artifizer merged 1 commit intoGlobalTypeSystem:mainfrom
devjow:feat/validator-install
Mar 5, 2026
Merged

feat: gts validator cli#69
Artifizer merged 1 commit intoGlobalTypeSystem:mainfrom
devjow:feat/validator-install

Conversation

@devjow
Copy link
Copy Markdown
Contributor

@devjow devjow commented Feb 26, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added gts-validator CLI binary for validating GTS identifiers in Markdown, JSON, YAML, and YAML-like files with support for vendor enforcement, exclude patterns, output formatting options, and strict mode.
  • Documentation

    • Updated README with CLI installation instructions, usage examples, and output formatting guidance; added library API usage examples.
  • Tests

    • Added comprehensive CLI integration tests covering help output, JSON validation, vendor enforcement, and edge cases.

Signed-off-by: devjow <me@devjow.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 26, 2026

📝 Walkthrough

Walkthrough

Introduces a CLI binary for gts-validator alongside documentation and tests. Adds clap-based argument parsing, filesystem scanning entry point, and output formatting. Includes CI smoke test for build validation and integration tests covering help, JSON output, vendor enforcement, strict mode, and default path resolution.

Changes

Cohort / File(s) Summary
Build and Configuration
gts-validator/Cargo.toml, .github/workflows/ci.yml
Adds binary target for the new CLI and clap dependency; introduces CI smoke test to verify CLI builds and executes successfully.
Documentation
gts-validator/README.md
Expands docs to cover dual-use (library and CLI), adds CLI usage with installation and examples, updates library examples to reflect API changes (VendorPolicy, scanned_files, errors_count()), removes color parameter references.
CLI Implementation and Tests
gts-validator/src/main.rs, gts-validator/tests/cli_tests.rs
Implements CLI binary with clap-based argument parsing for paths, vendor enforcement, filtering, output format, and strict mode; integration tests verify help output, JSON/human formatting, vendor validation, --scan-keys behavior, --skip-token toggling, --strict mode, and default path handling.

Sequence Diagram

sequenceDiagram
    participant User as CLI User
    participant Clap as Clap Parser
    participant Main as main.rs
    participant Lib as gts_validator Lib
    participant Output as Output Module
    participant Exit as Process Exit

    User->>Clap: Provide CLI arguments
    Clap->>Main: Parsed Cli struct
    Main->>Main: Build FsSourceConfig &<br/>ValidationConfig
    Main->>Lib: validate_fs(configs)
    Lib->>Lib: Scan filesystem &<br/>validate identifiers
    Lib->>Main: Return ValidationReport
    Main->>Output: Format report (JSON or<br/>human-readable)
    Output->>Main: Formatted string
    Main->>User: Print output
    Main->>Exit: Exit with code<br/>(SUCCESS or FAILURE)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Poem

🐰 A CLI is born, so neat and fine,
With clap and args arranged in line,
The validator now stands tall and proud,
From command-line calls, both clear and loud,
Vendor checks and formats bright—
The magic CLI shines just right! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 77.78% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: gts validator cli' directly and accurately summarizes the main change: introducing a new CLI binary for the gts-validator tool.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
gts-validator/src/main.rs (1)

80-83: Improve empty-path error context.

The current error is actionable but terse; including searched defaults improves CLI UX/debuggability.

💡 Suggested tweak
 if paths.is_empty() {
-    eprintln!("No existing paths to scan. Provide paths explicitly.");
+    eprintln!(
+        "No existing paths to scan. Searched defaults: {}. Provide paths explicitly.",
+        DEFAULT_SCAN_DIRS.join(", ")
+    );
     return ExitCode::FAILURE;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@gts-validator/src/main.rs` around lines 80 - 83, Update the empty-path error
to include the default search paths attempted so users see what was checked; in
the block where you check paths.is_empty() (the variable paths in main or the
CLI entrypoint) change the eprintln! to print a message that lists the default
paths variable or function (e.g., DEFAULT_PATHS or the result of
default_search_paths()) along with the existing hint to provide explicit paths,
then return ExitCode::FAILURE as before.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@gts-validator/src/main.rs`:
- Around line 80-83: Update the empty-path error to include the default search
paths attempted so users see what was checked; in the block where you check
paths.is_empty() (the variable paths in main or the CLI entrypoint) change the
eprintln! to print a message that lists the default paths variable or function
(e.g., DEFAULT_PATHS or the result of default_search_paths()) along with the
existing hint to provide explicit paths, then return ExitCode::FAILURE as
before.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd8ed5b and ee08ba1.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • .github/workflows/ci.yml
  • gts-validator/Cargo.toml
  • gts-validator/README.md
  • gts-validator/src/main.rs
  • gts-validator/tests/cli_tests.rs

@Artifizer Artifizer merged commit baff807 into GlobalTypeSystem:main Mar 5, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants