pythia-plsql 0.15.5__tar.gz → 0.15.7__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.5/scripts/pythia_plsql.egg-info → pythia_plsql-0.15.7}/PKG-INFO +1 -1
  2. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/pyproject.toml +1 -1
  3. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/scripts/pythia.py +28 -7
  4. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7/scripts/pythia_plsql.egg-info}/PKG-INFO +1 -1
  5. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-setup/reference/environment.md +4 -2
  6. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-table/SKILL.md +2 -1
  7. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/tests/test_phase6.py +40 -0
  8. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/LICENSE +0 -0
  9. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/README.md +0 -0
  10. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/comment-current.sql +0 -0
  11. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/compile-errors.sql +0 -0
  12. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/current-schema.sql +0 -0
  13. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/db-nls.sql +0 -0
  14. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/db-version.sql +0 -0
  15. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/dependencies.sql +0 -0
  16. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/explain-display.sql +0 -0
  17. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/impact.sql +0 -0
  18. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/invalid-objects.sql +0 -0
  19. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/name-occupants.sql +0 -0
  20. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/object-names.sql +0 -0
  21. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/object-source.sql +0 -0
  22. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/plscope-enabled.sql +0 -0
  23. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/plscope-statements.sql +0 -0
  24. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/plscope-usages.sql +0 -0
  25. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/schema-settings.sql +0 -0
  26. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/session-privileges.sql +0 -0
  27. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/similar-candidates.sql +0 -0
  28. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/source.sql +0 -0
  29. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/table-comments.sql +0 -0
  30. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/table-indexes.sql +0 -0
  31. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/table-stats.sql +0 -0
  32. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/queries/unindexed-fks.sql +0 -0
  33. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/scripts/pythia_plsql.egg-info/SOURCES.txt +0 -0
  34. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/scripts/pythia_plsql.egg-info/dependency_links.txt +0 -0
  35. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/scripts/pythia_plsql.egg-info/entry_points.txt +0 -0
  36. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/scripts/pythia_plsql.egg-info/requires.txt +0 -0
  37. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/scripts/pythia_plsql.egg-info/top_level.txt +0 -0
  38. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/setup.cfg +0 -0
  39. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-apply/SKILL.md +0 -0
  40. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-autopilot/SKILL.md +0 -0
  41. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-comment/SKILL.md +0 -0
  42. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-conventions/SKILL.md +0 -0
  43. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-deploy/SKILL.md +0 -0
  44. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-explore/SKILL.md +0 -0
  45. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-explore/reference/data-dictionary.md +0 -0
  46. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-impact/SKILL.md +0 -0
  47. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-package/SKILL.md +0 -0
  48. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-package/reference/plsql-standards.md +0 -0
  49. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-review/SKILL.md +0 -0
  50. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-review/reference/antipatterns.md +0 -0
  51. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-setup/SKILL.md +0 -0
  52. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-skill-author/SKILL.md +0 -0
  53. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-spec/SKILL.md +0 -0
  54. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-table/reference/ddl-standards.md +0 -0
  55. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-tune/SKILL.md +0 -0
  56. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-tune/reference/tuning-checklist.md +0 -0
  57. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-verify/SKILL.md +0 -0
  58. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-write/SKILL.md +0 -0
  59. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/pythia-write/reference/patterns.md +0 -0
  60. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/skills/using-pythia/SKILL.md +0 -0
  61. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/tests/test_install.py +0 -0
  62. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/tests/test_mcp.py +0 -0
  63. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/tests/test_phase1.py +0 -0
  64. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/tests/test_phase2.py +0 -0
  65. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/tests/test_phase3.py +0 -0
  66. {pythia_plsql-0.15.5 → pythia_plsql-0.15.7}/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.5
3
+ Version: 0.15.7
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pythia-plsql"
7
- version = "0.15.5"
7
+ version = "0.15.7"
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.5" # kept equal to pyproject.toml (tests/test_install.py)
64
+ __version__ = "0.15.7" # 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"
@@ -3106,7 +3106,8 @@ ROUTE build/change with open decisions -> pythia-spec asks FIRST. tables,
3106
3106
  trigger design -> pythia-package. scripts, releases -> pythia-deploy.
3107
3107
  explain -> explore. review -> review. landing a change -> apply.
3108
3108
  LEARN impact before any change. Ask the live database, never a dump. Read
3109
- .pythia/conventions.md if present; `pythia lint <file>` before apply.
3109
+ .pythia/conventions.md if present; `pythia lint <files>` before apply
3110
+ - a change's files in one run, so comments count across them.
3110
3111
  `pythia connections` - never open connections.json (passwords).
3111
3112
  ASK relay apply/deploy previews verbatim and wait for a real yes. >=10
3112
3113
  dependents or cross-schema: show the developer first. Refusals and
@@ -6609,9 +6610,20 @@ def cmd_lint(conn, schema, ns):
6609
6610
  f = lint_script(texts[p], conv, in_set)
6610
6611
  report[str(p)] = f
6611
6612
  errors += sum(1 for x in f if x["severity"] == "error")
6613
+ # one file, comments missing: they may live in another file of the same
6614
+ # change, which only one run over the set can count (field test 0.15.6)
6615
+ hint = None
6616
+ if len(paths) == 1 and any(x["rule"] == "comment-missing"
6617
+ for x in report[str(paths[0])]):
6618
+ hint = (f"COMMENT ON in another file? Comments count across the files "
6619
+ f"of one run: {invocation()} lint {paths[0]} <its comments "
6620
+ "file> (or the folder).")
6612
6621
  if ns.json:
6613
- print(json.dumps({"files": report, "errors": errors,
6614
- "rules": {k: v[0] for k, v in LINT_RULES.items()}}))
6622
+ out = {"files": report, "errors": errors,
6623
+ "rules": {k: v[0] for k, v in LINT_RULES.items()}}
6624
+ if hint:
6625
+ out["hint"] = hint
6626
+ print(json.dumps(out))
6615
6627
  else:
6616
6628
  for path, f in report.items():
6617
6629
  for ln in render_findings(f, label=path, en=en):
@@ -6621,6 +6633,8 @@ def cmd_lint(conn, schema, ns):
6621
6633
  + ("" if conv and conv.get("lint") else
6622
6634
  " (built-in rules; the LEAD tunes them in "
6623
6635
  ".pythia/conventions.json \"lint\")"))
6636
+ if hint:
6637
+ print("-- " + hint)
6624
6638
  if errors:
6625
6639
  sys.exit(2)
6626
6640
 
@@ -6846,8 +6860,10 @@ def classify_pythia_argv(argv):
6846
6860
  with contextlib.redirect_stderr(io.StringIO()), \
6847
6861
  contextlib.redirect_stdout(io.StringIO()):
6848
6862
  ns = build_parser().parse_args(argv)
6849
- except SystemExit:
6850
- return "other", None
6863
+ except SystemExit as e:
6864
+ # exit 0 inside the parser is --help: it prints and stops before
6865
+ # main() runs any command (field test 0.15.6). Errors exit 2.
6866
+ return ("read" if e.code == 0 else "other"), None
6851
6867
  sub = ns.command
6852
6868
  if getattr(ns, "yes", False):
6853
6869
  return "other", ns
@@ -7075,8 +7091,13 @@ def cmd_hook(conn, schema, ns):
7075
7091
  if run not in ("pythia", "pythia.exe"):
7076
7092
  # the shared files say `pythia`; this machine runs it otherwise
7077
7093
  # (a venv nobody activated, a clone) — field test 0.15.4
7094
+ # ...typed as written: a shell variable or a `;` makes it a
7095
+ # compound command, which the guard leaves to the client's
7096
+ # prompt (field test 0.15.5: PY=...; "$PY" -m pythia ...)
7078
7097
  print(f"RUN `pythia` here is `{run}` — spell every pythia "
7079
- "command the rules name that way.")
7098
+ "command the rules name that way, as written, one command "
7099
+ "per call: a shell variable or `;` makes it a compound "
7100
+ "command the guard asks about.")
7080
7101
  print("STATE " + "\n ".join(session_state_lines(root)))
7081
7102
  return
7082
7103
  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.5
3
+ Version: 0.15.7
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
@@ -103,5 +103,7 @@ or remove it.
103
103
  `pythia: command not found` in the agent's shell does not mean the hooks are
104
104
  off: pythia's venv is just not on PATH. The session preamble's `RUN` line names
105
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.
106
+ path, `-m pythia`); use it for every pythia command the rules name, typed as
107
+ written and one command per call — wrapped in a shell variable or joined with
108
+ `;`, it becomes a compound command the guard asks about. Commands pythia
109
+ prints already use it.
@@ -45,7 +45,8 @@ NO TABLE OR COLUMN WITHOUT ITS COMMENT, ITS CONSTRAINTS AND ITS IMPACT KNOWN
45
45
  — `COMMENT ... IS` takes a literal only (no `unistr`), and pythia sends
46
46
  UTF-8 exactly; `pythia doctor --db` warns if the character set cannot
47
47
  hold it.
48
- 4. **Lint it**: `pythia lint script.sql` — missing comments, unnamed
48
+ 4. **Lint it**: `pythia lint script.sql comments.sql` (one run, so the
49
+ comments file counts) — missing comments, unnamed
49
50
  constraints, unindexed FKs, `ADD ... NOT NULL` without a default,
50
51
  byte-semantics text, missing house columns. Errors are fixed, not argued.
51
52
  5. **Land it** with `pythia-deploy` (`pythia deploy script.sql`): every
@@ -1166,6 +1166,12 @@ def test_session_start_names_the_launcher_that_runs_here():
1166
1166
  out = _session_start(td)
1167
1167
  assert f"`pythia` here is `{launcher}`" in out, out
1168
1168
  assert f"`{launcher} guide`" in out and f"`{launcher} connections`" in out
1169
+ # field test 0.15.5: the agent put the long launcher in a shell
1170
+ # variable (PY=...; "$PY" -m pythia ...) — a compound command, so
1171
+ # the guard asked instead of allowing. The line says how to type it.
1172
+ run = next(ln for ln in out.splitlines() if ln.startswith("RUN"))
1173
+ assert "as written" in run and "one command per call" in run, run
1174
+ assert "variable" in run and "`;`" in run, run
1169
1175
  pythia.invocation = lambda: "pythia"
1170
1176
  out = _session_start(td)
1171
1177
  assert "`pythia` here is" not in out and "`pythia guide`" in out
@@ -1188,6 +1194,25 @@ def test_session_state_names_a_local_scope_approval_door():
1188
1194
  for ln in pythia.session_state_lines(td, home=home))
1189
1195
 
1190
1196
 
1197
+ def test_pre_tool_lets_help_through():
1198
+ """Field test 0.15.6: an agent ran `… -m pythia --help` and got a
1199
+ permission prompt — help exits inside the parser, before any command
1200
+ runs, so the guard could not classify it. Exit 0 from the parser is
1201
+ help and nothing else: it reads."""
1202
+ with tempfile.TemporaryDirectory() as td, tempfile.TemporaryDirectory() as v:
1203
+ for cmd in ("pythia --help", "pythia -h", "pythia apply --help",
1204
+ "pythia journal restore --help", "python -m pythia lint --help"):
1205
+ assert decision(pre(td, cmd)) == "allow", cmd
1206
+ exe = pathlib.Path(v) / "bin" / "python3"
1207
+ with _interpreter(exe):
1208
+ assert decision(pre(td, f'"{exe.as_posix()}" -m pythia --help')) == "allow"
1209
+ for cmd in ("pythia --he", "pythia --help; touch x", "pythia --help && rm y",
1210
+ "pythia apply f.sql --yes", "pythia policy set data_dml allow"):
1211
+ assert decision(pre(td, cmd)) is None, cmd
1212
+ # the forged-approval rule runs first, help or no help
1213
+ assert decision(pre(td, "pythia approve --hook --help")) == "deny"
1214
+
1215
+
1191
1216
  def test_tokens_that_are_not_tokens_name_nothing():
1192
1217
  with tempfile.TemporaryDirectory() as td:
1193
1218
  lease(td)
@@ -2040,6 +2065,21 @@ def test_lint_counts_comments_from_every_file_in_the_set():
2040
2065
  alone = [f for f in lint(a)[str(a)] if f["rule"] == "comment-missing"]
2041
2066
  assert alone and "in this script" in alone[0]["message"]
2042
2067
 
2068
+ # field test 0.15.6: an agent linted file by file and could only
2069
+ # guess the warnings were covered elsewhere. One file with missing
2070
+ # comments says how to count the others: lint them in one run.
2071
+ def text(*paths):
2072
+ ns = argparse.Namespace(paths=[str(p) for p in paths], json=False,
2073
+ project_root=td, color=False)
2074
+ _, out = quiet(pythia.cmd_lint, None, None, ns)
2075
+ return out
2076
+ hint = text(a)
2077
+ assert "one run" in hint and f"{pythia.invocation()} lint {a}" in hint, hint
2078
+ ns = argparse.Namespace(paths=[str(a)], json=True, project_root=td, color=False)
2079
+ _, out = quiet(pythia.cmd_lint, None, None, ns)
2080
+ assert "one run" in json.loads(out).get("hint", "")
2081
+ assert "one run" not in text(a, b) and "one run" not in text(b)
2082
+
2043
2083
 
2044
2084
  def main():
2045
2085
  failed = 0
File without changes
File without changes
File without changes