@bensandee/forgejo-cli 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Orange Bike Labs, LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # @bensandee/forgejo-cli
2
+
3
+ `bst-fj`: the Forgejo API commands, without the rest of `bst`. These commands used to ship on
4
+ `@bensandee/tooling`'s `bst` bin.
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ pnpm add -D @bensandee/forgejo-cli
10
+
11
+ # Or run directly
12
+ pnpm dlx @bensandee/forgejo-cli --help
13
+ ```
14
+
15
+ ## Connection
16
+
17
+ Every command finds its repository and token the same way `bst` does. It reads the environment
18
+ first:
19
+
20
+ | Variable | Meaning |
21
+ | -------------------- | ---------------------------------------------------------- |
22
+ | `FORGEJO_SERVER_URL` | The forge's base URL, such as `https://codeberg.org` |
23
+ | `FORGEJO_REPOSITORY` | The target repository as `owner/repo` |
24
+ | `RELEASE_TOKEN` | The API token (`FORGEJO_TOKEN` is used when this is unset) |
25
+
26
+ When the server URL or repository is not set, it falls back to the `origin` git remote, then to
27
+ `package.json#repository`. A command that takes `--repo` targets that repository instead.
28
+
29
+ ## Environment file
30
+
31
+ Set `BST_ENV_FILE` to the path of an env file, and `bst-fj` loads it before anything else runs, the
32
+ same way `bst` does. A variable already set in the environment always wins over the file. A file
33
+ that cannot be read stops the command before it starts. This is for development only: a production
34
+ run should get every variable from its environment and leave `BST_ENV_FILE` unset.
35
+
36
+ ## Commands
37
+
38
+ Run `bst-fj --help` for the list and `bst-fj <command> --help` for each command's flags. Every
39
+ command takes `--json`, which prints exactly one JSON document, failures included.
40
+
41
+ | Command | What it does |
42
+ | ---------------- | ---------------------------------------------------------------------------------------------------------- |
43
+ | `labels` | `list` a repository's labels, or `sync` one named set from a `--file` (creates and updates, never deletes) |
44
+ | `secrets` | `set`, `list` or `delete` Forgejo Actions secrets |
45
+ | `webhooks` | List webhooks across an instance (system, user, org and repo) |
46
+ | `release:create` | Create a release for a tag the forge already has; refuses a tag the forge lacks unless given `--target` |
47
+ | `pr:checks` | Read a pull request's CI verdict, optionally `--wait` for it to settle |
48
+ | `pr:list` | List a repository's pull requests |
49
+ | `commit:status` | Read the status checks for a commit SHA, branch, tag or git ref |
50
+
51
+ Zero posted statuses reads as `no-status`, never as green. Every command is Forgejo-only: on
52
+ GitHub, use `gh`.
package/bin/bst-fj.mjs ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Stable bin target for `bst-fj`.
4
+ *
5
+ * This file exists only so that `node_modules/.bin/bst-fj` can be created, and it is committed
6
+ * rather than built for exactly that reason. pnpm links bins **during install**, and skips one
7
+ * whose target is missing -- so pointing `bin` straight at `dist/bin.mjs` works only in a tree
8
+ * that already happens to be built. A fresh checkout installs before it builds, pnpm warns
9
+ * (`Failed to create bin ... ENOENT`) and moves on, and building afterwards does not go back and
10
+ * create the link. Every later `pnpm exec bst-fj` then fails with `Command "bst-fj" not found`.
11
+ *
12
+ * The indirection costs one module load and makes the bin link independent of build state: the
13
+ * link always exists, and `dist/bin.mjs` only has to be there by the time someone runs it. When
14
+ * it is not, the failure is an explicit ERR_MODULE_NOT_FOUND naming the missing build output --
15
+ * a far better error than a command that appears not to exist.
16
+ *
17
+ * Consumers installing from the registry get both files (`files` ships `bin` and `dist`) and are
18
+ * unaffected either way, since a published tarball is always built.
19
+ *
20
+ * Loaded with a dynamic `await import` rather than a bare `import "../dist/bin.mjs"`, which is an
21
+ * unassigned import and trips `import(no-unassigned-import)`. Suppressing that rule would be the
22
+ * wrong trade for a file whose entire purpose is a side effect: the dynamic form says "run this"
23
+ * rather than "bring in these bindings", which is what is actually meant here.
24
+ */
25
+ await import("../dist/bin.mjs");