Skip to content

Commit ce0e0f6

Browse files
committed
Organize secondary commands under tools
1 parent 1255dac commit ce0e0f6

27 files changed

Lines changed: 940 additions & 405 deletions

CLAUDE.md

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@ liquid-spec is a test suite and CLI for testing Liquid template implementations.
1313
gem install specific_install
1414
gem specific_install https://github.com/Shopify/liquid-spec
1515

16-
# See top-level commands
16+
# The top level stays focused on init, docs, run, and bench.
1717
liquid-spec help
1818

19+
# Inspection, comparison, generated coverage, and contributor checks live here.
20+
liquid-spec tools help
21+
1922
# Generate starter adapters. With no FILE, init creates both:
20-
# liquid_adapter.rb and liquid_adapter_jsonrpc.rb
23+
# specs/adapter.rb and specs/adapter-jsonrpc.rb
2124
liquid-spec init
2225
liquid-spec init my_adapter.rb
23-
liquid-spec init --jsonrpc liquid_adapter_jsonrpc.rb
26+
liquid-spec init --jsonrpc
2427

2528
# Run specs with an adapter
2629
liquid-spec run examples/liquid_ruby.rb
@@ -39,23 +42,24 @@ liquid-spec run my_adapter.rb -l
3942
liquid-spec run my_adapter.rb --list-suites
4043

4144
# Inspect/debug a specific spec in detail
42-
liquid-spec inspect my_adapter.rb -n "case.*empty"
45+
liquid-spec tools inspect my_adapter.rb -n "case.*empty"
4346

4447
# Quick YAML-spec eval against an adapter, usually with reference comparison
45-
cat my_spec.yml | liquid-spec eval my_adapter.rb --compare
46-
liquid-spec eval my_adapter.rb --spec=my_spec.yml --compare
48+
cat my_spec.yml | liquid-spec tools eval my_adapter.rb --compare
49+
liquid-spec tools eval my_adapter.rb --spec=my_spec.yml --compare
4750

4851
# Generated differential coverage after the recorded ramp is green
49-
liquid-spec mutate my_adapter.rb --around=for_loops
50-
liquid-spec fuzz my_adapter.rb --seed=1234 --json
51-
liquid-spec stress my_adapter.rb --depth=64
52+
liquid-spec tools mutate my_adapter.rb --around=for_loops
53+
liquid-spec tools fuzz my_adapter.rb --seed=1234 --json
54+
liquid-spec tools stress my_adapter.rb --depth=64
5255

5356
# Benchmarks, cross-adapter matrices, reports, feature docs, implementer docs
5457
liquid-spec bench
5558
liquid-spec bench my_adapter.rb
56-
liquid-spec matrix --all
57-
liquid-spec report
58-
liquid-spec features
59+
liquid-spec tools matrix --all
60+
liquid-spec tools report
61+
liquid-spec tools features
62+
liquid-spec tools check # runs every verifier in scripts/verifiers/
5963
liquid-spec docs curriculum
6064
```
6165

@@ -84,7 +88,7 @@ When every run spec passes (0 failures, level = max), a **Congrats** addendum pr
8488
suggested paths forward: implement an optional feature that actually had specs skipped
8589
this run (listed dynamically from the skipped-features set, filtered through
8690
`Features::FEATURE_DOCS` to `:optional`, excluding Ruby-interop `:unnecessary` ones),
87-
run `--bench` for performance, or run a matrix test / contribute back to liquid-spec.
91+
run `liquid-spec bench <adapter>` for performance, or use a matrix tool / contribute back to liquid-spec.
8892

8993

9094
### Spec Quality Gates
@@ -112,15 +116,17 @@ The spec-quality portion currently enforces:
112116

113117
### `rake check` — spec verifiers
114118

115-
`rake check` runs all verifiers in `scripts/verifiers/` in-process. Each
116-
verifier is a standalone Ruby script that prints findings (never modifies
119+
`liquid-spec tools check` runs all verifiers in `scripts/verifiers/` in-process;
120+
`rake check` is the contributor-task equivalent. Each verifier is a standalone Ruby
121+
script that prints findings (never modifies
117122
files) and returns 0 on success or non-zero on violations. Verifiers marked
118123
`# advisory: true` in their header are non-blocking — they report known debt
119124
but don't fail the overall check.
120125

121126
```bash
122-
rake check # run all verifiers
123-
rake prepush # run unit tests then all verifiers (standard pre-push gate)
127+
liquid-spec tools check # run all verifiers through the CLI
128+
rake check # equivalent contributor task
129+
rake prepush # run unit tests then all verifiers (standard pre-push gate)
124130
```
125131

126132
You can also run individual verifiers directly:
@@ -650,7 +656,7 @@ end
650656

651657
### Available Features
652658

653-
Feature selection is denylist-based. Leave `missing_features` empty to try everything, or add unsupported capabilities while the implementation is still growing. Use `liquid-spec features` (backed by `lib/liquid/spec/cli/features.rb`) as the source of truth for the current feature inventory and recommendations.
659+
Feature selection is denylist-based. Leave `missing_features` empty to try everything, or add unsupported capabilities while the implementation is still growing. Use `liquid-spec tools features` (backed by `lib/liquid/spec/cli/features.rb`) as the source of truth for the current feature inventory and recommendations.
654660

655661
**Common features to list in `missing_features`:**
656662
- `:drops` - Adapter cannot support the standard test drop library yet (see docs/test_drops.md)
@@ -676,7 +682,7 @@ Feature selection is denylist-based. Leave `missing_features` empty to try every
676682

677683
JSON-RPC is the main path for non-Ruby Liquid implementations. Keep it especially well documented and tested.
678684

679-
- Generate with `liquid-spec init --jsonrpc my_adapter.rb`. Running `liquid-spec init` with no filename generates both `liquid_adapter.rb` and `liquid_adapter_jsonrpc.rb`.
685+
- Generate with `liquid-spec init --jsonrpc my_adapter.rb`. Running `liquid-spec init` with no filename generates both `specs/adapter.rb` and `specs/adapter-jsonrpc.rb`.
680686
- The generated JSON-RPC adapter is executable/self-launching; use `--command=...` when you need to point it at a separate server command.
681687
- The server implements `initialize`, `compile`, `render`, and `quit` over newline-delimited JSON-RPC on stdin/stdout.
682688
- Server logs must go to stderr, never stdout.
@@ -695,7 +701,7 @@ ruby -Ilib -I$LIQUID bin/liquid-spec run examples/json_rpc_ruby_liquid.rb -n '^e
695701

696702
## The Eval Tool
697703

698-
The `liquid-spec eval` command is the primary tool for testing individual templates and discovering behavioral differences. **Always use `--compare`** to validate your implementation against the reference liquid-ruby.
704+
The `liquid-spec tools eval` command is the primary tool for testing individual templates and discovering behavioral differences. **Always use `--compare`** to validate your implementation against the reference liquid-ruby.
699705

700706
### Why Use Eval?
701707

@@ -711,7 +717,7 @@ The `liquid-spec eval` command is the primary tool for testing individual templa
711717

712718
```bash
713719
# Quick test with automatic comparison to reference
714-
cat <<'EOF' | liquid-spec eval adapter.rb --compare
720+
cat <<'EOF' | liquid-spec tools eval adapter.rb --compare
715721
name: test_upcase_literal
716722
complexity: 40
717723
template: "{{ 'hello' | upcase }}"
@@ -720,7 +726,7 @@ hint: "The upcase filter should uppercase a string literal."
720726
EOF
721727
722728
# Test with environment variables
723-
cat <<'EOF' | liquid-spec eval adapter.rb --compare
729+
cat <<'EOF' | liquid-spec tools eval adapter.rb --compare
724730
name: test_array_size
725731
complexity: 40
726732
template: "{{ x | size }}"
@@ -731,15 +737,15 @@ hint: "The size filter returns array length."
731737
EOF
732738
733739
# Or read from a file
734-
liquid-spec eval adapter.rb --spec=my_test.yml --compare
740+
liquid-spec tools eval adapter.rb --spec=my_test.yml --compare
735741
```
736742

737743
### Using --compare (Recommended)
738744

739745
The `--compare` flag runs your template against the reference liquid-ruby implementation first, then compares results. This is the best way to find behavioral differences:
740746

741747
```bash
742-
cat <<'EOF' | liquid-spec eval adapter.rb --compare
748+
cat <<'EOF' | liquid-spec tools eval adapter.rb --compare
743749
name: test_filter
744750
template: "{{ 'hi' | upcase }}"
745751
expected: "HI"
@@ -763,7 +769,7 @@ For complex tests, use YAML input via stdin or file:
763769

764770
```bash
765771
# From stdin (heredoc) - great for multi-line templates
766-
cat <<EOF | liquid-spec eval adapter.rb --compare
772+
cat <<EOF | liquid-spec tools eval adapter.rb --compare
767773
name: test_for_loop_with_break
768774
hint: "break should exit the loop immediately"
769775
complexity: 120
@@ -781,7 +787,7 @@ expected: |
781787
EOF
782788
783789
# From a YAML file
784-
liquid-spec eval adapter.rb --spec=my_test.yml --compare
790+
liquid-spec tools eval adapter.rb --spec=my_test.yml --compare
785791
```
786792

787793
### Spec YAML Format

0 commit comments

Comments
 (0)