Skip to content

PLAT-8152 Add scene-trees:view and scene-trees:export commands#176

Open
brentav wants to merge 10 commits into
masterfrom
export-scene-structure
Open

PLAT-8152 Add scene-trees:view and scene-trees:export commands#176
brentav wants to merge 10 commits into
masterfrom
export-scene-structure

Conversation

@brentav
Copy link
Copy Markdown
Contributor

@brentav brentav commented Feb 19, 2026

Summary

Adds a scene-trees command category with two subcommands for working with a scene's item tree:

  • scene-trees:view <sceneId> — Fetches all scene items for a scene, builds them into a tree, and prints
    a visual ASCII tree dump to stdout.
  • scene-trees:export <sceneId> [--output <path>] — Fetches the scene item tree and serializes it as a
    JSON file inside a ZIP archive (defaults to <sceneId>.zip).

New supporting library code in src/lib/:

  • tree-node.ts — Generic TreeNode<T> class.
  • tree-builder.ts — Utility methods for building a tree from a flat array.
  • tree-serializer.ts — Utility methods for serializing a TreeNode structure to JSON/ZIP.
  • scene-items.ts — Helper methods for fetching scene items for a scene.

Dependencies: Added archiver (ZIP creation) and @types/archiver.

Test Plan

  • Run yarn test — all tests should pass with ≥60% statement/line coverage.
    • To exercise the CLI manually against a real environment:

View the tree in the terminal

./bin/run scene-trees:view <sceneId>

Export to a ZIP (default path: <sceneId>.zip)

./bin/run scene-trees:export <sceneId>

Export to a custom path

./bin/run scene-trees:export <sceneId> --output my-tree.zip

  • Unzip the output and inspect <sceneId>.json to verify the tree structure.

Release Notes

New commands: scene-trees:view and scene-trees:export

You can now inspect and export the scene item tree for any scene directly from the CLI.

  • vertex scene-trees:view <sceneId> prints a hierarchical ASCII view of the scene item tree to your terminal.
  • vertex scene-trees:export <sceneId> downloads the full scene item tree and saves it as a JSON file inside a ZIP archive. Use --output <path> to control the destination.

Possible Regressions

  • No existing code paths were functionally modified.
  • Some library dependencies were upgraded and some sonar findings were addressed, but there should not be any functional changes with those.
  • No elevated risks for regressions.

Dependencies

None.

@brentav brentav requested a review from a team as a code owner February 19, 2026 19:48
Comment thread src/lib/tree-builder.ts
@@ -0,0 +1,75 @@
import { TreeNode } from './tree-node';
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I copied in a few of these tree utilities from the vertex-api-utils-node project. There are some issues with adding that library as a dependency right now. But the code for these has been previously vetted in that project.

@sonarqubecloud
Copy link
Copy Markdown


export default class Create extends BaseCommand {
public static description = `Create an export for a scene.`;
public static readonly description = `Create an export for a scene.`;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I resolved a sonar finding on all these static values. It's a widespread pattern in this repo, so it resulted in a lot of files being changed. But there should be no effective functional change with all these.

@@ -0,0 +1,53 @@
import { flags } from '@oclif/command';
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This file and the next one are the primary functional additions.

Copy link
Copy Markdown
Contributor

@MadisonEhlers-Vertex MadisonEhlers-Vertex left a comment

Choose a reason for hiding this comment

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

I had a few suggestions.

  1. Rename export to not conflict with the existing scene export concepts. "Scene Extraction"?

  2. Consideration to change the extraction formatting to be a cli friendly format (nit)

import { fetchSceneItemTree } from '../../lib/scene-items';
import { serializeTreeToZipFile } from '../../lib/tree-serializer';

export default class Export extends BaseCommand {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Export has a different meaning in our system. Should this be called Scene Extraction or something similar?

Comment thread src/lib/tree-serializer.ts
@danschultz danschultz requested a review from Copilot March 5, 2026 18:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@danschultz danschultz requested a review from Copilot March 5, 2026 18:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@danschultz danschultz requested review from Copilot and removed request for Copilot March 5, 2026 19:01
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 46 out of 47 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib/scene-items.ts Outdated
Comment thread src/lib/tree-node.ts Outdated
Comment thread src/lib/tree-serializer.ts
Comment thread src/lib/tree-serializer.ts Outdated
Comment thread src/lib/tree-serializer.ts Outdated
Comment thread src/lib/tree-serializer.ts Outdated
Comment thread src/lib/tree-serializer.ts
Comment thread src/lib/tree-serializer.ts
Applied acceptable Copilot CR suggestions

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 5, 2026

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 5, 2026

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.

3 participants