@supercollab/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.
Files changed (2) hide show
  1. package/bin/supercollab.js +44 -17
  2. package/package.json +1 -1
@@ -6,7 +6,7 @@ import crypto from 'node:crypto';
6
6
  import readline from 'node:readline/promises';
7
7
  import { stdin as input, stdout as output } from 'node:process';
8
8
 
9
- const VERSION = '0.1.0';
9
+ const VERSION = '0.1.1';
10
10
  const DEFAULT_SERVER = process.env.SUPERCOLLAB_URL || 'https://hyper.polynode.dev';
11
11
  const DEFAULT_CONFIG = process.env.SUPERCOLLAB_CONFIG || path.join(os.homedir(), '.supercollab', 'config.json');
12
12
  const SESSION_TTL_SKEW = 60;
@@ -97,22 +97,49 @@ function requireValue(opts, key) {
97
97
 
98
98
  async function readPassword(prompt = 'Password: ') {
99
99
  if (process.env.SUPERCOLLAB_PASSWORD) return process.env.SUPERCOLLAB_PASSWORD;
100
- if (!process.stdin.isTTY) throw new Error('password required; pass --password or set SUPERCOLLAB_PASSWORD');
101
- const rl = readline.createInterface({ input, output });
102
- const stdin = process.stdin;
103
- const onData = (char) => {
104
- char = String(char);
105
- switch (char) {
106
- case '\n': case '\r': case '\u0004': stdin.pause(); break;
107
- default: output.write('\x1B[2K\x1B[200D' + prompt + '*'.repeat(rl.line.length)); break;
108
- }
109
- };
110
- stdin.on('data', onData);
111
- const pw = await rl.question(prompt);
112
- stdin.off('data', onData);
113
- rl.close();
114
- output.write('\n');
115
- return pw;
100
+ if (!process.stdin.isTTY || typeof process.stdin.setRawMode !== 'function') {
101
+ throw new Error('password required; pass --password or set SUPERCOLLAB_PASSWORD');
102
+ }
103
+ return await new Promise((resolve, reject) => {
104
+ let password = '';
105
+ const stdin = process.stdin;
106
+ const wasRaw = stdin.isRaw;
107
+ const cleanup = () => {
108
+ stdin.off('data', onData);
109
+ try { stdin.setRawMode(Boolean(wasRaw)); } catch {}
110
+ stdin.pause();
111
+ };
112
+ const onData = (chunk) => {
113
+ for (const char of chunk.toString('utf8')) {
114
+ if (char === '\u0003') {
115
+ cleanup();
116
+ output.write('\n');
117
+ reject(new Error('cancelled'));
118
+ return;
119
+ }
120
+ if (char === '\r' || char === '\n' || char === '\u0004') {
121
+ cleanup();
122
+ output.write('\n');
123
+ resolve(password);
124
+ return;
125
+ }
126
+ if (char === '\u007f' || char === '\b') {
127
+ if (password.length > 0) {
128
+ password = password.slice(0, -1);
129
+ output.write('\b \b');
130
+ }
131
+ continue;
132
+ }
133
+ password += char;
134
+ output.write('*');
135
+ }
136
+ };
137
+ output.write(prompt);
138
+ stdin.setEncoding('utf8');
139
+ stdin.setRawMode(true);
140
+ stdin.resume();
141
+ stdin.on('data', onData);
142
+ });
116
143
  }
117
144
 
118
145
  async function api(config, method, endpoint, body, token) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supercollab/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "SuperCollab CLI and MCP bridge for secure agent collaboration workspaces.",
5
5
  "type": "module",
6
6
  "bin": {