diff --git a/.github/workflows/publish-cli.yml b/.github/workflows/publish-cli.yml deleted file mode 100644 index 5eef3cc7e1a..00000000000 --- a/.github/workflows/publish-cli.yml +++ /dev/null @@ -1,107 +0,0 @@ -name: publish-cli - -on: - push: - branches: [main] - paths: - - 'packages/cli/**' - -permissions: - contents: read - -# A newer push waits for the running publish rather than racing its version check. -concurrency: - group: publish-cli-${{ github.ref }} - cancel-in-progress: false - -jobs: - build: - name: build - runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }} - timeout-minutes: 15 - outputs: - version: ${{ steps.package_version.outputs.version }} - exists: ${{ steps.version_check.outputs.exists }} - steps: - - name: Checkout repository - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 - with: - persist-credentials: false - - - name: Setup workspace - uses: ./.github/actions/setup - with: - provider: ${{ vars.CI_PROVIDER }} - node-version: '22' - - - name: Build package - working-directory: packages/cli - run: bun run build - - - name: Get package version - id: package_version - working-directory: packages/cli - run: echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT" - - - name: Check if version already exists - id: version_check - env: - VERSION: ${{ steps.package_version.outputs.version }} - run: | - if npm view "simstudio@$VERSION" version &> /dev/null; then - echo "exists=true" >> "$GITHUB_OUTPUT" - else - echo "exists=false" >> "$GITHUB_OUTPUT" - fi - - # Bun packs because it rewrites `workspace:` ranges to real versions, - # which `npm pack` would publish verbatim. - - name: Pack package - if: steps.version_check.outputs.exists == 'false' - working-directory: packages/cli - run: bun pm pack --ignore-scripts --filename "$RUNNER_TEMP/package.tgz" --quiet - - - name: Upload package - if: steps.version_check.outputs.exists == 'false' - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 - with: - name: package - path: ${{ runner.temp }}/package.tgz - if-no-files-found: error - retention-days: 1 - - - name: Log skipped publish - if: steps.version_check.outputs.exists == 'true' - env: - VERSION: ${{ steps.package_version.outputs.version }} - run: echo "Skipped publishing because version $VERSION already exists on npm" - - # npm trusted publishing trades this job's OIDC token for a short-lived npm - # credential, so no npm token is stored anywhere. npm accepts the token only - # from GitHub-hosted runners, and only this job can mint one: it runs no - # repository code, it publishes the tarball the build job packed. npm runs no - # lifecycle scripts for a tarball, so nothing is rebuilt here, and provenance - # is attached automatically. - publish: - name: publish - needs: build - if: needs.build.outputs.exists == 'false' - runs-on: ubuntu-latest - timeout-minutes: 10 - permissions: - id-token: write - steps: - # Node 24 bundles npm 11.5.1+, which trusted publishing requires. - - name: Setup Node - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6 - with: - node-version: '24' - - - name: Download package - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 - with: - name: package - path: ${{ runner.temp }} - - - name: Publish to npm - run: npm publish "$RUNNER_TEMP/package.tgz" --access public diff --git a/.github/workflows/publish-sim-cli.yml b/.github/workflows/publish-sim-cli.yml index 2d87aa6bd92..8146da78d87 100644 --- a/.github/workflows/publish-sim-cli.yml +++ b/.github/workflows/publish-sim-cli.yml @@ -106,6 +106,16 @@ jobs: echo "tag=$TAG" } >> "$GITHUB_OUTPUT" + # `./embed` and the `#sim-cli/*` imports point at TypeScript source, which + # only the monorepo's own Next.js app consumes (it transpiles the package). + # The tarball ships `dist` alone, so published they would be dead entry + # points; the smoke test below fails on any export that does not exist. + - name: Drop source-only entry points + working-directory: packages/sim-cli + run: | + jq 'del(.imports, .exports["./embed"])' package.json > "$RUNNER_TEMP/package.json" + mv "$RUNNER_TEMP/package.json" package.json + # Bun packs because it rewrites `workspace:` ranges to real versions, # which `npm pack` would publish verbatim. The smoke test below and the # publish job both use this one tarball, so what was tested is what ships. @@ -126,6 +136,20 @@ jobs: SMOKE_DIR="$(mktemp -d "$RUNNER_TEMP/sim-cli-smoke.XXXXXX")" tar -xzf "$RUNNER_TEMP/package.tgz" -C "$SMOKE_DIR" test "$("$SMOKE_DIR/package/dist/index.js" --version)" = "$VERSION" + node -e ' + const fs = require("node:fs") + const path = require("node:path") + const root = path.join(process.argv[1], "package") + const pkg = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8")) + const targets = Object.values(pkg.exports ?? {}).flatMap((entry) => + typeof entry === "string" ? [entry] : Object.values(entry) + ) + const missing = targets.filter((target) => !fs.existsSync(path.join(root, target))) + if (missing.length > 0) { + console.error("Exports point at files the tarball does not contain: " + missing.join(", ")) + process.exit(1) + } + ' "$SMOKE_DIR" - name: Verify version is unpublished env: diff --git a/biome.json b/biome.json index 85fa1db5758..9dc657a52b0 100644 --- a/biome.json +++ b/biome.json @@ -167,7 +167,6 @@ "**/*.spec.ts", "apps/desktop/e2e/**", "apps/sim/vitest.setup.ts", - "packages/cli/**", "packages/sim-cli/**", "packages/sim-setup/**", "packages/db/script-migrations/**", diff --git a/bun.lock b/bun.lock index 5fc97ab72f8..a7968ebc050 100644 --- a/bun.lock +++ b/bun.lock @@ -567,22 +567,6 @@ "typescript": "^7.0.2", }, }, - "packages/cli": { - "name": "simstudio", - "version": "0.1.19", - "bin": { - "simstudio": "dist/index.js", - }, - "dependencies": { - "chalk": "5.6.2", - "commander": "^11.1.0", - }, - "devDependencies": { - "@sim/tsconfig": "workspace:*", - "@types/node": "24.19.2", - "typescript": "^7.0.2", - }, - }, "packages/db": { "name": "@sim/db", "version": "0.1.0", @@ -4334,7 +4318,6 @@ "simple-update-notifier": ["simple-update-notifier@2.0.0", "", { "dependencies": { "semver": "^7.5.3" } }, "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w=="], - "simstudio": ["simstudio@workspace:packages/cli"], "simstudio-ts-sdk": ["simstudio-ts-sdk@workspace:packages/ts-sdk"], diff --git a/knip.jsonc b/knip.jsonc index 9490adf34c9..48d5bdd9482 100644 --- a/knip.jsonc +++ b/knip.jsonc @@ -144,7 +144,6 @@ "ignoreIssues": { "components/icons.tsx": ["exports", "types", "duplicates"] } }, "apps/pii": { "includeEntryExports": false }, - "packages/cli": { "includeEntryExports": false }, "packages/db": { "includeEntryExports": false, "entry": [ diff --git a/packages/cli/README.md b/packages/cli/README.md deleted file mode 100644 index cddcfe564d4..00000000000 --- a/packages/cli/README.md +++ /dev/null @@ -1,57 +0,0 @@ -# Sim CLI - -Sim CLI allows you to run [Sim](https://sim.ai) using Docker with a single command. - -## Installation - -To install the Sim CLI globally, use: - -```bash -npm install -g simstudio -``` - -## Usage - -To start Sim, simply run: - -```bash -simstudio -``` - -### Options - -- `-p, --port `: Specify the port to run Sim on (default: 3000). -- `--no-pull`: Skip pulling the latest Docker images. - -## Requirements - -- Docker must be installed and running on your machine. - -## Data and secrets - -Everything lives under `~/.simstudio`: - -- `data/postgres` — the database volume. -- `secrets.env` — secrets generated for this install on first run, then reused. - -Keep `secrets.env`. `ENCRYPTION_KEY` and `API_ENCRYPTION_KEY` decrypt data already stored in the -database, so replacing them leaves that data unreadable. Back the file up alongside `data/`. - -You can supply your own values by editing it. The format is `KEY=value`, one per line, with `#` -for comments — quotes are not interpreted, so leave them off. - -| Key | Requirement | -|---|---| -| `ENCRYPTION_KEY`, `API_ENCRYPTION_KEY` | exactly 64 hex characters (`openssl rand -hex 32`) | -| `BETTER_AUTH_SECRET`, `INTERNAL_API_SECRET` | at least 32 characters, otherwise free-form | - -A value that does not meet its requirement is regenerated on the next run. When that replaces -something you had set, the CLI says so and copies the previous file to `secrets.env.bak-