specgate/docs v1.8.0

Domain packs, end to end#

One pass through a pack's whole life on a project: install it, see what it gave you, upgrade it to a newer version, and take it off again. It uses the public demo pack parking-management-specops, which has two tags, v0.1.0 and v0.2.0. Every command below was run against that repository with Specgate 1.5.0.

For what a pack is and which ones exist, read Domain packs. If you are starting from your own plan rather than a pack, start with Getting started instead.

Upgrading a domain pack: a three-way merge with your project First, specgate specops diff --pack-version v0.2.0 previews the upgrade: the files sync would add and modify, writing nothing. v0.2.0 requires four variables v0.1.0 did not, so diff and sync both take --var STACK, API_STYLE, TESTING and LANG. Then three versions meet. The merge base is the pack's previous version, v0.1.0, as it was rendered into your project — the baseline specops add recorded under .specops/baseline: REQ-001 to REQ-005, REQ-002's row Draft, and no REQ-006. Yours is the project with your work: REQ-002 Implemented in the matrix, written there by apply, and REQ-020, a requirement of your own. The pack's new version, v0.2.0, leaves REQ-001 to REQ-005 as they were and adds REQ-006, Join Capacity Waitlist: its feature file, its use case and its matrix row. specgate specops sync --pack-version v0.2.0, with the same four variables, merges them three ways. What the new version changes arrives: REQ-006. What you wrote stays: REQ-002 Implemented, and REQ-020. A line both changed is a conflict: the file gets conflict markers, or is left untouched with --abort-on-conflict, and sync stops naming the conflicting files. An id you already use — had your own requirement been REQ-006 — is such a conflict: sync stops naming docs/specs/traceability.md, and keeping both rows makes check fail with Duplicate Requirement ID REQ-006. You give yours a free id, rename it in its spec, tests and features, and run specgate check. specgate specops diff --pack-version v0.2.0 --var STACK=… --var API_STYLE=… --var TESTING=… --var LANG=… first, a preview: the files sync would add (+) and modify (~) — it writes nothing; v0.2.0 needs the four --var THE MERGE BASE YOURS THE PACK'S NEW VERSION v0.1.0, as rendered the baseline specops add recorded .specops/baseline/backend REQ-001 … REQ-005 REQ-002 Draft no REQ-006 yet Your project with your work REQ-002 Implemented in the matrix — apply wrote it REQ-020 a requirement of yours v0.2.0 the version you move to REQ-001 … REQ-005 unchanged + REQ-006 Join Capacity Waitlist its feature, use case and matrix row A three-way merge specgate specops sync --pack-version v0.2.0 --var … Arrives — what v0.2.0 changes: REQ-006 Stays — what you wrote: REQ-002 Implemented, and REQ-020 Conflict — a line both changed: the file gets conflict markers, or is left untouched with --abort-on-conflict; either way sync stops, naming the conflicting files An id you already use Had yours been REQ-006, both matrix rows conflict: sync stops, docs/specs/traceability.md Both kept, check fails: Duplicate Requirement ID REQ-006. Give yours a free id, rename it in its spec, tests and features, then run specgate check id clash
A pack upgrade merges the pack's old version, your project and the pack's new version three ways: the pack's changes arrive, yours stay, and only a line both changed — or an id both use — stops it.

1. Scaffold a project for the pack#

A pack brings its own requirements, so the project should start without any. Describe it in a short config file and scaffold it with --no-sample-req:

bash
cat > smart-parking.yaml <<'EOF'
PROJECT_NAME: Smart Parking
PROJECT_SLUG: smart-parking
PROJECT_TYPE: backend
DOMAIN: parking operations
STACK: Quarkus 3.x, Java 21, PostgreSQL
API_STYLE: REST with DTO boundaries
TESTING: JUnit 5, Cucumber
EOF

specgate init --config smart-parking.yaml --no-sample-req
cd smart-parking

Note

Adding a pack to a project init adopted. In a repository that already has code, init adopts it and seeds REQ-001 — Existing behaviour is preserved. A pack whose ids start at REQ-001 collides with it, and the gate then reports the adoption baseline as an orphan feature. Pick a pack whose ids do not overlap — the proven packs each use their own range — or scaffold as above.

2. Install the pack, pinned to a version#

bash
specgate specops add \
  --pack-repo https://github.com/rsaglobaltech/parking-management-specops.git \
  --pack-version v0.1.0 \
  --pack backend \
  --var PROJECT_NAME="Smart Parking" \
  --var PROJECT_SLUG=smart-parking \
  --var DOMAIN="parking operations"
text
  ℹ  Resolving remote pack https://github.com/rsaglobaltech/parking-management-specops.git@v0.1.0…
  ℹ  Wrote …/smart-parking/.specops.lock
  ℹ  Recorded baseline for 13 file(s) under .specops/baseline/backend
  ℹ  Generated 5 scenario file(s).
  ℹ  Domain pack expansion completed.

add clones the tag once into the pack cache, writes the requirements and scenarios into the project, and records the source, the version and every --var in .specops.lock, so later commands remember them.

3. See what it gave you#

bash
specgate status
text
  ◆ specgate · status   smart-parking

  Requirements  ░░░░░░░░░░░░░░░░░░░░  0 of 5 done

  To do ──────────────────────────────────────────────────
    ○ REQ-001  Monitor Capacity Threshold  a test and code
    ○ REQ-002  Register Vehicle Entry      a test and code
    ○ REQ-003  Calculate Parking Fee       a test and code
    ○ REQ-004  Detect Overstay             a test and code
    ○ REQ-005  Send Payment Receipt        a test and code

  Packs ──────────────────────────────────────────────────
    backend  @ v0.1.0

specgate check passes: the requirements are Draft, so they owe nothing yet. From here the daily loop is the usual one — status, a test that names the requirement, apply, check — described in Build the first requirement and Prove it.

4. Preview an upgrade before taking it#

v0.2.0 of this pack requires four variables v0.1.0 did not: STACK, API_STYLE, TESTING and LANG. Pass them once with --var; they are written back to the lockfile.

bash
specgate specops diff --pack-version v0.2.0 \
  --var STACK="Quarkus 3.x, Java 21" --var API_STYLE="REST with DTO boundaries" \
  --var TESTING="JUnit 5, Cucumber" --var LANG=en
text
── backend @ v0.2.0 (current: v0.1.0) ──
  + features/waitlist/capacity_waitlist.feature
  ~ AI_RULES.md
  ~ docs/specs/commands.md
  ~ docs/specs/domain-model.md
  ~ docs/specs/events.md
  ~ docs/specs/traceability.md
  ~ docs/specs/use-cases.md

  1 added · 6 modified · 7 unchanged

Without the new variables, diff and sync stop with Missing required variable 'STACK'. Provide it using --var STACK=... — the pack declares what it needs in variables.required. diff writes nothing; --json gives the same report to an agent, and --as-change turns the bump into a change folder you can review like any other.

5. Take the upgrade#

bash
specgate specops sync --pack-version v0.2.0 \
  --var STACK="Quarkus 3.x, Java 21" --var API_STYLE="REST with DTO boundaries" \
  --var TESTING="JUnit 5, Cucumber" --var LANG=en
text
  ℹ  Syncing backend @ v0.2.0 (was v0.1.0)

── backend @ v0.2.0 ──
  1 added · 6 unchanged · 6 updated
  ℹ  Sync completed for 1 pack(s) with no conflicts.

sync is a three-way merge against the baseline add recorded: a file you edited keeps your edits, and a real conflict gets markers (--abort-on-conflict leaves it untouched instead); either way sync exits non-zero and names the conflicting files. v0.2.0 adds REQ-006 — its feature file, its use case and its matrix row — and leaves REQ-001 to REQ-005 as they were, so a status apply wrote into REQ-002's row stays. specgate status now shows 0 of 6 done — the new REQ-006 Join Capacity Waitlist — and backend @ v0.2.0.

An id you already use is such a conflict. Had you added a requirement of your own as REQ-006 before the upgrade, both versions write a REQ-006 row in docs/specs/traceability.md: sync reports docs/specs/traceability.md — CONFLICT (markers written) and stops. Keeping both rows makes check fail with Duplicate Requirement ID in traceability.md: REQ-006. Give yours a free id, rename it in its spec, tests and features, then run specgate check.

6. Take the pack off#

The id is the one .specops.lock records — here backend, not the --pack-repo path:

bash
specgate specops remove backend --dry-run   # what it would remove
specgate specops remove backend
text
✔  Removed backend from .specops.lock (1 entry).
   Generated files were not deleted. Inspect with `git status` and remove anything unwanted.

remove forgets the pack; it does not delete the requirements, scenarios and tests the project now owns. Review them with git status and delete by hand what you no longer want.

Next#

  • Domain packs — the proven packs, the starter examples, and how to write your own.
  • Supply chain — the pack cache, pinning, and working offline.