feat: deploy-by-reference via native harper CLI (prototype / draft)#118
feat: deploy-by-reference via native harper CLI (prototype / draft)#118dawsontoth wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
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.
| @@ -0,0 +1,53 @@ | |||
| # Deploys this app to your Harper cluster by *reference* via `harper deploy by_ref=true` | |||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
No. We commit them to make them easy for humans to discover when browsing the repo.
There was a problem hiding this comment.
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>
217a381 to
161efc2
Compare
…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>
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:deploy→harper deploy by_ref=true restart=true replicated=true;deploy:setup→harper deploy setup=true..github/workflows/deploy.yaml— also fixes a latent bug: templates shipped a singular_github/workflow/that GitHub never runs; nowworkflows/(plural). Tag- and dispatch-triggered..envcarries onlyCLI_TARGET; credentials come fromharper login(local) or GitHub Actions secretsCLI_TARGET/HARPER_CLI_USERNAME/HARPER_CLI_PASSWORD(CI).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 branchclaude/harper-deployment-path-dd2495. This PR is the same feature with those scripts folded into the CLI.Blocked on (must release first)
harper deploy by_ref=true— deploy by git reference harper#1777 —harper deploy by_ref=true(prototyped, branchclaude/deploy-by-ref-flag)harper deploy --setup— one-command deploy-key provisioning harper#1778 —harper deploy setup=truegenerate: trueharper-pro#570 —add_ssh_key generate=true(drafted, branchclaude/add-ssh-key-generate)Tracks create-harper#117. Rollback: HarperFast/harper#641.
Notes
deploy:setupspelling (setup=truevs--setupvs a dedicatedharper add-deploy-key) is TBD per harper#1778; this PR usessetup=trueto match the CLI'skey=valuearg model.npm test(213 tests) green;dprint+oxlintclean.🤖 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)