@defai.digital/cli 13.4.3 → 13.4.5
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/bundled/agents/aerospace-scientist.json +114 -0
- package/bundled/agents/architecture.json +96 -0
- package/bundled/agents/backend.json +125 -0
- package/bundled/agents/blockchain-developer.json +114 -0
- package/bundled/agents/ceo.json +113 -0
- package/bundled/agents/creative-marketer.json +114 -0
- package/bundled/agents/cto.json +96 -0
- package/bundled/agents/data-scientist.json +96 -0
- package/bundled/agents/devops.json +98 -0
- package/bundled/agents/frontend.json +118 -0
- package/bundled/agents/fullstack.json +99 -0
- package/bundled/agents/ml-engineer.json +114 -0
- package/bundled/agents/mlops-engineer.json +102 -0
- package/bundled/agents/mobile.json +96 -0
- package/bundled/agents/product.json +96 -0
- package/bundled/agents/quality.json +95 -0
- package/bundled/agents/quantum-engineer.json +114 -0
- package/bundled/agents/researcher.json +123 -0
- package/bundled/agents/reviewer.json +107 -0
- package/bundled/agents/security.json +79 -0
- package/bundled/agents/standard.json +82 -0
- package/bundled/agents/writer.json +78 -0
- package/bundled/templates/monorepo/contract-index.ts.hbs +7 -0
- package/bundled/templates/monorepo/contract-test.ts.hbs +130 -0
- package/bundled/templates/monorepo/contracts-package.json.hbs +29 -0
- package/bundled/templates/monorepo/domain-index.ts.hbs +115 -0
- package/bundled/templates/monorepo/domain-package.json.hbs +27 -0
- package/bundled/templates/monorepo/gitignore.hbs +32 -0
- package/bundled/templates/monorepo/invariants.md.hbs +43 -0
- package/bundled/templates/monorepo/package.json.hbs +28 -0
- package/bundled/templates/monorepo/pnpm-workspace.yaml.hbs +5 -0
- package/bundled/templates/monorepo/schema.ts.hbs +82 -0
- package/bundled/templates/monorepo/template.json +106 -0
- package/bundled/templates/monorepo/tsconfig.json.hbs +22 -0
- package/bundled/templates/standalone/contract-index.ts.hbs +5 -0
- package/bundled/templates/standalone/contract-test.ts.hbs +95 -0
- package/bundled/templates/standalone/contracts-root-index.ts.hbs +7 -0
- package/bundled/templates/standalone/domain-index.ts.hbs +6 -0
- package/bundled/templates/standalone/domain-repository.ts.hbs +44 -0
- package/bundled/templates/standalone/domain-service.ts.hbs +102 -0
- package/bundled/templates/standalone/gitignore.hbs +27 -0
- package/bundled/templates/standalone/invariants.md.hbs +35 -0
- package/bundled/templates/standalone/package.json.hbs +41 -0
- package/bundled/templates/standalone/schema.ts.hbs +61 -0
- package/bundled/templates/standalone/src-index.ts.hbs +11 -0
- package/bundled/templates/standalone/template.json +91 -0
- package/bundled/templates/standalone/tsconfig.json.hbs +20 -0
- package/bundled/templates/standalone/vitest.config.ts.hbs +8 -0
- package/bundled/workflows/adversarial-debate.yaml +222 -0
- package/bundled/workflows/analyst.yaml +115 -0
- package/bundled/workflows/assistant.yaml +74 -0
- package/bundled/workflows/code-review-discussion.yaml +166 -0
- package/bundled/workflows/code-reviewer.yaml +94 -0
- package/bundled/workflows/contract-first-project.yaml +356 -0
- package/bundled/workflows/debugger.yaml +107 -0
- package/bundled/workflows/designer.yaml +113 -0
- package/bundled/workflows/developer.yaml +105 -0
- package/bundled/workflows/discuss-step-examples.yaml +153 -0
- package/bundled/workflows/infrastructure-automation.yaml +283 -0
- package/bundled/workflows/ml-ab-testing.yaml +311 -0
- package/bundled/workflows/ml-experiment-tracker.yaml +150 -0
- package/bundled/workflows/ml-feature-engineering.yaml +242 -0
- package/bundled/workflows/ml-model-evaluation.yaml +234 -0
- package/bundled/workflows/ml-model-monitoring.yaml +227 -0
- package/bundled/workflows/ml-model-registry.yaml +232 -0
- package/bundled/workflows/mlops-deployment.yaml +267 -0
- package/bundled/workflows/mobile-development.yaml +312 -0
- package/bundled/workflows/multi-model-discussion.yaml +243 -0
- package/bundled/workflows/product-discovery.yaml +295 -0
- package/bundled/workflows/qa-specialist.yaml +116 -0
- package/bundled/workflows/refactoring.yaml +105 -0
- package/bundled/workflows/security-audit.yaml +135 -0
- package/bundled/workflows/std/analysis.yaml +190 -0
- package/bundled/workflows/std/code-review.yaml +117 -0
- package/bundled/workflows/std/debugging.yaml +155 -0
- package/bundled/workflows/std/documentation.yaml +180 -0
- package/bundled/workflows/std/implementation.yaml +197 -0
- package/bundled/workflows/std/refactoring.yaml +180 -0
- package/bundled/workflows/std/testing.yaml +200 -0
- package/bundled/workflows/strategic-planning.yaml +235 -0
- package/bundled/workflows/technology-research.yaml +239 -0
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +8 -2
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/scaffold.d.ts.map +1 -1
- package/dist/commands/scaffold.js +6 -3
- package/dist/commands/scaffold.js.map +1 -1
- package/dist/web/api.d.ts.map +1 -1
- package/dist/web/api.js +13 -6
- package/dist/web/api.js.map +1 -1
- package/package.json +23 -22
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* {{pascalCase domainName}} Service
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
type {{pascalCase domainName}},
|
|
7
|
+
type {{pascalCase domainName}}Id,
|
|
8
|
+
type {{pascalCase domainName}}Status,
|
|
9
|
+
{{pascalCase domainName}}Schema,
|
|
10
|
+
{{pascalCase domainName}}ErrorCode,
|
|
11
|
+
} from '../../contracts/{{domainName}}/index.js';
|
|
12
|
+
import type { {{pascalCase domainName}}Repository } from './repository.js';
|
|
13
|
+
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// Service Implementation
|
|
16
|
+
// ============================================================================
|
|
17
|
+
|
|
18
|
+
export class {{pascalCase domainName}}Service {
|
|
19
|
+
constructor(private readonly repository: {{pascalCase domainName}}Repository) {}
|
|
20
|
+
|
|
21
|
+
async getById(id: {{pascalCase domainName}}Id): Promise<{{pascalCase domainName}}> {
|
|
22
|
+
const entity = await this.repository.findById(id);
|
|
23
|
+
if (!entity) {
|
|
24
|
+
throw new {{pascalCase domainName}}NotFoundError(id);
|
|
25
|
+
}
|
|
26
|
+
return entity;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async create(data: Omit<{{pascalCase domainName}}, 'id' | 'createdAt' | 'updatedAt'>): Promise<{{pascalCase domainName}}> {
|
|
30
|
+
const now = new Date().toISOString();
|
|
31
|
+
const entity: {{pascalCase domainName}} = {
|
|
32
|
+
...data,
|
|
33
|
+
id: crypto.randomUUID(),
|
|
34
|
+
createdAt: now,
|
|
35
|
+
updatedAt: now,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Validate against schema
|
|
39
|
+
{{pascalCase domainName}}Schema.parse(entity);
|
|
40
|
+
|
|
41
|
+
await this.repository.save(entity);
|
|
42
|
+
return entity;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async updateStatus(id: {{pascalCase domainName}}Id, newStatus: {{pascalCase domainName}}Status): Promise<{{pascalCase domainName}}> {
|
|
46
|
+
const entity = await this.getById(id);
|
|
47
|
+
|
|
48
|
+
// INV-{{upperCase (substring domainName 0 3)}}-101: Validate status transition
|
|
49
|
+
this.validateStatusTransition(entity.status, newStatus);
|
|
50
|
+
|
|
51
|
+
const updated: {{pascalCase domainName}} = {
|
|
52
|
+
...entity,
|
|
53
|
+
status: newStatus,
|
|
54
|
+
updatedAt: new Date().toISOString(),
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
await this.repository.save(updated);
|
|
58
|
+
return updated;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async delete(id: {{pascalCase domainName}}Id): Promise<boolean> {
|
|
62
|
+
return this.repository.delete(id);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private validateStatusTransition(
|
|
66
|
+
currentStatus: {{pascalCase domainName}}Status,
|
|
67
|
+
newStatus: {{pascalCase domainName}}Status
|
|
68
|
+
): void {
|
|
69
|
+
const validTransitions: Record<{{pascalCase domainName}}Status, {{pascalCase domainName}}Status[]> = {
|
|
70
|
+
draft: ['active', 'cancelled'],
|
|
71
|
+
active: ['completed', 'cancelled'],
|
|
72
|
+
completed: [],
|
|
73
|
+
cancelled: [],
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
if (!validTransitions[currentStatus].includes(newStatus)) {
|
|
77
|
+
throw new {{pascalCase domainName}}InvalidStatusError(currentStatus, newStatus);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ============================================================================
|
|
83
|
+
// Domain Errors
|
|
84
|
+
// ============================================================================
|
|
85
|
+
|
|
86
|
+
export class {{pascalCase domainName}}NotFoundError extends Error {
|
|
87
|
+
readonly code = {{pascalCase domainName}}ErrorCode.NOT_FOUND;
|
|
88
|
+
|
|
89
|
+
constructor(id: {{pascalCase domainName}}Id) {
|
|
90
|
+
super(`{{pascalCase domainName}} not found: ${id}`);
|
|
91
|
+
this.name = '{{pascalCase domainName}}NotFoundError';
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export class {{pascalCase domainName}}InvalidStatusError extends Error {
|
|
96
|
+
readonly code = {{pascalCase domainName}}ErrorCode.INVALID_STATUS;
|
|
97
|
+
|
|
98
|
+
constructor(currentStatus: {{pascalCase domainName}}Status, newStatus: {{pascalCase domainName}}Status) {
|
|
99
|
+
super(`Invalid status transition: ${currentStatus} → ${newStatus}`);
|
|
100
|
+
this.name = '{{pascalCase domainName}}InvalidStatusError';
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
|
|
4
|
+
# Build output
|
|
5
|
+
dist/
|
|
6
|
+
*.tsbuildinfo
|
|
7
|
+
|
|
8
|
+
# IDE
|
|
9
|
+
.idea/
|
|
10
|
+
.vscode/
|
|
11
|
+
*.swp
|
|
12
|
+
*.swo
|
|
13
|
+
|
|
14
|
+
# OS
|
|
15
|
+
.DS_Store
|
|
16
|
+
Thumbs.db
|
|
17
|
+
|
|
18
|
+
# Logs
|
|
19
|
+
*.log
|
|
20
|
+
npm-debug.log*
|
|
21
|
+
|
|
22
|
+
# Test coverage
|
|
23
|
+
coverage/
|
|
24
|
+
|
|
25
|
+
# Environment
|
|
26
|
+
.env
|
|
27
|
+
.env.local
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# {{pascalCase domainName}} Domain Invariants
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This document defines the behavioral invariants for the {{pascalCase domainName}} domain.
|
|
6
|
+
|
|
7
|
+
## Schema Invariants
|
|
8
|
+
|
|
9
|
+
### INV-{{upperCase (substring domainName 0 3)}}-001: Valid ID Format
|
|
10
|
+
{{pascalCase domainName}} ID MUST be a valid UUID v4.
|
|
11
|
+
- **Enforcement**: schema
|
|
12
|
+
- **Test**: `z.string().uuid()` rejects invalid UUIDs
|
|
13
|
+
|
|
14
|
+
### INV-{{upperCase (substring domainName 0 3)}}-002: Valid Status
|
|
15
|
+
Status MUST be one of the defined enum values.
|
|
16
|
+
- **Enforcement**: schema
|
|
17
|
+
- **Test**: `z.enum([...])` rejects invalid values
|
|
18
|
+
|
|
19
|
+
## Runtime Invariants
|
|
20
|
+
|
|
21
|
+
### INV-{{upperCase (substring domainName 0 3)}}-101: Status Transitions
|
|
22
|
+
Status transitions MUST follow the defined state machine.
|
|
23
|
+
- **Enforcement**: runtime
|
|
24
|
+
- **Valid Transitions**:
|
|
25
|
+
```
|
|
26
|
+
draft → active, cancelled
|
|
27
|
+
active → completed, cancelled
|
|
28
|
+
completed → (terminal)
|
|
29
|
+
cancelled → (terminal)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### INV-{{upperCase (substring domainName 0 3)}}-102: Timestamp Consistency
|
|
33
|
+
UpdatedAt MUST be >= CreatedAt.
|
|
34
|
+
- **Enforcement**: runtime
|
|
35
|
+
- **Test**: Update with earlier timestamp → error
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{projectName}}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "{{description}}",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./contracts": {
|
|
14
|
+
"import": "./dist/contracts/index.js",
|
|
15
|
+
"types": "./dist/contracts/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./contracts/{{domainName}}": {
|
|
18
|
+
"import": "./dist/contracts/{{domainName}}/index.js",
|
|
19
|
+
"types": "./dist/contracts/{{domainName}}/index.d.ts"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc",
|
|
24
|
+
"clean": "rm -rf dist",
|
|
25
|
+
"typecheck": "tsc --noEmit",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"test:watch": "vitest",
|
|
28
|
+
"lint": "eslint src tests"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"zod": "^3.22.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^20.0.0",
|
|
35
|
+
"typescript": "^5.3.0",
|
|
36
|
+
"vitest": "^1.0.0"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=20.0.0"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* {{pascalCase domainName}} Domain Contracts
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Value Objects
|
|
9
|
+
// ============================================================================
|
|
10
|
+
|
|
11
|
+
export const {{pascalCase domainName}}IdSchema = z.string().uuid();
|
|
12
|
+
export type {{pascalCase domainName}}Id = z.infer<typeof {{pascalCase domainName}}IdSchema>;
|
|
13
|
+
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// Enums
|
|
16
|
+
// ============================================================================
|
|
17
|
+
|
|
18
|
+
export const {{pascalCase domainName}}StatusSchema = z.enum([
|
|
19
|
+
'draft',
|
|
20
|
+
'active',
|
|
21
|
+
'completed',
|
|
22
|
+
'cancelled',
|
|
23
|
+
]);
|
|
24
|
+
export type {{pascalCase domainName}}Status = z.infer<typeof {{pascalCase domainName}}StatusSchema>;
|
|
25
|
+
|
|
26
|
+
// ============================================================================
|
|
27
|
+
// Entities
|
|
28
|
+
// ============================================================================
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* {{pascalCase domainName}} entity - Aggregate Root
|
|
32
|
+
*
|
|
33
|
+
* Invariants:
|
|
34
|
+
* - INV-{{upperCase (substring domainName 0 3)}}-001: ID must be valid UUID
|
|
35
|
+
* - INV-{{upperCase (substring domainName 0 3)}}-002: Status must be valid
|
|
36
|
+
*/
|
|
37
|
+
export const {{pascalCase domainName}}Schema = z.object({
|
|
38
|
+
id: {{pascalCase domainName}}IdSchema,
|
|
39
|
+
status: {{pascalCase domainName}}StatusSchema,
|
|
40
|
+
createdAt: z.string().datetime(),
|
|
41
|
+
updatedAt: z.string().datetime(),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export type {{pascalCase domainName}} = z.infer<typeof {{pascalCase domainName}}Schema>;
|
|
45
|
+
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// Validation
|
|
48
|
+
// ============================================================================
|
|
49
|
+
|
|
50
|
+
export function validate{{pascalCase domainName}}(data: unknown): {{pascalCase domainName}} {
|
|
51
|
+
return {{pascalCase domainName}}Schema.parse(data);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// ============================================================================
|
|
55
|
+
// Error Codes
|
|
56
|
+
// ============================================================================
|
|
57
|
+
|
|
58
|
+
export const {{pascalCase domainName}}ErrorCode = {
|
|
59
|
+
NOT_FOUND: '{{upperCase (substring domainName 0 3)}}_NOT_FOUND',
|
|
60
|
+
INVALID_STATUS: '{{upperCase (substring domainName 0 3)}}_INVALID_STATUS',
|
|
61
|
+
} as const;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "standalone",
|
|
3
|
+
"displayName": "Contract-First Standalone Project",
|
|
4
|
+
"description": "A single-package project with contract-first design",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"variables": {
|
|
7
|
+
"projectName": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"required": true,
|
|
10
|
+
"description": "Name of the project"
|
|
11
|
+
},
|
|
12
|
+
"domainName": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"required": true,
|
|
15
|
+
"description": "Primary domain name (e.g., 'order', 'user')"
|
|
16
|
+
},
|
|
17
|
+
"description": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"default": "A contract-first TypeScript project",
|
|
20
|
+
"description": "Project description"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"structure": [
|
|
24
|
+
{
|
|
25
|
+
"path": "package.json",
|
|
26
|
+
"template": "package.json.hbs"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"path": "tsconfig.json",
|
|
30
|
+
"template": "tsconfig.json.hbs"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": ".gitignore",
|
|
34
|
+
"template": "gitignore.hbs"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"path": "src/contracts/{{domainName}}/schema.ts",
|
|
38
|
+
"template": "schema.ts.hbs"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"path": "src/contracts/{{domainName}}/invariants.md",
|
|
42
|
+
"template": "invariants.md.hbs"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"path": "src/contracts/{{domainName}}/index.ts",
|
|
46
|
+
"template": "contract-index.ts.hbs"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"path": "src/contracts/index.ts",
|
|
50
|
+
"template": "contracts-root-index.ts.hbs"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"path": "src/domain/{{domainName}}/service.ts",
|
|
54
|
+
"template": "domain-service.ts.hbs"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"path": "src/domain/{{domainName}}/repository.ts",
|
|
58
|
+
"template": "domain-repository.ts.hbs"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"path": "src/domain/{{domainName}}/index.ts",
|
|
62
|
+
"template": "domain-index.ts.hbs"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"path": "src/index.ts",
|
|
66
|
+
"template": "src-index.ts.hbs"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"path": "tests/contracts/{{domainName}}.test.ts",
|
|
70
|
+
"template": "contract-test.ts.hbs"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"path": "vitest.config.ts",
|
|
74
|
+
"template": "vitest.config.ts.hbs"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"postCreate": [
|
|
78
|
+
{
|
|
79
|
+
"command": "pnpm install",
|
|
80
|
+
"description": "Install dependencies"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"command": "pnpm build",
|
|
84
|
+
"description": "Build the project"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"command": "pnpm test",
|
|
88
|
+
"description": "Run tests"
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"declaration": true,
|
|
12
|
+
"declarationMap": true,
|
|
13
|
+
"sourceMap": true,
|
|
14
|
+
"outDir": "dist",
|
|
15
|
+
"rootDir": "src",
|
|
16
|
+
"resolveJsonModule": true
|
|
17
|
+
},
|
|
18
|
+
"include": ["src/**/*"],
|
|
19
|
+
"exclude": ["node_modules", "dist", "tests"]
|
|
20
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# Adversarial Debate Workflow
|
|
2
|
+
#
|
|
3
|
+
# Two AI models argue opposing positions on a topic, with a third
|
|
4
|
+
# model serving as an impartial judge. This pattern helps uncover
|
|
5
|
+
# the strongest arguments on both sides of a question.
|
|
6
|
+
#
|
|
7
|
+
# Usage:
|
|
8
|
+
# ax run adversarial-debate --input '{"proposition": "Microservices are better than monoliths"}'
|
|
9
|
+
#
|
|
10
|
+
# The workflow assigns:
|
|
11
|
+
# - Claude: Argues FOR the proposition
|
|
12
|
+
# - Gemini: Argues AGAINST the proposition
|
|
13
|
+
# - Codex: Serves as impartial judge
|
|
14
|
+
|
|
15
|
+
workflowId: adversarial-debate
|
|
16
|
+
version: "1.0.0"
|
|
17
|
+
name: Adversarial Debate
|
|
18
|
+
description: >
|
|
19
|
+
Two AI models debate opposing positions with an impartial judge.
|
|
20
|
+
Reveals the strongest arguments on both sides of any question.
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
# Round 1: Opening Statements
|
|
24
|
+
- stepId: opening-statements
|
|
25
|
+
type: parallel
|
|
26
|
+
name: Opening Statements
|
|
27
|
+
timeout: 90000
|
|
28
|
+
config:
|
|
29
|
+
steps:
|
|
30
|
+
- stepId: proponent-opening
|
|
31
|
+
type: prompt
|
|
32
|
+
config:
|
|
33
|
+
provider: claude
|
|
34
|
+
prompt: |
|
|
35
|
+
You are arguing FOR this proposition in a formal debate:
|
|
36
|
+
|
|
37
|
+
PROPOSITION: {{input.proposition}}
|
|
38
|
+
|
|
39
|
+
Present your opening statement:
|
|
40
|
+
1. State your thesis clearly
|
|
41
|
+
2. Present 3-4 strong arguments supporting the proposition
|
|
42
|
+
3. Provide evidence and examples
|
|
43
|
+
4. Anticipate and preemptively address potential counterarguments
|
|
44
|
+
|
|
45
|
+
Be persuasive, logical, and thorough.
|
|
46
|
+
|
|
47
|
+
- stepId: opponent-opening
|
|
48
|
+
type: prompt
|
|
49
|
+
config:
|
|
50
|
+
provider: gemini
|
|
51
|
+
prompt: |
|
|
52
|
+
You are arguing AGAINST this proposition in a formal debate:
|
|
53
|
+
|
|
54
|
+
PROPOSITION: {{input.proposition}}
|
|
55
|
+
|
|
56
|
+
Present your opening statement:
|
|
57
|
+
1. State your counter-thesis clearly
|
|
58
|
+
2. Present 3-4 strong arguments against the proposition
|
|
59
|
+
3. Provide evidence and examples
|
|
60
|
+
4. Anticipate and preemptively address potential counterarguments
|
|
61
|
+
|
|
62
|
+
Be persuasive, logical, and thorough.
|
|
63
|
+
|
|
64
|
+
# Round 2: Rebuttals
|
|
65
|
+
- stepId: rebuttals
|
|
66
|
+
type: parallel
|
|
67
|
+
name: Rebuttals
|
|
68
|
+
timeout: 90000
|
|
69
|
+
dependencies:
|
|
70
|
+
- opening-statements
|
|
71
|
+
config:
|
|
72
|
+
steps:
|
|
73
|
+
- stepId: proponent-rebuttal
|
|
74
|
+
type: prompt
|
|
75
|
+
config:
|
|
76
|
+
provider: claude
|
|
77
|
+
prompt: |
|
|
78
|
+
You are still arguing FOR:
|
|
79
|
+
PROPOSITION: {{input.proposition}}
|
|
80
|
+
|
|
81
|
+
Your opponent argued:
|
|
82
|
+
{{steps.opponent-opening.output}}
|
|
83
|
+
|
|
84
|
+
Present your rebuttal:
|
|
85
|
+
1. Address their strongest points directly
|
|
86
|
+
2. Expose weaknesses in their logic
|
|
87
|
+
3. Reinforce your key arguments
|
|
88
|
+
4. Introduce new supporting evidence
|
|
89
|
+
|
|
90
|
+
- stepId: opponent-rebuttal
|
|
91
|
+
type: prompt
|
|
92
|
+
config:
|
|
93
|
+
provider: gemini
|
|
94
|
+
prompt: |
|
|
95
|
+
You are still arguing AGAINST:
|
|
96
|
+
PROPOSITION: {{input.proposition}}
|
|
97
|
+
|
|
98
|
+
Your opponent argued:
|
|
99
|
+
{{steps.proponent-opening.output}}
|
|
100
|
+
|
|
101
|
+
Present your rebuttal:
|
|
102
|
+
1. Address their strongest points directly
|
|
103
|
+
2. Expose weaknesses in their logic
|
|
104
|
+
3. Reinforce your key arguments
|
|
105
|
+
4. Introduce new supporting evidence
|
|
106
|
+
|
|
107
|
+
# Round 3: Closing Statements
|
|
108
|
+
- stepId: closing-statements
|
|
109
|
+
type: parallel
|
|
110
|
+
name: Closing Statements
|
|
111
|
+
timeout: 60000
|
|
112
|
+
dependencies:
|
|
113
|
+
- rebuttals
|
|
114
|
+
config:
|
|
115
|
+
steps:
|
|
116
|
+
- stepId: proponent-closing
|
|
117
|
+
type: prompt
|
|
118
|
+
config:
|
|
119
|
+
provider: claude
|
|
120
|
+
prompt: |
|
|
121
|
+
Present your closing statement FOR:
|
|
122
|
+
PROPOSITION: {{input.proposition}}
|
|
123
|
+
|
|
124
|
+
Considering the full debate:
|
|
125
|
+
- Your opening: {{steps.proponent-opening.output}}
|
|
126
|
+
- Their rebuttal: {{steps.opponent-rebuttal.output}}
|
|
127
|
+
- Your rebuttal: {{steps.proponent-rebuttal.output}}
|
|
128
|
+
|
|
129
|
+
Deliver a compelling closing:
|
|
130
|
+
1. Summarize your strongest points
|
|
131
|
+
2. Address any remaining objections
|
|
132
|
+
3. End with a powerful conclusion
|
|
133
|
+
|
|
134
|
+
- stepId: opponent-closing
|
|
135
|
+
type: prompt
|
|
136
|
+
config:
|
|
137
|
+
provider: gemini
|
|
138
|
+
prompt: |
|
|
139
|
+
Present your closing statement AGAINST:
|
|
140
|
+
PROPOSITION: {{input.proposition}}
|
|
141
|
+
|
|
142
|
+
Considering the full debate:
|
|
143
|
+
- Your opening: {{steps.opponent-opening.output}}
|
|
144
|
+
- Their rebuttal: {{steps.proponent-rebuttal.output}}
|
|
145
|
+
- Your rebuttal: {{steps.opponent-rebuttal.output}}
|
|
146
|
+
|
|
147
|
+
Deliver a compelling closing:
|
|
148
|
+
1. Summarize your strongest points
|
|
149
|
+
2. Address any remaining objections
|
|
150
|
+
3. End with a powerful conclusion
|
|
151
|
+
|
|
152
|
+
# Final: Judge's Verdict
|
|
153
|
+
- stepId: judges-verdict
|
|
154
|
+
type: prompt
|
|
155
|
+
name: Judge's Verdict
|
|
156
|
+
timeout: 120000
|
|
157
|
+
dependencies:
|
|
158
|
+
- closing-statements
|
|
159
|
+
config:
|
|
160
|
+
provider: codex
|
|
161
|
+
prompt: |
|
|
162
|
+
You are an impartial judge evaluating this debate.
|
|
163
|
+
|
|
164
|
+
PROPOSITION: {{input.proposition}}
|
|
165
|
+
|
|
166
|
+
## FOR THE PROPOSITION (Claude):
|
|
167
|
+
|
|
168
|
+
### Opening Statement:
|
|
169
|
+
{{steps.proponent-opening.output}}
|
|
170
|
+
|
|
171
|
+
### Rebuttal:
|
|
172
|
+
{{steps.proponent-rebuttal.output}}
|
|
173
|
+
|
|
174
|
+
### Closing:
|
|
175
|
+
{{steps.proponent-closing.output}}
|
|
176
|
+
|
|
177
|
+
## AGAINST THE PROPOSITION (Gemini):
|
|
178
|
+
|
|
179
|
+
### Opening Statement:
|
|
180
|
+
{{steps.opponent-opening.output}}
|
|
181
|
+
|
|
182
|
+
### Rebuttal:
|
|
183
|
+
{{steps.opponent-rebuttal.output}}
|
|
184
|
+
|
|
185
|
+
### Closing:
|
|
186
|
+
{{steps.opponent-closing.output}}
|
|
187
|
+
|
|
188
|
+
## YOUR VERDICT:
|
|
189
|
+
|
|
190
|
+
Provide a comprehensive judgment:
|
|
191
|
+
|
|
192
|
+
1. **Scoring** (1-10 for each):
|
|
193
|
+
- FOR - Argument Strength:
|
|
194
|
+
- FOR - Evidence Quality:
|
|
195
|
+
- FOR - Rebuttal Effectiveness:
|
|
196
|
+
- AGAINST - Argument Strength:
|
|
197
|
+
- AGAINST - Evidence Quality:
|
|
198
|
+
- AGAINST - Rebuttal Effectiveness:
|
|
199
|
+
|
|
200
|
+
2. **Best Arguments**:
|
|
201
|
+
- Strongest point FOR:
|
|
202
|
+
- Strongest point AGAINST:
|
|
203
|
+
|
|
204
|
+
3. **Logical Weaknesses**:
|
|
205
|
+
- Weakest point FOR:
|
|
206
|
+
- Weakest point AGAINST:
|
|
207
|
+
|
|
208
|
+
4. **Key Insights**: What did this debate reveal?
|
|
209
|
+
|
|
210
|
+
5. **Verdict**: Which side won and why?
|
|
211
|
+
|
|
212
|
+
6. **Nuanced Conclusion**: Beyond the debate, what is the balanced truth?
|
|
213
|
+
|
|
214
|
+
metadata:
|
|
215
|
+
category: collaboration
|
|
216
|
+
tags:
|
|
217
|
+
- debate
|
|
218
|
+
- adversarial
|
|
219
|
+
- multi-model
|
|
220
|
+
- decision-making
|
|
221
|
+
estimatedDuration: 360000 # ~6 minutes
|
|
222
|
+
estimatedCost: high
|