@mestreyoda/fabrica 0.1.0

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.
Files changed (45) hide show
  1. package/ARCHITECTURE.md +87 -0
  2. package/LICENSE +21 -0
  3. package/README.md +289 -0
  4. package/defaults/AGENTS.md +150 -0
  5. package/defaults/HEARTBEAT.md +3 -0
  6. package/defaults/IDENTITY.md +6 -0
  7. package/defaults/SOUL.md +39 -0
  8. package/defaults/TOOLS.md +15 -0
  9. package/defaults/fabrica/prompts/architect.md +147 -0
  10. package/defaults/fabrica/prompts/developer.md +211 -0
  11. package/defaults/fabrica/prompts/reviewer.md +114 -0
  12. package/defaults/fabrica/prompts/security-checklist.md +58 -0
  13. package/defaults/fabrica/prompts/tester.md +150 -0
  14. package/defaults/fabrica/workflow.yaml +184 -0
  15. package/dist/index.js +143075 -0
  16. package/dist/index.js.map +7 -0
  17. package/dist/lib/worker.cjs +214 -0
  18. package/dist/worker.cjs +4754 -0
  19. package/fabrica.manifest.json +24 -0
  20. package/genesis/configs/classification-rules.json +32 -0
  21. package/genesis/configs/interview-templates.json +73 -0
  22. package/genesis/configs/labels.json +202 -0
  23. package/genesis/configs/triage-matrix.json +39 -0
  24. package/genesis/scripts/classify-idea.sh +161 -0
  25. package/genesis/scripts/conduct-interview.sh +199 -0
  26. package/genesis/scripts/create-task.sh +797 -0
  27. package/genesis/scripts/delivery-target-lib.sh +88 -0
  28. package/genesis/scripts/generate-qa-contract.sh +188 -0
  29. package/genesis/scripts/generate-spec.sh +171 -0
  30. package/genesis/scripts/genesis-telemetry.sh +97 -0
  31. package/genesis/scripts/genesis-utils.sh +617 -0
  32. package/genesis/scripts/impact-analysis.sh +135 -0
  33. package/genesis/scripts/interview.sh +98 -0
  34. package/genesis/scripts/map-project.sh +309 -0
  35. package/genesis/scripts/receive-idea.sh +69 -0
  36. package/genesis/scripts/register-project.sh +520 -0
  37. package/genesis/scripts/research-idea.sh +84 -0
  38. package/genesis/scripts/scaffold-project.sh +1396 -0
  39. package/genesis/scripts/security-review.sh +141 -0
  40. package/genesis/scripts/sideband-lib.sh +243 -0
  41. package/genesis/scripts/stack-detection-lib.sh +130 -0
  42. package/genesis/scripts/triage.sh +598 -0
  43. package/genesis/scripts/validate-step.sh +81 -0
  44. package/openclaw.plugin.json +45 -0
  45. package/package.json +60 -0
@@ -0,0 +1,150 @@
1
+ # TESTER Worker Instructions
2
+
3
+ You test the code changes for the issue by running QA on the correct branch.
4
+
5
+ ## Context You Receive
6
+
7
+ - **Issue:** the original task description, acceptance criteria, and discussion
8
+ - **PR info:** the PR URL and diff (the PR may or may not be merged yet)
9
+ - **Project:** repo path, base branch, project name, projectSlug
10
+ - **SESSION_ID:** your unique session identifier
11
+
12
+ ## Your Job
13
+
14
+ ### 1. Checkout the correct branch
15
+
16
+ The PR may NOT be merged yet when you are dispatched. You MUST test the PR branch, not main.
17
+
18
+ ```bash
19
+ REPO_ROOT="<repo path from task message>"
20
+ cd "$REPO_ROOT"
21
+ git fetch origin
22
+
23
+ # Find the PR for this issue by branch naming convention
24
+ ISSUE_NUM=<issue number from task message>
25
+ REMOTE_URL="$(git remote get-url origin)"
26
+ PR_BRANCH=$(gh pr list --repo "$REMOTE_URL" --state open --json headRefName --jq "[.[] | select(.headRefName | test(\"/(${ISSUE_NUM})-\"))][0].headRefName" 2>/dev/null)
27
+
28
+ if [[ -n "$PR_BRANCH" && "$PR_BRANCH" != "null" ]]; then
29
+ # Open PR exists with matching branch — checkout the PR branch
30
+ git checkout "$PR_BRANCH" && git pull origin "$PR_BRANCH"
31
+ echo "Testing PR branch: $PR_BRANCH"
32
+ else
33
+ # No open PR for this issue — test on main (post-merge scenario)
34
+ git checkout main && git pull origin main
35
+ echo "Testing main branch (PR already merged)"
36
+ fi
37
+ ```
38
+
39
+ **IMPORTANT:** Always verify you are on the correct branch before running tests. If you test on `main` and the feature code is not there, your results will be WRONG.
40
+
41
+ ### 2. Run QA contract (MANDATORY)
42
+
43
+ ```bash
44
+ bash scripts/qa.sh 2>&1 | tee /tmp/qa-output-$SESSION_ID.log
45
+ echo "EXIT_CODE=$?"
46
+ ```
47
+
48
+ `scripts/qa.sh` is expected to bootstrap project-local test dependencies when required. Do not compensate with a shared global venv or host-level package installs.
49
+
50
+ Do **not** paste raw `qa.sh` output verbatim into public comments. Summarize only the relevant evidence and sanitize host paths, tokens, secrets, environment values, and machine-specific noise. If `qa.sh` doesn't exist, note this as a FAIL item.
51
+
52
+ ### 3. Verify Acceptance Criteria
53
+
54
+ For each AC in the issue:
55
+ - Verify it's satisfied by the code on the branch you checked out
56
+ - Mark each AC as PASS or FAIL with a brief explanation
57
+ - If an AC is ambiguous, note what you checked and mark CONDITIONAL
58
+ - **Every single AC must be verified** — do not skip any
59
+
60
+ ### 4. Check for regressions
61
+
62
+ - Run the full test suite if available
63
+ - Verify that existing functionality still works
64
+ - Check for broken imports, missing files, or incomplete merges
65
+
66
+ ### 4b. Edge Case Testing
67
+
68
+ For numeric/calculation features, test:
69
+ - Boundary values: 0, negatives, very large numbers
70
+ - Invalid input: empty string, non-numeric, special floats (if applicable)
71
+
72
+ For web endpoints, test:
73
+ - Missing required fields
74
+ - Malformed input
75
+
76
+ For CLI tools, test:
77
+ - Basic execution: runs without error, exit code 0
78
+ - Help output: `--help` flag produces usage information
79
+ - Invalid arguments: wrong types, missing required args → non-zero exit code and error message
80
+ - Version flag: `--version` shows version string (if applicable)
81
+
82
+ ### 4c. Structural Verification
83
+
84
+ Before concluding, verify:
85
+ - [ ] All test imports resolve correctly (no phantom module references)
86
+ - [ ] For web apps: at least one security test exists (input validation, error handling)
87
+ - [ ] Test count and coverage in your report match what `qa.sh` actually outputs
88
+
89
+ ### 5. Post structured report
90
+
91
+ Use `task_comment` to post your findings in this format:
92
+
93
+ ```markdown
94
+ ## QA Report — SESSION_ID: <your session id>
95
+
96
+ ### qa.sh Results
97
+ - Exit code: <0 or non-zero>
98
+ - PASS: <count> | FAIL: <count> | SKIP: <count>
99
+
100
+ ### Acceptance Criteria Verification
101
+ | # | Criterion | Result | Notes |
102
+ |---|-----------|--------|-------|
103
+ | 1 | <AC text> | PASS/FAIL | <what you checked> |
104
+ | 2 | <AC text> | PASS/FAIL | <what you checked> |
105
+
106
+ ### Regression Check
107
+ - [ ] Existing tests pass
108
+ - [ ] No broken imports
109
+ - [ ] No missing files
110
+
111
+ ### qa.sh Sanitized Evidence
112
+ \`\`\`text
113
+ <summarized and sanitized qa.sh output — enough to prove what ran and why it passed/failed>
114
+ \`\`\`
115
+
116
+ ### Test Coverage
117
+ - Total tests: <N>
118
+ - Pass: <N> | Fail: <N> | Skip: <N>
119
+ - Coverage: <X>% (if reporter configured)
120
+
121
+ ### Verdict: PASS / FAIL
122
+ <brief summary>
123
+ ```
124
+
125
+ ### 6. Call work_finish
126
+
127
+ - **Pass:** `work_finish({ role: "tester", result: "pass", channelId: "<project slug from 'Project:' field in task message>", summary: "<brief summary>" })`
128
+ - **Fail:** `work_finish({ role: "tester", result: "fail", channelId: "<project slug from 'Project:' field in task message>", summary: "<specific failures>" })`
129
+ - **Refine:** `work_finish({ role: "tester", result: "refine", channelId: "<project slug from 'Project:' field in task message>", summary: "<what needs human input>" })`
130
+ - **Blocked:** `work_finish({ role: "tester", result: "blocked", channelId: "<project slug from 'Project:' field in task message>", summary: "<what you need>" })`
131
+
132
+ > **IMPORTANT:** The `channelId` parameter accepts the project slug (e.g., "gestao-notas").
133
+ > Extract it from the "Project: <name>" line in your task message. Do NOT use the numeric
134
+ > channel ID — use the project slug to avoid resolution errors when channels are shared.
135
+
136
+ ## Conventions
137
+
138
+ - **Do NOT use closing keywords in PR/MR descriptions** (no "Closes #X", "Fixes #X", "Resolves #X"). Use "As described in issue #X" or "Addresses issue #X". Fabrica manages issue state — auto-closing bypasses the review lifecycle.
139
+ - Always leave a `task_comment` even if everything passes
140
+
141
+ ## Filing Follow-Up Issues
142
+
143
+ If you discover unrelated bugs or needed improvements during your work, call `task_create`:
144
+
145
+ `task_create({ projectSlug: "<from task message>", title: "Bug: ...", description: "..." })`
146
+
147
+ ## Tools You Should NOT Use
148
+
149
+ These are orchestrator-only tools. Do not call them:
150
+ - `task_start`, `tasks_status`, `health`, `project_register`
@@ -0,0 +1,184 @@
1
+ # Fabrica workflow configuration
2
+ #
3
+ # This file is YOUR configuration — Fabrica will never overwrite it on restart.
4
+ # Edit freely: roles, models, timeouts, reviewPolicy, testPolicy, states, etc.
5
+ # Copy to fabrica/projects/<project>/workflow.yaml for project-specific overrides.
6
+ #
7
+ # To see what changed in a new version: config({ action: "diff" })
8
+ # To reset to package defaults: config({ action: "reset", scope: "workflow" })
9
+
10
+ roles:
11
+ developer:
12
+ models:
13
+ junior: anthropic/claude-haiku-4-5
14
+ medior: anthropic/claude-sonnet-4-5
15
+ senior: anthropic/claude-opus-4-6
16
+ tester:
17
+ models:
18
+ junior: anthropic/claude-haiku-4-5
19
+ medior: anthropic/claude-sonnet-4-5
20
+ senior: anthropic/claude-opus-4-6
21
+ architect:
22
+ models:
23
+ junior: anthropic/claude-sonnet-4-5
24
+ senior: anthropic/claude-opus-4-6
25
+ reviewer:
26
+ models:
27
+ junior: anthropic/claude-haiku-4-5
28
+ senior: anthropic/claude-sonnet-4-5
29
+
30
+ workflow:
31
+ initial: planning
32
+ maxWorkersPerLevel: 2
33
+ # maxWorkersPerLevel: 2 — each level (junior/medior/senior) gets up to this many parallel slots.
34
+ # With 3 levels × 2 slots = 6 workers per role in parallel per project at full capacity.
35
+ # Override per-model with object syntax: senior: { model: anthropic/claude-opus-4-6, maxWorkers: 3 }
36
+ reviewPolicy: human # Options: human (default), agent, skip
37
+ # human — All PRs need human approval on GitHub/GitLab. Heartbeat auto-merges when approved.
38
+ # agent — Agent reviewer checks every PR before merge.
39
+ # skip — Review phase is skipped. PRs are auto-merged after development.
40
+ # If both review and test are skipped, PRs auto-merge to the base branch.
41
+ testPolicy: skip # Options: skip (default), agent
42
+ # skip — Testing phase is skipped. Issues go straight from review to done.
43
+ # To enable testing for a specific issue, remove the test:skip label.
44
+ # agent — Agent tester runs automated QA on every issue after review.
45
+ # Requires tester prompts: fabrica/prompts/tester.md
46
+ # (or per-project: fabrica/projects/<name>/prompts/tester.md)
47
+ roleExecution: parallel # Options: parallel (default), sequential
48
+ # parallel — Different roles can work simultaneously (e.g. developer + tester).
49
+ # sequential — Only one role active at a time.
50
+ states:
51
+ planning:
52
+ type: hold
53
+ label: Planning
54
+ color: "#95a5a6"
55
+ on:
56
+ APPROVE: todo
57
+ toResearch:
58
+ type: queue
59
+ role: architect
60
+ label: To Research
61
+ color: "#0075ca"
62
+ priority: 1
63
+ on:
64
+ PICKUP: researching
65
+ researching:
66
+ type: active
67
+ role: architect
68
+ label: Researching
69
+ color: "#4a90e2"
70
+ on:
71
+ COMPLETE:
72
+ target: done
73
+ actions:
74
+ - closeIssue
75
+ BLOCKED: refining
76
+ todo:
77
+ type: queue
78
+ role: developer
79
+ label: To Do
80
+ color: "#428bca"
81
+ priority: 1
82
+ on:
83
+ PICKUP: doing
84
+ doing:
85
+ type: active
86
+ role: developer
87
+ label: Doing
88
+ color: "#f0ad4e"
89
+ on:
90
+ COMPLETE:
91
+ target: toReview
92
+ actions:
93
+ - detectPr
94
+ BLOCKED: refining
95
+ toReview:
96
+ type: queue
97
+ role: reviewer
98
+ label: To Review
99
+ color: "#7057ff"
100
+ priority: 2
101
+ check: prApproved
102
+ on:
103
+ PICKUP: reviewing
104
+ SKIP:
105
+ target: toTest
106
+ APPROVED:
107
+ target: toTest
108
+ MERGE_FAILED: toImprove
109
+ CHANGES_REQUESTED: toImprove
110
+ MERGE_CONFLICT: toImprove
111
+ PR_CLOSED:
112
+ target: rejected
113
+ actions:
114
+ - closeIssue
115
+ reviewing:
116
+ type: active
117
+ role: reviewer
118
+ label: Reviewing
119
+ color: "#c5def5"
120
+ on:
121
+ APPROVE: toTest
122
+ REJECT: toImprove
123
+ BLOCKED: refining
124
+ # --- Test phase (skipped by default via testPolicy: skip) -----------------
125
+ # Issues arrive here after review. With testPolicy: skip (default), the
126
+ # heartbeat auto-transitions them to done. To enable testing per-issue,
127
+ # remove the test:skip label before it reaches this state.
128
+ # To enable testing globally, set testPolicy: agent above.
129
+ toTest:
130
+ type: queue
131
+ role: tester
132
+ label: To Test
133
+ color: "#5bc0de"
134
+ priority: 2
135
+ on:
136
+ PICKUP: testing
137
+ SKIP:
138
+ target: done
139
+ actions:
140
+ - mergePr
141
+ - gitPull
142
+ - closeIssue
143
+ MERGE_FAILED: toImprove
144
+ testing:
145
+ type: active
146
+ role: tester
147
+ label: Testing
148
+ color: "#9b59b6"
149
+ on:
150
+ PASS:
151
+ target: done
152
+ actions:
153
+ - mergePr
154
+ - gitPull
155
+ - closeIssue
156
+ FAIL:
157
+ target: toImprove
158
+ actions:
159
+ - reopenIssue
160
+ MERGE_FAILED: toImprove
161
+ REFINE: refining
162
+ BLOCKED: refining
163
+ done:
164
+ type: terminal
165
+ label: Done
166
+ color: "#5cb85c"
167
+ rejected:
168
+ type: terminal
169
+ label: Rejected
170
+ color: "#e11d48"
171
+ toImprove:
172
+ type: queue
173
+ role: developer
174
+ label: To Improve
175
+ color: "#d9534f"
176
+ priority: 3
177
+ on:
178
+ PICKUP: doing
179
+ refining:
180
+ type: hold
181
+ label: Refining
182
+ color: "#f39c12"
183
+ on:
184
+ APPROVE: todo