@bensandee/tooling 0.13.0 → 0.14.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 +225 -0
- package/README.md +121 -0
- package/dist/bin.d.mts +1 -0
- package/dist/bin.mjs +223 -57
- package/dist/docker-verify/index.d.mts +117 -0
- package/dist/docker-verify/index.mjs +218 -0
- package/dist/exec-CC49vrkM.mjs +7 -0
- package/dist/index.d.mts +104 -0
- package/package.json +19 -7
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# @bensandee/tooling
|
|
2
|
+
|
|
3
|
+
## 0.14.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- caeebd8: Add d.ts declaration file output and types export conditions
|
|
8
|
+
- caeebd8: Bump tsdown from 0.21.0 to 0.21.2
|
|
9
|
+
- Updated dependencies [caeebd8]
|
|
10
|
+
- Updated dependencies [caeebd8]
|
|
11
|
+
- @bensandee/common@0.1.2
|
|
12
|
+
|
|
13
|
+
## 0.14.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- e95d449: Add `--fail-fast` / `--no-fail-fast` flag to `checks:run` to control whether execution stops on the first failure. Defaults to fail-fast in dev and continue-on-error in CI.
|
|
18
|
+
- 715a4ea: Add `@bensandee/tooling/docker-verify` subpath export: a TypeScript framework for Docker image verification with compose lifecycle management, HTTP health polling, container health monitoring, and signal-safe cleanup. Consumers import building blocks and compose them with custom validators instead of writing boilerplate.
|
|
19
|
+
- 27c3480: Add `release:simple` command and rename CLI subcommands
|
|
20
|
+
|
|
21
|
+
**Breaking changes:**
|
|
22
|
+
|
|
23
|
+
- `release:create-forgejo-release` renamed to `forgejo:create-release`
|
|
24
|
+
- `release:merge` renamed to `changesets:merge`
|
|
25
|
+
- `releaseStrategy: "commit-and-tag-version"` renamed to `"simple"` in `.tooling.json` config
|
|
26
|
+
- Generated CI workflow for commit-and-tag-version now uses `pnpm exec tooling release:simple` instead of inline shell commands
|
|
27
|
+
|
|
28
|
+
**New feature:**
|
|
29
|
+
|
|
30
|
+
`release:simple` — a CLI command that handles the full release lifecycle for projects using commit-and-tag-version:
|
|
31
|
+
|
|
32
|
+
- Runs `commit-and-tag-version` to bump version, update CHANGELOG, and create a git tag
|
|
33
|
+
- Pushes to origin with `--follow-tags`
|
|
34
|
+
- Creates sliding version tags (vX, vX.Y) for flexible deployment pinning
|
|
35
|
+
- Creates Forgejo or GitHub releases automatically
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- 715a4ea: Add README files to all published packages for npm registry documentation
|
|
40
|
+
- 27c3480: Pre-populate `repo:init` prompts from saved `.tooling.json` config
|
|
41
|
+
|
|
42
|
+
When re-running `repo:init` on a project with an existing `.tooling.json`, each prompt now defaults to the previously saved choice instead of the detection-based default. Press Enter to keep existing settings or change only what you need.
|
|
43
|
+
|
|
44
|
+
- d448ec6: Update node tsconfig base to use `nodenext` module resolution with `allowImportingTsExtensions`, enabling `.ts` extensions in imports for projects running TypeScript natively on Node 24+. Migrate all tooling-cli imports to use `.ts` extensions and switch `#src` subpath mapping to `#src/*.ts`. Use extensionless imports for library packages.
|
|
45
|
+
- c49593f: Add `commit-and-tag-version` and `@changesets/cli` as optional dependencies
|
|
46
|
+
|
|
47
|
+
These tools are only needed when using their respective release strategies, so they're optional rather than required. Target projects already install them as devDependencies via the package-json generator.
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [715a4ea]
|
|
50
|
+
- Updated dependencies [d448ec6]
|
|
51
|
+
- @bensandee/common@0.1.1
|
|
52
|
+
|
|
53
|
+
## 0.13.0
|
|
54
|
+
|
|
55
|
+
### Minor Changes
|
|
56
|
+
|
|
57
|
+
- bbe3634: Add `checks:run` command (renamed from `repo:run-checks`). Add `ci:check`, `tooling:check`, and `tooling:update` as generated package.json scripts. CI workflows now run `pnpm ci:check`. Managed scripts are updated on `repo:update`/`repo:check` if they don't reference the expected command.
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- f20b25d: `checks:run` now reads package.json to detect which scripts are defined. Undefined scripts show "(not defined)" instead of silently passing. Commands use `pnpm run` instead of `pnpm run --if-present`.
|
|
62
|
+
|
|
63
|
+
## 0.12.0
|
|
64
|
+
|
|
65
|
+
### Minor Changes
|
|
66
|
+
|
|
67
|
+
- 5de6090: Add `repo:run-checks` command that runs all standard checks (build, typecheck, lint, test, format, knip, tooling:check, image:check) without short-circuiting, reporting a summary of failures at the end. Supports `--skip` to skip specific checks and `--add` to append custom checks. Generated CI workflows now use `pnpm check`, and the package.json generator produces `check` and `tooling:check` scripts pointing to this command. Managed scripts (`check`, `tooling:check`) are updated on `repo:update`/`repo:check` if they don't already reference the expected command.
|
|
68
|
+
|
|
69
|
+
## 0.11.0
|
|
70
|
+
|
|
71
|
+
### Minor Changes
|
|
72
|
+
|
|
73
|
+
- 493ae65: Add `repo:run-checks` command that runs all standard checks (build, typecheck, lint, test, format, knip, repo:check) without short-circuiting, reporting a summary of failures at the end. Generated CI workflows and package.json `check` scripts now use this command. Skip `trigger-release` script for changesets release strategy.
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- ae18571: Add .pnpm-store to gitignore file
|
|
78
|
+
- 916c1ee: Ensure `yaml-language-server` schema comment is added to existing Forgejo workflow files during update/merge
|
|
79
|
+
|
|
80
|
+
## 0.10.1
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- f131a3d: Add `pnpm why` to the allowed Bash commands in generated Claude settings
|
|
85
|
+
- 1cb2ce8: Add yaml-language-server schema comments to generated Forgejo workflow files and update schema glob to match both .yml and .yaml extensions
|
|
86
|
+
|
|
87
|
+
## 0.10.0
|
|
88
|
+
|
|
89
|
+
### Minor Changes
|
|
90
|
+
|
|
91
|
+
- 34a0e1e: feat: merge missing config into existing lefthook and CI workflow files instead of skipping
|
|
92
|
+
|
|
93
|
+
Generators for `lefthook.yml`, CI check workflows, and release workflows now merge required
|
|
94
|
+
entries into existing files rather than silently skipping them. This means `repo:update` can
|
|
95
|
+
add new steps (e.g. a newly required CI check) to repos that were initialized before the step
|
|
96
|
+
existed.
|
|
97
|
+
|
|
98
|
+
Add `# @bensandee/tooling:ignore` in the first 10 lines of any YAML file to opt out of
|
|
99
|
+
automatic merging.
|
|
100
|
+
|
|
101
|
+
### Patch Changes
|
|
102
|
+
|
|
103
|
+
- 330cc2c: fix: use semantic JSON comparison in repo:check and repo:update to ignore formatting-only differences
|
|
104
|
+
|
|
105
|
+
## 0.9.0
|
|
106
|
+
|
|
107
|
+
### Minor Changes
|
|
108
|
+
|
|
109
|
+
- 88f2a93: Require `.tooling.json` for `repo:update` and `repo:check` commands. Previously these commands would warn and continue with detected defaults when `.tooling.json` was missing, which could cause unexpected overwrites without proper archiving. Now they exit with an error directing the user to run `tooling repo:init` first.
|
|
110
|
+
|
|
111
|
+
Write Forgejo workflow schema mapping to `.code-workspace` file when present, falling back to `.vscode/settings.json`. The `yaml.schemas` setting in `.vscode/settings.json` doesn't apply in VS Code multi-root workspaces.
|
|
112
|
+
|
|
113
|
+
Improve post-init guidance: suggest a Claude Code prompt ("Execute the steps in .tooling-migrate.md") instead of "paste contents".
|
|
114
|
+
|
|
115
|
+
## 0.8.1
|
|
116
|
+
|
|
117
|
+
### Patch Changes
|
|
118
|
+
|
|
119
|
+
- efcfdcc: Fix findOpenPr to filter PRs client-side by head.ref instead of relying on Forgejo's inconsistent head query parameter, which could match the wrong PR
|
|
120
|
+
- 88aac23: Add forgejo workflow schema additions
|
|
121
|
+
- e4c41d6: Fix wrong agent name in settings.json for claude
|
|
122
|
+
- 43509b8: Pin @bensandee/\* package versions in generated package.json instead of using "latest". Versions are read from sibling package.json files at build time via tsdown's define feature, so they auto-update with each release.
|
|
123
|
+
- 5e65e50: enhance ciWorkflow to support Forgejo email notifications
|
|
124
|
+
- 60a5502: refactor generateClaudeSettings to handle monorepo structure and update tests for plugin integration
|
|
125
|
+
|
|
126
|
+
## 0.8.0
|
|
127
|
+
|
|
128
|
+
### Minor Changes
|
|
129
|
+
|
|
130
|
+
- 375f7fd: Add claude skills to settings.json
|
|
131
|
+
|
|
132
|
+
### Patch Changes
|
|
133
|
+
|
|
134
|
+
- 375098b: Add more safety restrictions to settings.json
|
|
135
|
+
- b330adf: Fix bad update to tsconfig when not needed
|
|
136
|
+
|
|
137
|
+
## 0.7.3
|
|
138
|
+
|
|
139
|
+
### Patch Changes
|
|
140
|
+
|
|
141
|
+
- 3257e04: Fix no-unsafe-json-parse rule and fix new lint errors
|
|
142
|
+
- ca61fa7: Don't overwrite existing oxfmt config
|
|
143
|
+
- 1bdf858: More intelligent addition of src folder to tsconfig
|
|
144
|
+
- 8de49b9: Add line about adding packages when necessary to resolve errors
|
|
145
|
+
|
|
146
|
+
## 0.7.2
|
|
147
|
+
|
|
148
|
+
### Patch Changes
|
|
149
|
+
|
|
150
|
+
- e48bc27: Fix bug where tsconfigs in packages would be force-updated even if solutions-style
|
|
151
|
+
|
|
152
|
+
## 0.7.1
|
|
153
|
+
|
|
154
|
+
### Patch Changes
|
|
155
|
+
|
|
156
|
+
- 6ef4ea9: Fix tsconfig build/update issues
|
|
157
|
+
- 3608a1a: Run pnpm update after repo:update
|
|
158
|
+
|
|
159
|
+
## 0.7.0
|
|
160
|
+
|
|
161
|
+
### Minor Changes
|
|
162
|
+
|
|
163
|
+
- 912013d: Add repo:check command
|
|
164
|
+
- 2545262: Add common package + error subclasses
|
|
165
|
+
|
|
166
|
+
### Patch Changes
|
|
167
|
+
|
|
168
|
+
- Updated dependencies [2545262]
|
|
169
|
+
- @bensandee/common@0.1.0
|
|
170
|
+
|
|
171
|
+
## 0.6.2
|
|
172
|
+
|
|
173
|
+
### Patch Changes
|
|
174
|
+
|
|
175
|
+
- caa1270: Fix hang migrating repo:init
|
|
176
|
+
|
|
177
|
+
## 0.6.1
|
|
178
|
+
|
|
179
|
+
### Patch Changes
|
|
180
|
+
|
|
181
|
+
- 2182ab3: fix bug where renovate.json5 wasn't cleaned up to use our preset
|
|
182
|
+
- d811a96: Lefthook doesn't need an install step in package.json prepare
|
|
183
|
+
|
|
184
|
+
## 0.6.0
|
|
185
|
+
|
|
186
|
+
### Minor Changes
|
|
187
|
+
|
|
188
|
+
- 94cd161: Updated default oxlint config to include more default rules.
|
|
189
|
+
|
|
190
|
+
## 0.5.1
|
|
191
|
+
|
|
192
|
+
### Patch Changes
|
|
193
|
+
|
|
194
|
+
- e0bc32e: Improve migration for tsconfig and husky/lint-staged
|
|
195
|
+
- 02c1a1b: Include version when running tooling cli
|
|
196
|
+
|
|
197
|
+
## 0.5.0
|
|
198
|
+
|
|
199
|
+
### Minor Changes
|
|
200
|
+
|
|
201
|
+
- 58fc8a3: Add lefthook support in place of husky, lint-staged
|
|
202
|
+
|
|
203
|
+
## 0.4.0
|
|
204
|
+
|
|
205
|
+
### Minor Changes
|
|
206
|
+
|
|
207
|
+
- e02953a: Bug fixing, move renovate config to standard location
|
|
208
|
+
- 451908d: Restructure package names and exports.
|
|
209
|
+
|
|
210
|
+
## 0.3.0
|
|
211
|
+
|
|
212
|
+
### Minor Changes
|
|
213
|
+
|
|
214
|
+
- 5e9719f: Many bug fixes
|
|
215
|
+
|
|
216
|
+
## 0.2.0
|
|
217
|
+
|
|
218
|
+
### Minor Changes
|
|
219
|
+
|
|
220
|
+
- c376981: Initial release
|
|
221
|
+
|
|
222
|
+
### Patch Changes
|
|
223
|
+
|
|
224
|
+
- 3fc9fe3: Support multiple release architectures (release-it, commit-and-tag-version and changsets)
|
|
225
|
+
- 4004530: Add release-forgejo command to perform final steps of release creation in forgejo.
|
package/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# @bensandee/tooling
|
|
2
|
+
|
|
3
|
+
CLI to bootstrap and maintain standardized TypeScript project tooling.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add -D @bensandee/tooling
|
|
9
|
+
|
|
10
|
+
# Or run directly
|
|
11
|
+
pnpm dlx @bensandee/tooling repo:init
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## CLI commands
|
|
15
|
+
|
|
16
|
+
### Project management
|
|
17
|
+
|
|
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`. |
|
|
24
|
+
|
|
25
|
+
### Release management
|
|
26
|
+
|
|
27
|
+
| Command | Description |
|
|
28
|
+
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
29
|
+
| `tooling release:changesets` | Changesets version/publish for Forgejo CI. Flag: `--dry-run`. Env: `FORGEJO_SERVER_URL`, `FORGEJO_REPOSITORY`, `FORGEJO_TOKEN`. |
|
|
30
|
+
| `tooling release:simple` | Streamlined release using commit-and-tag-version. |
|
|
31
|
+
| `tooling release:trigger` | Trigger a release workflow. |
|
|
32
|
+
| `tooling forgejo:create-release` | Create a Forgejo release from a tag. |
|
|
33
|
+
| `tooling changesets:merge` | Merge a changesets version PR. |
|
|
34
|
+
|
|
35
|
+
## Config file
|
|
36
|
+
|
|
37
|
+
`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.
|
|
38
|
+
|
|
39
|
+
## Library API
|
|
40
|
+
|
|
41
|
+
The `"."` export provides type-only exports for programmatic use:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import type {
|
|
45
|
+
ProjectConfig,
|
|
46
|
+
GeneratorResult,
|
|
47
|
+
GeneratorContext,
|
|
48
|
+
Generator,
|
|
49
|
+
DetectedProjectState,
|
|
50
|
+
LegacyConfig,
|
|
51
|
+
} from "@bensandee/tooling";
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
| Type | Description |
|
|
55
|
+
| ---------------------- | ----------------------------------------------------------------------------------------------- |
|
|
56
|
+
| `ProjectConfig` | User config shape (persisted in `.tooling.json`) |
|
|
57
|
+
| `GeneratorContext` | Context passed to generator functions (`exists`, `read`, `write`, `remove`, `confirmOverwrite`) |
|
|
58
|
+
| `GeneratorResult` | Result from a generator (created/updated/skipped files) |
|
|
59
|
+
| `Generator` | Generator function signature: `(ctx: GeneratorContext) => Promise<GeneratorResult>` |
|
|
60
|
+
| `DetectedProjectState` | Detected existing project state (package manager, CI, etc.) |
|
|
61
|
+
| `LegacyConfig` | Legacy config detection for migration |
|
|
62
|
+
|
|
63
|
+
## Docker verification
|
|
64
|
+
|
|
65
|
+
The `@bensandee/tooling/docker-verify` export provides utilities for verifying Docker Compose stacks via health checks.
|
|
66
|
+
|
|
67
|
+
### Quick start
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import { createRealExecutor, runVerification } from "@bensandee/tooling/docker-verify";
|
|
71
|
+
import type { VerifyConfig } from "@bensandee/tooling/docker-verify";
|
|
72
|
+
|
|
73
|
+
const config: VerifyConfig = {
|
|
74
|
+
compose: {
|
|
75
|
+
cwd: "./deploy",
|
|
76
|
+
composeFiles: ["docker-compose.yaml"],
|
|
77
|
+
services: ["api", "db"],
|
|
78
|
+
},
|
|
79
|
+
buildCommand: "pnpm image:build",
|
|
80
|
+
healthChecks: [
|
|
81
|
+
{
|
|
82
|
+
name: "API",
|
|
83
|
+
url: "http://localhost:3000/health",
|
|
84
|
+
validate: async (res) => res.ok,
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
timeoutMs: 120_000,
|
|
88
|
+
pollIntervalMs: 5_000,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const result = await runVerification(createRealExecutor(), config);
|
|
92
|
+
if (!result.success) {
|
|
93
|
+
console.error(result.reason, result.message);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Exports
|
|
98
|
+
|
|
99
|
+
| Export | Description |
|
|
100
|
+
| -------------------------------------- | ----------------------------------------------------------------- |
|
|
101
|
+
| `runVerification(executor, config)` | Full lifecycle: build, compose up, health check polling, teardown |
|
|
102
|
+
| `createRealExecutor()` | Production executor (real shell, fetch, timers) |
|
|
103
|
+
| `composeUp(executor, config)` | Start compose services |
|
|
104
|
+
| `composeDown(executor, config)` | Stop and remove compose services |
|
|
105
|
+
| `composeLogs(executor, config)` | Stream compose logs |
|
|
106
|
+
| `composePs(executor, config)` | List running containers |
|
|
107
|
+
| `checkHttpHealth(executor, check)` | Run a single HTTP health check |
|
|
108
|
+
| `getContainerHealth(executor, config)` | Check container-level health status |
|
|
109
|
+
|
|
110
|
+
### Types
|
|
111
|
+
|
|
112
|
+
| Type | Description |
|
|
113
|
+
| ---------------------- | ------------------------------------------------------------------------------------------ |
|
|
114
|
+
| `VerifyConfig` | Full verification config (compose settings, build command, health checks, timeouts) |
|
|
115
|
+
| `ComposeConfig` | Docker Compose settings (cwd, compose files, env file, services) |
|
|
116
|
+
| `HttpHealthCheck` | Health check definition (name, URL, validate function) |
|
|
117
|
+
| `VerifyResult` | Result: `{ success: true, elapsedMs }` or `{ success: false, reason, message, elapsedMs }` |
|
|
118
|
+
| `DockerVerifyExecutor` | Side-effect abstraction (exec, fetch, timers) for testability |
|
|
119
|
+
| `ContainerInfo` | Container status info from `composePs` |
|
|
120
|
+
|
|
121
|
+
## [Changelog](./CHANGELOG.md)
|
package/dist/bin.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|