graphicode-init
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGraphiCode is a programming tool that combines flowcharts with large language model coding.
This init skill is responsible for initializing a GraphiCode-managed project by collecting project information, creating , and setting up the required directory structure.
graphig.jsonGraphiCode是一款将流程图与大语言模型编码相结合的编程工具。
这个初始化skill负责通过收集项目信息、创建文件以及搭建所需的目录结构,来初始化一个由GraphiCode管理的项目。
graphig.jsonSteps
步骤
0. Check if graphig.json already exists
0. 检查graphig.json是否已存在
sh
cat ./graphig.jsonIf already exists, inform the user that the project is already initialized and exit immediately.
graphig.jsonsh
cat ./graphig.json如果已存在,告知用户项目已完成初始化并立即退出。
graphig.json1. Collect project information from the user
1. 向用户收集项目信息
Ask the user for the following fields (all at once):
- appName — the application name
- language — the programming language (e.g., TypeScript, Python)
- devEnv — the development environment (e.g., Bun, Node.js, Deno)
- runtimeEnv — the runtime environment (e.g., Bun, Node.js, Browser)
- entryDir — the directory where the entry file is located (e.g., )
src/entry - flowDirs — directories for flow files (e.g., )
{ "src/flows": "default flow directory" } - algorithmDirs — directories for algorithm files (e.g., )
{ "src/algorithms": "default algorithm directory" } - stateDirs — directories for state files (e.g., )
{ "src/states": "default state directory" } - typeDirs — directories for type files (e.g., )
{ "src/types": "default type directory" }
If the user is unsure about any field, suggest reasonable defaults based on the project context.
一次性向用户收集以下字段信息:
- appName — 应用名称
- language — 编程语言(例如:TypeScript、Python)
- devEnv — 开发环境(例如:Bun、Node.js、Deno)
- runtimeEnv — 运行时环境(例如:Bun、Node.js、Browser)
- entryDir — 入口文件所在目录(例如:)
src/entry - flowDirs — 流程图文件目录(例如:)
{ "src/flows": "default flow directory" } - algorithmDirs — 算法文件目录(例如:)
{ "src/algorithms": "default algorithm directory" } - stateDirs — 状态文件目录(例如:)
{ "src/states": "default state directory" } - typeDirs — 类型文件目录(例如:)
{ "src/types": "default type directory" }
如果用户对任何字段不确定,根据项目上下文提供合理的默认值建议。
2. Create graphig.json
2. 创建graphig.json
First, read (e.g., ) from this skill's directory to get the available devEnv/runtimeEnv options and their corresponding , , , values.
./references/<language>.md./references/TypeScript.mdprojectConfigmainFileNametestFileNametestCommandIf the user's provided , , or does not match any entry in the reference file, prompt the user to revise their input before proceeding.
languagedevEnvruntimeEnvThen create in the project root, combining the user's input from step 1 and the values looked up from the language reference file:
graphig.jsonsh
echo '{
"appName": "<appName>",
"language": "<language>",
"devEnv": "<devEnv>",
"runtimeEnv": "<runtimeEnv>",
"projectConfig": "<projectConfig>",
"entryDir": "<entryDir>",
"mainFileName": "<mainFileName>",
"testFileName": "<testFileName>",
"testCommand": "<testCommand>",
"flowDirs": { "<dir1>": "<description1>" },
"algorithmDirs": { "<dir1>": "<description1>" },
"stateDirs": { "<dir1>": "<description1>" },
"typeDirs": { "<dir1>": "<description1>" }
}' > ./graphig.json首先读取该skill目录下的(例如)文件,获取可用的devEnv/runtimeEnv选项以及对应的、、、值。
./references/<language>.md./references/TypeScript.mdprojectConfigmainFileNametestFileNametestCommand如果用户提供的、或与参考文件中的任何条目不匹配,提示用户修改输入后再继续。
languagedevEnvruntimeEnv随后在项目根目录创建,结合步骤1中用户输入的信息和从语言参考文件中查询到的值:
graphig.jsonsh
echo '{
"appName": "<appName>",
"language": "<language>",
"devEnv": "<devEnv>",
"runtimeEnv": "<runtimeEnv>",
"projectConfig": "<projectConfig>",
"entryDir": "<entryDir>",
"mainFileName": "<mainFileName>",
"testFileName": "<testFileName>",
"testCommand": "<testCommand>",
"flowDirs": { "<dir1>": "<description1>" },
"algorithmDirs": { "<dir1>": "<description1>" },
"stateDirs": { "<dir1>": "<description1>" },
"typeDirs": { "<dir1>": "<description1>" }
}' > ./graphig.json3. Create directory structure
3. 创建目录结构
For each directory (key) in flowDirs/algorithmDirs/stateDirs/typeDirs:
- Create the directory (including parent directories if needed).
- Create an empty dir config file inside it:
sh
undefined对于flowDirs/algorithmDirs/stateDirs/typeDirs中的每个目录(键):
- 创建该目录(如需则包含父目录)。
- 在其中创建一个空的目录配置文件:
sh
undefinedfor each flowDir
for each flowDir
mkdir -p <flowDir> && echo '{}' > <flowDir>/flow.graphig.json
mkdir -p <flowDir> && echo '{}' > <flowDir>/flow.graphig.json
for each algorithmDir
for each algorithmDir
mkdir -p <algorithmDir> && echo '{}' > <algorithmDir>/algorithm.graphig.json
mkdir -p <algorithmDir> && echo '{}' > <algorithmDir>/algorithm.graphig.json
for each stateDir
for each stateDir
mkdir -p <stateDir> && echo '{}' > <stateDir>/state.graphig.json
mkdir -p <stateDir> && echo '{}' > <stateDir>/state.graphig.json
for each typeDir
for each typeDir
mkdir -p <typeDir> && echo '{}' > <typeDir>/type.graphig.json
undefinedmkdir -p <typeDir> && echo '{}' > <typeDir>/type.graphig.json
undefined4. Copy utility files
4. 复制工具文件
Copy the language-specific utility files from this skill's assets directory to the project's directory:
graphicode-utils/sh
mkdir -p ./graphicode-utils
cp <this-skill-dir>/assets/<language>/* ./graphicode-utils/Replace with the value of the field in (e.g., ).
<language>languagegraphig.jsonTypeScript将该skill的assets目录中特定语言的工具文件复制到项目的目录:
graphicode-utils/sh
mkdir -p ./graphicode-utils
cp <this-skill-dir>/assets/<language>/* ./graphicode-utils/将替换为中字段的值(例如)。
<language>graphig.jsonlanguageTypeScript5. Confirm to the user
5. 向用户确认
After all files and directories are created, print a summary of what was created and confirm the initialization is complete.
在所有文件和目录创建完成后,打印已创建内容的摘要,并确认初始化已完成。
Others
其他说明
Remember to respond in the language the user uses, and write files in English.
记得使用用户所使用的语言进行回复,并且以英文编写文件。