flowviant 0.31.1 → 0.32.0
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/cli.mjs +9 -0
- package/bin/lib/mcp-cli.mjs +83 -0
- package/package.json +1 -1
package/bin/cli.mjs
CHANGED
|
@@ -114,6 +114,15 @@ if (process.argv[2] === 'shot') {
|
|
|
114
114
|
// `flowviant env <import|set|show>` — the CLI half of team env sync. Values
|
|
115
115
|
// are sealed to the project pubkey ON THIS MACHINE (same write-only crypto as
|
|
116
116
|
// the browser); `show` decrypts locally — it only works on an ENROLLED machine.
|
|
117
|
+
// `flowviant mcp` — connect YOUR Claude to Flowviant so you can file work from
|
|
118
|
+
// the terminal. Mints a `cli` credential: a separate principal from the build
|
|
119
|
+
// workers, with only the management tools and no way to claim or ship work.
|
|
120
|
+
if (process.argv[2] === 'mcp') {
|
|
121
|
+
const { runMcpCommand } = await import('./lib/mcp-cli.mjs');
|
|
122
|
+
await runMcpCommand(process.argv.slice(3));
|
|
123
|
+
process.exit(0);
|
|
124
|
+
}
|
|
125
|
+
|
|
117
126
|
if (process.argv[2] === 'env') {
|
|
118
127
|
const { runEnvCommand } = await import('./lib/env-cli.mjs');
|
|
119
128
|
await runEnvCommand(process.argv.slice(3));
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `flowviant mcp` — connect YOUR Claude to Flowviant so you can file work from
|
|
3
|
+
* the terminal ("stick that on the board", "file a task for this TODO").
|
|
4
|
+
*
|
|
5
|
+
* This mints a `cli` credential, which is a different principal from the worker
|
|
6
|
+
* tokens the daemon rotates for builds. That separation is the point, not
|
|
7
|
+
* bookkeeping: a worker reads untrusted repo, PR and issue text all day, so
|
|
8
|
+
* giving THAT principal tools that write to your workspace would mean a hostile
|
|
9
|
+
* string in a README could file work as you. The cli credential sees only the
|
|
10
|
+
* management tools and can never claim or complete work; the worker can never
|
|
11
|
+
* reach create_task.
|
|
12
|
+
*
|
|
13
|
+
* There is deliberately no invite capability on it. Invites grant access to a
|
|
14
|
+
* paid workspace and are guarded by a human browser session; you ask Flowvy in
|
|
15
|
+
* the app for those, and approve the card.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { FLEET_TOKEN, USER_AGENT, MCP_URL, FLEET_URL } from './config.mjs';
|
|
19
|
+
|
|
20
|
+
const CLI_TOKEN_URL = FLEET_URL.replace(/\/agents\/?$/, '/cli-token');
|
|
21
|
+
|
|
22
|
+
export async function runMcpCommand(args = []) {
|
|
23
|
+
if (!FLEET_TOKEN) {
|
|
24
|
+
console.error(
|
|
25
|
+
'error: no credential. Run `flowviant login` first — this needs the\n' +
|
|
26
|
+
'fleet credential the daemon uses, so it knows which project to connect.'
|
|
27
|
+
);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let res;
|
|
32
|
+
try {
|
|
33
|
+
res = await fetch(CLI_TOKEN_URL, {
|
|
34
|
+
method: 'POST',
|
|
35
|
+
headers: {
|
|
36
|
+
authorization: `Bearer ${FLEET_TOKEN}`,
|
|
37
|
+
'content-type': 'application/json',
|
|
38
|
+
'user-agent': USER_AGENT,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
} catch (err) {
|
|
42
|
+
console.error(`error: could not reach Flowviant (${err?.message || err})`);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!res.ok) {
|
|
47
|
+
console.error(
|
|
48
|
+
`error: could not mint a CLI credential (${res.status}). ` +
|
|
49
|
+
(res.status === 401 || res.status === 403
|
|
50
|
+
? 'Your credential may have been revoked — try `flowviant login` again.'
|
|
51
|
+
: 'Try again in a moment.')
|
|
52
|
+
);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const body = await res.json().catch(() => null);
|
|
57
|
+
const token = body?.data?.token;
|
|
58
|
+
if (!token) {
|
|
59
|
+
console.error('error: Flowviant returned no token. Try again.');
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const cmd =
|
|
64
|
+
`claude mcp add --transport http flowviant ${MCP_URL} ` +
|
|
65
|
+
`--header "Authorization: Bearer ${token}"`;
|
|
66
|
+
|
|
67
|
+
// --print for piping into a shell; otherwise explain what this does, since
|
|
68
|
+
// pasting a credential into a command deserves a sentence of context.
|
|
69
|
+
if (args.includes('--print')) {
|
|
70
|
+
console.log(cmd);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
console.log('');
|
|
75
|
+
console.log('Run this to connect your Claude to Flowviant:');
|
|
76
|
+
console.log('');
|
|
77
|
+
console.log(` ${cmd}`);
|
|
78
|
+
console.log('');
|
|
79
|
+
console.log('Then, in any Claude session: "file a task in Flowviant for …".');
|
|
80
|
+
console.log('Tasks land as drafts — nothing runs until you open one in the');
|
|
81
|
+
console.log('app and @mention an agent.');
|
|
82
|
+
console.log('');
|
|
83
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowviant",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "Run your own Claude Code as headless build agents for Flowviant — on your own credentials. Claims dispatched work, opens PRs, captures review evidence, and routes questions back to you.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|