@dccxx/auggiegw 1.0.23 → 1.0.24

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/cli.js CHANGED
@@ -2200,6 +2200,9 @@ var AUGMENT_DIR = path.join(os.homedir(), ".augment");
2200
2200
  var AUGMENT_SESSION_FILE = path.join(AUGMENT_DIR, "session.json");
2201
2201
  var AUGMENT_COMMANDS_DIR = path.join(AUGMENT_DIR, "commands");
2202
2202
  var AUGMENT_AGENTS_DIR = path.join(AUGMENT_DIR, "agents");
2203
+ var CLAUDE_DIR = path.join(os.homedir(), ".claude");
2204
+ var CLAUDE_COMMANDS_DIR = path.join(CLAUDE_DIR, "commands");
2205
+ var CLAUDE_AGENTS_DIR = path.join(CLAUDE_DIR, "agents");
2203
2206
  function loadConfig() {
2204
2207
  const apiUrl = process.env.AUGMENT_GATEWAY_URL || "https://augmentgateway.1app.space";
2205
2208
  return { apiUrl };
@@ -2322,18 +2325,30 @@ async function getAllPrompts(token, apiUrl, spinner) {
2322
2325
  return allPrompts;
2323
2326
  }
2324
2327
  async function savePromptToFile(prompt) {
2325
- try {
2326
- await fs.mkdir(AUGMENT_COMMANDS_DIR, { recursive: true });
2327
- const markdownContent = `---
2328
+ const markdownContent = `---
2328
2329
  description: ${prompt.name}
2329
2330
  type: "manual"
2330
2331
  ---
2331
2332
 
2332
2333
  ${prompt.content}`;
2334
+ let augmentError = null;
2335
+ let claudeError = null;
2336
+ try {
2337
+ await fs.mkdir(AUGMENT_COMMANDS_DIR, { recursive: true });
2333
2338
  const filePath = path.join(AUGMENT_COMMANDS_DIR, `${prompt.command}.md`);
2334
2339
  await fs.writeFile(filePath, markdownContent, "utf-8");
2335
2340
  } catch (error) {
2336
- throw new Error(`Failed to save prompt file for command '${prompt.command}': ${error}`);
2341
+ augmentError = new Error(`Failed to save to .augment: ${error}`);
2342
+ }
2343
+ try {
2344
+ await fs.mkdir(CLAUDE_COMMANDS_DIR, { recursive: true });
2345
+ const filePath = path.join(CLAUDE_COMMANDS_DIR, `${prompt.command}.md`);
2346
+ await fs.writeFile(filePath, markdownContent, "utf-8");
2347
+ } catch (error) {
2348
+ claudeError = new Error(`Failed to save to .claude: ${error}`);
2349
+ }
2350
+ if (augmentError && claudeError) {
2351
+ throw new Error(`Failed to save prompt file for command '${prompt.command}': ${augmentError.message}; ${claudeError.message}`);
2337
2352
  }
2338
2353
  }
2339
2354
  async function deleteAllCommandFiles() {
@@ -2363,9 +2378,7 @@ async function getKit(kitId, apiUrl) {
2363
2378
  return data;
2364
2379
  }
2365
2380
  async function saveSubagentToFile(subagent) {
2366
- try {
2367
- await fs.mkdir(AUGMENT_AGENTS_DIR, { recursive: true });
2368
- const markdownContent = `---
2381
+ const markdownContent = `---
2369
2382
  name: "${subagent.name}"
2370
2383
  description: "${subagent.description}"
2371
2384
  model: "${subagent.model}"
@@ -2373,10 +2386,24 @@ color: "${subagent.color}"
2373
2386
  ---
2374
2387
 
2375
2388
  ${subagent.content}`;
2389
+ let augmentError = null;
2390
+ let claudeError = null;
2391
+ try {
2392
+ await fs.mkdir(AUGMENT_AGENTS_DIR, { recursive: true });
2376
2393
  const filePath = path.join(AUGMENT_AGENTS_DIR, `${subagent.name}.md`);
2377
2394
  await fs.writeFile(filePath, markdownContent, "utf-8");
2378
2395
  } catch (error) {
2379
- throw new Error(`Failed to save subagent file for '${subagent.name}': ${error}`);
2396
+ augmentError = new Error(`Failed to save to .augment: ${error}`);
2397
+ }
2398
+ try {
2399
+ await fs.mkdir(CLAUDE_AGENTS_DIR, { recursive: true });
2400
+ const filePath = path.join(CLAUDE_AGENTS_DIR, `${subagent.name}.md`);
2401
+ await fs.writeFile(filePath, markdownContent, "utf-8");
2402
+ } catch (error) {
2403
+ claudeError = new Error(`Failed to save to .claude: ${error}`);
2404
+ }
2405
+ if (augmentError && claudeError) {
2406
+ throw new Error(`Failed to save subagent file for '${subagent.name}': ${augmentError.message}; ${claudeError.message}`);
2380
2407
  }
2381
2408
  }
2382
2409
  async function promptInput(question, hidden = false) {
@@ -2742,7 +2769,8 @@ async function handleKit(kitId) {
2742
2769
  subagentsCount++;
2743
2770
  }
2744
2771
  }
2745
- spinner.succeed(`Successfully installed kit "${kit.name}": ${promptsCount} prompts, ${subagentsCount} subagents`);
2772
+ spinner.succeed(`Successfully installed kit "${kit.name}": ${promptsCount} prompts, ${subagentsCount} subagents
2773
+ Files saved to ~/.augment/ and ~/.claude/ directories`);
2746
2774
  } catch (error) {
2747
2775
  spinner.fail(`Kit fetch failed: ${error}`);
2748
2776
  process.exit(1);
@@ -2771,4 +2799,4 @@ program2.command("switch-account").description("Switch to a newer account from t
2771
2799
  program2.command("kit <kit-id>").description("Fetch and install a kit (prompts and subagents) from the public API").action(handleKit);
2772
2800
  program2.parse();
2773
2801
 
2774
- //# debugId=C5CF051D7C5655BB64756E2164756E21
2802
+ //# debugId=31C1CEB51905863664756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dccxx/auggiegw",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "description": "A Node.js TypeScript package",
5
5
  "main": "./dist/cli.js",
6
6
  "types": "./dist/cli.d.ts",
@@ -0,0 +1,140 @@
1
+ # Kit Command - Requirements
2
+
3
+ ## Feature Overview
4
+
5
+ The `kit` command enables users to fetch and install pre-packaged collections of prompts and subagents from a public API endpoint. A "kit" is a bundle containing custom prompts and subagents that extend the functionality of the Auggie CLI. Files are synced to dual directories for compatibility: `~/.augment/commands/` and `~/.claude/commands/` for prompts, `~/.augment/agents/` and `~/.claude/agents/` for subagents.
6
+
7
+ ## User Story
8
+
9
+ **As a** CLI user
10
+ **I want to** install a kit by providing its ID
11
+ **So that** I can quickly add multiple prompts and subagents to my Auggie environment without manual configuration
12
+
13
+ ## Implementation Reference
14
+
15
+ - Entry point: `src/cli.ts:883-929` (handleKit function)
16
+ - API function: `src/cli.ts:369-385` (getKit function)
17
+ - Data models: `src/cli.ts:90-110` (SubagentData, KitData, GetKitResponse)
18
+ - File writers: `src/cli.ts:333-349` (savePromptToFile), `src/cli.ts:387-405` (saveSubagentToFile)
19
+
20
+ ## Acceptance Criteria
21
+
22
+ ### Command Invocation
23
+
24
+ - [x] WHEN the user runs `auggiegw kit <kit-id>`, THE SYSTEM SHALL fetch the kit from the public API endpoint.
25
+ - [x] IF the kit-id argument is missing, THEN THE SYSTEM SHALL display "Error: Kit ID is required" and usage message, and exit with code 1.
26
+
27
+ ### API Integration
28
+
29
+ - [x] THE SYSTEM SHALL make a GET request to `{apiUrl}/api/public/kit/{kitId}` without authentication headers.
30
+ - [x] THE SYSTEM SHALL parse the response as JSON with structure `{ success: boolean, message: string, data: KitData }`.
31
+ - [x] IF the HTTP response status is not OK, THEN THE SYSTEM SHALL throw an error with message "HTTP error! status: {status}".
32
+ - [x] IF the response `success` field is false, THEN THE SYSTEM SHALL throw an error with the API's message or "Failed to get kit".
33
+
34
+ ### Data Processing
35
+
36
+ - [x] WHEN the kit data is received, THE SYSTEM SHALL extract the kit name, prompts array, and subagents array.
37
+ - [x] THE SYSTEM SHALL process prompts sequentially before processing subagents.
38
+ - [x] THE SYSTEM SHALL track the count of successfully saved prompts and subagents.
39
+
40
+ ### Prompt Installation
41
+
42
+ - [x] WHEN processing prompts, THE SYSTEM SHALL create the directory `~/.augment/commands/` if it does not exist.
43
+ - [x] WHEN processing prompts, THE SYSTEM SHALL create the directory `~/.claude/commands/` if it does not exist.
44
+ - [x] FOR EACH prompt in the kit, THE SYSTEM SHALL save a markdown file to `~/.augment/commands/{command}.md` with YAML frontmatter containing `description` and `type: "manual"` fields.
45
+ - [x] FOR EACH prompt in the kit, THE SYSTEM SHALL save a markdown file to `~/.claude/commands/{command}.md` with YAML frontmatter containing `description` and `type: "manual"` fields.
46
+ - [x] THE SYSTEM SHALL overwrite existing prompt files with the same filename without confirmation.
47
+ - [x] IF a prompt file fails to save, THEN THE SYSTEM SHALL throw an error with message "Failed to save prompt file for command '{command}': {error}".
48
+ - [x] IF a prompt file fails to save to one directory (either `.augment` or `.claude`), THEN THE SYSTEM SHALL still attempt to save to the other directory before throwing an error.
49
+
50
+ ### Subagent Installation
51
+
52
+ - [x] WHEN processing subagents, THE SYSTEM SHALL create the directory `~/.augment/agents/` if it does not exist.
53
+ - [x] WHEN processing subagents, THE SYSTEM SHALL create the directory `~/.claude/agents/` if it does not exist.
54
+ - [x] FOR EACH subagent in the kit, THE SYSTEM SHALL save a markdown file to `~/.augment/agents/{name}.md` with YAML frontmatter containing `name`, `description`, `model`, and `color` fields.
55
+ - [x] FOR EACH subagent in the kit, THE SYSTEM SHALL save a markdown file to `~/.claude/agents/{name}.md` with YAML frontmatter containing `name`, `description`, `model`, and `color` fields.
56
+ - [x] THE SYSTEM SHALL overwrite existing subagent files with the same filename without confirmation.
57
+ - [x] IF a subagent file fails to save, THEN THE SYSTEM SHALL throw an error with message "Failed to save subagent file for '{name}': {error}".
58
+ - [x] IF a subagent file fails to save to one directory (either `.augment` or `.claude`), THEN THE SYSTEM SHALL still attempt to save to the other directory before throwing an error.
59
+
60
+ ### User Feedback
61
+
62
+ - [x] WHILE fetching the kit, THE SYSTEM SHALL display a spinner with text "Fetching kit {kitId}...".
63
+ - [x] WHILE processing the kit, THE SYSTEM SHALL update the spinner text to "Processing kit \"{name}\"...".
64
+ - [x] WHILE saving prompts, THE SYSTEM SHALL update the spinner text to "Saving {count} prompts...".
65
+ - [x] WHILE saving subagents, THE SYSTEM SHALL update the spinner text to "Saving {count} subagents...".
66
+ - [x] WHEN installation completes successfully, THE SYSTEM SHALL display "Successfully installed kit \"{name}\": {promptsCount} prompts, {subagentsCount} subagents".
67
+ - [x] WHEN installation completes successfully, THE SYSTEM SHALL display a message indicating files were saved to both `~/.augment/` and `~/.claude/` directories.
68
+ - [x] IF any error occurs during the process, THEN THE SYSTEM SHALL display "Kit fetch failed: {error}" and exit with code 1.
69
+
70
+ ### File Format Specifications
71
+
72
+ - [x] THE SYSTEM SHALL format prompt files with YAML frontmatter followed by content, using the template:
73
+ ```
74
+ ---
75
+ description: {prompt.name}
76
+ type: "manual"
77
+ ---
78
+
79
+ {prompt.content}
80
+ ```
81
+
82
+ - [x] THE SYSTEM SHALL format subagent files with YAML frontmatter followed by content, using the template:
83
+ ```
84
+ ---
85
+ name: "{subagent.name}"
86
+ description: "{subagent.description}"
87
+ model: "{subagent.model}"
88
+ color: "{subagent.color}"
89
+ ---
90
+
91
+ {subagent.content}
92
+ ```
93
+
94
+ - [x] THE SYSTEM SHALL use identical file formats for both `~/.augment/` and `~/.claude/` directories.
95
+
96
+ ## API Contract
97
+
98
+ ### Request
99
+ - **Method**: GET
100
+ - **Endpoint**: `{apiUrl}/api/public/kit/{kitId}`
101
+ - **Authentication**: None (public endpoint)
102
+ - **Parameters**: `kitId` (path parameter)
103
+
104
+ ### Response
105
+ ```typescript
106
+ {
107
+ success: boolean;
108
+ message: string;
109
+ data: {
110
+ id: string;
111
+ name: string;
112
+ description: string;
113
+ prompts: Array<{
114
+ name: string; // Display name for frontmatter
115
+ command: string; // Filename (without .md extension)
116
+ content: string; // Markdown content body
117
+ }>;
118
+ subagents: Array<{
119
+ name: string; // Filename (without .md extension)
120
+ description: string;
121
+ model: string;
122
+ color: string;
123
+ content: string; // Markdown content body
124
+ }>;
125
+ };
126
+ }
127
+ ```
128
+
129
+ ## Implementation Notes
130
+
131
+ **Status**: Completed
132
+ **Last Updated**: 2026-01-20
133
+ **Files**: `src/cli.ts:883-929` (handleKit), `src/cli.ts:333-349` (savePromptToFile), `src/cli.ts:387-405` (saveSubagentToFile)
134
+ **Deviations**: None
135
+
136
+ ### Implementation Details
137
+ - Prompts saved to both: `~/.augment/commands/` and `~/.claude/commands/`
138
+ - Subagents saved to both: `~/.augment/agents/` and `~/.claude/agents/`
139
+ - Error handling: Attempts both directories even if one fails
140
+ - Success message indicates dual-directory syncing