@alexgreensh/token-optimizer 0.0.0-stage → 5.13.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/.claude-plugin/marketplace.json +76 -0
  2. package/.claude-plugin/plugin.json +21 -0
  3. package/LICENSE +130 -0
  4. package/LICENSE-SMALL-BUSINESS.md +62 -0
  5. package/PRIVACY.md +200 -0
  6. package/README.md +13 -2
  7. package/hooks/codex-hooks.json +4 -0
  8. package/hooks/hooks.json +182 -0
  9. package/hooks/module_runner.py +149 -0
  10. package/hooks/posttooluse_runner.py +1110 -0
  11. package/hooks/python-launcher.sh +816 -0
  12. package/hooks/run.py +776 -0
  13. package/hooks/sessionstart_runner.py +629 -0
  14. package/hooks/stop_runner.py +408 -0
  15. package/hooks/userpromptsubmit_runner.py +722 -0
  16. package/hooks/windows-launcher.py +163 -0
  17. package/install-cloud.sh +23 -0
  18. package/package.json +29 -4
  19. package/skills/fleet-auditor/SKILL.md +150 -0
  20. package/skills/fleet-auditor/references/fleet-systems.md +167 -0
  21. package/skills/fleet-auditor/references/report-template.md +50 -0
  22. package/skills/fleet-auditor/references/waste-patterns.md +126 -0
  23. package/skills/fleet-auditor/scripts/fleet.py +3612 -0
  24. package/skills/fleet-auditor/scripts/shared.py +277 -0
  25. package/skills/resume-checkpoint/SKILL.md +52 -0
  26. package/skills/resume-checkpoint/scripts/pull_checkpoint.py +188 -0
  27. package/skills/token-coach/SKILL.md +129 -0
  28. package/skills/token-coach/assets/coach-dashboard-tab.html +45 -0
  29. package/skills/token-coach/examples/coaching-session-agentic.md +62 -0
  30. package/skills/token-coach/examples/coaching-session-heavy-setup.md +46 -0
  31. package/skills/token-coach/examples/coaching-session-new-project.md +38 -0
  32. package/skills/token-coach/references/agentic-systems.md +147 -0
  33. package/skills/token-coach/references/coach-patterns.md +120 -0
  34. package/skills/token-coach/references/coaching-scripts.md +146 -0
  35. package/skills/token-coach/references/deterministic-stages.md +102 -0
  36. package/skills/token-coach/references/keepwarm-consent.md +48 -0
  37. package/skills/token-coach/references/quick-reference.md +155 -0
  38. package/skills/token-dashboard/SKILL.md +72 -0
  39. package/skills/token-optimizer/SKILL.md +150 -0
  40. package/skills/token-optimizer/assets/dashboard.html +7251 -0
  41. package/skills/token-optimizer/examples/claude-md-optimized.md +40 -0
  42. package/skills/token-optimizer/examples/hooks-starter.json +179 -0
  43. package/skills/token-optimizer/examples/permissions-deny-template.json +24 -0
  44. package/skills/token-optimizer/pricing/prices.json +695 -0
  45. package/skills/token-optimizer/references/agent-prompts.md +687 -0
  46. package/skills/token-optimizer/references/cli-reference.md +92 -0
  47. package/skills/token-optimizer/references/codex-workflow.md +188 -0
  48. package/skills/token-optimizer/references/cursor-workflow.md +74 -0
  49. package/skills/token-optimizer/references/error-recovery.md +37 -0
  50. package/skills/token-optimizer/references/implementation-playbook.md +416 -0
  51. package/skills/token-optimizer/references/keepwarm-consent.md +48 -0
  52. package/skills/token-optimizer/references/opencode-workflow.md +72 -0
  53. package/skills/token-optimizer/references/optimization-checklist.md +714 -0
  54. package/skills/token-optimizer/references/phase0-setup.md +142 -0
  55. package/skills/token-optimizer/references/presentation-workflow.md +72 -0
  56. package/skills/token-optimizer/references/session-continuity.md +19 -0
  57. package/skills/token-optimizer/references/token-flow-architecture.md +629 -0
  58. package/skills/token-optimizer/scripts/activity_tracker.py +143 -0
  59. package/skills/token-optimizer/scripts/antigravity_doctor.py +548 -0
  60. package/skills/token-optimizer/scripts/antigravity_hook_bridge.py +511 -0
  61. package/skills/token-optimizer/scripts/antigravity_install.py +376 -0
  62. package/skills/token-optimizer/scripts/antigravity_proto.py +413 -0
  63. package/skills/token-optimizer/scripts/antigravity_session.py +346 -0
  64. package/skills/token-optimizer/scripts/antigravity_state.py +486 -0
  65. package/skills/token-optimizer/scripts/archive_result.py +1725 -0
  66. package/skills/token-optimizer/scripts/bash_compress.py +2490 -0
  67. package/skills/token-optimizer/scripts/bash_compress_hook.py +766 -0
  68. package/skills/token-optimizer/scripts/bash_hook.py +61 -0
  69. package/skills/token-optimizer/scripts/bash_whitelist.py +243 -0
  70. package/skills/token-optimizer/scripts/benchmark.py +1765 -0
  71. package/skills/token-optimizer/scripts/build_output_compress.py +776 -0
  72. package/skills/token-optimizer/scripts/cloud_kit.py +991 -0
  73. package/skills/token-optimizer/scripts/codex_command_compress.py +434 -0
  74. package/skills/token-optimizer/scripts/codex_compact_prompt.py +273 -0
  75. package/skills/token-optimizer/scripts/codex_doctor.py +454 -0
  76. package/skills/token-optimizer/scripts/codex_hook_bridge.py +311 -0
  77. package/skills/token-optimizer/scripts/codex_install.py +810 -0
  78. package/skills/token-optimizer/scripts/codex_io.py +119 -0
  79. package/skills/token-optimizer/scripts/codex_log_index.py +219 -0
  80. package/skills/token-optimizer/scripts/codex_models.py +34 -0
  81. package/skills/token-optimizer/scripts/codex_session.py +1186 -0
  82. package/skills/token-optimizer/scripts/codex_state.py +707 -0
  83. package/skills/token-optimizer/scripts/codex_statusline.py +303 -0
  84. package/skills/token-optimizer/scripts/command_filters.py +386 -0
  85. package/skills/token-optimizer/scripts/compression_backfill.py +600 -0
  86. package/skills/token-optimizer/scripts/compression_log.py +230 -0
  87. package/skills/token-optimizer/scripts/context_intel.py +331 -0
  88. package/skills/token-optimizer/scripts/context_pressure.py +115 -0
  89. package/skills/token-optimizer/scripts/copilot_doctor.py +406 -0
  90. package/skills/token-optimizer/scripts/copilot_hook_bridge.py +709 -0
  91. package/skills/token-optimizer/scripts/copilot_install.py +277 -0
  92. package/skills/token-optimizer/scripts/copilot_session.py +496 -0
  93. package/skills/token-optimizer/scripts/copilot_state.py +569 -0
  94. package/skills/token-optimizer/scripts/copilot_vscode.py +832 -0
  95. package/skills/token-optimizer/scripts/cowork_doctor.py +270 -0
  96. package/skills/token-optimizer/scripts/cowork_install.py +380 -0
  97. package/skills/token-optimizer/scripts/credential_patterns.py +1514 -0
  98. package/skills/token-optimizer/scripts/cursor_doctor.py +602 -0
  99. package/skills/token-optimizer/scripts/cursor_hook_bridge.py +843 -0
  100. package/skills/token-optimizer/scripts/cursor_install.py +423 -0
  101. package/skills/token-optimizer/scripts/cursor_session.py +303 -0
  102. package/skills/token-optimizer/scripts/cursor_state.py +348 -0
  103. package/skills/token-optimizer/scripts/delta_diff.py +110 -0
  104. package/skills/token-optimizer/scripts/detectors/__init__.py +2 -0
  105. package/skills/token-optimizer/scripts/detectors/bad_decomposition.py +78 -0
  106. package/skills/token-optimizer/scripts/detectors/cache_instability.py +504 -0
  107. package/skills/token-optimizer/scripts/detectors/looping.py +88 -0
  108. package/skills/token-optimizer/scripts/detectors/output_waste.py +143 -0
  109. package/skills/token-optimizer/scripts/detectors/overpowered.py +116 -0
  110. package/skills/token-optimizer/scripts/detectors/pdf_ingestion.py +52 -0
  111. package/skills/token-optimizer/scripts/detectors/registry.py +65 -0
  112. package/skills/token-optimizer/scripts/detectors/respond_to_bash.py +76 -0
  113. package/skills/token-optimizer/scripts/detectors/retry_churn.py +83 -0
  114. package/skills/token-optimizer/scripts/detectors/tool_cascade.py +62 -0
  115. package/skills/token-optimizer/scripts/detectors/wasteful_thinking.py +75 -0
  116. package/skills/token-optimizer/scripts/detectors/weak_model.py +55 -0
  117. package/skills/token-optimizer/scripts/detectors/websearch_routing.py +72 -0
  118. package/skills/token-optimizer/scripts/deterministic_candidates.py +1458 -0
  119. package/skills/token-optimizer/scripts/devin_compress.py +790 -0
  120. package/skills/token-optimizer/scripts/devin_doctor.py +403 -0
  121. package/skills/token-optimizer/scripts/devin_hooks.py +453 -0
  122. package/skills/token-optimizer/scripts/devin_install.py +1086 -0
  123. package/skills/token-optimizer/scripts/devin_source.py +119 -0
  124. package/skills/token-optimizer/scripts/devin_state.py +330 -0
  125. package/skills/token-optimizer/scripts/devin_verify.py +67 -0
  126. package/skills/token-optimizer/scripts/grok_doctor.py +560 -0
  127. package/skills/token-optimizer/scripts/grok_hook_bridge.py +699 -0
  128. package/skills/token-optimizer/scripts/grok_install.py +397 -0
  129. package/skills/token-optimizer/scripts/grok_session.py +317 -0
  130. package/skills/token-optimizer/scripts/grok_state.py +299 -0
  131. package/skills/token-optimizer/scripts/hermes_doctor.py +479 -0
  132. package/skills/token-optimizer/scripts/hermes_hook_bridge.py +285 -0
  133. package/skills/token-optimizer/scripts/hermes_install.py +668 -0
  134. package/skills/token-optimizer/scripts/hermes_session.py +691 -0
  135. package/skills/token-optimizer/scripts/hermes_state.py +448 -0
  136. package/skills/token-optimizer/scripts/hook_io.py +120 -0
  137. package/skills/token-optimizer/scripts/hook_runtime.py +713 -0
  138. package/skills/token-optimizer/scripts/injection.py +156 -0
  139. package/skills/token-optimizer/scripts/install_reconcile.py +952 -0
  140. package/skills/token-optimizer/scripts/measure.py +58739 -0
  141. package/skills/token-optimizer/scripts/outline.py +53 -0
  142. package/skills/token-optimizer/scripts/pipeline_analyzer.py +723 -0
  143. package/skills/token-optimizer/scripts/plugin_env.py +562 -0
  144. package/skills/token-optimizer/scripts/py_trust.py +80 -0
  145. package/skills/token-optimizer/scripts/quality_cache_gate.py +320 -0
  146. package/skills/token-optimizer/scripts/read_cache.py +2489 -0
  147. package/skills/token-optimizer/scripts/recovery_output.py +110 -0
  148. package/skills/token-optimizer/scripts/refetch_fingerprint.py +236 -0
  149. package/skills/token-optimizer/scripts/refetch_guard.py +244 -0
  150. package/skills/token-optimizer/scripts/routing_advisor.py +389 -0
  151. package/skills/token-optimizer/scripts/runtime_env.py +1893 -0
  152. package/skills/token-optimizer/scripts/session_store.py +979 -0
  153. package/skills/token-optimizer/scripts/spawn_utils.py +122 -0
  154. package/skills/token-optimizer/scripts/statusline.js +660 -0
  155. package/skills/token-optimizer/scripts/structure_map.py +2880 -0
  156. package/skills/token-optimizer/scripts/structure_map_ts.py +676 -0
  157. package/skills/token-optimizer/scripts/structure_replay.py +1556 -0
  158. package/skills/token-optimizer/scripts/thrash_guard.py +604 -0
  159. package/skills/token-optimizer/scripts/token_estimate.py +80 -0
  160. package/skills/token-optimizer/scripts/tool_search_diagnostic.py +61 -0
  161. package/skills/token-optimizer/scripts/utf8_io.py +219 -0
@@ -0,0 +1,277 @@
1
+ #!/usr/bin/env python3
2
+ """Token Optimizer — GitHub Copilot CLI installer.
3
+
4
+ Wires Token Optimizer into a Copilot CLI setup:
5
+
6
+ 1. Copies the adapter modules into <copilot_home>/token-optimizer/plugin/
7
+ so the hook bridge runs from a stable path that survives repo moves.
8
+ 2. Writes the hooks config to <copilot_home>/hooks/token-optimizer.json
9
+ (USER-LEVEL ONLY — never .github/hooks/, which would silently affect a
10
+ whole team's repo without consent; user-level hooks load in all modes
11
+ including non-interactive `copilot -p`, per the Copilot CLI project).
12
+ 3. Seeds capabilities.json for the installed CLI version.
13
+
14
+ Idempotent: re-running refreshes the payload and rewrites OUR hook file only.
15
+ Uninstall removes only files Token Optimizer created.
16
+
17
+ Usage:
18
+ python3 copilot_install.py install [--dry-run]
19
+ python3 copilot_install.py uninstall [--dry-run]
20
+ """
21
+
22
+ from __future__ import annotations
23
+
24
+ import argparse
25
+ import json
26
+ import os
27
+ import shlex
28
+ import shutil
29
+ import stat as _stat
30
+ import sys
31
+ from pathlib import Path
32
+
33
+ _SCRIPT_DIR = Path(__file__).resolve().parent
34
+ sys.path.insert(0, str(_SCRIPT_DIR))
35
+
36
+ from py_trust import py_path_is_trusted, py_trust_reason # noqa: E402
37
+ from runtime_env import copilot_home, measure_cli as _measure_cli, with_measure_cli as _hint # noqa: E402
38
+
39
+ HOOK_FILE_NAME = "token-optimizer.json"
40
+ HOOK_TIMEOUT_SEC = 10
41
+
42
+ # Modules the bridge needs at runtime, copied next to it so the installed
43
+ # hook never depends on the repo checkout location.
44
+ _PAYLOAD_MODULES = (
45
+ "copilot_hook_bridge.py",
46
+ "copilot_state.py",
47
+ "copilot_session.py",
48
+ "copilot_vscode.py",
49
+ "bash_hook.py",
50
+ "bash_compress.py",
51
+ # Dependency-free whitelist gate shared by bash_hook + bash_compress.
52
+ "bash_whitelist.py",
53
+ "hook_io.py",
54
+ "plugin_env.py",
55
+ "runtime_env.py",
56
+ # codex_io supplies atomic_write_json — without it the bridge's tally and
57
+ # capabilities writes silently no-op (crash recovery would be dead).
58
+ "codex_io.py",
59
+ # hermes_session supplies compute_quality_score — without it copilot_session
60
+ # silently falls back to a single-signal estimate (degraded quality grades).
61
+ "hermes_session.py",
62
+ )
63
+
64
+
65
+ def _plugin_dir(root: Path) -> Path:
66
+ return root / "token-optimizer" / "plugin"
67
+
68
+
69
+ def _hooks_dir(root: Path) -> Path:
70
+ return root / "hooks"
71
+
72
+
73
+ def _py_trust_reason(p: str) -> str | None:
74
+ """None when trusted, else a short human-readable rejection reason."""
75
+ return py_trust_reason(p)
76
+
77
+
78
+ def _py_path_is_trusted(p: str) -> bool:
79
+ """Trusted iff the interpreter's bytes are admin-owned (euid or root) and
80
+ not group/other-writable, and its dir is not world-writable and not
81
+ group-writable by a third party -- the launcher's ownership boundary
82
+ (ssh/sudo/git), in Python. Pure stat, never runs the target. On Windows,
83
+ stat ownership is unreliable under Git-Bash, so require only that the path
84
+ is a real file (the launcher leans on hardcoded allowlists there too)."""
85
+ return py_path_is_trusted(p)
86
+
87
+
88
+ def _resolve_safe_python() -> str:
89
+ """An ABSOLUTE, trusted python for the persisted Copilot hook command.
90
+
91
+ Never emit a bare "python3": that string is resolved via $PATH every time the
92
+ hook fires, so a hijacked PATH entry runs attacker code (the launcher's whole
93
+ allowlist exists to stop exactly this, and the Copilot bridge does not use the
94
+ launcher). Resolution order:
95
+ 1. TOKEN_OPTIMIZER_PYTHON, if it names a trusted file (user escape hatch,
96
+ same env the launcher honours);
97
+ 2. sys.executable -- the interpreter already running this installer, an
98
+ absolute path baked in ONCE here so the hook never does a PATH lookup,
99
+ but only through the same ownership gate (a writable venv interpreter
100
+ must never be persisted);
101
+ 3. a $PATH search, but only accepting a candidate that passes the ownership
102
+ gate above.
103
+ Raises RuntimeError rather than persist an unsafe command -- recoverable by
104
+ setting TOKEN_OPTIMIZER_PYTHON.
105
+ """
106
+ override = os.environ.get("TOKEN_OPTIMIZER_PYTHON", "").strip()
107
+ candidates = []
108
+ if override:
109
+ candidates.append(("TOKEN_OPTIMIZER_PYTHON", override))
110
+ if sys.executable:
111
+ candidates.append(("sys.executable", sys.executable))
112
+ for name in ("python3", "python"):
113
+ cand = shutil.which(name)
114
+ if cand:
115
+ candidates.append((name, cand))
116
+ for _label, cand in candidates:
117
+ if _py_path_is_trusted(cand):
118
+ # Persist the RESOLVED realpath, not abspath: the gate validated
119
+ # realpath(cand) (the symlink target + its parent dir), so persisting
120
+ # the original symlink path would leave a swap window between install
121
+ # and hook fire (an attacker with write access to the symlink's parent
122
+ # dir could redirect the symlink to a malicious interpreter).
123
+ return os.path.realpath(cand)
124
+ reasons = [f"{label}={cand}: {_py_trust_reason(cand)}"
125
+ for label, cand in candidates]
126
+ raise RuntimeError(
127
+ "no trusted python interpreter found for the Copilot hook; "
128
+ "set TOKEN_OPTIMIZER_PYTHON to an absolute python3 path and re-run install. "
129
+ "Candidates: " + "; ".join(reasons)
130
+ )
131
+
132
+
133
+ def _hook_config(bridge_path: Path) -> dict:
134
+ """The hooks file Copilot loads. Format per the official hooks reference:
135
+ {"version": 1, "hooks": {event: [{"type": "command", "bash": ...}]}}.
136
+ """
137
+ py = _resolve_safe_python()
138
+ # shlex.quote both paths: a HOME/COPILOT_HOME containing a space, $, or
139
+ # backtick would otherwise break the bash string or inject a subcommand.
140
+ # TOKEN_OPTIMIZER_RUNTIME is pinned so the bridge never process-scans on
141
+ # the hot path and never falls through to the Claude default.
142
+ py_q = shlex.quote(py)
143
+ bridge_q = shlex.quote(str(bridge_path))
144
+
145
+ def cmd(event: str) -> dict:
146
+ return {
147
+ "type": "command",
148
+ "bash": f"TOKEN_OPTIMIZER_RUNTIME=copilot {py_q} {bridge_q} {event}",
149
+ "timeoutSec": HOOK_TIMEOUT_SEC,
150
+ }
151
+
152
+ pre = cmd("pre-tool-use")
153
+ # Only the bash tool is rewritten; the matcher keeps every other tool
154
+ # call out of the bridge's hot path entirely.
155
+ pre["matcher"] = {"toolName": "bash"}
156
+
157
+ return {
158
+ "version": 1,
159
+ "hooks": {
160
+ "sessionStart": [cmd("session-start")],
161
+ "preToolUse": [pre],
162
+ "postToolUse": [cmd("post-tool-use")],
163
+ "stop": [cmd("stop")],
164
+ },
165
+ }
166
+
167
+
168
+ def install(*, dry_run: bool = False, home: Path = None) -> dict:
169
+ """Install the adapter. Returns a summary dict of actions taken."""
170
+ root = home if home is not None else copilot_home()
171
+ actions = {"copied": [], "hook_file": None, "skipped": [], "dry_run": dry_run}
172
+
173
+ plugin_dir = _plugin_dir(root)
174
+ hooks_dir = _hooks_dir(root)
175
+
176
+ if hooks_dir.exists() and not hooks_dir.is_dir():
177
+ raise RuntimeError(
178
+ f"{hooks_dir} exists but is not a directory — refusing to install. "
179
+ "Move it aside and re-run."
180
+ )
181
+
182
+ for name in _PAYLOAD_MODULES:
183
+ src = _SCRIPT_DIR / name
184
+ if not src.exists():
185
+ actions["skipped"].append(name)
186
+ continue
187
+ dest = plugin_dir / name
188
+ if not dry_run:
189
+ try:
190
+ plugin_dir.mkdir(parents=True, exist_ok=True)
191
+ shutil.copy2(src, dest)
192
+ except OSError as exc:
193
+ # A partial payload would silently break the bridge. Abort
194
+ # BEFORE writing the hook config so a broken install never wires
195
+ # hooks that point at missing modules.
196
+ raise RuntimeError(f"failed copying {name}: {exc}") from exc
197
+ actions["copied"].append(name)
198
+
199
+ if actions["skipped"]:
200
+ raise RuntimeError(
201
+ "missing payload modules in this checkout: "
202
+ f"{actions['skipped']} — refusing to wire hooks against an incomplete bridge."
203
+ )
204
+
205
+ hook_path = hooks_dir / HOOK_FILE_NAME
206
+ config = _hook_config(plugin_dir / "copilot_hook_bridge.py")
207
+ if not dry_run:
208
+ try:
209
+ hooks_dir.mkdir(parents=True, exist_ok=True)
210
+ hook_path.write_text(json.dumps(config, indent=2) + "\n", encoding="utf-8")
211
+ except OSError as exc:
212
+ raise RuntimeError(f"failed writing hook config: {exc}") from exc
213
+ actions["hook_file"] = str(hook_path)
214
+
215
+ # Seed capabilities for the installed CLI version (best-effort).
216
+ if not dry_run:
217
+ try:
218
+ import copilot_hook_bridge
219
+
220
+ copilot_hook_bridge.load_capabilities(refresh=True)
221
+ except Exception:
222
+ pass
223
+
224
+ return actions
225
+
226
+
227
+ def uninstall(*, dry_run: bool = False, home: Path = None) -> dict:
228
+ """Remove ONLY what install() created. Session data and trends stay."""
229
+ root = home if home is not None else copilot_home()
230
+ actions = {"removed": [], "dry_run": dry_run}
231
+
232
+ hook_path = _hooks_dir(root) / HOOK_FILE_NAME
233
+ if hook_path.exists():
234
+ if not dry_run:
235
+ hook_path.unlink()
236
+ actions["removed"].append(str(hook_path))
237
+
238
+ plugin_dir = _plugin_dir(root)
239
+ if plugin_dir.exists():
240
+ if not dry_run:
241
+ shutil.rmtree(plugin_dir)
242
+ actions["removed"].append(str(plugin_dir))
243
+
244
+ return actions
245
+
246
+
247
+ def build_parser() -> argparse.ArgumentParser:
248
+ parser = argparse.ArgumentParser(description=__doc__)
249
+ parser.add_argument("action", choices=("install", "uninstall"))
250
+ parser.add_argument("--dry-run", action="store_true")
251
+ return parser
252
+
253
+
254
+ def main(argv=None) -> int:
255
+ args = build_parser().parse_args(argv)
256
+ try:
257
+ if args.action == "install":
258
+ result = install(dry_run=args.dry_run)
259
+ verb = "Would install" if args.dry_run else "Installed"
260
+ print(f"{verb} Token Optimizer for GitHub Copilot CLI.")
261
+ print(f" Hook config: {result['hook_file']}")
262
+ print(f" Modules: {len(result['copied'])} copied"
263
+ + (f", {len(result['skipped'])} missing: {result['skipped']}" if result["skipped"] else ""))
264
+ print(_hint(" Run `python3 measure.py copilot-doctor` to verify readiness."))
265
+ else:
266
+ result = uninstall(dry_run=args.dry_run)
267
+ verb = "Would remove" if args.dry_run else "Removed"
268
+ for item in result["removed"] or ["(nothing installed)"]:
269
+ print(f"{verb}: {item}")
270
+ return 0
271
+ except RuntimeError as exc:
272
+ print(f"[Token Optimizer] {exc}", file=sys.stderr)
273
+ return 1
274
+
275
+
276
+ if __name__ == "__main__":
277
+ sys.exit(main())