Repository navigation
[codex] Add deploy-scoped noter sync installer slice - #372
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds an RFC and implements a deploy-scoped installer and CLI flow plus UI, tests, and build tooling: new public sync script ( Changes
Sequence Diagram(s)sequenceDiagram
participant Browser as Browser
participant Hosted as Deploy (/noter.js)
participant Auth as MCP Auth Service
participant Installer as Installer CLI
participant Local as Local Machine Agent
Browser->>Hosted: Navigate to /machines/connect (or open URL with params)
Hosted->>Auth: Obtain short-lived registration URL / token
Auth-->>Browser: Auth success + registration token/URL
Browser->>Installer: User copies/runs bootstrap command (includes source URL)
Installer->>Hosted: Fetch installer bootstrap (/noter.js)
Installer->>Local: Write installation state (~/.noter/sync/...) and spawn agent step
Local->>Hosted: Register machine using token / one-time code
Hosted-->>Browser: Confirm machine connected (UI state)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Deploying noter with
|
| Latest commit: |
797530c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6740d1d3.noter-ax1.pages.dev |
| Branch Preview URL: | https://codex-noter-sync-installer-r.noter-ax1.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md (1)
435-446: Add explicit headless/remote auth fallback in registration mechanics.The fallback currently mentions one-time code entry, but this RFC should explicitly define device code authorization for environments where browser handoff is unavailable (SSH/remote/headless). That keeps onboarding viable for non-GUI machine setups.
Proposed RFC text adjustment
Preferred pattern: 1. browser issues a short-lived machine-registration token or URL 2. local installer consumes it 3. installer exchanges it for durable machine credentials Acceptable fallback: 1. copy a one-time code from Noter into the CLI +2. support device code authorization for headless/remote environments where + browser handoff is unavailableBased on learnings: "Enable device code authorization for Codex when running in headless or remote environments where normal browser flow isn't available".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` around lines 435 - 446, The RFC's registration mechanics lack an explicit headless/remote auth fallback; update the "install" and "registration mechanics" sections to add a clear device code authorization flow (device code URL + short code) as the primary fallback for SSH/headless setups: describe how the browser issues a short-lived machine-registration token/URL, how the local installer/CLI (install command) can detect headless mode and instead request a device code, how the operator enters that code in a browser to authorize the machine, and how the installer exchanges the device-code grant for durable machine credentials; also update the acceptable fallback paragraph that currently mentions "one-time code" to explicitly reference "device code authorization" and include token lifetime and polling/exchange behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md`:
- Line 452: Replace the non-hyphenated compound adjective in the sentence
referencing the public_ts repo: change the phrase "GitHub Actions based" to the
hyphenated form "GitHub Actions-based" so the compound modifier before "npm
publish flow" is grammatically correct.
- Around line 450-483: The RFC's "Minimal Publish Shape" omits
integrity/provenance requirements for the installer; update the document to
require artifact authenticity checks for the MVP by adding explicit requirements
that the published package (`@noter-md/sync`) and its single executable
(noter.mjs) include verifiable provenance (e.g., npm provenance metadata or
signed release artifacts) and/or pinned checksums, and describe where and how
verification is performed (CLI behavior for `npx `@noter-md/sync` connect` and
documentation steps), plus failure modes and UX (warn/fail on mismatch) so
implementers know to verify signatures/checksums before executing the installer.
- Line 7: Update the document metadata in
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md by changing the
"Last updated: 2026-03-30" line to "Last updated: 2026-03-29" (or leave a TODO
comment and update to the true March 30 date when that edit is actually made);
locate the exact "Last updated:" header line in the file and replace the date
string to avoid future-dated metadata.
---
Nitpick comments:
In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md`:
- Around line 435-446: The RFC's registration mechanics lack an explicit
headless/remote auth fallback; update the "install" and "registration mechanics"
sections to add a clear device code authorization flow (device code URL + short
code) as the primary fallback for SSH/headless setups: describe how the browser
issues a short-lived machine-registration token/URL, how the local installer/CLI
(install command) can detect headless mode and instead request a device code,
how the operator enters that code in a browser to authorize the machine, and how
the installer exchanges the device-code grant for durable machine credentials;
also update the acceptable fallback paragraph that currently mentions "one-time
code" to explicitly reference "device code authorization" and include token
lifetime and polling/exchange behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6f84be3e-a869-4bd8-963b-a2ea60435145
📒 Files selected for processing (1)
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md
|
|
||
| - Status: Proposed implementation | ||
| - Owner: connected machine onboarding UX | ||
| - Last updated: 2026-03-30 |
There was a problem hiding this comment.
Fix document metadata date drift (future “Last updated”).
Line 7 says 2026-03-30, but this PR was opened on March 29, 2026. Please either set it to 2026-03-29 or update it when the actual March 30 edit lands to avoid audit confusion.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` at line 7,
Update the document metadata in
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md by changing the
"Last updated: 2026-03-30" line to "Last updated: 2026-03-29" (or leave a TODO
comment and update to the true March 30 date when that edit is actually made);
locate the exact "Last updated:" header line in the file and replace the date
string to avoid future-dated metadata.
| ## Minimal Publish Shape | ||
|
|
||
| The current `public_ts` repo proves that a GitHub Actions based npm publish flow | ||
| works fine for scoped public packages, but the connected-machine installer does | ||
| not need the full monorepo release shape used there. | ||
|
|
||
| Recommended packaging shape: | ||
|
|
||
| 1. package name: `@noter-md/sync` | ||
| 2. one executable source file: `noter.mjs` | ||
| 3. one `package.json` with `type: "module"`, `publishConfig.access: "public"`, | ||
| and a single `bin` entry | ||
| 4. no runtime dependencies unless the installer truly needs them | ||
|
|
||
| Recommended invocation: | ||
|
|
||
| ```bash | ||
| npx @noter-md/sync connect | ||
| ``` | ||
|
|
||
| Recommended reason: | ||
|
|
||
| 1. it preserves the "single polished script" feeling | ||
| 2. it works with stock Node today | ||
| 3. it avoids `curl ... | node` trust concerns as the primary instruction | ||
| 4. it is much simpler than asking users to copy a local `noter.mjs` file by hand | ||
|
|
||
| Suggested release automation: | ||
|
|
||
| 1. keep the package in its own small package folder or repo | ||
| 2. publish from GitHub Actions when the package version changes or when a tag is | ||
| pushed | ||
| 3. use `npm publish --access public` or an equivalent publish action | ||
| 4. avoid introducing Turbo/workspace complexity unless more packages actually |
There was a problem hiding this comment.
Define installer integrity and provenance requirements for MVP.
This section defines packaging/release flow, but it does not require artifact authenticity checks. For machine registration tooling, add explicit requirements for package integrity/provenance (e.g., npm provenance, pinned checksums/signatures for noter.mjs, and verification behavior in docs/CLI). Without this, supply-chain risk remains under-specified for implementation.
🧰 Tools
🪛 LanguageTool
[grammar] ~452-~452: Use a hyphen to join words.
Context: ...ic_ts` repo proves that a GitHub Actions based npm publish flow works fine for sc...
(QB_NEW_EN_HYPHEN)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` around lines
450 - 483, The RFC's "Minimal Publish Shape" omits integrity/provenance
requirements for the installer; update the document to require artifact
authenticity checks for the MVP by adding explicit requirements that the
published package (`@noter-md/sync`) and its single executable (noter.mjs) include
verifiable provenance (e.g., npm provenance metadata or signed release
artifacts) and/or pinned checksums, and describe where and how verification is
performed (CLI behavior for `npx `@noter-md/sync` connect` and documentation
steps), plus failure modes and UX (warn/fail on mismatch) so implementers know
to verify signatures/checksums before executing the installer.
|
|
||
| ## Minimal Publish Shape | ||
|
|
||
| The current `public_ts` repo proves that a GitHub Actions based npm publish flow |
There was a problem hiding this comment.
Use hyphenated compound adjective.
At Line 452, change GitHub Actions based to GitHub Actions-based.
🧰 Tools
🪛 LanguageTool
[grammar] ~452-~452: Use a hyphen to join words.
Context: ...ic_ts` repo proves that a GitHub Actions based npm publish flow works fine for sc...
(QB_NEW_EN_HYPHEN)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` at line 452,
Replace the non-hyphenated compound adjective in the sentence referencing the
public_ts repo: change the phrase "GitHub Actions based" to the hyphenated form
"GitHub Actions-based" so the compound modifier before "npm publish flow" is
grammatically correct.
There was a problem hiding this comment.
♻️ Duplicate comments (2)
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md (2)
456-490:⚠️ Potential issue | 🟠 MajorSpecify installer integrity/provenance requirements in MVP publish rules.
This section defines package shape and publish flow but still omits explicit authenticity checks for
@noter-md/sync/noter.mjs. Add concrete requirements for provenance/checksum/signature verification and expected failure UX (warn vs fail) before execution.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` around lines 456 - 490, Add explicit installer integrity and provenance requirements for the suggested package shape: require a signed release artifact for `@noter-md/sync` (noter.mjs) and publish a verifiable checksum (e.g., SHA256) alongside releases, document expected verification steps the installer must perform when running `npx `@noter-md/sync` connect` (verify checksum and signature against repo or tag-signed metadata), and specify the failure UX policy (treat signature mismatch or missing provenance as a hard fail by default with an optional --allow-unsafe flag that only emits a warning when explicitly supplied). Ensure these rules are added to the "Minimal Publish Shape" and "Suggested release automation" sections and reference the package name "@noter-md/sync", the executable "noter.mjs", and the `connect` invocation so reviewers can locate the change.
7-7:⚠️ Potential issue | 🟡 MinorFix future-dated metadata on Line 7.
Last updatedis set to2026-03-30, but this PR is from March 29, 2026. Please use the actual edit date to avoid audit/date-trace ambiguity.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` at line 7, Update the "Last updated: 2026-03-30" metadata in rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md to the actual edit date (replace 2026-03-30 with 2026-03-29) so the "Last updated:" line accurately reflects the PR date and avoids future-dated metadata.
🧹 Nitpick comments (1)
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md (1)
39-39: Hyphenate compound adjective on Line 39.Use
Short-terminstead ofShort term.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` at line 39, Fix the compound adjective on Line 39 of the RFC: change the phrase "Short term, make the installer origin URL-scoped..." to use a hyphenated compound adjective "Short-term, make the installer origin URL-scoped..." so the file rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md uses "Short-term" instead of "Short term".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md`:
- Around line 456-490: Add explicit installer integrity and provenance
requirements for the suggested package shape: require a signed release artifact
for `@noter-md/sync` (noter.mjs) and publish a verifiable checksum (e.g., SHA256)
alongside releases, document expected verification steps the installer must
perform when running `npx `@noter-md/sync` connect` (verify checksum and signature
against repo or tag-signed metadata), and specify the failure UX policy (treat
signature mismatch or missing provenance as a hard fail by default with an
optional --allow-unsafe flag that only emits a warning when explicitly
supplied). Ensure these rules are added to the "Minimal Publish Shape" and
"Suggested release automation" sections and reference the package name
"@noter-md/sync", the executable "noter.mjs", and the `connect` invocation so
reviewers can locate the change.
- Line 7: Update the "Last updated: 2026-03-30" metadata in
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md to the actual
edit date (replace 2026-03-30 with 2026-03-29) so the "Last updated:" line
accurately reflects the PR date and avoids future-dated metadata.
---
Nitpick comments:
In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md`:
- Line 39: Fix the compound adjective on Line 39 of the RFC: change the phrase
"Short term, make the installer origin URL-scoped..." to use a hyphenated
compound adjective "Short-term, make the installer origin URL-scoped..." so the
file rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md uses
"Short-term" instead of "Short term".
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: ce931010-7273-48e2-8f47-64e65a0ffbf7
📒 Files selected for processing (1)
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md
f3170f6 to
827c66d
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (3)
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md (3)
458-458:⚠️ Potential issue | 🟡 MinorHyphenate “GitHub Actions-based”.
Use the hyphenated form for the compound adjective before
npm publish flow.Suggested edit
-The current `public_ts` repo proves that a GitHub Actions based npm publish flow +The current `public_ts` repo proves that a GitHub Actions-based npm publish flow🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` at line 458, The phrase "GitHub Actions based npm publish flow" in the RFC text should be written as a compound adjective, so update the wording to "GitHub Actions-based npm publish flow" wherever it appears (e.g., the line containing `public_ts` and the string "GitHub Actions based npm publish flow") to apply the correct hyphenation.
7-7:⚠️ Potential issue | 🟡 MinorFix future-dated document metadata.
Last updatedis set to2026-03-30, which is ahead of this PR’s current date context. Please set it to the actual edit date to avoid audit ambiguity.Suggested edit
-- Last updated: 2026-03-30 +- Last updated: 2026-03-29🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` at line 7, Update the document metadata line that currently reads "Last updated: 2026-03-30" to the actual edit date for this PR (replace the 2026-03-30 value with the correct current date) to avoid future-dated metadata; locate the header/metadata section where "Last updated" appears in rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md and change only that date string so the rest of the document remains unchanged.
456-490:⚠️ Potential issue | 🟠 MajorAdd explicit installer integrity/provenance requirements for MVP.
The publish section defines packaging/release mechanics but still doesn’t require authenticity verification (provenance/signature/checksum + failure behavior). For installer execution, this is an important security requirement to specify in the RFC.
Suggested RFC additions (example)
## Minimal Publish Shape @@ Recommended reason: @@ 5. it is much simpler than asking users to copy a local `noter.js` file by hand + +Integrity and provenance requirements (MVP): + +1. published `@noter-md/sync` artifacts must include verifiable provenance + (for example, npm provenance / signed CI release attestations) +2. the fetched installer payload (`noter.js`) must be version-pinned and + checksum-verifiable +3. docs must show how users/operators can verify artifact authenticity +4. CLI behavior must define mismatch handling explicitly: + - fail closed on checksum/signature mismatch + - print actionable remediation steps + - never execute unverified payloads🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` around lines 456 - 490, Add explicit installer integrity and provenance requirements to the "Minimal Publish Shape" / publish section: require that releases of `@noter-md/sync` (the published package containing noter.js and package.json) include a machine-verifiable provenance (e.g., detached signature and SHA-256 checksum for noter.js and package.json, and a signed release manifest or provenance file published alongside the npm artifact), define the install-time verification algorithm the installer must perform when invoked via "npx `@noter-md/sync` connect --from https://<current-deploy>/noter.js" (verify checksum, verify signature chain and trusted key(s), and abort with a clear error if verification fails), and specify expected failure behavior and developer key-rotation/compromise procedures to be documented in the RFC.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md`:
- Line 39: Change the list item starting with "Short term, make the installer
origin URL-scoped..." to use the hyphenated compound modifier "Short-term"
(i.e., replace "Short term" with "Short-term") so the phrasing is grammatically
correct in the RFC text.
---
Duplicate comments:
In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md`:
- Line 458: The phrase "GitHub Actions based npm publish flow" in the RFC text
should be written as a compound adjective, so update the wording to "GitHub
Actions-based npm publish flow" wherever it appears (e.g., the line containing
`public_ts` and the string "GitHub Actions based npm publish flow") to apply the
correct hyphenation.
- Line 7: Update the document metadata line that currently reads "Last updated:
2026-03-30" to the actual edit date for this PR (replace the 2026-03-30 value
with the correct current date) to avoid future-dated metadata; locate the
header/metadata section where "Last updated" appears in
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md and change only
that date string so the rest of the document remains unchanged.
- Around line 456-490: Add explicit installer integrity and provenance
requirements to the "Minimal Publish Shape" / publish section: require that
releases of `@noter-md/sync` (the published package containing noter.js and
package.json) include a machine-verifiable provenance (e.g., detached signature
and SHA-256 checksum for noter.js and package.json, and a signed release
manifest or provenance file published alongside the npm artifact), define the
install-time verification algorithm the installer must perform when invoked via
"npx `@noter-md/sync` connect --from https://<current-deploy>/noter.js" (verify
checksum, verify signature chain and trusted key(s), and abort with a clear
error if verification fails), and specify expected failure behavior and
developer key-rotation/compromise procedures to be documented in the RFC.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f8afca92-57ca-4597-9998-0c7c12089726
📒 Files selected for processing (1)
rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md
|
|
||
| 1. Do not ask the user to edit a repo `package.json`. | ||
| 2. Do not make Homebrew the default onboarding path. | ||
| 3. Short term, make the installer origin URL-scoped so every production deploy |
There was a problem hiding this comment.
Hyphenate the compound modifier.
Use Short-term instead of Short term in this list item.
Suggested edit
-3. Short term, make the installer origin URL-scoped so every production deploy
+3. Short-term, make the installer origin URL-scoped so every production deploy📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 3. Short term, make the installer origin URL-scoped so every production deploy | |
| 3. Short-term, make the installer origin URL-scoped so every production deploy |
🧰 Tools
🪛 LanguageTool
[grammar] ~39-~39: Use a hyphen to join words.
Context: ...ew the default onboarding path. 3. Short term, make the installer origin URL-scop...
(QB_NEW_EN_HYPHEN)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@rfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md` at line 39,
Change the list item starting with "Short term, make the installer origin
URL-scoped..." to use the hyphenated compound modifier "Short-term" (i.e.,
replace "Short term" with "Short-term") so the phrasing is grammatically correct
in the RFC text.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3060ccf156
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const child = spawn(openerCommand.command, openerCommand.args, { | ||
| detached: true, | ||
| stdio: 'ignore', | ||
| }) | ||
| child.unref() |
There was a problem hiding this comment.
Handle browser opener spawn failures without crashing
When the opener binary is missing (for example xdg-open on headless Linux/WSL), spawn(...) emits an asynchronous error event; because openBrowser does not attach an error handler, Node treats it as unhandled and the CLI exits with a runtime error. The surrounding try/catch in main cannot catch this async failure, so npx @noter-md/sync connect --from ... can crash instead of degrading to “copy this URL and open it manually.”
Useful? React with 👍 / 👎.
| try { | ||
| return new URL(sourceUrl).origin; | ||
| } catch { |
There was a problem hiding this comment.
Reject non-http(s) source URLs before deriving deploy origin
resolveDeployOrigin accepts any parseable URL and returns .origin without validating scheme/host, so a link like /machines/connect?source=javascript:alert(1) produces deployOrigin === "null". That value is then used to build the script URL/command, which throws Invalid URL and breaks the connect page for that request. The source param should be validated as an expected http(s) Noter script URL before it is trusted.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (2)
apps/noter/src/App.tsx (1)
534-537: Use the shared route constant here too.The dashboard link, page metadata, and CLI handoff already depend on
MACHINE_CONNECT_ROUTE; leaving the router on a literal string adds an easy drift point in the middle of a new public flow.♻️ Small cleanup
+import { MACHINE_CONNECT_ROUTE } from "@/lib/noterSync"; ... - <Route - path="/machines/connect" - element={<MachineConnectPage />} - /> + <Route + path={MACHINE_CONNECT_ROUTE} + element={<MachineConnectPage />} + />As per coding guidelines, "Prefer one explicit source of truth for configuration; if expected env var/config/command is missing, fail with a clear error instead of probing backup names or future-facing alternatives."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/noter/src/App.tsx` around lines 534 - 537, Replace the hard-coded route string in the Route element with the shared constant: change the path prop from "/machines/connect" to use MACHINE_CONNECT_ROUTE (i.e., path={MACHINE_CONNECT_ROUTE}) for the Route that renders MachineConnectPage; also add the proper import for MACHINE_CONNECT_ROUTE from its module where other route constants live so the router uses the single source of truth used by the dashboard, metadata, and CLI handoff.apps/noter/public/noter.js (1)
105-110: Use a key-onlyopenedByCliflag.This introduces a second spelling of the same boolean state (
?openedByCli=1vs?openedByCli). Please emit it by presence only and let the receiver checkhas("openedByCli").As per coding guidelines, "For boolean URL query params, prefer key-only flags (e.g. `?diff`) instead of assigning values (`?diff=1`); treat key presence as enabled."♻️ Proposed refactor
export function buildMachineConnectUrl(args) { const machineConnectUrl = new URL(MACHINE_CONNECT_ROUTE, args.sourceUrl); machineConnectUrl.searchParams.set("source", args.sourceUrl); machineConnectUrl.searchParams.set("installation", args.installationId); - machineConnectUrl.searchParams.set("openedByCli", "1"); - return machineConnectUrl.toString(); + const separator = machineConnectUrl.search ? "&" : "?"; + return `${machineConnectUrl.toString()}${separator}openedByCli`; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/noter/public/noter.js` around lines 105 - 110, The buildMachineConnectUrl function currently sets openedByCli as a value pair ("1"); change it to a key-only flag by using URLSearchParams/URL.searchParams to append the key without a value (e.g., call .set or .append in a way that yields a key-only param) so the generated URL uses ?openedByCli instead of ?openedByCli=1; update the code that uses MACHINE_CONNECT_ROUTE, args.sourceUrl and args.installationId to keep those params unchanged and only modify how openedByCli is emitted so receivers can check url.searchParams.has("openedByCli").
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/noter/e2e/machine-connect-visual.spec.ts`:
- Around line 3-8: In the "machine connect fixture" test (test("machine connect
fixture", async ({ page }) => { ... })), remove the explicit call to
page.setViewportSize({ width: 1280, height: 860 }) so the test uses the shared
Playwright project viewport/presets (e.g., Desktop Chrome) instead of a one-off
size; leave the navigation and waitForLoadState calls intact.
In `@apps/noter/public/noter.js`:
- Around line 49-67: validateSourceUrl currently allows non-canonical URL
variants (user:pass@host, query string, fragment) which leak data; update
validateSourceUrl to reject any URL that contains a username, password, search
(query) or hash (fragment) by checking sourceUrl.username, sourceUrl.password,
sourceUrl.search, and sourceUrl.hash and throwing an Error with a clear message
if any are present; keep the existing protocol/hostname and pathname checks
(NOTER_SYNC_SCRIPT_PATHNAME) but add this additional validation to ensure only
canonical URLs are accepted.
- Around line 153-165: openBrowser currently spawns a child process but doesn't
listen for the child 'error' event or return a Promise, so failures to start the
opener are silent; change export function openBrowser(url) to return a Promise
that calls spawn(openerCommand.command, openerCommand.args, {detached: true,
stdio: "ignore"}) and resolves once the child is successfully spawned (and
detached/unref'ed) and rejects if the child emits an 'error' event, then update
callers to await openBrowser(url) before logging success so the log only happens
on resolved Promise.
In `@packages/sync/noter.js`:
- Around line 105-109: In buildMachineConnectUrl, stop emitting openedByCli=1
and instead add a key-only flag (just ?openedByCli) to the handoff URL: locate
the machineConnectUrl creation (new URL(MACHINE_CONNECT_ROUTE, args.sourceUrl))
and replace the searchParams.set('openedByCli', '1') step with appending the raw
flag token (e.g. add "openedByCli" to machineConnectUrl.search or otherwise
concatenate '?openedByCli' / '&openedByCli' so the URL contains the key without
a value); keep the other params (source and installationId) as-is and update any
related tests/consumers that expect the previous =1 form.
- Around line 153-165: The openBrowser function currently calls
spawn(openerCommand.command, openerCommand.args, ...) and relies on an outer
try/catch, but spawn emits an "error" event on the ChildProcess instead of
throwing; add a child.on('error', ...) handler right after spawn to catch spawn
failures (e.g., missing xdg-open) and invoke the same fallback warning/logging
behavior used in the existing catch block, then return/short-circuit so the
success path (child.unref() and success log) is not executed on error; keep
child.unref() for the normal path and ensure the handler covers both
packages/sync/noter.js and apps/noter/public/noter.js openBrowser
implementations.
---
Nitpick comments:
In `@apps/noter/public/noter.js`:
- Around line 105-110: The buildMachineConnectUrl function currently sets
openedByCli as a value pair ("1"); change it to a key-only flag by using
URLSearchParams/URL.searchParams to append the key without a value (e.g., call
.set or .append in a way that yields a key-only param) so the generated URL uses
?openedByCli instead of ?openedByCli=1; update the code that uses
MACHINE_CONNECT_ROUTE, args.sourceUrl and args.installationId to keep those
params unchanged and only modify how openedByCli is emitted so receivers can
check url.searchParams.has("openedByCli").
In `@apps/noter/src/App.tsx`:
- Around line 534-537: Replace the hard-coded route string in the Route element
with the shared constant: change the path prop from "/machines/connect" to use
MACHINE_CONNECT_ROUTE (i.e., path={MACHINE_CONNECT_ROUTE}) for the Route that
renders MachineConnectPage; also add the proper import for MACHINE_CONNECT_ROUTE
from its module where other route constants live so the router uses the single
source of truth used by the dashboard, metadata, and CLI handoff.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: b1fb9576-547b-44d7-98d5-607e5a855afa
⛔ Files ignored due to path filters (1)
apps/noter/e2e/machine-connect-visual.spec.ts-snapshots/machine-connect-page.pngis excluded by!**/*.png
📒 Files selected for processing (18)
apps/noter/e2e/machine-connect-visual.spec.tsapps/noter/public/noter.jsapps/noter/src/App.tsxapps/noter/src/components/MachineConnectPage.tsxapps/noter/src/components/MachineConnectVisualFixture.tsxapps/noter/src/components/VaultDashboard.tsxapps/noter/src/components/VaultDashboardChrome.tsxapps/noter/src/components/VaultDashboardVisualFixture.tsxapps/noter/src/lib/noterSync.test.tsapps/noter/src/lib/noterSync.tsapps/noter/src/lib/noterSyncPublicScript.test.tsapps/noter/src/lib/pageMetadata.test.tsapps/noter/src/lib/pageMetadata.tsapps/noter/src/visualFixture.tsxapps/noter/vite.config.tspackages/sync/noter.jspackages/sync/noter.test.tspackages/sync/package.json
✅ Files skipped from review due to trivial changes (1)
- packages/sync/package.json
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/sync/noter.js (1)
165-176: Prefer template literals over array.join for multi-line strings.As per coding guidelines: "When constructing multi-line JavaScript/TypeScript source snippets, prefer template literals over arrays of one-line strings joined with
'\n'."♻️ Suggested refactor
export function formatHelpText() { - return [ - 'Usage:', - ' noter-sync connect [--from https://<current-deploy>/noter.js]', - '', - 'Examples:', - ' npx `@noter-md/sync` connect', - ' npx `@noter-md/sync` connect --from https://preview.noter.md/noter.js', - ' node ./noter.js connect', - ' curl -fsSL https://noter.md/noter.js | node --input-type=module - connect --from https://noter.md/noter.js', - ].join('\n') + return `Usage: + noter-sync connect [--from https://<current-deploy>/noter.js] + +Examples: + npx `@noter-md/sync` connect + npx `@noter-md/sync` connect --from https://preview.noter.md/noter.js + node ./noter.js connect + curl -fsSL https://noter.md/noter.js | node --input-type=module - connect --from https://noter.md/noter.js` }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/sync/noter.js` around lines 165 - 176, The function formatHelpText currently builds the multi-line help string by returning an array joined with '\n'; replace that with a single template literal containing the same lines (preserving spacing and blank line) to follow the guideline. Edit the export function formatHelpText() to return a backtick-delimited multi-line string instead of the array.join call so callers receive identical output while using template literals.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/sync/noter.js`:
- Around line 46-65: validateSourceUrl currently allows URLs containing
username, password, search (query) or hash fragments which can leak credentials
and create duplicate installation records; update validateSourceUrl to
explicitly reject any sourceUrl that has non-empty username, password, search,
or hash components by throwing an Error (similar to the existing
pathname/protocol checks). Locate the function validateSourceUrl and add checks
against sourceUrl.username, sourceUrl.password, sourceUrl.search, and
sourceUrl.hash, producing a clear error message referencing
NOTER_SYNC_SCRIPT_PATHNAME so callers know the URL must be canonical and free of
credentials, queries, or fragments.
---
Nitpick comments:
In `@packages/sync/noter.js`:
- Around line 165-176: The function formatHelpText currently builds the
multi-line help string by returning an array joined with '\n'; replace that with
a single template literal containing the same lines (preserving spacing and
blank line) to follow the guideline. Edit the export function formatHelpText()
to return a backtick-delimited multi-line string instead of the array.join call
so callers receive identical output while using template literals.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 74fc47ae-bc76-4415-b26a-2815d54d6823
⛔ Files ignored due to path filters (1)
apps/noter/e2e/machine-connect-visual.spec.ts-snapshots/machine-connect-page.pngis excluded by!**/*.png
📒 Files selected for processing (8)
apps/noter/public/noter.jsapps/noter/src/components/MachineConnectPage.tsxapps/noter/src/components/MachineConnectVisualFixture.tsxapps/noter/src/lib/noterSync.test.tsapps/noter/src/lib/noterSync.tspackages/sync/noter.jspackages/sync/noter.test.tsrfcs/073_CODEX_PLUGIN_CONNECTED_MACHINE_ONBOARDING_RESEARCH.md
✅ Files skipped from review due to trivial changes (3)
- apps/noter/src/components/MachineConnectVisualFixture.tsx
- apps/noter/src/lib/noterSync.test.ts
- packages/sync/noter.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- apps/noter/src/lib/noterSync.ts
- apps/noter/src/components/MachineConnectPage.tsx
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e46ebbdef3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| sourceUrl = argv[index + 1] ?? null | ||
| index += 1 |
There was a problem hiding this comment.
Fail when
--from is provided without a URL
When parseCliArgs sees --from at the end of the command, it assigns null and execution later falls back to DEFAULT_NOTER_SYNC_SOURCE_URL instead of rejecting the input. That means a typo like noter-sync connect --from silently connects against the default deploy, which can misroute preview/local installation flows and is difficult to detect from the CLI output. The parser should throw if --from is missing its required URL argument.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b94aec12ec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "# default published package", | ||
| "npx @noter-md/sync connect", | ||
| "# direct single-file install for this deploy", | ||
| `curl -fsSL ${scriptUrl} | node --input-type=module - connect --from ${scriptUrl}`, |
There was a problem hiding this comment.
Copy only one install command from machine connect page
buildNoterSyncConnectCommand returns two runnable shell commands in one string, and MachineConnectPage copies that full string to the clipboard. When a user pastes it into a terminal, the shell executes both installers sequentially (npx and then the direct curl | node fallback), which double-runs bootstrap and can unexpectedly execute the remote script path even if the user intended the default flow only. The copied payload should be a single executable path (or require explicit user choice) to avoid unintended execution.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 318d49011f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ? { command: 'cmd', args: ['/c', 'start', '', url] } | ||
| : { command: 'xdg-open', args: [url] } |
There was a problem hiding this comment.
Quote URL when invoking Windows browser opener
buildMachineConnectUrl always produces a query string with &, but the Windows branch calls cmd /c start '' <url> without quoting the URL argument. In cmd, unquoted & splits commands, so the opener can receive a truncated URL (dropping installation/openedByCli) or fail to open correctly on Windows hosts. Please pass a quoted URL to start (for example start "" "<url>") so the full machine-connect URL is preserved.
Useful? React with 👍 / 👎.
318d490 to
6f327c4
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 605408b253
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| export function resolveMachineConnectScriptOrigin( | ||
| sourceUrl: string | null, | ||
| fallbackOrigin: string, | ||
| ): string { | ||
| return tryParseNoterSyncSourceUrl(sourceUrl)?.origin ?? fallbackOrigin; |
There was a problem hiding this comment.
Restrict machine-connect source origin to trusted host
resolveMachineConnectScriptOrigin trusts any https://.../noter.js value from the source query param, so a crafted link like /machines/connect?source=https://attacker.example/noter.js will make MachineConnectPage render/copy a command that downloads and executes attacker-controlled code. Because this page is served from a trusted Noter domain, users can be socially engineered into running that command. The source origin should be constrained (for example to the current origin and explicitly allowed preview/local hosts) before it is used to build the install command/link.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6cfa1949b5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const origin = | ||
| args?.devOrigin?.trim() || | ||
| args?.pagesUrl?.trim() || | ||
| DEFAULT_NOTER_SYNC_SOURCE_ORIGIN; |
There was a problem hiding this comment.
Fall back to local deploy origin when source env is missing
When DEV_ENV_ORIGIN and CF_PAGES_URL are unset, this function hard-falls back to https://noter.md, so the dev-served /noter.js is stamped with the production source URL. In the default local/worktree flow (make anon does not export either variable), running curl http://127.0.0.1:5174/noter.js | ... will open and persist state for noter.md instead of the current deploy, which breaks the deploy-scoped behavior this slice is introducing.
Useful? React with 👍 / 👎.
| export function buildDirectNoterSyncConnectCommand(scriptUrl: string): string { | ||
| return `curl -fsSL ${scriptUrl} | node --input-type=module - connect`; |
There was a problem hiding this comment.
Make direct installer command fail on curl errors
The generated direct command pipes curl into node without pipefail, so if download fails (DNS/TLS/404/network), node still runs an empty stdin script and exits 0 in typical shells. That creates a silent no-op in the primary “Use this today” path, making onboarding failures hard to detect and diagnose because users do not get a failing exit status.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f1d29e2936
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| export function buildDirectNoterSyncConnectCommand(scriptUrl: string): string { | ||
| return `curl -fsSL ${scriptUrl} | node --input-type=module - connect ${scriptUrl}`; |
There was a problem hiding this comment.
Quote installer URL in generated direct shell command
Wrap scriptUrl in shell quotes when building the copyable direct command, otherwise local IPv6 deploy URLs like http://[::1]:5174/noter.js can break in common shells (notably zsh, where [...] is treated as a glob pattern and can error with “no matches found”). This causes the advertised local/worktree bootstrap command to fail before curl runs, even though the URL is explicitly accepted by the source-url validator.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d84f0d787
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| child.once('spawn', () => { | ||
| child.off('error', handleError) | ||
| child.unref() | ||
| resolve() |
There was a problem hiding this comment.
Detect browser opener exit failures
openBrowser resolves as soon as the child process emits spawn, so main logs “opened machine connect page in your browser” even when the opener immediately exits with a non-zero code (common on headless Linux/WSL where xdg-open exists but cannot launch a browser). In that case the fallback warning path is never triggered, which silently breaks the handoff flow and misleads users about completion.
Useful? React with 👍 / 👎.
1d84f0d to
9d053aa
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9d053aa88e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return true | ||
| } | ||
|
|
||
| return import.meta.url === pathToFileURL(entrypoint).href |
There was a problem hiding this comment.
Resolve bin symlinks before checking direct execution
The isDirectExecution guard compares import.meta.url to pathToFileURL(process.argv[1]), but package-manager bin launches (npx @noter-md/sync connect, node_modules/.bin/noter-sync) run through a symlink path in .bin. In that common path, process.argv[1] is the symlink while import.meta.url resolves to the real file, so this comparison is false and main(...) never runs, causing the CLI to exit without doing anything. This breaks the primary published-package invocation flow.
Useful? React with 👍 / 👎.
b38f16f to
d3b4763
Compare
d3b4763 to
797530c
Compare
Why
The installer slice and RFC 073 had drifted into two overlapping stories: an older multi-install/per-source model and the simpler product model we actually want for the MVP. This update resets both the docs and the implementation around the current intent.
For this first-user slice, the hosted deploy-scoped
noter.jsfile is the real path because it is the fastest way to iterate across prod, preview, and local worktrees.@noter-md/syncstill matters, but as the later public wrapper around the same underlying file rather than as something we pretend is already published.Summary
~/.noter/config.jsoninstead of per-source installation recordspackages/sync/noter.jsas the canonical installer source and mirror it byte-for-byte into hostedapps/noter/public/noter.js/machines/connectUI on the explicit-URL command for now, even though the runtime now supports the shorter production command/machines/connect?openedByCliand the app derives the script URL from the current originValidation
pnpm exec vitest --run packages/sync/noter.test.tspnpm --filter noter exec vitest --run src/lib/noterSync.test.ts src/lib/noterSyncPublicScript.test.tsPLAYWRIGHT=1 pnpm --filter noter build:ciPLAYWRIGHT=1 pnpm --filter noter exec playwright test -c playwright.config.ts e2e/machine-connect-visual.spec.ts --update-snapshotsvitest --runmake anonwas required locally so the worktree backend was available athttp://127.0.0.1:14440for the commit hooksFirst Message
write/update a spec about how you would do it, push to prRequested Codex Runtime
gpt-5medium