@oriro/orirocli 0.1.9 → 0.1.12
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.
- package/README.md +16 -18
- package/dist/cli.js +4776 -2964
- package/package.json +2 -2
- package/skills/craft/ai-engineering/SKILL.md +2 -2
- package/skills/graphify/SKILL.md +0 -619
- package/skills/graphify/__init__.py +0 -28
- package/skills/graphify/__main__.py +0 -4582
- package/skills/graphify/affected.py +0 -154
- package/skills/graphify/always_on/agents-md.md +0 -12
- package/skills/graphify/always_on/antigravity-rules.md +0 -14
- package/skills/graphify/always_on/claude-md.md +0 -9
- package/skills/graphify/always_on/gemini-md.md +0 -9
- package/skills/graphify/always_on/kiro-steering.md +0 -5
- package/skills/graphify/always_on/vscode-instructions.md +0 -17
- package/skills/graphify/analyze.py +0 -724
- package/skills/graphify/benchmark.py +0 -155
- package/skills/graphify/build.py +0 -487
- package/skills/graphify/cache.py +0 -417
- package/skills/graphify/callflow_html.py +0 -2020
- package/skills/graphify/cluster.py +0 -272
- package/skills/graphify/command-kilo.md +0 -15
- package/skills/graphify/dedup.py +0 -429
- package/skills/graphify/detect.py +0 -1379
- package/skills/graphify/diagnostics.py +0 -390
- package/skills/graphify/export.py +0 -1408
- package/skills/graphify/extract.py +0 -11570
- package/skills/graphify/global_graph.py +0 -159
- package/skills/graphify/google_workspace.py +0 -223
- package/skills/graphify/hooks.py +0 -457
- package/skills/graphify/ingest.py +0 -331
- package/skills/graphify/llm.py +0 -1896
- package/skills/graphify/manifest.py +0 -4
- package/skills/graphify/mcp_ingest.py +0 -392
- package/skills/graphify/multigraph_compat.py +0 -212
- package/skills/graphify/pg_introspect.py +0 -142
- package/skills/graphify/prs.py +0 -748
- package/skills/graphify/querylog.py +0 -70
- package/skills/graphify/report.py +0 -218
- package/skills/graphify/scip_ingest.py +0 -363
- package/skills/graphify/security.py +0 -336
- package/skills/graphify/semantic_cleanup.py +0 -319
- package/skills/graphify/serve.py +0 -1309
- package/skills/graphify/skill-aider.md +0 -1246
- package/skills/graphify/skill-amp.md +0 -613
- package/skills/graphify/skill-claw.md +0 -616
- package/skills/graphify/skill-codex.md +0 -613
- package/skills/graphify/skill-copilot.md +0 -616
- package/skills/graphify/skill-devin.md +0 -1372
- package/skills/graphify/skill-droid.md +0 -613
- package/skills/graphify/skill-kilo.md +0 -625
- package/skills/graphify/skill-kiro.md +0 -615
- package/skills/graphify/skill-opencode.md +0 -608
- package/skills/graphify/skill-pi.md +0 -615
- package/skills/graphify/skill-trae.md +0 -614
- package/skills/graphify/skill-vscode.md +0 -612
- package/skills/graphify/skill-windows.md +0 -651
- package/skills/graphify/skills/amp/references/add-watch.md +0 -56
- package/skills/graphify/skills/amp/references/exports.md +0 -71
- package/skills/graphify/skills/amp/references/extraction-spec.md +0 -68
- package/skills/graphify/skills/amp/references/github-and-merge.md +0 -46
- package/skills/graphify/skills/amp/references/hooks.md +0 -33
- package/skills/graphify/skills/amp/references/query.md +0 -249
- package/skills/graphify/skills/amp/references/transcribe.md +0 -48
- package/skills/graphify/skills/amp/references/update.md +0 -179
- package/skills/graphify/skills/claude/references/add-watch.md +0 -56
- package/skills/graphify/skills/claude/references/exports.md +0 -71
- package/skills/graphify/skills/claude/references/extraction-spec.md +0 -68
- package/skills/graphify/skills/claude/references/github-and-merge.md +0 -46
- package/skills/graphify/skills/claude/references/hooks.md +0 -33
- package/skills/graphify/skills/claude/references/query.md +0 -103
- package/skills/graphify/skills/claude/references/transcribe.md +0 -48
- package/skills/graphify/skills/claude/references/update.md +0 -179
- package/skills/graphify/skills/claw/references/add-watch.md +0 -56
- package/skills/graphify/skills/claw/references/exports.md +0 -71
- package/skills/graphify/skills/claw/references/extraction-spec.md +0 -29
- package/skills/graphify/skills/claw/references/github-and-merge.md +0 -46
- package/skills/graphify/skills/claw/references/hooks.md +0 -33
- package/skills/graphify/skills/claw/references/query.md +0 -249
- package/skills/graphify/skills/claw/references/transcribe.md +0 -48
- package/skills/graphify/skills/claw/references/update.md +0 -179
- package/skills/graphify/skills/codex/references/add-watch.md +0 -56
- package/skills/graphify/skills/codex/references/exports.md +0 -71
- package/skills/graphify/skills/codex/references/extraction-spec.md +0 -29
- package/skills/graphify/skills/codex/references/github-and-merge.md +0 -46
- package/skills/graphify/skills/codex/references/hooks.md +0 -33
- package/skills/graphify/skills/codex/references/query.md +0 -249
- package/skills/graphify/skills/codex/references/transcribe.md +0 -48
- package/skills/graphify/skills/codex/references/update.md +0 -179
- package/skills/graphify/skills/copilot/references/add-watch.md +0 -56
- package/skills/graphify/skills/copilot/references/exports.md +0 -71
- package/skills/graphify/skills/copilot/references/extraction-spec.md +0 -68
- package/skills/graphify/skills/copilot/references/github-and-merge.md +0 -46
- package/skills/graphify/skills/copilot/references/hooks.md +0 -33
- package/skills/graphify/skills/copilot/references/query.md +0 -249
- package/skills/graphify/skills/copilot/references/transcribe.md +0 -48
- package/skills/graphify/skills/copilot/references/update.md +0 -179
- package/skills/graphify/skills/droid/references/add-watch.md +0 -56
- package/skills/graphify/skills/droid/references/exports.md +0 -71
- package/skills/graphify/skills/droid/references/extraction-spec.md +0 -68
- package/skills/graphify/skills/droid/references/github-and-merge.md +0 -46
- package/skills/graphify/skills/droid/references/hooks.md +0 -33
- package/skills/graphify/skills/droid/references/query.md +0 -249
- package/skills/graphify/skills/droid/references/transcribe.md +0 -48
- package/skills/graphify/skills/droid/references/update.md +0 -179
- package/skills/graphify/skills/kilo/references/add-watch.md +0 -56
- package/skills/graphify/skills/kilo/references/exports.md +0 -71
- package/skills/graphify/skills/kilo/references/extraction-spec.md +0 -68
- package/skills/graphify/skills/kilo/references/github-and-merge.md +0 -46
- package/skills/graphify/skills/kilo/references/hooks.md +0 -33
- package/skills/graphify/skills/kilo/references/query.md +0 -249
- package/skills/graphify/skills/kilo/references/transcribe.md +0 -48
- package/skills/graphify/skills/kilo/references/update.md +0 -179
- package/skills/graphify/skills/kiro/references/add-watch.md +0 -56
- package/skills/graphify/skills/kiro/references/exports.md +0 -71
- package/skills/graphify/skills/kiro/references/extraction-spec.md +0 -29
- package/skills/graphify/skills/kiro/references/github-and-merge.md +0 -46
- package/skills/graphify/skills/kiro/references/hooks.md +0 -33
- package/skills/graphify/skills/kiro/references/query.md +0 -249
- package/skills/graphify/skills/kiro/references/transcribe.md +0 -48
- package/skills/graphify/skills/kiro/references/update.md +0 -179
- package/skills/graphify/skills/opencode/references/add-watch.md +0 -56
- package/skills/graphify/skills/opencode/references/exports.md +0 -71
- package/skills/graphify/skills/opencode/references/extraction-spec.md +0 -68
- package/skills/graphify/skills/opencode/references/github-and-merge.md +0 -46
- package/skills/graphify/skills/opencode/references/hooks.md +0 -33
- package/skills/graphify/skills/opencode/references/query.md +0 -249
- package/skills/graphify/skills/opencode/references/transcribe.md +0 -48
- package/skills/graphify/skills/opencode/references/update.md +0 -179
- package/skills/graphify/skills/pi/references/add-watch.md +0 -56
- package/skills/graphify/skills/pi/references/exports.md +0 -71
- package/skills/graphify/skills/pi/references/extraction-spec.md +0 -29
- package/skills/graphify/skills/pi/references/github-and-merge.md +0 -46
- package/skills/graphify/skills/pi/references/hooks.md +0 -33
- package/skills/graphify/skills/pi/references/query.md +0 -249
- package/skills/graphify/skills/pi/references/transcribe.md +0 -48
- package/skills/graphify/skills/pi/references/update.md +0 -179
- package/skills/graphify/skills/trae/references/add-watch.md +0 -56
- package/skills/graphify/skills/trae/references/exports.md +0 -71
- package/skills/graphify/skills/trae/references/extraction-spec.md +0 -68
- package/skills/graphify/skills/trae/references/github-and-merge.md +0 -46
- package/skills/graphify/skills/trae/references/hooks.md +0 -35
- package/skills/graphify/skills/trae/references/query.md +0 -249
- package/skills/graphify/skills/trae/references/transcribe.md +0 -48
- package/skills/graphify/skills/trae/references/update.md +0 -179
- package/skills/graphify/skills/vscode/references/add-watch.md +0 -56
- package/skills/graphify/skills/vscode/references/exports.md +0 -71
- package/skills/graphify/skills/vscode/references/extraction-spec.md +0 -68
- package/skills/graphify/skills/vscode/references/github-and-merge.md +0 -46
- package/skills/graphify/skills/vscode/references/hooks.md +0 -33
- package/skills/graphify/skills/vscode/references/query.md +0 -249
- package/skills/graphify/skills/vscode/references/transcribe.md +0 -48
- package/skills/graphify/skills/vscode/references/update.md +0 -179
- package/skills/graphify/skills/windows/references/add-watch.md +0 -56
- package/skills/graphify/skills/windows/references/exports.md +0 -71
- package/skills/graphify/skills/windows/references/extraction-spec.md +0 -68
- package/skills/graphify/skills/windows/references/github-and-merge.md +0 -46
- package/skills/graphify/skills/windows/references/hooks.md +0 -33
- package/skills/graphify/skills/windows/references/query.md +0 -249
- package/skills/graphify/skills/windows/references/transcribe.md +0 -48
- package/skills/graphify/skills/windows/references/update.md +0 -179
- package/skills/graphify/symbol_resolution.py +0 -538
- package/skills/graphify/transcribe.py +0 -184
- package/skills/graphify/tree_html.py +0 -582
- package/skills/graphify/validate.py +0 -72
- package/skills/graphify/watch.py +0 -898
- package/skills/graphify/wiki.py +0 -282
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
from graphify.extract import extract_sql
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def _quote_ident(name: str) -> str:
|
|
7
|
-
"""Double-quote a PostgreSQL identifier, escaping embedded double-quotes."""
|
|
8
|
-
return '"' + name.replace('"', '""') + '"'
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def introspect_postgres(dsn: str | None = None) -> dict:
|
|
12
|
-
"""Connect to PostgreSQL, reconstruct DDL, and extract via extract_sql()."""
|
|
13
|
-
try:
|
|
14
|
-
import psycopg
|
|
15
|
-
except ModuleNotFoundError:
|
|
16
|
-
raise ImportError(
|
|
17
|
-
"psycopg is required for --postgres. "
|
|
18
|
-
"Install with: pip install 'graphify[postgres]'"
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
try:
|
|
22
|
-
conn = psycopg.connect(dsn or "") # empty string = PG* env vars
|
|
23
|
-
except psycopg.OperationalError as exc:
|
|
24
|
-
# Sanitize: strip the DSN/credentials that psycopg may embed in the
|
|
25
|
-
# OperationalError message (e.g. "connection to server … failed: …\nDETAIL: …")
|
|
26
|
-
msg = str(exc).split("\n")[0]
|
|
27
|
-
raise ConnectionError(f"could not connect to PostgreSQL: {msg}") from None
|
|
28
|
-
|
|
29
|
-
try:
|
|
30
|
-
conn.execute("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE READ ONLY DEFERRABLE")
|
|
31
|
-
|
|
32
|
-
# 1. Query tables
|
|
33
|
-
with conn.cursor() as cur:
|
|
34
|
-
cur.execute("""
|
|
35
|
-
SELECT table_schema, table_name, table_type
|
|
36
|
-
FROM information_schema.tables
|
|
37
|
-
WHERE table_schema NOT IN ('pg_catalog', 'information_schema')
|
|
38
|
-
ORDER BY table_schema, table_name;
|
|
39
|
-
""")
|
|
40
|
-
tables = cur.fetchall()
|
|
41
|
-
|
|
42
|
-
# 2. Query views
|
|
43
|
-
cur.execute("""
|
|
44
|
-
SELECT table_schema, table_name, view_definition
|
|
45
|
-
FROM information_schema.views
|
|
46
|
-
WHERE table_schema NOT IN ('pg_catalog', 'information_schema')
|
|
47
|
-
ORDER BY table_schema, table_name;
|
|
48
|
-
""")
|
|
49
|
-
views = cur.fetchall()
|
|
50
|
-
|
|
51
|
-
# 3. Query routines (functions/procedures), including language
|
|
52
|
-
cur.execute("""
|
|
53
|
-
SELECT routine_schema, routine_name, routine_type,
|
|
54
|
-
routine_definition, external_language
|
|
55
|
-
FROM information_schema.routines
|
|
56
|
-
WHERE routine_schema NOT IN ('pg_catalog', 'information_schema')
|
|
57
|
-
ORDER BY routine_schema, routine_name;
|
|
58
|
-
""")
|
|
59
|
-
routines = cur.fetchall()
|
|
60
|
-
|
|
61
|
-
# 4. Query foreign keys — grouped by constraint to handle composites
|
|
62
|
-
cur.execute("""
|
|
63
|
-
SELECT
|
|
64
|
-
tc.constraint_name,
|
|
65
|
-
kcu1.table_schema,
|
|
66
|
-
kcu1.table_name,
|
|
67
|
-
ARRAY_AGG(kcu1.column_name ORDER BY kcu1.ordinal_position) AS columns,
|
|
68
|
-
kcu2.table_schema AS foreign_table_schema,
|
|
69
|
-
kcu2.table_name AS foreign_table_name,
|
|
70
|
-
ARRAY_AGG(kcu2.column_name ORDER BY kcu2.ordinal_position) AS foreign_columns
|
|
71
|
-
FROM
|
|
72
|
-
information_schema.table_constraints AS tc
|
|
73
|
-
JOIN information_schema.referential_constraints AS rc
|
|
74
|
-
ON tc.constraint_name = rc.constraint_name
|
|
75
|
-
AND tc.table_schema = rc.constraint_schema
|
|
76
|
-
JOIN information_schema.key_column_usage AS kcu1
|
|
77
|
-
ON tc.constraint_name = kcu1.constraint_name
|
|
78
|
-
AND tc.table_schema = kcu1.table_schema
|
|
79
|
-
JOIN information_schema.key_column_usage AS kcu2
|
|
80
|
-
ON rc.unique_constraint_name = kcu2.constraint_name
|
|
81
|
-
AND rc.unique_constraint_schema = kcu2.table_schema
|
|
82
|
-
AND kcu1.position_in_unique_constraint = kcu2.ordinal_position
|
|
83
|
-
WHERE tc.constraint_type = 'FOREIGN KEY'
|
|
84
|
-
AND tc.table_schema NOT IN ('pg_catalog', 'information_schema')
|
|
85
|
-
GROUP BY tc.constraint_name, kcu1.table_schema, kcu1.table_name,
|
|
86
|
-
kcu2.table_schema, kcu2.table_name
|
|
87
|
-
ORDER BY kcu1.table_schema, kcu1.table_name;
|
|
88
|
-
""")
|
|
89
|
-
fks = cur.fetchall()
|
|
90
|
-
finally:
|
|
91
|
-
conn.close()
|
|
92
|
-
|
|
93
|
-
ddl = []
|
|
94
|
-
|
|
95
|
-
# Tables — quote identifiers to handle reserved words, hyphens, mixed-case
|
|
96
|
-
for schema, name, ttype in tables:
|
|
97
|
-
if ttype == "BASE TABLE":
|
|
98
|
-
ddl.append(f"CREATE TABLE {_quote_ident(schema)}.{_quote_ident(name)} (id INT);")
|
|
99
|
-
|
|
100
|
-
# Views — real body if available, stub if NULL (permission denied)
|
|
101
|
-
for schema, name, body in views:
|
|
102
|
-
if body:
|
|
103
|
-
ddl.append(f"CREATE VIEW {_quote_ident(schema)}.{_quote_ident(name)} AS {body};")
|
|
104
|
-
else:
|
|
105
|
-
ddl.append(f"CREATE VIEW {_quote_ident(schema)}.{_quote_ident(name)} AS SELECT 1;")
|
|
106
|
-
|
|
107
|
-
# Functions & Procedures — real body if available, stub if NULL
|
|
108
|
-
# Use $gfx$ as the dollar-quote tag to avoid collision with $$ inside bodies.
|
|
109
|
-
# Use external_language from the catalog; fall back to plpgsql if NULL/blank.
|
|
110
|
-
for schema, name, rtype, body, ext_lang in routines:
|
|
111
|
-
lang = (ext_lang or "plpgsql").lower()
|
|
112
|
-
fn_sig = f"{_quote_ident(schema)}.{_quote_ident(name)}()"
|
|
113
|
-
stub_body = "BEGIN SELECT 1; END;"
|
|
114
|
-
if rtype in ("FUNCTION", "PROCEDURE"):
|
|
115
|
-
actual_body = body if body else stub_body
|
|
116
|
-
# Represent PROCEDUREs as FUNCTION so tree-sitter-sql can parse them
|
|
117
|
-
ddl.append(
|
|
118
|
-
f"CREATE FUNCTION {fn_sig} RETURNS void"
|
|
119
|
-
f" AS $gfx$ {actual_body} $gfx$ LANGUAGE {lang};"
|
|
120
|
-
)
|
|
121
|
-
|
|
122
|
-
# FK edges — one ALTER TABLE per constraint (handles composite FKs correctly)
|
|
123
|
-
for constraint_name, t_schema, t_name, cols, r_schema, r_name, r_cols in fks:
|
|
124
|
-
col_list = ", ".join(_quote_ident(c) for c in cols)
|
|
125
|
-
ref_col_list = ", ".join(_quote_ident(c) for c in r_cols)
|
|
126
|
-
ddl.append(
|
|
127
|
-
f"ALTER TABLE {_quote_ident(t_schema)}.{_quote_ident(t_name)} "
|
|
128
|
-
f"ADD CONSTRAINT {_quote_ident(constraint_name)} "
|
|
129
|
-
f"FOREIGN KEY ({col_list}) REFERENCES {_quote_ident(r_schema)}.{_quote_ident(r_name)}({ref_col_list});"
|
|
130
|
-
)
|
|
131
|
-
|
|
132
|
-
ddl_string = "\n".join(ddl)
|
|
133
|
-
|
|
134
|
-
# Determine host/dbname for virtual path DSN sanitization
|
|
135
|
-
info = psycopg.conninfo.conninfo_to_dict(dsn or "")
|
|
136
|
-
host = info.get("host", "localhost")
|
|
137
|
-
dbname = info.get("dbname", "db")
|
|
138
|
-
virtual_path = Path(f"postgresql://{host}/{dbname}")
|
|
139
|
-
|
|
140
|
-
# Pass virtual path and in-memory DDL content to extract_sql
|
|
141
|
-
result = extract_sql(virtual_path, content=ddl_string)
|
|
142
|
-
return result
|