diff --git a/.agents/skills/investigate/SKILL.md b/.agents/skills/investigate/SKILL.md index fd67aeb4b..46ec0acc5 100644 --- a/.agents/skills/investigate/SKILL.md +++ b/.agents/skills/investigate/SKILL.md @@ -16,11 +16,11 @@ Investigate the following GitHub issue: $ARGUMENTS ### Phase 1: Fetch Issue Details 1. Parse the input: - - `WDX-123` or `linear.app` URL → **Linear ticket** + - `DX-123` or `linear.app` URL → **Linear ticket** - `#123`, bare number, or `github.com` URL → **GitHub issue** 2. Fetch the ticket: - **GitHub:** `gh issue view --json title,body,labels,comments,author,createdAt,state` - - **Linear:** `bash .agents/skills/triage/scripts/linear-fetch.sh issue WDX-123` + - **Linear:** `bash .agents/skills/triage/scripts/linear-fetch.sh issue DX-123` 3. Extract: error messages, stack traces, reproduction steps, environment details ### Phase 2: Identify Affected Package(s) @@ -47,7 +47,7 @@ For each root cause: the fix (file paths + line numbers), test coverage needed, ## Output -1. Extract identifier from arguments (issue `424` → `424`, ticket `WDX-296` → `WDX-296`, text → slugified) +1. Extract identifier from arguments (issue `424` → `424`, ticket `DX-296` → `DX-296`, text → slugified) 2. `mkdir -p claude-output` 3. Write to `claude-output/investigate-.md` 4. Confirm to user: "Investigation written to `claude-output/investigate-.md`" diff --git a/.agents/skills/qa-engineer-manual/SKILL.md b/.agents/skills/qa-engineer-manual/SKILL.md index 423c9ae5a..d221ceafd 100644 --- a/.agents/skills/qa-engineer-manual/SKILL.md +++ b/.agents/skills/qa-engineer-manual/SKILL.md @@ -34,6 +34,9 @@ You seed Storyblok QA spaces with predefined test scenarios. Packages might defi - Storyblok CLI built: `pnpm nx build storyblok` - `.env.qa-engineer-manual` file in repo root with `STORYBLOK_TOKEN` and `STORYBLOK_SPACE_ID` +> [!NOTE] +> The seed resolves the CLI and the `.storyblok` staging directory from `git rev-parse --show-toplevel`, i.e. the repo of your current working directory. To exercise changes in a worktree, build the CLI in that worktree and run the seed from inside it; otherwise it falls back to the main checkout's `dist`. + ```bash # .env.qa-engineer-manual STORYBLOK_TOKEN=your_personal_access_token @@ -103,6 +106,18 @@ bash .claude/skills/qa-engineer-manual/scripts/cleanup-remote.sh Deletes all stories, components (except the default `page` component), assets, asset folders, and internal tags in the space. Uses `STORYBLOK_SPACE_ID` from env by default (override with `--space `). This runs automatically before every seed, but can also be used standalone. +### Shared asset libraries + +Shared (org-level) asset libraries are global: they belong to the organization and can be shared across spaces, so a full wipe is destructive. Cleanup is scoped by folder membership, not by name. `--shared --library ` deletes every shared asset in the library's folder tree, every internal tag scoped to the library, and every child folder. It never deletes the library root folder or any resource outside the given library. Folder scoping is deliberate: transferred assets keep their original names, so a `qa-` name prefix would miss them. + +Because this removes all content inside the library regardless of name, only run it against a dedicated QA library, never a shared library that holds real org content. + +```bash +bash .claude/skills/qa-engineer-manual/scripts/cleanup-remote.sh --shared --library +``` + +Inspect a library first with `list.sh --resource shared-assets|shared-folders|shared-tags`. Package guides (for example `packages/cli/test/GUIDE.md`) describe the CLI push/pull workflow against libraries. + ### Scenario structure A scenario is a directory with optional subdirectories for each resource type: @@ -143,8 +158,8 @@ Paths are relative to this `SKILL.md`. | Script | Purpose | | --- | --- | | `./scripts/cleanup-local.sh` | Deletes local QA artifacts in `.storyblok/`. | -| `./scripts/cleanup-remote.sh` | Deletes all stories, components (except `page`), assets, asset folders, and internal tags in the space. Accepts `--space `. | -| `./scripts/list.sh` | Lists resources in the QA space. Pass `--resource stories\|assets\|components\|datasources` and optionally `--space `. | +| `./scripts/cleanup-remote.sh` | Deletes all stories, components (except `page`), assets, asset folders, and internal tags in the space. Accepts `--space `. Add `--shared --library ` to instead delete all shared resources in the given org library's folder tree, never the root (see "Shared asset libraries" below). | +| `./scripts/list.sh` | Lists resources in the QA space. Pass `--resource stories\|assets\|components\|datasources` and optionally `--space `. For org libraries: `--resource shared-assets\|shared-tags --library ` or `--resource shared-folders`. | | `./scripts/generate-story.sh` | Writes a story JSON to stdout. All fields optional — use flags to override `--slug`, `--name`, `--component`, `--parent-id`, `--is-folder`, `--id`, `--uuid`. | | `./scripts/generate-asset.sh` | Writes an asset sidecar JSON to stdout. Use `--filename`, `--alt`, `--title`, `--is-private`, `--folder-id`. Pass `--copy-png ` to also copy the template PNG to a target path. | diff --git a/.agents/skills/qa-engineer-manual/scripts/_common.sh b/.agents/skills/qa-engineer-manual/scripts/_common.sh index 3fd50bcd6..c7ae27b5c 100755 --- a/.agents/skills/qa-engineer-manual/scripts/_common.sh +++ b/.agents/skills/qa-engineer-manual/scripts/_common.sh @@ -5,6 +5,17 @@ # Provides: # load_env — loads .env.qa-engineer-manual and asserts STORYBLOK_TOKEN # require_space_id — ensures space_id is set (from arg or env), exits if not +# require_library_id — ensures library_id is set (from --library), exits if not +# +# Constants: +# QA_SHARED_PREFIX — name prefix every QA-created shared resource must carry +# so org-global libraries can be cleaned up safely +# (only prefix-matched resources are ever deleted). + +# Shared asset libraries are org-global (shared across spaces), so a full wipe +# is unsafe. Every QA-created shared asset, shared folder, and shared tag must +# be named with this prefix; shared cleanup only deletes prefix-matched items. +QA_SHARED_PREFIX="${QA_SHARED_PREFIX:-qa-}" # --------------------------------------------------------------------------- # load_env @@ -53,3 +64,15 @@ require_space_id() { exit 1 fi } + +# --------------------------------------------------------------------------- +# require_library_id +# Call after parsing args. Ensures the global `library_id` variable is set +# (a top-level shared asset folder id). Exits with an error if not. +# --------------------------------------------------------------------------- +require_library_id() { + if [ -z "${library_id:-}" ]; then + printf "Missing --library (a top-level shared asset folder id).\n" >&2 + exit 1 + fi +} diff --git a/.agents/skills/qa-engineer-manual/scripts/cleanup-local.sh b/.agents/skills/qa-engineer-manual/scripts/cleanup-local.sh index de63c813e..e78b22e30 100755 --- a/.agents/skills/qa-engineer-manual/scripts/cleanup-local.sh +++ b/.agents/skills/qa-engineer-manual/scripts/cleanup-local.sh @@ -28,6 +28,13 @@ for sid in "${space_ids[@]}"; do done done +# Shared asset libraries live under .storyblok/assets/shared//, +# keyed by org-global library ID rather than space ID, so clean the whole subtree. +if [ -d ".storyblok/assets/shared" ]; then + rm -rf ".storyblok/assets/shared" + removed=$((removed + 1)) +fi + if [ "${removed}" -eq 0 ]; then printf "clean\n" else diff --git a/.agents/skills/qa-engineer-manual/scripts/cleanup-remote.sh b/.agents/skills/qa-engineer-manual/scripts/cleanup-remote.sh index 2c342b830..cf027fcb4 100644 --- a/.agents/skills/qa-engineer-manual/scripts/cleanup-remote.sh +++ b/.agents/skills/qa-engineer-manual/scripts/cleanup-remote.sh @@ -5,6 +5,16 @@ set -euo pipefail # # Usage: # bash .claude/skills/qa-engineer-manual/scripts/cleanup-remote.sh --space +# +# Shared (org-level) asset libraries are global, so a full wipe is unsafe. +# --shared cleans every shared resource that belongs to ONE library, scoped by +# folder membership (not by name): all assets in the library's folder tree, all +# internal tags scoped to the library, and all child folders. Transferred assets +# keep their original names, so folder scoping catches them where a name prefix +# would not. It never deletes the library root folder (org context only) or any +# resource outside the given library. +# +# bash .claude/skills/qa-engineer-manual/scripts/cleanup-remote.sh --shared --library # shellcheck source=_common.sh source "$(dirname "${BASH_SOURCE[0]}")/_common.sh" @@ -14,6 +24,8 @@ load_env # Parse arguments # --------------------------------------------------------------------------- space_id="" +shared_mode=false +library_id="" while [ "$#" -gt 0 ]; do case "$1" in @@ -21,6 +33,14 @@ while [ "$#" -gt 0 ]; do space_id="$2" shift 2 ;; + --shared) + shared_mode=true + shift 1 + ;; + --library) + library_id="$2" + shift 2 + ;; *) printf "warning: unknown argument '%s'\n" "$1" >&2 shift 1 @@ -37,6 +57,144 @@ per_page=100 found_total=0 deleted_total=0 +# Deletes a list of ids (one per line) against an endpoint. Treats 2xx and 404 +# (already gone) as success. Runs in a command-substitution subshell, so it +# keeps no global state: it prints " " for the caller to total. +# Args: