Skip to content

Commit d419da1

Browse files
authored
Merge pull request #45 from japer-technology/copilot/include-local-chat-files
Ensure installer includes local chat runtime files
2 parents 86d37ba + a585cb6 commit d419da1

3 files changed

Lines changed: 50 additions & 7 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.3
1+
1.1.4

.github-openclaw-intelligence/lifecycle/preflight.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,18 @@ const openclawDir = resolve(import.meta.dir, "..");
4949
const configDir = resolve(openclawDir, "config");
5050
const piSettingsPath = resolve(openclawDir, ".pi", "settings.json");
5151
const schemaPath = resolve(configDir, "settings.schema.json");
52+
const packageJsonPath = resolve(openclawDir, "package.json");
53+
const localChatLabel = "lifecycle/local-chat.ts";
5254

5355
// ─── Required files ───────────────────────────────────────────────────────────
5456
const 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 ────────────────────────────
7390
if (existsSync(piSettingsPath) && existsSync(schemaPath)) {
7491
try {

.github/workflows/github-openclaw-intelligence-agent.yml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ╔══════════════════════════════════════════════════════════════════════════════╗
2-
# ║ OpenClaw Intelligence — Agent Workflow (Version 1.1.3) ║
2+
# ║ OpenClaw Intelligence — Agent Workflow (Version 1.1.4) ║
33
# ║ ║
44
# ║ A standalone tool-rich AI agent that lives inside your GitHub repository. ║
55
# ║ OpenClaw responds to `@`. ║
@@ -144,9 +144,35 @@ jobs:
144144
unzip -q /tmp/template.zip -d /tmp/template
145145
146146
EXTRACTED=$(ls -d /tmp/template/github-openclaw-intelligence-*)
147+
TEMPLATE_TARGET="$EXTRACTED/$TARGET"
148+
LOCAL_CHAT_ENTRY="lifecycle/local-chat.ts"
149+
150+
missing=false
151+
for required in \
152+
"$LOCAL_CHAT_ENTRY" \
153+
"package.json" \
154+
"bun.lock"; do
155+
if [ ! -f "$TEMPLATE_TARGET/$required" ]; then
156+
echo "::error::Template is missing required local chat file: $required"
157+
missing=true
158+
fi
159+
done
160+
161+
CHAT_SCRIPT=$(jq -r '.scripts.chat // ""' "$TEMPLATE_TARGET/package.json")
162+
case "$CHAT_SCRIPT" in
163+
*"$LOCAL_CHAT_ENTRY"*) ;;
164+
*)
165+
echo "::error::Template package.json chat script must reference $LOCAL_CHAT_ENTRY."
166+
missing=true
167+
;;
168+
esac
169+
170+
if [ "$missing" = true ]; then
171+
exit 1
172+
fi
147173
148-
rm -rf "$EXTRACTED/$TARGET/node_modules"
149-
rm -rf "$EXTRACTED/$TARGET/docs/analysis"
174+
rm -rf "$TEMPLATE_TARGET/node_modules"
175+
rm -rf "$TEMPLATE_TARGET/docs/analysis"
150176
151177
if [ "$ACTION" = "upgrade" ]; then
152178
BACKUP="/tmp/oci-backup"
@@ -158,7 +184,7 @@ jobs:
158184
[ -d "$TARGET/config" ] && cp -R "$TARGET/config" "$BACKUP/config"
159185
160186
rm -rf "$TARGET"
161-
cp -R "$EXTRACTED/$TARGET" "$TARGET"
187+
cp -R "$TEMPLATE_TARGET" "$TARGET"
162188
163189
rm -rf "$TARGET/state"
164190
@@ -173,7 +199,7 @@ jobs:
173199
[ -d "$BACKUP/state" ] && cp -R "$BACKUP/state" "$TARGET/state"
174200
[ -d "$BACKUP/config" ] && cp -R "$BACKUP/config" "$TARGET/config"
175201
else
176-
cp -R "$EXTRACTED/$TARGET" "$TARGET"
202+
cp -R "$TEMPLATE_TARGET" "$TARGET"
177203
178204
rm -rf "$TARGET/state"
179205

0 commit comments

Comments
 (0)