@massa-ai/cursor-plugin 1.6.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 (172) hide show
  1. package/.cursor-plugin/plugin.json +5 -0
  2. package/README.md +87 -0
  3. package/agents/massa-ai-architecture-specialist.md +65 -0
  4. package/agents/massa-ai-audit-specialist.md +81 -0
  5. package/agents/massa-ai-builder.md +67 -0
  6. package/agents/massa-ai-context-curator.md +67 -0
  7. package/agents/massa-ai-documentation-agent.md +65 -0
  8. package/agents/massa-ai-furps-analyst.md +71 -0
  9. package/agents/massa-ai-investigator.md +68 -0
  10. package/agents/massa-ai-mobile-specialist.md +82 -0
  11. package/agents/massa-ai-navigator.md +75 -0
  12. package/agents/massa-ai-plan-critic.md +90 -0
  13. package/agents/massa-ai-planner.md +65 -0
  14. package/agents/massa-ai-requirements-analyst.md +64 -0
  15. package/agents/massa-ai-reviewer.md +66 -0
  16. package/agents/massa-ai-test-engineer.md +66 -0
  17. package/agents/massa-ai-verification-agent.md +65 -0
  18. package/hooks/hooks.json +26 -0
  19. package/hooks/massa-ai-hook +298 -0
  20. package/install.sh +413 -0
  21. package/package.json +30 -0
  22. package/skills/agents/architecture-specialist/SKILL.md +69 -0
  23. package/skills/agents/audit-specialist/SKILL.md +85 -0
  24. package/skills/agents/builder/SKILL.md +71 -0
  25. package/skills/agents/context-curator/SKILL.md +71 -0
  26. package/skills/agents/documentation-agent/SKILL.md +69 -0
  27. package/skills/agents/furps-analyst/SKILL.md +74 -0
  28. package/skills/agents/investigator/SKILL.md +72 -0
  29. package/skills/agents/mobile-specialist/SKILL.md +86 -0
  30. package/skills/agents/navigator/SKILL.md +79 -0
  31. package/skills/agents/plan-critic/SKILL.md +93 -0
  32. package/skills/agents/planner/SKILL.md +69 -0
  33. package/skills/agents/requirements-analyst/SKILL.md +68 -0
  34. package/skills/agents/reviewer/SKILL.md +70 -0
  35. package/skills/agents/test-engineer/SKILL.md +70 -0
  36. package/skills/agents/verification-agent/SKILL.md +69 -0
  37. package/skills/def/SKILL.md +17 -0
  38. package/skills/find/SKILL.md +19 -0
  39. package/skills/graph/SKILL.md +16 -0
  40. package/skills/index/SKILL.md +19 -0
  41. package/skills/map/SKILL.md +24 -0
  42. package/skills/massa-ai/SKILL.md +315 -0
  43. package/skills/massa-ai/personas/README.md +35 -0
  44. package/skills/massa-ai/personas/ai-native-nodejs-cli-architect.md +76 -0
  45. package/skills/massa-ai/personas/catalog.json +157 -0
  46. package/skills/massa-ai/personas/context-skill-harness-engineer-architect.md +74 -0
  47. package/skills/massa-ai/personas/product-manager.md +67 -0
  48. package/skills/massa-ai/personas/senior-mobile-engineer.md +74 -0
  49. package/skills/massa-ai/personas/senior-mobile-qa-automation-engineer.md +75 -0
  50. package/skills/massa-ai/references/adr-authoring.md +189 -0
  51. package/skills/massa-ai/references/agent-orchestration.md +221 -0
  52. package/skills/massa-ai/references/architecture-coupling-lens.md +239 -0
  53. package/skills/massa-ai/references/architecture-deepening-lens.md +136 -0
  54. package/skills/massa-ai/references/architecture-domain-lens.md +186 -0
  55. package/skills/massa-ai/references/architecture-lenses.md +108 -0
  56. package/skills/massa-ai/references/audit-report-io.md +459 -0
  57. package/skills/massa-ai/references/audit-scope.md +103 -0
  58. package/skills/massa-ai/references/code-annotation.md +111 -0
  59. package/skills/massa-ai/references/codebase-investigation.md +96 -0
  60. package/skills/massa-ai/references/context-firewall.md +62 -0
  61. package/skills/massa-ai/references/conversation-feedback.md +104 -0
  62. package/skills/massa-ai/references/debug-diagnosis-loop.md +140 -0
  63. package/skills/massa-ai/references/decision-engine.md +73 -0
  64. package/skills/massa-ai/references/evidence-gate.md +53 -0
  65. package/skills/massa-ai/references/furps/analyst-role.md +49 -0
  66. package/skills/massa-ai/references/furps/checklist.md +92 -0
  67. package/skills/massa-ai/references/furps/intake.md +104 -0
  68. package/skills/massa-ai/references/furps/report-contract.md +140 -0
  69. package/skills/massa-ai/references/hook-enforcement.md +137 -0
  70. package/skills/massa-ai/references/implementation-delivery.md +101 -0
  71. package/skills/massa-ai/references/installation.md +110 -0
  72. package/skills/massa-ai/references/lessons.md +119 -0
  73. package/skills/massa-ai/references/maestro/artifacts-reports.md +69 -0
  74. package/skills/massa-ai/references/maestro/cli-device.md +65 -0
  75. package/skills/massa-ai/references/maestro/cloud.md +67 -0
  76. package/skills/massa-ai/references/maestro/config-env-output.md +76 -0
  77. package/skills/massa-ai/references/maestro/fact-ledger.md +71 -0
  78. package/skills/massa-ai/references/maestro/js-scripting.md +70 -0
  79. package/skills/massa-ai/references/maestro/mcp.md +59 -0
  80. package/skills/massa-ai/references/maestro/patterns.md +96 -0
  81. package/skills/massa-ai/references/maestro/selectors.md +91 -0
  82. package/skills/massa-ai/references/maestro/workspace-execution.md +81 -0
  83. package/skills/massa-ai/references/maestro/yaml-commands.md +203 -0
  84. package/skills/massa-ai/references/maestro.md +47 -0
  85. package/skills/massa-ai/references/mcp-tools.md +296 -0
  86. package/skills/massa-ai/references/memory-policy.md +103 -0
  87. package/skills/massa-ai/references/mobile-context.md +113 -0
  88. package/skills/massa-ai/references/mobile-diagnosis.md +106 -0
  89. package/skills/massa-ai/references/mobile-figma-matcher/ATTRIBUTION.md +5 -0
  90. package/skills/massa-ai/references/mobile-figma-matcher/android-compose.md +13 -0
  91. package/skills/massa-ai/references/mobile-figma-matcher/android-views.md +13 -0
  92. package/skills/massa-ai/references/mobile-figma-matcher/core.md +117 -0
  93. package/skills/massa-ai/references/mobile-figma-matcher/ios-swiftui.md +12 -0
  94. package/skills/massa-ai/references/mobile-figma-matcher/ios-uikit.md +12 -0
  95. package/skills/massa-ai/references/mobile-figma-matcher/kmp-compose-multiplatform.md +14 -0
  96. package/skills/massa-ai/references/mobile-figma-matcher/repository-detection.md +77 -0
  97. package/skills/massa-ai/references/naming-standards.md +47 -0
  98. package/skills/massa-ai/references/pr-task-fix.md +80 -0
  99. package/skills/massa-ai/references/project-context.md +76 -0
  100. package/skills/massa-ai/references/rfc/ATTRIBUTION.md +5 -0
  101. package/skills/massa-ai/references/rfc/discovery-and-sizing.md +120 -0
  102. package/skills/massa-ai/references/rfc/document-contract.md +85 -0
  103. package/skills/massa-ai/references/rfc/quality-and-lifecycle.md +101 -0
  104. package/skills/massa-ai/references/root-cause-scripts.md +97 -0
  105. package/skills/massa-ai/references/spec-driven/artifact-store.md +98 -0
  106. package/skills/massa-ai/references/spec-driven/code-analysis.md +119 -0
  107. package/skills/massa-ai/references/spec-driven/coding-principles.md +80 -0
  108. package/skills/massa-ai/references/spec-driven/context-limits.md +64 -0
  109. package/skills/massa-ai/references/spec-driven/design.md +257 -0
  110. package/skills/massa-ai/references/spec-driven/discuss.md +182 -0
  111. package/skills/massa-ai/references/spec-driven/execute.md +471 -0
  112. package/skills/massa-ai/references/spec-driven/lessons.md +5 -0
  113. package/skills/massa-ai/references/spec-driven/memory.md +214 -0
  114. package/skills/massa-ai/references/spec-driven/specify.md +283 -0
  115. package/skills/massa-ai/references/spec-driven/sub-agents.md +151 -0
  116. package/skills/massa-ai/references/spec-driven/tasks.md +494 -0
  117. package/skills/massa-ai/references/spec-driven/validate.md +397 -0
  118. package/skills/massa-ai/references/subagent-design.md +132 -0
  119. package/skills/massa-ai/references/synapse-policy.md +160 -0
  120. package/skills/massa-ai/references/tdd/calibrated-examples.md +54 -0
  121. package/skills/massa-ai/references/tdd/discovery-and-sizing.md +83 -0
  122. package/skills/massa-ai/references/tdd/document-contract.md +136 -0
  123. package/skills/massa-ai/references/tdd/quality-and-lifecycle.md +83 -0
  124. package/skills/massa-ai/references/the-fool/cognitive-bias-inventory.md +103 -0
  125. package/skills/massa-ai/references/the-fool/dialectic-synthesis.md +170 -0
  126. package/skills/massa-ai/references/the-fool/evidence-audit.md +202 -0
  127. package/skills/massa-ai/references/the-fool/mode-selection-guide.md +113 -0
  128. package/skills/massa-ai/references/the-fool/pre-mortem-analysis.md +200 -0
  129. package/skills/massa-ai/references/the-fool/red-team-adversarial.md +206 -0
  130. package/skills/massa-ai/references/the-fool/socratic-questioning.md +153 -0
  131. package/skills/massa-ai/references/ticket/atlassian-fix.md +130 -0
  132. package/skills/massa-ai/references/ticket/intake-and-sources.md +65 -0
  133. package/skills/massa-ai/references/ticket/templates-and-quality.md +129 -0
  134. package/skills/massa-ai/references/verification-ladder.md +62 -0
  135. package/skills/massa-ai/scripts/lessons.py +590 -0
  136. package/skills/massa-ai/workflows/adr.md +33 -0
  137. package/skills/massa-ai/workflows/architecture/architecture-audit.md +125 -0
  138. package/skills/massa-ai/workflows/architecture/architecture-fix.md +110 -0
  139. package/skills/massa-ai/workflows/bugs/bugs-audit.md +113 -0
  140. package/skills/massa-ai/workflows/bugs/bugs-fix.md +97 -0
  141. package/skills/massa-ai/workflows/code-quality/code-quality-audit.md +154 -0
  142. package/skills/massa-ai/workflows/code-quality/code-quality-fix.md +99 -0
  143. package/skills/massa-ai/workflows/commit.md +61 -0
  144. package/skills/massa-ai/workflows/debug.md +86 -0
  145. package/skills/massa-ai/workflows/design.md +54 -0
  146. package/skills/massa-ai/workflows/exploration.md +119 -0
  147. package/skills/massa-ai/workflows/feature.md +52 -0
  148. package/skills/massa-ai/workflows/general.md +46 -0
  149. package/skills/massa-ai/workflows/implementation/implementation-audit.md +87 -0
  150. package/skills/massa-ai/workflows/implementation/implementation-fix.md +90 -0
  151. package/skills/massa-ai/workflows/long-session.md +44 -0
  152. package/skills/massa-ai/workflows/maestro/maestro-audit.md +56 -0
  153. package/skills/massa-ai/workflows/maestro/maestro-fix.md +74 -0
  154. package/skills/massa-ai/workflows/maestro/maestro.md +68 -0
  155. package/skills/massa-ai/workflows/mobile-figma/mobile-figma-audit.md +68 -0
  156. package/skills/massa-ai/workflows/mobile-figma/mobile-figma-fix.md +74 -0
  157. package/skills/massa-ai/workflows/onboarding.md +23 -0
  158. package/skills/massa-ai/workflows/refactor.md +47 -0
  159. package/skills/massa-ai/workflows/refinement/furps-refinement.md +81 -0
  160. package/skills/massa-ai/workflows/requirements/requirements-audit.md +114 -0
  161. package/skills/massa-ai/workflows/requirements/requirements-fix.md +93 -0
  162. package/skills/massa-ai/workflows/rfc.md +55 -0
  163. package/skills/massa-ai/workflows/security/security-audit.md +113 -0
  164. package/skills/massa-ai/workflows/security/security-fix.md +97 -0
  165. package/skills/massa-ai/workflows/spec-driven.md +217 -0
  166. package/skills/massa-ai/workflows/tdd.md +71 -0
  167. package/skills/massa-ai/workflows/tests/tests-audit.md +114 -0
  168. package/skills/massa-ai/workflows/tests/tests-fix.md +96 -0
  169. package/skills/massa-ai/workflows/the-fool.md +82 -0
  170. package/skills/massa-ai/workflows/ticket.md +42 -0
  171. package/skills/persona-router/SKILL.md +158 -0
  172. package/skills/status/SKILL.md +15 -0
package/install.sh ADDED
@@ -0,0 +1,413 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # massa-ai Cursor plugin installer
4
+ #
5
+ # Copies the plugin bundle (skills, hooks.json, agents, optional manifest,
6
+ # binary symlink) into the user's or project's Cursor config directory and
7
+ # merges the 7 massa-ai hook events into ~/.cursor/hooks.json (or
8
+ # ./.cursor/hooks.json) using an array-append merge that preserves existing
9
+ # user hooks.
10
+ #
11
+ # MCP registration is delegated to scripts/install-agents.sh, the single writer
12
+ # of host MCP config. This installer no longer ships a plugin-local mcp.json.
13
+ #
14
+ # Idempotent: re-running is a no-op when owned entries already present.
15
+ # Uninstall removes only ownership-marked entries + the plugin directory.
16
+ #
17
+ # Usage:
18
+ # apps/cursor-plugin/install.sh # install at user scope (~/.cursor)
19
+ # apps/cursor-plugin/install.sh --user # (same)
20
+ # apps/cursor-plugin/install.sh --project # install at project scope (./.cursor)
21
+ # apps/cursor-plugin/install.sh --uninstall # remove owned entries + plugin dir
22
+ # apps/cursor-plugin/install.sh -h|--help # show this help
23
+
24
+ set -euo pipefail
25
+
26
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
27
+ REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
28
+ CLAUDE_PLUGIN_BIN="$REPO_ROOT/apps/claude-plugin/hooks/massa-ai-hook.ts"
29
+
30
+ SCOPE="user"
31
+ UNINSTALL=0
32
+ DRY_RUN=0
33
+
34
+ for arg in "$@"; do
35
+ case "$arg" in
36
+ --user) SCOPE="user" ;;
37
+ --project) SCOPE="project" ;;
38
+ --uninstall) UNINSTALL=1 ;;
39
+ --quiet) MASSA_AI_VERBOSE=0 ;;
40
+ --verbose) MASSA_AI_VERBOSE=1 ;;
41
+ --dry-run) DRY_RUN=1; MASSA_AI_VERBOSE=1 ;;
42
+ -h|--help)
43
+ sed -n '2,/^$/p' "$0" | sed 's/^# \{0,1\}//'
44
+ exit 0
45
+ ;;
46
+ *) echo "Unknown flag: $arg" >&2; exit 2 ;;
47
+ esac
48
+ done
49
+
50
+ # Banner
51
+ source "$SCRIPT_DIR/../../scripts/banner.sh"
52
+ massa_ai_banner
53
+
54
+ # Resolve target base dir
55
+ if [[ "$SCOPE" == "project" ]]; then
56
+ CURSOR_DIR="$(pwd)/.cursor"
57
+ else
58
+ CURSOR_DIR="$HOME/.cursor"
59
+ fi
60
+ PLUGIN_DIR="$CURSOR_DIR/plugins/massa-ai"
61
+ HOOKS_JSON="$CURSOR_DIR/hooks.json"
62
+
63
+ # The 7 Cursor events → binary subcommands. The command path uses the
64
+ # INSTALLED plugin dir (not the placeholder), so Cursor invokes the copy.
65
+ # Cursor hooks.json shape: { "version": 1, "hooks": { "<event>": [...] } }
66
+ massa_ai_event_entry() {
67
+ local subcommand="$1"
68
+ cat <<JSON
69
+ { "command": "$PLUGIN_DIR/hooks/massa-ai-hook $subcommand", "_massaAiOwned": true }
70
+ JSON
71
+ }
72
+
73
+ # Array-append merge (F5 mitigation): for each of the 7 events, append the
74
+ # massa-ai hook entry to the event's array inside the nested "hooks"
75
+ # object if no entry with _massaAiOwned: true already exists. Preserves
76
+ # the top-level "version" field (defaults to 1). Backup before first write.
77
+ # Uses node (preferred) or bun for safe JSON manipulation.
78
+ merge_hooks_json() {
79
+ local file="$1"
80
+ local mode="$2" # "install" or "uninstall"
81
+ local ts
82
+ ts="$(date +%Y%m%d%H%M%S)"
83
+
84
+ local runner=""
85
+ if command -v node &>/dev/null; then
86
+ runner="node"
87
+ elif command -v bun &>/dev/null; then
88
+ runner="bun"
89
+ else
90
+ echo "Error: node or bun required to merge hooks.json (JSON manipulation)" >&2
91
+ exit 3
92
+ fi
93
+
94
+ "$runner" - "$file" "$mode" "$ts" "$PLUGIN_DIR" <<'NODE'
95
+ const fs = require("fs");
96
+ const path = require("path");
97
+
98
+ const file = process.argv[2];
99
+ const mode = process.argv[3];
100
+ const ts = process.argv[4];
101
+ const pluginDir = process.argv[5];
102
+
103
+ const EVENTS = [
104
+ ["sessionStart", "session-start"],
105
+ ["sessionEnd", "stop"],
106
+ ["beforeSubmitPrompt", "user-prompt-submit"],
107
+ ["preToolUse", "pre-tool-use"],
108
+ ["postToolUse", "post-tool-use"],
109
+ ["preCompact", "pre-compact"],
110
+ ["stop", "stop"],
111
+ ];
112
+
113
+ let cfg = {};
114
+ let existed = false;
115
+ try {
116
+ const raw = fs.readFileSync(file, "utf8");
117
+ if (raw.trim()) {
118
+ cfg = JSON.parse(raw);
119
+ existed = true;
120
+ }
121
+ } catch (e) {
122
+ if (e.code === "ENOENT") {
123
+ // no file — start empty
124
+ } else {
125
+ throw e;
126
+ }
127
+ }
128
+
129
+ // Ensure the nested hooks object + version field
130
+ if (typeof cfg.version !== "number") cfg.version = 1;
131
+ if (typeof cfg.hooks !== "object" || cfg.hooks === null) cfg.hooks = {};
132
+
133
+ const hooks = cfg.hooks;
134
+
135
+ function hasOwned(arr) {
136
+ return Array.isArray(arr) && arr.some((e) => e && e._massaAiOwned === true);
137
+ }
138
+
139
+ if (mode === "uninstall") {
140
+ for (const [evt] of EVENTS) {
141
+ if (Array.isArray(hooks[evt])) {
142
+ hooks[evt] = hooks[evt].filter((e) => !(e && e._massaAiOwned === true));
143
+ if (hooks[evt].length === 0) delete hooks[evt];
144
+ }
145
+ }
146
+ } else {
147
+ // install: backup before first write if file existed
148
+ if (existed) {
149
+ const bak = `${file}.massa-ai.bak-${ts}`;
150
+ fs.copyFileSync(file, bak);
151
+ }
152
+ for (const [evt, sub] of EVENTS) {
153
+ if (!Array.isArray(hooks[evt])) hooks[evt] = [];
154
+ if (!hasOwned(hooks[evt])) {
155
+ hooks[evt].push({
156
+ command: `${pluginDir}/hooks/massa-ai-hook ${sub}`,
157
+ _massaAiOwned: true,
158
+ });
159
+ }
160
+ }
161
+ }
162
+
163
+ fs.mkdirSync(path.dirname(file), { recursive: true });
164
+ fs.writeFileSync(file, JSON.stringify(cfg, null, 2) + "\n");
165
+ NODE
166
+ }
167
+
168
+ # ── Skills bundling (PDO-08, 09 / D3 two-writer ownership) ──────────────────
169
+ # scripts/install-skills.sh remains the single writer once it has already
170
+ # claimed this platform (skillsOwner: "repo" in the shared install-state.json).
171
+ # This plugin installs its bundled massa-ai/persona-router skills into the
172
+ # SAME harness skills directory ($CURSOR_DIR/skills — NOT $PLUGIN_DIR/skills,
173
+ # which is this plugin's own registerPath-discovered skill cache) only when
174
+ # that has not happened, mirroring the MCP single-writer precedent
175
+ # (test-mcp-single-writer.sh). A repo checkout's own --apply always takes
176
+ # precedence over a prior plugin install — see install-skills.sh.
177
+ HARNESS_STATE_FILE="$HOME/.config/massa-ai/install-state.json"
178
+ HARNESS_SKILLS_DIR="$CURSOR_DIR/skills"
179
+ HARNESS_HOST="cursor"
180
+
181
+ harness_skills_owner() {
182
+ local runner="$1"
183
+ "$runner" - "$HARNESS_STATE_FILE" "$HARNESS_HOST" <<'NODE'
184
+ const fs = require("fs");
185
+ const [, , file, host] = process.argv;
186
+ try {
187
+ const data = JSON.parse(fs.readFileSync(file, "utf8"));
188
+ const rec = data && data.platforms && data.platforms[host];
189
+ process.stdout.write(rec && rec.skillsOwner === "repo" ? "repo" : "none");
190
+ } catch {
191
+ process.stdout.write("none");
192
+ }
193
+ NODE
194
+ }
195
+
196
+ install_bundled_skills() {
197
+ local runner=""
198
+ if command -v node &>/dev/null; then runner="node"
199
+ elif command -v bun &>/dev/null; then runner="bun"
200
+ else
201
+ echo " ⚠ node or bun required to install bundled skills — skipping" >&2
202
+ return 0
203
+ fi
204
+
205
+ if [[ "$(harness_skills_owner "$runner")" == "repo" ]]; then
206
+ vecho " ↷ skills already installed by scripts/install-skills.sh (repo-owned) — skipping bundled copy"
207
+ return 0
208
+ fi
209
+
210
+ local installed=0 name src dest
211
+ for name in massa-ai persona-router; do
212
+ src="$SCRIPT_DIR/skills/$name"
213
+ [[ -d "$src" ]] || continue
214
+ dest="$HARNESS_SKILLS_DIR/$name"
215
+ if [[ -e "$dest" && ! -d "$dest" ]]; then
216
+ echo " ⚠ $dest exists and is not a directory — skipping" >&2
217
+ continue
218
+ fi
219
+ mkdir -p "$HARNESS_SKILLS_DIR"
220
+ rm -rf "$dest"
221
+ cp -R "$src" "$dest"
222
+ installed=$((installed + 1))
223
+ done
224
+ vecho " + ${installed} harness skills installed to $HARNESS_SKILLS_DIR (plugin-owned)"
225
+
226
+ "$runner" - "$HARNESS_STATE_FILE" "$HARNESS_HOST" "$CURSOR_DIR" <<'NODE'
227
+ const fs = require("fs");
228
+ const path = require("path");
229
+ const [, , file, host, root] = process.argv;
230
+ let data = { version: 2, platforms: {} };
231
+ try {
232
+ const existing = JSON.parse(fs.readFileSync(file, "utf8"));
233
+ if (existing && typeof existing === "object" && !Array.isArray(existing)) data = existing;
234
+ } catch { /* fresh */ }
235
+ if (typeof data.platforms !== "object" || data.platforms === null || Array.isArray(data.platforms)) {
236
+ data.platforms = {};
237
+ }
238
+ data.version = 2;
239
+ data.platforms[host] = { root, skillsOwner: "plugin", skills: ["massa-ai", "persona-router"] };
240
+ fs.mkdirSync(path.dirname(file), { recursive: true });
241
+ fs.writeFileSync(file, JSON.stringify(data, null, 2) + "\n");
242
+ NODE
243
+ }
244
+
245
+ uninstall_bundled_skills() {
246
+ local runner=""
247
+ if command -v node &>/dev/null; then runner="node"
248
+ elif command -v bun &>/dev/null; then runner="bun"
249
+ else return 0
250
+ fi
251
+
252
+ local raw_owner
253
+ raw_owner="$("$runner" - "$HARNESS_STATE_FILE" "$HARNESS_HOST" <<'NODE'
254
+ const fs = require("fs");
255
+ const [, , file, host] = process.argv;
256
+ try {
257
+ const data = JSON.parse(fs.readFileSync(file, "utf8"));
258
+ const rec = data && data.platforms && data.platforms[host];
259
+ process.stdout.write(rec ? String(rec.skillsOwner) : "none");
260
+ } catch {
261
+ process.stdout.write("none");
262
+ }
263
+ NODE
264
+ )"
265
+ [[ "$raw_owner" == "plugin" ]] || return 0
266
+
267
+ local name
268
+ for name in massa-ai persona-router; do
269
+ rm -rf "$HARNESS_SKILLS_DIR/$name"
270
+ done
271
+ rmdir "$HARNESS_SKILLS_DIR" 2>/dev/null || true
272
+ echo " - removed plugin-owned harness skills from $HARNESS_SKILLS_DIR"
273
+
274
+ "$runner" - "$HARNESS_STATE_FILE" "$HARNESS_HOST" <<'NODE'
275
+ const fs = require("fs");
276
+ const [, , file, host] = process.argv;
277
+ try {
278
+ const data = JSON.parse(fs.readFileSync(file, "utf8"));
279
+ if (data && data.platforms && data.platforms[host] && data.platforms[host].skillsOwner === "plugin") {
280
+ delete data.platforms[host];
281
+ fs.writeFileSync(file, JSON.stringify(data, null, 2) + "\n");
282
+ }
283
+ } catch { /* nothing to clean up */ }
284
+ NODE
285
+ }
286
+
287
+ # ── Uninstall ───────────────────────────────────────────────────────────────
288
+ if [[ "$UNINSTALL" -eq 1 ]]; then
289
+ echo "Uninstalling massa-ai Cursor plugin (scope: $SCOPE)..."
290
+ uninstall_bundled_skills
291
+ # Remove owned hook entries (preserves user hooks)
292
+ if [[ -f "$HOOKS_JSON" ]]; then
293
+ merge_hooks_json "$HOOKS_JSON" "uninstall"
294
+ echo " - removed massa-ai hook entries from $HOOKS_JSON"
295
+ fi
296
+ # Remove plugin directory
297
+ if [[ -d "$PLUGIN_DIR" ]]; then
298
+ rm -rf "$PLUGIN_DIR"
299
+ echo " - removed $PLUGIN_DIR"
300
+ fi
301
+ echo ""
302
+ echo "Done. User hooks preserved."
303
+ exit 0
304
+ fi
305
+
306
+ # ── Install ──────────────────────────────────────────────────────────────────
307
+ vecho "Installing massa-ai Cursor plugin to: $PLUGIN_DIR"
308
+ mkdir -p "$PLUGIN_DIR/.cursor-plugin" "$PLUGIN_DIR/skills" "$PLUGIN_DIR/hooks" "$PLUGIN_DIR/agents"
309
+
310
+ # Copy manifest
311
+ cp "$SCRIPT_DIR/.cursor-plugin/plugin.json" "$PLUGIN_DIR/.cursor-plugin/plugin.json"
312
+ vecho " + .cursor-plugin/plugin.json"
313
+
314
+ # Copy the 6 host-command skills (each in a subdirectory: skills/<name>/SKILL.md).
315
+ # massa-ai/, persona-router/, and agents/ are the PDO-06 harness bundle, not a
316
+ # Cursor command skill — they are installed separately, into the shared
317
+ # harness skills directory (see "Skills bundling" below), not into this
318
+ # plugin-cache skills/ tree.
319
+ skill_count=0
320
+ for src in "$SCRIPT_DIR/skills/"*/SKILL.md; do
321
+ name="$(basename "$(dirname "$src")")"
322
+ case "$name" in
323
+ massa-ai|persona-router|agents) continue ;;
324
+ esac
325
+ mkdir -p "$PLUGIN_DIR/skills/$name"
326
+ cp "$src" "$PLUGIN_DIR/skills/$name/SKILL.md"
327
+ vecho " + skills/$name/SKILL.md"
328
+ skill_count=$((skill_count + 1))
329
+ done
330
+
331
+ # Copy hooks.json (the placeholder version — installer replaces paths)
332
+ cp "$SCRIPT_DIR/hooks/hooks.json" "$PLUGIN_DIR/hooks/hooks.json"
333
+ vecho " + hooks/hooks.json"
334
+
335
+ # Older installs shipped a plugin-local mcp.json here. Cursor reads
336
+ # ~/.cursor/mcp.json, not the plugin dir, and MCP is now owned by
337
+ # scripts/install-agents.sh — drop the residue so upgraders converge.
338
+ if [[ -f "$PLUGIN_DIR/mcp.json" ]]; then
339
+ rm -f "$PLUGIN_DIR/mcp.json"
340
+ # Not gated by --quiet: this deletes a file in the user's home, so it is a
341
+ # mutation notice rather than per-file chatter.
342
+ echo -e " - removed stale mcp.json (MCP is now registered in ~/.cursor/mcp.json)"
343
+ fi
344
+
345
+ # Copy agents — every generated subagent specialist (auto-discovered by Cursor
346
+ # from the plugin's agents/ dir). All of them, navigator included, are generated
347
+ # from skills/agents/*/SKILL.md and owned by the massa-ai- name prefix (CRS-04).
348
+ specialist_count=0
349
+ for src in "$SCRIPT_DIR/agents/"massa-ai-*.md; do
350
+ [[ -f "$src" ]] || continue
351
+ name="$(basename "$src")"
352
+ cp "$src" "$PLUGIN_DIR/agents/$name"
353
+ vecho " + $name"
354
+ specialist_count=$((specialist_count + 1))
355
+ done
356
+ vecho " + ${specialist_count} subagent specialists (generated from skills/agents/*/SKILL.md)"
357
+
358
+ # Skills bundling (PDO-08, 09): install massa-ai/persona-router into the
359
+ # shared harness skills directory, unless scripts/install-skills.sh already
360
+ # owns it for this platform.
361
+ vecho ""
362
+ install_bundled_skills
363
+
364
+ # Copy the real hooks/massa-ai-hook this plugin already ships (T14/PDO-14: a
365
+ # generated real file, no longer a symlink into apps/claude-plugin/ — that
366
+ # path does not exist in a registry tarball install, where $REPO_ROOT is not
367
+ # this monorepo. $CLAUDE_PLUGIN_BIN is kept only as a repo-checkout fallback.
368
+ if [[ -f "$SCRIPT_DIR/hooks/massa-ai-hook" ]]; then
369
+ cp "$SCRIPT_DIR/hooks/massa-ai-hook" "$PLUGIN_DIR/hooks/massa-ai-hook"
370
+ chmod +x "$PLUGIN_DIR/hooks/massa-ai-hook"
371
+ vecho " + hooks/massa-ai-hook"
372
+ elif [[ -f "$CLAUDE_PLUGIN_BIN" ]]; then
373
+ ln -sfn "$CLAUDE_PLUGIN_BIN" "$PLUGIN_DIR/hooks/massa-ai-hook"
374
+ vecho " + hooks/massa-ai-hook → $CLAUDE_PLUGIN_BIN"
375
+ else
376
+ echo " ⚠ Warning: no massa-ai-hook binary found" >&2
377
+ echo " Hooks will not fire until the binary is available." >&2
378
+ fi
379
+
380
+ # Merge hooks.json (array-append, backup, idempotent)
381
+ vecho ""
382
+ vecho "Merging hooks into $HOOKS_JSON..."
383
+ merge_hooks_json "$HOOKS_JSON" "install"
384
+ vecho " + 7 massa-ai hook events wired (array-append, user hooks preserved)"
385
+
386
+ # ── MCP registration (delegated) ─────────────────────────────────────────────
387
+ # scripts/install-agents.sh is the single writer of host MCP config. It writes
388
+ # the massa-ai entry into ~/.cursor/mcp.json at USER scope — a --project plugin
389
+ # install still registers MCP for the whole user.
390
+ vecho ""
391
+ vecho "Registering MCP server (user scope) via scripts/install-agents.sh..."
392
+ if [[ -f "$REPO_ROOT/scripts/install-agents.sh" ]]; then
393
+ # On success the delegated output is detail (usually "up to date"), so it is
394
+ # gated. On failure it is never gated: a silently-failed MCP registration is
395
+ # exactly the bug this change set exists to fix.
396
+ if agents_out="$(MASSA_AI_SUPPRESS_SPECIALIST_HINT=1 bash "$REPO_ROOT/scripts/install-agents.sh" --agent cursor --yes 2>&1)"; then
397
+ vecho "$agents_out"
398
+ else
399
+ echo "$agents_out" >&2
400
+ echo " ⚠ MCP wiring failed — run: bash scripts/install-agents.sh --agent cursor --yes" >&2
401
+ fi
402
+ else
403
+ echo " ⚠ scripts/install-agents.sh not found — register MCP with: bash scripts/install-agents.sh --agent cursor --yes" >&2
404
+ fi
405
+
406
+ # Summary line in quiet mode
407
+ if [ "${MASSA_AI_VERBOSE:-0}" != "1" ]; then
408
+ ok "cursor plugin installed (${skill_count} skills, ${specialist_count} specialists, 7 hooks)"
409
+ else
410
+ vecho ""
411
+ vecho "Done. Restart Cursor to pick up the plugin."
412
+ vecho "💡 MCP is registered in ~/.cursor/mcp.json by scripts/install-agents.sh (single writer)."
413
+ fi
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@massa-ai/cursor-plugin",
3
+ "version": "1.6.0",
4
+ "description": "massa-ai plugin for Cursor — semantic code search, memory, and context compression",
5
+ "files": [
6
+ "agents",
7
+ "hooks",
8
+ "skills",
9
+ "install.sh",
10
+ "README.md",
11
+ ".cursor-plugin/plugin.json"
12
+ ],
13
+ "author": "luizgmassa",
14
+ "keywords": [
15
+ "cursor",
16
+ "plugin",
17
+ "massa-ai",
18
+ "semantic-search",
19
+ "code-search",
20
+ "memory",
21
+ "context-compression",
22
+ "ai",
23
+ "llm"
24
+ ],
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/luizgmassa/massa-ai"
29
+ }
30
+ }
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: architecture-specialist
3
+ description: Read-only architecture guidance agent. Evaluate architecture, suggest boundaries, recommend abstractions, evaluate trade-offs, and suggest modularization. Folds the existing domain-mapper, coupling-auditor, and deepening-architect roles into one specialist. Triggers when a workflow needs architectural guidance before or during design. Never implements or rewrites code.
4
+ license: MIT
5
+ metadata:
6
+ author: S1LV4, luizgmassa
7
+ version: "1.0.0"
8
+ model_hint: MiniMax M3
9
+ permission: read-only
10
+ ---
11
+
12
+ # Architecture Specialist Agent Skill
13
+
14
+ ## Mission
15
+ Provide architectural guidance by evaluating structure, suggesting boundaries, and weighing trade-offs.
16
+
17
+ ## Responsibilities
18
+ - Evaluate architecture (layering, boundaries, coupling, depth).
19
+ - Suggest module boundaries and seams.
20
+ - Recommend abstractions where duplication or volatility warrants them.
21
+ - Evaluate trade-offs between approaches.
22
+ - Suggest modularization for shallow or over-coupled modules.
23
+
24
+ ## Restrictions
25
+ - Never implement.
26
+ - Never rewrite code.
27
+ - Never spawn subagents and never load the `massa-ai` router; the dispatching workflow owns routing.
28
+
29
+ ## Inputs
30
+ - `scope`: the module, service, or area under evaluation.
31
+ - `inputs`: recalled facts, source pointers, existing architecture docs.
32
+ - `sensors`: static coupling/depth metrics when available.
33
+
34
+ ## Outputs
35
+ - Status: Complete | Partial | Blocked
36
+ - Scope: modules and boundaries evaluated
37
+ - Evidence: `path:line` pointers, coupling/depth metrics, source locations
38
+ - Findings: boundary suggestions, abstraction recommendations, trade-off analysis, modularization plan
39
+ - Risks and skipped checks
40
+ - Exact next step
41
+
42
+ ## Invocation
43
+ ### Use when
44
+ - A workflow needs architectural guidance before or during design.
45
+ - The work crosses module or service boundaries.
46
+ - The user asks for architecture evaluation, coupling analysis, or modularization.
47
+
48
+ ### Do not use when
49
+ - The work is a single-file fix with no architectural surface.
50
+ - The task needs a concrete implementation (route to builder).
51
+ - An audit-specific lens is needed (route to audit-specialist with `lens: architecture`).
52
+
53
+ ## massa-ai Integration
54
+ - Context Firewall: summarize source reads; return findings and metrics, not raw code.
55
+ - Verification Ladder: static (coupling, depth, boundary) checks; no behavioral changes.
56
+ - Massa-ai Memory: suggest durable architecture-decision memories only when a boundary or abstraction is recommended; main agent persists.
57
+ - Synapse: own ephemeral session when evaluation spans multiple modules with repeated searches.
58
+ - References: `references/architecture-lenses.md`, `references/architecture-domain-lens.md`, `references/architecture-coupling-lens.md`, `references/architecture-deepening-lens.md`.
59
+
60
+ ## Model Hint
61
+ MiniMax M3 (advisory). Fallback to the workflow's configured default model if unavailable.
62
+
63
+ ## Validation Sensors
64
+ - Every finding has a `path:line` or metric pointer.
65
+ - Trade-offs name at least two alternatives.
66
+ - Boundary suggestions reference concrete modules.
67
+
68
+ ## Memory Boundary
69
+ Suggest durable memories only when an architectural boundary or abstraction is recommended and accepted. The main agent persists. Do not persist one-off evaluation chatter.
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: audit-specialist
3
+ description: Configurable read-only audit agent. Execute specialized audits through six lenses — bugs, architecture, security, requirements, code-quality, performance — selected via the lens field in the capability packet. Triggers when a workflow needs a findings-only audit. Never modifies implementation.
4
+ license: MIT
5
+ metadata:
6
+ author: S1LV4, luizgmassa
7
+ version: "1.0.0"
8
+ model_hint: GLM-5.2
9
+ permission: read-only
10
+ ---
11
+
12
+ # Audit Specialist Agent Skill
13
+
14
+ ## Mission
15
+ Execute a specialized audit through one configurable lens and return findings-only output.
16
+
17
+ ## Responsibilities
18
+ - Execute the audit checklist for the selected lens.
19
+ - Tie every finding to a `path:line` source location.
20
+ - Rank findings by severity.
21
+ - Produce a findings report following the project audit-report format.
22
+
23
+ ## Restrictions
24
+ - Never modify implementation.
25
+ - One lens per dispatch; do not mix lenses in one run.
26
+ - Never spawn subagents and never load the `massa-ai` router; the dispatching workflow owns routing.
27
+
28
+ ## Lenses
29
+
30
+ The `lens` field in the capability packet selects the audit behavior:
31
+
32
+ | Lens | Focus | Per-lens references |
33
+ |---|---|---|
34
+ | `bugs` | Bug discovery: null paths, error handling, race conditions, logic errors | `workflows/bugs/bugs-audit.md` |
35
+ | `architecture` | DDD, boundaries, coupling, module depth, seams | `references/architecture-lenses.md`, `references/architecture-domain-lens.md`, `references/architecture-coupling-lens.md`, `references/architecture-deepening-lens.md` |
36
+ | `security` | Security, privacy, auth, validation, secret handling | `workflows/security/security-audit.md` |
37
+ | `requirements` | Requirements, spec, acceptance, scope alignment | `workflows/requirements/requirements-audit.md` |
38
+ | `code-quality` | SOLID, Clean Code, KISS, YAGNI, DRY, maintainability | `workflows/code-quality/code-quality-audit.md` |
39
+ | `performance` | Performance hotspots, allocation, latency, throughput | Domain-specific; no fixed reference |
40
+
41
+ All lenses share `references/audit-scope.md` (scope rules) and `references/audit-report-io.md` (report format).
42
+
43
+ ## Inputs
44
+ - `scope`: the target area, diff, or module to audit.
45
+ - `lens`: one of `bugs | architecture | security | requirements | code-quality | performance` (required).
46
+ - `inputs`: recalled facts, existing audit reports, source pointers.
47
+ - `sensors`: static checks available for the lens (lint, typecheck, security scanners).
48
+
49
+ ## Outputs
50
+ - Status: Complete | Partial | Blocked
51
+ - Scope: area audited + lens used
52
+ - Evidence: `path:line` pointers, static-check results, source locations
53
+ - Findings: ranked list (severity, location, problem, suggestion) in the project audit-report format
54
+ - Risks and skipped checks
55
+ - Exact next step
56
+
57
+ ## Invocation
58
+ ### Use when
59
+ - A workflow needs a findings-only audit of an implementation target.
60
+ - The user asks for a bug, architecture, security, requirements, code-quality, or performance audit.
61
+ - A high/critical finding needs independent verification.
62
+
63
+ ### Do not use when
64
+ - The task needs a fix (route to the matching `*-fix` workflow or builder).
65
+ - No concrete target exists to audit.
66
+ - The lens is ambiguous (ask the user to pick one).
67
+
68
+ ## massa-ai Integration
69
+ - Context Firewall: summarize the audit scope; return findings, not raw source dumps.
70
+ - Verification Ladder: static checks per lens; no behavioral changes (findings-only).
71
+ - Massa-ai Memory: suggest durable audit-pattern memories only when a lens reveals a recurring issue class; main agent persists.
72
+ - Synapse: own ephemeral session when the audit spans multiple modules with repeated searches.
73
+ - References: `references/audit-scope.md`, `references/audit-report-io.md`, plus the per-lens references above.
74
+
75
+ ## Model Hint
76
+ GLM-5.2 (advisory). Fallback to the workflow's configured default model if unavailable.
77
+
78
+ ## Validation Sensors
79
+ - Every finding has a `path:line` pointer.
80
+ - Findings follow the project audit-report format (`references/audit-report-io.md`).
81
+ - Severity is assigned per the lens rubric.
82
+ - No fix actions taken (findings-only).
83
+
84
+ ## Memory Boundary
85
+ Suggest durable memories only when a lens reveals a recurring issue class worth remembering. The main agent persists. Do not persist the audit report itself (it lives in `.specs/`).
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: builder
3
+ description: Write-permitted implementation agent. Implement approved plans by modifying source code, creating files, and updating existing code while following project conventions. Triggers when a workflow has an approved plan or task with a disjoint write set. Never redesigns architecture, performs reviews, or generates implementation plans.
4
+ license: MIT
5
+ metadata:
6
+ author: S1LV4, luizgmassa
7
+ version: "1.0.0"
8
+ model_hint: GLM-5.2
9
+ permission: write
10
+ ---
11
+
12
+ # Builder Agent Skill
13
+
14
+ ## Mission
15
+ Implement an approved plan or task by modifying source code with a disjoint write set.
16
+
17
+ ## Responsibilities
18
+ - Modify source code per the approved plan.
19
+ - Create new files when the plan requires them.
20
+ - Update existing code following project conventions.
21
+ - Run the task's verification sensors before claiming completion.
22
+
23
+ ## Restrictions
24
+ - Never redesign architecture.
25
+ - Never perform reviews.
26
+ - Never generate implementation plans.
27
+ - Never write outside the assigned disjoint write set.
28
+ - Never spawn subagents and never load the `massa-ai` router; the dispatching workflow owns routing.
29
+
30
+ ## Inputs
31
+ - `scope`: exact files and modules to modify (disjoint write set).
32
+ - `inputs`: the approved plan or task, recalled facts, source pointers.
33
+ - `permissions`: write with disjoint write set.
34
+ - `sensors`: verification commands (tests, build, typecheck, lint).
35
+
36
+ ## Outputs
37
+ - Status: Complete | Partial | Blocked
38
+ - Scope: files changed
39
+ - Evidence: command results (tests, build, typecheck), diff summary
40
+ - Findings: implementation summary
41
+ - Risks and skipped checks
42
+ - Exact next step
43
+
44
+ ## Invocation
45
+ ### Use when
46
+ - A workflow has an approved plan or task.
47
+ - The write set is disjoint from other active agents.
48
+ - The task has concrete verification sensors.
49
+
50
+ ### Do not use when
51
+ - No plan or task is approved.
52
+ - The write set overlaps another active agent.
53
+ - The task needs architectural decisions (route to architecture-specialist or planner first).
54
+
55
+ ## massa-ai Integration
56
+ - Context Firewall: summarize diffs and command output; return evidence, not raw dumps.
57
+ - Verification Ladder: run the task's sensors (static + behavioral) before claiming Complete.
58
+ - Massa-ai Memory: suggest durable code-pattern memories only when the implementation establishes a reusable convention; main agent persists.
59
+ - Synapse: none (implementation is not a repeated-search task).
60
+ - References: `references/agent-orchestration.md`, `references/naming-standards.md`, `references/code-annotation.md`, `references/root-cause-scripts.md`.
61
+
62
+ ## Model Hint
63
+ GLM-5.2 (advisory). Fallback to the workflow's configured default model if unavailable.
64
+
65
+ ## Validation Sensors
66
+ - Verification commands from the plan pass (tests, build, typecheck, lint).
67
+ - Diff stays within the assigned write set.
68
+ - No validation assets weakened (tests, specs, fixtures, snapshots).
69
+
70
+ ## Memory Boundary
71
+ Suggest durable memories only when the implementation establishes a reusable code pattern or convention. The main agent persists. Do not persist one-off implementation details.