cohorte 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ short, user-facing, most recent first. One `## <version> — <YYYY-MM-DD>` secti
7
7
  > They are history and are deliberately not rewritten — every command gained a `cohorte-` prefix
8
8
  > in 2.0.0.
9
9
 
10
+ ## 3.1.1 — 2026-11-16
11
+
12
+ - **An install that fails half-way is rolled back.** `cohorte install` / `update` journal every file
13
+ they write or retire and put the tree back as it was if anything fails mid-run (a full disk, a
14
+ path that is a directory, a permission). Empty folders of yours under `~/.claude/commands` or
15
+ `~/.claude/agents` are never pruned.
16
+ - **The lead commands read `.claude/profile.json`** (16 of 18 commands), falling back to the
17
+ `PIPELINE.md` block when it is absent; prose sections (§Conventions, §Personas) are still read
18
+ from `PIPELINE.md`.
19
+ - **`/cohorte-ship` clears the feature's report buffer after the merge** (`specs/reports/<id>.*`,
20
+ the brainstorm return, the verify evidence) — with `rm -f`/`rmdir`, which every gate allows.
21
+ - **`new-feature.sh` / `remove-feature.sh` validate their input:** the feature id must be kebab-case,
22
+ and an unknown option is an error instead of being ignored. Re-render them with
23
+ `/cohorte-update-pipeline`.
24
+ - **Releases:** every GitHub Action is pinned to a commit SHA, the Discord notification fires only
25
+ after a successful npm publish, and the docs site builds on pull requests.
26
+
10
27
  ## 3.1.0 — 2026-11-16
11
28
 
12
29
  - **The schema is split: one file per topic, each command loads only what it cites.**
@@ -7,7 +7,7 @@ allowed-tools: Read, Write, Edit, Bash, Grep, Glob, DesignSync
7
7
  Bring the code UI kit back in line with the **design system** — the source of truth. Direction is
8
8
  **design → code**.
9
9
 
10
- > Read `PIPELINE.md` §`design` first. **If `design.enabled` is false, stop immediately** and tell the
10
+ > Read `.claude/profile.json` §`design` first (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`). **If `design.enabled` is false, stop immediately** and tell the
11
11
  > human this project has no design system configured (nothing to align). Otherwise proceed with the
12
12
  > profile's `provider`, `design_system_project`, `snapshot_dir`, `ui_kit_path`, `tokens_path`.
13
13
 
@@ -7,7 +7,7 @@ argument-hint: [path or domain, default = whole repo]
7
7
  You are the **lead**. Audit **$ARGUMENTS** (default: whole repo) to drive it to a clean base. Read +
8
8
  analyze only — no fixes (those go through `/cohorte-refactor`).
9
9
 
10
- > Read `PIPELINE.md` §`commands` (the mechanical gates), `surfaces`, and §Conventions — plus
10
+ > Read `.claude/profile.json` `commands` (the mechanical gates) and `surfaces` (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`), and `PIPELINE.md` §Conventions — plus
11
11
  > `specs/_decisions.md` §Live if it exists (`<core>/pipeline/schema/decisions.md`): those standing decisions are part
12
12
  > of the rulebook you audit against, and code that contradicts one is a finding like any other.
13
13
  >
@@ -13,7 +13,7 @@ metrics line, no kanban move. It exists to refresh what the loop workflow's prec
13
13
  (`readiness.json` newer than the spec, the contract on disk) without a full build — the loop then
14
14
  builds itself. Say which mode you ran in your last line.
15
15
 
16
- > Read `PIPELINE.md` §`pipeline-profile` first: the `surfaces` list (how many implementers to
16
+ > Read `.claude/profile.json` first (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`): the `surfaces` list (how many implementers to
17
17
  > dispatch + their agent names), `contract` (mechanism + path), and the `design` flag. _Skip the
18
18
  > re-read if it's already in your context this session and unmodified since._
19
19
  >
@@ -188,7 +188,7 @@ the prompt-cache prefix. Never paste a diff into a dispatch — the agent comput
188
188
  tree. For each surface in `surfaces`:
189
189
 
190
190
  > `subagent_type: <surface.agent>` — "Implement the **<surface.key>** surface for feature `$ARGUMENTS`.
191
- > Read `PIPELINE.md` first. Spec: `specs/$ARGUMENTS.md`. Contract: `<contract.path>/$ARGUMENTS.<ext>`
191
+ > Read `.claude/profile.json` first (your surface's commands and flags). Spec: `specs/$ARGUMENTS.md`. Contract: `<contract.path>/$ARGUMENTS.<ext>`
192
192
  > (import read-only). Work test-first. Touch only `<surface.path>`. Need the current state of your
193
193
  > tree? Compute it yourself: `<core>/pipeline/scripts/feature-diff.sh --default <default_branch> --patch -- <surface.path>`. Return the handoff in the
194
194
  > format your agent instructions define. Design files: <the spec's `design_files` links — each
@@ -8,7 +8,7 @@ You are the **lead**. Run the fix loop for feature **$ARGUMENTS** — the scoped
8
8
  `REVISE`/`BLOCK` verdict. The full `/cohorte-spec` (Mode B) + `/cohorte-build` path still exists for review returns
9
9
  that change the *contract*; `/cohorte-fix` is for everything else.
10
10
 
11
- > Read `PIPELINE.md` §`pipeline-profile` first: `surfaces` (paths + agent names) and `contract`.
11
+ > Read `.claude/profile.json` first (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`): `surfaces` (paths + agent names) and `contract`.
12
12
  > _Skip the re-read if it's already in your context this session and unmodified since._
13
13
  >
14
14
  > **Kanban** (`<core>/pipeline/schema/kanban.md`): on ingest, run
@@ -17,7 +17,7 @@ worktree's session**, supervised like any other; the fleet plans, watches and re
17
17
  lives in `specs/reports/fleet.json` (the main checkout's gitignored buffer — this repo's
18
18
  multi-*feature* flight plan).
19
19
 
20
- > Read `PIPELINE.md` §`pipeline-profile` first: `surfaces` (paths — the overlap analysis keys
20
+ > Read `.claude/profile.json` first (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`): `surfaces` (paths — the overlap analysis keys
21
21
  > on them), `contract`, `vcs.default_branch`, and the `isolation` block. _Skip the re-read if
22
22
  > already in context and unmodified since._ **`isolation.enabled: false` ⇒ stop at `plan`**:
23
23
  > N features in one checkout is a merge-conflict generator with extra steps — name the fix
@@ -8,7 +8,7 @@ client email, a support thread, a stack trace, a half-idea — and today a human
8
8
  hand before anything can start. Your job is that distillation: read the raw material, decide
9
9
  which door it enters through, and stage a handoff the next command can consume verbatim.
10
10
 
11
- > Read `PIPELINE.md` §`pipeline-profile` first — `name`, `one_liner`, `surfaces` (to guess which
11
+ > Read `.claude/profile.json` first (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`) — `name`, `one_liner`, `surfaces` (to guess which
12
12
  > surface a symptom lives in) and `ui_language`. _Skip the re-read if it's already in your
13
13
  > context this session and unmodified since._ Read `specs/_decisions.md` §Live if it exists —
14
14
  > an incoming request that contradicts a settled decision must be flagged as such, not triaged
@@ -12,7 +12,7 @@ cycle at input price on every turn.
12
12
 
13
13
  Bug (may be empty): **$ARGUMENTS**
14
14
 
15
- > Read `PIPELINE.md` §`pipeline-profile` first: `surfaces` (paths — this is what you map the bug onto)
15
+ > Read `.claude/profile.json` first (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`): `surfaces` (paths — this is what you map the bug onto)
16
16
  > and `vcs`. _Skip the re-read if it's already in your context this session and unmodified since._
17
17
  > Do NOT read `specs/_decisions.md`: a bug fix decides nothing transverse, and the journal is for
18
18
  > decisions that outlive a feature.
@@ -6,8 +6,8 @@ argument-hint: <domain…> (one or more surface keys, "shared", or "all")
6
6
 
7
7
  You are the **lead**. Refactor domain **$ARGUMENTS** to match `PIPELINE.md`, using the `/cohorte-audit` backlog.
8
8
 
9
- > Read `PIPELINE.md` §`surfaces` (map the domain → a surface + its agent + commands), §`contract`
10
- > and §`vcs` (§4's branch).
9
+ > Read `.claude/profile.json` `surfaces` (map the domain → a surface + its agent + commands), `contract`
10
+ > and `vcs` (§4's branch) (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`).
11
11
  >
12
12
  > **Kanban** (`<core>/pipeline/schema/kanban.md`): §4 runs
13
13
  > `<core>/pipeline/scripts/kanban-move.sh auto <spec id> ready --title "[refactor] <domains>"`. `auto`
@@ -11,7 +11,7 @@ each surface agent at render time. This command closes that loop: findings → p
11
11
  ratified rules → re-rendered agents. The next build then never produces the finding again —
12
12
  which is cheaper than any number of review rounds catching it.
13
13
 
14
- > Read `PIPELINE.md` §`pipeline-profile` (`surfaces`, and skim the existing §Conventions
14
+ > Read `.claude/profile.json` `surfaces` (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`), and skim `PIPELINE.md`'s existing §Conventions
15
15
  > stanzas — a rule that already exists is a finding about *enforcement*, not a missing rule)
16
16
  > and `specs/_decisions.md` §Live. _Skip the re-read if already in context and unmodified._
17
17
 
@@ -6,7 +6,7 @@ argument-hint: <feature_id> | --pr <num>
6
6
 
7
7
  You are the **lead**. Dispatch the review for feature **$ARGUMENTS**.
8
8
 
9
- > Read `PIPELINE.md` §`vcs.default_branch` (diff base) and the `surfaces`/`contract`/`commands` fields.
9
+ > Read `.claude/profile.json` `vcs.default_branch` (diff base) and the `surfaces`/`contract`/`commands` fields (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`).
10
10
  > _Skip the re-read if it's already in your context this session and unmodified since._
11
11
  >
12
12
  > **Kanban** (`<core>/pipeline/schema/kanban.md`): run
@@ -101,8 +101,8 @@ reviewed surface:
101
101
  Keep the dispatch prompt **byte-identical across features and rounds** except the variable block,
102
102
  which sits at the END so every repeat hits the prompt-cache prefix:
103
103
 
104
- > `subagent_type: cohorte-review` — "Review one feature surface against its frozen spec. Read `PIPELINE.md`
105
- > first (flags + the §Conventions/§Testing slice for your scope). Check spec conformance first, then
104
+ > `subagent_type: cohorte-review` — "Review one feature surface against its frozen spec. Read `.claude/profile.json`
105
+ > first (flags), then `PIPELINE.md`'s §Conventions/§Testing slice for your scope. Check spec conformance first, then
106
106
  > correctness, security, conventions, RBAC/mobile-first _if the profile enables them_, and TDD
107
107
  > coverage. Your dispatch names a staged diff file — read it FIRST; open a full source file only when
108
108
  > a finding demands it. Emit the REVIEW REPORT in the capped format your agent instructions define —
@@ -6,7 +6,7 @@ argument-hint: <feature_id>
6
6
 
7
7
  You are the **lead**. Ship feature **$ARGUMENTS**. This is the outward-facing gate.
8
8
 
9
- > Read `PIPELINE.md` §`vcs` (host, remote, default_branch, feature_branch_prefix) **and
9
+ > Read `.claude/profile.json` `vcs` (host, remote, default_branch, feature_branch_prefix) (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`) **and
10
10
  > §`release_notes`** — §2b below is skipped or required based on it, and skipping it when it is
11
11
  > required opens a PR that CI fails on arrival.
12
12
  >
@@ -122,7 +122,7 @@ See `<core>/pipeline/schema/release-notes.md`.
122
122
 
123
123
  Spawn one agent (`subagent_type: cohorte-release`):
124
124
  "Release feature `$ARGUMENTS` on branch
125
- `<the branch §1 resolved>`. Read `PIPELINE.md` §vcs first. Spec: `specs/$ARGUMENTS.md` (already
125
+ `<the branch §1 resolved>`. Read `.claude/profile.json` `vcs` first. Spec: `specs/$ARGUMENTS.md` (already
126
126
  `status: shipped` — stage it). Write conventional commit(s), push (no force), open the PR (use `gh` if
127
127
  `host: github` + available; else emit the compare URL + drafted PR body from `<core>/templates/pr-body.md`).
128
128
  Stage **all** the feature's changes including `specs/$ARGUMENTS.md` and, if `release_notes.enabled`, the
@@ -162,6 +162,11 @@ under the `shipped` heading — never re-read the whole board into context.
162
162
  `scripts/remove-feature.sh $ARGUMENTS` (add `--drop-db` to also drop the feature db; kept by
163
163
  default). It removes the worktree, deletes the merged branch, frees the slot. Never run it before
164
164
  the merge is confirmed, and only with the human's go-ahead (the gate will ask anyway).
165
+ - **Clear the report buffer** once the merge is confirmed (never before — `/cohorte-fix` and a
166
+ re-review read it): in the main checkout, one Bash call —
167
+ `rm -f specs/reports/$ARGUMENTS.verify/* 2>/dev/null; rmdir specs/reports/$ARGUMENTS.verify 2>/dev/null; rm -f specs/reports/$ARGUMENTS.* specs/reports/$ARGUMENTS-brainstorm.md`
168
+ (plain `rm -f` + `rmdir`, never `rm -rf`, which many profiles' gate denies).
169
+ These are gitignored, derived files: the spec, its `## Remediation` history and the merged code keep
170
+ everything worth keeping. Say how many files went.
165
171
  - Feature closed — **recommend a `/clear`** before starting the next one; nothing from this session
166
- is needed again (spec `merged`, board updated). `specs/reports/$ARGUMENTS.*` is a gitignored
167
- buffer and can be deleted now.
172
+ is needed again (spec `merged`, board updated, buffer cleared).
@@ -7,8 +7,8 @@ You run the **spec** step in the main thread — interactive, with the human. Pa
7
7
 
8
8
  **$ARGUMENTS**
9
9
 
10
- > Read `PIPELINE.md` first: `contract` (mechanism/path — so §5 names the right schema types),
11
- > `design.enabled` (whether §8 matters), and §Conventions. Use `specs/_template.md` as the section list.
10
+ > Read `.claude/profile.json` first (the parsed `pipeline-profile` block; absent ⇒ read that block in `PIPELINE.md`): `contract` (mechanism/path — so §5 names the right schema types),
11
+ > `design.enabled` (whether §8 matters); then `PIPELINE.md` §Conventions. Use `specs/_template.md` as the section list.
12
12
  >
13
13
  > **Decision journal** (`<core>/pipeline/schema/decisions.md`): read `specs/_decisions.md` §Live if it exists — one
14
14
  > line per standing decision, so it is cheap. It is the ONLY place the project's transverse rules
package/lib/install.js CHANGED
@@ -43,6 +43,12 @@ function walk(dir) {
43
43
  return out;
44
44
  }
45
45
 
46
+ // Remove `dir` itself when empty — never anything inside it. For the user's shared dirs
47
+ // (commands/, agents/): an empty folder of theirs under them is not ours to delete.
48
+ function rmdirIfEmpty(dir) {
49
+ try { if (!fs.readdirSync(dir).length) fs.rmdirSync(dir); } catch { /* absent or not empty */ }
50
+ }
51
+
46
52
  function pruneEmpty(dir, stopAt) {
47
53
  let entries;
48
54
  try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; }
@@ -297,42 +303,61 @@ async function install(globalDir, opts = {}) {
297
303
  const manifest = { version: VERSION, files: {} };
298
304
  let written = 0;
299
305
 
300
- for (const [rel, { content, mode }] of want) {
301
- const dest = path.join(globalDir, rel);
302
- const buf = Buffer.isBuffer(content) ? content : Buffer.from(content);
303
- const cur = readMaybe(dest);
304
- const newHash = sha(buf);
305
- if (cur && sha(cur) !== newHash) {
306
- const known = old.files[rel];
307
- // A 2.x install has no manifest, but every file it rendered carries our marker.
308
- const ours2x = !known && MARKERS.some((m) => cur.toString('utf8').includes(m));
309
- // Modified since we wrote it, or a file we never wrote that sits on our name.
310
- if (!ours2x && (!known || known !== sha(cur))) {
311
- const to = path.join(backupDir, rel);
312
- fs.mkdirSync(path.dirname(to), { recursive: true });
313
- fs.copyFileSync(dest, to);
314
- warnings.push(`${rel} differed from what cohorte installed — your copy is saved in ${R.displayPath(to)}`);
306
+ // Every change below is journaled (path + previous bytes, or null when the file is new), so an
307
+ // error half-way — a full disk, a path that is a directory, a permission — puts the tree back as
308
+ // it was instead of leaving half a release next to the previous manifest.
309
+ const journal = [];
310
+ const remember = (dest, prev) => journal.push({ dest, prev });
311
+ let removed = 0;
312
+ try {
313
+ for (const [rel, { content, mode }] of want) {
314
+ const dest = path.join(globalDir, rel);
315
+ const buf = Buffer.isBuffer(content) ? content : Buffer.from(content);
316
+ const cur = readMaybe(dest);
317
+ const newHash = sha(buf);
318
+ if (cur && sha(cur) !== newHash) {
319
+ const known = old.files[rel];
320
+ // A 2.x install has no manifest, but every file it rendered carries our marker.
321
+ const ours2x = !known && MARKERS.some((m) => cur.toString('utf8').includes(m));
322
+ // Modified since we wrote it, or a file we never wrote that sits on our name.
323
+ if (!ours2x && (!known || known !== sha(cur))) {
324
+ const to = path.join(backupDir, rel);
325
+ fs.mkdirSync(path.dirname(to), { recursive: true });
326
+ fs.copyFileSync(dest, to);
327
+ warnings.push(`${rel} differed from what cohorte installed — your copy is saved in ${R.displayPath(to)}`);
328
+ }
315
329
  }
330
+ if (!cur || sha(cur) !== newHash) {
331
+ remember(dest, cur);
332
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
333
+ fs.writeFileSync(dest, buf);
334
+ written++;
335
+ }
336
+ if (mode && process.platform !== 'win32') { try { fs.chmodSync(dest, mode); } catch { /* optional */ } }
337
+ manifest.files[rel] = newHash;
316
338
  }
317
- if (!cur || sha(cur) !== newHash) {
318
- fs.mkdirSync(path.dirname(dest), { recursive: true });
319
- fs.writeFileSync(dest, buf);
320
- written++;
339
+
340
+ // Files the previous version installed and this one does not: delete them when they are
341
+ // exactly as we wrote them, keep (and say so) when the user changed them.
342
+ for (const [rel, hash] of Object.entries(old.files)) {
343
+ if (want.has(rel)) continue;
344
+ const dest = path.join(globalDir, rel);
345
+ const cur = readMaybe(dest);
346
+ if (!cur) continue;
347
+ if (sha(cur) === hash) { remember(dest, cur); fs.rmSync(dest); removed++; }
348
+ else warnings.push(`kept ${rel}: no longer shipped, but you modified it`);
321
349
  }
322
- if (mode && process.platform !== 'win32') { try { fs.chmodSync(dest, mode); } catch { /* optional */ } }
323
- manifest.files[rel] = newHash;
324
- }
325
350
 
326
- // Files the previous version installed and this one does not: delete them when they are
327
- // exactly as we wrote them, keep (and say so) when the user changed them.
328
- let removed = 0;
329
- for (const [rel, hash] of Object.entries(old.files)) {
330
- if (want.has(rel)) continue;
331
- const dest = path.join(globalDir, rel);
332
- const cur = readMaybe(dest);
333
- if (!cur) continue;
334
- if (sha(cur) === hash) { fs.rmSync(dest); removed++; }
335
- else warnings.push(`kept ${rel}: no longer shipped, but you modified it`);
351
+ } catch (e) {
352
+ for (const { dest, prev } of journal.reverse()) {
353
+ try {
354
+ if (prev === null || prev === undefined) fs.rmSync(dest, { force: true });
355
+ else { fs.mkdirSync(path.dirname(dest), { recursive: true }); fs.writeFileSync(dest, prev); }
356
+ } catch { /* best effort — keep restoring the rest */ }
357
+ }
358
+ for (const d of ['cohorte', 'workflows']) pruneEmpty(path.join(globalDir, d));
359
+ for (const d of ['commands', 'agents']) rmdirIfEmpty(path.join(globalDir, d));
360
+ throw new ProjectError(`install failed and was rolled back (${journal.length} change(s) undone): ${e.message}`);
336
361
  }
337
362
  for (const d of ['cohorte', 'workflows']) pruneEmpty(path.join(globalDir, d), path.join(globalDir, d));
338
363
 
@@ -366,7 +391,8 @@ function uninstall(globalDir, { purge = false } = {}) {
366
391
  pruneEmpty(path.join(globalDir, 'cohorte'));
367
392
  // Empty dirs install created (commands/, agents/, workflows/): harmless to remove, and left
368
393
  // behind they make an uninstall look incomplete.
369
- for (const d of ['workflows', 'commands', 'agents']) pruneEmpty(path.join(globalDir, d));
394
+ pruneEmpty(path.join(globalDir, 'workflows'));
395
+ for (const d of ['commands', 'agents']) rmdirIfEmpty(path.join(globalDir, d));
370
396
  if (removed) report.push(`removed ${removed} installed file(s)`);
371
397
  const leftovers = legacyGlobalCandidates(globalDir);
372
398
  if (leftovers.length) warnings.push(`2.x files still present (run \`cohorte update\` first to migrate them, then uninstall): ${leftovers.slice(0, 5).join(', ')}${leftovers.length > 5 ? '…' : ''}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cohorte",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "Multi-agent development pipeline for Claude Code — install it once, run /cohorte-init-pipeline in a repo, and it adapts to that project's stack.",
5
5
  "bin": {
6
6
  "cohorte": "bin/cli.js"
@@ -19,10 +19,16 @@
19
19
  set -euo pipefail
20
20
 
21
21
  id="${1:-}"
22
- if [[ -z "$id" ]]; then
22
+ if [[ -z "$id" || $# -gt 1 ]]; then
23
23
  echo "usage: scripts/new-feature.sh <feature_id>" >&2
24
24
  exit 1
25
25
  fi
26
+ # The id becomes a branch name, a directory, a database name and a slot key: kebab-case only
27
+ # (what /cohorte-spec assigns), so nothing downstream has to quote or escape it.
28
+ if [[ ! "$id" =~ ^[a-z0-9][a-z0-9-]{0,62}$ ]]; then
29
+ echo "error: feature id \"$id\" must be kebab-case (a-z, 0-9, -; at most 63 chars), as /cohorte-spec assigns it" >&2
30
+ exit 2
31
+ fi
26
32
 
27
33
  repo_root="$(git -C "$(dirname "${BASH_SOURCE[0]}")" rev-parse --show-toplevel)"
28
34
  branch="__BRANCH_PREFIX__${id}"
@@ -14,11 +14,20 @@ set -euo pipefail
14
14
 
15
15
  id="${1:-}"
16
16
  drop_db="no"
17
- [[ "${2:-}" == "--drop-db" ]] && drop_db="yes"
18
-
19
- if [[ -z "$id" ]]; then
20
- echo "usage: scripts/remove-feature.sh <feature_id> [--drop-db]" >&2
21
- exit 1
17
+ usage() { echo "usage: scripts/remove-feature.sh <feature_id> [--drop-db]" >&2; exit 1; }
18
+ [[ -n "$id" ]] || usage
19
+ shift
20
+ # Every flag is parsed: an unknown one (a typo'd --drop-db, a --force this script never had) used
21
+ # to be ignored silently, so the teardown ran with options the human did not get.
22
+ for arg in "$@"; do
23
+ case "$arg" in
24
+ --drop-db) drop_db="yes" ;;
25
+ *) echo "error: unknown option \"$arg\"" >&2; usage ;;
26
+ esac
27
+ done
28
+ if [[ ! "$id" =~ ^[a-z0-9][a-z0-9-]{0,62}$ ]]; then
29
+ echo "error: feature id \"$id\" must be kebab-case (a-z, 0-9, -)" >&2
30
+ exit 2
22
31
  fi
23
32
 
24
33
  repo_root="$(git -C "$(dirname "${BASH_SOURCE[0]}")" rev-parse --show-toplevel)"