noslopui 0.0.1 → 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.
- package/LICENSE +21 -0
- package/README.md +76 -2
- package/SKILL.md +249 -0
- package/dist/adapters/claude-code.js +146 -0
- package/dist/adapters/index.js +19 -0
- package/dist/adapters/types.js +8 -0
- package/dist/commands/doctor.js +118 -0
- package/dist/commands/init.js +129 -0
- package/dist/commands/login.js +26 -0
- package/dist/commands/remove.js +39 -0
- package/dist/commands/update.js +42 -0
- package/dist/index.js +115 -0
- package/dist/lib/api.js +164 -0
- package/dist/lib/json-file.js +98 -0
- package/dist/lib/ui.js +75 -0
- package/dist/lib/version.js +3 -0
- package/package.json +38 -15
- package/bin/noslopui.js +0 -3
package/dist/lib/ui.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Terminal output and prompts. No dependencies on purpose: this package is run
|
|
2
|
+
// with `npx`, so every dependency is something the user waits to download
|
|
3
|
+
// before anything happens.
|
|
4
|
+
import { createInterface } from 'node:readline/promises';
|
|
5
|
+
import { hostname } from 'node:os';
|
|
6
|
+
import { stdin, stdout } from 'node:process';
|
|
7
|
+
const useColor = stdout.isTTY && !process.env.NO_COLOR && process.env.TERM !== 'dumb';
|
|
8
|
+
const wrap = (open, close) => (s) => (useColor ? `${open}${s}${close}` : s);
|
|
9
|
+
export const color = {
|
|
10
|
+
bold: wrap('\u001b[1m', '\u001b[22m'),
|
|
11
|
+
dim: wrap('\u001b[2m', '\u001b[22m'),
|
|
12
|
+
green: wrap('\u001b[32m', '\u001b[39m'),
|
|
13
|
+
yellow: wrap('\u001b[33m', '\u001b[39m'),
|
|
14
|
+
red: wrap('\u001b[31m', '\u001b[39m'),
|
|
15
|
+
cyan: wrap('\u001b[36m', '\u001b[39m'),
|
|
16
|
+
};
|
|
17
|
+
export const say = (line = '') => stdout.write(`${line}\n`);
|
|
18
|
+
export const step = (line) => say(`${color.cyan('›')} ${line}`);
|
|
19
|
+
export const ok = (line) => say(`${color.green('✔')} ${line}`);
|
|
20
|
+
export const warn = (line) => say(`${color.yellow('!')} ${line}`);
|
|
21
|
+
export const fail = (line) => say(`${color.red('✘')} ${line}`);
|
|
22
|
+
export const hint = (line) => say(` ${color.dim(line)}`);
|
|
23
|
+
/** True when there's a human to answer a prompt. */
|
|
24
|
+
export const interactive = () => Boolean(stdin.isTTY && stdout.isTTY);
|
|
25
|
+
/**
|
|
26
|
+
* A key is only ever shown like this. `npx noslopui init` runs in a terminal
|
|
27
|
+
* people screenshot and paste into issues, and the key is the account.
|
|
28
|
+
*/
|
|
29
|
+
export function maskKey(key) {
|
|
30
|
+
return key.length <= 11 ? '…' : `${key.slice(0, 11)}…`;
|
|
31
|
+
}
|
|
32
|
+
export async function confirm(question, fallback) {
|
|
33
|
+
if (!interactive())
|
|
34
|
+
return fallback;
|
|
35
|
+
const rl = createInterface({ input: stdin, output: stdout });
|
|
36
|
+
try {
|
|
37
|
+
const suffix = fallback ? 'Y/n' : 'y/N';
|
|
38
|
+
const answer = (await rl.question(`${color.cyan('?')} ${question} ${color.dim(`(${suffix})`)} `)).trim().toLowerCase();
|
|
39
|
+
if (!answer)
|
|
40
|
+
return fallback;
|
|
41
|
+
return answer === 'y' || answer === 'yes';
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
rl.close();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** Wait for Enter, or return immediately when nobody's watching. */
|
|
48
|
+
export async function pressEnter(question) {
|
|
49
|
+
if (!interactive())
|
|
50
|
+
return;
|
|
51
|
+
const rl = createInterface({ input: stdin, output: stdout });
|
|
52
|
+
try {
|
|
53
|
+
await rl.question(`${color.cyan('?')} ${question} `);
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
rl.close();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A name for this machine, used to label the key on the account page and on
|
|
61
|
+
* the approval screen. The hostname only — never a username, path or anything
|
|
62
|
+
* else that would say more about the person than "which laptop is this".
|
|
63
|
+
* `os.hostname()` rather than $HOSTNAME, which isn't exported on every shell.
|
|
64
|
+
*/
|
|
65
|
+
export function machineLabel() {
|
|
66
|
+
let raw = '';
|
|
67
|
+
try {
|
|
68
|
+
raw = hostname();
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
raw = '';
|
|
72
|
+
}
|
|
73
|
+
const cleaned = (raw.trim().split('.')[0] ?? '').replace(/[^\w .-]/g, '');
|
|
74
|
+
return cleaned.slice(0, 40) || 'this machine';
|
|
75
|
+
}
|
package/package.json
CHANGED
|
@@ -1,25 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "noslopui",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "Connect your coding agent to noslopUI
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Connect your coding agent to noslopUI \u2014 hand-crafted UI components and portable design systems, over MCP.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mcp",
|
|
7
|
+
"claude-code",
|
|
8
|
+
"ui",
|
|
9
|
+
"design-system",
|
|
10
|
+
"components",
|
|
11
|
+
"cli"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://noslopui.com",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/noslopUI/cli.git"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/noslopUI/cli/issues"
|
|
20
|
+
},
|
|
6
21
|
"license": "MIT",
|
|
22
|
+
"type": "module",
|
|
7
23
|
"bin": {
|
|
8
|
-
"noslopui": "
|
|
24
|
+
"noslopui": "dist/index.js"
|
|
9
25
|
},
|
|
10
26
|
"files": [
|
|
11
|
-
"
|
|
27
|
+
"dist",
|
|
28
|
+
"SKILL.md",
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE"
|
|
12
31
|
],
|
|
13
32
|
"engines": {
|
|
14
|
-
"node": ">=
|
|
33
|
+
"node": ">=20.10"
|
|
15
34
|
},
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc -p tsconfig.json",
|
|
37
|
+
"build:test": "tsc -p tsconfig.test.json",
|
|
38
|
+
"test": "npm run build:test && node scripts/run-tests.mjs",
|
|
39
|
+
"typecheck": "tsc -p tsconfig.test.json --noEmit",
|
|
40
|
+
"sync-skill": "node scripts/sync-skill.mjs",
|
|
41
|
+
"check-skill": "node scripts/sync-skill.mjs --check",
|
|
42
|
+
"prepack": "npm run build"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "^24.3.0",
|
|
46
|
+
"typescript": "^5.9.2"
|
|
47
|
+
}
|
|
25
48
|
}
|
package/bin/noslopui.js
DELETED