subto 8.0.2 → 8.0.3
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/dist/package/README.md +3 -3
- package/dist/package/index.js +1 -1
- package/index.js +30 -34
- package/package.json +1 -1
package/dist/package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ Commands
|
|
|
40
40
|
{
|
|
41
41
|
"url": "https://example.com",
|
|
42
42
|
"source": "cli",
|
|
43
|
-
"client": { "name": "subto-cli", "version": "8.0.
|
|
43
|
+
"client": { "name": "subto-cli", "version": "8.0.3" }
|
|
44
44
|
}
|
|
45
45
|
```
|
|
46
46
|
|
|
@@ -98,11 +98,11 @@ Download
|
|
|
98
98
|
After publishing or packing, a distributable tarball will be available under `./dist/` e.g.:
|
|
99
99
|
|
|
100
100
|
```
|
|
101
|
-
./dist/subto-8.0.
|
|
101
|
+
./dist/subto-8.0.3.tgz
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
You can download that file directly and install locally with:
|
|
105
105
|
|
|
106
106
|
```bash
|
|
107
|
-
npm install -g ./dist/subto-8.0.
|
|
107
|
+
npm install -g ./dist/subto-8.0.3.tgz
|
|
108
108
|
```
|
package/dist/package/index.js
CHANGED
|
@@ -11,7 +11,7 @@ const chalk = (_chalk && _chalk.default) ? _chalk.default : _chalk;
|
|
|
11
11
|
const CONFIG_DIR = path.join(os.homedir(), '.subto');
|
|
12
12
|
const CONFIG_PATH = path.join(CONFIG_DIR, 'config.json');
|
|
13
13
|
const DEFAULT_API_BASE = 'https://subto.one';
|
|
14
|
-
const CLIENT_META = { name: 'subto-cli', version: '8.0.
|
|
14
|
+
const CLIENT_META = { name: 'subto-cli', version: '8.0.3' };
|
|
15
15
|
|
|
16
16
|
function configFilePath() { return CONFIG_PATH; }
|
|
17
17
|
|
package/index.js
CHANGED
|
@@ -11,7 +11,7 @@ const chalk = (_chalk && _chalk.default) ? _chalk.default : _chalk;
|
|
|
11
11
|
const CONFIG_DIR = path.join(os.homedir(), '.subto');
|
|
12
12
|
const CONFIG_PATH = path.join(CONFIG_DIR, 'config.json');
|
|
13
13
|
const DEFAULT_API_BASE = 'https://subto.one/api/v1';
|
|
14
|
-
const CLIENT_META = { name: 'subto-cli', version: '8.0.
|
|
14
|
+
const CLIENT_META = { name: 'subto-cli', version: '8.0.3' };
|
|
15
15
|
const cp = require('child_process');
|
|
16
16
|
|
|
17
17
|
// Normalize SUBTO API base so callers can set either
|
|
@@ -90,6 +90,33 @@ async function writeConfig(obj) {
|
|
|
90
90
|
await fs.rename(tmp, configFilePath());
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
// Helpers: normalization, header-safety check, and simple yes/no prompt
|
|
94
|
+
function isByteStringSafe(s){
|
|
95
|
+
if (typeof s !== 'string') return false;
|
|
96
|
+
for (let i = 0; i < s.length; i++) { if (s.charCodeAt(i) > 255) return false; }
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function normalizeApiKey(s){
|
|
101
|
+
if (typeof s !== 'string') return s;
|
|
102
|
+
let out = s.normalize('NFKC');
|
|
103
|
+
out = out.replace(/[\u200B\uFEFF]/g, '');
|
|
104
|
+
out = out.replace(/\u00A0/g, ' ');
|
|
105
|
+
out = out.replace(/[\u2018\u2019]/g, "'");
|
|
106
|
+
out = out.replace(/[\u201C\u201D]/g, '"');
|
|
107
|
+
out = out.replace(/\u2026/g, '...');
|
|
108
|
+
out = out.replace(/[\u22C5\u00B7]/g, '.');
|
|
109
|
+
out = out.replace(/\u2022/g, '*');
|
|
110
|
+
return out.trim();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function askYesNo(promptText){
|
|
114
|
+
return new Promise(res => {
|
|
115
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
116
|
+
rl.question(promptText + ' ', ans => { rl.close(); res(String(ans||'').trim().toLowerCase().startsWith('y')); });
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
93
120
|
// Interactive helper to store OpenRouter key + model into ~/.subto/config.json
|
|
94
121
|
async function storeOpenRouterKeyInteractive(keyArg, modelArg) {
|
|
95
122
|
try {
|
|
@@ -138,38 +165,7 @@ async function storeOpenRouterKeyInteractive(keyArg, modelArg) {
|
|
|
138
165
|
}
|
|
139
166
|
|
|
140
167
|
async function promptHidden(prompt) {
|
|
141
|
-
|
|
142
|
-
if (typeof s !== 'string') return false;
|
|
143
|
-
for (let i = 0; i < s.length; i++) {
|
|
144
|
-
if (s.charCodeAt(i) > 255) return false;
|
|
145
|
-
}
|
|
146
|
-
return true;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function normalizeApiKey(s){
|
|
150
|
-
if (typeof s !== 'string') return s;
|
|
151
|
-
// Unicode Normalization + common visual substitutions
|
|
152
|
-
let out = s.normalize('NFKC');
|
|
153
|
-
// Remove invisible/zero-width marks
|
|
154
|
-
out = out.replace(/[\u200B\uFEFF]/g, '');
|
|
155
|
-
// Replace non-breaking spaces with regular space
|
|
156
|
-
out = out.replace(/\u00A0/g, ' ');
|
|
157
|
-
// Smart quotes -> ascii
|
|
158
|
-
out = out.replace(/[\u2018\u2019]/g, "'");
|
|
159
|
-
out = out.replace(/[\u201C\u201D]/g, '"');
|
|
160
|
-
// Ellipsis and middle-dots -> simple replacements
|
|
161
|
-
out = out.replace(/\u2026/g, '...');
|
|
162
|
-
out = out.replace(/[\u22C5\u00B7]/g, '.');
|
|
163
|
-
out = out.replace(/\u2022/g, '*');
|
|
164
|
-
return out.trim();
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function askYesNo(promptText){
|
|
168
|
-
return new Promise(res => {
|
|
169
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
170
|
-
rl.question(promptText + ' ', ans => { rl.close(); res(String(ans||'').trim().toLowerCase().startsWith('y')); });
|
|
171
|
-
});
|
|
172
|
-
}
|
|
168
|
+
|
|
173
169
|
if (!process.stdin.isTTY) throw new Error('Interactive prompt required');
|
|
174
170
|
return new Promise((resolve, reject) => {
|
|
175
171
|
const stdin = process.stdin;
|
|
@@ -523,7 +519,7 @@ async function startChatREPL(scanData){
|
|
|
523
519
|
|
|
524
520
|
async function run(argv) {
|
|
525
521
|
const program = new Command();
|
|
526
|
-
program.name('subto').description('Subto CLI — wrapper around Subto.One API').version(CLIENT_META.version || '8.0.
|
|
522
|
+
program.name('subto').description('Subto CLI — wrapper around Subto.One API').version(CLIENT_META.version || '8.0.3');
|
|
527
523
|
program.option('-v, --verbose', 'Show verbose HTTP logs');
|
|
528
524
|
program.option('--chat', 'Start local AI assistant (no command required)');
|
|
529
525
|
program.option('--no-auto-skip', 'Disable automatic skipping of external APIs when scans appear stuck');
|