gibson-cli 0.6.0__tar.gz → 0.7.0__tar.gz

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.
Files changed (140) hide show
  1. {gibson_cli-0.6.0/gibson_cli.egg-info → gibson_cli-0.7.0}/PKG-INFO +76 -27
  2. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/README.md +24 -26
  3. gibson_cli-0.7.0/bin/clean.sh +3 -0
  4. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/api/BaseApi.py +2 -1
  5. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/api/Cli.py +9 -2
  6. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/Build.py +60 -8
  7. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/Help.py +0 -12
  8. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/Question.py +4 -7
  9. gibson_cli-0.7.0/gibson/command/code/Code.py +72 -0
  10. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/code/Entity.py +25 -7
  11. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/code/Model.py +1 -1
  12. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/code/Schema.py +1 -1
  13. gibson_cli-0.6.0/gibson/command/code/Tests.py → gibson_cli-0.7.0/gibson/command/code/Test.py +1 -1
  14. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/importer/Import.py +83 -11
  15. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/importer/OpenApi.py +4 -9
  16. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/new/Module.py +1 -1
  17. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/new/New.py +3 -3
  18. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/new/Project.py +2 -2
  19. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/rewrite/Rewrite.py +9 -14
  20. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/tests/test_command_Conf.py +1 -0
  21. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/Project.py +1 -0
  22. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/core/Configuration.py +21 -58
  23. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/core/Conversation.py +25 -7
  24. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/data/bash-completion.tmpl +3 -4
  25. gibson_cli-0.7.0/gibson/data/postgresql/default-ref-table.tmpl +4 -0
  26. gibson_cli-0.7.0/gibson/data/postgresql/default-table.tmpl +5 -0
  27. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/db/TableExceptions.py +3 -0
  28. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/db/tests/test_db_TableExceptions.py +4 -0
  29. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/services/code/context/schema/EntityKeys.py +3 -3
  30. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/services/code/context/schema/tests/test_code_context_schema_EntityKeys.py +3 -3
  31. gibson_cli-0.7.0/gibson/structure/Entity.py +18 -0
  32. gibson_cli-0.7.0/gibson/structure/mysql/Entity.py +117 -0
  33. {gibson_cli-0.6.0/gibson/structure → gibson_cli-0.7.0/gibson/structure/mysql}/constraints/ReferenceConstraint.py +6 -2
  34. {gibson_cli-0.6.0/gibson/structure → gibson_cli-0.7.0/gibson/structure/mysql}/keys/ForeignKey.py +9 -5
  35. {gibson_cli-0.6.0/gibson/structure → gibson_cli-0.7.0/gibson/structure/mysql}/keys/Index.py +7 -3
  36. gibson_cli-0.6.0/gibson/structure/keys/tests/test_ForeignKey.py → gibson_cli-0.7.0/gibson/structure/mysql/keys/tests/test_structure_mysql_keys_ForeignKey.py +16 -8
  37. gibson_cli-0.6.0/gibson/structure/keys/tests/test_Index.py → gibson_cli-0.7.0/gibson/structure/mysql/keys/tests/test_structure_mysql_keys_Index.py +7 -3
  38. gibson_cli-0.6.0/gibson/structure/keys/tests/test_IndexAttribute.py → gibson_cli-0.7.0/gibson/structure/mysql/keys/tests/test_structure_mysql_keys_IndexAttribute.py +1 -1
  39. gibson_cli-0.7.0/gibson/structure/mysql/testing.py +231 -0
  40. gibson_cli-0.6.0/gibson/structure/tests/test_Entity.py → gibson_cli-0.7.0/gibson/structure/mysql/tests/test_structure_mysql_Entity.py +34 -20
  41. {gibson_cli-0.6.0/gibson/structure → gibson_cli-0.7.0/gibson/structure/postgresql}/Entity.py +11 -18
  42. gibson_cli-0.7.0/gibson/structure/postgresql/References.py +61 -0
  43. gibson_cli-0.7.0/gibson/structure/postgresql/table/ForeignKey.py +28 -0
  44. gibson_cli-0.7.0/gibson/structure/postgresql/table/tests/test_structure_postgresql_table_ForeignKey.py +44 -0
  45. {gibson_cli-0.6.0/gibson/structure → gibson_cli-0.7.0/gibson/structure/postgresql}/testing.py +45 -82
  46. gibson_cli-0.7.0/gibson/structure/postgresql/tests/test_structure_postgresql_Entity.py +82 -0
  47. gibson_cli-0.7.0/gibson/structure/tests/test_structure_Entity.py +22 -0
  48. {gibson_cli-0.6.0 → gibson_cli-0.7.0/gibson_cli.egg-info}/PKG-INFO +76 -27
  49. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson_cli.egg-info/SOURCES.txt +28 -16
  50. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/pyproject.toml +5 -1
  51. gibson_cli-0.7.0/requirements.txt +51 -0
  52. gibson_cli-0.6.0/gibson/command/code/Code.py +0 -42
  53. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/.gitignore +0 -0
  54. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/.pre-commit-config.yaml +0 -0
  55. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/bin/build.sh +0 -0
  56. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/bin/release.sh +0 -0
  57. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/api/ProjectApi.py +0 -0
  58. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/bin/gibson.py +0 -0
  59. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/BaseCommand.py +0 -0
  60. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/Conf.py +0 -0
  61. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/Count.py +0 -0
  62. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/Dev.py +0 -0
  63. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/Forget.py +0 -0
  64. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/Merge.py +0 -0
  65. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/Modify.py +0 -0
  66. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/Remove.py +0 -0
  67. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/Show.py +0 -0
  68. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/Tree.py +0 -0
  69. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/Version.py +0 -0
  70. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/WarGames.py +0 -0
  71. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/auth/Auth.py +0 -0
  72. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/auth/Login.py +0 -0
  73. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/auth/Logout.py +0 -0
  74. {gibson_cli-0.6.0/gibson/command/rewrite → gibson_cli-0.7.0/gibson/command/code}/Api.py +0 -0
  75. {gibson_cli-0.6.0/gibson/command/rewrite → gibson_cli-0.7.0/gibson/command/code}/Base.py +0 -0
  76. {gibson_cli-0.6.0/gibson/command/rewrite → gibson_cli-0.7.0/gibson/command/code}/Models.py +0 -0
  77. {gibson_cli-0.6.0/gibson/command/rewrite → gibson_cli-0.7.0/gibson/command/code}/Schemas.py +0 -0
  78. {gibson_cli-0.6.0/gibson/command/rewrite → gibson_cli-0.7.0/gibson/command/code}/Tests.py +0 -0
  79. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/list/Entities.py +0 -0
  80. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/list/List.py +0 -0
  81. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/list/Projects.py +0 -0
  82. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/rename/Entity.py +0 -0
  83. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/rename/Rename.py +0 -0
  84. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/command/tests/test_command_BaseCommand.py +0 -0
  85. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/Api.py +0 -0
  86. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/Code.py +0 -0
  87. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/Custom.py +0 -0
  88. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/Datastore.py +0 -0
  89. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/Dependencies.py +0 -0
  90. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/Dev.py +0 -0
  91. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/Frameworks.py +0 -0
  92. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/Modeler.py +0 -0
  93. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/Paths.py +0 -0
  94. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/Platform.py +0 -0
  95. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/Version.py +0 -0
  96. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/dev/Api.py +0 -0
  97. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/dev/Base.py +0 -0
  98. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/dev/Model.py +0 -0
  99. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/dev/Schema.py +0 -0
  100. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/tests/test_conf_Dependencies.py +0 -0
  101. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/conf/tests/test_conf_Platform.py +0 -0
  102. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/core/Colors.py +0 -0
  103. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/core/CommandRouter.py +0 -0
  104. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/core/Completions.py +0 -0
  105. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/core/Env.py +0 -0
  106. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/core/Memory.py +0 -0
  107. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/core/PythonPath.py +0 -0
  108. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/core/TimeKeeper.py +0 -0
  109. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/core/utils.py +0 -0
  110. {gibson_cli-0.6.0/gibson/data → gibson_cli-0.7.0/gibson/data/mysql}/default-ref-table.tmpl +0 -0
  111. {gibson_cli-0.6.0/gibson/data → gibson_cli-0.7.0/gibson/data/mysql}/default-table.tmpl +0 -0
  112. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/dev/Dev.py +0 -0
  113. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/display/Header.py +0 -0
  114. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/display/WorkspaceFooter.py +0 -0
  115. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/display/WorkspaceHeader.py +0 -0
  116. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/display/tests/test_display_Header.py +0 -0
  117. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/display/tests/test_display_WorkspaceFooter.py +0 -0
  118. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/display/tests/test_display_WorkspaceHeader.py +0 -0
  119. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/lang/Python.py +0 -0
  120. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/lang/tests/test_lang_Python.py +0 -0
  121. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/services/auth/Server.py +0 -0
  122. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/services/code/context/schema/DataDictionary.py +0 -0
  123. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/services/code/context/schema/Manager.py +0 -0
  124. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/services/code/context/schema/tests/test_code_context_schema_DataDictionary.py +0 -0
  125. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/services/code/context/schema/tests/test_code_context_schema_Manager.py +0 -0
  126. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/services/code/customization/Authenticator.py +0 -0
  127. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/services/code/customization/BaseCustomization.py +0 -0
  128. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/services/code/customization/CustomizationManager.py +0 -0
  129. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/services/code/customization/Index.py +0 -0
  130. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/services/code/customization/tests/test_code_customization_Authenticator.py +0 -0
  131. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/services/code/customization/tests/test_code_customization_BaseCustomization.py +0 -0
  132. {gibson_cli-0.6.0/gibson/structure → gibson_cli-0.7.0/gibson/structure/mysql}/keys/IndexAttribute.py +0 -0
  133. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/tests/test_Env.py +0 -0
  134. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/tests/test_Memory.py +0 -0
  135. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson/tests/test_utils.py +0 -0
  136. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson_cli.egg-info/dependency_links.txt +0 -0
  137. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson_cli.egg-info/entry_points.txt +0 -0
  138. /gibson_cli-0.6.0/requirements.txt → /gibson_cli-0.7.0/gibson_cli.egg-info/requires.txt +0 -0
  139. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/gibson_cli.egg-info/top_level.txt +0 -0
  140. {gibson_cli-0.6.0 → gibson_cli-0.7.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gibson-cli
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: Gibson Command Line Interface
5
5
  Author-email: GibsonAI <noc@gibsonai.com>
6
6
  Project-URL: Homepage, https://gibsonai.com/
@@ -14,6 +14,57 @@ Classifier: Intended Audience :: Developers
14
14
  Classifier: Programming Language :: Python :: 3.9
15
15
  Requires-Python: >=3.9
16
16
  Description-Content-Type: text/markdown
17
+ Requires-Dist: annotated-types==0.6.0
18
+ Requires-Dist: anyio==4.3.0
19
+ Requires-Dist: certifi==2024.2.2
20
+ Requires-Dist: charset-normalizer==3.3.2
21
+ Requires-Dist: click==8.1.7
22
+ Requires-Dist: dnspython==2.6.1
23
+ Requires-Dist: email_validator==2.1.1
24
+ Requires-Dist: exceptiongroup==1.2.0
25
+ Requires-Dist: Faker==24.0.0
26
+ Requires-Dist: faker_sqlalchemy==0.10.2208140
27
+ Requires-Dist: fastapi==0.111.0
28
+ Requires-Dist: fastapi-cli==0.0.2
29
+ Requires-Dist: h11==0.14.0
30
+ Requires-Dist: httpcore==1.0.5
31
+ Requires-Dist: httptools==0.6.1
32
+ Requires-Dist: httpx==0.27.0
33
+ Requires-Dist: idna==3.6
34
+ Requires-Dist: iniconfig==2.0.0
35
+ Requires-Dist: Jinja2==3.1.4
36
+ Requires-Dist: markdown-it-py==3.0.0
37
+ Requires-Dist: MarkupSafe==2.1.5
38
+ Requires-Dist: mdurl==0.1.2
39
+ Requires-Dist: orjson==3.10.3
40
+ Requires-Dist: packaging==23.2
41
+ Requires-Dist: pluggy==1.4.0
42
+ Requires-Dist: pydantic==2.6.1
43
+ Requires-Dist: pydantic_core==2.16.2
44
+ Requires-Dist: pyfiglet==1.0.2
45
+ Requires-Dist: Pygments==2.18.0
46
+ Requires-Dist: PyMySQL==1.1.0
47
+ Requires-Dist: pytest==8.0.1
48
+ Requires-Dist: python-dateutil==2.9.0.post0
49
+ Requires-Dist: python-dotenv==1.0.1
50
+ Requires-Dist: python-multipart==0.0.9
51
+ Requires-Dist: PyYAML==6.0.1
52
+ Requires-Dist: requests==2.31.0
53
+ Requires-Dist: rich==13.7.1
54
+ Requires-Dist: shellingham==1.5.4
55
+ Requires-Dist: six==1.16.0
56
+ Requires-Dist: sniffio==1.3.1
57
+ Requires-Dist: SQLAlchemy==1.4.41
58
+ Requires-Dist: starlette==0.37.2
59
+ Requires-Dist: tomli==2.0.1
60
+ Requires-Dist: typer==0.12.3
61
+ Requires-Dist: typing_extensions==4.9.0
62
+ Requires-Dist: ujson==5.9.0
63
+ Requires-Dist: urllib3==1.26.6
64
+ Requires-Dist: uvicorn==0.29.0
65
+ Requires-Dist: uvloop==0.19.0
66
+ Requires-Dist: watchfiles==0.21.0
67
+ Requires-Dist: websockets==12.0
17
68
 
18
69
 
19
70
  [![GibsonAI](https://github.com/user-attachments/assets/26bc1002-f878-4995-a6c5-eb8d5eb69c28)](https://gibsonai.com/)
@@ -69,7 +120,7 @@ Let's consider a more concrete example. You imported your datastore into the CLI
69
120
 
70
121
  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:
71
122
 
72
- `gibson rewrite models`
123
+ `gibson code models`
73
124
 
74
125
  The CLI will write the code for what is sitting in last memory.
75
126
 
@@ -125,8 +176,8 @@ All of Gibson's configuration files and caches are stored in `$HOME/.gibson`. Us
125
176
  - `:command! -nargs=* Gibson r ! gibson <args>`
126
177
  - Open a file and execute commands:
127
178
  - `:Gibson module abc`
128
- - `:Gibson rewrite models`
129
- - `:Gibson rewrite schemas`
179
+ - `:Gibson code models`
180
+ - `:Gibson code schemas`
130
181
 
131
182
  ## Currently Supported Software
132
183
 
@@ -184,10 +235,9 @@ Note: Gibson currently only supports MySQL. Let us know if you need something el
184
235
 
185
236
  ### Importing Your Datastore
186
237
 
187
- `gibson import datastore`
238
+ `gibson import mysql` or `gibson import pg_dump /path/to/pg_dump.sql` or `gibson import openapi /path/to/openapi.json`
188
239
 
189
240
  - This will make Gibson's stored memory aware of all of your datastore objects.
190
- - `gibson import datastore .. dev`
191
241
  - In addition to making Gibson aware, this will write all of the base, model and schema code for you.
192
242
 
193
243
  ### Configuring a Custom BaseModel
@@ -203,30 +253,30 @@ For example, you might provide class name = `MyBaseModel` and import path = `pro
203
253
 
204
254
  ### Writing the Base Code
205
255
 
206
- `gibson rewrite base`
256
+ `gibson code base`
207
257
 
208
258
  ### Writing the Code for a Single Model
209
259
 
210
- `gibson model [table name]`
260
+ `gibson code model [entity name]`
211
261
 
212
262
  ### Writing the Code for a Single Schema
213
263
 
214
- `gibson schema [table name]`
264
+ `gibson code schema [entity name]`
215
265
 
216
266
  ### Writing the Code for All Models
217
267
 
218
- `gibson rewrite models`
268
+ `gibson code models`
219
269
 
220
270
  ### Writing the Code for All Schemas
221
271
 
222
- `gibson rewrite schemas`
272
+ `gibson code schemas`
223
273
 
224
274
  ### Adding a New Module to the Software Using AI
225
275
 
226
276
  - gibson module [module name]
227
277
  - e.g. gibson module user
228
278
  - Gibson will display the SQL tables it has generated as a result of your request. It will store these entities in its last memory.
229
- - `gibson rewrite models`
279
+ - `gibson code models`
230
280
  - This will write the code for the entities it just created.
231
281
  - `gibson merge`
232
282
  - This will merge the new entities into your project.
@@ -234,10 +284,10 @@ For example, you might provide class name = `MyBaseModel` and import path = `pro
234
284
 
235
285
  ### Making Changes to the Software Using AI
236
286
 
237
- - `gibson modify [table name] [natural language request]`
287
+ - `gibson modify [entity name] [natural language request]`
238
288
  - e.g. `gibson modify my_table I want to add a new column called name and remove all of the columns related to email`
239
289
  - Gibson will display the modified SQL table and store it in its last memory.
240
- - `gibson rewrite models`
290
+ - `gibson code models`
241
291
  - This will write the code for the modified entity.
242
292
  - `gibson merge`
243
293
  - This will merge the modified entity into your project.
@@ -263,7 +313,7 @@ For example, you might provide class name = `MyBaseModel` and import path = `pro
263
313
  - Chat with Gibson and create a new project.
264
314
  - When your project is complete Gibson will email you the API key.
265
315
  - `gibson conf api::key [API key]`
266
- - `gibson import api .. dev`
316
+ - `gibson import api`
267
317
  - Magic, no?
268
318
 
269
319
  ### Integrating a Model into Your Code
@@ -295,26 +345,25 @@ At the moment, just refer to the base-level schema directly.
295
345
 
296
346
  ### Migrating Your Software from PHP to Python
297
347
 
298
- - Configure your datastore.
299
- - Turn on Dev Mode.
300
- - `gibson import datastore .. dev`
301
- - 70% of your code is written, customize the remaining.
348
+ - Configure your datastore
349
+ - Turn on Dev Mode
350
+ - `gibson import mysql` (alternatively import from pg_dump or openapi)
351
+ - 70% of your code is written, customize the remaining
302
352
 
303
353
  ### Asking Gibson Questions With Context
304
354
 
305
- - `gibson ? [natural language request]`
355
+ - `gibson q [natural language request]`
306
356
  - Your natural language request can include:
307
357
  - `file://[full path]` to import a file from the filesystem
308
358
  - `py://[import]` to import a file from `PYTHONPATH`
309
359
  - `sql://[entity name]` to import the SQL
310
360
  - For example:
311
- - `gibson ? format file:///Users/me/file.py for PEP8`
312
- - `gibson ? code review py://user.modules.User`
313
- - `gibson ? add nickname to sql://user`
314
- - When using `sql://`, any entities that are created as part of Gibson's response will be transferred into Gibson's last memory allowing you to execute a question, create a new entity and have Gibson immediately create a model or schema from it.
315
- - e.g. `gibson ? add nickname to sql://user`
316
- - `gibson model`
317
- - Important note, `gibson ?` may cause your shell to incorrectly interpret the question mark. If it does, you can use `gibson q` instead (just replace the question mark with the letter `q`).
361
+ - `gibson q format file:///Users/me/file.py for PEP8`
362
+ - `gibson q code review py://user.modules.User`
363
+ - `gibson q add nickname to sql://user`
364
+ - When using `sql://`, any entities that are created as part of Gibson's response will be transferred into Gibson's last memory allowing you to execute a query, create a new entity and have Gibson immediately create a model or schema from it.
365
+ - e.g. `gibson q add nickname to sql://user`
366
+ - `gibson code model user`
318
367
 
319
368
  ## Contributing
320
369
 
@@ -52,7 +52,7 @@ Let's consider a more concrete example. You imported your datastore into the CLI
52
52
 
53
53
  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:
54
54
 
55
- `gibson rewrite models`
55
+ `gibson code models`
56
56
 
57
57
  The CLI will write the code for what is sitting in last memory.
58
58
 
@@ -108,8 +108,8 @@ All of Gibson's configuration files and caches are stored in `$HOME/.gibson`. Us
108
108
  - `:command! -nargs=* Gibson r ! gibson <args>`
109
109
  - Open a file and execute commands:
110
110
  - `:Gibson module abc`
111
- - `:Gibson rewrite models`
112
- - `:Gibson rewrite schemas`
111
+ - `:Gibson code models`
112
+ - `:Gibson code schemas`
113
113
 
114
114
  ## Currently Supported Software
115
115
 
@@ -167,10 +167,9 @@ Note: Gibson currently only supports MySQL. Let us know if you need something el
167
167
 
168
168
  ### Importing Your Datastore
169
169
 
170
- `gibson import datastore`
170
+ `gibson import mysql` or `gibson import pg_dump /path/to/pg_dump.sql` or `gibson import openapi /path/to/openapi.json`
171
171
 
172
172
  - This will make Gibson's stored memory aware of all of your datastore objects.
173
- - `gibson import datastore .. dev`
174
173
  - In addition to making Gibson aware, this will write all of the base, model and schema code for you.
175
174
 
176
175
  ### Configuring a Custom BaseModel
@@ -186,30 +185,30 @@ For example, you might provide class name = `MyBaseModel` and import path = `pro
186
185
 
187
186
  ### Writing the Base Code
188
187
 
189
- `gibson rewrite base`
188
+ `gibson code base`
190
189
 
191
190
  ### Writing the Code for a Single Model
192
191
 
193
- `gibson model [table name]`
192
+ `gibson code model [entity name]`
194
193
 
195
194
  ### Writing the Code for a Single Schema
196
195
 
197
- `gibson schema [table name]`
196
+ `gibson code schema [entity name]`
198
197
 
199
198
  ### Writing the Code for All Models
200
199
 
201
- `gibson rewrite models`
200
+ `gibson code models`
202
201
 
203
202
  ### Writing the Code for All Schemas
204
203
 
205
- `gibson rewrite schemas`
204
+ `gibson code schemas`
206
205
 
207
206
  ### Adding a New Module to the Software Using AI
208
207
 
209
208
  - gibson module [module name]
210
209
  - e.g. gibson module user
211
210
  - Gibson will display the SQL tables it has generated as a result of your request. It will store these entities in its last memory.
212
- - `gibson rewrite models`
211
+ - `gibson code models`
213
212
  - This will write the code for the entities it just created.
214
213
  - `gibson merge`
215
214
  - This will merge the new entities into your project.
@@ -217,10 +216,10 @@ For example, you might provide class name = `MyBaseModel` and import path = `pro
217
216
 
218
217
  ### Making Changes to the Software Using AI
219
218
 
220
- - `gibson modify [table name] [natural language request]`
219
+ - `gibson modify [entity name] [natural language request]`
221
220
  - e.g. `gibson modify my_table I want to add a new column called name and remove all of the columns related to email`
222
221
  - Gibson will display the modified SQL table and store it in its last memory.
223
- - `gibson rewrite models`
222
+ - `gibson code models`
224
223
  - This will write the code for the modified entity.
225
224
  - `gibson merge`
226
225
  - This will merge the modified entity into your project.
@@ -246,7 +245,7 @@ For example, you might provide class name = `MyBaseModel` and import path = `pro
246
245
  - Chat with Gibson and create a new project.
247
246
  - When your project is complete Gibson will email you the API key.
248
247
  - `gibson conf api::key [API key]`
249
- - `gibson import api .. dev`
248
+ - `gibson import api`
250
249
  - Magic, no?
251
250
 
252
251
  ### Integrating a Model into Your Code
@@ -278,26 +277,25 @@ At the moment, just refer to the base-level schema directly.
278
277
 
279
278
  ### Migrating Your Software from PHP to Python
280
279
 
281
- - Configure your datastore.
282
- - Turn on Dev Mode.
283
- - `gibson import datastore .. dev`
284
- - 70% of your code is written, customize the remaining.
280
+ - Configure your datastore
281
+ - Turn on Dev Mode
282
+ - `gibson import mysql` (alternatively import from pg_dump or openapi)
283
+ - 70% of your code is written, customize the remaining
285
284
 
286
285
  ### Asking Gibson Questions With Context
287
286
 
288
- - `gibson ? [natural language request]`
287
+ - `gibson q [natural language request]`
289
288
  - Your natural language request can include:
290
289
  - `file://[full path]` to import a file from the filesystem
291
290
  - `py://[import]` to import a file from `PYTHONPATH`
292
291
  - `sql://[entity name]` to import the SQL
293
292
  - For example:
294
- - `gibson ? format file:///Users/me/file.py for PEP8`
295
- - `gibson ? code review py://user.modules.User`
296
- - `gibson ? add nickname to sql://user`
297
- - When using `sql://`, any entities that are created as part of Gibson's response will be transferred into Gibson's last memory allowing you to execute a question, create a new entity and have Gibson immediately create a model or schema from it.
298
- - e.g. `gibson ? add nickname to sql://user`
299
- - `gibson model`
300
- - Important note, `gibson ?` may cause your shell to incorrectly interpret the question mark. If it does, you can use `gibson q` instead (just replace the question mark with the letter `q`).
293
+ - `gibson q format file:///Users/me/file.py for PEP8`
294
+ - `gibson q code review py://user.modules.User`
295
+ - `gibson q add nickname to sql://user`
296
+ - When using `sql://`, any entities that are created as part of Gibson's response will be transferred into Gibson's last memory allowing you to execute a query, create a new entity and have Gibson immediately create a model or schema from it.
297
+ - e.g. `gibson q add nickname to sql://user`
298
+ - `gibson code model user`
301
299
 
302
300
  ## Contributing
303
301
 
@@ -0,0 +1,3 @@
1
+ rm -rf build/
2
+ rm -rf dist/
3
+ rm -rf gibson_cli.egg-info/
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import pprint
2
3
 
3
4
  import requests
4
5
 
@@ -96,7 +97,7 @@ class BaseApi:
96
97
  message = r.json()
97
98
  print("=" * 78)
98
99
  print("Raw Response:\n")
99
- print(message)
100
+ pprint.pprint(message)
100
101
  print("\n" + "=" * 78)
101
102
  except requests.exceptions.JSONDecodeError:
102
103
  pass
@@ -66,7 +66,10 @@ class Cli(BaseApi):
66
66
 
67
67
  def headers(self):
68
68
  headers = super().headers()
69
- headers["X-Gibson-API-Key"] = self.configuration.project.api.key
69
+ if self.configuration.project.id:
70
+ headers["X-Gibson-Project-ID"] = self.configuration.project.id
71
+ else:
72
+ headers["X-Gibson-API-Key"] = self.configuration.project.api.key
70
73
  return headers
71
74
 
72
75
  def import_(self):
@@ -157,7 +160,11 @@ class Cli(BaseApi):
157
160
  def modeler_openapi(self, modeler_version, contents):
158
161
  r = self.post(
159
162
  "modeler/openapi",
160
- {"contents": contents, "modeler": {"version": modeler_version}},
163
+ {
164
+ "contents": contents,
165
+ "datastore": {"type": self.configuration.project.datastore.type},
166
+ "modeler": {"version": modeler_version},
167
+ },
161
168
  )
162
169
 
163
170
  return r.json()
@@ -1,5 +1,6 @@
1
1
  import sys
2
2
 
3
+ import sqlalchemy
3
4
  from sqlalchemy import create_engine
4
5
  from sqlalchemy.orm import sessionmaker
5
6
 
@@ -18,11 +19,19 @@ class Build(BaseCommand):
18
19
 
19
20
  self.conversation.type("Connected to datastore...\n")
20
21
 
22
+ if self.configuration.project.datastore.type == "mysql":
23
+ self.__build_mysql(session)
24
+ elif self.configuration.project.datastore.type == "postgresql":
25
+ self.__build_postgresql(session)
26
+
27
+ self.conversation.newline()
28
+
29
+ def __build_mysql(self, session):
21
30
  try:
22
- if self.configuration.project.datastore.type == "mysql":
23
- table_exceptions = TableExceptions().mysql()
24
- session.execute("set foreign_key_checks = 0")
25
- self.conversation.type(" foreign key checks have been disabled\n")
31
+ table_exceptions = TableExceptions().mysql()
32
+
33
+ session.execute("set foreign_key_checks = 0")
34
+ self.conversation.type(" foreign key checks have been disabled\n")
26
35
 
27
36
  tables = session.execute("show tables").all()
28
37
  if len(tables) > 0:
@@ -39,11 +48,54 @@ class Build(BaseCommand):
39
48
  self.conversation.type(f" {entity['name']}\n", delay=0.002)
40
49
  session.execute(entity["definition"])
41
50
  finally:
42
- if self.configuration.project.datastore.type == "mysql":
43
- session.execute("set foreign_key_checks = 1")
44
- self.conversation.type(" foreign key checks have been enabled\n")
51
+ session.execute("set foreign_key_checks = 1")
52
+ self.conversation.type(" foreign key checks have been enabled\n")
53
+
54
+ def __build_postgresql(self, session):
55
+ table_exceptions = TableExceptions().postgresql()
56
+
57
+ schema = list(session.execute("select current_schema()"))[0][0]
58
+ self.conversation.type(f" current schema is {schema}\n")
59
+
60
+ tables = list(
61
+ session.execute(
62
+ """select table_name
63
+ from information_schema.tables
64
+ where table_schema = :table_schema""",
65
+ {"table_schema": schema},
66
+ )
67
+ )
45
68
 
46
- self.conversation.newline()
69
+ if len(tables) > 0:
70
+ self.conversation.type(" dropping existing entities\n")
71
+
72
+ for table in tables:
73
+ self.conversation.type(f" {table[0]}\n", delay=0.002)
74
+ session.execute(f"drop table if exists {schema}.{table[0]} cascade")
75
+ session.commit()
76
+
77
+ self.conversation.type(" building entities\n")
78
+
79
+ tables = {}
80
+ for entity in self.memory.entities:
81
+ tables[entity["name"]] = entity["definition"]
82
+
83
+ while tables != {}:
84
+ remove = []
85
+ for name, definition in tables.items():
86
+
87
+ try:
88
+ session.execute(definition)
89
+ session.commit()
90
+
91
+ self.conversation.type(f' {name.split(".")[-1]}\n', delay=0.002)
92
+
93
+ remove.append(name)
94
+ except sqlalchemy.exc.ProgrammingError:
95
+ session.rollback()
96
+
97
+ for name in remove:
98
+ del tables[name]
47
99
 
48
100
  def execute(self):
49
101
  if len(sys.argv) != 3 or sys.argv[2] != "datastore":
@@ -48,10 +48,6 @@ class Help(BaseCommand):
48
48
  "description": "move last changes into project",
49
49
  "memory": "last -> stored",
50
50
  },
51
- "model": {
52
- "description": "write the model code for an entity",
53
- "memory": "stored",
54
- },
55
51
  "modify": {
56
52
  "description": "change an entity using natural language",
57
53
  "memory": "last > stored",
@@ -69,15 +65,7 @@ class Help(BaseCommand):
69
65
  "description": "rewrite code",
70
66
  "memory": "stored",
71
67
  },
72
- "schema": {
73
- "description": "write the schema code for an entity",
74
- "memory": "stored",
75
- },
76
68
  "show": {"description": "display an entity", "memory": "last > stored"},
77
- "test": {
78
- "description": "write the unit tests for an entity",
79
- "memory": "stored",
80
- },
81
69
  "tree": {"description": "illustrate the project layout", "memory": None},
82
70
  "q": {"description": "ask Gibson a question", "memory": None},
83
71
  }
@@ -28,7 +28,10 @@ class Question(BaseCommand):
28
28
  with open(path, "r") as f:
29
29
  contents = f.read()
30
30
  except FileNotFoundError:
31
- self.__file_not_found(path)
31
+ self.configuration.display_project()
32
+ self.conversation.file_not_found(path)
33
+ self.conversation.newline()
34
+ exit(1)
32
35
 
33
36
  has_file = True
34
37
  instructions += f"\n\n{contents}\n\n"
@@ -81,12 +84,6 @@ class Question(BaseCommand):
81
84
 
82
85
  self.conversation.newline()
83
86
 
84
- def __file_not_found(self, path):
85
- self.configuration.display_project()
86
- self.conversation.type(f'404, My Friend. Cannot find file "{path}".\n')
87
- self.conversation.newline()
88
- exit(1)
89
-
90
87
  def __python_import_not_found(self, import_):
91
88
  self.configuration.display_project()
92
89
  self.conversation.type(f'That\'s a misfire, "{import_}" does not exist.\n')
@@ -0,0 +1,72 @@
1
+ import sys
2
+
3
+ import gibson.core.Colors as Colors
4
+ from gibson.command.BaseCommand import BaseCommand
5
+ from gibson.command.code.Api import Api as CodeApi
6
+ from gibson.command.code.Base import Base as CodeBase
7
+ from gibson.command.code.Entity import Entity as CodeEntity
8
+ from gibson.command.code.Model import Model as CodeModel
9
+ from gibson.command.code.Models import Models as CodeModels
10
+ from gibson.command.code.Schema import Schema as CodeSchema
11
+ from gibson.command.code.Schemas import Schemas as CodeSchemas
12
+ from gibson.command.code.Test import Test as CodeTest
13
+ from gibson.command.code.Tests import Tests as CodeTests
14
+
15
+
16
+ class Code(BaseCommand):
17
+ def execute(self):
18
+ if len(sys.argv) == 3 and sys.argv[2] == "api":
19
+ CodeApi(self.configuration).execute()
20
+ elif len(sys.argv) == 3 and sys.argv[2] == "base":
21
+ CodeBase(self.configuration).execute()
22
+ elif len(sys.argv) == 4 and sys.argv[2] == "entity":
23
+ CodeEntity(self.configuration).execute()
24
+ elif len(sys.argv) == 3 and sys.argv[2] == "models":
25
+ CodeModels(self.configuration).execute()
26
+ elif len(sys.argv) == 4 and sys.argv[2] == "models":
27
+ CodeModel(self.configuration).execute()
28
+ elif len(sys.argv) == 3 and sys.argv[2] == "schemas":
29
+ CodeSchemas(self.configuration).execute()
30
+ elif len(sys.argv) == 4 and sys.argv[2] == "schemas":
31
+ CodeSchema(self.configuration).execute()
32
+ elif len(sys.argv) == 3 and sys.argv[2] == "tests":
33
+ CodeTests(self.configuration).execute()
34
+ elif len(sys.argv) == 4 and sys.argv[2] == "tests":
35
+ CodeTest(self.configuration).execute()
36
+ else:
37
+ self.usage()
38
+
39
+ def usage(self):
40
+ self.configuration.display_project()
41
+ self.conversation.type(
42
+ f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.arguments(['api', 'base', 'entity', 'models', 'schemas', 'tests'])} {Colors.input('[entity name]')} {Colors.hint('write code')}\n"
43
+ )
44
+ self.conversation.type(
45
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('api')} {Colors.hint('generate the API code')}\n"
46
+ )
47
+ self.conversation.type(
48
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('base')} {Colors.hint('generate the base code')}\n"
49
+ )
50
+ self.conversation.type(
51
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('entity')} {Colors.input('[entity name]')} {Colors.hint('create or update an entity using the AI pair programmer')}\n"
52
+ )
53
+ self.conversation.type(
54
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('models')} {Colors.hint('generate the models for all entities')}\n"
55
+ )
56
+ self.conversation.type(
57
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('models')} {Colors.input('[entity name]')} {Colors.hint('generate the model(s) for a single entity')}\n"
58
+ )
59
+ self.conversation.type(
60
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('schemas')} {Colors.hint('generate the schemas for all entities')}\n"
61
+ )
62
+ self.conversation.type(
63
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('schemas')} {Colors.input('[entity name]')} {Colors.hint('generate the schema(s) for a single entity')}\n"
64
+ )
65
+ self.conversation.type(
66
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('tests')} {Colors.hint('generate the unit tests for all entities')}\n"
67
+ )
68
+ self.conversation.type(
69
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('tests')} {Colors.input('[entity name]')} {Colors.hint('generate the unit tests for a single entity')}\n"
70
+ )
71
+ self.conversation.newline()
72
+ exit(1)
@@ -14,10 +14,10 @@ from gibson.display.WorkspaceHeader import WorkspaceHeader
14
14
  from gibson.services.code.context.schema.Manager import (
15
15
  Manager as CodeContextSchemaManager,
16
16
  )
17
- from gibson.structure.Entity import Entity
17
+ from gibson.structure.Entity import Entity as StructureEntity
18
18
 
19
19
 
20
- class CodeEntity(BaseCommand):
20
+ class Entity(BaseCommand):
21
21
  CODE_WRITER_ENTITY_MODIFIER_NOOP = ""
22
22
 
23
23
  def __init__(self, configuration: Configuration):
@@ -96,7 +96,11 @@ class CodeEntity(BaseCommand):
96
96
  definition,
97
97
  self.CODE_WRITER_ENTITY_MODIFIER_NOOP,
98
98
  )
99
- entity = Entity().import_from_struct(data)
99
+ entity = (
100
+ StructureEntity()
101
+ .instantiate(self.configuration.project.datastore.type)
102
+ .import_from_struct(data)
103
+ )
100
104
 
101
105
  while True:
102
106
  self.__render_workspace(entity, data["code"][0]["definition"])
@@ -147,15 +151,29 @@ class CodeEntity(BaseCommand):
147
151
  entity.create_statement(),
148
152
  input_,
149
153
  )
150
- entity = Entity().import_from_struct(data)
154
+ entity = (
155
+ StructureEntity()
156
+ .instantiate(self.configuration.project.datastore.type)
157
+ .import_from_struct(data)
158
+ )
151
159
 
152
160
  def get_default_ref_table_template_path(self):
153
- return os.path.dirname(__file__) + "/../../data/default-ref-table.tmpl"
161
+ return (
162
+ os.path.dirname(__file__)
163
+ + "/../../data/"
164
+ + self.configuration.project.datastore.type
165
+ + "/default-ref-table.tmpl"
166
+ )
154
167
 
155
168
  def get_default_table_template_path(self):
156
- return os.path.dirname(__file__) + "/../../data/default-table.tmpl"
169
+ return (
170
+ os.path.dirname(__file__)
171
+ + "/../../data/"
172
+ + self.configuration.project.datastore.type
173
+ + "/default-table.tmpl"
174
+ )
157
175
 
158
- def __render_workspace(self, entity: Entity, model):
176
+ def __render_workspace(self, entity: StructureEntity, model):
159
177
  self.configuration.platform.cmd_clear()
160
178
 
161
179
  print("")
@@ -7,7 +7,7 @@ from gibson.core.TimeKeeper import TimeKeeper
7
7
  from gibson.dev.Dev import Dev
8
8
 
9
9
 
10
- class CodeModel(BaseCommand):
10
+ class Model(BaseCommand):
11
11
  def execute(self):
12
12
  self.configuration.require_project()
13
13
  entity = self.memory.recall_stored_entity(sys.argv[3])
@@ -7,7 +7,7 @@ from gibson.core.TimeKeeper import TimeKeeper
7
7
  from gibson.dev.Dev import Dev
8
8
 
9
9
 
10
- class CodeSchema(BaseCommand):
10
+ class Schema(BaseCommand):
11
11
  def execute(self):
12
12
  self.configuration.require_project()
13
13
  entity = self.memory.recall_stored_entity(sys.argv[3])