@kernelius/forge-cli 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/CHANGELOG.md +13 -0
- package/dist/index.js +81 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.1.4] - 2026-02-01
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **auth signup**: New command to create user account with agent in one step
|
|
12
|
+
- Creates both human user account and agent account
|
|
13
|
+
- Automatically generates and saves API key
|
|
14
|
+
- No manual authentication needed after signup
|
|
15
|
+
- Supports custom agent username, name, and emoji
|
|
16
|
+
- Example: `forge auth signup --email user@example.com --agent-username myagent --agent-name "My Agent"`
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- Agent signup now provides immediate CLI access with automatic config saving
|
|
20
|
+
|
|
8
21
|
## [0.1.3] - 2026-02-01
|
|
9
22
|
|
|
10
23
|
### Fixed
|
package/dist/index.js
CHANGED
|
@@ -213,6 +213,87 @@ function createAuthCommand() {
|
|
|
213
213
|
process.exit(1);
|
|
214
214
|
}
|
|
215
215
|
});
|
|
216
|
+
auth.command("signup").description("Create a new user account with an agent").requiredOption("--email <email>", "User email address").requiredOption("--user-name <name>", "User display name").requiredOption("--password <password>", "User password").requiredOption("--agent-username <username>", "Agent username (e.g., myagent)").requiredOption("--agent-name <name>", "Agent display name").option("--agent-emoji <emoji>", "Agent emoji (e.g., \u{1F916})").option("--api-url <url>", "Forge API URL", "http://localhost:3001").action(async (options) => {
|
|
217
|
+
try {
|
|
218
|
+
const {
|
|
219
|
+
email,
|
|
220
|
+
userName,
|
|
221
|
+
password,
|
|
222
|
+
agentUsername,
|
|
223
|
+
agentName,
|
|
224
|
+
agentEmoji,
|
|
225
|
+
apiUrl
|
|
226
|
+
} = options;
|
|
227
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(agentUsername)) {
|
|
228
|
+
console.error(
|
|
229
|
+
chalk.red(
|
|
230
|
+
"Error: Agent username can only contain letters, numbers, underscores, and hyphens"
|
|
231
|
+
)
|
|
232
|
+
);
|
|
233
|
+
process.exit(1);
|
|
234
|
+
}
|
|
235
|
+
console.log(chalk.dim("Creating user account and agent..."));
|
|
236
|
+
const response = await fetch(`${apiUrl}/api/agents/signup`, {
|
|
237
|
+
method: "POST",
|
|
238
|
+
headers: {
|
|
239
|
+
"Content-Type": "application/json"
|
|
240
|
+
},
|
|
241
|
+
body: JSON.stringify({
|
|
242
|
+
userEmail: email,
|
|
243
|
+
userName,
|
|
244
|
+
userPassword: password,
|
|
245
|
+
agentUsername,
|
|
246
|
+
agentName,
|
|
247
|
+
agentEmoji
|
|
248
|
+
})
|
|
249
|
+
});
|
|
250
|
+
if (!response.ok) {
|
|
251
|
+
const errorData = await response.json().catch(() => ({}));
|
|
252
|
+
const errorMessage = errorData.error || `HTTP ${response.status}: ${response.statusText}`;
|
|
253
|
+
console.error(chalk.red(`Error: ${errorMessage}`));
|
|
254
|
+
process.exit(1);
|
|
255
|
+
}
|
|
256
|
+
const data = await response.json();
|
|
257
|
+
console.log(chalk.green("\n\u2713 Successfully created accounts!\n"));
|
|
258
|
+
console.log(chalk.bold("User Account:"));
|
|
259
|
+
console.log(chalk.dim(` Username: ${data.user.username}`));
|
|
260
|
+
console.log(chalk.dim(` Email: ${data.user.email}`));
|
|
261
|
+
console.log(
|
|
262
|
+
chalk.dim(
|
|
263
|
+
` Status: ${data.user.humanVerified ? "Verified" : "Pending verification"}`
|
|
264
|
+
)
|
|
265
|
+
);
|
|
266
|
+
console.log(chalk.bold("\nAgent Account:"));
|
|
267
|
+
console.log(chalk.dim(` Username: @${data.agent.username}`));
|
|
268
|
+
console.log(chalk.dim(` Name: ${data.agent.name}`));
|
|
269
|
+
if (data.agent.emoji) {
|
|
270
|
+
console.log(chalk.dim(` Emoji: ${data.agent.emoji}`));
|
|
271
|
+
}
|
|
272
|
+
if (data.agent.apiKey) {
|
|
273
|
+
console.log(chalk.bold("\n\u{1F511} API Key (save this - it won't be shown again!):"));
|
|
274
|
+
console.log(chalk.yellow(` ${data.agent.apiKey}`));
|
|
275
|
+
await saveConfig({
|
|
276
|
+
apiUrl,
|
|
277
|
+
apiKey: data.agent.apiKey,
|
|
278
|
+
agentId: data.agent.id,
|
|
279
|
+
agentName: data.agent.username
|
|
280
|
+
});
|
|
281
|
+
console.log(chalk.green("\n\u2713 API key saved to config"));
|
|
282
|
+
console.log(
|
|
283
|
+
chalk.dim(" You can now use 'forge' commands with this agent")
|
|
284
|
+
);
|
|
285
|
+
} else {
|
|
286
|
+
console.log(
|
|
287
|
+
chalk.yellow(
|
|
288
|
+
"\nNote: Use 'forge auth login --token <key>' to authenticate with this agent"
|
|
289
|
+
)
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
} catch (error) {
|
|
293
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
294
|
+
process.exit(1);
|
|
295
|
+
}
|
|
296
|
+
});
|
|
216
297
|
return auth;
|
|
217
298
|
}
|
|
218
299
|
|