IdiomarkD - Idiomark for Developers
IdiomarkD (Idiomark for Developers) is a PEP (Idiomark Extension Protocol) for analyzing developer behavioral patterns from code samples.
v1: Static Behavioral Analysis
Analyzes developer behavioral patterns from static code samples - no git history required.
What It Analyzes
| Dimension | Analyzes | Example |
|---|---|---|
| Cognitive Style | Loop patterns, comments, iterations | for loops vs .map(), TODO/FIXME frequency |
| Code Structure | Function length, nesting depth, organization | 3-layer nested = high complexity tolerance |
| Naming | Variable conventions, abbreviations | camelCase vs UPPER_SNAKE |
| Error Handling | try/catch patterns, logging | Graceful degradation vs fail-fast |
| Testing | Test-to-code ratio, mock strategy | TDD zealot vs exploratory |
| Code Review | Comments, documentation style | Collaborative vs direct |
API Endpoint
POST /api/v1/analyze
Analyzes code samples for developer behavioral patterns.
Base URL: http://localhost:4000
Request
{
"code_samples": [
{
"filePath": "src/components/Button.tsx",
"content": "export function Button() {\n return <button>Click</button>\n}",
"language": "typescript"
},
{
"filePath": "src/utils/helpers.ts",
"content": "export const formatDate = (date: Date) => {...}",
"language": "typescript"
}
]
}
Limits:
- Max 100 samples per request
- Max 100KB per sample
- Rate limited to 100 requests/minute
Response
{
"behavioral": {
"cognitive_style": {
"problem_solving": "iterative_refinement",
"learning_style": "experimentation",
"documentation_preference": "code_first_comments_selective"
},
"code_structure": {
"functional_preference": 0.65,
"max_function_length": 18,
"complexity_tolerance": "moderate",
"file_organization": "co_located"
},
"naming": {
"philosophy": "descriptive_over_brief",
"conventions": {
"variables": "camelCase",
"types": "PascalCase",
"constants": "UPPER_SNAKE",
"files": "kebab-case"
},
"abbreviations": ["ctx", "fmt", "cfg"],
"anti_patterns": ["data", "temp", "obj"]
},
"error_handling": {
"philosophy": "graceful_degradation",
"fail_fast": false,
"error_context": "always_include_trace",
"logging_level": "info"
},
"testing": {
"temperament": "pragmatic_not_zealous",
"coverage_threshold": 0.72,
"test_external_dependencies": true,
"mock_strategy": "mixed"
},
"code_review": {
"style": "collaborative_not_adversarial",
"focus_areas": ["asynchronous_patterns", "error_handling", "logging"],
"nit_picks": ["console_logs", "magic_numbers"]
}
},
"confidence": {
"overall": 0.82,
"cognitive_style": 0.85,
"code_structure": 0.78,
"naming": 0.88,
"error_handling": 0.75,
"testing": 0.80,
"code_review": 0.76
},
"sampleCount": 42,
"analyzedAt": "2026-02-14T12:00:00.000Z",
"meta": {
"processedAt": "2026-02-14T12:00:05.123Z",
"processingTimeMs": 123,
"apiVersion": "1.0.0"
}
}
CLI Usage
# Analyze local codebase
npx @idiomark/core analyze-code ./src --format=idiomarkd
# Analyze specific file
npx @idiomark/core analyze-code ./src/components/Button.tsx --format=idiomarkd
# Save to file
npx @idiomark/core analyze-code ./src --format=idiomarkd > my-developer-profile.idiomarkd
v2: Evolution Patterns (Planned)
Future work - git history and commit pattern analysis.
Planned Features:
- Commit pattern detection (iterative vs big-bang)
- Churn analysis (files changed per commit)
- PR/issue collaboration style
- Fix turnaround time
- Code review responsiveness
See: v2 Future Work
Health Check
GET /health
curl http://localhost:4000/health
{
"status": "ok",
"service": "idiomarkd-api",
"version": "1.0.0",
"timestamp": "2026-02-14T12:00:00.000Z"
}
Environment Variables
| Variable | Description | Default |
|---|---|---|
PORT | Server port | 4000 |
HOST | Server host | 0.0.0.0 |
GITHUB_TOKEN | GitHub API token (future use) | - |
RATE_LIMIT_PER_MIN | Requests per minute | 100 |
LOG_LEVEL | Logging verbosity | info |
TypeScript Types
import type { CodeSample, BehavioralAnalysisResult } from '@idiomark/core/types-dev'
const samples: CodeSample[] = [
{
filePath: 'src/index.ts',
content: 'export function main() {}',
language: 'typescript',
metadata: {
commitHash: 'abc123',
timestamp: '2026-02-14T12:00:00Z',
author: 'developer'
}
}
]
const result: BehavioralAnalysisResult = await analyzeDeveloperBehavior(samples)
Architecture
IdiomarkD v1 runs on port 4000 as a separate service:
| Service | Port | Purpose |
|---|---|---|
| Main API | 3000 | Idiomark for social media profiles |
| IdiomarkD API | 4000 | Static behavioral analysis for developers |
Why separate?
- IdiomarkD is CPU-intensive (code parsing)
- GitHub API rate limiting doesn't affect main API
- Independent deployment/rollback
- Can scale separately
See Also
- SDK Guide - Programmatic Idiomark usage
- CLI Reference - Command-line tools