Skip to content

Feature/add socket#253

Merged
stephansama merged 11 commits into
mainfrom
feature/add-socket
Apr 12, 2026
Merged

Feature/add socket#253
stephansama merged 11 commits into
mainfrom
feature/add-socket

Conversation

@stephansama
Copy link
Copy Markdown
Owner

Checklist

  • Latest changes from main have been merged
  • Conflicts have been resolved
  • The branch is pointing to main
  • Eslint hasn't reported any issues.
  • All unit tests pass

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
packages Ready Ready Preview, Comment Apr 12, 2026 3:46am

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 10, 2026

🦋 Changeset detected

Latest commit: 3c3d55a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 22 packages
Name Type
@stephansama/catppuccin-jsonresume-theme Patch
@stephansama/prettier-plugin-handlebars Patch
@stephansama/svelte-social-share-links Patch
@stephansama/types-github-action-env Patch
@stephansama/find-makefile-targets Patch
@stephansama/astro-iconify-svgmap Patch
@stephansama/catppuccin-typedoc Patch
@stephansama/remark-asciinema Patch
@stephansama/typed-nocodb-api Patch
@stephansama/catppuccin-opml Patch
@stephansama/typed-templates Patch
@stephansama/alfred-kaomoji Patch
@stephansama/catppuccin-rss Patch
@stephansama/catppuccin-xsl Patch
@stephansama/ai-commit-msg Patch
@stephansama/multipublish Patch
@stephansama/typed-events Patch
@stephansama/auto-readme Patch
@stephansama/github-env Patch
@stephansama/types-lhci Patch
@stephansama/typed-env Patch
create-stephansama-example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

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

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 standardizes dependency management across the workspace by implementing pnpm catalogs and YAML anchors for shared versions. It also adds JSR and socket.dev badges to all package READMEs, introduces an automation script for badge management, and updates the turbo generator templates. Review feedback highlights a typo in a URL, potential performance issues with broad workspace patterns, a bug in the badge script's index handling, and a variable mismatch in the README template.

Comment thread core/github-env/README.md Outdated
Comment thread pnpm-workspace.yaml Outdated
Comment thread scripts/add-socket.ts
Comment on lines +31 to +39
const indexOfNpmVersion = lines.findIndex((line) =>
line.startsWith("[![NPM Version]"),
);

const body = [
...lines.slice(0, indexOfNpmVersion),
currentTemplate,
...lines.slice(indexOfNpmVersion),
].join("\n");
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

If the NPM Version badge is not found in the README, indexOfNpmVersion will be -1. The subsequent slice operations will then incorrectly insert the new badge before the last line of the file. You should check if the index is valid before proceeding. Additionally, the template string contains leading and trailing newlines which, when joined with \n, will create unwanted empty lines in the README.

Comment thread turbo/generators/templates/common/README.md Outdated
@socket-security
Copy link
Copy Markdown

socket-security Bot commented Apr 10, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​turbo/​gen@​2.8.9 ⏵ 2.8.20100 +310086 +2898 +1100
Updated@​eslint/​config-inspector@​1.4.2 ⏵ 1.5.099100100 +587 +2100

View full report

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 10, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Documentation

    • Added JSR and socket.dev badges to many package READMEs and templates for improved package visibility.
  • Chores

    • Standardized formatter and spellcheck configuration files.
    • Consolidated dependency/version references in workspace configuration.
    • Added workspace script and automation to insert socket.dev badges into READMEs.
    • Minor CI/hooks and package metadata tidy-ups.

Walkthrough

Adds JSR and socket.dev badges across many core package READMEs, adds an automation script (scripts/add-socket.ts) with its package manifest, converts many dependency specifiers to catalog: and centralizes versions in pnpm-workspace.yaml, and updates formatting/config files (.config/.cspell.json, .prettierrc, some package.json formatting and root package.json entries).

Changes

Cohort / File(s) Summary
Config & formatting
\.config/.cspell.json, \.prettierrc, core/prettier-plugin-handlebars/package.json
Reformatted JSON, adjusted Prettier overrides (added *.json override, changed Astro glob to array), updated .cspell ignoreWords (removed dotenvx, added commitlint, packagejson, taze), and changed a Prettier devDependency catalog reference.
README badge additions
core/*/README.md, turbo/generators/templates/common/README.md
Inserted JSR and socket.dev badges into many core package READMEs and the README generator template; a few READMEs had minor JSDoc quote-style edits.
Automation script & package
scripts/add-socket.ts, scripts/package.json, scripts/README.md
Added scripts/add-socket.ts that enumerates workspace packages, filters core/*, and inserts socket.dev badge markdown before the NPM badge; added @stephansama/scripts manifest with add-socket script and a minimal scripts README.
Workspace & catalogs
pnpm-workspace.yaml
Introduced __versions YAML anchors, added scripts to workspace globs, created new catalogs.* sub-catalogs, pinned/anchored many package versions, and reorganized prettier-related entries.
Root package manifest
package.json
Converted many dependency/devDependency specifiers to catalog: references, moved prettier-plugin-tailwindcss to dependencies, and removed scripts.dev (turbo dev).
Multipublish logic & docs
core/multipublish/src/index.ts, core/multipublish/README.md
Runtime: when versionJsr enabled, skip JSR update for unscoped package names (log warning + continue). Docs: added JSR/socket.dev badges and documented new optional tokenEnvironmentKey (default JSR_AUTH_TOKEN).
Hooks & pre-commit
.husky/commit-msg, .husky/pre-commit
Wrapped commit-msg path argument in quotes for commitlint, and removed -v flag from auto-readme invocation in pre-commit.
Tests & changeset
core/multipublish/src/index.test.ts, .changeset/sad-bats-battle.md
Updated multipublish tests to include an extra package fixture and added a changeset documenting badge additions.
Packaging formatting
many core/*/package.json
Reformatted package.json files (tabs → spaces) and updated one prettier devDependency catalog reference.

Sequence Diagram(s)

sequenceDiagram
  participant Script as scripts/add-socket.ts
  participant Workspace as PNPM Workspace (getPackages)
  participant FS as FileSystem (README.md)
  rect rgba(100,150,240,0.5)
    Workspace->>Script: return package list (name, dir, relativeDir)
  end
  Script->>Script: filter packages where relativeDir startsWith "core"
  loop per package
    Script->>FS: read README.md
    FS-->>Script: README content
    Script->>Script: build socket.dev badge markdown
    alt snippet exists
      Script->>Script: skip package
    else not present
      Script->>FS: write updated README.md (insert badge before NPM Version badge)
      FS-->>Script: write success
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐇 I hopped through READMEs past midnight,

stitched small badges, left them bright,
a script that leaps from package to file,
inserts socket.dev with a nimble smile,
a rabbit cheers for docs done right!

🚥 Pre-merge checks | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description only includes the repository's template checklist with no actual description of the changes made, their purpose, or rationale for the modifications. Add a detailed description explaining why socket.dev badges were added, the scope of changes across the monorepo, and any relevant context about catalog dependency updates.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Feature/add socket' is vague and generic, using non-descriptive terms that don't clearly convey what was actually changed in the changeset. Revise the title to be more descriptive of the main change, such as 'Add JSR and socket.dev badges to package READMEs' or 'Add socket.dev badge integration to monorepo packages'.

✏️ 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 feature/add-socket

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: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@core/catppuccin-opml/README.md`:
- Around line 6-7: The README badge order is inconsistent with other package
READMEs; in core/catppuccin-opml/README.md swap the two badge lines so the
socket.dev badge
(https://badge.socket.dev/npm/package/@stephansama/catppuccin-opml) appears
before the JSR badge (https://jsr.io/badges/@stephansama/catppuccin-opml) to
match core/catppuccin-xsl/README.md and keep badge ordering uniform across
packages.

In `@core/github-env/README.md`:
- Line 7: Fix the typo in the README badge URL: update the markdown link where
the badge is defined (the
"[![socket.dev](https://badge.socket.dev/npm/package/@stephansama/github-env)](https://scket.dev/npm/package/@stephansama/github-env/overview)"
entry) by changing the target URL host from "scket.dev" to "socket.dev" so the
link becomes
"(https://socket.dev/npm/package/@stephansama/github-env/overview)"; ensure both
the badge image URL and the clickable link use "socket.dev" consistently.

In `@package.json`:
- Line 30: The package.json script "scripts:add-socket" invokes the CLI "tsx"
but the project does not declare "tsx" in dependencies/devDependencies; add
"tsx": "catalog:" to the root package.json (prefer devDependencies for a dev
tool) so running pnpm run scripts:add-socket works in clean environments, then
run pnpm install to update the lockfile and verify pnpm run scripts:add-socket
executes without "tsx: command not found".

In `@pnpm-workspace.yaml`:
- Around line 86-87: Update the pnpm-workspace.yaml to use the existing
__versions anchor pattern: add a &prettier entry with value "3.8.1" to the
__versions block, then replace the hardcoded prettier: 3.8.1 line with prettier:
*prettier so the catalog uses the anchor; look for the __versions block and the
prettier key in the catalog to make these changes.

In `@scripts/add-socket.ts`:
- Around line 21-23: The code assumes README.md exists and that the anchor index
is found, causing crashes or malformed output; update the logic around
readmePath/readmeFile and currentTemplate to: check for README existence before
calling fs.promises.readFile (or catch the read error) and create a sensible
default README content if missing; after computing anchorIndex (the index used
by the insertion logic around template.replaceAll/currentTemplate), handle
indexOf returning -1 by choosing a safe insertion point (e.g., append at the end
or after the last non-empty line) instead of using -1 which writes before the
last line; ensure write logic uses these guarded values so writing never
produces malformed output.
- Around line 8-13: The script name add-socket.ts is misleading because the
current const template only inserts a JSR badge (const template) while a socket
badge template is commented out; either implement insertion of the socket.dev
badge or rename the script/command to reflect it only adds JSR. To fix: locate
the const template in scripts/add-socket.ts and either (A) restore and use the
commented socket template (or add a flag/option to choose between `socket` and
`jsr`) so both badges can be inserted, ensuring the chosen template variable is
used in the insertion routine, or (B) rename the file/CLI command and update any
references/documentation to add-jsr (and remove the commented socket template)
so behavior matches name. Ensure references to `template` and the commented
socket template are handled and update README/usage strings accordingly.

In `@turbo/generators/templates/common/README.md`:
- Line 7: The README badge URL uses an undefined template variable
`{{package}}`; update the href to use the existing `{{name}}` variable so both
the badge image and link match (replace `{{package}}` with `{{name}}` in the
badge link on the README line that contains [![socket.dev]...]); ensure you only
change the URL token and keep the rest of the badge markup intact.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: 5977854f-1d99-4f17-8a7b-62d5d71cd76a

📥 Commits

Reviewing files that changed from the base of the PR and between 1f064a2 and 65acd10.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (30)
  • .config/.cspell.json
  • .prettierrc
  • core/ai-commit-msg/README.md
  • core/alfred-kaomoji/README.md
  • core/astro-iconify-svgmap/README.md
  • core/auto-readme/README.md
  • core/catppuccin-jsonresume-theme/README.md
  • core/catppuccin-opml/README.md
  • core/catppuccin-rss/README.md
  • core/catppuccin-typedoc/README.md
  • core/catppuccin-xsl/README.md
  • core/example/README.md
  • core/find-makefile-targets/README.md
  • core/github-env/README.md
  • core/multipublish/README.md
  • core/prettier-plugin-handlebars/README.md
  • core/remark-asciinema/README.md
  • core/svelte-social-share-links/README.md
  • core/typed-env/README.md
  • core/typed-events/README.md
  • core/typed-nocodb-api/README.md
  • core/typed-templates/README.md
  • core/types-github-action-env/README.md
  • core/types-lhci/README.md
  • package.json
  • pnpm-workspace.yaml
  • scripts/add-socket.ts
  • scripts/package.json
  • scripts/tsconfig.json
  • turbo/generators/templates/common/README.md

Comment on lines +6 to +7
[![JSR](https://jsr.io/badges/@stephansama/catppuccin-opml)](https://jsr.io/@stephansama/catppuccin-opml)
[![socket.dev](https://badge.socket.dev/npm/package/@stephansama/catppuccin-opml)](https://socket.dev/npm/package/@stephansama/catppuccin-opml/overview)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Inconsistent badge ordering across READMEs.

The badge order here is JSR → socket.dev, but in core/catppuccin-xsl/README.md it's socket.dev → JSR. Consider maintaining a consistent badge order across all package READMEs for uniformity.

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

In `@core/catppuccin-opml/README.md` around lines 6 - 7, The README badge order is
inconsistent with other package READMEs; in core/catppuccin-opml/README.md swap
the two badge lines so the socket.dev badge
(https://badge.socket.dev/npm/package/@stephansama/catppuccin-opml) appears
before the JSR badge (https://jsr.io/badges/@stephansama/catppuccin-opml) to
match core/catppuccin-xsl/README.md and keep badge ordering uniform across
packages.

Comment thread core/github-env/README.md Outdated
Comment thread package.json Outdated
Comment thread pnpm-workspace.yaml Outdated
Comment thread scripts/add-socket.ts Outdated
Comment thread scripts/add-socket.ts
Comment thread turbo/generators/templates/common/README.md Outdated
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 10, 2026

More templates

@stephansama/ai-commit-msg

pnpm add https://pkg.pr.new/@stephansama/ai-commit-msg@253

@stephansama/alfred-kaomoji

pnpm add https://pkg.pr.new/@stephansama/alfred-kaomoji@253

@stephansama/astro-iconify-svgmap

pnpm add https://pkg.pr.new/@stephansama/astro-iconify-svgmap@253

@stephansama/auto-readme

pnpm add https://pkg.pr.new/@stephansama/auto-readme@253

@stephansama/catppuccin-jsonresume-theme

pnpm add https://pkg.pr.new/@stephansama/catppuccin-jsonresume-theme@253

@stephansama/catppuccin-opml

pnpm add https://pkg.pr.new/@stephansama/catppuccin-opml@253

@stephansama/catppuccin-rss

pnpm add https://pkg.pr.new/@stephansama/catppuccin-rss@253

@stephansama/catppuccin-typedoc

pnpm add https://pkg.pr.new/@stephansama/catppuccin-typedoc@253

@stephansama/catppuccin-xsl

pnpm add https://pkg.pr.new/@stephansama/catppuccin-xsl@253

create-stephansama-example

pnpm add https://pkg.pr.new/create-stephansama-example@253

@stephansama/find-makefile-targets

pnpm add https://pkg.pr.new/@stephansama/find-makefile-targets@253

@stephansama/github-env

pnpm add https://pkg.pr.new/@stephansama/github-env@253

@stephansama/multipublish

pnpm add https://pkg.pr.new/@stephansama/multipublish@253

@stephansama/prettier-plugin-handlebars

pnpm add https://pkg.pr.new/@stephansama/prettier-plugin-handlebars@253

@stephansama/remark-asciinema

pnpm add https://pkg.pr.new/@stephansama/remark-asciinema@253

@stephansama/svelte-social-share-links

pnpm add https://pkg.pr.new/@stephansama/svelte-social-share-links@253

@stephansama/typed-env

pnpm add https://pkg.pr.new/@stephansama/typed-env@253

@stephansama/typed-events

pnpm add https://pkg.pr.new/@stephansama/typed-events@253

@stephansama/typed-nocodb-api

pnpm add https://pkg.pr.new/@stephansama/typed-nocodb-api@253

@stephansama/typed-templates

pnpm add https://pkg.pr.new/@stephansama/typed-templates@253

@stephansama/types-github-action-env

pnpm add https://pkg.pr.new/@stephansama/types-github-action-env@253

@stephansama/types-lhci

pnpm add https://pkg.pr.new/@stephansama/types-lhci@253

commit: 3c3d55a

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.

♻️ Duplicate comments (1)
scripts/add-socket.ts (1)

17-35: ⚠️ Potential issue | 🟠 Major

Guard missing README and missing insertion anchor before write.

Line 18 can throw when README.md is absent, and indexOfNpmVersion === -1 leads to incorrect insertion slices. Handle both cases before constructing body.

Proposed fix
 const readmePath = path.resolve(pkg.dir, "README.md");
-const readmeFile = await fs.promises.readFile(readmePath, "utf8");
+const hasReadme = await fs.promises
+  .access(readmePath)
+  .then(() => true)
+  .catch(() => false);
+if (!hasReadme) continue;
+
+const readmeFile = await fs.promises.readFile(readmePath, "utf8");
@@
 const indexOfNpmVersion = lines.findIndex((line) =>
 	line.startsWith("[![NPM Version]"),
 );
+if (indexOfNpmVersion === -1) {
+	console.warn(`[add-socket] Skipping ${readmePath}: NPM badge line not found`);
+	continue;
+}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/add-socket.ts` around lines 17 - 35, Guard against missing README and
missing anchor before constructing body: when resolving/reading README
(readmePath/readmeFile) wrap the read in a try/catch or check existence first
and treat a missing README as an empty string; compute lines =
readmeFile.split("\n") accordingly. After computing indexOfNpmVersion, handle
the -1 case by choosing a safe insertion index (e.g., lines.length to append or
0 to prepend) instead of slicing with -1; then build body from lines.slice(0,
insertIndex), currentTemplate, and lines.slice(insertIndex) so insertion is
correct even when the anchor is absent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@scripts/add-socket.ts`:
- Around line 17-35: Guard against missing README and missing anchor before
constructing body: when resolving/reading README (readmePath/readmeFile) wrap
the read in a try/catch or check existence first and treat a missing README as
an empty string; compute lines = readmeFile.split("\n") accordingly. After
computing indexOfNpmVersion, handle the -1 case by choosing a safe insertion
index (e.g., lines.length to append or 0 to prepend) instead of slicing with -1;
then build body from lines.slice(0, insertIndex), currentTemplate, and
lines.slice(insertIndex) so insertion is correct even when the anchor is absent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 927334a3-730f-4365-a41e-8e1920e52614

📥 Commits

Reviewing files that changed from the base of the PR and between 65acd10 and 204c4aa.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • .changeset/sad-bats-battle.md
  • core/github-env/README.md
  • core/prettier-plugin-handlebars/package.json
  • pnpm-workspace.yaml
  • scripts/README.md
  • scripts/add-socket.ts
  • turbo/generators/templates/common/README.md

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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@core/multipublish/src/index.ts`:
- Around line 32-37: The current guard in index.ts checks pkg.packageJson.name
for a scope and skips publishing based on the npm package name; instead, change
the check to detect JSR-specific configuration/name scope: remove the
pkg.packageJson.name.includes("/") branch and replace it with a guard that
verifies the presence of the JSR config for the package (use the
loader/validator in jsr.ts) and then checks the JSR config's name field for a
scope (e.g., ensure jsrConfig exists and jsrConfig.name.includes("/"));
reference the existing jsr.ts helpers (the functions that parse/validate the JSR
config and the jsrConfig.name usage at lines ~39-49 and ~85) to locate how to
read the JSR config, and only skip when there is no JSR config or the JSR name
is not scoped.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: bda02ee6-2fc8-49b5-b5ec-b2304a639201

📥 Commits

Reviewing files that changed from the base of the PR and between 204c4aa and 5691db7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • core/multipublish/src/index.ts
  • package.json
  • pnpm-workspace.yaml

Comment on lines +32 to +37
if (!pkg.packageJson.name.includes("/")) {
console.warn(
`attempting to publish a non scoped package skipping`,
);
continue;
}
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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

python - <<'PY'
import json, re
from pathlib import Path

skip_dirs = {".git", "node_modules", "dist", "build", ".next", ".turbo"}

def should_skip(path: Path):
    return any(part in skip_dirs for part in path.parts)

def extract_name(path: Path):
    txt = path.read_text(encoding="utf-8", errors="ignore")
    m = re.search(r'"name"\s*:\s*"([^"]+)"', txt)
    return m.group(1) if m else None

for pkg_json in Path(".").rglob("package.json"):
    if should_skip(pkg_json):
        continue
    try:
        pkg = json.loads(pkg_json.read_text(encoding="utf-8"))
    except Exception:
        continue

    npm_name = pkg.get("name")
    if not isinstance(npm_name, str) or "/" in npm_name:
        continue

    pdir = pkg_json.parent
    for cfg_name in ("jsr.json", "deno.json", "jsr.jsonc", "deno.jsonc"):
        cfg = pdir / cfg_name
        if not cfg.exists():
            continue
        jsr_name = extract_name(cfg)
        if jsr_name and "/" in jsr_name:
            print(f"{pdir}\tnpm={npm_name}\tjsr={jsr_name}\tconfig={cfg_name}")
PY

Repository: stephansama/packages

Length of output: 46


🏁 Script executed:

# First, let's examine the index.ts file around lines 32-37
cat -n core/multipublish/src/index.ts | head -50

Repository: stephansama/packages

Length of output: 1655


🏁 Script executed:

# Also examine the jsr.ts file to understand JSR config loading and validation
cat -n core/multipublish/src/jsr.ts

Repository: stephansama/packages

Length of output: 3811


🏁 Script executed:

# Check if there are any JSR/deno config files in the repo
find . -type f \( -name "jsr.json" -o -name "deno.json" -o -name "jsr.jsonc" -o -name "deno.jsonc" \) ! -path "*/node_modules/*" ! -path "*/.git/*" | head -20

Repository: stephansama/packages

Length of output: 46


Guard checks npm package name scope instead of JSR config presence or JSR name scope.

Line 32 validates pkg.packageJson.name (npm package name), but JSR versioning should be gated by JSR config presence or the name field within the JSR config itself (lines 39-49, 85 in jsr.ts). These are independent—a package can have an unscoped npm name but scoped JSR name in jsr.json/deno.json, which would be incorrectly skipped by the current guard. The verification confirms no such packages currently exist in this repository, but the architectural issue remains.

Suggested fix
-import { updateJsrConfigVersion } from "./jsr";
+import { loadConfig as loadJsrConfig, updateJsrConfigVersion } from "./jsr";

 for (const pkg of releasedPackages) {
   if (args.versionJsr) {
-    if (!pkg.packageJson.name.includes("/")) {
+    const { config: jsrConfig } = await loadJsrConfig(pkg.dir);
+    if (!jsrConfig?.name.includes("/")) {
       console.warn(
-        `attempting to publish a non scoped package skipping`,
+        `skipping JSR version update for package "${pkg.packageJson.name}" because JSR name is not scoped`,
       );
       continue;
     }

     await updateJsrConfigVersion(pkg);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/multipublish/src/index.ts` around lines 32 - 37, The current guard in
index.ts checks pkg.packageJson.name for a scope and skips publishing based on
the npm package name; instead, change the check to detect JSR-specific
configuration/name scope: remove the pkg.packageJson.name.includes("/") branch
and replace it with a guard that verifies the presence of the JSR config for the
package (use the loader/validator in jsr.ts) and then checks the JSR config's
name field for a scope (e.g., ensure jsrConfig exists and
jsrConfig.name.includes("/")); reference the existing jsr.ts helpers (the
functions that parse/validate the JSR config and the jsrConfig.name usage at
lines ~39-49 and ~85) to locate how to read the JSR config, and only skip when
there is no JSR config or the JSR name is not scoped.

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.

Caution

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

⚠️ Outside diff range comments (1)
core/multipublish/src/index.test.ts (1)

61-78: ⚠️ Potential issue | 🟡 Minor

Assert exact publish call count to prevent false positives.

The two toHaveBeenCalledWith checks don’t fail on extra publish invocations. Add an exact count assertion for stronger regression protection.

✅ Suggested test hardening
 		expect(mocks.publishPlatform).toHaveBeenCalledWith(
 			expect.objectContaining({
 				packageJson: expect.objectContaining({
 					name: "pkg1",
 					version: "1.0.0",
 				}),
 			}),
 			"npm",
 		);
 		expect(mocks.publishPlatform).toHaveBeenCalledWith(
 			expect.objectContaining({
 				packageJson: expect.objectContaining({
 					name: "@stephansama/pkg2",
 					version: "1.0.0",
 				}),
 			}),
 			"npm",
 		);
+		expect(mocks.publishPlatform).toHaveBeenCalledTimes(2);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/multipublish/src/index.test.ts` around lines 61 - 78, The test currently
uses two expect(mocks.publishPlatform).toHaveBeenCalledWith(...) assertions but
doesn't assert the total number of publish calls; add an exact call count
assertion (e.g., expect(mocks.publishPlatform).toHaveBeenCalledTimes(2)) in the
test in core/multipublish/src/index.test.ts to ensure no extra publishes occur
alongside the two specific toHaveBeenCalledWith checks for publishPlatform and
the packageJson objects.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@core/multipublish/src/index.test.ts`:
- Around line 61-78: The test currently uses two
expect(mocks.publishPlatform).toHaveBeenCalledWith(...) assertions but doesn't
assert the total number of publish calls; add an exact call count assertion
(e.g., expect(mocks.publishPlatform).toHaveBeenCalledTimes(2)) in the test in
core/multipublish/src/index.test.ts to ensure no extra publishes occur alongside
the two specific toHaveBeenCalledWith checks for publishPlatform and the
packageJson objects.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8329ad88-69c8-4120-b8c4-3b2b3a0918a3

📥 Commits

Reviewing files that changed from the base of the PR and between 5691db7 and 3c3d55a.

📒 Files selected for processing (3)
  • .husky/commit-msg
  • .husky/pre-commit
  • core/multipublish/src/index.test.ts

@stephansama stephansama merged commit 8bf5ceb into main Apr 12, 2026
13 checks passed
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