@ionivetech/mugiwara 0.6.6 → 0.7.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 (110) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +2 -7
  3. package/.codex-plugin/plugin.json +2 -7
  4. package/.cursor-plugin/plugin.json +2 -7
  5. package/.kimi-plugin/plugin.json +2 -7
  6. package/.opencode/plugins/mugiwara.mjs +3 -18
  7. package/AGENTS.md +5 -4
  8. package/GEMINI.md +3 -3
  9. package/README.md +69 -63
  10. package/content/agents/brook-healing.md +8 -4
  11. package/content/agents/chopper-checkpoint.md +7 -3
  12. package/content/agents/eval-runner.md +4 -4
  13. package/content/agents/franky-gates.md +3 -3
  14. package/content/agents/jinbe-security.md +6 -7
  15. package/content/agents/luffy-orchestrator.md +11 -13
  16. package/content/agents/memory-keeper.md +4 -4
  17. package/content/agents/nami-planner.md +4 -4
  18. package/content/agents/resume-coordinator.md +7 -7
  19. package/content/agents/robin-reviewer.md +7 -3
  20. package/content/agents/sanji-quality.md +2 -2
  21. package/content/agents/skeptic-verifier.md +2 -2
  22. package/content/agents/usopp-brainstorm.md +3 -3
  23. package/content/agents/zoro-execution.md +6 -6
  24. package/content/skills/mugiwara-backend/SKILL.md +2 -0
  25. package/content/skills/mugiwara-backend/references/database.md +61 -0
  26. package/content/skills/mugiwara-brainstorm/SKILL.md +1 -1
  27. package/content/skills/mugiwara-checkpoint/SKILL.md +6 -5
  28. package/content/skills/mugiwara-checkpoint/references/ledger-format.md +1 -1
  29. package/content/skills/mugiwara-execution/SKILL.md +8 -8
  30. package/content/skills/mugiwara-execution/references/dispatch.md +1 -1
  31. package/content/skills/mugiwara-execution/references/resume-batching.md +2 -2
  32. package/content/skills/mugiwara-frontend/SKILL.md +3 -2
  33. package/content/skills/mugiwara-frontend/references/checklist.md +14 -0
  34. package/content/skills/mugiwara-gates/SKILL.md +8 -5
  35. package/content/skills/mugiwara-healing/SKILL.md +2 -2
  36. package/content/skills/mugiwara-lessons/SKILL.md +2 -2
  37. package/content/skills/mugiwara-orchestration/SKILL.md +7 -7
  38. package/content/skills/mugiwara-orchestration/references/check-ins.md +2 -2
  39. package/content/skills/mugiwara-orchestration/references/closure.md +17 -12
  40. package/content/skills/mugiwara-orchestration/references/triage-escalation.md +11 -1
  41. package/content/skills/mugiwara-planning/SKILL.md +3 -18
  42. package/content/skills/mugiwara-planning/references/plan-template.md +2 -2
  43. package/content/skills/mugiwara-quality/SKILL.md +5 -2
  44. package/content/skills/mugiwara-resume/SKILL.md +2 -2
  45. package/content/skills/mugiwara-review/SKILL.md +3 -2
  46. package/content/skills/mugiwara-security/SKILL.md +1 -1
  47. package/content/skills/mugiwara-ship/SKILL.md +1 -1
  48. package/content/skills/mugiwara-ship/references/cleanup.md +17 -16
  49. package/content/skills/mugiwara-workflow/SKILL.md +9 -12
  50. package/content/skills/mugiwara-workflow/references/workspace-layout.md +39 -38
  51. package/dist/mugiwara.js +904 -462
  52. package/gemini-extension.json +1 -1
  53. package/hooks/auto-savepoint.js +18 -10
  54. package/hooks/auto-savepoint.ts +23 -23
  55. package/hooks/engagement-marker.js +1 -1
  56. package/hooks/engagement-marker.ts +1 -1
  57. package/hooks/pipeline-guard.js +16 -12
  58. package/hooks/pipeline-guard.ts +22 -19
  59. package/hooks/session-start.js +13 -10
  60. package/hooks/session-start.ts +24 -19
  61. package/package.json +2 -2
  62. package/plugin.json +1 -1
  63. package/references/complexity.md +27 -4
  64. package/references/definition-of-done.md +1 -1
  65. package/references/multi-actor.md +0 -3
  66. package/references/prose-style.md +54 -0
  67. package/scripts/check-doc-links.ts +40 -0
  68. package/scripts/conformance.ts +6 -16
  69. package/scripts/coverage-gate.ts +20 -6
  70. package/scripts/gate-selftest.ts +118 -7
  71. package/scripts/lane.sh +54 -8
  72. package/scripts/lib/patterns.sh +5 -0
  73. package/scripts/policy-force.ts +22 -0
  74. package/scripts/retrieval-eval.ts +1 -1
  75. package/scripts/savepoint.sh +136 -58
  76. package/scripts/validate-content.ts +22 -9
  77. package/scripts/verify-install.ts +9 -7
  78. package/src/args.ts +2 -2
  79. package/src/budget.ts +56 -0
  80. package/src/cli.ts +161 -110
  81. package/src/continue.ts +29 -10
  82. package/src/installer.ts +25 -20
  83. package/src/integrity.ts +158 -0
  84. package/src/mission.ts +228 -95
  85. package/src/policy.ts +156 -0
  86. package/src/provenance.ts +116 -0
  87. package/src/rollback.ts +95 -0
  88. package/src/routing.ts +69 -0
  89. package/src/run.ts +2 -2
  90. package/src/sign.ts +61 -0
  91. package/src/targets/claude.ts +2 -2
  92. package/.opencode/commands/mugiwara-execute.md +0 -13
  93. package/.opencode/commands/mugiwara-heal.md +0 -13
  94. package/.opencode/commands/mugiwara-onboard.md +0 -14
  95. package/.opencode/commands/mugiwara-plan.md +0 -17
  96. package/.opencode/commands/mugiwara-ship.md +0 -13
  97. package/.opencode/commands/using-mugiwara.md +0 -20
  98. package/content/skills/mugiwara-agent-security/SKILL.md +0 -58
  99. package/content/skills/mugiwara-agent-security/references/checklist.md +0 -20
  100. package/content/skills/mugiwara-context-budget/SKILL.md +0 -66
  101. package/content/skills/mugiwara-context-budget/references/context-budget.md +0 -37
  102. package/content/skills/mugiwara-pr/SKILL.md +0 -69
  103. package/content/skills/mugiwara-pr/references/verdict-format.md +0 -31
  104. package/content/skills/mugiwara-sunset/SKILL.md +0 -82
  105. package/content/skills/using-mugiwara/SKILL.md +0 -51
  106. package/references/token-budget.md +0 -56
  107. package/scripts/evidence.sh +0 -81
  108. package/scripts/initiative.ts +0 -296
  109. package/scripts/mission-report.sh +0 -293
  110. package/src/onboard.ts +0 -207
package/src/onboard.ts DELETED
@@ -1,207 +0,0 @@
1
- // src/onboard.ts — zero-LLM onboarding wizard (6 questions, writes .mugiwara/config).
2
- // Runs on every platform via the `mugiwara onboard` CLI command. No LLM, no network.
3
- import { existsSync, lstatSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
4
- import { join } from 'node:path';
5
- import { createRl, choose, confirm, type Rl } from './prompt.ts';
6
-
7
- // Canonical key order for the written config. Keys the wizard does not ask
8
- // about (auto_commit, delegate_threshold, heal_max_cycles, verbosity) are
9
- // preserved from an existing config, never reset to defaults.
10
- const DEFAULT_ORDER = [
11
- 'mode', 'branch', 'commit', 'auto_commit', 'coverage_new', 'coverage_modified',
12
- 'review_depth', 'quality_depth', 'delegate_threshold', 'heal_max_cycles', 'verbosity',
13
- ];
14
-
15
- // Defaults for keys the wizard does not ask about — used only when the key is
16
- // absent from an existing config (fresh install). Existing values always win.
17
- const DEFAULTS: Record<string, string> = {
18
- auto_commit: 'on',
19
- delegate_threshold: '60',
20
- heal_max_cycles: '3',
21
- verbosity: 'normal',
22
- };
23
-
24
- const BRANCH_PRESETS: Record<number, string> = {
25
- 1: 'feature/{type}-{issue}-{slug}',
26
- 2: 'feature/{slug}',
27
- 3: 'feat/{slug}',
28
- };
29
-
30
- const COMMIT_PRESETS: Record<number, string> = {
31
- 1: 'conventional',
32
- 2: 'gitmoji',
33
- 3: 'plain',
34
- };
35
-
36
- export function parseConfig(lines: string[]): Map<string, string> {
37
- const map = new Map<string, string>();
38
- for (const line of lines) {
39
- const t = line.trim();
40
- if (!t || t.startsWith('#')) continue;
41
- const eq = t.indexOf('=');
42
- if (eq === -1) continue;
43
- const k = t.slice(0, eq).trim();
44
- const v = t.slice(eq + 1).trim();
45
- if (!map.has(k)) map.set(k, v);
46
- }
47
- return map;
48
- }
49
-
50
- export function buildConfig(existing: Map<string, string>, updates: Record<string, string>): string {
51
- const merged = new Map(existing);
52
- for (const [k, v] of Object.entries(updates)) merged.set(k, v);
53
- const lines: string[] = [];
54
- for (const k of DEFAULT_ORDER) {
55
- const v = merged.get(k) ?? DEFAULTS[k];
56
- if (v === undefined) continue;
57
- lines.push(`${k}=${v}`);
58
- merged.delete(k);
59
- }
60
- for (const [k, v] of merged) lines.push(`${k}=${v}`);
61
- return lines.join('\n') + '\n';
62
- }
63
-
64
- async function askFreeText(rl: Rl, prompt: string): Promise<string> {
65
- for (;;) {
66
- const v = (await rl.question(prompt)).trim();
67
- if (v) return v;
68
- console.log(' Cannot be empty.');
69
- }
70
- }
71
-
72
- // Same guard the runtime helpers use: a symlinked config must never be
73
- // overwritten through the wizard (the target file is not ours to write).
74
- function assertNotSymlink(file: string): void {
75
- if (!existsSync(file)) return;
76
- try {
77
- if (lstatSync(file).isSymbolicLink()) throw new Error(`refusing to follow symlink: ${file}`);
78
- } catch (e) {
79
- if ((e as { code?: string }).code === 'ENOENT') return;
80
- throw e;
81
- }
82
- }
83
-
84
- export async function runOnboard(projectDir: string): Promise<void> {
85
- if (!process.stdin.isTTY) {
86
- throw new Error('Not a terminal. Run `mugiwara onboard` in a terminal, or edit .mugiwara/config directly.');
87
- }
88
- const mugiwaraDir = join(projectDir, '.mugiwara');
89
- const configPath = join(mugiwaraDir, 'config');
90
- assertNotSymlink(configPath);
91
- const existing = parseConfig(existsSync(configPath) ? readFileSync(configPath, 'utf8').split(/\r?\n/) : []);
92
-
93
- const rl = createRl();
94
- try {
95
- console.log('');
96
- console.log('╔══════════════════════════════════════╗');
97
- console.log('║ Mugiwara Onboarding Wizard ║');
98
- console.log('╚══════════════════════════════════════╝');
99
- console.log('');
100
-
101
- if (existing.size > 0) {
102
- const redo = await confirm(rl, 'Existing .mugiwara/config found. Re-onboard?');
103
- if (!redo) {
104
- console.log('Onboarding cancelled. Config preserved.');
105
- return;
106
- }
107
- console.log('');
108
- }
109
-
110
- // Q1 — branch pattern
111
- const branchChoice = await choose(rl, 'Q1 — Branch naming pattern:', [
112
- 'Trunk-based — feature/{type}-{issue}-{slug}',
113
- 'GitFlow — feature/{slug}',
114
- 'GitHub Flow — feat/{slug}',
115
- 'Custom — enter your own pattern',
116
- ]);
117
- let branch: string;
118
- if (branchChoice === 3) {
119
- branch = await askFreeText(rl, ' Branch pattern (placeholders: {type} {issue} {slug}, e.g. {issue}-{slug}): ');
120
- } else {
121
- branch = BRANCH_PRESETS[branchChoice + 1];
122
- }
123
-
124
- // Q2 — autonomy mode
125
- const modeIdx = await choose(rl, 'Q2 — Autonomy mode:', [
126
- 'guided — ask before every wave transition',
127
- 'semi — auto-advance through waves, pause on failures',
128
- 'auto — full auto-pilot',
129
- ]);
130
- const mode = ['guided', 'semi', 'auto'][modeIdx];
131
-
132
- // Q3 — review depth
133
- const reviewIdx = await choose(rl, 'Q3 — Code review depth:', [
134
- 'full — breaking-change map, five-axis review, <=3 cycles',
135
- 'standard — five-axis review, 1 cycle',
136
- 'quick — diff-only, no caller-map',
137
- ]);
138
- const reviewDepth = ['full', 'standard', 'quick'][reviewIdx];
139
-
140
- // Q4 — quality depth
141
- const qualityIdx = await choose(rl, 'Q4 — Quality check depth:', [
142
- 'full — format, lint, typecheck, test, build',
143
- 'standard — lint, typecheck, test',
144
- 'quick — test only',
145
- ]);
146
- const qualityDepth = ['full', 'standard', 'quick'][qualityIdx];
147
-
148
- // Q5 — coverage
149
- const covIdx = await choose(rl, 'Q5 — Test coverage threshold:', [
150
- '90/80 — new code 90%, modified 80%',
151
- '80/70 — new code 80%, modified 70%',
152
- 'custom — enter your own values',
153
- 'none — 0/0, no coverage enforcement',
154
- ]);
155
- let coverageNew = 90;
156
- let coverageModified = 80;
157
- if (covIdx === 1) { coverageNew = 80; coverageModified = 70; }
158
- else if (covIdx === 2) {
159
- coverageNew = Number.parseInt(await askFreeText(rl, ' Coverage for new code (%): '), 10) || 0;
160
- coverageModified = Number.parseInt(await askFreeText(rl, ' Coverage for modified code (%): '), 10) || 0;
161
- } else if (covIdx === 3) { coverageNew = 0; coverageModified = 0; }
162
-
163
- // Q6 — commit style
164
- const commitChoice = await choose(rl, 'Q6 — Commit style:', [
165
- 'Conventional Commits — feat:, fix:, chore:, docs:',
166
- 'Gitmoji — emoji-prefixed conventional',
167
- 'Plain — no prefix, imperative sentence',
168
- 'Custom template — enter your own (placeholders: {type} {issue} {title})',
169
- ]);
170
- let commit: string;
171
- if (commitChoice === 3) {
172
- commit = await askFreeText(rl, ' Commit template (e.g. {issue}: {title}): ');
173
- } else {
174
- commit = COMMIT_PRESETS[commitChoice + 1];
175
- }
176
-
177
- // ---- Write config ----
178
- if (!existsSync(mugiwaraDir)) mkdirSync(mugiwaraDir, { recursive: true });
179
- const body = buildConfig(existing, {
180
- mode,
181
- branch,
182
- commit,
183
- coverage_new: String(coverageNew),
184
- coverage_modified: String(coverageModified),
185
- review_depth: reviewDepth,
186
- quality_depth: qualityDepth,
187
- });
188
- writeFileSync(configPath, `# .mugiwara/config — written by mugiwara onboard on ${new Date().toISOString().slice(0, 10)}\n${body}`);
189
-
190
- // ---- Summary ----
191
- console.log('╔══════════════════════════════════════╗');
192
- console.log('║ Onboarding Complete ║');
193
- console.log('╚══════════════════════════════════════╝');
194
- console.log('');
195
- console.log(` Branch pattern: ${branch}`);
196
- console.log(` Autonomy mode: ${mode}`);
197
- console.log(` Review depth: ${reviewDepth}`);
198
- console.log(` Quality depth: ${qualityDepth}`);
199
- console.log(` Coverage: ${coverageNew}/${coverageModified}`);
200
- console.log(` Commit style: ${commit}`);
201
- console.log('');
202
- console.log(` Config written: ${configPath}`);
203
- console.log('');
204
- } finally {
205
- rl.close();
206
- }
207
- }