gibson-cli 0.8.0__py3-none-any.whl → 0.8.2__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.
bin/build.sh CHANGED
@@ -1,2 +1 @@
1
- rm -rf dist gibson_cli.egg-info
2
- PYTHONMEM=1G python3 -m build
1
+ uv build
bin/release.sh CHANGED
@@ -1 +1,5 @@
1
- python3 -m twine upload --repository pypi dist/*
1
+ sh bin/clean.sh
2
+ sh bin/build.sh
3
+ uv publish
4
+ # python3 -m twine upload --repository pypi dist/*
5
+ sh bin/clean.sh
gibson/api/BaseApi.py CHANGED
@@ -25,7 +25,7 @@ class BaseApi:
25
25
 
26
26
  return r
27
27
 
28
- def get(self, endpoint):
28
+ def get(self, endpoint: str = ""):
29
29
  r = requests.get(self.url(endpoint), headers=self.headers())
30
30
 
31
31
  if r.status_code == 401 and self.refresh_auth_tokens():
@@ -46,7 +46,7 @@ class BaseApi:
46
46
 
47
47
  return headers
48
48
 
49
- def patch(self, endpoint, json: dict):
49
+ def patch(self, endpoint: str = "", json: dict = None):
50
50
  r = requests.patch(self.url(endpoint), headers=self.headers(), json=json)
51
51
 
52
52
  if r.status_code == 401 and self.refresh_auth_tokens():
@@ -66,7 +66,7 @@ class BaseApi:
66
66
 
67
67
  return r
68
68
 
69
- def put(self, endpoint, json: dict):
69
+ def put(self, endpoint: str = "", json: dict = None):
70
70
  r = requests.put(self.url(endpoint), headers=self.headers(), json=json)
71
71
 
72
72
  if r.status_code == 401 and self.refresh_auth_tokens():
gibson/api/DataApi.py ADDED
@@ -0,0 +1,18 @@
1
+ from gibson.api.BaseApi import BaseApi
2
+ from gibson.core.Configuration import Configuration
3
+
4
+
5
+ class DataApi(BaseApi):
6
+ PREFIX = "-"
7
+
8
+ def __init__(self, configuration: Configuration, api_key: str):
9
+ self.configuration = configuration
10
+ self.api_key = api_key or self.configuration.project.api.key
11
+
12
+ def headers(self):
13
+ headers = super().headers()
14
+ headers["X-Gibson-API-Key"] = self.api_key
15
+ return headers
16
+
17
+ def query(self, query: str):
18
+ return self.post("query", {"query": query}).json()
gibson/api/ProjectApi.py CHANGED
@@ -10,7 +10,7 @@ class ProjectApi(BaseApi):
10
10
  self.configuration.require_login()
11
11
 
12
12
  def list(self):
13
- return self.get("all")["projects"]
13
+ return self.get()["projects"]
14
14
 
15
15
  def create(self):
16
16
  return self.post().json()
@@ -43,4 +43,4 @@ class ProjectApi(BaseApi):
43
43
  if not name:
44
44
  raise ValueError("Name is required")
45
45
 
46
- return self.put(f"{uuid}", {"name": name}).json()
46
+ return self.patch(f"{uuid}", {"name": name}).json()
gibson/bin/gibson.py CHANGED
@@ -1,10 +1,15 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
+ import os
4
+
3
5
  from gibson.core.CommandRouter import CommandRouter
4
6
  from gibson.core.Configuration import Configuration
7
+ from gibson.display.Header import Header
5
8
 
6
9
 
7
10
  def main():
11
+ if os.getenv("GIBSON_CLI_DEV"):
12
+ print(f"{Header().render('dev mode')}\n")
8
13
  try:
9
14
  configuration = Configuration()
10
15
  if configuration.settings is None:
gibson/command/Version.py CHANGED
@@ -10,7 +10,7 @@ class Version(BaseCommand):
10
10
  try:
11
11
  r = requests.get("https://pypi.org/pypi/gibson-cli/json")
12
12
  latest_version = r.json()["info"]["version"]
13
- except:
13
+ except Exception:
14
14
  latest_version = VersionConf.num
15
15
 
16
16
  if latest_version != VersionConf.num:
@@ -1,14 +1,14 @@
1
1
  from typing import Dict, List
2
2
 
3
3
  from mcp.server.fastmcp import FastMCP
4
+ from requests.exceptions import HTTPError
4
5
 
6
+ from gibson.api.DataApi import DataApi
5
7
  from gibson.api.ProjectApi import ProjectApi
6
8
  from gibson.core.Configuration import Configuration
7
9
 
8
10
  mcp = FastMCP("GibsonAI")
9
11
 
10
- project_api = ProjectApi(Configuration())
11
-
12
12
  # Note: Resources are not yet supported by Cursor, everything must be implemented as a tool
13
13
  # See https://docs.cursor.com/context/model-context-protocol#limitations
14
14
 
@@ -16,19 +16,31 @@ project_api = ProjectApi(Configuration())
16
16
  @mcp.tool()
17
17
  def get_projects() -> List[Dict]:
18
18
  """Get all GibsonAI projects"""
19
- return project_api.list()
19
+ project_api = ProjectApi(Configuration())
20
+ try:
21
+ return project_api.list()
22
+ except HTTPError as e:
23
+ return {"status_code": e.response.status_code, "error": e.response.json()}
20
24
 
21
25
 
22
26
  @mcp.tool()
23
27
  def create_project() -> Dict:
24
28
  """Create a new GibsonAI project"""
25
- return project_api.create()
29
+ project_api = ProjectApi(Configuration())
30
+ try:
31
+ return project_api.create()
32
+ except HTTPError as e:
33
+ return {"status_code": e.response.status_code, "error": e.response.json()}
26
34
 
27
35
 
28
36
  @mcp.tool()
29
37
  def get_project_details(uuid: str) -> Dict:
30
38
  """Get a GibsonAI project's details"""
31
- return project_api.lookup(uuid=uuid)
39
+ project_api = ProjectApi(Configuration())
40
+ try:
41
+ return project_api.lookup(uuid=uuid)
42
+ except HTTPError as e:
43
+ return {"status_code": e.response.status_code, "error": e.response.json()}
32
44
 
33
45
 
34
46
  @mcp.tool()
@@ -37,7 +49,11 @@ def get_project_hosted_api_details(uuid: str) -> str:
37
49
  Get a GibsonAI project's hosted API details
38
50
  This includes necessary context for an LLM to understand and generate API calls related to fetching or modifying the project's data
39
51
  """
40
- return project_api.mcp(uuid=uuid)
52
+ project_api = ProjectApi(Configuration())
53
+ try:
54
+ return project_api.mcp(uuid=uuid)
55
+ except HTTPError as e:
56
+ return {"status_code": e.response.status_code, "error": e.response.json()}
41
57
 
42
58
 
43
59
  @mcp.tool()
@@ -47,7 +63,11 @@ def update_project(uuid: str, project_name: str) -> Dict:
47
63
  This currently only updates the project's name
48
64
  Returns the updated project details
49
65
  """
50
- return project_api.update(uuid=uuid, name=project_name)
66
+ project_api = ProjectApi(Configuration())
67
+ try:
68
+ return project_api.update(uuid=uuid, name=project_name)
69
+ except HTTPError as e:
70
+ return {"status_code": e.response.status_code, "error": e.response.json()}
51
71
 
52
72
 
53
73
  @mcp.tool()
@@ -57,7 +77,11 @@ def submit_data_modeling_request(uuid: str, data_modeling_request: str) -> Dict:
57
77
  This tool fully handles all data modeling, you should provide the user's request as-is
58
78
  Returns the response from the LLM
59
79
  """
60
- return project_api.submit_message(uuid=uuid, message=data_modeling_request)
80
+ project_api = ProjectApi(Configuration())
81
+ try:
82
+ return project_api.submit_message(uuid=uuid, message=data_modeling_request)
83
+ except HTTPError as e:
84
+ return {"status_code": e.response.status_code, "error": e.response.json()}
61
85
 
62
86
 
63
87
  @mcp.tool()
@@ -66,7 +90,11 @@ def deploy_project(uuid: str) -> None:
66
90
  Deploy a GibsonAI project's hosted databases
67
91
  This deploys both the development and production databases simultaneously and automatically handles the migrations
68
92
  """
69
- project_api.deploy(uuid=uuid)
93
+ project_api = ProjectApi(Configuration())
94
+ try:
95
+ return project_api.deploy(uuid=uuid)
96
+ except HTTPError as e:
97
+ return {"status_code": e.response.status_code, "error": e.response.json()}
70
98
 
71
99
 
72
100
  @mcp.tool()
@@ -75,7 +103,11 @@ def get_project_schema(uuid: str) -> str:
75
103
  Get the schema for a GibsonAI project
76
104
  This includes any changes made to the schema since the last deployment
77
105
  """
78
- return project_api.schema(uuid=uuid)
106
+ project_api = ProjectApi(Configuration())
107
+ try:
108
+ return project_api.schema(uuid=uuid)
109
+ except HTTPError as e:
110
+ return {"status_code": e.response.status_code, "error": e.response.json()}
79
111
 
80
112
 
81
113
  @mcp.tool()
@@ -84,4 +116,21 @@ def get_deployed_schema(uuid: str) -> str:
84
116
  Get the deployed schema for a GibsonAI project
85
117
  This is the schema that is currently live on the project's hosted databases
86
118
  """
87
- return project_api.database_schema(uuid=uuid)
119
+ project_api = ProjectApi(Configuration())
120
+ try:
121
+ return project_api.database_schema(uuid=uuid)
122
+ except HTTPError as e:
123
+ return {"status_code": e.response.status_code, "error": e.response.json()}
124
+
125
+
126
+ @mcp.tool()
127
+ def query_database(api_key: str, query: str) -> List[Dict] | None | Dict:
128
+ """
129
+ Query a GibsonAI project's hosted database using SQL
130
+ Note: the environment-specific API key must be provided
131
+ """
132
+ data_api = DataApi(Configuration(), api_key=api_key)
133
+ try:
134
+ return data_api.query(query=query)
135
+ except HTTPError as e:
136
+ return {"status_code": e.response.status_code, "error": e.response.json()}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gibson-cli
3
- Version: 0.8.0
3
+ Version: 0.8.2
4
4
  Summary: Gibson Command Line Interface
5
5
  Author-email: GibsonAI <noc@gibsonai.com>
6
6
  Project-URL: Homepage, https://gibsonai.com/
@@ -73,7 +73,6 @@ Requires-Dist: watchfiles==0.21.0
73
73
  Requires-Dist: websockets==12.0
74
74
  Requires-Dist: yaspin==3.1.0
75
75
 
76
-
77
76
  [![GibsonAI](https://github.com/user-attachments/assets/26bc1002-f878-4995-a6c5-eb8d5eb69c28)](https://gibsonai.com/)
78
77
 
79
78
  # Gibson CLI
@@ -90,19 +89,23 @@ Portions of the Gibson backend code are written by Gibson. So far, versus a hum
90
89
 
91
90
  ## Installation / Upgrading
92
91
 
93
- Install the latest version of the CLI using `pip`
92
+ ### With [uv](https://docs.astral.sh/uv/) (recommended)
94
93
 
95
94
  ```sh
96
- pip3 install gibson-cli --upgrade
95
+ uv tool install gibson-cli@latest
97
96
  ```
98
97
 
99
- Note: the first time you install any package from PyPI via `pip` that includes an executable, it is placed in a directory that is likely not in your `PATH`. There are a number of ways to do this, but one method is to run the following command:
98
+ If you're unable to run `gibson` after installing with uv, try running `uv tool update-shell` to ensure your `PATH` includes the uv tool executables directory.
99
+
100
+ ### With pip
100
101
 
101
102
  ```sh
102
- echo 'export PATH="$PATH:${$(which python3)%python3}"' >> ~/.zshrc # or ~/.bashrc
103
+ pip3 install gibson-cli --upgrade
103
104
  ```
104
105
 
105
- You will only need to do this once.
106
+ Note: you'll want to run this **outside** of a virtual environment (globally on your machine)
107
+
108
+ If you're unable to run `gibson` after installing with pip, ensure your `PATH` contains the directory where pip installs executables. This can differ based on your operating system, python installation location, and pip version.
106
109
 
107
110
  ## Key Terms
108
111
 
@@ -390,8 +393,8 @@ Update the configuration to look like the following:
390
393
  {
391
394
  "mcpServers": {
392
395
  "gibson": {
393
- "command": "gibson",
394
- "args": ["mcp", "run"]
396
+ "command": "uvx",
397
+ "args": ["--from", "gibson-cli@latest", "gibson", "mcp", "run"]
395
398
  }
396
399
  }
397
400
  }
@@ -402,4 +405,4 @@ That's it! Just make sure you're logged in to the CLI (if you're reading this, y
402
405
  ## Contributing
403
406
 
404
407
  - Clone this repository somewhere in your file system
405
- - `pip3 install [path to this repository]`
408
+ - `uv tool install [path to repository] -e`
@@ -1,11 +1,11 @@
1
- bin/build.sh,sha256=NfwMI06hR9w4VTmttDn5Zlbea7iur8BtfC60JTpMH0g,62
1
+ bin/build.sh,sha256=aAcWaPJeeFTojf2AYoD--_zS6TRqZcSogvqEezD5Wak,9
2
2
  bin/clean.sh,sha256=bVJ1aL-IWconmyZ70OAcF0MHiPzpWCejPiIFJ72yFkM,55
3
- bin/gibson,sha256=9OiLT8M9kJHA-gTp0pFc8NYbOe6LrQCs_HXgnD-5D3U,843
4
- bin/release.sh,sha256=LxPqH5kxhLKvzHaPRLBlq_ApaK7FHEteH4SzeRenidk,49
5
- gibson/api/BaseApi.py,sha256=ngr0XA5J-HEvtDo2z-T-G07GJ-o0i-LBZBpfqwQp834,3691
3
+ bin/release.sh,sha256=ghS71QUBWwCqBNKAtpspYvqX46M1cZyUgtOEI4xDLUo,110
4
+ gibson/api/BaseApi.py,sha256=4BZYKcLnIUtxinQuL--qpTRlsorMmpirdf3pW1DzPaI,3735
6
5
  gibson/api/Cli.py,sha256=Qcm5NIQ4x1Wn6KfkrAzwvZeWyt-cKF_xD7_lTWL4Lbw,8071
7
- gibson/api/ProjectApi.py,sha256=cyLfHGqTC5Lqyobmq0afe9ntVSZ_QbLBBd6oDDaqWoY,1258
8
- gibson/bin/gibson.py,sha256=56fqPBiF47uJvafHyNbWZ4GorcI0Ut98DCXeS7dt2io,420
6
+ gibson/api/DataApi.py,sha256=JZN6q7bO2O87xBCsU9w96NgINOJJZx3d7jOiHoVH1Wo,542
7
+ gibson/api/ProjectApi.py,sha256=OzOPumgcd9IHqiaa_v52vBfh1RTwJyYuQWcilj52GTI,1255
8
+ gibson/bin/gibson.py,sha256=bZTmpe5e3dqjA7kxLU9gycdURlXMAwApWvlYU-KBgFs,558
9
9
  gibson/command/BaseCommand.py,sha256=mmWUO0FxjMCbv3cHWnnasfAWnU_hTuGHUsRVJ4hUcqM,777
10
10
  gibson/command/Build.py,sha256=6lMdTa3HZvcbskoX8iJZJnekiJmyNVSbgGmgvh1v-BM,4421
11
11
  gibson/command/Conf.py,sha256=yuAGL6M8MUURG4hW3MAW043c-h_ALw3FHWbyCOR8YTQ,2375
@@ -19,7 +19,7 @@ gibson/command/Question.py,sha256=g8SwopbzeG14WWP0bc-fXIDVqOOicMzjC9YXoGd-NxY,38
19
19
  gibson/command/Remove.py,sha256=Ar8-vSNwmCaBupCLY_rcvyU_kWIILU_qVX5njV-tZVw,2478
20
20
  gibson/command/Show.py,sha256=qkkprY2JhA4qOOhYOwAECDnFZwTdqcsKsG4cwB_b-84,1409
21
21
  gibson/command/Tree.py,sha256=BeJ_13xrrRCK5FP2rQHWpDKrshVzte-_D1pNG1GXPIw,3056
22
- gibson/command/Version.py,sha256=1YjQlQJg9T97XGjzOg61Ybs4ywETZGVJoAp8zeDXbaU,1177
22
+ gibson/command/Version.py,sha256=jxkRdbQiyTdto18RpbL-5vudcbvLLX9kcl8vmkt7USw,1187
23
23
  gibson/command/auth/Auth.py,sha256=DAvnKq3Ks77QJwuGJCWA9Iv3c0Qq5pHFIpEA-gy6CxM,1086
24
24
  gibson/command/auth/Login.py,sha256=b43OfV76i6aGdOwj1NK64ZOdYlNyc08g3lZGQ_37KDw,437
25
25
  gibson/command/auth/Logout.py,sha256=V01q4TdbiBqCnIrM6IA4T25fO6ws0UpXp42I3pwHZVM,248
@@ -106,7 +106,7 @@ gibson/services/code/customization/CustomizationManager.py,sha256=M2gz98Yo2WTnnh
106
106
  gibson/services/code/customization/Index.py,sha256=4Thf0gZM6VErZJS97w748PRNmHi8QvsyblOLCw1Y_XE,364
107
107
  gibson/services/code/customization/tests/test_code_customization_Authenticator.py,sha256=kKExkLfKPpRA2NQH3fvRCuBEMhCGhR-IvNJqXuyBz3c,1949
108
108
  gibson/services/code/customization/tests/test_code_customization_BaseCustomization.py,sha256=jaEwxxoU7d9ziOtfF21NPmZX2qSRpa-kz_8Ju9BKGts,412
109
- gibson/services/mcp/server.py,sha256=rIgT9W05wB2hen6v0QQ2J_B9VyJb8htE3tPLTR5Q5FI,2494
109
+ gibson/services/mcp/server.py,sha256=Ur8PbXz_mTt1gLuOVTAixGFiac_0SkNXZN5n9Z5gETw,4500
110
110
  gibson/structure/Entity.py,sha256=N_Tx8RTs9ySMMgAoR9rVuMcsRgNA7zvNvJBScJLfYE4,675
111
111
  gibson/structure/mysql/Entity.py,sha256=zolt3N_F3WlQtlOqrHflwsJeJ6r6A3MN4LxCzeAbU_k,3693
112
112
  gibson/structure/mysql/testing.py,sha256=al4LI6e3bhjopsR0qTAmaOJyCQXF0_inVQ4xv7VQ6qo,9149
@@ -129,8 +129,8 @@ gibson/tests/test_Env.py,sha256=DPWmP0-aEelducq9bAwv7rKoY2NjWXUeCrzfJDQkn2M,369
129
129
  gibson/tests/test_Memory.py,sha256=YP7owToABAk_-s7fD5UG0HTc4lamDjdA39JUlLnk3Fg,2574
130
130
  gibson/tests/test_utils.py,sha256=r_y-EG05YTCNtL8MWiAK1KmPsmeoMgypKsQC_lVgOtM,559
131
131
  venv/bin/activate_this.py,sha256=E1T7r3559tBsyqFpdcQW0HbY7gDvNiIv5Pc6HQ4bpoA,2383
132
- gibson_cli-0.8.0.dist-info/METADATA,sha256=mMAK0s-OPAW6w9kGeC1AfFImfshzMzx16wV_W59wETE,14378
133
- gibson_cli-0.8.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
134
- gibson_cli-0.8.0.dist-info/entry_points.txt,sha256=j5VUvq3AzL21xPvVC24zMoXFt-I5lUWulr66nL3OAPM,50
135
- gibson_cli-0.8.0.dist-info/top_level.txt,sha256=fSV3vegbdbSDwiB6n5z3FCeYwkIonzFrx4ek3F_OSdI,16
136
- gibson_cli-0.8.0.dist-info/RECORD,,
132
+ gibson_cli-0.8.2.dist-info/METADATA,sha256=0sVISGJ8ho4WCJPSWDXXLolzgTB1Jq0-N5RCNkDcSVI,14592
133
+ gibson_cli-0.8.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
134
+ gibson_cli-0.8.2.dist-info/entry_points.txt,sha256=j5VUvq3AzL21xPvVC24zMoXFt-I5lUWulr66nL3OAPM,50
135
+ gibson_cli-0.8.2.dist-info/top_level.txt,sha256=fSV3vegbdbSDwiB6n5z3FCeYwkIonzFrx4ek3F_OSdI,16
136
+ gibson_cli-0.8.2.dist-info/RECORD,,
bin/gibson DELETED
@@ -1,26 +0,0 @@
1
- #!/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9
2
- # -*- coding: utf-8 -*-
3
-
4
- # This file is identical to what pip creates when you install an executable package, but it adds a dev mode banner.
5
- # To easily switch between dev mode and installed mode, add the following functions to your .zshrc or .bashrc:
6
- #
7
- # cli_dev_on() {
8
- # export PATH="$HOME/src/gibson/cli/bin:$PATH"
9
- # export PYTHONPATH="$HOME/src/gibson/cli:$PYTHONPATH"
10
- # }
11
- #
12
- # cli_dev_off() {
13
- # export PATH=${PATH#$HOME/src/gibson/cli/bin:}
14
- # export PYTHONPATH=${PYTHONPATH#:$HOME/src/gibson/cli:}
15
- # }
16
-
17
- import re
18
- import sys
19
-
20
- from gibson.bin.gibson import main
21
- from gibson.display.Header import Header
22
-
23
- if __name__ == "__main__":
24
- print(f"{Header().render('dev mode')}\n")
25
- sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
26
- sys.exit(main())