Skip to content

Commit 4ac7836

Browse files
committed
chore(release): codex 1.1.27 (source)
1 parent e5cfaa2 commit 4ac7836

2 files changed

Lines changed: 22 additions & 21 deletions

File tree

plugins/rldyour-flow/scripts/flow_post_task_state.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
import subprocess
99
import sys
1010
from pathlib import Path
11-
from typing import Any
11+
from typing import Any, cast
1212

1313
SCRIPT_DIR = Path(__file__).resolve().parent
1414
if str(SCRIPT_DIR) not in sys.path:
1515
sys.path.insert(0, str(SCRIPT_DIR))
1616

17-
from project_flow_policy import load_policy
17+
from project_flow_policy import load_policy # noqa: E402
1818

1919

2020
RUNTIME_IGNORED = {
@@ -216,9 +216,12 @@ def flush() -> None:
216216
return candidates
217217

218218

219+
def _dict_section(value: object) -> dict[str, Any]:
220+
return cast(dict[str, Any], value) if isinstance(value, dict) else {}
221+
222+
219223
def _effective_policy(policy: dict[str, Any]) -> dict[str, Any]:
220-
effective = policy.get("effective")
221-
return effective if isinstance(effective, dict) else {}
224+
return _dict_section(policy.get("effective"))
222225

223226

224227
def _runtime_execution(effective_policy: dict[str, Any]) -> dict[str, Any]:
@@ -277,8 +280,8 @@ def _policy_list(section: dict[str, Any], key: str, fallback: tuple[str, ...]) -
277280

278281
def _branch_cleanup_state(current_branch: str, policy: dict[str, Any]) -> dict[str, Any]:
279282
effective = _effective_policy(policy)
280-
branches_policy = effective.get("branches") if isinstance(effective.get("branches"), dict) else {}
281-
cleanup_policy = effective.get("branch_cleanup") if isinstance(effective.get("branch_cleanup"), dict) else {}
283+
branches_policy = _dict_section(effective.get("branches"))
284+
cleanup_policy = _dict_section(effective.get("branch_cleanup"))
282285
protected_branches = set(PROTECTED_BRANCHES)
283286
protected_branches.update(branches_policy.get("protected_branches", []) if isinstance(branches_policy, dict) else [])
284287
protected_branches.update(cleanup_policy.get("protected_branches", []) if isinstance(cleanup_policy, dict) else [])
@@ -421,9 +424,9 @@ def state() -> dict[str, Any]:
421424

422425
project_policy = load_policy(Path.cwd())
423426
effective_policy = _effective_policy(project_policy)
424-
fullrepo_policy = effective_policy.get("fullrepo") if isinstance(effective_policy.get("fullrepo"), dict) else {}
425-
stop_policy = effective_policy.get("stop_hook") if isinstance(effective_policy.get("stop_hook"), dict) else {}
426-
serena_policy = effective_policy.get("serena") if isinstance(effective_policy.get("serena"), dict) else {}
427+
fullrepo_policy = _dict_section(effective_policy.get("fullrepo"))
428+
stop_policy = _dict_section(effective_policy.get("stop_hook"))
429+
serena_policy = _dict_section(effective_policy.get("serena"))
427430
fullrepo_mode = str(fullrepo_policy.get("mode", "auto"))
428431
runtime_execution = _runtime_execution(effective_policy)
429432
execution_mode = str(runtime_execution["execution_mode"])

plugins/rldyour-flow/scripts/instruction_docs_state.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
import subprocess
99
import sys
1010
from pathlib import Path
11-
from typing import Any
11+
from typing import Any, cast
1212

1313
SCRIPT_DIR = Path(__file__).resolve().parent
1414
if str(SCRIPT_DIR) not in sys.path:
1515
sys.path.insert(0, str(SCRIPT_DIR))
1616

17-
from project_flow_policy import load_policy
17+
from project_flow_policy import load_policy # noqa: E402
1818

1919

2020
CODEX_DOC = "AGENTS.md"
@@ -179,6 +179,10 @@ def file_line_count(path: Path) -> int:
179179
return len(path.read_text(encoding="utf-8", errors="replace").splitlines())
180180

181181

182+
def dict_section(value: object) -> dict[str, Any]:
183+
return cast(dict[str, Any], value) if isinstance(value, dict) else {}
184+
185+
182186
def instruction_state(root: Path) -> dict[str, Any]:
183187
root = root.resolve()
184188
if git(root, "rev-parse", "--is-inside-work-tree").returncode != 0:
@@ -190,16 +194,10 @@ def instruction_state(root: Path) -> dict[str, Any]:
190194
}
191195

192196
project_policy = load_policy(root)
193-
effective_policy = project_policy.get("effective") if isinstance(project_policy.get("effective"), dict) else {}
194-
fullrepo_policy = effective_policy.get("fullrepo") if isinstance(effective_policy.get("fullrepo"), dict) else {}
195-
normal_policy = (
196-
effective_policy.get("normal_branch_policy")
197-
if isinstance(effective_policy.get("normal_branch_policy"), dict)
198-
else {}
199-
)
200-
instruction_policy = (
201-
effective_policy.get("instruction_docs") if isinstance(effective_policy.get("instruction_docs"), dict) else {}
202-
)
197+
effective_policy = dict_section(project_policy.get("effective"))
198+
fullrepo_policy = dict_section(effective_policy.get("fullrepo"))
199+
normal_policy = dict_section(effective_policy.get("normal_branch_policy"))
200+
instruction_policy = dict_section(effective_policy.get("instruction_docs"))
203201
instruction_docs_mode = str(instruction_policy.get("mode", "auto"))
204202
normal_instruction_mode = str(normal_policy.get("instruction_docs", "auto"))
205203
if instruction_docs_mode == "auto" and normal_instruction_mode != "auto":

0 commit comments

Comments
 (0)