@dccxx/auggiegw 1.0.22 → 1.0.23
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/CLAUDE.md +29 -6
- package/dist/cli.js +68 -1
- package/package.json +2 -1
package/CLAUDE.md
CHANGED
|
@@ -40,12 +40,12 @@ just release
|
|
|
40
40
|
|
|
41
41
|
Single-file CLI application (`src/cli.ts`) using Commander.js. All logic is contained in one file with clear separation:
|
|
42
42
|
|
|
43
|
-
1. **Type Definitions** (lines 18-
|
|
44
|
-
2. **Constants** (lines
|
|
45
|
-
3. **Utility Functions** (lines
|
|
46
|
-
4. **API Functions** (lines
|
|
47
|
-
5. **Command Handlers** (lines
|
|
48
|
-
6. **CLI Setup** (lines
|
|
43
|
+
1. **Type Definitions** (lines 18-162): All interfaces for API responses and internal data structures
|
|
44
|
+
2. **Constants** (lines 164-169): File paths for auth and session storage
|
|
45
|
+
3. **Utility Functions** (lines 171-254): Config loading, auth data management
|
|
46
|
+
4. **API Functions** (lines 265-518): HTTP calls to Augment Gateway API
|
|
47
|
+
5. **Command Handlers** (lines 520-929): Business logic for each CLI command
|
|
48
|
+
6. **CLI Setup** (lines 931-988): Commander.js program definition
|
|
49
49
|
|
|
50
50
|
### Key File Locations
|
|
51
51
|
|
|
@@ -53,6 +53,7 @@ Single-file CLI application (`src/cli.ts`) using Commander.js. All logic is cont
|
|
|
53
53
|
- Augment session: `~/.augment/session.json`
|
|
54
54
|
- Custom prompts: `~/.augment/commands/*.md`
|
|
55
55
|
- Auggie sessions: `~/.augment/sessions/*.json`
|
|
56
|
+
- Subagents: `~/.augment/agents/*.md`
|
|
56
57
|
|
|
57
58
|
## Special Logic & Non-Obvious Implementations
|
|
58
59
|
|
|
@@ -111,6 +112,28 @@ The `switch-account` command:
|
|
|
111
112
|
- Switches to the account at index `currentIndex - 1` (the newer one)
|
|
112
113
|
- After switching, calls `handleFetch({ authOnly: true, deleteSession: true })`
|
|
113
114
|
|
|
115
|
+
### Kit Command Logic (lines 883-929)
|
|
116
|
+
|
|
117
|
+
The `kit <kit-id>` command fetches and installs a kit from the public API:
|
|
118
|
+
1. Calls `/api/public/kit/{kit-id}` to fetch kit data (no authentication required)
|
|
119
|
+
2. Saves prompts to `~/.augment/commands/*.md` using the same format as `savePromptToFile`
|
|
120
|
+
3. Saves subagents to `~/.augment/agents/*.md` with YAML frontmatter
|
|
121
|
+
|
|
122
|
+
### Subagent File Format
|
|
123
|
+
|
|
124
|
+
Subagents are saved as markdown with YAML frontmatter:
|
|
125
|
+
|
|
126
|
+
```markdown
|
|
127
|
+
---
|
|
128
|
+
name: "{subagent.name}"
|
|
129
|
+
description: "{subagent.description}"
|
|
130
|
+
model: "{subagent.model}"
|
|
131
|
+
color: "{subagent.color}"
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
{subagent.content}
|
|
135
|
+
```
|
|
136
|
+
|
|
114
137
|
### Prompt File Format (lines 310-320)
|
|
115
138
|
|
|
116
139
|
Prompts are saved as markdown with YAML frontmatter:
|
package/dist/cli.js
CHANGED
|
@@ -2199,6 +2199,7 @@ var AUTH_FILE = path.join(AUTH_DIR, "auth.json");
|
|
|
2199
2199
|
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
|
+
var AUGMENT_AGENTS_DIR = path.join(AUGMENT_DIR, "agents");
|
|
2202
2203
|
function loadConfig() {
|
|
2203
2204
|
const apiUrl = process.env.AUGMENT_GATEWAY_URL || "https://augmentgateway.1app.space";
|
|
2204
2205
|
return { apiUrl };
|
|
@@ -2348,6 +2349,36 @@ async function deleteAllCommandFiles() {
|
|
|
2348
2349
|
}
|
|
2349
2350
|
return mdFiles.length;
|
|
2350
2351
|
}
|
|
2352
|
+
async function getKit(kitId, apiUrl) {
|
|
2353
|
+
const response = await fetch(`${apiUrl}/api/public/kit/${kitId}`, {
|
|
2354
|
+
method: "GET"
|
|
2355
|
+
});
|
|
2356
|
+
if (!response.ok) {
|
|
2357
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
2358
|
+
}
|
|
2359
|
+
const data = await response.json();
|
|
2360
|
+
if (!data.success) {
|
|
2361
|
+
throw new Error(data.message || "Failed to get kit");
|
|
2362
|
+
}
|
|
2363
|
+
return data;
|
|
2364
|
+
}
|
|
2365
|
+
async function saveSubagentToFile(subagent) {
|
|
2366
|
+
try {
|
|
2367
|
+
await fs.mkdir(AUGMENT_AGENTS_DIR, { recursive: true });
|
|
2368
|
+
const markdownContent = `---
|
|
2369
|
+
name: "${subagent.name}"
|
|
2370
|
+
description: "${subagent.description}"
|
|
2371
|
+
model: "${subagent.model}"
|
|
2372
|
+
color: "${subagent.color}"
|
|
2373
|
+
---
|
|
2374
|
+
|
|
2375
|
+
${subagent.content}`;
|
|
2376
|
+
const filePath = path.join(AUGMENT_AGENTS_DIR, `${subagent.name}.md`);
|
|
2377
|
+
await fs.writeFile(filePath, markdownContent, "utf-8");
|
|
2378
|
+
} catch (error) {
|
|
2379
|
+
throw new Error(`Failed to save subagent file for '${subagent.name}': ${error}`);
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2351
2382
|
async function promptInput(question, hidden = false) {
|
|
2352
2383
|
const rl = readline.createInterface({
|
|
2353
2384
|
input: process.stdin,
|
|
@@ -2682,6 +2713,41 @@ async function handleSwitchAccount() {
|
|
|
2682
2713
|
process.exit(1);
|
|
2683
2714
|
}
|
|
2684
2715
|
}
|
|
2716
|
+
async function handleKit(kitId) {
|
|
2717
|
+
if (!kitId) {
|
|
2718
|
+
console.error("Error: Kit ID is required");
|
|
2719
|
+
console.error("Usage: auggiegw kit <kit-id>");
|
|
2720
|
+
process.exit(1);
|
|
2721
|
+
}
|
|
2722
|
+
const spinner = ora("Fetching kit...").start();
|
|
2723
|
+
try {
|
|
2724
|
+
const config = loadConfig();
|
|
2725
|
+
spinner.text = `Fetching kit ${kitId}...`;
|
|
2726
|
+
const kitResponse = await getKit(kitId, config.apiUrl);
|
|
2727
|
+
const kit = kitResponse.data;
|
|
2728
|
+
spinner.text = `Processing kit "${kit.name}"...`;
|
|
2729
|
+
let promptsCount = 0;
|
|
2730
|
+
let subagentsCount = 0;
|
|
2731
|
+
if (kit.prompts && kit.prompts.length > 0) {
|
|
2732
|
+
spinner.text = `Saving ${kit.prompts.length} prompts...`;
|
|
2733
|
+
for (const prompt of kit.prompts) {
|
|
2734
|
+
await savePromptToFile(prompt);
|
|
2735
|
+
promptsCount++;
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
if (kit.subagents && kit.subagents.length > 0) {
|
|
2739
|
+
spinner.text = `Saving ${kit.subagents.length} subagents...`;
|
|
2740
|
+
for (const subagent of kit.subagents) {
|
|
2741
|
+
await saveSubagentToFile(subagent);
|
|
2742
|
+
subagentsCount++;
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
spinner.succeed(`Successfully installed kit "${kit.name}": ${promptsCount} prompts, ${subagentsCount} subagents`);
|
|
2746
|
+
} catch (error) {
|
|
2747
|
+
spinner.fail(`Kit fetch failed: ${error}`);
|
|
2748
|
+
process.exit(1);
|
|
2749
|
+
}
|
|
2750
|
+
}
|
|
2685
2751
|
var program2 = new Command;
|
|
2686
2752
|
program2.name("auggiegw").description("CLI tool for auggiegw authentication").version("1.0.0").option("--preserve-session", "Preserve Auggie session (do not delete chat history)").option("--delete-session", "Delete Auggie session (clear chat history)").option("--auth-only", "Fetch authentication session only without fetching prompts").option("--refresh-commands", "Delete all existing commands and fetch fresh ones from API");
|
|
2687
2753
|
program2.command("login [username] [password]").description("Login and store credentials").action(handleLogin);
|
|
@@ -2702,6 +2768,7 @@ program2.command("exec <command> [args...]").description("Execute any custom com
|
|
|
2702
2768
|
handleExec(command, args, sessionOptions);
|
|
2703
2769
|
});
|
|
2704
2770
|
program2.command("switch-account").description("Switch to a newer account from the purchased account list").action(handleSwitchAccount);
|
|
2771
|
+
program2.command("kit <kit-id>").description("Fetch and install a kit (prompts and subagents) from the public API").action(handleKit);
|
|
2705
2772
|
program2.parse();
|
|
2706
2773
|
|
|
2707
|
-
//# debugId=
|
|
2774
|
+
//# debugId=C5CF051D7C5655BB64756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dccxx/auggiegw",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"description": "A Node.js TypeScript package",
|
|
5
5
|
"main": "./dist/cli.js",
|
|
6
6
|
"types": "./dist/cli.d.ts",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"prepublishOnly": "bun run lint && bun run build",
|
|
16
16
|
"publish:auto": "node scripts/publish.js",
|
|
17
17
|
"dev:login": "bun run src/cli.ts login",
|
|
18
|
+
"dev:kit": "bun run src/cli.ts kit cmk4idkos0000ph7wwdy86a6f",
|
|
18
19
|
"dev:fetch": "bun run src/cli.ts fetch"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|