Skip to content

feat: deploy-by-reference via native harper CLI (prototype / draft)#118

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

feat: deploy-by-reference via native harper CLI (prototype / draft)#118
dawsontoth wants to merge 3 commits into
mainfrom
claude/deploy-by-ref-native

Conversation

@dawsontoth

@dawsontoth dawsontoth commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Draft / prototype. This is what create-harper's deploy scaffolding looks like once native harper CLI support lands. It deliberately uses CLI features that aren't released yet, so it can't merge until they do — see Blocked on below.

What this shows

The end-state of the deploy-by-reference switch (create-harper#117): scaffolded projects deploy by reference (the Harper cluster clones a pinned commit over SSH) with no per-project scripts.

  • package.json: deployharper deploy by_ref=true restart=true replicated=true; deploy:setupharper deploy setup=true.
  • Centralized GitHub Actions workflow at .github/workflows/deploy.yaml — also fixes a latent bug: templates shipped a singular _github/workflow/ that GitHub never runs; now workflows/ (plural). Tag- and dispatch-triggered.
  • .env carries only CLI_TARGET; credentials come from harper login (local) or GitHub Actions secrets CLI_TARGET / HARPER_CLI_USERNAME / HARPER_CLI_PASSWORD (CI).
  • README "Deployment" sections rewritten around the reference model + rollback.

Relationship to the ships-today version

The interim version that works with the currently released CLI carries scripts/deploy.mjs + scripts/setup-deploy.mjs (the logic lives in the project until the CLI can do it natively). It's on branch claude/harper-deployment-path-dd2495. This PR is the same feature with those scripts folded into the CLI.

Blocked on (must release first)

Tracks create-harper#117. Rollback: HarperFast/harper#641.

Notes

  • deploy:setup spelling (setup=true vs --setup vs a dedicated harper add-deploy-key) is TBD per harper#1778; this PR uses setup=true to match the CLI's key=value arg model.
  • npm test (213 tests) green; dprint + oxlint clean.

🤖 Generated with Claude Code


Related — deploy-by-reference effort

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

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

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

Copy link
Copy Markdown

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 updates the deployment process across multiple project templates to deploy "by reference" using the native harper CLI. It adds a new GitHub Actions workflow (deploy.yaml), updates package.json scripts to include deploy and deploy:setup, and updates the documentation in README.md files. Feedback on these changes highlights that the template-early-hints template was only partially updated, missing changes to its package.json and README.md. Additionally, installing the harper CLI globally in the workflow without a version pin could introduce breaking changes in the future, and the duplication of the deploy.yaml file across all template directories should be addressed by dynamically copying it from a centralized location.

Comment thread template-early-hints/_github/workflows/deploy.yaml Outdated
Comment thread templates-shared/all/_github/workflows/deploy.yaml Outdated
@@ -0,0 +1,53 @@
# Deploys this app to your Harper cluster by *reference* via `harper deploy by_ref=true`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

There is significant duplication of the deploy.yaml workflow file across all 11 template directories and templates-shared/all.\n\nIf there is an automated build/prepare script that copies files from templates-shared/all into each template directory, these duplicated files in the individual template folders should ideally be gitignored or not committed manually to avoid drift.\n\nIf there is no such script, consider introducing a step in the scaffolding process (e.g., in scaffoldProject.js) to copy shared files from templates-shared/all dynamically, which would allow you to delete the 11 duplicate copies and maintain the workflow in a single centralized place.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No. We commit them to make them easy for humans to discover when browsing the repo.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Leaving the per-template copies as-is — committing the fanned-out shared files into each template is intentional in this repo (see templates-shared/README.md): it keeps them discoverable when browsing and lets the scaffolder copy a template directory wholesale with no merge step. applySharedTemplates.js is the sync mechanism, so there's no manual drift. Flagging for a human maintainer rather than resolving, in case you'd prefer a different model.

🤖 Addressed by Claude Code

Templates deploy by *reference* (the Harper cluster clones a pinned commit over SSH) with no per-project scripts: deploy -> `harper deploy by_ref=true restart=true replicated=true`, deploy:setup -> `harper deploy setup=true`. Centralized GitHub Actions workflow (.github/workflows/deploy.yaml — also fixes the singular workflow/ -> workflows/ path bug so GitHub runs it); tag+dispatch triggered. .env carries only CLI_TARGET (creds via harper login / CI secrets). README deployment sections rewritten around the reference model.

End-state assuming native CLI support has landed: harper#1777 (by_ref), harper#1778 (deploy setup), harper-pro#570 (add_ssh_key generate). Tracks create-harper#117. DRAFT until those release.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dawsontoth
dawsontoth force-pushed the claude/deploy-by-ref-native branch from 217a381 to 161efc2 Compare July 17, 2026 15:24
dawsontoth and others added 2 commits July 17, 2026 14:24
…rly-hints

Pin the workflow's global install to `harper@^5.2.0` (the 5.2 line where deploy-by-reference lands; blocks a breaking 6.x bump) instead of unpinned latest. Exclude template-early-hints (a legacy harperdb EdgeWorker example, not published via npm create harper) from the deploy migration: remove the stray _github workflow it got via fan-out, and filter _github out of applySharedTemplates for it so it isn't re-added (it keeps every other shared file).

The per-template deploy.yaml duplication is intentional (templates-shared/README.md: shared files are committed into each template for discoverability + wholesale-copy scaffolding), so it's left as-is.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Aligns the scaffold with where the deploy design landed (harper#1799 in-memory git-host credential + client-side-sealed durable tokens) instead of SSH deploy keys: deploy -> `harper deploy by_ref=true credential=github.com ...` (git+https ref + a sealed-token credential reference the cluster resolves at clone time; public repos drop credential=github.com). deploy:setup -> `harper deploy setup=true` seals a durable GitHub/npm token locally with the cluster's public key and stores only ciphertext. README rewritten around the sealed-token flow; the workflow no longer handles any token itself.

Depends on harper#1777 (by_ref git+https + credential), harper#1778 (deploy setup), harper#1799.

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