1
0
mirror of https://github.com/aicode-standard/prompt-config.git synced 2025-10-07 06:45:14 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

improve the content of the proposal

This commit is contained in:
小墨
2025-09-29 17:15:43 +00:00
parent 32b4a18c0b
commit da0d5bc188
2 changed files with 589 additions and 175 deletions

381
README.md
View File

@@ -23,34 +23,89 @@ Create a unified standard for AI code editor prompt configuration files to addre
### Core Standard Path
```
.aicode/
├── prompts/
├── project.md # Project-level prompts (primary file)
├── context.md # Context rules
├── style.md # Code style guidelines
│ └── editor-specific/ # Editor-specific configurations (optional)
├── config.json # Configuration file
└── README.md # Documentation
.prompt/
├─ rules/
─ project[.<editor-identifer>].md # Project-level prompts (primary file)
─ context[.<editor-identifer>].md # Context rules (optional)
└─ code_style[.<editor-identifer>].md # Code style guidelines (optional)
├─ config.json # Configuration file
└─ README.md # Documentation (optional)
```
### Configuration File Format (`config.json`)
The `[.<editor-identifer>]` indicates editor-specific configurations. When omitted, it represents globally shared prompt files.
### Configuration Examples
**Basic Configuration:**
If we want to configure project-level prompts, we can do this:
```
.prompt/
└─ rules/
├─ project.md # Project-level prompts (primary file)
├─ project.vscode.md # Enhance `project.md` in VSCode editor (optional)
├─ project.cursor.md # Enhance `project.md` in Cursor editor (optional)
└─ project.trae.md # Enhance `project.md` in TRAE editor (optional)
```
**Advanced Configuration (Multi-file Structure):**
When prompt content is extensive and needs to be split into multiple files, you can create corresponding directories to organize prompts according to custom directory structures. Similarly, files should end with `[.<editor-identifer>].md`. All files are optional.
```
.prompt/
└─ rules/
├─ project/
│ ├─ [foo].vscode.md
│ ├─ [foo].cursor.md
│ ├─ [foo].trae.md
│ └─ index.md
├─ project.md
├─ project.vscode.md
├─ project.cursor.md
└─ project.trae.md
```
In this example, `.prompt/rules/project/index.md` serves the same purpose as `.prompt/rules/project.md`. When both exist, they will both take effect.
For the VSCode editor, in this example, the following markdown files will be loaded as prompts:
- `.prompt/rules/project/[foo].vscode.md`
- `.prompt/rules/project/index.md`
- `.prompt/rules/project.md`
- `.prompt/rules/project.vscode.md`
### File Loading Rules
1. **Global Files**: `.prompt/rules/project.md` (shared by all editors)
2. **Editor-Specific Files**: `.prompt/rules/project.{editor}.md` (loaded by specific editors)
3. **Directory Structure**: Supports subdirectory organization, with `index.md` as the directory entry file
4. **Merge Strategy**: Content from all matching files will be merged, with editor-specific configurations extending global configurations
## Configuration File Format (`.prompt/config.json`)
```json
{
"version": "1.0.0",
"prompts": {
"project": ".aicode/prompts/project.md",
"context": ".aicode/prompts/context.md",
"style": ".aicode/prompts/style.md"
},
"promptFileVersion": "1.0",
"response_language": "en-US", // Specify the language for model responses
"defaultMergeStrategy": "append", // Default merge strategy: append|overwrite|smart
"fileLoadingOrder": ["global", "editor-specific"], // File loading order
"supportedEditors": ["vscode", "cursor", "trae", "codeium"],
"editorSpecific": {
"vscode": {
"promptPriority": ["project.md", "project.vscode.md"],
"maxTokenLimit": 4000
},
"cursor": {
"rulesFile": ".cursor/rules.md",
"source": ".aicode/prompts/project.md"
"promptPriority": ["project.md", "project.cursor.md"],
"maxTokenLimit": 8000
},
"trae": {
"rulesFile": ".trae/rules/project_rules.md",
"source": ".aicode/prompts/project.md"
"promptPriority": ["project.md", "project.trae.md"],
"maxTokenLimit": 6000
},
"[editor_name]": {
...
}
}
}
@@ -60,47 +115,84 @@ Create a unified standard for AI code editor prompt configuration files to addre
### Phase 1: Compatibility Layer (Immediately Feasible)
Create conversion tools and installation scripts:
Create conversion tools and symbolic link scripts:
```bash
# install-aicode-prompts.sh
# migrate-prompts.sh
#!/bin/bash
mkdir -p .aicode/prompts
# Detect installed editors and create symbolic links
if [ -d ".cursor" ]; then
ln -sf ../.aicode/prompts/project.md .cursor/rules.md
fi
# Create standard directory structure
mkdir -p .prompt/rules
if [ -d ".trae" ]; then
mkdir -p .trae/rules
ln -sf ../../.aicode/prompts/project.md .trae/rules/project_rules.md
# Migrate existing configurations and create symbolic links
migrate_editor_config() {
local editor=$1
local source_path=$2
local target_name=$3
if [ -f "$source_path" ]; then
# Migrate to new location
cp "$source_path" ".prompt/rules/${target_name}.${editor}.md"
# Create symbolic link for backward compatibility
ln -sf "../.prompt/rules/${target_name}.${editor}.md" "$source_path"
echo "Migrated ${editor} configuration"
fi
}
# Migrate various editor configurations
migrate_editor_config "cursor" ".cursor/rules.md" "project"
migrate_editor_config "trae" ".trae/rules/project_rules.md" "project"
migrate_editor_config "codeium" ".codeium/context.md" "context"
# Create basic configuration file
if [ ! -f ".prompt/config.json" ]; then
cat > ".prompt/config.json" << EOF
{
"promptFileVersion": "1.0",
"response_language": "",
"defaultMergeStrategy": "append",
"supportedEditors": ["vscode", "cursor", "trae", "codeium"]
}
EOF
fi
```
### Phase 2: Editor Adaptation
Encourage editor vendors to support standard paths:
Encourage editor vendors to natively support standard paths:
```json
// Editor configuration example
// Editor configuration example (VSCode settings.json)
{
"promptSources": [
".aicode/prompts/project.md", // Standard path (priority)
".cursor/rules.md" // Legacy path (fallback)
]
"aiPrompts.standardPath": ".prompt/rules",
"aiPrompts.loadOrder": [
"project.md",
"project.vscode.md",
"context.md",
"context.vscode.md"
],
"aiPrompts.mergeStrategy": "smart"
}
```
### Phase 3: Ecosystem Development
1. Create validation tools to check configuration integrity
2. Develop configuration generation plugins for VS Code and other editors
3. Establish template libraries and best practices
1. **Develop Core Tools**:
- Configuration validation tool: `prompt-validator`
- File merging tool: `prompt-merger`
- Migration assistance tool: `prompt-migrate`
2. **Editor Plugins**:
- VSCode extension: `vscode-prompt-config-integration`
- Cursor plugin: `cursor-prompt-config-integration`
3. **Template Library**:
- Configuration templates for common project types
- Best practice examples for various languages
## Detailed Configuration Specifications
### `project.md` Template
### Project Prompts Template (`.prompt/rules/project.md`)
```markdown
# Project Prompts
@@ -110,30 +202,61 @@ Encourage editor vendors to support standard paths:
## Coding Standards
- Language: {{Programming language}}
- Style: {{Code style}}
- Constraints: {{Technical constraints}}
- Code Style: {{Code style guidelines}}
- Naming Conventions: {{Naming rules}}
## Architecture Constraints
- Design Patterns: {{Patterns used}}
- Layered Architecture: {{Architecture layers}}
- Dependency Management: {{Dependency specifications}}
## Business Rules
{{Specific business logic}}
{{Specific business logic and requirements}}
```
### Complete `config.json` Specification
### Editor-Specific Extension Example (`.prompt/rules/project.vscode.md`)
```markdown
# VSCode Specific Configuration
## Editor Integration
- Preferred VSCode Extensions: {{Extension list}}
- Debug Configuration: {{Debug settings}}
- Code Snippets: {{Custom snippets}}
## Performance Optimization
- Large File Handling Strategy: {{Handling approach}}
- Memory Management: {{Optimization suggestions}}
```
### Complete config.json Specification
```json
{
"version": "string",
"name": "string",
"prompts": {
"project": "string",
"context": "string",
"style": "string",
"testing": "string"
"promptFileVersion": "string", // Configuration version number
"responseLanguage": "string", // Default response language
"defaultMergeStrategy": "string", // Default merge strategy
"fileLoadingOrder": ["string"], // File loading order
"maxFileSizeKB": number, // Maximum file size limit
"encoding": "string", // File encoding format
"validationRules": { // Validation rules
"maxLength": number,
"allowedSections": ["string"],
"requiredSections": ["string"]
},
"mergeStrategy": "overwrite|append|smart",
"editorSupport": {
"cursor": "boolean",
"trae": "boolean",
"codeium": "boolean"
"editorSpecific": {
"[editor_name]": {
"promptPriority": ["string"], // Prompt priority
"maxTokenLimit": number, // Maximum token limit
"temperature": number, // Temperature parameter
"modelPreferences": ["string"] // Model preferences
}
},
"extensions": { // Extension configuration
"customSections": ["string"], // Custom sections
"templateVariables": { // Template variables
"key": "value"
}
}
}
```
@@ -142,58 +265,142 @@ Encourage editor vendors to support standard paths:
### Migrating from Existing Systems
1. **Incremental Migration**:
1. **Automatic Migration**:
```bash
# Use migration tool
npx @prompt-standard/migrate --editor cursor --editor trae
# Or use interactive migration
npx @prompt-standard/migrate-interactive
```
2. **Manual Migration**:
```bash
# 1. Create standard directory
mkdir -p .aicode/prompts
mkdir -p .prompt/rules
# 2. Move existing configuration
cp .cursor/rules.md .aicode/prompts/project.md
# 2. Migrate and rename existing configurations
mv .cursor/rules.md .prompt/rules/project.cursor.md
mv .trae/rules/project_rules.md .prompt/rules/project.trae.md
# 3. Create symbolic links
ln -s .aicode/prompts/project.md .cursor/rules.md
# 3. Create symbolic links (optional, for compatibility)
ln -s ../.prompt/rules/project.cursor.md .cursor/rules.md
ln -s ../.prompt/rules/project.trae.md .trae/rules/project_rules.md
```
2. **Validation Tool**:
3. **Validation**:
```bash
npx aicode-validate
# Install validation tool
npm install -g @prompt-standard/validator
# Validate configuration integrity
prompt-validate
```
### Validation Tool Features
```bash
# Check configuration completeness
prompt-validate --check-completeness
# Validate syntax correctness
prompt-validate --check-syntax
# Generate configuration report
prompt-validate --generate-report
# Check editor compatibility
prompt-validate --check-editor vscode cursor
```
## Benefits Analysis
### For Developers
-**Consistency**: Unified experience across editors
-**Maintainability**: Single source of truth
-**Collaboration**: Standardized team configurations
- ✅ **Consistency**: Unified experience across editors, reduced context switching
- ✅ **Maintainability**: Centralized management, single source of truth
- ✅ **Flexibility**: Support for global configurations and editor-specific extensions
- ✅ **Collaboration**: Standardized team configurations, easy sharing
### For Editor Vendors
-**Interoperability**: Reduce user migration costs
-**Ecosystem**: Promote toolchain integration
-**Standards Compliance**: Demonstrate professionalism and foresight
- ✅ **Interoperability**: Reduce user migration costs, increase user retention
- ✅ **Ecosystem**: Promote toolchain integration and plugin development
- ✅ **Standards Compliance**: Demonstrate professionalism and foresight, enhance competitiveness
- ✅ **Extensibility**: Support for custom configurations and advanced features
## Action Plan
1. **Immediate Actions** (1-2 weeks):
- Create reference implementation and conversion tools
- Write detailed documentation and examples
- Establish community discussion groups
### Immediate Actions (1-2 weeks)
- [ ] Create core tool library: `@prompt-standard/core`
- [ ] Develop configuration validation tool: `@prompt-standard/validator`
- [ ] Write detailed documentation and examples
- [ ] Establish community discussion groups (Discord/GitHub Discussions)
2. **Short-term Goals** (1-3 months):
- Gain support from 2-3 mainstream editors
- Create configuration templates for popular projects
- Develop IDE plugins
### Short-term Goals (1-3 months)
- [ ] Gain support from 2-3 mainstream editors
- [ ] Create configuration templates for popular projects
- [ ] Develop IDE plugin prototypes
- [ ] Establish automated testing processes
3. **Long-term Vision** (6-12 months):
- Become a de facto standard
- Establish certification programs
- Extend support to more AI development tools
### Long-term Vision (6-12 months)
- [ ] Become a de facto standard, natively supported by multiple editors
- [ ] Establish certification programs and compatibility testing
- [ ] Extend support to more AI development tools
- [ ] Develop graphical configuration management tools
## Technical Support
### Development Tools
```bash
# Core library installation
npm install @prompt-standard/core
# Validation tool installation
npm install -g @prompt-standard/validator
# Migration tool installation
npm install -g @prompt-standard/migrate
```
### API Examples
```javascript
// Using core library
import { PromptLoader, PromptValidator } from '@prompt-standard/core'
const loader = new PromptLoader('.prompt/rules')
const prompts = await loader.loadForEditor('vscode')
const validator = new PromptValidator()
const results = await validator.validate(prompts)
```
## Call for Participation
We invite participation from:
- **Editor Developers**: Implement standard support
- **Open Source Projects**: Early adoption of the standard
- **Community Members**: Provide feedback and contributions
- **Enterprise Users**: Share real-world requirements
### For Editor Developers
- Implement native standard support
- Provide feedback and improvement suggestions
- Participate in standard specification development
### For Open Source Projects
- Adopt standard configurations early
- Contribute project configuration templates
- Share usage experiences and best practices
### For Community Members
- Test and report issues
- Participate in documentation writing and translation
- Develop auxiliary tools and plugins
### For Enterprise Users
- Provide real business requirements
- Share enterprise-level application scenarios
- Participate in standard promotion and implementation
**Participation Methods**:
- 📝 Submit Issues and Feature Requests
- 🔄 Submit Pull Requests
- 💬 Join community discussions
- 🚀 Share your configuration examples
**GitHub Repository**: https://github.com/aicode-standard/prompt-config