@picked/cli 0.0.1-dev.1794460939512 → 0.0.1-dev.1794524488993

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.
Files changed (64) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/cjs/auth/oauth.d.ts +26 -0
  3. package/dist/cjs/auth/oauth.d.ts.map +1 -0
  4. package/dist/cjs/auth/pkce.d.ts +26 -0
  5. package/dist/cjs/auth/pkce.d.ts.map +1 -0
  6. package/dist/cjs/auth/session.d.ts +12 -0
  7. package/dist/cjs/auth/session.d.ts.map +1 -0
  8. package/dist/cjs/auth/token-store.d.ts +63 -0
  9. package/dist/cjs/auth/token-store.d.ts.map +1 -0
  10. package/dist/cjs/cli.d.ts +2 -0
  11. package/dist/cjs/cli.d.ts.map +1 -0
  12. package/dist/cjs/commands/app-deploy.d.ts +22 -0
  13. package/dist/cjs/commands/app-deploy.d.ts.map +1 -0
  14. package/dist/cjs/commands/app-keys.d.ts +19 -0
  15. package/dist/cjs/commands/app-keys.d.ts.map +1 -0
  16. package/dist/cjs/commands/docs.d.ts +65 -0
  17. package/dist/cjs/commands/docs.d.ts.map +1 -0
  18. package/dist/cjs/commands/generate-types.d.ts +15 -0
  19. package/dist/cjs/commands/generate-types.d.ts.map +1 -0
  20. package/dist/cjs/commands/login.d.ts +15 -0
  21. package/dist/cjs/commands/login.d.ts.map +1 -0
  22. package/dist/cjs/commands/logout.d.ts +14 -0
  23. package/dist/cjs/commands/logout.d.ts.map +1 -0
  24. package/dist/cjs/commands/pull.d.ts +19 -0
  25. package/dist/cjs/commands/pull.d.ts.map +1 -0
  26. package/dist/cjs/commands/status.d.ts +15 -0
  27. package/dist/cjs/commands/status.d.ts.map +1 -0
  28. package/dist/cjs/commands/whoami.d.ts +14 -0
  29. package/dist/cjs/commands/whoami.d.ts.map +1 -0
  30. package/dist/cjs/commands/workspace-export.d.ts +28 -0
  31. package/dist/cjs/commands/workspace-export.d.ts.map +1 -0
  32. package/dist/cjs/commands/workspace-import.d.ts +26 -0
  33. package/dist/cjs/commands/workspace-import.d.ts.map +1 -0
  34. package/dist/cjs/commands/workspace-list.d.ts +16 -0
  35. package/dist/cjs/commands/workspace-list.d.ts.map +1 -0
  36. package/dist/cjs/commands/workspace-use.d.ts +20 -0
  37. package/dist/cjs/commands/workspace-use.d.ts.map +1 -0
  38. package/dist/cjs/index.d.ts +13 -0
  39. package/dist/cjs/index.d.ts.map +1 -0
  40. package/dist/cjs/lib/admin-client.d.ts +22 -0
  41. package/dist/cjs/lib/admin-client.d.ts.map +1 -0
  42. package/dist/cjs/lib/api-url.d.ts +13 -0
  43. package/dist/cjs/lib/api-url.d.ts.map +1 -0
  44. package/dist/cjs/lib/browser.d.ts +12 -0
  45. package/dist/cjs/lib/browser.d.ts.map +1 -0
  46. package/dist/cjs/lib/bundle.d.ts +79 -0
  47. package/dist/cjs/lib/bundle.d.ts.map +1 -0
  48. package/dist/cjs/lib/docs.d.ts +94 -0
  49. package/dist/cjs/lib/docs.d.ts.map +1 -0
  50. package/dist/cjs/lib/paths.d.ts +13 -0
  51. package/dist/cjs/lib/paths.d.ts.map +1 -0
  52. package/dist/cjs/lib/prompt.d.ts +17 -0
  53. package/dist/cjs/lib/prompt.d.ts.map +1 -0
  54. package/dist/cjs/lib/workspace-transfer.d.ts +120 -0
  55. package/dist/cjs/lib/workspace-transfer.d.ts.map +1 -0
  56. package/dist/cjs/lib/workspaces.d.ts +53 -0
  57. package/dist/cjs/lib/workspaces.d.ts.map +1 -0
  58. package/dist/cjs/package.json +3 -0
  59. package/dist/cjs/telemetry.d.ts +26 -0
  60. package/dist/cjs/telemetry.d.ts.map +1 -0
  61. package/dist/types/auth/oauth.d.ts +1 -1
  62. package/dist/types/commands/docs.d.ts +1 -1
  63. package/dist/types/index.d.ts +11 -11
  64. package/package.json +24 -14
@@ -0,0 +1,26 @@
1
+ import type { AuthConfig, StoredSession } from './token-store.js';
2
+ /**
3
+ * Runs the full browser + loopback PKCE OAuth login flow against the Picked API's
4
+ * authorization server and returns the resulting session. The client registration is
5
+ * persisted to the origin's auth config as a side effect (see {@link registerClient}).
6
+ *
7
+ * @param {string} apiUrl - Base Picked API URL to authenticate against.
8
+ * @returns {Promise<StoredSession>} The newly obtained OAuth session.
9
+ * @throws {Error} When discovery, registration, the browser round-trip, or the token
10
+ * exchange fails.
11
+ * @example
12
+ * const session = await login('https://api.picked.app')
13
+ */
14
+ export declare function login(apiUrl: string): Promise<StoredSession>;
15
+ /**
16
+ * Exchanges a stored session's refresh token for a fresh access token at the discovered
17
+ * `token_endpoint`, rotating the refresh token when the server returns a new one.
18
+ *
19
+ * @param {AuthConfig} config - The origin's auth config, carrying its client and session.
20
+ * @returns {Promise<StoredSession>} The refreshed session.
21
+ * @throws {Error} When the config lacks a client or session, or the refresh request fails.
22
+ * @example
23
+ * const refreshed = await refreshSession(config)
24
+ */
25
+ export declare function refreshSession(config: AuthConfig): Promise<StoredSession>;
26
+ //# sourceMappingURL=oauth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../src/auth/oauth.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAgB,aAAa,EAAqB,MAAM,eAAe,CAAA;AAyU/F;;;;;;;;;;;GAWG;AACH,wBAAsB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAyDlE;AAED;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAuC/E"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Generates a high-entropy PKCE code verifier.
3
+ *
4
+ * @returns {string} A URL-safe code verifier of at least 43 characters (RFC 7636 §4.1).
5
+ * @example
6
+ * createCodeVerifier()
7
+ */
8
+ export declare function createCodeVerifier(): string;
9
+ /**
10
+ * Derives the S256 code challenge from a verifier.
11
+ *
12
+ * @param {string} verifier - The PKCE code verifier.
13
+ * @returns {string} The base64url-encoded SHA-256 digest of the verifier.
14
+ * @example
15
+ * deriveCodeChallenge('dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk')
16
+ */
17
+ export declare function deriveCodeChallenge(verifier: string): string;
18
+ /**
19
+ * Generates an anti-CSRF `state` value for the OAuth authorization request.
20
+ *
21
+ * @returns {string} A URL-safe random state string.
22
+ * @example
23
+ * createState()
24
+ */
25
+ export declare function createState(): string;
26
+ //# sourceMappingURL=pkce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pkce.d.ts","sourceRoot":"","sources":["../../../src/auth/pkce.ts"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAEpC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Returns a usable access token for an API origin: that origin's stored access token,
3
+ * refreshed first when within 60 seconds of expiry.
4
+ *
5
+ * @param {string} apiUrl - The API origin the token will be used against.
6
+ * @returns {Promise<string>} A bearer token suitable for `Authorization: Bearer <token>`.
7
+ * @throws {Error} When not logged in to `apiUrl`.
8
+ * @example
9
+ * const token = await getAccessToken('https://api.picked.app')
10
+ */
11
+ export declare function getAccessToken(apiUrl: string): Promise<string>;
12
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/auth/session.ts"],"names":[],"mappings":"AAMA;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAcpE"}
@@ -0,0 +1,63 @@
1
+ /** Identity claims decoded from the stored access token, for display purposes only. */
2
+ export interface StoredSessionUser {
3
+ id?: string;
4
+ email?: string;
5
+ }
6
+ /** Cached dynamic OAuth client registration for one API origin. */
7
+ export interface StoredClient {
8
+ clientId: string;
9
+ redirectUri: string;
10
+ }
11
+ /** OAuth session for one API origin. */
12
+ export interface StoredSession {
13
+ accessToken: string;
14
+ refreshToken: string;
15
+ /** Access-token expiry as epoch milliseconds. */
16
+ expiresAt: number;
17
+ user?: StoredSessionUser;
18
+ }
19
+ /** Per-origin auth config persisted at `~/.picked/auth/<slug>.json`. */
20
+ export interface AuthConfig {
21
+ apiUrl: string;
22
+ client?: StoredClient;
23
+ session?: StoredSession;
24
+ }
25
+ /**
26
+ * Reads the stored auth config for an API origin, or `null` when absent or malformed.
27
+ *
28
+ * @param {string} apiUrl - The API origin whose config to read.
29
+ * @returns {Promise<AuthConfig | null>} The stored config, or `null`.
30
+ * @example
31
+ * const config = await readAuthConfig('https://api.picked.app')
32
+ */
33
+ export declare function readAuthConfig(apiUrl: string): Promise<AuthConfig | null>;
34
+ /**
35
+ * Persists the OAuth client registration for an API origin, preserving any stored session.
36
+ *
37
+ * @param {string} apiUrl - The API origin the client is registered against.
38
+ * @param {StoredClient} client - The client registration to store.
39
+ * @returns {Promise<void>} Resolves once the config is persisted.
40
+ * @example
41
+ * await saveClient('https://api.picked.app', { clientId, redirectUri })
42
+ */
43
+ export declare function saveClient(apiUrl: string, client: StoredClient): Promise<void>;
44
+ /**
45
+ * Persists the OAuth session for an API origin, preserving any stored client registration.
46
+ *
47
+ * @param {string} apiUrl - The API origin the session belongs to.
48
+ * @param {StoredSession} session - The session to store.
49
+ * @returns {Promise<void>} Resolves once the config is persisted.
50
+ * @example
51
+ * await saveSession('https://api.picked.app', session)
52
+ */
53
+ export declare function saveSession(apiUrl: string, session: StoredSession): Promise<void>;
54
+ /**
55
+ * Removes the stored auth config for an API origin, if present. Other origins are untouched.
56
+ *
57
+ * @param {string} apiUrl - The API origin whose config to remove.
58
+ * @returns {Promise<void>} Resolves once that origin's config no longer exists.
59
+ * @example
60
+ * await clearAuthConfig('https://api.picked.app')
61
+ */
62
+ export declare function clearAuthConfig(apiUrl: string): Promise<void>;
63
+ //# sourceMappingURL=token-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-store.d.ts","sourceRoot":"","sources":["../../../src/auth/token-store.ts"],"names":[],"mappings":"AASA,uFAAuF;AACvF,MAAM,WAAW,iBAAiB;IAChC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,mEAAmE;AACnE,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,wCAAwC;AACxC,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,iBAAiB,CAAA;CACzB;AAED,wEAAwE;AACxE,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,OAAO,CAAC,EAAE,aAAa,CAAA;CACxB;AA4DD;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAU/E;AAkDD;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpF;AAED;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvF;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Runs `picked app deploy`, or `picked app dev` with `dev` set: validates the `app` section of
3
+ * `picked.config`, then deploys it as the app's next version, creating the app on its first deploy. A dev
4
+ * deploy goes to the dev channel, which only the app's own organisation installs, and needs an
5
+ * endpoint. A manifest matching the channel's latest version is reported unchanged. The deploy
6
+ * registers the public key `PICKED_APP_PRIVATE_KEY` or `PICKED_APP_PUBLIC_KEY` names.
7
+ *
8
+ * @param {object} options - Command options.
9
+ * @param {string} [options.cwd] - The app's directory.
10
+ * @param {string} [options.org] - The organisation id or slug.
11
+ * @param {boolean} [options.dev] - Deploy to the dev channel.
12
+ * @param {string} [options.endpoint] - The endpoint the version points at, overriding the manifest's; required with `dev`.
13
+ * @returns {Promise<number>} The process exit code.
14
+ * @example await runAppDeploy({ org: 'acme' })
15
+ */
16
+ export declare function runAppDeploy(options: {
17
+ cwd?: string;
18
+ org: string | undefined;
19
+ dev?: boolean;
20
+ endpoint?: string;
21
+ }): Promise<number>;
22
+ //# sourceMappingURL=app-deploy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/app-deploy.ts"],"names":[],"mappings":"AAgKA;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE;IAC1C,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;IACvB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsDlB"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Runs `picked app keys generate`: prints a new Ed25519 private key, the one-line base64 of its
3
+ * PKCS#8 DER, as a `PICKED_APP_PRIVATE_KEY` assignment, with its public key and key id.
4
+ *
5
+ * @returns {Promise<number>} The process exit code.
6
+ * @example await runAppKeysGenerate()
7
+ */
8
+ export declare function runAppKeysGenerate(): Promise<number>;
9
+ /**
10
+ * Reads the public key a deploy registers: derived from `PICKED_APP_PRIVATE_KEY`, else
11
+ * `PICKED_APP_PUBLIC_KEY`.
12
+ *
13
+ * @param {Record<string, string | undefined>} env - The environment.
14
+ * @returns {Promise<string | null>} The base64url public key, or null when neither is set.
15
+ * @throws {Error} When `PICKED_APP_PRIVATE_KEY` is not an Ed25519 private key.
16
+ * @example await deployedPublicKey(process.env)
17
+ */
18
+ export declare function deployedPublicKey(env: Record<string, string | undefined>): Promise<string | null>;
19
+ //# sourceMappingURL=app-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-keys.d.ts","sourceRoot":"","sources":["../../../src/commands/app-keys.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,CAgB1D;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GACtC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAYxB"}
@@ -0,0 +1,65 @@
1
+ /** @file `picked docs list` and `picked docs read` command implementations. */
2
+ import { type DocsSource } from '../lib/docs.js';
3
+ /**
4
+ * Runs `picked docs list`: prints the path and title of each documentation page, one per
5
+ * line, or every field as JSON.
6
+ *
7
+ * @param {object} options - Command options.
8
+ * @param {string} [options.query] - Words that each listed page must hold.
9
+ * @param {string} [options.type] - Content type to keep: `tutorial`, `how-to`, `reference` or `explanation`.
10
+ * @param {boolean} [options.json] - Print the pages as a JSON array.
11
+ * @param {DocsSource} [options.source] - Where to read pages; defaults to the installed `picked` docs.
12
+ * @returns {Promise<number>} Process exit code: 1 when no page matches.
13
+ * @example
14
+ * await runDocsList({ query: 'feature flag' })
15
+ */
16
+ export declare function runDocsList(options: {
17
+ query?: string;
18
+ type?: string;
19
+ json?: boolean;
20
+ source?: DocsSource;
21
+ }): Promise<number>;
22
+ /**
23
+ * Runs `picked docs read <page>`: prints one page as Markdown, under a comment that names its
24
+ * URL. The page can be a site path, a docs URL, or a bundled file path.
25
+ *
26
+ * @param {object} options - Command options.
27
+ * @param {string | undefined} options.page - The page to read.
28
+ * @param {DocsSource} [options.source] - Where to read pages; defaults to the installed `picked` docs.
29
+ * @returns {Promise<number>} Process exit code: 1 when the page does not exist.
30
+ * @example
31
+ * await runDocsRead({ page: '/how-to/install-the-sdk' })
32
+ */
33
+ export declare function runDocsRead(options: {
34
+ page: string | undefined;
35
+ source?: DocsSource;
36
+ }): Promise<number>;
37
+ /**
38
+ * Names a `picked docs` invocation for telemetry.
39
+ *
40
+ * @param {string | undefined} subcommand - The word after `picked docs`.
41
+ * @returns {string} `docs list` or `docs read`.
42
+ * @example
43
+ * docsCommandName('read') // 'docs read'
44
+ */
45
+ export declare function docsCommandName(subcommand: string | undefined): string;
46
+ /**
47
+ * Runs `picked docs`. `picked docs`, `picked docs list [words]` and `picked docs ls` list pages;
48
+ * `picked docs read <path>` and `picked docs <path>` read one.
49
+ *
50
+ * @param {object} options - Command options.
51
+ * @param {string[]} options.args - The words after `picked docs`.
52
+ * @param {string} [options.type] - Content type to keep when listing.
53
+ * @param {boolean} [options.json] - Print a listing as JSON.
54
+ * @param {DocsSource} [options.source] - Where to read pages; defaults to the installed `picked` docs.
55
+ * @returns {Promise<number>} Process exit code.
56
+ * @example
57
+ * await runDocs({ args: ['read', '/how-to/install-the-sdk'] })
58
+ */
59
+ export declare function runDocs(options: {
60
+ args: string[];
61
+ type?: string;
62
+ json?: boolean;
63
+ source?: DocsSource;
64
+ }): Promise<number>;
65
+ //# sourceMappingURL=docs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../../src/commands/docs.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAML,KAAK,UAAU,EAChB,MAAM,aAAa,CAAA;AAIpB;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE;IACzC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,MAAM,CAAC,EAAE,UAAU,CAAA;CACpB,GAAG,OAAO,CAAC,MAAM,CAAC,CA8BlB;AA6BD;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE;IACzC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACxB,MAAM,CAAC,EAAE,UAAU,CAAA;CACpB,GAAG,OAAO,CAAC,MAAM,CAAC,CA8BlB;AAcD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAEtE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE;IACrC,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,MAAM,CAAC,EAAE,UAAU,CAAA;CACpB,GAAG,OAAO,CAAC,MAAM,CAAC,CAYlB"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Runs `picked generate types`.
3
+ *
4
+ * @param {object} options - Command options.
5
+ * @param {boolean} [options.check] - Compare-only mode; do not write output.
6
+ * @param {string} [options.cwd] - Working directory containing `picked.config`.
7
+ * @returns {Promise<number>} Process exit code.
8
+ * @example
9
+ * await runGenerateTypes({ check: false })
10
+ */
11
+ export declare function runGenerateTypes(options?: {
12
+ check?: boolean;
13
+ cwd?: string;
14
+ }): Promise<number>;
15
+ //# sourceMappingURL=generate-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-types.d.ts","sourceRoot":"","sources":["../../../src/commands/generate-types.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,CAAC,EAAE;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,MAAM,CAAC,CAyClB"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Runs `picked login`: runs the browser + loopback PKCE OAuth flow and persists the
3
+ * resulting session to the current directory's API origin auth config. Fails without
4
+ * signing in while `PICKED_API_KEY` is set.
5
+ *
6
+ * @param {object} [options] - Command options.
7
+ * @param {string} [options.cwd] - Working directory used to resolve the API origin.
8
+ * @returns {Promise<number>} Process exit code.
9
+ * @example
10
+ * await runLogin({})
11
+ */
12
+ export declare function runLogin(options?: {
13
+ cwd?: string;
14
+ }): Promise<number>;
15
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/login.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;GAUG;AACH,wBAAsB,QAAQ,CAAC,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAwB1E"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Runs `picked logout`: removes the stored OAuth session for the current directory's API
3
+ * origin. Sessions for other origins are left untouched.
4
+ *
5
+ * @param {object} [options] - Command options.
6
+ * @param {string} [options.cwd] - Working directory used to resolve the API origin.
7
+ * @returns {Promise<number>} Process exit code.
8
+ * @example
9
+ * await runLogout()
10
+ */
11
+ export declare function runLogout(options?: {
12
+ cwd?: string;
13
+ }): Promise<number>;
14
+ //# sourceMappingURL=logout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/commands/logout.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAAC,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAM3E"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Runs `picked pull`: fetches the workspace schema, project config and CMS content of the
3
+ * project in force and writes them to `picked.snapshot.json`, which `data: 'snapshot'` builds
4
+ * from. With `check`, compares instead and writes nothing.
5
+ *
6
+ * @param {object} [options] - Command options.
7
+ * @param {boolean} [options.check] - Compare with the committed snapshot instead of writing.
8
+ * @param {boolean} [options.allowPreview] - Pull a preview source, which holds unpublished content.
9
+ * @param {string} [options.cwd] - Working directory containing `picked.config`.
10
+ * @returns {Promise<number>} Process exit code.
11
+ * @example
12
+ * await runPull({ check: true })
13
+ */
14
+ export declare function runPull(options?: {
15
+ check?: boolean;
16
+ allowPreview?: boolean;
17
+ cwd?: string;
18
+ }): Promise<number>;
19
+ //# sourceMappingURL=pull.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../../src/commands/pull.ts"],"names":[],"mappings":"AA4EA;;;;;;;;;;;;GAYG;AACH,wBAAsB,OAAO,CAAC,OAAO,CAAC,EAAE;IACtC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,MAAM,CAAC,CAiDlB"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Runs `picked status`: prints the app `picked.config` holds, with its endpoint, and the project it
3
+ * names, with the effective active workspace selection for the current API origin. A config
4
+ * that holds both prints both.
5
+ *
6
+ * @param {object} [options] - Command options.
7
+ * @param {string} [options.cwd] - Working directory to inspect; defaults to `process.cwd()`.
8
+ * @returns {Promise<number>} Process exit code.
9
+ * @example
10
+ * await runStatus({})
11
+ */
12
+ export declare function runStatus(options?: {
13
+ cwd?: string;
14
+ }): Promise<number>;
15
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/status.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AACH,wBAAsB,SAAS,CAAC,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAmD3E"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Runs `picked whoami`: prints the identity signed in to the current directory's API origin.
3
+ * Fails without reading a session while `PICKED_API_KEY` is set.
4
+ *
5
+ * @param {object} [options] - Command options.
6
+ * @param {string} [options.cwd] - Working directory used to resolve the API origin.
7
+ * @returns {Promise<number>} Process exit code.
8
+ * @example
9
+ * await runWhoami()
10
+ */
11
+ export declare function runWhoami(options?: {
12
+ cwd?: string;
13
+ }): Promise<number>;
14
+ //# sourceMappingURL=whoami.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../../src/commands/whoami.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAAC,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAsB3E"}
@@ -0,0 +1,28 @@
1
+ /** Options for {@link runWorkspaceExport}. */
2
+ interface RunWorkspaceExportOptions {
3
+ cwd?: string;
4
+ /** The project the exported workspace belongs to. */
5
+ project?: string;
6
+ /** The workspace to export. */
7
+ workspace?: string;
8
+ /** Export the snapshot workspace of the project's live version. */
9
+ live?: boolean;
10
+ /** The bundle directory to write, inside `cwd`. */
11
+ out?: string;
12
+ }
13
+ /**
14
+ * Runs `picked workspace export`: exports a workspace, or with `--live` the snapshot
15
+ * workspace of the project's live version, into a bundle directory. Every manifest asset is
16
+ * downloaded, checked against the manifest's size and SHA-256, and written to
17
+ * `assets/<sha256>`; a manifest item with no SHA-256 gets the hash of the downloaded bytes.
18
+ * `bundle.json` is written last, into a temporary sibling directory that becomes `--out` only
19
+ * once complete, so a failed run leaves `--out` as it was.
20
+ *
21
+ * @param {RunWorkspaceExportOptions} options - Command options.
22
+ * @returns {Promise<number>} Process exit code.
23
+ * @example
24
+ * await runWorkspaceExport({ project: 'proj-1', live: true, out: 'bundle' })
25
+ */
26
+ export declare function runWorkspaceExport(options: RunWorkspaceExportOptions): Promise<number>;
27
+ export {};
28
+ //# sourceMappingURL=workspace-export.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-export.d.ts","sourceRoot":"","sources":["../../../src/commands/workspace-export.ts"],"names":[],"mappings":"AAqBA,8CAA8C;AAC9C,UAAU,yBAAyB;IACjC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mEAAmE;IACnE,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,mDAAmD;IACnD,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAsKD;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsB5F"}
@@ -0,0 +1,26 @@
1
+ /** Options for {@link runWorkspaceImport}. */
2
+ interface RunWorkspaceImportOptions {
3
+ cwd?: string;
4
+ /** The project to import into. */
5
+ project?: string;
6
+ /** The bundle directory to read, inside `cwd`. */
7
+ in?: string;
8
+ /** The new workspace's name; the bundle's workspace name when omitted. */
9
+ name?: string;
10
+ /** Publish the new workspace after importing it. */
11
+ publish?: boolean;
12
+ }
13
+ /**
14
+ * Runs `picked workspace import`: stores the bundle's assets in the project, reusing the
15
+ * project's existing versions of identical bytes, imports the bundle as a new draft
16
+ * workspace, and with `--publish` publishes it. Prints the new workspace id. When storing
17
+ * fails or the API refuses the import, the assets this run uploaded are deleted.
18
+ *
19
+ * @param {RunWorkspaceImportOptions} options - Command options.
20
+ * @returns {Promise<number>} Process exit code.
21
+ * @example
22
+ * await runWorkspaceImport({ project: 'proj-1', in: 'bundle', publish: true })
23
+ */
24
+ export declare function runWorkspaceImport(options: RunWorkspaceImportOptions): Promise<number>;
25
+ export {};
26
+ //# sourceMappingURL=workspace-import.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-import.d.ts","sourceRoot":"","sources":["../../../src/commands/workspace-import.ts"],"names":[],"mappings":"AAyBA,8CAA8C;AAC9C,UAAU,yBAAyB;IACjC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,kDAAkD;IAClD,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,oDAAoD;IACpD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAmPD;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwC5F"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Runs `picked workspace list`: prints every organization, project, and workspace
3
+ * visible to the authenticated user.
4
+ *
5
+ * @param {object} [options] - Command options.
6
+ * @param {string} [options.cwd] - Working directory used to resolve the API URL.
7
+ * @param {boolean} [options.json] - Print machine-readable JSON to stdout; the default is an indented list.
8
+ * @returns {Promise<number>} Process exit code.
9
+ * @example
10
+ * await runWorkspaceList({ json: false })
11
+ */
12
+ export declare function runWorkspaceList(options?: {
13
+ cwd?: string;
14
+ json?: boolean;
15
+ }): Promise<number>;
16
+ //# sourceMappingURL=workspace-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-list.d.ts","sourceRoot":"","sources":["../../../src/commands/workspace-list.ts"],"names":[],"mappings":"AAiCA;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,CAAC,EAAE;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBlB"}
@@ -0,0 +1,20 @@
1
+ /** Options for {@link runWorkspaceUse}. */
2
+ interface RunWorkspaceUseOptions {
3
+ cwd?: string;
4
+ project?: string;
5
+ workspace?: string;
6
+ /** Skip the immediate `picked generate types` refresh. Defaults to true (runs). */
7
+ generate?: boolean;
8
+ }
9
+ /**
10
+ * Runs `picked workspace use`: selects a project (and optionally a specific workspace)
11
+ * and persists it to `.picked/settings.json`, refreshing generated types by default.
12
+ *
13
+ * @param {RunWorkspaceUseOptions} [options] - Command options.
14
+ * @returns {Promise<number>} Process exit code.
15
+ * @example
16
+ * await runWorkspaceUse({ project: 'proj-1' })
17
+ */
18
+ export declare function runWorkspaceUse(options?: RunWorkspaceUseOptions): Promise<number>;
19
+ export {};
20
+ //# sourceMappingURL=workspace-use.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-use.d.ts","sourceRoot":"","sources":["../../../src/commands/workspace-use.ts"],"names":[],"mappings":"AAeA,2CAA2C;AAC3C,UAAU,sBAAsB;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AA+HD;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBvF"}
@@ -0,0 +1,13 @@
1
+ /** @file Public exports for `\@picked/cli`. */
2
+ export { runDocs, runDocsList, runDocsRead } from './commands/docs.js';
3
+ export { runGenerateTypes } from './commands/generate-types.js';
4
+ export { runLogin } from './commands/login.js';
5
+ export { runLogout } from './commands/logout.js';
6
+ export { runPull } from './commands/pull.js';
7
+ export { runStatus } from './commands/status.js';
8
+ export { runWhoami } from './commands/whoami.js';
9
+ export { runWorkspaceExport } from './commands/workspace-export.js';
10
+ export { runWorkspaceImport } from './commands/workspace-import.js';
11
+ export { runWorkspaceList } from './commands/workspace-list.js';
12
+ export { runWorkspaceUse } from './commands/workspace-use.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA"}
@@ -0,0 +1,22 @@
1
+ import type { AdminApiClient } from '@picked/admin-api-client';
2
+ /**
3
+ * Reads the API key for non-interactive runs from `PICKED_API_KEY`.
4
+ *
5
+ * @returns {string | undefined} The trimmed key, or undefined when the variable is unset or blank.
6
+ * @example
7
+ * if (readApiKey()) console.error('Using PICKED_API_KEY')
8
+ */
9
+ export declare function readApiKey(): string | undefined;
10
+ /**
11
+ * Creates an admin API client for an API origin. With `PICKED_API_KEY` set, every request
12
+ * carries it as `X-API-Key` and the stored OAuth session is never read. Otherwise requests
13
+ * carry that origin's OAuth access token, refreshed as it nears expiry.
14
+ *
15
+ * @param {string} apiUrl - The API origin.
16
+ * @returns {Promise<AdminApiClient>} The client.
17
+ * @throws {Error} When there is no API key and no session for `apiUrl`.
18
+ * @example
19
+ * const client = await createCliAdminClient(await resolveApiUrl())
20
+ */
21
+ export declare function createCliAdminClient(apiUrl: string): Promise<AdminApiClient>;
22
+ //# sourceMappingURL=admin-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-client.d.ts","sourceRoot":"","sources":["../../../src/lib/admin-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAG9D;;;;;;GAMG;AACH,wBAAgB,UAAU,IAAI,MAAM,GAAG,SAAS,CAG/C;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAMlF"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Resolves the canonical Picked API origin: the `PICKED_API_URL` env var, else `apiUrl`
3
+ * from `picked.config`, a project's or an app's, else the production default. The result is normalised to its
4
+ * origin so it is identical whether it feeds a request or keys per-origin auth storage.
5
+ *
6
+ * @param {string} [cwd] - Directory to search for `picked.config`; defaults to `process.cwd()`.
7
+ * @returns {Promise<string>} The resolved canonical API origin (HTTPS or loopback).
8
+ * @throws {Error} When the resolved URL is not HTTPS and not a loopback host.
9
+ * @example
10
+ * const apiUrl = await resolveApiUrl()
11
+ */
12
+ export declare function resolveApiUrl(cwd?: string): Promise<string>;
13
+ //# sourceMappingURL=api-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-url.d.ts","sourceRoot":"","sources":["../../../src/lib/api-url.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CAAC,GAAG,SAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAMxE"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Opens a URL in the platform's default browser. Spawn failures are swallowed: callers
3
+ * always print the URL as a fallback for the user to open manually, so a missing opener
4
+ * binary should not fail the surrounding flow.
5
+ *
6
+ * @param {string} url - URL to open.
7
+ * @returns {Promise<void>} Resolves once the opener process has been spawned.
8
+ * @example
9
+ * await openUrl('https://api.picked.app/oauth/consent')
10
+ */
11
+ export declare function openUrl(url: string): Promise<void>;
12
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../src/lib/browser.ts"],"names":[],"mappings":"AAuBA;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAYlD"}