Keep the zipcode helper directly executable

The feature branch already routed zipcode lookup through the integrated ePost English-address surface, but the helper scripts themselves still lacked a shebang and executable mode. This follow-up locks the packaging/CLI contract with a regression test and marks both entrypoints executable so the documented helper can be invoked directly as a script.

Constraint: Issue #96 requires an executable zipcode_search.py helper in both the repo script wrapper and bundled skill helper

Rejected: Document python3-only invocation and leave file modes unchanged | would not satisfy the executable-helper requirement or catch future regressions

Confidence: high

Scope-risk: narrow

Reversibility: clean

Directive: Keep the wrapper and bundled helper executable together because tests assert the pair as the public entrypoints

Tested: python3 -m unittest scripts.test_zipcode_search; node --test scripts/skill-docs.test.js; python3 scripts/zipcode_search.py "서울특별시 강남구 테헤란로 123"; ./scripts/zipcode_search.py "서울특별시 강남구 테헤란로 123"; npm run build; PYTHONPATH=.:scripts python3 -m unittest scripts.test_patent_search; npm run ci

Not-tested: Direct execution of the bundled zipcode-search/scripts/zipcode_search.py helper against the live endpoint
This commit is contained in:
Jeffrey (Dongkyu) Kim 2026-04-10 10:48:00 +09:00
commit 35c91a0717
3 changed files with 19 additions and 0 deletions

View file

@ -1,4 +1,6 @@
import json
import os
from pathlib import Path
import unittest
from unittest import mock
@ -82,6 +84,19 @@ class ZipcodeSearchCliShapeTest(unittest.TestCase):
self.assertEqual(payload["results"][0]["zip_code"], "06133")
self.assertIn("Teheran-ro", payload["results"][0]["english_address"])
def test_helper_scripts_are_executable_python_entrypoints(self):
repo_root = Path(__file__).resolve().parent.parent
for helper in (
repo_root / "scripts" / "zipcode_search.py",
repo_root / "zipcode-search" / "scripts" / "zipcode_search.py",
):
with self.subTest(helper=helper):
self.assertTrue(os.access(helper, os.X_OK), f"{helper} should be executable")
self.assertTrue(
helper.read_text(encoding="utf-8").startswith("#!/usr/bin/env python3\n"),
f"{helper} should start with a Python shebang",
)
if __name__ == "__main__":
unittest.main()

2
scripts/zipcode_search.py Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env python3
from __future__ import annotations
from pathlib import Path

2
zipcode-search/scripts/zipcode_search.py Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env python3
from __future__ import annotations
import argparse