@getengram/cli 0.2.1 → 0.3.1
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/LICENSE +112 -21
- package/dist/commands/login.d.ts +16 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +203 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/upgrade.d.ts +6 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +57 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/index.js +26 -6
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/LICENSE
CHANGED
|
@@ -1,21 +1,112 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Parameters
|
|
4
|
+
|
|
5
|
+
Licensor: Get Engram LLC
|
|
6
|
+
Licensed Work: Engram
|
|
7
|
+
The Licensed Work is (c) 2026 Get Engram LLC.
|
|
8
|
+
Additional Use Grant: You may make use of the Licensed Work, provided that
|
|
9
|
+
you may not use the Licensed Work for a Memory Service.
|
|
10
|
+
|
|
11
|
+
A "Memory Service" is a commercial offering that allows
|
|
12
|
+
third parties to access the functionality of the Licensed
|
|
13
|
+
Work by providing conversation storage, semantic search,
|
|
14
|
+
or agent memory capabilities as a hosted or managed
|
|
15
|
+
service.
|
|
16
|
+
|
|
17
|
+
For clarity, the following are NOT restricted:
|
|
18
|
+
- Self-hosting the Licensed Work for your own internal use
|
|
19
|
+
- Using the Licensed Work as part of a product that is not
|
|
20
|
+
primarily a memory or conversation storage service
|
|
21
|
+
- Integrating with the hosted Engram service at
|
|
22
|
+
getengram.app via its APIs
|
|
23
|
+
|
|
24
|
+
Change Date: May 14, 2030
|
|
25
|
+
Change License: Apache License, Version 2.0
|
|
26
|
+
|
|
27
|
+
Exception: The following subdirectory is licensed under the Mozilla
|
|
28
|
+
Public License 2.0, as indicated by a LICENSE file within the directory:
|
|
29
|
+
|
|
30
|
+
- packages/sdk (@getengram/sdk, published to npm)
|
|
31
|
+
|
|
32
|
+
For information about alternative licensing arrangements for the Licensed Work,
|
|
33
|
+
please contact hello@getengram.app.
|
|
34
|
+
|
|
35
|
+
Notice
|
|
36
|
+
|
|
37
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
38
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
39
|
+
under an Open Source License, as stated in this License.
|
|
40
|
+
|
|
41
|
+
License text below is the full BSL 1.1 text copyright MariaDB Corporation Ab.
|
|
42
|
+
|
|
43
|
+
-----------------------------------------------------------------------------
|
|
44
|
+
|
|
45
|
+
Business Source License 1.1
|
|
46
|
+
|
|
47
|
+
Terms
|
|
48
|
+
|
|
49
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
50
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
51
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
52
|
+
production use.
|
|
53
|
+
|
|
54
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
55
|
+
available distribution of a specific version of the Licensed Work under this
|
|
56
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
57
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
58
|
+
above terminate.
|
|
59
|
+
|
|
60
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
61
|
+
currently in effect as described in this License, you must purchase a
|
|
62
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
63
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
64
|
+
|
|
65
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
66
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
67
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
68
|
+
for each version of the Licensed Work released by Licensor.
|
|
69
|
+
|
|
70
|
+
You must conspicuously display this License on each original or modified copy
|
|
71
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
72
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
73
|
+
License apply to your use of that work.
|
|
74
|
+
|
|
75
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
76
|
+
terminate your rights under this License for the current and all other
|
|
77
|
+
versions of the Licensed Work.
|
|
78
|
+
|
|
79
|
+
This License does not grant you any right in any trademark or logo of
|
|
80
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
81
|
+
Licensor as expressly required by this License).
|
|
82
|
+
|
|
83
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
84
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
86
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
87
|
+
TITLE.
|
|
88
|
+
|
|
89
|
+
MariaDB hereby grants you permission to use this License's text to license
|
|
90
|
+
your works, and to refer to it using the trademark "Business Source License",
|
|
91
|
+
as long as you comply with the Covenants of Licensor below.
|
|
92
|
+
|
|
93
|
+
Covenants of Licensor
|
|
94
|
+
|
|
95
|
+
In consideration of the right to use this License's text and the "Business
|
|
96
|
+
Source License" name and trademark, Licensor covenants to MariaDB, and to all
|
|
97
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
98
|
+
|
|
99
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
100
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
101
|
+
where "compatible" means that software provided under the Change License can
|
|
102
|
+
be included in a program with software provided under GPL Version 2.0 or a
|
|
103
|
+
later version. Licensor may specify additional Change Licenses without
|
|
104
|
+
limitation.
|
|
105
|
+
|
|
106
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
107
|
+
impose any additional restriction on the right granted in this License, as
|
|
108
|
+
the Additional Use Grant; or (b) insert the text "None".
|
|
109
|
+
|
|
110
|
+
3. To specify a Change Date.
|
|
111
|
+
|
|
112
|
+
4. Not to modify this License in any other way.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `engram signup` — create an anonymous account instantly.
|
|
3
|
+
* No email, no password. Just get a key and start using Engram.
|
|
4
|
+
*/
|
|
5
|
+
export declare function signup(): Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* `engram link` — attach an email + password to an anonymous account.
|
|
8
|
+
* Creates a Supabase user and links it to the existing org.
|
|
9
|
+
*/
|
|
10
|
+
export declare function link(): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* `engram login` — sign in with email + password.
|
|
13
|
+
* Calls Supabase auth, then the worker /signup to get an API key.
|
|
14
|
+
*/
|
|
15
|
+
export declare function login(): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAkDA;;;GAGG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CA0C5C;AAED;;;GAGG;AACH,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAqE1C;AAED;;;GAGG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAkF3C"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { createInterface } from "node:readline";
|
|
2
|
+
import { saveConfig, loadConfig, getBaseUrl } from "../config.js";
|
|
3
|
+
import { green, red, dim } from "../output.js";
|
|
4
|
+
const API_URL = process.env.ENGRAM_BASE_URL ?? getBaseUrl();
|
|
5
|
+
/** Prompt for input (hides input for passwords). */
|
|
6
|
+
function prompt(question, hidden = false) {
|
|
7
|
+
return new Promise((resolve) => {
|
|
8
|
+
const rl = createInterface({
|
|
9
|
+
input: process.stdin,
|
|
10
|
+
output: process.stdout,
|
|
11
|
+
});
|
|
12
|
+
if (hidden && process.stdin.isTTY) {
|
|
13
|
+
// Mute output for password entry
|
|
14
|
+
process.stdout.write(question);
|
|
15
|
+
const stdin = process.stdin;
|
|
16
|
+
const wasRaw = stdin.isRaw;
|
|
17
|
+
stdin.setRawMode(true);
|
|
18
|
+
let input = "";
|
|
19
|
+
const onData = (ch) => {
|
|
20
|
+
const c = ch.toString();
|
|
21
|
+
if (c === "\n" || c === "\r") {
|
|
22
|
+
stdin.setRawMode(wasRaw ?? false);
|
|
23
|
+
stdin.removeListener("data", onData);
|
|
24
|
+
process.stdout.write("\n");
|
|
25
|
+
rl.close();
|
|
26
|
+
resolve(input);
|
|
27
|
+
}
|
|
28
|
+
else if (c === "\x03") {
|
|
29
|
+
// Ctrl+C
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
else if (c === "\x7f" || c === "\b") {
|
|
33
|
+
// Backspace
|
|
34
|
+
input = input.slice(0, -1);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
input += c;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
stdin.on("data", onData);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
rl.question(question, (answer) => {
|
|
44
|
+
rl.close();
|
|
45
|
+
resolve(answer);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* `engram signup` — create an anonymous account instantly.
|
|
52
|
+
* No email, no password. Just get a key and start using Engram.
|
|
53
|
+
*/
|
|
54
|
+
export async function signup() {
|
|
55
|
+
const existing = await loadConfig();
|
|
56
|
+
if (existing.apiKey) {
|
|
57
|
+
console.error("You already have an account. Your API key is saved in ~/.engram/config.json\n\n" +
|
|
58
|
+
" engram auth status # check your account\n" +
|
|
59
|
+
" engram auth logout # remove credentials before creating a new account\n");
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
console.log("Creating account...");
|
|
63
|
+
const res = await fetch(`${API_URL}/signup/anonymous`, {
|
|
64
|
+
method: "POST",
|
|
65
|
+
headers: { "Content-Type": "application/json" },
|
|
66
|
+
});
|
|
67
|
+
if (!res.ok) {
|
|
68
|
+
const body = await res.text().catch(() => "");
|
|
69
|
+
console.error(red(`Signup failed: ${res.status} ${body}`));
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
const data = (await res.json());
|
|
73
|
+
const config = await loadConfig();
|
|
74
|
+
config.apiKey = data.api_key;
|
|
75
|
+
await saveConfig(config);
|
|
76
|
+
console.log(green("✓ Account created"));
|
|
77
|
+
console.log(` Organization: ${data.organization_id}`);
|
|
78
|
+
console.log(` API key saved to ~/.engram/config.json`);
|
|
79
|
+
console.log(dim("\n Tip: run 'engram install' to auto-start on login"));
|
|
80
|
+
console.log(dim(" Tip: run 'engram link <email>' to claim your account for upgrades"));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* `engram link` — attach an email + password to an anonymous account.
|
|
84
|
+
* Creates a Supabase user and links it to the existing org.
|
|
85
|
+
*/
|
|
86
|
+
export async function link() {
|
|
87
|
+
const config = await loadConfig();
|
|
88
|
+
const apiKey = process.env.ENGRAM_API_KEY ?? config.apiKey;
|
|
89
|
+
if (!apiKey) {
|
|
90
|
+
console.error(red("Not authenticated. Run 'engram signup' first."));
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
const email = await prompt("Email: ");
|
|
94
|
+
const password = await prompt("Password: ", true);
|
|
95
|
+
if (!email || !password) {
|
|
96
|
+
console.error(red("Email and password are required."));
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
if (password.length < 8) {
|
|
100
|
+
console.error(red("Password must be at least 8 characters."));
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
console.log("Linking account...");
|
|
104
|
+
// 1. Create Supabase user
|
|
105
|
+
const supabaseUrl = "https://ygfqaafyfjrutxjeswks.supabase.co";
|
|
106
|
+
const supabaseAnonKey = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InlnZnFhYWZ5ZmpydXR4amVzd2tzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDQ1MDg3ODcsImV4cCI6MjA2MDA4NDc4N30.pK_3TgpMFsYi_4fRR-gBnLGoXxqYINOqSjjKcBqe70c";
|
|
107
|
+
const signupRes = await fetch(`${supabaseUrl}/auth/v1/signup`, {
|
|
108
|
+
method: "POST",
|
|
109
|
+
headers: {
|
|
110
|
+
"Content-Type": "application/json",
|
|
111
|
+
apikey: supabaseAnonKey,
|
|
112
|
+
},
|
|
113
|
+
body: JSON.stringify({ email: email.trim(), password }),
|
|
114
|
+
});
|
|
115
|
+
if (!signupRes.ok) {
|
|
116
|
+
const err = (await signupRes.json().catch(() => ({})));
|
|
117
|
+
const msg = err.msg || err.error_description || `Signup failed: ${signupRes.status}`;
|
|
118
|
+
// "User already registered" is fine — they can still link
|
|
119
|
+
if (!msg.includes("already")) {
|
|
120
|
+
console.error(red(msg));
|
|
121
|
+
process.exit(1);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// 2. Link email to org via worker
|
|
125
|
+
const linkRes = await fetch(`${API_URL}/signup/link`, {
|
|
126
|
+
method: "POST",
|
|
127
|
+
headers: {
|
|
128
|
+
"Content-Type": "application/json",
|
|
129
|
+
Authorization: `Bearer ${apiKey}`,
|
|
130
|
+
},
|
|
131
|
+
body: JSON.stringify({ email: email.trim() }),
|
|
132
|
+
});
|
|
133
|
+
if (!linkRes.ok) {
|
|
134
|
+
const err = (await linkRes.json().catch(() => ({})));
|
|
135
|
+
console.error(red(err.message || `Link failed: ${linkRes.status}`));
|
|
136
|
+
process.exit(1);
|
|
137
|
+
}
|
|
138
|
+
console.log(green(`✓ Account linked to ${email.trim()}`));
|
|
139
|
+
console.log(` You can now sign in at getengram.app/login`);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* `engram login` — sign in with email + password.
|
|
143
|
+
* Calls Supabase auth, then the worker /signup to get an API key.
|
|
144
|
+
*/
|
|
145
|
+
export async function login() {
|
|
146
|
+
const email = await prompt("Email: ");
|
|
147
|
+
const password = await prompt("Password: ", true);
|
|
148
|
+
if (!email || !password) {
|
|
149
|
+
console.error(red("Email and password are required."));
|
|
150
|
+
process.exit(1);
|
|
151
|
+
}
|
|
152
|
+
// Sign in via Supabase REST API
|
|
153
|
+
const supabaseUrl = "https://ygfqaafyfjrutxjeswks.supabase.co";
|
|
154
|
+
const supabaseAnonKey = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InlnZnFhYWZ5ZmpydXR4amVzd2tzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDQ1MDg3ODcsImV4cCI6MjA2MDA4NDc4N30.pK_3TgpMFsYi_4fRR-gBnLGoXxqYINOqSjjKcBqe70c";
|
|
155
|
+
console.log("Signing in...");
|
|
156
|
+
const authRes = await fetch(`${supabaseUrl}/auth/v1/token?grant_type=password`, {
|
|
157
|
+
method: "POST",
|
|
158
|
+
headers: {
|
|
159
|
+
"Content-Type": "application/json",
|
|
160
|
+
apikey: supabaseAnonKey,
|
|
161
|
+
},
|
|
162
|
+
body: JSON.stringify({ email: email.trim(), password }),
|
|
163
|
+
});
|
|
164
|
+
if (!authRes.ok) {
|
|
165
|
+
const err = (await authRes.json().catch(() => ({})));
|
|
166
|
+
console.error(red(err.error_description || `Login failed: ${authRes.status}`));
|
|
167
|
+
process.exit(1);
|
|
168
|
+
}
|
|
169
|
+
const session = (await authRes.json());
|
|
170
|
+
// Exchange Supabase token for Engram API key
|
|
171
|
+
const signupRes = await fetch(`${API_URL}/signup`, {
|
|
172
|
+
method: "POST",
|
|
173
|
+
headers: {
|
|
174
|
+
"Content-Type": "application/json",
|
|
175
|
+
Authorization: `Bearer ${session.access_token}`,
|
|
176
|
+
},
|
|
177
|
+
body: JSON.stringify({ plan: "free" }),
|
|
178
|
+
});
|
|
179
|
+
if (signupRes.status === 409) {
|
|
180
|
+
// Account already has a key — check if we have one locally
|
|
181
|
+
const config = await loadConfig();
|
|
182
|
+
if (config.apiKey) {
|
|
183
|
+
console.log(green(`✓ Signed in as ${email.trim()}`));
|
|
184
|
+
console.log(` Using existing API key from ~/.engram/config.json`);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
console.error(red("Your account already has an API key.\n") +
|
|
188
|
+
" Use 'engram auth login <key>' to set it, or manage keys at getengram.app/dashboard");
|
|
189
|
+
process.exit(1);
|
|
190
|
+
}
|
|
191
|
+
if (!signupRes.ok) {
|
|
192
|
+
const body = await signupRes.text().catch(() => "");
|
|
193
|
+
console.error(red(`Failed to get API key: ${signupRes.status} ${body}`));
|
|
194
|
+
process.exit(1);
|
|
195
|
+
}
|
|
196
|
+
const data = (await signupRes.json());
|
|
197
|
+
const config = await loadConfig();
|
|
198
|
+
config.apiKey = data.api_key;
|
|
199
|
+
await saveConfig(config);
|
|
200
|
+
console.log(green(`✓ Signed in as ${email.trim()}`));
|
|
201
|
+
console.log(` API key saved to ~/.engram/config.json`);
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,KAAK,E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browser) and agents (returns URL).
|
|
4
|
+
*/
|
|
5
|
+
export declare function upgrade(args: string[], flags: Record<string, string>): Promise<void>;
|
|
6
|
+
//# sourceMappingURL=upgrade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAsB,OAAO,CAC3B,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5B,OAAO,CAAC,IAAI,CAAC,CAmEf"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { loadConfig, getBaseUrl } from "../config.js";
|
|
2
|
+
import { green, red, dim } from "../output.js";
|
|
3
|
+
const API_URL = process.env.ENGRAM_BASE_URL ?? getBaseUrl();
|
|
4
|
+
/**
|
|
5
|
+
* `engram upgrade [pro|team]` — create a Stripe Checkout session and open it.
|
|
6
|
+
* Works for both humans (opens browser) and agents (returns URL).
|
|
7
|
+
*/
|
|
8
|
+
export async function upgrade(args, flags) {
|
|
9
|
+
const config = await loadConfig();
|
|
10
|
+
const apiKey = process.env.ENGRAM_API_KEY ?? config.apiKey;
|
|
11
|
+
if (!apiKey) {
|
|
12
|
+
console.error(red("Not authenticated. Run 'engram signup' first."));
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
const plan = args[0] === "team" ? "team" : "pro";
|
|
16
|
+
const json = "json" in flags;
|
|
17
|
+
const res = await fetch(`${API_URL}/api/billing/checkout`, {
|
|
18
|
+
method: "POST",
|
|
19
|
+
headers: {
|
|
20
|
+
"Content-Type": "application/json",
|
|
21
|
+
Authorization: `Bearer ${apiKey}`,
|
|
22
|
+
},
|
|
23
|
+
body: JSON.stringify({ plan }),
|
|
24
|
+
});
|
|
25
|
+
if (!res.ok) {
|
|
26
|
+
const body = (await res.json().catch(() => ({})));
|
|
27
|
+
if (body.error === "missing_email") {
|
|
28
|
+
console.error(red("Your account needs an email before upgrading.\n") +
|
|
29
|
+
"\n Run: engram link\n");
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
console.error(red(body.message || `Upgrade failed: ${res.status}`));
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
const data = (await res.json());
|
|
36
|
+
if (json) {
|
|
37
|
+
console.log(JSON.stringify(data));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
console.log(green(`✓ Checkout session created for ${data.plan}`));
|
|
41
|
+
console.log(`\n ${data.url}\n`);
|
|
42
|
+
// Try to open in browser
|
|
43
|
+
try {
|
|
44
|
+
const { exec } = await import("node:child_process");
|
|
45
|
+
const cmd = process.platform === "darwin"
|
|
46
|
+
? "open"
|
|
47
|
+
: process.platform === "win32"
|
|
48
|
+
? "start"
|
|
49
|
+
: "xdg-open";
|
|
50
|
+
exec(`${cmd} "${data.url}"`);
|
|
51
|
+
console.log(dim(" Opening in your browser..."));
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
console.log(dim(" Open the URL above to complete checkout."));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=upgrade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,UAAU,EAAE,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,IAAc,EACd,KAA6B;IAE7B,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,OA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AAM,GAAG,CAAC,IAAI,EAAE,CAI7B,CAAC;IAEF,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAClC,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,kCAAkC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAClE,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAEjC,yBAAyB;IACzB,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;QACpD,MAAM,GAAG,GACP,OAAO,CAAC,QAAQ,KAAK,QAAQ;YAC3B,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO;gBAC5B,CAAC,CAAC,OAAO;gBACT,CAAC,CAAC,UAAU,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;QAC7B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC,CAAC;IACjE,CAAC;AACH,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,17 +2,20 @@
|
|
|
2
2
|
import { Engram } from "@getengram/sdk";
|
|
3
3
|
import { loadConfig, getBaseUrl } from "./config.js";
|
|
4
4
|
import { authLogin, authLogout, authStatus } from "./commands/auth.js";
|
|
5
|
+
import { signup, login, link } from "./commands/login.js";
|
|
5
6
|
import { listConversations, createConversation, getConversation, deleteConversation, } from "./commands/conversations.js";
|
|
6
7
|
import { store } from "./commands/store.js";
|
|
7
8
|
import { search } from "./commands/search.js";
|
|
8
9
|
import { log as showLog } from "./commands/log.js";
|
|
9
10
|
import { daemonStart, daemonStop, daemonStatus, daemonInstall, daemonUninstall } from "./daemon/index.js";
|
|
11
|
+
import { upgrade } from "./commands/upgrade.js";
|
|
10
12
|
import { bold, dim } from "./output.js";
|
|
11
|
-
const VERSION = "0.
|
|
13
|
+
const VERSION = "0.3.1";
|
|
12
14
|
// Commands that take 1 word
|
|
13
15
|
const TOP_COMMANDS = new Set([
|
|
14
16
|
"help", "version", "store", "append", "search", "find", "convs",
|
|
15
17
|
"start", "stop", "status", "install", "uninstall", "log",
|
|
18
|
+
"signup", "login", "link", "upgrade",
|
|
16
19
|
]);
|
|
17
20
|
// Commands that take 2 words (group + subcommand)
|
|
18
21
|
const GROUP_COMMANDS = new Set(["auth", "conversations", "conv", "daemon"]);
|
|
@@ -72,9 +75,8 @@ async function getClient() {
|
|
|
72
75
|
const apiKey = process.env.ENGRAM_API_KEY ?? config.apiKey;
|
|
73
76
|
if (!apiKey) {
|
|
74
77
|
console.error("Not authenticated. Run:\n\n" +
|
|
75
|
-
" engram
|
|
76
|
-
" #
|
|
77
|
-
" export ENGRAM_API_KEY=engram_sk_live_...\n");
|
|
78
|
+
" engram signup # create a free account\n" +
|
|
79
|
+
" engram login # sign in with email + password\n");
|
|
78
80
|
process.exit(1);
|
|
79
81
|
}
|
|
80
82
|
return new Engram({
|
|
@@ -90,7 +92,11 @@ ${bold("USAGE")}
|
|
|
90
92
|
engram <command> [options]
|
|
91
93
|
|
|
92
94
|
${bold("COMMANDS")}
|
|
93
|
-
${bold("
|
|
95
|
+
${bold("signup")} Create a free account instantly
|
|
96
|
+
${bold("login")} Sign in with email + password
|
|
97
|
+
${bold("link")} Link email to your account for dashboard access
|
|
98
|
+
|
|
99
|
+
${bold("auth login")} <key> Authenticate with API key ${dim("(manual)")}
|
|
94
100
|
${bold("auth logout")} Remove stored credentials
|
|
95
101
|
${bold("auth status")} Show authentication status
|
|
96
102
|
|
|
@@ -102,6 +108,7 @@ ${bold("COMMANDS")}
|
|
|
102
108
|
${bold("store")} -c <id> <message> Store a message
|
|
103
109
|
${bold("search")} <query> Semantic search across memory
|
|
104
110
|
${bold("log")} Show recent AI conversation activity
|
|
111
|
+
${bold("upgrade")} [pro|team] Upgrade your plan (opens Stripe checkout)
|
|
105
112
|
|
|
106
113
|
${bold("start")} Start background daemon (auto-capture)
|
|
107
114
|
${bold("stop")} Stop the daemon
|
|
@@ -119,7 +126,8 @@ ${bold("OPTIONS")}
|
|
|
119
126
|
--agent <id> Filter by agent ID
|
|
120
127
|
|
|
121
128
|
${bold("EXAMPLES")}
|
|
122
|
-
engram
|
|
129
|
+
engram signup
|
|
130
|
+
engram login
|
|
123
131
|
engram conversations create --title "My Chat" --tags dev,test
|
|
124
132
|
engram store -c conv_abc "deployed v2.1 to production"
|
|
125
133
|
engram search "when did we deploy"
|
|
@@ -151,6 +159,15 @@ async function main() {
|
|
|
151
159
|
case "-v":
|
|
152
160
|
console.log(`engram ${VERSION}`);
|
|
153
161
|
break;
|
|
162
|
+
case "signup":
|
|
163
|
+
await signup();
|
|
164
|
+
break;
|
|
165
|
+
case "login":
|
|
166
|
+
await login();
|
|
167
|
+
break;
|
|
168
|
+
case "link":
|
|
169
|
+
await link();
|
|
170
|
+
break;
|
|
154
171
|
case "auth login":
|
|
155
172
|
await authLogin(args);
|
|
156
173
|
break;
|
|
@@ -189,6 +206,9 @@ async function main() {
|
|
|
189
206
|
case "log":
|
|
190
207
|
await showLog(await getClient(), args, flags);
|
|
191
208
|
break;
|
|
209
|
+
case "upgrade":
|
|
210
|
+
await upgrade(args, flags);
|
|
211
|
+
break;
|
|
192
212
|
// Daemon commands — short aliases + namespaced
|
|
193
213
|
case "start":
|
|
194
214
|
case "daemon start":
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC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ACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;YACzB,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACzC,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getengram/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "CLI for Engram — persistent memory for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"cli",
|
|
19
19
|
"mcp"
|
|
20
20
|
],
|
|
21
|
-
"license": "
|
|
21
|
+
"license": "BSL-1.1",
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://getengram.app",
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"@getengram/sdk": "^0.1.1",
|
|
31
32
|
"better-sqlite3": "^12.8.0",
|
|
32
|
-
"chokidar": "^5.0.0"
|
|
33
|
-
"@getengram/sdk": "0.1.1"
|
|
33
|
+
"chokidar": "^5.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/better-sqlite3": "^7.6.13",
|