pythia-plsql 0.15.2__tar.gz → 0.15.3__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.
Files changed (66) hide show
  1. {pythia_plsql-0.15.2/scripts/pythia_plsql.egg-info → pythia_plsql-0.15.3}/PKG-INFO +5 -2
  2. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/README.md +4 -1
  3. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/pyproject.toml +1 -1
  4. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/scripts/pythia.py +136 -41
  5. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3/scripts/pythia_plsql.egg-info}/PKG-INFO +5 -2
  6. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-setup/reference/environment.md +4 -1
  7. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/tests/test_phase6.py +105 -0
  8. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/LICENSE +0 -0
  9. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/comment-current.sql +0 -0
  10. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/compile-errors.sql +0 -0
  11. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/current-schema.sql +0 -0
  12. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/db-nls.sql +0 -0
  13. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/db-version.sql +0 -0
  14. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/dependencies.sql +0 -0
  15. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/explain-display.sql +0 -0
  16. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/impact.sql +0 -0
  17. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/invalid-objects.sql +0 -0
  18. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/name-occupants.sql +0 -0
  19. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/object-names.sql +0 -0
  20. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/object-source.sql +0 -0
  21. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/plscope-enabled.sql +0 -0
  22. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/plscope-statements.sql +0 -0
  23. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/plscope-usages.sql +0 -0
  24. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/schema-settings.sql +0 -0
  25. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/session-privileges.sql +0 -0
  26. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/similar-candidates.sql +0 -0
  27. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/source.sql +0 -0
  28. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/table-comments.sql +0 -0
  29. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/table-indexes.sql +0 -0
  30. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/table-stats.sql +0 -0
  31. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/queries/unindexed-fks.sql +0 -0
  32. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/scripts/pythia_plsql.egg-info/SOURCES.txt +0 -0
  33. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/scripts/pythia_plsql.egg-info/dependency_links.txt +0 -0
  34. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/scripts/pythia_plsql.egg-info/entry_points.txt +0 -0
  35. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/scripts/pythia_plsql.egg-info/requires.txt +0 -0
  36. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/scripts/pythia_plsql.egg-info/top_level.txt +0 -0
  37. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/setup.cfg +0 -0
  38. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-apply/SKILL.md +0 -0
  39. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-autopilot/SKILL.md +0 -0
  40. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-comment/SKILL.md +0 -0
  41. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-conventions/SKILL.md +0 -0
  42. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-deploy/SKILL.md +0 -0
  43. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-explore/SKILL.md +0 -0
  44. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-explore/reference/data-dictionary.md +0 -0
  45. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-impact/SKILL.md +0 -0
  46. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-package/SKILL.md +0 -0
  47. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-package/reference/plsql-standards.md +0 -0
  48. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-review/SKILL.md +0 -0
  49. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-review/reference/antipatterns.md +0 -0
  50. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-setup/SKILL.md +0 -0
  51. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-skill-author/SKILL.md +0 -0
  52. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-spec/SKILL.md +0 -0
  53. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-table/SKILL.md +0 -0
  54. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-table/reference/ddl-standards.md +0 -0
  55. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-tune/SKILL.md +0 -0
  56. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-tune/reference/tuning-checklist.md +0 -0
  57. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-verify/SKILL.md +0 -0
  58. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-write/SKILL.md +0 -0
  59. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/pythia-write/reference/patterns.md +0 -0
  60. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/skills/using-pythia/SKILL.md +0 -0
  61. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/tests/test_install.py +0 -0
  62. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/tests/test_mcp.py +0 -0
  63. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/tests/test_phase1.py +0 -0
  64. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/tests/test_phase2.py +0 -0
  65. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/tests/test_phase3.py +0 -0
  66. {pythia_plsql-0.15.2 → pythia_plsql-0.15.3}/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.2
3
+ Version: 0.15.3
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
@@ -206,7 +206,10 @@ each agent needs you to finish by hand.
206
206
  the absolute interpreter, and the MCP approver to Claude Code's local scope
207
207
  (`claude mcp add --scope local`); your teammates never get a path from your
208
208
  machine. `pythia doctor` starts every launcher it finds and fails the ones
209
- that cannot import pythia.
209
+ that cannot import pythia — except where this machine's own launcher
210
+ already serves the same hooks: then the team's shared copy erroring here
211
+ is a warning (keep it for teammates or remove it). Codex's session hook is
212
+ a warning too: it carries only the session guide, and AGENTS.md the rules.
210
213
 
211
214
  Skills land in `.claude/skills` (or `~/.claude/skills` with `-g`).
212
215
  2. **Restart the Claude Code session** so the hooks and the MCP server load.
@@ -192,7 +192,10 @@ each agent needs you to finish by hand.
192
192
  the absolute interpreter, and the MCP approver to Claude Code's local scope
193
193
  (`claude mcp add --scope local`); your teammates never get a path from your
194
194
  machine. `pythia doctor` starts every launcher it finds and fails the ones
195
- that cannot import pythia.
195
+ that cannot import pythia — except where this machine's own launcher
196
+ already serves the same hooks: then the team's shared copy erroring here
197
+ is a warning (keep it for teammates or remove it). Codex's session hook is
198
+ a warning too: it carries only the session guide, and AGENTS.md the rules.
196
199
 
197
200
  Skills land in `.claude/skills` (or `~/.claude/skills` with `-g`).
198
201
  2. **Restart the Claude Code session** so the hooks and the MCP server load.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pythia-plsql"
7
- version = "0.15.2"
7
+ version = "0.15.3"
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.2" # kept equal to pyproject.toml (tests/test_install.py)
64
+ __version__ = "0.15.3" # 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"
@@ -4008,47 +4008,68 @@ def register_local_mcp(project_root, launcher, which=None, run=None, home=None):
4008
4008
  return ("updated" if have is not None else "added"), shown
4009
4009
 
4010
4010
 
4011
- def launcher_health(launcher, cwd=None, which=None, env=None, starts=None,
4012
- shared=False):
4013
- """(status, message) for one launcher found in the harness files. A bare
4014
- name is resolved on this PATH and run; a path (an interpreter's, or a
4015
- pythia.py's) is run only from a machine's own files — in a shared file it
4016
- is reported, never executed."""
4011
+ def launcher_verdict(launcher, which=None, env=None, starts=None, shared=False):
4012
+ """(status, code, detail) for one launcher found in the harness files —
4013
+ what doctor knows before a word is chosen. code: not-plain | shared-path |
4014
+ not-on-path | cannot-start | venv-only | ok; detail: the reason, or the
4015
+ active environment. A bare name is resolved on this PATH and run; a path
4016
+ (an interpreter's, or a pythia.py's) is run only from a machine's own
4017
+ files — in a shared file it is the repository's to choose, so it is
4018
+ named, never executed."""
4017
4019
  which = which or path_lookup
4018
4020
  env = os.environ if env is None else env
4019
4021
  starts = starts or launcher_starts
4020
4022
  argv = plain_launcher(launcher)
4021
4023
  if argv is None:
4022
- return ("warn", f"`{launcher}` is not a plain launcher (an interpreter "
4023
- "plus -m pythia, or an absolute pythia.py path) — doctor does "
4024
- "not run it")
4024
+ return "warn", "not-plain", ""
4025
4025
  bare = not re.search(r"[/\\]", argv[0])
4026
4026
  if shared and not (bare and argv[1:] == ["-m", "pythia"]):
4027
- # a path in a shared file is the repository's to choose — the
4028
- # interpreter's or the pythia.py it is pointed at — so it is named,
4029
- # never run
4030
- return ("warn", f"`{launcher}` is a path on one machine, in a file the "
4031
- "team shares — teammates' hooks will not find it, and doctor "
4032
- f"does not run it; `{invocation()} install` keeps a machine's "
4033
- "own launcher in .claude/settings.local.json")
4027
+ return "warn", "shared-path", ""
4034
4028
  resolved = which(argv[0]) if bare else argv[0]
4035
4029
  if bare and not resolved:
4036
- return ("fail", f"`{argv[0]}` is not on PATH, so `{launcher}` cannot "
4037
- "start — the guard and the approval doors it serves are off; "
4038
- f"re-run `{invocation()} install`")
4030
+ return "fail", "not-on-path", f"`{argv[0]}` is not on PATH"
4039
4031
  ok, why = starts(launcher)
4040
4032
  if not ok:
4041
- return ("fail", f"`{launcher}` cannot start pythia here ({why}) — the "
4042
- "guard and the approval doors it serves are off; re-run "
4043
- f"`{invocation()} install`, which picks an interpreter that can")
4033
+ return "fail", "cannot-start", why
4044
4034
  venv = env.get("VIRTUAL_ENV") or env.get("CONDA_PREFIX")
4045
4035
  if bare and venv and os.path.normcase(os.path.abspath(resolved)).startswith(
4046
4036
  os.path.normcase(os.path.abspath(venv)) + os.sep):
4047
- return ("warn", f"`{argv[0]}` finds pythia only while the virtual "
4048
- f"environment {venv} is active — Claude Code started from a "
4037
+ return "warn", "venv-only", venv
4038
+ return "ok", "ok", ""
4039
+
4040
+
4041
+ def launcher_message(launcher, code, detail, broken=None):
4042
+ """The words for a verdict. `broken` replaces what follows a launcher
4043
+ that cannot start — what it leaves off, and the fix — when the caller
4044
+ knows more than the launcher does (which file it is in, what else on
4045
+ this machine serves the same hooks)."""
4046
+ if code == "not-plain":
4047
+ return (f"`{launcher}` is not a plain launcher (an interpreter plus -m "
4048
+ "pythia, or an absolute pythia.py path) — doctor does not run it")
4049
+ if code == "shared-path":
4050
+ return (f"`{launcher}` is a path on one machine, in a file the team "
4051
+ "shares — teammates' hooks will not find it, and doctor does "
4052
+ f"not run it; `{invocation()} install` keeps a machine's own "
4053
+ "launcher in .claude/settings.local.json")
4054
+ if code in ("not-on-path", "cannot-start"):
4055
+ return (f"`{launcher}` cannot start pythia here ({detail}) — " + (
4056
+ broken or "the guard and the approval doors it serves are off; "
4057
+ f"re-run `{invocation()} install`, which picks an interpreter that "
4058
+ "can"))
4059
+ if code == "venv-only":
4060
+ return (f"`{launcher}` finds pythia only while the virtual environment "
4061
+ f"{detail} is active — Claude Code or Codex started from a "
4049
4062
  f"desktop app or IDE will not; re-run `{invocation()} install`, "
4050
4063
  "which pins this interpreter in .claude/settings.local.json")
4051
- return "ok", f"`{launcher}` starts pythia"
4064
+ return f"`{launcher}` starts pythia"
4065
+
4066
+
4067
+ def launcher_health(launcher, cwd=None, which=None, env=None, starts=None,
4068
+ shared=False, broken=None):
4069
+ """(status, message) for one launcher — launcher_verdict in words."""
4070
+ st, code, detail = launcher_verdict(launcher, which=which, env=env,
4071
+ starts=starts, shared=shared)
4072
+ return st, launcher_message(launcher, code, detail, broken)
4052
4073
 
4053
4074
 
4054
4075
  def exclude_local_settings(project_root):
@@ -6989,32 +7010,98 @@ def ask_question_breakers(project_root, home=None, plugin_limit=400):
6989
7010
  return found
6990
7011
 
6991
7012
 
7013
+ # what each pythia hook does, the two gates first — a launcher that cannot
7014
+ # start leaves exactly these off
7015
+ HOOK_JOBS = (("hook pre-tool", "the sqlplus guard"),
7016
+ ("approve --hook", "the AskUserQuestion approval"),
7017
+ ("hook session-start", "the session guide"),
7018
+ ("hook post-tool", "the verdict reminders"))
7019
+
7020
+
7021
+ def _and_list(words):
7022
+ words = list(words)
7023
+ return words[0] if len(words) == 1 else ", ".join(words[:-1]) + " and " + words[-1]
7024
+
7025
+
6992
7026
  def launch_checks(root, home, settings, local_settings):
6993
- """One row per launcher the harness files start pythia with: can it?
6994
- A hook that cannot start fails open, so this is a fail, not a warning."""
7027
+ """One row per launcher the harness files start pythia with: can it? A
7028
+ Claude hook that cannot start fails open, so the row names exactly which
7029
+ jobs (HOOK_JOBS) no other launcher that starts on this machine still
7030
+ does: a gate among them (the guard, the approval hook) is a fail; only
7031
+ the session guide or the reminders, a warning; nothing at all — the
7032
+ team's copy erroring here while this machine's own launcher serves the
7033
+ same hooks — a warning that leaves keep-or-remove to the developer.
7034
+ Codex's hook carries only the session guide: a warning either way."""
6995
7035
  tracked = bool(local_settings.get("hooks")) and git_tracks(
6996
7036
  root, ".claude/settings.local.json")
6997
- sources = [(".claude/settings.json", settings.get("hooks"), True),
6998
- (".claude/settings.local.json", local_settings.get("hooks"), tracked),
7037
+ # role: shared (the team's file), own (this machine's), user (~/.claude,
7038
+ # every project of this user), codex (shared, the session guide only)
7039
+ sources = [(".claude/settings.json", settings.get("hooks"), "shared"),
7040
+ (".claude/settings.local.json", local_settings.get("hooks"),
7041
+ "shared" if tracked else "own"),
6999
7042
  ("~/.claude/settings.json",
7000
7043
  (_read_json(home / ".claude" / "settings.json") or {}).get("hooks"),
7001
- False),
7044
+ "user"),
7002
7045
  (".codex/hooks.json",
7003
7046
  (_read_json(root / ".codex" / "hooks.json") or {}).get("hooks"),
7004
- True)]
7005
- out = []
7006
- for where, hooks, shared in sources:
7007
- launchers = []
7047
+ "codex")]
7048
+ found = []
7049
+ for where, hooks, role in sources:
7050
+ marks = {}
7008
7051
  for ev in (hooks or {}).values() if isinstance(hooks, dict) else []:
7009
7052
  for e in ev if isinstance(ev, list) else []:
7010
7053
  for h in (e.get("hooks") or []) if isinstance(e, dict) else []:
7011
7054
  cmd = str(h.get("command", "")) if isinstance(h, dict) else ""
7012
7055
  mark = _hook_mark(cmd)
7013
7056
  if mark:
7014
- launchers.append(cmd[:cmd.index(mark)].strip())
7015
- for launcher in dict.fromkeys(launchers):
7016
- st, msg = launcher_health(launcher, shared=shared)
7017
- out.append((st, "hook launch", f"{where}: {msg}"))
7057
+ marks.setdefault(cmd[:cmd.index(mark)].strip(), set()).add(
7058
+ LEGACY_HOOK_COMMANDS.get(mark, mark))
7059
+ for launcher, served in marks.items():
7060
+ found.append((where, role, launcher, served) + launcher_verdict(
7061
+ launcher, shared=role in ("shared", "codex")))
7062
+ out = []
7063
+ for i, (where, role, launcher, served, st, code, detail) in enumerate(found):
7064
+ broken = None
7065
+ if code in ("not-on-path", "cannot-start") and role == "codex":
7066
+ st = "warn"
7067
+ broken = ("Codex then misses only its session guide and live state; "
7068
+ "AGENTS.md still carries the rules. The .codex/ files are "
7069
+ f"shared and stay portable — `{invocation()} install` says "
7070
+ "what this machine's ~/.codex/config.toml needs")
7071
+ elif code in ("not-on-path", "cannot-start"):
7072
+ # what the other Claude launchers that do start already serve
7073
+ others = [(w, s) for j, (w, r, _, s, _, c, _) in enumerate(found)
7074
+ if j != i and r != "codex" and c == "ok"]
7075
+ covered = set().union(*[s for _, s in others]) if others else set()
7076
+ off = [label for mark, label in HOOK_JOBS if mark in served - covered]
7077
+ here = {"shared": ".claude/settings.json",
7078
+ "own": ".claude/settings.local.json",
7079
+ "user": "~/.claude/settings.json"}[role]
7080
+ if not off:
7081
+ st = "warn"
7082
+ names = list(dict.fromkeys(w for w, s in others if s & served))
7083
+ keep = ("Teammates may rely on them — keep them, or remove them "
7084
+ "from .claude/settings.json" if role == "shared" else
7085
+ f"Remove them from {here}")
7086
+ broken = (f"these hooks show an error on every call they match, "
7087
+ f"while {' and '.join(names)} "
7088
+ f"{'serve' if len(names) > 1 else 'serves'} the same "
7089
+ f"hooks with a launcher that starts. {keep}")
7090
+ else:
7091
+ gate = any(m in served - covered for m, _ in HOOK_JOBS[:2])
7092
+ st = "fail" if gate else "warn"
7093
+ fix = {"shared": f"re-run `{invocation()} install` — it adds this "
7094
+ "machine's own launcher to "
7095
+ ".claude/settings.local.json and leaves the "
7096
+ "shared file to the team",
7097
+ "own": f"re-run `{invocation()} install`, which picks an "
7098
+ "interpreter that can",
7099
+ "user": f"re-run `{invocation()} install -g`"}[role]
7100
+ broken = (f"{_and_list(off)} {'is' if len(off) == 1 else 'are'} "
7101
+ f"off {'in every project' if role == 'user' else 'on this machine'}"
7102
+ f"; {fix}")
7103
+ out.append((st, "hook launch",
7104
+ f"{where}: {launcher_message(launcher, code, detail, broken)}"))
7018
7105
  return out
7019
7106
 
7020
7107
 
@@ -7060,7 +7147,11 @@ def harness_checks(project_root, home=None):
7060
7147
  mcp = _read_json(root / ".mcp.json") or {}
7061
7148
  local = local_mcp_entry(root, home_dir)
7062
7149
  if local is not None:
7063
- st, msg = launcher_health(mcp_launcher(local) or str(local.get("command")))
7150
+ st, msg = launcher_health(
7151
+ mcp_launcher(local) or str(local.get("command")),
7152
+ broken="the pythia_approve door stays closed (AskUserQuestion and "
7153
+ f"the console remain); re-run `{invocation()} install`, which "
7154
+ "registers it again with a launcher that starts")
7064
7155
  out.append((st, "approval door", "pythia_approve MCP tool registered in "
7065
7156
  f"Claude Code's local scope (overrides .mcp.json) — {msg}"))
7066
7157
  elif "pythia" in (mcp.get("mcpServers") or {}):
@@ -7069,7 +7160,11 @@ def harness_checks(project_root, home=None):
7069
7160
  entry = mcp["mcpServers"]["pythia"]
7070
7161
  st, msg = launcher_health(mcp_launcher(entry) or str(
7071
7162
  (entry or {}).get("command") if isinstance(entry, dict) else entry),
7072
- shared=True)
7163
+ shared=True,
7164
+ broken="the pythia_approve door stays closed (AskUserQuestion and "
7165
+ f"the console remain); re-run `{invocation()} install` — it "
7166
+ "registers this machine's launcher in Claude Code's local "
7167
+ "scope, which overrides .mcp.json")
7073
7168
  out.append((st, "approval door", "pythia_approve MCP tool registered in "
7074
7169
  ".mcp.json" + ("" if trusted else
7075
7170
  " (approve the server once in /mcp)")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pythia-plsql
3
- Version: 0.15.2
3
+ Version: 0.15.3
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
@@ -206,7 +206,10 @@ each agent needs you to finish by hand.
206
206
  the absolute interpreter, and the MCP approver to Claude Code's local scope
207
207
  (`claude mcp add --scope local`); your teammates never get a path from your
208
208
  machine. `pythia doctor` starts every launcher it finds and fails the ones
209
- that cannot import pythia.
209
+ that cannot import pythia — except where this machine's own launcher
210
+ already serves the same hooks: then the team's shared copy erroring here
211
+ is a warning (keep it for teammates or remove it). Codex's session hook is
212
+ a warning too: it carries only the session guide, and AGENTS.md the rules.
210
213
 
211
214
  Skills land in `.claude/skills` (or `~/.claude/skills` with `-g`).
212
215
  2. **Restart the Claude Code session** so the hooks and the MCP server load.
@@ -93,4 +93,7 @@ arriving. A `fail` on **hook launch** means a hook's interpreter cannot import
93
93
  pythia, so the guard is off: common when pythia lives in a venv or pipx and
94
94
  Claude Code starts from a desktop app or IDE. Re-run `pythia install` — it pins
95
95
  that machine's interpreter in `.claude/settings.local.json` and Claude Code's
96
- local MCP scope, never in the shared files.
96
+ local MCP scope, never in the shared files. A `warn` naming
97
+ `.claude/settings.json` is the team's shared copy failing on this machine
98
+ while your own launcher already serves the same hooks: keep it for teammates
99
+ or remove it.
@@ -1621,6 +1621,111 @@ def test_doctor_never_runs_a_script_path_from_a_shared_file():
1621
1621
  assert len(named) == 3, rows
1622
1622
 
1623
1623
 
1624
+ # Field test of 0.15.2: right after an install from a venv, doctor reported
1625
+ # `fail` for the team's shared hooks ("the guard is off") although
1626
+ # settings.local.json served every one of them, and `fail` for Codex's session
1627
+ # hook, which carries no guard at all — and advised a re-run of install that
1628
+ # cannot change either, since install leaves shared files alone.
1629
+
1630
+ GONE = "python3.99 -m pythia" # a bare interpreter on no PATH
1631
+
1632
+
1633
+ def _launch_rows(rows, prefix):
1634
+ return [(s, m) for s, a, m in rows if a == "hook launch" and m.startswith(prefix)]
1635
+
1636
+
1637
+ def test_doctor_a_shared_hook_this_machine_already_covers_is_a_warning():
1638
+ with tempfile.TemporaryDirectory() as td, tempfile.TemporaryDirectory() as home:
1639
+ pythia.install_claude_hooks(td, launcher=GONE) # the team's
1640
+ pythia.install_claude_hooks(td, launcher=_good_launcher(), local=True)
1641
+ rows = pythia.harness_checks(td, home)
1642
+ shared = _launch_rows(rows, ".claude/settings.json")
1643
+ assert len(shared) == 1 and shared[0][0] == "warn", rows
1644
+ msg = shared[0][1]
1645
+ assert ".claude/settings.local.json" in msg # what serves them here
1646
+ assert "keep" in msg and "remove" in msg # the developer's call
1647
+ assert "error" in msg # what they will see
1648
+ assert not [r for r in rows if r[0] == "fail"], rows
1649
+
1650
+
1651
+ def test_doctor_a_shared_hook_nothing_here_covers_stays_a_fail_with_a_real_fix():
1652
+ with tempfile.TemporaryDirectory() as td, tempfile.TemporaryDirectory() as home:
1653
+ pythia.install_claude_hooks(td, launcher=GONE)
1654
+ local = pathlib.Path(td) / ".claude" / "settings.local.json"
1655
+ local.write_text(json.dumps({"hooks": {"PreToolUse": [ # the guard only
1656
+ {"matcher": "Bash", "hooks": [{"type": "command",
1657
+ "command": f"{_good_launcher()} hook pre-tool"}]}]}}), encoding="utf-8")
1658
+ rows = pythia.harness_checks(td, home)
1659
+ shared = _launch_rows(rows, ".claude/settings.json")
1660
+ assert len(shared) == 1 and shared[0][0] == "fail", rows
1661
+ msg = shared[0][1]
1662
+ assert "not on PATH" in msg and "install" in msg
1663
+ assert ".claude/settings.local.json" in msg # where the fix lands
1664
+ with tempfile.TemporaryDirectory() as td, tempfile.TemporaryDirectory() as home:
1665
+ pythia.install_claude_hooks(td, launcher=GONE) # no local file at all
1666
+ assert _launch_rows(pythia.harness_checks(td, home),
1667
+ ".claude/settings.json")[0][0] == "fail"
1668
+
1669
+
1670
+ def test_doctor_names_exactly_what_a_broken_hook_leaves_off():
1671
+ """~/.claude (install -g) serves the guard and the approval hook but no
1672
+ SessionStart: the team's broken copy then leaves off only the session
1673
+ guide — a warning that says so, not "the guard is off"."""
1674
+ with tempfile.TemporaryDirectory() as td, tempfile.TemporaryDirectory() as home:
1675
+ pythia.install_claude_hooks(td, launcher=GONE)
1676
+ pythia.install_claude_hooks(home, events=("PreToolUse", "PostToolUse"),
1677
+ launcher=_good_launcher())
1678
+ rows = pythia.harness_checks(td, home)
1679
+ shared = _launch_rows(rows, ".claude/settings.json")
1680
+ assert len(shared) == 1 and shared[0][0] == "warn", rows
1681
+ assert "session guide" in shared[0][1] and "guard" not in shared[0][1]
1682
+ assert not [r for r in rows if r[0] == "fail"], rows
1683
+ with tempfile.TemporaryDirectory() as td, tempfile.TemporaryDirectory() as home:
1684
+ pythia.install_claude_hooks(td, launcher=GONE)
1685
+ local = pathlib.Path(td) / ".claude" / "settings.local.json"
1686
+ local.write_text(json.dumps({"hooks": {"PreToolUse": [
1687
+ {"matcher": "Bash", "hooks": [{"type": "command",
1688
+ "command": f"{_good_launcher()} hook pre-tool"}]}]}}), encoding="utf-8")
1689
+ msg = _launch_rows(pythia.harness_checks(td, home), ".claude/settings.json")[0][1]
1690
+ assert "AskUserQuestion approval" in msg and "sqlplus guard" not in msg
1691
+
1692
+
1693
+ def test_doctor_codex_session_hook_names_its_real_scope():
1694
+ with tempfile.TemporaryDirectory() as td, tempfile.TemporaryDirectory() as home:
1695
+ p = pathlib.Path(td) / ".codex" / "hooks.json"
1696
+ p.parent.mkdir()
1697
+ p.write_text(json.dumps({"hooks": {"SessionStart": [{"hooks": [
1698
+ {"type": "command", "command": f"{GONE} hook session-start"}]}]}}),
1699
+ encoding="utf-8")
1700
+ rows = pythia.harness_checks(td, home)
1701
+ codex = _launch_rows(rows, ".codex/hooks.json")
1702
+ assert len(codex) == 1 and codex[0][0] == "warn", rows
1703
+ assert "AGENTS.md" in codex[0][1] and "session" in codex[0][1]
1704
+ assert "guard" not in codex[0][1] # it carries none
1705
+ assert not [r for r in rows if r[0] == "fail"], rows
1706
+
1707
+
1708
+ def test_doctor_names_what_a_broken_mcp_launcher_closes():
1709
+ with tempfile.TemporaryDirectory() as td, tempfile.TemporaryDirectory() as home:
1710
+ (pathlib.Path(td) / ".mcp.json").write_text(json.dumps({"mcpServers": {
1711
+ "pythia": {"command": "python3.99", "args": ["-m", "pythia", "mcp"]}}}),
1712
+ encoding="utf-8")
1713
+ door = [(s, m) for s, a, m in pythia.harness_checks(td, home)
1714
+ if a == "approval door"]
1715
+ assert len(door) == 1 and door[0][0] == "fail", door
1716
+ assert "pythia_approve" in door[0][1] and "local scope" in door[0][1]
1717
+ assert "guard" not in door[0][1] # a door, not the guard
1718
+
1719
+
1720
+ def test_doctor_sends_a_broken_global_hook_to_install_dash_g():
1721
+ with tempfile.TemporaryDirectory() as td, tempfile.TemporaryDirectory() as home:
1722
+ pythia.install_claude_hooks(home, events=("PreToolUse", "PostToolUse"),
1723
+ launcher='"/nonexistent/bin/python" -m pythia')
1724
+ user = _launch_rows(pythia.harness_checks(td, home), "~/.claude/settings.json")
1725
+ assert len(user) == 1 and user[0][0] == "fail", user
1726
+ assert "install -g" in user[0][1]
1727
+
1728
+
1624
1729
  def test_doctor_warns_a_bare_launcher_that_lives_in_the_active_virtualenv():
1625
1730
  ok = lambda l, cwd=None: (True, "") # noqa: E731
1626
1731
  with tempfile.TemporaryDirectory() as venv:
File without changes
File without changes