Skip to content

feat: jh project create - #78

Open
mbauman wants to merge 3 commits into
mainfrom
feat/project-create
Open

mbauman wants to merge 3 commits into
mainfrom
feat/project-create

Conversation

@mbauman

@mbauman mbauman commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Adds jh project create, which creates a project owned by you by making the same calls as the web UI's New Project dialog:

  1. POST /api/v1/projects/add returns the project ID.
  2. POST /api/v1/projects/create/{id} sets up the repository, cloning the upstream for imports.
  3. POST /api/v1/projects/pull/{id} follows, where a 409 is fine.
jh project create my-analysis --description "Q3 study" --tag finance
jh project create MyPkg.jl --import https://github.com/me/MyPkg.jl
jh project create --resume <project-id>
  • --workflow group|exclusive picks the editing workflow (default group).
  • Private by default: new projects get instance_default_role: "No Access" and are not deployable. Sharing, deployments and the branch workflow are left to the web UI.
  • --product takes a product name, display name or ID from the UI's product list (products.gql) and defaults to the first one.
  • --import recognizes github.com, gitlab.com and bitbucket.org by name. For other hosts it detects self-hosted GitLab (X-Gitlab-Meta on GET /api/v4/version) and GitHub Enterprise (X-GitHub-Request-Id on GET /api/v3/meta), both of which answer without authentication. Anything else needs --provider, which also overrides detection. The server's NOTOKEN, NOACCESS and NOPROVIDER errors are reported as hints.
  • --resume <id>: if the project is added but its repository setup fails, the error prints the ID and the --resume command, which reruns only the setup instead of creating a duplicate.
  • --json prints {"project_id", "name", "owner", "product", "git_upstream_url"}.

Testing

  • Unit tests cover the request body (including the JSON field names the server expects), validation of names, tags and import URLs, product matching, the add → create → pull sequence against a fake server, and error mapping.
  • The e2e CLI tests check the help text and argument validation. The e2e suite still doesn't create projects on the instance.
  • GitLab detection was checked against gitlab.gnome.org and gitlab.freedesktop.org, and Codeberg and example.com are rejected. GitHub Enterprise detection is tested only against a fake server.
  • Not yet run against a live JuliaHub instance.

🤖 Generated with Claude Code

mbauman and others added 3 commits October 27, 2026 11:21
Creates a project owned by you, making the same calls as the web UI's New
Project dialog: `POST /api/v1/projects/add`, then
`POST /api/v1/projects/create/{id}` to set up the repository and
`POST /api/v1/projects/pull/{id}` (a 409 there is fine).

    jh project create my-analysis --description "Q3 study" --tag finance
    jh project create MyPkg.jl --import https://github.com/me/MyPkg.jl

New projects are private ("No Access") and not deployable; sharing,
deployments and the branch workflow are left to the web UI. `--product`
takes a product name, display name or ID from the UI's product list and
defaults to the first one. `--import` infers the git provider for
github.com, gitlab.com and bitbucket.org, and needs `--provider` for other
hosts. The import errors NOTOKEN, NOACCESS and NOPROVIDER are reported as
hints.

If the project is added but its repository setup fails, the error prints
the project ID and `jh project create --resume <id>`, which reruns only the
setup instead of creating a duplicate. `--json` prints the project ID,
name, owner, product and upstream URL.

Unit tests cover building and validating the request (including the JSON
field names the server expects), product matching, the add/create/pull
sequence against a fake server, and error mapping. The e2e CLI tests check
the help text and argument validation; the e2e suite still doesn't create
projects on the instance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ject create`

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… create --import`

Hosts other than github.com, gitlab.com and bitbucket.org used to need
--provider. They are now probed: GitLab answers GET /api/v4/version with an
X-Gitlab-Meta header and GitHub Enterprise answers GET /api/v3/meta with
X-GitHub-Request-Id, even without authentication. Anything else still needs
--provider.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant