@dalzoubi/dev-agents-sync 1.0.7 → 1.0.9
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 +89 -0
- package/package.json +1 -1
- package/tests/paths.test.mjs +14 -0
- package/tests/writer-normalize.test.mjs +4 -0
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# @dalzoubi/dev-agents-sync
|
|
2
|
+
|
|
3
|
+
CLI for syncing managed dev-agent prompts from `dalzoubi/dev-agents` into consumer repositories for Claude Code and Cursor.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Run with `npx` from the root of the repo that should receive the agent files:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx --yes @dalzoubi/dev-agents-sync@1 init --targets claude,cursor
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The CLI requires Node.js 20 or newer.
|
|
14
|
+
|
|
15
|
+
## Authentication
|
|
16
|
+
|
|
17
|
+
The source repository is private, so the CLI needs a GitHub token that can read `dalzoubi/dev-agents`.
|
|
18
|
+
|
|
19
|
+
Authentication is resolved in this order:
|
|
20
|
+
|
|
21
|
+
1. `--token <token>`
|
|
22
|
+
2. `GITHUB_TOKEN`
|
|
23
|
+
3. `gh auth token`
|
|
24
|
+
|
|
25
|
+
For local use, authenticate with the GitHub CLI:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
gh auth login
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
For CI, set `GITHUB_TOKEN` or a repo secret such as `DEV_AGENTS_TOKEN`.
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
Initialize a consumer repo:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx --yes @dalzoubi/dev-agents-sync@1 init --targets claude
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This writes managed files into `.claude/` and creates `.dev-agents-sync.json` with the resolved content version.
|
|
42
|
+
Use `--targets cursor` or `--targets claude,cursor` to install Cursor project agents, rules, and slash commands into `.cursor/agents/`, `.cursor/rules/`, and `.cursor/commands/`.
|
|
43
|
+
|
|
44
|
+
Update to the latest matching content version:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx --yes @dalzoubi/dev-agents-sync@1 update
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Check whether managed files are in sync:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx --yes @dalzoubi/dev-agents-sync@1 check
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Show the expected diff without writing files:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx --yes @dalzoubi/dev-agents-sync@1 diff
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Show lockfile status:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npx --yes @dalzoubi/dev-agents-sync@1 status
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Common Flags
|
|
69
|
+
|
|
70
|
+
- `--targets claude,cursor` selects output targets. Use `claude`, `cursor`, or both.
|
|
71
|
+
- `--range ^1` selects the content version range. The default is `^1`.
|
|
72
|
+
- `--dry-run` prints the planned changes without writing files.
|
|
73
|
+
- `--force` allows overwriting unmanaged file collisions.
|
|
74
|
+
- `--token <token>` passes a GitHub token directly.
|
|
75
|
+
|
|
76
|
+
## Safety
|
|
77
|
+
|
|
78
|
+
Managed files include a marker:
|
|
79
|
+
|
|
80
|
+
```html
|
|
81
|
+
<!-- managed-by: dev-agents-sync vX.Y.Z -->
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The CLI overwrites files with this marker. It refuses to overwrite unmarked files unless `--force` is provided.
|
|
85
|
+
|
|
86
|
+
## License
|
|
87
|
+
|
|
88
|
+
UNLICENSED. This package is proprietary and all rights are reserved.
|
|
89
|
+
|
package/package.json
CHANGED
package/tests/paths.test.mjs
CHANGED
|
@@ -99,6 +99,20 @@ describe('resolveConsumerPath', () => {
|
|
|
99
99
|
assert.equal(result, expected);
|
|
100
100
|
});
|
|
101
101
|
|
|
102
|
+
it('translates "cursor/agents/define.md" to .cursor/agents/define.md', () => {
|
|
103
|
+
const consumerRoot = '/some/repo';
|
|
104
|
+
const result = resolveConsumerPath(consumerRoot, 'cursor/agents/define.md');
|
|
105
|
+
const expected = path.join(consumerRoot, '.cursor', 'agents', 'define.md');
|
|
106
|
+
assert.equal(result, expected);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('translates "cursor/commands/define.md" to .cursor/commands/define.md', () => {
|
|
110
|
+
const consumerRoot = '/some/repo';
|
|
111
|
+
const result = resolveConsumerPath(consumerRoot, 'cursor/commands/define.md');
|
|
112
|
+
const expected = path.join(consumerRoot, '.cursor', 'commands', 'define.md');
|
|
113
|
+
assert.equal(result, expected);
|
|
114
|
+
});
|
|
115
|
+
|
|
102
116
|
it('works with a Windows-style absolute consumer root path', () => {
|
|
103
117
|
// Simulate a Windows-style path
|
|
104
118
|
const consumerRoot = 'C:\\Users\\developer\\projects\\my-app';
|
|
@@ -21,9 +21,13 @@ describe('normalizeFileMap — tolerance + visibility', () => {
|
|
|
21
21
|
const out = normalizeFileMap({
|
|
22
22
|
'claude/agents/define.md': 'A',
|
|
23
23
|
'cursor/rules/x.mdc': 'B',
|
|
24
|
+
'cursor/commands/define.md': 'C',
|
|
25
|
+
'cursor/agents/define.md': 'D',
|
|
24
26
|
});
|
|
25
27
|
assert.equal(out['claude/agents/define.md'], 'A');
|
|
26
28
|
assert.equal(out['cursor/rules/x.mdc'], 'B');
|
|
29
|
+
assert.equal(out['cursor/commands/define.md'], 'C');
|
|
30
|
+
assert.equal(out['cursor/agents/define.md'], 'D');
|
|
27
31
|
});
|
|
28
32
|
|
|
29
33
|
it('infers prefix for known un-prefixed first segments', () => {
|