@sous-io/sous 0.2.18 → 0.2.19
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/docs/markdown/_sidebar.md +1 -0
- package/docs/markdown/commands.md +28 -0
- package/docs/markdown/repositories-authoring.md +7 -1
- package/docs/markdown/repositories-contributing.md +145 -0
- package/package.json +1 -1
- package/recipes/core/sous-skills/sous.recipe.yaml +1 -1
- package/src/commands/repo/contribute.ts +604 -0
- package/src/lib/repos/contribute.ts +452 -0
- package/src/lib/repos/release/changelog.ts +20 -7
- package/src/lib/repos/release/git-state.ts +16 -0
- package/src/lib/repos/release/submit-service.ts +1 -1
- package/src/utils/formatting.ts +27 -1
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
- [Overview](repositories.md)
|
|
13
13
|
- [Quickstart](repositories-quickstart.md)
|
|
14
14
|
- [Consuming recipes](repositories-consuming.md)
|
|
15
|
+
- [Contributing a change](repositories-contributing.md)
|
|
15
16
|
- [Authoring a repository](repositories-authoring.md)
|
|
16
17
|
- [Recipe variables](repositories-variables.md)
|
|
17
18
|
- [Providers](repositories-providers.md)
|
|
@@ -248,6 +248,34 @@ Takes `--dry-run`, `--no-build`, `--answer` and `--answers-file`.
|
|
|
248
248
|
|
|
249
249
|
Example: `sous repo unlink sous-recipes --update`
|
|
250
250
|
|
|
251
|
+
### `sous repo contribute REF`
|
|
252
|
+
Starts a contribution to a recipe repository, or finishes one with `--finish`, by running `sous repo link`,
|
|
253
|
+
`sous repo submit` and `sous repo unlink` in order; see [Contributing a change](repositories-contributing.md).
|
|
254
|
+
`REF` names a repository, or a namespace or recipe, in which case the repository that publishes it is used.
|
|
255
|
+
Each step runs the real command with the flags below passed through, prints as it runs, and a failure names the
|
|
256
|
+
step that failed and the steps that completed. `--dry-run` prints each step and runs none. Also spelled
|
|
257
|
+
`sous repo contrib`.
|
|
258
|
+
|
|
259
|
+
Starting runs `sous repo link REPO --latest --generate-branch`:
|
|
260
|
+
|
|
261
|
+
- `--create-branch <name>`: start on a new branch with this name instead of a generated one.
|
|
262
|
+
- `--branch <name>`: work on an existing branch instead of a new one (when finishing, the branch to submit).
|
|
263
|
+
- `--from <branch>`: the base of the new branch; defaults to the repository's default branch.
|
|
264
|
+
- `--global`: the machine-wide link, sharing one checkout (when finishing, too).
|
|
265
|
+
|
|
266
|
+
Finishing looks for work no proposal carries yet (uncommitted changes, commits never pushed, or pushed commits
|
|
267
|
+
with no open proposal), asks whether to submit it with `sous repo submit REPO`, then runs
|
|
268
|
+
`sous repo unlink REPO --update`. With nothing to submit, the submit step is skipped without asking.
|
|
269
|
+
|
|
270
|
+
- `--submit`, `--no-submit`: submit without asking, or finish without submitting.
|
|
271
|
+
- `--title <text>`, `--body <text>`, `--draft`, `--commit`: passed through to `sous repo submit`.
|
|
272
|
+
- `--remove`: passed through to `sous repo unlink`, deleting the checkout sous cloned.
|
|
273
|
+
- `-y, --yes`: passed through to every step, and submits without asking (also `-f`, `--force`).
|
|
274
|
+
- `--accept-first`: when `REF` matches several things, take the first one listed.
|
|
275
|
+
|
|
276
|
+
Example: `sous repo contribute workflow/task-files`, then `sous repo contribute workflow/task-files --finish
|
|
277
|
+
--title "Clarify the resume steps" --body "The resume steps skipped the task file."`
|
|
278
|
+
|
|
251
279
|
### `sous repo init [DIRECTORY]`
|
|
252
280
|
Creates a new recipe repository in a directory, defaulting to the current one; `--dry-run` prints the files it
|
|
253
281
|
would write. See [Authoring a repository](repositories-authoring.md).
|
|
@@ -368,6 +368,10 @@ changing its branch says it affects all of them.
|
|
|
368
368
|
|
|
369
369
|
## Contribute to someone else's repository
|
|
370
370
|
|
|
371
|
+
?> The whole path a recipe user takes, from starting a change in their own project to picking up the released
|
|
372
|
+
version, is one page: [Contributing a change](repositories-contributing.md). `sous repo contribute` chains the
|
|
373
|
+
commands this section and [Edit a repository in place](#edit-a-repository-in-place) describe.
|
|
374
|
+
|
|
371
375
|
`sous repo submit` proposes a change to a repository's maintainers and follows it through; it never publishes
|
|
372
376
|
and never writes to a repository directly. Run it inside the recipe repository you changed, or from a project
|
|
373
377
|
that links it: `sous repo submit sous-recipes` runs in the linked checkout, and with no argument the project's
|
|
@@ -401,7 +405,8 @@ your change carries with the default branch:
|
|
|
401
405
|
|
|
402
406
|
- recipes added, and recipes retired (a renamed recipe shows as one of each);
|
|
403
407
|
- version changes;
|
|
404
|
-
- recipes whose files changed without a version raise,
|
|
408
|
+
- recipes whose files changed without a version raise, with a warning that a release run with `--ci` (as the
|
|
409
|
+
scaffolded workflow runs it after a merge) refuses a changed recipe whose version was not raised;
|
|
405
410
|
- namespaces added or removed;
|
|
406
411
|
- variables added, removed or changed, with a warning that removing a variable or tightening its validation is
|
|
407
412
|
usually a major change.
|
|
@@ -434,6 +439,7 @@ that field in your own repository so a contributor is never left without a route
|
|
|
434
439
|
|
|
435
440
|
- [Repository file formats](repositories-file-formats.md): every manifest and index schema
|
|
436
441
|
- [Consuming recipes](repositories-consuming.md): the other side, from `repo add` to `build`
|
|
442
|
+
- [Contributing a change](repositories-contributing.md): proposing a change to a recipe you use, start to finish
|
|
437
443
|
- [Command reference](commands.md): every command and flag
|
|
438
444
|
- [Providers](repositories-providers.md): what `gh` and `glab` can each do for a release and a submission
|
|
439
445
|
- [Recipe variables](repositories-variables.md): how the definitions declared here are answered at build time
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# Contributing a Recipe Change
|
|
2
|
+
|
|
3
|
+
This page takes you from "a recipe I use could be better" to "my project runs the released fix", for a recipe
|
|
4
|
+
published by someone else's repository. It is written for the person using the recipe, not the person who
|
|
5
|
+
maintains it; everything happens from inside your own project.
|
|
6
|
+
|
|
7
|
+
One command covers the lifecycle: `sous repo contribute` starts a contribution, and `sous repo contribute --finish`
|
|
8
|
+
ends it. Each step it takes is an ordinary sous command, named on this page, so you can also run the parts by
|
|
9
|
+
hand.
|
|
10
|
+
|
|
11
|
+
## Start
|
|
12
|
+
|
|
13
|
+
Name the repository, or any namespace or recipe it publishes:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
sous repo contribute sous-recipes # the repository itself
|
|
17
|
+
sous repo contribute workflow/task-files # the repository that publishes this recipe
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
A namespace or recipe is resolved to the repository that publishes it, the same way every other command resolves
|
|
21
|
+
a reference; a name that matches in more than one trusted repository is a question, which `--accept-first`
|
|
22
|
+
answers by taking the first match.
|
|
23
|
+
|
|
24
|
+
Starting runs one step, `sous repo link <repo> --latest --generate-branch`:
|
|
25
|
+
|
|
26
|
+
- the repository is cloned into `.sous/repos/<owner>/<name>`, or the clone already there is reused;
|
|
27
|
+
- its default branch is brought up to upstream's (anything that would discard local work is listed and asked
|
|
28
|
+
about first; `--yes` answers);
|
|
29
|
+
- a new branch named `sous/edit-<YYYYMMDD>-<HHMM>` is created from it, so the change never stacks on an old,
|
|
30
|
+
already-merged branch;
|
|
31
|
+
- the project is pointed at the checkout, so builds read the repository from it instead of from a published
|
|
32
|
+
version.
|
|
33
|
+
|
|
34
|
+
Name the branch yourself with `--create-branch <name>`, work on a branch that already exists with
|
|
35
|
+
`--branch <name>`, or start the new branch from another base with `--from <branch>`. `--global` links the
|
|
36
|
+
machine-wide checkout that every project on this machine shares. The link and its flags are described in full
|
|
37
|
+
under [Edit a repository in place](repositories-authoring.md#edit-a-repository-in-place).
|
|
38
|
+
|
|
39
|
+
`--dry-run` prints the step without running it.
|
|
40
|
+
|
|
41
|
+
## Edit, and see the change in your own build
|
|
42
|
+
|
|
43
|
+
Edit the recipe's files in the checkout the start step printed. While the repository is linked, every build in
|
|
44
|
+
your project reads its recipes from that checkout, so the next `sous build` shows your edit in your own agent's
|
|
45
|
+
files; there is nothing to publish first. Builds say the repository is linked every time, because a link
|
|
46
|
+
bypasses versions, the lockfile and freshness checks.
|
|
47
|
+
|
|
48
|
+
Commit your work on the branch as you go. What a proposal carries is commits.
|
|
49
|
+
|
|
50
|
+
## Propose the change
|
|
51
|
+
|
|
52
|
+
Finishing proposes whatever is not proposed yet, so you can go straight to [Finish](#finish). To open the proposal
|
|
53
|
+
now and keep working, run the submit step on its own:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
sous repo submit sous-recipes --title "Clarify the resume steps" --body "The resume steps skipped the task file."
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`sous repo submit` validates the repository, pushes the branch (through a fork on your own account when you
|
|
60
|
+
cannot push to the repository itself) and opens a pull request or merge request through the host's own command
|
|
61
|
+
line tool. Its body is your description followed by a changelog sous generates. Every step it takes is described
|
|
62
|
+
under [Contribute to someone else's repository](repositories-authoring.md#contribute-to-someone-elses-repository).
|
|
63
|
+
|
|
64
|
+
## Revise it
|
|
65
|
+
|
|
66
|
+
Review comments are answered with more commits on the same branch. Commit them, then run
|
|
67
|
+
`sous repo submit sous-recipes` again: it finds the open proposal for the branch and pushes the new commits into
|
|
68
|
+
it. A new `--title` or `--body` replaces the proposal's own. With nothing new to send, it reports where the
|
|
69
|
+
proposal stands (review, checks, and whether it can merge). `sous repo submit sous-recipes --status` only
|
|
70
|
+
reports.
|
|
71
|
+
|
|
72
|
+
## Finish
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
sous repo contribute sous-recipes --finish
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Finishing first looks at the branch for work no proposal carries yet: uncommitted changes, commits that were never
|
|
79
|
+
pushed, or pushed commits with no open proposal behind them (that last one is looked up with the host's command
|
|
80
|
+
line tool). When it finds some, it asks whether to submit it; `--submit` or `--yes` submits without asking,
|
|
81
|
+
`--no-submit` finishes without submitting, and a run with no terminal fails naming those flags. When there is
|
|
82
|
+
nothing to submit, that part is skipped. The submit step passes `--title`, `--body`, `--draft`, `--commit` and
|
|
83
|
+
`--branch` through to `sous repo submit`.
|
|
84
|
+
|
|
85
|
+
Then it runs `sous repo unlink <repo> --update`:
|
|
86
|
+
|
|
87
|
+
- the project goes back to reading published versions, exactly the ones the lockfile pinned before the link;
|
|
88
|
+
- each pin the repository supplies moves to the newest published version its range allows;
|
|
89
|
+
- the project is rebuilt.
|
|
90
|
+
|
|
91
|
+
The checkout stays on disk, so an open proposal can still be revised from it later with `sous repo submit`. Pass
|
|
92
|
+
`--remove` to delete it as well; sous deletes only a checkout it cloned, and lists anything in it that exists
|
|
93
|
+
nowhere else before asking.
|
|
94
|
+
|
|
95
|
+
Every step prints as it runs, preceded by the command line that runs it. When a step fails, its own error comes
|
|
96
|
+
first, followed by the name of the step that failed and the steps that had already completed; nothing after the
|
|
97
|
+
failed step runs. `--dry-run` shows what finishing would do and runs none of it.
|
|
98
|
+
|
|
99
|
+
## Pick up the release
|
|
100
|
+
|
|
101
|
+
A contribution ships when the repository's maintainers merge it and the repository releases a new version. If
|
|
102
|
+
that happened before you finished, `--finish` already moved your pins to it. If it happens later, move them with
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
sous subscription update sous-recipes
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
which runs the same update `unlink --update` runs; with `--dry-run` it only shows what it would move. See
|
|
109
|
+
[Moving to newer versions](repositories-consuming.md#moving-to-newer-versions).
|
|
110
|
+
|
|
111
|
+
## What a contributor leaves alone
|
|
112
|
+
|
|
113
|
+
**Releases are the maintainers' business.** A contributor never runs `sous repo release`, and never edits
|
|
114
|
+
`sous.index.json`. The index is written by the repository's own release after a merge, from the manifests and the
|
|
115
|
+
tags; `sous repo submit` refuses a change that edits it, and says how to put it back.
|
|
116
|
+
|
|
117
|
+
**Versions depend on how the repository releases.** The release workflow `sous repo init` scaffolds, which
|
|
118
|
+
`sous-recipes` also runs, publishes on every merge to the default branch with `sous repo release --ci`, and that
|
|
119
|
+
raises no versions: the version a merge publishes is the one the merged change declares. A recipe whose files
|
|
120
|
+
changed while its `version` still equals its last release tag stops that release. So, unless the repository's
|
|
121
|
+
contribution guide says its maintainers raise versions themselves, raise the recipe's `version` in its
|
|
122
|
+
`sous.recipe.yaml` by hand as part of your change: a patch step for wording and fixes, a minor step for new files
|
|
123
|
+
or a new optional variable, and a major step for anything that breaks an existing subscriber (removing a file,
|
|
124
|
+
renaming a variable, or tightening a variable's validation). The changelog `sous repo submit` generates lists any
|
|
125
|
+
recipe your change touches without a version raise, with a warning that a `--ci` release refuses it, so a missed
|
|
126
|
+
one is visible in the proposal. The repository's
|
|
127
|
+
own guide is named by the `contribute` field of its `sous.repo.yaml`; for `sous-recipes` it is its
|
|
128
|
+
`CONTRIBUTING.md`.
|
|
129
|
+
|
|
130
|
+
**Core is edited in sous itself.** The `core` recipes in `sous-io/sous-recipes` are machine-written copies. Their
|
|
131
|
+
source is `recipes/core/sous-skills/` in `sous-io/sous`, and each sous release overwrites the copy, so an edit
|
|
132
|
+
merged into the copy would be lost. Their manifest says so with a
|
|
133
|
+
[`submissions`](repositories-file-formats.md#the-submissions-block) block: `sous repo submit` warns before
|
|
134
|
+
proposing a change that touches one and names where to send it instead, and the repository's own pull request
|
|
135
|
+
check refuses such a change. Propose core edits as a pull request to `sous-io/sous`.
|
|
136
|
+
|
|
137
|
+
## The commands this chains
|
|
138
|
+
|
|
139
|
+
| Part of the lifecycle | What `sous repo contribute` runs |
|
|
140
|
+
|-----------------------|----------------------------------|
|
|
141
|
+
| Start | `sous repo link <repo> --latest --generate-branch` (or the branch you named) |
|
|
142
|
+
| Propose, when finishing | `sous repo submit <repo>`, with the proposal flags passed through |
|
|
143
|
+
| Finish | `sous repo unlink <repo> --update`, plus `--remove` when given |
|
|
144
|
+
|
|
145
|
+
Every flag is listed in the [command reference](commands.md#sous-repo-contribute-ref).
|
package/package.json
CHANGED