gibson-cli 0.3.0__py3-none-any.whl → 0.3.1__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.
gibson/command/Version.py CHANGED
@@ -1,9 +1,32 @@
1
+ import requests
2
+
1
3
  from gibson.command.BaseCommand import BaseCommand
2
4
  from gibson.conf.Version import Version as VersionConf
5
+ from gibson.core.Colors import Color, colorize, command, option, subcommand
3
6
 
4
7
 
5
8
  class Version(BaseCommand):
6
9
  def execute(self):
7
- self.conversation.type(f"{VersionConf.num}\n")
10
+ try:
11
+ r = requests.get("https://pypi.org/pypi/gibson-cli/json")
12
+ latest_version = r.json()["info"]["version"]
13
+ except:
14
+ latest_version = VersionConf.num
15
+
16
+ if latest_version != VersionConf.num:
17
+ self.conversation.type(
18
+ f"A new version of {command(self.configuration.command)} is available: {colorize(latest_version, Color.CYAN)}\n"
19
+ )
20
+ self.conversation.type(
21
+ f"You are currently using version: {colorize(VersionConf.num, Color.VIOLET)}\n"
22
+ )
23
+ self.conversation.type(
24
+ f"Please update to the latest version by running: {command('pip3')} {subcommand('install')} {option('--upgrade')} gibson-cli\n"
25
+ )
26
+ else:
27
+ self.conversation.type(
28
+ f"Nice! You are using the latest version of {command(self.configuration.command)}: {colorize(VersionConf.num, Color.CYAN)}\n"
29
+ )
30
+
8
31
  self.conversation.newline()
9
32
  return True
gibson/core/Colors.py CHANGED
@@ -60,5 +60,9 @@ def arguments(list):
60
60
  return f"[{'|'.join(map(lambda x: argument(x), list))}]"
61
61
 
62
62
 
63
+ def option(text):
64
+ return colorize(text, Color.CYAN)
65
+
66
+
63
67
  def hint(text):
64
68
  return colorize(text, Color.GREY)
@@ -407,11 +407,8 @@ class Configuration:
407
407
  pass
408
408
 
409
409
  with open(f"{self.paths.auth}/{self.API_ENV}", "w") as f:
410
- f.write(
411
- json.dumps(
412
- {"access_token": access_token, "refresh_token": refresh_token}
413
- )
414
- )
410
+ data = {"access_token": access_token, "refresh_token": refresh_token}
411
+ json.dump(data, f, indent=2)
415
412
 
416
413
  def set_config_paths(self, ignore_env_vars=False):
417
414
  user_home = os.environ.get("HOME")
@@ -464,7 +461,7 @@ class Configuration:
464
461
  pass
465
462
 
466
463
  with open(self.project.paths.config, "w") as f:
467
- f.write(json.dumps(self.settings))
464
+ json.dump(self.settings, f, indent=2)
468
465
 
469
466
  self.read_config()
470
467
 
gibson/core/Memory.py CHANGED
@@ -104,7 +104,7 @@ class Memory:
104
104
 
105
105
  def __remember(self, file, data):
106
106
  with open(file, "w") as f:
107
- f.write(json.dumps(data))
107
+ json.dump(data, f, indent=2)
108
108
 
109
109
  return self
110
110
 
@@ -123,7 +123,7 @@ class Memory:
123
123
  return self.get_path_top() + "/last"
124
124
 
125
125
  def get_path_top(self):
126
- return (
126
+ return os.path.expandvars(
127
127
  self.configuration.project.paths.memory
128
128
  + "/"
129
129
  + self.configuration.project.name
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gibson-cli
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Gibson Command Line Interface
5
5
  Author-email: GibsonAI <noc@gibsonai.com>
6
6
  Project-URL: Homepage, https://gibsonai.com/
@@ -67,7 +67,7 @@ Let's consider a more concrete example. You imported your datastore into the CLI
67
67
 
68
68
  So Gibson creates a new version of the user table containing a nickname column. This new table is stored in last memory. If you execute:
69
69
 
70
- `gibson models`
70
+ `gibson rewrite models`
71
71
 
72
72
  The CLI will write the code for what is sitting in last memory.
73
73
 
@@ -123,8 +123,8 @@ All of Gibson's configuration files and caches are stored in `$HOME/.gibson`. Us
123
123
  - `:command! -nargs=* Gibson r ! gibson <args>`
124
124
  - Open a file and execute commands:
125
125
  - `:Gibson module abc`
126
- - `:Gibson models`
127
- - `:Gibson schemas`
126
+ - `:Gibson rewrite models`
127
+ - `:Gibson rewrite schemas`
128
128
 
129
129
  ## Currently Supported Software
130
130
 
@@ -200,7 +200,7 @@ For example, you might provide class name = `MyBaseModel` and import path = `pro
200
200
 
201
201
  ### Writing the Base Code
202
202
 
203
- `gibson base`
203
+ `gibson rewrite base`
204
204
 
205
205
  ### Writing the Code for a Single Model
206
206
 
@@ -212,20 +212,20 @@ For example, you might provide class name = `MyBaseModel` and import path = `pro
212
212
 
213
213
  ### Writing the Code for All Models
214
214
 
215
- `gibson models`
215
+ `gibson rewrite models`
216
216
 
217
217
  ### Writing the Code for All Schemas
218
218
 
219
- `gibson schemas`
219
+ `gibson rewrite schemas`
220
220
 
221
221
  ### Adding a New Module to the Software Using AI
222
222
 
223
223
  - gibson module [module name]
224
224
  - e.g. gibson module user
225
225
  - Gibson will display the SQL tables it has generated as a result of your request. It will store these entities in its last memory.
226
- - gibson models
226
+ - `gibson rewrite models`
227
227
  - This will write the code for the entities it just created.
228
- - gibson merge
228
+ - `gibson merge`
229
229
  - This will merge the new entities into your project.
230
230
  - Note, at the moment Gibson does not build the tables into your datastore.
231
231
 
@@ -234,7 +234,7 @@ For example, you might provide class name = `MyBaseModel` and import path = `pro
234
234
  - `gibson modify [table name] [natural language request]`
235
235
  - e.g. `gibson modify my_table I want to add a new column called name and remove all of the columns related to email`
236
236
  - Gibson will display the modified SQL table and store it in its last memory.
237
- - `gibson models`
237
+ - `gibson rewrite models`
238
238
  - This will write the code for the modified entity.
239
239
  - `gibson merge`
240
240
  - This will merge the modified entity into your project.
@@ -25,7 +25,7 @@ gibson/command/Schema.py,sha256=w47Z2klLAUSGx8Ln6iCWCVuZtz6cHBMc_i4ru7DqhyI,1233
25
25
  gibson/command/Show.py,sha256=oNGKeNfEo6Qz1n4rJIRjlLuHWHWs5lB0TWE8Vn3hE2U,1190
26
26
  gibson/command/Test.py,sha256=7M7zVo9_dPGZ_hWlN9HcvuqHdpw1-Lc4--eK2fS7j10,1228
27
27
  gibson/command/Tree.py,sha256=JWvUimeHWY5-6vEh6axTkhAdI-dVTxbKSjx_4isAAx8,3041
28
- gibson/command/Version.py,sha256=4St_HMM_ub8CHG61Zh2UZPzXawNabmtlRHZdvekdfd8,270
28
+ gibson/command/Version.py,sha256=LA162K8oPDJAwPEja6ppoHVU8tr7shA1gzkcWxV4XVs,1282
29
29
  gibson/command/WarGames.py,sha256=V0KIpz-Z546qtQaOPdIVHQ6wp2n3r3M3tgKx-GRQzzU,1300
30
30
  gibson/command/auth/Auth.py,sha256=aOD5f4Ob9ZZ_eoodO2BgJ2-pNNE-BzoqwrYz-UGJHKo,956
31
31
  gibson/command/auth/Login.py,sha256=b43OfV76i6aGdOwj1NK64ZOdYlNyc08g3lZGQ_37KDw,437
@@ -56,13 +56,13 @@ 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=Us7C_SiPySogZABytlktw871gJGgETNFYcNeVyvtsjU,1363
59
+ gibson/core/Colors.py,sha256=UchFC88hnQwLg2GFAqC4rqsBySlNU_0-5tC9Iz048q8,1421
60
60
  gibson/core/CommandRouter.py,sha256=7U9eUsEPTwKHZEdeCcMXB_qmDXx6X9wCY_OUPBRyt8M,8477
61
61
  gibson/core/Completions.py,sha256=N-mfeImSzw-d3Lrpu1KVnt0geMuKkbTaHpYTMYcPcAQ,1152
62
- gibson/core/Configuration.py,sha256=-L1MS2gkXPEpTcuFCnpuMKIinvBgxdE02RhRh4fnccY,15633
62
+ gibson/core/Configuration.py,sha256=DZMMcqysX39LkJbLl_kmo2PQ5vfqzXW6qgKamPIaiwQ,15595
63
63
  gibson/core/Conversation.py,sha256=gFP0fZCNiQ8K44qUQpAt9xokxJTft3_nfqiHmEoFlUE,8811
64
64
  gibson/core/Env.py,sha256=7HFKGah25KjLelyOjYS8ylR6yDScT6utyZe7HdB3aRE,431
65
- gibson/core/Memory.py,sha256=Anauq7vx883Bg5djoZCVyvAJBQeMtqQLzZtNecJMpZc,3921
65
+ gibson/core/Memory.py,sha256=xQvExaT151yC9nwKJuADsniMR-UQhw7zXyJd4LReL6g,3942
66
66
  gibson/core/TimeKeeper.py,sha256=0mzs04wizjGEJbiQFWZyi4ja4XgeJaDqc0JzPCHp9po,250
67
67
  gibson/core/utils.py,sha256=KTnPvA3sUYnLFTZG7Tke5YEdls8Da0rNbeaOm8hapiU,408
68
68
  gibson/data/bash-completion.tmpl,sha256=8XYbLMjyKlbaY4RVutxDqcwNLh5HNjTVDmZ3_Eci2xU,2726
@@ -104,8 +104,8 @@ gibson/structure/tests/test_Entity.py,sha256=Gl9f1NcEKdpWCx4W3takFFzp18mLhCYWKrd
104
104
  gibson/tests/test_Env.py,sha256=DPWmP0-aEelducq9bAwv7rKoY2NjWXUeCrzfJDQkn2M,369
105
105
  gibson/tests/test_Memory.py,sha256=YP7owToABAk_-s7fD5UG0HTc4lamDjdA39JUlLnk3Fg,2574
106
106
  gibson/tests/test_utils.py,sha256=r_y-EG05YTCNtL8MWiAK1KmPsmeoMgypKsQC_lVgOtM,559
107
- gibson_cli-0.3.0.dist-info/METADATA,sha256=VkuCt6nfzRP3AkFR1QtSmy-gbOG9-mkrrcM9bkm1sz4,11437
108
- gibson_cli-0.3.0.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
109
- gibson_cli-0.3.0.dist-info/entry_points.txt,sha256=j5VUvq3AzL21xPvVC24zMoXFt-I5lUWulr66nL3OAPM,50
110
- gibson_cli-0.3.0.dist-info/top_level.txt,sha256=RFaUY7VXGiqkMwo1Rj7pM4kGvxkhhnfo-2LmPpuL_fs,11
111
- gibson_cli-0.3.0.dist-info/RECORD,,
107
+ gibson_cli-0.3.1.dist-info/METADATA,sha256=nrCgKmaTPVoNjPt8JoFcK3K2z4uWANOuYXbveCbL9TE,11505
108
+ gibson_cli-0.3.1.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
109
+ gibson_cli-0.3.1.dist-info/entry_points.txt,sha256=j5VUvq3AzL21xPvVC24zMoXFt-I5lUWulr66nL3OAPM,50
110
+ gibson_cli-0.3.1.dist-info/top_level.txt,sha256=RFaUY7VXGiqkMwo1Rj7pM4kGvxkhhnfo-2LmPpuL_fs,11
111
+ gibson_cli-0.3.1.dist-info/RECORD,,