gibson-cli 0.5.8__tar.gz → 0.6.1__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 (130) hide show
  1. {gibson_cli-0.5.8/gibson_cli.egg-info → gibson_cli-0.6.1}/PKG-INFO +52 -1
  2. gibson_cli-0.6.1/bin/clean.sh +3 -0
  3. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/Help.py +2 -3
  4. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/Show.py +2 -4
  5. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/auth/Auth.py +5 -2
  6. gibson_cli-0.6.1/gibson/command/code/Code.py +42 -0
  7. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/code/Entity.py +2 -1
  8. {gibson_cli-0.5.8/gibson/command → gibson_cli-0.6.1/gibson/command/code}/Model.py +8 -14
  9. {gibson_cli-0.5.8/gibson/command → gibson_cli-0.6.1/gibson/command/code}/Schema.py +8 -14
  10. gibson_cli-0.5.8/gibson/command/Test.py → gibson_cli-0.6.1/gibson/command/code/Tests.py +8 -14
  11. {gibson_cli-0.5.8/gibson/command → gibson_cli-0.6.1/gibson/command/importer}/Import.py +14 -26
  12. {gibson_cli-0.5.8/gibson/command → gibson_cli-0.6.1/gibson/command/importer}/OpenApi.py +2 -14
  13. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/list/List.py +5 -2
  14. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/new/New.py +4 -6
  15. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/rewrite/Rewrite.py +1 -1
  16. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/core/Colors.py +20 -0
  17. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/core/CommandRouter.py +3 -17
  18. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/core/Memory.py +2 -2
  19. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/core/TimeKeeper.py +3 -1
  20. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/data/bash-completion.tmpl +2 -7
  21. {gibson_cli-0.5.8 → gibson_cli-0.6.1/gibson_cli.egg-info}/PKG-INFO +52 -1
  22. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson_cli.egg-info/SOURCES.txt +7 -5
  23. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/pyproject.toml +5 -1
  24. gibson_cli-0.6.1/requirements.txt +51 -0
  25. gibson_cli-0.5.8/gibson/command/code/Code.py +0 -26
  26. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/.gitignore +0 -0
  27. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/.pre-commit-config.yaml +0 -0
  28. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/README.md +0 -0
  29. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/bin/build.sh +0 -0
  30. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/bin/release.sh +0 -0
  31. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/api/BaseApi.py +0 -0
  32. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/api/Cli.py +0 -0
  33. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/api/ProjectApi.py +0 -0
  34. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/bin/gibson.py +0 -0
  35. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/BaseCommand.py +0 -0
  36. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/Build.py +0 -0
  37. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/Conf.py +0 -0
  38. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/Count.py +0 -0
  39. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/Dev.py +0 -0
  40. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/Forget.py +0 -0
  41. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/Merge.py +0 -0
  42. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/Modify.py +0 -0
  43. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/Question.py +0 -0
  44. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/Remove.py +0 -0
  45. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/Tree.py +0 -0
  46. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/Version.py +0 -0
  47. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/WarGames.py +0 -0
  48. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/auth/Login.py +0 -0
  49. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/auth/Logout.py +0 -0
  50. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/list/Entities.py +0 -0
  51. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/list/Projects.py +0 -0
  52. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/new/Module.py +0 -0
  53. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/new/Project.py +0 -0
  54. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/rename/Entity.py +0 -0
  55. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/rename/Rename.py +0 -0
  56. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/rewrite/Api.py +0 -0
  57. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/rewrite/Base.py +0 -0
  58. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/rewrite/Models.py +0 -0
  59. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/rewrite/Schemas.py +0 -0
  60. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/rewrite/Tests.py +0 -0
  61. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/tests/test_command_BaseCommand.py +0 -0
  62. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/command/tests/test_command_Conf.py +0 -0
  63. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/Api.py +0 -0
  64. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/Code.py +0 -0
  65. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/Custom.py +0 -0
  66. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/Datastore.py +0 -0
  67. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/Dependencies.py +0 -0
  68. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/Dev.py +0 -0
  69. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/Frameworks.py +0 -0
  70. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/Modeler.py +0 -0
  71. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/Paths.py +0 -0
  72. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/Platform.py +0 -0
  73. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/Project.py +0 -0
  74. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/Version.py +0 -0
  75. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/dev/Api.py +0 -0
  76. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/dev/Base.py +0 -0
  77. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/dev/Model.py +0 -0
  78. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/dev/Schema.py +0 -0
  79. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/tests/test_conf_Dependencies.py +0 -0
  80. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/conf/tests/test_conf_Platform.py +0 -0
  81. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/core/Completions.py +0 -0
  82. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/core/Configuration.py +0 -0
  83. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/core/Conversation.py +0 -0
  84. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/core/Env.py +0 -0
  85. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/core/PythonPath.py +0 -0
  86. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/core/utils.py +0 -0
  87. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/data/default-ref-table.tmpl +0 -0
  88. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/data/default-table.tmpl +0 -0
  89. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/db/TableExceptions.py +0 -0
  90. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/db/tests/test_db_TableExceptions.py +0 -0
  91. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/dev/Dev.py +0 -0
  92. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/display/Header.py +0 -0
  93. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/display/WorkspaceFooter.py +0 -0
  94. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/display/WorkspaceHeader.py +0 -0
  95. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/display/tests/test_display_Header.py +0 -0
  96. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/display/tests/test_display_WorkspaceFooter.py +0 -0
  97. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/display/tests/test_display_WorkspaceHeader.py +0 -0
  98. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/lang/Python.py +0 -0
  99. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/lang/tests/test_lang_Python.py +0 -0
  100. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/services/auth/Server.py +0 -0
  101. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/services/code/context/schema/DataDictionary.py +0 -0
  102. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/services/code/context/schema/EntityKeys.py +0 -0
  103. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/services/code/context/schema/Manager.py +0 -0
  104. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/services/code/context/schema/tests/test_code_context_schema_DataDictionary.py +0 -0
  105. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/services/code/context/schema/tests/test_code_context_schema_EntityKeys.py +0 -0
  106. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/services/code/context/schema/tests/test_code_context_schema_Manager.py +0 -0
  107. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/services/code/customization/Authenticator.py +0 -0
  108. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/services/code/customization/BaseCustomization.py +0 -0
  109. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/services/code/customization/CustomizationManager.py +0 -0
  110. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/services/code/customization/Index.py +0 -0
  111. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/services/code/customization/tests/test_code_customization_Authenticator.py +0 -0
  112. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/services/code/customization/tests/test_code_customization_BaseCustomization.py +0 -0
  113. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/structure/Entity.py +0 -0
  114. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/structure/constraints/ReferenceConstraint.py +0 -0
  115. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/structure/keys/ForeignKey.py +0 -0
  116. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/structure/keys/Index.py +0 -0
  117. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/structure/keys/IndexAttribute.py +0 -0
  118. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/structure/keys/tests/test_ForeignKey.py +0 -0
  119. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/structure/keys/tests/test_Index.py +0 -0
  120. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/structure/keys/tests/test_IndexAttribute.py +0 -0
  121. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/structure/testing.py +0 -0
  122. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/structure/tests/test_Entity.py +0 -0
  123. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/tests/test_Env.py +0 -0
  124. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/tests/test_Memory.py +0 -0
  125. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson/tests/test_utils.py +0 -0
  126. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson_cli.egg-info/dependency_links.txt +0 -0
  127. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson_cli.egg-info/entry_points.txt +0 -0
  128. /gibson_cli-0.5.8/requirements.txt → /gibson_cli-0.6.1/gibson_cli.egg-info/requires.txt +0 -0
  129. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/gibson_cli.egg-info/top_level.txt +0 -0
  130. {gibson_cli-0.5.8 → gibson_cli-0.6.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gibson-cli
3
- Version: 0.5.8
3
+ Version: 0.6.1
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/)
@@ -0,0 +1,3 @@
1
+ rm -rf build/
2
+ rm -rf dist/
3
+ rm -rf gibson_cli.egg-info/
@@ -37,7 +37,7 @@ class Help(BaseCommand):
37
37
  },
38
38
  "help": {"description": "for help", "memory": None},
39
39
  "import": {
40
- "description": "configure from a data source",
40
+ "description": "import entities from a data source",
41
41
  "memory": "stored",
42
42
  },
43
43
  "list": {
@@ -57,7 +57,6 @@ class Help(BaseCommand):
57
57
  "memory": "last > stored",
58
58
  },
59
59
  "new": {"description": "create something new", "memory": None},
60
- "openapi": {"description": "build from an OpenAPI spec", "memory": "last"},
61
60
  "remove": {
62
61
  "description": "remove an entity from the project",
63
62
  "memory": "last > stored",
@@ -80,7 +79,7 @@ class Help(BaseCommand):
80
79
  "memory": "stored",
81
80
  },
82
81
  "tree": {"description": "illustrate the project layout", "memory": None},
83
- "? | q": {"description": "ask a question", "memory": None},
82
+ "q": {"description": "ask Gibson a question", "memory": None},
84
83
  }
85
84
 
86
85
  self.conversation.set_delay(0.001)
@@ -26,9 +26,7 @@ class Show(BaseCommand):
26
26
  self.usage()
27
27
 
28
28
  for entity in sorted(entities, key=lambda x: x["name"]):
29
- statement = entity["definition"].replace(
30
- entity["name"], Colors.argument(entity["name"]), 1
31
- )
29
+ statement = Colors.table(entity["definition"], entity["name"])
32
30
  print(f"\n{statement}")
33
31
 
34
32
  def usage(self):
@@ -37,7 +35,7 @@ class Show(BaseCommand):
37
35
  f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('show')} {Colors.hint('display the entire schema')}\n"
38
36
  )
39
37
  self.conversation.type(
40
- f" or: {Colors.command(self.configuration.command)} {Colors.subcommand('show')} {Colors.argument('[entity name]')} {Colors.hint('display the schema for an entity')}\n"
38
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('show')} {Colors.argument('[entity name]')} {Colors.hint('display the schema for an entity')}\n"
41
39
  )
42
40
  self.conversation.newline()
43
41
  exit(1)
@@ -20,10 +20,13 @@ class Auth(BaseCommand):
20
20
  def usage(self):
21
21
  self.configuration.display_project()
22
22
  self.conversation.type(
23
- f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('auth')} {Colors.argument('login')} {Colors.hint('login to Gibson')}\n"
23
+ f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('auth')} {Colors.arguments(['login', 'logout'])}\n"
24
24
  )
25
25
  self.conversation.type(
26
- f" or: {Colors.command(self.configuration.command)} {Colors.subcommand('auth')} {Colors.argument('logout')} {Colors.hint('logout of Gibson')}\n"
26
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('auth')} {Colors.argument('login')} {Colors.hint('login to Gibson')}\n"
27
+ )
28
+ self.conversation.type(
29
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('auth')} {Colors.argument('logout')} {Colors.hint('logout of Gibson')}\n"
27
30
  )
28
31
  self.conversation.newline()
29
32
  exit(1)
@@ -0,0 +1,42 @@
1
+ import sys
2
+
3
+ import gibson.core.Colors as Colors
4
+ from gibson.command.BaseCommand import BaseCommand
5
+ from gibson.command.code.Entity import CodeEntity
6
+ from gibson.command.code.Model import CodeModel
7
+ from gibson.command.code.Schema import CodeSchema
8
+ from gibson.command.code.Tests import CodeTests
9
+
10
+
11
+ class Code(BaseCommand):
12
+ def execute(self):
13
+ if len(sys.argv) == 4 and sys.argv[2] == "entity":
14
+ CodeEntity(self.configuration).execute()
15
+ elif len(sys.argv) == 4 and sys.argv[2] == "model":
16
+ CodeModel(self.configuration).execute()
17
+ elif len(sys.argv) == 4 and sys.argv[2] == "schema":
18
+ CodeSchema(self.configuration).execute()
19
+ elif len(sys.argv) == 4 and sys.argv[2] == "tests":
20
+ CodeTests(self.configuration).execute()
21
+ else:
22
+ self.usage()
23
+
24
+ def usage(self):
25
+ self.configuration.display_project()
26
+ self.conversation.type(
27
+ f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.arguments(['entity', 'model', 'schema', 'tests'])} {Colors.input('[entity name]')} {Colors.hint('write code')}\n"
28
+ )
29
+ self.conversation.type(
30
+ 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"
31
+ )
32
+ self.conversation.type(
33
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('model')} {Colors.input('[entity name]')} {Colors.hint('generate the model code for an entity')}\n"
34
+ )
35
+ self.conversation.type(
36
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('schema')} {Colors.input('[entity name]')} {Colors.hint('generate the schema code for an entity')}\n"
37
+ )
38
+ self.conversation.type(
39
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('code')} {Colors.argument('tests')} {Colors.input('[entity name]')} {Colors.hint('generate the unit tests for an entity')}\n"
40
+ )
41
+ self.conversation.newline()
42
+ exit(1)
@@ -2,6 +2,7 @@ import os
2
2
  import sys
3
3
  from string import Template
4
4
 
5
+ import gibson.core.Colors as Colors
5
6
  from gibson.api.Cli import Cli
6
7
  from gibson.command.BaseCommand import BaseCommand
7
8
  from gibson.command.Merge import Merge
@@ -163,7 +164,7 @@ class CodeEntity(BaseCommand):
163
164
  print("")
164
165
  print(Header().render("SQL"))
165
166
  print("")
166
- print(entity.create_statement())
167
+ print(Colors.table(entity.create_statement(), entity.name))
167
168
 
168
169
  print("")
169
170
  print(Header().render("Model"))
@@ -7,16 +7,13 @@ from gibson.core.TimeKeeper import TimeKeeper
7
7
  from gibson.dev.Dev import Dev
8
8
 
9
9
 
10
- class Model(BaseCommand):
10
+ class CodeModel(BaseCommand):
11
11
  def execute(self):
12
- if len(sys.argv) != 3:
13
- self.usage()
14
-
15
12
  self.configuration.require_project()
16
- entity = self.memory.recall_stored_entity(sys.argv[2])
13
+ entity = self.memory.recall_stored_entity(sys.argv[3])
17
14
  if entity is None:
18
15
  self.conversation.not_sure_no_entity(
19
- self.configuration.project.name, sys.argv[2]
16
+ self.configuration.project.name, sys.argv[3]
20
17
  )
21
18
  exit(1)
22
19
 
@@ -29,13 +26,10 @@ class Model(BaseCommand):
29
26
  response["code"][0]["entity"]["name"], response["code"][0]["definition"]
30
27
  )
31
28
 
29
+ if self.configuration.project.dev.active is True:
30
+ self.conversation.type(
31
+ f"Gibson wrote the following {Colors.argument('model')} code to your project:\n"
32
+ )
33
+
32
34
  print(response["code"][0]["definition"])
33
35
  time_keeper.display()
34
-
35
- def usage(self):
36
- self.configuration.display_project()
37
- self.conversation.type(
38
- f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('model')} {Colors.input('[entity name]')} {Colors.hint('generate the model for an entity')}\n"
39
- )
40
- self.conversation.newline()
41
- exit(1)
@@ -7,16 +7,13 @@ from gibson.core.TimeKeeper import TimeKeeper
7
7
  from gibson.dev.Dev import Dev
8
8
 
9
9
 
10
- class Schema(BaseCommand):
10
+ class CodeSchema(BaseCommand):
11
11
  def execute(self):
12
- if len(sys.argv) != 3:
13
- self.usage()
14
-
15
12
  self.configuration.require_project()
16
- entity = self.memory.recall_stored_entity(sys.argv[2])
13
+ entity = self.memory.recall_stored_entity(sys.argv[3])
17
14
  if entity is None:
18
15
  self.conversation.not_sure_no_entity(
19
- self.configuration.project.name, sys.argv[2]
16
+ self.configuration.project.name, sys.argv[3]
20
17
  )
21
18
  exit(1)
22
19
 
@@ -29,13 +26,10 @@ class Schema(BaseCommand):
29
26
  response["code"][0]["entity"]["name"], response["code"][0]["definition"]
30
27
  )
31
28
 
29
+ if self.configuration.project.dev.active is True:
30
+ self.conversation.type(
31
+ f"Gibson wrote the following {Colors.argument('schema')} code to your project:\n"
32
+ )
33
+
32
34
  print(response["code"][0]["definition"])
33
35
  time_keeper.display()
34
-
35
- def usage(self):
36
- self.configuration.display_project()
37
- self.conversation.type(
38
- f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('schema')} {Colors.argument('[entity name]')} {Colors.hint('write the schema code for an entity')}\n"
39
- )
40
- self.conversation.newline()
41
- exit(1)
@@ -7,16 +7,13 @@ from gibson.core.TimeKeeper import TimeKeeper
7
7
  from gibson.dev.Dev import Dev
8
8
 
9
9
 
10
- class Test(BaseCommand):
10
+ class CodeTests(BaseCommand):
11
11
  def execute(self):
12
- if len(sys.argv) != 3:
13
- self.usage()
14
-
15
12
  self.configuration.require_project()
16
- entity = self.memory.recall_stored_entity(sys.argv[2])
13
+ entity = self.memory.recall_stored_entity(sys.argv[3])
17
14
  if entity is None:
18
15
  self.conversation.not_sure_no_entity(
19
- self.configuration.project.name, sys.argv[2]
16
+ self.configuration.project.name, sys.argv[3]
20
17
  )
21
18
  exit(1)
22
19
 
@@ -29,13 +26,10 @@ class Test(BaseCommand):
29
26
  response["code"][0]["entity"]["name"], response["code"][0]["definition"]
30
27
  )
31
28
 
29
+ if self.configuration.project.dev.active is True:
30
+ self.conversation.type(
31
+ f"Gibson wrote the following {Colors.argument('tests')} to your project:\n"
32
+ )
33
+
32
34
  print(response["code"][0]["definition"])
33
35
  time_keeper.display()
34
-
35
- def usage(self):
36
- self.configuration.display_project()
37
- self.conversation.type(
38
- f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('test')} {Colors.argument('[entity name]')} {Colors.hint('write the unit tests for an entity')}\n"
39
- )
40
- self.conversation.newline()
41
- exit(1)
@@ -6,44 +6,30 @@ from sqlalchemy.orm import sessionmaker
6
6
  import gibson.core.Colors as Colors
7
7
  from gibson.api.Cli import Cli
8
8
  from gibson.command.BaseCommand import BaseCommand
9
+ from gibson.command.importer.OpenApi import OpenApi
9
10
  from gibson.command.rewrite.Rewrite import Rewrite
10
11
  from gibson.db.TableExceptions import TableExceptions
11
12
 
12
13
 
13
14
  class Import(BaseCommand):
14
15
  def execute(self):
15
- if len(sys.argv) != 3 and len(sys.argv) != 5:
16
- self.usage()
17
-
18
16
  self.configuration.require_project()
19
17
  write_code = False
20
- if len(sys.argv) == 5:
21
- if sys.argv[3] != ".." or sys.argv[4] != "dev":
22
- self.usage()
23
-
24
- if self.configuration.project.dev.active is False:
25
- self.configuration.display_project()
26
- self.conversation.type(
27
- "Dude, seriously?! You have Dev Mode turned off. "
28
- + "Why would you do that?\n"
29
- )
30
- self.conversation.newline()
31
- exit(1)
32
-
33
- write_code = True
34
18
 
35
- if sys.argv[2] == "api":
19
+ if len(sys.argv) == 3 and sys.argv[2] == "api":
36
20
  entities = self.__import_from_api()
37
- elif sys.argv[2] == "datastore":
21
+ write_code = self.configuration.project.dev.active
22
+ elif len(sys.argv) == 3 and sys.argv[2] == "datastore":
38
23
  entities = self.__import_from_datastore()
24
+ write_code = self.configuration.project.dev.active
25
+ elif len(sys.argv) == 4 and sys.argv[2] == "openapi":
26
+ return OpenApi(self.configuration).execute()
39
27
  else:
40
28
  self.usage()
41
29
 
42
30
  self.memory.remember_entities(entities)
43
31
 
44
- word_entities = "entities"
45
- if len(entities) == 1:
46
- word_entities = "entity"
32
+ word_entities = "entity" if len(entities) == 1 else "entities"
47
33
 
48
34
  self.conversation.type("\nSummary\n")
49
35
  self.conversation.type(f" {len(entities)} {word_entities} imported\n")
@@ -62,7 +48,6 @@ class Import(BaseCommand):
62
48
  response = Cli(self.configuration).import_()
63
49
  self.conversation.type("Building schema...\n")
64
50
 
65
- entities = []
66
51
  for entity in response["project"]["entities"]:
67
52
  self.conversation.type(f" {entity['name']}\n", delay=0.002)
68
53
 
@@ -106,13 +91,16 @@ class Import(BaseCommand):
106
91
  else ""
107
92
  )
108
93
  self.conversation.type(
109
- f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('import')} {Colors.argument('api')} {Colors.hint('import all entities from your project created on GibsonAI.com')}\n"
94
+ f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('import')} {Colors.arguments(['api', 'datastore', 'openapi'])} {Colors.hint('import entities')}\n"
95
+ )
96
+ self.conversation.type(
97
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('import')} {Colors.argument('api')} {Colors.hint(f'import all entities from your project created on {Colors.link(self.configuration.app_domain())}')}\n"
110
98
  )
111
99
  self.conversation.type(
112
- f" or: {Colors.command(self.configuration.command)} {Colors.subcommand('import')} {Colors.argument('datastore')} {Colors.hint('import all entities from your local datastore')} {datastore_uri}\n"
100
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('import')} {Colors.argument('datastore')} {Colors.hint('import all entities from your local datastore')} {Colors.link(datastore_uri)}\n"
113
101
  )
114
102
  self.conversation.type(
115
- f" or: {Colors.command(self.configuration.command)} {Colors.subcommand('import')} {Colors.arguments(['api', 'datastore'])} {Colors.option('.. dev')} {Colors.hint('have dev mode write all the code')}\n"
103
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('import')} {Colors.argument('openapi')} {Colors.input('path/to/openapi.json')} {Colors.hint('import all entities from an OpenAPI spec file')}\n"
116
104
  )
117
105
  self.conversation.newline()
118
106
  exit(1)
@@ -2,7 +2,6 @@ import json
2
2
  import re
3
3
  import sys
4
4
 
5
- import gibson.core.Colors as Colors
6
5
  from gibson.api.Cli import Cli
7
6
  from gibson.command.BaseCommand import BaseCommand
8
7
 
@@ -17,11 +16,8 @@ class OpenApi(BaseCommand):
17
16
  exit(1)
18
17
 
19
18
  def execute(self):
20
- if len(sys.argv) != 3:
21
- self.usage()
22
-
23
19
  try:
24
- with open(sys.argv[2], "r") as f:
20
+ with open(sys.argv[3], "r") as f:
25
21
  contents = json.loads(f.read())
26
22
  except FileNotFoundError:
27
23
  self.file_not_found()
@@ -119,7 +115,7 @@ class OpenApi(BaseCommand):
119
115
  def file_not_found(self):
120
116
  self.configuration.display_project()
121
117
  self.conversation.type(
122
- f'Well that embarrassing. There is no file "{sys.argv[2]}".\n'
118
+ f'Well that embarrassing. There is no file "{sys.argv[3]}".\n'
123
119
  )
124
120
  self.conversation.newline()
125
121
  exit(1)
@@ -131,11 +127,3 @@ class OpenApi(BaseCommand):
131
127
  )
132
128
  self.conversation.newline()
133
129
  exit(1)
134
-
135
- def usage(self):
136
- self.configuration.display_project()
137
- self.conversation.type(
138
- f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('openapi')} {Colors.input('[file path]')} {Colors.hint('import entities from an OpenAPI spec file')}\n"
139
- )
140
- self.conversation.newline()
141
- exit(1)
@@ -18,10 +18,13 @@ class List(BaseCommand):
18
18
  def usage(self):
19
19
  self.configuration.display_project()
20
20
  self.conversation.type(
21
- f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('list')} {Colors.arguments(['entities'])} {Colors.hint('list all entities')}\n"
21
+ f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('list')} {Colors.arguments(['entities', 'projects'])}\n"
22
22
  )
23
23
  self.conversation.type(
24
- f" or: {Colors.command(self.configuration.command)} {Colors.subcommand('list')} {Colors.arguments(['projects'])} {Colors.hint('list all projects')}\n"
24
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('list')} {Colors.argument('entities')} {Colors.hint('list all entities')}\n"
25
+ )
26
+ self.conversation.type(
27
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('list')} {Colors.argument('projects')} {Colors.hint('list all projects')}\n"
25
28
  )
26
29
  self.conversation.newline()
27
30
  exit(1)
@@ -9,13 +9,11 @@ from gibson.command.new.Project import NewProject
9
9
 
10
10
  class New(BaseCommand):
11
11
  def execute(self):
12
- if not len(sys.argv) >= 3:
13
- self.usage()
14
- elif sys.argv[2] == "project":
12
+ if len(sys.argv) == 3 and sys.argv[2] == "project":
15
13
  NewProject(self.configuration).execute()
16
- elif sys.argv[2] == "module":
14
+ elif len(sys.argv) == 3 and sys.argv[2] == "module":
17
15
  NewModule(self.configuration).execute()
18
- elif sys.argv[2] == "entity":
16
+ elif len(sys.argv) == 4 and sys.argv[2] == "entity":
19
17
  CodeEntity(self.configuration).execute()
20
18
  else:
21
19
  self.usage()
@@ -32,7 +30,7 @@ class New(BaseCommand):
32
30
  f" {Colors.command(self.configuration.command)} {Colors.subcommand('new')} {Colors.argument('module')} {Colors.hint('create a new module')}\n"
33
31
  )
34
32
  self.conversation.type(
35
- f" {Colors.command(self.configuration.command)} {Colors.subcommand('new')} {Colors.argument('entity')} {Colors.hint('create a new entity')}\n"
33
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('new')} {Colors.argument('entity')} {Colors.input('[entity name]')} {Colors.hint('create a new entity')}\n"
36
34
  )
37
35
  self.conversation.newline()
38
36
  exit(1)
@@ -121,7 +121,7 @@ class Rewrite(BaseCommand):
121
121
  f"usage: {Colors.command(self.configuration.command)} {Colors.subcommand('rewrite')} {Colors.hint('rewrite all code')}\n"
122
122
  )
123
123
  self.conversation.type(
124
- f" or: {Colors.command(self.configuration.command)} {Colors.subcommand('rewrite')} {Colors.arguments(self.arguments)} {Colors.hint('rewrite only the specified code')}\n"
124
+ f" {Colors.command(self.configuration.command)} {Colors.subcommand('rewrite')} {Colors.arguments(self.arguments)} {Colors.hint('rewrite only the specified code')}\n"
125
125
  )
126
126
  self.conversation.newline()
127
127
  exit(1)
@@ -40,41 +40,61 @@ class Color:
40
40
  YELLOW2 = "\033[93m"
41
41
 
42
42
 
43
+ # Colorize text with a given color
43
44
  def colorize(text, color):
44
45
  return f"{color}{text}{Color.END}"
45
46
 
46
47
 
48
+ # Colorize a command
47
49
  def command(text):
48
50
  return colorize(text, Color.GREEN)
49
51
 
50
52
 
53
+ # Colorize a subcommand
51
54
  def subcommand(text):
52
55
  return colorize(text, Color.YELLOW)
53
56
 
54
57
 
58
+ # Colorize an argument
55
59
  def argument(text):
56
60
  return colorize(text, Color.VIOLET)
57
61
 
58
62
 
63
+ # Colorize a list of arguments
59
64
  def arguments(list):
60
65
  return f"[{'|'.join(map(lambda x: argument(x), list))}]"
61
66
 
62
67
 
68
+ # Colorize user input
63
69
  def input(text):
64
70
  return colorize(text, Color.WHITE2)
65
71
 
66
72
 
73
+ # Colorize a command option
67
74
  def option(text):
68
75
  return colorize(text, Color.CYAN)
69
76
 
70
77
 
78
+ # Colorize a hint
71
79
  def hint(text):
72
80
  return colorize(text, Color.GREY)
73
81
 
74
82
 
83
+ # Colorize a project name
75
84
  def project(text):
76
85
  return colorize(text, Color.BOLD)
77
86
 
78
87
 
88
+ # Colorize a URL to appear as a link
79
89
  def link(text):
80
90
  return colorize(colorize(text, Color.BLUE), Color.UNDERLINE)
91
+
92
+
93
+ # Colorize the table name in a SQL statement
94
+ def table(sql, name):
95
+ return sql.replace(name, colorize(name, Color.VIOLET))
96
+
97
+
98
+ # Colorize a time/duration output
99
+ def time(text):
100
+ return colorize(text, Color.GREEN)
@@ -8,20 +8,16 @@ from gibson.command.Count import Count
8
8
  from gibson.command.Dev import Dev
9
9
  from gibson.command.Forget import Forget
10
10
  from gibson.command.Help import Help
11
- from gibson.command.Import import Import
11
+ from gibson.command.importer.Import import Import
12
12
  from gibson.command.list.List import List
13
13
  from gibson.command.Merge import Merge
14
- from gibson.command.Model import Model
15
14
  from gibson.command.Modify import Modify
16
15
  from gibson.command.new.New import New
17
- from gibson.command.OpenApi import OpenApi
18
16
  from gibson.command.Question import Question
19
17
  from gibson.command.Remove import Remove
20
18
  from gibson.command.rename.Rename import Rename
21
19
  from gibson.command.rewrite.Rewrite import Rewrite
22
- from gibson.command.Schema import Schema
23
20
  from gibson.command.Show import Show
24
- from gibson.command.Test import Test
25
21
  from gibson.command.Tree import Tree
26
22
  from gibson.command.Version import Version
27
23
  from gibson.command.WarGames import WarGames
@@ -65,34 +61,24 @@ class CommandRouter:
65
61
  command = List(self.configuration)
66
62
  elif sys.argv[1] == "merge":
67
63
  command = Merge(self.configuration)
68
- elif sys.argv[1] == "model":
69
- command = Model(self.configuration)
70
64
  elif sys.argv[1] == "modify":
71
65
  command = Modify(self.configuration)
72
66
  elif sys.argv[1] == "new":
73
67
  command = New(self.configuration)
74
- elif sys.argv[1] == "openapi":
75
- command = OpenApi(self.configuration)
76
68
  elif sys.argv[1] == "remove":
77
69
  command = Remove(self.configuration)
78
70
  elif sys.argv[1] == "rename":
79
71
  command = Rename(self.configuration)
80
72
  elif sys.argv[1] == "rewrite":
81
73
  command = Rewrite(self.configuration, with_header=True)
82
- elif sys.argv[1] == "schema":
83
- command = Schema(self.configuration)
84
74
  elif sys.argv[1] == "show":
85
75
  command = Show(self.configuration)
86
- elif sys.argv[1] == "test":
87
- command = Test(self.configuration)
88
76
  elif sys.argv[1] == "tree":
89
77
  command = Tree(self.configuration)
90
- elif sys.argv[1] in ["?", "q"]:
78
+ elif sys.argv[1] in ["q"]:
91
79
  command = Question(self.configuration)
92
- elif sys.argv[1] in ["--version", "-v"]:
80
+ elif sys.argv[1] in ["version", "--version", "-v"]:
93
81
  command = Version(self.configuration)
94
- else:
95
- command = WarGames(self.configuration)
96
82
 
97
83
  if command is None or command.execute() is False:
98
84
  Help(self.configuration).execute()
@@ -71,7 +71,7 @@ class Memory:
71
71
  def recall_last_entity(self, name):
72
72
  if self.last is not None:
73
73
  for entity in self.last["entities"]:
74
- if entity["name"] == name:
74
+ if entity["name"].lower() == name.lower():
75
75
  return entity
76
76
  return None
77
77
 
@@ -98,7 +98,7 @@ class Memory:
98
98
  def recall_stored_entity(self, name):
99
99
  if self.entities is not None:
100
100
  for entity in self.entities:
101
- if entity["name"] == name:
101
+ if entity["name"].lower() == name.lower():
102
102
  return entity
103
103
 
104
104
  return None
@@ -1,5 +1,7 @@
1
1
  import time
2
2
 
3
+ import gibson.core.Colors as Colors
4
+
3
5
 
4
6
  class TimeKeeper:
5
7
  def __init__(self):
@@ -9,4 +11,4 @@ class TimeKeeper:
9
11
  print(self.get_display() + "\n")
10
12
 
11
13
  def get_display(self):
12
- return "[%ss]" % str(time.time() - self.__started)[0:7]
14
+ return Colors.time("[%ss]" % str(time.time() - self.__started)[0:7])