jj-octo 0.3.1 → 0.5.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.
Files changed (3) hide show
  1. package/README.md +40 -28
  2. package/dist/jj-octo.js +1829 -1672
  3. package/package.json +13 -11
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # jj-octo
2
2
 
3
- A [jj](https://github.com/jj-vcs/jj) subcommand for working with GitHub that supports stacking.
3
+ A [jj](https://github.com/jj-vcs/jj) subcommand for GitHub that supports stacked pull requests and works in Claude Code cloud sessions.
4
4
 
5
5
  > [!WARNING]
6
6
  > `jj-octo` is in early development, and its commands may change. So far it is largely vibe coded.
@@ -11,58 +11,70 @@ Run `jj gh --help` to list the commands.
11
11
 
12
12
  ## Install
13
13
 
14
- `jj-octo` runs on [bun](https://bun.sh), and calls `jj`. Both must be on `PATH`.
14
+ Each [GitHub release](https://github.com/kkom/jj-octo/releases) has a standalone `jj-octo` for macOS on Apple silicon and Linux on x64 and arm64. Alternatively, run the [npm package](https://www.npmjs.com/package/jj-octo) with [Bun](https://bun.sh). Either way, `jj` must be on `PATH`.
15
15
 
16
- ### For one repository
17
-
18
- With [mise](https://mise.jdx.dev), in the repository's `mise.toml`, where `A.B.C` is a bun version and `X.Y.Z` a [released version](https://www.npmjs.com/package/jj-octo?activeTab=versions) of `jj-octo`:
16
+ With [mise](https://mise.jdx.dev), add it to one repository's `mise.toml`:
19
17
 
20
18
  ```toml
21
19
  [tools]
22
- bun = "A.B.C"
23
-
24
- [tools."npm:jj-octo"]
25
- version = "X.Y.Z"
26
- # mise holds back a package that is new or rarely downloaded, and this approves it.
27
- allow_low_downloads = true
20
+ "github:kkom/jj-octo" = "X.Y.Z"
28
21
  ```
29
22
 
30
- Then set up each checkout, since jj doesn't read config from a committed file:
23
+ Or to every repository:
31
24
 
32
25
  ```
33
- jj-octo init
26
+ mise use --global github:kkom/jj-octo@X.Y.Z
34
27
  ```
35
28
 
36
- It makes the checkout a jj repository colocated with git, makes GitHub's default branch `trunk()`, and sets the `jj gh` alias.
29
+ Then run `jj-octo init` once in each checkout. It makes the checkout a jj repository colocated with git, makes GitHub's default branch `trunk()`, and sets the `jj gh` alias.
37
30
 
38
- ### For every repository
31
+ ## GitHub access
39
32
 
40
- ```
41
- bun install --global jj-octo
42
- jj config set --user aliases.gh '["util", "exec", "--", "jj-octo"]'
43
- ```
33
+ `jj-octo` reads the repository from the `origin` remote.
34
+
35
+ By default, it reads its token from `GH_TOKEN` or `GITHUB_TOKEN`, and otherwise runs `gh auth token`.
44
36
 
45
- Then run `jj-octo init` once in each checkout, as above.
37
+ With `jj-octo.github-auth` set to `git-proxy`, it sends a placeholder token instead. It sends requests through git's proxy for github.com, and trusts git's certificate authorities for it in place of Bun's own. [In a self-hosted environment](#in-a-self-hosted-environment) describes when to use it.
46
38
 
47
- To update it later:
39
+ ## In Claude Code cloud sessions
40
+
41
+ A Claude Code [cloud session](https://code.claude.com/docs/en/claude-code-on-the-web) runs in an Anthropic-hosted environment, or in your organization's self-hosted environment. Each needs its own setup.
42
+
43
+ The session's GitHub proxy can append a "Generated by Claude Code" footer to each pull request body that it creates or edits. `jj gh submit` would read the footer as an edit made on GitHub, and write it into the change. To have `submit` leave the footer out when it compares a pull request's body with its change's description, set:
48
44
 
49
45
  ```
50
- bun update --global --latest jj-octo
46
+ jj config set --repo jj-octo.ignore-claude-code-footer true
51
47
  ```
52
48
 
53
- ## GitHub access
49
+ ### In an Anthropic-hosted environment
54
50
 
55
- `jj-octo` reads the repository from the `origin` remote. It takes its token from `GH_TOKEN` or `GITHUB_TOKEN`, and otherwise from `gh auth token`.
51
+ There, the [GitHub proxy](https://code.claude.com/docs/en/cloud-environments#github-proxy) carries all GitHub traffic. It serves GitHub API requests only for the repositories attached to the session, and rejects GraphQL requests. That's why `jj-octo` uses only GitHub's REST API, while `gh pr` and other tools that depend on GraphQL fail there.
56
52
 
57
- It uses only GitHub's REST API, so that it works in a [Claude Code](https://claude.com/claude-code) cloud session. There, GitHub is reached through a proxy that allows REST calls for the session's repository and blocks GraphQL, which `gh pr` depends on.
53
+ mise reads this repository's releases through the GitHub API, so it can't install them unless the session has this repository attached. Install the npm package instead:
58
54
 
59
- Where git reaches github.com through a proxy that adds the credentials itself, as in a Claude Code cloud session that keeps the token outside the sandbox, have `jj-octo` use that proxy too:
55
+ ```toml
56
+ [tools]
57
+ bun = "A.B.C"
58
+
59
+ [tools."npm:jj-octo"]
60
+ version = "X.Y.Z"
61
+ # mise holds back a package that is new or rarely downloaded, and this approves it.
62
+ allow_low_downloads = true
63
+ ```
64
+
65
+ The session sets `HTTPS_PROXY`, `NODE_EXTRA_CA_CERTS`, and `GH_TOKEN` to the placeholder `proxy-injected`. The GitHub proxy replaces the placeholder with your real credentials. So `jj-octo` works there with its default settings.
66
+
67
+ ### In a self-hosted environment
68
+
69
+ A [self-hosted runner](https://code.claude.com/docs/en/self-hosted-environments-deploy#use-the-anthropic-git-proxy) started with `--use-anthropic-git-proxy` sends git through the Anthropic git proxy. That proxy adds the GitHub credentials of the session's creator. The session then holds no GitHub token, and only git's config names the proxy. There, have `jj-octo` use the same proxy:
60
70
 
61
71
  ```
62
72
  jj config set --repo jj-octo.github-auth git-proxy
63
73
  ```
64
74
 
65
- `jj-octo` then sends its requests through the `http.proxy` that git uses for `https://github.com`, trusts the certificate authorities in git's `http.sslCAInfo` for it, and sends a placeholder token that the proxy replaces. It reads git's settings on each run, so it follows a proxy that moves to another port. `token`, the default, sends your own token.
75
+ `jj-octo` then sends its requests through the `http.proxy` that git uses for `https://github.com`, and trusts the certificate authorities in git's `http.sslCAInfo` for it. It sends a placeholder token, which the proxy must replace with real credentials. It reads git's settings on each run, so it follows a proxy that moves to another port.
76
+
77
+ Don't use `git-proxy` with a proxy that only forwards requests. GitHub would get the placeholder token and reject every request. `token`, the default, sends your own token.
66
78
 
67
79
  ## Development
68
80
 
@@ -72,4 +84,4 @@ bun run check # format, lint, types, tests and build
72
84
  bun run fix # format and lint fixes
73
85
  ```
74
86
 
75
- To release, run `bun run release:patch`, `release:minor` or `release:major` in a pull request, which raises `version` in `package.json`. Once it is merged and the checks pass on `main`, the same workflow publishes that version to npm and tags it.
87
+ To release, run `bun run release:patch`, `release:minor` or `release:major` in a pull request, which raises `version` in `package.json`. Once it is merged and the checks pass on `main`, the same workflow publishes that version to npm, and as a GitHub release with the executables.