@oxygen-agent/cli 1.1014.135 → 1.1014.618
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/README.md +1 -1
- package/dist/admin-primary-providers-render.js +27 -19
- package/dist/cli-output.d.ts +12 -0
- package/dist/cli-output.js +395 -0
- package/dist/cli-paths.d.ts +1 -0
- package/dist/cli-paths.js +3 -0
- package/dist/cli-profile-context.d.ts +3 -0
- package/dist/cli-profile-context.js +13 -0
- package/dist/command-manifest.d.ts +15 -0
- package/dist/command-manifest.js +23 -1
- package/dist/command-support.d.ts +438 -0
- package/dist/command-support.js +1610 -0
- package/dist/commands/action-column.d.ts +3 -0
- package/dist/commands/action-column.js +43 -0
- package/dist/commands/activation.d.ts +3 -0
- package/dist/commands/activation.js +24 -0
- package/dist/commands/admin.d.ts +3 -0
- package/dist/commands/admin.js +347 -0
- package/dist/commands/ads.d.ts +3 -0
- package/dist/commands/ads.js +62 -0
- package/dist/commands/agent.d.ts +3 -0
- package/dist/commands/agent.js +274 -0
- package/dist/commands/api-keys.d.ts +3 -0
- package/dist/commands/api-keys.js +77 -0
- package/dist/commands/approvals.d.ts +3 -0
- package/dist/commands/approvals.js +518 -0
- package/dist/commands/auth.d.ts +3 -0
- package/dist/commands/auth.js +230 -0
- package/dist/commands/billing.d.ts +3 -0
- package/dist/commands/billing.js +357 -0
- package/dist/commands/blueprints.d.ts +3 -0
- package/dist/commands/blueprints.js +312 -0
- package/dist/commands/budget.d.ts +3 -0
- package/dist/commands/budget.js +55 -0
- package/dist/commands/callables.d.ts +3 -0
- package/dist/commands/callables.js +111 -0
- package/dist/commands/capabilities.d.ts +3 -0
- package/dist/commands/capabilities.js +44 -0
- package/dist/commands/cells.d.ts +3 -0
- package/dist/commands/cells.js +94 -0
- package/dist/commands/columns.d.ts +3 -0
- package/dist/commands/columns.js +1628 -0
- package/dist/commands/commands.d.ts +3 -0
- package/dist/commands/commands.js +45 -0
- package/dist/commands/comments.d.ts +3 -0
- package/dist/commands/comments.js +188 -0
- package/dist/commands/companies.d.ts +3 -0
- package/dist/commands/companies.js +312 -0
- package/dist/commands/connections.d.ts +3 -0
- package/dist/commands/connections.js +39 -0
- package/dist/commands/context.d.ts +3 -0
- package/dist/commands/context.js +170 -0
- package/dist/commands/copilot.d.ts +3 -0
- package/dist/commands/copilot.js +565 -0
- package/dist/commands/crm.d.ts +3 -0
- package/dist/commands/crm.js +1669 -0
- package/dist/commands/custom-integrations.d.ts +3 -0
- package/dist/commands/custom-integrations.js +140 -0
- package/dist/commands/dashboards.d.ts +3 -0
- package/dist/commands/dashboards.js +240 -0
- package/dist/commands/db.d.ts +3 -0
- package/dist/commands/db.js +190 -0
- package/dist/commands/deliverability.d.ts +3 -0
- package/dist/commands/deliverability.js +90 -0
- package/dist/commands/directory.d.ts +3 -0
- package/dist/commands/directory.js +101 -0
- package/dist/commands/domains.d.ts +3 -0
- package/dist/commands/domains.js +604 -0
- package/dist/commands/egress.d.ts +3 -0
- package/dist/commands/egress.js +130 -0
- package/dist/commands/email.d.ts +3 -0
- package/dist/commands/email.js +49 -0
- package/dist/commands/engagement.d.ts +3 -0
- package/dist/commands/engagement.js +189 -0
- package/dist/commands/enrich-column.d.ts +3 -0
- package/dist/commands/enrich-column.js +149 -0
- package/dist/commands/enrichment.d.ts +3 -0
- package/dist/commands/enrichment.js +49 -0
- package/dist/commands/feedback.d.ts +3 -0
- package/dist/commands/feedback.js +96 -0
- package/dist/commands/feeds.d.ts +3 -0
- package/dist/commands/feeds.js +486 -0
- package/dist/commands/find.d.ts +3 -0
- package/dist/commands/find.js +159 -0
- package/dist/commands/followers.d.ts +3 -0
- package/dist/commands/followers.js +39 -0
- package/dist/commands/formulas.d.ts +3 -0
- package/dist/commands/formulas.js +43 -0
- package/dist/commands/home.d.ts +3 -0
- package/dist/commands/home.js +22 -0
- package/dist/commands/inbox.d.ts +3 -0
- package/dist/commands/inbox.js +779 -0
- package/dist/commands/integrations.d.ts +3 -0
- package/dist/commands/integrations.js +290 -0
- package/dist/commands/knowledge.d.ts +3 -0
- package/dist/commands/knowledge.js +874 -0
- package/dist/commands/lead-sourcing.d.ts +3 -0
- package/dist/commands/lead-sourcing.js +52 -0
- package/dist/commands/limits.d.ts +3 -0
- package/dist/commands/limits.js +54 -0
- package/dist/commands/linkedin.d.ts +3 -0
- package/dist/commands/linkedin.js +275 -0
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.js +347 -0
- package/dist/commands/logout.d.ts +3 -0
- package/dist/commands/logout.js +12 -0
- package/dist/commands/mailboxes.d.ts +3 -0
- package/dist/commands/mailboxes.js +1290 -0
- package/dist/commands/managed-inboxes.d.ts +3 -0
- package/dist/commands/managed-inboxes.js +361 -0
- package/dist/commands/messages.d.ts +3 -0
- package/dist/commands/messages.js +78 -0
- package/dist/commands/notetaker.d.ts +3 -0
- package/dist/commands/notetaker.js +79 -0
- package/dist/commands/observability.d.ts +3 -0
- package/dist/commands/observability.js +125 -0
- package/dist/commands/orgs.d.ts +3 -0
- package/dist/commands/orgs.js +237 -0
- package/dist/commands/people.d.ts +3 -0
- package/dist/commands/people.js +353 -0
- package/dist/commands/posts.d.ts +3 -0
- package/dist/commands/posts.js +139 -0
- package/dist/commands/profiles.d.ts +3 -0
- package/dist/commands/profiles.js +250 -0
- package/dist/commands/projects.d.ts +3 -0
- package/dist/commands/projects.js +94 -0
- package/dist/commands/prompts.d.ts +3 -0
- package/dist/commands/prompts.js +84 -0
- package/dist/commands/publishing.d.ts +3 -0
- package/dist/commands/publishing.js +1419 -0
- package/dist/commands/recipes.d.ts +3 -0
- package/dist/commands/recipes.js +120 -0
- package/dist/commands/reviews.d.ts +3 -0
- package/dist/commands/reviews.js +75 -0
- package/dist/commands/rows.d.ts +3 -0
- package/dist/commands/rows.js +27 -0
- package/dist/commands/runs.d.ts +3 -0
- package/dist/commands/runs.js +37 -0
- package/dist/commands/search.d.ts +3 -0
- package/dist/commands/search.js +182 -0
- package/dist/commands/senders.d.ts +3 -0
- package/dist/commands/senders.js +393 -0
- package/dist/commands/sequences.d.ts +3 -0
- package/dist/commands/sequences.js +2322 -0
- package/dist/commands/session.d.ts +3 -0
- package/dist/commands/session.js +109 -0
- package/dist/commands/signals.d.ts +3 -0
- package/dist/commands/signals.js +289 -0
- package/dist/commands/signup-leads.d.ts +3 -0
- package/dist/commands/signup-leads.js +46 -0
- package/dist/commands/skills.d.ts +3 -0
- package/dist/commands/skills.js +50 -0
- package/dist/commands/sourcing.d.ts +3 -0
- package/dist/commands/sourcing.js +27 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.js +51 -0
- package/dist/commands/supabase.d.ts +3 -0
- package/dist/commands/supabase.js +128 -0
- package/dist/commands/support.d.ts +3 -0
- package/dist/commands/support.js +651 -0
- package/dist/commands/suppressions.d.ts +3 -0
- package/dist/commands/suppressions.js +577 -0
- package/dist/commands/table-ingestions.d.ts +3 -0
- package/dist/commands/table-ingestions.js +145 -0
- package/dist/commands/table-runs.d.ts +3 -0
- package/dist/commands/table-runs.js +277 -0
- package/dist/commands/tables.d.ts +3 -0
- package/dist/commands/tables.js +3492 -0
- package/dist/commands/tags.d.ts +3 -0
- package/dist/commands/tags.js +147 -0
- package/dist/commands/tools.d.ts +3 -0
- package/dist/commands/tools.js +246 -0
- package/dist/commands/update.d.ts +3 -0
- package/dist/commands/update.js +106 -0
- package/dist/commands/verify.d.ts +3 -0
- package/dist/commands/verify.js +27 -0
- package/dist/commands/viewers.d.ts +3 -0
- package/dist/commands/viewers.js +72 -0
- package/dist/commands/voice.d.ts +3 -0
- package/dist/commands/voice.js +351 -0
- package/dist/commands/whatsapp.d.ts +3 -0
- package/dist/commands/whatsapp.js +226 -0
- package/dist/commands/whoami.d.ts +3 -0
- package/dist/commands/whoami.js +110 -0
- package/dist/commands/worker.d.ts +3 -0
- package/dist/commands/worker.js +60 -0
- package/dist/commands/workflows.d.ts +3 -0
- package/dist/commands/workflows.js +1752 -0
- package/dist/commands/workspace.d.ts +3 -0
- package/dist/commands/workspace.js +94 -0
- package/dist/compact-list-flags.d.ts +7 -0
- package/dist/compact-list-flags.js +12 -0
- package/dist/crm-support-flags.js +14 -5
- package/dist/customer-operation-commands.js +8 -6
- package/dist/diagnostic-uploader.d.ts +3 -1
- package/dist/diagnostic-uploader.js +29 -8
- package/dist/help.d.ts +5 -0
- package/dist/help.js +22 -0
- package/dist/index.d.ts +98 -1
- package/dist/index.js +331 -30719
- package/dist/local-module-loader.d.ts +4 -0
- package/dist/local-module-loader.js +156 -0
- package/dist/visual-commands.js +9 -5
- package/node_modules/@oxygen/cli-ugc/dist/commands.js +2 -2
- package/node_modules/@oxygen/shared/dist/agent-session-schedule.d.ts +36 -0
- package/node_modules/@oxygen/shared/dist/agent-session-schedule.js +69 -0
- package/node_modules/@oxygen/shared/dist/agent-sessions.d.ts +14 -5
- package/node_modules/@oxygen/shared/dist/agent-sessions.js +14 -3
- package/node_modules/@oxygen/shared/dist/capability-discovery.js +175 -14
- package/node_modules/@oxygen/shared/dist/compact-list-result.d.ts +6 -0
- package/node_modules/@oxygen/shared/dist/compact-list-result.js +27 -0
- package/node_modules/@oxygen/shared/dist/contracts/agent-sessions.d.ts +12 -1
- package/node_modules/@oxygen/shared/dist/contracts/agent-sessions.js +5 -2
- package/node_modules/@oxygen/shared/dist/contracts/browser-operations.js +4 -2
- package/node_modules/@oxygen/shared/dist/contracts/compact-list-reads.d.ts +57 -0
- package/node_modules/@oxygen/shared/dist/contracts/compact-list-reads.js +23 -0
- package/node_modules/@oxygen/shared/dist/contracts/crm-support.d.ts +52 -0
- package/node_modules/@oxygen/shared/dist/contracts/crm-support.js +43 -2
- package/node_modules/@oxygen/shared/dist/contracts/customer-operations.js +17 -14
- package/node_modules/@oxygen/shared/dist/contracts/knowledge-content-reads.js +1 -1
- package/node_modules/@oxygen/shared/dist/contracts/knowledge-proposal-reads.d.ts +49 -0
- package/node_modules/@oxygen/shared/dist/contracts/knowledge-proposal-reads.js +14 -0
- package/node_modules/@oxygen/shared/dist/contracts/knowledge-sync.js +1 -1
- package/node_modules/@oxygen/shared/dist/contracts/limits-read.js +60 -7
- package/node_modules/@oxygen/shared/dist/contracts/operations.d.ts +9 -1
- package/node_modules/@oxygen/shared/dist/contracts/operations.js +13 -5
- package/node_modules/@oxygen/shared/dist/contracts/publishing-reads.js +1 -1
- package/node_modules/@oxygen/shared/dist/contracts/teammates.d.ts +16 -0
- package/node_modules/@oxygen/shared/dist/contracts/teammates.js +115 -0
- package/node_modules/@oxygen/shared/dist/cost-estimate-view.js +21 -3
- package/node_modules/@oxygen/shared/dist/cost-estimate.d.ts +31 -1
- package/node_modules/@oxygen/shared/dist/cost-estimate.js +56 -15
- package/node_modules/@oxygen/shared/dist/diagnostic-credentials.d.ts +2 -0
- package/node_modules/@oxygen/shared/dist/diagnostic-credentials.js +2 -0
- package/node_modules/@oxygen/shared/dist/diagnostic-lock.js +71 -44
- package/node_modules/@oxygen/shared/dist/diagnostic-spool.d.ts +18 -0
- package/node_modules/@oxygen/shared/dist/diagnostic-spool.js +348 -0
- package/node_modules/@oxygen/shared/dist/diagnostic-storage-failure.d.ts +10 -0
- package/node_modules/@oxygen/shared/dist/diagnostic-storage-failure.js +42 -0
- package/node_modules/@oxygen/shared/dist/diagnostic-storage.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/diagnostic-storage.js +59 -213
- package/node_modules/@oxygen/shared/dist/diagnostics.js +3 -2
- package/node_modules/@oxygen/shared/dist/email-dsn.d.ts +16 -5
- package/node_modules/@oxygen/shared/dist/email-dsn.js +97 -1
- package/node_modules/@oxygen/shared/dist/emailguard-placement-probe.js +5 -0
- package/node_modules/@oxygen/shared/dist/enrichment-intents.js +4 -5
- package/node_modules/@oxygen/shared/dist/file-import.js +5 -2
- package/node_modules/@oxygen/shared/dist/hosted-ai.d.ts +30 -0
- package/node_modules/@oxygen/shared/dist/hosted-ai.js +20 -0
- package/node_modules/@oxygen/shared/dist/knowledge-bootstrap.d.ts +6 -2
- package/node_modules/@oxygen/shared/dist/knowledge-seed-content.d.ts +17 -7
- package/node_modules/@oxygen/shared/dist/knowledge-seed-content.js +81 -17
- package/node_modules/@oxygen/shared/dist/langfuse.js +8 -4
- package/node_modules/@oxygen/shared/dist/mailbox-egress-ownership.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/mailbox-import.d.ts +6 -3
- package/node_modules/@oxygen/shared/dist/mailbox-import.js +9 -9
- package/node_modules/@oxygen/shared/dist/mcp-server-info.d.ts +8 -0
- package/node_modules/@oxygen/shared/dist/mcp-server-info.js +10 -0
- package/node_modules/@oxygen/shared/dist/object-storage.d.ts +10 -0
- package/node_modules/@oxygen/shared/dist/object-storage.js +14 -0
- package/node_modules/@oxygen/shared/dist/plan-limits-view.d.ts +5 -0
- package/node_modules/@oxygen/shared/dist/plan-limits-view.js +17 -1
- package/node_modules/@oxygen/shared/dist/pricing-sheet.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/pricing-sheet.js +1 -1
- package/node_modules/@oxygen/shared/dist/provider-selection.d.ts +15 -0
- package/node_modules/@oxygen/shared/dist/provider-selection.js +3 -0
- package/node_modules/@oxygen/shared/dist/repricing.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/repricing.js +2 -2
- package/node_modules/@oxygen/shared/dist/schedule-label.d.ts +6 -0
- package/node_modules/@oxygen/shared/dist/schedule-label.js +12 -0
- package/node_modules/@oxygen/shared/dist/sequence-failures.d.ts +1 -0
- package/node_modules/@oxygen/shared/dist/sequence-failures.js +20 -6
- package/node_modules/@oxygen/shared/dist/teammate-groups.d.ts +55 -0
- package/node_modules/@oxygen/shared/dist/teammate-groups.js +74 -0
- package/node_modules/@oxygen/shared/dist/teammate-messages.d.ts +52 -0
- package/node_modules/@oxygen/shared/dist/teammate-messages.js +88 -0
- package/node_modules/@oxygen/shared/dist/teammate-notes.d.ts +58 -0
- package/node_modules/@oxygen/shared/dist/teammate-notes.js +73 -0
- package/node_modules/@oxygen/shared/dist/teammate-routines.d.ts +95 -0
- package/node_modules/@oxygen/shared/dist/teammate-routines.js +266 -0
- package/node_modules/@oxygen/shared/dist/teammate-tasks.d.ts +56 -0
- package/node_modules/@oxygen/shared/dist/teammate-tasks.js +114 -0
- package/node_modules/@oxygen/shared/dist/teammates.d.ts +78 -0
- package/node_modules/@oxygen/shared/dist/teammates.js +140 -0
- package/node_modules/@oxygen/shared/dist/user-capability-routing.js +120 -0
- package/node_modules/@oxygen/shared/dist/version.generated.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/version.generated.js +1 -1
- package/node_modules/@oxygen/shared/dist/visual-render.d.ts +9 -1
- package/node_modules/@oxygen/shared/dist/visual-render.js +12 -5
- package/node_modules/@oxygen/shared/dist/warmup-metrics.d.ts +5 -0
- package/node_modules/@oxygen/shared/dist/warmup-metrics.js +44 -0
- package/package.json +1 -1
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { emitCliFailure, writeJson } from "../cli-output.js";
|
|
2
|
+
import { ansi, createCredentialFingerprint, describeProfileSource, formatFingerprint, handleLogoutAction, resolveActiveProfileWithSource, shellQuote } from "../command-support.js";
|
|
3
|
+
import { listCredentialProfiles, switchCredentialProfile } from "../credentials.js";
|
|
4
|
+
import { OxygenError, success } from "@oxygen/shared/cli-result";
|
|
5
|
+
import { Command } from "commander";
|
|
6
|
+
import { stdout as output } from "node:process";
|
|
7
|
+
async function handleProfilesListAction(options) {
|
|
8
|
+
try {
|
|
9
|
+
const state = await listCredentialProfiles();
|
|
10
|
+
const data = {
|
|
11
|
+
active_profile: state.activeProfile,
|
|
12
|
+
profiles: state.profiles.map((profile) => summarizeCredentialProfile(profile, profile.name === state.activeProfile)),
|
|
13
|
+
};
|
|
14
|
+
if (options.json) {
|
|
15
|
+
writeJson(success("profiles list", data));
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
process.stdout.write(formatProfilesList(data));
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
emitCliFailure("profiles list", error);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async function handleProfilesUseAction(profile, options) {
|
|
25
|
+
try {
|
|
26
|
+
const activeProfile = await switchCredentialProfile(profile);
|
|
27
|
+
const state = await listCredentialProfiles().catch(() => null);
|
|
28
|
+
const totalProfiles = state?.profiles.length ?? 1;
|
|
29
|
+
const data = {
|
|
30
|
+
active_profile: activeProfile.name,
|
|
31
|
+
profile: summarizeCredentialProfile(activeProfile, true),
|
|
32
|
+
};
|
|
33
|
+
if (options.json) {
|
|
34
|
+
writeJson(success("profiles use", data));
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
process.stdout.write(formatProfileUseSuccess(data.profile, { totalProfiles }));
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
emitCliFailure("profiles use", error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function handleProfilesEnvAction(profile, options) {
|
|
44
|
+
try {
|
|
45
|
+
if (options.unset) {
|
|
46
|
+
const data = {
|
|
47
|
+
profile,
|
|
48
|
+
unset: ["OXYGEN_PROFILE", "OXYGEN_API_URL"],
|
|
49
|
+
};
|
|
50
|
+
if (options.json) {
|
|
51
|
+
writeJson(success("profiles env", data));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
process.stdout.write("unset OXYGEN_PROFILE OXYGEN_API_URL\n");
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const state = await listCredentialProfiles();
|
|
58
|
+
const match = state.profiles.find((entry) => entry.name === profile);
|
|
59
|
+
if (!match) {
|
|
60
|
+
throw new OxygenError("profile_not_found", `Oxygen CLI profile "${profile}" is not stored.`, {
|
|
61
|
+
details: { profile },
|
|
62
|
+
exitCode: 1,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const env = {
|
|
66
|
+
OXYGEN_PROFILE: match.name,
|
|
67
|
+
OXYGEN_API_URL: match.apiUrl,
|
|
68
|
+
};
|
|
69
|
+
if (options.json) {
|
|
70
|
+
writeJson(success("profiles env", { profile: match.name, env }));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
process.stdout.write(`export OXYGEN_PROFILE=${shellQuote(match.name)}\n`);
|
|
74
|
+
process.stdout.write(`export OXYGEN_API_URL=${shellQuote(match.apiUrl)}\n`);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
emitCliFailure("profiles env", error);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async function handleProfilesCurrentAction(options) {
|
|
81
|
+
try {
|
|
82
|
+
const context = await resolveActiveProfileWithSource();
|
|
83
|
+
const credentials = context.resolution.credentials;
|
|
84
|
+
const data = {
|
|
85
|
+
profile: context.resolution.exists ? context.resolution.name : null,
|
|
86
|
+
profile_source: context.source,
|
|
87
|
+
api_url: credentials?.apiUrl ?? null,
|
|
88
|
+
organization: credentials?.identity?.organization ?? null,
|
|
89
|
+
user: credentials?.identity?.user ?? null,
|
|
90
|
+
stored: context.resolution.exists,
|
|
91
|
+
};
|
|
92
|
+
if (options.json) {
|
|
93
|
+
writeJson(success("profiles current", data));
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
process.stdout.write(formatProfilesCurrent(context));
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
emitCliFailure("profiles current", error);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function summarizeCredentialProfile(profile, active) {
|
|
103
|
+
return {
|
|
104
|
+
name: profile.name,
|
|
105
|
+
active,
|
|
106
|
+
api_url: profile.apiUrl,
|
|
107
|
+
token_fingerprint: formatFingerprint(createCredentialFingerprint(profile.token)),
|
|
108
|
+
organization: profile.activeOrganization ?? profile.identity?.organization ?? null,
|
|
109
|
+
user: profile.identity?.user ?? null,
|
|
110
|
+
identity_captured_at: profile.identity?.capturedAt ?? null,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function formatProfilesList(data) {
|
|
114
|
+
const styles = ansi(output.isTTY === true && !process.env.NO_COLOR);
|
|
115
|
+
if (data.profiles.length === 0) {
|
|
116
|
+
return [
|
|
117
|
+
"",
|
|
118
|
+
`${styles.dim("No stored Oxygen CLI profiles.")}`,
|
|
119
|
+
"",
|
|
120
|
+
].join("\n");
|
|
121
|
+
}
|
|
122
|
+
const nameWidth = Math.max(...data.profiles.map((profile) => profile.name.length));
|
|
123
|
+
const orgWidth = Math.max(...data.profiles.map((profile) => formatProfileOrgCell(profile).length));
|
|
124
|
+
const lines = [
|
|
125
|
+
"",
|
|
126
|
+
`${styles.bold("Oxygen CLI Profiles")}`,
|
|
127
|
+
"",
|
|
128
|
+
...data.profiles.map((profile) => {
|
|
129
|
+
const marker = profile.active ? "*" : " ";
|
|
130
|
+
const orgCell = formatProfileOrgCell(profile);
|
|
131
|
+
return [
|
|
132
|
+
`${marker} ${profile.name.padEnd(nameWidth)}`,
|
|
133
|
+
orgCell.padEnd(orgWidth),
|
|
134
|
+
styles.dim(profile.api_url),
|
|
135
|
+
styles.dim(profile.token_fingerprint),
|
|
136
|
+
].join(" ");
|
|
137
|
+
}),
|
|
138
|
+
"",
|
|
139
|
+
];
|
|
140
|
+
if (data.profiles.length >= 2) {
|
|
141
|
+
lines.push(` ${styles.dim("Pin a terminal:")} ${styles.bold('eval "$(oxygen profiles env <profile>)"')}`);
|
|
142
|
+
lines.push("");
|
|
143
|
+
}
|
|
144
|
+
return lines.join("\n");
|
|
145
|
+
}
|
|
146
|
+
function formatProfileOrgCell(profile) {
|
|
147
|
+
if (!profile.organization)
|
|
148
|
+
return "(unknown org — run `oxygen whoami` to refresh)";
|
|
149
|
+
const { slug, name } = profile.organization;
|
|
150
|
+
if (slug && slug !== name)
|
|
151
|
+
return `${name} (${slug})`;
|
|
152
|
+
return name || slug || profile.organization.id;
|
|
153
|
+
}
|
|
154
|
+
function formatProfileUseSuccess(profile, options) {
|
|
155
|
+
const styles = ansi(output.isTTY === true && !process.env.NO_COLOR);
|
|
156
|
+
const lines = [
|
|
157
|
+
"",
|
|
158
|
+
`${styles.green("[OK]")} ${styles.bold("CLI profile selected")}`,
|
|
159
|
+
"",
|
|
160
|
+
` ${styles.dim("Profile")} ${profile.name}`,
|
|
161
|
+
` ${styles.dim("Organization")} ${formatProfileOrgCell(profile)}`,
|
|
162
|
+
` ${styles.dim("API")} ${profile.api_url}`,
|
|
163
|
+
` ${styles.dim("Fingerprint")} ${profile.token_fingerprint}`,
|
|
164
|
+
"",
|
|
165
|
+
];
|
|
166
|
+
if (options.totalProfiles >= 2) {
|
|
167
|
+
lines.push(` ${styles.dim("Note: this changes the active profile for every shell.")}`);
|
|
168
|
+
lines.push(` ${styles.dim("To pin this terminal only, run:")} ${styles.bold(`eval "$(oxygen profiles env ${profile.name})"`)}`);
|
|
169
|
+
lines.push("");
|
|
170
|
+
}
|
|
171
|
+
return lines.join("\n");
|
|
172
|
+
}
|
|
173
|
+
// skipcq: JS-C1002
|
|
174
|
+
function formatProfilesCurrent(context) {
|
|
175
|
+
const styles = ansi(output.isTTY === true && !process.env.NO_COLOR);
|
|
176
|
+
const sourceLabel = describeProfileSource(context.source);
|
|
177
|
+
if (!context.resolution.exists) {
|
|
178
|
+
return [
|
|
179
|
+
"",
|
|
180
|
+
`${styles.dim("No stored profile resolves for this shell.")}`,
|
|
181
|
+
` ${styles.dim("Source:")} ${sourceLabel}`,
|
|
182
|
+
` ${styles.dim("Run")} ${styles.bold("oxygen login")} ${styles.dim("to create one.")}`,
|
|
183
|
+
"",
|
|
184
|
+
].join("\n");
|
|
185
|
+
}
|
|
186
|
+
const credentials = context.resolution.credentials;
|
|
187
|
+
if (!credentials) {
|
|
188
|
+
return [
|
|
189
|
+
"",
|
|
190
|
+
`${styles.dim("No stored profile resolves for this shell.")}`,
|
|
191
|
+
` ${styles.dim("Source:")} ${sourceLabel}`,
|
|
192
|
+
"",
|
|
193
|
+
].join("\n");
|
|
194
|
+
}
|
|
195
|
+
const organization = credentials.activeOrganization ?? credentials.identity?.organization ?? null;
|
|
196
|
+
const orgCell = organization
|
|
197
|
+
? (organization.slug && organization.slug !== organization.name
|
|
198
|
+
? `${organization.name} (${organization.slug})`
|
|
199
|
+
: organization.name)
|
|
200
|
+
: "(unknown — run `oxygen whoami` to refresh)";
|
|
201
|
+
return [
|
|
202
|
+
"",
|
|
203
|
+
`${styles.bold("Active Oxygen CLI Profile")}`,
|
|
204
|
+
"",
|
|
205
|
+
` ${styles.dim("Profile")} ${context.resolution.name}`,
|
|
206
|
+
` ${styles.dim("Source")} ${sourceLabel}`,
|
|
207
|
+
` ${styles.dim("Organization")} ${orgCell}`,
|
|
208
|
+
` ${styles.dim("API")} ${credentials.apiUrl}`,
|
|
209
|
+
"",
|
|
210
|
+
].join("\n");
|
|
211
|
+
}
|
|
212
|
+
export function registerProfilesFamily(program, handleAsyncAction) {
|
|
213
|
+
program
|
|
214
|
+
.command("profiles")
|
|
215
|
+
.description("Manage stored CLI credential profiles (switch between workspaces and hosts). `oxygen login` creates or updates the active profile.")
|
|
216
|
+
.addCommand(new Command("list")
|
|
217
|
+
.description("List stored CLI credential profiles.")
|
|
218
|
+
.option("--json", "Print a JSON envelope.")
|
|
219
|
+
.action(async (options) => {
|
|
220
|
+
await handleProfilesListAction(options);
|
|
221
|
+
}))
|
|
222
|
+
.addCommand(new Command("use")
|
|
223
|
+
.description("Switch the active CLI credential profile.")
|
|
224
|
+
.argument("<profile>", "Stored profile name.")
|
|
225
|
+
.option("--json", "Print a JSON envelope.")
|
|
226
|
+
.action(async (profile, options) => {
|
|
227
|
+
await handleProfilesUseAction(profile, options);
|
|
228
|
+
}))
|
|
229
|
+
.addCommand(new Command("remove")
|
|
230
|
+
.description("Remove one stored CLI credential profile.")
|
|
231
|
+
.argument("<profile>", "Stored profile name.")
|
|
232
|
+
.option("--json", "Print a JSON envelope.")
|
|
233
|
+
.action(async (profile, options) => {
|
|
234
|
+
await handleLogoutAction({ ...options, profile });
|
|
235
|
+
}))
|
|
236
|
+
.addCommand(new Command("env")
|
|
237
|
+
.description("Print shell `export` lines that pin this terminal to a stored CLI profile.")
|
|
238
|
+
.argument("<profile>", "Stored profile name.")
|
|
239
|
+
.option("--unset", "Print `unset` lines instead of `export` lines.")
|
|
240
|
+
.option("--json", "Print a JSON envelope.")
|
|
241
|
+
.action(async (profile, options) => {
|
|
242
|
+
await handleProfilesEnvAction(profile, options);
|
|
243
|
+
}))
|
|
244
|
+
.addCommand(new Command("current")
|
|
245
|
+
.description("Show the profile the next command will use, and where it came from.")
|
|
246
|
+
.option("--json", "Print a JSON envelope.")
|
|
247
|
+
.action(async (options) => {
|
|
248
|
+
await handleProfilesCurrentAction(options);
|
|
249
|
+
}));
|
|
250
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { resolveLiveDryRunMode } from "../cli-values.js";
|
|
2
|
+
import { splitCommaList } from "../command-support.js";
|
|
3
|
+
import { requestOxygen } from "../http-client.js";
|
|
4
|
+
import { readOption } from "../util.js";
|
|
5
|
+
import { OxygenError } from "@oxygen/shared/cli-result";
|
|
6
|
+
import { Command } from "commander";
|
|
7
|
+
export function registerProjectsFamily(program, handleAsyncAction) {
|
|
8
|
+
program
|
|
9
|
+
.command("projects")
|
|
10
|
+
.description("Manage table folders (projects). Inspect contents with `oxygen tables list --project <project>`.")
|
|
11
|
+
.addCommand(new Command("list")
|
|
12
|
+
.description("List table projects (folders) with each one's active table count (`tableCount`), so empty and oversized folders show without listing every folder's tables. Free.")
|
|
13
|
+
.option("--json", "Print a JSON envelope.")
|
|
14
|
+
.action(async (options) => {
|
|
15
|
+
await handleAsyncAction("projects list", options, () => requestOxygen("/api/cli/projects"));
|
|
16
|
+
}))
|
|
17
|
+
.addCommand(new Command("create")
|
|
18
|
+
.description("Create a schema-backed table project (folder). Free. Group tables into it with `oxygen tables move <tables...> --project <folder>`.")
|
|
19
|
+
.argument("<name>", "Display name for the project.")
|
|
20
|
+
.option("--json", "Print a JSON envelope.")
|
|
21
|
+
.action(async (name, options) => {
|
|
22
|
+
await handleAsyncAction("projects create", options, () => requestOxygen("/api/cli/projects", {
|
|
23
|
+
method: "POST",
|
|
24
|
+
body: { name },
|
|
25
|
+
}));
|
|
26
|
+
}))
|
|
27
|
+
.addCommand(new Command("rename")
|
|
28
|
+
.description("Rename a table project's display name and slug without changing its tables.")
|
|
29
|
+
.argument("<project>", "Project slug or id.")
|
|
30
|
+
.requiredOption("--name <name>", "New display name for the project.")
|
|
31
|
+
.option("--json", "Print a JSON envelope.")
|
|
32
|
+
.action(async (project, options) => {
|
|
33
|
+
await handleAsyncAction("projects rename", options, () => {
|
|
34
|
+
const name = readOption(options.name);
|
|
35
|
+
if (!name) {
|
|
36
|
+
throw new OxygenError("invalid_project_name", "--name is required.", {
|
|
37
|
+
exitCode: 1,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return requestOxygen(`/api/cli/projects/${encodeURIComponent(project)}`, {
|
|
41
|
+
method: "PATCH",
|
|
42
|
+
body: { name },
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}))
|
|
46
|
+
.addCommand(new Command("delete")
|
|
47
|
+
.description("Delete a non-General folder and its tables. Restoring any deleted table with `oxygen tables restore` before the purge date also restores the folder. Defaults to dry-run; --live requires --confirm and the preview's table IDs.")
|
|
48
|
+
.argument("<project>", "Project slug or id.")
|
|
49
|
+
.option("--dry-run", "Preview whether the project can be deleted without writing. Default.")
|
|
50
|
+
.option("--live", "Delete the project after inspecting the dry-run preview. Requires --confirm.")
|
|
51
|
+
.option("--confirm", "Confirm the live delete.")
|
|
52
|
+
.option("--expected-table-ids <ids>", "Comma-separated table IDs from the preview. Required for nonempty folders; refuses if contents changed.")
|
|
53
|
+
.option("--json", "Print a JSON envelope.")
|
|
54
|
+
.action(async (project, options) => {
|
|
55
|
+
await handleAsyncAction("projects delete", options, () => {
|
|
56
|
+
const mode = resolveLiveDryRunMode(options);
|
|
57
|
+
if (mode === "live" && options.confirm !== true) {
|
|
58
|
+
throw new OxygenError("confirm_required", "projects delete --live requires --confirm after inspecting the dry-run preview.", { exitCode: 1 });
|
|
59
|
+
}
|
|
60
|
+
return requestOxygen(`/api/cli/projects/${encodeURIComponent(project)}`, {
|
|
61
|
+
method: "DELETE",
|
|
62
|
+
body: {
|
|
63
|
+
mode,
|
|
64
|
+
...(mode === "live" ? { confirm: true } : {}),
|
|
65
|
+
...(options.expectedTableIds !== undefined
|
|
66
|
+
? { expected_table_ids: splitCommaList(options.expectedTableIds) }
|
|
67
|
+
: {}),
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}))
|
|
72
|
+
.addCommand(new Command("tag")
|
|
73
|
+
.description("Replace a project's workspace tags (whole set; `--tags \"\"` clears). See `oxygen tags list` for the vocabulary.")
|
|
74
|
+
.argument("<project>", "Project slug or id.")
|
|
75
|
+
.requiredOption("--tags <tags>", "Comma-separated workspace tags (replaces the whole set; empty clears).")
|
|
76
|
+
.option("--json", "Print a JSON envelope.")
|
|
77
|
+
.action(async (project, options) => {
|
|
78
|
+
await handleAsyncAction("projects tag", options, () => requestOxygen(`/api/cli/projects/${encodeURIComponent(project)}/tags`, {
|
|
79
|
+
method: "POST",
|
|
80
|
+
body: { tags: splitCommaList(options.tags) },
|
|
81
|
+
}));
|
|
82
|
+
}))
|
|
83
|
+
.addCommand(new Command("color")
|
|
84
|
+
.description("Set a folder's colour in the Tables sidebar (rail) for everyone in the workspace. `--color auto` restores the automatic colour. Free.")
|
|
85
|
+
.argument("<project>", "Project slug or id.")
|
|
86
|
+
.requiredOption("--color <color>", "Colour name (gray, red, orange, amber, yellow, green, teal, blue, indigo, purple, pink) or `auto` to clear.")
|
|
87
|
+
.option("--json", "Print a JSON envelope.")
|
|
88
|
+
.action(async (project, options) => {
|
|
89
|
+
await handleAsyncAction("projects color", options, () => requestOxygen(`/api/cli/projects/${encodeURIComponent(project)}/color`, {
|
|
90
|
+
method: "POST",
|
|
91
|
+
body: { color: options.color?.trim().toLowerCase() ?? null },
|
|
92
|
+
}));
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { handleAsyncAction } from "../cli-output.js";
|
|
2
|
+
import { isUuid } from "../command-support.js";
|
|
3
|
+
import { requestOxygen } from "../http-client.js";
|
|
4
|
+
import { readClearableOption, readOption } from "../util.js";
|
|
5
|
+
import { Command } from "commander";
|
|
6
|
+
function buildPromptTemplatesCommand(surface, description) {
|
|
7
|
+
return new Command(surface)
|
|
8
|
+
.description(description)
|
|
9
|
+
.addCommand(new Command("list")
|
|
10
|
+
.description("List prompt templates in the workspace.")
|
|
11
|
+
.option("--kind <kind>", "Filter by ai_column_system, scoring_rubric, or other.")
|
|
12
|
+
.option("--include-archived", "Include archived templates.")
|
|
13
|
+
.option("--json", "Print a JSON envelope.")
|
|
14
|
+
.action(async (options) => {
|
|
15
|
+
await handleAsyncAction(`${surface} list`, options, () => {
|
|
16
|
+
const params = new URLSearchParams();
|
|
17
|
+
const kind = readOption(options.kind);
|
|
18
|
+
if (kind)
|
|
19
|
+
params.set("kind", kind);
|
|
20
|
+
if (options.includeArchived)
|
|
21
|
+
params.set("include_archived", "true");
|
|
22
|
+
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
23
|
+
return requestOxygen(`/api/cli/templates${qs}`);
|
|
24
|
+
});
|
|
25
|
+
}))
|
|
26
|
+
.addCommand(new Command("get")
|
|
27
|
+
.description("Read one prompt template by id or slug.")
|
|
28
|
+
.argument("<id_or_slug>", "Template UUID or slug.")
|
|
29
|
+
.option("--json", "Print a JSON envelope.")
|
|
30
|
+
.action(async (idOrSlug, options) => {
|
|
31
|
+
await handleAsyncAction(`${surface} get`, options, () => requestOxygen("/api/cli/templates/get", {
|
|
32
|
+
method: "POST",
|
|
33
|
+
body: isUuid(idOrSlug)
|
|
34
|
+
? { id: idOrSlug }
|
|
35
|
+
: { slug: idOrSlug },
|
|
36
|
+
}));
|
|
37
|
+
}))
|
|
38
|
+
.addCommand(new Command("upsert")
|
|
39
|
+
.description("Create or update a prompt template.")
|
|
40
|
+
.option("--id <id>", "Existing template UUID to update. Omit to create.")
|
|
41
|
+
.option("--slug <slug>", "Stable slug (kebab-case).")
|
|
42
|
+
.option("--name <name>", "Human-readable name.")
|
|
43
|
+
.option("--description <text>", "Short description.")
|
|
44
|
+
.option("--kind <kind>", "Template kind: ai_column_system, scoring_rubric, or other.")
|
|
45
|
+
.option("--body <text>", "Prompt body.")
|
|
46
|
+
.option("--body-file <path>", "Path to a file containing the prompt body.")
|
|
47
|
+
.option("--json", "Print a JSON envelope.")
|
|
48
|
+
.action(async (options) => {
|
|
49
|
+
await handleAsyncAction(`${surface} upsert`, options, async () => {
|
|
50
|
+
const body = {};
|
|
51
|
+
if (readOption(options.id))
|
|
52
|
+
body.id = readOption(options.id);
|
|
53
|
+
if (readOption(options.slug))
|
|
54
|
+
body.slug = readOption(options.slug);
|
|
55
|
+
if (readOption(options.name))
|
|
56
|
+
body.name = readOption(options.name);
|
|
57
|
+
const description = readClearableOption(options.description);
|
|
58
|
+
if (description !== undefined)
|
|
59
|
+
body.description = description;
|
|
60
|
+
if (readOption(options.kind))
|
|
61
|
+
body.kind = readOption(options.kind);
|
|
62
|
+
if (readOption(options.body))
|
|
63
|
+
body.body = readOption(options.body);
|
|
64
|
+
else {
|
|
65
|
+
const path = readOption(options.bodyFile);
|
|
66
|
+
if (path) {
|
|
67
|
+
const fs = await import("node:fs/promises");
|
|
68
|
+
body.body = await fs.readFile(path, "utf8");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return requestOxygen("/api/cli/templates/upsert", { method: "POST", body });
|
|
72
|
+
});
|
|
73
|
+
}))
|
|
74
|
+
.addCommand(new Command("archive")
|
|
75
|
+
.description("Archive a prompt template. Seeded templates cannot be archived.")
|
|
76
|
+
.argument("<id>", "Template UUID.")
|
|
77
|
+
.option("--json", "Print a JSON envelope.")
|
|
78
|
+
.action(async (id, options) => {
|
|
79
|
+
await handleAsyncAction(`${surface} archive`, options, () => requestOxygen("/api/cli/templates/archive", { method: "POST", body: { id } }));
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
export function registerPromptsFamily(program, handleAsyncAction) {
|
|
83
|
+
program.addCommand(buildPromptTemplatesCommand("prompts", "Reusable prompt templates layered into AI columns at run time."));
|
|
84
|
+
}
|