diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ea8d16..991a864 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,8 +27,8 @@ jobs: - name: Run type and Svelte checks run: npm run check - - name: Build - run: npm run build + - name: Build release bundles + run: npm run build:release - name: Package release artifacts (smoke) run: bash ./scripts/package-release.sh "v0.0.0-ci" release diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3ce92f3..a29c243 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,8 +27,8 @@ jobs: npm run test npm run check - - name: Build production bundle - run: npm run build + - name: Build release bundles + run: npm run build:release - name: Package release archives run: bash ./scripts/package-release.sh "${GITHUB_REF_NAME}" release diff --git a/.gitignore b/.gitignore index 8a03fc1..cd7e26e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ reference/ .wrangler /.svelte-kit /build +/dist # OS .DS_Store diff --git a/README.md b/README.md index c6cb7ad..f871196 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,8 @@ Open `http://localhost:5173`. - `npm run dev` - local development server. - `npm run build` - production build. +- `npm run build:module` - embeddable module build. +- `npm run build:release` - static app and embeddable module builds for release archives. - `npm run preview` - preview built app. - `npm run cli -- run` - serve built UI via local CLI entrypoint. - `npm run test` - run Vitest suite. @@ -66,7 +68,7 @@ Open `http://localhost:5173`. ## Global CLI Usage -GitHub release artifacts include a runnable CLI bundle with `build/` assets and launchers. +GitHub release artifacts include a runnable CLI bundle with `build/` assets, launchers, and the embeddable `module.js`. After extracting a release archive, put the launcher on your `$PATH`: ```bash diff --git a/docs/operations.md b/docs/operations.md index 2827071..dc92fea 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -6,10 +6,10 @@ npm ci npm run test npm run check -npm run build +npm run build:release ``` -Output is generated into `build/` (static app bundle). +Output is generated into `build/` (static app bundle) and `dist/module.js` (embeddable module). ## Deployment Model @@ -48,7 +48,7 @@ Security expectations: 1. Ensure docs match current runtime behavior. 2. Run `npm run test` and `npm run check`. 3. Manual verification of pairing, chat, approvals, logout. -4. Build production bundle. +4. Build release bundles: `npm run build:release`. 5. Verify CLI startup: `npm run cli -- run --host 127.0.0.1 --port 4173`. 6. Validate release archive layout: `bash ./scripts/package-release.sh vX.Y.Z release && bash ./scripts/verify-release-package.sh vX.Y.Z release`. 7. Tag a release: `git tag vYYYY.M.D && git push origin vYYYY.M.D`. @@ -67,6 +67,8 @@ Each archive contains: - `nullclaw-chat-ui` (Unix launcher) - `nullclaw-chat-ui.cmd` (Windows launcher) - `bin/nullclaw-chat-ui.js` +- `module.js` (embeddable module) +- `nullclaw-chat-ui.css` (embeddable module styles) - `build/` (static app bundle) ## Troubleshooting diff --git a/package.json b/package.json index 62f900a..fbf47e7 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "scripts": { "dev": "vite dev", "build": "vite build", + "build:release": "npm run build && npm run build:module", "preview": "vite preview", "cli": "node ./bin/nullclaw-chat-ui.js", "test": "vitest run", diff --git a/scripts/package-release.sh b/scripts/package-release.sh index 1ea3039..808f3c9 100755 --- a/scripts/package-release.sh +++ b/scripts/package-release.sh @@ -11,6 +11,12 @@ rm -rf "${OUTDIR}" mkdir -p "${PKG_DIR}/bin" cp -R build "${PKG_DIR}/build" +if [[ ! -f dist/module.js ]]; then + echo "Module build output was not found: dist/module.js" >&2 + echo "Run \`npm run build:module\` before packaging release archives." >&2 + exit 1 +fi +cp -R dist/. "${PKG_DIR}/" cp bin/nullclaw-chat-ui.js "${PKG_DIR}/bin/nullclaw-chat-ui.js" cp package.json "${PKG_DIR}/package.json" cp README.md "${PKG_DIR}/README.md" diff --git a/scripts/verify-release-package.sh b/scripts/verify-release-package.sh index 4fcdb38..4023889 100755 --- a/scripts/verify-release-package.sh +++ b/scripts/verify-release-package.sh @@ -57,6 +57,8 @@ required_entries=( "nullclaw-chat-ui/nullclaw-chat-ui" "nullclaw-chat-ui/nullclaw-chat-ui.cmd" "nullclaw-chat-ui/bin/nullclaw-chat-ui.js" + "nullclaw-chat-ui/module.js" + "nullclaw-chat-ui/nullclaw-chat-ui.css" "nullclaw-chat-ui/build/index.html" )