@appilots/cli 0.1.0 → 0.3.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 +5683 -355
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.mts +187 -7
- package/dist/index.d.ts +187 -7
- package/dist/index.js +5673 -357
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5663 -353
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -13
package/dist/index.d.mts
CHANGED
|
@@ -519,6 +519,143 @@ declare class FormAnalyzer {
|
|
|
519
519
|
private isFieldRequired;
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
+
/**
|
|
523
|
+
* Options that shape how a `PlatformAnalyzer` walks a project. These mirror
|
|
524
|
+
* the subset of `MCPGeneratorConfig` that today's React Native analyzer
|
|
525
|
+
* set already accepts — kept as a separate options bag (instead of the
|
|
526
|
+
* generator's whole config) so a future non-RN analyzer only needs to
|
|
527
|
+
* implement what's relevant to it.
|
|
528
|
+
*/
|
|
529
|
+
interface PlatformAnalyzerOptions {
|
|
530
|
+
/** §1: Only include files with registerScreen() or matching screen patterns. */
|
|
531
|
+
strictScreens?: boolean;
|
|
532
|
+
/** §1: Custom glob patterns for screen file detection. */
|
|
533
|
+
screenPatterns?: string[];
|
|
534
|
+
/** §5: Additional navigation file patterns (added to defaults). */
|
|
535
|
+
navigationInclude?: string[];
|
|
536
|
+
/** §5: Exclude patterns for navigation analysis. */
|
|
537
|
+
navigationExclude?: string[];
|
|
538
|
+
}
|
|
539
|
+
interface PlatformAnalyzerResult {
|
|
540
|
+
screens: ScreenDescriptor[];
|
|
541
|
+
navigation: NavigationGraph;
|
|
542
|
+
/** Number of source files matched by glob (before screen filtering). */
|
|
543
|
+
analyzedFiles: number;
|
|
544
|
+
/** Number of files excluded by strict screen filtering, when applicable. */
|
|
545
|
+
screensFilteredOut?: number;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Seam `MCPGenerator` consumes to turn a project's source tree into
|
|
549
|
+
* screens + a navigation graph. The React Native implementation
|
|
550
|
+
* (`ReactNativePlatformAnalyzer`) wraps the existing Babel/JSX analyzer
|
|
551
|
+
* pipeline (`ScreenAnalyzer` / `NavigationAnalyzer` / `ComponentAnalyzer` /
|
|
552
|
+
* `FormAnalyzer`) unchanged; a platform with no source-level analyzer yet
|
|
553
|
+
* (or a project with no JS/TSX at all) can use `GenericPlatformAnalyzer`,
|
|
554
|
+
* which is a safe no-op — screens then come entirely from the declared
|
|
555
|
+
* manifest (`appilots.manifest.json`, see `../manifest/loadManifest.ts`).
|
|
556
|
+
*
|
|
557
|
+
* `MCPGenerator` selects an implementation based on `.appilotsrc`'s
|
|
558
|
+
* `platform` field (default `'react-native'`) and merges its output with
|
|
559
|
+
* any declared manifest — the manifest wins on a screen-name conflict.
|
|
560
|
+
*/
|
|
561
|
+
interface PlatformAnalyzer {
|
|
562
|
+
/** Platform identifier this analyzer implements, e.g. `'react-native'`. */
|
|
563
|
+
readonly platform: string;
|
|
564
|
+
analyze(config: AnalyzerConfig, options: PlatformAnalyzerOptions): Promise<PlatformAnalyzerResult>;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Default `PlatformAnalyzer` implementation — the React Native Babel/JSX
|
|
569
|
+
* analyzer pipeline that existed inline in `MCPGenerator` before the
|
|
570
|
+
* platform-analyzer seam was introduced. This is a straight move: the
|
|
571
|
+
* orchestration (run `ScreenAnalyzer` + `NavigationAnalyzer`, glob every
|
|
572
|
+
* source file, run `ComponentAnalyzer` + `FormAnalyzer` per file, merge
|
|
573
|
+
* their output into each screen's forms/components) is unchanged, so
|
|
574
|
+
* output for existing React Native projects is byte-for-byte identical.
|
|
575
|
+
*/
|
|
576
|
+
declare class ReactNativePlatformAnalyzer implements PlatformAnalyzer {
|
|
577
|
+
readonly platform = "react-native";
|
|
578
|
+
analyze(config: AnalyzerConfig, options: PlatformAnalyzerOptions): Promise<PlatformAnalyzerResult>;
|
|
579
|
+
private mergeForm;
|
|
580
|
+
private findEquivalentField;
|
|
581
|
+
private mergeField;
|
|
582
|
+
private namedSubmitAction;
|
|
583
|
+
private isWeakInferredFieldName;
|
|
584
|
+
private findFormWithSharedFields;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* `PlatformAnalyzer` for a platform with no source-level analyzer yet
|
|
589
|
+
* (anything other than `'react-native'` — Android/Kotlin, iOS/Swift, a
|
|
590
|
+
* web SPA, ...). It does zero filesystem work — no glob, no parsing — so
|
|
591
|
+
* it's safe to run on a project that has no JS/TSX at all. Screens for
|
|
592
|
+
* these platforms come entirely from the declared manifest
|
|
593
|
+
* (`appilots.manifest.json`); `MCPGenerator` merges the manifest on top
|
|
594
|
+
* of whatever this analyzer returns (nothing).
|
|
595
|
+
*
|
|
596
|
+
* This keeps the manifest-only integration path (deliverable §2) fully
|
|
597
|
+
* decoupled from `react-native`-specific tooling: a new platform can
|
|
598
|
+
* ship its own generator days before anyone writes a real AST analyzer
|
|
599
|
+
* for it.
|
|
600
|
+
*/
|
|
601
|
+
declare class GenericPlatformAnalyzer implements PlatformAnalyzer {
|
|
602
|
+
readonly platform: string;
|
|
603
|
+
constructor(platform: string);
|
|
604
|
+
analyze(_config: AnalyzerConfig, _options: PlatformAnalyzerOptions): Promise<PlatformAnalyzerResult>;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Default manifest filename, resolved relative to the project's
|
|
609
|
+
* `rootDir` unless `.appilotsrc`'s `manifestPath` overrides it.
|
|
610
|
+
*/
|
|
611
|
+
declare const DEFAULT_MANIFEST_FILENAME = "appilots.manifest.json";
|
|
612
|
+
/**
|
|
613
|
+
* A declared, hand-authored (or externally generated) application
|
|
614
|
+
* structure map — the manifest-mode integration path for any platform
|
|
615
|
+
* that doesn't have a source-level `PlatformAnalyzer` yet. Screens here
|
|
616
|
+
* use the exact same `ScreenDescriptor` shape the AST analyzers produce
|
|
617
|
+
* (validated against `@appilots/shared`'s `screenDescriptorSchema`, the
|
|
618
|
+
* same schema the formal `MCPDocument` wire contract uses), so a
|
|
619
|
+
* manifest and an AST-derived screen merge without any shape
|
|
620
|
+
* translation.
|
|
621
|
+
*/
|
|
622
|
+
interface AppilotsManifest {
|
|
623
|
+
/** Informational; not the MCPDocument's own `version` field. */
|
|
624
|
+
version?: string;
|
|
625
|
+
screens: ScreenDescriptor[];
|
|
626
|
+
/** Optional — merged into the analyzer-derived navigation graph. */
|
|
627
|
+
navigation?: Partial<NavigationGraph>;
|
|
628
|
+
}
|
|
629
|
+
interface LoadManifestResult {
|
|
630
|
+
/** `null` when no manifest file exists at the resolved path — not an error. */
|
|
631
|
+
manifest: AppilotsManifest | null;
|
|
632
|
+
/** Absolute path the manifest was (or would be) read from. */
|
|
633
|
+
resolvedPath: string;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Resolve and load `appilots.manifest.json` (or `manifestPath` from
|
|
637
|
+
* `.appilotsrc`) from `rootDir`. Returns `{ manifest: null }` when the
|
|
638
|
+
* file doesn't exist — manifest mode is opt-in, not required — but
|
|
639
|
+
* throws a descriptive error when the file exists and is unparseable
|
|
640
|
+
* JSON or fails `screenDescriptorSchema`/`navigationGraphSchema`
|
|
641
|
+
* validation, so a typo'd manifest fails loudly instead of silently
|
|
642
|
+
* contributing zero screens.
|
|
643
|
+
*/
|
|
644
|
+
declare function loadManifest(rootDir: string, manifestPath?: string): Promise<LoadManifestResult>;
|
|
645
|
+
/**
|
|
646
|
+
* Merge a declared manifest's screens on top of analyzer-derived screens.
|
|
647
|
+
* The manifest wins on a screen-name conflict (it's the developer's
|
|
648
|
+
* explicit, authoritative statement); screens only one side knows about
|
|
649
|
+
* pass through unchanged.
|
|
650
|
+
*/
|
|
651
|
+
declare function mergeManifestScreens(analyzerScreens: ScreenDescriptor[], manifestScreens: ScreenDescriptor[] | undefined): ScreenDescriptor[];
|
|
652
|
+
/**
|
|
653
|
+
* Merge a declared manifest's (partial) navigation graph on top of the
|
|
654
|
+
* analyzer-derived one. Manifest entries win per-key; arrays are
|
|
655
|
+
* concatenated (manifest navigators appended after analyzer ones).
|
|
656
|
+
*/
|
|
657
|
+
declare function mergeManifestNavigation(analyzerNavigation: NavigationGraph, manifestNavigation: Partial<NavigationGraph> | undefined): NavigationGraph;
|
|
658
|
+
|
|
522
659
|
interface MCPGeneratorOptions {
|
|
523
660
|
/** Output format (only 'json' supported currently) */
|
|
524
661
|
format: 'json';
|
|
@@ -596,12 +733,41 @@ interface MCPGeneratorConfig {
|
|
|
596
733
|
include?: string[];
|
|
597
734
|
/** Source exclude patterns */
|
|
598
735
|
exclude?: string[];
|
|
736
|
+
/**
|
|
737
|
+
* Which `PlatformAnalyzer` to run against the source tree. Defaults to
|
|
738
|
+
* `'react-native'` (the existing Babel/JSX analyzer pipeline). Any
|
|
739
|
+
* other value runs `GenericPlatformAnalyzer` — a safe no-op that does
|
|
740
|
+
* no filesystem/AST work — so a platform with no source analyzer yet
|
|
741
|
+
* still produces a valid document from a declared manifest alone.
|
|
742
|
+
*/
|
|
743
|
+
platform?: string;
|
|
744
|
+
/**
|
|
745
|
+
* Optional custom analyzer instance, mainly for tests. When set,
|
|
746
|
+
* `platform` is ignored for analyzer selection (but still recorded).
|
|
747
|
+
*/
|
|
748
|
+
platformAnalyzer?: PlatformAnalyzer;
|
|
749
|
+
/**
|
|
750
|
+
* Path to a declared `appilots.manifest.json`, relative to `rootDir`
|
|
751
|
+
* unless absolute. Defaults to `appilots.manifest.json` at the project
|
|
752
|
+
* root. Manifest screens merge on top of analyzer-derived screens,
|
|
753
|
+
* winning on a screen-name conflict. Missing file is not an error —
|
|
754
|
+
* manifest mode is opt-in.
|
|
755
|
+
*/
|
|
756
|
+
manifestPath?: string;
|
|
599
757
|
}
|
|
600
758
|
declare class MCPGenerator {
|
|
601
759
|
private analyzerConfig;
|
|
602
760
|
private options;
|
|
603
761
|
private generatorConfig;
|
|
762
|
+
private platformAnalyzer;
|
|
604
763
|
constructor(config: MCPGeneratorConfig);
|
|
764
|
+
/**
|
|
765
|
+
* Select the `PlatformAnalyzer` implementation for a `.appilotsrc`
|
|
766
|
+
* `platform` value. `'react-native'` (or unset — the existing default)
|
|
767
|
+
* gets the real Babel/JSX pipeline; anything else gets the no-op
|
|
768
|
+
* generic analyzer, relying entirely on a declared manifest.
|
|
769
|
+
*/
|
|
770
|
+
static createPlatformAnalyzer(platform?: string): PlatformAnalyzer;
|
|
605
771
|
/** Generate MCP documents from the project */
|
|
606
772
|
generate(): Promise<MCPOutput>;
|
|
607
773
|
/**
|
|
@@ -617,12 +783,6 @@ declare class MCPGenerator {
|
|
|
617
783
|
* Calculate SHA-256 checksum of content
|
|
618
784
|
*/
|
|
619
785
|
private calculateChecksum;
|
|
620
|
-
private mergeForm;
|
|
621
|
-
private findEquivalentField;
|
|
622
|
-
private mergeField;
|
|
623
|
-
private namedSubmitAction;
|
|
624
|
-
private isWeakInferredFieldName;
|
|
625
|
-
private findFormWithSharedFields;
|
|
626
786
|
/**
|
|
627
787
|
* Get project name and version from package.json in rootDir
|
|
628
788
|
*/
|
|
@@ -672,6 +832,26 @@ interface AppilotsConfig {
|
|
|
672
832
|
* Glob patterns to exclude from navigation analysis (§5).
|
|
673
833
|
*/
|
|
674
834
|
navigationExclude?: string[];
|
|
835
|
+
/**
|
|
836
|
+
* Target platform for source analysis (multi-platform prep). Selects
|
|
837
|
+
* which `PlatformAnalyzer` the generator runs and its default globs.
|
|
838
|
+
* `'react-native'` (the default when unset) runs the existing
|
|
839
|
+
* Babel/JSX analyzer pipeline. Any other value (`'web'`, `'android'`,
|
|
840
|
+
* `'ios'`, a custom platform id, ...) runs a no-op analyzer that does
|
|
841
|
+
* no source parsing — screens for that platform come entirely from a
|
|
842
|
+
* declared manifest (see `manifestPath`). Forward-compatible: unknown
|
|
843
|
+
* values degrade gracefully instead of erroring.
|
|
844
|
+
*/
|
|
845
|
+
platform?: string;
|
|
846
|
+
/**
|
|
847
|
+
* Path to a declared `appilots.manifest.json`, relative to the
|
|
848
|
+
* project root unless absolute. Screens declared here (in the same
|
|
849
|
+
* `ScreenDescriptor` shape the analyzers produce) merge on top of
|
|
850
|
+
* analyzer-derived screens, winning on a name conflict. Default:
|
|
851
|
+
* `appilots.manifest.json` at the project root. A missing file is not
|
|
852
|
+
* an error — manifest mode is opt-in.
|
|
853
|
+
*/
|
|
854
|
+
manifestPath?: string;
|
|
675
855
|
/** `appilots eval` settings — see docs: Testing your agent between releases. */
|
|
676
856
|
eval?: EvalConfig;
|
|
677
857
|
}
|
|
@@ -888,4 +1068,4 @@ declare class AppilotsAPIClient {
|
|
|
888
1068
|
health(): Promise<boolean>;
|
|
889
1069
|
}
|
|
890
1070
|
|
|
891
|
-
export { type ActionDescriptor, type AnalyzerConfig, AppilotsAPIClient, type AppilotsConfig, ComponentAnalyzer, type ComponentDescriptor, type EnvOverrides, type FlowDescriptor, type FlowStepDescriptor, FormAnalyzer, type FormDescriptor, type FormFieldDescriptor, type LocatorDescriptor, type MCPDocument, MCPGenerator, type MCPGeneratorConfig, type MCPGeneratorOptions, type MCPOutput, type MetadataLintWarning, NavigationAnalyzer, type NavigationGraph, type NavigationNode, type NavigatorDescriptor, type ParamDescriptor, type ScreenAgentHints, ScreenAnalyzer, type ScreenDescriptor, type SignalDescriptor, type StatusResult, type SyncResult, type TargetDescriptor, type WaitPolicyDescriptor, formatMetadataWarnings, getConfigPath, getEnvOverrides, lintActionMetadata, loadConfig, saveConfig, validateConfig };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -519,6 +519,143 @@ declare class FormAnalyzer {
|
|
|
519
519
|
private isFieldRequired;
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
+
/**
|
|
523
|
+
* Options that shape how a `PlatformAnalyzer` walks a project. These mirror
|
|
524
|
+
* the subset of `MCPGeneratorConfig` that today's React Native analyzer
|
|
525
|
+
* set already accepts — kept as a separate options bag (instead of the
|
|
526
|
+
* generator's whole config) so a future non-RN analyzer only needs to
|
|
527
|
+
* implement what's relevant to it.
|
|
528
|
+
*/
|
|
529
|
+
interface PlatformAnalyzerOptions {
|
|
530
|
+
/** §1: Only include files with registerScreen() or matching screen patterns. */
|
|
531
|
+
strictScreens?: boolean;
|
|
532
|
+
/** §1: Custom glob patterns for screen file detection. */
|
|
533
|
+
screenPatterns?: string[];
|
|
534
|
+
/** §5: Additional navigation file patterns (added to defaults). */
|
|
535
|
+
navigationInclude?: string[];
|
|
536
|
+
/** §5: Exclude patterns for navigation analysis. */
|
|
537
|
+
navigationExclude?: string[];
|
|
538
|
+
}
|
|
539
|
+
interface PlatformAnalyzerResult {
|
|
540
|
+
screens: ScreenDescriptor[];
|
|
541
|
+
navigation: NavigationGraph;
|
|
542
|
+
/** Number of source files matched by glob (before screen filtering). */
|
|
543
|
+
analyzedFiles: number;
|
|
544
|
+
/** Number of files excluded by strict screen filtering, when applicable. */
|
|
545
|
+
screensFilteredOut?: number;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Seam `MCPGenerator` consumes to turn a project's source tree into
|
|
549
|
+
* screens + a navigation graph. The React Native implementation
|
|
550
|
+
* (`ReactNativePlatformAnalyzer`) wraps the existing Babel/JSX analyzer
|
|
551
|
+
* pipeline (`ScreenAnalyzer` / `NavigationAnalyzer` / `ComponentAnalyzer` /
|
|
552
|
+
* `FormAnalyzer`) unchanged; a platform with no source-level analyzer yet
|
|
553
|
+
* (or a project with no JS/TSX at all) can use `GenericPlatformAnalyzer`,
|
|
554
|
+
* which is a safe no-op — screens then come entirely from the declared
|
|
555
|
+
* manifest (`appilots.manifest.json`, see `../manifest/loadManifest.ts`).
|
|
556
|
+
*
|
|
557
|
+
* `MCPGenerator` selects an implementation based on `.appilotsrc`'s
|
|
558
|
+
* `platform` field (default `'react-native'`) and merges its output with
|
|
559
|
+
* any declared manifest — the manifest wins on a screen-name conflict.
|
|
560
|
+
*/
|
|
561
|
+
interface PlatformAnalyzer {
|
|
562
|
+
/** Platform identifier this analyzer implements, e.g. `'react-native'`. */
|
|
563
|
+
readonly platform: string;
|
|
564
|
+
analyze(config: AnalyzerConfig, options: PlatformAnalyzerOptions): Promise<PlatformAnalyzerResult>;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Default `PlatformAnalyzer` implementation — the React Native Babel/JSX
|
|
569
|
+
* analyzer pipeline that existed inline in `MCPGenerator` before the
|
|
570
|
+
* platform-analyzer seam was introduced. This is a straight move: the
|
|
571
|
+
* orchestration (run `ScreenAnalyzer` + `NavigationAnalyzer`, glob every
|
|
572
|
+
* source file, run `ComponentAnalyzer` + `FormAnalyzer` per file, merge
|
|
573
|
+
* their output into each screen's forms/components) is unchanged, so
|
|
574
|
+
* output for existing React Native projects is byte-for-byte identical.
|
|
575
|
+
*/
|
|
576
|
+
declare class ReactNativePlatformAnalyzer implements PlatformAnalyzer {
|
|
577
|
+
readonly platform = "react-native";
|
|
578
|
+
analyze(config: AnalyzerConfig, options: PlatformAnalyzerOptions): Promise<PlatformAnalyzerResult>;
|
|
579
|
+
private mergeForm;
|
|
580
|
+
private findEquivalentField;
|
|
581
|
+
private mergeField;
|
|
582
|
+
private namedSubmitAction;
|
|
583
|
+
private isWeakInferredFieldName;
|
|
584
|
+
private findFormWithSharedFields;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* `PlatformAnalyzer` for a platform with no source-level analyzer yet
|
|
589
|
+
* (anything other than `'react-native'` — Android/Kotlin, iOS/Swift, a
|
|
590
|
+
* web SPA, ...). It does zero filesystem work — no glob, no parsing — so
|
|
591
|
+
* it's safe to run on a project that has no JS/TSX at all. Screens for
|
|
592
|
+
* these platforms come entirely from the declared manifest
|
|
593
|
+
* (`appilots.manifest.json`); `MCPGenerator` merges the manifest on top
|
|
594
|
+
* of whatever this analyzer returns (nothing).
|
|
595
|
+
*
|
|
596
|
+
* This keeps the manifest-only integration path (deliverable §2) fully
|
|
597
|
+
* decoupled from `react-native`-specific tooling: a new platform can
|
|
598
|
+
* ship its own generator days before anyone writes a real AST analyzer
|
|
599
|
+
* for it.
|
|
600
|
+
*/
|
|
601
|
+
declare class GenericPlatformAnalyzer implements PlatformAnalyzer {
|
|
602
|
+
readonly platform: string;
|
|
603
|
+
constructor(platform: string);
|
|
604
|
+
analyze(_config: AnalyzerConfig, _options: PlatformAnalyzerOptions): Promise<PlatformAnalyzerResult>;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Default manifest filename, resolved relative to the project's
|
|
609
|
+
* `rootDir` unless `.appilotsrc`'s `manifestPath` overrides it.
|
|
610
|
+
*/
|
|
611
|
+
declare const DEFAULT_MANIFEST_FILENAME = "appilots.manifest.json";
|
|
612
|
+
/**
|
|
613
|
+
* A declared, hand-authored (or externally generated) application
|
|
614
|
+
* structure map — the manifest-mode integration path for any platform
|
|
615
|
+
* that doesn't have a source-level `PlatformAnalyzer` yet. Screens here
|
|
616
|
+
* use the exact same `ScreenDescriptor` shape the AST analyzers produce
|
|
617
|
+
* (validated against `@appilots/shared`'s `screenDescriptorSchema`, the
|
|
618
|
+
* same schema the formal `MCPDocument` wire contract uses), so a
|
|
619
|
+
* manifest and an AST-derived screen merge without any shape
|
|
620
|
+
* translation.
|
|
621
|
+
*/
|
|
622
|
+
interface AppilotsManifest {
|
|
623
|
+
/** Informational; not the MCPDocument's own `version` field. */
|
|
624
|
+
version?: string;
|
|
625
|
+
screens: ScreenDescriptor[];
|
|
626
|
+
/** Optional — merged into the analyzer-derived navigation graph. */
|
|
627
|
+
navigation?: Partial<NavigationGraph>;
|
|
628
|
+
}
|
|
629
|
+
interface LoadManifestResult {
|
|
630
|
+
/** `null` when no manifest file exists at the resolved path — not an error. */
|
|
631
|
+
manifest: AppilotsManifest | null;
|
|
632
|
+
/** Absolute path the manifest was (or would be) read from. */
|
|
633
|
+
resolvedPath: string;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Resolve and load `appilots.manifest.json` (or `manifestPath` from
|
|
637
|
+
* `.appilotsrc`) from `rootDir`. Returns `{ manifest: null }` when the
|
|
638
|
+
* file doesn't exist — manifest mode is opt-in, not required — but
|
|
639
|
+
* throws a descriptive error when the file exists and is unparseable
|
|
640
|
+
* JSON or fails `screenDescriptorSchema`/`navigationGraphSchema`
|
|
641
|
+
* validation, so a typo'd manifest fails loudly instead of silently
|
|
642
|
+
* contributing zero screens.
|
|
643
|
+
*/
|
|
644
|
+
declare function loadManifest(rootDir: string, manifestPath?: string): Promise<LoadManifestResult>;
|
|
645
|
+
/**
|
|
646
|
+
* Merge a declared manifest's screens on top of analyzer-derived screens.
|
|
647
|
+
* The manifest wins on a screen-name conflict (it's the developer's
|
|
648
|
+
* explicit, authoritative statement); screens only one side knows about
|
|
649
|
+
* pass through unchanged.
|
|
650
|
+
*/
|
|
651
|
+
declare function mergeManifestScreens(analyzerScreens: ScreenDescriptor[], manifestScreens: ScreenDescriptor[] | undefined): ScreenDescriptor[];
|
|
652
|
+
/**
|
|
653
|
+
* Merge a declared manifest's (partial) navigation graph on top of the
|
|
654
|
+
* analyzer-derived one. Manifest entries win per-key; arrays are
|
|
655
|
+
* concatenated (manifest navigators appended after analyzer ones).
|
|
656
|
+
*/
|
|
657
|
+
declare function mergeManifestNavigation(analyzerNavigation: NavigationGraph, manifestNavigation: Partial<NavigationGraph> | undefined): NavigationGraph;
|
|
658
|
+
|
|
522
659
|
interface MCPGeneratorOptions {
|
|
523
660
|
/** Output format (only 'json' supported currently) */
|
|
524
661
|
format: 'json';
|
|
@@ -596,12 +733,41 @@ interface MCPGeneratorConfig {
|
|
|
596
733
|
include?: string[];
|
|
597
734
|
/** Source exclude patterns */
|
|
598
735
|
exclude?: string[];
|
|
736
|
+
/**
|
|
737
|
+
* Which `PlatformAnalyzer` to run against the source tree. Defaults to
|
|
738
|
+
* `'react-native'` (the existing Babel/JSX analyzer pipeline). Any
|
|
739
|
+
* other value runs `GenericPlatformAnalyzer` — a safe no-op that does
|
|
740
|
+
* no filesystem/AST work — so a platform with no source analyzer yet
|
|
741
|
+
* still produces a valid document from a declared manifest alone.
|
|
742
|
+
*/
|
|
743
|
+
platform?: string;
|
|
744
|
+
/**
|
|
745
|
+
* Optional custom analyzer instance, mainly for tests. When set,
|
|
746
|
+
* `platform` is ignored for analyzer selection (but still recorded).
|
|
747
|
+
*/
|
|
748
|
+
platformAnalyzer?: PlatformAnalyzer;
|
|
749
|
+
/**
|
|
750
|
+
* Path to a declared `appilots.manifest.json`, relative to `rootDir`
|
|
751
|
+
* unless absolute. Defaults to `appilots.manifest.json` at the project
|
|
752
|
+
* root. Manifest screens merge on top of analyzer-derived screens,
|
|
753
|
+
* winning on a screen-name conflict. Missing file is not an error —
|
|
754
|
+
* manifest mode is opt-in.
|
|
755
|
+
*/
|
|
756
|
+
manifestPath?: string;
|
|
599
757
|
}
|
|
600
758
|
declare class MCPGenerator {
|
|
601
759
|
private analyzerConfig;
|
|
602
760
|
private options;
|
|
603
761
|
private generatorConfig;
|
|
762
|
+
private platformAnalyzer;
|
|
604
763
|
constructor(config: MCPGeneratorConfig);
|
|
764
|
+
/**
|
|
765
|
+
* Select the `PlatformAnalyzer` implementation for a `.appilotsrc`
|
|
766
|
+
* `platform` value. `'react-native'` (or unset — the existing default)
|
|
767
|
+
* gets the real Babel/JSX pipeline; anything else gets the no-op
|
|
768
|
+
* generic analyzer, relying entirely on a declared manifest.
|
|
769
|
+
*/
|
|
770
|
+
static createPlatformAnalyzer(platform?: string): PlatformAnalyzer;
|
|
605
771
|
/** Generate MCP documents from the project */
|
|
606
772
|
generate(): Promise<MCPOutput>;
|
|
607
773
|
/**
|
|
@@ -617,12 +783,6 @@ declare class MCPGenerator {
|
|
|
617
783
|
* Calculate SHA-256 checksum of content
|
|
618
784
|
*/
|
|
619
785
|
private calculateChecksum;
|
|
620
|
-
private mergeForm;
|
|
621
|
-
private findEquivalentField;
|
|
622
|
-
private mergeField;
|
|
623
|
-
private namedSubmitAction;
|
|
624
|
-
private isWeakInferredFieldName;
|
|
625
|
-
private findFormWithSharedFields;
|
|
626
786
|
/**
|
|
627
787
|
* Get project name and version from package.json in rootDir
|
|
628
788
|
*/
|
|
@@ -672,6 +832,26 @@ interface AppilotsConfig {
|
|
|
672
832
|
* Glob patterns to exclude from navigation analysis (§5).
|
|
673
833
|
*/
|
|
674
834
|
navigationExclude?: string[];
|
|
835
|
+
/**
|
|
836
|
+
* Target platform for source analysis (multi-platform prep). Selects
|
|
837
|
+
* which `PlatformAnalyzer` the generator runs and its default globs.
|
|
838
|
+
* `'react-native'` (the default when unset) runs the existing
|
|
839
|
+
* Babel/JSX analyzer pipeline. Any other value (`'web'`, `'android'`,
|
|
840
|
+
* `'ios'`, a custom platform id, ...) runs a no-op analyzer that does
|
|
841
|
+
* no source parsing — screens for that platform come entirely from a
|
|
842
|
+
* declared manifest (see `manifestPath`). Forward-compatible: unknown
|
|
843
|
+
* values degrade gracefully instead of erroring.
|
|
844
|
+
*/
|
|
845
|
+
platform?: string;
|
|
846
|
+
/**
|
|
847
|
+
* Path to a declared `appilots.manifest.json`, relative to the
|
|
848
|
+
* project root unless absolute. Screens declared here (in the same
|
|
849
|
+
* `ScreenDescriptor` shape the analyzers produce) merge on top of
|
|
850
|
+
* analyzer-derived screens, winning on a name conflict. Default:
|
|
851
|
+
* `appilots.manifest.json` at the project root. A missing file is not
|
|
852
|
+
* an error — manifest mode is opt-in.
|
|
853
|
+
*/
|
|
854
|
+
manifestPath?: string;
|
|
675
855
|
/** `appilots eval` settings — see docs: Testing your agent between releases. */
|
|
676
856
|
eval?: EvalConfig;
|
|
677
857
|
}
|
|
@@ -888,4 +1068,4 @@ declare class AppilotsAPIClient {
|
|
|
888
1068
|
health(): Promise<boolean>;
|
|
889
1069
|
}
|
|
890
1070
|
|
|
891
|
-
export { type ActionDescriptor, type AnalyzerConfig, AppilotsAPIClient, type AppilotsConfig, ComponentAnalyzer, type ComponentDescriptor, type EnvOverrides, type FlowDescriptor, type FlowStepDescriptor, FormAnalyzer, type FormDescriptor, type FormFieldDescriptor, type LocatorDescriptor, type MCPDocument, MCPGenerator, type MCPGeneratorConfig, type MCPGeneratorOptions, type MCPOutput, type MetadataLintWarning, NavigationAnalyzer, type NavigationGraph, type NavigationNode, type NavigatorDescriptor, type ParamDescriptor, type ScreenAgentHints, ScreenAnalyzer, type ScreenDescriptor, type SignalDescriptor, type StatusResult, type SyncResult, type TargetDescriptor, type WaitPolicyDescriptor, formatMetadataWarnings, getConfigPath, getEnvOverrides, lintActionMetadata, loadConfig, saveConfig, validateConfig };
|
|
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 };
|