je_web_runner.api.authoring
Façade: action formatter / md authoring / templates / linter / migration.
- exception je_web_runner.api.authoring.ActionFormatterError
Bases:
WebRunnerExceptionRaised when input cannot be parsed as an action list.
- class je_web_runner.api.authoring.ActionTemplate(name: 'str', actions: 'List[Any]', parameters: 'Sequence[str]' = <factory>, description: 'str' = '')
Bases:
object- actions: List[Any]
- description: str = ''
- name: str
- parameters: Sequence[str]
- exception je_web_runner.api.authoring.ActionTemplateError
Bases:
WebRunnerExceptionRaised when template lookup, registration, or render fails.
- exception je_web_runner.api.authoring.BootstrapError
Bases:
WebRunnerExceptionRaised when the target directory is not safe to write into.
- exception je_web_runner.api.authoring.MdAuthoringError
Bases:
WebRunnerExceptionRaised on invalid input or empty Markdown.
- exception je_web_runner.api.authoring.SelToPwError
Bases:
WebRunnerExceptionRaised on invalid input to the translator.
- class je_web_runner.api.authoring.StarterFile(relative_path: 'str', content: 'str')
Bases:
object- content: str
- relative_path: str
- class je_web_runner.api.authoring.Translation(line: 'int', original: 'str', translated: 'str', note: 'str' = '')
Bases:
object- line: int
- note: str = ''
- original: str
- translated: str
- je_web_runner.api.authoring.available_templates() → List[str]
- je_web_runner.api.authoring.format_actions(actions: List[Any], indent: int = 2) → str
把 action list 轉成 canonical 多行 JSON。
indent為頂層 array 縮排空白數。 Format an action list as canonical JSON. Each action lives on its own line; the surrounding array usesindentspaces.
- je_web_runner.api.authoring.format_file(path: str | Path, write: bool = True, indent: int = 2) → Tuple[str, bool]
讀檔、格式化、(可選)寫回;回傳
(formatted_text, changed)。 Reformatpath. Whenwriteis True the file is rewritten only if its content changed. Returns the new text and whether it was different from the original.
- je_web_runner.api.authoring.format_text(text: str, indent: int = 2) → str
Parse JSON text and return its formatted form.
- je_web_runner.api.authoring.get_template(name: str) → ActionTemplate
- je_web_runner.api.authoring.init_workspace(directory: str, overwrite: bool = False, files_to_write: List[StarterFile] = None) → Dict[str, str]
建立 starter 結構。回傳
{relative_path: 'created' | 'skipped'}。 Write each starter file underdirectory; existing files are skipped unlessoverwrite=True.
- je_web_runner.api.authoring.parse_markdown(text: str) → List[List[Any]]
把 Markdown bullets 解析成 action list;無法辨識的條目保留為
WR__note。 Parse a Markdown body and return a flat WR_* action list. Each bullet line that doesn’t match a template is preserved as aWR__noteso the round-trip stays loss-less.
- je_web_runner.api.authoring.register_template(template: ActionTemplate) → None
- je_web_runner.api.authoring.render_template(name: str, parameters: Dict[str, Any] | None = None) → List[Any]
把
{{name}}替換成實際值,回傳深拷貝的 action list Substitute every{{name}}placeholder in the template with the matching value fromparametersand return a deep-copied action list. RaisesActionTemplateErrorif any required parameter is missing.
- je_web_runner.api.authoring.starter_files() → List[StarterFile]
Return the full list of files written by
init_workspace().
- je_web_runner.api.authoring.supported_action_commands() → List[str]
- je_web_runner.api.authoring.supported_bullet_patterns() → List[str]
Return the list of bullet templates the parser recognises.
- je_web_runner.api.authoring.supported_python_patterns() → List[str]
- je_web_runner.api.authoring.translate_action_list(actions: List[Any]) → List[List[Any]]
把
WR_*action 清單翻譯成 Playwright 變體;無對應時保留原本的指令並加註。 Translate a WebRunner action list.WR_implicitly_waitis dropped silently; commands without a registered mapping survive intact so the output remains a runnable draft.
- je_web_runner.api.authoring.translate_python_source(source: str) → List[Translation]
Translate Python source line-by-line, returning a Translation per hit.
- je_web_runner.api.authoring.transpile_file(md_path: str | Path, output_path: str | Path | None = None) → List[List[Any]]
讀
md_path,轉成 action list。output_path提供時會寫成格式化 JSON。 Readmd_path, transpile, and optionally write the formatted JSON tooutput_path.