Experience-Driven Black-Box Cost Control for Coding Agents
Python agentic-aiagentic-codingai-codingai-coding-assistantanthropicartificial-intelligenceclaude-codecodexcoding-agentcoding-agentscost-optimizationcost-reductiondeveloper-toolsgithub-copilotllmopen-sourceopenaiproductivitytoken-optimization
Keep a leading dot in a repository's state file name
Aaron93a1b27fb2fd
diff --git a/tests/test_windows_identity.py b/tests/test_windows_identity.pyindex d2e73b2..60e7dd1 100644--- a/tests/test_windows_identity.py+++ b/tests/test_windows_identity.py@@ -38,6 +38,7 @@ class WindowsIdentityTests(unittest.TestCase):file.write('{}')self.assertTrue(os.path.isfile(path))self.assertEqual(repo_filename('owner/repo'), 'owner__repo')+ self.assertEqual(repo_filename('.dotfiles'), '.dotfiles')if __name__ == '__main__':diff --git a/tokeneconomizer/names.py b/tokeneconomizer/names.pyindex 21f8b14..65b9918 100644--- a/tokeneconomizer/names.py+++ b/tokeneconomizer/names.py@@ -6,5 +6,6 @@ _UNSAFE = re.compile(r'[<>:"/\\|?*]+')def repo_filename(repo):"""`owner/repo` becomes `owner__repo`. A label holding a Windows path stays one name: joined as it- came, its separators or drive would file the state somewhere else, or nowhere."""- return _UNSAFE.sub("__", repo).strip(". ") or "repo"+ came, its separators or drive would file the state somewhere else, or nowhere. Only trailing+ dots and spaces go (Windows refuses them): a leading dot stays, so `.dotfiles` keeps its file."""+ return _UNSAFE.sub("__", repo).rstrip(". ") or "repo"