agentic-code 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/context-maps/{task-rule-matrix.yaml → task-skills-matrix.yaml} +98 -110
- package/.agents/{rules/core/ai-development-guide.md → skills/ai-development-guide/SKILL.md} +9 -2
- package/.agents/{rules/language/general/rules.md → skills/coding-rules/SKILL.md} +14 -2
- package/.agents/{rules/language/typescript/rules.md → skills/coding-rules/references/typescript.md} +18 -54
- package/.agents/{rules/core/documentation-criteria.md → skills/documentation-criteria/SKILL.md} +8 -1
- package/.agents/{rules/contextual/architecture/implementation-approach.md → skills/implementation-approach/SKILL.md} +8 -1
- package/.agents/{rules/core/integration-e2e-testing.md → skills/integration-e2e-testing/SKILL.md} +7 -0
- package/.agents/{rules/core/metacognition.md → skills/metacognition/SKILL.md} +10 -3
- package/.agents/{rules/language/general/testing.md → skills/testing/SKILL.md} +17 -32
- package/.agents/skills/testing/references/typescript.md +134 -0
- package/.agents/{rules/core/testing-strategy.md → skills/testing-strategy/SKILL.md} +7 -0
- package/.agents/tasks/acceptance-test-generation.md +38 -38
- package/.agents/tasks/code-review.md +6 -6
- package/.agents/tasks/implementation.md +34 -34
- package/.agents/tasks/integration-test-review.md +8 -8
- package/.agents/tasks/prd-creation.md +20 -20
- package/.agents/tasks/quality-assurance.md +26 -26
- package/.agents/tasks/task-analysis.md +20 -20
- package/.agents/tasks/technical-design.md +26 -26
- package/.agents/tasks/technical-document-review.md +8 -8
- package/.agents/tasks/work-planning.md +39 -39
- package/.agents/workflows/agentic-coding.md +30 -30
- package/AGENTS.md +20 -32
- package/README.md +18 -16
- package/bin/cli.js +6 -17
- package/bin/install-codex-skills.js +127 -0
- package/package.json +9 -12
- package/.agents/rules/language/typescript/testing.md +0 -284
- package/scripts/setup.js +0 -82
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ Generates test skeletons before writing implementation code.
|
|
|
74
74
|
│ ├── task-analysis.md # Entry point - AI starts here
|
|
75
75
|
│ └── ... # Design, test, implement, QA tasks
|
|
76
76
|
├── workflows/ # How to build it
|
|
77
|
-
└──
|
|
77
|
+
└── skills/ # Quality standards (Codex-compatible)
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
## Real Examples
|
|
@@ -96,11 +96,7 @@ You: "Build user authentication system"
|
|
|
96
96
|
|
|
97
97
|
### For New Projects
|
|
98
98
|
```bash
|
|
99
|
-
# Create project
|
|
100
99
|
npx agentic-code my-project
|
|
101
|
-
|
|
102
|
-
# Optional: Add language-specific rules
|
|
103
|
-
npx agentic-code my-project --lang=typescript
|
|
104
100
|
```
|
|
105
101
|
|
|
106
102
|
### For Existing Projects
|
|
@@ -108,11 +104,17 @@ npx agentic-code my-project --lang=typescript
|
|
|
108
104
|
# Copy the framework files
|
|
109
105
|
cp -r path/to/agentic-code/AGENTS.md .
|
|
110
106
|
cp -r path/to/agentic-code/.agents .
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Skills
|
|
111
110
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
`.agents/skills/` contains reusable skill files in the [Codex Skills format](https://github.com/openai/codex/blob/main/docs/skills.md). Each skill has a `SKILL.md` with instructions that AI agents can discover and apply.
|
|
112
|
+
|
|
113
|
+
**Codex**: You can install skills globally so Codex picks them up across all projects:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npx agentic-code-install-skills --codex
|
|
117
|
+
# Installs to ~/.codex/skills/agentic-code/
|
|
116
118
|
```
|
|
117
119
|
|
|
118
120
|
## Common Questions
|
|
@@ -120,8 +122,8 @@ ln -s general/testing.md testing.md
|
|
|
120
122
|
**Q: Can I use this with other AI coding tools besides Codex?**
|
|
121
123
|
Yes! This framework works with any AGENTS.md-compatible tool like Cursor, Aider, and other LLM-assisted development environments.
|
|
122
124
|
|
|
123
|
-
**Q: What programming languages are supported?**
|
|
124
|
-
The framework is language-agnostic and works with any programming language through general development principles.
|
|
125
|
+
**Q: What programming languages are supported?**
|
|
126
|
+
The framework is language-agnostic and works with any programming language through general development principles. TypeScript-specific rules are available in `skills/*/references/typescript.md`.
|
|
125
127
|
|
|
126
128
|
**Q: Do I need to learn a new syntax?**
|
|
127
129
|
No. Describe what you want in plain language; the framework handles the rest.
|
|
@@ -141,16 +143,16 @@ The framework has three pillars:
|
|
|
141
143
|
|
|
142
144
|
1. **Tasks** - Define WHAT to build
|
|
143
145
|
2. **Workflows** - Define HOW to build it
|
|
144
|
-
3. **
|
|
146
|
+
3. **Skills** - Define quality STANDARDS
|
|
145
147
|
|
|
146
148
|
<details>
|
|
147
149
|
<summary>Advanced features for the curious...</summary>
|
|
148
150
|
|
|
149
|
-
### Progressive
|
|
150
|
-
|
|
151
|
-
- Small (1-2 files) → Direct execution with minimal
|
|
151
|
+
### Progressive Skill Loading
|
|
152
|
+
Skills load based on task analysis:
|
|
153
|
+
- Small (1-2 files) → Direct execution with minimal skills
|
|
152
154
|
- Medium/Large (3+ files) → Structured workflow with design docs
|
|
153
|
-
- Each task definition specifies its required
|
|
155
|
+
- Each task definition specifies its required skills
|
|
154
156
|
|
|
155
157
|
### Quality Gates
|
|
156
158
|
Automatic checkpoints ensure:
|
package/bin/cli.js
CHANGED
|
@@ -7,8 +7,6 @@ const { execSync } = require('child_process');
|
|
|
7
7
|
// Parse command line arguments
|
|
8
8
|
const args = process.argv.slice(2);
|
|
9
9
|
const projectName = args[0];
|
|
10
|
-
const langOption = args.find(arg => arg.startsWith('--lang='));
|
|
11
|
-
const selectedLang = langOption ? langOption.split('=')[1] : 'general';
|
|
12
10
|
|
|
13
11
|
// Show help if no project name provided
|
|
14
12
|
if (!projectName) {
|
|
@@ -16,16 +14,12 @@ if (!projectName) {
|
|
|
16
14
|
🤖 Agentic Code - Task-oriented context engineering framework
|
|
17
15
|
|
|
18
16
|
Usage:
|
|
19
|
-
npx github:shinpr/agentic-code <project-name>
|
|
17
|
+
npx github:shinpr/agentic-code <project-name>
|
|
20
18
|
|
|
21
19
|
Examples:
|
|
22
|
-
npx github:shinpr/agentic-code my-project
|
|
23
|
-
npx github:shinpr/agentic-code my-project --lang=general # General (explicit)
|
|
24
|
-
npx github:shinpr/agentic-code my-project --lang=typescript # TypeScript-specific
|
|
20
|
+
npx github:shinpr/agentic-code my-project
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
general (default): Universal development principles for any language
|
|
28
|
-
typescript: Enhanced rules and TypeScript-specific tooling
|
|
22
|
+
Skills include language-specific references (e.g., .agents/skills/coding-rules/references/typescript.md)
|
|
29
23
|
`);
|
|
30
24
|
process.exit(1);
|
|
31
25
|
}
|
|
@@ -42,8 +36,7 @@ if (fs.existsSync(projectName)) {
|
|
|
42
36
|
process.exit(1);
|
|
43
37
|
}
|
|
44
38
|
|
|
45
|
-
console.log(`🚀 Creating Agentic Code project: ${projectName}`);
|
|
46
|
-
console.log(`📝 Language: ${selectedLang}\n`);
|
|
39
|
+
console.log(`🚀 Creating Agentic Code project: ${projectName}\n`);
|
|
47
40
|
|
|
48
41
|
try {
|
|
49
42
|
// Create project directory
|
|
@@ -63,10 +56,6 @@ try {
|
|
|
63
56
|
console.log('📦 Initializing Git repository...');
|
|
64
57
|
execSync('git init', { stdio: 'inherit' });
|
|
65
58
|
|
|
66
|
-
// Set up project configuration
|
|
67
|
-
console.log('⚙️ Setting up project configuration...');
|
|
68
|
-
execSync(`node scripts/setup.js --lang=${selectedLang}`, { stdio: 'inherit' });
|
|
69
|
-
|
|
70
59
|
// Create initial commit
|
|
71
60
|
console.log('💾 Creating initial commit...');
|
|
72
61
|
execSync('git add .', { stdio: 'inherit' });
|
|
@@ -77,7 +66,7 @@ try {
|
|
|
77
66
|
console.log(` cd ${projectName}`);
|
|
78
67
|
console.log(' 1. Read AGENTS.md to understand the framework');
|
|
79
68
|
console.log(' 2. Start with: open .agents/tasks/task-analysis.md');
|
|
80
|
-
console.log(' 3.
|
|
69
|
+
console.log(' 3. Skills are in .agents/skills/');
|
|
81
70
|
console.log('\n💡 Need help? Check the documentation or open an issue on GitHub.');
|
|
82
71
|
|
|
83
72
|
} catch (error) {
|
|
@@ -114,4 +103,4 @@ function copyDirectory(src, dest, excludeDirs = []) {
|
|
|
114
103
|
fs.copyFileSync(srcPath, destPath);
|
|
115
104
|
}
|
|
116
105
|
}
|
|
117
|
-
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
// Parse command line arguments
|
|
8
|
+
const args = process.argv.slice(2);
|
|
9
|
+
|
|
10
|
+
// Target configurations
|
|
11
|
+
const TARGETS = {
|
|
12
|
+
codex: {
|
|
13
|
+
dir: path.join(os.homedir(), '.codex', 'skills'),
|
|
14
|
+
name: 'agentic-code',
|
|
15
|
+
description: 'OpenAI Codex CLI',
|
|
16
|
+
postInstall: 'Restart Codex to load the skills.\nNote: Enable skills with --enable skills flag or in config.toml'
|
|
17
|
+
}
|
|
18
|
+
// Future targets can be added here
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Show help
|
|
22
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
23
|
+
console.log(`
|
|
24
|
+
Usage: agentic-code-install-skills [options]
|
|
25
|
+
|
|
26
|
+
Options:
|
|
27
|
+
--codex Install skills to ~/.codex/skills/.agentic-code (default)
|
|
28
|
+
--help Show this help message
|
|
29
|
+
|
|
30
|
+
Examples:
|
|
31
|
+
agentic-code-install-skills # Install to Codex (default)
|
|
32
|
+
agentic-code-install-skills --codex # Install to Codex (explicit)
|
|
33
|
+
`);
|
|
34
|
+
process.exit(0);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Determine target (default: codex)
|
|
38
|
+
let targetKey = 'codex';
|
|
39
|
+
if (args.includes('--codex')) {
|
|
40
|
+
targetKey = 'codex';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const target = TARGETS[targetKey];
|
|
44
|
+
if (!target) {
|
|
45
|
+
console.error(`Error: Unknown target '${targetKey}'`);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Get source directory (from installed package or local)
|
|
50
|
+
function getSourceSkillsDir() {
|
|
51
|
+
// When run from npx or installed globally
|
|
52
|
+
const packageSkillsDir = path.join(__dirname, '..', '.agents', 'skills');
|
|
53
|
+
if (fs.existsSync(packageSkillsDir)) {
|
|
54
|
+
return packageSkillsDir;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// When run from project directory
|
|
58
|
+
const localSkillsDir = path.join(process.cwd(), '.agents', 'skills');
|
|
59
|
+
if (fs.existsSync(localSkillsDir)) {
|
|
60
|
+
return localSkillsDir;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Copy directory recursively
|
|
67
|
+
function copyDirectory(src, dest) {
|
|
68
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
69
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
70
|
+
|
|
71
|
+
for (const entry of entries) {
|
|
72
|
+
const srcPath = path.join(src, entry.name);
|
|
73
|
+
const destPath = path.join(dest, entry.name);
|
|
74
|
+
|
|
75
|
+
if (entry.isDirectory()) {
|
|
76
|
+
copyDirectory(srcPath, destPath);
|
|
77
|
+
} else {
|
|
78
|
+
fs.copyFileSync(srcPath, destPath);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Main
|
|
84
|
+
function main() {
|
|
85
|
+
const sourceDir = getSourceSkillsDir();
|
|
86
|
+
|
|
87
|
+
if (!sourceDir) {
|
|
88
|
+
console.error('Error: .agents/skills directory not found.');
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const targetDir = path.join(target.dir, target.name);
|
|
93
|
+
|
|
94
|
+
console.log(`Installing Agentic Code skills to ${target.description}...\n`);
|
|
95
|
+
console.log(`Source: ${sourceDir}`);
|
|
96
|
+
console.log(`Target: ${targetDir}\n`);
|
|
97
|
+
|
|
98
|
+
// Create target parent directory if not exists
|
|
99
|
+
if (!fs.existsSync(target.dir)) {
|
|
100
|
+
fs.mkdirSync(target.dir, { recursive: true });
|
|
101
|
+
console.log(`Created: ${target.dir}`);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Remove existing target directory
|
|
105
|
+
if (fs.existsSync(targetDir)) {
|
|
106
|
+
fs.rmSync(targetDir, { recursive: true, force: true });
|
|
107
|
+
console.log(`Removed existing: ${targetDir}`);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Copy skills
|
|
111
|
+
copyDirectory(sourceDir, targetDir);
|
|
112
|
+
|
|
113
|
+
// List installed skills
|
|
114
|
+
const skills = fs.readdirSync(targetDir, { withFileTypes: true })
|
|
115
|
+
.filter(entry => entry.isDirectory())
|
|
116
|
+
.map(entry => entry.name);
|
|
117
|
+
|
|
118
|
+
console.log(`\nInstalled ${skills.length} skills:`);
|
|
119
|
+
skills.forEach(skill => console.log(` - ${skill}`));
|
|
120
|
+
|
|
121
|
+
console.log('\nDone.');
|
|
122
|
+
if (target.postInstall) {
|
|
123
|
+
console.log(target.postInstall);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
main();
|
package/package.json
CHANGED
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-code",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Task-oriented context engineering framework for LLM coding agents - AGENTS.md standard compliant",
|
|
5
5
|
"files": [
|
|
6
6
|
"bin/",
|
|
7
7
|
".agents/",
|
|
8
|
-
"AGENTS.md"
|
|
9
|
-
"scripts/"
|
|
8
|
+
"AGENTS.md"
|
|
10
9
|
],
|
|
11
10
|
"bin": {
|
|
12
|
-
"agentic-code": "./bin/cli.js"
|
|
11
|
+
"agentic-code": "./bin/cli.js",
|
|
12
|
+
"agentic-code-install-skills": "./bin/install-codex-skills.js"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
-
"setup": "node scripts/setup.js",
|
|
16
15
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
17
16
|
},
|
|
18
17
|
"keywords": [
|
|
19
|
-
"llm",
|
|
20
|
-
"ai",
|
|
21
|
-
"coding-agent",
|
|
22
18
|
"agents-md",
|
|
23
19
|
"context-engineering",
|
|
24
20
|
"agentic-coding",
|
|
25
|
-
"
|
|
21
|
+
"coding-agent",
|
|
22
|
+
"llm",
|
|
23
|
+
"codex",
|
|
26
24
|
"cursor",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"boilerplate"
|
|
25
|
+
"windsurf",
|
|
26
|
+
"cline"
|
|
30
27
|
],
|
|
31
28
|
"author": "Shinsuke Kagawa",
|
|
32
29
|
"license": "MIT",
|
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
# TypeScript Testing Rules
|
|
2
|
-
|
|
3
|
-
## Test Framework
|
|
4
|
-
- **Vitest**: This project uses Vitest
|
|
5
|
-
- Test imports: `import { describe, it, expect, beforeEach, vi } from 'vitest'`
|
|
6
|
-
- Mock creation: Use `vi.mock()`
|
|
7
|
-
|
|
8
|
-
## Basic Testing Policy
|
|
9
|
-
|
|
10
|
-
### Quality Requirements
|
|
11
|
-
- **Coverage**: Unit test coverage must be 80% or higher
|
|
12
|
-
- **Independence**: Each test can run independently
|
|
13
|
-
- **Reproducibility**: Tests are environment-independent
|
|
14
|
-
|
|
15
|
-
### Coverage Requirements
|
|
16
|
-
**Mandatory**: Unit test coverage must be 80% or higher
|
|
17
|
-
**Metrics**: Statements, Branches, Functions, Lines
|
|
18
|
-
|
|
19
|
-
### Test Types and Scope
|
|
20
|
-
1. **Unit Tests**
|
|
21
|
-
- Verify behavior of individual functions or classes
|
|
22
|
-
- Mock all external dependencies
|
|
23
|
-
|
|
24
|
-
2. **Integration Tests**
|
|
25
|
-
- Verify coordination between multiple components
|
|
26
|
-
- Use actual dependencies (DB, API, etc.)
|
|
27
|
-
|
|
28
|
-
3. **E2E Cross-functional Tests** [MANDATORY for new features]
|
|
29
|
-
- Test existing features remain stable after new feature integration
|
|
30
|
-
- Coverage based on Design Doc's Integration Point Map impact levels
|
|
31
|
-
- Verify performance degradation stays within project-defined limits
|
|
32
|
-
|
|
33
|
-
### TypeScript/Vitest Pattern Reference
|
|
34
|
-
|
|
35
|
-
```typescript
|
|
36
|
-
describe('Cross-functional E2E Tests', () => {
|
|
37
|
-
// Pattern 1: Baseline → Change → Verify
|
|
38
|
-
it('should maintain existing behavior after new feature', async () => {
|
|
39
|
-
// 1. Capture baseline
|
|
40
|
-
const baseline = await testExistingFeature()
|
|
41
|
-
|
|
42
|
-
// 2. Enable new feature
|
|
43
|
-
await enableNewFeature()
|
|
44
|
-
|
|
45
|
-
// 3. Verify continuity
|
|
46
|
-
const result = await testExistingFeature()
|
|
47
|
-
expect(result).toEqual(baseline)
|
|
48
|
-
expect(result.responseTime).toBeLessThan(
|
|
49
|
-
baseline.responseTime * 1.2 // Project-specific threshold
|
|
50
|
-
)
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
// Pattern 2: Data integrity across features
|
|
54
|
-
it('should preserve data integrity', async () => {
|
|
55
|
-
const data = await createTestData()
|
|
56
|
-
await newFeatureOperation(data.id)
|
|
57
|
-
|
|
58
|
-
const retrieved = await existingFeatureGet(data.id)
|
|
59
|
-
expect(retrieved).toEqual(data) // No unexpected mutations
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
**Note**: LLM outputs naturally vary - test behavior, not exact matches
|
|
64
|
-
|
|
65
|
-
## TDD Process [MANDATORY for all code changes]
|
|
66
|
-
|
|
67
|
-
**Execute this process for every code change:**
|
|
68
|
-
|
|
69
|
-
### RED Phase
|
|
70
|
-
1. Write test that defines expected behavior
|
|
71
|
-
2. Run test
|
|
72
|
-
3. Confirm test FAILS (if it passes, the test is wrong)
|
|
73
|
-
|
|
74
|
-
### GREEN Phase
|
|
75
|
-
1. Write MINIMAL code to make test pass
|
|
76
|
-
2. Run test
|
|
77
|
-
3. Confirm test PASSES
|
|
78
|
-
|
|
79
|
-
### REFACTOR Phase
|
|
80
|
-
1. Improve code quality
|
|
81
|
-
2. Run test
|
|
82
|
-
3. Confirm test STILL PASSES
|
|
83
|
-
|
|
84
|
-
### VERIFY Phase [MANDATORY - 0 ERRORS REQUIRED]
|
|
85
|
-
1. Execute ALL quality check commands below
|
|
86
|
-
2. Fix any errors until ALL commands pass with 0 errors
|
|
87
|
-
3. Confirm no regressions
|
|
88
|
-
4. ENFORCEMENT: Cannot proceed with ANY errors or warnings
|
|
89
|
-
|
|
90
|
-
**Exceptions (TDD not required):**
|
|
91
|
-
|
|
92
|
-
The following cases do NOT require test-first approach:
|
|
93
|
-
|
|
94
|
-
1. **Pure Configuration Files**
|
|
95
|
-
- package.json, tsconfig.json, build configs
|
|
96
|
-
- Environment variable files (.env templates)
|
|
97
|
-
- Linter/formatter configurations
|
|
98
|
-
- Rationale: No business logic to verify
|
|
99
|
-
|
|
100
|
-
2. **Documentation Only Changes**
|
|
101
|
-
- README updates
|
|
102
|
-
- Code comments additions
|
|
103
|
-
- Markdown documentation
|
|
104
|
-
- Rationale: No executable behavior to test
|
|
105
|
-
|
|
106
|
-
3. **Emergency Hotfixes**
|
|
107
|
-
- Production incidents requiring immediate fix
|
|
108
|
-
- Security vulnerabilities requiring urgent patch
|
|
109
|
-
- **REQUIREMENT**: Add tests immediately after deploying fix
|
|
110
|
-
- Rationale: Speed prioritized in crisis, but tests must follow
|
|
111
|
-
|
|
112
|
-
4. **Exploratory Spikes**
|
|
113
|
-
- Time-boxed research (max 2-4 hours)
|
|
114
|
-
- Proof-of-concept for uncertain technology
|
|
115
|
-
- **REQUIREMENT**: Discard spike code or rewrite with tests before merging
|
|
116
|
-
- Rationale: Learning phase, not production code
|
|
117
|
-
|
|
118
|
-
5. **Build/Deployment Scripts**
|
|
119
|
-
- CI/CD pipeline definitions
|
|
120
|
-
- Deployment automation scripts
|
|
121
|
-
- **NOTE**: Complex scripts with business logic DO require tests
|
|
122
|
-
- Rationale: Verified through actual deployment, not unit tests
|
|
123
|
-
|
|
124
|
-
**When in Doubt**: Default to TDD. Exceptions are narrow, not broad.
|
|
125
|
-
|
|
126
|
-
## Test Design Principles
|
|
127
|
-
|
|
128
|
-
### Test Case Structure
|
|
129
|
-
- Tests consist of three stages: "Arrange," "Act," "Assert"
|
|
130
|
-
- Clear naming that shows purpose of each test
|
|
131
|
-
- One test case verifies only one behavior
|
|
132
|
-
|
|
133
|
-
### Test Data Management
|
|
134
|
-
- Manage test data in dedicated directories
|
|
135
|
-
- Define test-specific environment variable values
|
|
136
|
-
- Always mock sensitive information
|
|
137
|
-
- Keep test data minimal, using only data directly related to test case verification purposes
|
|
138
|
-
|
|
139
|
-
### Mock and Stub Usage Policy
|
|
140
|
-
|
|
141
|
-
✅ **Recommended: Mock external dependencies in unit tests**
|
|
142
|
-
- Merit: Ensures test independence and reproducibility
|
|
143
|
-
- Practice: Mock DB, API, file system, and other external dependencies
|
|
144
|
-
|
|
145
|
-
❌ **Avoid: Actual external connections in unit tests**
|
|
146
|
-
- Reason: Slows test speed and causes environment-dependent problems
|
|
147
|
-
|
|
148
|
-
### Test Failure Response Decision Criteria
|
|
149
|
-
|
|
150
|
-
**Fix tests**: Wrong expected values, references to non-existent features, dependence on implementation details, implementation only for tests
|
|
151
|
-
**Fix implementation**: Valid specifications, business logic, important edge cases
|
|
152
|
-
**When in doubt**: Confirm with user
|
|
153
|
-
|
|
154
|
-
## Test Helper Utilization Rules
|
|
155
|
-
|
|
156
|
-
### Basic Principles
|
|
157
|
-
Test helpers are utilized to reduce duplication in test code and improve maintainability.
|
|
158
|
-
|
|
159
|
-
### Decision Criteria
|
|
160
|
-
| Mock Characteristics | Response Policy |
|
|
161
|
-
|---------------------|-----------------|
|
|
162
|
-
| **Simple and stable** | Consolidate in common helpers |
|
|
163
|
-
| **Complex or frequently changing** | Individual implementation |
|
|
164
|
-
| **Duplicated in 3+ places** | Consider consolidation |
|
|
165
|
-
| **Test-specific logic** | Individual implementation |
|
|
166
|
-
|
|
167
|
-
### Test Helper Usage Examples
|
|
168
|
-
```typescript
|
|
169
|
-
// ✅ Recommended: Utilize builder pattern
|
|
170
|
-
const testData = new TestDataBuilder()
|
|
171
|
-
.withDefaults()
|
|
172
|
-
.withName('Test User')
|
|
173
|
-
.build()
|
|
174
|
-
|
|
175
|
-
// ✅ Recommended: Custom assertions
|
|
176
|
-
function assertValidUser(user: unknown): asserts user is User {
|
|
177
|
-
// Validation logic
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// ❌ Avoid: Individual implementation of duplicate complex mocks
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
## Test Implementation Conventions
|
|
184
|
-
|
|
185
|
-
### Directory Structure
|
|
186
|
-
**File structure:**
|
|
187
|
-
- src/application/services/service.ts: Main service file
|
|
188
|
-
- src/application/services/__tests__/service.test.ts: Unit tests
|
|
189
|
-
- src/application/services/__tests__/service.int.test.ts: Integration tests
|
|
190
|
-
|
|
191
|
-
### Naming Conventions
|
|
192
|
-
- Test files: `{target-file-name}.test.ts`
|
|
193
|
-
- Integration test files: `{target-file-name}.int.test.ts`
|
|
194
|
-
- Test suites: Names describing target features or situations
|
|
195
|
-
- Test cases: Names describing expected behavior
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
### Test Code Quality Rules
|
|
199
|
-
|
|
200
|
-
✅ **Recommended: Keep all tests always active**
|
|
201
|
-
- Merit: Guarantees test suite completeness
|
|
202
|
-
- Practice: Fix problematic tests and activate them
|
|
203
|
-
|
|
204
|
-
❌ **Avoid: test.skip() or commenting out**
|
|
205
|
-
- Reason: Creates test gaps and incomplete quality checks
|
|
206
|
-
- Solution: Completely delete unnecessary tests
|
|
207
|
-
|
|
208
|
-
## Test Quality Criteria [MANDATORY]
|
|
209
|
-
|
|
210
|
-
1. **Boundary coverage**: Include empty/zero/max/error cases with happy paths
|
|
211
|
-
2. **Literal expectations**: `expect(calc(100)).toBe(10)` — use literals, not `100 * RATE`
|
|
212
|
-
3. **Result verification**: Assert return values and state, not call order
|
|
213
|
-
4. **Meaningful assertions**: Every test must have at least one `expect()`
|
|
214
|
-
5. **Mock external I/O only**: Mock DB/API/filesystem, use real internal utils
|
|
215
|
-
|
|
216
|
-
## Test Granularity Principles
|
|
217
|
-
|
|
218
|
-
### Core Principle: Observable Behavior Only
|
|
219
|
-
**MUST Test**: Public APIs, return values, exceptions, external calls, persisted state
|
|
220
|
-
**MUST NOT Test**: Private methods, internal state, algorithm implementation details
|
|
221
|
-
|
|
222
|
-
```typescript
|
|
223
|
-
// ✅ Test observable behavior
|
|
224
|
-
expect(calculatePrice(100, 0.1)).toBe(110)
|
|
225
|
-
|
|
226
|
-
// ❌ Test implementation details
|
|
227
|
-
expect((calculator as any).taxRate).toBe(0.1)
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
## Mock Type Safety Enforcement
|
|
231
|
-
|
|
232
|
-
### Minimal Type Definition Requirements
|
|
233
|
-
```typescript
|
|
234
|
-
// ✅ Only required parts
|
|
235
|
-
type TestRepo = Pick<Repository, 'find' | 'save'>
|
|
236
|
-
const mock: TestRepo = { find: vi.fn(), save: vi.fn() }
|
|
237
|
-
|
|
238
|
-
// Only when absolutely necessary, with clear justification
|
|
239
|
-
const sdkMock = {
|
|
240
|
-
call: vi.fn()
|
|
241
|
-
} as unknown as ExternalSDK // Complex external SDK type structure
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
## Basic Vitest Example
|
|
245
|
-
|
|
246
|
-
```typescript
|
|
247
|
-
import { describe, it, expect, beforeEach, vi } from 'vitest'
|
|
248
|
-
|
|
249
|
-
// Mock setup example
|
|
250
|
-
vi.mock('./userService', () => ({
|
|
251
|
-
getUserById: vi.fn(),
|
|
252
|
-
updateUser: vi.fn()
|
|
253
|
-
}))
|
|
254
|
-
|
|
255
|
-
describe('ComponentName', () => {
|
|
256
|
-
it('should follow AAA pattern', () => {
|
|
257
|
-
// Arrange
|
|
258
|
-
const input = 'test'
|
|
259
|
-
|
|
260
|
-
// Act
|
|
261
|
-
const result = someFunction(input)
|
|
262
|
-
|
|
263
|
-
// Assert
|
|
264
|
-
expect(result).toBe('expected')
|
|
265
|
-
})
|
|
266
|
-
})
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
## Quality Check Commands [MANDATORY for VERIFY phase]
|
|
270
|
-
|
|
271
|
-
**ALL TypeScript/JavaScript commands MUST pass with 0 errors before task completion:**
|
|
272
|
-
|
|
273
|
-
```bash
|
|
274
|
-
npm test # MUST pass all tests
|
|
275
|
-
npm run build # MUST build successfully
|
|
276
|
-
npm run lint # MUST have 0 lint errors
|
|
277
|
-
npm run type-check # MUST have 0 type errors
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
**ENFORCEMENT:**
|
|
281
|
-
- Run ALL applicable commands listed above
|
|
282
|
-
- Fix ANY errors or warnings before marking task complete
|
|
283
|
-
- If command doesn't exist in package.json, skip that specific command
|
|
284
|
-
- Document which commands were run in task completion
|
package/scripts/setup.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const { execSync } = require('child_process');
|
|
6
|
-
|
|
7
|
-
// Parse command line arguments for language option
|
|
8
|
-
const args = process.argv.slice(2);
|
|
9
|
-
const langOption = args.find(arg => arg.startsWith('--lang='));
|
|
10
|
-
const selectedLang = langOption ? langOption.split('=')[1] : 'general';
|
|
11
|
-
|
|
12
|
-
console.log('🚀 Setting up Agentic Code framework...\n');
|
|
13
|
-
|
|
14
|
-
// Check if we're in a Git repository
|
|
15
|
-
function isGitRepo() {
|
|
16
|
-
try {
|
|
17
|
-
execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' });
|
|
18
|
-
return true;
|
|
19
|
-
} catch {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Initialize Git repository if not exists
|
|
25
|
-
if (!isGitRepo()) {
|
|
26
|
-
console.log('📁 Initializing Git repository...');
|
|
27
|
-
try {
|
|
28
|
-
execSync('git init', { stdio: 'inherit' });
|
|
29
|
-
console.log('✓ Git repository initialized\n');
|
|
30
|
-
} catch (error) {
|
|
31
|
-
console.error('❌ Failed to initialize Git repository:', error.message);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Set up language configuration
|
|
36
|
-
const languageNames = {
|
|
37
|
-
general: 'General (language-agnostic)',
|
|
38
|
-
typescript: 'TypeScript'
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const languageName = languageNames[selectedLang] || selectedLang;
|
|
42
|
-
console.log(`⚙️ Setting up ${languageName} configuration...`);
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
const langPath = path.join(__dirname, '..', '.agents', 'rules', 'language');
|
|
46
|
-
const sourcePath = path.join(langPath, selectedLang);
|
|
47
|
-
const targetRulesPath = path.join(langPath, 'rules.md');
|
|
48
|
-
const targetTestingPath = path.join(langPath, 'testing.md');
|
|
49
|
-
|
|
50
|
-
// Check if source directory exists
|
|
51
|
-
if (!fs.existsSync(sourcePath)) {
|
|
52
|
-
console.error(`❌ Language '${selectedLang}' is not supported.`);
|
|
53
|
-
console.log('Available languages: general, typescript');
|
|
54
|
-
process.exit(1);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Remove existing symlinks if they exist
|
|
58
|
-
if (fs.existsSync(targetRulesPath)) {
|
|
59
|
-
fs.unlinkSync(targetRulesPath);
|
|
60
|
-
}
|
|
61
|
-
if (fs.existsSync(targetTestingPath)) {
|
|
62
|
-
fs.unlinkSync(targetTestingPath);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Create new symlinks
|
|
66
|
-
fs.symlinkSync(path.join(sourcePath, 'rules.md'), targetRulesPath);
|
|
67
|
-
fs.symlinkSync(path.join(sourcePath, 'testing.md'), targetTestingPath);
|
|
68
|
-
|
|
69
|
-
console.log(`✓ ${languageName} has been set as the active language.`);
|
|
70
|
-
console.log(` - .agents/rules/language/rules.md → ${selectedLang}/rules.md`);
|
|
71
|
-
console.log(` - .agents/rules/language/testing.md → ${selectedLang}/testing.md\n`);
|
|
72
|
-
} catch (error) {
|
|
73
|
-
console.error('❌ Failed to setup language configuration:', error.message);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Success message
|
|
77
|
-
console.log('🎉 Agentic Code framework is ready to use!');
|
|
78
|
-
console.log('\n📚 Quick Start:');
|
|
79
|
-
console.log(' 1. Read AGENTS.md to understand the framework');
|
|
80
|
-
console.log(' 2. Start with task analysis: .agents/tasks/task-analysis.md');
|
|
81
|
-
console.log(' 3. Follow the task-rule-matrix for complex workflows');
|
|
82
|
-
console.log('\n💡 Need help? Check the documentation or open an issue on GitHub.');
|