@bensandee/tooling 0.15.0 → 0.17.0

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/README.md CHANGED
@@ -8,19 +8,33 @@ CLI to bootstrap and maintain standardized TypeScript project tooling.
8
8
  pnpm add -D @bensandee/tooling
9
9
 
10
10
  # Or run directly
11
- pnpm dlx @bensandee/tooling repo:init
11
+ pnpm dlx @bensandee/tooling repo:sync
12
12
  ```
13
13
 
14
+ ## Conventions
15
+
16
+ The tool auto-detects project structure, CI platform, project type, and Docker packages from the filesystem. `.tooling.json` stores **overrides only** — omitted fields use detected defaults. Runtime commands (`docker:build`, `checks:run`, `release:changesets`) work without running `repo:sync` first.
17
+
18
+ | Convention | Detection | Default | Override via |
19
+ | ----------------- | ----------------------------------------------------- | ---------------------------------------- | ------------------------------------ |
20
+ | Project structure | `pnpm-workspace.yaml` present | `single` | `structure` in `.tooling.json` |
21
+ | CI platform | `.github/workflows/` or `.forgejo/workflows/` dir | `none` | `ci` in `.tooling.json` |
22
+ | Project type | Dependencies in `package.json` (react, node, library) | `default` | `projectType` in `.tooling.json` |
23
+ | Docker packages | `Dockerfile` or `docker/Dockerfile` in package dirs | — | `docker` map in `.tooling.json` |
24
+ | Formatter | Existing prettier config detected | `oxfmt` | `formatter` in `.tooling.json` |
25
+ | Release strategy | Existing release config detected | monorepo: `changesets`, single: `simple` | `releaseStrategy` in `.tooling.json` |
26
+
14
27
  ## CLI commands
15
28
 
16
29
  ### Project management
17
30
 
18
- | Command | Description |
19
- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
20
- | `tooling repo:init [dir]` | Interactive setup wizard. Flags: `--yes` (accept defaults), `--no-ci`, `--no-prompt`. Saves choices to `.tooling.json`. |
21
- | `tooling repo:update [dir]` | Add missing config files (never overwrites existing files). |
22
- | `tooling repo:check [dir]` | Dry-run drift detection. Exits 1 if files would change. CI-friendly. |
23
- | `tooling checks:run` | Run project checks (build, typecheck, lint, knip, test). Flag: `--fail-fast`. |
31
+ | Command | Description |
32
+ | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
33
+ | `tooling repo:sync [dir]` | Detect, generate, and sync project tooling (idempotent). First run prompts for release strategy, CI platform (if not detected), and formatter (if Prettier found). Subsequent runs are non-interactive. |
34
+ | `tooling repo:sync --check [dir]` | Dry-run drift detection. Exits 1 if files would change. CI-friendly. |
35
+ | `tooling checks:run` | Run project checks (build, typecheck, lint, knip, test). Flag: `--fail-fast`. |
36
+
37
+ **Flags:** `--yes` (accept all defaults), `--no-ci`, `--no-prompt`, `--eslint-plugin`
24
38
 
25
39
  ### Release management
26
40
 
@@ -34,23 +48,25 @@ pnpm dlx @bensandee/tooling repo:init
34
48
 
35
49
  ### Docker
36
50
 
37
- | Command | Description |
38
- | ------------------------ | ----------------------------------------------------------------------- |
39
- | `tooling docker:build` | Build Docker images for packages with docker config in `.tooling.json`. |
40
- | `tooling docker:publish` | Build, tag, and push Docker images to a registry. |
51
+ | Command | Description |
52
+ | ------------------------ | --------------------------------------------------- |
53
+ | `tooling docker:build` | Build Docker images for discovered Docker packages. |
54
+ | `tooling docker:publish` | Build, tag, and push Docker images to a registry. |
55
+
56
+ Docker packages are discovered automatically. Any package with a `Dockerfile` or `docker/Dockerfile` is a Docker package. Image names are derived as `{root-package-name}-{package-name}`, build context defaults to `.` (project root). For single-package repos, `Dockerfile` or `docker/Dockerfile` at the project root is checked.
57
+
58
+ When Docker packages are present, `repo:sync` generates a deploy workflow (`.forgejo/workflows/publish.yml` or `.github/workflows/publish.yml`) triggered on version tags (`v*.*.*`) that runs `pnpm exec tooling docker:publish`.
59
+
60
+ #### Overrides
41
61
 
42
- Both commands read Docker build config from the `docker` map in `.tooling.json`, keyed by package directory name. All paths are relative to the project root (where `.tooling.json` lives):
62
+ To override defaults, add a `docker` entry to `.tooling.json`:
43
63
 
44
64
  ```json
45
65
  {
46
- "setupDocker": true,
47
66
  "docker": {
48
67
  "server": {
49
68
  "dockerfile": "packages/server/docker/Dockerfile",
50
69
  "context": "."
51
- },
52
- "client": {
53
- "dockerfile": "packages/client/Dockerfile"
54
70
  }
55
71
  }
56
72
  }
@@ -58,11 +74,9 @@ Both commands read Docker build config from the `docker` map in `.tooling.json`,
58
74
 
59
75
  The `context` field defaults to `"."` (project root) when omitted. Versions for tagging are read from each package's own `package.json`.
60
76
 
61
- The tooling derives image names as `{root-package-name}-{package-name}` (e.g. `my-app-server`) and runs `docker build -f <dockerfile> -t <image-name>:latest <context>` for each package.
62
-
63
77
  #### `docker:build`
64
78
 
65
- Builds all detected packages, or a single package with `--package`:
79
+ Builds all discovered packages, or a single package with `--package`:
66
80
 
67
81
  ```bash
68
82
  # Build all packages with docker config
@@ -106,11 +120,23 @@ Each package is tagged independently using its own version, so packages in a mon
106
120
  | `DOCKER_USERNAME` | Registry username |
107
121
  | `DOCKER_PASSWORD` | Registry password |
108
122
 
109
- When `setupDocker` is enabled in `.tooling.json`, `repo:init` generates a deploy workflow (`.forgejo/workflows/deploy.yml` or `.github/workflows/deploy.yml`) triggered on version tags (`v*.*.*`) that runs `pnpm exec tooling docker:publish`.
110
-
111
123
  ## Config file
112
124
 
113
- `repo:init` persists choices to `.tooling.json` at the project root. `repo:check` and `repo:update` read this file to reproduce the same config without re-prompting.
125
+ `.tooling.json` stores **overrides only** — fields where the project differs from what convention/detection produces. A fully conventional project has `{}` or no `.tooling.json` at all.
126
+
127
+ Available override fields:
128
+
129
+ | Field | Type | Default (detected) |
130
+ | -------------------- | ------- | -------------------------------------------------------------------------------- |
131
+ | `structure` | string | `"monorepo"` if `pnpm-workspace.yaml` present, else `"single"` |
132
+ | `useEslintPlugin` | boolean | `true` |
133
+ | `formatter` | string | `"prettier"` if config found, else `"oxfmt"` |
134
+ | `setupVitest` | boolean | `true` |
135
+ | `ci` | string | Detected from workflow dirs, else `"none"` |
136
+ | `setupRenovate` | boolean | `true` |
137
+ | `releaseStrategy` | string | Detected from existing config, else monorepo: `"changesets"`, single: `"simple"` |
138
+ | `projectType` | string | Auto-detected from `package.json` deps |
139
+ | `detectPackageTypes` | boolean | `true` |
114
140
 
115
141
  ## Library API
116
142
 
@@ -193,5 +219,3 @@ if (!result.success) {
193
219
  | `VerifyResult` | Result: `{ success: true, elapsedMs }` or `{ success: false, reason, message, elapsedMs }` |
194
220
  | `DockerVerifyExecutor` | Side-effect abstraction (exec, fetch, timers) for testability |
195
221
  | `ContainerInfo` | Container status info from `composePs` |
196
-
197
- ## [Changelog](./CHANGELOG.md)