@curdx/flow 2.3.11 → 3.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 (210) hide show
  1. package/CHANGELOG.md +21 -34
  2. package/LICENSE +1 -1
  3. package/README.md +28 -79
  4. package/dist/index.mjs +995 -0
  5. package/package.json +33 -42
  6. package/.claude-plugin/marketplace.json +0 -48
  7. package/.claude-plugin/plugin.json +0 -70
  8. package/agent-preamble/preamble.md +0 -314
  9. package/agents/flow-adversary.md +0 -202
  10. package/agents/flow-architect.md +0 -197
  11. package/agents/flow-brownfield-analyst.md +0 -142
  12. package/agents/flow-debugger.md +0 -321
  13. package/agents/flow-edge-hunter.md +0 -288
  14. package/agents/flow-executor.md +0 -269
  15. package/agents/flow-orchestrator.md +0 -145
  16. package/agents/flow-planner.md +0 -246
  17. package/agents/flow-product-designer.md +0 -159
  18. package/agents/flow-qa-engineer.md +0 -282
  19. package/agents/flow-researcher.md +0 -165
  20. package/agents/flow-reviewer.md +0 -303
  21. package/agents/flow-security-auditor.md +0 -401
  22. package/agents/flow-triage-analyst.md +0 -272
  23. package/agents/flow-ui-researcher.md +0 -229
  24. package/agents/flow-ux-designer.md +0 -221
  25. package/agents/flow-verifier.md +0 -349
  26. package/bin/curdx-flow +0 -5
  27. package/bin/curdx-flow.js +0 -54
  28. package/cli/README.md +0 -104
  29. package/cli/doctor-workflow.js +0 -483
  30. package/cli/doctor.js +0 -73
  31. package/cli/help.js +0 -59
  32. package/cli/install-bundled-mcps.js +0 -37
  33. package/cli/install-companions.js +0 -19
  34. package/cli/install-context7-config.js +0 -80
  35. package/cli/install-curdx-plugin.js +0 -96
  36. package/cli/install-language.js +0 -35
  37. package/cli/install-next-steps.js +0 -29
  38. package/cli/install-options.js +0 -9
  39. package/cli/install-paths.js +0 -52
  40. package/cli/install-recommended-plugins.js +0 -104
  41. package/cli/install-required-plugins.js +0 -57
  42. package/cli/install-self-update.js +0 -62
  43. package/cli/install-workflow.js +0 -209
  44. package/cli/install.js +0 -101
  45. package/cli/lib/claude-commands.js +0 -41
  46. package/cli/lib/claude-ops.js +0 -47
  47. package/cli/lib/claude.js +0 -183
  48. package/cli/lib/config.js +0 -24
  49. package/cli/lib/doctor-claude-settings.js +0 -1186
  50. package/cli/lib/doctor-report.js +0 -978
  51. package/cli/lib/doctor-runtime-environment.js +0 -196
  52. package/cli/lib/frontmatter.js +0 -44
  53. package/cli/lib/json-schema.js +0 -57
  54. package/cli/lib/logging.js +0 -25
  55. package/cli/lib/process.js +0 -60
  56. package/cli/lib/prompts.js +0 -135
  57. package/cli/lib/runtime.js +0 -107
  58. package/cli/lib/semver.js +0 -109
  59. package/cli/lib/version.js +0 -12
  60. package/cli/protocols-body.md +0 -22
  61. package/cli/protocols.js +0 -162
  62. package/cli/registry.js +0 -123
  63. package/cli/router.js +0 -49
  64. package/cli/uninstall-actions.js +0 -360
  65. package/cli/uninstall-workflow.js +0 -146
  66. package/cli/uninstall.js +0 -42
  67. package/cli/upgrade-workflow.js +0 -80
  68. package/cli/upgrade.js +0 -91
  69. package/cli/utils.js +0 -40
  70. package/gates/adversarial-review-gate.md +0 -219
  71. package/gates/coverage-audit-gate.md +0 -182
  72. package/gates/devex-gate.md +0 -254
  73. package/gates/edge-case-gate.md +0 -194
  74. package/gates/karpathy-gate.md +0 -130
  75. package/gates/security-gate.md +0 -218
  76. package/gates/tdd-gate.md +0 -182
  77. package/gates/test-quality-gate.md +0 -59
  78. package/gates/verification-gate.md +0 -179
  79. package/hooks/hooks.json +0 -58
  80. package/hooks/scripts/common.sh +0 -46
  81. package/hooks/scripts/inject-karpathy.sh +0 -53
  82. package/hooks/scripts/quick-mode-guard.sh +0 -68
  83. package/hooks/scripts/session-start.sh +0 -90
  84. package/hooks/scripts/stop-watcher.sh +0 -230
  85. package/hooks/scripts/subagent-artifact-guard.sh +0 -159
  86. package/hooks/scripts/subagent-statusline.sh +0 -105
  87. package/knowledge/artifact-output-discipline.md +0 -24
  88. package/knowledge/artifact-summary-contracts.md +0 -50
  89. package/knowledge/atomic-commits.md +0 -262
  90. package/knowledge/claude-code-runtime-contracts.md +0 -219
  91. package/knowledge/epic-decomposition.md +0 -307
  92. package/knowledge/execution-strategies.md +0 -303
  93. package/knowledge/karpathy-guidelines.md +0 -219
  94. package/knowledge/planning-reviews.md +0 -211
  95. package/knowledge/poc-first-workflow.md +0 -223
  96. package/knowledge/review-feedback-intake.md +0 -57
  97. package/knowledge/spec-driven-development.md +0 -180
  98. package/knowledge/systematic-debugging.md +0 -378
  99. package/knowledge/two-stage-review.md +0 -249
  100. package/knowledge/wave-execution.md +0 -403
  101. package/monitors/monitors.json +0 -8
  102. package/monitors/scripts/flow-state-monitor.sh +0 -99
  103. package/output-styles/curdx-evidence-first.md +0 -34
  104. package/schemas/agent-frontmatter.schema.json +0 -63
  105. package/schemas/config.schema.json +0 -134
  106. package/schemas/gate-frontmatter.schema.json +0 -30
  107. package/schemas/hooks.schema.json +0 -115
  108. package/schemas/output-style-frontmatter.schema.json +0 -22
  109. package/schemas/plugin-manifest.schema.json +0 -436
  110. package/schemas/plugin-settings.schema.json +0 -29
  111. package/schemas/skill-frontmatter.schema.json +0 -177
  112. package/schemas/spec-frontmatter.schema.json +0 -42
  113. package/schemas/spec-state.schema.json +0 -147
  114. package/settings.json +0 -7
  115. package/skills/brownfield-index/SKILL.md +0 -53
  116. package/skills/brownfield-index/references/applicability.md +0 -12
  117. package/skills/brownfield-index/references/handoff.md +0 -8
  118. package/skills/brownfield-index/references/index-contract.md +0 -10
  119. package/skills/browser-qa/SKILL.md +0 -39
  120. package/skills/browser-qa/references/handoff.md +0 -6
  121. package/skills/browser-qa/references/prerequisites.md +0 -10
  122. package/skills/browser-qa/references/qa-contract.md +0 -20
  123. package/skills/cancel/SKILL.md +0 -41
  124. package/skills/cancel/references/destructive-mode.md +0 -17
  125. package/skills/cancel/references/reporting.md +0 -18
  126. package/skills/cancel/references/state-recovery.md +0 -30
  127. package/skills/cancel/references/target-resolution.md +0 -7
  128. package/skills/debug/SKILL.md +0 -45
  129. package/skills/debug/references/context-gathering.md +0 -11
  130. package/skills/debug/references/failure-guard.md +0 -25
  131. package/skills/debug/references/intake.md +0 -12
  132. package/skills/debug/references/phase-workflow.md +0 -34
  133. package/skills/debug/references/reporting.md +0 -20
  134. package/skills/epic/SKILL.md +0 -39
  135. package/skills/epic/references/epic-artifacts.md +0 -20
  136. package/skills/epic/references/epic-intake.md +0 -9
  137. package/skills/epic/references/slice-handoff.md +0 -16
  138. package/skills/fast/SKILL.md +0 -62
  139. package/skills/fast/references/applicability.md +0 -25
  140. package/skills/fast/references/clarification.md +0 -20
  141. package/skills/fast/references/execution-contract.md +0 -56
  142. package/skills/help/SKILL.md +0 -55
  143. package/skills/help/references/dispatch.md +0 -20
  144. package/skills/help/references/overview.md +0 -39
  145. package/skills/help/references/troubleshoot.md +0 -47
  146. package/skills/help/references/workflow.md +0 -37
  147. package/skills/implement/SKILL.md +0 -96
  148. package/skills/implement/references/error-recovery.md +0 -36
  149. package/skills/implement/references/linear-execution.md +0 -32
  150. package/skills/implement/references/preflight.md +0 -43
  151. package/skills/implement/references/progress-contract.md +0 -32
  152. package/skills/implement/references/state-init.md +0 -33
  153. package/skills/implement/references/stop-hook-execution.md +0 -36
  154. package/skills/implement/references/strategy-router.md +0 -38
  155. package/skills/implement/references/subagent-execution.md +0 -43
  156. package/skills/implement/references/wave-execution.md +0 -162
  157. package/skills/init/SKILL.md +0 -49
  158. package/skills/init/references/gitignore-and-health.md +0 -26
  159. package/skills/init/references/next-steps.md +0 -22
  160. package/skills/init/references/preflight.md +0 -15
  161. package/skills/init/references/scaffold-contract.md +0 -27
  162. package/skills/review/SKILL.md +0 -82
  163. package/skills/review/references/optional-passes.md +0 -48
  164. package/skills/review/references/preflight.md +0 -38
  165. package/skills/review/references/report-contract.md +0 -49
  166. package/skills/review/references/reporting.md +0 -20
  167. package/skills/review/references/stage-execution.md +0 -32
  168. package/skills/security-audit/SKILL.md +0 -47
  169. package/skills/security-audit/references/audit-contract.md +0 -21
  170. package/skills/security-audit/references/gate-handoff.md +0 -8
  171. package/skills/security-audit/references/scope-and-depth.md +0 -9
  172. package/skills/spec/SKILL.md +0 -100
  173. package/skills/spec/references/artifact-landing.md +0 -31
  174. package/skills/spec/references/phase-execution.md +0 -50
  175. package/skills/spec/references/planning-review.md +0 -31
  176. package/skills/spec/references/preflight-and-routing.md +0 -46
  177. package/skills/spec/references/reporting.md +0 -21
  178. package/skills/start/SKILL.md +0 -84
  179. package/skills/start/references/branch-routing.md +0 -51
  180. package/skills/start/references/mode-semantics.md +0 -12
  181. package/skills/start/references/preflight.md +0 -13
  182. package/skills/start/references/reporting.md +0 -20
  183. package/skills/start/references/state-seeding.md +0 -44
  184. package/skills/start/references/workflow-handoff.md +0 -26
  185. package/skills/status/SKILL.md +0 -41
  186. package/skills/status/references/gather-contract.md +0 -27
  187. package/skills/status/references/health-rules.md +0 -27
  188. package/skills/status/references/output-contract.md +0 -24
  189. package/skills/status/references/preflight.md +0 -10
  190. package/skills/status/references/recovery-hints.md +0 -18
  191. package/skills/ui-sketch/SKILL.md +0 -39
  192. package/skills/ui-sketch/references/brief-intake.md +0 -10
  193. package/skills/ui-sketch/references/iteration-handoff.md +0 -5
  194. package/skills/ui-sketch/references/variant-contract.md +0 -15
  195. package/skills/verify/SKILL.md +0 -56
  196. package/skills/verify/references/evidence-workflow.md +0 -39
  197. package/skills/verify/references/output-contract.md +0 -23
  198. package/skills/verify/references/preflight.md +0 -11
  199. package/skills/verify/references/report-handoff.md +0 -35
  200. package/skills/verify/references/strict-mode.md +0 -12
  201. package/templates/CONTEXT.md.tmpl +0 -53
  202. package/templates/PROJECT.md.tmpl +0 -59
  203. package/templates/ROADMAP.md.tmpl +0 -50
  204. package/templates/STATE.md.tmpl +0 -49
  205. package/templates/config.json.tmpl +0 -51
  206. package/templates/design.md.tmpl +0 -83
  207. package/templates/progress.md.tmpl +0 -77
  208. package/templates/requirements.md.tmpl +0 -76
  209. package/templates/research.md.tmpl +0 -83
  210. package/templates/tasks.md.tmpl +0 -107
package/cli/lib/semver.js DELETED
@@ -1,109 +0,0 @@
1
- function normalizeVersionToken(token) {
2
- return /^\d+$/.test(token) ? Number(token) : token;
3
- }
4
-
5
- function parseVersion(version) {
6
- const normalized = String(version || "").trim().replace(/^v/i, "");
7
- const [coreRaw = "0", prereleaseRaw] = normalized.split("-", 2);
8
- const core = coreRaw.split(".").map((part) => Number.parseInt(part, 10) || 0);
9
- const prerelease = prereleaseRaw
10
- ? prereleaseRaw.split(/[.-]/).filter(Boolean).map(normalizeVersionToken)
11
- : [];
12
-
13
- return { core, prerelease };
14
- }
15
-
16
- function compareIdentifier(left, right) {
17
- if (left === right) {
18
- return 0;
19
- }
20
-
21
- const leftIsNumber = typeof left === "number";
22
- const rightIsNumber = typeof right === "number";
23
-
24
- if (leftIsNumber && rightIsNumber) {
25
- return left > right ? 1 : -1;
26
- }
27
-
28
- if (leftIsNumber) {
29
- return -1;
30
- }
31
-
32
- if (rightIsNumber) {
33
- return 1;
34
- }
35
-
36
- return left > right ? 1 : -1;
37
- }
38
-
39
- export function compareVersions(leftVersion, rightVersion) {
40
- const left = parseVersion(leftVersion);
41
- const right = parseVersion(rightVersion);
42
- const coreLength = Math.max(left.core.length, right.core.length);
43
-
44
- for (let index = 0; index < coreLength; index += 1) {
45
- const leftPart = left.core[index] ?? 0;
46
- const rightPart = right.core[index] ?? 0;
47
- if (leftPart !== rightPart) {
48
- return leftPart > rightPart ? 1 : -1;
49
- }
50
- }
51
-
52
- const leftHasPrerelease = left.prerelease.length > 0;
53
- const rightHasPrerelease = right.prerelease.length > 0;
54
-
55
- if (!leftHasPrerelease && !rightHasPrerelease) {
56
- return 0;
57
- }
58
-
59
- if (!leftHasPrerelease) {
60
- return 1;
61
- }
62
-
63
- if (!rightHasPrerelease) {
64
- return -1;
65
- }
66
-
67
- const prereleaseLength = Math.max(left.prerelease.length, right.prerelease.length);
68
- for (let index = 0; index < prereleaseLength; index += 1) {
69
- const leftPart = left.prerelease[index];
70
- const rightPart = right.prerelease[index];
71
-
72
- if (leftPart === undefined) {
73
- return -1;
74
- }
75
-
76
- if (rightPart === undefined) {
77
- return 1;
78
- }
79
-
80
- const comparison = compareIdentifier(leftPart, rightPart);
81
- if (comparison !== 0) {
82
- return comparison;
83
- }
84
- }
85
-
86
- return 0;
87
- }
88
-
89
- export function isVersionNewer(latestVersion, currentVersion) {
90
- return compareVersions(latestVersion, currentVersion) > 0;
91
- }
92
-
93
- export function isVersionAtLeast(version, minimumVersion) {
94
- return compareVersions(version, minimumVersion) >= 0;
95
- }
96
-
97
- export function deriveNpmDistTag(version) {
98
- const { prerelease } = parseVersion(version);
99
-
100
- if (prerelease.length === 0) {
101
- return "latest";
102
- }
103
-
104
- const namedChannel = prerelease.find(
105
- (token) => typeof token === "string" && token.length > 0
106
- );
107
-
108
- return namedChannel || "prerelease";
109
- }
@@ -1,12 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { dirname, join } from "node:path";
3
- import { fileURLToPath } from "node:url";
4
-
5
- // Read version dynamically from package.json so `curdx-flow --version` always
6
- // reflects the installed package version.
7
- const __dirname = dirname(fileURLToPath(import.meta.url));
8
- const pkgJson = JSON.parse(
9
- readFileSync(join(__dirname, "..", "..", "package.json"), "utf-8")
10
- );
11
-
12
- export const VERSION = pkgJson.version;
@@ -1,22 +0,0 @@
1
- ## Global Protocols (curdx-flow)
2
-
3
- All operations MUST strictly follow these system constraints:
4
-
5
- ### Language separation
6
- - **Tool / persistence layer = English**: commit messages, code, comments, file names, function names, PR descriptions, error messages thrown by code, and any artifact persisted to the repository or consumed by agents / skills / hooks at runtime.
7
- - **Conversational layer = Simplified Chinese**: chat replies, explanations and reasoning shown directly to the human in a conversation interface (e.g. Claude Code chat).
8
- - **Installer UX (`cli/` only, narrow carve-out)**: interactive menus printed by the npm-published installer under `cli/**` may present localized Chinese options because they serve a human operator at install time. This carve-out does NOT apply to `agents/`, `skills/`, `commands/`, `gates/`, `hooks/`, `knowledge/`, documentation, or any prose consumed by agents at runtime — those stay English.
9
-
10
- Rationale: English in the persistence / tool / agent-input layer aligns with developer-tool industry norms (npm/git/cargo are all English) and keeps AI / agent adaptation reliable. Chinese in the conversational layer matches the user's language preference. The installer carve-out reflects the fact that installer menus are a human-to-human interaction surface, not agent input. Mixing the two (e.g. Chinese commit messages, Chinese strings inside agent prompts) is a violation.
11
-
12
- ### Discovery & reasoning
13
- - **Library / framework / API questions**: query `context7` MCP first. Do not rely on training memory.
14
- - **Planning / design / architecture review / epic decomposition**: use `sequential-thinking` MCP with at least 5 thoughts.
15
- - **Cross-session memory**: query `claude-mem` MCP at task start when available.
16
-
17
- ### Three red lines (inherited from pua)
18
- 1. **Closed loop**: claiming "done"? Provide evidence (build output / passing tests / curl result).
19
- 2. **Fact-driven**: before saying "probably an env issue", verify it. Unverified attribution = blame-shifting.
20
- 3. **Exhaust everything**: before saying "I cannot", complete the systematic 4-stage debugging.
21
-
22
- > Source: curdx-flow CLI installer (`curdx-flow install`). Remove with: `curdx-flow uninstall --purge`.
package/cli/protocols.js DELETED
@@ -1,162 +0,0 @@
1
- /**
2
- * Global protocol injection — manage a curdx-flow-owned block in ~/.claude/CLAUDE.md.
3
- *
4
- * Uses sentinel markers so the block is idempotent (re-install upgrades it)
5
- * and reversible (uninstall removes it cleanly without touching user content).
6
- */
7
-
8
- import {
9
- readFileSync,
10
- writeFileSync,
11
- existsSync,
12
- mkdirSync,
13
- renameSync,
14
- unlinkSync,
15
- } from "node:fs";
16
- import { join, dirname } from "node:path";
17
- import { homedir } from "node:os";
18
- import { fileURLToPath } from "node:url";
19
-
20
- // Use os.homedir() instead of process.env.HOME — HOME can be empty inside
21
- // non-login shells (CI containers, some spawned child envs), which would
22
- // resolve GLOBAL_CLAUDE_MD to "/.claude/CLAUDE.md" (filesystem root) and
23
- // cause mkdir/writeFileSync to fail with EACCES. homedir() falls back to
24
- // the effective user's passwd entry on POSIX and USERPROFILE on Windows.
25
- const HOME = homedir();
26
- export const GLOBAL_CLAUDE_MD = join(HOME, ".claude", "CLAUDE.md");
27
-
28
- const SENTINEL_BEGIN =
29
- "<!-- BEGIN curdx-flow protocols (auto-managed; do not edit between sentinels) -->";
30
- const SENTINEL_END = "<!-- END curdx-flow protocols -->";
31
-
32
- // Protocol body lives in a sibling markdown file so it keeps markdown tooling
33
- // (preview, lint, prettier) and avoids backtick-escaping noise inside a JS
34
- // template literal. The body itself is English — it's instructions for the
35
- // model, not user-facing prose.
36
- const __dirname = dirname(fileURLToPath(import.meta.url));
37
- const PROTOCOL_BODY = readFileSync(
38
- join(__dirname, "protocols-body.md"),
39
- "utf-8"
40
- ).trim();
41
-
42
- const FULL_BLOCK = `${SENTINEL_BEGIN}\n${PROTOCOL_BODY}\n${SENTINEL_END}`;
43
-
44
- /**
45
- * Read existing CLAUDE.md content; return "" if missing.
46
- */
47
- function readGlobalMd() {
48
- if (!existsSync(GLOBAL_CLAUDE_MD)) return "";
49
- return readFileSync(GLOBAL_CLAUDE_MD, "utf-8");
50
- }
51
-
52
- /**
53
- * Locate the sentinel block in the content.
54
- * Returns { start, end } indices into content, `null` if neither sentinel is
55
- * present, or throws if the block is corrupted (begin without matching end).
56
- * The throw is intentional — previously the corrupted case silently returned
57
- * null, so the next run would append a SECOND block, producing drift.
58
- */
59
- function findBlock(content) {
60
- const start = content.indexOf(SENTINEL_BEGIN);
61
- if (start === -1) {
62
- // Also check for a dangling END without BEGIN — that is also corrupted.
63
- if (content.indexOf(SENTINEL_END) !== -1) {
64
- throw new Error(
65
- `Corrupted protocol block in ${GLOBAL_CLAUDE_MD}: END sentinel found without BEGIN. ` +
66
- `Manually inspect the file and remove the dangling END line, then re-run.`
67
- );
68
- }
69
- return null;
70
- }
71
- const endIdx = content.indexOf(SENTINEL_END, start);
72
- if (endIdx === -1) {
73
- throw new Error(
74
- `Corrupted protocol block in ${GLOBAL_CLAUDE_MD}: BEGIN sentinel found without END. ` +
75
- `Manually remove the orphan BEGIN line (or restore the END), then re-run.`
76
- );
77
- }
78
- return { start, end: endIdx + SENTINEL_END.length };
79
- }
80
-
81
- /**
82
- * Write `content` to `path` atomically: write to a sibling temp file first,
83
- * then rename. This prevents a half-written CLAUDE.md if the process is
84
- * interrupted mid-write, and avoids races between concurrent install /
85
- * uninstall invocations.
86
- */
87
- function atomicWrite(path, content) {
88
- const tmp = `${path}.curdx-flow.tmp.${process.pid}`;
89
- try {
90
- writeFileSync(tmp, content, "utf-8");
91
- renameSync(tmp, path);
92
- } catch (err) {
93
- // Best-effort cleanup of the temp file; swallow errors here since we
94
- // are already re-throwing the real failure.
95
- try {
96
- if (existsSync(tmp)) unlinkSync(tmp);
97
- } catch {
98
- // ignore
99
- }
100
- throw err;
101
- }
102
- }
103
-
104
- /**
105
- * Inject (or upgrade) the protocol block in ~/.claude/CLAUDE.md.
106
- * @returns {{action:"created"|"upgraded"|"unchanged", path:string}}
107
- */
108
- export function injectGlobalProtocols() {
109
- const path = GLOBAL_CLAUDE_MD;
110
- const dir = dirname(path);
111
- if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
112
-
113
- const existing = readGlobalMd();
114
- const block = findBlock(existing);
115
-
116
- if (!block) {
117
- // Append — preserve all user content, add a separator if file had content
118
- const sep = existing.length > 0 && !existing.endsWith("\n\n")
119
- ? (existing.endsWith("\n") ? "\n" : "\n\n")
120
- : "";
121
- const next = existing + sep + FULL_BLOCK + "\n";
122
- atomicWrite(path, next);
123
- return { action: existing.length === 0 ? "created" : "appended", path };
124
- }
125
-
126
- // Replace existing block (handle upgrade-in-place)
127
- const currentBlock = existing.slice(block.start, block.end);
128
- if (currentBlock === FULL_BLOCK) {
129
- return { action: "unchanged", path };
130
- }
131
- const next =
132
- existing.slice(0, block.start) + FULL_BLOCK + existing.slice(block.end);
133
- atomicWrite(path, next);
134
- return { action: "upgraded", path };
135
- }
136
-
137
- /**
138
- * Remove the protocol block from ~/.claude/CLAUDE.md.
139
- * @returns {{action:"removed"|"not-present"|"no-file", path:string}}
140
- */
141
- export function removeGlobalProtocols() {
142
- const path = GLOBAL_CLAUDE_MD;
143
- if (!existsSync(path)) return { action: "no-file", path };
144
-
145
- const existing = readGlobalMd();
146
- const block = findBlock(existing);
147
- if (!block) return { action: "not-present", path };
148
-
149
- // Trim leading/trailing whitespace adjacent to the block
150
- let start = block.start;
151
- let end = block.end;
152
- // Eat one trailing newline if present
153
- if (existing[end] === "\n") end++;
154
- // Eat one leading newline if previous char is also newline (collapse blank lines)
155
- if (start > 0 && existing[start - 1] === "\n" && existing[start - 2] === "\n") {
156
- start--;
157
- }
158
-
159
- const next = existing.slice(0, start) + existing.slice(end);
160
- atomicWrite(path, next);
161
- return { action: "removed", path };
162
- }
package/cli/registry.js DELETED
@@ -1,123 +0,0 @@
1
- /**
2
- * Single source of truth for recommended companion plugins.
3
- *
4
- * Background: before this file existed, the list of recommended plugins lived
5
- * in FOUR independent places (install.js, uninstall.js, upgrade.js,
6
- * doctor.js). They drifted — chrome-devtools-mcp was added to install.js
7
- * during the beta.8 MCP decoupling but forgotten in the other three,
8
- * making it installable but uninstallable. This registry exists so adding
9
- * or removing a plugin is a one-file change.
10
- *
11
- * Every consumer pulls what it needs via property access:
12
- * - install.js → marketplaceSource + installSpec + hint (+ optional postInstall)
13
- * - uninstall.js → uninstallSpec + uninstallArgs + marketplaceId
14
- * - upgrade.js → updateSpec + marketplaceId
15
- * - doctor.js → id + installSpec (for health checks and recovery hints)
16
- */
17
-
18
- export const RECOMMENDED_PLUGINS = [
19
- {
20
- name: "pua",
21
- id: "pua@pua-skills",
22
- marketplaceSource: "tanweai/pua",
23
- marketplaceId: "pua-skills",
24
- installSpec: "pua@pua-skills",
25
- uninstallSpec: "pua@pua-skills",
26
- updateSpec: "pua@pua-skills",
27
- scope: "user",
28
- hint: "no-give-up + three red lines",
29
- },
30
- {
31
- name: "claude-mem",
32
- id: "claude-mem@thedotmack",
33
- marketplaceSource: "thedotmack/claude-mem",
34
- marketplaceId: "thedotmack",
35
- installSpec: "claude-mem@thedotmack",
36
- uninstallSpec: "claude-mem@thedotmack",
37
- updateSpec: "claude-mem@thedotmack",
38
- uninstallArgs: ["--keep-data"],
39
- scope: "user",
40
- hint: "automatic cross-session memory",
41
- postInstall: "claude-mem-runtimes",
42
- },
43
- {
44
- name: "frontend-design",
45
- id: "frontend-design@claude-plugins-official",
46
- marketplaceSource: "anthropics/claude-plugins-official",
47
- marketplaceId: "claude-plugins-official",
48
- installSpec: "frontend-design@claude-plugins-official",
49
- uninstallSpec: "frontend-design@claude-plugins-official",
50
- updateSpec: "frontend-design@claude-plugins-official",
51
- scope: "user",
52
- hint: "Anthropic official UI skill",
53
- },
54
- {
55
- name: "chrome-devtools-mcp",
56
- id: "chrome-devtools-mcp@chrome-devtools-plugins",
57
- marketplaceSource: "ChromeDevTools/chrome-devtools-mcp",
58
- marketplaceId: "chrome-devtools-plugins",
59
- installSpec: "chrome-devtools-mcp@chrome-devtools-plugins",
60
- uninstallSpec: "chrome-devtools-mcp@chrome-devtools-plugins",
61
- updateSpec: "chrome-devtools-mcp@chrome-devtools-plugins",
62
- scope: "user",
63
- hint: "Chrome DevTools + Puppeteer (Google official)",
64
- },
65
- ];
66
-
67
- export const REQUIRED_PLUGINS = [
68
- {
69
- name: "context7-plugin",
70
- id: "context7-plugin@context7-marketplace",
71
- marketplaceSource: "upstash/context7",
72
- marketplaceId: "context7-marketplace",
73
- installSpec: "context7-plugin@context7-marketplace",
74
- uninstallSpec: "context7-plugin@context7-marketplace",
75
- updateSpec: "context7-plugin@context7-marketplace",
76
- scope: "user",
77
- hint: "official Context7 plugin (MCP + skill + docs-researcher agent + /context7:docs)",
78
- requiresConfig: true,
79
- configType: "apiKey",
80
- },
81
- ];
82
-
83
- /**
84
- * MCP servers that curdx-flow depends on for its core discipline rules and
85
- * still registers directly. Starting beta.12 these are registered at
86
- * USER-LEVEL via `claude mcp add` instead of plugin.json bundling, so:
87
- *
88
- * - Tool names stay standard (mcp__sequential-thinking__*)
89
- * — matching every agent's and knowledge doc's hardcoded references.
90
- *
91
- * Context7 is installed via Upstash's official Claude Code plugin instead
92
- * of direct `claude mcp add`: context7-plugin@context7-marketplace includes
93
- * the MCP server, skill, docs-researcher agent, and /context7:docs command.
94
- */
95
- export const BUNDLED_MCPS = [
96
- {
97
- name: "sequential-thinking",
98
- command: "npx",
99
- args: ["-y", "@modelcontextprotocol/server-sequential-thinking"],
100
- purpose: "structured reasoning for design / review (L2 Mandatory Tool)",
101
- preserveExisting: true,
102
- },
103
- ];
104
-
105
- /**
106
- * Marketplaces to refresh during `upgrade`. Derived from RECOMMENDED_PLUGINS
107
- * plus the curdx-flow marketplace itself.
108
- */
109
- export const MARKETPLACES_TO_REFRESH = [
110
- "curdx-flow-marketplace",
111
- ...REQUIRED_PLUGINS.map((p) => p.marketplaceId),
112
- ...RECOMMENDED_PLUGINS.map((p) => p.marketplaceId),
113
- ];
114
-
115
- /**
116
- * Plugin install specs to update during `upgrade` — includes curdx-flow
117
- * itself plus every recommended plugin.
118
- */
119
- export const PLUGINS_TO_UPDATE = [
120
- "curdx-flow@curdx-flow-marketplace",
121
- ...REQUIRED_PLUGINS.map((p) => p.updateSpec),
122
- ...RECOMMENDED_PLUGINS.map((p) => p.updateSpec),
123
- ];
package/cli/router.js DELETED
@@ -1,49 +0,0 @@
1
- import { doctor } from "./doctor.js";
2
- import { install } from "./install.js";
3
- import { uninstall } from "./uninstall.js";
4
- import { upgrade } from "./upgrade.js";
5
- import { printHelp } from "./help.js";
6
- import { VERSION, color } from "./utils.js";
7
-
8
- export async function runCli(args = process.argv.slice(2)) {
9
- const cmd = args[0];
10
- const rest = args.slice(1);
11
-
12
- if (cmd === "--version" || cmd === "-v") {
13
- console.log(VERSION);
14
- return;
15
- }
16
-
17
- if (!cmd || cmd === "--help" || cmd === "-h") {
18
- printHelp();
19
- return;
20
- }
21
-
22
- try {
23
- switch (cmd) {
24
- case "install":
25
- await install(rest);
26
- break;
27
- case "doctor":
28
- await doctor(rest);
29
- break;
30
- case "upgrade":
31
- await upgrade(rest);
32
- break;
33
- case "uninstall":
34
- case "remove":
35
- await uninstall(rest);
36
- break;
37
- default:
38
- console.error(color.red(`Unknown command: ${cmd}`));
39
- console.error(`Run ${color.cyan("npx @curdx/flow --help")} for CLI usage.`);
40
- process.exit(1);
41
- }
42
- } catch (err) {
43
- console.error(color.red(`\n✗ ${err.message || err}`));
44
- if (process.env.CURDX_DEBUG) {
45
- console.error(err.stack || "");
46
- }
47
- process.exit(1);
48
- }
49
- }