flowcollab 0.3.2 → 0.3.4
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/bin/_client.mjs +5 -5
- package/bin/edit.mjs +1 -1
- package/bin/login.mjs +8 -5
- package/package.json +1 -1
package/bin/_client.mjs
CHANGED
|
@@ -54,13 +54,13 @@ function loadGlobalConfig() {
|
|
|
54
54
|
}
|
|
55
55
|
const _gc = loadGlobalConfig();
|
|
56
56
|
|
|
57
|
-
// flow-login writes apiBase to ~/.flow/config.json —
|
|
58
|
-
// a stale FLOW_API_BASE doesn't silently override the
|
|
59
|
-
//
|
|
57
|
+
// flow-login writes apiBase + token to ~/.flow/config.json — both take precedence over
|
|
58
|
+
// env vars so a stale FLOW_API_BASE / FLOW_API_TOKEN_* doesn't silently override the
|
|
59
|
+
// user's authenticated session. Env vars are still honoured when config.json has no value.
|
|
60
60
|
const DEFAULT_BASE = _gc.apiBase || process.env.FLOW_API_BASE || 'https://flow-production-84b7.up.railway.app';
|
|
61
61
|
|
|
62
62
|
function envToken() {
|
|
63
|
-
return process.env.FLOW_API_TOKEN_OWNER || process.env.FLOW_API_TOKEN_CONTRIBUTOR ||
|
|
63
|
+
return _gc.token || process.env.FLOW_API_TOKEN_OWNER || process.env.FLOW_API_TOKEN_CONTRIBUTOR || '';
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
function actingViaClaude() {
|
|
@@ -112,9 +112,9 @@ export function resolvedTokenDisplay() {
|
|
|
112
112
|
return '*'.repeat(Math.max(0, raw.length - 4)) + raw.slice(-4);
|
|
113
113
|
}
|
|
114
114
|
export function resolvedTokenSource() {
|
|
115
|
+
if (_gc.token) return 'flow-login';
|
|
115
116
|
if (process.env.FLOW_API_TOKEN_OWNER) return 'env (owner)';
|
|
116
117
|
if (process.env.FLOW_API_TOKEN_CONTRIBUTOR) return 'env (contributor)';
|
|
117
|
-
if (_gc.token) return 'flow-login';
|
|
118
118
|
return 'none';
|
|
119
119
|
}
|
|
120
120
|
|
package/bin/edit.mjs
CHANGED
|
@@ -26,7 +26,7 @@ async function main() {
|
|
|
26
26
|
const changes = {};
|
|
27
27
|
for (const [flag, toField] of Object.entries(FIELD_MAP)) {
|
|
28
28
|
const val = arg(flag);
|
|
29
|
-
if (val !== undefined) Object.assign(changes, toField(val));
|
|
29
|
+
if (val !== undefined && val !== '') Object.assign(changes, toField(val));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
if (Object.keys(changes).length === 0) die('No fields to update. Pass at least one flag like --title="..." or --priority=p1');
|
package/bin/login.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
flow-login [--server=https://flow-production-84b7.up.railway.app]
|
|
5
5
|
*/
|
|
6
6
|
import { homedir } from 'os';
|
|
7
|
-
import { mkdirSync, writeFileSync } from 'fs';
|
|
7
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
8
8
|
import { join } from 'path';
|
|
9
9
|
import { exec } from 'child_process';
|
|
10
10
|
|
|
@@ -62,18 +62,21 @@ async function main() {
|
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
64
|
if (poll.status === 202) continue;
|
|
65
|
-
if (
|
|
65
|
+
if (poll.status !== 200) {
|
|
66
66
|
process.stdout.write('\n');
|
|
67
67
|
throw new Error(`Unexpected server response: ${poll.status}. Run flow-login again.`);
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
{
|
|
70
70
|
const { token, actor_id, org_id, api_base } = await poll.json();
|
|
71
71
|
if (!token) throw new Error('Server returned no token. Run flow-login again.');
|
|
72
72
|
const dir = join(homedir(), '.flow');
|
|
73
73
|
mkdirSync(dir, { recursive: true });
|
|
74
|
+
const configPath = join(dir, 'config.json');
|
|
75
|
+
let existing = {};
|
|
76
|
+
try { existing = JSON.parse(readFileSync(configPath, 'utf8')); } catch {}
|
|
74
77
|
writeFileSync(
|
|
75
|
-
|
|
76
|
-
JSON.stringify({ apiBase: api_base || base, token, actorId: actor_id, orgId: org_id }, null, 2) + '\n',
|
|
78
|
+
configPath,
|
|
79
|
+
JSON.stringify({ ...existing, apiBase: api_base || base, token, actorId: actor_id, orgId: org_id }, null, 2) + '\n',
|
|
77
80
|
{ encoding: 'utf8', mode: 0o600 },
|
|
78
81
|
);
|
|
79
82
|
process.stdout.write('\n\n');
|