Skip to content

feat(cli): let people apply and diff a board saved as an HTML file - #206

Merged
yordis merged 2 commits into
TrogonStack:mainfrom
enilsen16:enilsen16/feat-cli-apply-html
Oct 20, 2026
Merged

yordis merged 2 commits into
TrogonStack:mainfrom
enilsen16:enilsen16/feat-cli-apply-html

Conversation

@enilsen16

@enilsen16 enilsen16 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Studio's Export HTML embeds the board's manifests in the saved file (manifests.model and manifests.external). The CLI cannot read them. trogon-atlas apply -f and diff -f accept only .yaml and .yml files.

Change

  • apply -f board.html and diff -f board.html read the atlas-snapshot data block and use manifests.model as the manifests. After that, the normal plan and apply path runs.
  • The CLI reads a .html file only when you name it. A directory walk still reads only YAML, so a saved board next to its YAML is not read twice. fmt does not accept .html files.
  • External entities (manifests.external) are foreign entities that the board references directly. The CLI never writes them. If the target does not have one of them, apply and diff fail before they write and list the missing entities.
  • If the file has no manifests (an older Studio, or a board that the server could not render in full), the error tells you to export it again.

Open question

What must import do with an external entity that already exists in the target? This PR skips it, even if the bundled copy is different. The other options are:

  • report the difference as drift, or
  • create the external entities that are missing (a --include-external flag), and never overwrite the ones that exist.

Test

  • Unit tests (manifest.rs): read a board file that has </script> inside a YAML doc; keep external entities separate; give the error for a file with no manifests or no data block; skip .html in a directory walk and in fmt.
  • Integration test (export_integration.rs): export a board, save it as a board file in a new namespace, and apply it. The plan is all Create, and the next plan is all Unchanged. A board whose external entity is missing in the target is refused, and the error names that entity.
  • cargo test -p trogon-atlas-client, cargo test -p trogon-atlas-cli and cargo clippy -p trogon-atlas-client -p trogon-atlas-cli --all-targets -- -D warnings pass.

Closes #160


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

apply -f and diff -f read the manifests that Studio's Export HTML embeds. External entities the board references are never written; the command fails if the target lacks one.

Signed-off-by: Erik Nilsen <enilsen16@live.com>
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b530d164-887d-49b4-808e-9effd770abc4
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@enilsen16
enilsen16 marked this pull request as ready for review October 20, 2026 15:19
@cursor

cursor Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Additive input and a read-only preflight on apply/diff; normal YAML apply behavior and BatchMutate semantics are unchanged.

Overview
trogon-atlas apply and diff can take a Studio Export HTML board (-f board.html) in addition to YAML trees. The loader pulls manifests.model and manifests.external from the embedded atlas-snapshot JSON script block, then runs the same plan/apply or diff path as today.

Board-specific rules: .html is only read when you pass the file explicitly—directory walks still pick up YAML only, so a board sitting next to manifests is not ingested twice. fmt stays YAML-only. External manifests are never written; require_external runs before plan/diff and fails fast with a clear list if the server is missing any referenced foreign entity (existence check by id only, so an untranscodable bundled copy cannot mask a missing entity or block when the entity is present).

read_paths now returns a ManifestFiles split (documents vs external) instead of a flat document list; CLI help text documents the HTML path.

Reviewed by Cursor Bugbot for commit a212158. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 2aec11e. Configure here.

Comment thread rsworkspace/crates/trogon-atlas-client/src/apply.rs
…ing their specs

Signed-off-by: Erik Nilsen <enilsen16@live.com>
@yordis
yordis merged commit 1cf1c0d into TrogonStack:main Oct 20, 2026
27 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.

Let an exported board HTML file carry its manifests, so people can import it

2 participants