aronrepo 2.2.1 → 3.0.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/README.md CHANGED
@@ -2,60 +2,72 @@
2
2
 
3
3
  # aronrepo
4
4
 
5
- Facade install target for the Aronrepo monorepo toolchain.
5
+ One commit standard and one release engine for JavaScript repositories, built so the repository owner and coding agents follow the same rules. It replaces semantic-release, commitlint, and changelog presets.
6
6
 
7
- Use this package when you want one dependency that brings the published Aronrepo toolchain packages for conventional commits, commitlint configuration, changelog generation, semantic-release configuration, and pnpm workspace publishing. The package also provides a small programmatic entrypoint that names those packages.
7
+ ## Install
8
8
 
9
- The package has no runtime side effects and does not configure commitlint, changelog generation, or semantic-release by itself.
9
+ ```sh
10
+ bun add -d aronrepo husky
11
+ ```
10
12
 
11
- ## Install
13
+ `pnpm add -D aronrepo husky` and `npm install -D aronrepo husky` work too. This package is ESM-only and has no peer tools.
12
14
 
13
- For complete adoption, install the facade package plus the external peer tools used by your repository commands:
15
+ ## Configure
14
16
 
15
- ```sh
16
- pnpm add -D aronrepo @commitlint/cli semantic-release
17
+ ```js
18
+ // aronrepo.config.js
19
+ /** @type {import('aronrepo').AronrepoConfig} */
20
+ export default {
21
+ release: {
22
+ mode: 'explicit' // or 'auto'
23
+ }
24
+ }
17
25
  ```
18
26
 
19
- For programmatic package-list usage only:
27
+ ```sh
28
+ # .husky/commit-msg
29
+ aronrepo check --edit "$1"
30
+ ```
20
31
 
21
32
  ```sh
22
- pnpm add -D aronrepo
33
+ bun x aronrepo agents --write
34
+ bun x aronrepo doctor
23
35
  ```
24
36
 
25
- This package is ESM-only.
37
+ In `explicit` mode (the default) only `Bump(Minor)` and `Bump(Major)` raise minor and major versions. In `auto` mode `Add` releases a minor version and a `BREAKING CHANGE:` footer releases a major version. A release type that changes no published file releases nothing.
26
38
 
27
- ## Usage
39
+ ## Commit Types
28
40
 
29
- ```ts
30
- import { packages } from 'aronrepo'
41
+ `Type(Scope): Summary`, with a summary that starts with an uppercase letter or digit and has no trailing period.
31
42
 
32
- console.log(packages)
33
- ```
43
+ | Release | Types |
44
+ | --- | --- |
45
+ | Owner decides | `Bump(Major)`, `Bump(Minor)`, `Bump(Patch)` |
46
+ | Patch (`Add`: minor in `auto`) | `Add`, `Improve`, `Perf`, `Fix`, `Deprecate`, `Drop`, `Upgrade`, `Revert`, `Docs(README)` |
47
+ | None | `Docs`, `Test`, `Benchmark`, `Example`, `Build`, `CI`, `Style`, `Refactor`, `Chore` |
34
48
 
35
- `packages` is a readonly list of the Aronrepo toolchain package names:
49
+ `aronrepo policy --json` describes when to use each type. `Feat`, `New`, `Update`, and `Misc` are legacy types that `aronrepo check` rejects.
36
50
 
37
- ```ts
38
- [
39
- '@aronrepo/commitlint-config',
40
- '@aronrepo/conventional-commits',
41
- '@aronrepo/conventional-changelog-config',
42
- '@aronrepo/semantic-release-config',
43
- '@aronrepo/semantic-release-pnpm'
44
- ]
45
- ```
51
+ ## Commands
46
52
 
47
- ## Toolchain Packages
53
+ | Command | Use |
54
+ | --- | --- |
55
+ | `aronrepo check` | check a commit message, a commit range, or a PR title |
56
+ | `aronrepo explain` | print the next version and the reason for each commit |
57
+ | `aronrepo release [--dry-run]` | publish the packages, push the version tag, and create the GitHub release |
58
+ | `aronrepo policy [--json]` | print the policy |
59
+ | `aronrepo agents [--write]` | check or regenerate the policy block in `AGENTS.md` |
60
+ | `aronrepo doctor` | check the setup |
48
61
 
49
- - `@aronrepo/conventional-commits`: commit types, release impact rules, changelog groups, and AI agent policy.
50
- - `@aronrepo/commitlint-config`: commitlint rules for Aronrepo commit and PR title validation.
51
- - `@aronrepo/conventional-changelog-config`: parser, writer, and recommended bump options for conventional changelog tooling.
52
- - `@aronrepo/semantic-release-config`: semantic-release defaults and workspace package discovery.
53
- - `@aronrepo/semantic-release-pnpm`: semantic-release plugin for publishing pnpm workspace packages.
62
+ `aronrepo release` publishes `main` on `latest` and `alpha`, `beta`, `rc`, and `canary` as prereleases on their own dist-tags. It publishes every package on a staging dist-tag first, moves the channel's dist-tag once all of them are on the registry, and resumes an interrupted run.
54
63
 
55
- ## AI Coding Adoption
64
+ ## API
56
65
 
57
- For a complete adoption prompt that an AI coding agent can use in another repository, see the root guide:
66
+ ```js
67
+ import { parseCommit, resolveRelease, renderReleaseNotes } from 'aronrepo'
68
+ import { planRelease, explainRange } from 'aronrepo/node'
69
+ ```
58
70
 
59
- - [AI Coding Integration](https://github.com/1aron/aronrepo/blob/main/docs/ai-coding.md)
71
+ `aronrepo` exports the commit standard without Node dependencies; `aronrepo/node` exports the config loader, git and workspace helpers, the release engine, and the CLI commands.
60
72
 
61
- The prompt tells the agent to inspect the target repository first, install the `aronrepo` facade and required peer tools, configure commitlint and semantic-release, document release behavior, and add agent guidance without unrelated refactors.
73
+ See the [Aronrepo repository](https://github.com/1aron/aronrepo#readme) for release branches, CI setup, AI coding integration, and migrating from Aronrepo 2.
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {}
package/dist/cli.js ADDED
@@ -0,0 +1,110 @@
1
+ #!/usr/bin/env node
2
+ import { releaseModes } from "./index.js";
3
+ import { c as release, i as explain, n as check, o as policy, r as doctor, t as agents } from "./commands-BRnoLH3z.js";
4
+ import { parseArgs } from "node:util";
5
+ // src/cli.ts
6
+ const help = `Usage: aronrepo <command> [options]
7
+
8
+ Commands:
9
+ check Check commits against the release policy
10
+ --edit <file> commit-msg hook: message file + staged files
11
+ --message <text> a message + staged files (or --files)
12
+ --title <text> [--base <ref> --head <ref>] a PR title + PR diff
13
+ --from <ref> [--to <ref>] every commit in a range
14
+ explain Print the next release and the reason for each commit
15
+ [--from <ref>] [--to <ref>] defaults to the release range of the branch
16
+ release Publish the next release: npm packages, the version tag, and the GitHub release
17
+ [--dry-run] [--branch <name>] prints the plan and notes without changes
18
+ policy Print the release policy [--json | --markdown]
19
+ agents Check the AGENTS.md policy block, or regenerate it with --write [--file <path>]
20
+ doctor Check the Aronrepo setup of this repository
21
+
22
+ Options:
23
+ --cwd <dir> repository root (default: current directory)
24
+ --mode <explicit|auto> override release.mode from aronrepo.config.js
25
+ --json machine-readable output
26
+ `;
27
+ async function main(argv) {
28
+ const { positionals, values } = parseArgs({
29
+ args: argv,
30
+ allowPositionals: true,
31
+ options: {
32
+ cwd: { type: "string" },
33
+ mode: { type: "string" },
34
+ json: { type: "boolean" },
35
+ markdown: { type: "boolean" },
36
+ write: { type: "boolean" },
37
+ check: { type: "boolean" },
38
+ file: { type: "string" },
39
+ edit: { type: "string" },
40
+ message: { type: "string" },
41
+ title: { type: "string" },
42
+ base: { type: "string" },
43
+ head: { type: "string" },
44
+ from: { type: "string" },
45
+ to: { type: "string" },
46
+ files: { type: "string" },
47
+ "dry-run": { type: "boolean" },
48
+ branch: { type: "string" },
49
+ help: {
50
+ type: "boolean",
51
+ short: "h"
52
+ }
53
+ }
54
+ });
55
+ const [command] = positionals;
56
+ if (!command || values.help) return {
57
+ code: command || values.help ? 0 : 2,
58
+ output: help
59
+ };
60
+ if (values.mode && !releaseModes.includes(values.mode)) return {
61
+ code: 2,
62
+ output: `--mode must be one of: ${releaseModes.join(", ")}`
63
+ };
64
+ const common = {
65
+ ...values.cwd ? { cwd: values.cwd } : {},
66
+ ...values.mode ? { mode: values.mode } : {},
67
+ ...values.json ? { json: true } : {}
68
+ };
69
+ const optional = (...keys) => Object.fromEntries(keys.filter((key) => values[key] !== void 0).map((key) => [key, values[key]]));
70
+ switch (command) {
71
+ case "check": return check({
72
+ ...common,
73
+ ...optional("edit", "message", "title", "base", "head", "from", "to"),
74
+ ...values.files !== void 0 ? { files: values.files.split(",").map((file) => file.trim()).filter(Boolean) } : {}
75
+ });
76
+ case "explain": return explain({
77
+ ...common,
78
+ ...optional("from", "to")
79
+ });
80
+ case "release": return release({
81
+ ...common,
82
+ ...optional("branch"),
83
+ ...values["dry-run"] ? { dryRun: true } : {}
84
+ });
85
+ case "policy": return policy({
86
+ ...common,
87
+ ...values.markdown ? { markdown: true } : {}
88
+ });
89
+ case "agents": return agents({
90
+ ...common,
91
+ ...optional("file"),
92
+ ...values.write ? { write: true } : {}
93
+ });
94
+ case "doctor": return doctor(common);
95
+ default: return {
96
+ code: 2,
97
+ output: `Unknown command "${command}".\n\n${help}`
98
+ };
99
+ }
100
+ }
101
+ main(process.argv.slice(2)).then(({ code, output }) => {
102
+ if (output) (code === 0 ? process.stdout : process.stderr).write(`${output}\n`);
103
+ process.exitCode = code;
104
+ }).catch((error) => {
105
+ process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
106
+ process.exitCode = 1;
107
+ });
108
+ export {};
109
+
110
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { parseArgs } from 'node:util'\nimport { releaseModes, type ReleaseMode } from './index'\nimport { agents, check, doctor, explain, policy, release, type CommandResult } from './commands'\n\nconst help = `Usage: aronrepo <command> [options]\n\nCommands:\n check Check commits against the release policy\n --edit <file> commit-msg hook: message file + staged files\n --message <text> a message + staged files (or --files)\n --title <text> [--base <ref> --head <ref>] a PR title + PR diff\n --from <ref> [--to <ref>] every commit in a range\n explain Print the next release and the reason for each commit\n [--from <ref>] [--to <ref>] defaults to the release range of the branch\n release Publish the next release: npm packages, the version tag, and the GitHub release\n [--dry-run] [--branch <name>] prints the plan and notes without changes\n policy Print the release policy [--json | --markdown]\n agents Check the AGENTS.md policy block, or regenerate it with --write [--file <path>]\n doctor Check the Aronrepo setup of this repository\n\nOptions:\n --cwd <dir> repository root (default: current directory)\n --mode <explicit|auto> override release.mode from aronrepo.config.js\n --json machine-readable output\n`\n\nasync function main(argv: string[]): Promise<CommandResult> {\n const { positionals, values } = parseArgs({\n args: argv,\n allowPositionals: true,\n options: {\n cwd: { type: 'string' },\n mode: { type: 'string' },\n json: { type: 'boolean' },\n markdown: { type: 'boolean' },\n write: { type: 'boolean' },\n check: { type: 'boolean' },\n file: { type: 'string' },\n edit: { type: 'string' },\n message: { type: 'string' },\n title: { type: 'string' },\n base: { type: 'string' },\n head: { type: 'string' },\n from: { type: 'string' },\n to: { type: 'string' },\n files: { type: 'string' },\n 'dry-run': { type: 'boolean' },\n branch: { type: 'string' },\n help: { type: 'boolean', short: 'h' }\n }\n })\n const [command] = positionals\n if (!command || values.help) return { code: command || values.help ? 0 : 2, output: help }\n if (values.mode && !releaseModes.includes(values.mode as ReleaseMode)) {\n return { code: 2, output: `--mode must be one of: ${releaseModes.join(', ')}` }\n }\n const common = {\n ...(values.cwd ? { cwd: values.cwd } : {}),\n ...(values.mode ? { mode: values.mode as ReleaseMode } : {}),\n ...(values.json ? { json: true } : {})\n }\n const optional = <K extends keyof typeof values>(...keys: K[]) =>\n Object.fromEntries(keys.filter((key) => values[key] !== undefined).map((key) => [key, values[key]]))\n\n switch (command) {\n case 'check':\n return check({\n ...common,\n ...optional('edit', 'message', 'title', 'base', 'head', 'from', 'to'),\n ...(values.files !== undefined ? { files: values.files.split(',').map((file) => file.trim()).filter(Boolean) } : {})\n })\n case 'explain':\n return explain({ ...common, ...optional('from', 'to') })\n case 'release':\n return release({ ...common, ...optional('branch'), ...(values['dry-run'] ? { dryRun: true } : {}) })\n case 'policy':\n return policy({ ...common, ...(values.markdown ? { markdown: true } : {}) })\n case 'agents':\n return agents({ ...common, ...optional('file'), ...(values.write ? { write: true } : {}) })\n case 'doctor':\n return doctor(common)\n default:\n return { code: 2, output: `Unknown command \"${command}\".\\n\\n${help}` }\n }\n}\n\nmain(process.argv.slice(2))\n .then(({ code, output }) => {\n if (output) (code === 0 ? process.stdout : process.stderr).write(`${output}\\n`)\n process.exitCode = code\n })\n .catch((error: unknown) => {\n process.stderr.write(`${error instanceof Error ? error.message : String(error)}\\n`)\n process.exitCode = 1\n })\n"],"mappings":";;;;;AAKA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;AAsBb,eAAe,KAAK,MAAwC;CACxD,MAAM,EAAE,aAAa,WAAW,UAAU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