gibson-cli 0.3.5__py3-none-any.whl → 0.4.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.
@@ -18,6 +18,7 @@ class Auth(BaseCommand):
18
18
  self.usage()
19
19
 
20
20
  def usage(self):
21
+ self.conversation.display_project(self.configuration.project.name)
21
22
  self.conversation.type(
22
23
  f"usage: {command(self.configuration.command)} {subcommand('auth')} {argument('login')} {hint('login to Gibson')} \n"
23
24
  )
gibson/core/Colors.py CHANGED
@@ -66,3 +66,7 @@ def option(text):
66
66
 
67
67
  def hint(text):
68
68
  return colorize(text, Color.GREY)
69
+
70
+
71
+ def project(text):
72
+ return colorize(text, Color.BOLD)
@@ -5,9 +5,10 @@ class Completions:
5
5
  def __init__(self):
6
6
  self.user_home = os.environ.get("HOME")
7
7
  self.gibson_config = ".gibsonai"
8
+ self.file_name = "bash_completion"
8
9
 
9
10
  def install(self):
10
- completions_location = f"$HOME/{self.gibson_config}/bash_completion"
11
+ completions_location = f"$HOME/{self.gibson_config}/{self.file_name}"
11
12
  installation = f"""\n[ -s "{completions_location}" ] && \\. "{completions_location}" # Load gibson auto completion\n"""
12
13
 
13
14
  for file in [f"{self.user_home}/.bashrc", f"{self.user_home}/.zshrc"]:
@@ -31,7 +32,7 @@ class Completions:
31
32
  except FileExistsError:
32
33
  pass
33
34
 
34
- with open(f"{self.user_home}/{self.gibson_config}/bash_completion", "w") as f:
35
+ with open(f"{self.user_home}/{self.gibson_config}/{self.file_name}", "w") as f:
35
36
  f.write(contents)
36
37
 
37
38
  return self
@@ -11,12 +11,13 @@ from gibson.conf.Platform import Platform
11
11
  from gibson.conf.Project import Project
12
12
  from gibson.core.Completions import Completions
13
13
  from gibson.core.Conversation import Conversation
14
+ from gibson.core.PythonPath import PythonPath
14
15
  from gibson.services.auth.Server import Server as AuthServer
15
16
 
16
17
 
17
18
  class Configuration:
18
19
  VERSION = 2
19
- API_ENV = os.environ.get("GIBSONAI_API_ENV", "staging")
20
+ API_ENV = os.environ.get("GIBSONAI_API_ENV", "production")
20
21
 
21
22
  def __init__(self):
22
23
  self.command = None
@@ -37,6 +38,7 @@ class Configuration:
37
38
  self.read_config()
38
39
 
39
40
  Completions().write().install()
41
+ PythonPath().write().install()
40
42
 
41
43
  def api_domain(self):
42
44
  domains = {
@@ -6,6 +6,7 @@ import time
6
6
  import pyfiglet
7
7
 
8
8
  from gibson.conf.Version import Version
9
+ from gibson.core.Colors import project
9
10
 
10
11
 
11
12
  class Conversation:
@@ -72,7 +73,7 @@ class Conversation:
72
73
  self.newline()
73
74
 
74
75
  def display_project(self, project_name):
75
- self.type(f"<> Project {project_name}\n\n")
76
+ self.type(f"<> Project {project(project_name)}\n\n")
76
77
 
77
78
  def entities_hijacked(self):
78
79
  self.type(
@@ -0,0 +1,52 @@
1
+ import json
2
+ import os
3
+
4
+
5
+ class PythonPath:
6
+ def __init__(self):
7
+ self.user_home = os.environ.get("HOME")
8
+ self.gibson_config = ".gibsonai"
9
+ self.file_name = "python_path"
10
+
11
+ def install(self):
12
+ python_path_location = f"$HOME/{self.gibson_config}/{self.file_name}"
13
+ installation = f"""\n[ -s "{python_path_location}" ] && \\. "{python_path_location}" # Setup pythonpath for gibson projects\n"""
14
+
15
+ for file in [f"{self.user_home}/.bashrc", f"{self.user_home}/.zshrc"]:
16
+ with open(file, "a+") as f:
17
+ f.seek(0)
18
+ if python_path_location not in f.read():
19
+ f.write(installation)
20
+
21
+ return self
22
+
23
+ def write(self):
24
+ try:
25
+ with open(f"{self.user_home}/{self.gibson_config}/config", "r") as f:
26
+ config = json.loads(f.read())
27
+ except:
28
+ return self
29
+
30
+ project_paths = filter(
31
+ lambda x: x is not None,
32
+ [
33
+ config.get(project).get("dev", {}).get("base", {}).get("path")
34
+ for project in config
35
+ ],
36
+ )
37
+
38
+ if not project_paths:
39
+ return self
40
+
41
+ try:
42
+ os.mkdir(f"{self.user_home}/{self.gibson_config}")
43
+ except FileExistsError:
44
+ pass
45
+
46
+ contents = "\n".join(
47
+ f"export PYTHONPATH=$PYTHONPATH:{path}" for path in project_paths
48
+ )
49
+ with open(f"{self.user_home}/{self.gibson_config}/{self.file_name}", "w") as f:
50
+ f.write(contents)
51
+
52
+ return self
@@ -10,7 +10,7 @@ class BaseCustomization:
10
10
  self.configuration = configuration
11
11
 
12
12
  def _get_file_name(self):
13
- return NotImplementedError
13
+ raise NotImplementedError
14
14
 
15
15
  def preserve(self):
16
16
  file_name = self._get_file_name()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gibson-cli
3
- Version: 0.3.5
3
+ Version: 0.4.0
4
4
  Summary: Gibson Command Line Interface
5
5
  Author-email: GibsonAI <noc@gibsonai.com>
6
6
  Project-URL: Homepage, https://gibsonai.com/
@@ -93,7 +93,7 @@ Run `gibson auth login` to login to Gibson with your Google account.
93
93
 
94
94
  While in beta, you have to acquire an API manually:
95
95
 
96
- - Go to <https://staging.gibsonai.com/>.
96
+ - Go to <https://app.gibsonai.com/>.
97
97
  - Chat with Gibson and create a new project.
98
98
  - When your project is complete Gibson will email you the API key.
99
99
  - gibson conf api::key [API key]
@@ -256,7 +256,7 @@ For example, you might provide class name = `MyBaseModel` and import path = `pro
256
256
 
257
257
  ### Building a Project End-to-End Using AI
258
258
 
259
- - Go to <https://staging.gibsonai.com/>.
259
+ - Go to <https://app.gibsonai.com/>.
260
260
  - Chat with Gibson and create a new project.
261
261
  - When your project is complete Gibson will email you the API key.
262
262
  - `gibson conf api::key [API key]`
@@ -27,7 +27,7 @@ gibson/command/Test.py,sha256=7M7zVo9_dPGZ_hWlN9HcvuqHdpw1-Lc4--eK2fS7j10,1228
27
27
  gibson/command/Tree.py,sha256=JWvUimeHWY5-6vEh6axTkhAdI-dVTxbKSjx_4isAAx8,3041
28
28
  gibson/command/Version.py,sha256=LA162K8oPDJAwPEja6ppoHVU8tr7shA1gzkcWxV4XVs,1282
29
29
  gibson/command/WarGames.py,sha256=V0KIpz-Z546qtQaOPdIVHQ6wp2n3r3M3tgKx-GRQzzU,1300
30
- gibson/command/auth/Auth.py,sha256=aOD5f4Ob9ZZ_eoodO2BgJ2-pNNE-BzoqwrYz-UGJHKo,956
30
+ gibson/command/auth/Auth.py,sha256=7gIwt8qyULdRf7Rgf2wZ1ePvvZ6nYWCdEhoOHOJErzE,1031
31
31
  gibson/command/auth/Login.py,sha256=b43OfV76i6aGdOwj1NK64ZOdYlNyc08g3lZGQ_37KDw,437
32
32
  gibson/command/auth/Logout.py,sha256=V01q4TdbiBqCnIrM6IA4T25fO6ws0UpXp42I3pwHZVM,248
33
33
  gibson/command/rewrite/Api.py,sha256=sSvAqEJXdgQjYcu0uiM6ndHE3GnfkfVL6eqP2Otkbww,1002
@@ -56,13 +56,14 @@ gibson/conf/dev/Model.py,sha256=HbHRX3VDxR7hXlzuxkKw4Bf7FH6XMfQ96k9BeIUoBf4,73
56
56
  gibson/conf/dev/Schema.py,sha256=kOSlX1jEyVb82xd8TO8jEAimLcaefIFJr6d2JYvyTqg,74
57
57
  gibson/conf/tests/test_conf_Dependencies.py,sha256=LITeeYiqXM5rKkyWFBqcnMvUR5pzDRuHVAngH372jWc,116
58
58
  gibson/conf/tests/test_conf_Platform.py,sha256=Zc53IsZmV-hT9VRrZEPNrsuehSdWnJXWKGMmOhEqWHo,138
59
- gibson/core/Colors.py,sha256=UchFC88hnQwLg2GFAqC4rqsBySlNU_0-5tC9Iz048q8,1421
59
+ gibson/core/Colors.py,sha256=RDgFlADA9DxbJGWhlNYHtvOO5oKHhFuxhUEet1Uakv4,1480
60
60
  gibson/core/CommandRouter.py,sha256=7U9eUsEPTwKHZEdeCcMXB_qmDXx6X9wCY_OUPBRyt8M,8477
61
- gibson/core/Completions.py,sha256=N-mfeImSzw-d3Lrpu1KVnt0geMuKkbTaHpYTMYcPcAQ,1152
62
- gibson/core/Configuration.py,sha256=L5jDfY20N0MvfaCW2sc8_8282VlQ8rWGr-C3rK-Gtfk,16036
63
- gibson/core/Conversation.py,sha256=x2nTD5YD72VpwCSJgrlpMhJqqibfIfbTob0dz0FCPMA,8646
61
+ gibson/core/Completions.py,sha256=Bsh25vnf0pjpJA6MJNR_2MA2s58Ujj8XolR8fm8AQ_s,1197
62
+ gibson/core/Configuration.py,sha256=CHrTrCobyEbHFA5dOem3hxglmFQkmtYfvl05oIN8ydI,16124
63
+ gibson/core/Conversation.py,sha256=cZTlP_VAv9OfBAxACCmGHuOfobCKKlWMplXrpc4-aGs,8694
64
64
  gibson/core/Env.py,sha256=7HFKGah25KjLelyOjYS8ylR6yDScT6utyZe7HdB3aRE,431
65
65
  gibson/core/Memory.py,sha256=xQvExaT151yC9nwKJuADsniMR-UQhw7zXyJd4LReL6g,3942
66
+ gibson/core/PythonPath.py,sha256=p1q7n_5KnPvA8XbxJyvqC2vrIdEdTiMr6vRU9yj77Cs,1567
66
67
  gibson/core/TimeKeeper.py,sha256=0mzs04wizjGEJbiQFWZyi4ja4XgeJaDqc0JzPCHp9po,250
67
68
  gibson/core/utils.py,sha256=KTnPvA3sUYnLFTZG7Tke5YEdls8Da0rNbeaOm8hapiU,408
68
69
  gibson/data/bash-completion.tmpl,sha256=8XYbLMjyKlbaY4RVutxDqcwNLh5HNjTVDmZ3_Eci2xU,2726
@@ -87,7 +88,7 @@ gibson/services/code/context/schema/tests/test_code_context_schema_DataDictionar
87
88
  gibson/services/code/context/schema/tests/test_code_context_schema_EntityKeys.py,sha256=i--xVPHNw7Ks8kkuv9GmSbpp0BuMMKTGtPBY1HwT-60,2114
88
89
  gibson/services/code/context/schema/tests/test_code_context_schema_Manager.py,sha256=FiQFpFmJjv9g46QjmBjGVF3yz1GF0Q42j0fvZm5ZOYw,1230
89
90
  gibson/services/code/customization/Authenticator.py,sha256=3VvxZsxelPPhxapHnsYhfMaFgdQ523dai9wxCNMa9Eg,372
90
- gibson/services/code/customization/BaseCustomization.py,sha256=E925XQ9KvSnSy2rE91er58mD7AJ8I1t-I8L2UAFrS0g,1188
91
+ gibson/services/code/customization/BaseCustomization.py,sha256=toCGRMF8VUXNIwScpAiiRqq4RT2rQCzYkbyypdfAAl4,1187
91
92
  gibson/services/code/customization/CustomizationManager.py,sha256=M2gz98Yo2WTnnhs1lx_ma63aK1hTfbU6C9RbItaYeDY,705
92
93
  gibson/services/code/customization/Index.py,sha256=4Thf0gZM6VErZJS97w748PRNmHi8QvsyblOLCw1Y_XE,364
93
94
  gibson/services/code/customization/tests/test_code_customization_Authenticator.py,sha256=kKExkLfKPpRA2NQH3fvRCuBEMhCGhR-IvNJqXuyBz3c,1949
@@ -105,8 +106,8 @@ gibson/structure/tests/test_Entity.py,sha256=Gl9f1NcEKdpWCx4W3takFFzp18mLhCYWKrd
105
106
  gibson/tests/test_Env.py,sha256=DPWmP0-aEelducq9bAwv7rKoY2NjWXUeCrzfJDQkn2M,369
106
107
  gibson/tests/test_Memory.py,sha256=YP7owToABAk_-s7fD5UG0HTc4lamDjdA39JUlLnk3Fg,2574
107
108
  gibson/tests/test_utils.py,sha256=r_y-EG05YTCNtL8MWiAK1KmPsmeoMgypKsQC_lVgOtM,559
108
- gibson_cli-0.3.5.dist-info/METADATA,sha256=LR-E9ieuglR8EAGiLDCWAWaclUF6ZpvHYZtsd5mFjcA,11505
109
- gibson_cli-0.3.5.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
110
- gibson_cli-0.3.5.dist-info/entry_points.txt,sha256=j5VUvq3AzL21xPvVC24zMoXFt-I5lUWulr66nL3OAPM,50
111
- gibson_cli-0.3.5.dist-info/top_level.txt,sha256=RFaUY7VXGiqkMwo1Rj7pM4kGvxkhhnfo-2LmPpuL_fs,11
112
- gibson_cli-0.3.5.dist-info/RECORD,,
109
+ gibson_cli-0.4.0.dist-info/METADATA,sha256=5Ek10vgd86r0JECMVED0OGQU78t5hkWs_W0MJnEeMX4,11497
110
+ gibson_cli-0.4.0.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
111
+ gibson_cli-0.4.0.dist-info/entry_points.txt,sha256=j5VUvq3AzL21xPvVC24zMoXFt-I5lUWulr66nL3OAPM,50
112
+ gibson_cli-0.4.0.dist-info/top_level.txt,sha256=RFaUY7VXGiqkMwo1Rj7pM4kGvxkhhnfo-2LmPpuL_fs,11
113
+ gibson_cli-0.4.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (72.1.0)
2
+ Generator: setuptools (72.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5