@@ -49,14 +49,18 @@ const openclawDir = resolve(import.meta.dir, "..");
4949const configDir = resolve ( openclawDir , "config" ) ;
5050const piSettingsPath = resolve ( openclawDir , ".pi" , "settings.json" ) ;
5151const schemaPath = resolve ( configDir , "settings.schema.json" ) ;
52+ const packageJsonPath = resolve ( openclawDir , "package.json" ) ;
53+ const localChatLabel = "lifecycle/local-chat.ts" ;
5254
5355// ─── Required files ───────────────────────────────────────────────────────────
5456const requiredFiles : { path : string ; label : string } [ ] = [
5557 { path : resolve ( openclawDir , "ENABLED.md" ) , label : "ENABLED.md" } ,
5658 { path : piSettingsPath , label : ".pi/settings.json" } ,
5759 { path : resolve ( openclawDir , "lifecycle" , "agent.ts" ) , label : "lifecycle/agent.ts" } ,
5860 { path : resolve ( openclawDir , "lifecycle" , "enabled.ts" ) , label : "lifecycle/enabled.ts" } ,
59- { path : resolve ( openclawDir , "package.json" ) , label : "package.json" } ,
61+ { path : resolve ( openclawDir , localChatLabel ) , label : localChatLabel } ,
62+ { path : resolve ( openclawDir , "bun.lock" ) , label : "bun.lock" } ,
63+ { path : packageJsonPath , label : "package.json" } ,
6064] ;
6165
6266// ─── Collect errors ───────────────────────────────────────────────────────────
@@ -69,6 +73,19 @@ for (const { path: filePath, label } of requiredFiles) {
6973 }
7074}
7175
76+ // ── 1b. Ensure local chat entry point is installed ───────────────────────────
77+ if ( existsSync ( packageJsonPath ) ) {
78+ try {
79+ const packageJson = JSON . parse ( readFileSync ( packageJsonPath , "utf-8" ) ) ;
80+ const chatScript = packageJson ?. scripts ?. chat ;
81+ if ( typeof chatScript !== "string" || ! chatScript . includes ( localChatLabel ) ) {
82+ errors . push ( `package.json: "chat" script must reference ${ localChatLabel } (e.g. "bun run ${ localChatLabel } ")` ) ;
83+ }
84+ } catch ( err ) {
85+ errors . push ( `package.json: invalid JSON (${ err instanceof Error ? err . message : String ( err ) } )` ) ;
86+ }
87+ }
88+
7289// ── 2. Validate settings.json against the schema ────────────────────────────
7390if ( existsSync ( piSettingsPath ) && existsSync ( schemaPath ) ) {
7491 try {
0 commit comments