gibson-cli 0.6.0__py3-none-any.whl → 0.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bin/clean.sh +3 -0
- gibson/api/BaseApi.py +2 -1
- gibson/api/Cli.py +9 -2
- gibson/command/Build.py +60 -8
- gibson/command/Help.py +0 -12
- gibson/command/Question.py +4 -7
- gibson/command/code/Code.py +42 -12
- gibson/command/code/Entity.py +25 -7
- gibson/command/code/Model.py +1 -1
- gibson/command/code/Schema.py +1 -1
- gibson/command/code/Test.py +35 -0
- gibson/command/code/Tests.py +12 -21
- gibson/command/importer/Import.py +83 -11
- gibson/command/importer/OpenApi.py +4 -9
- gibson/command/new/Module.py +1 -1
- gibson/command/new/New.py +3 -3
- gibson/command/new/Project.py +2 -2
- gibson/command/rewrite/Rewrite.py +9 -14
- gibson/command/tests/test_command_Conf.py +1 -0
- gibson/conf/Project.py +1 -0
- gibson/core/Configuration.py +21 -58
- gibson/core/Conversation.py +25 -7
- gibson/data/bash-completion.tmpl +3 -4
- gibson/data/postgresql/default-ref-table.tmpl +4 -0
- gibson/data/postgresql/default-table.tmpl +5 -0
- gibson/db/TableExceptions.py +3 -0
- gibson/db/tests/test_db_TableExceptions.py +4 -0
- gibson/services/code/context/schema/EntityKeys.py +3 -3
- gibson/services/code/context/schema/tests/test_code_context_schema_EntityKeys.py +3 -3
- gibson/structure/Entity.py +12 -109
- gibson/structure/mysql/Entity.py +117 -0
- gibson/structure/{constraints → mysql/constraints}/ReferenceConstraint.py +6 -2
- gibson/structure/{keys → mysql/keys}/ForeignKey.py +9 -5
- gibson/structure/{keys → mysql/keys}/Index.py +7 -3
- gibson/structure/{keys/tests/test_ForeignKey.py → mysql/keys/tests/test_structure_mysql_keys_ForeignKey.py} +16 -8
- gibson/structure/{keys/tests/test_Index.py → mysql/keys/tests/test_structure_mysql_keys_Index.py} +7 -3
- gibson/structure/{keys/tests/test_IndexAttribute.py → mysql/keys/tests/test_structure_mysql_keys_IndexAttribute.py} +1 -1
- gibson/structure/mysql/testing.py +231 -0
- gibson/structure/{tests/test_Entity.py → mysql/tests/test_structure_mysql_Entity.py} +34 -20
- gibson/structure/postgresql/Entity.py +108 -0
- gibson/structure/postgresql/References.py +61 -0
- gibson/structure/postgresql/table/ForeignKey.py +28 -0
- gibson/structure/postgresql/table/tests/test_structure_postgresql_table_ForeignKey.py +44 -0
- gibson/structure/{testing.py → postgresql/testing.py} +45 -82
- gibson/structure/postgresql/tests/test_structure_postgresql_Entity.py +82 -0
- gibson/structure/tests/test_structure_Entity.py +22 -0
- {gibson_cli-0.6.0.dist-info → gibson_cli-0.7.0.dist-info}/METADATA +76 -27
- {gibson_cli-0.6.0.dist-info → gibson_cli-0.7.0.dist-info}/RECORD +58 -47
- {gibson_cli-0.6.0.dist-info → gibson_cli-0.7.0.dist-info}/WHEEL +1 -1
- gibson/command/rewrite/Tests.py +0 -26
- /gibson/command/{rewrite → code}/Api.py +0 -0
- /gibson/command/{rewrite → code}/Base.py +0 -0
- /gibson/command/{rewrite → code}/Models.py +0 -0
- /gibson/command/{rewrite → code}/Schemas.py +0 -0
- /gibson/data/{default-ref-table.tmpl → mysql/default-ref-table.tmpl} +0 -0
- /gibson/data/{default-table.tmpl → mysql/default-table.tmpl} +0 -0
- /gibson/structure/{keys → mysql/keys}/IndexAttribute.py +0 -0
- {gibson_cli-0.6.0.dist-info → gibson_cli-0.7.0.dist-info}/entry_points.txt +0 -0
- {gibson_cli-0.6.0.dist-info → gibson_cli-0.7.0.dist-info}/top_level.txt +0 -0
@@ -1,97 +1,78 @@
|
|
1
|
-
from gibson.structure.Entity import Entity
|
1
|
+
from gibson.structure.postgresql.Entity import Entity
|
2
2
|
|
3
3
|
|
4
4
|
def structure_testing_get_entity():
|
5
5
|
entity = Entity()
|
6
6
|
entity.attributes = [
|
7
7
|
{
|
8
|
-
"as_": None,
|
9
|
-
"bytes_": None,
|
10
8
|
"check": None,
|
11
|
-
"
|
9
|
+
"datastore": {
|
10
|
+
"specifics": {
|
11
|
+
"references": None,
|
12
|
+
}
|
13
|
+
},
|
12
14
|
"data_type": {"formatted": "bigint", "raw": "bigint"},
|
13
15
|
"default": None,
|
14
|
-
"extra": {"increment": {"auto": True}},
|
15
16
|
"key": {"index": None, "primary": True, "unique": None},
|
16
17
|
"length": None,
|
17
18
|
"name": "id",
|
18
19
|
"nullable": False,
|
19
20
|
"numeric": {"precision": None, "scale": None},
|
20
|
-
"on": None,
|
21
|
-
"reference": None,
|
22
21
|
"sql": "id bigint not null auto_increment primary key",
|
23
|
-
"unsigned": None,
|
24
|
-
"values": None,
|
25
22
|
},
|
26
23
|
{
|
27
|
-
"as_": None,
|
28
|
-
"bytes_": None,
|
29
24
|
"check": None,
|
30
|
-
"
|
25
|
+
"datastore": {
|
26
|
+
"specifics": {
|
27
|
+
"references": None,
|
28
|
+
}
|
29
|
+
},
|
31
30
|
"data_type": {"formatted": "varchar(36)", "raw": "varchar"},
|
32
31
|
"default": None,
|
33
|
-
"extra": {"increment": {"auto": None}},
|
34
32
|
"key": {"index": None, "primary": None, "unique": True},
|
35
33
|
"length": 36,
|
36
34
|
"name": "uuid",
|
37
35
|
"nullable": False,
|
38
36
|
"numeric": {"precision": None, "scale": None},
|
39
|
-
"on": None,
|
40
|
-
"reference": None,
|
41
37
|
"sql": "uuid varchar(36) not null unique key",
|
42
|
-
"unsigned": None,
|
43
|
-
"values": None,
|
44
38
|
},
|
45
39
|
{
|
46
|
-
"as_": None,
|
47
|
-
"bytes_": None,
|
48
40
|
"check": None,
|
49
|
-
"
|
41
|
+
"datastore": {
|
42
|
+
"specifics": {
|
43
|
+
"references": None,
|
44
|
+
}
|
45
|
+
},
|
50
46
|
"data_type": {"formatted": "datetime", "raw": "datetime"},
|
51
47
|
"default": "current_timestamp",
|
52
|
-
"extra": {"increment": {"auto": None}},
|
53
48
|
"key": {"index": None, "primary": None, "unique": None},
|
54
49
|
"length": None,
|
55
50
|
"name": "date_created",
|
56
51
|
"nullable": False,
|
57
52
|
"numeric": {"precision": None, "scale": None},
|
58
|
-
"on": None,
|
59
|
-
"reference": None,
|
60
53
|
"sql": "date_created datetime not null default current_timestamp",
|
61
|
-
"unsigned": None,
|
62
|
-
"values": None,
|
63
54
|
},
|
64
55
|
{
|
65
|
-
"as_": None,
|
66
|
-
"bytes_": None,
|
67
56
|
"check": None,
|
68
|
-
"
|
57
|
+
"datastore": {
|
58
|
+
"specifics": {
|
59
|
+
"references": None,
|
60
|
+
}
|
61
|
+
},
|
69
62
|
"data_type": {"formatted": "datetime", "raw": "datetime"},
|
70
63
|
"default": "null",
|
71
|
-
"extra": {"increment": {"auto": None}},
|
72
64
|
"key": {"index": None, "primary": None, "unique": None},
|
73
65
|
"length": None,
|
74
66
|
"name": "date_updated",
|
75
67
|
"nullable": None,
|
76
68
|
"numeric": {"precision": None, "scale": None},
|
77
|
-
"on": "update current_timestamp",
|
78
|
-
"reference": None,
|
79
69
|
"sql": "date_updated datetime default null on update current_timestamp",
|
80
|
-
"unsigned": None,
|
81
|
-
"values": None,
|
82
70
|
},
|
83
71
|
]
|
84
72
|
entity.constraints = {"check": []}
|
85
73
|
entity.keys = {"foreign": [], "index": [], "primary": None, "unique": []}
|
86
74
|
entity.name = "abc_def"
|
87
|
-
entity.
|
88
|
-
"auto": None,
|
89
|
-
"charset": None,
|
90
|
-
"collate": None,
|
91
|
-
"default": None,
|
92
|
-
"engine": None,
|
93
|
-
"sql": None,
|
94
|
-
}
|
75
|
+
entity.table = None
|
95
76
|
|
96
77
|
return entity
|
97
78
|
|
@@ -103,92 +84,74 @@ def structure_testing_get_struct_data():
|
|
103
84
|
"struct": {
|
104
85
|
"attributes": [
|
105
86
|
{
|
106
|
-
"as_": None,
|
107
|
-
"bytes_": None,
|
108
87
|
"check": None,
|
109
|
-
"
|
88
|
+
"datastore": {
|
89
|
+
"specifics": {
|
90
|
+
"references": None,
|
91
|
+
}
|
92
|
+
},
|
110
93
|
"data_type": {"formatted": "bigint", "raw": "bigint"},
|
111
94
|
"default": None,
|
112
|
-
"extra": {"increment": {"auto": True}},
|
113
95
|
"key": {"index": None, "primary": True, "unique": None},
|
114
96
|
"length": None,
|
115
97
|
"name": "id",
|
116
98
|
"nullable": False,
|
117
99
|
"numeric": {"precision": None, "scale": None},
|
118
|
-
"on": None,
|
119
|
-
"reference": None,
|
120
100
|
"sql": "id bigint not null auto_increment primary key",
|
121
|
-
"unsigned": None,
|
122
|
-
"values": None,
|
123
101
|
},
|
124
102
|
{
|
125
|
-
"as_": None,
|
126
|
-
"bytes_": None,
|
127
103
|
"check": None,
|
128
|
-
"
|
104
|
+
"datastore": {
|
105
|
+
"specifics": {
|
106
|
+
"reference": None,
|
107
|
+
}
|
108
|
+
},
|
129
109
|
"data_type": {"formatted": "varchar(36)", "raw": "varchar"},
|
130
110
|
"default": None,
|
131
|
-
"extra": {"increment": {"auto": None}},
|
132
111
|
"key": {"index": None, "primary": None, "unique": True},
|
133
112
|
"length": 36,
|
134
113
|
"name": "uuid",
|
135
114
|
"nullable": False,
|
136
115
|
"numeric": {"precision": None, "scale": None},
|
137
|
-
"on": None,
|
138
|
-
"reference": None,
|
139
116
|
"sql": "uuid varchar(36) not null unique key",
|
140
|
-
"unsigned": None,
|
141
|
-
"values": None,
|
142
117
|
},
|
143
118
|
{
|
144
|
-
"as_": None,
|
145
|
-
"bytes_": None,
|
146
119
|
"check": None,
|
147
|
-
"
|
120
|
+
"datastore": {
|
121
|
+
"specifics": {
|
122
|
+
"references": None,
|
123
|
+
}
|
124
|
+
},
|
148
125
|
"data_type": {"formatted": "datetime", "raw": "datetime"},
|
149
126
|
"default": "current_timestamp",
|
150
|
-
"extra": {"increment": {"auto": None}},
|
151
127
|
"key": {"index": None, "primary": None, "unique": None},
|
152
128
|
"length": None,
|
153
129
|
"name": "date_created",
|
154
130
|
"nullable": False,
|
155
131
|
"numeric": {"precision": None, "scale": None},
|
156
|
-
"on": None,
|
157
|
-
"reference": None,
|
158
132
|
"sql": "date_created datetime not null default current_timestamp",
|
159
|
-
"unsigned": None,
|
160
|
-
"values": None,
|
161
133
|
},
|
162
134
|
{
|
163
|
-
"as_": None,
|
164
|
-
"bytes_": None,
|
165
135
|
"check": None,
|
166
|
-
"
|
136
|
+
"datastore": {
|
137
|
+
"specifics": {
|
138
|
+
"references": None,
|
139
|
+
}
|
140
|
+
},
|
167
141
|
"data_type": {"formatted": "datetime", "raw": "datetime"},
|
168
142
|
"default": "null",
|
169
|
-
"extra": {"increment": {"auto": None}},
|
170
143
|
"key": {"index": None, "primary": None, "unique": None},
|
171
144
|
"length": None,
|
172
145
|
"name": "date_updated",
|
173
146
|
"nullable": None,
|
174
147
|
"numeric": {"precision": None, "scale": None},
|
175
|
-
"
|
176
|
-
"
|
177
|
-
"sql": "date_updated datetime default null on update current_timestamp",
|
178
|
-
"unsigned": None,
|
179
|
-
"values": None,
|
148
|
+
"sql": "date_updated datetime default null on update "
|
149
|
+
+ "current_timestamp",
|
180
150
|
},
|
181
151
|
],
|
182
152
|
"constraints": {"check": []},
|
183
153
|
"keys": {"foreign": [], "index": [], "primary": None, "unique": []},
|
184
|
-
"
|
185
|
-
"auto": None,
|
186
|
-
"charset": None,
|
187
|
-
"collate": None,
|
188
|
-
"default": None,
|
189
|
-
"engine": None,
|
190
|
-
"sql": None,
|
191
|
-
},
|
154
|
+
"table": None,
|
192
155
|
},
|
193
156
|
}
|
194
157
|
}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
import pytest
|
2
|
+
|
3
|
+
from gibson.structure.postgresql.Entity import Entity
|
4
|
+
from gibson.structure.postgresql.References import References
|
5
|
+
from gibson.structure.postgresql.table.ForeignKey import ForeignKey
|
6
|
+
from gibson.structure.postgresql.testing import (
|
7
|
+
structure_testing_get_entity,
|
8
|
+
structure_testing_get_struct_data,
|
9
|
+
)
|
10
|
+
|
11
|
+
|
12
|
+
def test_add_foreign_key():
|
13
|
+
references = References()
|
14
|
+
references.columns = ["a", "b"]
|
15
|
+
references.ref_table = "abc_def"
|
16
|
+
|
17
|
+
foreign_key = ForeignKey()
|
18
|
+
foreign_key.columns = ["c", "d"]
|
19
|
+
foreign_key.references = references
|
20
|
+
|
21
|
+
entity = structure_testing_get_entity()
|
22
|
+
entity.add_foreign_key(foreign_key)
|
23
|
+
|
24
|
+
assert entity.keys["foreign"] == [
|
25
|
+
{
|
26
|
+
"attributes": ["c", "d"],
|
27
|
+
"references": {
|
28
|
+
"attributes": ["a", "b"],
|
29
|
+
"datastore": {
|
30
|
+
"specifics": {
|
31
|
+
"match": {"full": None, "partial": None, "simple": None}
|
32
|
+
}
|
33
|
+
},
|
34
|
+
"entity": {"name": "abc_def", "schema_": None},
|
35
|
+
"on": {"delete": None, "update": None},
|
36
|
+
"sql": "references abc_def (a, b)",
|
37
|
+
},
|
38
|
+
"sql": "foreign key (c, d) references abc_def (a, b)",
|
39
|
+
}
|
40
|
+
]
|
41
|
+
|
42
|
+
|
43
|
+
def test_add_attribute_after():
|
44
|
+
entity = structure_testing_get_entity()
|
45
|
+
entity.add_attribute("abc", "bigint", after="uuid")
|
46
|
+
|
47
|
+
assert entity.attributes[2]["sql"] == "abc bigint"
|
48
|
+
|
49
|
+
|
50
|
+
def test_add_attribute_before():
|
51
|
+
entity = structure_testing_get_entity()
|
52
|
+
entity.add_attribute("abc", "bigint", before="uuid")
|
53
|
+
|
54
|
+
assert entity.attributes[1]["sql"] == "abc bigint"
|
55
|
+
|
56
|
+
|
57
|
+
def test_add_attribute_append():
|
58
|
+
entity = structure_testing_get_entity()
|
59
|
+
entity.add_attribute("abc", "bigint")
|
60
|
+
|
61
|
+
assert entity.attributes[-1]["sql"] == "abc bigint"
|
62
|
+
|
63
|
+
|
64
|
+
def test_import_from_struct_incorrect_data_format():
|
65
|
+
with pytest.raises(RuntimeError) as e:
|
66
|
+
Entity().import_from_struct({"abc": "def"})
|
67
|
+
|
68
|
+
assert str(e.value) == "cannot import from struct, incorrect data format"
|
69
|
+
|
70
|
+
|
71
|
+
def test_import_from_struct():
|
72
|
+
entity = Entity().import_from_struct(structure_testing_get_struct_data())
|
73
|
+
|
74
|
+
assert entity.name == "abc_def"
|
75
|
+
assert len(entity.attributes) == 4
|
76
|
+
assert entity.attributes[0]["name"] == "id"
|
77
|
+
assert entity.attributes[1]["name"] == "uuid"
|
78
|
+
assert entity.attributes[2]["name"] == "date_created"
|
79
|
+
assert entity.attributes[3]["name"] == "date_updated"
|
80
|
+
assert entity.constraints == {"check": []}
|
81
|
+
assert entity.keys == {"foreign": [], "index": [], "primary": None, "unique": []}
|
82
|
+
assert entity.table is None
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import pytest
|
2
|
+
|
3
|
+
from gibson.structure.Entity import Entity
|
4
|
+
from gibson.structure.mysql.Entity import Entity as MysqlEntity
|
5
|
+
from gibson.structure.postgresql.Entity import Entity as PostgresqlEntity
|
6
|
+
|
7
|
+
|
8
|
+
def test_instantiate_exceptions():
|
9
|
+
with pytest.raises(RuntimeError) as e:
|
10
|
+
Entity().instantiate("invalid")
|
11
|
+
|
12
|
+
assert str(e.value) == 'unrecognized datastore type "invalid"'
|
13
|
+
|
14
|
+
|
15
|
+
def test_instantiate_mysql():
|
16
|
+
entity = Entity().instantiate("mysql")
|
17
|
+
assert isinstance(entity, MysqlEntity)
|
18
|
+
|
19
|
+
|
20
|
+
def test_instantiate_postgresql():
|
21
|
+
entity = Entity().instantiate("postgresql")
|
22
|
+
assert isinstance(entity, PostgresqlEntity)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: gibson-cli
|
3
|
-
Version: 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
|
[](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
|
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
|
129
|
-
- `:Gibson
|
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
|
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
|
256
|
+
`gibson code base`
|
207
257
|
|
208
258
|
### Writing the Code for a Single Model
|
209
259
|
|
210
|
-
`gibson model [
|
260
|
+
`gibson code model [entity name]`
|
211
261
|
|
212
262
|
### Writing the Code for a Single Schema
|
213
263
|
|
214
|
-
`gibson schema [
|
264
|
+
`gibson code schema [entity name]`
|
215
265
|
|
216
266
|
### Writing the Code for All Models
|
217
267
|
|
218
|
-
`gibson
|
268
|
+
`gibson code models`
|
219
269
|
|
220
270
|
### Writing the Code for All Schemas
|
221
271
|
|
222
|
-
`gibson
|
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
|
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 [
|
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
|
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
|
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
|
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
|
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
|
312
|
-
- `gibson
|
313
|
-
- `gibson
|
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
|
315
|
-
- e.g. `gibson
|
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
|
|