google-stitch-mcp 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/LICENSE +212 -0
  2. package/README.md +439 -0
  3. package/bin/stitch-mcp.js +2 -0
  4. package/dist/cli.d.ts +1 -0
  5. package/dist/cli.js +130810 -0
  6. package/dist/commands/doctor/command.d.ts +2 -0
  7. package/dist/commands/doctor/context.d.ts +19 -0
  8. package/dist/commands/doctor/handler.d.ts +12 -0
  9. package/dist/commands/doctor/spec.d.ts +130 -0
  10. package/dist/commands/doctor/steps/AdcCheckStep.d.ts +8 -0
  11. package/dist/commands/doctor/steps/ApiCheckStep.d.ts +8 -0
  12. package/dist/commands/doctor/steps/ApiKeyConnectionStep.d.ts +8 -0
  13. package/dist/commands/doctor/steps/ApiKeyDetectedStep.d.ts +8 -0
  14. package/dist/commands/doctor/steps/AuthCheckStep.d.ts +8 -0
  15. package/dist/commands/doctor/steps/GcloudCheckStep.d.ts +8 -0
  16. package/dist/commands/doctor/steps/ProjectCheckStep.d.ts +8 -0
  17. package/dist/commands/init/command.d.ts +2 -0
  18. package/dist/commands/init/context.d.ts +24 -0
  19. package/dist/commands/init/handler.d.ts +19 -0
  20. package/dist/commands/init/spec.d.ts +91 -0
  21. package/dist/commands/init/steps/AuthModeStep.d.ts +8 -0
  22. package/dist/commands/init/steps/AuthStep.d.ts +8 -0
  23. package/dist/commands/init/steps/ClientSelectionStep.d.ts +9 -0
  24. package/dist/commands/init/steps/ConfigStep.d.ts +9 -0
  25. package/dist/commands/init/steps/GcloudInstallStep.d.ts +8 -0
  26. package/dist/commands/init/steps/IamApiStep.d.ts +8 -0
  27. package/dist/commands/init/steps/ProjectSelectStep.d.ts +8 -0
  28. package/dist/commands/init/steps/TestConnectionStep.d.ts +8 -0
  29. package/dist/commands/init/steps/TransportStep.d.ts +9 -0
  30. package/dist/commands/logout/command.d.ts +2 -0
  31. package/dist/commands/logout/context.d.ts +12 -0
  32. package/dist/commands/logout/handler.d.ts +8 -0
  33. package/dist/commands/logout/spec.d.ts +77 -0
  34. package/dist/commands/logout/steps/ClearConfigStep.d.ts +8 -0
  35. package/dist/commands/logout/steps/PrepareStep.d.ts +8 -0
  36. package/dist/commands/logout/steps/RevokeAdcStep.d.ts +9 -0
  37. package/dist/commands/logout/steps/RevokeUserStep.d.ts +9 -0
  38. package/dist/commands/proxy/command.d.ts +2 -0
  39. package/dist/commands/proxy/handler.d.ts +7 -0
  40. package/dist/commands/registry.d.ts +2 -0
  41. package/dist/commands/screens/ScreensView.d.ts +16 -0
  42. package/dist/commands/screens/command.d.ts +2 -0
  43. package/dist/commands/screens/handler.d.ts +24 -0
  44. package/dist/commands/serve/ServeView.d.ts +12 -0
  45. package/dist/commands/serve/command.d.ts +2 -0
  46. package/dist/commands/serve/handler.d.ts +22 -0
  47. package/dist/commands/site/command.d.ts +2 -0
  48. package/dist/commands/site/hooks/useProjectHydration.d.ts +9 -0
  49. package/dist/commands/site/index.d.ts +12 -0
  50. package/dist/commands/site/ui/ScreenList.d.ts +11 -0
  51. package/dist/commands/site/ui/SiteBuilder.d.ts +10 -0
  52. package/dist/commands/site/ui/components/StatusIcon.d.ts +6 -0
  53. package/dist/commands/site/ui/types.d.ts +1 -0
  54. package/dist/commands/site/utils/ProjectSyncer.d.ts +8 -0
  55. package/dist/commands/site/utils/SiteManifest.d.ts +16 -0
  56. package/dist/commands/snapshot/command.d.ts +2 -0
  57. package/dist/commands/snapshot/handler.d.ts +17 -0
  58. package/dist/commands/snapshot/spec.d.ts +39 -0
  59. package/dist/commands/tool/command.d.ts +2 -0
  60. package/dist/commands/tool/context.d.ts +9 -0
  61. package/dist/commands/tool/handler.d.ts +9 -0
  62. package/dist/commands/tool/spec.d.ts +39 -0
  63. package/dist/commands/tool/steps/ExecuteToolStep.d.ts +8 -0
  64. package/dist/commands/tool/steps/ListToolsStep.d.ts +8 -0
  65. package/dist/commands/tool/steps/ParseArgsStep.d.ts +8 -0
  66. package/dist/commands/tool/steps/ShowSchemaStep.d.ts +10 -0
  67. package/dist/commands/tool/steps/ValidateToolStep.d.ts +8 -0
  68. package/dist/commands/tool/virtual-tools/build-site.d.ts +2 -0
  69. package/dist/commands/tool/virtual-tools/get-screen-code.d.ts +2 -0
  70. package/dist/commands/tool/virtual-tools/get-screen-image.d.ts +2 -0
  71. package/dist/commands/tool/virtual-tools/index.d.ts +7 -0
  72. package/dist/commands/tool/virtual-tools/list-tools.d.ts +2 -0
  73. package/dist/commands/view/command.d.ts +2 -0
  74. package/dist/commands/view/handler.d.ts +14 -0
  75. package/dist/framework/CommandDefinition.d.ts +18 -0
  76. package/dist/framework/CommandStep.d.ts +15 -0
  77. package/dist/framework/ConsoleUI.d.ts +14 -0
  78. package/dist/framework/MockUI.d.ts +16 -0
  79. package/dist/framework/StepRunner.d.ts +20 -0
  80. package/dist/framework/UserInterface.d.ts +13 -0
  81. package/dist/index.d.ts +13 -0
  82. package/dist/index.js +23583 -0
  83. package/dist/lib/server/AssetGateway.d.ts +25 -0
  84. package/dist/lib/server/vite/StitchViteServer.d.ts +11 -0
  85. package/dist/lib/server/vite/plugins/virtualContent.d.ts +7 -0
  86. package/dist/lib/services/site/SiteService.d.ts +6 -0
  87. package/dist/lib/services/site/schemas.d.ts +91 -0
  88. package/dist/lib/services/site/types.d.ts +22 -0
  89. package/dist/platform/detector.d.ts +29 -0
  90. package/dist/platform/environment.d.ts +13 -0
  91. package/dist/platform/paths.d.ts +20 -0
  92. package/dist/platform/shell.d.ts +30 -0
  93. package/dist/services/gcloud/handler.d.ts +57 -0
  94. package/dist/services/gcloud/spec.d.ts +408 -0
  95. package/dist/services/mcp-client/MockStitchMCPClient.d.ts +7 -0
  96. package/dist/services/mcp-client/client.d.ts +79 -0
  97. package/dist/services/mcp-client/spec.d.ts +27 -0
  98. package/dist/services/mcp-config/handler.d.ts +13 -0
  99. package/dist/services/mcp-config/spec.d.ts +108 -0
  100. package/dist/services/project/handler.d.ts +11 -0
  101. package/dist/services/project/spec.d.ts +86 -0
  102. package/dist/services/proxy/handler.d.ts +26 -0
  103. package/dist/services/proxy/spec.d.ts +83 -0
  104. package/dist/services/stitch/handler.d.ts +17 -0
  105. package/dist/services/stitch/spec.d.ts +279 -0
  106. package/dist/services/view/handler.d.ts +7 -0
  107. package/dist/services/view/spec.d.ts +66 -0
  108. package/dist/ui/InteractiveViewer.d.ts +17 -0
  109. package/dist/ui/JsonTree.d.ts +12 -0
  110. package/dist/ui/checklist/handler.d.ts +23 -0
  111. package/dist/ui/checklist/spec.d.ts +191 -0
  112. package/dist/ui/checklist.d.ts +54 -0
  113. package/dist/ui/copy-behaviors/clipboard.d.ts +32 -0
  114. package/dist/ui/copy-behaviors/handlers.d.ts +16 -0
  115. package/dist/ui/copy-behaviors/index.d.ts +8 -0
  116. package/dist/ui/copy-behaviors/registry.d.ts +24 -0
  117. package/dist/ui/copy-behaviors/types.d.ts +26 -0
  118. package/dist/ui/navigation-behaviors/index.d.ts +34 -0
  119. package/dist/ui/serve-behaviors/handlers.d.ts +9 -0
  120. package/dist/ui/serve-behaviors/index.d.ts +7 -0
  121. package/dist/ui/serve-behaviors/registry.d.ts +10 -0
  122. package/dist/ui/serve-behaviors/server.d.ts +8 -0
  123. package/dist/ui/serve-behaviors/types.d.ts +18 -0
  124. package/dist/ui/spinner.d.ts +11 -0
  125. package/dist/ui/theme.d.ts +18 -0
  126. package/dist/ui/wizard.d.ts +36 -0
  127. package/package.json +83 -0
@@ -0,0 +1,191 @@
1
+ import { z } from 'zod';
2
+ export declare const ChecklistItemState: z.ZodEnum<["PENDING", "IN_PROGRESS", "COMPLETE", "SKIPPED", "FAILED"]>;
3
+ export type ChecklistItemStateType = z.infer<typeof ChecklistItemState>;
4
+ export declare const ChecklistItemSchema: z.ZodType<ChecklistItem>;
5
+ export type ChecklistItem = {
6
+ id: string;
7
+ label: string;
8
+ children?: ChecklistItem[];
9
+ };
10
+ export declare const ChecklistConfigSchema: z.ZodObject<{
11
+ title: z.ZodDefault<z.ZodString>;
12
+ items: z.ZodArray<z.ZodType<ChecklistItem, z.ZodTypeDef, ChecklistItem>, "many">;
13
+ showProgress: z.ZodDefault<z.ZodBoolean>;
14
+ animationDelayMs: z.ZodDefault<z.ZodNumber>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ title: string;
17
+ items: ChecklistItem[];
18
+ showProgress: boolean;
19
+ animationDelayMs: number;
20
+ }, {
21
+ items: ChecklistItem[];
22
+ title?: string | undefined;
23
+ showProgress?: boolean | undefined;
24
+ animationDelayMs?: number | undefined;
25
+ }>;
26
+ export type ChecklistConfig = z.infer<typeof ChecklistConfigSchema>;
27
+ export declare const UpdateItemInputSchema: z.ZodObject<{
28
+ itemId: z.ZodString;
29
+ state: z.ZodEnum<["PENDING", "IN_PROGRESS", "COMPLETE", "SKIPPED", "FAILED"]>;
30
+ detail: z.ZodOptional<z.ZodString>;
31
+ reason: z.ZodOptional<z.ZodString>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ itemId: string;
34
+ state: "PENDING" | "IN_PROGRESS" | "COMPLETE" | "SKIPPED" | "FAILED";
35
+ detail?: string | undefined;
36
+ reason?: string | undefined;
37
+ }, {
38
+ itemId: string;
39
+ state: "PENDING" | "IN_PROGRESS" | "COMPLETE" | "SKIPPED" | "FAILED";
40
+ detail?: string | undefined;
41
+ reason?: string | undefined;
42
+ }>;
43
+ export type UpdateItemInput = z.infer<typeof UpdateItemInputSchema>;
44
+ export declare const ChecklistErrorCode: z.ZodEnum<["ITEM_NOT_FOUND", "INVALID_STATE_TRANSITION", "RENDER_FAILED", "UNKNOWN_ERROR"]>;
45
+ export declare const RenderSuccess: z.ZodObject<{
46
+ success: z.ZodLiteral<true>;
47
+ data: z.ZodObject<{
48
+ output: z.ZodString;
49
+ completedCount: z.ZodNumber;
50
+ totalCount: z.ZodNumber;
51
+ percentComplete: z.ZodNumber;
52
+ }, "strip", z.ZodTypeAny, {
53
+ output: string;
54
+ completedCount: number;
55
+ totalCount: number;
56
+ percentComplete: number;
57
+ }, {
58
+ output: string;
59
+ completedCount: number;
60
+ totalCount: number;
61
+ percentComplete: number;
62
+ }>;
63
+ }, "strip", z.ZodTypeAny, {
64
+ success: true;
65
+ data: {
66
+ output: string;
67
+ completedCount: number;
68
+ totalCount: number;
69
+ percentComplete: number;
70
+ };
71
+ }, {
72
+ success: true;
73
+ data: {
74
+ output: string;
75
+ completedCount: number;
76
+ totalCount: number;
77
+ percentComplete: number;
78
+ };
79
+ }>;
80
+ export declare const RenderFailure: z.ZodObject<{
81
+ success: z.ZodLiteral<false>;
82
+ error: z.ZodObject<{
83
+ code: z.ZodEnum<["ITEM_NOT_FOUND", "INVALID_STATE_TRANSITION", "RENDER_FAILED", "UNKNOWN_ERROR"]>;
84
+ message: z.ZodString;
85
+ recoverable: z.ZodBoolean;
86
+ }, "strip", z.ZodTypeAny, {
87
+ code: "UNKNOWN_ERROR" | "ITEM_NOT_FOUND" | "INVALID_STATE_TRANSITION" | "RENDER_FAILED";
88
+ message: string;
89
+ recoverable: boolean;
90
+ }, {
91
+ code: "UNKNOWN_ERROR" | "ITEM_NOT_FOUND" | "INVALID_STATE_TRANSITION" | "RENDER_FAILED";
92
+ message: string;
93
+ recoverable: boolean;
94
+ }>;
95
+ }, "strip", z.ZodTypeAny, {
96
+ success: false;
97
+ error: {
98
+ code: "UNKNOWN_ERROR" | "ITEM_NOT_FOUND" | "INVALID_STATE_TRANSITION" | "RENDER_FAILED";
99
+ message: string;
100
+ recoverable: boolean;
101
+ };
102
+ }, {
103
+ success: false;
104
+ error: {
105
+ code: "UNKNOWN_ERROR" | "ITEM_NOT_FOUND" | "INVALID_STATE_TRANSITION" | "RENDER_FAILED";
106
+ message: string;
107
+ recoverable: boolean;
108
+ };
109
+ }>;
110
+ export type RenderResult = z.infer<typeof RenderSuccess> | z.infer<typeof RenderFailure>;
111
+ export declare const UpdateSuccess: z.ZodObject<{
112
+ success: z.ZodLiteral<true>;
113
+ data: z.ZodObject<{
114
+ itemId: z.ZodString;
115
+ previousState: z.ZodEnum<["PENDING", "IN_PROGRESS", "COMPLETE", "SKIPPED", "FAILED"]>;
116
+ newState: z.ZodEnum<["PENDING", "IN_PROGRESS", "COMPLETE", "SKIPPED", "FAILED"]>;
117
+ }, "strip", z.ZodTypeAny, {
118
+ itemId: string;
119
+ previousState: "PENDING" | "IN_PROGRESS" | "COMPLETE" | "SKIPPED" | "FAILED";
120
+ newState: "PENDING" | "IN_PROGRESS" | "COMPLETE" | "SKIPPED" | "FAILED";
121
+ }, {
122
+ itemId: string;
123
+ previousState: "PENDING" | "IN_PROGRESS" | "COMPLETE" | "SKIPPED" | "FAILED";
124
+ newState: "PENDING" | "IN_PROGRESS" | "COMPLETE" | "SKIPPED" | "FAILED";
125
+ }>;
126
+ }, "strip", z.ZodTypeAny, {
127
+ success: true;
128
+ data: {
129
+ itemId: string;
130
+ previousState: "PENDING" | "IN_PROGRESS" | "COMPLETE" | "SKIPPED" | "FAILED";
131
+ newState: "PENDING" | "IN_PROGRESS" | "COMPLETE" | "SKIPPED" | "FAILED";
132
+ };
133
+ }, {
134
+ success: true;
135
+ data: {
136
+ itemId: string;
137
+ previousState: "PENDING" | "IN_PROGRESS" | "COMPLETE" | "SKIPPED" | "FAILED";
138
+ newState: "PENDING" | "IN_PROGRESS" | "COMPLETE" | "SKIPPED" | "FAILED";
139
+ };
140
+ }>;
141
+ export declare const UpdateFailure: z.ZodObject<{
142
+ success: z.ZodLiteral<false>;
143
+ error: z.ZodObject<{
144
+ code: z.ZodEnum<["ITEM_NOT_FOUND", "INVALID_STATE_TRANSITION", "RENDER_FAILED", "UNKNOWN_ERROR"]>;
145
+ message: z.ZodString;
146
+ recoverable: z.ZodBoolean;
147
+ }, "strip", z.ZodTypeAny, {
148
+ code: "UNKNOWN_ERROR" | "ITEM_NOT_FOUND" | "INVALID_STATE_TRANSITION" | "RENDER_FAILED";
149
+ message: string;
150
+ recoverable: boolean;
151
+ }, {
152
+ code: "UNKNOWN_ERROR" | "ITEM_NOT_FOUND" | "INVALID_STATE_TRANSITION" | "RENDER_FAILED";
153
+ message: string;
154
+ recoverable: boolean;
155
+ }>;
156
+ }, "strip", z.ZodTypeAny, {
157
+ success: false;
158
+ error: {
159
+ code: "UNKNOWN_ERROR" | "ITEM_NOT_FOUND" | "INVALID_STATE_TRANSITION" | "RENDER_FAILED";
160
+ message: string;
161
+ recoverable: boolean;
162
+ };
163
+ }, {
164
+ success: false;
165
+ error: {
166
+ code: "UNKNOWN_ERROR" | "ITEM_NOT_FOUND" | "INVALID_STATE_TRANSITION" | "RENDER_FAILED";
167
+ message: string;
168
+ recoverable: boolean;
169
+ };
170
+ }>;
171
+ export type UpdateResult = z.infer<typeof UpdateSuccess> | z.infer<typeof UpdateFailure>;
172
+ export interface ChecklistUI {
173
+ /** Initialize the checklist with items */
174
+ initialize(config: ChecklistConfig): void;
175
+ /** Update an item's state */
176
+ updateItem(input: UpdateItemInput): UpdateResult;
177
+ /** Render the current checklist state to a string */
178
+ render(): RenderResult;
179
+ /** Print the checklist to stdout (with optional in-place update) */
180
+ print(options?: {
181
+ clearPrevious?: boolean;
182
+ }): void;
183
+ /** Get current progress as percentage */
184
+ getProgress(): {
185
+ completed: number;
186
+ total: number;
187
+ percent: number;
188
+ };
189
+ /** Check if all items are complete or skipped */
190
+ isComplete(): boolean;
191
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Result of a verification check
3
+ */
4
+ export interface VerifyResult {
5
+ success: boolean;
6
+ message?: string;
7
+ }
8
+ /**
9
+ * A single step in the checklist
10
+ */
11
+ export interface ChecklistStep {
12
+ id: string;
13
+ title: string;
14
+ command: string;
15
+ instruction?: string;
16
+ verifyCommand?: string[];
17
+ verifyFn?: () => Promise<VerifyResult>;
18
+ env?: Record<string, string>;
19
+ }
20
+ /**
21
+ * Options for running the checklist
22
+ */
23
+ export interface ChecklistOptions {
24
+ autoVerify: boolean;
25
+ startingStepNumber?: number;
26
+ }
27
+ /**
28
+ * Result of running the checklist
29
+ */
30
+ export interface ChecklistResult {
31
+ success: boolean;
32
+ completedSteps: string[];
33
+ failedStep?: string;
34
+ error?: string;
35
+ }
36
+ /**
37
+ * Verify all steps upfront to determine which can be skipped
38
+ */
39
+ export declare function verifyAllSteps(steps: ChecklistStep[], env?: Record<string, string>): Promise<Map<string, VerifyResult>>;
40
+ /**
41
+ * Checklist runner - guides user through steps
42
+ */
43
+ export declare class Checklist {
44
+ private completedSteps;
45
+ private env;
46
+ /**
47
+ * Run the checklist
48
+ */
49
+ run(steps: ChecklistStep[], options: ChecklistOptions): Promise<ChecklistResult>;
50
+ }
51
+ /**
52
+ * Create a new checklist runner
53
+ */
54
+ export declare function createChecklist(): Checklist;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copy text to clipboard
3
+ */
4
+ export declare function copyText(text: string): Promise<void>;
5
+ /**
6
+ * Copy JSON-serialized value to clipboard
7
+ */
8
+ export declare function copyJson(value: any): Promise<void>;
9
+ /**
10
+ * Download an image from URL and copy to clipboard.
11
+ * Uses platform-specific commands for image clipboard.
12
+ */
13
+ /**
14
+ * Download an image from URL.
15
+ */
16
+ export declare function downloadImage(url: string): Promise<ArrayBuffer>;
17
+ /**
18
+ * Download an image from URL and copy to clipboard.
19
+ * Uses platform-specific commands for image clipboard.
20
+ */
21
+ export declare function downloadAndCopyImage(url: string): Promise<void>;
22
+ /**
23
+ * Download text content from URL and copy to clipboard.
24
+ */
25
+ /**
26
+ * Download text content from URL.
27
+ */
28
+ export declare function downloadText(url: string): Promise<string>;
29
+ /**
30
+ * Download text content from URL and copy to clipboard.
31
+ */
32
+ export declare function downloadAndCopyText(url: string): Promise<void>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copy handlers - isolated behavior implementations.
3
+ */
4
+ import type { CopyHandler } from './types.js';
5
+ /**
6
+ * Default handler: copies value on "c", copies {key: value} on "cc"
7
+ */
8
+ export declare const defaultCopyHandler: CopyHandler;
9
+ /**
10
+ * Image URL handler: copies URL on "c", downloads and copies image on "cc"
11
+ */
12
+ export declare const imageUrlCopyHandler: CopyHandler;
13
+ /**
14
+ * HTML code URL handler: copies URL on "c", downloads and copies HTML code on "cc"
15
+ */
16
+ export declare const htmlCodeCopyHandler: CopyHandler;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copy behaviors for JSON viewer.
3
+ * Provides isolated, reusable copy handlers.
4
+ */
5
+ export type { CopyHandler, CopyContext, CopyResult, PathMatcher } from './types.js';
6
+ export { copyText, copyJson, downloadAndCopyImage } from './clipboard.js';
7
+ export { defaultCopyHandler, imageUrlCopyHandler } from './handlers.js';
8
+ export { registerHandler, getHandler, endsWith, contains } from './registry.js';
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Registry for path-based copy handler selection.
3
+ */
4
+ import type { CopyHandler, PathMatcher } from './types.js';
5
+ import { defaultCopyHandler, imageUrlCopyHandler, htmlCodeCopyHandler } from './handlers.js';
6
+ /**
7
+ * Register a handler for paths matching the given pattern.
8
+ * Later registrations take precedence over earlier ones.
9
+ */
10
+ export declare function registerHandler(matcher: PathMatcher, handler: CopyHandler): void;
11
+ /**
12
+ * Get the appropriate handler for a given path.
13
+ * Returns the most recently registered matching handler, or default.
14
+ */
15
+ export declare function getHandler(path: string): CopyHandler;
16
+ /**
17
+ * Create a matcher that checks if path ends with the given suffix.
18
+ */
19
+ export declare function endsWith(suffix: string): PathMatcher;
20
+ /**
21
+ * Create a matcher that checks if path contains the given segment.
22
+ */
23
+ export declare function contains(segment: string): PathMatcher;
24
+ export { defaultCopyHandler, imageUrlCopyHandler, htmlCodeCopyHandler };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copy behavior types for the JSON viewer.
3
+ * Handlers implement this interface to provide custom copy behaviors.
4
+ */
5
+ export interface CopyContext {
6
+ /** The key name of the property */
7
+ key: string;
8
+ /** The value of the property */
9
+ value: any;
10
+ /** Full dot-notation path (e.g., "projects.0.thumbnailScreenshot.downloadUrl") */
11
+ path: string;
12
+ /** Optional callback to show progress during async operations */
13
+ onProgress?: (message: string) => void;
14
+ }
15
+ export interface CopyResult {
16
+ success: boolean;
17
+ message: string;
18
+ }
19
+ export interface CopyHandler {
20
+ /** Handle "c" - single copy (typically just the value) */
21
+ copy(ctx: CopyContext): Promise<CopyResult>;
22
+ /** Handle "cc" - extended copy (typically key+value or special action) */
23
+ copyExtended(ctx: CopyContext): Promise<CopyResult>;
24
+ }
25
+ /** Check if a path matches a pattern (supports glob-like segments) */
26
+ export type PathMatcher = (path: string) => boolean;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Navigation behaviors for the JSON viewer.
3
+ * Handles drill-down navigation into screens and back navigation.
4
+ */
5
+ export interface NavigationContext {
6
+ /** Current selected path */
7
+ path: string;
8
+ /** Current node value */
9
+ value: any;
10
+ /** The key of the node */
11
+ key: string;
12
+ }
13
+ export interface NavigationResult {
14
+ /** Whether navigation should occur */
15
+ shouldNavigate: boolean;
16
+ /** Target resource to navigate to */
17
+ target?: string;
18
+ /** Type of navigation (e.g., 'screen', 'project') */
19
+ type?: string;
20
+ }
21
+ export type NavigationHandler = (ctx: NavigationContext) => NavigationResult;
22
+ /**
23
+ * Detects if the current node is within screenInstances and can navigate to a screen.
24
+ * When on screenInstances[x] or screenInstances[x].sourceScreen, extract the sourceScreen value.
25
+ */
26
+ export declare function screenInstanceNavigationHandler(ctx: NavigationContext): NavigationResult;
27
+ /**
28
+ * Get navigation result for a given context.
29
+ */
30
+ export declare function getNavigationTarget(ctx: NavigationContext): NavigationResult;
31
+ /**
32
+ * Register a custom navigation handler.
33
+ */
34
+ export declare function registerNavigationHandler(handler: NavigationHandler): void;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Serve handlers - isolated behavior implementations.
3
+ */
4
+ import type { ServeHandler } from './types.js';
5
+ import { serveHtmlInMemory } from './server.js';
6
+ export declare const deps: {
7
+ serveHtmlInMemory: typeof serveHtmlInMemory;
8
+ };
9
+ export declare const htmlCodeServeHandler: ServeHandler;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Serve behaviors for JSON viewer.
3
+ */
4
+ export type { ServeHandler, ServeContext, ServeResult, PathMatcher } from './types.js';
5
+ export { serveHtmlInMemory } from './server.js';
6
+ export { htmlCodeServeHandler } from './handlers.js';
7
+ export { registerServeHandler, getServeHandler, endsWith, contains } from './registry.js';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Registry for path-based serve handler selection.
3
+ */
4
+ import type { ServeHandler, PathMatcher } from './types.js';
5
+ import { htmlCodeServeHandler } from './handlers.js';
6
+ export declare function registerServeHandler(matcher: PathMatcher, handler: ServeHandler): void;
7
+ export declare function getServeHandler(path: string): ServeHandler | null;
8
+ export declare function endsWith(suffix: string): PathMatcher;
9
+ export declare function contains(segment: string): PathMatcher;
10
+ export { htmlCodeServeHandler };
@@ -0,0 +1,8 @@
1
+ export interface ServeInstance {
2
+ url: string;
3
+ stop: () => void;
4
+ }
5
+ export declare function serveHtmlInMemory(html: string, options?: {
6
+ timeout?: number;
7
+ openBrowser?: boolean;
8
+ }): Promise<ServeInstance>;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Serve behavior types for the JSON viewer.
3
+ */
4
+ export interface ServeContext {
5
+ key: string;
6
+ value: any;
7
+ path: string;
8
+ onProgress?: (message: string) => void;
9
+ }
10
+ export interface ServeResult {
11
+ success: boolean;
12
+ message: string;
13
+ url?: string;
14
+ }
15
+ export interface ServeHandler {
16
+ serve(ctx: ServeContext): Promise<ServeResult>;
17
+ }
18
+ export type PathMatcher = (path: string) => boolean;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Wrapper for ora spinner with consistent styling
3
+ */
4
+ export declare class Spinner {
5
+ private spinner;
6
+ start(message: string): void;
7
+ succeed(message: string): void;
8
+ fail(message: string): void;
9
+ stop(): void;
10
+ }
11
+ export declare function createSpinner(): Spinner;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Theme colors matching the shell script aesthetic
3
+ */
4
+ export declare const theme: {
5
+ blue: import("chalk").ChalkInstance;
6
+ green: import("chalk").ChalkInstance;
7
+ gray: import("chalk").ChalkInstance;
8
+ red: import("chalk").ChalkInstance;
9
+ yellow: import("chalk").ChalkInstance;
10
+ cyan: import("chalk").ChalkInstance;
11
+ bgDark: import("chalk").ChalkInstance;
12
+ };
13
+ export declare const icons: {
14
+ success: string;
15
+ error: string;
16
+ info: string;
17
+ warning: string;
18
+ };
@@ -0,0 +1,36 @@
1
+ export type McpClient = 'antigravity' | 'vscode' | 'cursor' | 'claude-code' | 'gemini-cli' | 'codex' | 'opencode';
2
+ /**
3
+ * Prompt user to select their MCP client
4
+ */
5
+ export declare function promptMcpClient(): Promise<McpClient>;
6
+ /**
7
+ * Prompt user to select Authentication Mode
8
+ */
9
+ export declare function promptAuthMode(): Promise<'apiKey' | 'oauth'>;
10
+ /**
11
+ * Prompt user to select API Key storage
12
+ */
13
+ export declare function promptApiKeyStorage(): Promise<'.env' | 'config' | 'skip'>;
14
+ /**
15
+ * Prompt user to enter API Key
16
+ */
17
+ export declare function promptApiKey(): Promise<string>;
18
+ /**
19
+ * Prompt user to select from a list of options
20
+ */
21
+ export declare function promptSelect<T extends string>(message: string, choices: Array<{
22
+ name: string;
23
+ value: T;
24
+ }>): Promise<T>;
25
+ /**
26
+ * Prompt user to enter text
27
+ */
28
+ export declare function promptInput(message: string, defaultValue?: string): Promise<string>;
29
+ /**
30
+ * Prompt user for confirmation
31
+ */
32
+ export declare function promptConfirm(message: string, defaultValue?: boolean): Promise<boolean>;
33
+ /**
34
+ * Prompt user to select transport type
35
+ */
36
+ export declare function promptTransportType(authMode?: 'apiKey' | 'oauth'): Promise<'http' | 'stdio'>;
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "google-stitch-mcp",
3
+ "version": "0.3.2",
4
+ "description": "Stitch MCP CLI helper. Automates Google Cloud authentication. Generates MCP config for your client. Sets up a proxy server.",
5
+ "type": "module",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/dongitran/stitch-mcp.git"
12
+ },
13
+ "bin": {
14
+ "stitch-mcp": "./bin/stitch-mcp.js"
15
+ },
16
+ "main": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "import": "./dist/index.js",
21
+ "types": "./dist/index.d.ts"
22
+ }
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "bin",
27
+ "README.md"
28
+ ],
29
+ "scripts": {
30
+ "build": "bun build src/index.ts src/cli.ts --outdir=dist --target=node --format=esm --external lightningcss --external vite --external @astrojs/compiler && tsc -p tsconfig.build.json && bun scripts/generate-bin.ts",
31
+ "dev": "bun run src/cli.ts",
32
+ "test": "bun test --preload ./tests/setup.ts",
33
+ "prepublishOnly": "bun run build",
34
+ "verify-pack": "bun scripts/verify-pack.ts",
35
+ "release": "np"
36
+ },
37
+ "keywords": [],
38
+ "author": "David East",
39
+ "license": "Apache-2.0",
40
+ "dependencies": {
41
+ "@astrojs/compiler": "^2.13.1",
42
+ "@inquirer/prompts": "^8.2.0",
43
+ "@modelcontextprotocol/sdk": "^1.25.2",
44
+ "adm-zip": "^0.5.16",
45
+ "chalk": "^5.6.2",
46
+ "cheerio": "^1.2.0",
47
+ "clipboardy": "^5.2.1",
48
+ "commander": "^12.1.0",
49
+ "dotenv": "^17.2.3",
50
+ "fs-extra": "^11.3.3",
51
+ "ink": "^6.6.0",
52
+ "ink-spinner": "^5.0.0",
53
+ "ink-text-input": "^6.0.0",
54
+ "ora": "^8.1.1",
55
+ "p-limit": "^7.3.0",
56
+ "react": "^19.2.4",
57
+ "vite": "^7.3.1",
58
+ "zod": "^3.24.1"
59
+ },
60
+ "devDependencies": {
61
+ "@happy-dom/global-registrator": "^20.5.0",
62
+ "@testing-library/dom": "^10.4.1",
63
+ "@testing-library/react": "^16.3.2",
64
+ "@types/adm-zip": "^0.5.7",
65
+ "@types/bun": "latest",
66
+ "@types/clipboardy": "^2.0.4",
67
+ "@types/express": "^5.0.6",
68
+ "@types/fs-extra": "^11.0.4",
69
+ "@types/node": "^25.0.9",
70
+ "@types/react": "^19.2.10",
71
+ "happy-dom": "^20.5.0",
72
+ "ink-testing-library": "^4.0.0",
73
+ "jsdom": "^28.0.0",
74
+ "np": "^10.2.0",
75
+ "react-devtools-core": "^6.1.2",
76
+ "signal-exit": "^4.1.0",
77
+ "typescript": "^5.7.3",
78
+ "vitest": "^4.0.18"
79
+ },
80
+ "engines": {
81
+ "node": ">=18.0.0"
82
+ }
83
+ }