@oomfware/cgr 0.1.3 → 0.1.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/dist/assets/system-prompt.md +2 -0
- package/dist/index.mjs +14 -6
- package/package.json +1 -1
- package/src/assets/system-prompt.md +2 -0
- package/src/commands/ask.ts +1 -1
- package/src/commands/clean.ts +30 -3
|
@@ -28,6 +28,8 @@ You also have read-only Bash access for standard Unix tools when needed.
|
|
|
28
28
|
|
|
29
29
|
## Guidelines
|
|
30
30
|
|
|
31
|
+
- **Be direct** - Answer the question, don't narrate your process. Skip preamble like "Perfect!",
|
|
32
|
+
"Now I understand...", or "Let me explain..."
|
|
31
33
|
- **Explore first** - Don't guess. Use Glob and Grep to find relevant files, then Read to understand
|
|
32
34
|
them. Trace imports, function calls, and data flow.
|
|
33
35
|
- **Cite your sources** - Back up claims with evidence:
|
package/dist/index.mjs
CHANGED
|
@@ -382,7 +382,7 @@ const spawnClaude = (cwd, contextPrompt, args) => new Promise((resolve, reject)
|
|
|
382
382
|
"--append-system-prompt",
|
|
383
383
|
contextPrompt
|
|
384
384
|
];
|
|
385
|
-
console.error("
|
|
385
|
+
console.error("summoning claude...");
|
|
386
386
|
const claude = spawn("claude", claudeArgs, {
|
|
387
387
|
cwd,
|
|
388
388
|
stdio: "inherit"
|
|
@@ -587,17 +587,25 @@ const handler = async (args) => {
|
|
|
587
587
|
console.log("no cached data found");
|
|
588
588
|
return;
|
|
589
589
|
}
|
|
590
|
+
const maxNameLen = Math.max(...repos.map((r) => r.displayPath.length), sessionsExist ? 10 : 0);
|
|
591
|
+
const maxSizeLen = Math.max(...repos.map((r) => formatSize(r.size).length), sessionsExist ? formatSize(sessionsSize).length : 0);
|
|
592
|
+
const termWidth = process.stdout.columns ?? 80;
|
|
593
|
+
const usePadding = maxNameLen + 2 + maxSizeLen + 6 <= termWidth;
|
|
594
|
+
const formatChoice = (name, size) => usePadding ? `${name.padEnd(maxNameLen)} ${formatSize(size)}` : `${name} (${formatSize(size)})`;
|
|
590
595
|
const choices = repos.map((repo) => ({
|
|
591
|
-
name:
|
|
592
|
-
value: repo.path
|
|
596
|
+
name: formatChoice(repo.displayPath, repo.size),
|
|
597
|
+
value: repo.path,
|
|
598
|
+
short: repo.displayPath
|
|
593
599
|
}));
|
|
594
600
|
if (sessionsExist && sessionsSize > 0) choices.push({
|
|
595
|
-
name:
|
|
596
|
-
value: sessionsDir
|
|
601
|
+
name: formatChoice("(sessions)", sessionsSize),
|
|
602
|
+
value: sessionsDir,
|
|
603
|
+
short: "(sessions)"
|
|
597
604
|
});
|
|
598
605
|
const selected = await checkbox({
|
|
599
606
|
message: "select items to remove",
|
|
600
|
-
choices
|
|
607
|
+
choices,
|
|
608
|
+
pageSize: 20
|
|
601
609
|
});
|
|
602
610
|
if (selected.length === 0) return;
|
|
603
611
|
let totalSize = 0;
|
package/package.json
CHANGED
|
@@ -28,6 +28,8 @@ You also have read-only Bash access for standard Unix tools when needed.
|
|
|
28
28
|
|
|
29
29
|
## Guidelines
|
|
30
30
|
|
|
31
|
+
- **Be direct** - Answer the question, don't narrate your process. Skip preamble like "Perfect!",
|
|
32
|
+
"Now I understand...", or "Let me explain..."
|
|
31
33
|
- **Explore first** - Don't guess. Use Glob and Grep to find relevant files, then Read to understand
|
|
32
34
|
them. Trace imports, function calls, and data flow.
|
|
33
35
|
- **Cite your sources** - Back up claims with evidence:
|
package/src/commands/ask.ts
CHANGED
|
@@ -133,7 +133,7 @@ const spawnClaude = (cwd: string, contextPrompt: string, args: Args): Promise<nu
|
|
|
133
133
|
contextPrompt,
|
|
134
134
|
];
|
|
135
135
|
|
|
136
|
-
console.error('
|
|
136
|
+
console.error('summoning claude...');
|
|
137
137
|
const claude = spawn('claude', claudeArgs, {
|
|
138
138
|
cwd,
|
|
139
139
|
stdio: 'inherit',
|
package/src/commands/clean.ts
CHANGED
|
@@ -21,6 +21,12 @@ export const schema = object({
|
|
|
21
21
|
|
|
22
22
|
export type Args = InferValue<typeof schema>;
|
|
23
23
|
|
|
24
|
+
type Choice = {
|
|
25
|
+
name: string;
|
|
26
|
+
value: string;
|
|
27
|
+
short: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
24
30
|
/**
|
|
25
31
|
* checks if a path exists.
|
|
26
32
|
* @param path the path to check
|
|
@@ -209,21 +215,42 @@ export const handler = async (args: Args): Promise<void> => {
|
|
|
209
215
|
}
|
|
210
216
|
|
|
211
217
|
// build choices for checkbox
|
|
212
|
-
const
|
|
213
|
-
|
|
218
|
+
const maxNameLen = Math.max(
|
|
219
|
+
...repos.map((r) => r.displayPath.length),
|
|
220
|
+
sessionsExist ? '(sessions)'.length : 0,
|
|
221
|
+
);
|
|
222
|
+
const maxSizeLen = Math.max(
|
|
223
|
+
...repos.map((r) => formatSize(r.size).length),
|
|
224
|
+
sessionsExist ? formatSize(sessionsSize).length : 0,
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
// checkbox prefix is ~4 chars, leave some margin
|
|
228
|
+
const termWidth = process.stdout.columns ?? 80;
|
|
229
|
+
const usePadding = maxNameLen + 2 + maxSizeLen + 6 <= termWidth;
|
|
230
|
+
|
|
231
|
+
const formatChoice = (name: string, size: number): string =>
|
|
232
|
+
usePadding
|
|
233
|
+
? `${name.padEnd(maxNameLen)} ${formatSize(size)}`
|
|
234
|
+
: `${name} (${formatSize(size)})`;
|
|
235
|
+
|
|
236
|
+
const choices: Choice[] = repos.map((repo) => ({
|
|
237
|
+
name: formatChoice(repo.displayPath, repo.size),
|
|
214
238
|
value: repo.path,
|
|
239
|
+
short: repo.displayPath,
|
|
215
240
|
}));
|
|
216
241
|
|
|
217
242
|
if (sessionsExist && sessionsSize > 0) {
|
|
218
243
|
choices.push({
|
|
219
|
-
name:
|
|
244
|
+
name: formatChoice('(sessions)', sessionsSize),
|
|
220
245
|
value: sessionsDir,
|
|
246
|
+
short: '(sessions)',
|
|
221
247
|
});
|
|
222
248
|
}
|
|
223
249
|
|
|
224
250
|
const selected = await checkbox({
|
|
225
251
|
message: 'select items to remove',
|
|
226
252
|
choices,
|
|
253
|
+
pageSize: 20,
|
|
227
254
|
});
|
|
228
255
|
|
|
229
256
|
if (selected.length === 0) {
|