Skip to content

MAINTENANCE: Test code blocks#80

Merged
rskew merged 10 commits into
mainfrom
rs/test-code-blocks
Mar 31, 2026
Merged

MAINTENANCE: Test code blocks#80
rskew merged 10 commits into
mainfrom
rs/test-code-blocks

Conversation

@rskew
Copy link
Copy Markdown
Collaborator

@rskew rskew commented Mar 20, 2026

No description provided.

@rskew rskew self-assigned this Mar 20, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 20, 2026

Deploy Preview for highlighter-docs ready!

Name Link
🔨 Latest commit d206eb6
🔍 Latest deploy log https://app.netlify.com/projects/highlighter-docs/deploys/69ca07d0d64d420007abda3c
😎 Deploy Preview https://deploy-preview-80--highlighter-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 88 (🔴 down 5 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the documentation experience by introducing interactive code tabs for displaying platform-specific examples, primarily for Bash and PowerShell. Concurrently, it bolsters documentation reliability by adding automated scripts to validate the syntax of code blocks and ensure the correctness of referenced CLI commands. These changes improve both the usability and accuracy of the project's technical documentation.

Highlights

  • New Code Tab Functionality: Introduced a new code_tabs shortcode, along with supporting CSS and JavaScript, to enable tabbed code blocks in documentation. This allows for displaying platform-specific examples (e.g., Bash, PowerShell, CMD) within a single section.
  • Documentation Updates for Multi-Platform Examples: Extensively updated several SDK reference documentation files to utilize the new code_tabs shortcode, providing equivalent PowerShell examples for many existing Bash CLI commands and environment variable setups.
  • Automated Code Block Testing: Added two new maintenance scripts: scripts/check-code-blocks.sh for syntax validation of fenced code blocks (Bash/Sh and JSON) in markdown files, and scripts/check-hl-commands.sh to verify that hl CLI subcommands referenced in documentation actually exist and their --help output is accessible.
  • Infrastructure Support: Included python3 in the flake.nix build inputs to support the new Python-dependent CLI command checking script, and added .venv-check/ to .gitignore for the script's virtual environment.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/check-docs.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@tall-josh tall-josh force-pushed the rs/test-code-blocks branch from 514c26c to 2672d42 Compare March 20, 2026 06:13
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a significant improvement to the documentation by adding PowerShell examples for CLI commands and implementing a tabbed interface to display code blocks for different shells. It also adds two new validation scripts to check the correctness of code blocks and hl commands in the documentation, which is a great step towards maintaining documentation quality. The implementation of the code tabs feature using a Zola shortcode, CSS, and JavaScript is well-executed. My review includes a couple of suggestions to improve the idiomatic usage of PowerShell in one of the examples and to enhance the safety of one of the new bash scripts.

I am having trouble creating individual review comments. Click here to see my feedback.

content/docs/reference/sdk/network-discovery.md (270-280)

medium

For more robust and idiomatic PowerShell, consider using the ConvertFrom-Csv cmdlet to parse the CSV output. This avoids manually splitting strings, which can be fragile, and allows accessing columns by their header name, making the code more readable and maintainable.

hl datasource discover batch --file macs.txt --quiet | ConvertFrom-Csv | ForEach-Object {
    if ($_.IP -ne "not_found") {
        Write-Host "Camera $($_.MAC) is at $($_.IP) (hostname: $($_.Hostname))"
        # Perform actions on each camera
        if (Test-Connection -ComputerName $_.IP -Count 1 -Quiet) { Write-Host "  - Online" }
    } else {
        Write-Host "Camera $($_.MAC) not found on network"
    }
}

scripts/check-code-blocks.sh (29)

medium

Using eval can be risky and make scripts harder to reason about. For this increment operation, you can achieve the same result more safely using printf -v with indirect parameter expansion ${!1}. This avoids the potential for arbitrary code execution if the input were ever uncontrolled.

inc() { printf -v "$1" '%d' "$(( ${!1} + 1 ))"; }

@tall-josh tall-josh force-pushed the rs/test-code-blocks branch from 2672d42 to c91a13c Compare March 20, 2026 06:19
@rskew rskew requested a review from jonochang March 20, 2026 14:09
@rskew
Copy link
Copy Markdown
Collaborator Author

rskew commented Mar 20, 2026

This was me, not Josh (Josh's SSH key was on ares and got used by git accidentally)

silverpond-claude and others added 7 commits March 30, 2026 13:50
- `hl new` was removed; replaced with `hl generate agent`
- `hl agent run` renamed to `hl agent start`
- Also fixed typo: YOU_AGENT_DEF → YOUR_AGENT_DEF

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the bash-based hl command checker with two Python scripts that
do deeper validation:

- check-python-blocks.py: extracts Python code blocks from markdown and
  runs pyright (basic type checking, import resolution, undefined vars)
  against the installed highlighter-sdk. Catches wrong import paths like
  the CocoWriter issue from PR #83.

- check-hl-commands.py: uses Click's make_context() to validate every
  documented hl command against the actual CLI tree — checking subcommand
  names, flag names, required flags, and argument types without executing
  any command callbacks.

Also:
- Fix scaffolds snippet: add missing imports, correct DataFile→DataSample
- Add silverpond-nix to flake.nix for local dev with SDK + pyright
- Merge CI jobs into single sdk-validation job

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Drop cachix/install-nix-action and magic-nix-cache in favour of the
self-hosted runner that already has nix, matching the highlighter repo.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rskew rskew force-pushed the rs/test-code-blocks branch from 7622886 to 6df048c Compare March 30, 2026 03:21
@rskew
Copy link
Copy Markdown
Collaborator Author

rskew commented Mar 30, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the documentation by fixing typos, updating CLI commands, and transitioning API references from DataFile to DataSample. It also introduces three new validation scripts to check the syntax and correctness of Bash, JSON, and Python code blocks within the markdown files. The Nix environment has been updated to include these tools and relax specific Python dependency constraints. Feedback focuses on improving the shell script's robustness and security by avoiding eval and ensuring temporary files are cleaned up using traps.

Comment thread scripts/check-code-blocks.sh Outdated
Comment thread scripts/check-code-blocks.sh
silverpond-claude and others added 3 commits March 30, 2026 14:26
Address Gemini review: use local -n (nameref) instead of eval in the
inc() helper to avoid potential code injection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Switch trigger to workflow_dispatch only. Scripts can be run locally via
nix develop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CLI fixes:
- datasource import: --file → -i, remove --create-missing/--update-existing
  (import always upserts), --output → -o
- datasource export: replace with `hl datasource list --format json > file`
  (export downloads data files, not definitions)
- training-run read: --id is not an option, use positional arg
- agent start: -f doesn't exist, file path is positional

Python fixes:
- data-source-cli.md: HLClient() → HLClient.from_env()
- Tune pyright config to suppress SDK type-stub false positives
  (reportAttributeAccessIssue, reportCallIssue, reportArgumentType)

All three scripts now pass cleanly:
- 95/95 hl commands, 4/4 Python blocks, 0 bash/JSON errors

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rskew rskew requested review from simon-dev-ml and tall-josh March 30, 2026 05:25
@rskew rskew merged commit 9e0d2ef into main Mar 31, 2026
4 checks passed
@rskew rskew deleted the rs/test-code-blocks branch March 31, 2026 23:24
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