feat: add schema-validator subagent and helper script (t085)#391
feat: add schema-validator subagent and helper script (t085)#391marcusquinn merged 1 commit intomainfrom
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughIntroduces a schema validator utility orchestrating local npm-driven Schema.org data validation with CLI commands for validating HTML and JSON inputs, dependency management, schema caching, and integration into the SEO audit workflow, alongside documentation and index updates. Changes
Sequence DiagramsequenceDiagram
participant User as User/CLI
participant Validator as schema-validator-helper.sh
participant PM as npm/Package Manager
participant NodeScript as validate.mjs
participant Extractor as `@marbec/web-auto-extractor`
participant AdobeValidator as `@adobe/structured-data-validator`
participant SchemaCache as schemaorg-all-https.jsonld
participant SchemaOrg as Schema.org Remote
User->>Validator: validate <url/file>
activate Validator
Validator->>Validator: Check dependencies
alt Dependencies missing
Validator->>PM: Install packages
PM-->>Validator: Ready
end
Validator->>Validator: Generate validate.mjs
Validator->>NodeScript: Execute validation
activate NodeScript
NodeScript->>Extractor: Extract JSON-LD/Microdata/RDFa
Extractor-->>NodeScript: Structured data
NodeScript->>SchemaCache: Check cached schema
alt Cache valid (< 24h)
SchemaCache-->>NodeScript: Schema
else Cache expired/missing
NodeScript->>SchemaOrg: Fetch latest schema
SchemaOrg-->>NodeScript: Schema
NodeScript->>SchemaCache: Update cache
end
NodeScript->>AdobeValidator: Validate against schema
AdobeValidator-->>NodeScript: Validation results
NodeScript-->>Validator: JSON report
deactivate NodeScript
Validator-->>User: Print results & exit
deactivate Validator
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly Related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Fri Feb 6 06:46:51 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Fix all issues with AI agents
In @.agent/scripts/schema-validator-helper.sh:
- Around line 365-368: The unconditional "return 0" at the end of the function
that contains the case branch (cmd_validate / the function handling validation)
masks any non-zero exit status from the validation commands; remove the final
"return 0" or instead capture and return the branch's exit code (e.g., store the
last command's exit status in a variable and "return" that) so the function
returns the actual validation result rather than always reporting success.
- Around line 162-173: The validate function currently treats any input that
isn't an existing file (checked by fs.existsSync) or an http URL (checked by
input.startsWith('http')) as raw HTML, which hides mistyped file paths; update
validate to add an else branch after the existing file/http checks to throw a
clear Error (or reject) when the input is neither an existing file path nor an
http URL so callers get an explicit "file not found or invalid input" message;
reference the validate function, fs.existsSync, input.startsWith('http'), and
fetchFn when implementing this guard.
- Around line 87-95: The current block that adds '"type": "module"' to
"$TOOL_DIR/package.json" silently continues when jq is missing (command_exists
jq) causing ESM imports in validate.mjs to break; update the conditional to
either (a) add a sed-based fallback that inserts or replaces the "type" field in
place when jq is not available (use a portable sed command that handles JSON
safely for this simple insertion/replacement) targeting "$TOOL_DIR/package.json"
or (b) exit non-zero after printing the warning; modify the branch that now only
calls print_warning to implement the sed fallback (or call exit 1) so
validate.mjs will run under ESM mode, referencing the existing variables and
helpers (TOOL_DIR, command_exists, print_warning, mktemp) and preserving the
tmp/mv atomic update pattern if using sed + temp file.
- Around line 289-299: Replace the direct subshell node invocation with a
conditional so failures don't trigger set -e; e.g., run the node call inside an
if-statement: if (cd "$TOOL_DIR" && node "$JS_SCRIPT" "$node_cmd" "$target");
then exit_code=0; else exit_code=$?; fi — this preserves
target/TOOL_DIR/JS_SCRIPT/node_cmd references, captures the node exit code into
exit_code, allows printing the success/error messages, and lets the script
return $exit_code at the end.
In @.agent/subagent-index.toon:
- Line 80: The TOON index header incorrectly declares "scripts[37]" while there
are 38 script entries; update the header token "TOON:scripts[37]" to
"TOON:scripts[38]" in the .agent/subagent-index.toon file (the TOON:scripts[...]
marker) and re-verify the script count (lines 81–118) so the declared number
matches the actual entries.
🧹 Nitpick comments (1)
.agent/scripts/schema-validator-helper.sh (1)
74-110: Consider a pre-flight check fornpmavailability.
install_depswill produce a somewhat cryptic error ("Failed to initialize package.json") ifnpmis not installed. A quickcommand_exists npmguard at the top with a clear message would improve the user experience, especially sincecmd_statusalready checks fornode.Proposed addition at the top of install_deps
install_deps() { + if ! command_exists npm; then + print_error "npm is required but not found. Install Node.js 18+ first." + return 1 + fi print_info "Installing schema-validator dependencies in $TOOL_DIR..."
Create Schema.org structured data validator for JSON-LD, Microdata, and RDFa validation using @adobe/structured-data-validator and @marbec/web-auto-extractor. Includes auto-install of npm deps, 24h schema cache, URL/file/JSON-LD input support. - Add seo/schema-validator.md with YAML frontmatter and AI-CONTEXT - Add scripts/schema-validator-helper.sh (zero ShellCheck violations) - Update subagent-index.toon (seo/ key_files, scripts count 36→37) - Update seo-audit-skill.md with schema-validator references
bbcd37c to
54a8e04
Compare
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Fri Feb 6 16:59:22 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|
…(t142) - Add error guard on create_js_script call in cmd_validate - Document the || exit_code=$? pattern that prevents set -e from killing the script before validation results are reported - Change exit 1 to return 1 in main() catch-all for consistency The core || exit_code=$? guard was already in place from PR #391. This commit adds defensive improvements for remaining set -e hazards. Closes #443
…(t142) - Add error guard on create_js_script call in cmd_validate - Document the || exit_code=$? pattern that prevents set -e from killing the script before validation results are reported - Change exit 1 to return 1 in main() catch-all for consistency The core || exit_code=$? guard was already in place from PR #391. This commit adds defensive improvements for remaining set -e hazards. Closes #443
…ntf+tail (t147.4) - Replace sed ANSI-C quoting hack with printf+tail for jq-absent package.json injection - fixes ShellCheck SC1003 and improves macOS/Linux portability - Resolve last unresolved CodeRabbit thread on PR #391 (set -e fix verified) - Fix TODO.md formatting: t147.4 was concatenated on t147.3 notes line - Mark t147.4 complete
…(t142) - Add error guard on create_js_script call in cmd_validate - Document the || exit_code=$? pattern that prevents set -e from killing the script before validation results are reported - Change exit 1 to return 1 in main() catch-all for consistency The core || exit_code=$? guard was already in place from PR #391. This commit adds defensive improvements for remaining set -e hazards. Closes #443
…ntf+tail (t147.4) - Replace sed ANSI-C quoting hack with printf+tail for jq-absent package.json injection - fixes ShellCheck SC1003 and improves macOS/Linux portability - Resolve last unresolved CodeRabbit thread on PR #391 (set -e fix verified) - Fix TODO.md formatting: t147.4 was concatenated on t147.3 notes line - Mark t147.4 complete
…(t142) (#449) - Add error guard on create_js_script call in cmd_validate - Document the || exit_code=$? pattern that prevents set -e from killing the script before validation results are reported - Change exit 1 to return 1 in main() catch-all for consistency The core || exit_code=$? guard was already in place from PR #391. This commit adds defensive improvements for remaining set -e hazards. Closes #443
…ntf+tail (t147.4) - Replace sed ANSI-C quoting hack with printf+tail for jq-absent package.json injection - fixes ShellCheck SC1003 and improves macOS/Linux portability - Resolve last unresolved CodeRabbit thread on PR #391 (set -e fix verified) - Fix TODO.md formatting: t147.4 was concatenated on t147.3 notes line - Mark t147.4 complete
…ntf+tail (t147.4) (#457) - Replace sed ANSI-C quoting hack with printf+tail for jq-absent package.json injection - fixes ShellCheck SC1003 and improves macOS/Linux portability - Resolve last unresolved CodeRabbit thread on PR #391 (set -e fix verified) - Fix TODO.md formatting: t147.4 was concatenated on t147.3 notes line - Mark t147.4 complete


Summary
seo/schema-validator.md) and helper script (scripts/schema-validator-helper.sh)@adobe/structured-data-validatorand@marbec/web-auto-extractorsubagent-index.toonandseo-audit-skill.mdwith schema-validator referencesDetails
New files:
.agent/seo/schema-validator.md- Subagent with proper YAML frontmatter, AI-CONTEXT blocks, usage docs, common schema types, troubleshooting.agent/scripts/schema-validator-helper.sh- Helper script with commands:validate,validate-json,status,install,helpModified files:
.agent/subagent-index.toon- Addedschema-validatorto seo/ key_files, added script entry (36→37).agent/seo/seo-audit-skill.md- Linked Schema Validator in Tools Referenced, added to Related SkillsQuality:
local var="$1"pattern, explicit returns,set -euo pipefailemail-health-check-helper.shandsite-crawler.mdDependencies auto-installed to
~/.aidevops/tools/schema-validator/:@adobe/structured-data-validator(Apache-2.0)@marbec/web-auto-extractor(MIT)node-fetch(fallback for Node <18)Closes t085
Summary by CodeRabbit
New Features
Documentation