|
22 | 22 | from pathlib import Path |
23 | 23 | from typing import Any |
24 | 24 |
|
25 | | -from astrid.core.project.current_run import read_current_run |
26 | | -from astrid.core.foundation.project_paths import project_dir |
27 | | -from astrid.core.session.binding import ( |
28 | | - ASTRID_SESSION_ID_ENV, |
29 | | - SESSION_FILE_NAME, # noqa: F401 — re-export; tests patch cli.SESSION_FILE_NAME |
30 | | - attach_session, |
31 | | -) |
32 | | -from astrid.core.session.constants import STUCK_NO_EVENT_SECONDS |
33 | | -from astrid.core.session.identity import ( |
34 | | - Identity, |
35 | | - IdentityError, |
36 | | - bootstrap_identity, |
37 | | - read_identity, |
38 | | - # validate_agent_slug moved to cli_attach |
39 | | -) |
40 | | -from astrid.core.session.lease import read_lease |
41 | | -# lifecycle imports (SessionTakeoverTargetError, takeover_session) moved to cli_sessions; |
42 | | -# load_session moved to cli_attach. |
43 | | -from astrid.core.session.model import ( |
44 | | - Session, |
45 | | - SessionRole, |
46 | | - SessionStore, |
47 | | - # SessionRecordNotFoundError moved to cli_status |
48 | | - # SessionStoreError moved to cli_sessions |
49 | | -) |
50 | | -from astrid.core.session.paths import ( |
51 | | - # session_path moved to cli_sessions |
52 | | - sessions_dir, |
53 | | -) |
54 | | -from astrid.core.task.events import EVENTS_FILENAME, read_events |
55 | | -# timeline_crud, read_project_default, find_timeline_slug_for_ulid moved to cli_status |
56 | | -from astrid.core.threads.ids import generate_ulid |
57 | | - |
58 | 25 | # M4 T44: Re-export attach command and templates from cli_attach.py. |
59 | 26 | # Tests call ``cli.cmd_attach(...)`` and reference ``cli.ATTACH_HEADER``. |
60 | 27 | from astrid.core.cli.session_attach import ( # noqa: E402, F401 |
|
66 | 33 | cmd_attach, |
67 | 34 | ) |
68 | 35 |
|
| 36 | +# STATUS_UNBOUND_HEADER, ATTACH_SUGGESTION_TEMPLATE, NO_PROJECTS_FOUND moved to cli_status |
| 37 | +# ----- argparse glue ---------------------------------------------------- |
| 38 | +# |
| 39 | +# M4 T50: Parser construction moved to cli_parser.py. ``build_parser`` is |
| 40 | +# re-exported here so existing callers of ``cli.build_parser()`` continue to |
| 41 | +# work. The parser uses the shared CommandSpec convention with late imports |
| 42 | +# from this facade so monkeypatch seams (``cli.cmd_attach``, ``cli.cmd_status``, |
| 43 | +# etc.) remain interceptable. |
| 44 | +from astrid.core.cli.session_parser import ( # noqa: E402, F401 |
| 45 | + COMMANDS, # re-export for CLI conformance allowlist |
| 46 | + build_parser, |
| 47 | +) |
| 48 | + |
69 | 49 | # M4 T46: Re-export sessions subcommand handlers from cli_sessions.py. |
70 | 50 | # Tests call ``cli.cmd_sessions_ls(...)``, ``cli.cmd_sessions_detach(...)``, |
71 | 51 | # ``cli.cmd_sessions_takeover(...)``, ``cli.cmd_sessions_prune(...)`` and |
|
95 | 75 | _status_state_for, |
96 | 76 | cmd_status, |
97 | 77 | ) |
| 78 | +from astrid.core.foundation.project_paths import project_dir |
| 79 | +from astrid.core.project.current_run import read_current_run |
98 | 80 |
|
99 | 81 | # ----- Templates & shared helpers --------------------------------------- |
100 | 82 | # |
|
104 | 86 | # re-exported here so ``astrid.core.session.cli.<name>`` keeps resolving for the |
105 | 87 | # test monkeypatches that target the facade. Tests assert on the literal |
106 | 88 | # template strings; keep them stable. |
107 | | - |
108 | 89 | from astrid.core.session._shared import ( # noqa: E402, F401 |
109 | 90 | FIRST_RUN_PROMPT_HEADER, |
110 | 91 | NONE_PLACEHOLDER, |
|
119 | 100 | _make_bootstrap_session, |
120 | 101 | _session_store, |
121 | 102 | ) |
122 | | -# STATUS_UNBOUND_HEADER, ATTACH_SUGGESTION_TEMPLATE, NO_PROJECTS_FOUND moved to cli_status |
123 | | - |
124 | | - |
125 | | -# ----- argparse glue ---------------------------------------------------- |
126 | | -# |
127 | | -# M4 T50: Parser construction moved to cli_parser.py. ``build_parser`` is |
128 | | -# re-exported here so existing callers of ``cli.build_parser()`` continue to |
129 | | -# work. The parser uses the shared CommandSpec convention with late imports |
130 | | -# from this facade so monkeypatch seams (``cli.cmd_attach``, ``cli.cmd_status``, |
131 | | -# etc.) remain interceptable. |
| 103 | +from astrid.core.session.binding import ( |
| 104 | + ASTRID_SESSION_ID_ENV, |
| 105 | + SESSION_FILE_NAME, # noqa: F401 — re-export; tests patch cli.SESSION_FILE_NAME |
| 106 | + attach_session, |
| 107 | +) |
| 108 | +from astrid.core.session.constants import STUCK_NO_EVENT_SECONDS |
| 109 | +from astrid.core.session.identity import ( |
| 110 | + Identity, |
| 111 | + IdentityError, |
| 112 | + bootstrap_identity, |
| 113 | + read_identity, |
| 114 | + # validate_agent_slug moved to cli_attach |
| 115 | +) |
| 116 | +from astrid.core.session.lease import read_lease |
132 | 117 |
|
133 | | -from astrid.core.cli.session_parser import ( # noqa: E402, F401 |
134 | | - COMMANDS, # re-export for CLI conformance allowlist |
135 | | - build_parser, |
| 118 | +# lifecycle imports (SessionTakeoverTargetError, takeover_session) moved to cli_sessions; |
| 119 | +# load_session moved to cli_attach. |
| 120 | +from astrid.core.session.model import ( |
| 121 | + Session, |
| 122 | + SessionRole, |
| 123 | + SessionStore, |
| 124 | + # SessionRecordNotFoundError moved to cli_status |
| 125 | + # SessionStoreError moved to cli_sessions |
136 | 126 | ) |
| 127 | +from astrid.core.session.paths import ( |
| 128 | + # session_path moved to cli_sessions |
| 129 | + sessions_dir, |
| 130 | +) |
| 131 | +from astrid.core.task.events import EVENTS_FILENAME, read_events |
| 132 | + |
| 133 | +# timeline_crud, read_project_default, find_timeline_slug_for_ulid moved to cli_status |
| 134 | +from astrid.core.threads.ids import generate_ulid |
137 | 135 |
|
138 | 136 |
|
139 | 137 | def main(argv: list[str] | None = None) -> int: |
|
0 commit comments