Skip to content

Commit 49ac61c

Browse files
jlia0claude
andcommitted
fix: tinyoffice office command auto-detect install/build, fix asChild build error
- Detect stale node_modules and .next after tinyclaw update by comparing package.json mtime against node_modules/.package-lock.json and .next/BUILD_ID - Replace asChild prop (unsupported by custom Button) with Link wrapping Button - Use git tag -l instead of for-each-ref for release notes extraction in CI Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8ab5d20 commit 49ac61c

3 files changed

Lines changed: 22 additions & 22 deletions

File tree

.github/workflows/release.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,11 @@ jobs:
118118
id: release_notes
119119
run: |
120120
VERSION="${{ steps.get_version.outputs.version }}"
121-
# Use for-each-ref to reliably get the annotated tag message (not the commit message)
122-
TAG_MESSAGE=$(git for-each-ref --format='%(contents)' "refs/tags/$VERSION")
121+
# git tag -l --format reads the annotated tag object directly,
122+
# unlike for-each-ref which can dereference to the commit in CI
123+
TAG_MESSAGE=$(git tag -l --format='%(contents)' "$VERSION")
123124
if [ -n "$TAG_MESSAGE" ]; then
124-
echo "$TAG_MESSAGE" > release_notes.md
125+
printf '%s\n' "$TAG_MESSAGE" > release_notes.md
125126
else
126127
cat > release_notes.md <<EOF
127128
## TinyClaw $VERSION

tinyclaw.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,20 +252,22 @@ case "${1:-}" in
252252
node "$SCRIPT_DIR/packages/visualizer/dist/chatroom-viewer.js" --team "$CHATROOM_TEAM"
253253
;;
254254
office)
255-
# Install tinyoffice deps if needed
256-
if [ ! -d "$SCRIPT_DIR/tinyoffice/node_modules" ]; then
255+
OFFICE_DIR="$SCRIPT_DIR/tinyoffice"
256+
# Install deps if node_modules missing or package.json changed since last install
257+
if [ ! -d "$OFFICE_DIR/node_modules" ] || \
258+
[ "$OFFICE_DIR/package.json" -nt "$OFFICE_DIR/node_modules/.package-lock.json" ]; then
257259
echo -e "${BLUE}Installing TinyOffice dependencies...${NC}"
258-
(cd "$SCRIPT_DIR/tinyoffice" && npm install)
260+
(cd "$OFFICE_DIR" && npm install) || { echo -e "${RED}Install failed${NC}"; exit 1; }
259261
fi
260-
# Build if .next doesn't exist or source is newer
261-
if [ ! -d "$SCRIPT_DIR/tinyoffice/.next" ] || \
262-
[ -n "$(find "$SCRIPT_DIR/tinyoffice/src" -newer "$SCRIPT_DIR/tinyoffice/.next" -print -quit 2>/dev/null)" ]; then
262+
# Build if .next missing or source/deps changed since last build
263+
if [ ! -f "$OFFICE_DIR/.next/BUILD_ID" ] || \
264+
[ "$OFFICE_DIR/package.json" -nt "$OFFICE_DIR/.next/BUILD_ID" ] || \
265+
[ -n "$(find "$OFFICE_DIR/src" -newer "$OFFICE_DIR/.next/BUILD_ID" -print -quit 2>/dev/null)" ]; then
263266
echo -e "${BLUE}Building TinyOffice...${NC}"
264-
(cd "$SCRIPT_DIR/tinyoffice" && npm run build)
267+
(cd "$OFFICE_DIR" && npm run build) || { echo -e "${RED}Build failed${NC}"; exit 1; }
265268
fi
266-
# Start Next.js production server
267269
echo -e "${GREEN}Starting TinyOffice on http://localhost:3000${NC}"
268-
(cd "$SCRIPT_DIR/tinyoffice" && npm run start)
270+
(cd "$OFFICE_DIR" && npm run start)
269271
;;
270272
pairing)
271273
node "$CLI/pairing.js" "${2:-}" "${3:-}" "${4:-}"

tinyoffice/src/app/settings/page.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ export default function SettingsPage() {
9393
<p className="text-sm text-muted-foreground">
9494
Once setup is complete, you can return here to edit raw settings.
9595
</p>
96-
<Button asChild>
97-
<Link href="/setup">Run Setup</Link>
98-
</Button>
96+
<Link href="/setup">
97+
<Button>Run Setup</Button>
98+
</Link>
9999
</CardContent>
100100
</Card>
101101
</div>
@@ -127,15 +127,12 @@ export default function SettingsPage() {
127127
{errorMsg}
128128
</span>
129129
)}
130-
<Button
131-
variant="outline"
132-
asChild
133-
>
134-
<Link href="/setup" className="inline-flex items-center gap-2">
130+
<Link href="/setup" className="inline-flex items-center gap-2">
131+
<Button variant="outline">
135132
<Wand2 className="h-4 w-4" />
136133
<span>Run Setup</span>
137-
</Link>
138-
</Button>
134+
</Button>
135+
</Link>
139136
<Button onClick={handleSave} disabled={saving || loading}>
140137
{saving ? (
141138
<Loader2 className="h-4 w-4 animate-spin" />

0 commit comments

Comments
 (0)