@appilots/cli 0.3.0 → 0.4.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/cli/index.js +1812 -241
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.mts +200 -12
- package/dist/index.d.ts +200 -12
- package/dist/index.js +1594 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1583 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -604,6 +604,189 @@ declare class GenericPlatformAnalyzer implements PlatformAnalyzer {
|
|
|
604
604
|
analyze(_config: AnalyzerConfig, _options: PlatformAnalyzerOptions): Promise<PlatformAnalyzerResult>;
|
|
605
605
|
}
|
|
606
606
|
|
|
607
|
+
/**
|
|
608
|
+
* `PlatformAnalyzer` for React web apps (`.appilotsrc` `platform:
|
|
609
|
+
* "web"`) — source-level inference instead of the manifest-only path
|
|
610
|
+
* `GenericPlatformAnalyzer` provides. Orchestrates:
|
|
611
|
+
*
|
|
612
|
+
* - `WebScreenAnalyzer` — screens, forms, actions, collections from
|
|
613
|
+
* DOM-vocabulary JSX (`onClick`, `data-testid`, `type=`, ...)
|
|
614
|
+
* - `WebNavigationAnalyzer` — a navigation graph from React Router
|
|
615
|
+
* configuration (`createBrowserRouter`, `<Route path element>`)
|
|
616
|
+
*
|
|
617
|
+
* The screen analyzer records navigation targets as ROUTE PATHS
|
|
618
|
+
* (`/vehicles/new`); this orchestrator owns the route table and
|
|
619
|
+
* resolves them to screen names, leaving unresolved paths as-is (still
|
|
620
|
+
* useful to the agent, and valid against the wire schema).
|
|
621
|
+
*
|
|
622
|
+
* Strict-screen filtering (on by default, like RN): a file counts as a
|
|
623
|
+
* screen when it calls `registerScreen()`, matches a screen glob
|
|
624
|
+
* (web defaults: `pages/`, `routes/`, `views/`, `app/`, `*Page`/
|
|
625
|
+
* `*Screen`/`*View`), or its component is rendered by a detected route
|
|
626
|
+
* — that last rule is what "the detected route patterns" adds over
|
|
627
|
+
* static globs.
|
|
628
|
+
*
|
|
629
|
+
* A declared `appilots.manifest.json` still merges ON TOP of this
|
|
630
|
+
* analyzer's output in `MCPGenerator` (manifest wins on a screen-name
|
|
631
|
+
* conflict) — same precedence as every other platform.
|
|
632
|
+
*/
|
|
633
|
+
declare class ReactWebPlatformAnalyzer implements PlatformAnalyzer {
|
|
634
|
+
readonly platform = "web";
|
|
635
|
+
analyze(config: AnalyzerConfig, options: PlatformAnalyzerOptions): Promise<PlatformAnalyzerResult>;
|
|
636
|
+
private isScreen;
|
|
637
|
+
/** Replace route-path references with screen names where the route table resolves them. */
|
|
638
|
+
private resolveRoutePaths;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* One analyzed source file, before strict-screen filtering. The
|
|
643
|
+
* orchestrator (`ReactWebPlatformAnalyzer`) decides inclusion — it also
|
|
644
|
+
* knows the route table, so a file can qualify as a screen by being a
|
|
645
|
+
* route component even when it matches no glob pattern.
|
|
646
|
+
*/
|
|
647
|
+
interface WebScreenCandidate {
|
|
648
|
+
descriptor: ScreenDescriptor;
|
|
649
|
+
hasRegisterScreen: boolean;
|
|
650
|
+
matchesScreenPattern: boolean;
|
|
651
|
+
}
|
|
652
|
+
interface WebScreenAnalysis {
|
|
653
|
+
candidates: WebScreenCandidate[];
|
|
654
|
+
/** Files matched by the include globs (before screen filtering). */
|
|
655
|
+
analyzedFiles: number;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Default glob patterns that identify screen files in a web project —
|
|
659
|
+
* the RN defaults (`*Screen.tsx`, `screens/**`) don't match how web
|
|
660
|
+
* apps are laid out, so the web dialect looks at the conventional
|
|
661
|
+
* page/route/view directories instead.
|
|
662
|
+
*/
|
|
663
|
+
declare const DEFAULT_WEB_SCREEN_PATTERNS: string[];
|
|
664
|
+
/**
|
|
665
|
+
* Web (DOM/JSX) sibling of `ScreenAnalyzer`. Same output contract
|
|
666
|
+
* (`ScreenDescriptor`), web-native vocabulary:
|
|
667
|
+
*
|
|
668
|
+
* - actions come from `onClick`/`onSubmit` (not `onPress`)
|
|
669
|
+
* - locators come from `data-testid`, `id`, `name`, `aria-label`, and
|
|
670
|
+
* `<label htmlFor>` association (plus `appilotsId`, shared with RN)
|
|
671
|
+
* - field types come from `type=` / `inputMode=` (not `keyboardType`)
|
|
672
|
+
* - navigation targets come from React Router (`useNavigate`'s
|
|
673
|
+
* `navigate('/x')`, `<Link to>`, `<Navigate to>`, internal `href`s);
|
|
674
|
+
* they are recorded as ROUTE PATHS here and resolved to screen names
|
|
675
|
+
* by the orchestrator, which owns the route table
|
|
676
|
+
*/
|
|
677
|
+
declare class WebScreenAnalyzer {
|
|
678
|
+
private config;
|
|
679
|
+
private verbose;
|
|
680
|
+
private screenPatterns;
|
|
681
|
+
constructor(config: AnalyzerConfig, options?: {
|
|
682
|
+
screenPatterns?: string[];
|
|
683
|
+
});
|
|
684
|
+
analyze(): Promise<WebScreenAnalysis>;
|
|
685
|
+
analyzeFile(filePath: string): Promise<WebScreenCandidate | null>;
|
|
686
|
+
private detectRegisterScreenCall;
|
|
687
|
+
private extractRegisterScreenMetadata;
|
|
688
|
+
/** Default-exported component name, else the first exported capitalized function. */
|
|
689
|
+
private extractComponentName;
|
|
690
|
+
private extractComponents;
|
|
691
|
+
private collectHtmlForLabels;
|
|
692
|
+
private extractForms;
|
|
693
|
+
private isSubmitElement;
|
|
694
|
+
private extractField;
|
|
695
|
+
private inferInputType;
|
|
696
|
+
private extractSelectOptions;
|
|
697
|
+
private mergeForms;
|
|
698
|
+
private extractActions;
|
|
699
|
+
private extractActionFromElement;
|
|
700
|
+
private mergeActionMetadata;
|
|
701
|
+
private enrichActionsFromHandlers;
|
|
702
|
+
/**
|
|
703
|
+
* Handler behavior via the shared, platform-neutral analyzer
|
|
704
|
+
* (async/await, `.then`, state setters, toasts, destructive verbs)
|
|
705
|
+
* plus the web-only signals: React Router navigation targets and
|
|
706
|
+
* `window.confirm(...)` as the native confirmation dialog.
|
|
707
|
+
*/
|
|
708
|
+
private collectWebHandlerBehaviors;
|
|
709
|
+
private handlerNameFromAttr;
|
|
710
|
+
private extractNavigationTargets;
|
|
711
|
+
private extractCollections;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* A single resolved React Router route: its full URL path and the screen
|
|
716
|
+
* (component) it renders. This is the web analog of a React Navigation
|
|
717
|
+
* `<Stack.Screen name=...>` entry.
|
|
718
|
+
*/
|
|
719
|
+
interface WebRoute {
|
|
720
|
+
/** Full path with parent segments joined, e.g. `/vehicles/:id`. */
|
|
721
|
+
path: string;
|
|
722
|
+
/** Screen name — the route component's name, or derived from the path. */
|
|
723
|
+
screenName: string;
|
|
724
|
+
/** Path params extracted from `:segment` placeholders. */
|
|
725
|
+
params?: ParamDescriptor[];
|
|
726
|
+
/** True for `<Route index>` / `{ index: true }` routes. */
|
|
727
|
+
index?: boolean;
|
|
728
|
+
/**
|
|
729
|
+
* True when this route has child routes — it renders a layout wrapper
|
|
730
|
+
* around them, not a page of its own. A layout route loses to its own
|
|
731
|
+
* `index` child when both resolve to the same path, since the index
|
|
732
|
+
* child is what the user actually lands on.
|
|
733
|
+
*/
|
|
734
|
+
layout?: boolean;
|
|
735
|
+
}
|
|
736
|
+
interface WebNavigationResult {
|
|
737
|
+
graph: NavigationGraph;
|
|
738
|
+
routes: WebRoute[];
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Analyzes React Router route configuration to build a navigation graph
|
|
742
|
+
* — the sibling of `NavigationAnalyzer` (which is 100% react-navigation
|
|
743
|
+
* and never runs for `platform: 'web'`). Understands both declaration
|
|
744
|
+
* styles:
|
|
745
|
+
*
|
|
746
|
+
* - JSX: `<Routes><Route path="/x" element={<X/>}/></Routes>` (nested
|
|
747
|
+
* `<Route>` children join their parent's path)
|
|
748
|
+
* - Object config: `createBrowserRouter([{ path, element, children }])`
|
|
749
|
+
* (also `createHashRouter`, `createMemoryRouter`, `useRoutes`)
|
|
750
|
+
*/
|
|
751
|
+
declare class WebNavigationAnalyzer {
|
|
752
|
+
private config;
|
|
753
|
+
private navigationInclude;
|
|
754
|
+
private navigationExclude;
|
|
755
|
+
constructor(config: AnalyzerConfig, options?: {
|
|
756
|
+
navigationInclude?: string[];
|
|
757
|
+
navigationExclude?: string[];
|
|
758
|
+
});
|
|
759
|
+
analyze(): Promise<WebNavigationResult>;
|
|
760
|
+
/** Files likely to contain route configuration. */
|
|
761
|
+
private findRouteFiles;
|
|
762
|
+
private extractJsxRoutes;
|
|
763
|
+
/** `element={<VehicleList/>}` or `Component={VehicleList}`. */
|
|
764
|
+
private componentNameFromElementAttr;
|
|
765
|
+
private extractObjectRoutes;
|
|
766
|
+
private visitRouteObjects;
|
|
767
|
+
private joinPaths;
|
|
768
|
+
private normalizePath;
|
|
769
|
+
private buildRoute;
|
|
770
|
+
private paramsFromPath;
|
|
771
|
+
/**
|
|
772
|
+
* One entry per path. When several declarations resolve to the same
|
|
773
|
+
* path, keep the one that best describes what the user lands on: a
|
|
774
|
+
* page beats a layout wrapper (an `index` child and its parent layout
|
|
775
|
+
* share a path), and a resolved component name beats a name derived
|
|
776
|
+
* from the path.
|
|
777
|
+
*/
|
|
778
|
+
private dedupeRoutes;
|
|
779
|
+
private buildGraph;
|
|
780
|
+
}
|
|
781
|
+
/** `/vehicles/:id/edit` → `VehiclesIdEdit`; `/` → `Home`. */
|
|
782
|
+
declare function screenNameFromPath(routePath: string): string;
|
|
783
|
+
/**
|
|
784
|
+
* Match a navigated-to concrete path (e.g. `/vehicles/123`) against the
|
|
785
|
+
* route table, honoring `:param` segments. Returns the matched screen
|
|
786
|
+
* name, or undefined.
|
|
787
|
+
*/
|
|
788
|
+
declare function resolvePathToScreen(routes: WebRoute[], target: string): string | undefined;
|
|
789
|
+
|
|
607
790
|
/**
|
|
608
791
|
* Default manifest filename, resolved relative to the project's
|
|
609
792
|
* `rootDir` unless `.appilotsrc`'s `manifestPath` overrides it.
|
|
@@ -735,10 +918,11 @@ interface MCPGeneratorConfig {
|
|
|
735
918
|
exclude?: string[];
|
|
736
919
|
/**
|
|
737
920
|
* Which `PlatformAnalyzer` to run against the source tree. Defaults to
|
|
738
|
-
* `'react-native'` (the existing Babel/JSX analyzer pipeline).
|
|
739
|
-
*
|
|
740
|
-
*
|
|
741
|
-
*
|
|
921
|
+
* `'react-native'` (the existing Babel/JSX analyzer pipeline). `'web'`
|
|
922
|
+
* runs `ReactWebPlatformAnalyzer` (DOM-vocabulary JSX + React Router).
|
|
923
|
+
* Any other value runs `GenericPlatformAnalyzer` — a safe no-op that
|
|
924
|
+
* does no filesystem/AST work — so a platform with no source analyzer
|
|
925
|
+
* yet still produces a valid document from a declared manifest alone.
|
|
742
926
|
*/
|
|
743
927
|
platform?: string;
|
|
744
928
|
/**
|
|
@@ -764,8 +948,10 @@ declare class MCPGenerator {
|
|
|
764
948
|
/**
|
|
765
949
|
* Select the `PlatformAnalyzer` implementation for a `.appilotsrc`
|
|
766
950
|
* `platform` value. `'react-native'` (or unset — the existing default)
|
|
767
|
-
* gets the
|
|
768
|
-
*
|
|
951
|
+
* gets the RN Babel/JSX pipeline; `'web'` gets the React web (DOM +
|
|
952
|
+
* React Router) pipeline; anything else gets the no-op generic
|
|
953
|
+
* analyzer, relying entirely on a declared manifest. The manifest
|
|
954
|
+
* still merges on top of every analyzer's output either way.
|
|
769
955
|
*/
|
|
770
956
|
static createPlatformAnalyzer(platform?: string): PlatformAnalyzer;
|
|
771
957
|
/** Generate MCP documents from the project */
|
|
@@ -836,11 +1022,13 @@ interface AppilotsConfig {
|
|
|
836
1022
|
* Target platform for source analysis (multi-platform prep). Selects
|
|
837
1023
|
* which `PlatformAnalyzer` the generator runs and its default globs.
|
|
838
1024
|
* `'react-native'` (the default when unset) runs the existing
|
|
839
|
-
* Babel/JSX analyzer pipeline.
|
|
840
|
-
*
|
|
841
|
-
*
|
|
842
|
-
*
|
|
843
|
-
*
|
|
1025
|
+
* Babel/JSX analyzer pipeline. `'web'` runs the React web analyzer
|
|
1026
|
+
* (DOM-vocabulary JSX + React Router route discovery). Any other
|
|
1027
|
+
* value (`'android'`, `'ios'`, a custom platform id, ...) runs a
|
|
1028
|
+
* no-op analyzer that does no source parsing — screens for that
|
|
1029
|
+
* platform come entirely from a declared manifest (see
|
|
1030
|
+
* `manifestPath`). Forward-compatible: unknown values degrade
|
|
1031
|
+
* gracefully instead of erroring.
|
|
844
1032
|
*/
|
|
845
1033
|
platform?: string;
|
|
846
1034
|
/**
|
|
@@ -1068,4 +1256,4 @@ declare class AppilotsAPIClient {
|
|
|
1068
1256
|
health(): Promise<boolean>;
|
|
1069
1257
|
}
|
|
1070
1258
|
|
|
1071
|
-
export { type ActionDescriptor, type AnalyzerConfig, AppilotsAPIClient, type AppilotsConfig, type AppilotsManifest, ComponentAnalyzer, type ComponentDescriptor, DEFAULT_MANIFEST_FILENAME, 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, type ScreenAgentHints, ScreenAnalyzer, type ScreenDescriptor, type SignalDescriptor, type StatusResult, type SyncResult, type TargetDescriptor, type WaitPolicyDescriptor, formatMetadataWarnings, getConfigPath, getEnvOverrides, lintActionMetadata, loadConfig, loadManifest, mergeManifestNavigation, mergeManifestScreens, saveConfig, validateConfig };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -604,6 +604,189 @@ declare class GenericPlatformAnalyzer implements PlatformAnalyzer {
|
|
|
604
604
|
analyze(_config: AnalyzerConfig, _options: PlatformAnalyzerOptions): Promise<PlatformAnalyzerResult>;
|
|
605
605
|
}
|
|
606
606
|
|
|
607
|
+
/**
|
|
608
|
+
* `PlatformAnalyzer` for React web apps (`.appilotsrc` `platform:
|
|
609
|
+
* "web"`) — source-level inference instead of the manifest-only path
|
|
610
|
+
* `GenericPlatformAnalyzer` provides. Orchestrates:
|
|
611
|
+
*
|
|
612
|
+
* - `WebScreenAnalyzer` — screens, forms, actions, collections from
|
|
613
|
+
* DOM-vocabulary JSX (`onClick`, `data-testid`, `type=`, ...)
|
|
614
|
+
* - `WebNavigationAnalyzer` — a navigation graph from React Router
|
|
615
|
+
* configuration (`createBrowserRouter`, `<Route path element>`)
|
|
616
|
+
*
|
|
617
|
+
* The screen analyzer records navigation targets as ROUTE PATHS
|
|
618
|
+
* (`/vehicles/new`); this orchestrator owns the route table and
|
|
619
|
+
* resolves them to screen names, leaving unresolved paths as-is (still
|
|
620
|
+
* useful to the agent, and valid against the wire schema).
|
|
621
|
+
*
|
|
622
|
+
* Strict-screen filtering (on by default, like RN): a file counts as a
|
|
623
|
+
* screen when it calls `registerScreen()`, matches a screen glob
|
|
624
|
+
* (web defaults: `pages/`, `routes/`, `views/`, `app/`, `*Page`/
|
|
625
|
+
* `*Screen`/`*View`), or its component is rendered by a detected route
|
|
626
|
+
* — that last rule is what "the detected route patterns" adds over
|
|
627
|
+
* static globs.
|
|
628
|
+
*
|
|
629
|
+
* A declared `appilots.manifest.json` still merges ON TOP of this
|
|
630
|
+
* analyzer's output in `MCPGenerator` (manifest wins on a screen-name
|
|
631
|
+
* conflict) — same precedence as every other platform.
|
|
632
|
+
*/
|
|
633
|
+
declare class ReactWebPlatformAnalyzer implements PlatformAnalyzer {
|
|
634
|
+
readonly platform = "web";
|
|
635
|
+
analyze(config: AnalyzerConfig, options: PlatformAnalyzerOptions): Promise<PlatformAnalyzerResult>;
|
|
636
|
+
private isScreen;
|
|
637
|
+
/** Replace route-path references with screen names where the route table resolves them. */
|
|
638
|
+
private resolveRoutePaths;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* One analyzed source file, before strict-screen filtering. The
|
|
643
|
+
* orchestrator (`ReactWebPlatformAnalyzer`) decides inclusion — it also
|
|
644
|
+
* knows the route table, so a file can qualify as a screen by being a
|
|
645
|
+
* route component even when it matches no glob pattern.
|
|
646
|
+
*/
|
|
647
|
+
interface WebScreenCandidate {
|
|
648
|
+
descriptor: ScreenDescriptor;
|
|
649
|
+
hasRegisterScreen: boolean;
|
|
650
|
+
matchesScreenPattern: boolean;
|
|
651
|
+
}
|
|
652
|
+
interface WebScreenAnalysis {
|
|
653
|
+
candidates: WebScreenCandidate[];
|
|
654
|
+
/** Files matched by the include globs (before screen filtering). */
|
|
655
|
+
analyzedFiles: number;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Default glob patterns that identify screen files in a web project —
|
|
659
|
+
* the RN defaults (`*Screen.tsx`, `screens/**`) don't match how web
|
|
660
|
+
* apps are laid out, so the web dialect looks at the conventional
|
|
661
|
+
* page/route/view directories instead.
|
|
662
|
+
*/
|
|
663
|
+
declare const DEFAULT_WEB_SCREEN_PATTERNS: string[];
|
|
664
|
+
/**
|
|
665
|
+
* Web (DOM/JSX) sibling of `ScreenAnalyzer`. Same output contract
|
|
666
|
+
* (`ScreenDescriptor`), web-native vocabulary:
|
|
667
|
+
*
|
|
668
|
+
* - actions come from `onClick`/`onSubmit` (not `onPress`)
|
|
669
|
+
* - locators come from `data-testid`, `id`, `name`, `aria-label`, and
|
|
670
|
+
* `<label htmlFor>` association (plus `appilotsId`, shared with RN)
|
|
671
|
+
* - field types come from `type=` / `inputMode=` (not `keyboardType`)
|
|
672
|
+
* - navigation targets come from React Router (`useNavigate`'s
|
|
673
|
+
* `navigate('/x')`, `<Link to>`, `<Navigate to>`, internal `href`s);
|
|
674
|
+
* they are recorded as ROUTE PATHS here and resolved to screen names
|
|
675
|
+
* by the orchestrator, which owns the route table
|
|
676
|
+
*/
|
|
677
|
+
declare class WebScreenAnalyzer {
|
|
678
|
+
private config;
|
|
679
|
+
private verbose;
|
|
680
|
+
private screenPatterns;
|
|
681
|
+
constructor(config: AnalyzerConfig, options?: {
|
|
682
|
+
screenPatterns?: string[];
|
|
683
|
+
});
|
|
684
|
+
analyze(): Promise<WebScreenAnalysis>;
|
|
685
|
+
analyzeFile(filePath: string): Promise<WebScreenCandidate | null>;
|
|
686
|
+
private detectRegisterScreenCall;
|
|
687
|
+
private extractRegisterScreenMetadata;
|
|
688
|
+
/** Default-exported component name, else the first exported capitalized function. */
|
|
689
|
+
private extractComponentName;
|
|
690
|
+
private extractComponents;
|
|
691
|
+
private collectHtmlForLabels;
|
|
692
|
+
private extractForms;
|
|
693
|
+
private isSubmitElement;
|
|
694
|
+
private extractField;
|
|
695
|
+
private inferInputType;
|
|
696
|
+
private extractSelectOptions;
|
|
697
|
+
private mergeForms;
|
|
698
|
+
private extractActions;
|
|
699
|
+
private extractActionFromElement;
|
|
700
|
+
private mergeActionMetadata;
|
|
701
|
+
private enrichActionsFromHandlers;
|
|
702
|
+
/**
|
|
703
|
+
* Handler behavior via the shared, platform-neutral analyzer
|
|
704
|
+
* (async/await, `.then`, state setters, toasts, destructive verbs)
|
|
705
|
+
* plus the web-only signals: React Router navigation targets and
|
|
706
|
+
* `window.confirm(...)` as the native confirmation dialog.
|
|
707
|
+
*/
|
|
708
|
+
private collectWebHandlerBehaviors;
|
|
709
|
+
private handlerNameFromAttr;
|
|
710
|
+
private extractNavigationTargets;
|
|
711
|
+
private extractCollections;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* A single resolved React Router route: its full URL path and the screen
|
|
716
|
+
* (component) it renders. This is the web analog of a React Navigation
|
|
717
|
+
* `<Stack.Screen name=...>` entry.
|
|
718
|
+
*/
|
|
719
|
+
interface WebRoute {
|
|
720
|
+
/** Full path with parent segments joined, e.g. `/vehicles/:id`. */
|
|
721
|
+
path: string;
|
|
722
|
+
/** Screen name — the route component's name, or derived from the path. */
|
|
723
|
+
screenName: string;
|
|
724
|
+
/** Path params extracted from `:segment` placeholders. */
|
|
725
|
+
params?: ParamDescriptor[];
|
|
726
|
+
/** True for `<Route index>` / `{ index: true }` routes. */
|
|
727
|
+
index?: boolean;
|
|
728
|
+
/**
|
|
729
|
+
* True when this route has child routes — it renders a layout wrapper
|
|
730
|
+
* around them, not a page of its own. A layout route loses to its own
|
|
731
|
+
* `index` child when both resolve to the same path, since the index
|
|
732
|
+
* child is what the user actually lands on.
|
|
733
|
+
*/
|
|
734
|
+
layout?: boolean;
|
|
735
|
+
}
|
|
736
|
+
interface WebNavigationResult {
|
|
737
|
+
graph: NavigationGraph;
|
|
738
|
+
routes: WebRoute[];
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Analyzes React Router route configuration to build a navigation graph
|
|
742
|
+
* — the sibling of `NavigationAnalyzer` (which is 100% react-navigation
|
|
743
|
+
* and never runs for `platform: 'web'`). Understands both declaration
|
|
744
|
+
* styles:
|
|
745
|
+
*
|
|
746
|
+
* - JSX: `<Routes><Route path="/x" element={<X/>}/></Routes>` (nested
|
|
747
|
+
* `<Route>` children join their parent's path)
|
|
748
|
+
* - Object config: `createBrowserRouter([{ path, element, children }])`
|
|
749
|
+
* (also `createHashRouter`, `createMemoryRouter`, `useRoutes`)
|
|
750
|
+
*/
|
|
751
|
+
declare class WebNavigationAnalyzer {
|
|
752
|
+
private config;
|
|
753
|
+
private navigationInclude;
|
|
754
|
+
private navigationExclude;
|
|
755
|
+
constructor(config: AnalyzerConfig, options?: {
|
|
756
|
+
navigationInclude?: string[];
|
|
757
|
+
navigationExclude?: string[];
|
|
758
|
+
});
|
|
759
|
+
analyze(): Promise<WebNavigationResult>;
|
|
760
|
+
/** Files likely to contain route configuration. */
|
|
761
|
+
private findRouteFiles;
|
|
762
|
+
private extractJsxRoutes;
|
|
763
|
+
/** `element={<VehicleList/>}` or `Component={VehicleList}`. */
|
|
764
|
+
private componentNameFromElementAttr;
|
|
765
|
+
private extractObjectRoutes;
|
|
766
|
+
private visitRouteObjects;
|
|
767
|
+
private joinPaths;
|
|
768
|
+
private normalizePath;
|
|
769
|
+
private buildRoute;
|
|
770
|
+
private paramsFromPath;
|
|
771
|
+
/**
|
|
772
|
+
* One entry per path. When several declarations resolve to the same
|
|
773
|
+
* path, keep the one that best describes what the user lands on: a
|
|
774
|
+
* page beats a layout wrapper (an `index` child and its parent layout
|
|
775
|
+
* share a path), and a resolved component name beats a name derived
|
|
776
|
+
* from the path.
|
|
777
|
+
*/
|
|
778
|
+
private dedupeRoutes;
|
|
779
|
+
private buildGraph;
|
|
780
|
+
}
|
|
781
|
+
/** `/vehicles/:id/edit` → `VehiclesIdEdit`; `/` → `Home`. */
|
|
782
|
+
declare function screenNameFromPath(routePath: string): string;
|
|
783
|
+
/**
|
|
784
|
+
* Match a navigated-to concrete path (e.g. `/vehicles/123`) against the
|
|
785
|
+
* route table, honoring `:param` segments. Returns the matched screen
|
|
786
|
+
* name, or undefined.
|
|
787
|
+
*/
|
|
788
|
+
declare function resolvePathToScreen(routes: WebRoute[], target: string): string | undefined;
|
|
789
|
+
|
|
607
790
|
/**
|
|
608
791
|
* Default manifest filename, resolved relative to the project's
|
|
609
792
|
* `rootDir` unless `.appilotsrc`'s `manifestPath` overrides it.
|
|
@@ -735,10 +918,11 @@ interface MCPGeneratorConfig {
|
|
|
735
918
|
exclude?: string[];
|
|
736
919
|
/**
|
|
737
920
|
* Which `PlatformAnalyzer` to run against the source tree. Defaults to
|
|
738
|
-
* `'react-native'` (the existing Babel/JSX analyzer pipeline).
|
|
739
|
-
*
|
|
740
|
-
*
|
|
741
|
-
*
|
|
921
|
+
* `'react-native'` (the existing Babel/JSX analyzer pipeline). `'web'`
|
|
922
|
+
* runs `ReactWebPlatformAnalyzer` (DOM-vocabulary JSX + React Router).
|
|
923
|
+
* Any other value runs `GenericPlatformAnalyzer` — a safe no-op that
|
|
924
|
+
* does no filesystem/AST work — so a platform with no source analyzer
|
|
925
|
+
* yet still produces a valid document from a declared manifest alone.
|
|
742
926
|
*/
|
|
743
927
|
platform?: string;
|
|
744
928
|
/**
|
|
@@ -764,8 +948,10 @@ declare class MCPGenerator {
|
|
|
764
948
|
/**
|
|
765
949
|
* Select the `PlatformAnalyzer` implementation for a `.appilotsrc`
|
|
766
950
|
* `platform` value. `'react-native'` (or unset — the existing default)
|
|
767
|
-
* gets the
|
|
768
|
-
*
|
|
951
|
+
* gets the RN Babel/JSX pipeline; `'web'` gets the React web (DOM +
|
|
952
|
+
* React Router) pipeline; anything else gets the no-op generic
|
|
953
|
+
* analyzer, relying entirely on a declared manifest. The manifest
|
|
954
|
+
* still merges on top of every analyzer's output either way.
|
|
769
955
|
*/
|
|
770
956
|
static createPlatformAnalyzer(platform?: string): PlatformAnalyzer;
|
|
771
957
|
/** Generate MCP documents from the project */
|
|
@@ -836,11 +1022,13 @@ interface AppilotsConfig {
|
|
|
836
1022
|
* Target platform for source analysis (multi-platform prep). Selects
|
|
837
1023
|
* which `PlatformAnalyzer` the generator runs and its default globs.
|
|
838
1024
|
* `'react-native'` (the default when unset) runs the existing
|
|
839
|
-
* Babel/JSX analyzer pipeline.
|
|
840
|
-
*
|
|
841
|
-
*
|
|
842
|
-
*
|
|
843
|
-
*
|
|
1025
|
+
* Babel/JSX analyzer pipeline. `'web'` runs the React web analyzer
|
|
1026
|
+
* (DOM-vocabulary JSX + React Router route discovery). Any other
|
|
1027
|
+
* value (`'android'`, `'ios'`, a custom platform id, ...) runs a
|
|
1028
|
+
* no-op analyzer that does no source parsing — screens for that
|
|
1029
|
+
* platform come entirely from a declared manifest (see
|
|
1030
|
+
* `manifestPath`). Forward-compatible: unknown values degrade
|
|
1031
|
+
* gracefully instead of erroring.
|
|
844
1032
|
*/
|
|
845
1033
|
platform?: string;
|
|
846
1034
|
/**
|
|
@@ -1068,4 +1256,4 @@ declare class AppilotsAPIClient {
|
|
|
1068
1256
|
health(): Promise<boolean>;
|
|
1069
1257
|
}
|
|
1070
1258
|
|
|
1071
|
-
export { type ActionDescriptor, type AnalyzerConfig, AppilotsAPIClient, type AppilotsConfig, type AppilotsManifest, ComponentAnalyzer, type ComponentDescriptor, DEFAULT_MANIFEST_FILENAME, 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, type ScreenAgentHints, ScreenAnalyzer, type ScreenDescriptor, type SignalDescriptor, type StatusResult, type SyncResult, type TargetDescriptor, type WaitPolicyDescriptor, formatMetadataWarnings, getConfigPath, getEnvOverrides, lintActionMetadata, loadConfig, loadManifest, mergeManifestNavigation, mergeManifestScreens, saveConfig, validateConfig };
|
|
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 };
|