@satori-sh/cli 0.0.33 → 0.1.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.
Files changed (120) hide show
  1. package/README.md +16 -3
  2. package/bin/satori.js +13 -0
  3. package/dist/add.d.ts +23 -0
  4. package/dist/add.d.ts.map +1 -0
  5. package/dist/add.js +55 -0
  6. package/dist/add.js.map +1 -0
  7. package/dist/chunk-pgay1aps.js +27331 -0
  8. package/dist/chunk-zhxnt6w7.js +32 -0
  9. package/dist/commands/add.d.ts +3 -0
  10. package/dist/commands/add.d.ts.map +1 -0
  11. package/dist/commands/add.js +12 -0
  12. package/dist/commands/add.js.map +1 -0
  13. package/dist/commands/chat.d.ts +5 -0
  14. package/dist/commands/chat.d.ts.map +1 -0
  15. package/dist/commands/chat.js +22 -0
  16. package/dist/commands/chat.js.map +1 -0
  17. package/dist/commands/copy-logs.d.ts +3 -0
  18. package/dist/commands/copy-logs.d.ts.map +1 -0
  19. package/dist/commands/copy-logs.js +39 -0
  20. package/dist/commands/copy-logs.js.map +1 -0
  21. package/dist/commands/get.d.ts +3 -0
  22. package/dist/commands/get.d.ts.map +1 -0
  23. package/dist/commands/get.js +21 -0
  24. package/dist/commands/get.js.map +1 -0
  25. package/dist/commands/memory.d.ts +3 -0
  26. package/dist/commands/memory.d.ts.map +1 -0
  27. package/dist/commands/memory.js +37 -0
  28. package/dist/commands/memory.js.map +1 -0
  29. package/dist/commands/search.d.ts +3 -0
  30. package/dist/commands/search.d.ts.map +1 -0
  31. package/dist/commands/search.js +12 -0
  32. package/dist/commands/search.js.map +1 -0
  33. package/dist/commands/sub.d.ts +3 -0
  34. package/dist/commands/sub.d.ts.map +1 -0
  35. package/dist/commands/sub.js +39 -0
  36. package/dist/commands/sub.js.map +1 -0
  37. package/dist/config.d.ts +51 -0
  38. package/dist/config.d.ts.map +1 -0
  39. package/dist/config.js +195 -0
  40. package/dist/config.js.map +1 -0
  41. package/dist/index.d.ts +4 -82
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +65 -5443
  44. package/dist/index.js.map +1 -0
  45. package/dist/lib/ask.d.ts +4 -0
  46. package/dist/lib/ask.d.ts.map +1 -0
  47. package/dist/lib/ask.js +44 -0
  48. package/dist/lib/ask.js.map +1 -0
  49. package/dist/lib/cli-overrides.d.ts +6 -0
  50. package/dist/lib/cli-overrides.d.ts.map +1 -0
  51. package/dist/lib/cli-overrides.js +28 -0
  52. package/dist/lib/cli-overrides.js.map +1 -0
  53. package/dist/lib/config-validation.d.ts +3 -0
  54. package/dist/lib/config-validation.d.ts.map +1 -0
  55. package/dist/lib/config-validation.js +16 -0
  56. package/dist/lib/config-validation.js.map +1 -0
  57. package/dist/lib/constants.d.ts +9 -0
  58. package/dist/lib/constants.d.ts.map +1 -0
  59. package/dist/lib/constants.js +14 -0
  60. package/dist/lib/constants.js.map +1 -0
  61. package/dist/lib/fatal.d.ts +2 -0
  62. package/dist/lib/fatal.d.ts.map +1 -0
  63. package/dist/lib/fatal.js +6 -0
  64. package/dist/lib/fatal.js.map +1 -0
  65. package/dist/lib/info-display.d.ts +14 -0
  66. package/dist/lib/info-display.d.ts.map +1 -0
  67. package/dist/lib/info-display.js +26 -0
  68. package/dist/lib/info-display.js.map +1 -0
  69. package/dist/lib/logging.d.ts +4 -0
  70. package/dist/lib/logging.d.ts.map +1 -0
  71. package/dist/lib/logging.js +24 -0
  72. package/dist/lib/logging.js.map +1 -0
  73. package/dist/lib/telemetry.d.ts +17 -0
  74. package/dist/lib/telemetry.d.ts.map +1 -0
  75. package/dist/lib/telemetry.js +60 -0
  76. package/dist/lib/telemetry.js.map +1 -0
  77. package/dist/memory.d.ts +41 -0
  78. package/dist/memory.d.ts.map +1 -0
  79. package/dist/memory.js +93 -0
  80. package/dist/memory.js.map +1 -0
  81. package/dist/search.d.ts +14 -0
  82. package/dist/search.d.ts.map +1 -0
  83. package/dist/search.js +53 -0
  84. package/dist/search.js.map +1 -0
  85. package/dist/src/add.d.ts +23 -0
  86. package/dist/src/add.d.ts.map +1 -0
  87. package/dist/src/add.js +50 -0
  88. package/dist/src/add.js.map +1 -0
  89. package/dist/src/config.d.ts +51 -0
  90. package/dist/src/config.d.ts.map +1 -0
  91. package/dist/src/config.js +195 -0
  92. package/dist/src/config.js.map +1 -0
  93. package/dist/src/index.d.ts +14 -0
  94. package/dist/src/index.d.ts.map +1 -0
  95. package/dist/src/index.js +446 -0
  96. package/dist/src/index.js.map +1 -0
  97. package/dist/src/memory.d.ts +41 -0
  98. package/dist/src/memory.d.ts.map +1 -0
  99. package/dist/src/memory.js +93 -0
  100. package/dist/src/memory.js.map +1 -0
  101. package/dist/src/search.d.ts +14 -0
  102. package/dist/src/search.d.ts.map +1 -0
  103. package/dist/src/search.js +43 -0
  104. package/dist/src/search.js.map +1 -0
  105. package/dist/src/types.d.ts +74 -0
  106. package/dist/src/types.d.ts.map +1 -0
  107. package/dist/src/types.js +2 -0
  108. package/dist/src/types.js.map +1 -0
  109. package/dist/tests/index.test.d.ts +2 -0
  110. package/dist/tests/index.test.d.ts.map +1 -0
  111. package/dist/tests/index.test.js +252 -0
  112. package/dist/tests/index.test.js.map +1 -0
  113. package/dist/types.d.ts +74 -0
  114. package/dist/types.d.ts.map +1 -0
  115. package/dist/types.js +2 -0
  116. package/dist/types.js.map +1 -0
  117. package/logos/chars.png +0 -0
  118. package/logos/s.png +0 -0
  119. package/logos/satori.png +0 -0
  120. package/package.json +10 -13
@@ -0,0 +1,32 @@
1
+ var __create = Object.create;
2
+ var __getProtoOf = Object.getPrototypeOf;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __toESM = (mod, isNodeMode, target) => {
7
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
8
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
9
+ for (let key of __getOwnPropNames(mod))
10
+ if (!__hasOwnProp.call(to, key))
11
+ __defProp(to, key, {
12
+ get: () => mod[key],
13
+ enumerable: true
14
+ });
15
+ return to;
16
+ };
17
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
18
+ var __export = (target, all) => {
19
+ for (var name in all)
20
+ __defProp(target, name, {
21
+ get: all[name],
22
+ enumerable: true,
23
+ configurable: true,
24
+ set: (newValue) => all[name] = () => newValue
25
+ });
26
+ };
27
+ var __require = import.meta.require;
28
+
29
+ export { __toESM, __commonJS, __export, __require };
30
+
31
+ //# debugId=F789B86C38CA030D64756E2164756E21
32
+ //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFtdLAogICJzb3VyY2VzQ29udGVudCI6IFsKICBdLAogICJtYXBwaW5ncyI6ICIiLAogICJkZWJ1Z0lkIjogIkY3ODlCODZDMzhDQTAzMEQ2NDc1NkUyMTY0NzU2RTIxIiwKICAibmFtZXMiOiBbXQp9
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const registerAddCommand: (program: Command, trackCommand: (event: string) => Promise<void>) => void;
3
+ //# sourceMappingURL=add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,kBAAkB,GAAI,SAAS,OAAO,EAAE,cAAc,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,SASlG,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { addMemories } from '../add.js';
2
+ export const registerAddCommand = (program, trackCommand) => {
3
+ program
4
+ .command('add')
5
+ .description('add a new memory')
6
+ .argument('<text>', 'text to add as memory')
7
+ .action(async (text) => {
8
+ await trackCommand('cli_add');
9
+ await addMemories(text);
10
+ });
11
+ };
12
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAgB,EAAE,YAA8C,EAAE,EAAE;IACrG,OAAO;SACJ,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,kBAAkB,CAAC;SAC/B,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;SAC3C,MAAM,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE;QAC7B,MAAM,YAAY,CAAC,SAAS,CAAC,CAAC;QAC9B,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Command } from 'commander';
2
+ import { type InfoDisplay } from '../lib/info-display.js';
3
+ import { type ProcessUserInput } from '../types.js';
4
+ export declare const registerChatCommand: (program: Command, getInfoDisplay: () => Promise<InfoDisplay>, processUserInput: ProcessUserInput) => void;
5
+ //# sourceMappingURL=chat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/commands/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAgB7E,eAAO,MAAM,mBAAmB,GAC9B,SAAS,OAAO,EAChB,gBAAgB,MAAM,OAAO,CAAC,WAAW,CAAC,EAC1C,kBAAkB,gBAAgB,SAWnC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { fatal } from '../lib/fatal.js';
2
+ const runChat = async (initialPrompt, options, getInfoDisplay, processUserInput) => {
3
+ if (!initialPrompt) {
4
+ return;
5
+ }
6
+ const info = await getInfoDisplay();
7
+ console.log(info.fullLine);
8
+ await processUserInput(initialPrompt, options, 'cli');
9
+ };
10
+ export const registerChatCommand = (program, getInfoDisplay, processUserInput) => {
11
+ program
12
+ .argument('[prompt]', 'initial prompt for chat session (optional)')
13
+ .action(async (initialPrompt, options) => {
14
+ try {
15
+ await runChat(initialPrompt, options, getInfoDisplay, processUserInput);
16
+ }
17
+ catch (error) {
18
+ fatal(`Chat error: ${error instanceof Error ? error.message : error}`);
19
+ }
20
+ });
21
+ };
22
+ //# sourceMappingURL=chat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/commands/chat.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAGxC,MAAM,OAAO,GAAG,KAAK,EACnB,aAAiC,EACjC,OAA2B,EAC3B,cAA0C,EAC1C,gBAAkC,EAClC,EAAE;IACF,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO;IACT,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,cAAc,EAAE,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3B,MAAM,gBAAgB,CAAC,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,OAAgB,EAChB,cAA0C,EAC1C,gBAAkC,EAClC,EAAE;IACF,OAAO;SACJ,QAAQ,CAAC,UAAU,EAAE,4CAA4C,CAAC;SAClE,MAAM,CAAC,KAAK,EAAE,aAAiC,EAAE,OAA2B,EAAE,EAAE;QAC/E,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,gBAAgB,CAAC,CAAC;QAC1E,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,KAAK,CAAC,eAAe,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QACzE,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const registerCopyLogsCommand: (program: Command, trackCommand: (event: string) => Promise<void>) => void;
3
+ //# sourceMappingURL=copy-logs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-logs.d.ts","sourceRoot":"","sources":["../../src/commands/copy-logs.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,eAAO,MAAM,uBAAuB,GAAI,SAAS,OAAO,EAAE,cAAc,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,SAgCvG,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { readFileSync } from 'node:fs';
3
+ import { fatal } from '../lib/fatal.js';
4
+ import { LOG_PATH } from '../lib/logging.js';
5
+ export const registerCopyLogsCommand = (program, trackCommand) => {
6
+ program
7
+ .command('copy')
8
+ .description('copy logs.txt contents')
9
+ .argument('[target]', 'copy target')
10
+ .action(async (target) => {
11
+ if (target && target !== 'logs') {
12
+ fatal('Unknown copy target. Use `copy logs`.');
13
+ }
14
+ await trackCommand('cli_copy_logs');
15
+ let contents = '';
16
+ try {
17
+ contents = readFileSync(LOG_PATH, 'utf8');
18
+ }
19
+ catch {
20
+ console.log(`No logs yet. Expected at ${LOG_PATH}`);
21
+ return;
22
+ }
23
+ if (process.platform !== 'darwin') {
24
+ console.log(contents);
25
+ return;
26
+ }
27
+ await new Promise((resolve, reject) => {
28
+ const pbcopy = execFile('pbcopy', (error) => {
29
+ if (error) {
30
+ reject(error);
31
+ return;
32
+ }
33
+ resolve();
34
+ });
35
+ pbcopy.stdin?.end(contents);
36
+ });
37
+ });
38
+ };
39
+ //#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K,EAAE,CAAC;oBACV,MAAM,CAAC,KAAK,CAAC,CAAC;oBACd,OAAO;gBACT,CAAC;gBACD,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const registerGetCommand: (program: Command, trackCommand: (event: string) => Promise<void>) => void;
3
+ //# sourceMappingURL=get.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../src/commands/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,eAAO,MAAM,kBAAkB,GAAI,SAAS,OAAO,EAAE,cAAc,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,SAgBlG,CAAC"}
@@ -0,0 +1,21 @@
1
+ import chalk from 'chalk';
2
+ import { getStoredApiKey } from '../config.js';
3
+ import { fatal } from '../lib/fatal.js';
4
+ export const registerGetCommand = (program, trackCommand) => {
5
+ program
6
+ .command('get')
7
+ .description('get config value (e.g. `get api-key`)')
8
+ .argument('<key>', 'key to get')
9
+ .action(async (key) => {
10
+ await trackCommand('cli_get');
11
+ if (key !== 'api-key') {
12
+ fatal('Unknown key');
13
+ }
14
+ const apiKey = await getStoredApiKey();
15
+ if (!apiKey) {
16
+ fatal('API key not found in config');
17
+ }
18
+ console.log(chalk.magenta(`\n ${apiKey} \n`));
19
+ });
20
+ };
21
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../src/commands/get.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAgB,EAAE,YAA8C,EAAE,EAAE;IACrG,OAAO;SACJ,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,uCAAuC,CAAC;SACpD,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;SAC/B,MAAM,CAAC,KAAK,EAAE,GAAW,EAAE,EAAE;QAC5B,MAAM,YAAY,CAAC,SAAS,CAAC,CAAC;QAC9B,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,KAAK,CAAC,aAAa,CAAC,CAAC;QACvB,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,eAAe,EAAE,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,MAAM,QAAQ,CAAC,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const registerMemoryCommand: (program: Command, trackCommand: (event: string) => Promise<void>) => void;
3
+ //# sourceMappingURL=memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/commands/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,qBAAqB,GAAI,SAAS,OAAO,EAAE,cAAc,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,SAqCrG,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { listMemoryIds, setMemoryId } from '../memory.js';
2
+ export const registerMemoryCommand = (program, trackCommand) => {
3
+ const memory = program
4
+ .command('memory')
5
+ .description('manage memory ids');
6
+ memory
7
+ .command('list')
8
+ .description('list memory ids')
9
+ .action(async () => {
10
+ await trackCommand('cli_memory_list');
11
+ const memoryIds = await listMemoryIds();
12
+ if (memoryIds.length === 0) {
13
+ console.log('No memory ids found.');
14
+ return;
15
+ }
16
+ console.log(memoryIds.join('\n'));
17
+ });
18
+ memory
19
+ .command('new')
20
+ .description('create a new memory id and set it')
21
+ .argument('<memory-id-name>', 'memory id to set')
22
+ .action(async (memoryId) => {
23
+ await trackCommand('cli_memory_new');
24
+ await setMemoryId(memoryId);
25
+ console.log(`Memory id set to ${memoryId}`);
26
+ });
27
+ memory
28
+ .command('use')
29
+ .description('switch to a memory id')
30
+ .argument('<memory-id>', 'memory id to set')
31
+ .action(async (memoryId) => {
32
+ await trackCommand('cli_memory_use');
33
+ await setMemoryId(memoryId);
34
+ console.log(`Memory id set to ${memoryId}`);
35
+ });
36
+ };
37
+ //# sourceMappingURL=memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/commands/memory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE1D,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,OAAgB,EAAE,YAA8C,EAAE,EAAE;IACxG,MAAM,MAAM,GAAG,OAAO;SACnB,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAEpC,MAAM;SACH,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,iBAAiB,CAAC;SAC9B,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,YAAY,CAAC,iBAAiB,CAAC,CAAC;QACtC,MAAM,SAAS,GAAG,MAAM,aAAa,EAAE,CAAC;QACxC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;YACpC,OAAO;QACT,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEL,MAAM;SACH,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,mCAAmC,CAAC;SAChD,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;SAChD,MAAM,CAAC,KAAK,EAAE,QAAgB,EAAE,EAAE;QACjC,MAAM,YAAY,CAAC,gBAAgB,CAAC,CAAC;QACrC,MAAM,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,oBAAoB,QAAQ,EAAE,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEL,MAAM;SACH,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,uBAAuB,CAAC;SACpC,QAAQ,CAAC,aAAa,EAAE,kBAAkB,CAAC;SAC3C,MAAM,CAAC,KAAK,EAAE,QAAgB,EAAE,EAAE;QACjC,MAAM,YAAY,CAAC,gBAAgB,CAAC,CAAC;QACrC,MAAM,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,oBAAoB,QAAQ,EAAE,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const registerSearchCommand: (program: Command, trackCommand: (event: string) => Promise<void>) => void;
3
+ //# sourceMappingURL=search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,qBAAqB,GAAI,SAAS,OAAO,EAAE,cAAc,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,SASrG,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { searchMemories } from '../search.js';
2
+ export const registerSearchCommand = (program, trackCommand) => {
3
+ program
4
+ .command('search')
5
+ .description('search memories')
6
+ .argument('<query>', 'search query for memories')
7
+ .action(async (query) => {
8
+ await trackCommand('cli_search');
9
+ await searchMemories(query);
10
+ });
11
+ };
12
+ //# sourceMappingURL=search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,OAAgB,EAAE,YAA8C,EAAE,EAAE;IACxG,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,iBAAiB,CAAC;SAC9B,QAAQ,CAAC,SAAS,EAAE,2BAA2B,CAAC;SAChD,MAAM,CAAC,KAAK,EAAE,KAAa,EAAE,EAAE;QAC9B,MAAM,YAAY,CAAC,YAAY,CAAC,CAAC;QACjC,MAAM,cAAc,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const registerSubCommand: (program: Command, trackCommand: (event: string) => Promise<void>) => void;
3
+ //# sourceMappingURL=sub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sub.d.ts","sourceRoot":"","sources":["../../src/commands/sub.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,eAAO,MAAM,kBAAkB,GAAI,SAAS,OAAO,EAAE,cAAc,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,SAuBlG,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { getConfig } from '../config.js';
3
+ import { fatal } from '../lib/fatal.js';
4
+ const parseCheckoutUrl = (checkoutUrlRaw) => {
5
+ if (typeof checkoutUrlRaw !== 'string' || checkoutUrlRaw.length === 0) {
6
+ fatal('SATORI_CHECKOUT_URL is not set');
7
+ }
8
+ const checkoutUrl = checkoutUrlRaw;
9
+ try {
10
+ return new URL(checkoutUrl).toString();
11
+ }
12
+ catch {
13
+ fatal('SATORI_CHECKOUT_URL is not a valid URL');
14
+ }
15
+ throw new Error('Unreachable');
16
+ };
17
+ export const registerSubCommand = (program, trackCommand) => {
18
+ program
19
+ .command('sub')
20
+ .description('open the subscription checkout')
21
+ .action(async () => {
22
+ await trackCommand('cli_sub');
23
+ const config = await getConfig();
24
+ const checkoutUrl = parseCheckoutUrl(config.checkoutUrl);
25
+ if (process.platform !== 'darwin') {
26
+ console.log(checkoutUrl);
27
+ return;
28
+ }
29
+ await new Promise((resolve) => {
30
+ execFile('open', [checkoutUrl], (error) => {
31
+ if (error) {
32
+ console.log(checkoutUrl);
33
+ }
34
+ resolve();
35
+ });
36
+ });
37
+ });
38
+ };
39
+ //# sourceMappingURL=sub.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sub.js","sourceRoot":"","sources":["../../src/commands/sub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI9C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,MAAM,gBAAgB,GAAG,CAAC,cAA6B,EAAU,EAAE;IACjE,IAAI,OAAO,cAAc,KAAK,QAAQ,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtE,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAC1C,CAAC;IACD,MAAM,WAAW,GAAG,cAAwB,CAAC;IAC7C,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAClD,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAgB,EAAE,YAA8C,EAAE,EAAE;IACrG,OAAO;SACJ,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,gCAAgC,CAAC;SAC7C,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,YAAY,CAAC,SAAS,CAAC,CAAC;QAC9B,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,gBAAgB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAEzD,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAClC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YACzB,OAAO;QACT,CAAC;QAED,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YAClC,QAAQ,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,KAAmB,EAAE,EAAE;gBACtD,IAAI,KAAK,EAAE,CAAC;oBACV,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;gBAC3B,CAAC;gBACD,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { Config } from './types.js';
2
+ /**
3
+ * Checks write access to the config directory by attempting to create, write, and delete a temporary file.
4
+ *
5
+ * @throws {Error} If write access is denied or any operation fails
6
+ */
7
+ export declare function checkWriteAccess(): Promise<void>;
8
+ type ConfigOverrides = {
9
+ apiKey?: string;
10
+ memoryId?: string;
11
+ };
12
+ export declare const setConfigOverrides: (overrides: ConfigOverrides) => void;
13
+ /**
14
+ * Saves the API key to the config file.
15
+ *
16
+ * @param {string} apiKey - The API key to save
17
+ * @throws {Error} If write access fails or saving fails
18
+ */
19
+ export declare function saveApiKey(apiKey: string): Promise<void>;
20
+ /**
21
+ * Reads the stored API key from the config file only.
22
+ *
23
+ * @returns {Promise<string | null>} The stored API key or null
24
+ */
25
+ export declare function getStoredApiKey(): Promise<string | null>;
26
+ /**
27
+ * Saves the memory ID to the config file.
28
+ *
29
+ * @param {string} memoryId - The memory ID to save
30
+ * @throws {Error} If write access fails or saving fails
31
+ */
32
+ export declare function saveMemoryId(memoryId: string): Promise<void>;
33
+ /**
34
+ * Retrieves and validates configuration from file and environment variables.
35
+ * Fetches the memory_id and api_key from the config file in ~/.config/satori/satori.json.
36
+ *
37
+ * If the API key isn't in the config, it looks in SATORI_API_KEY.
38
+ * If there is no API key in either place it will call the API to get a new key.
39
+ *
40
+ * @returns {Promise<Config>} The validated configuration object
41
+ * @throws {Error} If required environment variables are missing or invalid
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const config = await getConfig();
46
+ * console.log(config.apiKey); // API key from ~/.config/satori/satori.json or SATORI_API_KEY env var, or null
47
+ * ```
48
+ */
49
+ export declare function getConfig(): Promise<Config>;
50
+ export {};
51
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAKpC;;;;GAIG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAatD;AAED,KAAK,eAAe,GAAG;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAIF,eAAO,MAAM,kBAAkB,GAAI,WAAW,eAAe,SAE5D,CAAC;AAIF;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAa9D;AAED;;;;GAIG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAM9D;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAalE;AAsBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CA6EjD"}
package/dist/config.js ADDED
@@ -0,0 +1,195 @@
1
+ import { homedir } from 'node:os';
2
+ import { join } from 'node:path';
3
+ import { randomUUID } from 'node:crypto';
4
+ /**
5
+ * Checks write access to the config directory by attempting to create, write, and delete a temporary file.
6
+ *
7
+ * @throws {Error} If write access is denied or any operation fails
8
+ */
9
+ export async function checkWriteAccess() {
10
+ // Dynamic import used instead of static import at top-level to enable mocking with Bun's mock.module() in tests.
11
+ // Static imports cannot be overridden by module mocks in Bun, so this allows fs operations to be properly mocked.
12
+ const { promises: fs } = await import('node:fs');
13
+ const dir = join(homedir(), '.config', 'satori');
14
+ try {
15
+ await fs.mkdir(dir, { recursive: true });
16
+ const tempFile = join(dir, `temp-${randomUUID()}.txt`);
17
+ await fs.writeFile(tempFile, 'test');
18
+ await fs.unlink(tempFile);
19
+ }
20
+ catch (error) {
21
+ throw new Error(`Cannot write to config directory: ${error instanceof Error ? error.message : error}`);
22
+ }
23
+ }
24
+ let configOverrides = null;
25
+ export const setConfigOverrides = (overrides) => {
26
+ configOverrides = { ...overrides };
27
+ };
28
+ const getConfigOverrides = () => configOverrides ?? {};
29
+ /**
30
+ * Saves the API key to the config file.
31
+ *
32
+ * @param {string} apiKey - The API key to save
33
+ * @throws {Error} If write access fails or saving fails
34
+ */
35
+ export async function saveApiKey(apiKey) {
36
+ // Dynamic import used instead of static import at top-level to enable mocking with Bun's mock.module() in tests.
37
+ // Static imports cannot be overridden by module mocks in Bun, so this allows fs operations to be properly mocked.
38
+ const { promises: fs } = await import('node:fs');
39
+ await checkWriteAccess();
40
+ const configPath = join(homedir(), '.config', 'satori', 'satori.json');
41
+ try {
42
+ const existing = await loadConfigFile();
43
+ const config = { ...existing, api_key: apiKey };
44
+ await fs.writeFile(configPath, JSON.stringify(config, null, 2));
45
+ }
46
+ catch (error) {
47
+ throw new Error(`Failed to save API key: ${error instanceof Error ? error.message : error}`);
48
+ }
49
+ }
50
+ /**
51
+ * Reads the stored API key from the config file only.
52
+ *
53
+ * @returns {Promise<string | null>} The stored API key or null
54
+ */
55
+ export async function getStoredApiKey() {
56
+ const data = await loadConfigFile();
57
+ if (typeof data.api_key === 'string') {
58
+ return data.api_key;
59
+ }
60
+ return null;
61
+ }
62
+ /**
63
+ * Saves the memory ID to the config file.
64
+ *
65
+ * @param {string} memoryId - The memory ID to save
66
+ * @throws {Error} If write access fails or saving fails
67
+ */
68
+ export async function saveMemoryId(memoryId) {
69
+ // Dynamic import used instead of static import at top-level to enable mocking with Bun's mock.module() in tests.
70
+ // Static imports cannot be overridden by module mocks in Bun, so this allows fs operations to be properly mocked.
71
+ const { promises: fs } = await import('node:fs');
72
+ await checkWriteAccess();
73
+ const configPath = join(homedir(), '.config', 'satori', 'satori.json');
74
+ try {
75
+ const existing = await loadConfigFile();
76
+ const config = { ...existing, memory_id: memoryId };
77
+ await fs.writeFile(configPath, JSON.stringify(config, null, 2));
78
+ }
79
+ catch (error) {
80
+ throw new Error(`Failed to save memory ID: ${error instanceof Error ? error.message : error}`);
81
+ }
82
+ }
83
+ /**
84
+ * Loads the config file data.
85
+ *
86
+ * @returns {Promise<Record<string, unknown>>} The config data
87
+ */
88
+ async function loadConfigFile() {
89
+ try {
90
+ const { promises: fs } = await import('node:fs');
91
+ const configPath = join(homedir(), '.config', 'satori', 'satori.json');
92
+ const raw = await fs.readFile(configPath, 'utf8');
93
+ const data = JSON.parse(raw);
94
+ if (data && typeof data === 'object') {
95
+ return data;
96
+ }
97
+ }
98
+ catch {
99
+ // Ignore errors
100
+ }
101
+ return {};
102
+ }
103
+ /**
104
+ * Retrieves and validates configuration from file and environment variables.
105
+ * Fetches the memory_id and api_key from the config file in ~/.config/satori/satori.json.
106
+ *
107
+ * If the API key isn't in the config, it looks in SATORI_API_KEY.
108
+ * If there is no API key in either place it will call the API to get a new key.
109
+ *
110
+ * @returns {Promise<Config>} The validated configuration object
111
+ * @throws {Error} If required environment variables are missing or invalid
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * const config = await getConfig();
116
+ * console.log(config.apiKey); // API key from ~/.config/satori/satori.json or SATORI_API_KEY env var, or null
117
+ * ```
118
+ */
119
+ export async function getConfig() {
120
+ if (process.platform !== 'darwin') {
121
+ throw new Error('We do not currently support Windows yet, email support@satori.sh to request Windows support');
122
+ }
123
+ const overrides = getConfigOverrides();
124
+ const shouldSkipFile = Boolean(overrides.apiKey || overrides.memoryId);
125
+ let apiKey = overrides.apiKey ?? null;
126
+ let memoryId = overrides.memoryId;
127
+ const openaiApiKey = process.env.OPENAI_API_KEY || null;
128
+ if (!shouldSkipFile) {
129
+ try {
130
+ const data = await loadConfigFile();
131
+ if (typeof data.api_key === 'string') {
132
+ apiKey = data.api_key;
133
+ }
134
+ if (typeof data.memory_id === 'string') {
135
+ memoryId = data.memory_id;
136
+ }
137
+ }
138
+ catch {
139
+ // If file reading or parsing fails, apiKey and memoryId remain default
140
+ }
141
+ }
142
+ // Fallback to environment variable if not set from file
143
+ if (!apiKey) {
144
+ apiKey = process.env.SATORI_API_KEY || null;
145
+ }
146
+ const nodeEnv = process.env.NODE_ENV;
147
+ const baseUrl = process.env.SATORI_BASE_URL
148
+ || (nodeEnv !== 'production' ? 'http://localhost:8000' : 'https://api.satori.sh');
149
+ const checkoutUrl = process.env.SATORI_CHECKOUT_URL
150
+ || (nodeEnv === 'production'
151
+ ? 'https://buy.stripe.com/aFabJ03GIez6bH53Ckew800'
152
+ : 'https://buy.stripe.com/test_14AeVc5TZc2GapagZp0gw00');
153
+ try {
154
+ new URL(baseUrl);
155
+ }
156
+ catch {
157
+ throw new Error('Invalid SATORI_BASE_URL format');
158
+ }
159
+ if (checkoutUrl) {
160
+ try {
161
+ new URL(checkoutUrl);
162
+ }
163
+ catch {
164
+ throw new Error('Invalid SATORI_CHECKOUT_URL format');
165
+ }
166
+ }
167
+ // Generate new API key if still null
168
+ if (!apiKey) {
169
+ try {
170
+ const response = await fetch(`${baseUrl}/orgs`, {
171
+ method: 'POST',
172
+ });
173
+ if (!response.ok) {
174
+ throw new Error(`HTTP error: ${response.status} ${response.statusText}`);
175
+ }
176
+ const data = await response.json();
177
+ if (data && typeof data.api_key === 'string') {
178
+ apiKey = data.api_key;
179
+ await saveApiKey(apiKey);
180
+ }
181
+ else {
182
+ throw new Error('Invalid response: missing api_key');
183
+ }
184
+ }
185
+ catch (error) {
186
+ throw new Error(`Failed to generate API key: ${error instanceof Error ? error.message : error}`);
187
+ }
188
+ }
189
+ // Fallback to config file memoryId if not set via env
190
+ if (!memoryId) {
191
+ memoryId = process.env.SATORI_MEMORY_ID;
192
+ }
193
+ return { apiKey, openaiApiKey, baseUrl, checkoutUrl, memoryId };
194
+ }
195
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,iHAAiH;IACjH,kHAAkH;IAClH,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;IACjD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IACjD,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACzC,MAA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