@getpara/cli 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -0
- package/dist/api/client.d.ts +49 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +247 -0
- package/dist/api/errors.d.ts +9 -0
- package/dist/api/errors.d.ts.map +1 -0
- package/dist/api/errors.js +29 -0
- package/dist/api/types.d.ts +155 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +58 -0
- package/dist/auth/polling-flow.d.ts +7 -0
- package/dist/auth/polling-flow.d.ts.map +1 -0
- package/dist/auth/polling-flow.js +94 -0
- package/dist/auth/session-manager.d.ts +7 -0
- package/dist/auth/session-manager.d.ts.map +1 -0
- package/dist/auth/session-manager.js +42 -0
- package/dist/cli.d.ts +16 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +151 -0
- package/dist/commands/auth/index.d.ts +3 -0
- package/dist/commands/auth/index.d.ts.map +1 -0
- package/dist/commands/auth/index.js +18 -0
- package/dist/commands/auth/login.d.ts +3 -0
- package/dist/commands/auth/login.d.ts.map +1 -0
- package/dist/commands/auth/login.js +70 -0
- package/dist/commands/auth/logout.d.ts +3 -0
- package/dist/commands/auth/logout.d.ts.map +1 -0
- package/dist/commands/auth/logout.js +45 -0
- package/dist/commands/auth/status.d.ts +3 -0
- package/dist/commands/auth/status.d.ts.map +1 -0
- package/dist/commands/auth/status.js +54 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +122 -0
- package/dist/commands/create.d.ts +3 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +587 -0
- package/dist/commands/doctor.d.ts +3 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +67 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +45 -0
- package/dist/commands/keys/archive.d.ts +3 -0
- package/dist/commands/keys/archive.d.ts.map +1 -0
- package/dist/commands/keys/archive.js +49 -0
- package/dist/commands/keys/config/branding.d.ts +23 -0
- package/dist/commands/keys/config/branding.d.ts.map +1 -0
- package/dist/commands/keys/config/branding.js +246 -0
- package/dist/commands/keys/config/categories.d.ts +15 -0
- package/dist/commands/keys/config/categories.d.ts.map +1 -0
- package/dist/commands/keys/config/categories.js +67 -0
- package/dist/commands/keys/config/index.d.ts +3 -0
- package/dist/commands/keys/config/index.d.ts.map +1 -0
- package/dist/commands/keys/config/index.js +56 -0
- package/dist/commands/keys/config/ramps.d.ts +18 -0
- package/dist/commands/keys/config/ramps.d.ts.map +1 -0
- package/dist/commands/keys/config/ramps.js +185 -0
- package/dist/commands/keys/config/security.d.ts +15 -0
- package/dist/commands/keys/config/security.d.ts.map +1 -0
- package/dist/commands/keys/config/security.js +212 -0
- package/dist/commands/keys/config/setup.d.ts +16 -0
- package/dist/commands/keys/config/setup.d.ts.map +1 -0
- package/dist/commands/keys/config/setup.js +235 -0
- package/dist/commands/keys/config/webhooks.d.ts +18 -0
- package/dist/commands/keys/config/webhooks.d.ts.map +1 -0
- package/dist/commands/keys/config/webhooks.js +279 -0
- package/dist/commands/keys/create.d.ts +3 -0
- package/dist/commands/keys/create.d.ts.map +1 -0
- package/dist/commands/keys/create.js +64 -0
- package/dist/commands/keys/get.d.ts +3 -0
- package/dist/commands/keys/get.d.ts.map +1 -0
- package/dist/commands/keys/get.js +91 -0
- package/dist/commands/keys/index.d.ts +3 -0
- package/dist/commands/keys/index.d.ts.map +1 -0
- package/dist/commands/keys/index.js +22 -0
- package/dist/commands/keys/list.d.ts +3 -0
- package/dist/commands/keys/list.d.ts.map +1 -0
- package/dist/commands/keys/list.js +66 -0
- package/dist/commands/keys/rotate.d.ts +3 -0
- package/dist/commands/keys/rotate.d.ts.map +1 -0
- package/dist/commands/keys/rotate.js +59 -0
- package/dist/commands/orgs/index.d.ts +3 -0
- package/dist/commands/orgs/index.d.ts.map +1 -0
- package/dist/commands/orgs/index.js +15 -0
- package/dist/commands/orgs/list.d.ts +3 -0
- package/dist/commands/orgs/list.d.ts.map +1 -0
- package/dist/commands/orgs/list.js +53 -0
- package/dist/commands/orgs/switch.d.ts +3 -0
- package/dist/commands/orgs/switch.d.ts.map +1 -0
- package/dist/commands/orgs/switch.js +61 -0
- package/dist/commands/projects/archive.d.ts +3 -0
- package/dist/commands/projects/archive.d.ts.map +1 -0
- package/dist/commands/projects/archive.js +51 -0
- package/dist/commands/projects/create.d.ts +3 -0
- package/dist/commands/projects/create.d.ts.map +1 -0
- package/dist/commands/projects/create.js +48 -0
- package/dist/commands/projects/index.d.ts +3 -0
- package/dist/commands/projects/index.d.ts.map +1 -0
- package/dist/commands/projects/index.js +25 -0
- package/dist/commands/projects/list.d.ts +3 -0
- package/dist/commands/projects/list.d.ts.map +1 -0
- package/dist/commands/projects/list.js +52 -0
- package/dist/commands/projects/restore.d.ts +3 -0
- package/dist/commands/projects/restore.d.ts.map +1 -0
- package/dist/commands/projects/restore.js +36 -0
- package/dist/commands/projects/switch.d.ts +3 -0
- package/dist/commands/projects/switch.d.ts.map +1 -0
- package/dist/commands/projects/switch.js +57 -0
- package/dist/commands/projects/update.d.ts +3 -0
- package/dist/commands/projects/update.d.ts.map +1 -0
- package/dist/commands/projects/update.js +67 -0
- package/dist/commands/whoami.d.ts +3 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +61 -0
- package/dist/config/config-manager.d.ts +3 -0
- package/dist/config/config-manager.d.ts.map +1 -0
- package/dist/config/config-manager.js +32 -0
- package/dist/config/config-store.d.ts +10 -0
- package/dist/config/config-store.d.ts.map +1 -0
- package/dist/config/config-store.js +37 -0
- package/dist/config/credential-store.d.ts +12 -0
- package/dist/config/credential-store.d.ts.map +1 -0
- package/dist/config/credential-store.js +94 -0
- package/dist/config/paths.d.ts +5 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +29 -0
- package/dist/config/project-config.d.ts +8 -0
- package/dist/config/project-config.d.ts.map +1 -0
- package/dist/config/project-config.js +41 -0
- package/dist/core/constants.d.ts +27 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/constants.js +60 -0
- package/dist/core/error-handler.d.ts +24 -0
- package/dist/core/error-handler.d.ts.map +1 -0
- package/dist/core/error-handler.js +83 -0
- package/dist/core/types.d.ts +21 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +0 -0
- package/dist/core/update-check.d.ts +6 -0
- package/dist/core/update-check.d.ts.map +1 -0
- package/dist/core/update-check.js +78 -0
- package/dist/diagnostics/checks/chain-dependencies.d.ts +2 -0
- package/dist/diagnostics/checks/chain-dependencies.d.ts.map +1 -0
- package/dist/diagnostics/checks/chain-dependencies.js +130 -0
- package/dist/diagnostics/checks/css-import.d.ts +2 -0
- package/dist/diagnostics/checks/css-import.d.ts.map +1 -0
- package/dist/diagnostics/checks/css-import.js +57 -0
- package/dist/diagnostics/checks/deprecated-packages.d.ts +2 -0
- package/dist/diagnostics/checks/deprecated-packages.d.ts.map +1 -0
- package/dist/diagnostics/checks/deprecated-packages.js +93 -0
- package/dist/diagnostics/checks/env-api-key.d.ts +2 -0
- package/dist/diagnostics/checks/env-api-key.d.ts.map +1 -0
- package/dist/diagnostics/checks/env-api-key.js +75 -0
- package/dist/diagnostics/checks/env-var-prefix.d.ts +2 -0
- package/dist/diagnostics/checks/env-var-prefix.d.ts.map +1 -0
- package/dist/diagnostics/checks/env-var-prefix.js +52 -0
- package/dist/diagnostics/checks/index.d.ts +13 -0
- package/dist/diagnostics/checks/index.d.ts.map +1 -0
- package/dist/diagnostics/checks/index.js +32 -0
- package/dist/diagnostics/checks/para-provider.d.ts +2 -0
- package/dist/diagnostics/checks/para-provider.d.ts.map +1 -0
- package/dist/diagnostics/checks/para-provider.js +42 -0
- package/dist/diagnostics/checks/query-client.d.ts +2 -0
- package/dist/diagnostics/checks/query-client.d.ts.map +1 -0
- package/dist/diagnostics/checks/query-client.js +58 -0
- package/dist/diagnostics/checks/use-client-directive.d.ts +2 -0
- package/dist/diagnostics/checks/use-client-directive.d.ts.map +1 -0
- package/dist/diagnostics/checks/use-client-directive.js +81 -0
- package/dist/diagnostics/checks/version-consistency.d.ts +2 -0
- package/dist/diagnostics/checks/version-consistency.d.ts.map +1 -0
- package/dist/diagnostics/checks/version-consistency.js +93 -0
- package/dist/diagnostics/context.d.ts +3 -0
- package/dist/diagnostics/context.d.ts.map +1 -0
- package/dist/diagnostics/context.js +56 -0
- package/dist/diagnostics/detectors/framework.d.ts +5 -0
- package/dist/diagnostics/detectors/framework.d.ts.map +1 -0
- package/dist/diagnostics/detectors/framework.js +73 -0
- package/dist/diagnostics/detectors/package-manager.d.ts +3 -0
- package/dist/diagnostics/detectors/package-manager.d.ts.map +1 -0
- package/dist/diagnostics/detectors/package-manager.js +17 -0
- package/dist/diagnostics/detectors/sdk.d.ts +7 -0
- package/dist/diagnostics/detectors/sdk.d.ts.map +1 -0
- package/dist/diagnostics/detectors/sdk.js +48 -0
- package/dist/diagnostics/runner.d.ts +3 -0
- package/dist/diagnostics/runner.d.ts.map +1 -0
- package/dist/diagnostics/runner.js +44 -0
- package/dist/diagnostics/types.d.ts +70 -0
- package/dist/diagnostics/types.d.ts.map +1 -0
- package/dist/diagnostics/types.js +14 -0
- package/dist/diagnostics/utils/code-search.d.ts +10 -0
- package/dist/diagnostics/utils/code-search.d.ts.map +1 -0
- package/dist/diagnostics/utils/code-search.js +98 -0
- package/dist/diagnostics/utils/file-system.d.ts +7 -0
- package/dist/diagnostics/utils/file-system.d.ts.map +1 -0
- package/dist/diagnostics/utils/file-system.js +72 -0
- package/dist/diagnostics/utils/package-json.d.ts +12 -0
- package/dist/diagnostics/utils/package-json.d.ts.map +1 -0
- package/dist/diagnostics/utils/package-json.js +51 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/output/formatter.d.ts +25 -0
- package/dist/output/formatter.d.ts.map +1 -0
- package/dist/output/formatter.js +76 -0
- package/dist/output/mask.d.ts +2 -0
- package/dist/output/mask.d.ts.map +1 -0
- package/dist/output/mask.js +15 -0
- package/dist/output/prompts.d.ts +25 -0
- package/dist/output/prompts.d.ts.map +1 -0
- package/dist/output/prompts.js +86 -0
- package/dist/output/spinner.d.ts +6 -0
- package/dist/output/spinner.d.ts.map +1 -0
- package/dist/output/spinner.js +7 -0
- package/dist/output/table.d.ts +9 -0
- package/dist/output/table.d.ts.map +1 -0
- package/dist/output/table.js +21 -0
- package/dist/scaffolding/scaffolder.d.ts +3 -0
- package/dist/scaffolding/scaffolder.d.ts.map +1 -0
- package/dist/scaffolding/scaffolder.js +78 -0
- package/dist/scaffolding/strategies/expo-template.d.ts +16 -0
- package/dist/scaffolding/strategies/expo-template.d.ts.map +1 -0
- package/dist/scaffolding/strategies/expo-template.js +160 -0
- package/dist/scaffolding/strategies/index.d.ts +5 -0
- package/dist/scaffolding/strategies/index.d.ts.map +1 -0
- package/dist/scaffolding/strategies/index.js +25 -0
- package/dist/scaffolding/strategies/nextjs-template.d.ts +12 -0
- package/dist/scaffolding/strategies/nextjs-template.d.ts.map +1 -0
- package/dist/scaffolding/strategies/nextjs-template.js +122 -0
- package/dist/scaffolding/template-renderer.d.ts +11 -0
- package/dist/scaffolding/template-renderer.d.ts.map +1 -0
- package/dist/scaffolding/template-renderer.js +99 -0
- package/dist/scaffolding/types.d.ts +69 -0
- package/dist/scaffolding/types.d.ts.map +1 -0
- package/dist/scaffolding/types.js +21 -0
- package/dist/scaffolding/utils/detect-package-manager.d.ts +23 -0
- package/dist/scaffolding/utils/detect-package-manager.d.ts.map +1 -0
- package/dist/scaffolding/utils/detect-package-manager.js +57 -0
- package/dist/scaffolding/utils/fs.d.ts +11 -0
- package/dist/scaffolding/utils/fs.d.ts.map +1 -0
- package/dist/scaffolding/utils/fs.js +45 -0
- package/dist/scaffolding/utils/resolve-para-version.d.ts +7 -0
- package/dist/scaffolding/utils/resolve-para-version.d.ts.map +1 -0
- package/dist/scaffolding/utils/resolve-para-version.js +21 -0
- package/dist/validation/auth-methods.d.ts +14 -0
- package/dist/validation/auth-methods.d.ts.map +1 -0
- package/dist/validation/auth-methods.js +23 -0
- package/dist/validation/cidr.d.ts +11 -0
- package/dist/validation/cidr.d.ts.map +1 -0
- package/dist/validation/cidr.js +35 -0
- package/dist/validation/hex-color.d.ts +7 -0
- package/dist/validation/hex-color.d.ts.map +1 -0
- package/dist/validation/hex-color.js +10 -0
- package/dist/validation/index.d.ts +9 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +49 -0
- package/dist/validation/native-passkey.d.ts +31 -0
- package/dist/validation/native-passkey.d.ts.map +1 -0
- package/dist/validation/native-passkey.js +45 -0
- package/dist/validation/session-length.d.ts +18 -0
- package/dist/validation/session-length.d.ts.map +1 -0
- package/dist/validation/session-length.js +30 -0
- package/dist/validation/url.d.ts +26 -0
- package/dist/validation/url.d.ts.map +1 -0
- package/dist/validation/url.js +50 -0
- package/dist/validation/wallet-types.d.ts +14 -0
- package/dist/validation/wallet-types.d.ts.map +1 -0
- package/dist/validation/wallet-types.js +22 -0
- package/dist/validation/webhook.d.ts +4 -0
- package/dist/validation/webhook.d.ts.map +1 -0
- package/dist/validation/webhook.js +33 -0
- package/package.json +60 -0
- package/templates/expo/_env.example +3 -0
- package/templates/expo/_gitignore +48 -0
- package/templates/expo/_yarnrc.yml +1 -0
- package/templates/expo/app/(auth)/_layout.tsx +12 -0
- package/templates/expo/app/(auth)/index.tsx.template +86 -0
- package/templates/expo/app/(tabs)/_layout.tsx +16 -0
- package/templates/expo/app/(tabs)/index.tsx +112 -0
- package/templates/expo/app/(tabs)/send.tsx +111 -0
- package/templates/expo/app/_layout.tsx +17 -0
- package/templates/expo/app/index.tsx +22 -0
- package/templates/expo/app.json.template +32 -0
- package/templates/expo/assets/adaptive-icon.png +0 -0
- package/templates/expo/assets/favicon.png +0 -0
- package/templates/expo/assets/icon.png +0 -0
- package/templates/expo/assets/splash.png +0 -0
- package/templates/expo/babel.config.cjs +12 -0
- package/templates/expo/components/features/AuthForm.tsx.template +138 -0
- package/templates/expo/components/features/OAuthButtons.tsx.template +27 -0
- package/templates/expo/components/features/index.ts.template +4 -0
- package/templates/expo/components/ui/Button.tsx +58 -0
- package/templates/expo/components/ui/Card.tsx +11 -0
- package/templates/expo/components/ui/Divider.tsx +19 -0
- package/templates/expo/components/ui/Input.tsx +23 -0
- package/templates/expo/components/ui/WalletCard.tsx +44 -0
- package/templates/expo/components/ui/index.ts +5 -0
- package/templates/expo/eslint.config.cjs +15 -0
- package/templates/expo/global.css +3 -0
- package/templates/expo/hooks/useOneClickLogin.ts.template +161 -0
- package/templates/expo/hooks/useViemClient.ts +118 -0
- package/templates/expo/hooks/useWallets.ts +52 -0
- package/templates/expo/index.js +2 -0
- package/templates/expo/lib/auth.ts +54 -0
- package/templates/expo/lib/constants.ts.template +2 -0
- package/templates/expo/lib/para.ts +14 -0
- package/templates/expo/metro.config.cjs +14 -0
- package/templates/expo/nativewind-env.d.ts +2 -0
- package/templates/expo/prettier.config.cjs +10 -0
- package/templates/expo/providers/ParaProvider.tsx +140 -0
- package/templates/expo/tailwind.config.cjs +23 -0
- package/templates/expo/tsconfig.json +11 -0
- package/templates/expo/types/index.ts +28 -0
- package/templates/nextjs/README.md +69 -0
- package/templates/nextjs/_env.example +8 -0
- package/templates/nextjs/_gitignore +36 -0
- package/templates/nextjs/_yarnrc.yml +1 -0
- package/templates/nextjs/eslint.config.mjs +10 -0
- package/templates/nextjs/next.config.ts +5 -0
- package/templates/nextjs/postcss.config.mjs +7 -0
- package/templates/nextjs/public/para.svg +3 -0
- package/templates/nextjs/src/app/layout.tsx +30 -0
- package/templates/nextjs/src/app/page.tsx +40 -0
- package/templates/nextjs/src/components/ParaProvider.tsx +116 -0
- package/templates/nextjs/src/components/layout/Header.tsx +44 -0
- package/templates/nextjs/src/components/ui/ConnectCard.tsx +24 -0
- package/templates/nextjs/src/components/ui/SignMessage.tsx +53 -0
- package/templates/nextjs/src/components/ui/WalletInfo.tsx +22 -0
- package/templates/nextjs/src/hooks/useSignHelloWorld.ts +23 -0
- package/templates/nextjs/src/styles/globals.css +1 -0
- package/templates/nextjs/tsconfig.json +27 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { registerOrgsListCommand } from "./list.js";
|
|
2
|
+
import { registerOrgsSwitchCommand } from "./switch.js";
|
|
3
|
+
function registerOrgsCommands(program) {
|
|
4
|
+
const orgs = program.command("orgs").description("Organization management").addHelpText(
|
|
5
|
+
"after",
|
|
6
|
+
`
|
|
7
|
+
Select an org before managing projects or keys:
|
|
8
|
+
$ para orgs switch`
|
|
9
|
+
);
|
|
10
|
+
registerOrgsListCommand(orgs);
|
|
11
|
+
registerOrgsSwitchCommand(orgs);
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
registerOrgsCommands
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/orgs/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAoD7D"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { getGlobalOptions, createFormatter, helpText } from "../../cli.js";
|
|
2
|
+
import { ensureAuthenticated } from "../../auth/session-manager.js";
|
|
3
|
+
import { resolveConfig } from "../../config/config-manager.js";
|
|
4
|
+
import { ParaApiClient } from "../../api/client.js";
|
|
5
|
+
import { CliError } from "../../core/error-handler.js";
|
|
6
|
+
function registerOrgsListCommand(parent) {
|
|
7
|
+
parent.command("list").description("List your organizations").addHelpText(
|
|
8
|
+
"after",
|
|
9
|
+
helpText(`Examples:
|
|
10
|
+
$ para orgs list Show your orgs with plan tier and active indicator
|
|
11
|
+
$ para orgs list --json Output as JSON for scripting`)
|
|
12
|
+
).action(async (_, cmd) => {
|
|
13
|
+
const opts = await getGlobalOptions(cmd);
|
|
14
|
+
const formatter = createFormatter(opts);
|
|
15
|
+
const config = await resolveConfig(opts);
|
|
16
|
+
const session = await ensureAuthenticated(config.environment);
|
|
17
|
+
const client = new ParaApiClient({
|
|
18
|
+
environment: config.environment,
|
|
19
|
+
sessionId: session.sessionId
|
|
20
|
+
});
|
|
21
|
+
let userId = session.userId;
|
|
22
|
+
if (!userId) {
|
|
23
|
+
const status = await client.getAuthStatus();
|
|
24
|
+
if (!status.userId) {
|
|
25
|
+
throw new CliError("Could not determine user ID. Run `para login` with browser authentication.");
|
|
26
|
+
}
|
|
27
|
+
userId = status.userId;
|
|
28
|
+
}
|
|
29
|
+
const orgs = await client.getOrganizations(userId);
|
|
30
|
+
if (opts.json) {
|
|
31
|
+
formatter.json(orgs);
|
|
32
|
+
} else {
|
|
33
|
+
formatter.table(
|
|
34
|
+
[
|
|
35
|
+
{ key: "name", header: "Name" },
|
|
36
|
+
{ key: "id", header: "ID" },
|
|
37
|
+
{ key: "plan", header: "Plan" },
|
|
38
|
+
{ key: "active", header: "" }
|
|
39
|
+
],
|
|
40
|
+
orgs.map((org) => ({
|
|
41
|
+
name: org.name,
|
|
42
|
+
id: org.id,
|
|
43
|
+
plan: org.activePlanSlug || "free",
|
|
44
|
+
active: org.id === config.organizationId ? "(active)" : ""
|
|
45
|
+
}))
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
formatter.flush();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
registerOrgsListCommand
|
|
53
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/commands/orgs/switch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASzC,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CA6D/D"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { getGlobalOptions, createFormatter, helpText } from "../../cli.js";
|
|
2
|
+
import { ensureAuthenticated } from "../../auth/session-manager.js";
|
|
3
|
+
import { resolveConfig } from "../../config/config-manager.js";
|
|
4
|
+
import { ParaApiClient } from "../../api/client.js";
|
|
5
|
+
import { CliError } from "../../core/error-handler.js";
|
|
6
|
+
import { updateGlobalConfig } from "../../config/config-store.js";
|
|
7
|
+
import { select } from "../../output/prompts.js";
|
|
8
|
+
function registerOrgsSwitchCommand(parent) {
|
|
9
|
+
parent.command("switch").description("Set the active organization").argument("[org-id]", "Organization ID to switch to").addHelpText(
|
|
10
|
+
"after",
|
|
11
|
+
helpText(`Examples:
|
|
12
|
+
$ para orgs switch Choose from a list of your organizations
|
|
13
|
+
$ para orgs switch abc-123 Switch directly by ID (skip the picker)
|
|
14
|
+
|
|
15
|
+
Required before using projects or keys commands.`)
|
|
16
|
+
).action(async (orgId, _, cmd) => {
|
|
17
|
+
const opts = await getGlobalOptions(cmd);
|
|
18
|
+
const formatter = createFormatter(opts);
|
|
19
|
+
const config = await resolveConfig(opts);
|
|
20
|
+
const session = await ensureAuthenticated(config.environment);
|
|
21
|
+
const client = new ParaApiClient({
|
|
22
|
+
environment: config.environment,
|
|
23
|
+
sessionId: session.sessionId
|
|
24
|
+
});
|
|
25
|
+
let userId = session.userId;
|
|
26
|
+
if (!userId) {
|
|
27
|
+
const status = await client.getAuthStatus();
|
|
28
|
+
if (!status.userId) {
|
|
29
|
+
throw new CliError("Could not determine user ID. Run `para login` with browser authentication.");
|
|
30
|
+
}
|
|
31
|
+
userId = status.userId;
|
|
32
|
+
}
|
|
33
|
+
let selectedOrgId = orgId;
|
|
34
|
+
let selectedOrgName;
|
|
35
|
+
if (!selectedOrgId) {
|
|
36
|
+
const orgs = await client.getOrganizations(userId);
|
|
37
|
+
if (orgs.length === 0) {
|
|
38
|
+
formatter.warn("No organizations found.");
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
selectedOrgId = await select(
|
|
42
|
+
"Select organization:",
|
|
43
|
+
orgs.map((org) => ({
|
|
44
|
+
value: org.id,
|
|
45
|
+
label: org.name,
|
|
46
|
+
hint: org.id === config.organizationId ? "(current)" : void 0
|
|
47
|
+
}))
|
|
48
|
+
);
|
|
49
|
+
selectedOrgName = orgs.find((o) => o.id === selectedOrgId)?.name;
|
|
50
|
+
}
|
|
51
|
+
await updateGlobalConfig({ defaultOrganizationId: selectedOrgId });
|
|
52
|
+
formatter.json({ organizationId: selectedOrgId, name: selectedOrgName });
|
|
53
|
+
formatter.success(
|
|
54
|
+
`Switched to organization ${selectedOrgName ? `${selectedOrgName} (${selectedOrgId})` : selectedOrgId}`
|
|
55
|
+
);
|
|
56
|
+
formatter.flush();
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
registerOrgsSwitchCommand
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive.d.ts","sourceRoot":"","sources":["../../../src/commands/projects/archive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAqDpE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { getGlobalOptions, createFormatter, helpText } from "../../cli.js";
|
|
2
|
+
import { ensureAuthenticated } from "../../auth/session-manager.js";
|
|
3
|
+
import { resolveConfig } from "../../config/config-manager.js";
|
|
4
|
+
import { ParaApiClient } from "../../api/client.js";
|
|
5
|
+
import { CliError } from "../../core/error-handler.js";
|
|
6
|
+
import { confirm } from "../../output/prompts.js";
|
|
7
|
+
function registerProjectsArchiveCommand(parent) {
|
|
8
|
+
parent.command("archive").description("Archive a project").argument("[project-id]", "Project ID (uses active project if not given)").option("-y, --yes", "Skip confirmation prompt").addHelpText(
|
|
9
|
+
"after",
|
|
10
|
+
helpText(`Examples:
|
|
11
|
+
$ para projects archive Archive the active project (asks for confirmation)
|
|
12
|
+
$ para projects archive abc-123 Archive a specific project
|
|
13
|
+
$ para projects archive abc-123 -y Skip confirmation (for scripts)
|
|
14
|
+
|
|
15
|
+
Archived projects can be restored with "para projects restore".`)
|
|
16
|
+
).action(async (projectIdArg, cmdOpts, cmd) => {
|
|
17
|
+
const opts = await getGlobalOptions(cmd);
|
|
18
|
+
const formatter = createFormatter(opts);
|
|
19
|
+
const config = await resolveConfig(opts);
|
|
20
|
+
const session = await ensureAuthenticated(config.environment);
|
|
21
|
+
if (!config.organizationId) {
|
|
22
|
+
throw new CliError("No organization selected. Run `para orgs switch` or pass --org <id>.");
|
|
23
|
+
}
|
|
24
|
+
const projectId = projectIdArg || config.projectId;
|
|
25
|
+
if (!projectId) {
|
|
26
|
+
throw new CliError("No project selected. Run `para projects switch` or pass --project <id>.");
|
|
27
|
+
}
|
|
28
|
+
if (!cmdOpts.yes) {
|
|
29
|
+
const confirmed = await confirm("Are you sure you want to archive this project? Its API keys will stop working.");
|
|
30
|
+
if (!confirmed) {
|
|
31
|
+
formatter.info("Archive cancelled.");
|
|
32
|
+
formatter.flush();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const client = new ParaApiClient({
|
|
37
|
+
environment: config.environment,
|
|
38
|
+
sessionId: session.sessionId
|
|
39
|
+
});
|
|
40
|
+
await client.deleteProject(config.organizationId, projectId);
|
|
41
|
+
if (opts.json) {
|
|
42
|
+
formatter.json({ projectId, archived: true });
|
|
43
|
+
} else {
|
|
44
|
+
formatter.success(`Archived project ${projectId}`);
|
|
45
|
+
}
|
|
46
|
+
formatter.flush();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
registerProjectsArchiveCommand
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/projects/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAoDnE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { getGlobalOptions, createFormatter, helpText } from "../../cli.js";
|
|
2
|
+
import { ensureAuthenticated } from "../../auth/session-manager.js";
|
|
3
|
+
import { resolveConfig } from "../../config/config-manager.js";
|
|
4
|
+
import { ParaApiClient } from "../../api/client.js";
|
|
5
|
+
import { CliError } from "../../core/error-handler.js";
|
|
6
|
+
import { text } from "../../output/prompts.js";
|
|
7
|
+
function registerProjectsCreateCommand(parent) {
|
|
8
|
+
parent.command("create").description("Create a new project").option("-n, --name <name>", "Project name").option("-d, --description <desc>", "Project description").option("--framework <framework>", "Framework (nextjs, vite, react-native, etc.)").addHelpText(
|
|
9
|
+
"after",
|
|
10
|
+
helpText(`Examples:
|
|
11
|
+
$ para projects create Walks you through name, description, framework
|
|
12
|
+
$ para projects create -n "My App" Skip the name prompt
|
|
13
|
+
$ para projects create -n "My App" --framework nextjs Fully non-interactive
|
|
14
|
+
|
|
15
|
+
Requires an active organization. Run "para orgs switch" first.`)
|
|
16
|
+
).action(async (cmdOpts, cmd) => {
|
|
17
|
+
const opts = await getGlobalOptions(cmd);
|
|
18
|
+
const formatter = createFormatter(opts);
|
|
19
|
+
const config = await resolveConfig(opts);
|
|
20
|
+
const session = await ensureAuthenticated(config.environment);
|
|
21
|
+
if (!config.organizationId) {
|
|
22
|
+
throw new CliError("No organization selected. Run `para orgs switch` or pass --org <id>.");
|
|
23
|
+
}
|
|
24
|
+
const name = cmdOpts.name || await text("Project name:", {
|
|
25
|
+
validate: (v) => {
|
|
26
|
+
if (!v.trim()) return "Name is required.";
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const client = new ParaApiClient({
|
|
30
|
+
environment: config.environment,
|
|
31
|
+
sessionId: session.sessionId
|
|
32
|
+
});
|
|
33
|
+
const project = await client.createProject(config.organizationId, {
|
|
34
|
+
name,
|
|
35
|
+
description: cmdOpts.description,
|
|
36
|
+
framework: cmdOpts.framework
|
|
37
|
+
});
|
|
38
|
+
if (opts.json) {
|
|
39
|
+
formatter.json(project);
|
|
40
|
+
} else {
|
|
41
|
+
formatter.success(`Created project "${project.name}" (${project.id})`);
|
|
42
|
+
}
|
|
43
|
+
formatter.flush();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
registerProjectsCreateCommand
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/projects/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmB/D"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { registerProjectsListCommand } from "./list.js";
|
|
2
|
+
import { registerProjectsCreateCommand } from "./create.js";
|
|
3
|
+
import { registerProjectsSwitchCommand } from "./switch.js";
|
|
4
|
+
import { registerProjectsUpdateCommand } from "./update.js";
|
|
5
|
+
import { registerProjectsArchiveCommand } from "./archive.js";
|
|
6
|
+
import { registerProjectsRestoreCommand } from "./restore.js";
|
|
7
|
+
function registerProjectsCommands(program) {
|
|
8
|
+
const projects = program.command("projects").description("Project management").addHelpText(
|
|
9
|
+
"after",
|
|
10
|
+
`
|
|
11
|
+
Select a project before managing API keys:
|
|
12
|
+
$ para projects switch
|
|
13
|
+
|
|
14
|
+
Requires an active organization. Run "para orgs switch" first.`
|
|
15
|
+
);
|
|
16
|
+
registerProjectsListCommand(projects);
|
|
17
|
+
registerProjectsCreateCommand(projects);
|
|
18
|
+
registerProjectsSwitchCommand(projects);
|
|
19
|
+
registerProjectsUpdateCommand(projects);
|
|
20
|
+
registerProjectsArchiveCommand(projects);
|
|
21
|
+
registerProjectsRestoreCommand(projects);
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
registerProjectsCommands
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/projects/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAoDjE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { getGlobalOptions, createFormatter, helpText } from "../../cli.js";
|
|
2
|
+
import { ensureAuthenticated } from "../../auth/session-manager.js";
|
|
3
|
+
import { resolveConfig } from "../../config/config-manager.js";
|
|
4
|
+
import { ParaApiClient } from "../../api/client.js";
|
|
5
|
+
import { CliError } from "../../core/error-handler.js";
|
|
6
|
+
function registerProjectsListCommand(parent) {
|
|
7
|
+
parent.command("list").description("List projects in your organization").option("--include-archived", "Include archived projects").addHelpText(
|
|
8
|
+
"after",
|
|
9
|
+
helpText(`Examples:
|
|
10
|
+
$ para projects list Show projects in your active org (name, ID, framework)
|
|
11
|
+
$ para projects list --include-archived Also show archived projects
|
|
12
|
+
$ para projects list --json Output as JSON for scripting
|
|
13
|
+
|
|
14
|
+
Requires an active organization. Run "para orgs switch" first.`)
|
|
15
|
+
).action(async (cmdOpts, cmd) => {
|
|
16
|
+
const opts = await getGlobalOptions(cmd);
|
|
17
|
+
const formatter = createFormatter(opts);
|
|
18
|
+
const config = await resolveConfig(opts);
|
|
19
|
+
const session = await ensureAuthenticated(config.environment);
|
|
20
|
+
if (!config.organizationId) {
|
|
21
|
+
throw new CliError("No organization selected. Run `para orgs switch` or pass --org <id>.");
|
|
22
|
+
}
|
|
23
|
+
const client = new ParaApiClient({
|
|
24
|
+
environment: config.environment,
|
|
25
|
+
sessionId: session.sessionId
|
|
26
|
+
});
|
|
27
|
+
const projects = await client.getProjects(config.organizationId);
|
|
28
|
+
const filtered = cmdOpts.includeArchived ? projects : projects.filter((p) => !p.archived);
|
|
29
|
+
if (opts.json) {
|
|
30
|
+
formatter.json(filtered);
|
|
31
|
+
} else {
|
|
32
|
+
formatter.table(
|
|
33
|
+
[
|
|
34
|
+
{ key: "name", header: "Name" },
|
|
35
|
+
{ key: "id", header: "ID" },
|
|
36
|
+
{ key: "framework", header: "Framework" },
|
|
37
|
+
{ key: "active", header: "" }
|
|
38
|
+
],
|
|
39
|
+
filtered.map((p) => ({
|
|
40
|
+
name: p.name,
|
|
41
|
+
id: p.id,
|
|
42
|
+
framework: p.framework || "-",
|
|
43
|
+
active: p.id === config.projectId ? "(active)" : ""
|
|
44
|
+
}))
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
formatter.flush();
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
registerProjectsListCommand
|
|
52
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restore.d.ts","sourceRoot":"","sources":["../../../src/commands/projects/restore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAoCpE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { getGlobalOptions, createFormatter, helpText } from "../../cli.js";
|
|
2
|
+
import { ensureAuthenticated } from "../../auth/session-manager.js";
|
|
3
|
+
import { resolveConfig } from "../../config/config-manager.js";
|
|
4
|
+
import { ParaApiClient } from "../../api/client.js";
|
|
5
|
+
import { CliError } from "../../core/error-handler.js";
|
|
6
|
+
function registerProjectsRestoreCommand(parent) {
|
|
7
|
+
parent.command("restore").description("Restore an archived project").argument("<project-id>", "Project ID to restore").addHelpText(
|
|
8
|
+
"after",
|
|
9
|
+
helpText(`Examples:
|
|
10
|
+
$ para projects restore abc-123 Restore an archived project
|
|
11
|
+
|
|
12
|
+
Use "para projects list --include-archived" to find archived project IDs.`)
|
|
13
|
+
).action(async (projectId, _cmdOpts, cmd) => {
|
|
14
|
+
const opts = await getGlobalOptions(cmd);
|
|
15
|
+
const formatter = createFormatter(opts);
|
|
16
|
+
const config = await resolveConfig(opts);
|
|
17
|
+
const session = await ensureAuthenticated(config.environment);
|
|
18
|
+
if (!config.organizationId) {
|
|
19
|
+
throw new CliError("No organization selected. Run `para orgs switch` or pass --org <id>.");
|
|
20
|
+
}
|
|
21
|
+
const client = new ParaApiClient({
|
|
22
|
+
environment: config.environment,
|
|
23
|
+
sessionId: session.sessionId
|
|
24
|
+
});
|
|
25
|
+
await client.restoreProject(config.organizationId, projectId);
|
|
26
|
+
if (opts.json) {
|
|
27
|
+
formatter.json({ projectId, restored: true });
|
|
28
|
+
} else {
|
|
29
|
+
formatter.success(`Restored project ${projectId}`);
|
|
30
|
+
}
|
|
31
|
+
formatter.flush();
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
registerProjectsRestoreCommand
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/commands/projects/switch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASzC,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CA0DnE"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { getGlobalOptions, createFormatter, helpText } from "../../cli.js";
|
|
2
|
+
import { ensureAuthenticated } from "../../auth/session-manager.js";
|
|
3
|
+
import { resolveConfig } from "../../config/config-manager.js";
|
|
4
|
+
import { ParaApiClient } from "../../api/client.js";
|
|
5
|
+
import { updateGlobalConfig } from "../../config/config-store.js";
|
|
6
|
+
import { CliError } from "../../core/error-handler.js";
|
|
7
|
+
import { select } from "../../output/prompts.js";
|
|
8
|
+
function registerProjectsSwitchCommand(parent) {
|
|
9
|
+
parent.command("switch").description("Set the active project").argument("[project-id]", "Project ID to switch to").addHelpText(
|
|
10
|
+
"after",
|
|
11
|
+
helpText(`Examples:
|
|
12
|
+
$ para projects switch Choose from a list of projects in your org
|
|
13
|
+
$ para projects switch abc-123 Switch directly by ID (skip the picker)
|
|
14
|
+
|
|
15
|
+
Required before using keys commands.`)
|
|
16
|
+
).action(async (projectId, _, cmd) => {
|
|
17
|
+
const opts = await getGlobalOptions(cmd);
|
|
18
|
+
const formatter = createFormatter(opts);
|
|
19
|
+
const config = await resolveConfig(opts);
|
|
20
|
+
const session = await ensureAuthenticated(config.environment);
|
|
21
|
+
if (!config.organizationId) {
|
|
22
|
+
throw new CliError("No organization selected. Run `para orgs switch` or pass --org <id>.");
|
|
23
|
+
}
|
|
24
|
+
let selectedProjectId = projectId;
|
|
25
|
+
let selectedProjectName;
|
|
26
|
+
if (!selectedProjectId) {
|
|
27
|
+
const client = new ParaApiClient({
|
|
28
|
+
environment: config.environment,
|
|
29
|
+
sessionId: session.sessionId
|
|
30
|
+
});
|
|
31
|
+
const projects = await client.getProjects(config.organizationId);
|
|
32
|
+
const active = projects.filter((p) => !p.archived);
|
|
33
|
+
if (active.length === 0) {
|
|
34
|
+
formatter.warn("No projects found. Run `para projects create` first.");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
selectedProjectId = await select(
|
|
38
|
+
"Select project:",
|
|
39
|
+
active.map((p) => ({
|
|
40
|
+
value: p.id,
|
|
41
|
+
label: p.name,
|
|
42
|
+
hint: p.id === config.projectId ? "(current)" : void 0
|
|
43
|
+
}))
|
|
44
|
+
);
|
|
45
|
+
selectedProjectName = active.find((p) => p.id === selectedProjectId)?.name;
|
|
46
|
+
}
|
|
47
|
+
await updateGlobalConfig({ defaultProjectId: selectedProjectId });
|
|
48
|
+
formatter.json({ projectId: selectedProjectId, name: selectedProjectName });
|
|
49
|
+
formatter.success(
|
|
50
|
+
`Switched to project ${selectedProjectName ? `${selectedProjectName} (${selectedProjectId})` : selectedProjectId}`
|
|
51
|
+
);
|
|
52
|
+
formatter.flush();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
registerProjectsSwitchCommand
|
|
57
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/projects/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAgFnE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { getGlobalOptions, createFormatter, helpText } from "../../cli.js";
|
|
2
|
+
import { ensureAuthenticated } from "../../auth/session-manager.js";
|
|
3
|
+
import { resolveConfig } from "../../config/config-manager.js";
|
|
4
|
+
import { ParaApiClient } from "../../api/client.js";
|
|
5
|
+
import { CliError } from "../../core/error-handler.js";
|
|
6
|
+
import { text } from "../../output/prompts.js";
|
|
7
|
+
function registerProjectsUpdateCommand(parent) {
|
|
8
|
+
parent.command("update").description("Update a project").argument("[project-id]", "Project ID (uses active project if not given)").option("-n, --name <name>", "New project name").option("-d, --description <desc>", "New description").option("--framework <framework>", "Framework (REACT, NEXT, VITE, etc.)").option("--package-manager <pm>", "Package manager (NPM, YARN, PNPM)").addHelpText(
|
|
9
|
+
"after",
|
|
10
|
+
helpText(`Examples:
|
|
11
|
+
$ para projects update -n "New Name" Rename the active project
|
|
12
|
+
$ para projects update abc-123 -n "Renamed" Rename a specific project
|
|
13
|
+
$ para projects update --framework NEXT Update framework setting
|
|
14
|
+
$ para projects update -n "App" --framework NEXT Update multiple fields at once
|
|
15
|
+
|
|
16
|
+
Requires an active organization. Pass --project or use "para projects switch" first.`)
|
|
17
|
+
).action(
|
|
18
|
+
async (projectIdArg, cmdOpts, cmd) => {
|
|
19
|
+
const opts = await getGlobalOptions(cmd);
|
|
20
|
+
const formatter = createFormatter(opts);
|
|
21
|
+
const config = await resolveConfig(opts);
|
|
22
|
+
const session = await ensureAuthenticated(config.environment);
|
|
23
|
+
if (!config.organizationId) {
|
|
24
|
+
throw new CliError("No organization selected. Run `para orgs switch` or pass --org <id>.");
|
|
25
|
+
}
|
|
26
|
+
const projectId = projectIdArg || config.projectId;
|
|
27
|
+
if (!projectId) {
|
|
28
|
+
throw new CliError("No project selected. Run `para projects switch` or pass --project <id>.");
|
|
29
|
+
}
|
|
30
|
+
const data = {};
|
|
31
|
+
if (cmdOpts.name !== void 0) data.name = cmdOpts.name;
|
|
32
|
+
if (cmdOpts.description !== void 0) data.description = cmdOpts.description;
|
|
33
|
+
if (cmdOpts.framework !== void 0) data.framework = cmdOpts.framework;
|
|
34
|
+
if (cmdOpts.packageManager !== void 0) data.packageManager = cmdOpts.packageManager;
|
|
35
|
+
if (Object.keys(data).length === 0) {
|
|
36
|
+
const name = await text("Project name:", {
|
|
37
|
+
placeholder: "Leave empty to keep current"
|
|
38
|
+
});
|
|
39
|
+
if (name.trim()) data.name = name.trim();
|
|
40
|
+
const description = await text("Description:", {
|
|
41
|
+
placeholder: "Leave empty to keep current"
|
|
42
|
+
});
|
|
43
|
+
if (description.trim()) data.description = description.trim();
|
|
44
|
+
}
|
|
45
|
+
if (Object.keys(data).length === 0) {
|
|
46
|
+
formatter.info("No changes specified.");
|
|
47
|
+
formatter.flush();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const client = new ParaApiClient({
|
|
51
|
+
environment: config.environment,
|
|
52
|
+
sessionId: session.sessionId
|
|
53
|
+
});
|
|
54
|
+
await client.updateProject(config.organizationId, projectId, data);
|
|
55
|
+
if (opts.json) {
|
|
56
|
+
formatter.json({ projectId, updated: data });
|
|
57
|
+
} else {
|
|
58
|
+
const fields = Object.keys(data).join(", ");
|
|
59
|
+
formatter.success(`Updated project (${fields})`);
|
|
60
|
+
}
|
|
61
|
+
formatter.flush();
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
registerProjectsUpdateCommand
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../src/commands/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgE5D"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { getGlobalOptions, createFormatter, helpText } from "../cli.js";
|
|
2
|
+
import { ensureAuthenticated } from "../auth/session-manager.js";
|
|
3
|
+
import { resolveConfig } from "../config/config-manager.js";
|
|
4
|
+
import { ParaApiClient } from "../api/client.js";
|
|
5
|
+
function registerWhoamiCommand(program) {
|
|
6
|
+
program.command("whoami").description("Show current authenticated user and context").addHelpText(
|
|
7
|
+
"after",
|
|
8
|
+
helpText(`Examples:
|
|
9
|
+
$ para whoami Show your email, active org, project, and environment
|
|
10
|
+
$ para whoami --json Machine-readable output (useful in CI scripts)
|
|
11
|
+
$ para whoami -e PROD Check who you are on production`)
|
|
12
|
+
).action(async (_, cmd) => {
|
|
13
|
+
const opts = await getGlobalOptions(cmd);
|
|
14
|
+
const formatter = createFormatter(opts);
|
|
15
|
+
const config = await resolveConfig(opts);
|
|
16
|
+
const session = await ensureAuthenticated(config.environment);
|
|
17
|
+
const client = new ParaApiClient({
|
|
18
|
+
environment: config.environment,
|
|
19
|
+
sessionId: session.sessionId
|
|
20
|
+
});
|
|
21
|
+
const status = await client.getAuthStatus();
|
|
22
|
+
if (opts.json) {
|
|
23
|
+
formatter.json({
|
|
24
|
+
email: status.email,
|
|
25
|
+
userId: status.userId,
|
|
26
|
+
environment: config.environment,
|
|
27
|
+
organizationId: config.organizationId,
|
|
28
|
+
projectId: config.projectId,
|
|
29
|
+
organizations: status.organizations,
|
|
30
|
+
sessionExpiresAt: status.sessionExpiresAt
|
|
31
|
+
});
|
|
32
|
+
} else {
|
|
33
|
+
const entries = [
|
|
34
|
+
{ label: "Email", value: status.email || "N/A" },
|
|
35
|
+
{ label: "User ID", value: status.userId || "N/A" },
|
|
36
|
+
{ label: "Environment", value: config.environment }
|
|
37
|
+
];
|
|
38
|
+
if (config.organizationId) {
|
|
39
|
+
const org = status.organizations?.find((o) => o.id === config.organizationId);
|
|
40
|
+
entries.push({
|
|
41
|
+
label: "Organization",
|
|
42
|
+
value: org ? `${org.name} (${org.role})` : config.organizationId
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (config.projectId) {
|
|
46
|
+
entries.push({ label: "Project", value: config.projectId });
|
|
47
|
+
}
|
|
48
|
+
if (status.sessionExpiresAt) {
|
|
49
|
+
entries.push({
|
|
50
|
+
label: "Session Expires",
|
|
51
|
+
value: new Date(status.sessionExpiresAt).toLocaleString()
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
formatter.detail(entries);
|
|
55
|
+
}
|
|
56
|
+
formatter.flush();
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
registerWhoamiCommand
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-manager.d.ts","sourceRoot":"","sources":["../../src/config/config-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAItE,wBAAsB,aAAa,CAAC,IAAI,EAAE,aAAa,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAUtG"}
|