@oleksandr.rudnychenko/sync_loop 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +246 -124
- package/bin/cli.js +131 -77
- package/package.json +3 -4
- package/src/init.js +569 -365
- package/src/server.js +289 -208
- package/{template → src/template}/README.md +3 -3
- /package/{template → src/template}/.agent-loop/README.md +0 -0
- /package/{template → src/template}/.agent-loop/feedback.md +0 -0
- /package/{template → src/template}/.agent-loop/glossary.md +0 -0
- /package/{template → src/template}/.agent-loop/patterns/api-standards.md +0 -0
- /package/{template → src/template}/.agent-loop/patterns/code-patterns.md +0 -0
- /package/{template → src/template}/.agent-loop/patterns/refactoring-workflow.md +0 -0
- /package/{template → src/template}/.agent-loop/patterns/testing-guide.md +0 -0
- /package/{template → src/template}/.agent-loop/patterns.md +0 -0
- /package/{template → src/template}/.agent-loop/reasoning-kernel.md +0 -0
- /package/{template → src/template}/.agent-loop/validate-env.md +0 -0
- /package/{template → src/template}/.agent-loop/validate-n.md +0 -0
- /package/{template → src/template}/AGENTS.md +0 -0
- /package/{template → src/template}/bootstrap-prompt.md +0 -0
- /package/{template → src/template}/protocol-summary.md +0 -0
package/README.md
CHANGED
|
@@ -1,124 +1,246 @@
|
|
|
1
|
-
# SyncLoop
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
|
44
|
-
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
|
79
|
-
|
|
80
|
-
| **
|
|
81
|
-
| **
|
|
82
|
-
| **
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
1
|
+
# SyncLoop
|
|
2
|
+
|
|
3
|
+
**Give your AI coding agent a structured reasoning loop.**
|
|
4
|
+
|
|
5
|
+
Without a protocol, AI agents guess — they hallucinate fixes, ignore architecture rules, fail silently, and lose context across a long session. SyncLoop solves this by wiring a strict 7-stage reasoning loop directly into your agent via MCP, so every task goes through sense → plan → act → validate → learn, every turn.
|
|
6
|
+
|
|
7
|
+
Works with **GitHub Copilot**, **Cursor**, and **Claude Code** — any client that supports [Model Context Protocol](https://modelcontextprotocol.io/).
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Why it matters
|
|
12
|
+
|
|
13
|
+
| Without SyncLoop | With SyncLoop |
|
|
14
|
+
|------------------|---------------|
|
|
15
|
+
| Agent jumps straight to coding | Agent senses state and gaps first |
|
|
16
|
+
| Fixes symptoms, not root causes | Diagnoses root cause before patching |
|
|
17
|
+
| Ignores architecture layers | Enforces layer rules on every change |
|
|
18
|
+
| Loses context in long sessions | Compresses and clears context each cycle |
|
|
19
|
+
| Repeats the same mistakes | Learns from failures, persists heuristics |
|
|
20
|
+
| No self-correction on test failures | Retries with targeted patches (max 5 iterations) |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
Add to your MCP client configuration:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"sync_loop": {
|
|
32
|
+
"command": "npx",
|
|
33
|
+
"args": ["-y", "-p", "@oleksandr.rudnychenko/sync_loop", "sync_loop"]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
That's it. Your agent now runs the full SyncLoop protocol on every turn.
|
|
40
|
+
|
|
41
|
+
### Where to add the config
|
|
42
|
+
|
|
43
|
+
| Client | Config location |
|
|
44
|
+
|--------|----------------|
|
|
45
|
+
| **VS Code (Copilot)** | `.vscode/mcp.json` or Settings → MCP Servers |
|
|
46
|
+
| **Cursor** | Settings → MCP Servers |
|
|
47
|
+
| **Claude Desktop** | `claude_desktop_config.json` |
|
|
48
|
+
| **Claude Code** | `claude_code_config.json` or `--mcp-config` flag |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## How the Agent Loop Works
|
|
53
|
+
|
|
54
|
+
Every agent turn runs the same 7-stage loop — no shortcuts:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
SENSE → GKP → DECIDE+ACT → CHALLENGE-TEST → UPDATE → LEARN → REPORT
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Stage by stage
|
|
61
|
+
|
|
62
|
+
**1. SENSE**
|
|
63
|
+
Before touching any code, the agent reads the current codebase state and identifies:
|
|
64
|
+
- what needs to change
|
|
65
|
+
- what could break
|
|
66
|
+
- what context is still missing
|
|
67
|
+
|
|
68
|
+
It will not proceed until it has enough information to act safely.
|
|
69
|
+
|
|
70
|
+
**2. GKP — Generated Knowledge Pack**
|
|
71
|
+
The agent routes through a pattern registry to pull only the constraints, risks, and implementation
|
|
72
|
+
examples relevant to this specific task. Raw files are not carried forward — only a compressed,
|
|
73
|
+
task-scoped context bundle is produced.
|
|
74
|
+
|
|
75
|
+
**3. DECIDE + ACT**
|
|
76
|
+
The agent selects one of three operational modes and executes immediately:
|
|
77
|
+
|
|
78
|
+
| Mode | When | What the agent does |
|
|
79
|
+
|------|------|---------------------|
|
|
80
|
+
| **INTACT-STABILIZE** | System is healthy | Harden types, add tests, improve docs |
|
|
81
|
+
| **BROKEN-EXPAND** | Something is broken | Patch the root cause with minimal surface area |
|
|
82
|
+
| **OVERDENSE-SPLIT** | Code is too complex | Decompose before adding anything new |
|
|
83
|
+
|
|
84
|
+
Plan and action happen in the same step — no plans without execution.
|
|
85
|
+
|
|
86
|
+
**4. CHALLENGE-TEST**
|
|
87
|
+
Two validation gates run in a loop until everything passes or the retry budget runs out (max 5):
|
|
88
|
+
|
|
89
|
+
1. **ENV gate** — type safety, test coverage, layer integrity, complexity thresholds, debug hygiene
|
|
90
|
+
2. **NEIGHBOR gate** — shape compatibility across modules, boundary exports, cross-module contracts
|
|
91
|
+
|
|
92
|
+
Failures are classified before any fix is attempted:
|
|
93
|
+
|
|
94
|
+
| Class | Signal | What happens |
|
|
95
|
+
|-------|--------|--------------|
|
|
96
|
+
| **Micro** | Error text directly explains fix (missing return type, stray `print()`) | Fixed in-place, no budget consumed |
|
|
97
|
+
| **Macro** | Root cause needs diagnosis (test failure, layer violation) | Patch cycle runs, consumes 1 of 5 retries |
|
|
98
|
+
|
|
99
|
+
If the same failure recurs 3 times, the approach is pruned and the agent re-enters planning
|
|
100
|
+
with a hardcoded constraint against repeating it. If it was already pruned once, the agent escalates.
|
|
101
|
+
|
|
102
|
+
**5. UPDATE**
|
|
103
|
+
Once all gates pass, state transitions are committed: changed files, updated contracts, modified patterns.
|
|
104
|
+
|
|
105
|
+
**6. LEARN**
|
|
106
|
+
Lessons from the cycle are persisted so they carry into future turns:
|
|
107
|
+
- Quick fix → added as a row in the auto-fixes or common errors table
|
|
108
|
+
- New reusable approach → written into the matching pattern spec
|
|
109
|
+
|
|
110
|
+
**7. REPORT**
|
|
111
|
+
Non-trivial tasks produce a structured session summary: what changed, which gates passed, what was learned.
|
|
112
|
+
Skipped for trivial one-liners.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Context Compaction
|
|
117
|
+
|
|
118
|
+
Long coding sessions degrade agent quality when too much raw context accumulates.
|
|
119
|
+
SyncLoop actively manages this with two strategies:
|
|
120
|
+
|
|
121
|
+
**State Collapse — after a successful cycle**
|
|
122
|
+
Everything is summarised into a compact checkpoint. Only that checkpoint enters the next SENSE stage.
|
|
123
|
+
Raw history is discarded.
|
|
124
|
+
|
|
125
|
+
**Branch Pruning — on repeated failure**
|
|
126
|
+
When the same error recurs 3 times, the failing approach is reverted and a constraint is recorded:
|
|
127
|
+
"do not retry approach X". The agent re-enters DECIDE with that lesson injected.
|
|
128
|
+
|
|
129
|
+
This keeps the agent sharp in long sessions instead of degrading.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Pattern System
|
|
134
|
+
|
|
135
|
+
SyncLoop routes implementation decisions through a structured registry rather than letting the agent free-associate.
|
|
136
|
+
|
|
137
|
+
### Pattern families
|
|
138
|
+
|
|
139
|
+
| ID | What it covers |
|
|
140
|
+
|----|----------------|
|
|
141
|
+
| **P1–P11** | Port/adapter, domain modules, background tasks, transport routes, dependency injection, typed models, enum safety, error handling, type hints, service orchestration, config isolation |
|
|
142
|
+
| **R1** | 4-phase safe refactoring: plan → execute → validate → document |
|
|
143
|
+
| **R2** | Full test pyramid: unit, integration, API — fixtures, factories, mocks, naming conventions |
|
|
144
|
+
| **R3** | API boundary contracts: typed request/response models, error envelopes, versioning |
|
|
145
|
+
|
|
146
|
+
### How pattern routing works
|
|
147
|
+
|
|
148
|
+
Inside GKP, the agent:
|
|
149
|
+
1. Scans pattern triggers (`"Use when: moving a file"`, `"Use when: adding an endpoint"`)
|
|
150
|
+
2. Routes to the matching spec
|
|
151
|
+
3. Extracts constraints and examples for the active task only
|
|
152
|
+
4. Checks learned tables for known pitfalls and auto-fixes
|
|
153
|
+
5. Compresses to a minimal action context
|
|
154
|
+
|
|
155
|
+
This makes decisions consistent across the session and prevents architecture drift.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Testing Approach
|
|
160
|
+
|
|
161
|
+
Tests are run in order: changed files first → adjacent modules → full suite.
|
|
162
|
+
The agent never modifies tests to make them pass. If a test fails, the source is fixed.
|
|
163
|
+
|
|
164
|
+
**Failure handling:**
|
|
165
|
+
- Missing return types, stray debug calls → fixed inline, no retry budget spent
|
|
166
|
+
- Real test failures or layer violations → root-cause diagnosis → targeted patch → retry gate
|
|
167
|
+
|
|
168
|
+
**Test pyramid targets:** ≥70% unit, ≤20% integration, ≤10% API.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Guardrails
|
|
173
|
+
|
|
174
|
+
The agent is hardcoded never to:
|
|
175
|
+
|
|
176
|
+
- Modify tests to force them green
|
|
177
|
+
- Remove type annotations to silence type errors
|
|
178
|
+
- Bypass architecture layer boundaries
|
|
179
|
+
- Change public APIs or contracts without explicit user approval
|
|
180
|
+
- Mix refactoring with feature changes in the same patch
|
|
181
|
+
- Skip validation after refactors, import moves, or interface changes
|
|
182
|
+
|
|
183
|
+
If any of these are required to proceed, the agent stops and escalates.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## What the MCP server exposes
|
|
188
|
+
|
|
189
|
+
### Resources
|
|
190
|
+
|
|
191
|
+
All protocol docs are served on-demand — the agent pulls only what it needs per stage.
|
|
192
|
+
|
|
193
|
+
| Resource | Content |
|
|
194
|
+
|----------|---------|
|
|
195
|
+
| `reasoning-kernel` | Full 7-stage loop, transition map, stage details, context clearage |
|
|
196
|
+
| `feedback` | Failure diagnosis, patch contract, micro-loop, branch pruning, learning |
|
|
197
|
+
| `validate-env` | Stage 1 gates: types, tests, layers, complexity, debug hygiene |
|
|
198
|
+
| `validate-n` | Stage 2 gates: shape compatibility, boundaries, bridge contracts |
|
|
199
|
+
| `patterns` | Pattern routing index, GKP table, auto-fixes, heuristics, pruning records |
|
|
200
|
+
| `glossary` | Canonical domain terminology and naming rules |
|
|
201
|
+
| `code-patterns` | P1–P11 implementation patterns with examples |
|
|
202
|
+
| `testing-guide` | Full test strategy: pyramid, fixtures, factories, mocks, parametrize |
|
|
203
|
+
| `refactoring-workflow` | 4-phase refactoring checklist |
|
|
204
|
+
| `api-standards` | Boundary contracts: typed models, error envelopes, versioning |
|
|
205
|
+
| `protocol-summary` | Condensed ~50-line overview for system-prompt injection |
|
|
206
|
+
| `agents-md` | AGENTS.md entrypoint template |
|
|
207
|
+
| `overview` | File index and framework overview |
|
|
208
|
+
|
|
209
|
+
### Tools
|
|
210
|
+
|
|
211
|
+
| Tool | Description |
|
|
212
|
+
|------|-------------|
|
|
213
|
+
| `init` | Scaffold platform-specific protocol files into your project |
|
|
214
|
+
|
|
215
|
+
### Prompts
|
|
216
|
+
|
|
217
|
+
| Prompt | Description |
|
|
218
|
+
|--------|-------------|
|
|
219
|
+
| `bootstrap` | Wire SyncLoop to your actual project — scans codebase, populates real commands and architecture |
|
|
220
|
+
| `protocol` | Condensed protocol for direct system-prompt injection |
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Optional: scaffold files into your project
|
|
225
|
+
|
|
226
|
+
For offline use, CI, or customisation, the full protocol can be written into your repo:
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
Use the sync_loop init tool — choose: copilot, cursor, claude, or all
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
| Target | Files generated |
|
|
233
|
+
|--------|----------------|
|
|
234
|
+
| `copilot` | `.github/copilot-instructions.md` + `.github/instructions/*.instructions.md` |
|
|
235
|
+
| `cursor` | `.cursor/rules/*.md` with frontmatter |
|
|
236
|
+
| `claude` | `CLAUDE.md` + `.claude/rules/*.md` |
|
|
237
|
+
| `all` | All of the above + `AGENTS.md` + `.agent-loop/` canonical source |
|
|
238
|
+
|
|
239
|
+
After scaffolding, use the `bootstrap` prompt so the agent scans your codebase and populates
|
|
240
|
+
the generated files with real validation commands, architecture layers, and module boundaries.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## License
|
|
245
|
+
|
|
246
|
+
MIT
|
package/bin/cli.js
CHANGED
|
@@ -1,77 +1,131 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const args = process.argv.slice(2);
|
|
4
|
-
const command = args[0];
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const args = process.argv.slice(2);
|
|
4
|
+
const command = args[0];
|
|
5
|
+
|
|
6
|
+
function getOptionValue(optionName) {
|
|
7
|
+
const idx = args.indexOf(optionName);
|
|
8
|
+
if (idx === -1) return undefined;
|
|
9
|
+
return args[idx + 1];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function getPositionalArgs() {
|
|
13
|
+
const positionals = [];
|
|
14
|
+
for (let i = 1; i < args.length; i += 1) {
|
|
15
|
+
const current = args[i];
|
|
16
|
+
if (current === "--target") {
|
|
17
|
+
i += 1;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (current === "--dry-run" || current === "--overwrite" || current === "--no-overwrite") {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
if (current.startsWith("--")) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
positionals.push(current);
|
|
27
|
+
}
|
|
28
|
+
return positionals;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Help
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
35
|
+
process.stdout.write(`
|
|
36
|
+
sync_loop - MCP server + CLI for the SyncLoop agent reasoning protocol
|
|
37
|
+
|
|
38
|
+
Usage:
|
|
39
|
+
npx -y -p @oleksandr.rudnychenko/sync_loop sync_loop
|
|
40
|
+
Start MCP server (stdio transport)
|
|
41
|
+
|
|
42
|
+
npx -y -p @oleksandr.rudnychenko/sync_loop sync_loop init [projectPath] [--target <platform>] [--dry-run] [--no-overwrite]
|
|
43
|
+
Scaffold files into the project
|
|
44
|
+
|
|
45
|
+
npx -y -p @oleksandr.rudnychenko/sync_loop sync_loop --help
|
|
46
|
+
Show this help
|
|
47
|
+
|
|
48
|
+
Init targets:
|
|
49
|
+
copilot .github/instructions/ + copilot-instructions.md
|
|
50
|
+
cursor .cursor/rules/ with frontmatter
|
|
51
|
+
claude CLAUDE.md + .claude/rules/
|
|
52
|
+
all All of the above (default)
|
|
53
|
+
|
|
54
|
+
Flags:
|
|
55
|
+
--dry-run Preview writes without modifying files
|
|
56
|
+
--no-overwrite Do not overwrite existing generated files
|
|
57
|
+
|
|
58
|
+
MCP Configuration (add to your client settings):
|
|
59
|
+
|
|
60
|
+
{
|
|
61
|
+
"mcpServers": {
|
|
62
|
+
"sync_loop": {
|
|
63
|
+
"command": "npx",
|
|
64
|
+
"args": ["-y", "-p", "@oleksandr.rudnychenko/sync_loop", "sync_loop"]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
Resources: Protocol docs on-demand (reasoning kernel, validation, feedback, patterns)
|
|
70
|
+
Tools: init - scaffold platform-specific files
|
|
71
|
+
Prompts: bootstrap - wire SyncLoop to your project; protocol - reasoning loop
|
|
72
|
+
|
|
73
|
+
https://github.com/oleksandr-rud/SyncLoop
|
|
74
|
+
`);
|
|
75
|
+
process.exit(0);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
// CLI: npx sync_loop init
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
if (command === "init") {
|
|
82
|
+
const target = getOptionValue("--target") ?? "all";
|
|
83
|
+
const dryRun = args.includes("--dry-run");
|
|
84
|
+
const overwrite = args.includes("--no-overwrite") ? false : true;
|
|
85
|
+
const validTargets = ["copilot", "cursor", "claude", "all"];
|
|
86
|
+
|
|
87
|
+
if (!validTargets.includes(target)) {
|
|
88
|
+
process.stderr.write(`Error: unknown target "${target}". Use one of: ${validTargets.join(", ")}\n`);
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const [projectPath] = getPositionalArgs();
|
|
93
|
+
const resolvedProjectPath = projectPath || process.cwd();
|
|
94
|
+
|
|
95
|
+
const { init, detectStacks } = await import("../src/init.js");
|
|
96
|
+
|
|
97
|
+
try {
|
|
98
|
+
const stacks = detectStacks(resolvedProjectPath);
|
|
99
|
+
const result = init(
|
|
100
|
+
resolvedProjectPath,
|
|
101
|
+
target,
|
|
102
|
+
stacks,
|
|
103
|
+
{ dryRun, overwrite },
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
process.stdout.write([
|
|
107
|
+
`SyncLoop initialized for ${target}:`,
|
|
108
|
+
"",
|
|
109
|
+
...result.results,
|
|
110
|
+
"",
|
|
111
|
+
"Detected stacks:",
|
|
112
|
+
...result.stacks.map((stack) => `- ${stack.name}${stack.path ? ` (${stack.path})` : ""}: ${stack.languages.join(", ")} | ${stack.frameworks.join(", ")}`),
|
|
113
|
+
"",
|
|
114
|
+
dryRun
|
|
115
|
+
? "Dry run complete. No files were modified."
|
|
116
|
+
: "Done. Run the bootstrap prompt to wire to your project.",
|
|
117
|
+
"",
|
|
118
|
+
].join("\n"));
|
|
119
|
+
} catch (err) {
|
|
120
|
+
process.stderr.write(`Error: ${err.message}\n`);
|
|
121
|
+
process.exit(1);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
process.exit(0);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
// Default: start MCP server
|
|
129
|
+
// ---------------------------------------------------------------------------
|
|
130
|
+
import("../src/server.js");
|
|
131
|
+
|
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oleksandr.rudnychenko/sync_loop",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MCP server for the SyncLoop agent reasoning protocol — works with Copilot, Cursor, Claude Code",
|
|
6
6
|
"bin": {
|
|
7
|
-
"
|
|
7
|
+
"sync_loop": "./bin/cli.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"bin/",
|
|
11
|
-
"src/"
|
|
12
|
-
"template/"
|
|
11
|
+
"src/"
|
|
13
12
|
],
|
|
14
13
|
"dependencies": {
|
|
15
14
|
"@modelcontextprotocol/sdk": "^1.0.0",
|