Plain-text folder-trust prompt (port of the C8 TrustFolderScreen). Accept → persist (``record_trust_accepted``) + grant session trust + apply the full env. Decline/EOF → False (caller exits 1, mirroring TS TrustDialog's "No, exit" → gracefulShutdownSync(1)).
()
| 213 | |
| 214 | |
| 215 | def _prompt_folder_trust() -> bool: |
| 216 | """Plain-text folder-trust prompt (port of the C8 TrustFolderScreen). |
| 217 | |
| 218 | Accept → persist (``record_trust_accepted``) + grant session trust + |
| 219 | apply the full env. Decline/EOF → False (caller exits 1, mirroring TS |
| 220 | TrustDialog's "No, exit" → gracefulShutdownSync(1)). |
| 221 | """ |
| 222 | from src.permissions.trust_boundary import establish_session_trust |
| 223 | from src.services.startup_gates import ( |
| 224 | collect_trust_warnings, |
| 225 | record_trust_accepted, |
| 226 | ) |
| 227 | |
| 228 | cwd = os.getcwd() |
| 229 | print("Do you trust the files in this folder?") |
| 230 | print(f" {cwd}") |
| 231 | try: |
| 232 | warnings = collect_trust_warnings() |
| 233 | except Exception: |
| 234 | warnings = [] |
| 235 | if warnings: |
| 236 | print() |
| 237 | for warning in warnings: |
| 238 | print(f" ! {warning}") |
| 239 | print() |
| 240 | print( |
| 241 | "ClawCodex may read, execute, and modify files here. Accept only if " |
| 242 | "you trust this folder's contents and configuration." |
| 243 | ) |
| 244 | try: |
| 245 | answer = input("Trust this folder? [y/N] ").strip().lower() |
| 246 | except (EOFError, KeyboardInterrupt): |
| 247 | print() |
| 248 | return False |
| 249 | if answer not in ("y", "yes"): |
| 250 | return False |
| 251 | record_trust_accepted() |
| 252 | establish_session_trust() |
| 253 | return True |
| 254 | |
| 255 | |
| 256 | def _build_parser() -> argparse.ArgumentParser: |
no test coverage detected