@epilot/cli 0.1.193 → 0.1.195
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 +89 -1
- package/definitions/pricing.json +44 -7
- package/dist/{access-token-CMXAXZ3R.js → access-token-Q2UGZIMP.js} +4 -4
- package/dist/{add-component-KJLVM44N.js → add-component-USRY2DQG.js} +4 -4
- package/dist/{add-function-ODBHPWP6.js → add-function-RZTEKVSB.js} +4 -4
- package/dist/{address-556I5SBF.js → address-AX4UT6BO.js} +4 -4
- package/dist/{address-suggestions-5KHWKGNW.js → address-suggestions-GMVIIZY6.js} +4 -4
- package/dist/agent-auth-A2D2R6FP.js +42 -0
- package/dist/{ai-agents-5QBOUUL5.js → ai-agents-J2ZTLDLV.js} +4 -4
- package/dist/{api-MA3KZAHZ.js → api-3L3XZYSQ.js} +4 -4
- package/dist/app-RHHZR5YW.js +26 -0
- package/dist/{audit-logs-N6ZFVTBE.js → audit-logs-VLVHBCF5.js} +4 -4
- package/dist/auth-N3CDDMDS.js +235 -0
- package/dist/auth-login-ACQGAE72.js +34 -0
- package/dist/{auth-token-APXLIQAO.js → auth-token-JOSBGVGA.js} +2 -2
- package/dist/{automation-22LGZB4O.js → automation-NYSYIXDW.js} +4 -4
- package/dist/{billing-O4UZP4LR.js → billing-6SWQNULS.js} +4 -4
- package/dist/bin/epilot.js +84 -60
- package/dist/{blueprint-manifest-RGKFKTQW.js → blueprint-manifest-3RS3SQE6.js} +4 -4
- package/dist/{calendar-BAZUUP7W.js → calendar-WQIQK46M.js} +4 -4
- package/dist/{chat-Q2OKVJTT.js → chat-EMJD5AN5.js} +4 -4
- package/dist/{chunk-CMVLVDYF.js → chunk-36I64456.js} +7 -7
- package/dist/{chunk-7TLX5QRJ.js → chunk-5DFIPWJS.js} +3 -3
- package/dist/chunk-5Q3PQUI2.js +602 -0
- package/dist/{chunk-ENVFJFZZ.js → chunk-BYNI3AGG.js} +1 -1
- package/dist/{chunk-M3M3C5WH.js → chunk-G564QXNL.js} +17 -3
- package/dist/{chunk-YHQA2AVG.js → chunk-QPUCHKXS.js} +1 -0
- package/dist/{auth-login-3AY5U4JU.js → chunk-U4YGZRJY.js} +378 -11
- package/dist/{config-DGZIMLZK.js → config-PJWYWLQH.js} +1 -1
- package/dist/{configuration-hub-LVEKC5UV.js → configuration-hub-BVTAC26A.js} +4 -4
- package/dist/{consent-42RHQN4U.js → consent-UZSED4QQ.js} +4 -4
- package/dist/{customer-portal-CPYSHWMQ.js → customer-portal-CZSHTI3Q.js} +4 -4
- package/dist/{dashboard-X2MFX52H.js → dashboard-NQHQ65ME.js} +4 -4
- package/dist/{data-governance-6TG574RV.js → data-governance-WOUP2NNR.js} +4 -4
- package/dist/{deduplication-TT46SFOU.js → deduplication-EUAFCYY3.js} +4 -4
- package/dist/{deploy-7CEOUBVD.js → deploy-LRSKADBB.js} +4 -4
- package/dist/{design-IG7LWD4X.js → design-XR6C6OTA.js} +4 -4
- package/dist/{dev-SN44SGW4.js → dev-FGVM3R2Z.js} +4 -4
- package/dist/{document-5KYSBLGK.js → document-EWDEIA2Z.js} +4 -4
- package/dist/{email-settings-MZ7XM4H7.js → email-settings-IOHMQBXH.js} +4 -4
- package/dist/{email-template-FUMBRAJC.js → email-template-K6X722R7.js} +4 -4
- package/dist/{entity-VBD2YEZX.js → entity-Z6JH5EDY.js} +4 -4
- package/dist/{entity-mapping-YRLTIJQW.js → entity-mapping-PZY5PCRG.js} +4 -4
- package/dist/{environments-KTG3J2N5.js → environments-FL7IAAHN.js} +4 -4
- package/dist/{event-catalog-Z6XAAUZU.js → event-catalog-GUAWJ3RG.js} +4 -4
- package/dist/{export-OYADKVRF.js → export-IXXFKWBZ.js} +4 -4
- package/dist/{external-values-ZWMXARW2.js → external-values-A7C75KBV.js} +4 -4
- package/dist/{file-762S5MIJ.js → file-IRUY5MWL.js} +4 -4
- package/dist/{iban-KOXXBC27.js → iban-3MLGKYKV.js} +4 -4
- package/dist/{identity-6ZFNTQ3I.js → identity-LI26M7EG.js} +4 -4
- package/dist/{init-OUEJLN3K.js → init-HRF5Q2UW.js} +4 -4
- package/dist/{integration-toolkit-GGVOJ54C.js → integration-toolkit-GSDL2CE2.js} +4 -4
- package/dist/{journey-67YFR7GP.js → journey-ASQNGOEH.js} +4 -4
- package/dist/{kanban-ADY77D7C.js → kanban-7XW56ILD.js} +4 -4
- package/dist/{message-NDXC2GK4.js → message-XYB34GBX.js} +4 -4
- package/dist/{metering-RKYF77CI.js → metering-GJSVL6OZ.js} +4 -4
- package/dist/{notes-5TJY7RB5.js → notes-FZPFGPFO.js} +4 -4
- package/dist/{notification-H6YLABKW.js → notification-X6IHCJDI.js} +4 -4
- package/dist/org-UWRWFPRZ.js +427 -0
- package/dist/{organization-ILSV2FAU.js → organization-374MUWDY.js} +4 -4
- package/dist/{partner-directory-BCH6MF5E.js → partner-directory-BC7XF3VN.js} +4 -4
- package/dist/{permissions-YJNGIXNZ.js → permissions-UAXXL2OG.js} +4 -4
- package/dist/{pricing-G67JCXSJ.js → pricing-Q43OPFUT.js} +4 -4
- package/dist/{pricing-tier-ZHL7YDIR.js → pricing-tier-AHRG3AVC.js} +4 -4
- package/dist/{profile-OZJL5ZPT.js → profile-G2FH3DXR.js} +1 -1
- package/dist/{purpose-TLIZRKF2.js → purpose-FXBJ24XT.js} +4 -4
- package/dist/{query-RJFX7FVF.js → query-Y5XZZBFS.js} +4 -4
- package/dist/{remove-component-CM5KWCN6.js → remove-component-WQLTK36T.js} +4 -4
- package/dist/{review-MU2OAL5D.js → review-XWKQ2QBF.js} +4 -4
- package/dist/{sandbox-UVLVVTEA.js → sandbox-7DPZVDMD.js} +4 -4
- package/dist/{sharing-U5O6SIM2.js → sharing-4IMN5325.js} +4 -4
- package/dist/{snapshot-VSORAWHR.js → snapshot-OE7NRZGS.js} +4 -4
- package/dist/{submission-HVNOP5T6.js → submission-R2GYF5UV.js} +4 -4
- package/dist/{targeting-STSFTPYR.js → targeting-NLHZEKAE.js} +4 -4
- package/dist/{template-variables-MFDAUYI4.js → template-variables-BEBZD6IW.js} +4 -4
- package/dist/{upgrade-EBCK4LM6.js → upgrade-ON2KV5LK.js} +1 -1
- package/dist/{user-Y5N4UYAI.js → user-C2MPCWFC.js} +4 -4
- package/dist/{validate-N3KWJCCB.js → validate-L3EVLLDB.js} +4 -4
- package/dist/{validation-rules-LTKHB7BK.js → validation-rules-MCQP5FYV.js} +4 -4
- package/dist/{versions-M2OEVZZG.js → versions-U4M5UMIX.js} +4 -4
- package/dist/{webhooks-XU3W66DH.js → webhooks-CXLFLDRO.js} +4 -4
- package/dist/{workflow-N6IJ6LYR.js → workflow-WGG5Y45V.js} +4 -4
- package/dist/{workflow-definition-GTOTMANE.js → workflow-definition-P5RIZCJK.js} +4 -4
- package/package.json +3 -2
- package/dist/app-W7SP77LS.js +0 -26
- package/dist/auth-WMXFMPWE.js +0 -119
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
describeAccess,
|
|
4
|
+
openBrowser,
|
|
5
|
+
parseAccessProfile,
|
|
6
|
+
printApproval,
|
|
7
|
+
resolveReason
|
|
8
|
+
} from "./chunk-U4YGZRJY.js";
|
|
9
|
+
import {
|
|
10
|
+
isInteractive
|
|
11
|
+
} from "./chunk-IOLKUHUB.js";
|
|
12
|
+
import {
|
|
13
|
+
ACCESS_PROFILES,
|
|
14
|
+
AgentAuthError,
|
|
15
|
+
formatExpiresIn,
|
|
16
|
+
isGrantUsable,
|
|
17
|
+
isReadProfile,
|
|
18
|
+
issueTokenForOrg,
|
|
19
|
+
listEpilotOrganizations,
|
|
20
|
+
loadAgentIdentity,
|
|
21
|
+
mostPermissiveProfile,
|
|
22
|
+
organizationGrants,
|
|
23
|
+
requestOrganizationAccess
|
|
24
|
+
} from "./chunk-5Q3PQUI2.js";
|
|
25
|
+
import {
|
|
26
|
+
loadCredentials
|
|
27
|
+
} from "./chunk-G564QXNL.js";
|
|
28
|
+
import {
|
|
29
|
+
getResolvedProfile
|
|
30
|
+
} from "./chunk-QPUCHKXS.js";
|
|
31
|
+
import {
|
|
32
|
+
BOLD,
|
|
33
|
+
CYAN,
|
|
34
|
+
DIM,
|
|
35
|
+
GREEN,
|
|
36
|
+
RED,
|
|
37
|
+
RESET,
|
|
38
|
+
YELLOW
|
|
39
|
+
} from "./chunk-7ZQ666ZQ.js";
|
|
40
|
+
|
|
41
|
+
// src/commands/org.ts
|
|
42
|
+
import { defineCommand } from "citty";
|
|
43
|
+
var commonArgs = {
|
|
44
|
+
profile: { type: "string", description: "Named profile whose agent identity to use (or EPILOT_PROFILE env)" },
|
|
45
|
+
json: { type: "boolean", description: "Output raw JSON" },
|
|
46
|
+
interactive: { type: "boolean", default: true, description: "Interactive mode (--no-interactive to disable)" }
|
|
47
|
+
};
|
|
48
|
+
var accessArg = {
|
|
49
|
+
access: {
|
|
50
|
+
type: "string",
|
|
51
|
+
description: `Access profile (${ACCESS_PROFILES.join(", ")})`
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var AGENT_REQUIRED_MESSAGE = "This profile has no agent identity. Run `epilot auth login --agent` first.";
|
|
55
|
+
var fail = (message, code, json) => {
|
|
56
|
+
if (json) {
|
|
57
|
+
process.stdout.write(`${JSON.stringify({ error: code ?? "error", message })}
|
|
58
|
+
`);
|
|
59
|
+
} else {
|
|
60
|
+
process.stderr.write(`${RED}${message}${RESET}${code ? ` ${DIM}(${code})${RESET}` : ""}
|
|
61
|
+
`);
|
|
62
|
+
}
|
|
63
|
+
process.exit(1);
|
|
64
|
+
};
|
|
65
|
+
var handleError = (error, json) => {
|
|
66
|
+
if (error instanceof AgentAuthError) return fail(error.message, error.code, json);
|
|
67
|
+
return fail(error instanceof Error ? error.message : String(error), void 0, json);
|
|
68
|
+
};
|
|
69
|
+
var requireAgent = (profileName, json) => {
|
|
70
|
+
const loaded = loadAgentIdentity(profileName);
|
|
71
|
+
if (!loaded) {
|
|
72
|
+
if (json) {
|
|
73
|
+
process.stdout.write(`${JSON.stringify({ error: "agent_required", message: AGENT_REQUIRED_MESSAGE })}
|
|
74
|
+
`);
|
|
75
|
+
} else {
|
|
76
|
+
process.stderr.write(
|
|
77
|
+
`${YELLOW}This profile has no agent identity.${RESET} Run ${BOLD}epilot auth login --agent${RESET} first.
|
|
78
|
+
`
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
return loaded;
|
|
84
|
+
};
|
|
85
|
+
var currentOrgId = (loaded, profileName) => getResolvedProfile(profileName)?.org_id ?? loadCredentials()?.org_id ?? loaded?.record.org_id;
|
|
86
|
+
var accessCell = (o) => {
|
|
87
|
+
if (o.access?.granted) {
|
|
88
|
+
const details = [
|
|
89
|
+
o.access.access_profile ?? "read",
|
|
90
|
+
o.access.anonymized ? "anonymized" : "",
|
|
91
|
+
formatExpiresIn(o.access.expires_at) ?? ""
|
|
92
|
+
].filter(Boolean);
|
|
93
|
+
const pending = o.access.pending ? ` ${YELLOW}+ pending request${RESET}` : "";
|
|
94
|
+
return `${GREEN}granted${RESET} ${DIM}(${details.join(", ")})${RESET}${pending}`;
|
|
95
|
+
}
|
|
96
|
+
if (o.access?.pending) return `${YELLOW}pending${RESET}`;
|
|
97
|
+
return `${DIM}no access${RESET}`;
|
|
98
|
+
};
|
|
99
|
+
var formatOrgTable = (organizations, activeId) => {
|
|
100
|
+
const idWidth = Math.max(2, ...organizations.map((o) => o.organization_id.length));
|
|
101
|
+
const nameWidth = Math.max(4, ...organizations.map((o) => (o.organization_name ?? "").length));
|
|
102
|
+
const typeWidth = Math.max(4, ...organizations.map((o) => (o.organization_type ?? "").length));
|
|
103
|
+
const lines = [
|
|
104
|
+
` ${BOLD}${"ID".padEnd(idWidth)} ${"NAME".padEnd(nameWidth)} ${"TYPE".padEnd(typeWidth)} ACCESS${RESET}`
|
|
105
|
+
];
|
|
106
|
+
for (const o of organizations) {
|
|
107
|
+
const marker = o.organization_id === activeId ? `${CYAN}*${RESET}` : " ";
|
|
108
|
+
lines.push(
|
|
109
|
+
`${marker} ${o.organization_id.padEnd(idWidth)} ${(o.organization_name ?? "").padEnd(nameWidth)} ${(o.organization_type ?? "").padEnd(typeWidth)} ${accessCell(o)}`
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
if (activeId) lines.push(`
|
|
113
|
+
${DIM}* active organization${RESET}`);
|
|
114
|
+
return `${lines.join("\n")}
|
|
115
|
+
`;
|
|
116
|
+
};
|
|
117
|
+
var isDeviceAuthorization = (approval) => !!approval && approval.method === "device_authorization";
|
|
118
|
+
var grantedProfile = async (loaded, orgId) => {
|
|
119
|
+
const status = await loaded.client.getAgentStatus(loaded.identity.hostKey, loaded.identity.agentId);
|
|
120
|
+
const usable = organizationGrants(status.agent_capability_grants).filter(
|
|
121
|
+
(g) => g.organizationId === orgId && isGrantUsable(g)
|
|
122
|
+
);
|
|
123
|
+
return mostPermissiveProfile(usable.map((g) => g.profile));
|
|
124
|
+
};
|
|
125
|
+
var resolveRequestProfile = (args) => {
|
|
126
|
+
const explicit = parseAccessProfile(args.access);
|
|
127
|
+
if (args.write) {
|
|
128
|
+
process.stderr.write(
|
|
129
|
+
`${DIM}--write is deprecated; use --access full (or a narrower profile such as config:write / data:write).${RESET}
|
|
130
|
+
`
|
|
131
|
+
);
|
|
132
|
+
return explicit ?? "full";
|
|
133
|
+
}
|
|
134
|
+
return explicit ?? "read";
|
|
135
|
+
};
|
|
136
|
+
var requestOrgAccess = async (loaded, options) => {
|
|
137
|
+
const profile = options.accessProfile ?? "read";
|
|
138
|
+
const readProfile = isReadProfile(profile);
|
|
139
|
+
const anonymize = readProfile ? !options.fullPii : false;
|
|
140
|
+
const interactive = isInteractive({ interactive: options.interactive }) && !options.json;
|
|
141
|
+
const out = (s) => (options.json ? process.stderr : process.stdout).write(s);
|
|
142
|
+
if (options.fullPii && !readProfile) {
|
|
143
|
+
out(`${DIM}--full-pii is implied by ${profile}: write access is never anonymized.${RESET}
|
|
144
|
+
`);
|
|
145
|
+
}
|
|
146
|
+
const reason = await resolveReason(profile, options.reason, interactive && !!process.stdin.isTTY) ?? `epilot CLI: access to organization ${options.orgId}`;
|
|
147
|
+
const response = await requestOrganizationAccess(loaded.client, loaded.identity, {
|
|
148
|
+
organizationId: options.orgId,
|
|
149
|
+
profile,
|
|
150
|
+
anonymize,
|
|
151
|
+
reason
|
|
152
|
+
});
|
|
153
|
+
const grants = response.agent_capability_grants ?? [];
|
|
154
|
+
const pendingGrants = grants.filter((g) => g.status === "pending");
|
|
155
|
+
const alreadyActive = grants.length > 0 && pendingGrants.length === 0 && grants.every((g) => g.status === "active");
|
|
156
|
+
let effectiveProfile = profile;
|
|
157
|
+
if (!alreadyActive) {
|
|
158
|
+
if (!isDeviceAuthorization(response.approval)) {
|
|
159
|
+
return fail("The server did not return a device authorization approval.", "unsupported_approval", options.json);
|
|
160
|
+
}
|
|
161
|
+
out(`
|
|
162
|
+
${BOLD}Access request for organization ${options.orgId}${RESET}
|
|
163
|
+
`);
|
|
164
|
+
out(` Access: ${describeAccess({ profile, anonymized: anonymize })}`);
|
|
165
|
+
out(readProfile && !anonymize ? `, ${YELLOW}full personal data${RESET}
|
|
166
|
+
` : "\n");
|
|
167
|
+
out(` Reason: ${reason}
|
|
168
|
+
`);
|
|
169
|
+
printApproval(response.approval, out);
|
|
170
|
+
if (!interactive) {
|
|
171
|
+
const pending = {
|
|
172
|
+
status: "pending",
|
|
173
|
+
organization_id: options.orgId,
|
|
174
|
+
requested: { organization_id: options.orgId, access_profile: profile, anonymize, reason },
|
|
175
|
+
approval: response.approval,
|
|
176
|
+
grants,
|
|
177
|
+
next: `epilot org use ${options.orgId}`
|
|
178
|
+
};
|
|
179
|
+
if (options.json) {
|
|
180
|
+
process.stdout.write(`${JSON.stringify(pending, null, 2)}
|
|
181
|
+
`);
|
|
182
|
+
} else {
|
|
183
|
+
out(
|
|
184
|
+
`${DIM}Approve the request in your browser, then run ${RESET}epilot org use ${options.orgId}${DIM}.${RESET}
|
|
185
|
+
`
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
await openBrowser(response.approval.verification_uri_complete, out);
|
|
191
|
+
const status = await loaded.client.waitForApproval(
|
|
192
|
+
loaded.identity.hostKey,
|
|
193
|
+
loaded.identity.agentId,
|
|
194
|
+
response.approval,
|
|
195
|
+
{
|
|
196
|
+
pendingGrantIds: pendingGrants.map((g) => g.id).filter((id) => !!id),
|
|
197
|
+
onPoll: () => out(".")
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
out("\n");
|
|
201
|
+
const decided = status.agent_capability_grants.filter((g) => pendingGrants.some((p) => p.id && p.id === g.id));
|
|
202
|
+
if (decided.length > 0 && decided.every((g) => g.status === "denied")) {
|
|
203
|
+
return fail(`Access to organization ${options.orgId} was denied.`, "grant_denied", options.json);
|
|
204
|
+
}
|
|
205
|
+
const granted = organizationGrants(decided).filter((g) => isGrantUsable(g));
|
|
206
|
+
effectiveProfile = mostPermissiveProfile(granted.map((g) => g.profile)) ?? profile;
|
|
207
|
+
if (effectiveProfile !== profile) {
|
|
208
|
+
out(`${YELLOW}Access was granted as ${effectiveProfile} instead of the requested ${profile}.${RESET}
|
|
209
|
+
`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
await switchToOrg(loaded, options.orgId, { profile: options.profile, json: options.json }, void 0, {
|
|
213
|
+
profile: effectiveProfile,
|
|
214
|
+
anonymize: isReadProfile(effectiveProfile) && anonymize ? true : void 0
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
var switchToOrg = async (loaded, orgId, options, org, access = {}) => {
|
|
218
|
+
const profile = access.profile ?? org?.access?.access_profile ?? await grantedProfile(loaded, orgId);
|
|
219
|
+
const anonymize = access.anonymize ?? (org?.access?.anonymized === true ? true : void 0);
|
|
220
|
+
const issued = await issueTokenForOrg(loaded, orgId, {
|
|
221
|
+
...profile ? { profile } : {},
|
|
222
|
+
...anonymize !== void 0 ? { anonymize } : {},
|
|
223
|
+
profileName: options.profile
|
|
224
|
+
});
|
|
225
|
+
const issuedProfile = issued.access_profile ?? profile ?? "read";
|
|
226
|
+
if (options.json) {
|
|
227
|
+
process.stdout.write(
|
|
228
|
+
`${JSON.stringify(
|
|
229
|
+
{
|
|
230
|
+
status: "active",
|
|
231
|
+
organization_id: issued.organization_id ?? orgId,
|
|
232
|
+
organization_name: org?.organization_name,
|
|
233
|
+
user_id: issued.user_id,
|
|
234
|
+
access_profile: issuedProfile,
|
|
235
|
+
read_only: issued.read_only,
|
|
236
|
+
anonymize: issued.anonymize,
|
|
237
|
+
expires_at: issued.expires_at,
|
|
238
|
+
...org?.access?.expires_at ? { grant_expires_at: org.access.expires_at } : {}
|
|
239
|
+
},
|
|
240
|
+
null,
|
|
241
|
+
2
|
|
242
|
+
)}
|
|
243
|
+
`
|
|
244
|
+
);
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const label = org?.organization_name ? `${org.organization_name} ${DIM}(${orgId})${RESET}` : orgId;
|
|
248
|
+
process.stdout.write(`${GREEN}${BOLD}Switched to organization ${RESET}${label}
|
|
249
|
+
`);
|
|
250
|
+
process.stdout.write(
|
|
251
|
+
` Access: ${describeAccess({ profile: issuedProfile, anonymized: issued.anonymize, expiresAt: org?.access?.expires_at })}
|
|
252
|
+
`
|
|
253
|
+
);
|
|
254
|
+
process.stdout.write(` Token expires: ${issued.expires_at} ${DIM}(refreshed automatically)${RESET}
|
|
255
|
+
`);
|
|
256
|
+
};
|
|
257
|
+
var org_default = defineCommand({
|
|
258
|
+
meta: {
|
|
259
|
+
name: "org",
|
|
260
|
+
description: "List, switch and request access to organizations (agent mode: `epilot auth login --agent`)"
|
|
261
|
+
},
|
|
262
|
+
subCommands: {
|
|
263
|
+
list: defineCommand({
|
|
264
|
+
meta: { name: "list", description: "List your organizations and the access this CLI has to them" },
|
|
265
|
+
args: commonArgs,
|
|
266
|
+
run: async ({ args }) => {
|
|
267
|
+
const loaded = requireAgent(args.profile, args.json);
|
|
268
|
+
try {
|
|
269
|
+
const { organizations } = await listEpilotOrganizations(loaded.client, loaded.identity);
|
|
270
|
+
const active = currentOrgId(loaded, args.profile);
|
|
271
|
+
if (args.json) {
|
|
272
|
+
process.stdout.write(
|
|
273
|
+
`${JSON.stringify(
|
|
274
|
+
organizations.map((o) => ({ ...o, active: o.organization_id === active })),
|
|
275
|
+
null,
|
|
276
|
+
2
|
|
277
|
+
)}
|
|
278
|
+
`
|
|
279
|
+
);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (organizations.length === 0) {
|
|
283
|
+
process.stdout.write("No organizations found for your user.\n");
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
process.stdout.write(formatOrgTable(organizations, active));
|
|
287
|
+
} catch (error) {
|
|
288
|
+
handleError(error, args.json);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}),
|
|
292
|
+
use: defineCommand({
|
|
293
|
+
meta: {
|
|
294
|
+
name: "use",
|
|
295
|
+
description: "Switch the active organization (issues a token for its most permissive grant)"
|
|
296
|
+
},
|
|
297
|
+
args: {
|
|
298
|
+
id: { type: "positional", description: "Organization ID", required: true },
|
|
299
|
+
...accessArg,
|
|
300
|
+
...commonArgs
|
|
301
|
+
},
|
|
302
|
+
run: async ({ args }) => {
|
|
303
|
+
const loaded = requireAgent(args.profile, args.json);
|
|
304
|
+
const orgId = String(args.id);
|
|
305
|
+
try {
|
|
306
|
+
const explicit = parseAccessProfile(args.access);
|
|
307
|
+
const { organizations } = await listEpilotOrganizations(loaded.client, loaded.identity);
|
|
308
|
+
const org = organizations.find((o) => o.organization_id === orgId);
|
|
309
|
+
if (!org) {
|
|
310
|
+
return fail(`Organization ${orgId} is not available to your user.`, "organization_not_found", args.json);
|
|
311
|
+
}
|
|
312
|
+
if (org.access?.granted) {
|
|
313
|
+
await switchToOrg(loaded, orgId, args, org, { profile: explicit });
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
process.stdout.write(
|
|
317
|
+
`${YELLOW}This CLI has no access to organization ${orgId} yet${org.access?.pending ? " (request pending)" : ""}.${RESET} Requesting access...
|
|
318
|
+
`
|
|
319
|
+
);
|
|
320
|
+
await requestOrgAccess(loaded, { ...args, orgId, accessProfile: explicit });
|
|
321
|
+
} catch (error) {
|
|
322
|
+
handleError(error, args.json);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}),
|
|
326
|
+
request: defineCommand({
|
|
327
|
+
meta: { name: "request", description: "Request access to an organization (approved in your browser)" },
|
|
328
|
+
args: {
|
|
329
|
+
id: { type: "positional", description: "Organization ID", required: true },
|
|
330
|
+
...accessArg,
|
|
331
|
+
write: { type: "boolean", description: "Deprecated: same as --access full" },
|
|
332
|
+
reason: {
|
|
333
|
+
type: "string",
|
|
334
|
+
description: "Purpose shown to the approving user (required for profiles other than read)"
|
|
335
|
+
},
|
|
336
|
+
"full-pii": {
|
|
337
|
+
type: "boolean",
|
|
338
|
+
description: "Read profiles: request unmasked personal data (default: anonymized; implied by write profiles)"
|
|
339
|
+
},
|
|
340
|
+
...commonArgs
|
|
341
|
+
},
|
|
342
|
+
run: async ({ args }) => {
|
|
343
|
+
const loaded = requireAgent(args.profile, args.json);
|
|
344
|
+
try {
|
|
345
|
+
await requestOrgAccess(loaded, {
|
|
346
|
+
orgId: String(args.id),
|
|
347
|
+
accessProfile: resolveRequestProfile(args),
|
|
348
|
+
fullPii: args["full-pii"],
|
|
349
|
+
reason: args.reason,
|
|
350
|
+
profile: args.profile,
|
|
351
|
+
json: args.json,
|
|
352
|
+
interactive: args.interactive
|
|
353
|
+
});
|
|
354
|
+
} catch (error) {
|
|
355
|
+
handleError(error, args.json);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}),
|
|
359
|
+
current: defineCommand({
|
|
360
|
+
meta: { name: "current", description: "Show the active organization" },
|
|
361
|
+
args: commonArgs,
|
|
362
|
+
run: async ({ args }) => {
|
|
363
|
+
const loaded = requireAgent(args.profile, args.json);
|
|
364
|
+
const orgId = currentOrgId(loaded, args.profile);
|
|
365
|
+
if (!orgId) {
|
|
366
|
+
if (args.json) {
|
|
367
|
+
process.stdout.write(`${JSON.stringify({ organization_id: null, agent_id: loaded.record.agent_id })}
|
|
368
|
+
`);
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
process.stdout.write(`${YELLOW}No active organization.${RESET} Run ${BOLD}epilot org use <id>${RESET}.
|
|
372
|
+
`);
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
let org;
|
|
376
|
+
try {
|
|
377
|
+
const { organizations } = await listEpilotOrganizations(loaded.client, loaded.identity);
|
|
378
|
+
org = organizations.find((o) => o.organization_id === orgId);
|
|
379
|
+
} catch {
|
|
380
|
+
}
|
|
381
|
+
const accessProfile = loaded.record.access_profile ?? org?.access?.access_profile ?? "read";
|
|
382
|
+
if (args.json) {
|
|
383
|
+
process.stdout.write(
|
|
384
|
+
`${JSON.stringify(
|
|
385
|
+
{
|
|
386
|
+
organization_id: orgId,
|
|
387
|
+
organization_name: org?.organization_name,
|
|
388
|
+
access_profile: accessProfile,
|
|
389
|
+
read_only: loaded.record.read_only ?? org?.access?.read_only,
|
|
390
|
+
anonymize: loaded.record.anonymize ?? org?.access?.anonymized,
|
|
391
|
+
grant_expires_at: org?.access?.expires_at,
|
|
392
|
+
agent_id: loaded.record.agent_id
|
|
393
|
+
},
|
|
394
|
+
null,
|
|
395
|
+
2
|
|
396
|
+
)}
|
|
397
|
+
`
|
|
398
|
+
);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
const label = org?.organization_name ? `${org.organization_name} ${DIM}(${orgId})${RESET}` : orgId;
|
|
402
|
+
process.stdout.write(`${BOLD}Active organization:${RESET} ${label}
|
|
403
|
+
`);
|
|
404
|
+
process.stdout.write(
|
|
405
|
+
` Access: ${describeAccess({
|
|
406
|
+
profile: accessProfile,
|
|
407
|
+
anonymized: loaded.record.anonymize ?? org?.access?.anonymized,
|
|
408
|
+
expiresAt: org?.access?.expires_at
|
|
409
|
+
})}
|
|
410
|
+
`
|
|
411
|
+
);
|
|
412
|
+
if (org) process.stdout.write(` Grants: ${accessCell(org)}
|
|
413
|
+
`);
|
|
414
|
+
}
|
|
415
|
+
})
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
export {
|
|
419
|
+
AGENT_REQUIRED_MESSAGE,
|
|
420
|
+
currentOrgId,
|
|
421
|
+
org_default as default,
|
|
422
|
+
formatOrgTable,
|
|
423
|
+
requestOrgAccess,
|
|
424
|
+
requireAgent,
|
|
425
|
+
resolveRequestProfile,
|
|
426
|
+
switchToOrg
|
|
427
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
callApi
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-36I64456.js";
|
|
5
|
+
import "./chunk-BYNI3AGG.js";
|
|
5
6
|
import "./chunk-IOLKUHUB.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-YHQA2AVG.js";
|
|
7
|
+
import "./chunk-G564QXNL.js";
|
|
8
|
+
import "./chunk-QPUCHKXS.js";
|
|
9
9
|
import "./chunk-7ZQ666ZQ.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/apis/organization.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
callApi
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-36I64456.js";
|
|
5
|
+
import "./chunk-BYNI3AGG.js";
|
|
5
6
|
import "./chunk-IOLKUHUB.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-YHQA2AVG.js";
|
|
7
|
+
import "./chunk-G564QXNL.js";
|
|
8
|
+
import "./chunk-QPUCHKXS.js";
|
|
9
9
|
import "./chunk-7ZQ666ZQ.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/apis/partner-directory.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
callApi
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-36I64456.js";
|
|
5
|
+
import "./chunk-BYNI3AGG.js";
|
|
5
6
|
import "./chunk-IOLKUHUB.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-YHQA2AVG.js";
|
|
7
|
+
import "./chunk-G564QXNL.js";
|
|
8
|
+
import "./chunk-QPUCHKXS.js";
|
|
9
9
|
import "./chunk-7ZQ666ZQ.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/apis/permissions.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
callApi
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-36I64456.js";
|
|
5
|
+
import "./chunk-BYNI3AGG.js";
|
|
5
6
|
import "./chunk-IOLKUHUB.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-YHQA2AVG.js";
|
|
7
|
+
import "./chunk-G564QXNL.js";
|
|
8
|
+
import "./chunk-QPUCHKXS.js";
|
|
9
9
|
import "./chunk-7ZQ666ZQ.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/apis/pricing.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
callApi
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-36I64456.js";
|
|
5
|
+
import "./chunk-BYNI3AGG.js";
|
|
5
6
|
import "./chunk-IOLKUHUB.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-YHQA2AVG.js";
|
|
7
|
+
import "./chunk-G564QXNL.js";
|
|
8
|
+
import "./chunk-QPUCHKXS.js";
|
|
9
9
|
import "./chunk-7ZQ666ZQ.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/apis/pricing-tier.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
callApi
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-36I64456.js";
|
|
5
|
+
import "./chunk-BYNI3AGG.js";
|
|
5
6
|
import "./chunk-IOLKUHUB.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-YHQA2AVG.js";
|
|
7
|
+
import "./chunk-G564QXNL.js";
|
|
8
|
+
import "./chunk-QPUCHKXS.js";
|
|
9
9
|
import "./chunk-7ZQ666ZQ.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/apis/purpose.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
callApi
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-36I64456.js";
|
|
5
|
+
import "./chunk-BYNI3AGG.js";
|
|
5
6
|
import "./chunk-IOLKUHUB.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-YHQA2AVG.js";
|
|
7
|
+
import "./chunk-G564QXNL.js";
|
|
8
|
+
import "./chunk-QPUCHKXS.js";
|
|
9
9
|
import "./chunk-7ZQ666ZQ.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/apis/query.ts
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
log,
|
|
4
4
|
readManifest,
|
|
5
5
|
writeManifest
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-5DFIPWJS.js";
|
|
7
|
+
import "./chunk-BYNI3AGG.js";
|
|
8
|
+
import "./chunk-G564QXNL.js";
|
|
9
|
+
import "./chunk-QPUCHKXS.js";
|
|
10
10
|
import "./chunk-7ZQ666ZQ.js";
|
|
11
11
|
|
|
12
12
|
// src/commands/app/remove-component.ts
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
createAppApiClient,
|
|
4
4
|
log,
|
|
5
5
|
readManifest
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-5DFIPWJS.js";
|
|
7
|
+
import "./chunk-BYNI3AGG.js";
|
|
8
|
+
import "./chunk-G564QXNL.js";
|
|
9
|
+
import "./chunk-QPUCHKXS.js";
|
|
10
10
|
import "./chunk-7ZQ666ZQ.js";
|
|
11
11
|
|
|
12
12
|
// src/commands/app/review.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
callApi
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-36I64456.js";
|
|
5
|
+
import "./chunk-BYNI3AGG.js";
|
|
5
6
|
import "./chunk-IOLKUHUB.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-YHQA2AVG.js";
|
|
7
|
+
import "./chunk-G564QXNL.js";
|
|
8
|
+
import "./chunk-QPUCHKXS.js";
|
|
9
9
|
import "./chunk-7ZQ666ZQ.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/apis/sandbox.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
callApi
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-36I64456.js";
|
|
5
|
+
import "./chunk-BYNI3AGG.js";
|
|
5
6
|
import "./chunk-IOLKUHUB.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-YHQA2AVG.js";
|
|
7
|
+
import "./chunk-G564QXNL.js";
|
|
8
|
+
import "./chunk-QPUCHKXS.js";
|
|
9
9
|
import "./chunk-7ZQ666ZQ.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/apis/sharing.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
callApi
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-36I64456.js";
|
|
5
|
+
import "./chunk-BYNI3AGG.js";
|
|
5
6
|
import "./chunk-IOLKUHUB.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-YHQA2AVG.js";
|
|
7
|
+
import "./chunk-G564QXNL.js";
|
|
8
|
+
import "./chunk-QPUCHKXS.js";
|
|
9
9
|
import "./chunk-7ZQ666ZQ.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/apis/snapshot.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
callApi
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-36I64456.js";
|
|
5
|
+
import "./chunk-BYNI3AGG.js";
|
|
5
6
|
import "./chunk-IOLKUHUB.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-YHQA2AVG.js";
|
|
7
|
+
import "./chunk-G564QXNL.js";
|
|
8
|
+
import "./chunk-QPUCHKXS.js";
|
|
9
9
|
import "./chunk-7ZQ666ZQ.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/apis/submission.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
callApi
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-36I64456.js";
|
|
5
|
+
import "./chunk-BYNI3AGG.js";
|
|
5
6
|
import "./chunk-IOLKUHUB.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-YHQA2AVG.js";
|
|
7
|
+
import "./chunk-G564QXNL.js";
|
|
8
|
+
import "./chunk-QPUCHKXS.js";
|
|
9
9
|
import "./chunk-7ZQ666ZQ.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/apis/targeting.ts
|