shapewall 0.3.0 → 0.3.1

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 (24) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/agent/package-lock.json +2 -2
  3. package/dist/client/assets/{BoardChat-CupOxioV.js → BoardChat-V1BCXdDB.js} +1 -1
  4. package/dist/client/assets/{ChecksPanel-BqrS02Ih.js → ChecksPanel-Cm22bCdQ.js} +1 -1
  5. package/dist/client/assets/{History-CQG3NQOC.js → History-U0bD1BjA.js} +1 -1
  6. package/dist/client/assets/{LocalSettings-CSNMhNyV.js → LocalSettings-DOSuW7VC.js} +1 -1
  7. package/dist/client/assets/{Management-CJVNAqAW.js → Management-BFcKFdbp.js} +1 -1
  8. package/dist/client/assets/{QuickConnect-B-4pUgXH.js → QuickConnect-DyfPSWbV.js} +1 -1
  9. package/dist/client/assets/{app-update-dialog-rhaw0MRk.js → app-update-dialog-DH2Mgby8.js} +1 -1
  10. package/dist/client/assets/{index-DKOCIQiq.js → index-C9S7HL_o.js} +3 -3
  11. package/dist/client/build-info.json +1 -1
  12. package/dist/client/index.html +1 -1
  13. package/dist/client/sw.js +2 -2
  14. package/dist/console/assets/{LocalAccountsApp-DOKZI6Lt.js → LocalAccountsApp-lJjkhUcH.js} +1 -1
  15. package/dist/console/assets/{LocalConsole-DXzldLW9.js → LocalConsole-BZHqYKnt.js} +1 -1
  16. package/dist/console/assets/{app-update-dialog-CrqIMEwN.js → app-update-dialog-DCM9sYE3.js} +1 -1
  17. package/dist/console/assets/{console-76WovHlh.js → console-C2LsvEco.js} +3 -3
  18. package/dist/console/build-info.json +1 -1
  19. package/dist/console/console.html +1 -1
  20. package/docs/pull-requests.md +3 -2
  21. package/package.json +1 -1
  22. package/src/agent/starter/worktree.js +32 -4
  23. package/src/ci/workflow.js +14 -3
  24. package/src/cli/init.js +8 -5
@@ -1 +1 @@
1
- {"version":"0.3.0","revision":"c34ececf96613a351c6811f5b6ee7e932d65e65b"}
1
+ {"version":"0.3.1","revision":"459470abbee7004bdcfd09dddad08e524d7dee6d"}
@@ -12,7 +12,7 @@
12
12
  <title>Shapewall</title>
13
13
  <!-- Saved light/dark mode and theme, before the first paint (see src/lib/theme.js). -->
14
14
  <script src="/_console/theme-boot.js"></script>
15
- <script type="module" crossorigin src="/_console/assets/console-76WovHlh.js"></script>
15
+ <script type="module" crossorigin src="/_console/assets/console-C2LsvEco.js"></script>
16
16
  <link rel="stylesheet" crossorigin href="/_console/assets/console-Fp4k9iyx.css">
17
17
  </head>
18
18
  <body>
@@ -126,8 +126,9 @@ With `"ci": { "images": "branch" }`, the comment shows thumbnails inline: the jo
126
126
  images.
127
127
  - The images are public and stay in the branch history until you delete the branch. Delete it any time; old comments then lose their
128
128
  pictures.
129
- - The comment job needs `contents: write` in its `permissions` to push the branch. Without it, the comment falls back to links and
130
- says why.
129
+ - The comment job needs `contents: write` in its `permissions` to push the branch. `shapewall init --ci` writes that when the config
130
+ already has `"images": "branch"`; if you add the setting later, change `contents: read` to `contents: write` in the comment job (or
131
+ run `shapewall init --ci --force`). Without it, the comment falls back to links and says why.
131
132
 
132
133
  ## Turning it off
133
134
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shapewall",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Every page of your site on one zoomable wall: desktop and phone captures, sandboxed live HTML, and element-anchored comments your coding agent can read.",
5
5
  "license": "Apache-2.0 AND FSL-1.1-ALv2",
6
6
  "author": "Dan Baruch",
@@ -621,18 +621,46 @@ export function sweepWorkRoot(root, { now = Date.now(), isAlive = alive, keep =
621
621
  return removed
622
622
  }
623
623
 
624
+ // What a push may travel over: https, http, ssh and a local path. Everything
625
+ // else is off, so a remote URL (or a url.*.insteadOf rewrite) in the
626
+ // repository's config cannot pick a transport that runs a program
627
+ // ("ext::sh -c ...", or any other git-remote-<name> helper). This is the
628
+ // environment variable, not `-c protocol.allow=never`: a protocol.<name>.allow
629
+ // in the repository's config would win over that, and never over this.
630
+ const PUSH_PROTOCOLS = 'https:http:ssh:file'
631
+
624
632
  // Pushes the agent's branch, and only it, to the same name on the remote.
633
+ //
634
+ // The push uses the person's own credentials on purpose (their credential
635
+ // helper, their ssh setup): that is how it reaches their remote at all. What
636
+ // it does not take from the repository's config is anything that would run a
637
+ // different program or send something else: the transport is limited (above),
638
+ // the receiving program is git's own whatever remote.<name>.receivepack says,
639
+ // and the push is not signed, so no gpg program runs.
625
640
  export async function pushBranch({ tree, remote }) {
626
641
  const { branch } = tree
627
642
  const last = branch.split('/').pop()
628
643
  if (PROTECTED_BRANCHES.has(branch) || PROTECTED_BRANCHES.has(last)) throw new Error(`refusing to push "${branch}"`)
644
+ // A remote name starting with "-" would be read as an option.
645
+ if (typeof remote !== 'string' || !remote || remote.startsWith('-')) throw new Error('refusing to push: not a remote name')
629
646
  // No tags (push.followTags) and no submodule pushes (push.recurseSubmodules)
630
647
  // from the person's config: the branch is all that goes.
631
648
  const refspec = `refs/heads/${branch}:refs/heads/${branch}`
632
- await git(['--git-dir', tree.gitDir, 'push', '--no-verify', '--no-follow-tags', '--recurse-submodules=no', remote, refspec], {
633
- cwd: tree.repo,
634
- timeoutMs: 180000,
635
- })
649
+ await git(
650
+ [
651
+ '--git-dir',
652
+ tree.gitDir,
653
+ 'push',
654
+ '--no-verify',
655
+ '--no-follow-tags',
656
+ '--no-signed',
657
+ '--recurse-submodules=no',
658
+ '--receive-pack=git-receive-pack',
659
+ remote,
660
+ refspec,
661
+ ],
662
+ { cwd: tree.repo, timeoutMs: 180000, extraEnv: { GIT_ALLOW_PROTOCOL: PUSH_PROTOCOLS } },
663
+ )
636
664
  }
637
665
 
638
666
  export { alive as processAlive }
@@ -8,7 +8,9 @@ export const WORKFLOW_FILE = '.github/workflows/shapewall.yml'
8
8
 
9
9
  const PACKAGE = JSON.parse(fs.readFileSync(new URL('../../package.json', import.meta.url), 'utf8'))
10
10
 
11
- export function workflowYaml({ version = PACKAGE.version, playwright = PACKAGE.dependencies.playwright } = {}) {
11
+ // `imagesBranch`: the config has "ci": { "images": "branch" }, so the comment
12
+ // job may push the images branch (contents: write).
13
+ export function workflowYaml({ version = PACKAGE.version, playwright = PACKAGE.dependencies.playwright, imagesBranch = false } = {}) {
12
14
  return `# Shapewall: capture on every pull request.
13
15
  #
14
16
  # On each pull request (and each push to it) this job captures the pages in
@@ -198,10 +200,19 @@ jobs:
198
200
  if: always() && needs.shapewall.outputs.enabled == 'true'
199
201
  runs-on: ubuntu-latest
200
202
  timeout-minutes: 10
201
- # For "ci.images": "branch" (public repositories only) also set contents: write.
203
+ ${
204
+ imagesBranch
205
+ ? ` # contents: write is for "ci.images": "branch" (public repositories only): this
206
+ # job pushes the images to the shapewall-ci branch. Without that
207
+ # setting, contents: read is enough.
208
+ permissions:
209
+ contents: write
210
+ pull-requests: write`
211
+ : ` # For "ci.images": "branch" (public repositories only) also set contents: write.
202
212
  permissions:
203
213
  contents: read
204
- pull-requests: write
214
+ pull-requests: write`
215
+ }
205
216
  env:
206
217
  SHAPEWALL: shapewall@${version}
207
218
  steps:
package/src/cli/init.js CHANGED
@@ -163,14 +163,17 @@ export async function initCi(flags, out, { fetch }) {
163
163
  const shown = path.relative(process.cwd(), file) || file
164
164
  if (fs.existsSync(file) && !flags.force) throw new Error(`${shown} already exists (use --ci --force to replace it)`)
165
165
  fs.mkdirSync(path.dirname(file), { recursive: true })
166
- fs.writeFileSync(file, workflowYaml())
167
- out(`Wrote ${shown}: on every pull request it captures the pages before and after, and keeps one comment up to date.`)
168
- let hasStart = false
166
+ let ci = null
169
167
  try {
170
- hasStart = Boolean(JSON.parse(fs.readFileSync(configFile, 'utf8'))?.ci?.start)
168
+ ci = JSON.parse(fs.readFileSync(configFile, 'utf8'))?.ci
171
169
  } catch {
172
- hasStart = false
170
+ ci = null
173
171
  }
172
+ const hasStart = Boolean(ci?.start)
173
+ const imagesBranch = ci?.images === 'branch'
174
+ fs.writeFileSync(file, workflowYaml({ imagesBranch }))
175
+ out(`Wrote ${shown}: on every pull request it captures the pages before and after, and keeps one comment up to date.`)
176
+ if (imagesBranch) out('The config has "images": "branch", so the comment job has contents: write to push the images branch.')
174
177
  if (!hasStart)
175
178
  out(
176
179
  'Next: either add "ci": { "start": { "install": [...], "build": [...], "serve": [...], "url": "http://127.0.0.1:PORT" } } to the config (build and serve mode), or set SHAPEWALL_PREVIEW_URL in the workflow (preview URL mode). Then commit the workflow.',