solid-detection
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSOLID Detection Skill
SOLID检测技能
Project Detection
项目类型检测
Detect project type from configuration files:
bash
undefined从配置文件检测项目类型:
bash
undefinedNext.js (priority over React)
Next.js (优先级高于React)
[ -f "package.json" ] && grep -q '"next"' package.json
[ -f "package.json" ] && grep -q '"next"' package.json
React (no "next" in package.json)
React (package.json中无"next")
[ -f "package.json" ] && grep -q '"react"' package.json && ! grep -q '"next"' package.json
[ -f "package.json" ] && grep -q '"react"' package.json && ! grep -q '"next"' package.json
Generic TypeScript (no react/next, has .ts files)
通用TypeScript (无react/next,存在.ts文件)
[ -f "package.json" ] && ! grep -q '"react"' package.json && ! grep -q '"next"' package.json
[ -f "tsconfig.json" ] || [ -f "bun.lockb" ] || [ -f "bunfig.toml" ]
[ -f "package.json" ] && ! grep -q '"react"' package.json && ! grep -q '"next"' package.json
[ -f "tsconfig.json" ] || [ -f "bun.lockb" ] || [ -f "bunfig.toml" ]
Laravel
Laravel
[ -f "composer.json" ] && grep -q '"laravel' composer.json
[ -f "composer.json" ] && grep -q '"laravel' composer.json
Swift
Swift
[ -f "Package.swift" ] || ls *.xcodeproj
[ -f "Package.swift" ] || ls *.xcodeproj
Java
Java
[ -f "pom.xml" ] || [ -f "build.gradle" ] || [ -f "build.gradle.kts" ]
[ -f "pom.xml" ] || [ -f "build.gradle" ] || [ -f "build.gradle.kts" ]
Go
Go
[ -f "go.mod" ]
[ -f "go.mod" ]
Ruby
Ruby
[ -f "Gemfile" ] && [ -f "Rakefile" ]
[ -f "Gemfile" ] && [ -f "Rakefile" ]
Rust
Rust
[ -f "Cargo.toml" ]
[ -f "Cargo.toml" ]
Python
Python
[ -f "pyproject.toml" ] || [ -f "requirements.txt" ]
**Priority order:** Next.js > React > Generic TS > Laravel > Swift > Java > Go > Ruby > Rust > Python[ -f "pyproject.toml" ] || [ -f "requirements.txt" ]
**优先级顺序:** Next.js > React > 通用TypeScript > Laravel > Swift > Java > Go > Ruby > Rust > PythonLanguage Rules
各语言规则
Next.js / TypeScript
Next.js / TypeScript
| Rule | Value |
|---|---|
| File limit | 150 lines |
| Interface location | |
| Shared interfaces | |
| Forbidden | Interfaces in |
| SOLID skill | |
Pattern detection:
regex
^(export )?(interface|type) \w+| 规则 | 取值 |
|---|---|
| 文件行数限制 | 150行 |
| 接口存放位置 | |
| 共享接口位置 | |
| 禁止项 | 接口存放在 |
| SOLID技能标识 | |
模式检测:
regex
^(export )?(interface|type) \w+React / TypeScript
React / TypeScript
| Rule | Value |
|---|---|
| File limit | 100 lines |
| Interface location | |
| Shared interfaces | |
| Forbidden | Interfaces in |
| SOLID skill | |
Pattern detection:
regex
^(export )?(interface|type) \w+| 规则 | 取值 |
|---|---|
| 文件行数限制 | 100行 |
| 接口存放位置 | |
| 共享接口位置 | |
| 禁止项 | 接口存放在 |
| SOLID技能标识 | |
模式检测:
regex
^(export )?(interface|type) \w+Generic TypeScript / Bun / Node.js
通用TypeScript / Bun / Node.js
| Rule | Value |
|---|---|
| File limit | 100 lines |
| Interface location | |
| Shared interfaces | |
| Structure | Modular MANDATORY |
| Forbidden | Interfaces in service/lib files |
| SOLID skill | |
Pattern detection:
regex
^(export )?(interface|type) \w+| 规则 | 取值 |
|---|---|
| 文件行数限制 | 100行 |
| 接口存放位置 | |
| 共享接口位置 | |
| 结构要求 | 必须采用模块化结构 |
| 禁止项 | 接口存放在service/lib文件中 |
| SOLID技能标识 | |
模式检测:
regex
^(export )?(interface|type) \w+Laravel / PHP
Laravel / PHP
| Rule | Value |
|---|---|
| File limit | 100 lines |
| Interface location | |
| Shared interfaces | |
| Structure | FuseCore Modular MANDATORY |
| Forbidden | Interfaces outside Contracts/ |
| SOLID skill | |
Pattern detection:
regex
^interface \w+| 规则 | 取值 |
|---|---|
| 文件行数限制 | 100行 |
| 接口存放位置 | |
| 共享接口位置 | |
| 结构要求 | 必须采用FuseCore模块化结构 |
| 禁止项 | 接口存放在Contracts/目录外 |
| SOLID技能标识 | |
模式检测:
regex
^interface \w+Swift
Swift
| Rule | Value |
|---|---|
| File limit | 150 lines |
| Interface location | |
| Shared interfaces | |
| Structure | Features Modular MANDATORY |
| Forbidden | Protocols outside Protocols/ |
| SOLID skill | |
Pattern detection:
regex
^protocol \w+| 规则 | 取值 |
|---|---|
| 文件行数限制 | 150行 |
| 接口存放位置 | |
| 共享接口位置 | |
| 结构要求 | 必须采用Features模块化结构 |
| 禁止项 | 协议存放在Protocols/目录外 |
| SOLID技能标识 | |
模式检测:
regex
^protocol \w+Java
Java
| Rule | Value |
|---|---|
| File limit | 100 lines |
| Interface location | |
| Shared interfaces | |
| Structure | Modular MANDATORY |
| Forbidden | Interfaces in impl files |
| SOLID skill | |
Pattern detection:
regex
^(public )?(interface) \w+| 规则 | 取值 |
|---|---|
| 文件行数限制 | 100行 |
| 接口存放位置 | |
| 共享接口位置 | |
| 结构要求 | 必须采用模块化结构 |
| 禁止项 | 接口存放在实现类文件中 |
| SOLID技能标识 | |
模式检测:
regex
^(public )?(interface) \w+Go
Go
| Rule | Value |
|---|---|
| File limit | 100 lines |
| Interface location | |
| Shared interfaces | |
| Structure | Modular MANDATORY |
| Forbidden | Interfaces in impl files |
| SOLID skill | |
Pattern detection:
regex
^type \w+ interface \{| 规则 | 取值 |
|---|---|
| 文件行数限制 | 100行 |
| 接口存放位置 | |
| 共享接口位置 | |
| 结构要求 | 必须采用模块化结构 |
| 禁止项 | 接口存放在实现类文件中 |
| SOLID技能标识 | |
模式检测:
regex
^type \w+ interface \{Ruby
Ruby
| Rule | Value |
|---|---|
| File limit | 100 lines |
| Interface location | |
| Shared interfaces | |
| Structure | Modular MANDATORY |
| Forbidden | Contracts in model files |
| SOLID skill | |
Pattern detection:
regex
^module \w+Contract| 规则 | 取值 |
|---|---|
| 文件行数限制 | 100行 |
| 接口存放位置 | |
| 共享接口位置 | |
| 结构要求 | 必须采用模块化结构 |
| 禁止项 | 契约存放在模型文件中 |
| SOLID技能标识 | |
模式检测:
regex
^module \w+ContractRust
Rust
| Rule | Value |
|---|---|
| File limit | 100 lines |
| Interface location | |
| Shared interfaces | |
| Structure | Modular MANDATORY |
| Forbidden | Traits in impl files |
| SOLID skill | |
Pattern detection:
regex
^pub trait \w+| 规则 | 取值 |
|---|---|
| 文件行数限制 | 100行 |
| 接口存放位置 | |
| 共享接口位置 | |
| 结构要求 | 必须采用模块化结构 |
| 禁止项 | 特征存放在实现类文件中 |
| SOLID技能标识 | |
模式检测:
regex
^pub trait \w+Python
Python
| Rule | Value |
|---|---|
| File limit | 100 lines |
| Interface location | |
| Forbidden | ABC outside interfaces/ |
Pattern detection:
regex
class \w+\(.*ABC.*\)| 规则 | 取值 |
|---|---|
| 文件行数限制 | 100行 |
| 接口存放位置 | |
| 禁止项 | ABC类存放在interfaces/目录外 |
模式检测:
regex
class \w+\(.*ABC.*\)Line Counting
行数统计
Exclude from count:
- Blank lines
- Comments (,
//,/* */,#)""" - Import statements (optional)
bash
undefined不计入行数的内容:
- 空行
- 注释(、
//、/* */、#)""" - 导入语句(可选)
bash
undefinedTypeScript/Go/Rust/Swift
TypeScript/Go/Rust/Swift
grep -v '^\s*$|^\s*//|^\s*/*|^\s**' file
grep -v '^\s*$|^\s*//|^\s*/*|^\s**' file
PHP
PHP
grep -v '^\s*$|^\s*//|^\s*#|^\s*/*|^\s**' file
grep -v '^\s*$|^\s*//|^\s*#|^\s*/*|^\s**' file
Python
Python
grep -v '^\s*$|^\s*#|^\s*"""' file
undefinedgrep -v '^\s*$|^\s*#|^\s*"""' file
undefinedValidation Actions
校验动作
| Severity | Action |
|---|---|
| Interface in wrong location | BLOCK (exit 2) |
| File over limit | WARNING (exit 0) |
| Missing documentation | WARNING |
| 严重程度 | 执行动作 |
|---|---|
| 接口存放位置错误 | 阻止提交(退出码2) |
| 文件行数超限 | 警告(退出码0) |
| 缺少文档 | 警告 |
Skill Mapping
技能映射
| Project Type | SOLID Skill | Skill Path |
|---|---|---|
| solid-nextjs | |
| solid-react | |
| solid-generic | |
| solid-php | |
| solid-swift | |
| solid-java | |
| solid-go | |
| solid-ruby | |
| solid-rust | |
| (no skill yet) | - |
| 项目类型 | SOLID技能 | 技能路径 |
|---|---|---|
| solid-nextjs | |
| solid-react | |
| solid-generic | |
| solid-php | |
| solid-swift | |
| solid-java | |
| solid-go | |
| solid-ruby | |
| solid-rust | |
| (暂未提供技能) | - |
Environment Variables
环境变量
Set by :
detect-project.shbash
SOLID_PROJECT_TYPE=nextjs|react|generic|laravel|swift|java|go|ruby|rust|python|unknown
SOLID_FILE_LIMIT=100|150
SOLID_INTERFACE_DIR=path/to/interfaces
SOLID_STRUCTURE=modular由设置:
detect-project.shbash
SOLID_PROJECT_TYPE=nextjs|react|generic|laravel|swift|java|go|ruby|rust|python|unknown
SOLID_FILE_LIMIT=100|150
SOLID_INTERFACE_DIR=path/to/interfaces
SOLID_STRUCTURE=modular