@jiggai/recipes 0.2.22 → 0.2.24
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 +10 -7
- package/docs/AGENTS_AND_SKILLS.md +21 -9
- package/docs/BUNDLED_RECIPES.md +12 -7
- package/docs/CLEANUP_TODO.md +31 -0
- package/docs/CODE_SMELLS_TRACKER.md +42 -0
- package/docs/SMELLS_TODO.md +23 -0
- package/docs/TEAM_WORKFLOW.md +3 -1
- package/docs/TEST_COVERAGE_PROGRESS.md +37 -0
- package/index.ts +386 -2156
- package/package.json +21 -2
- package/recipes/default/business-team.md +166 -51
- package/recipes/default/clinic-team.md +161 -29
- package/recipes/default/construction-team.md +167 -39
- package/recipes/default/crypto-trader-team.md +161 -29
- package/recipes/default/customer-support-team.md +140 -69
- package/recipes/default/development-team.md +50 -118
- package/recipes/default/financial-planner-team.md +167 -38
- package/recipes/default/law-firm-team.md +167 -40
- package/recipes/default/marketing-team.md +420 -123
- package/recipes/default/product-team.md +160 -93
- package/recipes/default/research-team.md +140 -66
- package/recipes/default/researcher.md +1 -1
- package/recipes/default/social-team.md +649 -60
- package/recipes/default/stock-trader-team.md +189 -38
- package/recipes/default/writing-team.md +143 -55
- package/src/handlers/cron.ts +309 -0
- package/src/handlers/install.ts +160 -0
- package/src/handlers/recipes.ts +119 -0
- package/src/handlers/scaffold.ts +141 -0
- package/src/handlers/team.ts +395 -0
- package/src/handlers/tickets.ts +304 -0
- package/src/lib/agent-config.ts +48 -0
- package/src/lib/bindings.ts +9 -59
- package/src/lib/cleanup-workspaces.ts +4 -4
- package/src/lib/config.ts +47 -0
- package/src/lib/constants.ts +11 -0
- package/src/lib/cron-utils.ts +54 -0
- package/src/lib/fs-utils.ts +33 -0
- package/src/lib/json-utils.ts +17 -0
- package/src/lib/lanes.ts +14 -12
- package/src/lib/prompt.ts +47 -0
- package/src/lib/recipe-frontmatter.ts +65 -21
- package/src/lib/recipe-id.ts +49 -0
- package/src/lib/recipes-config.ts +166 -0
- package/src/lib/recipes.ts +57 -0
- package/src/lib/remove-team.ts +17 -23
- package/src/lib/scaffold-utils.ts +95 -0
- package/src/lib/skill-install.ts +22 -0
- package/src/lib/stable-stringify.ts +21 -0
- package/src/lib/template.ts +10 -0
- package/src/lib/ticket-finder.ts +40 -23
- package/src/lib/ticket-workflow.ts +32 -65
- package/src/lib/workspace.ts +33 -0
- package/src/marketplaceFetch.ts +1 -1
- package/src/toolsInvoke.ts +41 -32
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# ClawRecipes (OpenClaw Recipes Plugin)
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<img src="
|
|
4
|
+
<img src="https://github.com/JIGGAI/ClawRecipes/blob/main/clawcipes_cook.jpg" alt="ClawRecipes logo" width="240" />
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
ClawRecipes is an OpenClaw plugin that provides **CLI-first recipes** for scaffolding specialist agents and teams from Markdown.
|
|
@@ -134,12 +134,15 @@ Notes:
|
|
|
134
134
|
## Links
|
|
135
135
|
- GitHub: https://github.com/JIGGAI/ClawRecipes
|
|
136
136
|
- Docs:
|
|
137
|
-
- Installation: `docs/INSTALLATION.md`
|
|
138
|
-
- Commands: `docs/COMMANDS.md`
|
|
139
|
-
- Recipe format: `docs/RECIPE_FORMAT.md`
|
|
140
|
-
- Team workflow: `docs/TEAM_WORKFLOW.md`
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
- [Installation](https://github.com/JIGGAI/ClawRecipes/blob/main/docs/INSTALLATION.md): `docs/INSTALLATION.md`
|
|
138
|
+
- [Commands](https://github.com/JIGGAI/ClawRecipes/blob/main/docs/COMMANDS.md): `docs/COMMANDS.md`
|
|
139
|
+
- [Recipe format](https://github.com/JIGGAI/ClawRecipes/blob/main/docs/RECIPE_FORMAT.md): `docs/RECIPE_FORMAT.md`
|
|
140
|
+
- [Team workflow](https://github.com/JIGGAI/ClawRecipes/blob/main/docs/TEAM_WORKFLOW.md): `docs/TEAM_WORKFLOW.md`
|
|
141
|
+
- [Agents & Skills](https://github.com/JIGGAI/ClawRecipes/blob/main/docs/AGENTS_AND_SKILLS.md): `docs/AGENTS_AND_SKILLS.md`
|
|
142
|
+
- [Bundled](https://github.com/JIGGAI/ClawRecipes/blob/main/docs/BUNDLED_RECIPES.md): `docs/BUNDLED_RECIPES.md`
|
|
143
|
+
- [Create Recipe Tutorial](https://github.com/JIGGAI/ClawRecipes/blob/main/docs/TUTORIAL_CREATE_RECIPE.md): `docs/TUTORIAL_CREATE_RECIPE.md`
|
|
144
|
+
|
|
145
|
+
## Note
|
|
143
146
|
ClawRecipes is meant to be *installed* and then used to build **agents + teams**.
|
|
144
147
|
|
|
145
148
|
Most users should focus on:
|
|
@@ -38,15 +38,27 @@ In OpenClaw, skills are surfaced as tools the agent can use.
|
|
|
38
38
|
## Tool policies (allow/deny)
|
|
39
39
|
Every agent can have a tool policy in OpenClaw config (written via `--apply-config` when scaffolding).
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
### About `exec`
|
|
42
|
+
`exec` is the shell-command tool. It can be used for things like:
|
|
43
|
+
- running tests/builds (`npm test`, `npm run build`)
|
|
44
|
+
- git operations (`git status`, `git diff`)
|
|
45
|
+
- codegen/migrations (`prisma migrate`, `pnpm lint`)
|
|
46
|
+
- quick diagnostics (`curl`, `jq`, `rg`)
|
|
47
|
+
|
|
48
|
+
ClawRecipes **does not deny `exec` by default** (many recipes set `deny: []`).
|
|
49
|
+
|
|
50
|
+
If you want an agent to be able to run commands, you must explicitly allow runtime capabilities.
|
|
51
|
+
|
|
52
|
+
### Common patterns
|
|
53
|
+
- Safe-by-default agents:
|
|
54
|
+
- `allow: ["group:fs", "group:web"]`
|
|
55
|
+
- `deny: ["exec"]` (optional hard block)
|
|
56
|
+
|
|
57
|
+
- Developer/devops-style agents:
|
|
58
|
+
- `allow: ["group:fs", "group:web", "group:runtime"]`
|
|
59
|
+
- `deny: []`
|
|
60
|
+
|
|
61
|
+
> Note: even when allowed, `exec` may still be gated by your OpenClaw exec approvals / allowlists.
|
|
50
62
|
|
|
51
63
|
## How to add/update tool access (allow list)
|
|
52
64
|
There are two common approaches.
|
package/docs/BUNDLED_RECIPES.md
CHANGED
|
@@ -29,7 +29,7 @@ Default tool policy (recipe-defined):
|
|
|
29
29
|
## 2) `social-team` (team)
|
|
30
30
|
**Kind:** team
|
|
31
31
|
|
|
32
|
-
**Use when:** you want
|
|
32
|
+
**Use when:** you want platform-specialist social execution (not copywriting): distribution + listening + platform SEO + community + reporting back to marketing.
|
|
33
33
|
|
|
34
34
|
Scaffold:
|
|
35
35
|
```bash
|
|
@@ -37,14 +37,19 @@ openclaw recipes scaffold-team social-team --team-id social-team-team --apply-co
|
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
What it creates:
|
|
40
|
-
-
|
|
40
|
+
- shared team workspace
|
|
41
41
|
- agents:
|
|
42
|
-
- `
|
|
43
|
-
- `
|
|
44
|
-
- `
|
|
45
|
-
- `
|
|
42
|
+
- `lead`
|
|
43
|
+
- `research`
|
|
44
|
+
- `listening`
|
|
45
|
+
- `social-seo`
|
|
46
|
+
- `editorial`
|
|
47
|
+
- `community`
|
|
48
|
+
- `distributor`
|
|
49
|
+
- platform roles: `tiktok`, `instagram`, `youtube`, `facebook`, plus defaults `x`, `linkedin`
|
|
46
50
|
|
|
47
51
|
Notes:
|
|
52
|
+
- Copy + creative live in `marketing-team` (not here).
|
|
48
53
|
- Default `tools` in the recipe deny `exec` (safer by default).
|
|
49
54
|
|
|
50
55
|
## 3) `development-team` (team)
|
|
@@ -206,7 +211,7 @@ openclaw recipes scaffold-team marketing-team --team-id marketing-team-team --ap
|
|
|
206
211
|
```
|
|
207
212
|
|
|
208
213
|
Roles:
|
|
209
|
-
- lead, seo, copywriter, ads, social, designer, analyst
|
|
214
|
+
- lead, seo, copywriter, ads, social, designer, analyst, video, compliance
|
|
210
215
|
|
|
211
216
|
---
|
|
212
217
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Cleanup TODO
|
|
2
|
+
|
|
3
|
+
## Infrastructure
|
|
4
|
+
|
|
5
|
+
- [x] Add @vitest/coverage-v8, test:coverage script
|
|
6
|
+
- [x] Create TEST_COVERAGE_PROGRESS.md, CODE_SMELLS_TRACKER.md
|
|
7
|
+
- [x] Run baseline coverage, populate progress doc
|
|
8
|
+
- [x] Update TEST_COVERAGE_PROGRESS.md after each coverage batch
|
|
9
|
+
|
|
10
|
+
## Code Smells
|
|
11
|
+
|
|
12
|
+
- [x] Extract fileExists to src/lib/fs-utils
|
|
13
|
+
- [x] Extract stableStringify to src/lib/stable-stringify
|
|
14
|
+
- [x] Unify parseFrontmatter/normalizeCronJobs (use recipe-frontmatter)
|
|
15
|
+
- [x] Replace magic numbers in toolsInvoke
|
|
16
|
+
|
|
17
|
+
## Test Coverage
|
|
18
|
+
|
|
19
|
+
- [x] lanes.ts
|
|
20
|
+
- [x] ticket-finder.ts
|
|
21
|
+
- [x] cleanup-workspaces (expand)
|
|
22
|
+
- [x] remove-team (expand)
|
|
23
|
+
- [x] marketplaceFetch (with fetch mock)
|
|
24
|
+
- [x] toolsInvoke (with fetch mock)
|
|
25
|
+
- [x] Extracted config, template, cron-utils, agent-config
|
|
26
|
+
- [x] index.ts handlers (via extraction or integration)
|
|
27
|
+
|
|
28
|
+
## Final
|
|
29
|
+
|
|
30
|
+
- [x] Set coverage thresholds (phased: 25% baseline; target 95%)
|
|
31
|
+
- [x] Verify npm run test:coverage passes
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Code Smells Tracker
|
|
2
|
+
|
|
3
|
+
| # | Smell | Status | Priority | Notes |
|
|
4
|
+
|---|-------|--------|----------|-------|
|
|
5
|
+
| 1 | fileExists duplicated (index, ticket-finder, ticket-workflow, lanes, remove-team) | done | high | Extracted to src/lib/fs-utils |
|
|
6
|
+
| 2 | stableStringify duplicated (index, bindings) | done | high | Extracted to src/lib/stable-stringify |
|
|
7
|
+
| 3 | parseFrontmatter/normalizeCronJobs duplicated (index, recipe-frontmatter) | done | high | Unified; recipe-frontmatter extended with message/task/prompt |
|
|
8
|
+
| 4 | Magic numbers in toolsInvoke (30_000, 150*attempt) | done | medium | Extracted as TOOLS_INVOKE_TIMEOUT_MS, RETRY_DELAY_BASE_MS |
|
|
9
|
+
| 5 | index.ts god file (~2500 lines) | done | low | Extracted handlers to src/handlers/; index now ~670 lines (Phase 3) |
|
|
10
|
+
| 6 | Duplicate ticket-finding logic (ticket-workflow vs ticket-finder) | done | medium | ticket-workflow now delegates to ticket-finder |
|
|
11
|
+
| 7 | Duplicated ticket regex patterns | done | low | TICKET_FILENAME_REGEX in ticket-finder; tickets uses it |
|
|
12
|
+
| 8 | Hardcoded "recipes" in scaffold | done | low | scaffold uses cfg.workspaceRecipesDir |
|
|
13
|
+
| 9 | Lane path duplication in tickets | done | low | tickets uses ticketStageDir from lanes |
|
|
14
|
+
| 10 | Magic numbers (1000, 18789, 0000) | done | low | MAX_RECIPE_ID_AUTO_INCREMENT, GATEWAY_DEFAULT_PORT, DEFAULT_TICKET_NUMBER in constants |
|
|
15
|
+
| 11 | Overlapping TicketLane/TicketStage types | done | low | TicketLane = Exclude<TicketStage, "assignments"> in lanes; ticket-finder re-exports |
|
|
16
|
+
| 12 | Config load/write duplicated | done | medium | loadOpenClawConfig, writeOpenClawConfig in recipes-config; all callers use them |
|
|
17
|
+
| 13 | nextTicketNumber inline in dispatch | done | low | Extracted computeNextTicketNumber to ticket-finder |
|
|
18
|
+
| 14 | bindings.ts vs recipes-config duplication | done | low | bindings re-exports from recipes-config; bindings.test uses recipes-config |
|
|
19
|
+
| 15 | Silent catch in handleDispatch | done | low | Documented: non-critical enqueueSystemEvent, nudgeQueued reflects skip |
|
|
20
|
+
| 16 | Duplicate pickRecipeId (scaffold vs team) | done | medium | Extracted to src/lib/recipe-id |
|
|
21
|
+
| 17 | Hardcoded "recipes" in team | done | low | team uses cfg.workspaceRecipesDir |
|
|
22
|
+
| 18 | as any in recipe-frontmatter normalizeCronJobs | done | low | CronJobInput type |
|
|
23
|
+
| 19 | as any in cron.ts (scope, created response) | done | low | Proper types; CronAddResponse, CronReconcileResult |
|
|
24
|
+
| 20 | getCfg trivial wrapper in recipes | done | very low | Inlined getRecipesConfig |
|
|
25
|
+
| 21 | results: any[] in cron | done | low | CronReconcileResult union type |
|
|
26
|
+
|
|
27
|
+
## Automated smell detection
|
|
28
|
+
|
|
29
|
+
Run `npm run smell-check` to:
|
|
30
|
+
- **ESLint**: `no-explicit-any`, `complexity`, `max-lines-per-function`, `max-params` (src/; index.ts exempt from complexity/lines)
|
|
31
|
+
- **jscpd**: Duplicate code detection (≥8 lines, ≥50 tokens)
|
|
32
|
+
- **Pattern grep**: `as any` in src/ (max 10), TODO/FIXME/XXX (max 20)
|
|
33
|
+
|
|
34
|
+
Scripts: `npm run lint`, `npm run lint:fix`, `npm run jscpd`, `npm run smell-check`
|
|
35
|
+
|
|
36
|
+
## Resolution log
|
|
37
|
+
|
|
38
|
+
- **Smell 5**: Index handler extraction (Phase 2–3) moved ~1200 lines to src/handlers/{cron,recipes,scaffold,team,tickets,install}.ts. index.ts now thin CLI wiring only.
|
|
39
|
+
- **Smells 6–11**: Additional cleanup: consolidated ticket-finding, extracted regex/constants, used config for recipes dir, ticketStageDir, magic-number constants, unified lane types.
|
|
40
|
+
- **Smells 12–15**: Config helpers (load/write), computeNextTicketNumber, bindings consolidation, silent-catch documentation.
|
|
41
|
+
- **Smells 16–21**: pickRecipeId extracted to recipe-id; team uses workspaceRecipesDir; CronJobInput type; cron types (CronAddResponse, CronReconcileResult); getCfg inlined; config double-lookup comment.
|
|
42
|
+
- **Post-cleanup complete** (Feb 2026): All 21 smells resolved; smell-check passes with 0 warnings. Additional quality improvements: pre-commit hooks (husky + lint-staged), CI coverage enforcement, tsconfig.json, JSDoc for public APIs.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Remaining Code Smells — TODO
|
|
2
|
+
|
|
3
|
+
## Type safety (`as any` / `any`) — DONE
|
|
4
|
+
|
|
5
|
+
- [x] **cron.ts** — Replaced with OpenClawCronJob, CronJobPatch, OpenClawPluginApi
|
|
6
|
+
- [x] **team.ts** — AgentScaffoldResult, MigrateStep types
|
|
7
|
+
- [x] **recipes-config.ts** — OpenClawConfigMutable
|
|
8
|
+
- [x] **remove-team.ts** — Record<string, unknown>
|
|
9
|
+
- [ ] **index.ts** — ~16 options: any remain (partial: install, scaffold use typed opts)
|
|
10
|
+
- [x] **Misc** — recipes, tickets, agent-config, config, cron-utils, marketplaceFetch, toolsInvoke, lanes, cleanup-workspaces, recipe-frontmatter
|
|
11
|
+
|
|
12
|
+
## Duplicate code (jscpd) — DONE
|
|
13
|
+
|
|
14
|
+
- [x] **ticket-workflow.ts** — patchTicketFields extracted
|
|
15
|
+
- [x] **tickets.ts** — dryRunTicketMove extracted
|
|
16
|
+
- [x] **index.ts** — runInstallRecipe, logScaffoldResult extracted
|
|
17
|
+
|
|
18
|
+
## Remaining (deferred)
|
|
19
|
+
|
|
20
|
+
- [ ] **Complexity** — reconcileRecipeCronJobs (55), handleScaffoldTeam (27), etc.
|
|
21
|
+
- [ ] **Long functions** — handleScaffoldTeam (163), reconcileRecipeCronJobs (139)
|
|
22
|
+
- [ ] **scaffold.ts ↔ team.ts** — pickRecipeId already shared; further unification optional
|
|
23
|
+
- [ ] **Console in src/lib** — Logging abstraction
|
package/docs/TEAM_WORKFLOW.md
CHANGED
|
@@ -61,7 +61,9 @@ Two concepts people often mix up:
|
|
|
61
61
|
Even if `openclaw recipes dispatch` created an inbox entry + backlog ticket, the lead won’t act unless:
|
|
62
62
|
- a human opens the lead agent/chat, **or**
|
|
63
63
|
- an automation loop runs (cron triage), **or**
|
|
64
|
-
-
|
|
64
|
+
- a best-effort nudge reaches the lead session.
|
|
65
|
+
|
|
66
|
+
By default, `openclaw recipes dispatch` will try to **enqueue a system event** to `agent:<teamId>-lead:main` (best-effort). If it can’t, the CLI prints explicit next steps (enable cron / run lead once / allowlist direct pings).
|
|
65
67
|
|
|
66
68
|
### Allowlisting other agents (subagents.allowAgents)
|
|
67
69
|
To allow `main` to target team role agents (like `development-team-lead`), add this to your OpenClaw config:
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Test Coverage Progress
|
|
2
|
+
|
|
3
|
+
Target: 95% line coverage.
|
|
4
|
+
|
|
5
|
+
## Baseline (before cleanup)
|
|
6
|
+
|
|
7
|
+
| File | % Stmts | % Branch | % Funcs | % Lines | Notes |
|
|
8
|
+
|------|---------|----------|---------|---------|-------|
|
|
9
|
+
| index.ts | 4.16 | 61.53 | 18.42 | 4.16 | God file; most logic untested |
|
|
10
|
+
| src/marketplaceFetch.ts | 0 | 100 | 100 | 0 | Needs fetch mock |
|
|
11
|
+
| src/toolsInvoke.ts | 0 | 100 | 0 | 0 | Needs fetch mock |
|
|
12
|
+
| src/lib/bindings.ts | 91.42 | 66.66 | 100 | 91.42 | Lines 50-52 uncovered |
|
|
13
|
+
| src/lib/cleanup-workspaces.ts | 78.51 | 61.9 | 100 | 78.51 | |
|
|
14
|
+
| src/lib/lanes.ts | 60 | 83.33 | 66.66 | 60 | |
|
|
15
|
+
| src/lib/recipe-frontmatter.ts | 93.54 | 70.83 | 100 | 93.54 | |
|
|
16
|
+
| src/lib/remove-team.ts | 81.51 | 70.58 | 63.63 | 81.51 | |
|
|
17
|
+
| src/lib/scaffold-templates.ts | 100 | 100 | 100 | 100 | |
|
|
18
|
+
| src/lib/shared-context.ts | 100 | 85.71 | 100 | 100 | |
|
|
19
|
+
| src/lib/ticket-finder.ts | 0 | 0 | 0 | 0 | Not yet exercised by tests |
|
|
20
|
+
| src/lib/ticket-workflow.ts | 96.52 | 37.5 | 100 | 96.52 | |
|
|
21
|
+
| **All files** | **18.25** | **58.85** | **48.83** | **18.25** | |
|
|
22
|
+
|
|
23
|
+
## Gaps to address
|
|
24
|
+
|
|
25
|
+
- index.ts: extract logic to src/lib and test there; add integration tests for command handlers
|
|
26
|
+
- ticket-finder.ts: add tests
|
|
27
|
+
- marketplaceFetch, toolsInvoke: mock fetch, add tests
|
|
28
|
+
- lanes.ts, cleanup-workspaces, remove-team: expand tests
|
|
29
|
+
|
|
30
|
+
## Updates
|
|
31
|
+
|
|
32
|
+
- **Baseline**: Initial coverage run before cleanup work.
|
|
33
|
+
- **Post-cleanup**: 25% overall; src/lib at 91.53%, src/ at 98.36%. index.ts remains low (3.91%) — extraction moved logic to lib. Thresholds set at 25% baseline; target 95% as further index extraction proceeds.
|
|
34
|
+
- **Index handler extraction (Phase 2–3)**: Handler logic moved to src/handlers/; exercised via __internal in integration tests.
|
|
35
|
+
- **Post-extraction baseline** (npm run test:coverage): 56.55% overall; src/ at 98.36%; src/handlers at 66.44%; src/lib at 94.63%; index.ts at 9.62% (thin CLI wiring).
|
|
36
|
+
- **Comprehensive coverage plan** (Phase 1–3): cron-handler, install-handler, prompt, workspace, scaffold, team, tickets, recipes tests added. Thresholds raised to 60% lines/statements, 90% functions. index.ts remains thin wiring; logic exercised via __internal.
|
|
37
|
+
- **CI coverage enforcement** (Feb 2026): CI now runs `npm run test:coverage`; build fails if thresholds are not met. Thresholds: lines 60%, statements 60%, functions 90%, branches 65%.
|