Files
solidcraft-upstream/crates/engine/src/legacy_ids.rs
T
bherbruckandClaude Opus 5.5 d10312b7fd Command ids are SolveCraft's own: 173 ids that were another product's internal command ids become dotted, lower-case ids (<area>.<thing>[.<variant>]: solid.extrude, sketch.rectangle.two_point, sheet.flange, joint.drive, ...), in the registry, toolbar, dialogs, shortcuts, palette, control channel, MCP, examples, scenarios and docs
The old ids live only in crates/engine/src/legacy_ids.rs (the legacy migration table): find_command maps them, so old scripts, recipes and control calls keep working, and saved shortcuts, recent and pinned commands are migrated on load (designs store no command ids). Parity maps the observed catalog ids to ours through xtask/data/fusion-ids.tsv. The agent rule now reads: our own dotted id, never another product's. Cargo.toml's repository points at github.com/bherbruck/solvecraft.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 12:17:23 +00:00

237 lines
12 KiB
Rust

//! Legacy migration: the command ids SolveCraft used before 2026-10-09, when many commands
//! carried the id of the matching command in another CAD program, and the dotted ids that
//! replaced them. This is the one place the old ids live. Old scripts, recipes, control-channel
//! calls, saved shortcuts and toolbar layouts keep working: `find_command` and the preference
//! loaders map an old id through `current_id`. `solvecraft-tools/rename_ids.sh` converts a
//! worktree with this same table.
/// (old id, current id).
pub const LEGACY_IDS: &[(&str, &str)] = &[
("AsBuiltPositionsCmd", "component.revert_position"),
("FusionCreateComponentsFromBodiesCommand", "component.from_bodies"),
("FusionCreateNewComponentCommand", "component.create"),
("SnapshotCmd", "component.capture_position"),
("FusionShowDesignConfigPanelCmd", "config.table"),
("FusionStartDesignConfigModeCmd", "config.configure"),
("FusionComputeAllCommand", "timeline.compute_all"),
("FusionDeleteCommand", "timeline.delete"),
("FusionRenameTimelineEntryCommand", "timeline.rename"),
("RedoCommand", "edit.redo"),
("UndoCommand", "edit.undo"),
("timeline.rollTo", "timeline.roll_to"),
("AlignCmd", "solid.align"),
("EmbossCmd", "solid.emboss"),
("FusionReplaceFaceCommand", "solid.replace_face"),
("FusionRibCommand", "solid.rib"),
("FusionWebCommand", "solid.web"),
("PrimitiveCoil", "solid.coil"),
("SoftDeleteCommand", "solid.remove"),
("ConstructionPlaneAtAngleCommand", "construct.plane.at_angle"),
("ConstructionPlaneOffsetFromPlaneCommand", "construct.plane.offset"),
("Extrude", "solid.extrude"),
("FusionChamferCommand", "solid.chamfer"),
("FusionCombineCommand", "solid.combine"),
("FusionDraftCommand", "solid.draft"),
("FusionFilletEdgesCommand", "solid.fillet"),
("FusionHoleCommand", "solid.hole"),
("FusionMoveCommand", "solid.move"),
("FusionOffsetFacesCommand", "solid.offset_face"),
("FusionPressPullCommand", "solid.press_pull"),
("FusionShellBodyCommand", "solid.shell"),
("FusionSplitBodyCommand", "solid.split_body"),
("FusionThreadCommand", "solid.thread"),
("MirrorCommand", "solid.mirror"),
("ModifyScale", "solid.scale"),
("PatternCircular", "solid.pattern.circular"),
("PatternOnPath", "solid.pattern.path"),
("PatternRectangular", "solid.pattern.rectangular"),
("PrimitiveBox", "solid.box"),
("PrimitiveCylinder", "solid.cylinder"),
("PrimitivePipe", "solid.pipe"),
("PrimitiveSphere", "solid.sphere"),
("PrimitiveTorus", "solid.torus"),
("Revolve", "solid.revolve"),
("SolidLoft", "solid.loft"),
("StockModelCommand", "solid.bounding_solid"),
("Sweep", "solid.sweep"),
("ExportCommand", "file.export"),
("FusionImportCommandFromToolbar", "file.insert_step"),
("FusionSaveAsSTLCommand", "file.save_mesh"),
("NewDocumentCommand", "file.new"),
("ParaMeshInsertAlignCommand", "file.insert_mesh"),
("SaveDocumentAsCommand", "file.save_as"),
("SaveDocumentCommand", "file.save"),
("AppearanceCommand", "appearance.assign"),
("MeasureCommand", "inspect.measure"),
("PhysicalMaterialCommand", "material.assign"),
("FusionMotionRelationshipCommand", "joint.motion_link"),
("FusionMoveJointsCommand", "joint.drive"),
("InterferenceCheckCommand", "inspect.interference"),
("JointAsBuiltCmd", "joint.as_built"),
("JointAssembleCmdNew", "joint.create"),
("JointOrigin", "joint.origin"),
("RigidGroupCmd", "joint.rigid_group"),
("ContactSetCmd", "contact.create"),
("DisableAllContactCmd", "contact.disable_all"),
("EnableAllContactCmd", "contact.enable_all"),
("EnableContactSetsCmd", "contact.enable_sets"),
("FusionMotionStudyCommand", "motion.study"),
("ChangeParameterCommand", "parameters.change"),
("FusionFastenersCommand", "parts.fastener"),
("FusionAssignPlasticRuleCommand", "plastic.assign_rule"),
("FusionBossCommand", "plastic.boss"),
("FusionLipCommand", "plastic.lip"),
("FusionManagePlasticRuleCommand", "plastic.manage_rules"),
("FusionRestCommand", "plastic.rest"),
("FusionSnapFitCommand", "plastic.snap_fit"),
("FusionHalfSectionViewCommand", "inspect.section"),
("ConvertToSheetMetalCmd", "sheet.convert"),
("FusionSheetMetalFlangeCommand", "sheet.flange"),
("FusionSheetMetalFlatPatternCmd", "sheet.flat_pattern"),
("FusionSheetMetalHemFlangeCommand", "sheet.hem"),
("FusionSheetMetalRulesCommand", "sheet.manage_rules"),
("FusionSheetmetalUnfoldCommand", "sheet.unfold"),
("SheetMetalFoldCmd", "sheet.fold"),
("FusionAddCanvasCommand", "canvas.insert"),
("FusionAddEditDecalCommand", "canvas.decal"),
("ConstraintSmooth", "sketch.constraint.curvature"),
("SketchAutoConstrainAndFinish", "sketch.finish_auto_constrain"),
("SketchAutoConstraintAndDimCmd", "sketch.auto_constrain"),
("SketchAutoConstraintAndDimFromDatumCmd", "sketch.auto_constrain_from_datum"),
("SketchConstrainer", "sketch.constrainer"),
("SketchPolygonConstraintCmd", "sketch.constraint.polygon"),
("ArcTangent", "sketch.arc.tangent"),
("BlendG1CurveSketchCmd", "sketch.blend_curve"),
("CircleElipse", "sketch.ellipse"),
("CircleTanTanRadius", "sketch.circle.two_tangent"),
("CircleThreeTangent", "sketch.circle.three_tangent"),
("ConicCurveCmd", "sketch.conic"),
("DrawCVMSpline3D", "sketch.spline.control_point"),
("DrawCVMSpline5D", "sketch.spline.control_point_5"),
("DrawSpline", "sketch.spline.fit_point"),
("MTextCmd", "sketch.text"),
("ShapeArcSlotCenterTwoPoint", "sketch.slot.arc_center"),
("ShapeArcSlotThreePoint", "sketch.slot.arc_three_point"),
("ShapeSlotCenterPoint", "sketch.slot.center_point"),
("SketchMidpointLine", "sketch.line.midpoint"),
("ImportDxfFileCommand", "sketch.insert_dxf"),
("SketchImportSVG", "sketch.insert_svg"),
("FusionCenterOfMassCommand", "inspect.center_of_mass"),
("FusionCurvatureCombAnalysisCommand", "inspect.curvature_comb"),
("FusionIsoCurveAnalysisCommand", "inspect.isocurve"),
("FusionMinimumRadiusAnalysisCommand", "inspect.minimum_radius"),
("BreakSketchCmd", "sketch.break"),
("ChamferSketchDistanceAngle", "sketch.chamfer.distance_angle"),
("ChamferSketchDistanceDistance", "sketch.chamfer.two_distance"),
("ChamferSketchEqualDistance", "sketch.chamfer.equal_distance"),
("CircularSketchPatternCommand", "sketch.pattern.circular"),
("ExtendSketchCmd", "sketch.extend"),
("FilletSketchCmd", "sketch.fillet"),
("MirrorSketchCommand", "sketch.mirror"),
("Offset", "sketch.offset"),
("RectangularSketchPatternCommand", "sketch.pattern.rectangular"),
("SketchScaleCmd", "sketch.scale"),
("TrimSketchCmd", "sketch.trim"),
("FitCurvesToSectionCommand", "sketch.fit_curves_to_section"),
("Include3DGeometry", "sketch.include_3d"),
("IntersectCmd", "sketch.intersect"),
("IntersectionCurve", "sketch.intersection_curve"),
("ProjectNewCmd", "sketch.project"),
("ProjectToSurface", "sketch.project_to_surface"),
("SketchIsoparametricCurve", "sketch.isoparametric_curve"),
("SpunProfileCmd", "sketch.spun_profile"),
("ArcCenterTwoPoint", "sketch.arc.center_point"),
("ArcThreePoint", "sketch.arc.three_point"),
("CircleCenterRadius", "sketch.circle.center"),
("CircleThreePoint", "sketch.circle.three_point"),
("CircleTwoPoint", "sketch.circle.two_point"),
("ConstraintCoincident", "sketch.constraint.coincident"),
("ConstraintCollinear", "sketch.constraint.collinear"),
("ConstraintConcentric", "sketch.constraint.concentric"),
("ConstraintEqual", "sketch.constraint.equal"),
("ConstraintFix", "sketch.constraint.fix"),
("ConstraintHorizontalVertical", "sketch.constraint.horizontal_vertical"),
("ConstraintMidPoint", "sketch.constraint.midpoint"),
("ConstraintParallel", "sketch.constraint.parallel"),
("ConstraintPerpendicular", "sketch.constraint.perpendicular"),
("ConstraintSymmetry", "sketch.constraint.symmetry"),
("ConstraintTangent", "sketch.constraint.tangent"),
("DrawPoint", "sketch.point"),
("DrawPolyline", "sketch.line"),
("ShapePolygonCircumscribed", "sketch.polygon.circumscribed"),
("ShapePolygonEdge", "sketch.polygon.edge"),
("ShapePolygonInscribed", "sketch.polygon.inscribed"),
("ShapeRectangleCenter", "sketch.rectangle.center"),
("ShapeRectangleThreePoint", "sketch.rectangle.three_point"),
("ShapeRectangleTwoPoint", "sketch.rectangle.two_point"),
("ShapeSlotCenterToCenter", "sketch.slot.center_to_center"),
("ShapeSlotOverall", "sketch.slot.overall"),
("SketchActivate", "sketch.edit"),
("SketchCreate", "sketch.create"),
("SketchDimension", "sketch.dimension"),
("SketchStop", "sketch.finish"),
("FusionAccessibilityAnalysisCommand", "inspect.accessibility"),
("FusionCurvatureMapAnalysisCommand", "inspect.curvature_map"),
("FusionDraftAnalysisCommand", "inspect.draft"),
("FusionEnvironmentMapAnalysisCommand", "inspect.environment_map"),
("FusionZebraAnalysisCommand", "inspect.zebra"),
("FusionExtendCommand", "surface.extend"),
("FusionSurfacePatchCommand", "surface.patch"),
("FusionSurfaceStitchCommand", "surface.stitch"),
("FusionSurfaceThickenCommand", "surface.thicken"),
("FusionSurfaceTrimCommand", "surface.trim"),
("FusionSplitFaceCommand", "solid.split_face"),
("ConstructionAxisThroughCylinderCommand", "construct.axis.through_cylinder"),
("ConstructionAxisNormalToFaceCommand", "construct.axis.normal_to_face"),
("ConstructionAxisFromTwoPlanesCommand", "construct.axis.two_planes"),
("ConstructionAxisThroughTwoPointsCommand", "construct.axis.two_points"),
("ConstructionAxisThroughEdgeCommand", "construct.axis.edge"),
("ConstructionPointFromPointCommand", "construct.point.vertex"),
("ConstructionPointThroughTwoEdgesCommand", "construct.point.two_edges"),
("ConstructionPointFromThreePlanesCommand", "construct.point.three_planes"),
("ConstructionPointFromCircleOrSphereCommand", "construct.point.center"),
("ConstructionPointAtEdgeAndPlaneCommand", "construct.point.edge_plane"),
("ConstructionPointAlongPathCommand", "construct.point.along_path"),
("ConstructionMidPlaneCommand", "construct.plane.midplane"),
("ConstructionPlaneFromTwoEdgesCommand", "construct.plane.two_edges"),
("ConstructionPlaneFromThreePointsCommand", "construct.plane.three_points"),
("ConstructionTangentPlaneCommand", "construct.plane.tangent"),
("ConstructionPlaneAlongPathCommand", "construct.plane.along_path"),
];
/// The current id for a command id that may be a legacy one (unchanged otherwise).
pub fn current_id(id: &str) -> &str {
LEGACY_IDS.iter().find(|(old, _)| old.eq_ignore_ascii_case(id)).map(|(_, new)| *new).unwrap_or(id)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn every_legacy_id_names_a_command() {
let unknown: Vec<&str> =
LEGACY_IDS.iter().filter(|(_, new)| crate::find_command(new).is_none_or(|c| c.id != *new)).map(|(_, new)| *new).collect();
// The construction set and Split Face are on a branch not yet merged when the table was made.
let pending = ["solid.split_face"];
let unknown: Vec<&str> = unknown
.into_iter()
.filter(|n| {
!pending.contains(n)
&& !n.starts_with("construct.axis")
&& !n.starts_with("construct.point")
&& ![
"construct.plane.midplane",
"construct.plane.two_edges",
"construct.plane.three_points",
"construct.plane.tangent",
"construct.plane.along_path",
]
.contains(n)
})
.collect();
assert!(unknown.is_empty(), "{unknown:?}");
assert_eq!(crate::find_command("SketchCreate").map(|c| c.id), Some("sketch.create"));
}
}