@appilots/cli 0.4.0 → 0.11.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/dist/index.d.mts CHANGED
@@ -425,6 +425,14 @@ declare class ScreenAnalyzer {
425
425
  private extractNavigationParams;
426
426
  private extractItemFields;
427
427
  private inferItemType;
428
+ /**
429
+ * Identity comes from how a field is NAMED, not from what the app
430
+ * sells: `id`/`uuid`/`key`/`slug` are conventions any codebase uses,
431
+ * `name`/`title`/`email` are how any row introduces itself. `plate`
432
+ * used to sit in this list and read like one of them — but it is the
433
+ * example app's schema, and no other tenant ever got its equivalent
434
+ * (`mrn`, `trackingNumber`, `sku`) added here.
435
+ */
428
436
  private inferIdentityFields;
429
437
  private inferSearchField;
430
438
  /**
@@ -457,6 +465,26 @@ declare class NavigationAnalyzer {
457
465
  private findNavigationFiles;
458
466
  /** Parse navigator definitions from a file */
459
467
  private parseNavigators;
468
+ /**
469
+ * Is this JSX element `<navigatorVarName.MEMBER …>`?
470
+ */
471
+ private isNavigatorMember;
472
+ /**
473
+ * Flatten a navigator's JSX children into the `<X.Screen>` elements they
474
+ * contain, unwrapping every container a real app puts in between.
475
+ *
476
+ * The old version compared `t.isJSXElement(child)` against the direct
477
+ * children only. A ternary is a `JSXExpressionContainer`, so an
478
+ * auth-gated root — the modal shape of a commercial app, and the shape
479
+ * of this repo's own `apps/example-app` — contributed ZERO screens to
480
+ * the graph while `appilots sync` reported success (#396).
481
+ *
482
+ * Both branches of a conditional are collected on purpose. The graph is
483
+ * a design-time map of what routes EXIST, not a prediction of which one
484
+ * a given session will render; the agent needs the destination name to
485
+ * be there whether or not the user happens to be logged in right now.
486
+ */
487
+ private collectScreenElements;
460
488
  /** Extract screens from a navigator JSX element */
461
489
  private extractScreensFromNavigator;
462
490
  /** Extract string attribute value from JSX attributes */
@@ -827,9 +855,8 @@ interface LoadManifestResult {
827
855
  declare function loadManifest(rootDir: string, manifestPath?: string): Promise<LoadManifestResult>;
828
856
  /**
829
857
  * Merge a declared manifest's screens on top of analyzer-derived screens.
830
- * The manifest wins on a screen-name conflict (it's the developer's
831
- * explicit, authoritative statement); screens only one side knows about
832
- * pass through unchanged.
858
+ * A screen only one side knows about passes through unchanged; a screen
859
+ * both sides know is merged key by key (see `mergeScreen`).
833
860
  */
834
861
  declare function mergeManifestScreens(analyzerScreens: ScreenDescriptor[], manifestScreens: ScreenDescriptor[] | undefined): ScreenDescriptor[];
835
862
  /**
@@ -1060,6 +1087,12 @@ interface EvalConfig {
1060
1087
  interface ValidationResult {
1061
1088
  valid: boolean;
1062
1089
  errors: string[];
1090
+ /**
1091
+ * Non-fatal problems — today, keys the CLI does not understand. A typo
1092
+ * here is silently ignored at load time and only surfaces much later as
1093
+ * a confusing failure, so it is worth saying out loud.
1094
+ */
1095
+ warnings: string[];
1063
1096
  }
1064
1097
  /**
1065
1098
  * Environment overrides recognized by the CLI. Precedence when loading:
@@ -1079,10 +1112,12 @@ declare function getEnvOverrides(env?: NodeJS.ProcessEnv): EnvOverrides;
1079
1112
  * environment variables (env wins). Works without a .appilotsrc when
1080
1113
  * APPILOTS_API_KEY is set, so CI can run `appilots sync` with env vars only.
1081
1114
  *
1115
+ * @param onWarn Called once per non-fatal problem (unrecognized keys).
1116
+ * Commands pass the logger's `warn`; omitting it keeps loading silent.
1082
1117
  * @returns AppilotsConfig if a file or APPILOTS_API_KEY exists, null otherwise
1083
1118
  * @throws when the file is unparseable or the merged config fails validation
1084
1119
  */
1085
- declare function loadConfig(): AppilotsConfig | null;
1120
+ declare function loadConfig(onWarn?: (message: string) => void): AppilotsConfig | null;
1086
1121
  /**
1087
1122
  * Saves configuration to .appilotsrc in the given directory
1088
1123
  *
@@ -1140,12 +1175,26 @@ declare function formatMetadataWarnings(warnings: MetadataLintWarning[]): string
1140
1175
  interface SyncResult {
1141
1176
  success: boolean;
1142
1177
  unchanged: boolean;
1178
+ /**
1179
+ * Set by the server when an unchanged upload had to re-activate a
1180
+ * document that was stored but not active — i.e. something else (an
1181
+ * older version, a hand-activated document) was in front of the agent.
1182
+ */
1183
+ activated?: boolean;
1143
1184
  id?: string;
1144
1185
  checksum?: string;
1145
1186
  screensCount?: number;
1146
1187
  formsCount?: number;
1147
1188
  actionsCount?: number;
1148
1189
  error?: string;
1190
+ /**
1191
+ * The server's `error.code`, kept structured alongside the rendered
1192
+ * `error` text so callers can branch on the failure instead of
1193
+ * matching substrings. Absent when the failure produced no envelope.
1194
+ */
1195
+ errorCode?: string;
1196
+ /** HTTP status of the failed response; 0 for network/timeout failures. */
1197
+ errorStatus?: number;
1149
1198
  }
1150
1199
  /**
1151
1200
  * One eval scenario as sent to `POST /cli/eval/run`. Shape mirrors the
@@ -1207,11 +1256,21 @@ interface APIClientConfig {
1207
1256
  /** Retries on network errors / 5xx (default 2) */
1208
1257
  maxRetries?: number;
1209
1258
  }
1210
- /**
1211
- * HTTP client for communicating with Appilots API
1212
- */
1213
1259
  declare class AppilotsAPIClient {
1214
- private serverUrl;
1260
+ /**
1261
+ * `serverUrl` with the API's mount prefix resolved — every path below
1262
+ * is relative to THIS, not to the configured origin.
1263
+ *
1264
+ * It used to be the raw `serverUrl` with `/api/v1` hardcoded into each
1265
+ * path, which made the field mean something different here than in the
1266
+ * SDK. Both read the same `.appilotsrc`: the SDK completes the prefix
1267
+ * when it is missing, so `https://api.appilots.com/api/v1` is correct
1268
+ * there — and here that same value produced
1269
+ * `/api/v1/api/v1/cli/sync`, a 404 whose body reads `Route not found`.
1270
+ * Sharing `normalizeApiBaseUrl` is what makes one file mean one thing:
1271
+ * with or without the prefix now works in both.
1272
+ */
1273
+ private baseUrl;
1215
1274
  private apiKey;
1216
1275
  private timeoutMs;
1217
1276
  private maxRetries;
@@ -1256,4 +1315,13 @@ declare class AppilotsAPIClient {
1256
1315
  health(): Promise<boolean>;
1257
1316
  }
1258
1317
 
1259
- export { type ActionDescriptor, type AnalyzerConfig, AppilotsAPIClient, type AppilotsConfig, type AppilotsManifest, ComponentAnalyzer, type ComponentDescriptor, DEFAULT_MANIFEST_FILENAME, DEFAULT_WEB_SCREEN_PATTERNS, type EnvOverrides, type FlowDescriptor, type FlowStepDescriptor, FormAnalyzer, type FormDescriptor, type FormFieldDescriptor, GenericPlatformAnalyzer, type LoadManifestResult, type LocatorDescriptor, type MCPDocument, MCPGenerator, type MCPGeneratorConfig, type MCPGeneratorOptions, type MCPOutput, type MetadataLintWarning, NavigationAnalyzer, type NavigationGraph, type NavigationNode, type NavigatorDescriptor, type ParamDescriptor, type PlatformAnalyzer, type PlatformAnalyzerOptions, type PlatformAnalyzerResult, ReactNativePlatformAnalyzer, ReactWebPlatformAnalyzer, type ScreenAgentHints, ScreenAnalyzer, type ScreenDescriptor, type SignalDescriptor, type StatusResult, type SyncResult, type TargetDescriptor, type WaitPolicyDescriptor, WebNavigationAnalyzer, type WebNavigationResult, type WebRoute, WebScreenAnalyzer, formatMetadataWarnings, getConfigPath, getEnvOverrides, lintActionMetadata, loadConfig, loadManifest, mergeManifestNavigation, mergeManifestScreens, resolvePathToScreen, saveConfig, screenNameFromPath, validateConfig };
1318
+ /**
1319
+ * GENERATED by scripts/release/sync-sdk-versions.mjs — do not edit.
1320
+ *
1321
+ * The version `@appilots/cli` prints for `appilots --version` and in its
1322
+ * banner. Kept identical to package.json by the release flow;
1323
+ * `version.test.ts` fails if the two ever disagree.
1324
+ */
1325
+ declare const CLI_VERSION = "0.11.0";
1326
+
1327
+ export { type ActionDescriptor, type AnalyzerConfig, AppilotsAPIClient, type AppilotsConfig, type AppilotsManifest, CLI_VERSION, ComponentAnalyzer, type ComponentDescriptor, DEFAULT_MANIFEST_FILENAME, DEFAULT_WEB_SCREEN_PATTERNS, type EnvOverrides, type FlowDescriptor, type FlowStepDescriptor, FormAnalyzer, type FormDescriptor, type FormFieldDescriptor, GenericPlatformAnalyzer, type LoadManifestResult, type LocatorDescriptor, type MCPDocument, MCPGenerator, type MCPGeneratorConfig, type MCPGeneratorOptions, type MCPOutput, type MetadataLintWarning, NavigationAnalyzer, type NavigationGraph, type NavigationNode, type NavigatorDescriptor, type ParamDescriptor, type PlatformAnalyzer, type PlatformAnalyzerOptions, type PlatformAnalyzerResult, ReactNativePlatformAnalyzer, ReactWebPlatformAnalyzer, type ScreenAgentHints, ScreenAnalyzer, type ScreenDescriptor, type SignalDescriptor, type StatusResult, type SyncResult, type TargetDescriptor, type WaitPolicyDescriptor, WebNavigationAnalyzer, type WebNavigationResult, type WebRoute, WebScreenAnalyzer, formatMetadataWarnings, getConfigPath, getEnvOverrides, lintActionMetadata, loadConfig, loadManifest, mergeManifestNavigation, mergeManifestScreens, resolvePathToScreen, saveConfig, screenNameFromPath, validateConfig };
package/dist/index.d.ts CHANGED
@@ -425,6 +425,14 @@ declare class ScreenAnalyzer {
425
425
  private extractNavigationParams;
426
426
  private extractItemFields;
427
427
  private inferItemType;
428
+ /**
429
+ * Identity comes from how a field is NAMED, not from what the app
430
+ * sells: `id`/`uuid`/`key`/`slug` are conventions any codebase uses,
431
+ * `name`/`title`/`email` are how any row introduces itself. `plate`
432
+ * used to sit in this list and read like one of them — but it is the
433
+ * example app's schema, and no other tenant ever got its equivalent
434
+ * (`mrn`, `trackingNumber`, `sku`) added here.
435
+ */
428
436
  private inferIdentityFields;
429
437
  private inferSearchField;
430
438
  /**
@@ -457,6 +465,26 @@ declare class NavigationAnalyzer {
457
465
  private findNavigationFiles;
458
466
  /** Parse navigator definitions from a file */
459
467
  private parseNavigators;
468
+ /**
469
+ * Is this JSX element `<navigatorVarName.MEMBER …>`?
470
+ */
471
+ private isNavigatorMember;
472
+ /**
473
+ * Flatten a navigator's JSX children into the `<X.Screen>` elements they
474
+ * contain, unwrapping every container a real app puts in between.
475
+ *
476
+ * The old version compared `t.isJSXElement(child)` against the direct
477
+ * children only. A ternary is a `JSXExpressionContainer`, so an
478
+ * auth-gated root — the modal shape of a commercial app, and the shape
479
+ * of this repo's own `apps/example-app` — contributed ZERO screens to
480
+ * the graph while `appilots sync` reported success (#396).
481
+ *
482
+ * Both branches of a conditional are collected on purpose. The graph is
483
+ * a design-time map of what routes EXIST, not a prediction of which one
484
+ * a given session will render; the agent needs the destination name to
485
+ * be there whether or not the user happens to be logged in right now.
486
+ */
487
+ private collectScreenElements;
460
488
  /** Extract screens from a navigator JSX element */
461
489
  private extractScreensFromNavigator;
462
490
  /** Extract string attribute value from JSX attributes */
@@ -827,9 +855,8 @@ interface LoadManifestResult {
827
855
  declare function loadManifest(rootDir: string, manifestPath?: string): Promise<LoadManifestResult>;
828
856
  /**
829
857
  * Merge a declared manifest's screens on top of analyzer-derived screens.
830
- * The manifest wins on a screen-name conflict (it's the developer's
831
- * explicit, authoritative statement); screens only one side knows about
832
- * pass through unchanged.
858
+ * A screen only one side knows about passes through unchanged; a screen
859
+ * both sides know is merged key by key (see `mergeScreen`).
833
860
  */
834
861
  declare function mergeManifestScreens(analyzerScreens: ScreenDescriptor[], manifestScreens: ScreenDescriptor[] | undefined): ScreenDescriptor[];
835
862
  /**
@@ -1060,6 +1087,12 @@ interface EvalConfig {
1060
1087
  interface ValidationResult {
1061
1088
  valid: boolean;
1062
1089
  errors: string[];
1090
+ /**
1091
+ * Non-fatal problems — today, keys the CLI does not understand. A typo
1092
+ * here is silently ignored at load time and only surfaces much later as
1093
+ * a confusing failure, so it is worth saying out loud.
1094
+ */
1095
+ warnings: string[];
1063
1096
  }
1064
1097
  /**
1065
1098
  * Environment overrides recognized by the CLI. Precedence when loading:
@@ -1079,10 +1112,12 @@ declare function getEnvOverrides(env?: NodeJS.ProcessEnv): EnvOverrides;
1079
1112
  * environment variables (env wins). Works without a .appilotsrc when
1080
1113
  * APPILOTS_API_KEY is set, so CI can run `appilots sync` with env vars only.
1081
1114
  *
1115
+ * @param onWarn Called once per non-fatal problem (unrecognized keys).
1116
+ * Commands pass the logger's `warn`; omitting it keeps loading silent.
1082
1117
  * @returns AppilotsConfig if a file or APPILOTS_API_KEY exists, null otherwise
1083
1118
  * @throws when the file is unparseable or the merged config fails validation
1084
1119
  */
1085
- declare function loadConfig(): AppilotsConfig | null;
1120
+ declare function loadConfig(onWarn?: (message: string) => void): AppilotsConfig | null;
1086
1121
  /**
1087
1122
  * Saves configuration to .appilotsrc in the given directory
1088
1123
  *
@@ -1140,12 +1175,26 @@ declare function formatMetadataWarnings(warnings: MetadataLintWarning[]): string
1140
1175
  interface SyncResult {
1141
1176
  success: boolean;
1142
1177
  unchanged: boolean;
1178
+ /**
1179
+ * Set by the server when an unchanged upload had to re-activate a
1180
+ * document that was stored but not active — i.e. something else (an
1181
+ * older version, a hand-activated document) was in front of the agent.
1182
+ */
1183
+ activated?: boolean;
1143
1184
  id?: string;
1144
1185
  checksum?: string;
1145
1186
  screensCount?: number;
1146
1187
  formsCount?: number;
1147
1188
  actionsCount?: number;
1148
1189
  error?: string;
1190
+ /**
1191
+ * The server's `error.code`, kept structured alongside the rendered
1192
+ * `error` text so callers can branch on the failure instead of
1193
+ * matching substrings. Absent when the failure produced no envelope.
1194
+ */
1195
+ errorCode?: string;
1196
+ /** HTTP status of the failed response; 0 for network/timeout failures. */
1197
+ errorStatus?: number;
1149
1198
  }
1150
1199
  /**
1151
1200
  * One eval scenario as sent to `POST /cli/eval/run`. Shape mirrors the
@@ -1207,11 +1256,21 @@ interface APIClientConfig {
1207
1256
  /** Retries on network errors / 5xx (default 2) */
1208
1257
  maxRetries?: number;
1209
1258
  }
1210
- /**
1211
- * HTTP client for communicating with Appilots API
1212
- */
1213
1259
  declare class AppilotsAPIClient {
1214
- private serverUrl;
1260
+ /**
1261
+ * `serverUrl` with the API's mount prefix resolved — every path below
1262
+ * is relative to THIS, not to the configured origin.
1263
+ *
1264
+ * It used to be the raw `serverUrl` with `/api/v1` hardcoded into each
1265
+ * path, which made the field mean something different here than in the
1266
+ * SDK. Both read the same `.appilotsrc`: the SDK completes the prefix
1267
+ * when it is missing, so `https://api.appilots.com/api/v1` is correct
1268
+ * there — and here that same value produced
1269
+ * `/api/v1/api/v1/cli/sync`, a 404 whose body reads `Route not found`.
1270
+ * Sharing `normalizeApiBaseUrl` is what makes one file mean one thing:
1271
+ * with or without the prefix now works in both.
1272
+ */
1273
+ private baseUrl;
1215
1274
  private apiKey;
1216
1275
  private timeoutMs;
1217
1276
  private maxRetries;
@@ -1256,4 +1315,13 @@ declare class AppilotsAPIClient {
1256
1315
  health(): Promise<boolean>;
1257
1316
  }
1258
1317
 
1259
- export { type ActionDescriptor, type AnalyzerConfig, AppilotsAPIClient, type AppilotsConfig, type AppilotsManifest, ComponentAnalyzer, type ComponentDescriptor, DEFAULT_MANIFEST_FILENAME, DEFAULT_WEB_SCREEN_PATTERNS, type EnvOverrides, type FlowDescriptor, type FlowStepDescriptor, FormAnalyzer, type FormDescriptor, type FormFieldDescriptor, GenericPlatformAnalyzer, type LoadManifestResult, type LocatorDescriptor, type MCPDocument, MCPGenerator, type MCPGeneratorConfig, type MCPGeneratorOptions, type MCPOutput, type MetadataLintWarning, NavigationAnalyzer, type NavigationGraph, type NavigationNode, type NavigatorDescriptor, type ParamDescriptor, type PlatformAnalyzer, type PlatformAnalyzerOptions, type PlatformAnalyzerResult, ReactNativePlatformAnalyzer, ReactWebPlatformAnalyzer, type ScreenAgentHints, ScreenAnalyzer, type ScreenDescriptor, type SignalDescriptor, type StatusResult, type SyncResult, type TargetDescriptor, type WaitPolicyDescriptor, WebNavigationAnalyzer, type WebNavigationResult, type WebRoute, WebScreenAnalyzer, formatMetadataWarnings, getConfigPath, getEnvOverrides, lintActionMetadata, loadConfig, loadManifest, mergeManifestNavigation, mergeManifestScreens, resolvePathToScreen, saveConfig, screenNameFromPath, validateConfig };
1318
+ /**
1319
+ * GENERATED by scripts/release/sync-sdk-versions.mjs — do not edit.
1320
+ *
1321
+ * The version `@appilots/cli` prints for `appilots --version` and in its
1322
+ * banner. Kept identical to package.json by the release flow;
1323
+ * `version.test.ts` fails if the two ever disagree.
1324
+ */
1325
+ declare const CLI_VERSION = "0.11.0";
1326
+
1327
+ export { type ActionDescriptor, type AnalyzerConfig, AppilotsAPIClient, type AppilotsConfig, type AppilotsManifest, CLI_VERSION, ComponentAnalyzer, type ComponentDescriptor, DEFAULT_MANIFEST_FILENAME, DEFAULT_WEB_SCREEN_PATTERNS, type EnvOverrides, type FlowDescriptor, type FlowStepDescriptor, FormAnalyzer, type FormDescriptor, type FormFieldDescriptor, GenericPlatformAnalyzer, type LoadManifestResult, type LocatorDescriptor, type MCPDocument, MCPGenerator, type MCPGeneratorConfig, type MCPGeneratorOptions, type MCPOutput, type MetadataLintWarning, NavigationAnalyzer, type NavigationGraph, type NavigationNode, type NavigatorDescriptor, type ParamDescriptor, type PlatformAnalyzer, type PlatformAnalyzerOptions, type PlatformAnalyzerResult, ReactNativePlatformAnalyzer, ReactWebPlatformAnalyzer, type ScreenAgentHints, ScreenAnalyzer, type ScreenDescriptor, type SignalDescriptor, type StatusResult, type SyncResult, type TargetDescriptor, type WaitPolicyDescriptor, WebNavigationAnalyzer, type WebNavigationResult, type WebRoute, WebScreenAnalyzer, formatMetadataWarnings, getConfigPath, getEnvOverrides, lintActionMetadata, loadConfig, loadManifest, mergeManifestNavigation, mergeManifestScreens, resolvePathToScreen, saveConfig, screenNameFromPath, validateConfig };