flowcollab 0.1.0 → 0.1.2
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 +16 -2
- package/bin/whoami.mjs +6 -17
- package/package.json +1 -1
package/bin/_client.mjs
CHANGED
|
@@ -15,7 +15,7 @@ function loadGlobalConfig() {
|
|
|
15
15
|
}
|
|
16
16
|
const _gc = loadGlobalConfig();
|
|
17
17
|
|
|
18
|
-
const DEFAULT_BASE = process.env.FLOW_API_BASE || _gc.apiBase || '
|
|
18
|
+
const DEFAULT_BASE = process.env.FLOW_API_BASE || _gc.apiBase || 'https://flow-production-84b7.up.railway.app';
|
|
19
19
|
|
|
20
20
|
function envToken() {
|
|
21
21
|
return process.env.FLOW_API_TOKEN_OWNER || process.env.FLOW_API_TOKEN_CONTRIBUTOR || _gc.token || '';
|
|
@@ -29,7 +29,7 @@ function actingViaClaude() {
|
|
|
29
29
|
export async function flowFetch(path, { method = 'GET', body } = {}) {
|
|
30
30
|
const token = envToken();
|
|
31
31
|
if (!token) {
|
|
32
|
-
throw new Error('
|
|
32
|
+
throw new Error('Not authenticated. Run `flow-login` to connect your account.');
|
|
33
33
|
}
|
|
34
34
|
const url = DEFAULT_BASE.replace(/\/+$/, '') + path;
|
|
35
35
|
const headers = {
|
|
@@ -55,6 +55,20 @@ export async function flowFetch(path, { method = 'GET', body } = {}) {
|
|
|
55
55
|
return parsed;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
export const RESOLVED_BASE = DEFAULT_BASE;
|
|
59
|
+
export const RESOLVED_ACTOR = process.env.FLOW_DEFAULT_ASSIGNEE || _gc.actorId || '';
|
|
60
|
+
export function resolvedTokenDisplay() {
|
|
61
|
+
const raw = envToken();
|
|
62
|
+
if (!raw) return '(none — run `flow-login`)';
|
|
63
|
+
return '*'.repeat(Math.max(0, raw.length - 4)) + raw.slice(-4);
|
|
64
|
+
}
|
|
65
|
+
export function resolvedTokenSource() {
|
|
66
|
+
if (process.env.FLOW_API_TOKEN_OWNER) return 'env (owner)';
|
|
67
|
+
if (process.env.FLOW_API_TOKEN_CONTRIBUTOR) return 'env (contributor)';
|
|
68
|
+
if (_gc.token) return 'flow-login';
|
|
69
|
+
return 'none';
|
|
70
|
+
}
|
|
71
|
+
|
|
58
72
|
export function die(msg, code = 1) {
|
|
59
73
|
process.stderr.write(`flow-cli: ${msg}\n`);
|
|
60
74
|
process.exit(code);
|
package/bin/whoami.mjs
CHANGED
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/* flow
|
|
2
|
+
/* flow-whoami — print current session identity and verify API connectivity.
|
|
3
3
|
Usage: flow-whoami
|
|
4
|
-
Run at session start to confirm you're acting as the right actor with a live token.
|
|
5
4
|
*/
|
|
6
5
|
|
|
7
|
-
import '
|
|
8
|
-
import { flowFetch } from './_client.mjs';
|
|
6
|
+
import { flowFetch, RESOLVED_BASE, RESOLVED_ACTOR, resolvedTokenDisplay, resolvedTokenSource } from './_client.mjs';
|
|
9
7
|
|
|
10
8
|
async function main() {
|
|
11
|
-
const actor =
|
|
12
|
-
const base = process.env.FLOW_API_BASE || 'http://localhost:3000';
|
|
9
|
+
const actor = RESOLVED_ACTOR || '(not set — run flow-login)';
|
|
13
10
|
const actingVia = (process.env.FLOW_ACTING_VIA || 'claude').toLowerCase();
|
|
14
11
|
|
|
15
|
-
const ownerToken = process.env.FLOW_API_TOKEN_OWNER || '';
|
|
16
|
-
const contribToken = process.env.FLOW_API_TOKEN_CONTRIBUTOR || '';
|
|
17
|
-
const tokenKind = ownerToken ? 'owner' : contribToken ? 'contributor' : 'none';
|
|
18
|
-
const rawToken = ownerToken || contribToken;
|
|
19
|
-
const tokenDisplay = rawToken.length > 4
|
|
20
|
-
? `${'*'.repeat(rawToken.length - 4)}${rawToken.slice(-4)}`
|
|
21
|
-
: rawToken ? '****' : '(missing)';
|
|
22
|
-
|
|
23
12
|
process.stdout.write('Flow identity:\n');
|
|
24
13
|
process.stdout.write(` actor: ${actor}\n`);
|
|
25
|
-
process.stdout.write(` token: ${
|
|
26
|
-
process.stdout.write(`
|
|
14
|
+
process.stdout.write(` token: ${resolvedTokenSource()} ${resolvedTokenDisplay()}\n`);
|
|
15
|
+
process.stdout.write(` server: ${RESOLVED_BASE}\n`);
|
|
27
16
|
process.stdout.write(` acting_via: ${actingVia}\n`);
|
|
28
17
|
|
|
29
18
|
try {
|
|
@@ -36,4 +25,4 @@ async function main() {
|
|
|
36
25
|
}
|
|
37
26
|
}
|
|
38
27
|
|
|
39
|
-
main().catch(e => { process.stderr.write('flow-
|
|
28
|
+
main().catch(e => { process.stderr.write('flow-whoami: ' + (e.message || e) + '\n'); process.exit(1); });
|