morphy-cli 0.5.0__py3-none-any.whl

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.
@@ -0,0 +1,136 @@
1
+ Metadata-Version: 2.4
2
+ Name: morphy-cli
3
+ Version: 0.5.0
4
+ Summary: MORPHY — governed natural-language database terminal
5
+ Author-email: Ananya Kalia <ananyakalia2704@gmail.com>
6
+ Project-URL: Homepage, https://morphy-web.vercel.app
7
+ Project-URL: Repository, https://github.com/ananyakalia14/morphy
8
+ Project-URL: Issues, https://github.com/ananyakalia14/morphy/issues
9
+ Keywords: sql,cli,database,query,governed-sql,terminal,ai
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Database
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ Requires-Dist: httpx<1,>=0.27
21
+ Requires-Dist: prompt-toolkit<4,>=3.0
22
+ Requires-Dist: keyring>=24.0.0
23
+
24
+ # MORPHY CLI — Antigravity handoff
25
+
26
+ Antigravity owns the terminal interface, commands and client experience in this folder. The shared engine lives in backend/. Read ../docs/API.md and ../AGENTS.md first.
27
+
28
+ ## Existing implementation
29
+
30
+ The Python package exposes morphy and sq console commands. Install from the repository root with python -m pip install -e ./cli.
31
+
32
+ morphy starts the sample REPL. Existing commands are /help, /schema, /examples, /ask <question>, /sql <SELECT> and /exit or /quit. The sample /ask uses curated example titles.
33
+
34
+ morphy --database <UUID> selects a real organization database and reads MORPHY_ACCESS_TOKEN from the environment. --url selects the engine. --sql runs one query and exits. Live /ask previews SQL and requests confirmation before execution.
35
+
36
+ The current CLI uses httpx and a simple input loop. Access tokens remain in the process environment. It has no persisted login session, token refresh, organization chooser, connection wizard or command completion yet.
37
+
38
+ ## Build on this foundation
39
+
40
+ - [x] Add prompt-toolkit for slash completion, history, multiline SQL and interruption handling.
41
+ - [x] Add login/logout/status using the same Supabase Auth project as the website.
42
+ - [x] Store persisted refresh tokens in the OS credential store and support session expiry/refresh.
43
+ - [x] Add organization and database selection, keeping current context visible.
44
+ - [x] Add /connect and CSV import flows using the engine's authenticated endpoints.
45
+ - [x] Add profile, invitation and member-management commands through the shared Supabase RPCs.
46
+ - [x] Add readable tables, JSON output, CSV export, null handling and bounded output.
47
+ - [x] Show generation stages, correction attempts and cache status without invented percentages.
48
+ - [x] Add command cancellation, network-timeout messages and graceful Ctrl+C.
49
+ - [x] Add noninteractive flags and stable exit codes for scripts.
50
+ - [x] Add command tests and integration tests against a disposable development control plane.
51
+ - [x] Document Windows, macOS and Linux installation. Validate both console aliases.
52
+
53
+ ## Features and Commands
54
+
55
+ ### Session & Identity
56
+ - `/login <email>`: Authenticate via Supabase GoTrue with secure password prompt.
57
+ - `/logout`: Clear active session, OS keyring credentials, and stored query results.
58
+ - `/status`: Inspect active authentication, engine URL, active organization, and target database.
59
+ - `/profile`: View your profile; `/profile claim <handle> <name>` or `/profile edit <name>` to edit display name.
60
+ - `/dashboard`: Comprehensive terminal dashboard view; `/dashboard [render <id>]` to render a saved dashboard.
61
+ - `/dashboards`: List saved dashboards in the active database.
62
+ - `/dashboard-create <title> [shared]`: Create a saved dashboard definition.
63
+ - `/dashboard-add <dash_id> <query_id>`: Add a saved query panel to a dashboard.
64
+ - `/permissions`: Inspect effective permissions and row filtering rules on active database.
65
+ - `/perm-revoke <role|user>`: Revoke permissions on active database.
66
+
67
+ ### Organizations & Databases
68
+ - `/orgs`: List member organizations.
69
+ - `/use-org <id|name>`: Switch active organization context.
70
+ - `/dbs`: List databases registered in active organization.
71
+ - `/use-db <id|name|sample>`: Switch target database context (or return to sample workspace).
72
+ - `/connect <uri>`: Save and verify target PostgreSQL connection (admin).
73
+ - `/import <path>`: Ingest UTF-8 CSV data up to 1 MB into SQLite target database (admin).
74
+
75
+ ### Team & Collaboration
76
+ - `/members`: List members and assigned roles in the active organization.
77
+ - `/invites`: View pending invitations.
78
+ - `/invite <username>`: Search users and dispatch organization invitations.
79
+ - `/accept <id>`: Accept an invitation to join an organization.
80
+ - `/withdraw <id>`: Withdraw/cancel an existing invitation.
81
+
82
+ ### Queries & Saved Queries
83
+ - `/schema`: View allowed tables and column types.
84
+ - `/examples`: List curated natural-language query examples.
85
+ - `/ask <question>`: Natural language query generation with pre-execution review.
86
+ - `/sql <SELECT ...>`: Execute read-only SQL queries.
87
+ - `/save-query <name> [sql]`: Save current or specified query.
88
+ - `/queries`: List all saved queries.
89
+ - `/run-query <name>`: Execute a saved query.
90
+ - `/delete-query <name>`: Delete a saved query.
91
+ - `/export <path.csv>`: Export last query results as RFC-4180 CSV.
92
+ - `/json`: Print last query results as formatted JSON.
93
+
94
+ ### Scripting & Automation
95
+ Run one-shot queries without entering interactive mode:
96
+ ```bash
97
+ morphy --sql "SELECT * FROM orders LIMIT 5"
98
+ morphy --sql "SELECT * FROM orders LIMIT 5" --json
99
+ morphy --sql "SELECT * FROM orders LIMIT 5" --csv
100
+ ```
101
+ Stable exit codes:
102
+ - `0`: Success
103
+ - `1`: Query, validation, or policy error
104
+ - `2`: Network or engine connectivity error
105
+ - `130`: Interrupted / cancelled via SIGINT (Ctrl+C)
106
+
107
+ ## Installation & Setup
108
+
109
+ ### Requirements
110
+ - Python >= 3.11
111
+
112
+ ### Installation
113
+ From the repository root:
114
+ ```bash
115
+ python -m pip install -e ./cli
116
+ ```
117
+ Both `morphy` and `sq` console commands are installed.
118
+
119
+ On Windows, macOS and Linux:
120
+ ```bash
121
+ morphy --help
122
+ sq --help
123
+ ```
124
+
125
+ ## Required boundaries
126
+
127
+ Keep SQL generation, target connections, encryption keys, policy enforcement and execution in the backend. The CLI sends the current user's bearer token to the configured engine. Verify HTTPS for remote authenticated endpoints.
128
+
129
+ Use the same API request/response shapes as the web app. Never ask an LLM to decide whether a query is authorized. Never execute model output directly against a target database.
130
+
131
+ Do not commit tokens, passwords or shell history. Source authentication settings from documented configuration. Support existing --url, --database and --sql callers as the interface evolves.
132
+
133
+ ## First PR
134
+
135
+ Create cli/interactive-shell from main. Add the terminal framework, /help and completion around the existing HTTP client first. Include --help and interruption checks. Submit a PR with usage examples and testing evidence.
136
+
@@ -0,0 +1,15 @@
1
+ morphy_cli/__init__.py,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
2
+ morphy_cli/__main__.py,sha256=jqsMIo3TrEswz9SOe77_J2pJciEzzbwhMh13CXfjmks,34
3
+ morphy_cli/auth.py,sha256=zTkx_ht78w0-YYIl2rSUJb2vd4BkZWhLKUq7iUEYHv4,11687
4
+ morphy_cli/client.py,sha256=RmySFjovErm8wVaiJG_yTesvcTRDEMJlwV-5FJtMlOI,7355
5
+ morphy_cli/completer.py,sha256=8VkY1d3BVcSH0QmreJmACRIzNSk3EMRLhJw_JH1BzXg,3288
6
+ morphy_cli/control.py,sha256=lhQMRcDNMB8FwfySQPDbMYbfK1g0xhFtoBDdObE8bSk,10789
7
+ morphy_cli/formatting.py,sha256=N7S0XpVXEreroKIzmqGSVK_Znw-ch4M3HRrLMIzmD5U,5811
8
+ morphy_cli/main.py,sha256=VsS-yhheWHgUSFw1dZioO7xJ-YLfzrk-cEJyUQPrVaA,3509
9
+ morphy_cli/queries.py,sha256=qLVQ_RKX4ft7cVlELix572nRQHXAT4HUPZY3QWmcc3k,2530
10
+ morphy_cli/shell.py,sha256=7maSs9HrM_sVa4IUf6P2vUtW5AG4vfEZWwioL6E2XEU,35113
11
+ morphy_cli-0.5.0.dist-info/METADATA,sha256=50SXFwQv6iJsbhPbPlFmHvajtG1rBRtbj66kWatX020,6988
12
+ morphy_cli-0.5.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
13
+ morphy_cli-0.5.0.dist-info/entry_points.txt,sha256=ec0605jB9g11fvy-hJS4YLCS6XdPkr5NNENxawrc4dE,74
14
+ morphy_cli-0.5.0.dist-info/top_level.txt,sha256=uV2uYl6cbhB-b4zr0Mn3-G_7ibP0_qaGTYFadgVtu3o,11
15
+ morphy_cli-0.5.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ morphy = morphy_cli.main:main
3
+ sq = morphy_cli.main:main
@@ -0,0 +1 @@
1
+ morphy_cli