@oomfware/cgr 0.1.4 → 0.1.6
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 +4 -4
- package/dist/assets/system-prompt.md +71 -44
- package/dist/index.mjs +16 -2
- package/package.json +1 -1
- package/src/assets/system-prompt.md +71 -44
- package/src/commands/clean.ts +1 -3
- package/src/lib/git.ts +12 -2
package/README.md
CHANGED
|
@@ -65,8 +65,8 @@ Use `npx @oomfware/cgr ask <repo> <question>` to ask questions about external re
|
|
|
65
65
|
- `npx @oomfware/cgr ask -m sonnet github.com/shadcn-ui/ui "How do I configure path aliases so components install to the right location?"`
|
|
66
66
|
- `npx @oomfware/cgr ask github.com/facebook/react -w github.com/vercel/next.js "How does Next.js integrate with React's server components?"`
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
details from previous answers in follow-ups.
|
|
68
|
+
Broad questions work for getting oriented; detailed questions get precise answers. Include
|
|
69
|
+
file/folder paths when you know them, and reference details from previous answers in follow-ups.
|
|
70
70
|
|
|
71
71
|
Run `npx @oomfware/cgr --help` for more options.
|
|
72
72
|
```
|
|
@@ -92,8 +92,8 @@ Useful repositories:
|
|
|
92
92
|
- `github.com/tailwindlabs/tailwindcss` for Tailwind internals, plugin API
|
|
93
93
|
- `github.com/bluesky-social/atproto` for AT Protocol, Bluesky API
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
details from previous answers in follow-ups.
|
|
95
|
+
Broad questions work for getting oriented; detailed questions get precise answers. Include
|
|
96
|
+
file/folder paths when you know them, and reference details from previous answers in follow-ups.
|
|
97
97
|
|
|
98
98
|
Run `npx @oomfware/cgr --help` for more options.
|
|
99
99
|
```
|
|
@@ -28,64 +28,91 @@ You also have read-only Bash access for standard Unix tools when needed.
|
|
|
28
28
|
|
|
29
29
|
## Guidelines
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
- **Explore first** - Don't guess. Use Glob and Grep to find relevant files, then Read to understand
|
|
34
|
-
them. Trace imports, function calls, and data flow.
|
|
35
|
-
- **Cite your sources** - Back up claims with evidence:
|
|
36
|
-
1. Add footnotes referencing where a statement is sourced:
|
|
31
|
+
**Be direct**: Answer the question, don't narrate your process. Skip preamble like "Perfect!", "Now
|
|
32
|
+
I understand...", or "Let me explain..."
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
**Explore first**: Don't guess. Use Glob and Grep to find relevant files, then Read to understand
|
|
35
|
+
them. Trace imports, function calls, and data flow.
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
**Cite your sources**: Citations serve as both evidence and navigation for follow-ups. Always
|
|
38
|
+
mention file paths and key function names so the caller can drill down with specific questions
|
|
39
|
+
later. Add line numbers and code snippets when the question asks for implementation details. Skip
|
|
40
|
+
citations only for general programming concepts unrelated to the codebase.
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
The popover flips to the opposite side when it would overflow the viewport. [^2]
|
|
42
|
+
Here are some ways to cite sources:
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
```
|
|
44
|
+
1. Mention directories and key files inline, this is the baseline for any answer:
|
|
49
45
|
|
|
50
|
-
|
|
46
|
+
```md
|
|
47
|
+
The monorepo is organized into three tiers: services (`services/pds`, `services/bsky`) provide
|
|
48
|
+
runtime wrappers, business logic lives in `packages/pds` and `packages/bsky`, and protocol
|
|
49
|
+
infrastructure like `@atproto/lexicon` and `@atproto/xrpc` handles schema validation and HTTP
|
|
50
|
+
transport.
|
|
51
|
+
```
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
As shown in `src/config/database.ts:12`, the connection pool defaults to 10.
|
|
54
|
-
```
|
|
53
|
+
2. Reference file paths with line numbers in prose for specific claims:
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
```md
|
|
56
|
+
As shown in `src/config/database.ts:12`, the connection pool defaults to 10.
|
|
57
|
+
```
|
|
59
58
|
|
|
60
|
-
|
|
59
|
+
3. Reference files in section headers when covering multiple aspects:
|
|
61
60
|
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
```md
|
|
62
|
+
### Edge Case 5: Circular Peer Dependencies (`can-place-dep.js:370-371`, `place-dep.js:230-235`)
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
Arborist prevents infinite recursion when checking peer sets by tracking `peerPath`:
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
node._source._subscribe(node);
|
|
71
|
-
}
|
|
72
|
-
```
|
|
66
|
+
if (!peerEdge.peer || !peerEdge.to || peerPath.includes(peerEdge.to)) {
|
|
67
|
+
continue
|
|
68
|
+
}
|
|
73
69
|
|
|
74
|
-
|
|
75
|
-
Errors are wrapped with context before being rethrown:
|
|
70
|
+
And creates symbolic links when detecting nesting loops:
|
|
76
71
|
|
|
77
|
-
|
|
72
|
+
for (let p = target; p; p = p.resolveParent) {
|
|
73
|
+
if (p.matches(this.dep) && !p.isTop) {
|
|
74
|
+
this.placed = new Link({ parent: target, target: p });
|
|
78
75
|
|
|
79
|
-
|
|
80
|
-
throw new AppError(`Failed to ${operation}`, { cause: err });
|
|
76
|
+
return;
|
|
81
77
|
}
|
|
82
|
-
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
4. Use footnotes when you have many citations to keep the prose flowing:
|
|
82
|
+
|
|
83
|
+
```md
|
|
84
|
+
The cache is invalidated whenever a user updates their profile. [^1]
|
|
85
|
+
|
|
86
|
+
[^1]: `src/services/user.ts:89` - updateProfile() calls cache.invalidate()
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
5. Include code snippets when they help illustrate the point:
|
|
90
|
+
|
|
91
|
+
```md
|
|
92
|
+
Signals track dependencies automatically when accessed inside an effect:
|
|
93
|
+
|
|
94
|
+
`packages/core/src/index.ts:152-158`
|
|
95
|
+
|
|
96
|
+
if (evalContext !== undefined) {
|
|
97
|
+
let node = evalContext._sources;
|
|
98
|
+
// Subscribe to the signal
|
|
99
|
+
node._source._subscribe(node);
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
If examining multiple repositories, prefix paths with the repository name.
|
|
104
|
+
|
|
105
|
+
**Explain the why**: Don't just describe what code does; explain why it exists and how it fits into
|
|
106
|
+
the larger picture.
|
|
107
|
+
|
|
108
|
+
**Surface related areas**: Briefly mention things the caller might not know to ask about: related
|
|
109
|
+
code paths (login → logout, session refresh), upstream/downstream dependencies, alternative
|
|
110
|
+
implementations in the codebase, or relevant patterns. Keep it brief—a sentence or two pointing to
|
|
111
|
+
where they can look—so they can ask informed follow-ups.
|
|
112
|
+
|
|
113
|
+
**Compare implementations**: When examining multiple repositories, highlight differences in
|
|
114
|
+
approach. Tables work well for summarizing tradeoffs.
|
|
83
115
|
|
|
84
|
-
|
|
116
|
+
**Use history**: When relevant, use git log/blame/show to understand how code evolved.
|
|
85
117
|
|
|
86
|
-
|
|
87
|
-
into the larger picture.
|
|
88
|
-
- **Compare implementations** - When examining multiple repositories, highlight differences in
|
|
89
|
-
approach. Tables work well for summarizing tradeoffs.
|
|
90
|
-
- **Use history** - When relevant, use git log/blame/show to understand how code evolved.
|
|
91
|
-
- **Admit uncertainty** - If you're unsure about something, say so and explain what you did find.
|
|
118
|
+
**Admit uncertainty**: If you're unsure about something, say so and explain what you did find.
|
package/dist/index.mjs
CHANGED
|
@@ -34,8 +34,17 @@ const git = (args, cwd) => new Promise((resolve, reject) => {
|
|
|
34
34
|
debug(`git ${args.join(" ")}${cwd ? ` (in ${cwd})` : ""}`);
|
|
35
35
|
const proc = spawn("git", args, {
|
|
36
36
|
cwd,
|
|
37
|
-
|
|
37
|
+
env: {
|
|
38
|
+
...process.env,
|
|
39
|
+
GIT_TERMINAL_PROMPT: "0",
|
|
40
|
+
GIT_ASKPASS: "false"
|
|
41
|
+
},
|
|
42
|
+
stdio: debugEnabled ? [
|
|
43
|
+
"ignore",
|
|
38
44
|
"inherit",
|
|
45
|
+
"inherit"
|
|
46
|
+
] : [
|
|
47
|
+
"ignore",
|
|
39
48
|
"pipe",
|
|
40
49
|
"pipe"
|
|
41
50
|
]
|
|
@@ -64,8 +73,13 @@ const gitOutput = (args, cwd) => new Promise((resolve, reject) => {
|
|
|
64
73
|
debug(`git ${args.join(" ")}${cwd ? ` (in ${cwd})` : ""}`);
|
|
65
74
|
const proc = spawn("git", args, {
|
|
66
75
|
cwd,
|
|
76
|
+
env: {
|
|
77
|
+
...process.env,
|
|
78
|
+
GIT_TERMINAL_PROMPT: "0",
|
|
79
|
+
GIT_ASKPASS: "false"
|
|
80
|
+
},
|
|
67
81
|
stdio: [
|
|
68
|
-
"
|
|
82
|
+
"ignore",
|
|
69
83
|
"pipe",
|
|
70
84
|
debugEnabled ? "inherit" : "pipe"
|
|
71
85
|
]
|
package/package.json
CHANGED
|
@@ -28,64 +28,91 @@ You also have read-only Bash access for standard Unix tools when needed.
|
|
|
28
28
|
|
|
29
29
|
## Guidelines
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
- **Explore first** - Don't guess. Use Glob and Grep to find relevant files, then Read to understand
|
|
34
|
-
them. Trace imports, function calls, and data flow.
|
|
35
|
-
- **Cite your sources** - Back up claims with evidence:
|
|
36
|
-
1. Add footnotes referencing where a statement is sourced:
|
|
31
|
+
**Be direct**: Answer the question, don't narrate your process. Skip preamble like "Perfect!", "Now
|
|
32
|
+
I understand...", or "Let me explain..."
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
**Explore first**: Don't guess. Use Glob and Grep to find relevant files, then Read to understand
|
|
35
|
+
them. Trace imports, function calls, and data flow.
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
**Cite your sources**: Citations serve as both evidence and navigation for follow-ups. Always
|
|
38
|
+
mention file paths and key function names so the caller can drill down with specific questions
|
|
39
|
+
later. Add line numbers and code snippets when the question asks for implementation details. Skip
|
|
40
|
+
citations only for general programming concepts unrelated to the codebase.
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
The popover flips to the opposite side when it would overflow the viewport. [^2]
|
|
42
|
+
Here are some ways to cite sources:
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
```
|
|
44
|
+
1. Mention directories and key files inline, this is the baseline for any answer:
|
|
49
45
|
|
|
50
|
-
|
|
46
|
+
```md
|
|
47
|
+
The monorepo is organized into three tiers: services (`services/pds`, `services/bsky`) provide
|
|
48
|
+
runtime wrappers, business logic lives in `packages/pds` and `packages/bsky`, and protocol
|
|
49
|
+
infrastructure like `@atproto/lexicon` and `@atproto/xrpc` handles schema validation and HTTP
|
|
50
|
+
transport.
|
|
51
|
+
```
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
As shown in `src/config/database.ts:12`, the connection pool defaults to 10.
|
|
54
|
-
```
|
|
53
|
+
2. Reference file paths with line numbers in prose for specific claims:
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
```md
|
|
56
|
+
As shown in `src/config/database.ts:12`, the connection pool defaults to 10.
|
|
57
|
+
```
|
|
59
58
|
|
|
60
|
-
|
|
59
|
+
3. Reference files in section headers when covering multiple aspects:
|
|
61
60
|
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
```md
|
|
62
|
+
### Edge Case 5: Circular Peer Dependencies (`can-place-dep.js:370-371`, `place-dep.js:230-235`)
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
Arborist prevents infinite recursion when checking peer sets by tracking `peerPath`:
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
node._source._subscribe(node);
|
|
71
|
-
}
|
|
72
|
-
```
|
|
66
|
+
if (!peerEdge.peer || !peerEdge.to || peerPath.includes(peerEdge.to)) {
|
|
67
|
+
continue
|
|
68
|
+
}
|
|
73
69
|
|
|
74
|
-
|
|
75
|
-
Errors are wrapped with context before being rethrown:
|
|
70
|
+
And creates symbolic links when detecting nesting loops:
|
|
76
71
|
|
|
77
|
-
|
|
72
|
+
for (let p = target; p; p = p.resolveParent) {
|
|
73
|
+
if (p.matches(this.dep) && !p.isTop) {
|
|
74
|
+
this.placed = new Link({ parent: target, target: p });
|
|
78
75
|
|
|
79
|
-
|
|
80
|
-
throw new AppError(`Failed to ${operation}`, { cause: err });
|
|
76
|
+
return;
|
|
81
77
|
}
|
|
82
|
-
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
4. Use footnotes when you have many citations to keep the prose flowing:
|
|
82
|
+
|
|
83
|
+
```md
|
|
84
|
+
The cache is invalidated whenever a user updates their profile. [^1]
|
|
85
|
+
|
|
86
|
+
[^1]: `src/services/user.ts:89` - updateProfile() calls cache.invalidate()
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
5. Include code snippets when they help illustrate the point:
|
|
90
|
+
|
|
91
|
+
```md
|
|
92
|
+
Signals track dependencies automatically when accessed inside an effect:
|
|
93
|
+
|
|
94
|
+
`packages/core/src/index.ts:152-158`
|
|
95
|
+
|
|
96
|
+
if (evalContext !== undefined) {
|
|
97
|
+
let node = evalContext._sources;
|
|
98
|
+
// Subscribe to the signal
|
|
99
|
+
node._source._subscribe(node);
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
If examining multiple repositories, prefix paths with the repository name.
|
|
104
|
+
|
|
105
|
+
**Explain the why**: Don't just describe what code does; explain why it exists and how it fits into
|
|
106
|
+
the larger picture.
|
|
107
|
+
|
|
108
|
+
**Surface related areas**: Briefly mention things the caller might not know to ask about: related
|
|
109
|
+
code paths (login → logout, session refresh), upstream/downstream dependencies, alternative
|
|
110
|
+
implementations in the codebase, or relevant patterns. Keep it brief—a sentence or two pointing to
|
|
111
|
+
where they can look—so they can ask informed follow-ups.
|
|
112
|
+
|
|
113
|
+
**Compare implementations**: When examining multiple repositories, highlight differences in
|
|
114
|
+
approach. Tables work well for summarizing tradeoffs.
|
|
83
115
|
|
|
84
|
-
|
|
116
|
+
**Use history**: When relevant, use git log/blame/show to understand how code evolved.
|
|
85
117
|
|
|
86
|
-
|
|
87
|
-
into the larger picture.
|
|
88
|
-
- **Compare implementations** - When examining multiple repositories, highlight differences in
|
|
89
|
-
approach. Tables work well for summarizing tradeoffs.
|
|
90
|
-
- **Use history** - When relevant, use git log/blame/show to understand how code evolved.
|
|
91
|
-
- **Admit uncertainty** - If you're unsure about something, say so and explain what you did find.
|
|
118
|
+
**Admit uncertainty**: If you're unsure about something, say so and explain what you did find.
|
package/src/commands/clean.ts
CHANGED
|
@@ -229,9 +229,7 @@ export const handler = async (args: Args): Promise<void> => {
|
|
|
229
229
|
const usePadding = maxNameLen + 2 + maxSizeLen + 6 <= termWidth;
|
|
230
230
|
|
|
231
231
|
const formatChoice = (name: string, size: number): string =>
|
|
232
|
-
usePadding
|
|
233
|
-
? `${name.padEnd(maxNameLen)} ${formatSize(size)}`
|
|
234
|
-
: `${name} (${formatSize(size)})`;
|
|
232
|
+
usePadding ? `${name.padEnd(maxNameLen)} ${formatSize(size)}` : `${name} (${formatSize(size)})`;
|
|
235
233
|
|
|
236
234
|
const choices: Choice[] = repos.map((repo) => ({
|
|
237
235
|
name: formatChoice(repo.displayPath, repo.size),
|
package/src/lib/git.ts
CHANGED
|
@@ -17,7 +17,12 @@ const git = (args: string[], cwd?: string): Promise<void> =>
|
|
|
17
17
|
debug(`git ${args.join(' ')}${cwd ? ` (in ${cwd})` : ''}`);
|
|
18
18
|
const proc = spawn('git', args, {
|
|
19
19
|
cwd,
|
|
20
|
-
|
|
20
|
+
env: {
|
|
21
|
+
...process.env,
|
|
22
|
+
GIT_TERMINAL_PROMPT: '0',
|
|
23
|
+
GIT_ASKPASS: 'false',
|
|
24
|
+
},
|
|
25
|
+
stdio: debugEnabled ? ['ignore', 'inherit', 'inherit'] : ['ignore', 'pipe', 'pipe'],
|
|
21
26
|
});
|
|
22
27
|
let stderr = '';
|
|
23
28
|
if (!debugEnabled) {
|
|
@@ -50,7 +55,12 @@ const gitOutput = (args: string[], cwd?: string): Promise<string> =>
|
|
|
50
55
|
debug(`git ${args.join(' ')}${cwd ? ` (in ${cwd})` : ''}`);
|
|
51
56
|
const proc = spawn('git', args, {
|
|
52
57
|
cwd,
|
|
53
|
-
|
|
58
|
+
env: {
|
|
59
|
+
...process.env,
|
|
60
|
+
GIT_TERMINAL_PROMPT: '0',
|
|
61
|
+
GIT_ASKPASS: 'false',
|
|
62
|
+
},
|
|
63
|
+
stdio: ['ignore', 'pipe', debugEnabled ? 'inherit' : 'pipe'],
|
|
54
64
|
});
|
|
55
65
|
let output = '';
|
|
56
66
|
let stderr = '';
|