umbrella-context 0.1.2 → 0.1.32
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/um.js +2 -0
- package/dist/adapters/byterover-context-runtime-store.d.ts +15 -0
- package/dist/adapters/byterover-context-runtime-store.js +57 -0
- package/dist/adapters/byterover-runtime-bridge.d.ts +218 -0
- package/dist/adapters/byterover-runtime-bridge.js +343 -0
- package/dist/adapters/byterover-transport-task-store.d.ts +13 -0
- package/dist/adapters/byterover-transport-task-store.js +50 -0
- package/dist/adapters/umbrella-onboarding.d.ts +27 -0
- package/dist/adapters/umbrella-onboarding.js +79 -0
- package/dist/adapters/umbrella-provider-runtime.d.ts +38 -0
- package/dist/adapters/umbrella-provider-runtime.js +199 -0
- package/dist/adapters/vendor-byterover.d.ts +4 -0
- package/dist/adapters/vendor-byterover.js +19 -0
- package/dist/commands/activity.d.ts +2 -0
- package/dist/commands/activity.js +82 -0
- package/dist/commands/bridge.d.ts +2 -0
- package/dist/commands/bridge.js +40 -0
- package/dist/commands/catalog.d.ts +34 -0
- package/dist/commands/catalog.js +234 -0
- package/dist/commands/connect.js +14 -14
- package/dist/commands/connectors.d.ts +24 -0
- package/dist/commands/connectors.js +626 -0
- package/dist/commands/curate.d.ts +1 -0
- package/dist/commands/curate.js +48 -3
- package/dist/commands/debug.d.ts +2 -0
- package/dist/commands/debug.js +55 -0
- package/dist/commands/fix.js +54 -0
- package/dist/commands/hub.d.ts +22 -0
- package/dist/commands/hub.js +487 -0
- package/dist/commands/interactive.d.ts +2 -0
- package/dist/commands/interactive.js +970 -62
- package/dist/commands/locations.d.ts +1 -0
- package/dist/commands/locations.js +15 -12
- package/dist/commands/logout.d.ts +2 -0
- package/dist/commands/logout.js +34 -0
- package/dist/commands/model.d.ts +11 -0
- package/dist/commands/model.js +225 -0
- package/dist/commands/providers.d.ts +17 -0
- package/dist/commands/providers.js +379 -0
- package/dist/commands/pull.js +60 -1
- package/dist/commands/push.js +62 -2
- package/dist/commands/reset.d.ts +2 -0
- package/dist/commands/reset.js +35 -0
- package/dist/commands/restart.d.ts +2 -0
- package/dist/commands/restart.js +21 -0
- package/dist/commands/search.js +65 -1
- package/dist/commands/session.d.ts +2 -0
- package/dist/commands/session.js +241 -0
- package/dist/commands/setup.js +58 -56
- package/dist/commands/space.d.ts +12 -0
- package/dist/commands/space.js +138 -42
- package/dist/commands/status.d.ts +29 -0
- package/dist/commands/status.js +120 -19
- package/dist/commands/tasks.d.ts +2 -0
- package/dist/commands/tasks.js +95 -0
- package/dist/commands/transport.d.ts +2 -0
- package/dist/commands/transport.js +88 -0
- package/dist/commands/tree.d.ts +2 -0
- package/dist/commands/tree.js +98 -0
- package/dist/commands/tui.d.ts +2 -0
- package/dist/commands/tui.js +1273 -0
- package/dist/config.d.ts +23 -0
- package/dist/config.js +69 -0
- package/dist/index.js +41 -5
- package/dist/repo-state.d.ts +227 -1
- package/dist/repo-state.js +920 -4
- package/dist/umbrella.js +29 -5
- package/package.json +11 -3
package/dist/commands/search.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { configManager } from "../config.js";
|
|
3
|
-
import { getPendingMemories, getPulledMemories, summarizeLocalMemoryMatches } from "../repo-state.js";
|
|
3
|
+
import { addTaskReasoningContent, addTaskToolCall, appendTaskStreamingContent, completeTask, createTask, getPendingMemories, getPulledMemories, patchTaskLifecycle, recordSessionEvent, recordSessionQuery, setSessionPanel, summarizeLocalMemoryMatches, } from "../repo-state.js";
|
|
4
4
|
export async function searchCommandAction(query) {
|
|
5
5
|
const config = configManager.config;
|
|
6
6
|
if (!config) {
|
|
@@ -8,20 +8,75 @@ export async function searchCommandAction(query) {
|
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
try {
|
|
11
|
+
await setSessionPanel("query", query);
|
|
12
|
+
await recordSessionQuery(query);
|
|
13
|
+
const task = await createTask({
|
|
14
|
+
kind: "query",
|
|
15
|
+
title: `Query: ${query}`,
|
|
16
|
+
detail: "Searching local .um notes and shared server memory.",
|
|
17
|
+
status: "running",
|
|
18
|
+
panel: "query",
|
|
19
|
+
focus: query,
|
|
20
|
+
});
|
|
11
21
|
const localMatches = summarizeLocalMemoryMatches([...(await getPendingMemories()), ...(await getPulledMemories())], query);
|
|
22
|
+
await addTaskReasoningContent(task.id, `Checked local repo context first and found ${localMatches.length} candidate match${localMatches.length === 1 ? "" : "es"}.`);
|
|
23
|
+
await addTaskToolCall(task.id, {
|
|
24
|
+
toolName: "server.memory.search",
|
|
25
|
+
status: "running",
|
|
26
|
+
args: { query },
|
|
27
|
+
});
|
|
28
|
+
await patchTaskLifecycle(task.id, {
|
|
29
|
+
status: "running",
|
|
30
|
+
detail: `Local scan complete. Querying shared memory for "${query}".`,
|
|
31
|
+
reason: "Moved from local scan to shared search.",
|
|
32
|
+
});
|
|
33
|
+
await appendTaskStreamingContent(task.id, `local=${localMatches.length};`);
|
|
12
34
|
const res = await fetch(`${config.serverUrl}/api/memories/search?query=${encodeURIComponent(query)}`, {
|
|
13
35
|
headers: { Authorization: `Bearer ${config.apiKey}` },
|
|
14
36
|
});
|
|
15
37
|
if (!res.ok) {
|
|
16
38
|
const err = await res.json();
|
|
39
|
+
await addTaskToolCall(task.id, {
|
|
40
|
+
toolName: "server.memory.search",
|
|
41
|
+
status: "error",
|
|
42
|
+
args: { query },
|
|
43
|
+
error: err.error,
|
|
44
|
+
});
|
|
45
|
+
await completeTask(task.id, "failed", err.error || "Search failed.");
|
|
17
46
|
console.log(chalk.red(`\n Failed: ${err.error}`));
|
|
18
47
|
return;
|
|
19
48
|
}
|
|
20
49
|
const data = await res.json();
|
|
50
|
+
await addTaskToolCall(task.id, {
|
|
51
|
+
toolName: "server.memory.search",
|
|
52
|
+
status: "completed",
|
|
53
|
+
args: { query },
|
|
54
|
+
result: { total: data.results.length },
|
|
55
|
+
});
|
|
56
|
+
await appendTaskStreamingContent(task.id, `server=${data.results.length};`);
|
|
57
|
+
await addTaskReasoningContent(task.id, `Shared search returned ${data.results.length} match${data.results.length === 1 ? "" : "es"}.`);
|
|
21
58
|
if (data.results.length === 0 && localMatches.length === 0) {
|
|
59
|
+
await completeTask(task.id, "completed", "No local or shared context matched this question.");
|
|
60
|
+
await recordSessionEvent({
|
|
61
|
+
kind: "query",
|
|
62
|
+
title: `No context found for "${query}"`,
|
|
63
|
+
detail: "The query did not match local drafts or server context.",
|
|
64
|
+
panel: "query",
|
|
65
|
+
focus: query,
|
|
66
|
+
status: "warning",
|
|
67
|
+
});
|
|
22
68
|
console.log(chalk.yellow(`\n No context found for "${query}"`));
|
|
23
69
|
return;
|
|
24
70
|
}
|
|
71
|
+
await completeTask(task.id, "completed", `Found ${localMatches.length} local match${localMatches.length === 1 ? "" : "es"} and ${data.results.length} shared match${data.results.length === 1 ? "" : "es"}.`);
|
|
72
|
+
await recordSessionEvent({
|
|
73
|
+
kind: "query",
|
|
74
|
+
title: `Searched Context for "${query}"`,
|
|
75
|
+
detail: `Found ${localMatches.length} local match${localMatches.length === 1 ? "" : "es"} and ${data.results.length} server match${data.results.length === 1 ? "" : "es"}.`,
|
|
76
|
+
panel: "query",
|
|
77
|
+
focus: query,
|
|
78
|
+
status: "success",
|
|
79
|
+
});
|
|
25
80
|
console.log(chalk.bold(`\n Found context for ${config.companyName} / ${config.projectName}:\n`));
|
|
26
81
|
if (localMatches.length > 0) {
|
|
27
82
|
console.log(chalk.cyan(" Local .um matches:\n"));
|
|
@@ -47,6 +102,15 @@ export async function searchCommandAction(query) {
|
|
|
47
102
|
});
|
|
48
103
|
}
|
|
49
104
|
catch (err) {
|
|
105
|
+
const failedTask = await createTask({
|
|
106
|
+
kind: "query",
|
|
107
|
+
title: `Query failed: ${query}`,
|
|
108
|
+
detail: err.message,
|
|
109
|
+
status: "failed",
|
|
110
|
+
panel: "query",
|
|
111
|
+
focus: query,
|
|
112
|
+
});
|
|
113
|
+
await completeTask(failedTask.id, "failed", err.message);
|
|
50
114
|
console.log(chalk.red(`\n Error: ${err.message}`));
|
|
51
115
|
}
|
|
52
116
|
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { ensureSessionState, getConnectorRuns, getInstalledConnectors, getInstalledHubEntries, getPendingMemories, getPulledFixes, getPulledMemories, } from "../repo-state.js";
|
|
3
|
+
import { connectorsCommandAction } from "./connectors.js";
|
|
4
|
+
import { hubCommandAction } from "./hub.js";
|
|
5
|
+
import { modelCommandAction } from "./model.js";
|
|
6
|
+
import { providersCommandAction } from "./providers.js";
|
|
7
|
+
import { getStatusSnapshot } from "./status.js";
|
|
8
|
+
import { spaceCommandAction } from "./space.js";
|
|
9
|
+
import { activityCommandAction } from "./activity.js";
|
|
10
|
+
function divider() {
|
|
11
|
+
return chalk.gray("------------------------------------------------------------");
|
|
12
|
+
}
|
|
13
|
+
function line(label, value) {
|
|
14
|
+
return ` ${chalk.cyan(label.padEnd(18))} ${value}`;
|
|
15
|
+
}
|
|
16
|
+
async function printSessionSummary() {
|
|
17
|
+
const snapshot = await getStatusSnapshot();
|
|
18
|
+
const session = await ensureSessionState();
|
|
19
|
+
console.log(chalk.bold("\n Session Summary\n"));
|
|
20
|
+
console.log(line("Company", snapshot.companyName));
|
|
21
|
+
console.log(line("Space", snapshot.spaceName));
|
|
22
|
+
console.log(line("Current panel", snapshot.currentPanel));
|
|
23
|
+
console.log(line("Current focus", snapshot.currentFocus));
|
|
24
|
+
console.log(line("Latest event", snapshot.latestEvent));
|
|
25
|
+
console.log(line("Commands", String(session.commandHistory.length)));
|
|
26
|
+
console.log(line("Queries", String(session.recentQueries.length)));
|
|
27
|
+
console.log(line("Curations", String(session.recentCurations.length)));
|
|
28
|
+
console.log("");
|
|
29
|
+
}
|
|
30
|
+
async function printSessionTimeline() {
|
|
31
|
+
const session = await ensureSessionState();
|
|
32
|
+
console.log(chalk.bold("\n Session Timeline\n"));
|
|
33
|
+
console.log(divider());
|
|
34
|
+
if ((session.events?.length ?? 0) === 0) {
|
|
35
|
+
console.log(chalk.gray(" No session events yet."));
|
|
36
|
+
console.log("");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
session.events.slice(0, 12).forEach((entry, index) => {
|
|
40
|
+
const badge = entry.status === "success" ? chalk.green(`[${entry.kind}]`)
|
|
41
|
+
: entry.status === "warning" ? chalk.yellow(`[${entry.kind}]`)
|
|
42
|
+
: entry.status === "failure" ? chalk.red(`[${entry.kind}]`)
|
|
43
|
+
: chalk.cyan(`[${entry.kind}]`);
|
|
44
|
+
console.log(` ${index + 1}. ${badge} ${entry.title}`);
|
|
45
|
+
console.log(chalk.gray(` ${new Date(entry.at).toLocaleString()}`));
|
|
46
|
+
if (entry.detail) {
|
|
47
|
+
console.log(chalk.gray(` ${entry.detail}`));
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
console.log("");
|
|
51
|
+
}
|
|
52
|
+
async function printSessionPanel() {
|
|
53
|
+
const session = await ensureSessionState();
|
|
54
|
+
const latestPanelEvent = (session.events ?? []).find((entry) => entry.panel === session.currentPanel);
|
|
55
|
+
console.log(chalk.bold("\n Live Panel\n"));
|
|
56
|
+
console.log(divider());
|
|
57
|
+
console.log(line("Panel", session.currentPanel ?? "None"));
|
|
58
|
+
console.log(line("Focus", session.currentFocus ?? "None"));
|
|
59
|
+
console.log(line("Last panel event", latestPanelEvent?.title ?? "Nothing panel-specific yet"));
|
|
60
|
+
if (session.panelHistory.length > 0) {
|
|
61
|
+
console.log("");
|
|
62
|
+
console.log(chalk.bold(" Recent panels"));
|
|
63
|
+
session.panelHistory.slice(0, 5).forEach((entry, index) => {
|
|
64
|
+
console.log(` ${index + 1}. ${entry}`);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
console.log("");
|
|
68
|
+
}
|
|
69
|
+
async function printSessionRecent() {
|
|
70
|
+
const pending = await getPendingMemories();
|
|
71
|
+
const pulled = await getPulledMemories();
|
|
72
|
+
const fixes = await getPulledFixes();
|
|
73
|
+
const connectors = await getConnectorRuns();
|
|
74
|
+
const hub = await getInstalledHubEntries();
|
|
75
|
+
const installedConnectors = await getInstalledConnectors();
|
|
76
|
+
console.log(chalk.bold("\n Recent Repo Activity\n"));
|
|
77
|
+
console.log(divider());
|
|
78
|
+
console.log(line("Pending drafts", String(pending.length)));
|
|
79
|
+
console.log(line("Pulled context", String(pulled.length)));
|
|
80
|
+
console.log(line("Known fixes", String(fixes.length)));
|
|
81
|
+
console.log(line("Hub installs", String(hub.length)));
|
|
82
|
+
console.log(line("Connectors", String(installedConnectors.length)));
|
|
83
|
+
console.log(line("Connector runs", String(connectors.length)));
|
|
84
|
+
if (connectors[0]) {
|
|
85
|
+
console.log("");
|
|
86
|
+
console.log(chalk.bold(" Latest connector run"));
|
|
87
|
+
console.log(` ${connectors[0].connectorName} (${connectors[0].status})`);
|
|
88
|
+
console.log(chalk.gray(` ${connectors[0].summary}`));
|
|
89
|
+
}
|
|
90
|
+
console.log("");
|
|
91
|
+
}
|
|
92
|
+
async function printSessionActivity() {
|
|
93
|
+
await activityCommandAction();
|
|
94
|
+
}
|
|
95
|
+
async function printSessionHistory() {
|
|
96
|
+
const session = await ensureSessionState();
|
|
97
|
+
console.log(chalk.bold("\n Session History\n"));
|
|
98
|
+
console.log(divider());
|
|
99
|
+
if (session.commandHistory.length === 0) {
|
|
100
|
+
console.log(chalk.gray(" No commands recorded yet."));
|
|
101
|
+
console.log("");
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
session.commandHistory.slice(0, 20).forEach((entry, index) => {
|
|
105
|
+
console.log(` ${index + 1}. ${entry}`);
|
|
106
|
+
});
|
|
107
|
+
console.log("");
|
|
108
|
+
}
|
|
109
|
+
async function continueSessionFlow() {
|
|
110
|
+
const session = await ensureSessionState();
|
|
111
|
+
const panel = session.currentPanel;
|
|
112
|
+
const focus = session.currentFocus ?? undefined;
|
|
113
|
+
if (!panel || panel === "home") {
|
|
114
|
+
await printSessionSummary();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (panel === "timeline") {
|
|
118
|
+
await printSessionTimeline();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (panel === "recent") {
|
|
122
|
+
await printSessionRecent();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (panel === "activity") {
|
|
126
|
+
await printSessionActivity();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (panel === "session") {
|
|
130
|
+
await printSessionSummary();
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (panel === "reset") {
|
|
134
|
+
console.log(chalk.yellow("\n The last saved panel was a local reset. Run status or home to rebuild your working view."));
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (panel === "status") {
|
|
138
|
+
await import("./status.js").then((mod) => mod.statusCommandAction());
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (panel === "providers") {
|
|
142
|
+
if (focus && focus !== "list") {
|
|
143
|
+
await providersCommandAction("inspect", focus);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
await providersCommandAction("list");
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (panel === "model") {
|
|
150
|
+
if (focus && focus !== "list") {
|
|
151
|
+
await modelCommandAction("inspect", focus);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
await modelCommandAction("list");
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (panel === "hub") {
|
|
158
|
+
if (focus?.startsWith("registry:")) {
|
|
159
|
+
await hubCommandAction("registry", "list");
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (focus === "installed") {
|
|
163
|
+
await hubCommandAction("installed");
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (focus && focus !== "list") {
|
|
167
|
+
await hubCommandAction("inspect", focus);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
await hubCommandAction("list");
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (panel === "connectors") {
|
|
174
|
+
if (focus && focus !== "list") {
|
|
175
|
+
await connectorsCommandAction("inspect", focus);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
await connectorsCommandAction("list");
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (panel === "space" || panel === "spaces" || panel === "projects") {
|
|
182
|
+
await spaceCommandAction("list");
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
console.log(chalk.yellow(`\n No resume flow yet for panel "${panel}".`));
|
|
186
|
+
}
|
|
187
|
+
export async function sessionCommandAction(action = "summary") {
|
|
188
|
+
const normalized = action.toLowerCase();
|
|
189
|
+
if (normalized === "summary") {
|
|
190
|
+
await printSessionSummary();
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (normalized === "timeline") {
|
|
194
|
+
await printSessionTimeline();
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (normalized === "panel") {
|
|
198
|
+
await printSessionPanel();
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (normalized === "recent") {
|
|
202
|
+
await printSessionRecent();
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (normalized === "activity") {
|
|
206
|
+
await printSessionActivity();
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (normalized === "history") {
|
|
210
|
+
await printSessionHistory();
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (normalized === "continue") {
|
|
214
|
+
await continueSessionFlow();
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
console.log(chalk.red("Use: session summary | session timeline | session panel | session recent | session activity | session history | session continue"));
|
|
218
|
+
}
|
|
219
|
+
export function sessionCommand(cli) {
|
|
220
|
+
cli.command("session [action]", "Show persistent terminal session views for this repo").action(async (action) => {
|
|
221
|
+
await sessionCommandAction(action ?? "summary");
|
|
222
|
+
});
|
|
223
|
+
cli.command("home", "Show the saved repo home/session summary").action(async () => {
|
|
224
|
+
await sessionCommandAction("summary");
|
|
225
|
+
});
|
|
226
|
+
cli.command("recent", "Show saved recent repo activity").action(async () => {
|
|
227
|
+
await sessionCommandAction("recent");
|
|
228
|
+
});
|
|
229
|
+
cli.command("activity", "Show the saved richer repo activity feed").action(async () => {
|
|
230
|
+
await sessionCommandAction("activity");
|
|
231
|
+
});
|
|
232
|
+
cli.command("timeline", "Show the saved session event timeline").action(async () => {
|
|
233
|
+
await sessionCommandAction("timeline");
|
|
234
|
+
});
|
|
235
|
+
cli.command("panel", "Show the saved live panel and focus").action(async () => {
|
|
236
|
+
await sessionCommandAction("panel");
|
|
237
|
+
});
|
|
238
|
+
cli.command("continue", "Resume the last saved panel flow outside the live shell").action(async () => {
|
|
239
|
+
await sessionCommandAction("continue");
|
|
240
|
+
});
|
|
241
|
+
}
|
package/dist/commands/setup.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import prompts from "prompts";
|
|
3
3
|
import { configManager } from "../config.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
4
|
+
import { checkUmbrellaOnboardingServer, connectUmbrellaDevice, createUmbrellaOnboardingCompany, createUmbrellaOnboardingSpace, loadUmbrellaOnboardingSpaces, normalizeUmbrellaServerUrl, signInUmbrellaOnboarding, } from "../adapters/umbrella-onboarding.js";
|
|
5
|
+
const DEFAULT_UMBRELLA_SERVER_URL = "http://5.161.55.138:3100";
|
|
6
|
+
function isLocalOnlyServerUrl(value) {
|
|
7
|
+
try {
|
|
8
|
+
const parsed = new URL(value);
|
|
9
|
+
const host = parsed.hostname.toLowerCase();
|
|
10
|
+
return host === "127.0.0.1" || host === "localhost" || host === "::1";
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
8
15
|
}
|
|
9
16
|
function printConnected(setup) {
|
|
10
17
|
console.log(chalk.green(`\n Connected to ${setup.companyName} / ${setup.activeSpaceName}`));
|
|
@@ -22,9 +29,6 @@ async function chooseCompany(serverUrl, companies, cookie, initialCompanyId) {
|
|
|
22
29
|
return matched;
|
|
23
30
|
}
|
|
24
31
|
const companyPrompt = await prompts({
|
|
25
|
-
type: "select",
|
|
26
|
-
name: "value",
|
|
27
|
-
message: "Choose a company from Umbrella",
|
|
28
32
|
choices: [
|
|
29
33
|
...companies.map((company) => ({
|
|
30
34
|
title: `${company.name} (${company.issuePrefix})`,
|
|
@@ -32,6 +36,9 @@ async function chooseCompany(serverUrl, companies, cookie, initialCompanyId) {
|
|
|
32
36
|
})),
|
|
33
37
|
{ title: "+ Create new company", value: "__create__" },
|
|
34
38
|
],
|
|
39
|
+
message: "Choose a company from Umbrella",
|
|
40
|
+
name: "value",
|
|
41
|
+
type: "select",
|
|
35
42
|
});
|
|
36
43
|
if (!companyPrompt.value)
|
|
37
44
|
return null;
|
|
@@ -39,14 +46,15 @@ async function chooseCompany(serverUrl, companies, cookie, initialCompanyId) {
|
|
|
39
46
|
return companies.find((company) => company.id === companyPrompt.value) ?? null;
|
|
40
47
|
}
|
|
41
48
|
const createdPrompt = await prompts({
|
|
42
|
-
type: "text",
|
|
43
|
-
name: "value",
|
|
44
49
|
message: "New company name",
|
|
50
|
+
name: "value",
|
|
51
|
+
type: "text",
|
|
45
52
|
validate: (value) => (value.trim().length > 0 ? true : "Enter a company name"),
|
|
46
53
|
});
|
|
47
54
|
if (!createdPrompt.value)
|
|
48
55
|
return null;
|
|
49
|
-
|
|
56
|
+
const created = await createUmbrellaOnboardingCompany(serverUrl, createdPrompt.value.trim(), cookie);
|
|
57
|
+
return created.company;
|
|
50
58
|
}
|
|
51
59
|
async function chooseSpace(serverUrl, companyId, spaces, cookie, initialSpaceId) {
|
|
52
60
|
if (initialSpaceId) {
|
|
@@ -55,9 +63,6 @@ async function chooseSpace(serverUrl, companyId, spaces, cookie, initialSpaceId)
|
|
|
55
63
|
return matched.id;
|
|
56
64
|
}
|
|
57
65
|
const spacePrompt = await prompts({
|
|
58
|
-
type: "select",
|
|
59
|
-
name: "value",
|
|
60
|
-
message: "Choose a context space",
|
|
61
66
|
choices: [
|
|
62
67
|
...spaces.map((space) => ({
|
|
63
68
|
title: space.isPrimary ? `${space.name} (core)` : space.name,
|
|
@@ -65,42 +70,24 @@ async function chooseSpace(serverUrl, companyId, spaces, cookie, initialSpaceId)
|
|
|
65
70
|
})),
|
|
66
71
|
{ title: "+ Create new space", value: "__create__" },
|
|
67
72
|
],
|
|
73
|
+
message: "Choose a context space",
|
|
74
|
+
name: "value",
|
|
75
|
+
type: "select",
|
|
68
76
|
});
|
|
69
77
|
if (!spacePrompt.value)
|
|
70
78
|
return null;
|
|
71
79
|
if (spacePrompt.value !== "__create__")
|
|
72
80
|
return spacePrompt.value;
|
|
73
81
|
const createdPrompt = await prompts({
|
|
74
|
-
type: "text",
|
|
75
|
-
name: "value",
|
|
76
82
|
message: "New context space name",
|
|
83
|
+
name: "value",
|
|
84
|
+
type: "text",
|
|
77
85
|
validate: (value) => (value.trim().length > 0 ? true : "Enter a space name"),
|
|
78
86
|
});
|
|
79
87
|
if (!createdPrompt.value)
|
|
80
88
|
return null;
|
|
81
|
-
const
|
|
82
|
-
return
|
|
83
|
-
}
|
|
84
|
-
function saveSetup(setup, umbrellaUrl) {
|
|
85
|
-
configManager.set({
|
|
86
|
-
umbrellaUrl,
|
|
87
|
-
serverUrl: setup.baseUrl,
|
|
88
|
-
companyId: setup.companyId,
|
|
89
|
-
companyName: setup.companyName,
|
|
90
|
-
workspaceId: setup.workspaceId,
|
|
91
|
-
workspaceName: setup.workspaceName,
|
|
92
|
-
projectId: setup.activeSpaceId,
|
|
93
|
-
projectName: setup.activeSpaceName,
|
|
94
|
-
apiKey: setup.apiKey,
|
|
95
|
-
});
|
|
96
|
-
configManager.upsertLocation({
|
|
97
|
-
repoRoot: process.cwd(),
|
|
98
|
-
companyId: setup.companyId,
|
|
99
|
-
companyName: setup.companyName,
|
|
100
|
-
projectId: setup.activeSpaceId,
|
|
101
|
-
projectName: setup.activeSpaceName,
|
|
102
|
-
updatedAt: new Date().toISOString(),
|
|
103
|
-
});
|
|
89
|
+
const created = await createUmbrellaOnboardingSpace(serverUrl, companyId, createdPrompt.value.trim(), cookie);
|
|
90
|
+
return created.activeSpaceId;
|
|
104
91
|
}
|
|
105
92
|
export function setupCommand(cli) {
|
|
106
93
|
cli
|
|
@@ -113,26 +100,39 @@ export function setupCommand(cli) {
|
|
|
113
100
|
.action(async (options) => {
|
|
114
101
|
console.log(chalk.bold("\n Umbrella Context Setup\n"));
|
|
115
102
|
const existing = configManager.config;
|
|
103
|
+
const envServerUrl = process.env.UMBRELLA_SERVER_URL?.trim();
|
|
104
|
+
const suggestedServerUrl = options.serverUrl?.trim() ||
|
|
105
|
+
envServerUrl ||
|
|
106
|
+
existing?.umbrellaUrl ||
|
|
107
|
+
existing?.serverUrl ||
|
|
108
|
+
DEFAULT_UMBRELLA_SERVER_URL;
|
|
109
|
+
console.log(chalk.gray(` Defaulting to the live Umbrella server at ${DEFAULT_UMBRELLA_SERVER_URL}. Only use 127.0.0.1 if you are intentionally running Umbrella on this same computer instead.`));
|
|
116
110
|
const serverUrlPrompt = await prompts({
|
|
117
|
-
|
|
118
|
-
name: "value",
|
|
111
|
+
initial: suggestedServerUrl,
|
|
119
112
|
message: "Umbrella server URL",
|
|
120
|
-
|
|
113
|
+
name: "value",
|
|
114
|
+
type: options.serverUrl ? null : "text",
|
|
121
115
|
});
|
|
122
|
-
const serverUrl =
|
|
116
|
+
const serverUrl = normalizeUmbrellaServerUrl(options.serverUrl?.trim() ||
|
|
117
|
+
serverUrlPrompt.value ||
|
|
118
|
+
envServerUrl ||
|
|
119
|
+
existing?.umbrellaUrl ||
|
|
120
|
+
existing?.serverUrl ||
|
|
121
|
+
DEFAULT_UMBRELLA_SERVER_URL);
|
|
123
122
|
try {
|
|
124
|
-
const health = await getUmbrellaHealth(serverUrl);
|
|
125
123
|
let cookie = null;
|
|
126
|
-
|
|
124
|
+
let companies = [];
|
|
125
|
+
const serverCheck = await checkUmbrellaOnboardingServer(serverUrl);
|
|
126
|
+
if (serverCheck.deploymentMode === "authenticated") {
|
|
127
127
|
const emailPrompt = await prompts({
|
|
128
|
-
type: options.email ? null : "text",
|
|
129
|
-
name: "value",
|
|
130
128
|
message: "Umbrella email",
|
|
129
|
+
name: "value",
|
|
130
|
+
type: options.email ? null : "text",
|
|
131
131
|
});
|
|
132
132
|
const passwordPrompt = await prompts({
|
|
133
|
-
type: options.password ? null : "password",
|
|
134
|
-
name: "value",
|
|
135
133
|
message: "Umbrella password",
|
|
134
|
+
name: "value",
|
|
135
|
+
type: options.password ? null : "password",
|
|
136
136
|
});
|
|
137
137
|
const email = options.email?.trim() || emailPrompt.value;
|
|
138
138
|
const password = options.password?.trim() || passwordPrompt.value;
|
|
@@ -140,31 +140,33 @@ export function setupCommand(cli) {
|
|
|
140
140
|
console.log(chalk.red("\n Sign-in cancelled."));
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
|
-
const
|
|
144
|
-
cookie =
|
|
143
|
+
const signIn = await signInUmbrellaOnboarding(serverUrl, email, password);
|
|
144
|
+
cookie = signIn.cookie;
|
|
145
|
+
companies = signIn.companies;
|
|
145
146
|
}
|
|
146
147
|
else {
|
|
147
148
|
console.log(chalk.gray(" Local trusted mode detected. Using the local board access path."));
|
|
149
|
+
companies = serverCheck.companies;
|
|
148
150
|
}
|
|
149
|
-
const companies = await listUmbrellaCompanies(serverUrl, cookie);
|
|
150
151
|
const company = await chooseCompany(serverUrl, companies, cookie, options.companyId?.trim());
|
|
151
152
|
if (!company) {
|
|
152
153
|
console.log(chalk.yellow("\n No company selected."));
|
|
153
154
|
return;
|
|
154
155
|
}
|
|
155
|
-
const
|
|
156
|
-
const spaces = toContextSpaces(summary);
|
|
156
|
+
const spaces = await loadUmbrellaOnboardingSpaces(serverUrl, company.id, cookie);
|
|
157
157
|
const selectedSpaceId = await chooseSpace(serverUrl, company.id, spaces, cookie, options.spaceId?.trim());
|
|
158
158
|
if (!selectedSpaceId) {
|
|
159
159
|
console.log(chalk.yellow("\n No context space selected."));
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
|
-
const setup = await
|
|
163
|
-
saveSetup(setup, serverUrl);
|
|
164
|
-
await ensureRepoContext(configManager.config);
|
|
162
|
+
const setup = await connectUmbrellaDevice(serverUrl, company.id, selectedSpaceId, cookie);
|
|
165
163
|
printConnected(setup);
|
|
166
164
|
}
|
|
167
165
|
catch (err) {
|
|
166
|
+
if (isLocalOnlyServerUrl(serverUrl)) {
|
|
167
|
+
console.log(chalk.yellow("\n Hint: 127.0.0.1 points to this same computer only."));
|
|
168
|
+
console.log(chalk.yellow(" If Umbrella is running on another machine or server, re-run setup and enter that machine's real URL or IP."));
|
|
169
|
+
}
|
|
168
170
|
console.log(chalk.red(`\n Error: ${err.message}`));
|
|
169
171
|
}
|
|
170
172
|
});
|
package/dist/commands/space.d.ts
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
+
export type SpaceCommandResult = {
|
|
2
|
+
action: "create" | "list" | "switch";
|
|
3
|
+
changed: boolean;
|
|
4
|
+
companyName: string;
|
|
5
|
+
currentSpaceName: string | null;
|
|
6
|
+
spaces: Array<{
|
|
7
|
+
id: string;
|
|
8
|
+
isPrimary: boolean;
|
|
9
|
+
name: string;
|
|
10
|
+
}>;
|
|
11
|
+
};
|
|
12
|
+
export declare function spaceCommandAction(action: string, spaceArg?: string): Promise<SpaceCommandResult | void>;
|
|
1
13
|
export declare function spaceCommand(cli: any): void;
|