pythia-plsql 0.15.4__tar.gz → 0.15.5__tar.gz
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.
- {pythia_plsql-0.15.4/scripts/pythia_plsql.egg-info → pythia_plsql-0.15.5}/PKG-INFO +5 -2
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/README.md +4 -1
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/pyproject.toml +1 -1
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/scripts/pythia.py +74 -19
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5/scripts/pythia_plsql.egg-info}/PKG-INFO +5 -2
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-setup/reference/environment.md +6 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/tests/test_phase3.py +14 -5
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/tests/test_phase6.py +160 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/LICENSE +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/comment-current.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/compile-errors.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/current-schema.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/db-nls.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/db-version.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/dependencies.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/explain-display.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/impact.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/invalid-objects.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/name-occupants.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/object-names.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/object-source.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/plscope-enabled.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/plscope-statements.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/plscope-usages.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/schema-settings.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/session-privileges.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/similar-candidates.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/source.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/table-comments.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/table-indexes.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/table-stats.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/queries/unindexed-fks.sql +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/scripts/pythia_plsql.egg-info/SOURCES.txt +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/scripts/pythia_plsql.egg-info/dependency_links.txt +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/scripts/pythia_plsql.egg-info/entry_points.txt +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/scripts/pythia_plsql.egg-info/requires.txt +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/scripts/pythia_plsql.egg-info/top_level.txt +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/setup.cfg +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-apply/SKILL.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-autopilot/SKILL.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-comment/SKILL.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-conventions/SKILL.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-deploy/SKILL.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-explore/SKILL.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-explore/reference/data-dictionary.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-impact/SKILL.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-package/SKILL.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-package/reference/plsql-standards.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-review/SKILL.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-review/reference/antipatterns.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-setup/SKILL.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-skill-author/SKILL.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-spec/SKILL.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-table/SKILL.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-table/reference/ddl-standards.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-tune/SKILL.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-tune/reference/tuning-checklist.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-verify/SKILL.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-write/SKILL.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-write/reference/patterns.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/using-pythia/SKILL.md +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/tests/test_install.py +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/tests/test_mcp.py +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/tests/test_phase1.py +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/tests/test_phase2.py +0 -0
- {pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/tests/test_phase5.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pythia-plsql
|
|
3
|
-
Version: 0.15.
|
|
3
|
+
Version: 0.15.5
|
|
4
4
|
Summary: PL/SQL development for AI agents on Oracle Database - expert data-dictionary queries, impact analysis, and a snapshot-verified write path with honest rollback.
|
|
5
5
|
License: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/thaildhe172591/pythia
|
|
@@ -210,7 +210,10 @@ each agent needs you to finish by hand.
|
|
|
210
210
|
`.claude/settings.local.json` (this machine's file, kept out of git) with
|
|
211
211
|
the absolute interpreter, and the MCP approver to Claude Code's local scope
|
|
212
212
|
(`claude mcp add --scope local`); your teammates never get a path from your
|
|
213
|
-
machine.
|
|
213
|
+
machine. Every command pythia prints uses the spelling that starts it here,
|
|
214
|
+
the session preamble's `RUN` line names it for the agent (CLAUDE.md, being
|
|
215
|
+
shared, can only say `pythia`), and the guard lets reads through in that
|
|
216
|
+
spelling — this interpreter's own path, never another. `pythia doctor` starts every launcher it finds and fails the ones
|
|
214
217
|
that cannot import pythia — except where this machine's own launcher
|
|
215
218
|
already serves the same hooks: then the team's shared copy erroring here
|
|
216
219
|
is a warning (keep it for teammates or remove it). Codex's session hook is
|
|
@@ -196,7 +196,10 @@ each agent needs you to finish by hand.
|
|
|
196
196
|
`.claude/settings.local.json` (this machine's file, kept out of git) with
|
|
197
197
|
the absolute interpreter, and the MCP approver to Claude Code's local scope
|
|
198
198
|
(`claude mcp add --scope local`); your teammates never get a path from your
|
|
199
|
-
machine.
|
|
199
|
+
machine. Every command pythia prints uses the spelling that starts it here,
|
|
200
|
+
the session preamble's `RUN` line names it for the agent (CLAUDE.md, being
|
|
201
|
+
shared, can only say `pythia`), and the guard lets reads through in that
|
|
202
|
+
spelling — this interpreter's own path, never another. `pythia doctor` starts every launcher it finds and fails the ones
|
|
200
203
|
that cannot import pythia — except where this machine's own launcher
|
|
201
204
|
already serves the same hooks: then the team's shared copy erroring here
|
|
202
205
|
is a warning (keep it for teammates or remove it). Codex's session hook is
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pythia-plsql"
|
|
7
|
-
version = "0.15.
|
|
7
|
+
version = "0.15.5"
|
|
8
8
|
description = "PL/SQL development for AI agents on Oracle Database - expert data-dictionary queries, impact analysis, and a snapshot-verified write path with honest rollback."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -61,7 +61,7 @@ import pathlib
|
|
|
61
61
|
import re
|
|
62
62
|
import sys
|
|
63
63
|
|
|
64
|
-
__version__ = "0.15.
|
|
64
|
+
__version__ = "0.15.5" # kept equal to pyproject.toml (tests/test_install.py)
|
|
65
65
|
|
|
66
66
|
READONLY = re.compile(r"^\s*(select|with)\b", re.I)
|
|
67
67
|
CONFIG_DIR = ".pythia"
|
|
@@ -239,7 +239,7 @@ def offer_path_fix(scripts_dir, interactive, forced=False):
|
|
|
239
239
|
print(" " + warn)
|
|
240
240
|
print(" Open a NEW terminal for it to take effect — an already-running")
|
|
241
241
|
print(" one keeps the environment it started with, and so do its tabs.")
|
|
242
|
-
print(f" Until then: {
|
|
242
|
+
print(f" Until then: {interpreter_word()} -m pythia <command>")
|
|
243
243
|
return True
|
|
244
244
|
|
|
245
245
|
|
|
@@ -357,7 +357,7 @@ def entry_point_hint(found, scripts_dir, in_stored_path=False):
|
|
|
357
357
|
"Windows Terminal,",
|
|
358
358
|
" VS Code or Cursor, restart the application itself.",
|
|
359
359
|
" In this one, keep using: "
|
|
360
|
-
+
|
|
360
|
+
+ interpreter_word() + " -m pythia <command>",
|
|
361
361
|
]))
|
|
362
362
|
out = ["`pythia` is installed but not on your PATH."]
|
|
363
363
|
if scripts_dir:
|
|
@@ -367,8 +367,7 @@ def entry_point_hint(found, scripts_dir, in_stored_path=False):
|
|
|
367
367
|
# that variable is system and user merged, so writing it
|
|
368
368
|
# back into user scope copies every system entry into the
|
|
369
369
|
# user's. Let the tool do it correctly instead.
|
|
370
|
-
out.append(" Put it there with: "
|
|
371
|
-
+ pathlib.Path(sys.executable).stem
|
|
370
|
+
out.append(" Put it there with: " + interpreter_word()
|
|
372
371
|
+ " -m pythia install --add-to-path")
|
|
373
372
|
else:
|
|
374
373
|
out.append(" Add it to your shell profile:")
|
|
@@ -376,25 +375,54 @@ def entry_point_hint(found, scripts_dir, in_stored_path=False):
|
|
|
376
375
|
else:
|
|
377
376
|
out.append(" Add pip's scripts directory to PATH.")
|
|
378
377
|
out.append("Either way, this works right now, PATH or no PATH:")
|
|
379
|
-
out.append(" " +
|
|
378
|
+
out.append(" " + interpreter_word() + " -m pythia <command>")
|
|
380
379
|
return "\n".join(out)
|
|
381
380
|
|
|
382
381
|
|
|
382
|
+
def _same_path(a, b):
|
|
383
|
+
"""The same file by spelling, symlinks NOT followed: a venv's python is a
|
|
384
|
+
symlink to the base interpreter, and only the venv's own path loads the
|
|
385
|
+
venv's packages."""
|
|
386
|
+
norm = lambda p: os.path.normcase(os.path.abspath(p)) # noqa: E731
|
|
387
|
+
return norm(a) == norm(b)
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
def interpreter_word():
|
|
391
|
+
"""This interpreter as a shell here can type it: its bare name when PATH
|
|
392
|
+
finds this very file, else its absolute path, quoted. "python3" on most
|
|
393
|
+
Linux/macOS, "python" on Windows — and in a venv nobody activated (Claude
|
|
394
|
+
Code started from an app or an IDE), the venv's own path: the bare name
|
|
395
|
+
would start the system interpreter, which has no pythia."""
|
|
396
|
+
exe = sys.executable
|
|
397
|
+
if not exe:
|
|
398
|
+
return "python"
|
|
399
|
+
# the name as typed: Path.stem would turn "python3.9" into "python3"
|
|
400
|
+
name = re.sub(r"\.exe$", "", pathlib.Path(exe).name, flags=re.I)
|
|
401
|
+
found = path_lookup(name)
|
|
402
|
+
if found and _same_path(found, exe):
|
|
403
|
+
return name
|
|
404
|
+
return launcher_text([pathlib.Path(exe).as_posix()])
|
|
405
|
+
|
|
406
|
+
|
|
383
407
|
def invocation():
|
|
384
|
-
"""How to invoke this tool
|
|
385
|
-
|
|
386
|
-
|
|
408
|
+
"""How to invoke this tool from a shell on this machine. Every printed
|
|
409
|
+
command must be paste-able: a bare `pythia ...` is CommandNotFound for
|
|
410
|
+
anyone running from source, or from a venv that is not on PATH."""
|
|
387
411
|
main_spec = getattr(sys.modules.get("__main__"), "__spec__", None)
|
|
388
412
|
if getattr(main_spec, "name", "") == "pythia":
|
|
389
413
|
# `python -m pythia` — argv[0] is the module's site-packages path,
|
|
390
414
|
# which nobody typed; the -m form is the paste-able one
|
|
391
|
-
return f"{
|
|
415
|
+
return f"{interpreter_word()} -m pythia"
|
|
392
416
|
prog = sys.argv[0] or "pythia"
|
|
393
417
|
if prog.lower().endswith(".py"):
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
418
|
+
return f"{interpreter_word()} {launcher_text([prog]) if ' ' in prog else prog}"
|
|
419
|
+
name = pathlib.Path(prog).name
|
|
420
|
+
if not re.search(r"[/\\]", prog):
|
|
421
|
+
return name # found by name: PATH has it
|
|
422
|
+
found = path_lookup(name)
|
|
423
|
+
if found and (_same_path(found, prog) or _same_path(found, prog + ".exe")):
|
|
424
|
+
return name
|
|
425
|
+
return f"{interpreter_word()} -m pythia"
|
|
398
426
|
|
|
399
427
|
|
|
400
428
|
HEADLESS_YES_MSG = (
|
|
@@ -6778,6 +6806,23 @@ def parse_pythia_command(command, cwd=None):
|
|
|
6778
6806
|
exe = re.sub(r"\.exe$", "", first.lower())
|
|
6779
6807
|
if exe == "pythia": # by name only: PATH decides, not the agent
|
|
6780
6808
|
return toks[1:]
|
|
6809
|
+
if _is_abs_path(first) and sys.executable:
|
|
6810
|
+
# this hook's own interpreter by absolute path — the spelling that
|
|
6811
|
+
# runs where pythia's venv is not on PATH (field test 0.15.4) — or
|
|
6812
|
+
# the pythia script beside it; any other path is a stranger's file
|
|
6813
|
+
own = pathlib.Path(sys.executable)
|
|
6814
|
+
if _same_path(first, own) and toks[1:3] == ["-m", "pythia"]:
|
|
6815
|
+
base = pathlib.Path(cwd or os.getcwd())
|
|
6816
|
+
if (base / "pythia.py").exists() or (base / "pythia").is_dir():
|
|
6817
|
+
return None # python -m would import that one
|
|
6818
|
+
return toks[3:]
|
|
6819
|
+
if _same_path(first, own) and len(toks) > 1 and _is_real_pythia(
|
|
6820
|
+
pathlib.Path(cwd or os.getcwd()) / toks[1]):
|
|
6821
|
+
return toks[2:] # a clone's launcher: this very file
|
|
6822
|
+
if any(_same_path(first, own.with_name(n))
|
|
6823
|
+
for n in ("pythia", "pythia.exe")):
|
|
6824
|
+
return toks[1:]
|
|
6825
|
+
return None
|
|
6781
6826
|
if re.fullmatch(r"python(\d+(\.\d+)?)?|py", exe):
|
|
6782
6827
|
if toks[1:3] == ["-m", "pythia"]:
|
|
6783
6828
|
base = pathlib.Path(cwd or os.getcwd())
|
|
@@ -6972,9 +7017,10 @@ def post_tool_note(payload):
|
|
|
6972
7017
|
return _hook_out("PostToolUse", context="pythia: " + " ".join(notes))
|
|
6973
7018
|
|
|
6974
7019
|
|
|
6975
|
-
def session_state_lines(root):
|
|
7020
|
+
def session_state_lines(root, home=None):
|
|
6976
7021
|
"""The project's live state, for the session preamble — no database."""
|
|
6977
7022
|
lines = []
|
|
7023
|
+
run = invocation()
|
|
6978
7024
|
cfg_path = pathlib.Path(root) / CONFIG_DIR / CONFIG_NAME
|
|
6979
7025
|
if cfg_path.is_file():
|
|
6980
7026
|
try:
|
|
@@ -6983,16 +7029,19 @@ def session_state_lines(root):
|
|
|
6983
7029
|
rows = []
|
|
6984
7030
|
names = ", ".join(r["name"] + ("*" if r["default"] else "") for r in rows)
|
|
6985
7031
|
lines.append(f"connections: {names or 'none filled in'} (* = default; "
|
|
6986
|
-
"`
|
|
7032
|
+
f"`{run} connections` for details)")
|
|
6987
7033
|
else:
|
|
6988
|
-
lines.append("connections: none — `
|
|
7034
|
+
lines.append(f"connections: none — `{run} install` scaffolds "
|
|
6989
7035
|
".pythia/connections.json")
|
|
6990
7036
|
lines.append(lease_line(read_lease(root)))
|
|
6991
7037
|
if (pathlib.Path(root) / CONFIG_DIR / "conventions.md").is_file():
|
|
6992
7038
|
lines.append("conventions: .pythia/conventions.md exists — read it "
|
|
6993
7039
|
"before writing any object")
|
|
6994
7040
|
mcp = _read_json(pathlib.Path(root) / ".mcp.json") or {}
|
|
6995
|
-
|
|
7041
|
+
# a venv install registers the approver in Claude Code's local scope
|
|
7042
|
+
# (~/.claude.json), never in the shared .mcp.json
|
|
7043
|
+
if ("pythia" in (mcp.get("mcpServers") or {})
|
|
7044
|
+
or local_mcp_entry(root, home) is not None):
|
|
6996
7045
|
lines.append("approval door: the pythia_approve tool (MCP) — prompts in "
|
|
6997
7046
|
"every permission mode; AskUserQuestion is the fallback")
|
|
6998
7047
|
return lines
|
|
@@ -7015,13 +7064,19 @@ def cmd_hook(conn, schema, ns):
|
|
|
7015
7064
|
md = pathlib.Path(root) / "CLAUDE.md"
|
|
7016
7065
|
loaded = md.is_file() and AGENTS_BEGIN in md.read_text(
|
|
7017
7066
|
encoding="utf-8", errors="replace")
|
|
7067
|
+
run = invocation()
|
|
7018
7068
|
if loaded:
|
|
7019
7069
|
# Claude Code already loaded the guide from CLAUDE.md: the
|
|
7020
7070
|
# hook adds what a static file cannot — the live state
|
|
7021
7071
|
print("PYTHIA HARNESS ACTIVE - the rules are in CLAUDE.md "
|
|
7022
|
-
"(pythia block); `
|
|
7072
|
+
f"(pythia block); `{run} guide` prints the full contract.")
|
|
7023
7073
|
else:
|
|
7024
7074
|
print(BRIEF_GUIDE.rstrip())
|
|
7075
|
+
if run not in ("pythia", "pythia.exe"):
|
|
7076
|
+
# the shared files say `pythia`; this machine runs it otherwise
|
|
7077
|
+
# (a venv nobody activated, a clone) — field test 0.15.4
|
|
7078
|
+
print(f"RUN `pythia` here is `{run}` — spell every pythia "
|
|
7079
|
+
"command the rules name that way.")
|
|
7025
7080
|
print("STATE " + "\n ".join(session_state_lines(root)))
|
|
7026
7081
|
return
|
|
7027
7082
|
out = (pre_tool_decision(payload) if event == "pre-tool"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pythia-plsql
|
|
3
|
-
Version: 0.15.
|
|
3
|
+
Version: 0.15.5
|
|
4
4
|
Summary: PL/SQL development for AI agents on Oracle Database - expert data-dictionary queries, impact analysis, and a snapshot-verified write path with honest rollback.
|
|
5
5
|
License: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/thaildhe172591/pythia
|
|
@@ -210,7 +210,10 @@ each agent needs you to finish by hand.
|
|
|
210
210
|
`.claude/settings.local.json` (this machine's file, kept out of git) with
|
|
211
211
|
the absolute interpreter, and the MCP approver to Claude Code's local scope
|
|
212
212
|
(`claude mcp add --scope local`); your teammates never get a path from your
|
|
213
|
-
machine.
|
|
213
|
+
machine. Every command pythia prints uses the spelling that starts it here,
|
|
214
|
+
the session preamble's `RUN` line names it for the agent (CLAUDE.md, being
|
|
215
|
+
shared, can only say `pythia`), and the guard lets reads through in that
|
|
216
|
+
spelling — this interpreter's own path, never another. `pythia doctor` starts every launcher it finds and fails the ones
|
|
214
217
|
that cannot import pythia — except where this machine's own launcher
|
|
215
218
|
already serves the same hooks: then the team's shared copy erroring here
|
|
216
219
|
is a warning (keep it for teammates or remove it). Codex's session hook is
|
|
@@ -99,3 +99,9 @@ local MCP scope, never in the shared files. A `warn` naming
|
|
|
99
99
|
`.claude/settings.json` is the team's shared copy failing on this machine
|
|
100
100
|
while your own launcher already serves the same hooks: keep it for teammates
|
|
101
101
|
or remove it.
|
|
102
|
+
|
|
103
|
+
`pythia: command not found` in the agent's shell does not mean the hooks are
|
|
104
|
+
off: pythia's venv is just not on PATH. The session preamble's `RUN` line names
|
|
105
|
+
the spelling that works on this machine (the venv's interpreter by absolute
|
|
106
|
+
path, `-m pythia`); use it for every pythia command the rules name. Commands
|
|
107
|
+
pythia prints already use it.
|
|
@@ -796,10 +796,18 @@ def test_apply_preview_warns_on_naming_drift():
|
|
|
796
796
|
|
|
797
797
|
|
|
798
798
|
def test_invocation_reflects_how_the_tool_was_run():
|
|
799
|
+
"""...as it runs from a shell here: a bare name only when PATH finds this
|
|
800
|
+
very file (tests/test_phase6.py covers the venv that is not on PATH)."""
|
|
799
801
|
import os
|
|
800
|
-
|
|
801
|
-
|
|
802
|
+
import re
|
|
803
|
+
# python / python3 / python3.13 — the name, not Path.stem ("python3.9"
|
|
804
|
+
# would lose its ".9")
|
|
805
|
+
interp = re.sub(r"\.exe$", "", pathlib.Path(sys.executable).name, flags=re.I)
|
|
806
|
+
old, old_lookup = sys.argv[0], pythia.path_lookup
|
|
802
807
|
try:
|
|
808
|
+
# PATH finds this interpreter by its name, and the entry point by its
|
|
809
|
+
pythia.path_lookup = lambda name, *a, **k: (
|
|
810
|
+
sys.executable if name == interp else sys.argv[0])
|
|
803
811
|
sys.argv[0] = "scripts/pythia.py" # run from source
|
|
804
812
|
assert pythia.invocation() == f"{interp} scripts/pythia.py"
|
|
805
813
|
# packaged entry point — a native path for whichever OS runs the test
|
|
@@ -812,7 +820,7 @@ def test_invocation_reflects_how_the_tool_was_run():
|
|
|
812
820
|
sys.argv[0] = "/usr/local/bin/pythia"
|
|
813
821
|
assert pythia.invocation() == "pythia"
|
|
814
822
|
finally:
|
|
815
|
-
sys.argv[0] = old
|
|
823
|
+
sys.argv[0], pythia.path_lookup = old, old_lookup
|
|
816
824
|
|
|
817
825
|
|
|
818
826
|
def test_preview_hint_is_pasteable():
|
|
@@ -830,8 +838,9 @@ def test_preview_hint_is_pasteable():
|
|
|
830
838
|
pythia.run_apply(conn, "APP", apply_ns(td, file="f.sql"), NEW_FILE)
|
|
831
839
|
finally:
|
|
832
840
|
sys.argv[0] = old
|
|
833
|
-
|
|
834
|
-
assert f"{
|
|
841
|
+
# this interpreter as a shell here types it (tests/test_phase6.py)
|
|
842
|
+
assert (f"{pythia.interpreter_word()} scripts/pythia.py apply f.sql "
|
|
843
|
+
"--confirm ") in buf.getvalue()
|
|
835
844
|
|
|
836
845
|
|
|
837
846
|
def test_preview_diff_ignores_the_create_header():
|
|
@@ -1028,6 +1028,166 @@ def test_pre_tool_cannot_be_talked_into_a_second_command():
|
|
|
1028
1028
|
expect_exit(lambda: pythia.build_parser().parse_args(["approve", "--ho"]))
|
|
1029
1029
|
|
|
1030
1030
|
|
|
1031
|
+
@contextlib.contextmanager
|
|
1032
|
+
def _interpreter(path):
|
|
1033
|
+
"""Run as if sys.executable were `path` — the hook's own interpreter."""
|
|
1034
|
+
old = sys.executable
|
|
1035
|
+
sys.executable = str(path)
|
|
1036
|
+
try:
|
|
1037
|
+
yield
|
|
1038
|
+
finally:
|
|
1039
|
+
sys.executable = old
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
def test_pre_tool_lets_reads_through_this_interpreter_by_absolute_path():
|
|
1043
|
+
"""Field test 0.15.4: pythia in a venv that is not on PATH. The commands
|
|
1044
|
+
that run there are spelled with the venv's interpreter by absolute path —
|
|
1045
|
+
the same launcher the hooks use — and every read was a prompt, because
|
|
1046
|
+
the guard knew only `pythia` and `python -m pythia`."""
|
|
1047
|
+
with tempfile.TemporaryDirectory() as td, tempfile.TemporaryDirectory() as v:
|
|
1048
|
+
exe = pathlib.Path(v) / "bin" / ("python.exe" if os.name == "nt" else "python3")
|
|
1049
|
+
script = exe.with_name("pythia.exe" if os.name == "nt" else "pythia")
|
|
1050
|
+
with _interpreter(exe):
|
|
1051
|
+
q = exe.as_posix()
|
|
1052
|
+
assert decision(pre(td, f'"{q}" -m pythia src PKG_ORDER')) == "allow"
|
|
1053
|
+
assert decision(pre(td, f"{q} -m pythia connections")) == "allow"
|
|
1054
|
+
assert decision(pre(td, f'"{q}" -m pythia apply f.sql')) == "allow" # preview
|
|
1055
|
+
# the install's own entry point, beside its interpreter
|
|
1056
|
+
assert decision(pre(td, f'"{script.as_posix()}" src PKG_ORDER')) == "allow"
|
|
1057
|
+
# a clone's launcher: this interpreter and this very pythia.py
|
|
1058
|
+
real = pathlib.Path(pythia.__file__).resolve().as_posix()
|
|
1059
|
+
assert decision(pre(td, f'"{q}" "{real}" src PKG_ORDER')) == "allow"
|
|
1060
|
+
|
|
1061
|
+
|
|
1062
|
+
def test_pre_tool_trusts_no_other_absolute_launcher():
|
|
1063
|
+
"""Allowing a command runs it without asking. An absolute path is
|
|
1064
|
+
trusted only when it is, by spelling, the interpreter running this hook
|
|
1065
|
+
(or its own pythia script): not a look-alike, not a symlink to it — a
|
|
1066
|
+
venv's python IS a symlink, and only its own path loads its packages."""
|
|
1067
|
+
with tempfile.TemporaryDirectory() as td, tempfile.TemporaryDirectory() as v:
|
|
1068
|
+
exe = pathlib.Path(v) / "bin" / "python3"
|
|
1069
|
+
with _interpreter(exe):
|
|
1070
|
+
q = exe.as_posix()
|
|
1071
|
+
for cmd in (f'"{pathlib.Path(v).as_posix()}/evil/python3" -m pythia src X',
|
|
1072
|
+
f'"{q}x" -m pythia src X',
|
|
1073
|
+
f'"{exe.with_name("python4").as_posix()}" -m pythia src X',
|
|
1074
|
+
f'"{exe.with_name("evil").as_posix()}" src X',
|
|
1075
|
+
"./bin/python3 -m pythia src X", # relative: cwd decides
|
|
1076
|
+
f'"{q}" -c "import os" -m pythia src X',
|
|
1077
|
+
f'"{q}" -m pythia src X; rm -rf ~',
|
|
1078
|
+
f'"{q}" -m pythia src X && touch y',
|
|
1079
|
+
f'"{q}" -m pythia apply f.sql --yes',
|
|
1080
|
+
f'"{q}" -m pythia policy set structural allow',
|
|
1081
|
+
f'"{q}" -m pythiax src X',
|
|
1082
|
+
f'"{q}" /tmp/elsewhere/pythia.py src X'):
|
|
1083
|
+
assert decision(pre(td, cmd)) is None, cmd
|
|
1084
|
+
# a pythia.py in the working directory shadows `-m pythia`
|
|
1085
|
+
(pathlib.Path(td) / "pythia.py").write_text("print('x')\n", encoding="utf-8")
|
|
1086
|
+
assert decision(pre(td, f'"{q}" -m pythia src X')) is None
|
|
1087
|
+
# the same path while ANOTHER interpreter runs the hook: not trusted
|
|
1088
|
+
with _interpreter(pathlib.Path(v) / "other" / "python3"), \
|
|
1089
|
+
tempfile.TemporaryDirectory() as clean:
|
|
1090
|
+
assert decision(pre(clean, f'"{exe.as_posix()}" -m pythia src X')) is None
|
|
1091
|
+
# a symlink to the real interpreter is another spelling: not trusted
|
|
1092
|
+
link = pathlib.Path(v) / "link-python3"
|
|
1093
|
+
try:
|
|
1094
|
+
os.symlink(sys.executable, link)
|
|
1095
|
+
except (OSError, NotImplementedError):
|
|
1096
|
+
return # no symlinks here (Windows without rights)
|
|
1097
|
+
with tempfile.TemporaryDirectory() as clean:
|
|
1098
|
+
assert decision(pre(clean, f'"{link.as_posix()}" -m pythia src X')) is None
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
@contextlib.contextmanager
|
|
1102
|
+
def _path_finds(found):
|
|
1103
|
+
"""path_lookup answering `found(name)` instead of reading PATH."""
|
|
1104
|
+
old = pythia.path_lookup
|
|
1105
|
+
pythia.path_lookup = lambda name, *a, **k: found(name)
|
|
1106
|
+
try:
|
|
1107
|
+
yield
|
|
1108
|
+
finally:
|
|
1109
|
+
pythia.path_lookup = old
|
|
1110
|
+
|
|
1111
|
+
|
|
1112
|
+
def test_printed_commands_run_where_pythia_is_not_on_path():
|
|
1113
|
+
"""Field test 0.15.4: a real Claude Code session in a project whose
|
|
1114
|
+
pythia lives in a venv that is not on PATH ran `pythia ...` and got
|
|
1115
|
+
`command not found`; the install's fallback said `python3 -m pythia`,
|
|
1116
|
+
which on that machine is the system interpreter, without pythia. A
|
|
1117
|
+
printed command names what runs here: the bare name only when PATH finds
|
|
1118
|
+
this very file, else this interpreter by absolute path."""
|
|
1119
|
+
with tempfile.TemporaryDirectory() as v:
|
|
1120
|
+
exe = pathlib.Path(v) / "bin" / "python3"
|
|
1121
|
+
script = exe.with_name("pythia")
|
|
1122
|
+
launcher = f'"{exe.as_posix()}" -m pythia'
|
|
1123
|
+
old = sys.argv[0]
|
|
1124
|
+
try:
|
|
1125
|
+
with _interpreter(exe):
|
|
1126
|
+
sys.argv[0] = str(script) # console script
|
|
1127
|
+
with _path_finds(lambda n: "/usr/bin/" + n): # PATH: other ones
|
|
1128
|
+
assert pythia.invocation() == launcher
|
|
1129
|
+
hint = pythia.entry_point_hint(None, str(exe.parent))
|
|
1130
|
+
assert launcher in hint and "\n python3 -m pythia" not in hint
|
|
1131
|
+
with _path_finds(lambda n: str(script) if n == "pythia" else None):
|
|
1132
|
+
assert pythia.invocation() == "pythia"
|
|
1133
|
+
sys.argv[0] = "scripts/pythia.py" # from a clone
|
|
1134
|
+
with _path_finds(lambda n: str(exe) if n == "python3" else None):
|
|
1135
|
+
assert pythia.invocation() == "python3 scripts/pythia.py"
|
|
1136
|
+
with _path_finds(lambda n: None):
|
|
1137
|
+
assert pythia.invocation() == f'"{exe.as_posix()}" scripts/pythia.py'
|
|
1138
|
+
finally:
|
|
1139
|
+
sys.argv[0] = old
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
def _session_start(td, home=None):
|
|
1143
|
+
import argparse
|
|
1144
|
+
old_stdin = sys.stdin
|
|
1145
|
+
sys.stdin = io.StringIO("")
|
|
1146
|
+
try:
|
|
1147
|
+
_, out = quiet(pythia.cmd_hook, None, None,
|
|
1148
|
+
argparse.Namespace(event="session-start", project_root=td))
|
|
1149
|
+
finally:
|
|
1150
|
+
sys.stdin = old_stdin
|
|
1151
|
+
return out
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
def test_session_start_names_the_launcher_that_runs_here():
|
|
1155
|
+
"""CLAUDE.md is shared, so it says `pythia`. The hook runs on this
|
|
1156
|
+
machine: it says how `pythia` is spelled here, once, and spells its own
|
|
1157
|
+
pointers that way."""
|
|
1158
|
+
launcher = '"/v/bin/python3" -m pythia'
|
|
1159
|
+
with tempfile.TemporaryDirectory() as td:
|
|
1160
|
+
pythia.scaffold_config(td)
|
|
1161
|
+
pythia.merge_marked_block(pathlib.Path(td) / "CLAUDE.md",
|
|
1162
|
+
pythia.claude_md_block())
|
|
1163
|
+
old = pythia.invocation
|
|
1164
|
+
try:
|
|
1165
|
+
pythia.invocation = lambda: launcher
|
|
1166
|
+
out = _session_start(td)
|
|
1167
|
+
assert f"`pythia` here is `{launcher}`" in out, out
|
|
1168
|
+
assert f"`{launcher} guide`" in out and f"`{launcher} connections`" in out
|
|
1169
|
+
pythia.invocation = lambda: "pythia"
|
|
1170
|
+
out = _session_start(td)
|
|
1171
|
+
assert "`pythia` here is" not in out and "`pythia guide`" in out
|
|
1172
|
+
finally:
|
|
1173
|
+
pythia.invocation = old
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
def test_session_state_names_a_local_scope_approval_door():
|
|
1177
|
+
"""Field test 0.15.4: in a venv project the MCP approver lives in Claude
|
|
1178
|
+
Code's local scope (~/.claude.json), not .mcp.json — and the session
|
|
1179
|
+
state said nothing about the door that prompts in every mode."""
|
|
1180
|
+
with tempfile.TemporaryDirectory() as td, tempfile.TemporaryDirectory() as home:
|
|
1181
|
+
assert not any("approval door" in ln
|
|
1182
|
+
for ln in pythia.session_state_lines(td, home=home))
|
|
1183
|
+
(pathlib.Path(home) / ".claude.json").write_text(json.dumps({"projects": {
|
|
1184
|
+
str(pathlib.Path(td)): {"mcpServers": {"pythia": {
|
|
1185
|
+
"command": "/v/bin/python3", "args": ["-m", "pythia", "mcp"]}}}}}),
|
|
1186
|
+
encoding="utf-8")
|
|
1187
|
+
assert any("approval door" in ln and "pythia_approve" in ln
|
|
1188
|
+
for ln in pythia.session_state_lines(td, home=home))
|
|
1189
|
+
|
|
1190
|
+
|
|
1031
1191
|
def test_tokens_that_are_not_tokens_name_nothing():
|
|
1032
1192
|
with tempfile.TemporaryDirectory() as td:
|
|
1033
1193
|
lease(td)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/scripts/pythia_plsql.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-explore/reference/data-dictionary.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-package/reference/plsql-standards.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythia_plsql-0.15.4 → pythia_plsql-0.15.5}/skills/pythia-tune/reference/tuning-checklist.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|