@bingran/sbti-cli 0.1.0 → 0.1.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.
package/NOTICE CHANGED
@@ -1,13 +1,7 @@
1
- This repository includes original code and documentation authored for `sbti-cli`,
2
- which are released under the MIT License in `LICENSE`.
1
+ This published package includes original code and documentation authored for
2
+ `sbti-cli`, which are released under the MIT License in `LICENSE`.
3
3
 
4
- This repository may also contain third-party content derived from the upstream
5
- SBTI website at https://sbti.fancc.de5.net/, including but not limited to:
6
-
7
- - survey prompts
8
- - result descriptions
9
- - extracted character artwork / poster images
10
-
11
- Those upstream materials remain subject to their original ownership and are not
12
- relicensed by this repository unless the original rights holder states
13
- otherwise.
4
+ It also includes bundled survey prompts, result descriptions, and character
5
+ artwork derived from upstream SBTI materials. Those upstream materials remain
6
+ subject to their original ownership and are not relicensed by this package
7
+ unless the original rights holder states otherwise.
package/README.md CHANGED
@@ -1,322 +1,23 @@
1
- <h1 align="center">SBTI CLI - Test SBTI for your agents.</h1>
1
+ # SBTI CLI
2
2
 
3
- <p align="center">
4
- <em>SBTI CLI - Test SBTI for your agents.</em><br>
5
- A Node.js CLI with <strong>offline-only execution</strong>, <strong>bundled survey data</strong>, and <strong>result-image export</strong>.
6
- </p>
3
+ Offline-only command-line runner for the bundled SBTI questionnaire.
7
4
 
8
- <p align="center">
9
- <a href="https://sbti.fancc.de5.net"><img alt="Original test" src="https://img.shields.io/badge/original-sbti.fancc.de5.net-4CAF50?style=flat-square"></a>
10
- <img alt="Node.js" src="https://img.shields.io/badge/Node.js-18%2B-339933?style=flat-square">
11
- <img alt="Runtime mode" src="https://img.shields.io/badge/runtime-offline--only-blue?style=flat-square">
12
- <img alt="Result images" src="https://img.shields.io/badge/result%20images-27-orange?style=flat-square">
13
- <img alt="Questions" src="https://img.shields.io/badge/questions-30%20%2B%201%20hidden-purple?style=flat-square">
14
- <img alt="License" src="https://img.shields.io/badge/license-MIT-red?style=flat-square">
15
- </p>
5
+ This published package intentionally ships only the standalone CLI bundle and minimal package metadata, so installed artifacts do not expose repository-only provenance notes or source links.
16
6
 
17
- <p align="center">
18
- <a href="./README.md"><img alt="English" src="https://img.shields.io/badge/English-current-111827?style=for-the-badge"></a>
19
- <a href="./README.zh-CN.md"><img alt="简体中文" src="https://img.shields.io/badge/简体中文-click_to_switch-EF4444?style=for-the-badge"></a>
20
- </p>
21
-
22
- <p align="center">
23
- <img src="assets/type-images/CTRL.png" width="130" alt="CTRL">
24
- <img src="assets/type-images/BOSS.png" width="130" alt="BOSS">
25
- <img src="assets/type-images/SEXY.png" width="130" alt="SEXY">
26
- <img src="assets/type-images/MALO.png" width="130" alt="MALO">
27
- <img src="assets/type-images/DRUNK.png" width="130" alt="DRUNK">
28
- <img src="assets/type-images/HHHH.png" width="130" alt="HHHH">
29
- </p>
30
-
31
- ---
32
-
33
- ## 📖 Table of Contents
34
-
35
- - [📖 Table of Contents](#-table-of-contents)
36
- - [🎯 What Is This](#-what-is-this)
37
- - [🧭 Installation \& Setup](#-installation--setup)
38
- - [🧪 Using the CLI](#-using-the-cli)
39
- - [Common Commands](#common-commands)
40
- - [Interactive Controls](#interactive-controls)
41
- - [Typical Run](#typical-run)
42
- - [🧬 Core Capabilities](#-core-capabilities)
43
- - [🎭 Result Images \& Offline Resources](#-result-images--offline-resources)
44
- - [Export All Result Images](#export-all-result-images)
45
- - [🔬 Data Sources \& How It Works](#-data-sources--how-it-works)
46
- - [Why It Can Match the Website So Closely](#why-it-can-match-the-website-so-closely)
47
- - [Where the Poster Art Comes From](#where-the-poster-art-comes-from)
48
- - [Most Important Files in This Repo](#most-important-files-in-this-repo)
49
- - [🙏 Acknowledgements](#-acknowledgements)
50
- - [📄 License](#-license)
51
-
52
- ---
53
-
54
- ## 🎯 What Is This
55
-
56
- This repository turns **SBTI** into a local command-line runner.
57
-
58
- Key traits:
59
-
60
- - 🎲 **Website-equivalent question flow**
61
- - 📊 **Website-equivalent scoring**
62
- - 📴 **Offline-safe execution**
63
- - 🖼️ **Exportable result posters**
64
- - ✅ **Regression coverage**
65
-
66
- ---
67
-
68
- ## 🧭 Installation & Setup
69
-
70
- ### Install From npm
71
-
72
- For agent runs or normal CLI use, install the published package and run the binary directly:
7
+ ## Install
73
8
 
74
9
  ```bash
75
10
  npm install -g @bingran/sbti-cli
76
- sbti-cli
77
- ```
78
-
79
- or:
80
-
81
- ```bash
82
- npx @bingran/sbti-cli
83
- ```
84
-
85
- The npm install surface is intentionally small: the root `@bingran/sbti-cli` package only ships a tiny launcher, and npm pulls the matching platform-native binary package for your machine. The published package does **not** ship the repository source tree, tests, build scripts, or image assets.
86
-
87
- Current native package targets:
88
-
89
- - macOS `arm64`
90
- - macOS `x64`
91
- - Linux `arm64`
92
- - Linux `x64`
93
- - Windows `x64`
94
-
95
- ### Clone The Repo For Development
96
-
97
- If you want the test suite, image-export tooling, or source code itself, use the repository checkout:
98
-
99
- ```bash
100
- git clone https://github.com/bingran-you/sbti-cli.git
101
- cd sbti-cli
102
- npm install
103
- npm test
104
11
  ```
105
12
 
106
- Then start the development CLI with:
107
-
108
- ```bash
109
- npm run sbti
110
- ```
111
-
112
- or:
113
-
114
- ```bash
115
- node src/cli.mjs
116
- ```
117
-
118
- > 💡 There is no database, browser driver, or `.env` setup required. If Node.js is installed, you can run either the published CLI or the repo-local development entry point.
119
-
120
- ---
121
-
122
- ## 🧪 Using the CLI
123
-
124
- ### Common Commands
125
-
126
- | Command | Purpose |
127
- |---|---|
128
- | `sbti-cli` | Start a normal interactive run from the published npm package |
129
- | `sbti-cli --seed 42` | Use a deterministic shuffle seed |
130
- | `sbti-cli --json` | Print the final result as JSON |
131
- | `npm run sbti` | Start the repo-local development entry point |
132
- | `npm run export-images` | Rebuild the local poster manifest and gallery from bundled assets in a repo checkout |
133
-
134
- ### Interactive Controls
135
-
136
- Once the CLI starts, you answer one question at a time:
137
- Each answer is locked in for that run as soon as you submit it.
138
-
139
- | Input | Action |
140
- |---|---|
141
- | `A / B / C / D` | Select the current option |
142
- | `q` | Quit without submitting |
143
-
144
- ### Typical Run
13
+ ## Run
145
14
 
146
15
  ```bash
147
16
  sbti-cli
148
17
  ```
149
18
 
150
- ```text
151
- SBTI CLI
152
- Question source: bundled:sbti-main.js
153
-
154
- Question 1 / 31 · dimension hidden
155
- ...
156
-
157
- Enter A/B/C/D, or q to quit.
158
- > C
159
- ```
160
-
161
- ---
162
-
163
- ## 🧬 Core Capabilities
164
-
165
- <table>
166
- <tr>
167
- <th>Area</th>
168
- <th>Capability</th>
169
- <th>Details</th>
170
- </tr>
171
- <tr>
172
- <td><strong>🛟 Offline runtime</strong></td>
173
- <td>Always runs from the bundled snapshot</td>
174
- <td>The CLI never fetches the live website at runtime, so every questionnaire run stays fully local</td>
175
- </tr>
176
- <tr>
177
- <td><strong>🖼️ Result-image export</strong></td>
178
- <td>27 bundled posters can be indexed locally</td>
179
- <td>The repo can rebuild a JSON manifest and an HTML gallery from the checked-in image files</td>
180
- </tr>
181
- <tr>
182
- <td><strong>🧪 Regression tests</strong></td>
183
- <td>Bundled-runtime verification</td>
184
- <td>Includes runtime parity, 50 deterministic result cases, and offline asset coverage</td>
185
- </tr>
186
- <tr>
187
- <td><strong>📦 Native npm release</strong></td>
188
- <td>Small launcher plus platform-native binary packages</td>
189
- <td>Installing from npm no longer ships the repo source tree, tests, or build scripts with the runnable CLI</td>
190
- </tr>
191
- </table>
192
-
193
- ---
194
-
195
- ## 🎭 Result Images & Offline Resources
196
-
197
- This section is repository-only. The published npm CLI does not ship the poster assets or the export script.
198
-
199
- <table>
200
- <tr>
201
- <td align="center" width="33%">
202
- <a href="assets/type-images/index.html"><img src="assets/type-images/CTRL.png" width="180"><br><strong>Local result gallery</strong></a><br>
203
- <sub>An HTML gallery generated from the extracted poster files</sub>
204
- </td>
205
- <td align="center" width="33%">
206
- <a href="assets/type-images/manifest.json"><img src="assets/type-images/BOSS.png" width="180"><br><strong>Image manifest</strong></a><br>
207
- <sub>File names, MIME types, and sizes for all exported posters</sub>
208
- </td>
209
- <td align="center" width="33%">
210
- <a href="src/bundled-data.mjs"><img src="assets/type-images/SEXY.png" width="180"><br><strong>Offline snapshot</strong></a><br>
211
- <sub>The built-in survey data used for every CLI run</sub>
212
- </td>
213
- </tr>
214
- <tr>
215
- <td align="center">
216
- <a href="scripts/export-type-images.mjs"><img src="assets/type-images/MALO.png" width="180"><br><strong>Image export script</strong></a><br>
217
- <sub>Rebuilds the local poster manifest and gallery from the checked-in image files</sub>
218
- </td>
219
- <td align="center">
220
- <a href="test/runtime.test.mjs"><img src="assets/type-images/HHHH.png" width="180"><br><strong>Parity tests</strong></a><br>
221
- <sub>Checks that CLI results stay aligned with the bundled scoring logic</sub>
222
- </td>
223
- </tr>
224
- </table>
225
-
226
- ### Export All Result Images
227
-
228
- ```bash
229
- npm run export-images
230
- ```
231
-
232
- This generates:
233
-
234
- - [`assets/type-images/index.html`](assets/type-images/index.html) — local gallery
235
- - [`assets/type-images/manifest.json`](assets/type-images/manifest.json) — poster manifest
236
- - [`assets/type-images/`](assets/type-images/) — all decoded `.png` / `.jpg` files
237
-
238
- ## 🔬 Data Sources & How It Works
239
-
240
- ### Why It Can Match the Website So Closely
241
-
242
- This repository stores a bundled snapshot of the survey data and scoring logic in [`src/bundled-data.mjs`](src/bundled-data.mjs). [`src/runtime.mjs`](src/runtime.mjs) turns that snapshot into a sandboxed runtime so the CLI can stay local while preserving the original question flow and result math.
243
-
244
- The CLI therefore uses the same runtime objects throughout every run:
245
-
246
- | Runtime object | Content |
247
- |---|---|
248
- | `dimensionMeta` | Chinese labels and model groups for the 15 dimensions |
249
- | `questions` | The 30 regular questions |
250
- | `specialQuestions` | The drink-gate question set |
251
- | `TYPE_LIBRARY` | Codes, names, intros, and full descriptions for all 27 result types |
252
- | `NORMAL_TYPES` | The 25 normal H / M / L templates |
253
- | `DIM_EXPLANATIONS` | Dimension explanations for each L / M / H tier |
254
- | `computeResult()` | The website's own result-selection branch logic |
255
-
256
- That is why the CLI can stay aligned with:
257
-
258
- - question shuffle
259
- - drink-gate insertion and hidden question reveal
260
- - 15-dimension scoring and bucketing
261
- - normal-type ranking
262
- - `DRUNK` override
263
- - `HHHH` low-similarity fallback
264
-
265
- ### Where the Poster Art Comes From
266
-
267
- All 27 result posters are checked into [`assets/type-images/`](assets/type-images/). [`scripts/export-type-images.mjs`](scripts/export-type-images.mjs) rebuilds the manifest and gallery pages from those local files.
268
-
269
- ### Most Important Files in This Repo
270
-
271
- - [`src/cli.mjs`](src/cli.mjs) — CLI entry point and interactive questionnaire flow
272
- - [`src/runtime.mjs`](src/runtime.mjs) — bundled runtime loading, sandbox evaluation, and result summarization
273
- - [`src/bundled-data.mjs`](src/bundled-data.mjs) — bundled offline snapshot
274
- - [`src/type-images.mjs`](src/type-images.mjs) — image helpers and local gallery generation
275
- - [`bin/sbti-cli.cjs`](bin/sbti-cli.cjs) — npm launcher that resolves the installed native binary package
276
- - [`lib/platform-package.cjs`](lib/platform-package.cjs) — supported-platform map and native-package resolution helpers
277
- - [`dist/sbti-cli.cjs`](dist/sbti-cli.cjs) — CommonJS single-file bundle used as the native-binary build input
278
- - [`scripts/build-dist.mjs`](scripts/build-dist.mjs) — generates the single-file ESM/CJS CLI bundles
279
- - [`scripts/build-platform-packages.mjs`](scripts/build-platform-packages.mjs) — builds precompiled native npm subpackages for each platform target
280
- - [`scripts/publish-packages.mjs`](scripts/publish-packages.mjs) — publishes the native platform packages and then the root `@bingran/sbti-cli` package
281
- - [`scripts/export-type-images.mjs`](scripts/export-type-images.mjs) — local poster metadata rebuild
282
- - [`test/runtime.test.mjs`](test/runtime.test.mjs) — bundled runtime parity tests
283
- - [`test/launcher.test.mjs`](test/launcher.test.mjs) — native-launcher package resolution coverage
284
- - [`test/package.test.mjs`](test/package.test.mjs) — publish-tarball surface checks
285
- - [`test/type-images.test.mjs`](test/type-images.test.mjs) — offline asset coverage
286
-
287
- ---
288
-
289
- ## 🙏 Acknowledgements
290
-
291
- <table>
292
- <tr>
293
- <th>Project</th>
294
- <th>Author</th>
295
- <th>Contribution</th>
296
- </tr>
297
- <tr>
298
- <td><a href="https://sbti.fancc.de5.net"><strong>SBTI Personality Test</strong></a></td>
299
- <td>Bilibili <a href="https://space.bilibili.com/417038183">@蛆肉儿串儿</a></td>
300
- <td>Original survey author and source of the question text, result copy, and character artwork</td>
301
- </tr>
302
- <tr>
303
- <td><a href="https://github.com/serenakeyitan/sbti-wiki"><strong>sbti-wiki</strong></a></td>
304
- <td><a href="https://github.com/serenakeyitan">@serenakeyitan</a></td>
305
- <td>The visual README format here was inspired by that project's centered hero, badges, image strip, and information-card layout</td>
306
- </tr>
307
- <tr>
308
- <td><strong>sbti-cli</strong></td>
309
- <td><a href="https://github.com/bingran-you">Bingran You (@bingran-you)</a></td>
310
- <td>Built the sandboxed runtime loader, offline snapshot, image exporter, and regression test suite for a practical terminal workflow</td>
311
- </tr>
312
- </table>
313
-
314
- > ⚠️ **For entertainment only**: the upstream site already warns against treating this as diagnosis, hiring criteria, relationship truth, fortune telling, or any serious judgment. This repo is a tooling and reference project, not a psychological assessment.
315
-
316
- ---
317
-
318
- ## 📄 License
319
-
320
- The original code and documentation in this repository are released under the [MIT License](LICENSE).
19
+ ## Package behavior
321
20
 
322
- Third-party survey prompts, result text, and extracted character artwork originate from the upstream SBTI website and remain subject to their original ownership. See [NOTICE](NOTICE) for attribution and scope.
21
+ - Runs entirely from the bundled offline questionnaire snapshot
22
+ - Locks answers in one question at a time for each run
23
+ - Ships only the standalone CLI bundle plus basic package metadata
package/bin/sbti-cli.cjs CHANGED
@@ -1,33 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { spawn } = require('node:child_process');
4
- const process = require('node:process');
3
+ const { pathToFileURL } = require('node:url');
4
+ const path = require('node:path');
5
5
 
6
- const { resolveInstalledBinaryPath } = require('../lib/platform-package.cjs');
7
-
8
- let resolvedBinary;
9
-
10
- try {
11
- resolvedBinary = resolveInstalledBinaryPath((request) => require.resolve(request));
12
- } catch (error) {
13
- console.error(error.message);
14
- process.exit(1);
15
- }
16
-
17
- const child = spawn(resolvedBinary.binaryPath, process.argv.slice(2), {
18
- stdio: 'inherit'
19
- });
20
-
21
- child.on('error', (error) => {
22
- console.error(error.message);
23
- process.exit(1);
24
- });
25
-
26
- child.on('exit', (code, signal) => {
27
- if (signal) {
28
- console.error(`sbti-cli terminated with signal ${signal}.`);
29
- process.exit(1);
30
- }
31
-
32
- process.exit(code ?? 0);
33
- });
6
+ const entryUrl = pathToFileURL(path.join(__dirname, '..', 'dist', 'sbti-cli.mjs')).href;
7
+ import(entryUrl);