@@ -7,6 +7,7 @@ import { useAppSettings } from "../../appSettings";
77import { APP_DISPLAY_NAME } from "../../branding" ;
88import { isElectron } from "../../env" ;
99import { useHandleNewThread } from "../../hooks/useHandleNewThread" ;
10+ import { resolveImportedProjectScripts } from "../../lib/projectImport" ;
1011import { serverConfigQueryOptions } from "../../lib/serverReactQuery" ;
1112import { newCommandId , newProjectId } from "../../lib/utils" ;
1213import { readNativeApi } from "../../nativeApi" ;
@@ -105,15 +106,25 @@ export function ChatHomeEmptyState() {
105106 const title = pickedPath . split ( / [ / \\ ] / ) . findLast ( ( segment ) => segment . length > 0 ) ?? pickedPath ;
106107 try {
107108 const projectId = newProjectId ( ) ;
109+ const { scripts : projectScripts , warning : packageScriptWarning } =
110+ await resolveImportedProjectScripts ( api , pickedPath ) ;
108111 await api . orchestration . dispatchCommand ( {
109112 type : "project.create" ,
110113 commandId : newCommandId ( ) ,
111114 projectId,
112115 title,
113116 workspaceRoot : pickedPath ,
114117 defaultModel : DEFAULT_MODEL_BY_PROVIDER . codex ,
118+ ...( projectScripts ? { scripts : projectScripts } : { } ) ,
115119 createdAt : new Date ( ) . toISOString ( ) ,
116120 } ) ;
121+ if ( packageScriptWarning ) {
122+ toastManager . add ( {
123+ type : "warning" ,
124+ title : "Project actions need a package manager choice" ,
125+ description : packageScriptWarning ,
126+ } ) ;
127+ }
117128 await handleNewThread ( projectId , {
118129 envMode : appSettings . defaultThreadEnvMode ,
119130 } ) . catch ( ( ) => undefined ) ;
@@ -146,15 +157,25 @@ export function ChatHomeEmptyState() {
146157
147158 const projectId = newProjectId ( ) ;
148159 try {
160+ const { scripts : projectScripts , warning : packageScriptWarning } =
161+ await resolveImportedProjectScripts ( api , result . path ) ;
149162 await api . orchestration . dispatchCommand ( {
150163 type : "project.create" ,
151164 commandId : newCommandId ( ) ,
152165 projectId,
153166 title : result . repoName ,
154167 workspaceRoot : result . path ,
155168 defaultModel : DEFAULT_MODEL_BY_PROVIDER . codex ,
169+ ...( projectScripts ? { scripts : projectScripts } : { } ) ,
156170 createdAt : new Date ( ) . toISOString ( ) ,
157171 } ) ;
172+ if ( packageScriptWarning ) {
173+ toastManager . add ( {
174+ type : "warning" ,
175+ title : "Project actions need a package manager choice" ,
176+ description : packageScriptWarning ,
177+ } ) ;
178+ }
158179 await handleNewThread ( projectId , {
159180 envMode : appSettings . defaultThreadEnvMode ,
160181 } ) . catch ( ( ) => undefined ) ;
0 commit comments