wip: preserve local engine and agent workflow changes before ganjihong refactor integration

This commit is contained in:
2026-09-09 17:08:24 +08:00
parent a5c3ec1f36
commit 387b99e255
112 changed files with 3543 additions and 12177 deletions
+13 -1
View File
@@ -1,5 +1,6 @@
from __future__ import annotations
import re
from typing import Any
from .featurescript_lexer import Token, lex
from .ir import Call, FeatureIR, ModelIR, SketchIR
@@ -130,7 +131,18 @@ def _arg_map(call: Call) -> dict[str, Any]:
def parse_featurescript(source: str, sample_id: str = "unknown") -> ModelIR:
parser = Parser(source); calls = parser.statements(); model = ModelIR(sample_id, raw_source=source)
parser = Parser(source); calls = parser.statements()
version = re.search(r"\bFeatureScript\s+(\d+(?:\.\d+)*)\s*;", source)
standard_library = re.search(
r"\bimport\s*\(\s*path\s*:\s*[\"']([^\"']*onshape/std/[^\"']*)[\"']",
source,
)
model = ModelIR(
sample_id,
raw_source=source,
featurescript_version=version.group(1) if version else None,
standard_library=standard_library.group(1) if standard_library else None,
)
for call in calls:
if call.name == "newSketch":
definition = _arg_map(call)