sphinx-understand 0.1.1 → 0.1.2
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/package.json +4 -2
- package/scripts/postinstall.js +23 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sphinx-understand",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Outsource your thinking, not your understanding. A comprehension checkpoint for agent-assisted development.",
|
|
5
5
|
"homepage": "https://github.com/parthh01/sphinx#readme",
|
|
6
6
|
"repository": {
|
|
@@ -21,11 +21,13 @@
|
|
|
21
21
|
"test": "node scripts/run-suite.mjs",
|
|
22
22
|
"check": "node --check bin/sphinx.js && node scripts/run-suite.mjs",
|
|
23
23
|
"start": "node bin/sphinx.js",
|
|
24
|
-
"eval": "node eval/run.js"
|
|
24
|
+
"eval": "node eval/run.js",
|
|
25
|
+
"postinstall": "node scripts/postinstall.js"
|
|
25
26
|
},
|
|
26
27
|
"files": [
|
|
27
28
|
"bin",
|
|
28
29
|
"src",
|
|
30
|
+
"scripts/postinstall.js",
|
|
29
31
|
"docs",
|
|
30
32
|
"eval/RESULTS.md",
|
|
31
33
|
"eval/fixtures/known-false-negatives.json",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Prints a setup hint after `npm install -g`. It changes nothing on the machine.
|
|
2
|
+
// npm 7+ hides lifecycle output, so write to the terminal device directly and
|
|
3
|
+
// stay silent when there is none (CI, Docker, IDEs).
|
|
4
|
+
import { openSync, writeSync, closeSync, existsSync } from 'node:fs';
|
|
5
|
+
import { homedir } from 'node:os';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
|
|
8
|
+
const env = process.env;
|
|
9
|
+
const global = env.npm_config_global === 'true' || env.npm_config_location === 'global';
|
|
10
|
+
if (global && !(env.CI && !['false', '0'].includes(env.CI))) {
|
|
11
|
+
const home = env.SPHINX_HOME || path.join(env.SPHINX_USER_HOME || homedir(), '.config', 'sphinx');
|
|
12
|
+
const setUp = existsSync(path.join(home, 'install.json'));
|
|
13
|
+
const color = !env.NO_COLOR && env.TERM !== 'dumb';
|
|
14
|
+
const amber = text => color ? `\x1b[38;5;179m${text}\x1b[0m` : text;
|
|
15
|
+
const bold = text => color ? `\x1b[1m${text}\x1b[0m` : text;
|
|
16
|
+
const message = setUp
|
|
17
|
+
? `\n ${amber('sphinx')} updated. Your existing setup is unchanged; run ${bold('sphinx doctor')} to check it.\n\n`
|
|
18
|
+
: `\n ${amber('sphinx')} is installed. Finish setup to connect Git and your coding agents:\n\n ${bold('sphinx install')}\n\n`;
|
|
19
|
+
try {
|
|
20
|
+
const tty = openSync(process.platform === 'win32' ? 'CON' : '/dev/tty', 'w');
|
|
21
|
+
try { writeSync(tty, message); } finally { closeSync(tty); }
|
|
22
|
+
} catch { /* No terminal: nothing to show. */ }
|
|
23
|
+
}
|