PLAT-8152 Add scene-trees:view and scene-trees:export commands#176
PLAT-8152 Add scene-trees:view and scene-trees:export commands#176brentav wants to merge 10 commits into
Conversation
| @@ -0,0 +1,75 @@ | |||
| import { TreeNode } from './tree-node'; | |||
There was a problem hiding this comment.
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.
|
|
|
||
| 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.`; |
There was a problem hiding this comment.
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'; | |||
There was a problem hiding this comment.
This file and the next one are the primary functional additions.
| import { fetchSceneItemTree } from '../../lib/scene-items'; | ||
| import { serializeTreeToZipFile } from '../../lib/tree-serializer'; | ||
|
|
||
| export default class Export extends BaseCommand { |
There was a problem hiding this comment.
Export has a different meaning in our system. Should this be called Scene Extraction or something similar?
There was a problem hiding this comment.
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.
Applied acceptable Copilot CR suggestions Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
|



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 printsa visual ASCII tree dump to stdout.
scene-trees:export <sceneId> [--output <path>]— Fetches the scene item tree and serializes it as aJSON file inside a ZIP archive (defaults to
<sceneId>.zip).New supporting library code in
src/lib/:tree-node.ts— GenericTreeNode<T>class.tree-builder.ts— Utility methods for building a tree from a flat array.tree-serializer.ts— Utility methods for serializing aTreeNodestructure 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
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<sceneId>.jsonto verify the tree structure.Release Notes
New commands:
scene-trees:viewandscene-trees:exportYou 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
Dependencies
None.