timeback-studio 0.1.4 → 0.1.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/credentials/add.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE3C;;;GAGG;AACH,wBAAsB,cAAc,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuEhF"}
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/credentials/add.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE3C;;;GAGG;AACH,wBAAsB,cAAc,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuFhF"}
@@ -1,7 +1,14 @@
1
1
  import type { CredentialEnvironment } from '@timeback/internal-cli-infra';
2
+ interface PromptInitialCredentialsOptions {
3
+ /** Skip the intro banner (use when caller already printed one) */
4
+ skipIntro?: boolean;
5
+ }
2
6
  /**
3
7
  * Runs the first-time credential setup flow.
4
- * @returns The selected default environment, or null if cancelled
8
+ *
9
+ * @param options - Options for the prompt
10
+ * @returns The selected environment to use for this run, or null if cancelled/error
5
11
  */
6
- export declare function promptInitialCredentials(): Promise<CredentialEnvironment | null>;
12
+ export declare function promptInitialCredentials(options?: PromptInitialCredentialsOptions): Promise<CredentialEnvironment | null>;
13
+ export {};
7
14
  //# sourceMappingURL=initial.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"initial.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/credentials/lib/initial.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AAEzE;;;GAGG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAwDtF"}
1
+ {"version":3,"file":"initial.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/credentials/lib/initial.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AAEzE,UAAU,+BAA+B;IACxC,kEAAkE;IAClE,SAAS,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC7C,OAAO,GAAE,+BAAoC,GAC3C,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAoEvC"}
@@ -2,9 +2,27 @@
2
2
  * Config Resolution for Serve Command
3
3
  */
4
4
  import type { CourseConfig } from '@timeback/types';
5
- import type { Environment, EnvironmentCredentials, LoadedUserConfig, ParserOptions } from '../../../config';
5
+ import type { Credentials, Environment, EnvironmentCredentials, LoadedUserConfig, ParserOptions } from '../../../config';
6
6
  import type { ImportResult } from '../../lib';
7
7
  import type { ResolvedConfig, ServeOptions } from './types';
8
+ interface ResolveConfigSourceResult {
9
+ resolved: ResolvedConfig;
10
+ credentials: EnvironmentCredentials;
11
+ configuredEnvs: Environment[];
12
+ }
13
+ /**
14
+ * Resolve the config "source of truth" for `serve` without doing any precondition checks.
15
+ *
16
+ * - If CLI course IDs are provided, we use them (and may hit the API / prompt for creds).
17
+ * - Otherwise, we try to load a config file without prompting for credentials.
18
+ * - If no config file exists, we fall back to interactive import (requires creds).
19
+ *
20
+ * @param courseIds - Course IDs passed via CLI args
21
+ * @param opts - Serve command options
22
+ * @param defaultEnvironment - Default environment (saved/override-derived)
23
+ * @returns Resolved config source + any loaded credentials, or null if cancelled/failed
24
+ */
25
+ export declare function resolveConfigSource(courseIds: string[], opts: ServeOptions, defaultEnvironment: Environment): Promise<ResolveConfigSourceResult | null>;
8
26
  /**
9
27
  * Builds a LoadedUserConfig from import result (in-memory).
10
28
  * @param result - Import result with app name and courses
@@ -24,7 +42,7 @@ export declare function buildUserConfigFromCourses(courses: CourseConfig[]): Loa
24
42
  * @param env - Target environment
25
43
  * @param credentials - Credentials map
26
44
  * @param configuredEnvs - List of configured environments
27
- * @returns Resolved config, or null if cancelled
45
+ * @returns Resolved config, or null if cancelled/error
28
46
  */
29
47
  export declare function resolveFromCourseIds(courseIds: string[], env: Environment, credentials: EnvironmentCredentials, configuredEnvs: Environment[]): Promise<ResolvedConfig | null>;
30
48
  /**
@@ -37,13 +55,38 @@ export declare function resolveFromCourseIds(courseIds: string[], env: Environme
37
55
  */
38
56
  export declare function resolveFromConfigOrImport(credentials: EnvironmentCredentials, configuredEnvs: Environment[], defaultEnv: Environment, parserOpts?: ParserOptions): Promise<ResolvedConfig | null>;
39
57
  /**
40
- * Get derived sensors, optionally overridden by CLI flag.
58
+ * Persist a prompted sensor back to the user's config file (when possible).
41
59
  *
42
- * @param config - User config
43
- * @param opts - CLI options
44
- * @returns Sensor URLs for event filtering
60
+ * We only auto-write for JSON config files (e.g. `timeback.config.json`).
61
+ * For other config formats (e.g. `playcademy.config.ts`), we do not attempt to modify.
62
+ *
63
+ * @param config - Loaded config (must include file path)
64
+ * @param sensor - Sensor URL to persist
65
+ * @returns True if the sensor was persisted to disk, false otherwise
66
+ */
67
+ /**
68
+ * Options for resolving sensors.
69
+ */
70
+ interface ResolveSensorsOptions {
71
+ config: LoadedUserConfig;
72
+ env: Environment;
73
+ opts: ServeOptions;
74
+ creds: Credentials;
75
+ }
76
+ /**
77
+ * Resolve effective sensors for event filtering.
78
+ *
79
+ * Resolution priority:
80
+ * 1. `--sensors` CLI flag (explicit override) → use directly
81
+ * 2. `config.sensor` (top-level explicit sensor) → use directly (trusted override, no managedBy check)
82
+ * 3. Otherwise, check upstream `course.metadata.managedBy`:
83
+ * - If **all** courses are managed by Timeback CLI → derive sensors from config (per-env resolution with launchUrl fallback)
84
+ * - If **any** course is not managed → prompt user for sensor (no guessing)
85
+ *
86
+ * @param options - Resolution options
87
+ * @returns Sensor URLs for event filtering, or undefined if user cancelled prompt
45
88
  */
46
- export declare function getEffectiveSensors(config: LoadedUserConfig, opts: ServeOptions): string[] | undefined;
89
+ export declare function resolveSensors(options: ResolveSensorsOptions): Promise<string[] | undefined | null>;
47
90
  /**
48
91
  * Resolve user config from CLI args, config file, or import flow.
49
92
  *
@@ -60,4 +103,5 @@ export declare function getEffectiveSensors(config: LoadedUserConfig, opts: Serv
60
103
  * @returns Resolved config, or null if cancelled
61
104
  */
62
105
  export declare function resolveConfig(courseIds: string[], opts: ServeOptions, credentials: EnvironmentCredentials, configuredEnvs: Environment[], defaultEnv: Environment): Promise<ResolvedConfig | null>;
106
+ export {};
63
107
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/serve/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,EACX,WAAW,EACX,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,EACb,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3D;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,YAAY,GAAG,gBAAgB,CAqBhF;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,gBAAgB,CAkBpF;AAED;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACzC,SAAS,EAAE,MAAM,EAAE,EACnB,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,sBAAsB,EACnC,cAAc,EAAE,WAAW,EAAE,GAC3B,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA8BhC;AAED;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAC9C,WA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,CAAC,MAAM,EAAE,YAAY,GAAG,gBAAgB,CAqBhF;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,gBAAgB,CAkBpF;AAED;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACzC,SAAS,EAAE,MAAM,EAAE,EACnB,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,sBAAsB,EACnC,cAAc,EAAE,WAAW,EAAE,GAC3B,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAgChC;AAED;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAC9C,WAAW,EAAE,sBAAsB,EACnC,cAAc,EAAE,WAAW,EAAE,EAC7B,UAAU,EAAE,WAAW,EACvB,UAAU,GAAE,aAAkB,GAC5B,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA0BhC;AAmCD;;;;;;;;;GASG;AACH;;GAEG;AACH,UAAU,qBAAqB;IAC9B,MAAM,EAAE,gBAAgB,CAAA;IACxB,GAAG,EAAE,WAAW,CAAA;IAChB,IAAI,EAAE,YAAY,CAAA;IAClB,KAAK,EAAE,WAAW,CAAA;CAClB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CACnC,OAAO,EAAE,qBAAqB,GAC5B,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,GAAG,IAAI,CAAC,CA2EtC;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CAClC,SAAS,EAAE,MAAM,EAAE,EACnB,IAAI,EAAE,YAAY,EAClB,WAAW,EAAE,sBAAsB,EACnC,cAAc,EAAE,WAAW,EAAE,EAC7B,UAAU,EAAE,WAAW,GACrB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAShC"}
@@ -0,0 +1,32 @@
1
+ import type { CredentialEnvironment } from '@timeback/internal-cli-infra';
2
+ import type { LoadedUserConfig } from '../../../config';
3
+ interface ResolveServeEnvironmentOptions {
4
+ /** Parsed user config (from file or in-memory import) */
5
+ userConfig: LoadedUserConfig;
6
+ /** Whether the user explicitly passed `--env` */
7
+ hasEnvOverride: boolean;
8
+ /** Environment from CLI flag (if provided) */
9
+ envOverride?: CredentialEnvironment;
10
+ }
11
+ /**
12
+ * Resolve which environment Studio should use based on config course IDs.
13
+ *
14
+ * Resolution logic:
15
+ * 1. If `--env` flag provided → use it
16
+ * 2. If config has IDs for exactly one env → use that env silently
17
+ * 3. If config has IDs for both envs → prompt user to select
18
+ * 4. If config has zero IDs → returns null (caller should error)
19
+ *
20
+ * @param options - Environment resolution inputs
21
+ * @returns The effective environment to use, or null if no course IDs exist
22
+ */
23
+ export declare function resolveServeEnvironment(options: ResolveServeEnvironmentOptions): Promise<CredentialEnvironment | null>;
24
+ /**
25
+ * Prompt user to select an environment when CLI course IDs are provided without --env.
26
+ *
27
+ * @param count - Number of course IDs (for singular/plural message)
28
+ * @returns The selected environment, or exits if cancelled
29
+ */
30
+ export declare function promptEnvironmentForCourseIds(count: number): Promise<CredentialEnvironment>;
31
+ export {};
32
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/serve/env.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAEvD,UAAU,8BAA8B;IACvC,yDAAyD;IACzD,UAAU,EAAE,gBAAgB,CAAA;IAC5B,iDAAiD;IACjD,cAAc,EAAE,OAAO,CAAA;IACvB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,qBAAqB,CAAA;CACnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,uBAAuB,CAC5C,OAAO,EAAE,8BAA8B,GACrC,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CA+CvC;AAED;;;;;GAKG;AACH,wBAAsB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAkBjG"}
@@ -8,9 +8,11 @@ import type { ServeOptions } from './types';
8
8
  * Serve command entry point.
9
9
  *
10
10
  * Flow:
11
- * 1. Setup credentials (interactive if none exist)
12
- * 2. Resolve config (CLI course IDs > config file > interactive import)
13
- * 3. Start server
11
+ * 1. Resolve config source (CLI course IDs > config file > interactive import)
12
+ * 2. Resolve environment from config (silent if one env, prompt if both, error if none)
13
+ * 3. Ensure credentials for the chosen environment (interactive if missing)
14
+ * 4. Resolve sensors (with managedBy gating)
15
+ * 5. Start server
14
16
  *
15
17
  * @param courseIds - Optional course IDs to load directly
16
18
  * @param opts - Server options including optional environment
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/serve/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C;;;;;;;;;;GAUG;AACH,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAkDzF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/serve/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AA0M3C;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAsCzF"}
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/serve/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE/D;;;;;GAKG;AACH,wBAAgB,WAAW,CAC1B,GAAG,EAAE,UAAU,EACf,YAAY,EAAE,YAAY,EAC1B,UAAU,CAAC,EAAE,MAAM,GACjB,IAAI,CAqBN"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/serve/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE/D;;;;;GAKG;AACH,wBAAgB,WAAW,CAC1B,GAAG,EAAE,UAAU,EACf,YAAY,EAAE,YAAY,EAC1B,UAAU,CAAC,EAAE,MAAM,GACjB,IAAI,CAuBN"}
@@ -3,8 +3,10 @@
3
3
  *
4
4
  * Studio-specific utilities for fetching courses.
5
5
  */
6
+ import type { OneRoster } from '@timeback/core/types';
6
7
  import type { CourseConfig } from '@timeback/types';
7
8
  import type { Credentials, Environment } from '../../config';
9
+ import type { UnmanagedCourseInfo } from './types';
8
10
  export { toCourseConfig } from '@timeback/internal-cli-infra';
9
11
  /**
10
12
  * Fetch and convert courses by IDs.
@@ -14,4 +16,34 @@ export { toCourseConfig } from '@timeback/internal-cli-infra';
14
16
  * @returns Array of CourseConfigs
15
17
  */
16
18
  export declare function fetchCourses(creds: Credentials, env: Environment, ids: string[]): Promise<CourseConfig[]>;
19
+ /**
20
+ * Check if a course is managed by Timeback CLI.
21
+ *
22
+ * A course is considered managed if its metadata.managedBy field
23
+ * starts with "timeback@" (e.g., "timeback@1.0.0").
24
+ *
25
+ * @param course - OneRoster course object
26
+ * @returns True if managed by Timeback CLI
27
+ */
28
+ export declare function isManagedCourse(course: OneRoster.Course): boolean;
29
+ /**
30
+ * Result of checking course management status.
31
+ */
32
+ interface ManagedByCheckResult {
33
+ /** True if all courses are managed by Timeback CLI. */
34
+ allManaged: boolean;
35
+ /** Info about courses that are not managed (for error messages). */
36
+ unmanagedCourses: UnmanagedCourseInfo[];
37
+ }
38
+ /**
39
+ * Check if all courses for the given IDs are managed by Timeback CLI.
40
+ *
41
+ * Fetches course metadata from the API and checks the managedBy field.
42
+ *
43
+ * @param creds - Credentials for the environment
44
+ * @param env - Target environment
45
+ * @param ids - Course IDs to check
46
+ * @returns Result indicating if all are managed
47
+ */
48
+ export declare function checkCoursesManaged(creds: Credentials, env: Environment, ids: string[]): Promise<ManagedByCheckResult>;
17
49
  //# sourceMappingURL=courses.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"courses.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/courses.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AA0B7D;;;;;;GAMG;AACH,wBAAsB,YAAY,CACjC,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,MAAM,EAAE,GACX,OAAO,CAAC,YAAY,EAAE,CAAC,CAmBzB"}
1
+ {"version":3,"file":"courses.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/courses.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AA0B7D;;;;;;GAMG;AACH,wBAAsB,YAAY,CACjC,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,MAAM,EAAE,GACX,OAAO,CAAC,YAAY,EAAE,CAAC,CAmBzB;AAMD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,OAAO,CAGjE;AAED;;GAEG;AACH,UAAU,oBAAoB;IAC7B,uDAAuD;IACvD,UAAU,EAAE,OAAO,CAAA;IACnB,oEAAoE;IACpE,gBAAgB,EAAE,mBAAmB,EAAE,CAAA;CACvC;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACxC,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,MAAM,EAAE,GACX,OAAO,CAAC,oBAAoB,CAAC,CAqD/B"}
@@ -1,35 +1,22 @@
1
1
  /**
2
2
  * Credential Utilities
3
3
  *
4
- * Shared credential loading and resolution logic.
4
+ * Re-exports from `@timeback/internal-cli-infra` plus Studio-specific helpers.
5
5
  */
6
- import type { CredentialEnvironment, Credentials } from '@timeback/internal-cli-infra';
7
- import type { EnvironmentCredentials } from '../../config';
8
- /**
9
- * Loads credentials for all configured environments.
10
- * @returns Credentials keyed by environment
11
- */
12
- export declare function loadAllCredentials(): Promise<EnvironmentCredentials>;
13
- /**
14
- * Determines the default environment (CLI flag > saved > first configured > staging).
15
- * @param override - Optional environment override from CLI
16
- * @returns Resolved environment
17
- */
18
- export declare function resolveDefaultEnvironment(override?: CredentialEnvironment): Promise<CredentialEnvironment>;
6
+ import type { CredentialEnvironment, EnvironmentCredentials } from '@timeback/internal-cli-infra';
7
+ export { ensureCredentials, loadAllCredentials } from '@timeback/internal-cli-infra';
8
+ interface HandleCredentialSetupOptions {
9
+ /** Skip the intro banner (use when caller already printed one) */
10
+ skipIntro?: boolean;
11
+ }
19
12
  /**
20
13
  * Handles first-time credential setup when no credentials exist yet.
14
+ *
15
+ * @param options - Options for the setup flow
21
16
  * @returns The selected environment and credentials, or null if cancelled
22
17
  */
23
- export declare function handleCredentialSetup(): Promise<{
18
+ export declare function handleCredentialSetup(options?: HandleCredentialSetupOptions): Promise<{
24
19
  credentials: EnvironmentCredentials;
25
- defaultEnvironment: CredentialEnvironment;
20
+ selectedEnvironment: CredentialEnvironment;
26
21
  } | null>;
27
- /**
28
- * Ensures credentials exist for the target environment.
29
- * Prompts for setup if missing.
30
- * @param env - Target environment
31
- * @param credentials - Current credentials map
32
- * @returns Updated credentials with the target env, or null if cancelled
33
- */
34
- export declare function ensureCredentials(env: CredentialEnvironment, credentials: EnvironmentCredentials): Promise<Credentials | null>;
35
22
  //# sourceMappingURL=credentials.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/credentials.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AACtF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAE1D;;;GAGG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAY1E;AAED;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC9C,QAAQ,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CAQhC;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC;IACtD,WAAW,EAAE,sBAAsB,CAAA;IACnC,kBAAkB,EAAE,qBAAqB,CAAA;CACzC,GAAG,IAAI,CAAC,CAWR;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACtC,GAAG,EAAE,qBAAqB,EAC1B,WAAW,EAAE,sBAAsB,GACjC,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAiB7B"}
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/credentials.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAEjG,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAEpF,UAAU,4BAA4B;IACrC,kEAAkE;IAClE,SAAS,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAC1C,OAAO,GAAE,4BAAiC,GACxC,OAAO,CAAC;IACV,WAAW,EAAE,sBAAsB,CAAA;IACnC,mBAAmB,EAAE,qBAAqB,CAAA;CAC1C,GAAG,IAAI,CAAC,CAiBR"}
@@ -1,5 +1,5 @@
1
- export { fetchCourses, toCourseConfig } from './courses';
2
- export { ensureCredentials, handleCredentialSetup, loadAllCredentials, resolveDefaultEnvironment, } from './credentials';
1
+ export { checkCoursesManaged, fetchCourses, isManagedCourse, toCourseConfig } from './courses';
2
+ export { ensureCredentials, handleCredentialSetup, loadAllCredentials } from './credentials';
3
3
  export { promptImportApp, promptNoConfig } from './onboarding';
4
4
  export { intro, outro } from '@timeback/internal-cli-infra';
5
5
  export type { ImportFailure, ImportResult } from './onboarding';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AACxD,OAAO,EACN,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,GACzB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAE3D,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC9F,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAC5F,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAE3D,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Types for CLI lib utilities.
3
+ */
4
+ /**
5
+ * Info about an unmanaged course.
6
+ */
7
+ export interface UnmanagedCourseInfo {
8
+ /** Course ID */
9
+ id: string;
10
+ /** Course title (if available) */
11
+ title?: string;
12
+ }
13
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,gBAAgB;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;CACd"}
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { z } from 'zod';
7
7
  import { configSchema } from './constants';
8
- import type { CredentialEnvironment, Credentials, LoadedUserConfig } from '@timeback/internal-cli-infra';
8
+ import type { CredentialEnvironment, Credentials, EnvironmentCredentials, LoadedUserConfig } from '@timeback/internal-cli-infra';
9
9
  export type Config = z.infer<typeof configSchema>;
10
10
  /**
11
11
  * Deployment environment within a platform.
@@ -32,13 +32,7 @@ export interface LoadCredentialsError {
32
32
  success: false;
33
33
  error: string;
34
34
  }
35
- /**
36
- * Credentials stored per environment.
37
- * Currently assumes the default platform (BEYOND_AI).
38
- */
39
- export type EnvironmentCredentials = {
40
- [K in CredentialEnvironment]?: Credentials;
41
- };
35
+ export type { EnvironmentCredentials } from '@timeback/internal-cli-infra';
42
36
  export type { LoadedUserConfig, UserConfig } from '@timeback/internal-cli-infra';
43
37
  export declare const ServerConfigSchema: z.ZodObject<{
44
38
  name: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,KAAK,EACX,qBAAqB,EACrB,WAAW,EACX,gBAAgB,EAEhB,MAAM,8BAA8B,CAAA;AAMrC,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AAWjD;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,qBAAqB,CAAA;AAE/C;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,GAAG,OAAO,CAAA;AAM/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAEhE,YAAY,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAE/D,MAAM,WAAW,qBAAqB;IACrC,OAAO,EAAE,IAAI,CAAA;IACb,WAAW,EAAE,WAAW,CAAA;IACxB,MAAM,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAA;CAClC;AAED,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,KAAK,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACb;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;KACnC,CAAC,IAAI,qBAAqB,CAAC,CAAC,EAAE,WAAW;CAC1C,CAAA;AAMD,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AAMhF,eAAO,MAAM,kBAAkB;;;;;;;;iBAQ7B,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAM7D,MAAM,WAAW,UAAU;IAC1B,YA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