@exaudeus/workrail 0.1.7 → 0.1.9
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/README.md +41 -4
- package/dist/application/app.d.ts +6 -1
- package/dist/application/app.js +5 -1
- package/dist/application/decorators/simple-output-decorator.d.ts +8 -0
- package/dist/application/decorators/simple-output-decorator.js +89 -0
- package/package.json +1 -1
- package/workflows/coding-task-workflow.json +3 -2
- package/workflows/systemic-bug-investigation.json +3 -2
package/README.md
CHANGED
|
@@ -86,15 +86,52 @@ Add to your agent's `config.json`:
|
|
|
86
86
|
|
|
87
87
|
---
|
|
88
88
|
|
|
89
|
+
## 💾 Using Local Workflows (when configuring MCP via JSON)
|
|
90
|
+
|
|
91
|
+
WorkRail will auto-discover workflows even when added to your agent via JSON config. It searches, in priority order:
|
|
92
|
+
|
|
93
|
+
- User: `~/.workrail/workflows` (recommended)
|
|
94
|
+
- Project: `./workflows` relative to the MCP process `cwd`
|
|
95
|
+
- Custom: directories listed in `WORKFLOW_STORAGE_PATH` (colon-separated on macOS/Linux)
|
|
96
|
+
|
|
97
|
+
Example agent config passing env and `cwd` so your local workflows are picked up:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"mcpServers": {
|
|
102
|
+
"workrail": {
|
|
103
|
+
"command": "npx",
|
|
104
|
+
"args": ["-y", "@exaudeus/workrail"],
|
|
105
|
+
"env": {
|
|
106
|
+
"WORKFLOW_STORAGE_PATH": "/absolute/path/my-workflows:/absolute/path/shared-workflows"
|
|
107
|
+
},
|
|
108
|
+
"cwd": "/absolute/path/my-project"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Quick tips:
|
|
115
|
+
|
|
116
|
+
- Initialize your user dir once: `workrail init`
|
|
117
|
+
- Validate a file: `workrail validate /abs/path/my-workflows/my-workflow.json`
|
|
118
|
+
- List all discovered workflows: `workrail list`
|
|
119
|
+
|
|
120
|
+
See also: `docs/workflow-management.md` for more details.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
89
124
|
## 📋 Available Workflows
|
|
90
125
|
|
|
91
126
|
WorkRail comes with battle-tested workflows for common development tasks:
|
|
92
127
|
|
|
93
128
|
### 🔧 **Development Workflows**
|
|
94
|
-
- **`coding-task-workflow`** -
|
|
95
|
-
- **`
|
|
96
|
-
|
|
97
|
-
|
|
129
|
+
- **`coding-task-workflow-with-loops`** - Enhanced coding workflow with iterative refinement loops, analysis, planning, implementation, and review *(Recommended)*
|
|
130
|
+
- **`systematic-bug-investigation-with-loops`** - Enhanced debugging with iterative analysis loops and systematic methodology *(Recommended)*
|
|
131
|
+
|
|
132
|
+
#### Deprecated Workflows
|
|
133
|
+
- ~~**`coding-task-workflow`** - [DEPRECATED] Use `coding-task-workflow-with-loops` instead~~
|
|
134
|
+
- ~~**`systematic-bug-investigation`** - [DEPRECATED] Use `systematic-bug-investigation-with-loops` instead~~
|
|
98
135
|
|
|
99
136
|
### 🚀 **Project Management**
|
|
100
137
|
- **`adaptive-ticket-creation`** - Create well-structured tickets with proper requirements
|
|
@@ -22,4 +22,9 @@ export declare const METHOD_NAMES: {
|
|
|
22
22
|
readonly SHUTDOWN: "shutdown";
|
|
23
23
|
};
|
|
24
24
|
export type MethodName = typeof METHOD_NAMES[keyof typeof METHOD_NAMES];
|
|
25
|
-
export
|
|
25
|
+
export interface IApplicationMediator {
|
|
26
|
+
execute(method: string, params: any): Promise<any>;
|
|
27
|
+
register(method: string, handler: any): void;
|
|
28
|
+
setResponseValidator(fn: (method: string, result: any) => void): void;
|
|
29
|
+
}
|
|
30
|
+
export declare function buildWorkflowApplication(workflowService: WorkflowService, validator?: MethodValidator, enableOutputOptimization?: boolean): IApplicationMediator;
|
package/dist/application/app.js
CHANGED
|
@@ -71,6 +71,7 @@ const list_workflows_1 = require("./use-cases/list-workflows");
|
|
|
71
71
|
const get_workflow_1 = require("./use-cases/get-workflow");
|
|
72
72
|
const get_next_step_1 = require("./use-cases/get-next-step");
|
|
73
73
|
const validate_step_output_1 = require("./use-cases/validate-step-output");
|
|
74
|
+
const simple_output_decorator_1 = require("./decorators/simple-output-decorator");
|
|
74
75
|
exports.METHOD_NAMES = {
|
|
75
76
|
WORKFLOW_LIST: 'workflow_list',
|
|
76
77
|
WORKFLOW_GET: 'workflow_get',
|
|
@@ -80,7 +81,7 @@ exports.METHOD_NAMES = {
|
|
|
80
81
|
TOOLS_LIST: 'tools/list',
|
|
81
82
|
SHUTDOWN: 'shutdown'
|
|
82
83
|
};
|
|
83
|
-
function buildWorkflowApplication(workflowService, validator = request_validator_1.requestValidator) {
|
|
84
|
+
function buildWorkflowApplication(workflowService, validator = request_validator_1.requestValidator, enableOutputOptimization = true) {
|
|
84
85
|
const app = new ApplicationMediator(validator);
|
|
85
86
|
app.setResponseValidator((method, result) => response_validator_1.responseValidator.validate(method, result));
|
|
86
87
|
const listWorkflowsUseCase = (0, list_workflows_1.createListWorkflows)(workflowService);
|
|
@@ -112,5 +113,8 @@ function buildWorkflowApplication(workflowService, validator = request_validator
|
|
|
112
113
|
const { shutdownHandler } = await Promise.resolve().then(() => __importStar(require('../tools/mcp_shutdown')));
|
|
113
114
|
return (await shutdownHandler({ id: 0, params, method: 'shutdown', jsonrpc: '2.0' })).result;
|
|
114
115
|
});
|
|
116
|
+
if (enableOutputOptimization) {
|
|
117
|
+
return new simple_output_decorator_1.SimpleOutputDecorator(app);
|
|
118
|
+
}
|
|
115
119
|
return app;
|
|
116
120
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IApplicationMediator } from '../app';
|
|
2
|
+
export declare class SimpleOutputDecorator implements IApplicationMediator {
|
|
3
|
+
private readonly wrapped;
|
|
4
|
+
constructor(wrapped: IApplicationMediator);
|
|
5
|
+
execute(method: string, params: any): Promise<any>;
|
|
6
|
+
register(method: string, handler: any): void;
|
|
7
|
+
setResponseValidator(fn: (method: string, result: any) => void): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SimpleOutputDecorator = void 0;
|
|
4
|
+
const CONTEXT_OPTIMIZATION_TEXT = `
|
|
5
|
+
|
|
6
|
+
**CONTEXT OPTIMIZATION REQUIREMENTS**:
|
|
7
|
+
|
|
8
|
+
The MCP server is STATELESS. You MUST send required data with each request:
|
|
9
|
+
|
|
10
|
+
**ALWAYS INCLUDE:**
|
|
11
|
+
1. \`workflowId\` - Required for all calls
|
|
12
|
+
2. \`completedSteps\` - Full array of completed step IDs
|
|
13
|
+
3. **Condition Variables** - ANY variable used in step \`runCondition\` fields
|
|
14
|
+
4. **Template Variables** - ANY variable referenced in {{templates}} in prompts/titles
|
|
15
|
+
5. **Your New/Modified Variables** - Variables you created or changed in this step
|
|
16
|
+
|
|
17
|
+
**CONDITIONALLY INCLUDE:**
|
|
18
|
+
- **Loop Variables** (when in a loop): \`currentIteration\`, \`currentItem\`, \`currentIndex\`
|
|
19
|
+
- **Active Loop State**: Only \`_loopState[currentLoopId]\` if currently in a loop
|
|
20
|
+
- **Referenced Variables**: Any variable that future steps might need
|
|
21
|
+
|
|
22
|
+
**NEVER INCLUDE:**
|
|
23
|
+
- Large arrays that aren't being actively iterated (e.g., \`implementationSteps\` array)
|
|
24
|
+
- Stale loop states from completed loops
|
|
25
|
+
- Unreferenced historical data
|
|
26
|
+
- Variables only used in completed steps
|
|
27
|
+
|
|
28
|
+
**SIZE TARGETS:**
|
|
29
|
+
- Normal steps: < 2KB
|
|
30
|
+
- Loop iterations: < 5KB
|
|
31
|
+
- Complex state: < 10KB
|
|
32
|
+
|
|
33
|
+
**EXAMPLE - Loop Context:**
|
|
34
|
+
\`\`\`json
|
|
35
|
+
{
|
|
36
|
+
"workflowId": "coding-task-workflow",
|
|
37
|
+
"completedSteps": ["phase-1", "phase-2", "loop-step-1"],
|
|
38
|
+
"context": {
|
|
39
|
+
// Required: condition/template variables
|
|
40
|
+
"taskComplexity": "Medium",
|
|
41
|
+
"totalImplementationSteps": 8,
|
|
42
|
+
"currentStepNumber": 3,
|
|
43
|
+
|
|
44
|
+
// Required: your changes
|
|
45
|
+
"stepCompleted": true,
|
|
46
|
+
"testResults": "passed",
|
|
47
|
+
|
|
48
|
+
// Required: active loop state only
|
|
49
|
+
"_loopState": {
|
|
50
|
+
"phase-6-loop": { "iteration": 3 }
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
// DON'T include:
|
|
54
|
+
// - implementationSteps: [...] // Large array
|
|
55
|
+
// - analysisResults: {...} // From phase 1
|
|
56
|
+
// - _loopState.oldLoop: {...} // Completed loop
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
\`\`\`
|
|
60
|
+
|
|
61
|
+
**VALIDATION CHECK**: Before sending, verify you have ALL variables referenced in:
|
|
62
|
+
- The next step's \`runCondition\`
|
|
63
|
+
- Any {{variable}} in the next step's prompts
|
|
64
|
+
- Variables needed for loop control`;
|
|
65
|
+
class SimpleOutputDecorator {
|
|
66
|
+
constructor(wrapped) {
|
|
67
|
+
this.wrapped = wrapped;
|
|
68
|
+
}
|
|
69
|
+
async execute(method, params) {
|
|
70
|
+
const result = await this.wrapped.execute(method, params);
|
|
71
|
+
if (method === 'workflow_next' && result?.guidance?.prompt) {
|
|
72
|
+
return {
|
|
73
|
+
...result,
|
|
74
|
+
guidance: {
|
|
75
|
+
...result.guidance,
|
|
76
|
+
prompt: result.guidance.prompt + CONTEXT_OPTIMIZATION_TEXT
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
register(method, handler) {
|
|
83
|
+
this.wrapped.register(method, handler);
|
|
84
|
+
}
|
|
85
|
+
setResponseValidator(fn) {
|
|
86
|
+
this.wrapped.setResponseValidator(fn);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.SimpleOutputDecorator = SimpleOutputDecorator;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "coding-task-workflow",
|
|
3
|
-
"name": "Excellent Adaptive Coding Workflow with Devil's Advocate Review",
|
|
3
|
+
"name": "[DEPRECATED] Excellent Adaptive Coding Workflow with Devil's Advocate Review",
|
|
4
4
|
"version": "0.8.0",
|
|
5
|
-
"description": "Comprehensive AI coding workflow with bidirectional re-triage, deep analysis, intelligent clarification, devil's advocate review, automation levels, failure bounds, tool fallbacks, and context documentation for production-ready development.",
|
|
5
|
+
"description": "[DEPRECATED] This workflow has been superseded by 'coding-task-workflow-with-loops' which includes enhanced loop capabilities for better iterative development. Use 'coding-task-workflow-with-loops' for new projects. Comprehensive AI coding workflow with bidirectional re-triage, deep analysis, intelligent clarification, devil's advocate review, automation levels, failure bounds, tool fallbacks, and context documentation for production-ready development.",
|
|
6
6
|
|
|
7
7
|
"preconditions": [
|
|
8
8
|
"User has a clear task description (e.g., from Jira, a dev doc, or a BRD).",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"Git repository is recommended for version control and commits (workflow degrades gracefully if unavailable)."
|
|
12
12
|
],
|
|
13
13
|
"metaGuidance": [
|
|
14
|
+
"⚠️ DEPRECATION NOTICE: This workflow is deprecated. Use 'coding-task-workflow-with-loops' instead for enhanced iterative development capabilities with loop support.",
|
|
14
15
|
"This workflow follows the ANALYZE -> CLARIFY -> PREP -> IMPLEMENT -> VERIFY pattern with bidirectional dynamic re-triage capabilities.",
|
|
15
16
|
"Deep codebase analysis occurs early to inform intelligent requirements clarification and all subsequent planning phases.",
|
|
16
17
|
"Dynamic re-triage allows complexity upgrades and safe downgrades based on new insights from analysis and clarifications.",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "systematic-bug-investigation",
|
|
3
|
-
"name": "Systematic Bug Investigation Workflow",
|
|
3
|
+
"name": "[DEPRECATED] Systematic Bug Investigation Workflow",
|
|
4
4
|
"version": "1.0.0",
|
|
5
|
-
"description": "A comprehensive workflow for systematic bug and failing test investigation that prevents LLMs from jumping to conclusions. Enforces thorough evidence gathering, hypothesis formation, debugging instrumentation, and validation to achieve near 100% certainty about root causes. This workflow does NOT fix bugs - it produces detailed diagnostic writeups that enable effective fixing by providing complete understanding of what is happening, why it's happening, and supporting evidence.",
|
|
5
|
+
"description": "[DEPRECATED] This workflow has been superseded by 'systematic-bug-investigation-with-loops' which includes enhanced loop capabilities for iterative debugging and investigation. Use 'systematic-bug-investigation-with-loops' for new bug investigations. A comprehensive workflow for systematic bug and failing test investigation that prevents LLMs from jumping to conclusions. Enforces thorough evidence gathering, hypothesis formation, debugging instrumentation, and validation to achieve near 100% certainty about root causes. This workflow does NOT fix bugs - it produces detailed diagnostic writeups that enable effective fixing by providing complete understanding of what is happening, why it's happening, and supporting evidence.",
|
|
6
6
|
"clarificationPrompts": [
|
|
7
7
|
"What type of system is this? (web app, mobile app, backend service, desktop app, etc.)",
|
|
8
8
|
"How consistently can you reproduce this bug? (always reproducible, sometimes reproducible, rarely reproducible)",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"Bug is reproducible with specific steps or a minimal test case"
|
|
20
20
|
],
|
|
21
21
|
"metaGuidance": [
|
|
22
|
+
"⚠️ DEPRECATION NOTICE: This workflow is deprecated. Use 'systematic-bug-investigation-with-loops' instead for enhanced iterative debugging capabilities with loop support.",
|
|
22
23
|
"INVESTIGATION DISCIPLINE: Never propose fixes or solutions until Phase 6 (Comprehensive Diagnostic Writeup). Focus entirely on systematic evidence gathering and analysis.",
|
|
23
24
|
"HYPOTHESIS RIGOR: All hypotheses must be based on concrete evidence from code analysis with quantified scoring (1-10 scales). Maximum 5 hypotheses per investigation.",
|
|
24
25
|
"DEBUGGING INSTRUMENTATION: Always implement debugging mechanisms before running tests - logs, print statements, or test modifications that will provide evidence.",
|