@dccxx/auggiegw 1.0.20 → 1.0.21

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.
Files changed (3) hide show
  1. package/CLAUDE.md +6 -1
  2. package/dist/cli.js +38 -2
  3. package/package.json +1 -1
package/CLAUDE.md CHANGED
@@ -108,18 +108,23 @@ The `switch-account` command:
108
108
  - Switches to the account at index `currentIndex - 1` (the newer one)
109
109
  - After switching, calls `handleFetch({ authOnly: true, deleteSession: true })`
110
110
 
111
- ### Prompt File Format (lines 305-319)
111
+ ### Prompt File Format (lines 310-320)
112
112
 
113
113
  Prompts are saved as markdown with YAML frontmatter:
114
114
 
115
115
  ```markdown
116
116
  ---
117
117
  description: {prompt.name}
118
+ type: "manual"
118
119
  ---
119
120
 
120
121
  {prompt.content}
121
122
  ```
122
123
 
124
+ ### Auto-Fix Commands on Fetch
125
+
126
+ When running `fetch` (without `--auth-only`), the CLI automatically fixes existing command files by adding `type: "manual"` if missing. This happens after authentication and before the success message.
127
+
123
128
  ### Authentication Token Resolution (lines 197-205)
124
129
 
125
130
  `getAuthToken()` checks environment variable `AUGGIEGW_AUTH_TOKEN` first, then falls back to reading from `~/.auggiegw/auth.json`.
package/dist/cli.js CHANGED
@@ -2325,6 +2325,7 @@ async function savePromptToFile(prompt) {
2325
2325
  await fs.mkdir(AUGMENT_COMMANDS_DIR, { recursive: true });
2326
2326
  const markdownContent = `---
2327
2327
  description: ${prompt.name}
2328
+ type: "manual"
2328
2329
  ---
2329
2330
 
2330
2331
  ${prompt.content}`;
@@ -2347,6 +2348,35 @@ async function deleteAllCommandFiles() {
2347
2348
  }
2348
2349
  return mdFiles.length;
2349
2350
  }
2351
+ async function fixCommandFiles() {
2352
+ try {
2353
+ await fs.access(AUGMENT_COMMANDS_DIR);
2354
+ } catch {
2355
+ return 0;
2356
+ }
2357
+ const files = await fs.readdir(AUGMENT_COMMANDS_DIR);
2358
+ const mdFiles = files.filter((file) => file.endsWith(".md"));
2359
+ let updatedCount = 0;
2360
+ for (const file of mdFiles) {
2361
+ const filePath = path.join(AUGMENT_COMMANDS_DIR, file);
2362
+ const content = await fs.readFile(filePath, "utf-8");
2363
+ if (content.startsWith("---")) {
2364
+ const endOfFrontmatter = content.indexOf("---", 3);
2365
+ if (endOfFrontmatter !== -1) {
2366
+ const frontmatter = content.substring(0, endOfFrontmatter + 3);
2367
+ const body = content.substring(endOfFrontmatter + 3);
2368
+ if (!frontmatter.includes("type:")) {
2369
+ const updatedFrontmatter = frontmatter.replace(/^(---\n(?:.*\n)*?)(description:[^\n]*\n)/m, `$1$2type: "manual"
2370
+ `);
2371
+ const updatedContent = updatedFrontmatter + body;
2372
+ await fs.writeFile(filePath, updatedContent, "utf-8");
2373
+ updatedCount++;
2374
+ }
2375
+ }
2376
+ }
2377
+ }
2378
+ return updatedCount;
2379
+ }
2350
2380
  async function promptInput(question, hidden = false) {
2351
2381
  const rl = readline.createInterface({
2352
2382
  input: process.stdin,
@@ -2593,7 +2623,13 @@ async function handleFetch(options) {
2593
2623
  spinner.warn(`Deleted ${deletedCount} commands, no new prompts found`);
2594
2624
  }
2595
2625
  } else {
2596
- spinner.succeed("Authentication successful (use --refresh-commands to update prompts)");
2626
+ spinner.text = "Fixing existing command files...";
2627
+ const fixedCount = await fixCommandFiles();
2628
+ if (fixedCount > 0) {
2629
+ spinner.succeed(`Authentication successful, fixed ${fixedCount} command file(s) with type: "manual"`);
2630
+ } else {
2631
+ spinner.succeed("Authentication successful (use --refresh-commands to update prompts)");
2632
+ }
2597
2633
  }
2598
2634
  }
2599
2635
  } catch (error) {
@@ -2693,4 +2729,4 @@ program2.command("exec <command> [args...]").description("Execute any custom com
2693
2729
  program2.command("switch-account").description("Switch to a newer account from the purchased account list").action(handleSwitchAccount);
2694
2730
  program2.parse();
2695
2731
 
2696
- //# debugId=B34B485639FF8F0864756E2164756E21
2732
+ //# debugId=64FF217361AEBDF264756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dccxx/auggiegw",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "A Node.js TypeScript package",
5
5
  "main": "./dist/cli.js",
6
6
  "types": "./dist/cli.d.ts",