55** CodeMage** is a tool that translates a source file written in one programming language into another language.
66The translation will be done by Large Language Model AI(such as ChatGPT)
77
8- ## Release 1.0.0
98
10- ### Features
9+
10+ ## Features (Release 1.1.2)
1111
1212 1. Supported Languages: Javascript, Python, C++, Java
1313 2. Default target Language is Python
1414 3. Supported LLM model: openrouter, groq
1515 4. Default LLM model is openrouter(sao10k/l3-euryale-70b)
1616
17- # Getting Started with ` PyPI `
17+
18+
19+ <br >
20+ <br >
21+
22+ # Getting started
23+
24+ ### Prerequisite
25+
26+
27+ 1 . Python
28+ - You need python 3.12 or later version to use this tool
29+ - Install Python : https://www.python.org/downloads/
30+
31+
32+
33+ <br >
34+ <br >
35+
36+ ## Start with ` PyPI `
1837
1938### 1. Download the package using PyPI
2039``` bash
40+ # for window user
2141pip install code-mage
42+
43+ # for mac user
44+ pip3 install code-mage
2245```
2346
47+ <br >
48+
2449### 2. Create your API_KEY at [ openrouter] ( https://openrouter.ai/docs/api-keys ) Or [ Groq] ( https://console.groq.com/keys )
2550
2651It's free with sign-up. You can easily sign-up with your google account
2752
53+ <br >
54+
2855### 3.a Set-up the API_KEY using ` Variable ` (option 1)
2956
3057``` bash
31- export API_KEY=YOUR-API-KEY
58+ export GROQ_API_KEY=YOUR-API-KEY # if you use groq model
59+ export OPENROUTER_API_KEY=YOUR-API-KEY # if you use openrouter model
3260```
3361
62+ <br >
63+
3464### 3.b Set-up with ` .toml ` file (option 2)
3565
36- With this option, you can also set other tool options.
66+ With this option, you can also set other tool options more easily
3767
3868- Start by creating a ` .codemage-config.toml ` in your home directory.
3969
4070``` bash
41- mkdir ~ /.codemage-config.toml
71+ vi ~ /.codemage-config.toml
4272```
4373
44- - Add the following information to the file:
74+ - Add the following environment settings in the file:
4575
4676``` toml
77+ # the double quotes for string values are necessary.
78+
4779model =" groq" # if you wish to use OPEN ROUTER you can just delete this line
4880GROQ_API_KEY =" <YOUR-GROQ-API-KEY>"
4981OPENROUTER_API_KEY =" <YOUR-OPEN-ROUTER-API-KEY>"
@@ -53,37 +85,42 @@ token_usage=false # if you wish to get token_usage info, set it `true`
5385output =" result" # type any name for the output file without the extension
5486```
5587
88+ <br >
89+
5690### 4. Run the tool
5791
5892``` bash
5993codemage < file-you-want-to-convert>
94+
6095# For example,
6196codemage test.js
97+ codemage test.js -s
98+ codemage test.js -m openrouter # specify your model, or the default model is "groq"
6299```
63100
64- # Getting Started by cloning the github repo
101+ < br >
65102
66- ### 1. Install Python : https://www.python.org/downloads/
103+ # Start by cloning the github repo
67104
68- < br >
105+ If you are using the tool by cloning the repo, you need poetry package manager.
69106
70- ### 2 . Install Poetry
107+ ### 1 . Install Poetry (if not installed yet)
71108
72109``` console
73110curl -sSL https://install.python-poetry.org | python3 -
74111```
75112
76113** OR** if you have ` pipx ` installed on your local machine, you can use the following commend
77114
78- [ How to download ` pipx ` ] ( https://github.com/pypa/pipx )
79-
80115``` console
81116pipx install poetry
82117```
83118
119+ Refer to [ How to download pipx] ( https://github.com/pypa/pipx )
120+
84121<br >
85122
86- ### 3 . Clone the repository
123+ ### 2 . Clone the repository
87124
88125``` console
89126git clone https://github.com/gitdevjin/code-mage.git
@@ -92,35 +129,44 @@ cd code_mage
92129
93130<br >
94131
95- ### 4 . Install Poetry Package
132+ ### 3 . Install Poetry Dependencies
96133
97134``` console
98135poetry install
99136```
100137
101138<br >
102139
103- ### 5 . Create your API_KEY at [ openrouter] ( https://openrouter.ai/docs/api-keys ) Or [ Groq] ( https://console.groq.com/keys )
140+ ### 4 . Create your API_KEY at [ openrouter] ( https://openrouter.ai/docs/api-keys ) Or [ Groq] ( https://console.groq.com/keys )
104141
105142It's free with sign-up. You can easily sign-up with your google account
106143
107144<br >
108145
109- ### 6. Create ` .env ` file in the root directory and save the following:
146+ ### 5-a Create ` .env ` file in the root directory and save the following:
110147
111148```
112149OPENROUTER_API_KEY=your_open_router_api_key
113150GROQ_API_KEY=your_groq_api_key
114151```
152+ <br >
153+
154+ ### 5-b Using TOML files
155+
156+ You can also use ` .toml ` file with this method
157+ Refer to [ this] ( #3b-set-up-with-toml-file-option-2 )
115158
116159Now you are ready to use the tool!
117160
118161<br >
119162
120163# Usage
121164
165+ - Run the command
166+
122167``` console
123168poetry run codemage <source_file>
169+ poetry run codemage ./example/test.js
124170```
125171
126172## Examples
@@ -155,34 +201,6 @@ You can stream out the result onto `stdout` with `-s, --stream` flag:
155201poetry run codemage ./example/test.js -s
156202```
157203
158- ### Using TOML files
159-
160- If you wish, you can specify all of your options in a TOML formatted configuration.
161-
162- - Start by creating a ` .codemage-config.toml ` in your home directory.
163-
164- ``` bash
165- mkdir ~ /.codemage-config.toml
166- ```
167-
168- - Add the following information to the file:
169-
170- ``` toml
171- model =" groq" # if you wish to use OPEN ROUTER you can just delete this line
172- GROQ_API_KEY =" <YOUR-GROQ-API-KEY>"
173- OPENROUTER_API_KEY =" <YOUR-OPEN-ROUTER-API-KEY>"
174- language =" java" # you can use any of the supported languages
175- stream =false /true
176- token_usage =false /true
177- output =" result" # type any name for the output file without the extension
178- ```
179-
180- - Run the command
181-
182- ```
183- poetry run codemage ./example/test.js
184- ```
185-
186204## Options
187205
188206-h, --help : display help message and exit
0 commit comments