Restructure SDK outputs into sdk/{rust,rhai,python,js}/ (#70) #89
No reviewers
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_rpc!89
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-70-sdk-restructure"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #70.
Summary
Unifies generated SDK output into a single
sdk/umbrella, one folder per language target. Previously the Rust SDK lived undercrates/<name>_sdk/, the Rhai bindings undercrates/<name>_rhai/, JS output was a loosesdk/js/types_generated.js, and Python was emitted at all only when the user manually opted in.After this PR:
Cargo package names inside
sdk/rust/andsdk/rhai/keep their_sdk/_rhaisuffix per hero_rpc#55 §6 — only the on-disk directory moved.crates/keeps the binaries + core lib + examples.Changes
crates/generator/src/build/scaffold.rsCargo.tomlmembers updated tosdk/rustandsdk/rhai.create_workspace_dirscreatessdk/rust/,sdk/rust/src/, and (when Rhai is enabled)sdk/rhai/src/.generate_sdk_cratewrites tosdk/rust/;generate_rhai_cratewrites tosdk/rhai/.crates/<name>/build.rsnow setsclient_crate_dir("../../sdk/rust")and calls.with_python_sdk()._examplescrate's path dep moved to../../sdk/rust.test_scaffold_unified_sdk_layout,test_workspace_cargo_toml_uses_sdk_paths,test_scaffold_build_rs_opts_into_python_and_sdk_rust.crates/generator/src/generate/js.rssdk/js/package.json(preserved on re-run) + per-domainsdk/js/src/<domain>.js+ an auto-regeneratedsdk/js/src/index.jsbarrel.crates/generator/src/build/emit/python_sdk.rshero_hero_*_sdkdouble-prefix bug surfaced by the regen: whensdk_types_crate("hero_recipes")was set (the value the scaffolder always emits), the Python emitter unconditionally prepended anotherhero_. Now the leadinghero_is stripped before being re-applied, so both bare and prefixed crate names land atsdk/python/hero_<svc>_sdk/. New testpython_sdk_strips_redundant_hero_prefix_in_package_name.example/recipe_server/sdk/rust/,sdk/rhai/, brand-newsdk/python/hero_recipes_sdk/, and a propersdk/js/package.Cargo.toml,_examplespath dep, andcrates/hero_recipes/build.rsupdated.Out of scope
hero_skills—hero_service_scaffold.mdskill update will land as a separate PR there.hero_servicetemplate repo — separate regen PR in that repo.Acceptance
cargo build --workspace— clean (1 pre-existing unused-imports warning in generatedtypes_generated.rs, untouched).cargo test -p hero_rpc_generator --lib— 131 passed; 0 failed.lab infocheck— identical todevelopment(4 clean, 2 with pre-existing issues incrates/generator+crates/hero_lifecyclemain.rs §5 boilerplate — out of scope for #70).<hero-api-docs>still resolves:docs/openrpc.jsonregeneration intact,recipes_admin/src/main.rsstillinclude_str!s it correctly.Test plan
cargo build --workspacefrom the hero_rpc rootcargo build --workspacefromexample/recipe_servercargo test -p hero_rpc_generator --liblab infocheck— no new failures vsdevelopmentexample/recipe_server/sdk/tree —rust/,rhai/,python/,js/all populated correctly; nocrates/hero_recipes_{sdk,rhai}/left over🤖 Generated with Claude Code
Regenerates `example/recipe_server/` against the new unified SDK layout introduced in the previous commit. * `crates/hero_recipes_sdk/` → `sdk/rust/` * `crates/hero_recipes_rhai/` → `sdk/rhai/` * New `sdk/python/hero_recipes_sdk/` package (emitted by `.with_python_sdk()`). * Old loose `sdk/js/types_generated.js` becomes a proper ESM package: `sdk/js/package.json` + per-domain `sdk/js/src/<domain>.js` + barrel `sdk/js/src/index.js`. * Workspace `Cargo.toml` members updated; `_examples` crate's path dep now points at `../../sdk/rust`. * `crates/hero_recipes/build.rs` opts into the Python SDK and routes `client_crate_dir` to `../../sdk/rust`. Bonus: fixes a double-prefix bug in the Python SDK emitter where `sdk_types_crate("hero_recipes")` produced `sdk/python/hero_hero_recipes_sdk/`. The leading `hero_` prefix is now stripped before being re-applied, so both bare and prefixed crate names land at `sdk/python/hero_<svc>_sdk/`. Tests added. `cargo build --workspace` on the example tree is clean (one pre-existing unused-imports warning in the generated `types_generated.rs`, untouched by this change). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>sdk/{rust,python,rhai,js}/#70