Skip to content

Remove moq submodule, use published packages#23

Open
kixelated wants to merge 5 commits intomainfrom
update-main
Open

Remove moq submodule, use published packages#23
kixelated wants to merge 5 commits intomainfrom
update-main

Conversation

@kixelated
Copy link
Copy Markdown
Collaborator

Summary

  • Remove moq git submodule, consume @moq/* packages from npm instead
  • Add moq nix flake as input to provide moq-relay and moq-token-cli for local dev
  • Add dev/relay/ with config and justfile for running the local relay server
  • Update all references (justfiles, tsconfig, CI workflow, docs)
  • Also includes dependency bumps from prior commits on this branch

Test plan

  • bun install resolves all published npm packages
  • TypeScript compilation passes for both @hang/api and @hang/live
  • Biome linting passes
  • just dev starts relay, api, and app correctly

🤖 Generated with Claude Code

kixelated and others added 5 commits March 31, 2026 11:21
Update moq to latest, upgrade biome to 2.4+ and typescript to 6.0+
to match moq requirements, enable tailwindDirectives in biome config,
and run semver-compatible dependency updates across all packages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Bump major versions: vite 8, typescript 6, @types/web 0.0.345,
  marked 17, uuid 13, @huggingface/transformers 4, globals 17
- Revert WIP addSection/addTrack code (d624cfe) that used unmerged APIs
- Fix path → name rename for Publish.Broadcast and Watch.Broadcast
- Fix support element imports: @moq/watch/support and @moq/publish/support
- Fix CryptoKeyPair type narrowing in moq/token
- Add allowImportingTsExtensions and worklet.d.ts for moq compatibility
- Remove stale @ts-expect-error directives (navigator.gpu now typed)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the moq git submodule with published @moq/* npm packages and
provide moq-relay/moq-token-cli via the moq nix flake for local dev.

- Remove moq submodule and .gitmodules
- Replace workspace:* deps with published npm versions
- Add moq flake input to flake.nix for relay and token CLI binaries
- Add dev/relay/ with config and justfile for local relay server
- Update justfile, api/justfile paths for new relay location
- Copy worklet.d.ts locally (was in moq/js/common/)
- Update CLAUDE.md, README.md, CI workflow, infra references

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

Walkthrough

This pull request transitions the MOQ protocol implementation from a git submodule dependency to published npm packages. The moq/ submodule is removed from repository configuration, while internal documentation and build tooling are updated to reference @moq/* npm packages and a new local relay server setup in dev/relay/. Package dependencies are pinned to explicit versions, and the Nix flake is updated to provide moq-relay and moq-token-cli binaries. Configuration files, justfiles, and GitHub workflows are adjusted to reflect the new dependency and directory structure.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the primary change: removing the moq git submodule and switching to published npm packages instead.
Description check ✅ Passed The description clearly relates to the changeset, detailing the removal of the moq submodule, addition of the moq nix flake, new dev/relay configuration, and documentation updates across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update-main
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch update-main

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
README.md (1)

51-56: ⚠️ Potential issue | 🟠 Major

The “Without Nix” path is missing relay tool prerequisites.

just dev now relies on moq-relay/moq-token-cli, but this section only installs JS deps. That path will fail unless users install those binaries separately.

💡 Suggested docs patch
 **Without Nix:**
 
 ```sh
 bun install
+# Ensure `moq-relay` and `moq-token-cli` are installed and on PATH
 just dev
</details>


Also applies to: 77-77

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @README.md around lines 51 - 56, The "Without Nix" instructions omit the
required relay tool binaries, so update the README's section that shows the
commands bun install and just dev to also instruct users to install and add
moq-relay and moq-token-cli to their PATH before running just dev; mention
these exact tool names (moq-relay, moq-token-cli) and place the note
immediately after bun install (and likewise update the similar occurrence
around line 77) so users know to install those prerequisites.


</details>

</blockquote></details>

</blockquote></details>
🧹 Nitpick comments (2)
app/package.json (1)

21-25: Consider exact pins for pre-1.0 @moq/* packages.

Using ^0.x.y for pre-1.0 dependencies can introduce breaking behavior on fresh installs. Prefer exact versions ("0.x.y") if you want tighter reproducibility during this migration period. This pattern appears in both app/package.json (lines 21–25) and api/package.json.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/package.json` around lines 21 - 25, The package pins for pre-1.0
dependencies use caret ranges which can pull breaking changes; update the
dependency entries for "@moq/hang", "@moq/lite", "@moq/publish", "@moq/signals",
and "@moq/watch" (in app/package.json) from "^0.x.y" to exact "0.x.y" versions
to ensure reproducible installs, and apply the same change for the corresponding
`@moq/`* entries found in api/package.json; keep the exact numeric versions
currently listed (remove the leading ^) without changing the version numbers
themselves.
dev/relay/justfile (1)

8-23: Harden permissions for generated auth artifacts.

root.jwk (and usually root.jwt) should be owner-readable only to avoid accidental local disclosure on shared systems.

💡 Suggested fix
 auth-key:
 	`@if` [ ! -f "root.jwk" ]; then \
 		rm -f *.jwt; \
 		moq-token-cli --key "root.jwk" generate; \
+		chmod 600 root.jwk; \
 	fi
@@
 auth-token: auth-key
 	`@if` [ ! -f "root.jwt" ]; then \
 		moq-token-cli --key "root.jwk" sign \
 			--root "" \
 			--subscribe "" \
 			--publish "" \
 			--cluster \
 			> root.jwt ; \
+		chmod 600 root.jwt; \
 	fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@dev/relay/justfile` around lines 8 - 23, The generated auth targets (auth-key
and auth-token) currently create root.jwk and root.jwt with default permissions;
change the recipes for targets "auth-key" and "auth-token" to set strict file
permissions after creation (e.g., chmod 600 root.jwk and chmod 600 root.jwt) so
both files are owner-readable/writeable only; ensure the chmod commands run only
when the files are created and preserve the existing rm -f *.jwt cleanup
behavior in the "auth-key" recipe.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@api/justfile`:
- Around line 9-11: The dev justfile target should guard the cat
../dev/relay/root.jwk call with an explicit preflight check: before invoking bun
wrangler dev, test that ../dev/relay/root.jwk exists (e.g., using [ -f ] or test
-f) and if it’s missing emit a clear error message and exit non-zero; then read
the key into a variable and pass it via --var "RELAY_SECRET:$(cat ...)" and keep
the existing RELAY_URL line unchanged. Locate the dev target in the justfile and
add the existence check and early exit immediately before the bun wrangler dev
invocation so the failure is descriptive rather than a bare cat error.

In `@dev/relay/root.toml`:
- Around line 9-18: The default relay listen addresses (tls.generate/listen and
[web.http].listen) are currently set to "[::]:4443", which is too permissive for
anonymous mode; change these defaults to loopback-only (e.g., "[::1]:4443" or
"127.0.0.1:4443") so the relay binds only to localhost when running with public
= "anon" — update the tls.generate/listen and web.http.listen entries
accordingly and ensure any comments note the security rationale.

In `@README.md`:
- Around line 18-23: The fenced code block that lists the project structure (the
block containing the lines starting with "app/        Web frontend (SolidJS +
Vite)", "api/        Backend API (Cloudflare Workers + Hono)", "native/    
Desktop/mobile app (Tauri v2)", and "dev/relay/  Local relay server config")
needs a language identifier to satisfy markdownlint MD040; update the opening
fence from ``` to ```text so the block becomes a labeled plaintext code block.

---

Outside diff comments:
In `@README.md`:
- Around line 51-56: The "Without Nix" instructions omit the required relay tool
binaries, so update the README's section that shows the commands `bun install`
and `just dev` to also instruct users to install and add `moq-relay` and
`moq-token-cli` to their PATH before running `just dev`; mention these exact
tool names (`moq-relay`, `moq-token-cli`) and place the note immediately after
`bun install` (and likewise update the similar occurrence around line 77) so
users know to install those prerequisites.

---

Nitpick comments:
In `@app/package.json`:
- Around line 21-25: The package pins for pre-1.0 dependencies use caret ranges
which can pull breaking changes; update the dependency entries for "@moq/hang",
"@moq/lite", "@moq/publish", "@moq/signals", and "@moq/watch" (in
app/package.json) from "^0.x.y" to exact "0.x.y" versions to ensure reproducible
installs, and apply the same change for the corresponding `@moq/`* entries found
in api/package.json; keep the exact numeric versions currently listed (remove
the leading ^) without changing the version numbers themselves.

In `@dev/relay/justfile`:
- Around line 8-23: The generated auth targets (auth-key and auth-token)
currently create root.jwk and root.jwt with default permissions; change the
recipes for targets "auth-key" and "auth-token" to set strict file permissions
after creation (e.g., chmod 600 root.jwk and chmod 600 root.jwt) so both files
are owner-readable/writeable only; ensure the chmod commands run only when the
files are created and preserve the existing rm -f *.jwt cleanup behavior in the
"auth-key" recipe.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 99226d78-5294-4adf-9743-0c25d01464fd

📥 Commits

Reviewing files that changed from the base of the PR and between 41bbb17 and 8c23b3c.

⛔ Files ignored due to path filters (2)
  • bun.lock is excluded by !**/*.lock
  • flake.lock is excluded by !**/*.lock
📒 Files selected for processing (15)
  • .github/workflows/check.yml
  • .gitmodules
  • CLAUDE.md
  • README.md
  • api/justfile
  • api/package.json
  • app/package.json
  • app/src/worklet.d.ts
  • dev/relay/justfile
  • dev/relay/root.toml
  • flake.nix
  • infra/variables.tf
  • justfile
  • moq
  • package.json
💤 Files with no reviewable changes (4)
  • infra/variables.tf
  • .gitmodules
  • moq
  • .github/workflows/check.yml

Comment on lines 9 to +11
dev:
bun wrangler d1 migrations apply DB --local
bun wrangler dev --var "RELAY_SECRET:$(cat ../moq/dev/root.jwk)" --var "RELAY_URL:http://${TAURI_DEV_HOST:-localhost}:4443"
bun wrangler dev --var "RELAY_SECRET:$(cat ../dev/relay/root.jwk)" --var "RELAY_URL:http://${TAURI_DEV_HOST:-localhost}:4443"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add an explicit preflight check for root.jwk.

Running cd api && just dev fails with a low-context cat error if the key hasn’t been generated yet. A guard here makes local setup failures much clearer.

💡 Suggested patch
 dev:
 	bun wrangler d1 migrations apply DB --local
-	bun wrangler dev --var "RELAY_SECRET:$(cat ../dev/relay/root.jwk)" --var "RELAY_URL:http://${TAURI_DEV_HOST:-localhost}:4443"
+	test -f ../dev/relay/root.jwk || (echo "Missing ../dev/relay/root.jwk. Run: cd dev/relay && just auth-token" >&2; exit 1)
+	bun wrangler dev --var "RELAY_SECRET:$(cat ../dev/relay/root.jwk)" --var "RELAY_URL:http://${TAURI_DEV_HOST:-localhost}:4443"
📝 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.

Suggested change
dev:
bun wrangler d1 migrations apply DB --local
bun wrangler dev --var "RELAY_SECRET:$(cat ../moq/dev/root.jwk)" --var "RELAY_URL:http://${TAURI_DEV_HOST:-localhost}:4443"
bun wrangler dev --var "RELAY_SECRET:$(cat ../dev/relay/root.jwk)" --var "RELAY_URL:http://${TAURI_DEV_HOST:-localhost}:4443"
dev:
bun wrangler d1 migrations apply DB --local
test -f ../dev/relay/root.jwk || (echo "Missing ../dev/relay/root.jwk. Run: cd dev/relay && just auth-token" >&2; exit 1)
bun wrangler dev --var "RELAY_SECRET:$(cat ../dev/relay/root.jwk)" --var "RELAY_URL:http://${TAURI_DEV_HOST:-localhost}:4443"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@api/justfile` around lines 9 - 11, The dev justfile target should guard the
cat ../dev/relay/root.jwk call with an explicit preflight check: before invoking
bun wrangler dev, test that ../dev/relay/root.jwk exists (e.g., using [ -f ] or
test -f) and if it’s missing emit a clear error message and exit non-zero; then
read the key into a variable and pass it via --var "RELAY_SECRET:$(cat ...)" and
keep the existing RELAY_URL line unchanged. Locate the dev target in the
justfile and add the existence check and early exit immediately before the bun
wrangler dev invocation so the failure is descriptive rather than a bare cat
error.

Comment on lines +9 to +18
listen = "[::]:4443"

# Generate a self-signed certificate for the given hostnames.
# This is used for local development, in conjunction with a fingerprint, or with TLS verification disabled.
tls.generate = ["localhost"]

[web.http]
# Listen for HTTP and WebSocket (TCP) connections on the given address.
# Defaults to disabled if not provided.
listen = "[::]:4443"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Default relay binding is too broad for anonymous mode.

With listen = "[::]:4443" and public = "anon", the relay may accept anonymous traffic from non-local interfaces on shared networks. Default this config to loopback-only for safer local development.

🔒 Suggested hardening
 [server]
-listen = "[::]:4443"
+listen = "127.0.0.1:4443"
@@
 [web.http]
-listen = "[::]:4443"
+listen = "127.0.0.1:4443"

Also applies to: 33-34

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@dev/relay/root.toml` around lines 9 - 18, The default relay listen addresses
(tls.generate/listen and [web.http].listen) are currently set to "[::]:4443",
which is too permissive for anonymous mode; change these defaults to
loopback-only (e.g., "[::1]:4443" or "127.0.0.1:4443") so the relay binds only
to localhost when running with public = "anon" — update the tls.generate/listen
and web.http.listen entries accordingly and ensure any comments note the
security rationale.

Comment on lines 18 to 23
```
app/ Web frontend (SolidJS + Vite)
api/ Backend API (Cloudflare Workers + Hono)
native/ Desktop/mobile app (Tauri v2)
moq/ Media over QUIC libraries (git submodule → github.com/kixelated/moq)
dev/relay/ Local relay server config
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add a language identifier to the fenced project-structure block.

This currently trips markdownlint MD040.

💡 Suggested fix
-```
+```text
 app/        Web frontend (SolidJS + Vite)
 api/        Backend API (Cloudflare Workers + Hono)
 native/     Desktop/mobile app (Tauri v2)
 dev/relay/  Local relay server config
</details>

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.22.0)</summary>

[warning] 18-18: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @README.md around lines 18 - 23, The fenced code block that lists the project
structure (the block containing the lines starting with "app/ Web
frontend (SolidJS + Vite)", "api/ Backend API (Cloudflare Workers +
Hono)", "native/ Desktop/mobile app (Tauri v2)", and "dev/relay/ Local
relay server config") needs a language identifier to satisfy markdownlint MD040;
update the opening fence from totext so the block becomes a labeled
plaintext code block.


</details>

<!-- fingerprinting:phantom:poseidon:hawk:5ca8007f-9d0b-410f-888f-fecd37b49e9a -->

<!-- This is an auto-generated comment by CodeRabbit -->

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