codestyle

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Codestyle

Codestyle

Code template management: CLI tools for search/get/upload + AI-guided generation.
代码模板管理:提供搜索/获取/上传功能的CLI工具,同时支持AI引导生成功能。

Decision Tree

决策树

User request
    ├─ "search" / "检索" ──→ Search Workflow (CLI, local+remote)
    ├─ "get" / "获取" ──→ Get Workflow (CLI, local+remote)
    ├─ "generate" / "生成" ──→ Generate Workflow (AI dialog, then upload)
    └─ "upload" / "上传" ──→ Upload Workflow (CLI, remote)
User request
    ├─ "search" / "检索" ──→ Search Workflow (CLI, local+remote)
    ├─ "get" / "获取" ──→ Get Workflow (CLI, local+remote)
    ├─ "generate" / "生成" ──→ Generate Workflow (AI dialog, then upload)
    └─ "upload" / "上传" ──→ Upload Workflow (CLI, remote)

Commands

命令说明

CommandExecutionDescription
search
CLI (JAR)Search templates (local Lucene + remote API)
get
CLI (JAR)Get full template content
generate
AI DialogMulti-turn conversation, then call upload
upload
CLI (JAR)Upload template to server
命令执行方式描述
search
CLI (JAR)搜索模板(本地Lucene + 远程API)
get
CLI (JAR)获取完整模板内容
generate
AI Dialog多轮对话交互,完成后调用上传接口
upload
CLI (JAR)将模板上传到服务器

Quick Start

快速开始

Windows

Windows

bash
"<SKILL_DIR>\scripts\codestyle.bat" search "keyword"
"<SKILL_DIR>\scripts\codestyle.bat" get "template-path"
"<SKILL_DIR>\scripts\codestyle.bat" upload --path ./my-template
bash
"<SKILL_DIR>\scripts\codestyle.bat" search "keyword"
"<SKILL_DIR>\scripts\codestyle.bat" get "template-path"
"<SKILL_DIR>\scripts\codestyle.bat" upload --path ./my-template

Linux/macOS

Linux/macOS

bash
bash <SKILL_DIR>/scripts/codestyle search "keyword"
bash <SKILL_DIR>/scripts/codestyle get "template-path"
bash <SKILL_DIR>/scripts/codestyle upload --path ./my-template
bash
bash <SKILL_DIR>/scripts/codestyle search "keyword"
bash <SKILL_DIR>/scripts/codestyle get "template-path"
bash <SKILL_DIR>/scripts/codestyle upload --path ./my-template

Generate (AI Dialog)

生成(AI 对话)

User: 把这段代码做成模板:[代码]
AI: [多轮对话引导生成模板]
AI: [调用 upload 存储]
User: 把这段代码做成模板:[代码]
AI: [多轮对话引导生成模板]
AI: [调用 upload 存储]

Workflows

工作流

See references/ for detailed workflow instructions:
  • Search Workflow - Find templates (local+remote)
  • Get Workflow - Retrieve template content by full path
  • Generate Workflow - AI-guided template creation
  • Upload Workflow - Submit templates (remote)
详细工作流说明请查看 references/ 目录:
  • Search Workflow - 查找模板(本地+远程)
  • Get Workflow - 通过完整路径获取模板内容
  • Generate Workflow - AI引导的模板创建流程
  • Upload Workflow - 提交模板到远程仓库

Generate Workflow Overview

生成工作流概述

Generate workflow is pure AI dialog, no script calls until final upload.
InputExamplePre-processing
Code snippet
@RestController ...
None
Current file"当前这个文件"Read file
Local path
/path/to/file.java
Read file
GitHub URL
https://github.com/xxx/repo
Clone repo
Web URL
https://blog.xxx.com/...
Crawl content
Process:
识别输入 → 预处理 → 分析结构 → 选择模板 → AI生成 → 去重检测 → 用户确认 → 调用upload
生成工作流为纯AI对话形式,直到最终上传步骤前都不会调用脚本。
输入示例预处理操作
代码片段
@RestController ...
当前文件"当前这个文件"读取文件
本地路径
/path/to/file.java
读取文件
GitHub URL
https://github.com/xxx/repo
克隆仓库
网页URL
https://blog.xxx.com/...
爬取内容
处理流程:
识别输入 → 预处理 → 分析结构 → 选择模板 → AI生成 → 去重检测 → 用户确认 → 调用upload

First-Time Use

首次使用说明

Automatic initialization on first command:
  1. Detect no
    .initialized
    marker
  2. Download JAR file (if needed)
  3. Clone template repository
  4. Create
    .initialized
    marker
  5. Execute original command
首次执行命令时会自动完成初始化:
  1. 检测到无
    .initialized
    标记文件
  2. 下载JAR文件(若需要)
  3. 克隆模板仓库
  4. 生成
    .initialized
    标记文件
  5. 执行原命令

Configuration

配置

See references/config.md for configuration options.
配置选项请查看references/config.md

Template Format

模板格式

Directory Structure

目录结构

Standard template structure with meta.json in version directory:
<artifactId>/
└── <version>/
    ├── meta.json          # Template metadata (required)
    ├── README.md          # Documentation (optional)
    └── <subdirectories>   # Template files (.ftl)
Example:
CRUD/
└── 1.0.0/
    ├── meta.json
    ├── README.md
    ├── backend/
    │   ├── sql/Menu.ftl
    │   └── src/main/java/...
    └── frontend/
        └── src/...
See references/template-format.md for complete format specification.
See references/template-syntax.md for template syntax.
标准模板结构要求版本目录下必须包含meta.json
<artifactId>/
└── <version>/
    ├── meta.json          # 模板元数据(必填)
    ├── README.md          # 说明文档(可选)
    └── <subdirectories>   # 模板文件(.ftl)
示例:
CRUD/
└── 1.0.0/
    ├── meta.json
    ├── README.md
    ├── backend/
    │   ├── sql/Menu.ftl
    │   └── src/main/java/...
    └── frontend/
        └── src/...
完整格式规范请查看references/template-format.md
模板语法说明请查看references/template-syntax.md

Requirements

环境要求

  • JDK 17+
  • Git 2.0+ (for first-time setup and repo cloning)
  • Internet connection (for remote API calls)
  • JDK 17+
  • Git 2.0+(首次设置和仓库克隆时需要)
  • 网络连接(用于调用远程API)