@illuminis/comprism 2.4.4 → 2.5.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.
@@ -0,0 +1,58 @@
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.runOrdered = runOrdered;
37
+ exports.installedBy = installedBy;
38
+ /**
39
+ * One command the server ordered (an update while signed out), run where the
40
+ * install lives, its output shown as it goes. The server decides; this only runs.
41
+ */
42
+ const cp = __importStar(require("node:child_process"));
43
+ function runOrdered(order) {
44
+ if (order.message)
45
+ process.stdout.write(`${order.message}\n`);
46
+ const win = process.platform === 'win32' && order.file === 'npm';
47
+ const done = cp.spawnSync(win ? 'npm.cmd' : order.file, order.args, { stdio: 'inherit', shell: win });
48
+ return done.status ?? 1;
49
+ }
50
+ /** How this copy was installed, so the server can order an update the same way. */
51
+ function installedBy(file) {
52
+ const here = file.replace(/\\/g, '/');
53
+ if (here.includes('/node_modules/@illuminis/'))
54
+ return 'npm';
55
+ if (here.includes('site-packages') || here.includes('/pipx/'))
56
+ return 'python';
57
+ return 'script';
58
+ }
package/out/cli-start.js CHANGED
@@ -50,6 +50,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
50
50
  */
51
51
  const os = __importStar(require("node:os"));
52
52
  const index_1 = require("./build/machine/line/index");
53
+ const run_ordered_1 = require("./build/machine/terminal/run_ordered");
53
54
  const signIn = __importStar(require("./build/machine/terminal/sign-in"));
54
55
  const server_generated_1 = require("./server.generated");
55
56
  // This tool's own version, sent so the server can say when a newer one is out.
@@ -105,7 +106,7 @@ function main() {
105
106
  door.onopen = () => {
106
107
  door.send(JSON.stringify({
107
108
  token: card?.workspaceKey ?? '', tenant: card?.tenant, words: process.argv.slice(2), version: VERSION,
108
- folder: process.cwd(), machine: os.hostname(), term: process.env.TERM,
109
+ folder: process.cwd(), machine: os.hostname(), term: process.env.TERM, install: (0, run_ordered_1.installedBy)(__filename),
109
110
  termProgram: process.env.TERM_PROGRAM,
110
111
  cols: process.stdout.columns, rows: process.stdout.rows,
111
112
  }));
@@ -123,6 +124,8 @@ function main() {
123
124
  }
124
125
  else if (said.type === 'clear_sign_in')
125
126
  signIn.clearSignIn();
127
+ else if (said.type === 'run')
128
+ finish((0, run_ordered_1.runOrdered)(said));
126
129
  else if (said.type === 'exit')
127
130
  finish(said.code ?? 0, said.message);
128
131
  };
@@ -3,4 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BUILD_COMMIT = exports.HOME_SERVER = void 0;
4
4
  // Written by the build. Do not edit.
5
5
  exports.HOME_SERVER = "https://completionprism.illuminis.ai";
6
- exports.BUILD_COMMIT = "6760ff14e8e3b0bf3ecd46964489801d00860d3a";
6
+ exports.BUILD_COMMIT = "bfd6417107244731927d4b7ea0f5705dd7473c64";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@illuminis/comprism",
3
- "version": "2.4.4",
3
+ "version": "2.5.1",
4
4
  "description": "CompletionPrism in your terminal. A thin shell: what you type goes to CompletionPrism's front door, and what it answers comes back.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,