@sparkleideas/claude-flow-patch 3.1.0-alpha.44.patch.10
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/AGENTS.md +162 -0
- package/CLAUDE.md +506 -0
- package/README.md +351 -0
- package/bin/claude-flow-patch.mjs +148 -0
- package/check-patches.sh +195 -0
- package/lib/categories.json +15 -0
- package/lib/common.py +97 -0
- package/lib/discover.mjs +181 -0
- package/lib/discover.sh +160 -0
- package/package.json +86 -0
- package/patch/010-CF-001-doctor-yaml/README.md +11 -0
- package/patch/010-CF-001-doctor-yaml/fix.py +20 -0
- package/patch/010-CF-001-doctor-yaml/sentinel +1 -0
- package/patch/020-CF-002-config-export-yaml/README.md +11 -0
- package/patch/020-CF-002-config-export-yaml/fix.py +130 -0
- package/patch/020-CF-002-config-export-yaml/sentinel +1 -0
- package/patch/030-DM-001-daemon-log-zero/README.md +12 -0
- package/patch/030-DM-001-daemon-log-zero/fix.py +37 -0
- package/patch/030-DM-001-daemon-log-zero/sentinel +1 -0
- package/patch/040-DM-002-cpu-load-threshold/README.md +11 -0
- package/patch/040-DM-002-cpu-load-threshold/fix.py +6 -0
- package/patch/040-DM-002-cpu-load-threshold/sentinel +1 -0
- package/patch/050-DM-003-macos-freemem/README.md +11 -0
- package/patch/050-DM-003-macos-freemem/fix.py +7 -0
- package/patch/050-DM-003-macos-freemem/sentinel +1 -0
- package/patch/060-DM-004-preload-worker-stub/README.md +11 -0
- package/patch/060-DM-004-preload-worker-stub/fix.py +34 -0
- package/patch/060-DM-004-preload-worker-stub/sentinel +1 -0
- package/patch/070-DM-005-consolidation-worker-stub/README.md +11 -0
- package/patch/070-DM-005-consolidation-worker-stub/fix.py +46 -0
- package/patch/070-DM-005-consolidation-worker-stub/sentinel +1 -0
- package/patch/080-EM-001-embedding-ignores-config/README.md +11 -0
- package/patch/080-EM-001-embedding-ignores-config/fix.py +111 -0
- package/patch/080-EM-001-embedding-ignores-config/sentinel +1 -0
- package/patch/090-EM-002-transformers-cache-eacces/README.md +11 -0
- package/patch/090-EM-002-transformers-cache-eacces/fix.sh +12 -0
- package/patch/090-EM-002-transformers-cache-eacces/sentinel +1 -0
- package/patch/100-GV-001-hnsw-ghost-vectors/README.md +11 -0
- package/patch/100-GV-001-hnsw-ghost-vectors/fix.py +34 -0
- package/patch/100-GV-001-hnsw-ghost-vectors/sentinel +1 -0
- package/patch/110-HK-001-post-edit-file-path/README.md +44 -0
- package/patch/110-HK-001-post-edit-file-path/fix.py +23 -0
- package/patch/110-HK-001-post-edit-file-path/sentinel +1 -0
- package/patch/120-HK-002-hooks-tools-stub/README.md +36 -0
- package/patch/120-HK-002-hooks-tools-stub/fix.py +155 -0
- package/patch/120-HK-002-hooks-tools-stub/sentinel +1 -0
- package/patch/130-HK-003-metrics-hardcoded/README.md +30 -0
- package/patch/130-HK-003-metrics-hardcoded/fix.py +82 -0
- package/patch/130-HK-003-metrics-hardcoded/sentinel +1 -0
- package/patch/135-HK-004-respect-daemon-autostart/README.md +11 -0
- package/patch/135-HK-004-respect-daemon-autostart/fix.py +14 -0
- package/patch/135-HK-004-respect-daemon-autostart/sentinel +1 -0
- package/patch/137-HK-005-daemon-pid-guard/README.md +11 -0
- package/patch/137-HK-005-daemon-pid-guard/fix.py +53 -0
- package/patch/137-HK-005-daemon-pid-guard/sentinel +2 -0
- package/patch/140-HW-001-stdin-hang/README.md +11 -0
- package/patch/140-HW-001-stdin-hang/fix.py +6 -0
- package/patch/140-HW-001-stdin-hang/sentinel +1 -0
- package/patch/150-HW-002-failures-swallowed/README.md +11 -0
- package/patch/150-HW-002-failures-swallowed/fix.py +42 -0
- package/patch/150-HW-002-failures-swallowed/sentinel +1 -0
- package/patch/160-HW-003-aggressive-intervals/README.md +11 -0
- package/patch/160-HW-003-aggressive-intervals/fix.py +52 -0
- package/patch/160-HW-003-aggressive-intervals/sentinel +3 -0
- package/patch/170-IN-001-intelligence-stub/README.md +64 -0
- package/patch/170-IN-001-intelligence-stub/fix.py +63 -0
- package/patch/170-IN-001-intelligence-stub/sentinel +1 -0
- package/patch/180-MM-001-memory-persist-path/README.md +27 -0
- package/patch/180-MM-001-memory-persist-path/fix.py +54 -0
- package/patch/180-MM-001-memory-persist-path/sentinel +1 -0
- package/patch/190-NS-001-discovery-default-namespace/README.md +16 -0
- package/patch/190-NS-001-discovery-default-namespace/fix.py +68 -0
- package/patch/190-NS-001-discovery-default-namespace/sentinel +2 -0
- package/patch/200-NS-002-targeted-require-namespace/README.md +19 -0
- package/patch/200-NS-002-targeted-require-namespace/fix.py +158 -0
- package/patch/200-NS-002-targeted-require-namespace/sentinel +2 -0
- package/patch/210-NS-003-namespace-typo-pattern/README.md +15 -0
- package/patch/210-NS-003-namespace-typo-pattern/fix.py +23 -0
- package/patch/210-NS-003-namespace-typo-pattern/sentinel +1 -0
- package/patch/220-RS-001-better-sqlite3-node24/README.md +54 -0
- package/patch/220-RS-001-better-sqlite3-node24/fix.py +27 -0
- package/patch/220-RS-001-better-sqlite3-node24/rebuild.sh +31 -0
- package/patch/220-RS-001-better-sqlite3-node24/sentinel +2 -0
- package/patch/230-RV-001-force-learn-tick/README.md +31 -0
- package/patch/230-RV-001-force-learn-tick/fix.py +14 -0
- package/patch/230-RV-001-force-learn-tick/sentinel +2 -0
- package/patch/240-RV-002-trajectory-load/README.md +28 -0
- package/patch/240-RV-002-trajectory-load/fix.py +14 -0
- package/patch/240-RV-002-trajectory-load/sentinel +2 -0
- package/patch/250-RV-003-trajectory-stats-sync/README.md +31 -0
- package/patch/250-RV-003-trajectory-stats-sync/fix.py +18 -0
- package/patch/250-RV-003-trajectory-stats-sync/sentinel +2 -0
- package/patch/260-SG-001-init-settings/README.md +29 -0
- package/patch/260-SG-001-init-settings/fix.py +143 -0
- package/patch/260-SG-001-init-settings/sentinel +4 -0
- package/patch/270-SG-003-init-helpers-all-paths/README.md +60 -0
- package/patch/270-SG-003-init-helpers-all-paths/fix.py +165 -0
- package/patch/270-SG-003-init-helpers-all-paths/sentinel +3 -0
- package/patch/280-UI-001-intelligence-stats-crash/README.md +11 -0
- package/patch/280-UI-001-intelligence-stats-crash/fix.py +57 -0
- package/patch/280-UI-001-intelligence-stats-crash/sentinel +1 -0
- package/patch/290-UI-002-neural-status-not-loaded/README.md +11 -0
- package/patch/290-UI-002-neural-status-not-loaded/fix.py +19 -0
- package/patch/290-UI-002-neural-status-not-loaded/sentinel +1 -0
- package/patch/300-DM-006-log-rotation/README.md +12 -0
- package/patch/300-DM-006-log-rotation/fix.py +72 -0
- package/patch/300-DM-006-log-rotation/sentinel +2 -0
- package/patch/310-HW-004-runwithtimeout-orphan/README.md +11 -0
- package/patch/310-HW-004-runwithtimeout-orphan/fix.py +10 -0
- package/patch/310-HW-004-runwithtimeout-orphan/sentinel +1 -0
- package/patch/320-SG-004-wizard-parity/README.md +40 -0
- package/patch/320-SG-004-wizard-parity/fix.py +208 -0
- package/patch/320-SG-004-wizard-parity/sentinel +3 -0
- package/patch/330-SG-005-start-all-subcommand/README.md +32 -0
- package/patch/330-SG-005-start-all-subcommand/fix.py +58 -0
- package/patch/330-SG-005-start-all-subcommand/sentinel +1 -0
- package/patch-all.sh +199 -0
- package/repair-post-init.sh +263 -0
- package/scripts/preflight.mjs +249 -0
- package/scripts/upstream-log.mjs +257 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# @sparkleideas/claude-flow-patch
|
|
2
|
+
|
|
3
|
+
> Runtime patches for `@claude-flow/cli` v3.1.0-alpha.41, `ruvector`, and `ruv-swarm` v1.0.20
|
|
4
|
+
|
|
5
|
+
**Claude Code instructions are in [CLAUDE.md](CLAUDE.md). Project-specific instructions (defect index, workflows, policies) are in [README.md](README.md).**
|
|
6
|
+
|
|
7
|
+
## Project Overview
|
|
8
|
+
|
|
9
|
+
A Claude Flow powered project
|
|
10
|
+
|
|
11
|
+
**Tech Stack**: Python (patches), Bash (orchestration)
|
|
12
|
+
**Architecture**: Idempotent runtime patching via string replacement
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
### Apply Patches
|
|
17
|
+
```bash
|
|
18
|
+
bash patch-all.sh
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Verify
|
|
22
|
+
```bash
|
|
23
|
+
bash check-patches.sh
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Agent Coordination
|
|
27
|
+
|
|
28
|
+
### Swarm Configuration
|
|
29
|
+
|
|
30
|
+
This project uses hierarchical swarm coordination for complex tasks:
|
|
31
|
+
|
|
32
|
+
| Setting | Value | Purpose |
|
|
33
|
+
|---------|-------|---------|
|
|
34
|
+
| Topology | `hierarchical` | Queen-led coordination (anti-drift) |
|
|
35
|
+
| Max Agents | 8 | Optimal team size |
|
|
36
|
+
| Strategy | `specialized` | Clear role boundaries |
|
|
37
|
+
| Consensus | `raft` | Leader-based consistency |
|
|
38
|
+
|
|
39
|
+
### When to Use Swarms
|
|
40
|
+
|
|
41
|
+
**Invoke swarm for:**
|
|
42
|
+
- Multi-file changes (3+ files)
|
|
43
|
+
- New feature implementation
|
|
44
|
+
- Cross-module refactoring
|
|
45
|
+
- API changes with tests
|
|
46
|
+
- Security-related changes
|
|
47
|
+
- Performance optimization
|
|
48
|
+
|
|
49
|
+
**Skip swarm for:**
|
|
50
|
+
- Single file edits
|
|
51
|
+
- Simple bug fixes (1-2 lines)
|
|
52
|
+
- Documentation updates
|
|
53
|
+
- Configuration changes
|
|
54
|
+
|
|
55
|
+
### Available Skills
|
|
56
|
+
|
|
57
|
+
Use `$skill-name` syntax to invoke:
|
|
58
|
+
|
|
59
|
+
| Skill | Use Case |
|
|
60
|
+
|-------|----------|
|
|
61
|
+
| `$swarm-orchestration` | Multi-agent task coordination |
|
|
62
|
+
| `$memory-management` | Pattern storage and retrieval |
|
|
63
|
+
| `$sparc-methodology` | Structured development workflow |
|
|
64
|
+
| `$security-audit` | Security scanning and CVE detection |
|
|
65
|
+
|
|
66
|
+
### Agent Types
|
|
67
|
+
|
|
68
|
+
| Type | Role | Use Case |
|
|
69
|
+
|------|------|----------|
|
|
70
|
+
| `researcher` | Requirements analysis | Understanding scope |
|
|
71
|
+
| `architect` | System design | Planning structure |
|
|
72
|
+
| `coder` | Implementation | Writing code |
|
|
73
|
+
| `tester` | Test creation | Quality assurance |
|
|
74
|
+
| `reviewer` | Code review | Security and quality |
|
|
75
|
+
|
|
76
|
+
## Code Standards
|
|
77
|
+
|
|
78
|
+
### File Organization
|
|
79
|
+
- **NEVER** save to root folder
|
|
80
|
+
- `/src` - Source code files
|
|
81
|
+
- `/tests` - Test files
|
|
82
|
+
- `/docs` - Documentation
|
|
83
|
+
- `/config` - Configuration files
|
|
84
|
+
|
|
85
|
+
### Quality Rules
|
|
86
|
+
- Files under 500 lines
|
|
87
|
+
- No hardcoded secrets
|
|
88
|
+
- Input validation at boundaries
|
|
89
|
+
- Typed interfaces for public APIs
|
|
90
|
+
- TDD London School (mock-first) preferred
|
|
91
|
+
|
|
92
|
+
### Commit Messages
|
|
93
|
+
```
|
|
94
|
+
<type>(<scope>): <description>
|
|
95
|
+
|
|
96
|
+
[optional body]
|
|
97
|
+
|
|
98
|
+
Sparkling Ideas <henrik@sparklingideas.co.uk>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `chore`
|
|
102
|
+
|
|
103
|
+
## Security
|
|
104
|
+
|
|
105
|
+
### Critical Rules
|
|
106
|
+
- NEVER commit secrets, credentials, or .env files
|
|
107
|
+
- NEVER hardcode API keys
|
|
108
|
+
- Always validate user input
|
|
109
|
+
- Use parameterized queries for SQL
|
|
110
|
+
- Sanitize output to prevent XSS
|
|
111
|
+
|
|
112
|
+
### Path Security
|
|
113
|
+
- Validate all file paths
|
|
114
|
+
- Prevent directory traversal (../)
|
|
115
|
+
- Use absolute paths internally
|
|
116
|
+
|
|
117
|
+
## Memory System
|
|
118
|
+
|
|
119
|
+
### Storing Patterns
|
|
120
|
+
```bash
|
|
121
|
+
npx @claude-flow/cli memory store \
|
|
122
|
+
--key "pattern-name" \
|
|
123
|
+
--value "pattern description" \
|
|
124
|
+
--namespace patterns
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Searching Memory
|
|
128
|
+
```bash
|
|
129
|
+
npx @claude-flow/cli memory search \
|
|
130
|
+
--query "search terms" \
|
|
131
|
+
--namespace patterns
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Links
|
|
135
|
+
|
|
136
|
+
- Documentation: https://github.com/ruvnet/claude-flow
|
|
137
|
+
- Issues: https://github.com/ruvnet/claude-flow/issues
|
|
138
|
+
|
|
139
|
+
## Guidance Lifecycle Wiring (Codex)
|
|
140
|
+
|
|
141
|
+
Codex does not expose Claude Code-style event-command hook maps in `config.toml`.
|
|
142
|
+
This project uses an explicit bridge script:
|
|
143
|
+
|
|
144
|
+
- `scripts/guidance-codex-bridge.js` -> dispatches lifecycle events to:
|
|
145
|
+
- `.claude/helpers/hook-handler.cjs` (enforcement path)
|
|
146
|
+
- optional `npx @claude-flow/cli@latest hooks ...` telemetry calls
|
|
147
|
+
|
|
148
|
+
Primary commands:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
npm run guidance:codex:session-start
|
|
152
|
+
npm run guidance:codex:pre-task -- --description "Implement feature X"
|
|
153
|
+
npm run guidance:codex:pre-command -- --command "git status"
|
|
154
|
+
npm run guidance:codex:pre-edit -- --file src/example.ts
|
|
155
|
+
npm run guidance:codex:post-edit -- --file src/example.ts
|
|
156
|
+
npm run guidance:codex:post-task -- --task-id task-123 --status completed
|
|
157
|
+
npm run guidance:codex:session-end
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Control flags:
|
|
161
|
+
- `--skip-cf-hooks` skips secondary `@claude-flow/cli` hook invocations
|
|
162
|
+
- `GUIDANCE_CODEX_SKIP_CF_HOOKS=1` disables secondary invocations globally
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
# @sparkleideas/claude-flow-patch
|
|
2
|
+
|
|
3
|
+
Runtime patches for `@claude-flow/cli` **v3.1.0-alpha.41**, `ruvector`, and `ruv-swarm` **v1.0.20**.
|
|
4
|
+
|
|
5
|
+
## Terminology
|
|
6
|
+
|
|
7
|
+
| Term | Meaning | Example |
|
|
8
|
+
|------|---------|---------|
|
|
9
|
+
| **Defect** | A tracked problem (bug or missing feature). Each defect has its own directory under `patch/` with a README.md and fix.py. | "Defect HW-001", "29 defects across 13 categories" |
|
|
10
|
+
| **Patch** | The code change that addresses a defect. Implemented as `fix.py` (or `fix.sh`) using `patch()`/`patch_all()` calls. We patch because we can't fix upstream. | "fix.py contains 3 patch ops" |
|
|
11
|
+
| **GitHub issue** | The upstream issue on github.com/ruvnet/claude-flow. Always say "GitHub issue", never just "issue". | "GitHub issue #1111" |
|
|
12
|
+
| **Defect ID** | The unique identifier for a defect: `{PREFIX}-{NNN}`. | HW-001, NS-003, RS-001 |
|
|
13
|
+
| **Execution order number** | 3-digit numeric prefix on the directory name that controls patch application order. Spaced by 10 to allow insertions. | `010-`, `170-`, `270-` |
|
|
14
|
+
|
|
15
|
+
- Use **defect** for the tracked problem (the folder, the ID, the concept).
|
|
16
|
+
- Use **patch** for the code change applied to the library (`fix.py`, `patch()`, `patch-all.sh`).
|
|
17
|
+
- Always say **GitHub issue** for the upstream reference -- never bare "issue".
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
|
|
21
|
+
- NEVER modify files inside the npm/npx cache directly -- edit `fix.py` scripts in `patch/`
|
|
22
|
+
- NEVER run individual `fix.py` files standalone -- always use `bash patch-all.sh`
|
|
23
|
+
- NEVER delete a defect without confirming it is truly obsolete -- see "Removing a Defect" below
|
|
24
|
+
- NEVER reuse a defect ID that was previously assigned to a different GitHub issue
|
|
25
|
+
- ONE defect directory and ONE fix.py per GitHub issue -- do not combine multiple GitHub issues into one defect or split one GitHub issue across multiple defects
|
|
26
|
+
- ALWAYS verify with `bash check-patches.sh` after applying
|
|
27
|
+
- ALWAYS run `npm run preflight` before staging — the pre-commit hook (`hooks/pre-commit`) enforces this via `--check` mode
|
|
28
|
+
- ALWAYS update ALL listing files when adding/removing a defect (see checklist)
|
|
29
|
+
- Execution order is determined by the numeric prefix on each defect directory name. Dependencies between defects are expressed by assigning lower numbers to prerequisites.
|
|
30
|
+
|
|
31
|
+
## Project Structure
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
patch-all.sh # Orchestrator -- globs patch/*/fix.py (no hardcoded list)
|
|
35
|
+
check-patches.sh # Sentinel -- reads patch/*/sentinel files dynamically
|
|
36
|
+
repair-post-init.sh # Post-init helper repair for existing projects
|
|
37
|
+
lib/
|
|
38
|
+
common.py # Shared helpers: patch(), patch_all(), path variables
|
|
39
|
+
discover.mjs # Dynamic discovery: scans patch/*/ → structured JSON
|
|
40
|
+
categories.json # Prefix-to-label mapping (one line per category)
|
|
41
|
+
scripts/
|
|
42
|
+
preflight.mjs # Pre-commit sync: doc tables, versions, config (npm run preflight)
|
|
43
|
+
upstream-log.mjs # Show recent upstream releases (npm run upstream-log [count])
|
|
44
|
+
patch/
|
|
45
|
+
{NNN}-{PREFIX}-{NNN}-{slug}/ # NNN = 3-digit execution order
|
|
46
|
+
README.md # Defect report: title, severity, root cause, fix
|
|
47
|
+
fix.py # patch()/patch_all() calls
|
|
48
|
+
sentinel # Verification directives for check-patches.sh
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Target Packages
|
|
52
|
+
|
|
53
|
+
| Package | Version | Location | Env var |
|
|
54
|
+
|---------|---------|----------|---------|
|
|
55
|
+
| `@claude-flow/cli` | `3.1.0-alpha.41` | `~/.npm/_npx/*/node_modules/@claude-flow/cli/dist/src/` | `BASE` |
|
|
56
|
+
| `ruvector` | (bundled) | `~/.npm/_npx/*/node_modules/ruvector/bin/cli.js` | `RUVECTOR_CLI` |
|
|
57
|
+
| `ruv-swarm` | `1.0.20` | `~/.npm/_npx/*/node_modules/ruv-swarm/` | (found via glob) |
|
|
58
|
+
|
|
59
|
+
`BASE` is set by `patch-all.sh`. All path variables in `lib/common.py` derive from it.
|
|
60
|
+
`RUVECTOR_CLI` is set by `patch-all.sh` to the ruvector CLI entry point.
|
|
61
|
+
RS-001 locates its own target via `find`.
|
|
62
|
+
|
|
63
|
+
## GitHub Issue Policy
|
|
64
|
+
|
|
65
|
+
Every defect MUST link to exactly one GitHub issue. No exceptions. One defect = one GitHub issue.
|
|
66
|
+
|
|
67
|
+
### Where the fix description goes
|
|
68
|
+
|
|
69
|
+
The `## Fix` section MUST always be present. Where it lives depends on who created the GitHub issue:
|
|
70
|
+
|
|
71
|
+
| Who created the issue? | Where does `## Fix` go? |
|
|
72
|
+
|------------------------|------------------------|
|
|
73
|
+
| **sparkling** (us) | In the **issue body** — edit the issue to include `## Fix` |
|
|
74
|
+
| **Someone else** | In a **single comment** on the issue — do NOT edit their body |
|
|
75
|
+
|
|
76
|
+
This rule is absolute. Every linked GitHub issue must have a `## Fix` section visible — either in the body (if we created it) or in exactly one comment (if someone else created it).
|
|
77
|
+
|
|
78
|
+
### Before creating a new defect, always search first:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
gh issue list --repo ruvnet/claude-flow --search "<keywords>" --limit 10
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### If an open GitHub issue exists (created by someone else):
|
|
85
|
+
|
|
86
|
+
Post a single comment with the patch details. Do NOT edit the issue body. Do NOT post multiple comments, closing remarks, or history. One clean comment per defect:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
gh issue comment <NUMBER> --repo ruvnet/claude-flow --body "$(cat <<'EOF'
|
|
90
|
+
## Fix
|
|
91
|
+
|
|
92
|
+
Defect **{PREFIX}-{NNN}** in [claude-flow-patch](https://github.com/sparkling/claude-flow-patch).
|
|
93
|
+
|
|
94
|
+
**Root cause:** <1-2 sentences explaining why the bug occurs at the code level>
|
|
95
|
+
|
|
96
|
+
<What the patch does. Be specific. Include a table if multiple ops.>
|
|
97
|
+
|
|
98
|
+
**Affected versions:** `@claude-flow/cli` 3.1.0-alpha.44 through current
|
|
99
|
+
|
|
100
|
+
**Related issues:** #NNN, #NNN
|
|
101
|
+
EOF
|
|
102
|
+
)"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### If no GitHub issue exists (we create it):
|
|
106
|
+
|
|
107
|
+
The `## Fix` section goes directly in the issue body. This is mandatory — sparkling-created issues MUST contain the fix in the body, not in a follow-up comment.
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
gh issue create --repo ruvnet/claude-flow \
|
|
111
|
+
--title "Bug: <short description>" \
|
|
112
|
+
--body "$(cat <<'EOF'
|
|
113
|
+
## Summary
|
|
114
|
+
<1-2 sentences>
|
|
115
|
+
|
|
116
|
+
## Root Cause
|
|
117
|
+
<what's wrong and why>
|
|
118
|
+
|
|
119
|
+
## Fix
|
|
120
|
+
<what the patch does — be specific, include a table if multiple ops>
|
|
121
|
+
|
|
122
|
+
## Files Affected
|
|
123
|
+
- <dist/src/path/to/file.js>
|
|
124
|
+
|
|
125
|
+
## Affected Versions
|
|
126
|
+
`@claude-flow/cli` 3.1.0-alpha.44 through current
|
|
127
|
+
|
|
128
|
+
## Related Issues
|
|
129
|
+
- #NNN — <short description of relationship>
|
|
130
|
+
EOF
|
|
131
|
+
)"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Save the returned GitHub issue number for the defect README.md.
|
|
135
|
+
|
|
136
|
+
### Comment hygiene:
|
|
137
|
+
|
|
138
|
+
- One comment per defect, describing the patch. No meta-commentary.
|
|
139
|
+
- Every comment/body MUST include affected versions and related issues (use "None" if truly standalone).
|
|
140
|
+
- If you need to replace a comment, delete the old one first (`gh api -X DELETE`).
|
|
141
|
+
- Do not reference defect history, deletion/restoration, or internal decisions.
|
|
142
|
+
|
|
143
|
+
## Defect Categories
|
|
144
|
+
|
|
145
|
+
<!-- GENERATED:defect-tables:begin -->
|
|
146
|
+
| Prefix | Category | Count |
|
|
147
|
+
|--------|----------|-------|
|
|
148
|
+
| CF | Config & Doctor | 2 |
|
|
149
|
+
| DM | Daemon & Workers | 6 |
|
|
150
|
+
| EM | Embeddings & HNSW | 2 |
|
|
151
|
+
| GV | Ghost Vectors | 1 |
|
|
152
|
+
| HK | Hooks | 5 |
|
|
153
|
+
| HW | Headless Worker | 4 |
|
|
154
|
+
| IN | Intelligence | 1 |
|
|
155
|
+
| MM | Memory Management | 1 |
|
|
156
|
+
| NS | Memory Namespace | 3 |
|
|
157
|
+
| RS | ruv-swarm | 1 |
|
|
158
|
+
| RV | RuVector Intelligence | 3 |
|
|
159
|
+
| SG | Settings Generator | 4 |
|
|
160
|
+
| UI | Display & Cosmetic | 2 |
|
|
161
|
+
|
|
162
|
+
## All 35 Defects
|
|
163
|
+
|
|
164
|
+
| ID | GitHub Issue | Severity |
|
|
165
|
+
|----|-------------|----------|
|
|
166
|
+
| CF-001 | [#1141 Doctor ignores YAML config files](https://github.com/ruvnet/claude-flow/issues/1141) | Low |
|
|
167
|
+
| CF-002 | [#1142 Config export shows hardcoded defaults](https://github.com/ruvnet/claude-flow/issues/1142) | Medium |
|
|
168
|
+
| DM-001 | [#1116 daemon.log always 0 bytes](https://github.com/ruvnet/claude-flow/issues/1116) | Medium |
|
|
169
|
+
| DM-002 | [#1138 maxCpuLoad=2.0 blocks all workers on multi-core](https://github.com/ruvnet/claude-flow/issues/1138) | Critical |
|
|
170
|
+
| DM-003 | [#1077 macOS freemem() always ~0% — workers blocked](https://github.com/ruvnet/claude-flow/issues/1077) | Critical |
|
|
171
|
+
| DM-004 | [#1139 Preload worker stub + missing from defaults](https://github.com/ruvnet/claude-flow/issues/1139) | Enhancement |
|
|
172
|
+
| DM-005 | [#1140 Consolidation worker stub (no decay/rebuild)](https://github.com/ruvnet/claude-flow/issues/1140) | Enhancement |
|
|
173
|
+
| EM-001 | [#1143 Embedding system ignores project config (model + HNSW dims)](https://github.com/ruvnet/claude-flow/issues/1143) | High |
|
|
174
|
+
| EM-002 | [#1144 @xenova/transformers cache EACCES](https://github.com/ruvnet/claude-flow/issues/1144) | Medium |
|
|
175
|
+
| GV-001 | [#1122 HNSW ghost vectors persist after memory delete](https://github.com/ruvnet/claude-flow/issues/1122) | Medium |
|
|
176
|
+
| HK-001 | [#1155 post-edit hook records file_path as "unknown"](https://github.com/ruvnet/claude-flow/issues/1155) | Medium |
|
|
177
|
+
| HK-002 | [#1058 MCP hook handlers are stubs that don't persist data](https://github.com/ruvnet/claude-flow/issues/1058) | High |
|
|
178
|
+
| HK-003 | [#1158 hooks_metrics MCP handler returns hardcoded fake data](https://github.com/ruvnet/claude-flow/issues/1158) | High |
|
|
179
|
+
| HK-004 | [#1175 hooks_session-start ignores daemon.autoStart from settings.json](https://github.com/ruvnet/claude-flow/issues/1175) | High |
|
|
180
|
+
| HK-005 | [#1171 Multiple MCP servers start independent in-process daemons](https://github.com/ruvnet/claude-flow/issues/1171) | Critical |
|
|
181
|
+
| HW-001 | [#1111 Headless workers hang — stdin pipe never closed](https://github.com/ruvnet/claude-flow/issues/1111) | Critical |
|
|
182
|
+
| HW-002 | [#1112 Headless failures silently swallowed as success](https://github.com/ruvnet/claude-flow/issues/1112) | High |
|
|
183
|
+
| HW-003 | [#1113 Worker scheduling intervals too aggressive + settings ignored](https://github.com/ruvnet/claude-flow/issues/1113) | High |
|
|
184
|
+
| IN-001 | [#1154 intelligence.cjs is a stub that doesn't actually learn](https://github.com/ruvnet/claude-flow/issues/1154) | Critical |
|
|
185
|
+
| MM-001 | [#1152 Remove dead persistPath config option](https://github.com/ruvnet/claude-flow/issues/1152) | Low |
|
|
186
|
+
| NS-001 | [#1123 Discovery ops default to wrong namespace](https://github.com/ruvnet/claude-flow/issues/1123) | Critical |
|
|
187
|
+
| NS-002 | [#581 Store/delete/retrieve fall back to 'default' + accept 'all'](https://github.com/ruvnet/claude-flow/issues/581) | Critical |
|
|
188
|
+
| NS-003 | [#1136 Namespace typo 'pattern' vs 'patterns'](https://github.com/ruvnet/claude-flow/issues/1136) | Medium |
|
|
189
|
+
| RS-001 | [ruv-FANN#185 ruv-swarm MCP fails on Node 24 — better-sqlite3 missing native bindings](https://github.com/ruvnet/ruv-FANN/issues/185) | Critical |
|
|
190
|
+
| RV-001 | [#1156 force-learn command calls intel.tick() which doesn't exist](https://github.com/ruvnet/claude-flow/issues/1156) | Medium |
|
|
191
|
+
| RV-002 | [#1157 activeTrajectories not loaded from saved file](https://github.com/ruvnet/claude-flow/issues/1157) | High |
|
|
192
|
+
| RV-003 | [ruv-FANN#186 trajectory-end does not update stats counters](https://github.com/ruvnet/ruv-FANN/issues/186) | Medium |
|
|
193
|
+
| SG-001 | [#1150 Init generates invalid settings](https://github.com/ruvnet/claude-flow/issues/1150) | High |
|
|
194
|
+
| SG-003 | [#1169 Init missing helpers for --dual, --minimal, hooks, and upgrade paths](https://github.com/ruvnet/claude-flow/issues/1169) | Critical |
|
|
195
|
+
| UI-001 | [#1145 intelligence stats crashes on .toFixed()](https://github.com/ruvnet/claude-flow/issues/1145) | Critical |
|
|
196
|
+
| UI-002 | [#1146 neural status shows "Not loaded"](https://github.com/ruvnet/claude-flow/issues/1146) | Low |
|
|
197
|
+
| DM-006 | [#1114 No log rotation — logs grow unbounded](https://github.com/ruvnet/claude-flow/issues/1114) | Medium |
|
|
198
|
+
| HW-004 | [#1117 runWithTimeout rejects but does not kill child process](https://github.com/ruvnet/claude-flow/issues/1117) | Medium |
|
|
199
|
+
| SG-004 | [#1181 init wizard lacks parity with init](https://github.com/ruvnet/claude-flow/issues/1181) | High |
|
|
200
|
+
| SG-005 | [#1177 add 'start all' subcommand to start everything at once](https://github.com/ruvnet/claude-flow/issues/1177) | Enhancement |
|
|
201
|
+
<!-- GENERATED:defect-tables:end -->
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Creating a New Defect
|
|
206
|
+
|
|
207
|
+
Follow every step. Do not skip any.
|
|
208
|
+
|
|
209
|
+
### Step 1: Find or create a GitHub issue
|
|
210
|
+
|
|
211
|
+
Search first:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
gh issue list --repo ruvnet/claude-flow --search "<keywords>" --limit 10
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
- **GitHub issue exists and is open**: note the number, post a patch comment (see GitHub Issue Policy above).
|
|
218
|
+
- **GitHub issue exists but is closed**: reopen it with a comment explaining why.
|
|
219
|
+
- **No GitHub issue exists**: create one (see GitHub Issue Policy above). Save the returned `#number`.
|
|
220
|
+
|
|
221
|
+
### Step 2: Choose a defect ID
|
|
222
|
+
|
|
223
|
+
Format: `{PREFIX}-{NNN}`
|
|
224
|
+
|
|
225
|
+
- `PREFIX`: 2-letter category code from the table above. Create a new prefix if no existing category fits.
|
|
226
|
+
- `NNN`: next sequential number within that category (e.g. if HK-002 exists, next is HK-003).
|
|
227
|
+
- NEVER reuse an ID previously assigned to a different GitHub issue, even if that defect was deleted.
|
|
228
|
+
|
|
229
|
+
### Step 3: Create the defect directory
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
mkdir -p patch/{ORDER}-{PREFIX}-{NNN}-{slug}/
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
`ORDER`: 3-digit execution order number in 10-increments (e.g. `300`). Choose the next available number. If this defect depends on another, its number must be higher than the dependency's.
|
|
236
|
+
|
|
237
|
+
`slug`: lowercase-kebab-case summary (e.g. `post-edit-file-path`).
|
|
238
|
+
|
|
239
|
+
### Step 4: Write README.md
|
|
240
|
+
|
|
241
|
+
Create `patch/{PREFIX}-{NNN}-{slug}/README.md`:
|
|
242
|
+
|
|
243
|
+
```markdown
|
|
244
|
+
# {PREFIX}-{NNN}: Short title
|
|
245
|
+
|
|
246
|
+
**Severity**: Critical | High | Medium | Low | Enhancement
|
|
247
|
+
**GitHub**: [#{number}](https://github.com/ruvnet/claude-flow/issues/{number})
|
|
248
|
+
|
|
249
|
+
## Root Cause
|
|
250
|
+
|
|
251
|
+
<What's wrong and why. Include code snippets showing the bug.>
|
|
252
|
+
|
|
253
|
+
## Fix
|
|
254
|
+
|
|
255
|
+
<What the patch does. Be specific about each change.>
|
|
256
|
+
|
|
257
|
+
## Files Patched
|
|
258
|
+
|
|
259
|
+
- <relative path from dist/src/ for each file>
|
|
260
|
+
|
|
261
|
+
## Ops
|
|
262
|
+
|
|
263
|
+
<N> ops in fix.py
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Step 5: Write fix.py and sentinel
|
|
267
|
+
|
|
268
|
+
Create `patch/{PREFIX}-{NNN}-{slug}/fix.py` with patch calls:
|
|
269
|
+
|
|
270
|
+
```python
|
|
271
|
+
# {PREFIX}-{NNN}: Short title
|
|
272
|
+
# GitHub: #{number}
|
|
273
|
+
|
|
274
|
+
patch("{PREFIX}-{NNN}a: description of first change",
|
|
275
|
+
TARGET_VAR, # Path variable from lib/common.py
|
|
276
|
+
"""old string""", # Exact string to find (copy-paste from target file)
|
|
277
|
+
"""new string""") # Replacement string
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Create `patch/{PREFIX}-{NNN}-{slug}/sentinel` to declare how `check-patches.sh` verifies this patch:
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
grep "unique_string" path/to/target.js
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**Sentinel directives** (one per line):
|
|
287
|
+
|
|
288
|
+
```
|
|
289
|
+
grep "unique_string" path/to/target.js # String must be present
|
|
290
|
+
absent "old_string" path/to/target.js # String must be absent
|
|
291
|
+
none # No sentinel (e.g. permissions-only)
|
|
292
|
+
package: ruvector # Gate on optional package
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Paths are relative to `@claude-flow/cli/dist/src/` (e.g. `services/worker-daemon.js`, `init/executor.js`). For external packages, add `package: ruvector` or `package: ruv-swarm` and use paths relative to that package root.
|
|
296
|
+
|
|
297
|
+
The sentinel pattern must:
|
|
298
|
+
- Only appear in the target file AFTER the patch is applied
|
|
299
|
+
- Be specific enough not to match unrelated code
|
|
300
|
+
|
|
301
|
+
**Patch API**:
|
|
302
|
+
- `patch(label, filepath, old, new)` -- replace first occurrence only
|
|
303
|
+
- `patch_all(label, filepath, old, new)` -- replace ALL occurrences
|
|
304
|
+
|
|
305
|
+
Both are idempotent: skip if `new` already present, warn if `old` not found.
|
|
306
|
+
|
|
307
|
+
**Path variables** (defined in `lib/common.py`):
|
|
308
|
+
|
|
309
|
+
| Variable | File | Package |
|
|
310
|
+
|----------|------|---------|
|
|
311
|
+
| `HWE` | `services/headless-worker-executor.js` | @claude-flow/cli |
|
|
312
|
+
| `WD` | `services/worker-daemon.js` | @claude-flow/cli |
|
|
313
|
+
| `DJ` | `commands/daemon.js` | @claude-flow/cli |
|
|
314
|
+
| `DOC` | `commands/doctor.js` | @claude-flow/cli |
|
|
315
|
+
| `MI` | `memory/memory-initializer.js` | @claude-flow/cli |
|
|
316
|
+
| `MCP_MEMORY` | `mcp-tools/memory-tools.js` | @claude-flow/cli |
|
|
317
|
+
| `MCP_HOOKS` | `mcp-tools/hooks-tools.js` | @claude-flow/cli |
|
|
318
|
+
| `CLI_MEMORY` | `commands/memory.js` | @claude-flow/cli |
|
|
319
|
+
| `CONF` | `commands/config.js` | @claude-flow/cli |
|
|
320
|
+
| `HOOKS_CMD` | `commands/hooks.js` | @claude-flow/cli |
|
|
321
|
+
| `NEURAL` | `commands/neural.js` | @claude-flow/cli |
|
|
322
|
+
| `EMB_TOOLS` | `mcp-tools/embeddings-tools.js` | @claude-flow/cli |
|
|
323
|
+
| `SETTINGS_GEN` | `init/settings-generator.js` | @claude-flow/cli |
|
|
324
|
+
| `HELPERS_GEN` | `init/helpers-generator.js` | @claude-flow/cli |
|
|
325
|
+
| `EXECUTOR` | `init/executor.js` | @claude-flow/cli |
|
|
326
|
+
| `INIT_CMD` | `commands/init.js` | @claude-flow/cli |
|
|
327
|
+
| `START_CMD` | `commands/start.js` | @claude-flow/cli |
|
|
328
|
+
| `CMDS_INDEX` | `commands/index.js` | @claude-flow/cli |
|
|
329
|
+
| `ruvector_cli` | `bin/cli.js` | ruvector |
|
|
330
|
+
| `ruv_swarm_root` | (package root) | ruv-swarm |
|
|
331
|
+
|
|
332
|
+
To target a new file, add a variable to `lib/common.py` following the existing pattern.
|
|
333
|
+
|
|
334
|
+
### Step 6: Update docs and test
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
# Regenerate all documentation from dynamic discovery
|
|
338
|
+
npm run preflight
|
|
339
|
+
|
|
340
|
+
# Apply -- should show "Applied: ..."
|
|
341
|
+
bash patch-all.sh --global
|
|
342
|
+
|
|
343
|
+
# Idempotency -- should show "0 applied, N already present"
|
|
344
|
+
bash patch-all.sh --global
|
|
345
|
+
|
|
346
|
+
# Sentinel -- should show "OK: All patches verified"
|
|
347
|
+
bash check-patches.sh
|
|
348
|
+
|
|
349
|
+
# Tests
|
|
350
|
+
npm test
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
**No manual edits needed** to `patch-all.sh`, `check-patches.sh`, `README.md`, `CLAUDE.md`, `npm/README.md`, or `npm/config.json`. Dynamic discovery handles everything.
|
|
354
|
+
|
|
355
|
+
### Full Checklist
|
|
356
|
+
|
|
357
|
+
- [ ] GitHub issue exists (searched first, created only if none found)
|
|
358
|
+
- [ ] GitHub issue comment posted with patch details
|
|
359
|
+
- [ ] `patch/{PREFIX}-{NNN}-{slug}/README.md` created with all required sections
|
|
360
|
+
- [ ] `patch/{PREFIX}-{NNN}-{slug}/fix.py` created with `patch()`/`patch_all()` calls
|
|
361
|
+
- [ ] `patch/{PREFIX}-{NNN}-{slug}/sentinel` created with verification directives
|
|
362
|
+
- [ ] Path variable added to `lib/common.py` (if targeting a new file)
|
|
363
|
+
- [ ] If new category prefix: add one line to `lib/categories.json`
|
|
364
|
+
- [ ] `npm run preflight` regenerates all doc tables
|
|
365
|
+
- [ ] `bash patch-all.sh` applies successfully
|
|
366
|
+
- [ ] `bash patch-all.sh` is idempotent (0 applied on re-run)
|
|
367
|
+
- [ ] `bash check-patches.sh` shows OK
|
|
368
|
+
- [ ] Tests added to `03-patch-apply.test.mjs` and `04-idempotency.test.mjs`
|
|
369
|
+
- [ ] `npm test` passes
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## Removing a Defect
|
|
374
|
+
|
|
375
|
+
Before removing any defect:
|
|
376
|
+
|
|
377
|
+
1. Confirm the bug is genuinely fixed upstream or the patch is truly unreachable.
|
|
378
|
+
2. Do NOT remove a defect just because a local workaround exists -- the MCP-level patch may still be needed.
|
|
379
|
+
3. If removing, retire the defect ID permanently. Never reassign a deleted ID to a different GitHub issue.
|
|
380
|
+
4. Run `npm run preflight` to regenerate all documentation.
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## Testing
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
npm test # run all tests
|
|
388
|
+
node --test tests/02-common-library.test.mjs # run one suite
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Uses `node:test` (built-in, zero dependencies). Tests live in `tests/`.
|
|
392
|
+
|
|
393
|
+
| Suite | File | What it covers |
|
|
394
|
+
|-------|------|----------------|
|
|
395
|
+
| CLI dispatch | `01-cli-dispatch.test.mjs` | `--help`, unknown commands, `apply` valid/invalid IDs, `check` delegation |
|
|
396
|
+
| common.py | `02-common-library.test.mjs` | `patch()` apply/skip/warn/idempotent, `patch_all()`, path resolution from `BASE` |
|
|
397
|
+
| Patch apply | `03-patch-apply.test.mjs` | Individual patches (HW-001, DM-002, SG-002) applied against fixtures |
|
|
398
|
+
| Idempotency | `04-idempotency.test.mjs` | Double-apply produces identical files, second run reports skipped |
|
|
399
|
+
| Error handling | `05-error-handling.test.mjs` | Empty `BASE`, `/dev/null`, nonexistent dir, unknown options |
|
|
400
|
+
| Discovery | `06-discovery.test.mjs` | Direct/umbrella/multi-install discovery, deduplication, npx cache roots |
|
|
401
|
+
|
|
402
|
+
### Fixtures
|
|
403
|
+
|
|
404
|
+
`tests/fixtures/cli/dist/src/` mirrors the subset of `@claude-flow/cli` that patches target. Each file contains the exact `old` strings patches search for — just enough for `patch()` to match, not full upstream JS files.
|
|
405
|
+
|
|
406
|
+
`tests/helpers/` provides:
|
|
407
|
+
- `fixture-factory.mjs` — copies fixtures to a temp dir, returns `{ base, cleanup }`
|
|
408
|
+
- `run-cli.mjs` — wraps `spawnSync('node', ['bin/claude-flow-patch.mjs', ...args])`
|
|
409
|
+
- `run-python.mjs` — concatenates `common.py` + `fix.py` and pipes to `python3` with `BASE` set
|
|
410
|
+
|
|
411
|
+
### Adding tests for a new defect
|
|
412
|
+
|
|
413
|
+
1. Ensure `tests/fixtures/cli/dist/src/<target-file>.js` contains the `old` string from the new `fix.py`
|
|
414
|
+
2. Add a row to the `TESTS` array in `03-patch-apply.test.mjs`
|
|
415
|
+
3. Add a row to the `PATCHES` array in `04-idempotency.test.mjs`
|
|
416
|
+
4. Run `npm test`
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## Commands
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
# Apply all patches (default: --global)
|
|
424
|
+
bash patch-all.sh
|
|
425
|
+
|
|
426
|
+
# Patch only the npx cache
|
|
427
|
+
bash patch-all.sh --global
|
|
428
|
+
|
|
429
|
+
# Patch a specific project's node_modules
|
|
430
|
+
bash patch-all.sh --target /path/to/project
|
|
431
|
+
|
|
432
|
+
# Patch both
|
|
433
|
+
bash patch-all.sh --global --target /path/to/project
|
|
434
|
+
|
|
435
|
+
# Verify patches
|
|
436
|
+
bash check-patches.sh
|
|
437
|
+
|
|
438
|
+
# Repair a project initialized before patching
|
|
439
|
+
bash repair-post-init.sh --target /path/to/project
|
|
440
|
+
|
|
441
|
+
# Check target version
|
|
442
|
+
grep '"version"' ~/.npm/_npx/*/node_modules/@claude-flow/cli/package.json
|
|
443
|
+
|
|
444
|
+
# Show recent upstream releases (requires npm; gh optional for commit messages)
|
|
445
|
+
npm run upstream-log # last 10 versions
|
|
446
|
+
npm run upstream-log -- 20 # last 20 versions
|
|
447
|
+
npm run upstream-log -- --diff # also show dependency changes vs baseline
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
### Target Options
|
|
451
|
+
|
|
452
|
+
| Flag | Target | When to use |
|
|
453
|
+
|------|--------|-------------|
|
|
454
|
+
| (none) | Global npx cache (default) | Most common — patches the npx cache |
|
|
455
|
+
| `--global` | `~/.npm/_npx/*/node_modules/` | Explicit global-only |
|
|
456
|
+
| `--target <dir>` | `<dir>/node_modules/` | Project with a local install |
|
|
457
|
+
| `--global --target <dir>` | Both locations | Covers both invocation paths |
|
|
458
|
+
|
|
459
|
+
`npx @claude-flow/cli` uses local `node_modules` if present, otherwise the global npx cache.
|
|
460
|
+
|
|
461
|
+
## Dependency Order
|
|
462
|
+
|
|
463
|
+
Execution order is controlled by the 3-digit numeric prefix on each directory name.
|
|
464
|
+
`patch-all.sh` globs `patch/*/fix.py` which sorts lexicographically, so numeric prefixes
|
|
465
|
+
execute in the correct order automatically.
|
|
466
|
+
|
|
467
|
+
Two dependency chains exist:
|
|
468
|
+
|
|
469
|
+
| Chain | Directories | Reason |
|
|
470
|
+
|-------|-------------|--------|
|
|
471
|
+
| IN-001 -> SG-003 | `170-IN-001-*` before `270-SG-003-*` | SG-003's `old_string` contains code introduced by IN-001 |
|
|
472
|
+
| NS-001 -> NS-002 -> NS-003 | `190-NS-001-*` before `200-NS-002-*` before `210-NS-003-*` | Sequential namespace fixes |
|
|
473
|
+
|
|
474
|
+
All other patches are independent.
|
|
475
|
+
|
|
476
|
+
## Preflight & Pre-Commit Hook
|
|
477
|
+
|
|
478
|
+
A git pre-commit hook at `hooks/pre-commit` runs automatically on every commit. It calls `npm run preflight:check` (read-only) and `npm test`. If anything is stale or tests fail, the commit is blocked.
|
|
479
|
+
|
|
480
|
+
**Setup** (one-time, already done for this clone):
|
|
481
|
+
```bash
|
|
482
|
+
git config core.hooksPath hooks
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
**Before staging**, run:
|
|
486
|
+
```bash
|
|
487
|
+
npm run preflight # Syncs doc tables, defect counts, version strings, config
|
|
488
|
+
npm test # Runs all tests
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
Then `git add -u` to stage the regenerated files.
|
|
492
|
+
|
|
493
|
+
**What `preflight` syncs**:
|
|
494
|
+
- Defect tables in README.md, CLAUDE.md, npm/README.md (from `patch/*/README.md`)
|
|
495
|
+
- Defect counts in `npm/config.json` (from discovery)
|
|
496
|
+
- `npm/config.json` version.current (from `package.json`)
|
|
497
|
+
- Upstream baseline version in prose (from `npm/config.json` targets)
|
|
498
|
+
|
|
499
|
+
Manual edits to generated sections (`<!-- GENERATED:*:begin/end -->`) will be overwritten.
|
|
500
|
+
|
|
501
|
+
## Key Design Decisions
|
|
502
|
+
|
|
503
|
+
- **Idempotent**: `patch()` checks if `new` string is already present before replacing.
|
|
504
|
+
- **Non-destructive**: patches only modify the npx cache, never the npm registry package.
|
|
505
|
+
- **Platform-aware**: DM-003 is macOS-only (auto-skipped on Linux).
|
|
506
|
+
- **Sentinel-guarded**: `check-patches.sh` detects cache wipes and auto-reapplies.
|