sim-cli-core 0.3.5__tar.gz → 0.3.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/PKG-INFO +56 -27
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/README.md +55 -26
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/docs/DEVELOPMENT.md +0 -1
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/docs/plugin-install.md +2 -8
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/pyproject.toml +1 -1
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/_plugin_install.py +11 -11
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/cli.py +0 -41
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/describe.py +0 -4
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/test_plugin_install.py +2 -2
- sim_cli_core-0.3.5/src/sim/plugin_catalog.py +0 -232
- sim_cli_core-0.3.5/tests/base/test_plugin_catalog.py +0 -137
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/.github/workflows/publish.yml +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/.gitignore +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/CLAUDE.md +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/CONTRIBUTING.md +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/LICENSE +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/NOTICE +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/assets/architecture.svg +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/assets/banner.svg +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/assets/logo.svg +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/docs/agent-readability.md +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/docs/architecture/multi-session-and-config.md +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/docs/architecture/skills-layering-plan.md +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/docs/architecture/version-compat.md +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/__init__.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/__main__.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/_timeout.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/compat.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/config.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/driver.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/drivers/__init__.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/gui/LICENSES/ATTRIBUTION.md +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/gui/__init__.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/gui/_pywinauto_tools.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/gui/_win32_dialog.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/history.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/inspect.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/plugins.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/runner.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/server.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/session.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/testing/__init__.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/src/sim/testing/protocol_conformance.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/__init__.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/__init__.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/test_cli.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/test_compat.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/test_config.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/test_connect.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/test_describe.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/test_driver_discovery.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/test_history.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/test_init_setup.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/test_lint.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/test_lint_public_corpus.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/test_logs.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/test_multi_session.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/test_plugins.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/test_protocol_conformance.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/test_python_floor_audit.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/base/test_run.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/conftest.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/drivers/__init__.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/execution/calculix_e2e_cantilever_run.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/execution/coolprop/water_props.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/execution/elmer_e2e_heat_square.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/execution/gmsh_e2e_sphere_mesh.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/execution/lammps_e2e_lj_nvt.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/execution/meshio_e2e_gmsh_to_vtk.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/execution/pymfem_e2e_poisson.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/execution/pyvista_e2e_sphere_stats.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/execution/scikit_fem_e2e_poisson.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/execution/scikitrf/short_load.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/execution/su2_e2e_inviscid_bump.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/comsol/comsol_good.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/comsol/comsol_no_client.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/comsol/comsol_no_import.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/hypermesh_good.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/hypermesh_gui.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/hypermesh_no_import.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/hypermesh_no_usage.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/hypermesh_syntax_error.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/isaac/bad_import_order.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/isaac/bad_no_close.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/isaac/bad_no_simapp.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/isaac/hello_world.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/isaac/import_franka.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/isaac/not_isaac.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/isaac/official_hello_world.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/isaac/replicator_cubes.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/isaac/syntax_error.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/isaac/warehouse_sdg.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/matlab/empty_model.mdl +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/matlab/empty_model.slx +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/matlab/matlab_ok.m +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/mfem_good.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/mfem_no_import.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/mfem_no_mesh.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/mfem_syntax_error.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/mock_fail.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/mock_solver.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/newton/basic_pendulum.json +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/newton/cable_twist.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/newton/robot_g1.json +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/not_simulation.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/pybamm/pybamm_bad_import.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/pybamm/pybamm_crate_sweep.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/pybamm/pybamm_no_solve.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/pybamm/pybamm_spm_good.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/skfem_good.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/skfem_no_import.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/skfem_no_solve.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/fixtures/skfem_syntax_error.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/gui/__init__.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/gui/test_connect_tools_field.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/gui/test_gui_facade.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/inspect/__init__.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/inspect/_extract_comsol_Tmax.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/inspect/test_channel_3_4_5_9.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/inspect/test_gui_probes.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/inspect/test_inspect_types.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/inspect/test_probes.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tests/inspect/test_snippet_timeout.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tools/audit_python_floor.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tools/extract_driver.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/tools/lint-public-corpus.py +0 -0
- {sim_cli_core-0.3.5 → sim_cli_core-0.3.6}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sim-cli-core
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.6
|
|
4
4
|
Summary: Make every engineering tool agent-native — a CLI runtime that lets LLM agents launch, drive, and observe CAD/CAE software
|
|
5
5
|
Project-URL: Homepage, https://github.com/svd-ai-lab/sim-cli
|
|
6
6
|
Project-URL: Repository, https://github.com/svd-ai-lab/sim-cli
|
|
@@ -45,13 +45,14 @@ Description-Content-Type: text/markdown
|
|
|
45
45
|
|
|
46
46
|
<br>
|
|
47
47
|
|
|
48
|
-
**
|
|
48
|
+
**sim-cli lets AI agents operate CAE solvers one verified step at a time.**
|
|
49
49
|
|
|
50
50
|
`sim` is an open-source CLI and local runtime that lets Codex, Claude Code,
|
|
51
51
|
GitHub Copilot, Gemini, and other agents work with simulation software through
|
|
52
52
|
solver-specific plugins and bundled skills. An agent can check what is
|
|
53
|
-
installed, connect to a solver, inspect live state, execute bounded
|
|
54
|
-
|
|
53
|
+
installed, connect to a solver, inspect live state, execute bounded modeling
|
|
54
|
+
or analysis steps, verify result/state, and save checkpoints/artifacts for
|
|
55
|
+
engineering review.
|
|
55
56
|
|
|
56
57
|
<p align="center">
|
|
57
58
|
<a href="#quick-start-agent-setup"><img src="https://img.shields.io/badge/Quick_Start-agent_setup-3b82f6?style=for-the-badge" alt="Quick Start"></a>
|
|
@@ -81,8 +82,8 @@ capture artifacts, and leave checkpoints for an engineer to review.
|
|
|
81
82
|
automate COMSOL, Fluent, MATLAB, LTspice, Abaqus, HFSS, and similar tools
|
|
82
83
|
without losing inspection and recovery between steps.
|
|
83
84
|
- **Design engineers and occasional simulation users** who have agent
|
|
84
|
-
experience and want
|
|
85
|
-
model evolve, review screenshots or plots, and keep final artifacts.
|
|
85
|
+
experience and want an agent-assisted workflow: ask for a simulation, watch
|
|
86
|
+
the model evolve, review screenshots or plots, and keep final artifacts.
|
|
86
87
|
- **AI agents** reading this repository to learn the safe setup and operating
|
|
87
88
|
loop before touching a solver.
|
|
88
89
|
- **Engineering leaders** evaluating whether agent-assisted simulation can be
|
|
@@ -99,10 +100,16 @@ it hides intermediate state, fails late, and makes recovery difficult.
|
|
|
99
100
|
`sim` gives an agent a small, repeatable control surface:
|
|
100
101
|
|
|
101
102
|
```text
|
|
102
|
-
check
|
|
103
|
-
|
|
103
|
+
check readiness → attach to live session → inspect model state
|
|
104
|
+
→ run one bounded CAE step → verify result/state → save checkpoint/artifacts
|
|
104
105
|
```
|
|
105
106
|
|
|
107
|
+
A bounded CAE step is one small modeling, meshing, solving, or postprocessing
|
|
108
|
+
action that can be inspected and verified before continuing. Examples: create a
|
|
109
|
+
geometry feature, assign a material, apply a boundary condition, generate a
|
|
110
|
+
mesh, run one study, extract a probe value, create a plot, or export a result
|
|
111
|
+
table.
|
|
112
|
+
|
|
106
113
|
The solver-specific knowledge is not baked into the core CLI. It comes from
|
|
107
114
|
plugins. A plugin can provide both:
|
|
108
115
|
|
|
@@ -225,6 +232,32 @@ For COMSOL-specific details such as shared Desktop mode, offline `.mph`
|
|
|
225
232
|
inspection, Desktop attach fallback, model identity checks, and checkpoint
|
|
226
233
|
policy, follow the bundled COMSOL skill.
|
|
227
234
|
|
|
235
|
+
## Why CLI-first?
|
|
236
|
+
|
|
237
|
+
sim-cli is CLI-first because engineering simulation is file-based,
|
|
238
|
+
scriptable, local, artifact-heavy, and long-running.
|
|
239
|
+
|
|
240
|
+
CAE agents need to work with solver executables, model files,
|
|
241
|
+
Python/Java/journal scripts, shell commands, logs, checkpoints, plots,
|
|
242
|
+
and artifacts. A CLI command surface composes with all of that and
|
|
243
|
+
matches how Codex CLI, Claude Code, and other coding agents already
|
|
244
|
+
operate.
|
|
245
|
+
|
|
246
|
+
MCP is useful for API-style integrations and remote tool discovery,
|
|
247
|
+
but a broad MCP surface can add context overhead and wrapper
|
|
248
|
+
maintenance. For COMSOL, Abaqus, Ansys Workbench, OpenFOAM, LTspice,
|
|
249
|
+
and similar solvers, sim-cli keeps the source of truth as a small,
|
|
250
|
+
auditable command loop:
|
|
251
|
+
|
|
252
|
+
```text
|
|
253
|
+
check readiness → attach to live session → inspect model state
|
|
254
|
+
→ run one bounded CAE step → verify result/state → save checkpoint/artifacts
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Solver plugins provide solver-specific behavior. Agent skills teach
|
|
258
|
+
Codex, Claude Code, and other agents when and how to use the CLI
|
|
259
|
+
safely.
|
|
260
|
+
|
|
228
261
|
## The agent loop
|
|
229
262
|
|
|
230
263
|
For any solver, the agent should prefer this loop over one large generated
|
|
@@ -238,11 +271,11 @@ script:
|
|
|
238
271
|
identity target before changing state.
|
|
239
272
|
4. `uv run sim exec --file step.py --label <step>` for one bounded modeling
|
|
240
273
|
or analysis step.
|
|
241
|
-
5. `uv run sim inspect last.result` and solver-specific state
|
|
242
|
-
|
|
243
|
-
|
|
274
|
+
5. `uv run sim inspect last.result` and solver-specific state.
|
|
275
|
+
6. Verify the result/state using solver-specific numerical evidence when available.
|
|
276
|
+
7. Save checkpoints and artifacts when the solver plugin or skill requires
|
|
244
277
|
them.
|
|
245
|
-
|
|
278
|
+
8. `uv run sim disconnect` when the session is done.
|
|
246
279
|
|
|
247
280
|
Screenshots and plots help humans review the result, but engineering
|
|
248
281
|
acceptance should prefer numeric evidence when the solver skill defines it:
|
|
@@ -279,21 +312,17 @@ protected LAN. The runtime currently has no auth layer, and `/connect` plus
|
|
|
279
312
|
`sim-cli-core` ships with no solver drivers built in. Each simulation solver is
|
|
280
313
|
reached through an explicit plugin package.
|
|
281
314
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
| Solver | Package spec |
|
|
285
|
-
| --- | --- |
|
|
286
|
-
| COMSOL | `sim-plugin-comsol` |
|
|
287
|
-
|
|
|
288
|
-
| Ansys Workbench | `sim-plugin-workbench` |
|
|
289
|
-
|
|
|
290
|
-
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
| LTspice | `sim-plugin-ltspice` |
|
|
294
|
-
| OpenFOAM | `git+https://github.com/svd-ai-lab/sim-plugin-openfoam@main` |
|
|
295
|
-
|
|
296
|
-
Under development: Amesim, Dymola, and Flotherm.
|
|
315
|
+
A few representative plugins:
|
|
316
|
+
|
|
317
|
+
| Solver | Package spec | Plugin repo |
|
|
318
|
+
| --- | --- | --- |
|
|
319
|
+
| COMSOL | `sim-plugin-comsol` | [sim-plugin-comsol](https://github.com/svd-ai-lab/sim-plugin-comsol) |
|
|
320
|
+
| Abaqus | `sim-plugin-abaqus` | [sim-plugin-abaqus](https://github.com/svd-ai-lab/sim-plugin-abaqus) |
|
|
321
|
+
| Ansys Workbench | `sim-plugin-workbench` | [sim-plugin-workbench](https://github.com/svd-ai-lab/sim-plugin-workbench) |
|
|
322
|
+
| Autodesk Fusion 360 | _in development_ | [sim-plugin-fusion360](https://github.com/svd-ai-lab/sim-plugin-fusion360) |
|
|
323
|
+
| LTspice | `sim-plugin-ltspice` | [sim-plugin-ltspice](https://github.com/svd-ai-lab/sim-plugin-ltspice) |
|
|
324
|
+
|
|
325
|
+
For the curated full list, see [sim-plugin-index](https://github.com/svd-ai-lab/sim-plugin-index).
|
|
297
326
|
|
|
298
327
|
After adding any plugin package, sync its bundled skill and verify that the local
|
|
299
328
|
solver can be reached:
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
<br>
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**sim-cli lets AI agents operate CAE solvers one verified step at a time.**
|
|
8
8
|
|
|
9
9
|
`sim` is an open-source CLI and local runtime that lets Codex, Claude Code,
|
|
10
10
|
GitHub Copilot, Gemini, and other agents work with simulation software through
|
|
11
11
|
solver-specific plugins and bundled skills. An agent can check what is
|
|
12
|
-
installed, connect to a solver, inspect live state, execute bounded
|
|
13
|
-
|
|
12
|
+
installed, connect to a solver, inspect live state, execute bounded modeling
|
|
13
|
+
or analysis steps, verify result/state, and save checkpoints/artifacts for
|
|
14
|
+
engineering review.
|
|
14
15
|
|
|
15
16
|
<p align="center">
|
|
16
17
|
<a href="#quick-start-agent-setup"><img src="https://img.shields.io/badge/Quick_Start-agent_setup-3b82f6?style=for-the-badge" alt="Quick Start"></a>
|
|
@@ -40,8 +41,8 @@ capture artifacts, and leave checkpoints for an engineer to review.
|
|
|
40
41
|
automate COMSOL, Fluent, MATLAB, LTspice, Abaqus, HFSS, and similar tools
|
|
41
42
|
without losing inspection and recovery between steps.
|
|
42
43
|
- **Design engineers and occasional simulation users** who have agent
|
|
43
|
-
experience and want
|
|
44
|
-
model evolve, review screenshots or plots, and keep final artifacts.
|
|
44
|
+
experience and want an agent-assisted workflow: ask for a simulation, watch
|
|
45
|
+
the model evolve, review screenshots or plots, and keep final artifacts.
|
|
45
46
|
- **AI agents** reading this repository to learn the safe setup and operating
|
|
46
47
|
loop before touching a solver.
|
|
47
48
|
- **Engineering leaders** evaluating whether agent-assisted simulation can be
|
|
@@ -58,10 +59,16 @@ it hides intermediate state, fails late, and makes recovery difficult.
|
|
|
58
59
|
`sim` gives an agent a small, repeatable control surface:
|
|
59
60
|
|
|
60
61
|
```text
|
|
61
|
-
check
|
|
62
|
-
|
|
62
|
+
check readiness → attach to live session → inspect model state
|
|
63
|
+
→ run one bounded CAE step → verify result/state → save checkpoint/artifacts
|
|
63
64
|
```
|
|
64
65
|
|
|
66
|
+
A bounded CAE step is one small modeling, meshing, solving, or postprocessing
|
|
67
|
+
action that can be inspected and verified before continuing. Examples: create a
|
|
68
|
+
geometry feature, assign a material, apply a boundary condition, generate a
|
|
69
|
+
mesh, run one study, extract a probe value, create a plot, or export a result
|
|
70
|
+
table.
|
|
71
|
+
|
|
65
72
|
The solver-specific knowledge is not baked into the core CLI. It comes from
|
|
66
73
|
plugins. A plugin can provide both:
|
|
67
74
|
|
|
@@ -184,6 +191,32 @@ For COMSOL-specific details such as shared Desktop mode, offline `.mph`
|
|
|
184
191
|
inspection, Desktop attach fallback, model identity checks, and checkpoint
|
|
185
192
|
policy, follow the bundled COMSOL skill.
|
|
186
193
|
|
|
194
|
+
## Why CLI-first?
|
|
195
|
+
|
|
196
|
+
sim-cli is CLI-first because engineering simulation is file-based,
|
|
197
|
+
scriptable, local, artifact-heavy, and long-running.
|
|
198
|
+
|
|
199
|
+
CAE agents need to work with solver executables, model files,
|
|
200
|
+
Python/Java/journal scripts, shell commands, logs, checkpoints, plots,
|
|
201
|
+
and artifacts. A CLI command surface composes with all of that and
|
|
202
|
+
matches how Codex CLI, Claude Code, and other coding agents already
|
|
203
|
+
operate.
|
|
204
|
+
|
|
205
|
+
MCP is useful for API-style integrations and remote tool discovery,
|
|
206
|
+
but a broad MCP surface can add context overhead and wrapper
|
|
207
|
+
maintenance. For COMSOL, Abaqus, Ansys Workbench, OpenFOAM, LTspice,
|
|
208
|
+
and similar solvers, sim-cli keeps the source of truth as a small,
|
|
209
|
+
auditable command loop:
|
|
210
|
+
|
|
211
|
+
```text
|
|
212
|
+
check readiness → attach to live session → inspect model state
|
|
213
|
+
→ run one bounded CAE step → verify result/state → save checkpoint/artifacts
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Solver plugins provide solver-specific behavior. Agent skills teach
|
|
217
|
+
Codex, Claude Code, and other agents when and how to use the CLI
|
|
218
|
+
safely.
|
|
219
|
+
|
|
187
220
|
## The agent loop
|
|
188
221
|
|
|
189
222
|
For any solver, the agent should prefer this loop over one large generated
|
|
@@ -197,11 +230,11 @@ script:
|
|
|
197
230
|
identity target before changing state.
|
|
198
231
|
4. `uv run sim exec --file step.py --label <step>` for one bounded modeling
|
|
199
232
|
or analysis step.
|
|
200
|
-
5. `uv run sim inspect last.result` and solver-specific state
|
|
201
|
-
|
|
202
|
-
|
|
233
|
+
5. `uv run sim inspect last.result` and solver-specific state.
|
|
234
|
+
6. Verify the result/state using solver-specific numerical evidence when available.
|
|
235
|
+
7. Save checkpoints and artifacts when the solver plugin or skill requires
|
|
203
236
|
them.
|
|
204
|
-
|
|
237
|
+
8. `uv run sim disconnect` when the session is done.
|
|
205
238
|
|
|
206
239
|
Screenshots and plots help humans review the result, but engineering
|
|
207
240
|
acceptance should prefer numeric evidence when the solver skill defines it:
|
|
@@ -238,21 +271,17 @@ protected LAN. The runtime currently has no auth layer, and `/connect` plus
|
|
|
238
271
|
`sim-cli-core` ships with no solver drivers built in. Each simulation solver is
|
|
239
272
|
reached through an explicit plugin package.
|
|
240
273
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
| Solver | Package spec |
|
|
244
|
-
| --- | --- |
|
|
245
|
-
| COMSOL | `sim-plugin-comsol` |
|
|
246
|
-
|
|
|
247
|
-
| Ansys Workbench | `sim-plugin-workbench` |
|
|
248
|
-
|
|
|
249
|
-
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
| LTspice | `sim-plugin-ltspice` |
|
|
253
|
-
| OpenFOAM | `git+https://github.com/svd-ai-lab/sim-plugin-openfoam@main` |
|
|
254
|
-
|
|
255
|
-
Under development: Amesim, Dymola, and Flotherm.
|
|
274
|
+
A few representative plugins:
|
|
275
|
+
|
|
276
|
+
| Solver | Package spec | Plugin repo |
|
|
277
|
+
| --- | --- | --- |
|
|
278
|
+
| COMSOL | `sim-plugin-comsol` | [sim-plugin-comsol](https://github.com/svd-ai-lab/sim-plugin-comsol) |
|
|
279
|
+
| Abaqus | `sim-plugin-abaqus` | [sim-plugin-abaqus](https://github.com/svd-ai-lab/sim-plugin-abaqus) |
|
|
280
|
+
| Ansys Workbench | `sim-plugin-workbench` | [sim-plugin-workbench](https://github.com/svd-ai-lab/sim-plugin-workbench) |
|
|
281
|
+
| Autodesk Fusion 360 | _in development_ | [sim-plugin-fusion360](https://github.com/svd-ai-lab/sim-plugin-fusion360) |
|
|
282
|
+
| LTspice | `sim-plugin-ltspice` | [sim-plugin-ltspice](https://github.com/svd-ai-lab/sim-plugin-ltspice) |
|
|
283
|
+
|
|
284
|
+
For the curated full list, see [sim-plugin-index](https://github.com/svd-ai-lab/sim-plugin-index).
|
|
256
285
|
|
|
257
286
|
After adding any plugin package, sync its bundled skill and verify that the local
|
|
258
287
|
solver can be reached:
|
|
@@ -35,7 +35,6 @@ src/sim/
|
|
|
35
35
|
driver.py DriverProtocol + result dataclasses
|
|
36
36
|
compat.py Version-compat profiles + layered skill resolution
|
|
37
37
|
plugins.py Plugin discovery, listing, info
|
|
38
|
-
plugin_catalog.py Catalogue/discovery fetch + normalization
|
|
39
38
|
_plugin_install.py Explicit install / uninstall sources
|
|
40
39
|
drivers/
|
|
41
40
|
__init__.py Plugin registry — discovers external plugins
|
|
@@ -182,15 +182,9 @@ uv run sim check comsol
|
|
|
182
182
|
`sim.toml`; the uv project dependency list remains the clearest place to pin
|
|
183
183
|
the Python environment.
|
|
184
184
|
|
|
185
|
-
## Discovery
|
|
185
|
+
## Discovery
|
|
186
186
|
|
|
187
|
-
|
|
188
|
-
package specs, but install commands remain standard Python package operations.
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
uv run sim plugin catalog
|
|
192
|
-
uv run sim --json plugin catalog
|
|
193
|
-
```
|
|
187
|
+
A curated plugin list lives in the [sim-plugin-index](https://github.com/svd-ai-lab/sim-plugin-index) README — a markdown table with the install string for each plugin. Agents and humans read it directly.
|
|
194
188
|
|
|
195
189
|
## Verifying an install
|
|
196
190
|
|
|
@@ -52,10 +52,10 @@ _VERSION_PIN_RE = re.compile(r"(?:==|!=|~=|>=|<=|>|<)\s*(.+)$")
|
|
|
52
52
|
def _short_name_error(name: str) -> str:
|
|
53
53
|
return (
|
|
54
54
|
f"{name!r} is not an explicit plugin install source. "
|
|
55
|
-
"See
|
|
56
|
-
"explicit pip-installable source: a local
|
|
57
|
-
"wheel/sdist URL, a git URL, or a package
|
|
58
|
-
f"'sim-plugin-{name}'."
|
|
55
|
+
"See https://github.com/svd-ai-lab/sim-plugin-index for a curated "
|
|
56
|
+
"plugin list, or pass an explicit pip-installable source: a local "
|
|
57
|
+
"wheel/sdist path, a direct wheel/sdist URL, a git URL, or a package "
|
|
58
|
+
f"spec such as 'sim-plugin-{name}'."
|
|
59
59
|
)
|
|
60
60
|
|
|
61
61
|
|
|
@@ -318,9 +318,9 @@ def bundle_plugins(names: list[str], output_dir: Path, *,
|
|
|
318
318
|
index_url: str | None = None) -> dict[str, Any]:
|
|
319
319
|
"""The install-resolver-backed bundle flow was removed.
|
|
320
320
|
|
|
321
|
-
|
|
322
|
-
URLs or install exact package specs.
|
|
323
|
-
install-time resolver.
|
|
321
|
+
See https://github.com/svd-ai-lab/sim-plugin-index for a curated plugin
|
|
322
|
+
list, then download explicit wheel URLs or install exact package specs.
|
|
323
|
+
There is no install-time resolver to map short names to wheels.
|
|
324
324
|
"""
|
|
325
325
|
_ = (names, output_dir, index_url)
|
|
326
326
|
return {
|
|
@@ -331,10 +331,10 @@ def bundle_plugins(names: list[str], output_dir: Path, *,
|
|
|
331
331
|
{
|
|
332
332
|
"name": name,
|
|
333
333
|
"error": (
|
|
334
|
-
"bundle no longer resolves
|
|
335
|
-
"sim
|
|
336
|
-
"
|
|
337
|
-
"package specs"
|
|
334
|
+
"bundle no longer resolves short plugin names; see "
|
|
335
|
+
"https://github.com/svd-ai-lab/sim-plugin-index for a "
|
|
336
|
+
"curated plugin list, then pass explicit wheel URLs, "
|
|
337
|
+
"local artifacts, git URLs, or exact package specs"
|
|
338
338
|
),
|
|
339
339
|
}
|
|
340
340
|
for name in names
|
|
@@ -1003,47 +1003,6 @@ def plugin():
|
|
|
1003
1003
|
"""
|
|
1004
1004
|
|
|
1005
1005
|
|
|
1006
|
-
@plugin.command("catalog")
|
|
1007
|
-
@click.option("--offline", is_flag=True,
|
|
1008
|
-
help="Use the cached discovery catalogue only.")
|
|
1009
|
-
@click.option("--refresh", is_flag=True,
|
|
1010
|
-
help="Refresh the cached discovery catalogue.")
|
|
1011
|
-
@click.option("--catalog-url", default=None,
|
|
1012
|
-
help="Override the discovery catalogue URL.")
|
|
1013
|
-
@click.pass_context
|
|
1014
|
-
def plugin_catalog_cmd(ctx, offline, refresh, catalog_url):
|
|
1015
|
-
"""List available plugins from the discovery catalogue.
|
|
1016
|
-
|
|
1017
|
-
This is discovery only. Install commands remain explicit and pip-native;
|
|
1018
|
-
the catalogue is not used to silently resolve short names during install.
|
|
1019
|
-
"""
|
|
1020
|
-
from sim.plugin_catalog import DEFAULT_CATALOG_URL, list_catalog
|
|
1021
|
-
|
|
1022
|
-
rows = list_catalog(
|
|
1023
|
-
url=catalog_url or DEFAULT_CATALOG_URL,
|
|
1024
|
-
offline=offline,
|
|
1025
|
-
force=refresh,
|
|
1026
|
-
)
|
|
1027
|
-
if ctx.obj["json"]:
|
|
1028
|
-
click.echo(json_mod.dumps([r.to_dict() for r in rows], indent=2))
|
|
1029
|
-
return
|
|
1030
|
-
|
|
1031
|
-
if not rows:
|
|
1032
|
-
click.echo("[sim] plugin catalog: no available plugins found")
|
|
1033
|
-
return
|
|
1034
|
-
|
|
1035
|
-
click.echo(f"[sim] {len(rows)} available plugin(s) in catalog:")
|
|
1036
|
-
for r in rows:
|
|
1037
|
-
ver = f" {r.version}" if r.version else ""
|
|
1038
|
-
license_class = f" ({r.license_class})" if r.license_class else ""
|
|
1039
|
-
dist = f" [{r.distribution}]" if r.distribution else ""
|
|
1040
|
-
click.echo(f" {r.id:20s} {r.name}{ver}{dist}{license_class}")
|
|
1041
|
-
if r.summary:
|
|
1042
|
-
click.echo(f" {r.summary}")
|
|
1043
|
-
if r.install:
|
|
1044
|
-
click.echo(f" install: sim plugin install {r.install}")
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
1006
|
@plugin.command("list")
|
|
1048
1007
|
@click.pass_context
|
|
1049
1008
|
def plugin_list(ctx):
|
|
@@ -119,10 +119,6 @@ _EXAMPLES: dict[str, list[dict[str, str]]] = {
|
|
|
119
119
|
{"cmd": "sim --json plugin list",
|
|
120
120
|
"summary": "List every registered plugin (built-in + external)."},
|
|
121
121
|
],
|
|
122
|
-
"plugin catalog": [
|
|
123
|
-
{"cmd": "sim --json plugin catalog",
|
|
124
|
-
"summary": "List available plugins from the discovery catalogue."},
|
|
125
|
-
],
|
|
126
122
|
"plugin info": [
|
|
127
123
|
{"cmd": "sim plugin info coolprop",
|
|
128
124
|
"summary": "Show one plugin's metadata and compatibility profiles."},
|
|
@@ -97,7 +97,7 @@ def test_resolve_bare_short_name_rejected(name: str):
|
|
|
97
97
|
resolve_source(name)
|
|
98
98
|
msg = str(exc.value)
|
|
99
99
|
assert "explicit plugin install source" in msg
|
|
100
|
-
assert "sim
|
|
100
|
+
assert "sim-plugin-index" in msg
|
|
101
101
|
assert f"sim-plugin-{name}" in msg
|
|
102
102
|
|
|
103
103
|
|
|
@@ -112,7 +112,7 @@ def test_bundle_plugins_is_disabled_without_index(tmp_path: Path):
|
|
|
112
112
|
assert result["ok"] is False
|
|
113
113
|
assert result["fetched"] == []
|
|
114
114
|
assert result["errors"][0]["name"] == "ltspice"
|
|
115
|
-
assert "
|
|
115
|
+
assert "sim-plugin-index" in result["errors"][0]["error"]
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
def test_install_bare_short_name_returns_helpful_error(monkeypatch):
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
"""Plugin catalogue/discovery helpers.
|
|
2
|
-
|
|
3
|
-
The catalogue answers "what plugins exist?" for users and agents. It is
|
|
4
|
-
intentionally separate from ``sim plugin install`` source resolution: catalogue
|
|
5
|
-
entries advertise an explicit install string, but installing still requires the
|
|
6
|
-
caller to pass that string (or any other pip-native source) to
|
|
7
|
-
``sim plugin install``. The catalogue is advisory metadata, not a trust
|
|
8
|
-
boundary or a runtime resolver.
|
|
9
|
-
|
|
10
|
-
Schema (sim-plugin-index ``index.json``, ``schema_version: 2``):
|
|
11
|
-
|
|
12
|
-
{
|
|
13
|
-
"id": "ltspice", # short slug
|
|
14
|
-
"name": "LTspice", # display name
|
|
15
|
-
"distribution": "pypi" | "wheel" | "git", # advisory tag
|
|
16
|
-
"install": "sim-plugin-ltspice==0.2.3" # literal arg to `sim plugin install`
|
|
17
|
-
| "https://.../foo.whl#sha256=..."
|
|
18
|
-
| "git+https://...",
|
|
19
|
-
"version": "0.2.3",
|
|
20
|
-
"summary": "...", # optional, display only
|
|
21
|
-
"homepage": "...", # optional, display only
|
|
22
|
-
"license_class": "oss" | "commercial" # optional, display only
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
The reader also accepts the legacy ``schema_version: 1`` shape (``name`` as
|
|
26
|
-
slug, ``latest_version``, ``latest_wheel_url``/``git``/``package``) so the
|
|
27
|
-
catalogue can migrate independently of sim-cli releases.
|
|
28
|
-
"""
|
|
29
|
-
from __future__ import annotations
|
|
30
|
-
|
|
31
|
-
import json
|
|
32
|
-
import time
|
|
33
|
-
import urllib.request
|
|
34
|
-
from dataclasses import dataclass
|
|
35
|
-
from pathlib import Path
|
|
36
|
-
from typing import Any
|
|
37
|
-
|
|
38
|
-
DEFAULT_CATALOG_URL = (
|
|
39
|
-
"https://raw.githubusercontent.com/svd-ai-lab/sim-plugin-index/main/index.json"
|
|
40
|
-
)
|
|
41
|
-
CATALOG_CACHE_TTL_SECONDS = 3600
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def _catalog_cache_path() -> Path:
|
|
45
|
-
return Path.home() / ".sim" / "index-cache" / "catalog.json"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
@dataclass(frozen=True)
|
|
49
|
-
class CatalogEntry:
|
|
50
|
-
"""One available plugin as advertised by the discovery catalogue."""
|
|
51
|
-
|
|
52
|
-
id: str # short slug, e.g. "ltspice"
|
|
53
|
-
name: str = "" # display name, e.g. "LTspice"
|
|
54
|
-
distribution: str = "" # "pypi" | "wheel" | "git" | ""
|
|
55
|
-
install: str = "" # literal arg to `sim plugin install`
|
|
56
|
-
version: str = "" # advertised current version
|
|
57
|
-
summary: str = ""
|
|
58
|
-
homepage: str = ""
|
|
59
|
-
license_class: str = ""
|
|
60
|
-
source: str = "catalog"
|
|
61
|
-
|
|
62
|
-
def to_dict(self) -> dict[str, str]:
|
|
63
|
-
return {
|
|
64
|
-
"id": self.id,
|
|
65
|
-
"name": self.name,
|
|
66
|
-
"distribution": self.distribution,
|
|
67
|
-
"install": self.install,
|
|
68
|
-
"version": self.version,
|
|
69
|
-
"summary": self.summary,
|
|
70
|
-
"homepage": self.homepage,
|
|
71
|
-
"license_class": self.license_class,
|
|
72
|
-
"source": self.source,
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def fetch_catalog(
|
|
77
|
-
url: str = DEFAULT_CATALOG_URL,
|
|
78
|
-
*,
|
|
79
|
-
force: bool = False,
|
|
80
|
-
offline: bool = False,
|
|
81
|
-
) -> dict[str, Any]:
|
|
82
|
-
"""Fetch the plugin discovery catalogue with a small local cache.
|
|
83
|
-
|
|
84
|
-
The cache is only for discovery. It is never consulted at install time.
|
|
85
|
-
"""
|
|
86
|
-
|
|
87
|
-
cache = _catalog_cache_path()
|
|
88
|
-
if offline:
|
|
89
|
-
if cache.is_file():
|
|
90
|
-
try:
|
|
91
|
-
return json.loads(cache.read_text(encoding="utf-8"))
|
|
92
|
-
except (OSError, json.JSONDecodeError):
|
|
93
|
-
return {"schema_version": 2, "plugins": []}
|
|
94
|
-
return {"schema_version": 2, "plugins": []}
|
|
95
|
-
|
|
96
|
-
if not force and cache.is_file():
|
|
97
|
-
try:
|
|
98
|
-
if time.time() - cache.stat().st_mtime < CATALOG_CACHE_TTL_SECONDS:
|
|
99
|
-
return json.loads(cache.read_text(encoding="utf-8"))
|
|
100
|
-
except (OSError, json.JSONDecodeError):
|
|
101
|
-
pass
|
|
102
|
-
|
|
103
|
-
try:
|
|
104
|
-
with urllib.request.urlopen(url, timeout=10) as resp:
|
|
105
|
-
data = resp.read().decode("utf-8")
|
|
106
|
-
parsed = json.loads(data)
|
|
107
|
-
except Exception: # noqa: BLE001 - discovery should degrade gracefully
|
|
108
|
-
if cache.is_file():
|
|
109
|
-
try:
|
|
110
|
-
return json.loads(cache.read_text(encoding="utf-8"))
|
|
111
|
-
except (OSError, json.JSONDecodeError):
|
|
112
|
-
pass
|
|
113
|
-
return {"schema_version": 2, "plugins": []}
|
|
114
|
-
|
|
115
|
-
cache.parent.mkdir(parents=True, exist_ok=True)
|
|
116
|
-
cache.write_text(data, encoding="utf-8")
|
|
117
|
-
return parsed
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
def _legacy_install_string(raw: dict[str, Any]) -> tuple[str, str]:
|
|
121
|
-
"""Derive (install, distribution) from a v1 catalogue entry.
|
|
122
|
-
|
|
123
|
-
v1 entries had ``package`` / ``latest_version`` / ``latest_wheel_url`` /
|
|
124
|
-
``git`` instead of a single ``install`` string. Order of preference:
|
|
125
|
-
pinned wheel URL → PyPI package spec → git URL → bare package name.
|
|
126
|
-
"""
|
|
127
|
-
package = str(raw.get("package") or raw.get("pypi_package") or "").strip()
|
|
128
|
-
version = str(raw.get("latest_version") or raw.get("version") or "").strip()
|
|
129
|
-
wheel_url = str(raw.get("latest_wheel_url") or "").strip()
|
|
130
|
-
git_url = str(raw.get("git") or "").strip()
|
|
131
|
-
|
|
132
|
-
if wheel_url:
|
|
133
|
-
return wheel_url, "wheel"
|
|
134
|
-
if package and version:
|
|
135
|
-
return f"{package}=={version}", "pypi"
|
|
136
|
-
if package:
|
|
137
|
-
return package, "pypi"
|
|
138
|
-
if git_url:
|
|
139
|
-
return f"git+{git_url}", "git"
|
|
140
|
-
return "", ""
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
def _entry_from_mapping(raw: dict[str, Any], *, source: str) -> CatalogEntry | None:
|
|
144
|
-
# Slug: prefer v2 `id`, fall back to v1 `name`.
|
|
145
|
-
slug = str(raw.get("id") or raw.get("name") or "").strip()
|
|
146
|
-
if not slug:
|
|
147
|
-
return None
|
|
148
|
-
|
|
149
|
-
# Display name: prefer explicit `name`, fall back to slug.
|
|
150
|
-
display = str(raw.get("name") or slug).strip()
|
|
151
|
-
# If both `id` and `name` were absent we used `name` as slug — re-derive
|
|
152
|
-
# display from the slug to avoid showing the raw key as both fields.
|
|
153
|
-
if not raw.get("id") and raw.get("name"):
|
|
154
|
-
display = str(raw["name"]).strip()
|
|
155
|
-
|
|
156
|
-
distribution = str(raw.get("distribution") or "").strip()
|
|
157
|
-
install = str(raw.get("install") or "").strip()
|
|
158
|
-
version = str(raw.get("version") or raw.get("latest_version") or "").strip()
|
|
159
|
-
|
|
160
|
-
# v1 fallback: synthesize install + distribution from legacy fields.
|
|
161
|
-
if not install:
|
|
162
|
-
install, legacy_dist = _legacy_install_string(raw)
|
|
163
|
-
if not distribution:
|
|
164
|
-
distribution = legacy_dist
|
|
165
|
-
|
|
166
|
-
return CatalogEntry(
|
|
167
|
-
id=slug,
|
|
168
|
-
name=display,
|
|
169
|
-
distribution=distribution,
|
|
170
|
-
install=install,
|
|
171
|
-
version=version,
|
|
172
|
-
summary=str(raw.get("summary") or raw.get("description") or ""),
|
|
173
|
-
homepage=str(raw.get("homepage") or raw.get("url") or raw.get("git") or ""),
|
|
174
|
-
license_class=str(raw.get("license_class") or raw.get("license") or ""),
|
|
175
|
-
source=source,
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
def normalize_catalog(raw: dict[str, Any], *, source: str = "catalog") -> list[CatalogEntry]:
|
|
180
|
-
"""Normalize current and legacy catalogue shapes into ``CatalogEntry`` rows."""
|
|
181
|
-
|
|
182
|
-
plugins = raw.get("plugins", [])
|
|
183
|
-
if isinstance(plugins, dict):
|
|
184
|
-
iterable = []
|
|
185
|
-
for slug, info in plugins.items():
|
|
186
|
-
if isinstance(info, dict):
|
|
187
|
-
# If the value already carries `id` we trust it; otherwise
|
|
188
|
-
# promote the dict key to the slug.
|
|
189
|
-
item = {"id": slug, **info} if "id" not in info else dict(info)
|
|
190
|
-
else:
|
|
191
|
-
item = {"id": slug}
|
|
192
|
-
iterable.append(item)
|
|
193
|
-
elif isinstance(plugins, list):
|
|
194
|
-
iterable = [p for p in plugins if isinstance(p, dict)]
|
|
195
|
-
else:
|
|
196
|
-
iterable = []
|
|
197
|
-
|
|
198
|
-
rows = []
|
|
199
|
-
for item in iterable:
|
|
200
|
-
row = _entry_from_mapping(item, source=source)
|
|
201
|
-
if row is not None:
|
|
202
|
-
rows.append(row)
|
|
203
|
-
return sorted(rows, key=lambda r: r.id.lower())
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
def list_catalog(
|
|
207
|
-
*,
|
|
208
|
-
query: str | None = None,
|
|
209
|
-
url: str = DEFAULT_CATALOG_URL,
|
|
210
|
-
offline: bool = False,
|
|
211
|
-
force: bool = False,
|
|
212
|
-
) -> list[CatalogEntry]:
|
|
213
|
-
"""List available plugins from the discovery catalogue.
|
|
214
|
-
|
|
215
|
-
``query`` is an optional case-insensitive substring filter over
|
|
216
|
-
``id``/``name``/``summary``/``homepage``. Kept as a helper-level option for
|
|
217
|
-
callers that want to filter the same data; the CLI exposes only the full
|
|
218
|
-
listing (``sim plugin catalog``).
|
|
219
|
-
"""
|
|
220
|
-
|
|
221
|
-
raw = fetch_catalog(url=url, offline=offline, force=force)
|
|
222
|
-
rows = normalize_catalog(raw, source=url)
|
|
223
|
-
if not query:
|
|
224
|
-
return rows
|
|
225
|
-
q = query.lower()
|
|
226
|
-
return [
|
|
227
|
-
row for row in rows
|
|
228
|
-
if q in row.id.lower()
|
|
229
|
-
or q in row.name.lower()
|
|
230
|
-
or q in row.summary.lower()
|
|
231
|
-
or q in row.homepage.lower()
|
|
232
|
-
]
|