@1claw/cli 0.11.0 → 0.12.0
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/README.md +4 -0
- package/dist/src/commands/password-reset.d.ts +4 -0
- package/dist/src/commands/password-reset.d.ts.map +1 -0
- package/dist/src/commands/password-reset.js +98 -0
- package/dist/src/commands/password-reset.js.map +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -1
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,10 +51,14 @@ export ONECLAW_API_KEY="1ck_..."
|
|
|
51
51
|
```bash
|
|
52
52
|
1claw login # Browser-based login
|
|
53
53
|
1claw login --email # Email/password login
|
|
54
|
+
1claw forgot-password # Request password reset email (no login required)
|
|
55
|
+
1claw reset-password # Set new password from email token (no login required)
|
|
54
56
|
1claw logout # Clear stored credentials
|
|
55
57
|
1claw whoami # Show current user info
|
|
56
58
|
```
|
|
57
59
|
|
|
60
|
+
Password reset only applies to **email/password** accounts (not Google/SSO-only). After reset, open the link in the email (dashboard) or pass `--token` to `reset-password`.
|
|
61
|
+
|
|
58
62
|
### Vaults
|
|
59
63
|
|
|
60
64
|
```bash
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password-reset.d.ts","sourceRoot":"","sources":["../../../src/commands/password-reset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,eAAO,MAAM,qBAAqB,SAwC5B,CAAC;AAEP,eAAO,MAAM,oBAAoB,SAoE5B,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import inquirer from "inquirer";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { apiNoAuth } from "../client.js";
|
|
5
|
+
import { setApiUrl } from "../config.js";
|
|
6
|
+
import { printSuccess, printError, printInfo } from "../output.js";
|
|
7
|
+
import { handleError } from "../middleware.js";
|
|
8
|
+
export const forgotPasswordCommand = new Command("forgot-password")
|
|
9
|
+
.description("Request a password reset email (link opens the dashboard). No auth required.")
|
|
10
|
+
.option("--email <email>", "Account email address")
|
|
11
|
+
.option("--api-url <url>", "Override API base URL")
|
|
12
|
+
.action(async (opts) => {
|
|
13
|
+
try {
|
|
14
|
+
if (opts.apiUrl) {
|
|
15
|
+
setApiUrl(opts.apiUrl);
|
|
16
|
+
printInfo(`API URL set to ${opts.apiUrl}`);
|
|
17
|
+
}
|
|
18
|
+
let email = opts.email?.trim();
|
|
19
|
+
if (!email) {
|
|
20
|
+
const answers = await inquirer.prompt([
|
|
21
|
+
{ type: "input", name: "email", message: "Email:" },
|
|
22
|
+
]);
|
|
23
|
+
email = String(answers.email ?? "").trim();
|
|
24
|
+
}
|
|
25
|
+
if (!email) {
|
|
26
|
+
printError("Email is required.");
|
|
27
|
+
process.exit(2);
|
|
28
|
+
}
|
|
29
|
+
const res = await apiNoAuth("/auth/forgot-password", {
|
|
30
|
+
method: "POST",
|
|
31
|
+
body: { email },
|
|
32
|
+
});
|
|
33
|
+
printSuccess(res.message || "If an account exists, check your email.");
|
|
34
|
+
printInfo(`Open the link in the message in your browser (${chalk.dim("1claw.xyz/reset-password")}).`);
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
handleError(err);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
export const resetPasswordCommand = new Command("reset-password")
|
|
41
|
+
.description("Set a new password using the token from the reset email. No auth required.")
|
|
42
|
+
.option("--token <token>", "Token from the reset email URL")
|
|
43
|
+
.option("--password <password>", "New password (avoid: visible in shell history)")
|
|
44
|
+
.option("--api-url <url>", "Override API base URL")
|
|
45
|
+
.action(async (opts) => {
|
|
46
|
+
try {
|
|
47
|
+
if (opts.apiUrl) {
|
|
48
|
+
setApiUrl(opts.apiUrl);
|
|
49
|
+
printInfo(`API URL set to ${opts.apiUrl}`);
|
|
50
|
+
}
|
|
51
|
+
let token = opts.token?.trim();
|
|
52
|
+
let newPassword = opts.password;
|
|
53
|
+
if (!token) {
|
|
54
|
+
const t = await inquirer.prompt([
|
|
55
|
+
{
|
|
56
|
+
type: "input",
|
|
57
|
+
name: "token",
|
|
58
|
+
message: "Reset token (from email link):",
|
|
59
|
+
},
|
|
60
|
+
]);
|
|
61
|
+
token = String(t.token ?? "").trim();
|
|
62
|
+
}
|
|
63
|
+
if (!newPassword) {
|
|
64
|
+
const p = await inquirer.prompt([
|
|
65
|
+
{
|
|
66
|
+
type: "password",
|
|
67
|
+
name: "password",
|
|
68
|
+
message: "New password:",
|
|
69
|
+
mask: "•",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: "password",
|
|
73
|
+
name: "confirm",
|
|
74
|
+
message: "Confirm new password:",
|
|
75
|
+
mask: "•",
|
|
76
|
+
},
|
|
77
|
+
]);
|
|
78
|
+
if (p.password !== p.confirm) {
|
|
79
|
+
printError("Passwords do not match.");
|
|
80
|
+
process.exit(2);
|
|
81
|
+
}
|
|
82
|
+
newPassword = p.password;
|
|
83
|
+
}
|
|
84
|
+
if (!token || !newPassword) {
|
|
85
|
+
printError("Token and new password are required.");
|
|
86
|
+
process.exit(2);
|
|
87
|
+
}
|
|
88
|
+
const res = await apiNoAuth("/auth/reset-password", {
|
|
89
|
+
method: "POST",
|
|
90
|
+
body: { token, new_password: newPassword },
|
|
91
|
+
});
|
|
92
|
+
printSuccess(res.message || "Password updated. Run `1claw login`.");
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
handleError(err);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=password-reset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password-reset.js","sourceRoot":"","sources":["../../../src/commands/password-reset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,QAAQ,MAAM,UAAU,C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QAED,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,MAAM,CAAC,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;gBAC5B;oBACI,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,UAAU;oBAChB,OAAO,EAAE,eAAe;oBACxB,IAAI,EAAE,GAAG;iBACZ;gBACD;oBACI,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE,uBAAuB;oBAChC,IAAI,EAAE,GAAG;iBACZ;aACJ,CAAC,CAAC;YACH,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;gBAC3B,UAAU,CAAC,yBAAyB,CAAC,CAAC;gBACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,CAAC;YACD,WAAW,GAAG,CAAC,CAAC,QAAkB,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC;YACzB,UAAU,CAAC,sCAAsC,CAAC,CAAC;YACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;QAED,MAAM,GAAG,GAAG,MAAM,SAAS,CACvB,sBAAsB,EACtB;YACI,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE;SAC7C,CACJ,CAAC;QACF,YAAY,CAAC,GAAG,CAAC,OAAO,IAAI,sCAAsC,CAAC,CAAC;IACxE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,WAAW,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;AACL,CAAC,CACJ,CAAC"}
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4BpC,wBAAgB,aAAa,IAAI,OAAO,CAoDvC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
1
4
|
import { Command } from "commander";
|
|
2
5
|
import { loginCommand, logoutCommand, whoamiCommand, } from "./commands/login.js";
|
|
6
|
+
import { forgotPasswordCommand, resetPasswordCommand, } from "./commands/password-reset.js";
|
|
3
7
|
import { vaultCommand } from "./commands/vault.js";
|
|
4
8
|
import { secretCommand } from "./commands/secret.js";
|
|
5
9
|
import { envCommand } from "./commands/env.js";
|
|
@@ -12,14 +16,18 @@ import { mfaCommand } from "./commands/mfa.js";
|
|
|
12
16
|
import { configCommand } from "./commands/config.js";
|
|
13
17
|
import { proxyCommand } from "./commands/proxy.js";
|
|
14
18
|
import { setOutputFormat, setApiUrl } from "./config.js";
|
|
19
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
20
|
+
const cliPackageVersion = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf8")).version;
|
|
15
21
|
export function createProgram() {
|
|
16
22
|
const program = new Command("1claw")
|
|
17
|
-
.version(
|
|
23
|
+
.version(cliPackageVersion)
|
|
18
24
|
.description("1Claw CLI — HSM-backed secret management for AI agents and humans");
|
|
19
25
|
// Auth
|
|
20
26
|
program.addCommand(loginCommand);
|
|
21
27
|
program.addCommand(logoutCommand);
|
|
22
28
|
program.addCommand(whoamiCommand);
|
|
29
|
+
program.addCommand(forgotPasswordCommand);
|
|
30
|
+
program.addCommand(resetPasswordCommand);
|
|
23
31
|
// Core resources
|
|
24
32
|
program.addCommand(vaultCommand);
|
|
25
33
|
program.addCommand(secretCommand);
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACH,YAAY,EACZ,aAAa,EACb,aAAa,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,UAAU,aAAa;IACzB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;SAC/B,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACH,YAAY,EACZ,aAAa,EACb,aAAa,GAChB,MAAM,qBAAqB,CAAC;A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