# SkillHub Offline Package

This directory contains an offline deployment bundle for SkillHub and offline
skill packs that can be imported into an already deployed intranet SkillHub.

## What Is Included

- `docker-compose.yaml` and `.env.release`: SkillHub intranet deployment.
- `images/skillhub-images-v0.2.8.tar`: SkillHub server/web/scanner plus base images.
- `images/clawhub-cli-latest.tar`: Docker image containing the official npm `clawhub` CLI.
- `artifacts/github-skills-offline-20260605.tar.gz`: broad GitHub skill import pack.
- `artifacts/devops-testing-skills-offline-20260605.tar.gz`: curated dev/ops/test skill pack.
- `scripts/load-images.sh`: load SkillHub service images.
- `scripts/load-clawhub-cli-image.sh`: load the official `clawhub` CLI image.
- `scripts/load-offline-skill-pack.sh`: unpack any offline skill pack.
- `scripts/deploy-offline-skills.sh`: publish offline skills through the Dockerized official CLI.

For the complete runbook, see [USAGE.md](USAGE.md).

## Quick Start: Deploy SkillHub

On the intranet server:

```bash
sudo mkdir -p /opt/skillhub
sudo cp -r . /opt/skillhub/
cd /opt/skillhub

bash scripts/load-images.sh
docker compose --env-file .env.release -f docker-compose.yaml up -d
docker compose --env-file .env.release -f docker-compose.yaml ps
```

Open the URL configured by `SKILLHUB_PUBLIC_BASE_URL`.

## Quick Start: Publish Dev/Ops/Test Skills

Load the official `clawhub` CLI Docker image:

```bash
cd /opt/skillhub
bash scripts/load-clawhub-cli-image.sh images/clawhub-cli-latest.tar
```

Load and publish the curated dev/ops/test skill pack:

```bash
bash scripts/load-offline-skill-pack.sh artifacts/devops-testing-skills-offline-20260605.tar.gz

CLAWHUB_REGISTRY=http://skillhub.intra.example.com:8080 \
CLAWHUB_TOKEN=your-api-token \
bash scripts/deploy-offline-skills.sh artifacts/devops-testing-skills-offline-20260605.tar.gz
```

Or publish from the unpacked directory:

```bash
CLAWHUB_REGISTRY=http://skillhub.intra.example.com:8080 \
CLAWHUB_TOKEN=your-api-token \
bash scripts/deploy-offline-skills.sh seed-skills/devops-testing
```

## Offline Skill Packs

### Dev/Ops/Test Pack

The curated pack contains 69 skills for development, operations, testing, API,
database, security, release, and incident workflows.

- Config: `config/devops-testing-skill-selection.json`
- Artifact: `artifacts/devops-testing-skills-offline-20260605.tar.gz`
- Report: `reports/devops-testing-skill-pack-report.md`

### Broad GitHub Pack

The broad GitHub pack contains 378 normalized skills from configured public
GitHub sources.

- Config: `config/github-skill-sources.json`
- Artifact: `artifacts/github-skills-offline-20260605.tar.gz`
- Report: `reports/github-skill-import-report.md`

## Build Offline Artifacts

Run these on an internet-connected machine.

Build the official `clawhub` CLI Docker image:

```bash
bash scripts/build-clawhub-cli-image.sh
```

Build the broad GitHub skill pack:

```bash
bash scripts/build-github-skill-offline-pack.sh
```

Build the curated dev/ops/test skill pack from already collected skills:

```bash
bash scripts/build-devops-testing-skill-pack.sh
```

Build the SkillHub service image tarball:

```bash
bash scripts/pull-save-images.sh
```

## Publishing Behavior

`scripts/deploy-offline-skills.sh` runs `scripts/deploy-offline-skills-docker.sh`,
which uses `docker run --rm --network host skillhub/clawhub-cli:latest`.

The script logs in with `CLAWHUB_TOKEN` and publishes each skill with official
`clawhub publish`. Skill slugs use the SkillHub-compatible form:

```text
namespace--skill
```

When SkillHub returns pre-publish warnings such as suspected secrets, the batch
script skips that skill by default and continues. Skipped items are logged to:

```text
reports/offline-publish-skipped-warnings.log
```

Use strict mode to stop on the first warning:

```bash
ON_PUBLISH_WARNING=fail \
CLAWHUB_REGISTRY=http://skillhub.intra.example.com:8080 \
CLAWHUB_TOKEN=your-api-token \
bash scripts/deploy-offline-skills.sh artifacts/devops-testing-skills-offline-20260605.tar.gz
```

## Common Fixes

If you see:

```text
Offline pack does not contain seed-skills/github
```

you are using an old loader/publisher script. Use:

```bash
bash scripts/load-offline-skill-pack.sh artifacts/devops-testing-skills-offline-20260605.tar.gz
bash scripts/deploy-offline-skills.sh artifacts/devops-testing-skills-offline-20260605.tar.gz
```

If the backend fails with `Client id must not be empty`, make sure your current
`docker-compose.yaml` uses non-empty OAuth placeholders, or update from this
package.

To expose SkillHub at `http://ipd.abc.com/skillhub`, use the external Nginx
sample in `config/nginx-skillhub-subpath.conf` and follow [USAGE.md](USAGE.md).
