[CLI] Add Flow360 CLI foundation commands#2022
[CLI] Add Flow360 CLI foundation commands#2022maciej-flexcompute wants to merge 12 commits intomainfrom
Conversation
…cli-pr1-foundation
Coverage report (flow360)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit bf5f3a0. Configure here.
| "id": info["id"], | ||
| "name": info["name"], | ||
| "solver_version": info.get("solverVersion"), | ||
| "tags": list(info.get("tags") or []), |
There was a problem hiding this comment.
So the schema for tags is actually list of list?
| ROOT_FOLDER_NAME = "My workspace" | ||
|
|
||
|
|
||
| class FolderWebApi: |
There was a problem hiding this comment.
Any plan to unify the API call site for the class Folder and class FodlerWebAPI? Like the _build_folder_tree() looks very similar with the _build_tree() function below.
| from flow360_schema.models.functions import math | ||
| from flow360_schema.models.variables import solution | ||
|
|
||
| from flow360 import component |
| _warn_prerelease() | ||
|
|
||
|
|
||
| def __getattr__(name): |
There was a problem hiding this comment.
Is this implementing the lazy load?
| Flow360Error = _schema_exceptions.Flow360Error | ||
| Flow360ValueError = _schema_exceptions.Flow360ValueError | ||
|
|
||
| Flow360ErrorWithLocation = getattr(_schema_exceptions, "Flow360ErrorWithLocation", Flow360Error) |
There was a problem hiding this comment.
Is the fallback to Flow360Error needed? If we have correct schema dependency specified this (missing module) should not be a problem?

Summary
This is PR 1 of the Flow360 CLI split. It adds the lightweight foundation and discovery surface without including resource inspection, mutation, draft execution, logs, or results handling.
Changes included:
flow360 project list/info/tree/items/pathwith lightweight webAPI-backed reads.flow360 project list --format textand reuse the formatter for legacyshow_projects.flow360 folder get/tree.ProjectWebApi,ProjectTree, andFolderWebApihelpers for these read paths.Validation
Result:
39 passed in 3.75s.CLI command smoke timings
Real E2E smoke run against the Flow360 API using the locally installed PR checkout after removing the hidden
project getalias. Times are single-run wall-clock measurements from the CLI process and include authentication lookup, API latency, JSON parsing, and terminal formatting.Real data used:
Simple Airplane(prj-7cd91cca-3049-47cd-a5c8-d7cf0ad1cbc0), with geometry, surface mesh, two volume meshes, and two cases.case-7b77792d-ed36-4760-921a-a7b9614a867d.Codex Perf Folder 153737(folder-7629a9ed-c3de-4d38-b48b-c9fef25ddb71).flow360 project list --limit 3flow360 project list --limit 1 --format textflow360 project info prj-7cd91cca-3049-47cd-a5c8-d7cf0ad1cbc0flow360 project tree prj-7cd91cca-3049-47cd-a5c8-d7cf0ad1cbc0flow360 project items prj-7cd91cca-3049-47cd-a5c8-d7cf0ad1cbc0flow360 project path prj-7cd91cca-3049-47cd-a5c8-d7cf0ad1cbc0 --item-id case-7b77792d-ed36-4760-921a-a7b9614a867d --item-type Caseflow360 folder get folder-7629a9ed-c3de-4d38-b48b-c9fef25ddb71flow360 folder treeExample responses:
flow360 project list --limit 3flow360 project list --limit 1 --format textflow360 project info prj-7cd91cca-3049-47cd-a5c8-d7cf0ad1cbc0flow360 project tree prj-7cd91cca-3049-47cd-a5c8-d7cf0ad1cbc0flow360 project items prj-7cd91cca-3049-47cd-a5c8-d7cf0ad1cbc0flow360 project path prj-7cd91cca-3049-47cd-a5c8-d7cf0ad1cbc0 --item-id case-7b77792d-ed36-4760-921a-a7b9614a867d --item-type Caseflow360 folder get folder-7629a9ed-c3de-4d38-b48b-c9fef25ddb71flow360 folder treeNotes
This intentionally excludes later CLI work: geometry/surface-mesh/volume-mesh/case inspection, draft commands, open/wait/logs, project/folder mutations, results handling, and local
flow360-schemapath wiring.Note
Medium Risk
Primarily additive, but it changes CLI command loading and global env/profile handling for existing commands, which could alter runtime behavior or error handling in authentication/config flows.
Overview
Introduces a lazy-loading Click CLI foundation that defers importing SDK-backed command groups until invoked, and centralizes global
--profile/--dev/--uat/--envhandling via a sharedCliContext.Adds new read-only CLI surfaces for cloud discovery:
flow360 project list/info/tree/items/path(with optional--format text) andflow360 folder get/tree, plus shared JSON/text output helpers and presentation-only project list formatting.Refactors existing commands to use the new context resolution (including prompting for API key only when needed), updates
show_projectsto reuse the new project list formatter, adds thin/v2web API wrappers for projects/folders, and expands tests (including lazy-import guarantees and endpoint selection) alongside mock server support for the new/v2/folderslist endpoint.Reviewed by Cursor Bugbot for commit 40ee7a9. Bugbot is set up for automated code reviews on this repo. Configure here.