Update bun packages

From 5throck/ai-workspace-standards · View interactive version

Update bun packages is an AI agent skill from the GitHub repository 5throck/ai-workspace-standards. Scans, updates, and upgrades Bun dependencies and packages across the AI workspace (L0) or standalone project (L2/L3) while ensuring lockfile consistency, package.json version bumps, and security compliance. Use when: updating bun dependencies, upgrading packages to @latest, checking outdated packag

How to use this skill

Skill file

Overview

This skill provides a layer-aware methodology for auditing, updating, and upgrading Bun packages and dependencies. It automatically detects whether it is running in L0 (Workspace Maintainer) or L2/L3 (Standalone Project) context and adapts its scope accordingly:


When to Use This Skill


Step 0: Layer Context Auto-Detection

Before scanning, determine the execution context by checking for the existence of templates/common/:

# Check execution layer
if [ -d "templates/common" ]; then
  MODE="L0_WORKSPACE_ROOT"
else
  MODE="L2_L3_STANDALONE_PROJECT"
fi

Step 1: Scan & Audit Outdated Packages

L0 Workspace Root Mode

  1. Target Locations:
  1. Run Outdated Scan:

```bash

$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; bun outdated

```

L2/L3 Standalone Project Mode

  1. Target Locations:
  1. Run Outdated Scan:

```bash

$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; bun outdated

```

  1. Categorize Update Types:

Step 2: Security & Compatibility Assessment

  1. License Audit:

Ensure all new or updated packages use OSI-approved licenses (MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, MPL-2.0, LGPL-2.1+). Avoid GPL-3.0/AGPL-3.0/SSPL per Coding Guidelines §8.5.

  1. Core System Contracts:

Preserve essential type safety and build tooling:

  1. Breaking Change Verification:

If upgrading major versions, search for target package imports using grep_search to verify API compatibility before modifying package.json.


Step 3: Execute Package Updates & Lockfile Sync

L0 Workspace Root Mode

  1. In-Range Update:

```bash

$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; bun update

```

  1. Major / Pinned Upgrade to @latest:

To upgrade pinned dependencies to their latest releases (e.g. js-yaml, typescript, @types/node):

```bash

$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; bun add <package-name>@latest

$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; bun add -d <dev-package-name>@latest

```

  1. Align Root/Common/Variant Template Dependencies:

Use the dedicated alignment helper so root-template dependency strings are not patched by hand:

```bash

bun scripts/sync-template-deps.ts --apply

```

Review the diff for package.json, templates/common/package.json, and any templates/co-*/package.json overlays before continuing.

  1. Propagate to Templates:

```bash

$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; bun run propagate:apply

```

L2/L3 Standalone Project Mode

  1. In-Range & Pinned Update:

```bash

$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; bun update

$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; bun add <package-name>@latest

```

  1. Lockfile Refresh:

```bash

$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; bun install

```

  1. (Skip L0 propagate:apply — L2/L3 projects operate independently).

Step 4: Verification & Quality Gate

L0 Workspace Root Mode

  1. Run full workspace audit:

```bash

$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; bun scripts/audit.ts

```

  1. Validate template integrity:

```bash

$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; bun scripts/validate-templates.ts

```

  1. Run integration test suite:

```bash

$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; bun test

```

  1. Execute /sync pipeline:

```bash

$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; bun scripts/dev-sync.ts --body-file ".git/sync-pr-body.md" "chore(deps): update bun packages to @latest and sync templates"

```

L2/L3 Standalone Project Mode

  1. Run local project QA gate / tests:

```bash

$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; bun test

```

  1. Execute local /sync pipeline:

```bash

$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; bun scripts/dev-sync.ts --body-file ".git/sync-pr-body.md" "chore(deps): update bun packages"

```

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.