gibson-cli 0.8.2__py3-none-any.whl → 0.8.3__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/release.sh CHANGED
@@ -1,5 +1,5 @@
1
1
  sh bin/clean.sh
2
2
  sh bin/build.sh
3
- uv publish
4
- # python3 -m twine upload --repository pypi dist/*
3
+ read -p "Enter the PyPI token: " token
4
+ uv publish --username __token__ --password $token
5
5
  sh bin/clean.sh
gibson/api/BaseApi.py CHANGED
@@ -2,7 +2,6 @@ import pprint
2
2
 
3
3
  import requests
4
4
 
5
- import gibson.core.Colors as Colors
6
5
  from gibson.core.Configuration import Configuration
7
6
 
8
7
 
@@ -103,10 +102,7 @@ class BaseApi:
103
102
 
104
103
  def __raise_for_status(self, r):
105
104
  if r.status_code == 401:
106
- self.configuration.conversation.type(
107
- f"\nYou need to log in to continue. Please run {Colors.command(self.configuration.command, 'auth', args='login')} and then try again.\n"
108
- )
109
- exit(1)
105
+ self.configuration.login_required()
110
106
 
111
107
  try:
112
108
  r.raise_for_status()
gibson/api/ProjectApi.py CHANGED
@@ -7,7 +7,6 @@ class ProjectApi(BaseApi):
7
7
 
8
8
  def __init__(self, configuration: Configuration):
9
9
  self.configuration = configuration
10
- self.configuration.require_login()
11
10
 
12
11
  def list(self):
13
12
  return self.get()["projects"]
gibson/bin/gibson.py CHANGED
@@ -12,10 +12,7 @@ def main():
12
12
  print(f"{Header().render('dev mode')}\n")
13
13
  try:
14
14
  configuration = Configuration()
15
- if configuration.settings is None:
16
- configuration.initialize()
17
- else:
18
- CommandRouter(configuration).run()
15
+ CommandRouter(configuration).run()
19
16
  except KeyboardInterrupt:
20
17
  exit(1)
21
18
 
@@ -3,6 +3,6 @@ from gibson.command.BaseCommand import BaseCommand
3
3
 
4
4
  class Logout(BaseCommand):
5
5
  def execute(self):
6
- self.configuration.set_access_token(None)
7
- self.conversation.type(f"You are now logged out.")
6
+ self.configuration.set_auth_tokens(None, None)
7
+ self.conversation.type("You are now logged out.")
8
8
  self.conversation.newline()
@@ -12,6 +12,7 @@ class McpServer(BaseCommand):
12
12
  # Setup signal handlers to exit the server
13
13
  signal.signal(signal.SIGTERM, lambda signo, frame: sys.exit(0))
14
14
  signal.signal(signal.SIGINT, lambda signo, frame: sys.exit(0))
15
+ self.conversation.type("GibsonAI MCP server running...\n")
15
16
  mcp.run()
16
17
  else:
17
18
  self.usage()
@@ -33,7 +33,10 @@ class CommandRouter:
33
33
 
34
34
  def run(self):
35
35
  if len(sys.argv) == 1:
36
- Help(self.configuration).execute()
36
+ if self.configuration.settings is None:
37
+ self.configuration.initialize()
38
+ else:
39
+ Help(self.configuration).execute()
37
40
  return self
38
41
 
39
42
  Env().verify(self.configuration)
@@ -17,11 +17,12 @@ class Configuration:
17
17
  VERSION = 2
18
18
  API_ENV = os.environ.get("GIBSONAI_API_ENV", "production")
19
19
 
20
- def __init__(self):
20
+ def __init__(self, interactive=True):
21
21
  self.command = None
22
22
  if len(sys.argv) >= 1:
23
23
  self.command = sys.argv[0].split("/")[-1]
24
24
 
25
+ self.interactive = interactive
25
26
  self.conversation = Conversation()
26
27
  self.platform = Platform()
27
28
  self.project = None
@@ -132,7 +133,7 @@ class Configuration:
132
133
  os.remove(test_file)
133
134
 
134
135
  return path
135
- except:
136
+ except Exception:
136
137
  self.conversation.newline()
137
138
  self.conversation.type(
138
139
  " Well this is embarrassing. I cannot write to that path.\n"
@@ -304,6 +305,13 @@ class Configuration:
304
305
  self.set_auth_tokens(access_token, refresh_token)
305
306
  return True
306
307
 
308
+ def login_required(self):
309
+ if self.interactive:
310
+ self.conversation.message_login_required(self)
311
+ exit(1)
312
+
313
+ return self
314
+
307
315
  def read_config(self):
308
316
  try:
309
317
  with open(self.paths.config, "r") as f:
@@ -317,8 +325,7 @@ class Configuration:
317
325
 
318
326
  def require_login(self):
319
327
  if self.get_access_token() is None:
320
- self.conversation.message_login_required(self)
321
- exit(1)
328
+ self.login_required()
322
329
 
323
330
  return self
324
331
 
@@ -13,34 +13,43 @@ mcp = FastMCP("GibsonAI")
13
13
  # See https://docs.cursor.com/context/model-context-protocol#limitations
14
14
 
15
15
 
16
+ def error_handler(e: HTTPError) -> Dict:
17
+ """Handle HTTP errors from the API"""
18
+ status_code = e.response.status_code
19
+ message = e.response.json()
20
+ if status_code == 401:
21
+ message = "Authentication required. Run `uvx --from gibson-cli@latest gibson auth login` to authenticate then try again."
22
+ return {"status_code": status_code, "error": message}
23
+
24
+
16
25
  @mcp.tool()
17
26
  def get_projects() -> List[Dict]:
18
27
  """Get all GibsonAI projects"""
19
- project_api = ProjectApi(Configuration())
28
+ project_api = ProjectApi(Configuration(interactive=False))
20
29
  try:
21
30
  return project_api.list()
22
31
  except HTTPError as e:
23
- return {"status_code": e.response.status_code, "error": e.response.json()}
32
+ return error_handler(e)
24
33
 
25
34
 
26
35
  @mcp.tool()
27
36
  def create_project() -> Dict:
28
37
  """Create a new GibsonAI project"""
29
- project_api = ProjectApi(Configuration())
38
+ project_api = ProjectApi(Configuration(interactive=False))
30
39
  try:
31
40
  return project_api.create()
32
41
  except HTTPError as e:
33
- return {"status_code": e.response.status_code, "error": e.response.json()}
42
+ return error_handler(e)
34
43
 
35
44
 
36
45
  @mcp.tool()
37
46
  def get_project_details(uuid: str) -> Dict:
38
47
  """Get a GibsonAI project's details"""
39
- project_api = ProjectApi(Configuration())
48
+ project_api = ProjectApi(Configuration(interactive=False))
40
49
  try:
41
50
  return project_api.lookup(uuid=uuid)
42
51
  except HTTPError as e:
43
- return {"status_code": e.response.status_code, "error": e.response.json()}
52
+ return error_handler(e)
44
53
 
45
54
 
46
55
  @mcp.tool()
@@ -49,11 +58,11 @@ def get_project_hosted_api_details(uuid: str) -> str:
49
58
  Get a GibsonAI project's hosted API details
50
59
  This includes necessary context for an LLM to understand and generate API calls related to fetching or modifying the project's data
51
60
  """
52
- project_api = ProjectApi(Configuration())
61
+ project_api = ProjectApi(Configuration(interactive=False))
53
62
  try:
54
63
  return project_api.mcp(uuid=uuid)
55
64
  except HTTPError as e:
56
- return {"status_code": e.response.status_code, "error": e.response.json()}
65
+ return error_handler(e)
57
66
 
58
67
 
59
68
  @mcp.tool()
@@ -63,11 +72,11 @@ def update_project(uuid: str, project_name: str) -> Dict:
63
72
  This currently only updates the project's name
64
73
  Returns the updated project details
65
74
  """
66
- project_api = ProjectApi(Configuration())
75
+ project_api = ProjectApi(Configuration(interactive=False))
67
76
  try:
68
77
  return project_api.update(uuid=uuid, name=project_name)
69
78
  except HTTPError as e:
70
- return {"status_code": e.response.status_code, "error": e.response.json()}
79
+ return error_handler(e)
71
80
 
72
81
 
73
82
  @mcp.tool()
@@ -77,11 +86,11 @@ def submit_data_modeling_request(uuid: str, data_modeling_request: str) -> Dict:
77
86
  This tool fully handles all data modeling, you should provide the user's request as-is
78
87
  Returns the response from the LLM
79
88
  """
80
- project_api = ProjectApi(Configuration())
89
+ project_api = ProjectApi(Configuration(interactive=False))
81
90
  try:
82
91
  return project_api.submit_message(uuid=uuid, message=data_modeling_request)
83
92
  except HTTPError as e:
84
- return {"status_code": e.response.status_code, "error": e.response.json()}
93
+ return error_handler(e)
85
94
 
86
95
 
87
96
  @mcp.tool()
@@ -90,11 +99,11 @@ def deploy_project(uuid: str) -> None:
90
99
  Deploy a GibsonAI project's hosted databases
91
100
  This deploys both the development and production databases simultaneously and automatically handles the migrations
92
101
  """
93
- project_api = ProjectApi(Configuration())
102
+ project_api = ProjectApi(Configuration(interactive=False))
94
103
  try:
95
104
  return project_api.deploy(uuid=uuid)
96
105
  except HTTPError as e:
97
- return {"status_code": e.response.status_code, "error": e.response.json()}
106
+ return error_handler(e)
98
107
 
99
108
 
100
109
  @mcp.tool()
@@ -103,11 +112,11 @@ def get_project_schema(uuid: str) -> str:
103
112
  Get the schema for a GibsonAI project
104
113
  This includes any changes made to the schema since the last deployment
105
114
  """
106
- project_api = ProjectApi(Configuration())
115
+ project_api = ProjectApi(Configuration(interactive=False))
107
116
  try:
108
117
  return project_api.schema(uuid=uuid)
109
118
  except HTTPError as e:
110
- return {"status_code": e.response.status_code, "error": e.response.json()}
119
+ return error_handler(e)
111
120
 
112
121
 
113
122
  @mcp.tool()
@@ -116,11 +125,11 @@ def get_deployed_schema(uuid: str) -> str:
116
125
  Get the deployed schema for a GibsonAI project
117
126
  This is the schema that is currently live on the project's hosted databases
118
127
  """
119
- project_api = ProjectApi(Configuration())
128
+ project_api = ProjectApi(Configuration(interactive=False))
120
129
  try:
121
130
  return project_api.database_schema(uuid=uuid)
122
131
  except HTTPError as e:
123
- return {"status_code": e.response.status_code, "error": e.response.json()}
132
+ return error_handler(e)
124
133
 
125
134
 
126
135
  @mcp.tool()
@@ -129,8 +138,8 @@ def query_database(api_key: str, query: str) -> List[Dict] | None | Dict:
129
138
  Query a GibsonAI project's hosted database using SQL
130
139
  Note: the environment-specific API key must be provided
131
140
  """
132
- data_api = DataApi(Configuration(), api_key=api_key)
141
+ data_api = DataApi(Configuration(interactive=False), api_key=api_key)
133
142
  try:
134
143
  return data_api.query(query=query)
135
144
  except HTTPError as e:
136
- return {"status_code": e.response.status_code, "error": e.response.json()}
145
+ return error_handler(e)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gibson-cli
3
- Version: 0.8.2
3
+ Version: 0.8.3
4
4
  Summary: Gibson Command Line Interface
5
5
  Author-email: GibsonAI <noc@gibsonai.com>
6
6
  Project-URL: Homepage, https://gibsonai.com/
@@ -1,11 +1,11 @@
1
1
  bin/build.sh,sha256=aAcWaPJeeFTojf2AYoD--_zS6TRqZcSogvqEezD5Wak,9
2
2
  bin/clean.sh,sha256=bVJ1aL-IWconmyZ70OAcF0MHiPzpWCejPiIFJ72yFkM,55
3
- bin/release.sh,sha256=ghS71QUBWwCqBNKAtpspYvqX46M1cZyUgtOEI4xDLUo,110
4
- gibson/api/BaseApi.py,sha256=4BZYKcLnIUtxinQuL--qpTRlsorMmpirdf3pW1DzPaI,3735
3
+ bin/release.sh,sha256=6pnY_GctbwF-3sZB67b0nzUlTsxlhY1hqJQoqRutXuw,137
4
+ gibson/api/BaseApi.py,sha256=Wza4yuLHhFjkPxt2dhtUtM_r9b5IGd72V80VDl7v3Gw,3510
5
5
  gibson/api/Cli.py,sha256=Qcm5NIQ4x1Wn6KfkrAzwvZeWyt-cKF_xD7_lTWL4Lbw,8071
6
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
7
+ gibson/api/ProjectApi.py,sha256=1_gRAAgaqblV0I0D-R-wwgSQArQ4fSCxTDfTO3zDQzY,1212
8
+ gibson/bin/gibson.py,sha256=ybtdrqLfmTb-gG2U7kWSHWSZDvc864omYR9vres38ZU,458
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
@@ -22,7 +22,7 @@ gibson/command/Tree.py,sha256=BeJ_13xrrRCK5FP2rQHWpDKrshVzte-_D1pNG1GXPIw,3056
22
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
- gibson/command/auth/Logout.py,sha256=V01q4TdbiBqCnIrM6IA4T25fO6ws0UpXp42I3pwHZVM,248
25
+ gibson/command/auth/Logout.py,sha256=QwW9pCNi61Ak0-1B-3spd_YlsmLYBxzV4uwyO0RYzxg,252
26
26
  gibson/command/code/Api.py,sha256=sSvAqEJXdgQjYcu0uiM6ndHE3GnfkfVL6eqP2Otkbww,1002
27
27
  gibson/command/code/Base.py,sha256=YJ2a5Hl0f9NXHUBBPvlt-dUIqEPWQz5vH6-1EHmbFbA,640
28
28
  gibson/command/code/Code.py,sha256=j6RetYcg3RQcpD7lA0MRDof9A9drHPDeGjdsslQtLvM,3773
@@ -38,7 +38,7 @@ gibson/command/importer/OpenApi.py,sha256=5PL4JlhniPhUidOFxKpC9ao_r8C_qIeCoGyliP
38
38
  gibson/command/list/Entities.py,sha256=o5Wemlq_EpeObNwJHbCqkUT4nccfu_OOZ_gYWzJ051Y,1223
39
39
  gibson/command/list/List.py,sha256=IA9VYuOiFdweg-6HIBZ5hECnMyNxsoU2dKd-gzRNtio,1107
40
40
  gibson/command/list/Projects.py,sha256=ju82kC3cuvAMGg4YJl1yn0l8t11fa1T5Zvgkl_p9m9U,1194
41
- gibson/command/mcp/McpServer.py,sha256=fzeo6gQU0eZL9LA0w5iC1I-wATufIyh23zA7oiYRtGM,810
41
+ gibson/command/mcp/McpServer.py,sha256=LiKPGtxpdGHJQP280tmqhnUOvdJboF6UtoQggKQHVJg,881
42
42
  gibson/command/new/Module.py,sha256=PCTt6k54XFzgNjNgwY0FKQFzk0YFoaN_KPZF2sfN_V0,1535
43
43
  gibson/command/new/New.py,sha256=cwsBpZAZH-9se26ywAUFyvrc9L9ezwoERIrRLlDkrzU,1519
44
44
  gibson/command/new/Project.py,sha256=Cw1Z6TvPIGhTi7GiQZ2VFjv6hXdpGKQdX9HuAd5gric,759
@@ -66,9 +66,9 @@ gibson/conf/dev/Schema.py,sha256=kOSlX1jEyVb82xd8TO8jEAimLcaefIFJr6d2JYvyTqg,74
66
66
  gibson/conf/tests/test_conf_Dependencies.py,sha256=LITeeYiqXM5rKkyWFBqcnMvUR5pzDRuHVAngH372jWc,116
67
67
  gibson/conf/tests/test_conf_Platform.py,sha256=Zc53IsZmV-hT9VRrZEPNrsuehSdWnJXWKGMmOhEqWHo,138
68
68
  gibson/core/Colors.py,sha256=sllEmJAb2AAUH0e-ZLP1_C8pfz5U_w0fo5kubSH5g1o,3426
69
- gibson/core/CommandRouter.py,sha256=P64NCzC2noHauV_cdMU1IzfjgHe1zezDadviaPs3Cds,3320
69
+ gibson/core/CommandRouter.py,sha256=V7awLSPjOx2GQqJNoHQSFsiA2uFkrxtpysyTDbyPloA,3442
70
70
  gibson/core/Completions.py,sha256=a26WRh40UpnTT5HGTPT8TCcL8h80HvvZiTJXZofDjx8,1207
71
- gibson/core/Configuration.py,sha256=xUul0ckr92e7uvn5t3YM1w6n3uGytvs6l69kx9EotIc,16404
71
+ gibson/core/Configuration.py,sha256=5nO4hY1MvVQapt37RbwrJpc9zwUx6u86n1BRRbIgjUQ,16586
72
72
  gibson/core/Conversation.py,sha256=KF7YPXijhhz6HOkife__ycHox4WeRKNHIpv3juDPhq0,10237
73
73
  gibson/core/Diff.py,sha256=onUJ5_0_S1vKAY_oFgX4vmwQo4byrnXLV4w7QSNA8fY,1071
74
74
  gibson/core/Env.py,sha256=08dZRHzzR0ahrbM4S0bXC7V1xhYQkT8Zefs00qUHf0U,498
@@ -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=Ur8PbXz_mTt1gLuOVTAixGFiac_0SkNXZN5n9Z5gETw,4500
109
+ gibson/services/mcp/server.py,sha256=pmJrZ2A1U33Y_UMCA6kgvIoqUZju3m8fLLfOjaAo_oM,4533
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.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,,
132
+ gibson_cli-0.8.3.dist-info/METADATA,sha256=NJ34YJ9UIbKeQMbn2dkE4jXy1gykNNsNZ3l0_kR67tU,14592
133
+ gibson_cli-0.8.3.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
134
+ gibson_cli-0.8.3.dist-info/entry_points.txt,sha256=j5VUvq3AzL21xPvVC24zMoXFt-I5lUWulr66nL3OAPM,50
135
+ gibson_cli-0.8.3.dist-info/top_level.txt,sha256=fSV3vegbdbSDwiB6n5z3FCeYwkIonzFrx4ek3F_OSdI,16
136
+ gibson_cli-0.8.3.dist-info/RECORD,,