memax-cli 0.1.0-alpha.2 → 0.1.0-alpha.21
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/assets/skills/memax-memory/SKILL.md +154 -0
- package/dist/commands/auth.d.ts +1 -0
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +14 -7
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/capture.d.ts +17 -0
- package/dist/commands/capture.d.ts.map +1 -0
- package/dist/commands/capture.js +60 -0
- package/dist/commands/capture.js.map +1 -0
- package/dist/commands/delete.d.ts +1 -1
- package/dist/commands/delete.d.ts.map +1 -1
- package/dist/commands/delete.js +22 -5
- package/dist/commands/delete.js.map +1 -1
- package/dist/commands/hub.d.ts +4 -0
- package/dist/commands/hub.d.ts.map +1 -0
- package/dist/commands/hub.js +53 -0
- package/dist/commands/hub.js.map +1 -0
- package/dist/commands/list.d.ts +2 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +35 -8
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +32 -7
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +226 -26
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/push.d.ts +2 -1
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +49 -11
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/recall.d.ts +1 -0
- package/dist/commands/recall.d.ts.map +1 -1
- package/dist/commands/recall.js +30 -27
- package/dist/commands/recall.js.map +1 -1
- package/dist/commands/setup-hooks.d.ts +12 -0
- package/dist/commands/setup-hooks.d.ts.map +1 -0
- package/dist/commands/setup-hooks.js +184 -0
- package/dist/commands/setup-hooks.js.map +1 -0
- package/dist/commands/setup-instructions.d.ts +21 -0
- package/dist/commands/setup-instructions.d.ts.map +1 -0
- package/dist/commands/setup-instructions.js +172 -0
- package/dist/commands/setup-instructions.js.map +1 -0
- package/dist/commands/setup-mcp.d.ts +14 -0
- package/dist/commands/setup-mcp.d.ts.map +1 -0
- package/dist/commands/setup-mcp.js +276 -0
- package/dist/commands/setup-mcp.js.map +1 -0
- package/dist/commands/setup-types.d.ts +20 -0
- package/dist/commands/setup-types.d.ts.map +1 -0
- package/dist/commands/setup-types.js +60 -0
- package/dist/commands/setup-types.js.map +1 -0
- package/dist/commands/setup.d.ts +18 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +371 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/show.d.ts.map +1 -1
- package/dist/commands/show.js +10 -13
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/sync.d.ts +7 -2
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +614 -107
- package/dist/commands/sync.js.map +1 -1
- package/dist/index.js +85 -14
- package/dist/index.js.map +1 -1
- package/dist/lib/client.d.ts +6 -0
- package/dist/lib/client.d.ts.map +1 -0
- package/dist/lib/client.js +69 -0
- package/dist/lib/client.js.map +1 -0
- package/dist/lib/project-context.d.ts +40 -0
- package/dist/lib/project-context.d.ts.map +1 -0
- package/dist/lib/project-context.js +157 -0
- package/dist/lib/project-context.js.map +1 -0
- package/dist/lib/prompt.d.ts +7 -0
- package/dist/lib/prompt.d.ts.map +1 -0
- package/dist/lib/prompt.js +41 -0
- package/dist/lib/prompt.js.map +1 -0
- package/package.json +17 -13
- package/dist/lib/api.d.ts +0 -4
- package/dist/lib/api.d.ts.map +0 -1
- package/dist/lib/api.js +0 -95
- package/dist/lib/api.js.map +0 -1
- package/src/commands/auth.ts +0 -92
- package/src/commands/config.ts +0 -27
- package/src/commands/delete.ts +0 -20
- package/src/commands/hook.ts +0 -243
- package/src/commands/list.ts +0 -38
- package/src/commands/login.ts +0 -159
- package/src/commands/mcp.ts +0 -282
- package/src/commands/push.ts +0 -82
- package/src/commands/recall.ts +0 -160
- package/src/commands/show.ts +0 -35
- package/src/commands/sync.ts +0 -403
- package/src/index.ts +0 -167
- package/src/lib/api.ts +0 -110
- package/src/lib/config.ts +0 -61
- package/src/lib/credentials.ts +0 -42
- package/tsconfig.json +0 -9
package/src/lib/config.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { homedir } from "node:os";
|
|
4
|
-
|
|
5
|
-
const CONFIG_DIR = join(homedir(), ".memax");
|
|
6
|
-
const CONFIG_FILE = join(CONFIG_DIR, "config.json");
|
|
7
|
-
|
|
8
|
-
export interface MemaxConfig {
|
|
9
|
-
api_url: string;
|
|
10
|
-
default_hub: string;
|
|
11
|
-
default_boundary: string;
|
|
12
|
-
auto_categorize: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const DEFAULT_CONFIG: MemaxConfig = {
|
|
16
|
-
api_url: "http://localhost:8080",
|
|
17
|
-
default_hub: "default",
|
|
18
|
-
default_boundary: "private",
|
|
19
|
-
auto_categorize: true,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export function getConfigDir(): string {
|
|
23
|
-
return CONFIG_DIR;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function loadConfig(): MemaxConfig {
|
|
27
|
-
// Env var overrides everything
|
|
28
|
-
const envUrl = process.env.MEMAX_API_URL;
|
|
29
|
-
|
|
30
|
-
if (!existsSync(CONFIG_FILE)) {
|
|
31
|
-
return envUrl ? { ...DEFAULT_CONFIG, api_url: envUrl } : DEFAULT_CONFIG;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
const raw = readFileSync(CONFIG_FILE, "utf-8");
|
|
36
|
-
const config = { ...DEFAULT_CONFIG, ...JSON.parse(raw) };
|
|
37
|
-
if (envUrl) config.api_url = envUrl;
|
|
38
|
-
return config;
|
|
39
|
-
} catch {
|
|
40
|
-
return envUrl ? { ...DEFAULT_CONFIG, api_url: envUrl } : DEFAULT_CONFIG;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function saveConfig(config: Partial<MemaxConfig>): void {
|
|
45
|
-
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
46
|
-
|
|
47
|
-
let existing = DEFAULT_CONFIG;
|
|
48
|
-
if (existsSync(CONFIG_FILE)) {
|
|
49
|
-
try {
|
|
50
|
-
existing = {
|
|
51
|
-
...DEFAULT_CONFIG,
|
|
52
|
-
...JSON.parse(readFileSync(CONFIG_FILE, "utf-8")),
|
|
53
|
-
};
|
|
54
|
-
} catch {
|
|
55
|
-
// ignore parse errors
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const merged = { ...existing, ...config };
|
|
60
|
-
writeFileSync(CONFIG_FILE, JSON.stringify(merged, null, 2) + "\n");
|
|
61
|
-
}
|
package/src/lib/credentials.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { getConfigDir } from "./config.js";
|
|
4
|
-
|
|
5
|
-
const CRED_FILE = join(getConfigDir(), "credentials.json");
|
|
6
|
-
|
|
7
|
-
interface Credentials {
|
|
8
|
-
access_token: string;
|
|
9
|
-
refresh_token: string;
|
|
10
|
-
expires_at?: number; // unix timestamp (ms)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function loadCredentials(): Credentials | null {
|
|
14
|
-
if (!existsSync(CRED_FILE)) return null;
|
|
15
|
-
try {
|
|
16
|
-
const creds = JSON.parse(readFileSync(CRED_FILE, "utf-8")) as Credentials;
|
|
17
|
-
if (!creds.access_token) return null;
|
|
18
|
-
return creds;
|
|
19
|
-
} catch {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function saveCredentials(creds: Credentials): void {
|
|
25
|
-
mkdirSync(getConfigDir(), { recursive: true });
|
|
26
|
-
writeFileSync(CRED_FILE, JSON.stringify(creds, null, 2) + "\n", {
|
|
27
|
-
mode: 0o600,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function isTokenExpired(): boolean {
|
|
32
|
-
const creds = loadCredentials();
|
|
33
|
-
if (!creds?.expires_at) return false; // no expiry info → assume valid
|
|
34
|
-
// Treat as expired 5 minutes early to avoid edge cases
|
|
35
|
-
return Date.now() >= creds.expires_at - 5 * 60 * 1000;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function clearCredentials(): void {
|
|
39
|
-
if (existsSync(CRED_FILE)) {
|
|
40
|
-
writeFileSync(CRED_FILE, "{}\n", { mode: 0o600 });
|
|
41
|
-
}
|
|
42
|
-
}
|