@defai.digital/automatosx 12.8.7 → 13.1.3
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/LICENSE +1 -1
- package/README.md +48 -754
- package/dist/bin.d.ts +8 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +16 -0
- package/dist/bin.js.map +1 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -74239
- package/dist/index.js.map +1 -0
- package/package.json +35 -160
- package/.github/assets/ax-cli.png +0 -0
- package/.github/assets/axlogo.png +0 -0
- package/CHANGELOG.md +0 -81
- package/SECURITY.md +0 -173
- package/dist/mcp/index.d.ts +0 -2
- package/dist/mcp/index.js +0 -43627
- package/examples/AGENTS_INFO.md +0 -187
- package/examples/README.md +0 -434
- package/examples/abilities/accessibility.md +0 -115
- package/examples/abilities/api-design.md +0 -168
- package/examples/abilities/best-practices.md +0 -102
- package/examples/abilities/caching-strategy.md +0 -165
- package/examples/abilities/ci-cd.md +0 -61
- package/examples/abilities/clean-code.md +0 -398
- package/examples/abilities/code-generation.md +0 -333
- package/examples/abilities/code-review.md +0 -51
- package/examples/abilities/component-architecture.md +0 -112
- package/examples/abilities/content-creation.md +0 -97
- package/examples/abilities/data-modeling.md +0 -171
- package/examples/abilities/data-validation.md +0 -50
- package/examples/abilities/db-modeling.md +0 -167
- package/examples/abilities/debugging.md +0 -52
- package/examples/abilities/design-patterns.md +0 -437
- package/examples/abilities/design-system-implementation.md +0 -126
- package/examples/abilities/documentation.md +0 -54
- package/examples/abilities/etl-pipelines.md +0 -44
- package/examples/abilities/feasibility-study.md +0 -20
- package/examples/abilities/general-assistance.md +0 -26
- package/examples/abilities/idea-evaluation.md +0 -21
- package/examples/abilities/infra-as-code.md +0 -57
- package/examples/abilities/job-orchestration.md +0 -44
- package/examples/abilities/literature-review.md +0 -19
- package/examples/abilities/longform-report.md +0 -25
- package/examples/abilities/mathematical-reasoning.md +0 -170
- package/examples/abilities/observability.md +0 -61
- package/examples/abilities/orbital-mechanics.md +0 -50
- package/examples/abilities/our-architecture-decisions.md +0 -180
- package/examples/abilities/our-code-review-checklist.md +0 -149
- package/examples/abilities/our-coding-standards.md +0 -369
- package/examples/abilities/our-project-structure.md +0 -183
- package/examples/abilities/performance.md +0 -89
- package/examples/abilities/problem-solving.md +0 -50
- package/examples/abilities/propulsion-systems.md +0 -50
- package/examples/abilities/quantum-algorithm-design.md +0 -54
- package/examples/abilities/quantum-error-correction.md +0 -56
- package/examples/abilities/quantum-frameworks-transpilation.md +0 -53
- package/examples/abilities/quantum-noise-modeling.md +0 -58
- package/examples/abilities/refactoring.md +0 -223
- package/examples/abilities/release-strategy.md +0 -58
- package/examples/abilities/secrets-policy.md +0 -61
- package/examples/abilities/secure-coding-review.md +0 -60
- package/examples/abilities/software-architecture.md +0 -394
- package/examples/abilities/solid-principles.md +0 -341
- package/examples/abilities/sql-optimization.md +0 -84
- package/examples/abilities/state-management.md +0 -96
- package/examples/abilities/task-planning.md +0 -65
- package/examples/abilities/technical-writing.md +0 -77
- package/examples/abilities/telemetry-diagnostics.md +0 -51
- package/examples/abilities/testing.md +0 -56
- package/examples/abilities/threat-modeling.md +0 -58
- package/examples/abilities/troubleshooting.md +0 -80
- package/examples/abilities/typescript-zod-validation.md +0 -830
- package/examples/agents/AGENTS_INTEGRATION.md +0 -99
- package/examples/agents/aerospace-scientist.yaml +0 -159
- package/examples/agents/architecture.yaml +0 -244
- package/examples/agents/automatosx.config.json +0 -286
- package/examples/agents/backend.yaml +0 -141
- package/examples/agents/ceo.yaml +0 -105
- package/examples/agents/creative-marketer.yaml +0 -173
- package/examples/agents/cto.yaml +0 -118
- package/examples/agents/data-scientist.yaml +0 -200
- package/examples/agents/data.yaml +0 -106
- package/examples/agents/design.yaml +0 -115
- package/examples/agents/devops.yaml +0 -124
- package/examples/agents/frontend.yaml +0 -171
- package/examples/agents/fullstack.yaml +0 -172
- package/examples/agents/mobile.yaml +0 -185
- package/examples/agents/product.yaml +0 -103
- package/examples/agents/quality.yaml +0 -117
- package/examples/agents/quantum-engineer.yaml +0 -166
- package/examples/agents/researcher.yaml +0 -122
- package/examples/agents/security.yaml +0 -115
- package/examples/agents/standard.yaml +0 -214
- package/examples/agents/writer.yaml +0 -122
- package/examples/providers/README.md +0 -117
- package/examples/providers/claude/CLAUDE_INTEGRATION.md +0 -302
- package/examples/providers/claude/mcp/automatosx.json +0 -244
- package/examples/providers/codex/CODEX_INTEGRATION.md +0 -593
- package/examples/providers/codex/README.md +0 -349
- package/examples/providers/codex/usage-examples.ts +0 -421
- package/examples/providers/gemini/GEMINI_INTEGRATION.md +0 -236
- package/examples/providers/gemini/README.md +0 -76
- package/examples/providers/openai-codex-example.ts +0 -421
- package/examples/pytorch_resnet50_training.py +0 -289
- package/examples/specs/automatosx-release.ax.yaml +0 -380
- package/examples/specs/enterprise.ax.yaml +0 -121
- package/examples/specs/enterprise.yaml.mustache +0 -121
- package/examples/specs/government.ax.yaml +0 -148
- package/examples/specs/government.yaml.mustache +0 -148
- package/examples/specs/minimal.ax.yaml +0 -21
- package/examples/specs/minimal.yaml.mustache +0 -21
- package/examples/teams/business.yaml +0 -56
- package/examples/teams/core.yaml +0 -60
- package/examples/teams/design.yaml +0 -58
- package/examples/teams/engineering.yaml +0 -69
- package/examples/teams/research.yaml +0 -56
- package/examples/use-cases/01-web-app-development.md +0 -374
- package/examples/workflows/analyst.yaml +0 -60
- package/examples/workflows/assistant.yaml +0 -48
- package/examples/workflows/basic-agent.yaml +0 -28
- package/examples/workflows/code-reviewer.yaml +0 -52
- package/examples/workflows/debugger.yaml +0 -63
- package/examples/workflows/designer.yaml +0 -69
- package/examples/workflows/developer.yaml +0 -60
- package/examples/workflows/fullstack-developer.yaml +0 -395
- package/examples/workflows/qa-specialist.yaml +0 -71
- package/schema/ability-metadata.json +0 -21
- package/schema/config.json +0 -703
- package/schema/spec-schema.json +0 -608
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
# Our Code Review Checklist - AutomatosX v5
|
|
2
|
-
|
|
3
|
-
> Code review checklist for AutomatosX team
|
|
4
|
-
|
|
5
|
-
## Before Submitting PR
|
|
6
|
-
|
|
7
|
-
### Code Quality
|
|
8
|
-
|
|
9
|
-
- [ ] **No `any` types** - All types explicit, use `unknown` if truly unknown
|
|
10
|
-
- [ ] **ESM imports** - All imports have `.js` extension
|
|
11
|
-
- [ ] **Function size** - Functions <50 lines, extract helpers if needed
|
|
12
|
-
- [ ] **Naming** - Clear, descriptive names (no abbreviations)
|
|
13
|
-
- [ ] **Comments** - JSDoc for public APIs, inline for complex logic
|
|
14
|
-
|
|
15
|
-
### Error Handling
|
|
16
|
-
|
|
17
|
-
- [ ] **Custom errors** - Use AgentValidationError, PathError, etc.
|
|
18
|
-
- [ ] **Error context** - Include relevant context in error messages
|
|
19
|
-
- [ ] **Try-catch blocks** - Catch and re-throw with context
|
|
20
|
-
- [ ] **No silent failures** - All errors logged or thrown
|
|
21
|
-
|
|
22
|
-
### Security
|
|
23
|
-
|
|
24
|
-
- [ ] **Path validation** - All file access through PathResolver or WorkspaceManager
|
|
25
|
-
- [ ] **Input sanitization** - User inputs sanitized before use
|
|
26
|
-
- [ ] **Workspace boundaries** - Writes only to automatosx/PRD or automatosx/tmp (v5.2+)
|
|
27
|
-
- [ ] **File size limits** - Check file sizes to prevent DoS
|
|
28
|
-
- [ ] **No hardcoded secrets** - Use environment variables
|
|
29
|
-
|
|
30
|
-
### Testing
|
|
31
|
-
|
|
32
|
-
- [ ] **Tests added** - New features have tests (unit + integration)
|
|
33
|
-
- [ ] **Coverage maintained** - Overall ≥70%, core modules ≥85%
|
|
34
|
-
- [ ] **Tests pass** - All 1,149 tests passing
|
|
35
|
-
- [ ] **Edge cases** - Test edge cases and error scenarios
|
|
36
|
-
|
|
37
|
-
### Performance
|
|
38
|
-
|
|
39
|
-
- [ ] **No bottlenecks** - Profile if adding expensive operations
|
|
40
|
-
- [ ] **Lazy loading** - Heavy deps use dynamic import
|
|
41
|
-
- [ ] **Caching** - Use TTLCache for expensive operations
|
|
42
|
-
- [ ] **Bundle size** - Check `dist/index.js` stays <250KB
|
|
43
|
-
|
|
44
|
-
### Logging
|
|
45
|
-
|
|
46
|
-
- [ ] **Structured logging** - Use `logger.info/warn/error` with context
|
|
47
|
-
- [ ] **Log levels** - Appropriate log levels (debug/info/warn/error)
|
|
48
|
-
- [ ] **No console.log** - Use logger, not console.log
|
|
49
|
-
|
|
50
|
-
### Git
|
|
51
|
-
|
|
52
|
-
- [ ] **Conventional commits** - Format: `type(scope): message`
|
|
53
|
-
- [ ] **Descriptive message** - Clear what and why
|
|
54
|
-
- [ ] **No large files** - No binaries or large files
|
|
55
|
-
- [ ] **No sensitive data** - No API keys, passwords, etc.
|
|
56
|
-
|
|
57
|
-
## Reviewer Checklist
|
|
58
|
-
|
|
59
|
-
### Code Review
|
|
60
|
-
|
|
61
|
-
- [ ] **Logic correctness** - Does the code do what it's supposed to?
|
|
62
|
-
- [ ] **Type safety** - Are all types correct and complete?
|
|
63
|
-
- [ ] **Error handling** - Are errors handled appropriately?
|
|
64
|
-
- [ ] **Security** - No security vulnerabilities introduced?
|
|
65
|
-
|
|
66
|
-
### Architecture
|
|
67
|
-
|
|
68
|
-
- [ ] **Import hierarchy** - Follows layer architecture (types → utils → core → agents → cli)
|
|
69
|
-
- [ ] **Module boundaries** - No circular dependencies
|
|
70
|
-
- [ ] **Separation of concerns** - Each module has single responsibility
|
|
71
|
-
|
|
72
|
-
### Testing
|
|
73
|
-
|
|
74
|
-
- [ ] **Test quality** - Tests are meaningful and comprehensive
|
|
75
|
-
- [ ] **Test coverage** - Coverage meets targets
|
|
76
|
-
- [ ] **Mock providers** - Tests use AX_MOCK_PROVIDERS=true
|
|
77
|
-
|
|
78
|
-
### Documentation
|
|
79
|
-
|
|
80
|
-
- [ ] **JSDoc complete** - Public APIs have JSDoc
|
|
81
|
-
- [ ] **README updated** - If adding features, update README
|
|
82
|
-
- [ ] **CHANGELOG updated** - Add entry to GitHub Releases (https://github.com/defai-digital/automatosx/releases)
|
|
83
|
-
|
|
84
|
-
### Performance & Size
|
|
85
|
-
|
|
86
|
-
- [ ] **No new large deps** - Check package.json for new dependencies
|
|
87
|
-
- [ ] **Bundle size** - Run `npm run build` and check dist/index.js size
|
|
88
|
-
- [ ] **Startup time** - CLI startup time reasonable
|
|
89
|
-
|
|
90
|
-
## Common Patterns
|
|
91
|
-
|
|
92
|
-
### Type Safety
|
|
93
|
-
|
|
94
|
-
```typescript
|
|
95
|
-
// ❌ Avoid
|
|
96
|
-
const data: any = loadData();
|
|
97
|
-
|
|
98
|
-
// ✅ Prefer
|
|
99
|
-
const data: ProfileData = loadProfile(name);
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Error Handling
|
|
103
|
-
|
|
104
|
-
```typescript
|
|
105
|
-
// ❌ Avoid: Silent failure
|
|
106
|
-
try {
|
|
107
|
-
await task();
|
|
108
|
-
} catch (e) { }
|
|
109
|
-
|
|
110
|
-
// ✅ Prefer: Log and re-throw
|
|
111
|
-
try {
|
|
112
|
-
await task();
|
|
113
|
-
} catch (error) {
|
|
114
|
-
logger.error('Task failed', {
|
|
115
|
-
task: taskName,
|
|
116
|
-
error: (error as Error).message
|
|
117
|
-
});
|
|
118
|
-
throw error;
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Security
|
|
123
|
-
|
|
124
|
-
```typescript
|
|
125
|
-
// ❌ Avoid: Path traversal risk
|
|
126
|
-
const path = join(root, userInput);
|
|
127
|
-
|
|
128
|
-
// ✅ Prefer: Validated path
|
|
129
|
-
const resolver = new PathResolver({ projectRoot: root });
|
|
130
|
-
const path = await resolver.resolve(userInput);
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
### Logging
|
|
134
|
-
|
|
135
|
-
```typescript
|
|
136
|
-
// ❌ Avoid
|
|
137
|
-
console.log('Profile loaded');
|
|
138
|
-
|
|
139
|
-
// ✅ Prefer
|
|
140
|
-
logger.info('Profile loaded', {
|
|
141
|
-
name: profileName,
|
|
142
|
-
path: profilePath
|
|
143
|
-
});
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
**Last Updated:** 2025-10-11
|
|
149
|
-
**For:** AutomatosX v5.2+
|
|
@@ -1,369 +0,0 @@
|
|
|
1
|
-
# Our Coding Standards - AutomatosX v5
|
|
2
|
-
|
|
3
|
-
> Project-specific coding standards for AutomatosX
|
|
4
|
-
|
|
5
|
-
## TypeScript Standards
|
|
6
|
-
|
|
7
|
-
**Strict mode enabled:**
|
|
8
|
-
|
|
9
|
-
```json
|
|
10
|
-
{
|
|
11
|
-
"strict": true,
|
|
12
|
-
"noUncheckedIndexedAccess": true,
|
|
13
|
-
"noImplicitOverride": true,
|
|
14
|
-
"noFallthroughCasesInSwitch": true
|
|
15
|
-
}
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
**Type annotations:**
|
|
19
|
-
|
|
20
|
-
```typescript
|
|
21
|
-
// ✅ Good: Explicit types for public APIs
|
|
22
|
-
export function loadProfile(name: string): Promise<AgentProfile> { }
|
|
23
|
-
|
|
24
|
-
// ❌ Bad: Any types
|
|
25
|
-
function process(data: any) { } // Never use any!
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
**Error handling:**
|
|
29
|
-
|
|
30
|
-
```typescript
|
|
31
|
-
// ✅ Good: Typed errors from utils/errors.ts
|
|
32
|
-
import { AgentValidationError, PathError } from '../utils/errors.js';
|
|
33
|
-
|
|
34
|
-
if (!profile.name) {
|
|
35
|
-
throw new AgentValidationError('Missing required field: name');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Include error context
|
|
39
|
-
try {
|
|
40
|
-
await executeTask();
|
|
41
|
-
} catch (error) {
|
|
42
|
-
logger.error('Task execution failed', {
|
|
43
|
-
task: taskName,
|
|
44
|
-
agent: agentName,
|
|
45
|
-
error: (error as Error).message
|
|
46
|
-
});
|
|
47
|
-
throw error;
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
**Module system (ESM with .js extensions):**
|
|
52
|
-
|
|
53
|
-
```typescript
|
|
54
|
-
// ✅ Good: .js extension in imports (required for ESM)
|
|
55
|
-
import { PathResolver } from '../core/path-resolver.js';
|
|
56
|
-
import type { AgentProfile } from '../types/agent.js';
|
|
57
|
-
|
|
58
|
-
// ❌ Bad: No extension
|
|
59
|
-
import { PathResolver } from '../core/path-resolver';
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
**Runtime validation with Zod (REQUIRED for all scripts):**
|
|
63
|
-
|
|
64
|
-
```typescript
|
|
65
|
-
// ✅ Good: Use Zod for all external data validation
|
|
66
|
-
import { z } from 'zod';
|
|
67
|
-
|
|
68
|
-
const ConfigSchema = z.object({
|
|
69
|
-
workspaceRoot: z.string().min(1),
|
|
70
|
-
timeout: z.number().int().positive().default(30000),
|
|
71
|
-
maxRetries: z.number().int().min(0).max(5).default(3),
|
|
72
|
-
providers: z.array(z.string()).min(1),
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
type Config = z.infer<typeof ConfigSchema>;
|
|
76
|
-
|
|
77
|
-
function loadConfig(data: unknown): Config {
|
|
78
|
-
return ConfigSchema.parse(data);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// ❌ Bad: No runtime validation (TypeScript types don't catch runtime errors)
|
|
82
|
-
interface Config {
|
|
83
|
-
workspaceRoot: string;
|
|
84
|
-
timeout: number;
|
|
85
|
-
// ...
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function loadConfig(data: any): Config {
|
|
89
|
-
return data as Config; // Unsafe!
|
|
90
|
-
}
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
**When to use Zod in AutomatosX:**
|
|
94
|
-
|
|
95
|
-
- ✅ **CLI argument parsing** - Validate all user input
|
|
96
|
-
- ✅ **Configuration files** - Validate YAML/JSON configs
|
|
97
|
-
- ✅ **API requests/responses** - Validate provider responses
|
|
98
|
-
- ✅ **File I/O** - Validate file contents before processing
|
|
99
|
-
- ✅ **Environment variables** - Validate at startup
|
|
100
|
-
- ✅ **External scripts** - Always validate external data
|
|
101
|
-
|
|
102
|
-
**Example: CLI argument validation**
|
|
103
|
-
|
|
104
|
-
```typescript
|
|
105
|
-
import { z } from 'zod';
|
|
106
|
-
|
|
107
|
-
const RunCommandArgsSchema = z.object({
|
|
108
|
-
agent: z.string().min(1).max(50),
|
|
109
|
-
task: z.string().min(1),
|
|
110
|
-
timeout: z.number().int().positive().optional(),
|
|
111
|
-
verbose: z.boolean().default(false),
|
|
112
|
-
provider: z.enum(['claude', 'gemini', 'openai']).optional(),
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
export function validateRunArgs(argv: unknown) {
|
|
116
|
-
try {
|
|
117
|
-
return RunCommandArgsSchema.parse(argv);
|
|
118
|
-
} catch (error) {
|
|
119
|
-
if (error instanceof z.ZodError) {
|
|
120
|
-
const messages = error.issues.map(
|
|
121
|
-
(issue) => `${issue.path.join('.')}: ${issue.message}`
|
|
122
|
-
);
|
|
123
|
-
throw new Error(`Invalid arguments:\n${messages.join('\n')}`);
|
|
124
|
-
}
|
|
125
|
-
throw error;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
**Example: Agent profile validation**
|
|
131
|
-
|
|
132
|
-
```typescript
|
|
133
|
-
import { z } from 'zod';
|
|
134
|
-
|
|
135
|
-
const AgentProfileSchema = z.object({
|
|
136
|
-
name: z.string().min(1).max(50),
|
|
137
|
-
displayName: z.string().min(1).max(100),
|
|
138
|
-
description: z.string().min(1),
|
|
139
|
-
systemPrompt: z.string().min(1),
|
|
140
|
-
defaultProvider: z.enum(['claude', 'gemini', 'openai']).optional(),
|
|
141
|
-
timeout: z.number().int().positive().optional(),
|
|
142
|
-
abilities: z.array(z.string()).default([]),
|
|
143
|
-
stages: z.array(z.object({
|
|
144
|
-
name: z.string(),
|
|
145
|
-
prompt: z.string(),
|
|
146
|
-
checkpoints: z.array(z.string()).optional(),
|
|
147
|
-
})).optional(),
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
type AgentProfile = z.infer<typeof AgentProfileSchema>;
|
|
151
|
-
|
|
152
|
-
export async function loadAgentProfile(path: string): Promise<AgentProfile> {
|
|
153
|
-
const raw = await readFile(path, 'utf-8');
|
|
154
|
-
const yaml = YAML.parse(raw);
|
|
155
|
-
|
|
156
|
-
// Validate and return typed profile
|
|
157
|
-
return AgentProfileSchema.parse(yaml);
|
|
158
|
-
}
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
## Code Quality Standards
|
|
162
|
-
|
|
163
|
-
**Function size (<50 lines):**
|
|
164
|
-
|
|
165
|
-
```typescript
|
|
166
|
-
// ✅ Good: Small, focused function
|
|
167
|
-
private buildPrompt(context: ExecutionContext): string {
|
|
168
|
-
let prompt = '';
|
|
169
|
-
if (context.abilities) {
|
|
170
|
-
prompt += `# Your Abilities\n\n${context.abilities}\n\n`;
|
|
171
|
-
}
|
|
172
|
-
if (context.agent.stages) {
|
|
173
|
-
prompt += this.buildStagesSection(context.agent.stages);
|
|
174
|
-
}
|
|
175
|
-
prompt += `# Task\n\n${context.task}`;
|
|
176
|
-
return prompt;
|
|
177
|
-
}
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
**Naming conventions:**
|
|
181
|
-
|
|
182
|
-
```typescript
|
|
183
|
-
// ✅ Good: Descriptive names
|
|
184
|
-
const profilePath = join(profilesDir, `${name}.yaml`);
|
|
185
|
-
async function resolveAgentName(input: string): Promise<string> { }
|
|
186
|
-
|
|
187
|
-
// ✅ Good: PascalCase for classes
|
|
188
|
-
export class PathResolver { }
|
|
189
|
-
export class MemoryManager { }
|
|
190
|
-
|
|
191
|
-
// ❌ Bad: Abbreviations or vague names
|
|
192
|
-
const p = join(dir, `${n}.yaml`);
|
|
193
|
-
export class PM { }
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
**JSDoc for public APIs:**
|
|
197
|
-
|
|
198
|
-
```typescript
|
|
199
|
-
/**
|
|
200
|
-
* Load agent profile from YAML file
|
|
201
|
-
*
|
|
202
|
-
* @param name - Agent name (e.g., "backend", "quality")
|
|
203
|
-
* @returns Validated AgentProfile
|
|
204
|
-
* @throws AgentNotFoundError if profile doesn't exist
|
|
205
|
-
* @throws AgentValidationError if profile is invalid
|
|
206
|
-
*/
|
|
207
|
-
async loadProfile(name: string): Promise<AgentProfile> { }
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
## Security Standards
|
|
211
|
-
|
|
212
|
-
**Always use PathResolver:**
|
|
213
|
-
|
|
214
|
-
```typescript
|
|
215
|
-
// ✅ Good: Use PathResolver for all file access
|
|
216
|
-
import { PathResolver } from '../core/path-resolver.js';
|
|
217
|
-
|
|
218
|
-
const resolver = new PathResolver({ projectRoot });
|
|
219
|
-
const safePath = await resolver.resolve(userInput);
|
|
220
|
-
|
|
221
|
-
// ❌ Bad: Direct path manipulation
|
|
222
|
-
const path = join(projectRoot, userInput); // Unsafe!
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
**Input sanitization:**
|
|
226
|
-
|
|
227
|
-
```typescript
|
|
228
|
-
// ✅ Good: Sanitize before using in file system
|
|
229
|
-
const agentDirName = agentName
|
|
230
|
-
.replace(/[^a-zA-Z0-9-]/g, '-')
|
|
231
|
-
.toLowerCase();
|
|
232
|
-
|
|
233
|
-
// ✅ Good: File size limits to prevent DoS
|
|
234
|
-
if (content.length > 100 * 1024) {
|
|
235
|
-
throw new AgentValidationError('Profile file too large (max 100KB)');
|
|
236
|
-
}
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
**Restrictive permissions:**
|
|
240
|
-
|
|
241
|
-
```typescript
|
|
242
|
-
// ✅ Good: Restrict workspace permissions (Unix)
|
|
243
|
-
if (process.platform !== 'win32') {
|
|
244
|
-
await chmod(agentWorkspace, 0o700); // Owner only
|
|
245
|
-
}
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
## Testing Standards
|
|
249
|
-
|
|
250
|
-
**Structure with Vitest:**
|
|
251
|
-
|
|
252
|
-
```typescript
|
|
253
|
-
import { describe, it, expect, beforeEach } from 'vitest';
|
|
254
|
-
|
|
255
|
-
describe('PathResolver', () => {
|
|
256
|
-
let resolver: PathResolver;
|
|
257
|
-
|
|
258
|
-
beforeEach(() => {
|
|
259
|
-
resolver = new PathResolver({ projectRoot: '/test' });
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
it('should resolve relative paths', async () => {
|
|
263
|
-
const result = await resolver.resolve('./file.txt');
|
|
264
|
-
expect(result).toBe('/test/file.txt');
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
it('should reject path traversal', async () => {
|
|
268
|
-
await expect(
|
|
269
|
-
resolver.resolve('../../../etc/passwd')
|
|
270
|
-
).rejects.toThrow(PathError);
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
**Coverage targets:**
|
|
276
|
-
|
|
277
|
-
- Overall: 70%+ (currently 85%)
|
|
278
|
-
- Core modules: 85%+
|
|
279
|
-
- CLI commands: 70%+
|
|
280
|
-
- Utils: 90%+
|
|
281
|
-
|
|
282
|
-
## Logging Standards
|
|
283
|
-
|
|
284
|
-
**Use structured logging:**
|
|
285
|
-
|
|
286
|
-
```typescript
|
|
287
|
-
import { logger } from '../utils/logger.js';
|
|
288
|
-
|
|
289
|
-
// ✅ Good: Structured logging with context
|
|
290
|
-
logger.info('Profile loaded', {
|
|
291
|
-
name: profileName,
|
|
292
|
-
path: profilePath
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
logger.error('Execution failed', {
|
|
296
|
-
agent: agentName,
|
|
297
|
-
task: taskSummary,
|
|
298
|
-
error: (error as Error).message
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
// ❌ Bad: Console.log
|
|
302
|
-
console.log('Profile loaded');
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
**Log levels:**
|
|
306
|
-
|
|
307
|
-
- **debug:** Development details
|
|
308
|
-
- **info:** Normal operations
|
|
309
|
-
- **warn:** Recoverable issues
|
|
310
|
-
- **error:** Failures requiring attention
|
|
311
|
-
|
|
312
|
-
## Performance Standards
|
|
313
|
-
|
|
314
|
-
**Lazy loading:**
|
|
315
|
-
|
|
316
|
-
```typescript
|
|
317
|
-
// ✅ Good: Lazy load heavy dependencies
|
|
318
|
-
async executeTask() {
|
|
319
|
-
const { spawn } = await import('child_process');
|
|
320
|
-
// ...
|
|
321
|
-
}
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
**Caching:**
|
|
325
|
-
|
|
326
|
-
```typescript
|
|
327
|
-
// ✅ Good: Cache profiles with TTL
|
|
328
|
-
this.cache = new TTLCache<AgentProfile>({
|
|
329
|
-
maxEntries: 20,
|
|
330
|
-
ttl: 300000, // 5 minutes
|
|
331
|
-
cleanupInterval: 60000
|
|
332
|
-
});
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
**Bundle size target:** <250KB (currently 381KB)
|
|
336
|
-
|
|
337
|
-
## Git Commit Standards
|
|
338
|
-
|
|
339
|
-
**Conventional Commits format:** `type(scope): message`
|
|
340
|
-
|
|
341
|
-
```bash
|
|
342
|
-
# Types
|
|
343
|
-
feat(agents): add stage injection to executor
|
|
344
|
-
fix(memory): resolve vector search timeout
|
|
345
|
-
docs(readme): update installation instructions
|
|
346
|
-
test(router): add retry logic tests
|
|
347
|
-
refactor(cli): simplify command parsing
|
|
348
|
-
perf(cache): optimize TTL cleanup interval
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
**Commit message structure:**
|
|
352
|
-
|
|
353
|
-
```bash
|
|
354
|
-
# ✅ Good: Clear, specific
|
|
355
|
-
feat(stages): inject workflow stages into prompt
|
|
356
|
-
|
|
357
|
-
- Add Stage and Personality interfaces to types
|
|
358
|
-
- Update ProfileLoader to parse stages from YAML
|
|
359
|
-
- Modify Executor to include stages in prompt
|
|
360
|
-
|
|
361
|
-
# ❌ Bad: Vague
|
|
362
|
-
fix: bug fix
|
|
363
|
-
update: changes
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
---
|
|
367
|
-
|
|
368
|
-
**Last Updated:** 2025-10-10
|
|
369
|
-
**For:** AutomatosX v5.0+
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
# Our Project Structure - AutomatosX v5
|
|
2
|
-
|
|
3
|
-
> AutomatosX project organization and file structure conventions
|
|
4
|
-
|
|
5
|
-
## Directory Structure
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
automatosx/
|
|
9
|
-
├── src/ # TypeScript source code
|
|
10
|
-
│ ├── core/ # Router, PathResolver, MemoryManager, SessionManager
|
|
11
|
-
│ ├── agents/ # ProfileLoader, AbilitiesManager, ContextManager, Executor
|
|
12
|
-
│ ├── providers/ # Claude, Gemini, OpenAI implementations
|
|
13
|
-
│ ├── cli/ # CLI entry point and commands/
|
|
14
|
-
│ ├── types/ # TypeScript type definitions
|
|
15
|
-
│ └── utils/ # Logger, errors, formatters
|
|
16
|
-
│
|
|
17
|
-
├── tests/ # 1,149 tests (100% pass)
|
|
18
|
-
│ ├── unit/ # Core modules, utilities
|
|
19
|
-
│ ├── integration/ # CLI command flows
|
|
20
|
-
│ ├── e2e/ # Complete workflows
|
|
21
|
-
│ └── fixtures/ # Test helpers, mock providers
|
|
22
|
-
│
|
|
23
|
-
├── examples/
|
|
24
|
-
│ ├── agents/ # Example agent profiles (YAML)
|
|
25
|
-
│ ├── abilities/ # Example abilities (Markdown)
|
|
26
|
-
│ └── templates/ # Agent templates
|
|
27
|
-
│
|
|
28
|
-
├── dist/ # Build output (381KB, gitignored)
|
|
29
|
-
│ ├── index.js # Bundled CLI (ESM)
|
|
30
|
-
│ ├── index.js.map
|
|
31
|
-
│ └── index.d.ts
|
|
32
|
-
│
|
|
33
|
-
├── .automatosx/ # User project directory (created by init)
|
|
34
|
-
│ ├── config.json # User configuration
|
|
35
|
-
│ ├── agents/ # User's custom agents
|
|
36
|
-
│ ├── abilities/ # User's custom abilities
|
|
37
|
-
│ ├── memory/ # SQLite database (memory.db)
|
|
38
|
-
│ ├── sessions/ # Session persistence
|
|
39
|
-
│ └── logs/ # Application logs
|
|
40
|
-
│
|
|
41
|
-
├── automatosx/ # Workspace directory
|
|
42
|
-
│ ├── PRD/ # Planning documents (permanent)
|
|
43
|
-
│ └── tmp/ # Temporary files (auto-cleanup)
|
|
44
|
-
│
|
|
45
|
-
└── tmp/ # Temporary files (gitignored)
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Module Import Hierarchy
|
|
49
|
-
|
|
50
|
-
**Dependency flow (imports only from lower layers):**
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
Layer 1: types/ → No dependencies
|
|
54
|
-
Layer 2: utils/ → types/
|
|
55
|
-
Layer 3: core/ → types/, utils/
|
|
56
|
-
Layer 4: providers/ → types/, core/
|
|
57
|
-
Layer 5: agents/ → types/, utils/, core/
|
|
58
|
-
Layer 6: cli/ → All of the above
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
**Rule:** Higher layers can import from lower layers, never vice versa.
|
|
62
|
-
|
|
63
|
-
## File Naming Conventions
|
|
64
|
-
|
|
65
|
-
**TypeScript files:** `kebab-case.ts`
|
|
66
|
-
|
|
67
|
-
```
|
|
68
|
-
✅ path-resolver.ts, memory-manager.ts, claude-provider.ts
|
|
69
|
-
❌ PathResolver.ts, path_resolver.ts, pathResolver.ts
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
**Test files:** `{module-name}.test.ts`
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
✅ path-resolver.test.ts, memory-manager.test.ts
|
|
76
|
-
❌ path-resolver.spec.ts, test-path-resolver.ts
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
**Type files:** `{concept}.ts` (no -types suffix)
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
✅ types/agent.ts, types/provider.ts
|
|
83
|
-
❌ types/agent-types.ts, types/AgentTypes.ts
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
**Configuration files:**
|
|
87
|
-
|
|
88
|
-
- YAML for agents: `examples/agents/backend.yaml`
|
|
89
|
-
- Markdown for abilities: `examples/abilities/code-generation.md`
|
|
90
|
-
- JSON for config: `.automatosx/config.json`
|
|
91
|
-
|
|
92
|
-
## Import Patterns
|
|
93
|
-
|
|
94
|
-
**ESM imports (always use .js extension):**
|
|
95
|
-
|
|
96
|
-
```typescript
|
|
97
|
-
// ✅ Good: Full path with .js
|
|
98
|
-
import { PathResolver } from '../core/path-resolver.js';
|
|
99
|
-
import type { AgentProfile } from '../types/agent.js';
|
|
100
|
-
|
|
101
|
-
// ❌ Bad: Missing .js extension
|
|
102
|
-
import { PathResolver } from '../core/path-resolver';
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
**Type-only imports:**
|
|
106
|
-
|
|
107
|
-
```typescript
|
|
108
|
-
// ✅ Good: type-only imports (better tree-shaking)
|
|
109
|
-
import type { AgentProfile } from '../types/agent.js';
|
|
110
|
-
import type { Provider } from '../types/provider.js';
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
## Configuration Hierarchy
|
|
114
|
-
|
|
115
|
-
**Priority order:**
|
|
116
|
-
|
|
117
|
-
1. `.automatosx/config.json` (project-specific, created by `ax setup`)
|
|
118
|
-
2. `ax.config.json` (project root, manually created)
|
|
119
|
-
3. `~/.automatosx/config.json` (user global)
|
|
120
|
-
4. `DEFAULT_CONFIG` (defaults in `src/types/config.ts`)
|
|
121
|
-
|
|
122
|
-
**Agent profiles search order:**
|
|
123
|
-
|
|
124
|
-
1. `.automatosx/agents/{name}.yaml` (user custom)
|
|
125
|
-
2. `examples/agents/{name}.yaml` (built-in)
|
|
126
|
-
|
|
127
|
-
**Abilities search order:**
|
|
128
|
-
|
|
129
|
-
1. `.automatosx/abilities/{name}.md` (user custom)
|
|
130
|
-
2. `examples/abilities/{name}.md` (built-in)
|
|
131
|
-
|
|
132
|
-
## Build Output
|
|
133
|
-
|
|
134
|
-
**Location:** `dist/`
|
|
135
|
-
|
|
136
|
-
- `index.js` - Bundled CLI (ESM, 381KB)
|
|
137
|
-
- `index.js.map` - Source map
|
|
138
|
-
- `index.d.ts` - Type definitions
|
|
139
|
-
|
|
140
|
-
**Bundle target:** ESM, Node 24+, <250KB target
|
|
141
|
-
|
|
142
|
-
## Workspace Structure
|
|
143
|
-
|
|
144
|
-
**Shared workspaces:**
|
|
145
|
-
|
|
146
|
-
- `automatosx/PRD/` - Planning documents, feature designs, proposals (permanent)
|
|
147
|
-
- `automatosx/tmp/` - Test scripts, analysis tools, temporary reports (auto-cleanup)
|
|
148
|
-
|
|
149
|
-
**All agents** have equal read/write access to both directories.
|
|
150
|
-
|
|
151
|
-
**Memory storage:** `.automatosx/memory/memory.db`
|
|
152
|
-
|
|
153
|
-
- SQLite database with FTS5 full-text search
|
|
154
|
-
- < 1ms search performance
|
|
155
|
-
|
|
156
|
-
**Session storage:** `.automatosx/sessions/sessions.json`
|
|
157
|
-
|
|
158
|
-
- JSON-based persistence
|
|
159
|
-
- 100ms debounced saves
|
|
160
|
-
- Automatic cleanup (7+ days old)
|
|
161
|
-
|
|
162
|
-
## Security Boundaries
|
|
163
|
-
|
|
164
|
-
**Allowed reads:**
|
|
165
|
-
|
|
166
|
-
- `{projectRoot}/**/*` (validated by PathResolver)
|
|
167
|
-
|
|
168
|
-
**Allowed writes:**
|
|
169
|
-
|
|
170
|
-
- `automatosx/PRD/**/*` - Planning documents
|
|
171
|
-
- `automatosx/tmp/**/*` - Temporary files
|
|
172
|
-
|
|
173
|
-
**Forbidden:**
|
|
174
|
-
|
|
175
|
-
- Empty paths or current directory (`''`, `'.'`)
|
|
176
|
-
- Path traversal (`../../../etc/passwd`)
|
|
177
|
-
- Symbolic links outside project
|
|
178
|
-
- Absolute paths
|
|
179
|
-
|
|
180
|
-
---
|
|
181
|
-
|
|
182
|
-
**Last Updated:** 2025-10-11
|
|
183
|
-
**For:** AutomatosX v5.2+
|