Skip to content

feat(cli): harper deploy by_ref=true — deploy by git+https reference (+ credential)#1850

Draft
dawsontoth wants to merge 3 commits into
mainfrom
claude/deploy-by-ref-flag
Draft

feat(cli): harper deploy by_ref=true — deploy by git+https reference (+ credential)#1850
dawsontoth wants to merge 3 commits into
mainfrom
claude/deploy-by-ref-flag

Conversation

@dawsontoth

@dawsontoth dawsontoth commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Draft / prototype for #1777. Part of the create-harper deploy-by-reference effort.

harper deploy by_ref=true (or ref=<committish>) resolves the app's GitHub owner/repo + commit from the local working copy (or GitHub Actions GITHUB_REPOSITORY/GITHUB_SHA) and deploys git+https://github.com/<owner>/<repo>.git#<sha> instead of packaging a payload blob. Pinning by SHA keeps cluster peers from diverging on a moved tag.

For a private repo, credential=github.com (or credential=true) attaches a credentials reference [{ host, secret: "deploy.<component>.<host>" }] — the durable token sealed once by harper deploy setup=true (#1778) — which the cluster resolves in-memory to authenticate the HTTPS clone (#1799). Public repos need no credential.

Where: bin/cliOperations.ts, PREPARE_OPERATION.deploy_component. The no-flag default stays the payload deploy (backward-compatible). by_ref/ref/credential are transport-only (consumed client-side); credentials is a real operation field and is sent. Parse + oxlint + prettier clean.

Refs #1777, #1799, #641.

Related — deploy-by-reference effort

Prototype PRs: #1850 (deploy by_ref) · #1851 (deploy setup) · HarperFast/harper-pro#594 (add_ssh_key generate) · HarperFast/create-harper#118 (create-harper scaffold)

Tracking issues: #1777 · #1778 · HarperFast/harper-pro#570 · HarperFast/create-harper#117 · #641 (rollback)

…+ credential)

When no `package=` is given and `by_ref=true` (or `ref=<committish>`) is passed, the CLI resolves the app's GitHub owner/repo and commit (HEAD or GITHUB_SHA) from the local working copy, warns on a dirty tree, defaults `project` from package.json, and deploys `git+https://github.com/<owner>/<repo>.git#<sha>`. Pinning by SHA keeps cluster peers from diverging on a moved tag.

For a private repo, `credential=github.com` (or `credential=true`) attaches a `credentials` reference [{host, secret: deploy.<component>.<host>}] — the sealed token provisioned once by `harper deploy setup=true` — which the cluster resolves in-memory to authenticate the HTTPS clone (#1799). A public repo needs no credential.

No-flag default stays the payload deploy. by_ref/ref/credential are transport-only; credentials (plural) is a real field and is sent. Relates to #1777, #1799, #641.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a "deploy-by-reference" feature that allows deploying a pinned Git commit directly by reference instead of uploading a payload blob. The feedback points out an issue in resolveGitCommittish where numeric git references (such as numeric SHAs or tags) parsed as numbers would be ignored due to a strict string type check, and provides a suggestion to convert them to strings.

Comment thread bin/cliOperations.ts Outdated
Comment thread bin/cliOperations.ts
@claude

claude Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Reviewed; no blockers found. Both prior blockers (numeric-ref coercion, missing tests) are resolved in 2f12b9f.

dawsontoth and others added 2 commits July 17, 2026 15:58
…<host>)

The credential= reference must resolve to the same hdb_secret row that `harper deploy setup=true` seals (and a literal-token deploy would auto-name). Renamed the derivation to deriveGitSecretName, mirroring the server's exactly (the .git. segment + normalizeGitHost). Keeps by_ref (#1850) and deploy setup (#1851) consistent with core.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tests

resolveGitCommittish accepts a number (buildRequest JSON-parses ref=1234567 to a number) and coerces it to a string instead of ignoring it and falling back to GITHUB_SHA/HEAD. Extracted the by_ref branch into an exported prepareDeployByRef(req) (plus exported resolveGitCommittish/deriveGitSecretName) for testability. Added unit tests covering the git+https package build, ref override, numeric-ref coercion, credential=true/<host> reference derivation, and the deploy.<component>.git.<host> secret name.

Addresses the harper#1850 review (12/12 unit tests pass).

Co-Authored-By: Claude Opus 4.8 <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