gibson-cli 0.7.3__tar.gz → 0.7.4__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 (144) hide show
  1. {gibson_cli-0.7.3/gibson_cli.egg-info → gibson_cli-0.7.4}/PKG-INFO +2 -1
  2. gibson_cli-0.7.4/gibson/bin/gibson.py +19 -0
  3. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/Help.py +2 -2
  4. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/Version.py +3 -3
  5. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/code/Entity.py +80 -73
  6. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/code/Model.py +11 -9
  7. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/code/Schema.py +11 -9
  8. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/code/Test.py +11 -9
  9. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/rewrite/Rewrite.py +0 -1
  10. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/core/Colors.py +35 -15
  11. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/core/Configuration.py +2 -1
  12. gibson_cli-0.7.4/gibson/core/Spinner.py +37 -0
  13. gibson_cli-0.7.4/gibson/display/Header.py +9 -0
  14. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/display/WorkspaceFooter.py +3 -3
  15. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/display/WorkspaceHeader.py +1 -1
  16. gibson_cli-0.7.4/gibson/display/tests/test_display_Header.py +12 -0
  17. gibson_cli-0.7.4/gibson/display/tests/test_display_WorkspaceFooter.py +11 -0
  18. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/display/tests/test_display_WorkspaceHeader.py +1 -1
  19. {gibson_cli-0.7.3 → gibson_cli-0.7.4/gibson_cli.egg-info}/PKG-INFO +2 -1
  20. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson_cli.egg-info/SOURCES.txt +1 -0
  21. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson_cli.egg-info/requires.txt +1 -0
  22. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/pyproject.toml +1 -1
  23. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/requirements.txt +1 -0
  24. gibson_cli-0.7.3/gibson/bin/gibson.py +0 -16
  25. gibson_cli-0.7.3/gibson/display/Header.py +0 -10
  26. gibson_cli-0.7.3/gibson/display/tests/test_display_Header.py +0 -10
  27. gibson_cli-0.7.3/gibson/display/tests/test_display_WorkspaceFooter.py +0 -11
  28. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/.gitignore +0 -0
  29. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/.pre-commit-config.yaml +0 -0
  30. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/README.md +0 -0
  31. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/bin/build.sh +0 -0
  32. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/bin/clean.sh +0 -0
  33. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/bin/release.sh +0 -0
  34. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/api/BaseApi.py +0 -0
  35. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/api/Cli.py +0 -0
  36. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/api/ProjectApi.py +0 -0
  37. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/BaseCommand.py +0 -0
  38. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/Build.py +0 -0
  39. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/Conf.py +0 -0
  40. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/Count.py +0 -0
  41. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/Dev.py +0 -0
  42. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/Forget.py +0 -0
  43. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/Merge.py +0 -0
  44. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/Modify.py +0 -0
  45. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/Question.py +0 -0
  46. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/Remove.py +0 -0
  47. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/Show.py +0 -0
  48. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/Tree.py +0 -0
  49. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/WarGames.py +0 -0
  50. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/auth/Auth.py +0 -0
  51. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/auth/Login.py +0 -0
  52. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/auth/Logout.py +0 -0
  53. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/code/Api.py +0 -0
  54. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/code/Base.py +0 -0
  55. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/code/Code.py +0 -0
  56. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/code/Models.py +0 -0
  57. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/code/Schemas.py +0 -0
  58. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/code/Tests.py +0 -0
  59. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/importer/Import.py +0 -0
  60. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/importer/OpenApi.py +0 -0
  61. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/list/Entities.py +0 -0
  62. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/list/List.py +0 -0
  63. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/list/Projects.py +0 -0
  64. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/new/Module.py +0 -0
  65. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/new/New.py +0 -0
  66. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/new/Project.py +0 -0
  67. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/rename/Entity.py +0 -0
  68. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/rename/Rename.py +0 -0
  69. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/tests/test_command_BaseCommand.py +0 -0
  70. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/command/tests/test_command_Conf.py +0 -0
  71. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/Api.py +0 -0
  72. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/Code.py +0 -0
  73. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/Custom.py +0 -0
  74. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/Datastore.py +0 -0
  75. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/Dependencies.py +0 -0
  76. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/Dev.py +0 -0
  77. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/Frameworks.py +0 -0
  78. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/Modeler.py +0 -0
  79. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/Paths.py +0 -0
  80. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/Platform.py +0 -0
  81. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/Project.py +0 -0
  82. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/Version.py +0 -0
  83. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/dev/Api.py +0 -0
  84. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/dev/Base.py +0 -0
  85. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/dev/Model.py +0 -0
  86. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/dev/Schema.py +0 -0
  87. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/tests/test_conf_Dependencies.py +0 -0
  88. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/conf/tests/test_conf_Platform.py +0 -0
  89. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/core/CommandRouter.py +0 -0
  90. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/core/Completions.py +0 -0
  91. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/core/Conversation.py +0 -0
  92. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/core/Env.py +0 -0
  93. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/core/Memory.py +0 -0
  94. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/core/PythonPath.py +0 -0
  95. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/core/TimeKeeper.py +0 -0
  96. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/core/utils.py +0 -0
  97. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/data/bash-completion.tmpl +0 -0
  98. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/data/mysql/default-ref-table.tmpl +0 -0
  99. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/data/mysql/default-table.tmpl +0 -0
  100. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/data/postgresql/default-ref-table.tmpl +0 -0
  101. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/data/postgresql/default-table.tmpl +0 -0
  102. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/db/TableExceptions.py +0 -0
  103. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/db/tests/test_db_TableExceptions.py +0 -0
  104. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/dev/Dev.py +0 -0
  105. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/lang/Python.py +0 -0
  106. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/lang/tests/test_lang_Python.py +0 -0
  107. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/services/auth/Server.py +0 -0
  108. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/services/code/context/schema/DataDictionary.py +0 -0
  109. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/services/code/context/schema/EntityKeys.py +0 -0
  110. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/services/code/context/schema/Manager.py +0 -0
  111. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/services/code/context/schema/tests/test_code_context_schema_DataDictionary.py +0 -0
  112. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/services/code/context/schema/tests/test_code_context_schema_EntityKeys.py +0 -0
  113. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/services/code/context/schema/tests/test_code_context_schema_Manager.py +0 -0
  114. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/services/code/customization/Authenticator.py +0 -0
  115. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/services/code/customization/BaseCustomization.py +0 -0
  116. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/services/code/customization/CustomizationManager.py +0 -0
  117. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/services/code/customization/Index.py +0 -0
  118. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/services/code/customization/tests/test_code_customization_Authenticator.py +0 -0
  119. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/services/code/customization/tests/test_code_customization_BaseCustomization.py +0 -0
  120. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/Entity.py +0 -0
  121. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/mysql/Entity.py +0 -0
  122. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/mysql/constraints/ReferenceConstraint.py +0 -0
  123. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/mysql/keys/ForeignKey.py +0 -0
  124. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/mysql/keys/Index.py +0 -0
  125. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/mysql/keys/IndexAttribute.py +0 -0
  126. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/mysql/keys/tests/test_structure_mysql_keys_ForeignKey.py +0 -0
  127. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/mysql/keys/tests/test_structure_mysql_keys_Index.py +0 -0
  128. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/mysql/keys/tests/test_structure_mysql_keys_IndexAttribute.py +0 -0
  129. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/mysql/testing.py +0 -0
  130. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/mysql/tests/test_structure_mysql_Entity.py +0 -0
  131. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/postgresql/Entity.py +0 -0
  132. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/postgresql/References.py +0 -0
  133. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/postgresql/table/ForeignKey.py +0 -0
  134. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/postgresql/table/tests/test_structure_postgresql_table_ForeignKey.py +0 -0
  135. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/postgresql/testing.py +0 -0
  136. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/postgresql/tests/test_structure_postgresql_Entity.py +0 -0
  137. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/structure/tests/test_structure_Entity.py +0 -0
  138. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/tests/test_Env.py +0 -0
  139. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/tests/test_Memory.py +0 -0
  140. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson/tests/test_utils.py +0 -0
  141. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson_cli.egg-info/dependency_links.txt +0 -0
  142. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson_cli.egg-info/entry_points.txt +0 -0
  143. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/gibson_cli.egg-info/top_level.txt +0 -0
  144. {gibson_cli-0.7.3 → gibson_cli-0.7.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gibson-cli
3
- Version: 0.7.3
3
+ Version: 0.7.4
4
4
  Summary: Gibson Command Line Interface
5
5
  Author-email: GibsonAI <noc@gibsonai.com>
6
6
  Project-URL: Homepage, https://gibsonai.com/
@@ -65,6 +65,7 @@ Requires-Dist: uvicorn==0.29.0
65
65
  Requires-Dist: uvloop==0.19.0
66
66
  Requires-Dist: watchfiles==0.21.0
67
67
  Requires-Dist: websockets==12.0
68
+ Requires-Dist: yaspin==3.1.0
68
69
 
69
70
 
70
71
  [![GibsonAI](https://github.com/user-attachments/assets/26bc1002-f878-4995-a6c5-eb8d5eb69c28)](https://gibsonai.com/)
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env python3
2
+
3
+ from gibson.core.CommandRouter import CommandRouter
4
+ from gibson.core.Configuration import Configuration
5
+
6
+
7
+ def main():
8
+ try:
9
+ configuration = Configuration()
10
+ if configuration.settings is None:
11
+ configuration.initialize()
12
+ else:
13
+ CommandRouter(configuration).run()
14
+ except KeyboardInterrupt:
15
+ exit(1)
16
+
17
+
18
+ if __name__ == "__main__":
19
+ main()
@@ -21,7 +21,7 @@ class Help(BaseCommand):
21
21
  "description": "create the entities in the datastore",
22
22
  "memory": "stored",
23
23
  },
24
- "code": {"description": "pair program", "memory": None},
24
+ "code": {"description": "pair program with gibson", "memory": None},
25
25
  "conf": {"description": "set a configuration variable", "memory": None},
26
26
  "count": {
27
27
  "description": "show the number of entities stored",
@@ -62,7 +62,7 @@ class Help(BaseCommand):
62
62
  "memory": "last > stored",
63
63
  },
64
64
  "rewrite": {
65
- "description": "rewrite code",
65
+ "description": "rewrite all code",
66
66
  "memory": "stored",
67
67
  },
68
68
  "show": {"description": "display an entity", "memory": "last > stored"},
@@ -15,15 +15,15 @@ class Version(BaseCommand):
15
15
 
16
16
  if latest_version != VersionConf.num:
17
17
  self.conversation.type(
18
- f"A new version of {Colors.command(self.configuration.command)} is available: {Colors.colorize(latest_version, Colors.Color.CYAN)}\n"
18
+ f"A new version of {Colors.command(self.configuration.command)} is available: {Colors.cyan(latest_version)}\n"
19
19
  )
20
20
  self.conversation.type(
21
- f"You are currently using version: {Colors.colorize(VersionConf.num, Colors.Color.VIOLET)}\n"
21
+ f"You are currently using version: {Colors.violet(VersionConf.num)}\n"
22
22
  )
23
23
  self.conversation.type(
24
24
  f"Please update to the latest version by running: {Colors.command('pip3')} {Colors.subcommand('install')} {Colors.option('--upgrade')} gibson-cli\n"
25
25
  )
26
26
  else:
27
27
  self.conversation.type(
28
- f"Nice! 🎉 You are using the latest version of {Colors.command(self.configuration.command)}: {Colors.colorize(VersionConf.num, Colors.Color.CYAN)}\n"
28
+ f"Nice! 🎉 You are using the latest version of {Colors.command(self.configuration.command)}: {Colors.cyan(VersionConf.num)}\n"
29
29
  )
@@ -10,6 +10,7 @@ from gibson.command.code.Schema import Schema
10
10
  from gibson.command.code.Test import Test
11
11
  from gibson.command.Merge import Merge
12
12
  from gibson.core.Configuration import Configuration
13
+ from gibson.core.Spinner import ComputingSpinner, Spinner
13
14
  from gibson.display.Header import Header
14
15
  from gibson.display.WorkspaceFooter import WorkspaceFooter
15
16
  from gibson.display.WorkspaceHeader import WorkspaceHeader
@@ -88,79 +89,85 @@ class Entity(BaseCommand):
88
89
  self.configuration.require_project()
89
90
  definition = self.configure_definition()
90
91
 
91
- self.__context = CodeContextSchemaManager().from_code_writer_schema_context(
92
- cli.code_writer_schema_context()
93
- )
94
-
95
- data = cli.code_writer_entity_modifier(
96
- self.__context.json,
97
- sys.argv[3],
98
- definition,
99
- self.CODE_WRITER_ENTITY_MODIFIER_NOOP,
100
- )
101
- entity = (
102
- StructureEntity()
103
- .instantiate(self.configuration.project.datastore.type)
104
- .import_from_struct(data)
105
- )
92
+ with ComputingSpinner():
93
+ self.__context = CodeContextSchemaManager().from_code_writer_schema_context(
94
+ cli.code_writer_schema_context()
95
+ )
96
+ data = cli.code_writer_entity_modifier(
97
+ self.__context.json,
98
+ sys.argv[3],
99
+ definition,
100
+ self.CODE_WRITER_ENTITY_MODIFIER_NOOP,
101
+ )
102
+ entity = (
103
+ StructureEntity()
104
+ .instantiate(self.configuration.project.datastore.type)
105
+ .import_from_struct(data)
106
+ )
106
107
 
107
108
  while True:
108
- self.__render_workspace(entity, data["code"][0]["definition"])
109
-
110
- input_ = input("> ")
111
- if input_ in [":q", ":q!", ":wq"]:
112
- self.conversation.newline()
113
-
114
- if input_ == ":q":
115
- self.conversation.type("Exiting without saving.\n")
116
-
117
- if input_ in [":q", ":q!"]:
118
- exit(1)
119
-
120
- self.memory.remember_last({"entities": [data["entity"]]})
121
- self.conversation.mute()
122
- Merge(self.configuration).execute()
123
- self.conversation.unmute()
124
-
125
- self.conversation.type("Entity saved! ✅\n\n")
126
- self.conversation.type("Gibson is writing the code...\n\n")
127
-
128
- Model(self.configuration).execute(entity.name)
129
- Schema(self.configuration).execute(entity.name)
130
- Test(self.configuration).execute(entity.name)
131
-
132
- self.conversation.type(
133
- f"All code for the {Colors.violet(entity.name)} entity has been written 🎉\n\n"
134
- )
135
-
136
- exit()
137
- elif input_ == "":
138
- continue
139
-
140
- talk_to_gibsonai = True
141
-
142
- parts = input_.split(" ")
143
- if parts[0] == "fk":
144
- input_ = self.CODE_WRITER_ENTITY_MODIFIER_NOOP
145
- if not self.__add_foreign_key(entity, parts[1]):
146
- # If the entity was not modified, likely because the table
147
- # referenced does not exist or does not contain indexes which
148
- # can be used for a foreign key, do not waste the network call
149
- # to GibsonAI since there is nothing to do.
150
- talk_to_gibsonai = False
151
-
152
- if talk_to_gibsonai is True:
153
- data = cli.code_writer_entity_modifier(
154
- self.__context.json,
155
- data["entity"]["name"],
156
- entity.create_statement(),
157
- input_,
158
- )
159
- entity = (
160
- StructureEntity()
161
- .instantiate(self.configuration.project.datastore.type)
162
- .import_from_struct(data)
163
- )
109
+ try:
110
+ self.__render_workspace(entity, data["code"][0]["definition"])
111
+ input_ = input("> ")
112
+ if input_.lower() in [":q", ":q!", ":wq"]:
113
+ self.conversation.newline()
114
+
115
+ if input_.lower() == ":q":
116
+ self.conversation.type("Exiting without saving.\n")
117
+
118
+ if input_.lower() in [":q", ":q!"]:
119
+ exit(1)
120
+
121
+ # Mute output from individual merge + rewrite operations
122
+ self.conversation.mute()
123
+
124
+ with Spinner(
125
+ "Gibson is saving your changes to the entity...",
126
+ "Entity saved",
127
+ ):
128
+ self.memory.remember_last({"entities": [data["entity"]]})
129
+ Merge(self.configuration).execute()
130
+
131
+ # Rewrite each category of code with the new entity definition
132
+ Model(self.configuration).execute(entity_name=entity.name)
133
+ Schema(self.configuration).execute(entity_name=entity.name)
134
+ Test(self.configuration).execute(entity_name=entity.name)
135
+
136
+ self.conversation.unmute()
137
+ self.conversation.type(
138
+ f"\nAll code for the {Colors.violet(entity.name)} entity has been written 🎉\n\n"
139
+ )
140
+ exit()
141
+ elif input_ == "":
142
+ continue
143
+
144
+ with ComputingSpinner():
145
+ talk_to_gibsonai = True
146
+ parts = input_.split(" ")
147
+ if parts[0] == "fk":
148
+ input_ = self.CODE_WRITER_ENTITY_MODIFIER_NOOP
149
+ if not self.__add_foreign_key(entity, parts[1]):
150
+ # If the entity was not modified, likely because the table
151
+ # referenced does not exist or does not contain indexes which
152
+ # can be used for a foreign key, do not waste the network call
153
+ # to GibsonAI since there is nothing to do.
154
+ talk_to_gibsonai = False
155
+
156
+ if talk_to_gibsonai is True:
157
+ data = cli.code_writer_entity_modifier(
158
+ self.__context.json,
159
+ data["entity"]["name"],
160
+ entity.create_statement(),
161
+ input_,
162
+ )
163
+ entity = (
164
+ StructureEntity()
165
+ .instantiate(self.configuration.project.datastore.type)
166
+ .import_from_struct(data)
167
+ )
168
+ except KeyboardInterrupt:
169
+ self.conversation.type("\nExiting without saving.\n")
170
+ exit(1)
164
171
 
165
172
  def get_default_ref_table_template_path(self):
166
173
  return (
@@ -185,12 +192,12 @@ class Entity(BaseCommand):
185
192
  print(WorkspaceHeader().render(self.configuration.project.name))
186
193
 
187
194
  print("")
188
- print(Header().render("SQL", Colors.Color.CYAN))
195
+ print(Header().render("SQL", Colors.cyan))
189
196
  print("")
190
197
  print(Colors.table(entity.create_statement(), entity.name))
191
198
 
192
199
  print("")
193
- print(Header().render("Model", Colors.Color.YELLOW))
200
+ print(Header().render("Model", Colors.yellow))
194
201
  print("")
195
202
  print(Colors.model(model, entity.name))
196
203
 
@@ -3,6 +3,7 @@ import sys
3
3
  import gibson.core.Colors as Colors
4
4
  from gibson.api.Cli import Cli
5
5
  from gibson.command.BaseCommand import BaseCommand
6
+ from gibson.core.Spinner import Spinner
6
7
  from gibson.core.TimeKeeper import TimeKeeper
7
8
  from gibson.dev.Dev import Dev
8
9
 
@@ -20,17 +21,18 @@ class Model(BaseCommand):
20
21
 
21
22
  time_keeper = TimeKeeper()
22
23
 
23
- cli = Cli(self.configuration)
24
- response = cli.code_models([entity["name"]])
25
-
26
- Dev(self.configuration).model(
27
- response["code"][0]["entity"]["name"], response["code"][0]["definition"]
28
- )
24
+ with Spinner("Gibson is writing the models...", "Models written"):
25
+ cli = Cli(self.configuration)
26
+ response = cli.code_models([entity["name"]])
27
+ Dev(self.configuration).model(
28
+ response["code"][0]["entity"]["name"], response["code"][0]["definition"]
29
+ )
29
30
 
30
31
  if self.configuration.project.dev.active is True:
31
32
  self.conversation.type(
32
- f"Gibson wrote the following {Colors.argument('model')} code to your project:\n"
33
+ f"\nGibson wrote the following {Colors.argument('model')} code to your project:\n"
33
34
  )
34
35
 
35
- print(response["code"][0]["definition"])
36
- time_keeper.display()
36
+ if not self.conversation.muted():
37
+ print(response["code"][0]["definition"])
38
+ time_keeper.display()
@@ -3,6 +3,7 @@ import sys
3
3
  import gibson.core.Colors as Colors
4
4
  from gibson.api.Cli import Cli
5
5
  from gibson.command.BaseCommand import BaseCommand
6
+ from gibson.core.Spinner import Spinner
6
7
  from gibson.core.TimeKeeper import TimeKeeper
7
8
  from gibson.dev.Dev import Dev
8
9
 
@@ -20,17 +21,18 @@ class Schema(BaseCommand):
20
21
 
21
22
  time_keeper = TimeKeeper()
22
23
 
23
- cli = Cli(self.configuration)
24
- response = cli.code_schemas([entity["name"]])
25
-
26
- Dev(self.configuration).schema(
27
- response["code"][0]["entity"]["name"], response["code"][0]["definition"]
28
- )
24
+ with Spinner("Gibson is writing the schemas...", "Schemas written"):
25
+ cli = Cli(self.configuration)
26
+ response = cli.code_schemas([entity["name"]])
27
+ Dev(self.configuration).schema(
28
+ response["code"][0]["entity"]["name"], response["code"][0]["definition"]
29
+ )
29
30
 
30
31
  if self.configuration.project.dev.active is True:
31
32
  self.conversation.type(
32
- f"Gibson wrote the following {Colors.argument('schema')} code to your project:\n"
33
+ f"\nGibson wrote the following {Colors.argument('schema')} code to your project:\n"
33
34
  )
34
35
 
35
- print(response["code"][0]["definition"])
36
- time_keeper.display()
36
+ if not self.conversation.muted():
37
+ print(response["code"][0]["definition"])
38
+ time_keeper.display()
@@ -3,6 +3,7 @@ import sys
3
3
  import gibson.core.Colors as Colors
4
4
  from gibson.api.Cli import Cli
5
5
  from gibson.command.BaseCommand import BaseCommand
6
+ from gibson.core.Spinner import Spinner
6
7
  from gibson.core.TimeKeeper import TimeKeeper
7
8
  from gibson.dev.Dev import Dev
8
9
 
@@ -20,17 +21,18 @@ class Test(BaseCommand):
20
21
 
21
22
  time_keeper = TimeKeeper()
22
23
 
23
- cli = Cli(self.configuration)
24
- response = cli.code_testing([entity["name"]])
25
-
26
- Dev(self.configuration).tests(
27
- response["code"][0]["entity"]["name"], response["code"][0]["definition"]
28
- )
24
+ with Spinner("Gibson is writing the tests...", "Tests written"):
25
+ cli = Cli(self.configuration)
26
+ response = cli.code_testing([entity["name"]])
27
+ Dev(self.configuration).tests(
28
+ response["code"][0]["entity"]["name"], response["code"][0]["definition"]
29
+ )
29
30
 
30
31
  if self.configuration.project.dev.active is True:
31
32
  self.conversation.type(
32
- f"Gibson wrote the following {Colors.argument('tests')} to your project:\n"
33
+ f"\nGibson wrote the following {Colors.argument('tests')} to your project:\n"
33
34
  )
34
35
 
35
- print(response["code"][0]["definition"])
36
- time_keeper.display()
36
+ if not self.conversation.muted():
37
+ print(response["code"][0]["definition"])
38
+ time_keeper.display()
@@ -25,7 +25,6 @@ class Rewrite(BaseCommand):
25
25
  super().__init__(configuration)
26
26
  self.wipe = wipe
27
27
  self.with_header = with_header
28
- self.arguments = ["api", "base", "models", "schemas", "tests"]
29
28
 
30
29
  def execute(self):
31
30
  if len(sys.argv) == 2:
@@ -1,4 +1,4 @@
1
- class Color:
1
+ class Constants:
2
2
  BLACK = "\033[30m"
3
3
  BLACK_BG = "\033[40m"
4
4
  BLINK = "\033[5m"
@@ -42,17 +42,17 @@ class Color:
42
42
 
43
43
  # Colorize text with a given color
44
44
  def colorize(text, color):
45
- return f"{color}{text}{Color.END}"
45
+ return f"{color}{text}{Constants.END}"
46
46
 
47
47
 
48
48
  # Colorize a command
49
49
  def command(text):
50
- return colorize(text, Color.GREEN)
50
+ return green(text)
51
51
 
52
52
 
53
53
  # Colorize a subcommand
54
54
  def subcommand(text):
55
- return colorize(text, Color.YELLOW)
55
+ return yellow(text)
56
56
 
57
57
 
58
58
  # Colorize an argument
@@ -67,27 +67,27 @@ def arguments(list):
67
67
 
68
68
  # Colorize user input
69
69
  def input(text):
70
- return colorize(text, Color.WHITE2)
70
+ return white(text)
71
71
 
72
72
 
73
73
  # Colorize a command option
74
74
  def option(text):
75
- return colorize(text, Color.CYAN)
75
+ return cyan(text)
76
76
 
77
77
 
78
78
  # Colorize a hint
79
79
  def hint(text):
80
- return colorize(text, Color.GREY)
80
+ return grey(text)
81
81
 
82
82
 
83
83
  # Colorize a project name
84
84
  def project(text):
85
- return colorize(text, Color.BOLD)
85
+ return bold(text)
86
86
 
87
87
 
88
88
  # Colorize a URL to appear as a link
89
89
  def link(text):
90
- return colorize(colorize(text, Color.BLUE), Color.UNDERLINE)
90
+ return underline(blue(text))
91
91
 
92
92
 
93
93
  # Colorize the table name in a SQL statement
@@ -104,24 +104,44 @@ def model(code, name):
104
104
 
105
105
  # Colorize a time/duration output
106
106
  def time(text):
107
- return colorize(text, Color.GREEN)
107
+ return green(text)
108
+
109
+
110
+ def bold(text):
111
+ return colorize(text, Constants.BOLD)
112
+
113
+
114
+ def underline(text):
115
+ return colorize(text, Constants.UNDERLINE)
116
+
117
+
118
+ def blue(text):
119
+ return colorize(text, Constants.BLUE)
108
120
 
109
121
 
110
122
  def cyan(text):
111
- return colorize(text, Color.CYAN)
123
+ return colorize(text, Constants.CYAN)
112
124
 
113
125
 
114
126
  def green(text):
115
- return colorize(text, Color.GREEN)
127
+ return colorize(text, Constants.GREEN)
128
+
129
+
130
+ def grey(text):
131
+ return colorize(text, Constants.GREY)
116
132
 
117
133
 
118
134
  def red(text):
119
- return colorize(text, Color.RED)
135
+ return colorize(text, Constants.RED)
120
136
 
121
137
 
122
138
  def violet(text):
123
- return colorize(text, Color.VIOLET)
139
+ return colorize(text, Constants.VIOLET)
140
+
141
+
142
+ def white(text):
143
+ return colorize(text, Constants.WHITE2)
124
144
 
125
145
 
126
146
  def yellow(text):
127
- return colorize(text, Color.YELLOW)
147
+ return colorize(text, Constants.YELLOW)
@@ -347,6 +347,7 @@ class Configuration:
347
347
  json.dump(data, f, indent=2)
348
348
 
349
349
  def set_config_paths(self):
350
+ config_path = os.environ.get("GIBSONAI_CONFIG_PATH", None)
350
351
  gibson_config_dir = ".gibsonai"
351
352
  user_home = os.environ.get("HOME")
352
353
  if user_home is None:
@@ -354,7 +355,7 @@ class Configuration:
354
355
  "Gibson here. Please set your HOME environment variable."
355
356
  )
356
357
 
357
- self.paths.top = f"{user_home}/{gibson_config_dir}"
358
+ self.paths.top = config_path or f"{user_home}/{gibson_config_dir}"
358
359
  self.paths.auth = f"{self.paths.top}/auth"
359
360
  self.paths.config = f"{self.paths.top}/config"
360
361
 
@@ -0,0 +1,37 @@
1
+ from yaspin import yaspin
2
+ from yaspin.spinners import Spinners
3
+
4
+
5
+ class Spinner:
6
+ def __init__(
7
+ self, start_text, success_text=None, fail_text=None, disappearing=False
8
+ ):
9
+ self.success_text = success_text or start_text
10
+ self.fail_text = fail_text or start_text
11
+ self.disappearing = disappearing
12
+ self.spinner = yaspin(
13
+ Spinners.binary,
14
+ text=start_text,
15
+ color="green",
16
+ )
17
+
18
+ def __enter__(self):
19
+ self.spinner.start()
20
+
21
+ def __exit__(self, exc_type, exc_val, exc_tb):
22
+ if exc_type is not None:
23
+ self.spinner.text = self.fail_text
24
+ self.spinner.fail("❌")
25
+ elif self.disappearing:
26
+ self.spinner.text = ""
27
+ self.spinner.stop()
28
+ else:
29
+ self.spinner.text = self.success_text
30
+ self.spinner.ok("✅")
31
+
32
+ self.spinner.stop()
33
+
34
+
35
+ class ComputingSpinner(Spinner):
36
+ def __init__(self):
37
+ super().__init__("Gibson is computing...", disappearing=True)
@@ -0,0 +1,9 @@
1
+ import math
2
+
3
+
4
+ class Header:
5
+ def render(self, text, colorizer=None):
6
+ output = text if colorizer is None else colorizer(text)
7
+ half = math.floor((78 - len(text)) / 2) # 80 line length - 2 spaces
8
+ header = "/" * half + f" {output} " + "/" * half
9
+ return header
@@ -4,9 +4,9 @@ import gibson.core.Colors as Colors
4
4
  class WorkspaceFooter:
5
5
  def render(self):
6
6
  return (
7
- "=" * 79
7
+ "-" * 79
8
8
  + "\n"
9
- + f"[{Colors.red(':q')} + enter = {Colors.red('discard')} changes] "
9
+ + f"[{Colors.red(':q')} + enter = {Colors.red('discard')} changes] "
10
10
  + f"[{Colors.green(':wq')} + enter = {Colors.green('save')} changes + write code]\n\n"
11
- + "Using natural language, tell me how I can modify this entity."
11
+ + "Using natural language, tell me how I can modify this entity:"
12
12
  )
@@ -7,5 +7,5 @@ class WorkspaceHeader:
7
7
  f"Project {project_name}".ljust(50)
8
8
  + " " * 12
9
9
  + "[PAIR PROGRAMMER]\n"
10
- + "=" * 79
10
+ + "-" * 79
11
11
  ).replace(project_name, Colors.project(project_name))
@@ -0,0 +1,12 @@
1
+ import gibson.core.Colors as Colors
2
+ from gibson.display.Header import Header
3
+
4
+
5
+ def test_render():
6
+ text = "abc def ghi"
7
+ assert Header().render(text) == (
8
+ "///////////////////////////////// abc def ghi /////////////////////////////////"
9
+ )
10
+ assert Header().render(text, Colors.red) == (
11
+ f"///////////////////////////////// {Colors.red(text)} /////////////////////////////////"
12
+ )
@@ -0,0 +1,11 @@
1
+ import gibson.core.Colors as Colors
2
+ from gibson.display.WorkspaceFooter import WorkspaceFooter
3
+
4
+
5
+ def test_render():
6
+ assert WorkspaceFooter().render() == (
7
+ f"""-------------------------------------------------------------------------------
8
+ [{Colors.red(':q')} + enter = {Colors.red('discard')} changes] [{Colors.green(':wq')} + enter = {Colors.green('save')} changes + write code]
9
+
10
+ Using natural language, tell me how I can modify this entity:"""
11
+ )
@@ -5,5 +5,5 @@ from gibson.display.WorkspaceHeader import WorkspaceHeader
5
5
  def test_render():
6
6
  assert WorkspaceHeader().render("abc def ghi") == (
7
7
  f"""Project {Colors.project("abc def ghi")} [PAIR PROGRAMMER]
8
- ==============================================================================="""
8
+ -------------------------------------------------------------------------------"""
9
9
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gibson-cli
3
- Version: 0.7.3
3
+ Version: 0.7.4
4
4
  Summary: Gibson Command Line Interface
5
5
  Author-email: GibsonAI <noc@gibsonai.com>
6
6
  Project-URL: Homepage, https://gibsonai.com/
@@ -65,6 +65,7 @@ Requires-Dist: uvicorn==0.29.0
65
65
  Requires-Dist: uvloop==0.19.0
66
66
  Requires-Dist: watchfiles==0.21.0
67
67
  Requires-Dist: websockets==12.0
68
+ Requires-Dist: yaspin==3.1.0
68
69
 
69
70
 
70
71
  [![GibsonAI](https://github.com/user-attachments/assets/26bc1002-f878-4995-a6c5-eb8d5eb69c28)](https://gibsonai.com/)
@@ -77,6 +77,7 @@ gibson/core/Conversation.py
77
77
  gibson/core/Env.py
78
78
  gibson/core/Memory.py
79
79
  gibson/core/PythonPath.py
80
+ gibson/core/Spinner.py
80
81
  gibson/core/TimeKeeper.py
81
82
  gibson/core/utils.py
82
83
  gibson/data/bash-completion.tmpl
@@ -49,3 +49,4 @@ uvicorn==0.29.0
49
49
  uvloop==0.19.0
50
50
  watchfiles==0.21.0
51
51
  websockets==12.0
52
+ yaspin==3.1.0
@@ -15,7 +15,7 @@ classifiers = [
15
15
  "Intended Audience :: Developers",
16
16
  "Programming Language :: Python :: 3.9",
17
17
  ]
18
- version = "0.7.3"
18
+ version = "0.7.4"
19
19
 
20
20
  [tool.setuptools.packages.find]
21
21
  where = ["."]
@@ -49,3 +49,4 @@ uvicorn==0.29.0
49
49
  uvloop==0.19.0
50
50
  watchfiles==0.21.0
51
51
  websockets==12.0
52
+ yaspin==3.1.0
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env python3
2
-
3
- from gibson.core.CommandRouter import CommandRouter
4
- from gibson.core.Configuration import Configuration
5
-
6
-
7
- def main():
8
- configuration = Configuration()
9
- if configuration.settings is None:
10
- configuration.initialize()
11
- else:
12
- router = CommandRouter(configuration).run()
13
-
14
-
15
- if __name__ == "__main__":
16
- main()
@@ -1,10 +0,0 @@
1
- import gibson.core.Colors as Colors
2
-
3
-
4
- class Header:
5
- def render(self, text, color=None):
6
- output = text if color is None else Colors.colorize(text, color)
7
- header = "+-----------------------------------------------------------------------------+\n"
8
- header += "| " + output + " " * (76 - len(text)) + "|\n"
9
- header += "+-----------------------------------------------------------------------------+"
10
- return header
@@ -1,10 +0,0 @@
1
- import gibson.core.Colors as Colors
2
- from gibson.display.Header import Header
3
-
4
-
5
- def test_render():
6
- assert Header().render("abc def ghi") == (
7
- """+-----------------------------------------------------------------------------+
8
- | abc def ghi |
9
- +-----------------------------------------------------------------------------+"""
10
- )
@@ -1,11 +0,0 @@
1
- import gibson.core.Colors as Colors
2
- from gibson.display.WorkspaceFooter import WorkspaceFooter
3
-
4
-
5
- def test_render():
6
- assert WorkspaceFooter().render() == (
7
- f"""===============================================================================
8
- [{Colors.red(':q')} + enter = {Colors.red('discard')} changes] [{Colors.green(':wq')} + enter = {Colors.green('save')} changes + write code]
9
-
10
- Using natural language, tell me how I can modify this entity."""
11
- )
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes