@illuminis/comprism 0.1.8 → 2.4.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.
Files changed (225) hide show
  1. package/out/{graph → build/machine/codemap}/read-python.js +2 -2
  2. package/out/{executor → build/machine/executor}/diagnostics.js +1 -1
  3. package/out/{executor → build/machine/executor}/hooks.js +1 -1
  4. package/out/{executor → build/machine/executor}/sandbox.js +1 -1
  5. package/out/build/machine/line/index.js +339 -0
  6. package/out/{commands/privacy.js → build/machine/runtime/home.js} +10 -19
  7. package/out/build/machine/runtime/needs.js +89 -0
  8. package/out/{lib → build/machine/runtime}/self.js +25 -3
  9. package/out/build/machine/terminal/jobs.js +67 -0
  10. package/out/build/machine/terminal/sign-in.js +212 -0
  11. package/out/build/machine/terminal/steps.js +460 -0
  12. package/out/build/machine/terminal/voice.js +136 -0
  13. package/out/build/machine/voice/record.js +286 -0
  14. package/out/cli-start.js +130 -0
  15. package/out/machine/line/index.js +339 -0
  16. package/out/machine/runtime/self.js +22 -0
  17. package/out/machine/terminal/clipboard.js +182 -0
  18. package/out/machine/terminal/jobs.js +67 -0
  19. package/out/machine/terminal/sign-in.js +212 -0
  20. package/out/machine/terminal/steps.js +460 -0
  21. package/out/machine/terminal/voice.js +136 -0
  22. package/out/machine/voice/record.js +79 -1
  23. package/out/native/dictate +0 -0
  24. package/out/server.generated.js +6 -0
  25. package/package.json +8 -40
  26. package/README.md +0 -343
  27. package/out/agent/command.d.ts +0 -157
  28. package/out/agent/command.js +0 -454
  29. package/out/agent/render.d.ts +0 -169
  30. package/out/agent/render.js +0 -689
  31. package/out/agent/session.d.ts +0 -334
  32. package/out/agent/session.js +0 -1232
  33. package/out/commands/agents.d.ts +0 -2
  34. package/out/commands/agents.js +0 -79
  35. package/out/commands/ask.d.ts +0 -1
  36. package/out/commands/ask.js +0 -222
  37. package/out/commands/codemap.d.ts +0 -2
  38. package/out/commands/codemap.js +0 -151
  39. package/out/commands/commands-thin.d.ts +0 -39
  40. package/out/commands/commands-thin.js +0 -244
  41. package/out/commands/config.d.ts +0 -1
  42. package/out/commands/config.js +0 -138
  43. package/out/commands/cost.d.ts +0 -1
  44. package/out/commands/cost.js +0 -167
  45. package/out/commands/decisionEngine.d.ts +0 -1
  46. package/out/commands/decisionEngine.js +0 -66
  47. package/out/commands/hooks.d.ts +0 -1
  48. package/out/commands/hooks.js +0 -83
  49. package/out/commands/install.d.ts +0 -206
  50. package/out/commands/install.js +0 -738
  51. package/out/commands/instructions.d.ts +0 -1
  52. package/out/commands/instructions.js +0 -113
  53. package/out/commands/integrations.d.ts +0 -3
  54. package/out/commands/integrations.js +0 -215
  55. package/out/commands/jobs.d.ts +0 -5
  56. package/out/commands/jobs.js +0 -157
  57. package/out/commands/keys.d.ts +0 -55
  58. package/out/commands/keys.js +0 -344
  59. package/out/commands/login.d.ts +0 -9
  60. package/out/commands/login.js +0 -606
  61. package/out/commands/memory.d.ts +0 -3
  62. package/out/commands/memory.js +0 -113
  63. package/out/commands/permissions.d.ts +0 -1
  64. package/out/commands/permissions.js +0 -94
  65. package/out/commands/plugins.d.ts +0 -4
  66. package/out/commands/plugins.js +0 -192
  67. package/out/commands/privacy.d.ts +0 -1
  68. package/out/commands/providerKey.d.ts +0 -32
  69. package/out/commands/providerKey.js +0 -108
  70. package/out/commands/repl.d.ts +0 -12
  71. package/out/commands/repl.js +0 -2303
  72. package/out/commands/report.d.ts +0 -39
  73. package/out/commands/report.js +0 -115
  74. package/out/commands/review.d.ts +0 -5
  75. package/out/commands/review.js +0 -223
  76. package/out/commands/sessions.d.ts +0 -23
  77. package/out/commands/sessions.js +0 -115
  78. package/out/commands/settings.d.ts +0 -23
  79. package/out/commands/settings.js +0 -153
  80. package/out/commands/skills.d.ts +0 -21
  81. package/out/commands/skills.js +0 -207
  82. package/out/commands/unattended.d.ts +0 -7
  83. package/out/commands/unattended.js +0 -351
  84. package/out/commands/update.d.ts +0 -1
  85. package/out/commands/update.js +0 -123
  86. package/out/commands/welcome.d.ts +0 -25
  87. package/out/commands/welcome.js +0 -223
  88. package/out/commands/worktrees.d.ts +0 -5
  89. package/out/commands/worktrees.js +0 -186
  90. package/out/executor/browser.d.ts +0 -14
  91. package/out/executor/diagnostics.d.ts +0 -2
  92. package/out/executor/documents.d.ts +0 -40
  93. package/out/executor/files.d.ts +0 -2
  94. package/out/executor/git.d.ts +0 -48
  95. package/out/executor/hooks.d.ts +0 -51
  96. package/out/executor/index.d.ts +0 -45
  97. package/out/executor/notebook.d.ts +0 -2
  98. package/out/executor/paths.d.ts +0 -20
  99. package/out/executor/sandbox.d.ts +0 -40
  100. package/out/executor/shell.d.ts +0 -86
  101. package/out/executor/toolservers.d.ts +0 -20
  102. package/out/executor/worktree.d.ts +0 -9
  103. package/out/graph/build.d.ts +0 -45
  104. package/out/graph/facts.d.ts +0 -47
  105. package/out/graph/files.d.ts +0 -45
  106. package/out/graph/read-locales.d.ts +0 -29
  107. package/out/graph/read-python.d.ts +0 -11
  108. package/out/graph/read-typescript.d.ts +0 -16
  109. package/out/graph/sync.d.ts +0 -66
  110. package/out/graph/sync.js +0 -242
  111. package/out/lib/attach.d.ts +0 -106
  112. package/out/lib/attach.js +0 -396
  113. package/out/lib/clipboard.d.ts +0 -23
  114. package/out/lib/commandlist.d.ts +0 -20
  115. package/out/lib/commandlist.js +0 -58
  116. package/out/lib/config.d.ts +0 -94
  117. package/out/lib/config.js +0 -197
  118. package/out/lib/connection.d.ts +0 -73
  119. package/out/lib/connection.js +0 -188
  120. package/out/lib/decision.d.ts +0 -22
  121. package/out/lib/decision.js +0 -50
  122. package/out/lib/fingerprint.d.ts +0 -25
  123. package/out/lib/fingerprint.js +0 -58
  124. package/out/lib/gateway.d.ts +0 -427
  125. package/out/lib/gateway.js +0 -226
  126. package/out/lib/history.d.ts +0 -24
  127. package/out/lib/history.js +0 -137
  128. package/out/lib/ide.d.ts +0 -19
  129. package/out/lib/ide.js +0 -131
  130. package/out/lib/keyboard.d.ts +0 -98
  131. package/out/lib/keyboard.js +0 -390
  132. package/out/lib/lastlogin.d.ts +0 -14
  133. package/out/lib/lastlogin.js +0 -105
  134. package/out/lib/machine.d.ts +0 -21
  135. package/out/lib/machine.js +0 -91
  136. package/out/lib/notify.d.ts +0 -4
  137. package/out/lib/notify.js +0 -52
  138. package/out/lib/output.d.ts +0 -48
  139. package/out/lib/output.js +0 -108
  140. package/out/lib/picker.d.ts +0 -1
  141. package/out/lib/picker.js +0 -158
  142. package/out/lib/project-ops.d.ts +0 -19
  143. package/out/lib/project-ops.js +0 -146
  144. package/out/lib/project.d.ts +0 -28
  145. package/out/lib/prompt.d.ts +0 -37
  146. package/out/lib/prompt.js +0 -142
  147. package/out/lib/queue.d.ts +0 -13
  148. package/out/lib/queue.js +0 -116
  149. package/out/lib/readiness.d.ts +0 -22
  150. package/out/lib/readiness.js +0 -207
  151. package/out/lib/self.d.ts +0 -23
  152. package/out/lib/servicecommand.d.ts +0 -14
  153. package/out/lib/servicecommand.js +0 -74
  154. package/out/lib/sessions.d.ts +0 -19
  155. package/out/lib/sessions.js +0 -221
  156. package/out/lib/startcache.d.ts +0 -13
  157. package/out/lib/startcache.js +0 -78
  158. package/out/lib/stdin.d.ts +0 -32
  159. package/out/lib/stdin.js +0 -117
  160. package/out/lib/store.d.ts +0 -40
  161. package/out/lib/store.js +0 -138
  162. package/out/lib/sync.d.ts +0 -18
  163. package/out/lib/sync.js +0 -81
  164. package/out/lib/types.d.ts +0 -417
  165. package/out/lib/types.js +0 -21
  166. package/out/lib/ui.d.ts +0 -123
  167. package/out/lib/ui.js +0 -299
  168. package/out/lib/version.d.ts +0 -23
  169. package/out/lib/version.js +0 -46
  170. package/out/lib/voice.d.ts +0 -49
  171. package/out/lib/voice.js +0 -236
  172. package/out/lib/words.d.ts +0 -20
  173. package/out/lib/words.js +0 -27
  174. package/out/machine/codemap/build.d.ts +0 -45
  175. package/out/machine/codemap/facts.d.ts +0 -47
  176. package/out/machine/codemap/files.d.ts +0 -45
  177. package/out/machine/codemap/read-locales.d.ts +0 -29
  178. package/out/machine/codemap/read-python.d.ts +0 -11
  179. package/out/machine/codemap/read-typescript.d.ts +0 -16
  180. package/out/machine/executor/browser.d.ts +0 -14
  181. package/out/machine/executor/diagnostics.d.ts +0 -2
  182. package/out/machine/executor/documents.d.ts +0 -40
  183. package/out/machine/executor/files.d.ts +0 -2
  184. package/out/machine/executor/git.d.ts +0 -48
  185. package/out/machine/executor/hooks.d.ts +0 -51
  186. package/out/machine/executor/index.d.ts +0 -45
  187. package/out/machine/executor/notebook.d.ts +0 -2
  188. package/out/machine/executor/paths.d.ts +0 -20
  189. package/out/machine/executor/sandbox.d.ts +0 -40
  190. package/out/machine/executor/shell.d.ts +0 -86
  191. package/out/machine/executor/toolservers.d.ts +0 -20
  192. package/out/machine/executor/worktree.d.ts +0 -9
  193. package/out/machine/folder/project.d.ts +0 -28
  194. package/out/machine/runtime/home.d.ts +0 -2
  195. package/out/machine/runtime/needs.d.ts +0 -30
  196. package/out/machine/runtime/self.d.ts +0 -23
  197. package/out/machine/voice/record.d.ts +0 -38
  198. package/out/postinstall.d.ts +0 -2
  199. package/out/postinstall.js +0 -120
  200. package/out/providers/anthropic.d.ts +0 -22
  201. package/out/providers/anthropic.js +0 -80
  202. package/out/providers/index.d.ts +0 -8
  203. package/out/providers/index.js +0 -84
  204. package/out/providers/openai.d.ts +0 -11
  205. package/out/providers/openai.js +0 -57
  206. package/out/thin.d.ts +0 -2
  207. package/out/thin.js +0 -855
  208. package/scripts/read_python.py +0 -270
  209. /package/out/{graph → build/machine/codemap}/build.js +0 -0
  210. /package/out/{graph → build/machine/codemap}/facts.js +0 -0
  211. /package/out/{graph → build/machine/codemap}/files.js +0 -0
  212. /package/out/{graph → build/machine/codemap}/read-locales.js +0 -0
  213. /package/out/{graph → build/machine/codemap}/read-typescript.js +0 -0
  214. /package/out/{executor → build/machine/executor}/browser.js +0 -0
  215. /package/out/{executor → build/machine/executor}/documents.js +0 -0
  216. /package/out/{executor → build/machine/executor}/files.js +0 -0
  217. /package/out/{executor → build/machine/executor}/git.js +0 -0
  218. /package/out/{executor → build/machine/executor}/index.js +0 -0
  219. /package/out/{executor → build/machine/executor}/notebook.js +0 -0
  220. /package/out/{executor → build/machine/executor}/paths.js +0 -0
  221. /package/out/{executor → build/machine/executor}/shell.js +0 -0
  222. /package/out/{executor → build/machine/executor}/toolservers.js +0 -0
  223. /package/out/{executor → build/machine/executor}/worktree.js +0 -0
  224. /package/out/{lib → build/machine/folder}/project.js +0 -0
  225. /package/out/{lib → build/machine/terminal}/clipboard.js +0 -0
@@ -1,153 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.cmdWorkspace = void 0;
40
- exports.currentWorkspace = currentWorkspace;
41
- exports.cmdProviders = cmdProviders;
42
- exports.cmdModel = cmdModel;
43
- exports.cmdProject = cmdProject;
44
- const node_path_1 = __importDefault(require("node:path"));
45
- const gateway_1 = require("../lib/gateway");
46
- const config_1 = require("../lib/config");
47
- const ui = __importStar(require("../lib/ui"));
48
- const out = (s = '') => process.stdout.write(s + '\n');
49
- /** Where the chosen folder is remembered. Beside the rest of the settings. */
50
- function workspaceFile() {
51
- return node_path_1.default.join((0, config_1.homeDir)(), 'workspace.json');
52
- }
53
- /**
54
- * The folder a command should act on.
55
- *
56
- * The folder you are standing in, unless you named one. That is what every
57
- * other tool in a terminal does, and a saved folder that silently overrode the
58
- * current one would be a trap.
59
- */
60
- function currentWorkspace() {
61
- // The folder you are standing in, as in every other terminal tool. A folder
62
- // saved on this laptop used to override it; workspaces now live on the
63
- // service, the same in every client, and `workspace <name>` opens another
64
- // (web manual 13.2).
65
- return { path: process.cwd(), source: 'cwd' };
66
- }
67
- /**
68
- * How a vendor writes its own name.
69
- *
70
- * The workspace returns a machine name and title-cases it, which turns `openai`
71
- * into "Openai" and `xai` into "Xai". Neither company spells itself that way,
72
- * and two screens in the same product showing the same vendors must spell them
73
- * identically. Kept in step with the same list in `keys.ts`.
74
- */
75
- const VENDOR_LABEL = {
76
- anthropic: 'Anthropic', openai: 'OpenAI', google: 'Google', xai: 'xAI',
77
- };
78
- const vendorLabel = (key, fallback) => VENDOR_LABEL[key.toLowerCase()] || fallback;
79
- async function cmdProviders() {
80
- out(ui.banner('AI providers'));
81
- out();
82
- const reply = await (0, gateway_1.ask)({ intent: 'catalog', prompt: '' });
83
- // Four ways this can fail to be an answer, and none of them is "your account
84
- // has no vendors". Saying otherwise sends somebody to add a key they already
85
- // have, which is the fault reported on 17 September 2026.
86
- if (!reply.ok || reply.served === false || reply.complete === false
87
- || !reply.providers || reply.providers.length === 0) {
88
- out(ui.fail('Your organization could not tell us which vendors it can reach.'));
89
- out(` ${ui.c.dim(reply.message || reply.decision.rationale || 'no answer from the organization')}`);
90
- out(` ${ui.c.dim('check the address with')} ${ui.c.bold('comprism status')}`);
91
- out();
92
- process.exitCode = 1;
93
- return;
94
- }
95
- for (const p of reply.providers) {
96
- const state = p.has_key ? ui.c.green('ready') : ui.c.amber('no key stored');
97
- out(` ${ui.c.bold(vendorLabel(p.provider, p.label))} ${state}`);
98
- for (const m of p.models) {
99
- const mark = m.reachable ? ui.c.green(' ok ') : ui.c.dim(' -- ');
100
- out(` ${mark} ${m.label.padEnd(24)} ${ui.c.dim(m.tier)}`);
101
- }
102
- out();
103
- }
104
- const total = reply.providers.reduce((n, p) => n + p.models.length, 0);
105
- out(ui.c.dim(` ${total} models across ${reply.providers.length} vendors, every one priced from our own study.`));
106
- out(ui.c.dim(' A vendor with no key stored can still be called by sending your key with the request.'));
107
- out();
108
- }
109
- /**
110
- * Set the model you are compared against.
111
- *
112
- * This is NOT the model that runs your work: the product picks that, and the
113
- * whole point is that it often picks a cheaper one. This is the model you WOULD
114
- * have used, which is the only thing a saving can honestly be measured against.
115
- */
116
- async function cmdModel(args) {
117
- // The comparison model is the person's own setting on the service, the same
118
- // in every client (service catalog 14); the service lists, checks and words it.
119
- const named = args.filter((a) => !a.startsWith('--')).join(' ');
120
- const reply = await (0, gateway_1.ask)({
121
- intent: 'command', prompt: '', payload: { words: `model ${named}`.trim() },
122
- });
123
- if (!reply.lines?.length) {
124
- out(ui.fail(reply.message || 'Your organization could not answer that.'));
125
- process.exitCode = 1;
126
- return;
127
- }
128
- out();
129
- for (const line of reply.lines)
130
- out(line);
131
- out();
132
- if (reply.granted === false)
133
- process.exitCode = 1;
134
- }
135
- async function cmdProject(args) {
136
- // `comprism workspace ...` typed at the shell: the same service command a
137
- // session runs (web manual 13.2). Opening one takes effect in a session.
138
- const { runServiceCommand } = await Promise.resolve().then(() => __importStar(require('../lib/servicecommand')));
139
- const said = await runServiceCommand(['workspace', ...args].join(' ').trim(), { cwd: process.cwd() });
140
- if (!said.reached) {
141
- out(ui.fail(said.message || 'Your organization could not answer that.'));
142
- process.exitCode = 1;
143
- return;
144
- }
145
- out();
146
- for (const line of said.lines)
147
- out(line);
148
- out();
149
- if (!said.ok)
150
- process.exitCode = 1;
151
- }
152
- /** The older name, kept so nothing that calls it breaks. */
153
- exports.cmdWorkspace = cmdProject;
@@ -1,21 +0,0 @@
1
- type Row = {
2
- name: string;
3
- description: string;
4
- where: string;
5
- active: boolean;
6
- note?: string | null;
7
- };
8
- type Checked = {
9
- level: string;
10
- name: string;
11
- line: string;
12
- };
13
- export declare function skillRows(folder: string, op?: "list" | "check"): Promise<{
14
- rows: Row[];
15
- checked?: Checked[];
16
- empty?: string | null;
17
- error?: string;
18
- }>;
19
- export declare const SKILLS_HELP = " comprism skills the skills here and where each came from\n comprism skills add --personal <folder> keep a skill folder on your account\n comprism skills remove --personal <name> remove one of your own skills\n comprism skills check what will not load, and how to fix it\n In a session, /name followed by anything runs that skill with it.";
20
- export declare function cmdSkills(args: string[]): Promise<number>;
21
- export {};
@@ -1,207 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.SKILLS_HELP = void 0;
37
- exports.skillRows = skillRows;
38
- exports.cmdSkills = cmdSkills;
39
- /**
40
- * `comprism skills` (manual 9.1 to 9.4): the skills here, where each came
41
- * from, and which one a closer skill hides; `skills add --personal <folder>`
42
- * keeps a skill folder on your account.
43
- *
44
- * The service decides what counts as a skill, which one wins a name, and
45
- * every word shown. This reads the files it names, inside the project and
46
- * through the executor's own checks, lines up the columns, and for `add`
47
- * reads the folder and sends it. Nothing in a skill folder is ever run.
48
- */
49
- const fs = __importStar(require("fs"));
50
- const path = __importStar(require("path"));
51
- const commandlist_1 = require("../lib/commandlist");
52
- const gateway_1 = require("../lib/gateway");
53
- const project_1 = require("../machine/folder/project");
54
- const ui = __importStar(require("../lib/ui"));
55
- const ROUNDS = 6;
56
- /** What a folder sent with `add` may hold, beside its SKILL.md. The service
57
- * sets the same ceilings and says so when one is met. */
58
- const MAX_FILES = 20;
59
- const MAX_FILE_BYTES = 50_000;
60
- async function skillRows(folder, op = "list") {
61
- const root = (0, project_1.resolveProject)(folder).root;
62
- const files = {};
63
- const listings = {};
64
- for (let round = 0; round < ROUNDS; round += 1) {
65
- const reply = await (0, gateway_1.ask)({ intent: "skills", prompt: "", skillsPayload: { op, round, files, listings, project: root } });
66
- const body = reply.skills;
67
- if (!reply.ok || reply.served === false || !body) {
68
- return { rows: [], error: reply.message || "The skill list could not be read from your organization." };
69
- }
70
- if (!body.wants) {
71
- return op === "check"
72
- ? { rows: [], checked: (body.rows ?? []) }
73
- : { rows: body.rows ?? [], empty: body.empty };
74
- }
75
- for (const p of body.wants.read ?? [])
76
- files[p] = (0, commandlist_1.readOne)(root, p);
77
- for (const f of body.wants.list ?? [])
78
- listings[f] = (0, commandlist_1.listOne)(root, f);
79
- }
80
- return { rows: [], error: "The skill list could not be completed." };
81
- }
82
- function draw(rows) {
83
- const nameW = Math.min(24, Math.max(...rows.map((r) => r.name.length))) + 2;
84
- const descW = Math.max(...rows.map((r) => r.description.length)) + 2;
85
- return rows.map((r) => {
86
- const line = `${r.name.padEnd(nameW)}${r.description.padEnd(descW)}${r.where}`;
87
- const note = r.note ? ` ${r.note}` : "";
88
- return r.active ? `${line}${ui.c.dim(note)}` : ui.c.dim(`${line}${note}`);
89
- });
90
- }
91
- /** Every text file in a skill folder, by path relative to it, one level of
92
- * subfolder deep (a `references/` folder), within the ceilings. */
93
- function folderFiles(dir) {
94
- const found = {};
95
- const walk = (at, rel, depth) => {
96
- for (const entry of fs.readdirSync(at, { withFileTypes: true })) {
97
- if (Object.keys(found).length >= MAX_FILES)
98
- return;
99
- if (entry.name.startsWith("."))
100
- continue;
101
- const full = path.join(at, entry.name);
102
- const inside = rel ? `${rel}/${entry.name}` : entry.name;
103
- if (entry.isDirectory()) {
104
- if (depth < 1)
105
- walk(full, inside, depth + 1);
106
- continue;
107
- }
108
- if (!entry.isFile() || inside === "SKILL.md")
109
- continue;
110
- const stat = fs.statSync(full);
111
- if (stat.size > MAX_FILE_BYTES)
112
- continue;
113
- const text = fs.readFileSync(full, "utf8");
114
- if (text.includes("\u0000"))
115
- continue;
116
- found[inside] = text;
117
- }
118
- };
119
- walk(dir, "", 0);
120
- return found;
121
- }
122
- async function addPersonal(folder) {
123
- const dir = path.resolve(folder);
124
- const md = path.join(dir, "SKILL.md");
125
- if (!fs.existsSync(md)) {
126
- process.stdout.write(` ${ui.fail(`${folder} has no SKILL.md directly inside it, so it is not a skill folder. Nothing was saved.`)}\n`);
127
- return 2;
128
- }
129
- const reply = await (0, gateway_1.ask)({
130
- intent: "skills", prompt: "",
131
- skillsPayload: {
132
- op: "add_personal", folder_name: path.basename(dir),
133
- skill_md: fs.readFileSync(md, "utf8"), files: folderFiles(dir),
134
- },
135
- });
136
- const body = reply.skills;
137
- if (!reply.ok || reply.served === false || !body) {
138
- process.stdout.write(` ${ui.fail(reply.message || "The skill could not be saved to your account.")}\n`);
139
- return 1;
140
- }
141
- if (body.error) {
142
- process.stdout.write(` ${ui.fail(body.error)}\n`);
143
- return 1;
144
- }
145
- process.stdout.write(` ${body.line ?? ""}\n`);
146
- return 0;
147
- }
148
- async function removePersonal(name) {
149
- const reply = await (0, gateway_1.ask)({ intent: "skills", prompt: "", skillsPayload: { op: "remove_personal", name } });
150
- const body = reply.skills;
151
- if (!reply.ok || reply.served === false || !body || body.error) {
152
- process.stdout.write(` ${ui.fail(body?.error || reply.message || "The skill could not be removed.")}\n`);
153
- return 1;
154
- }
155
- process.stdout.write(` ${body.line ?? ""}\n`);
156
- return 0;
157
- }
158
- exports.SKILLS_HELP = ` comprism skills the skills here and where each came from
159
- comprism skills add --personal <folder> keep a skill folder on your account
160
- comprism skills remove --personal <name> remove one of your own skills
161
- comprism skills check what will not load, and how to fix it
162
- In a session, /name followed by anything runs that skill with it.`;
163
- async function cmdSkills(args) {
164
- const at = args.indexOf("--cwd");
165
- const cwd = at >= 0 && args[at + 1] ? String(args[at + 1]) : process.cwd();
166
- const [sub] = args.filter((a, i) => !a.startsWith("--") && args[i - 1] !== "--cwd" && args[i - 1] !== "--personal");
167
- const personal = args.indexOf("--personal");
168
- const target = personal >= 0 ? args[personal + 1] : undefined;
169
- if (args.includes("--help") || args.includes("-h")) {
170
- process.stdout.write(`${exports.SKILLS_HELP}\n`);
171
- return 0;
172
- }
173
- if (sub === "add" || sub === "remove") {
174
- if (!target) {
175
- process.stdout.write(` ${ui.fail(`comprism skills ${sub} takes --personal ${sub === "add" ? "<folder>" : "<name>"}. Nothing was changed.`)}\n`);
176
- return 2;
177
- }
178
- return sub === "add" ? addPersonal(target) : removePersonal(target);
179
- }
180
- if (sub === "check") {
181
- const found = await skillRows(cwd, "check");
182
- if (found.error) {
183
- process.stdout.write(` ${ui.fail(found.error)}\n`);
184
- return 1;
185
- }
186
- const tone = (level) => (level === "error" ? ui.c.red : level === "warn" ? ui.c.amber : ui.c.dim);
187
- for (const r of found.checked ?? [])
188
- process.stdout.write(` ${tone(r.level)(r.level.padEnd(7))}${r.line}\n`);
189
- return (found.checked ?? []).some((r) => r.level === "error") ? 1 : 0;
190
- }
191
- if (sub) {
192
- process.stdout.write(` ${ui.fail(`\`skills ${sub}\` is not a skills command.`)}\n${exports.SKILLS_HELP}\n`);
193
- return 2;
194
- }
195
- const found = await skillRows(cwd);
196
- if (found.error) {
197
- process.stdout.write(` ${ui.fail(found.error)}\n`);
198
- return 1;
199
- }
200
- if (!found.rows.length) {
201
- process.stdout.write(` ${found.empty ?? ""}\n`);
202
- return 0;
203
- }
204
- for (const line of draw(found.rows))
205
- process.stdout.write(` ${line}\n`);
206
- return 0;
207
- }
@@ -1,7 +0,0 @@
1
- export declare function cmdSchedule(args: string[]): Promise<number>;
2
- export declare function cmdTriggers(args: string[]): Promise<number>;
3
- /** `comprism worker [--cloud] [--once]`: take and run what the service offers. */
4
- export declare function cmdWorker(args: string[]): Promise<number>;
5
- export declare function submitCloud(request: string, cwd: string, args: string[]): Promise<number>;
6
- /** Before resuming a session: apply what its cloud job changed, once (10.18). */
7
- export declare function handBack(sessionId: string, cwd: string): Promise<void>;