graft-engine-cli 0.0.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.
@@ -0,0 +1,7 @@
1
+ Copyright <2026> <Phaedalus>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,215 @@
1
+ Metadata-Version: 2.4
2
+ Name: graft-engine-cli
3
+ Version: 0.0.1
4
+ Summary: Command line tools for the Graft game engine
5
+ Author: Phaedalus
6
+ License: MIT
7
+ Requires-Python: >=3.9
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: packaging
11
+ Dynamic: license-file
12
+
13
+ # Graft CLI
14
+
15
+ Command line tools for creating and managing projects built with the **Graft game engine**.
16
+
17
+ Graft CLI helps you create new projects, run them locally, install specific engine versions, and work with project templates.
18
+
19
+ This tool is designed to stay lightweight and simple while the Graft ecosystem grows.
20
+
21
+ ---
22
+
23
+ ## Installation
24
+
25
+ ### Install with pip
26
+
27
+ ```bash
28
+ pip install graft-cli
29
+ ```
30
+
31
+ Or install locally from source:
32
+
33
+ ```bash
34
+ pip install .
35
+ ```
36
+
37
+ ---
38
+
39
+ ## Basic Usage
40
+
41
+ Running the CLI with no arguments will display available commands:
42
+
43
+ ```bash
44
+ graft
45
+ ```
46
+
47
+ Output:
48
+
49
+ ```
50
+ Graft CLI
51
+ Usage:
52
+ graft new [name] [--engine VERSION]
53
+ graft run
54
+ graft clone <repo>
55
+ graft doctor
56
+ graft engines
57
+ graft version
58
+ ```
59
+
60
+ ---
61
+
62
+ # Commands
63
+
64
+ ## Create a New Project
65
+
66
+ Create a new Graft project:
67
+
68
+ ```bash
69
+ graft new MyGame
70
+ ```
71
+
72
+ Create using a specific engine version:
73
+
74
+ ```bash
75
+ graft new MyGame --engine 0.0.6
76
+ ```
77
+
78
+ Initialize a project in the current directory:
79
+
80
+ ```bash
81
+ graft new .
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Run a Project
87
+
88
+ Run the current project:
89
+
90
+ ```bash
91
+ graft run
92
+ ```
93
+
94
+ The CLI will automatically:
95
+
96
+ * locate the project root
97
+ * read the entry point from `project.graft`
98
+ * run the Graft engine
99
+
100
+ Older engine versions are automatically supported.
101
+
102
+ ---
103
+
104
+ ## Clone a Template
105
+
106
+ Clone a project template:
107
+
108
+ ```bash
109
+ graft clone https://github.com/user/template
110
+ ```
111
+
112
+ Templates should include a `project.graft` file.
113
+
114
+ ---
115
+
116
+ ## List Engine Versions
117
+
118
+ View available Graft engine versions:
119
+
120
+ ```bash
121
+ graft engines
122
+ ```
123
+
124
+ Example output:
125
+
126
+ ```
127
+ Available Graft Versions:
128
+
129
+ 0.0.1
130
+ 0.0.2
131
+ 0.0.3
132
+ 0.0.4
133
+ 0.0.5
134
+ 0.0.6
135
+
136
+ Latest: 0.0.6
137
+ ```
138
+
139
+ ---
140
+
141
+ ## Environment Diagnostics
142
+
143
+ Check your development environment:
144
+
145
+ ```bash
146
+ graft doctor
147
+ ```
148
+
149
+ This verifies tools required by Graft such as:
150
+
151
+ * Python
152
+ * Git
153
+ * Rust
154
+ * Cargo
155
+
156
+ ---
157
+
158
+ ## CLI Version
159
+
160
+ Display the installed CLI version:
161
+
162
+ ```bash
163
+ graft version
164
+ ```
165
+
166
+ ---
167
+
168
+ # Project Structure
169
+
170
+ A typical Graft project looks like:
171
+
172
+ ```
173
+ MyGame/
174
+ ├ engine/
175
+ ├ scripts/
176
+ │ └ main.lua
177
+ ├ assets/
178
+ └ project.graft
179
+ ```
180
+
181
+ Example `project.graft`:
182
+
183
+ ```
184
+ name = "MyGame"
185
+ entry = "scripts/main.lua"
186
+ ```
187
+
188
+ ---
189
+
190
+ # Engine Versions
191
+
192
+ The CLI installs engine versions directly from the official repository:
193
+
194
+ https://github.com/phaedalus/graft
195
+
196
+ Projects can target specific engine releases for stability.
197
+
198
+ ---
199
+
200
+ # Philosophy
201
+
202
+ Graft is designed with a simple philosophy:
203
+
204
+ * **Rust for performance**
205
+ * **Lua for gameplay scripting**
206
+ * **Minimal core**
207
+ * **Fork-per-project engine architecture**
208
+
209
+ The CLI reflects this philosophy by staying small and predictable.
210
+
211
+ ---
212
+
213
+ # License
214
+
215
+ MIT License
@@ -0,0 +1,203 @@
1
+ # Graft CLI
2
+
3
+ Command line tools for creating and managing projects built with the **Graft game engine**.
4
+
5
+ Graft CLI helps you create new projects, run them locally, install specific engine versions, and work with project templates.
6
+
7
+ This tool is designed to stay lightweight and simple while the Graft ecosystem grows.
8
+
9
+ ---
10
+
11
+ ## Installation
12
+
13
+ ### Install with pip
14
+
15
+ ```bash
16
+ pip install graft-cli
17
+ ```
18
+
19
+ Or install locally from source:
20
+
21
+ ```bash
22
+ pip install .
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Basic Usage
28
+
29
+ Running the CLI with no arguments will display available commands:
30
+
31
+ ```bash
32
+ graft
33
+ ```
34
+
35
+ Output:
36
+
37
+ ```
38
+ Graft CLI
39
+ Usage:
40
+ graft new [name] [--engine VERSION]
41
+ graft run
42
+ graft clone <repo>
43
+ graft doctor
44
+ graft engines
45
+ graft version
46
+ ```
47
+
48
+ ---
49
+
50
+ # Commands
51
+
52
+ ## Create a New Project
53
+
54
+ Create a new Graft project:
55
+
56
+ ```bash
57
+ graft new MyGame
58
+ ```
59
+
60
+ Create using a specific engine version:
61
+
62
+ ```bash
63
+ graft new MyGame --engine 0.0.6
64
+ ```
65
+
66
+ Initialize a project in the current directory:
67
+
68
+ ```bash
69
+ graft new .
70
+ ```
71
+
72
+ ---
73
+
74
+ ## Run a Project
75
+
76
+ Run the current project:
77
+
78
+ ```bash
79
+ graft run
80
+ ```
81
+
82
+ The CLI will automatically:
83
+
84
+ * locate the project root
85
+ * read the entry point from `project.graft`
86
+ * run the Graft engine
87
+
88
+ Older engine versions are automatically supported.
89
+
90
+ ---
91
+
92
+ ## Clone a Template
93
+
94
+ Clone a project template:
95
+
96
+ ```bash
97
+ graft clone https://github.com/user/template
98
+ ```
99
+
100
+ Templates should include a `project.graft` file.
101
+
102
+ ---
103
+
104
+ ## List Engine Versions
105
+
106
+ View available Graft engine versions:
107
+
108
+ ```bash
109
+ graft engines
110
+ ```
111
+
112
+ Example output:
113
+
114
+ ```
115
+ Available Graft Versions:
116
+
117
+ 0.0.1
118
+ 0.0.2
119
+ 0.0.3
120
+ 0.0.4
121
+ 0.0.5
122
+ 0.0.6
123
+
124
+ Latest: 0.0.6
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Environment Diagnostics
130
+
131
+ Check your development environment:
132
+
133
+ ```bash
134
+ graft doctor
135
+ ```
136
+
137
+ This verifies tools required by Graft such as:
138
+
139
+ * Python
140
+ * Git
141
+ * Rust
142
+ * Cargo
143
+
144
+ ---
145
+
146
+ ## CLI Version
147
+
148
+ Display the installed CLI version:
149
+
150
+ ```bash
151
+ graft version
152
+ ```
153
+
154
+ ---
155
+
156
+ # Project Structure
157
+
158
+ A typical Graft project looks like:
159
+
160
+ ```
161
+ MyGame/
162
+ ├ engine/
163
+ ├ scripts/
164
+ │ └ main.lua
165
+ ├ assets/
166
+ └ project.graft
167
+ ```
168
+
169
+ Example `project.graft`:
170
+
171
+ ```
172
+ name = "MyGame"
173
+ entry = "scripts/main.lua"
174
+ ```
175
+
176
+ ---
177
+
178
+ # Engine Versions
179
+
180
+ The CLI installs engine versions directly from the official repository:
181
+
182
+ https://github.com/phaedalus/graft
183
+
184
+ Projects can target specific engine releases for stability.
185
+
186
+ ---
187
+
188
+ # Philosophy
189
+
190
+ Graft is designed with a simple philosophy:
191
+
192
+ * **Rust for performance**
193
+ * **Lua for gameplay scripting**
194
+ * **Minimal core**
195
+ * **Fork-per-project engine architecture**
196
+
197
+ The CLI reflects this philosophy by staying small and predictable.
198
+
199
+ ---
200
+
201
+ # License
202
+
203
+ MIT License
File without changes
@@ -0,0 +1,47 @@
1
+ import shutil
2
+ import subprocess
3
+ import sys
4
+
5
+ def check_command(cmd):
6
+ if shutil.which(cmd) is None:
7
+ return False
8
+ return True
9
+
10
+ def check_rust():
11
+ try:
12
+ subprocess.run(["rustc", "--version"], capture_output=True, check=True)
13
+ return True
14
+ except:
15
+ return False
16
+
17
+ def check_cargo():
18
+ try:
19
+ subprocess.run(["cargo", "--version"], capture_output=True, check=True)
20
+ return True
21
+ except:
22
+ return False
23
+
24
+ def run_doctor():
25
+
26
+ print("Graft Enviroment Doctor")
27
+ print("-----------------------")
28
+
29
+ py_version = sys.version.split()[0]
30
+ print(f"Python: {py_version}")
31
+
32
+ if check_command("git"):
33
+ print("Git: OK")
34
+ else:
35
+ print("Git: MISSING")
36
+
37
+ if check_rust():
38
+ print("Rust: OK")
39
+ else:
40
+ print("Rust: MISSING")
41
+
42
+ if check_cargo():
43
+ print("Cargo: OK")
44
+ else:
45
+ print("Cargo: MISSING")
46
+
47
+ print("-----------------------")
@@ -0,0 +1,4 @@
1
+ GRAFT_REPO = "https://github.com/phaedalus/graft"
2
+
3
+ def list_engine_versions():
4
+
@@ -0,0 +1,24 @@
1
+ import subprocess
2
+ import os
3
+
4
+
5
+ def clone_template(repo):
6
+
7
+ print("Cloning repository...")
8
+
9
+ subprocess.run(["git", "clone", repo], check=True)
10
+
11
+ repo_name = repo.rstrip("/").split("/")[-1]
12
+
13
+ if repo_name.endswith(".git"):
14
+ repo_name = repo_name[:-4]
15
+
16
+ project_dir = os.path.join(os.getcwd(), repo_name)
17
+
18
+ project_file = os.path.join(project_dir, "project.graft")
19
+
20
+ if not os.path.exists(project_file):
21
+ print("Warning: This repository is missing a project.graft file.")
22
+ print("It may not be a valid Graft project template.")
23
+
24
+ print("Repository cloned.")
@@ -0,0 +1,75 @@
1
+ import sys
2
+ from graft_cli.project import new_project, list_engine_versions
3
+ from graft_cli.run import run_project
4
+ from graft_cli.git_tools import clone_template
5
+ from graft_cli.doctor import run_doctor
6
+
7
+ def main():
8
+
9
+ if len(sys.argv) < 2:
10
+ print("Graft CLI")
11
+ print("Usage:")
12
+ print(" graft new [name] [--engine VERSION]")
13
+ print(" graft run")
14
+ print(" graft clone <repo>")
15
+ print(" graft doctor")
16
+ print(" graft engines")
17
+ print(" graft version")
18
+ return
19
+
20
+ command = sys.argv[1]
21
+
22
+ if command == "new":
23
+
24
+ name = None
25
+ engine_version = None
26
+
27
+ args = sys.argv[2:]
28
+
29
+ i = 0
30
+ while i < len(args):
31
+
32
+ arg = args[i]
33
+
34
+ if arg == "--engine":
35
+ if i + 1 >= len(args):
36
+ print("Error: --engine requires a version.")
37
+ return
38
+
39
+ engine_version = args[i + 1]
40
+ i += 2
41
+ continue
42
+
43
+ if name is None:
44
+ name = arg
45
+
46
+ i += 1
47
+
48
+ new_project(name, engine_version)
49
+
50
+ elif command == "run":
51
+ run_project()
52
+
53
+ elif command == "clone":
54
+ if len(sys.argv) < 3:
55
+ print("Usage: graft clone <repo>")
56
+ return
57
+
58
+ repo = sys.argv[2]
59
+ clone_template(repo)
60
+
61
+ elif command == "doctor":
62
+ run_doctor()
63
+
64
+ elif command == "engines":
65
+ list_engine_versions()
66
+
67
+ elif command == "version":
68
+ print("graft-cli 0.0.1")
69
+
70
+ else:
71
+ print(f"Unknown command: {command}")
72
+ print("Run 'graft' for usage.")
73
+
74
+ if __name__ == "__main__":
75
+ main()
@@ -0,0 +1,227 @@
1
+ import os
2
+ import stat
3
+ import subprocess
4
+ import shutil
5
+ from packaging.version import Version
6
+
7
+ GRAFT_REPO = "https://github.com/phaedalus/graft"
8
+
9
+
10
+ def remove_readonly(func, path, excinfo):
11
+ os.chmod(path, stat.S_IWRITE)
12
+ func(path)
13
+
14
+
15
+ def inside_existing_project():
16
+
17
+ current = os.getcwd()
18
+
19
+ while True:
20
+ if os.path.exists(os.path.join(current, "project.graft")):
21
+ return True
22
+
23
+ parent = os.path.dirname(current)
24
+
25
+ if parent == current:
26
+ return False
27
+
28
+ current = parent
29
+
30
+
31
+ def get_latest_tag():
32
+
33
+ result = subprocess.run(
34
+ ["git", "ls-remote", "--tags", GRAFT_REPO],
35
+ capture_output=True,
36
+ text=True,
37
+ check=True
38
+ )
39
+
40
+ versions = []
41
+
42
+ for line in result.stdout.splitlines():
43
+
44
+ tag = line.split("/")[-1]
45
+
46
+ try:
47
+ versions.append(Version(tag))
48
+ except:
49
+ continue
50
+
51
+ versions.sort()
52
+
53
+ return str(versions[-1])
54
+
55
+
56
+ def clone_engine(target_dir, version=None):
57
+
58
+ if version is None or version == "latest":
59
+ print("Fetching latest Graft version...")
60
+ version = get_latest_tag()
61
+
62
+ print(f"Installing Graft {version}")
63
+
64
+ subprocess.run(
65
+ ["git", "clone", "--quiet", "--depth", "1", "--branch", version, GRAFT_REPO, target_dir],
66
+ check=True
67
+ )
68
+
69
+ git_dir = os.path.join(target_dir, ".git")
70
+
71
+ if os.path.exists(git_dir):
72
+ shutil.rmtree(git_dir, onerror=remove_readonly)
73
+
74
+ print("Engine installed.")
75
+
76
+
77
+ def create_project_files(project_dir):
78
+
79
+ scripts = os.path.join(project_dir, "scripts")
80
+ assets = os.path.join(project_dir, "assets")
81
+
82
+ os.makedirs(scripts, exist_ok=True)
83
+ os.makedirs(assets, exist_ok=True)
84
+
85
+ main_lua = os.path.join(scripts, "main.lua")
86
+
87
+ if not os.path.exists(main_lua):
88
+ with open(main_lua, "w") as f:
89
+ f.write(
90
+ """function update(dt)
91
+ -- Logic
92
+ end
93
+
94
+ function draw()
95
+ -- Rendering
96
+ end
97
+ """
98
+ )
99
+
100
+ project_file = os.path.join(project_dir, "project.graft")
101
+
102
+ if not os.path.exists(project_file):
103
+
104
+ name = os.path.basename(project_dir)
105
+
106
+ with open(project_file, "w") as f:
107
+ f.write(
108
+ f"""name = "{name}"
109
+ entry = "scripts/main.lua"
110
+ """
111
+ )
112
+
113
+
114
+ def read_project_name(project_dir):
115
+
116
+ project_file = os.path.join(project_dir, "project.graft")
117
+
118
+ if not os.path.exists(project_file):
119
+ return os.path.basename(project_dir)
120
+
121
+ with open(project_file, "r", encoding="utf-8") as f:
122
+ for line in f:
123
+ if line.startswith("name"):
124
+ return line.split("=")[1].strip().strip('"')
125
+
126
+ return os.path.basename(project_dir)
127
+
128
+
129
+ def wire_engine(project_dir):
130
+
131
+ engine_dir = os.path.join(project_dir, "engine")
132
+ scripts_dir = os.path.join(project_dir, "scripts")
133
+
134
+ engine_main = os.path.join(engine_dir, "main.lua")
135
+ api_file = os.path.join(engine_dir, "graft_api.lua")
136
+
137
+ if os.path.exists(engine_main):
138
+ os.remove(engine_main)
139
+
140
+ if os.path.exists(api_file):
141
+ os.rename(api_file, os.path.join(scripts_dir, "graft_api.lua"))
142
+
143
+ project_name = read_project_name(project_dir)
144
+
145
+ main_rs = os.path.join(engine_dir, "src", "main.rs")
146
+
147
+ if os.path.exists(main_rs):
148
+
149
+ with open(main_rs, "r", encoding="utf-8") as f:
150
+ content = f.read()
151
+
152
+ target = 'title: "Graft Game".to_string(),'
153
+
154
+ if target in content:
155
+
156
+ content = content.replace(
157
+ target,
158
+ f'title: "{project_name}".to_string(),'
159
+ )
160
+
161
+ with open(main_rs, "w", encoding="utf-8") as f:
162
+ f.write(content)
163
+
164
+ print("Engine title updated.")
165
+
166
+ else:
167
+ print("Engine version does not support window titles, skipping.")
168
+
169
+
170
+ def new_project(name=None, engine_version=None):
171
+
172
+ if inside_existing_project():
173
+ print("Error: Cannot create a Graft project inside another Graft project.")
174
+ return
175
+
176
+ if name is None or name == ".":
177
+ project_dir = os.getcwd()
178
+ else:
179
+
180
+ project_dir = os.path.join(os.getcwd(), name)
181
+
182
+ if os.path.exists(project_dir):
183
+ print("Project folder already exists")
184
+ return
185
+
186
+ os.makedirs(project_dir)
187
+
188
+ engine_dir = os.path.join(project_dir, "engine")
189
+
190
+ if not os.path.exists(engine_dir):
191
+ clone_engine(engine_dir, engine_version)
192
+
193
+ create_project_files(project_dir)
194
+
195
+ wire_engine(project_dir)
196
+
197
+ print("Graft project ready.")
198
+
199
+
200
+ def list_engine_versions():
201
+
202
+ result = subprocess.run(
203
+ ["git", "ls-remote", "--tags", GRAFT_REPO],
204
+ capture_output=True,
205
+ text=True,
206
+ check=True
207
+ )
208
+
209
+ versions = []
210
+
211
+ for line in result.stdout.splitlines():
212
+
213
+ tag = line.split("/")[-1]
214
+
215
+ try:
216
+ versions.append(Version(tag))
217
+ except:
218
+ continue
219
+
220
+ versions.sort()
221
+
222
+ print("Available Graft Versions:\n")
223
+
224
+ for v in versions:
225
+ print(v)
226
+
227
+ print("\nLatest:", versions[-1])
@@ -0,0 +1,90 @@
1
+ import os
2
+ import shutil
3
+ import subprocess
4
+
5
+
6
+ def find_project_root():
7
+
8
+ current = os.getcwd()
9
+
10
+ while True:
11
+ if os.path.exists(os.path.join(current, "project.graft")):
12
+ return current
13
+
14
+ parent = os.path.dirname(current)
15
+
16
+ if parent == current:
17
+ print("Error: Not inside a Graft project.")
18
+ return None
19
+
20
+ current = parent
21
+
22
+
23
+ def get_entry(project_dir):
24
+
25
+ graft_file = os.path.join(project_dir, "project.graft")
26
+ entry = "scripts/main.lua"
27
+
28
+ if os.path.exists(graft_file):
29
+ with open(graft_file) as f:
30
+ for line in f:
31
+ if line.startswith("entry"):
32
+ entry = line.split("=")[1].strip().strip('"')
33
+
34
+ return entry
35
+
36
+
37
+ def engine_supports_entry_arg(engine_dir):
38
+
39
+ main_rs = os.path.join(engine_dir, "src", "main.rs")
40
+
41
+ if not os.path.exists(main_rs):
42
+ return False
43
+
44
+ with open(main_rs, "r", encoding="utf-8") as f:
45
+ content = f.read()
46
+
47
+ # crude but effective detection
48
+ return "env::args" in content
49
+
50
+
51
+ def run_project():
52
+
53
+ project_dir = find_project_root()
54
+
55
+ if project_dir is None:
56
+ return
57
+
58
+ engine_dir = os.path.join(project_dir, "engine")
59
+
60
+ if not os.path.exists(engine_dir):
61
+ print("Error: Engine folder missing.")
62
+ return
63
+
64
+ entry = get_entry(project_dir)
65
+
66
+ source_entry = os.path.join(project_dir, entry)
67
+
68
+ if not os.path.exists(source_entry):
69
+ print(f"Error: Entry file not found: {entry}")
70
+ return
71
+
72
+ print(f"Running project using entry: {entry}")
73
+
74
+ if engine_supports_entry_arg(engine_dir):
75
+
76
+ subprocess.run(
77
+ ["cargo", "run", "--", entry],
78
+ cwd=engine_dir
79
+ )
80
+
81
+ else:
82
+
83
+ engine_entry = os.path.join(engine_dir, "main.lua")
84
+
85
+ shutil.copy(source_entry, engine_entry)
86
+
87
+ subprocess.run(
88
+ ["cargo", "run"],
89
+ cwd=engine_dir
90
+ )
@@ -0,0 +1,215 @@
1
+ Metadata-Version: 2.4
2
+ Name: graft-engine-cli
3
+ Version: 0.0.1
4
+ Summary: Command line tools for the Graft game engine
5
+ Author: Phaedalus
6
+ License: MIT
7
+ Requires-Python: >=3.9
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: packaging
11
+ Dynamic: license-file
12
+
13
+ # Graft CLI
14
+
15
+ Command line tools for creating and managing projects built with the **Graft game engine**.
16
+
17
+ Graft CLI helps you create new projects, run them locally, install specific engine versions, and work with project templates.
18
+
19
+ This tool is designed to stay lightweight and simple while the Graft ecosystem grows.
20
+
21
+ ---
22
+
23
+ ## Installation
24
+
25
+ ### Install with pip
26
+
27
+ ```bash
28
+ pip install graft-cli
29
+ ```
30
+
31
+ Or install locally from source:
32
+
33
+ ```bash
34
+ pip install .
35
+ ```
36
+
37
+ ---
38
+
39
+ ## Basic Usage
40
+
41
+ Running the CLI with no arguments will display available commands:
42
+
43
+ ```bash
44
+ graft
45
+ ```
46
+
47
+ Output:
48
+
49
+ ```
50
+ Graft CLI
51
+ Usage:
52
+ graft new [name] [--engine VERSION]
53
+ graft run
54
+ graft clone <repo>
55
+ graft doctor
56
+ graft engines
57
+ graft version
58
+ ```
59
+
60
+ ---
61
+
62
+ # Commands
63
+
64
+ ## Create a New Project
65
+
66
+ Create a new Graft project:
67
+
68
+ ```bash
69
+ graft new MyGame
70
+ ```
71
+
72
+ Create using a specific engine version:
73
+
74
+ ```bash
75
+ graft new MyGame --engine 0.0.6
76
+ ```
77
+
78
+ Initialize a project in the current directory:
79
+
80
+ ```bash
81
+ graft new .
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Run a Project
87
+
88
+ Run the current project:
89
+
90
+ ```bash
91
+ graft run
92
+ ```
93
+
94
+ The CLI will automatically:
95
+
96
+ * locate the project root
97
+ * read the entry point from `project.graft`
98
+ * run the Graft engine
99
+
100
+ Older engine versions are automatically supported.
101
+
102
+ ---
103
+
104
+ ## Clone a Template
105
+
106
+ Clone a project template:
107
+
108
+ ```bash
109
+ graft clone https://github.com/user/template
110
+ ```
111
+
112
+ Templates should include a `project.graft` file.
113
+
114
+ ---
115
+
116
+ ## List Engine Versions
117
+
118
+ View available Graft engine versions:
119
+
120
+ ```bash
121
+ graft engines
122
+ ```
123
+
124
+ Example output:
125
+
126
+ ```
127
+ Available Graft Versions:
128
+
129
+ 0.0.1
130
+ 0.0.2
131
+ 0.0.3
132
+ 0.0.4
133
+ 0.0.5
134
+ 0.0.6
135
+
136
+ Latest: 0.0.6
137
+ ```
138
+
139
+ ---
140
+
141
+ ## Environment Diagnostics
142
+
143
+ Check your development environment:
144
+
145
+ ```bash
146
+ graft doctor
147
+ ```
148
+
149
+ This verifies tools required by Graft such as:
150
+
151
+ * Python
152
+ * Git
153
+ * Rust
154
+ * Cargo
155
+
156
+ ---
157
+
158
+ ## CLI Version
159
+
160
+ Display the installed CLI version:
161
+
162
+ ```bash
163
+ graft version
164
+ ```
165
+
166
+ ---
167
+
168
+ # Project Structure
169
+
170
+ A typical Graft project looks like:
171
+
172
+ ```
173
+ MyGame/
174
+ ├ engine/
175
+ ├ scripts/
176
+ │ └ main.lua
177
+ ├ assets/
178
+ └ project.graft
179
+ ```
180
+
181
+ Example `project.graft`:
182
+
183
+ ```
184
+ name = "MyGame"
185
+ entry = "scripts/main.lua"
186
+ ```
187
+
188
+ ---
189
+
190
+ # Engine Versions
191
+
192
+ The CLI installs engine versions directly from the official repository:
193
+
194
+ https://github.com/phaedalus/graft
195
+
196
+ Projects can target specific engine releases for stability.
197
+
198
+ ---
199
+
200
+ # Philosophy
201
+
202
+ Graft is designed with a simple philosophy:
203
+
204
+ * **Rust for performance**
205
+ * **Lua for gameplay scripting**
206
+ * **Minimal core**
207
+ * **Fork-per-project engine architecture**
208
+
209
+ The CLI reflects this philosophy by staying small and predictable.
210
+
211
+ ---
212
+
213
+ # License
214
+
215
+ MIT License
@@ -0,0 +1,16 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ graft_cli/__init__.py
5
+ graft_cli/doctor.py
6
+ graft_cli/engines.py
7
+ graft_cli/git_tools.py
8
+ graft_cli/main.py
9
+ graft_cli/project.py
10
+ graft_cli/run.py
11
+ graft_engine_cli.egg-info/PKG-INFO
12
+ graft_engine_cli.egg-info/SOURCES.txt
13
+ graft_engine_cli.egg-info/dependency_links.txt
14
+ graft_engine_cli.egg-info/entry_points.txt
15
+ graft_engine_cli.egg-info/requires.txt
16
+ graft_engine_cli.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ graft = graft_cli.main:main
@@ -0,0 +1,16 @@
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "graft-engine-cli"
7
+ version = "0.0.1"
8
+ description = "Command line tools for the Graft game engine"
9
+ readme = "README.md"
10
+ authors = [{name="Phaedalus"}]
11
+ license = {text = "MIT"}
12
+ dependencies = ["packaging"]
13
+ requires-python = ">=3.9"
14
+
15
+ [project.scripts]
16
+ graft = "graft_cli.main:main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+