Summary
Add machine-parseable JSON output mode for scripting and CI/CD integration.
Why It's Needed
- CI/CD Integration: Automated pipelines can parse results
- Scripting: Chain codetyper with other tools
- Log Parsing: Structured logs instead of colored text
- Programmatic Access: Build wrappers and integrations
Usage
codetyper --format json "fix the bug"
codetyper --format jsonl "refactor this" # JSON Lines for streaming
codetyper -p --format json "explain this code" # Print mode + JSON
Output Format
{
"session_id": "abc123",
"status": "success",
"exit_code": 0,
"provider": "copilot",
"model": "gpt-5-mini",
"messages": [
{
"role": "user",
"content": "fix the bug",
"timestamp": "2024-01-27T10:30:00Z"
},
{
"role": "assistant",
"content": "I'll fix the bug in src/app.ts...",
"tool_calls": [
{
"id": "call_123",
"tool": "edit",
"input": {
"path": "src/app.ts",
"old_string": "bug",
"new_string": "fix"
},
"output": {
"success": true,
"diff": "..."
},
"duration_ms": 150
}
],
"timestamp": "2024-01-27T10:30:05Z"
}
],
"files_modified": ["src/app.ts"],
"files_created": [],
"files_deleted": [],
"tokens": {
"input": 1500,
"output": 800,
"total": 2300
},
"duration_ms": 5000
}
Exit Codes
const EXIT_CODES = {
SUCCESS: 0,
GENERAL_ERROR: 1,
INVALID_ARGS: 2,
PROVIDER_ERROR: 3,
PERMISSION_DENIED: 4,
TOOL_FAILED: 5,
TIMEOUT: 6,
INTERRUPTED: 130,
}
Acceptance Criteria
Effort Estimate
1 day
Summary
Add machine-parseable JSON output mode for scripting and CI/CD integration.
Why It's Needed
Usage
Output Format
{ "session_id": "abc123", "status": "success", "exit_code": 0, "provider": "copilot", "model": "gpt-5-mini", "messages": [ { "role": "user", "content": "fix the bug", "timestamp": "2024-01-27T10:30:00Z" }, { "role": "assistant", "content": "I'll fix the bug in src/app.ts...", "tool_calls": [ { "id": "call_123", "tool": "edit", "input": { "path": "src/app.ts", "old_string": "bug", "new_string": "fix" }, "output": { "success": true, "diff": "..." }, "duration_ms": 150 } ], "timestamp": "2024-01-27T10:30:05Z" } ], "files_modified": ["src/app.ts"], "files_created": [], "files_deleted": [], "tokens": { "input": 1500, "output": 800, "total": 2300 }, "duration_ms": 5000 }Exit Codes
Acceptance Criteria
--format jsonflag for full JSON output--format jsonlflag for streaming JSON LinesEffort Estimate
1 day