Skip to content

feat(cli): add sync command#24

Open
natemoo-re wants to merge 5 commits intomainfrom
feat/sync-skills
Open

feat(cli): add sync command#24
natemoo-re wants to merge 5 commits intomainfrom
feat/sync-skills

Conversation

@natemoo-re
Copy link
Copy Markdown
Member

removes @tanstack/intent, add explicit bsh sync command to copy package skills to user's skills

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 4, 2026

⚠️ No Changeset found

Latest commit: e92545a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 4, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@bomb.sh/tools@24

commit: e92545a

Comment thread src/commands/sync.ts
Comment on lines +179 to +199
async function isSelf(root: URL): Promise<boolean> {
const pkgPath = new URL("package.json", root);
if (!(await exists(pkgPath))) return false;
const content = await readFile(pkgPath, "utf8");
const pkg = JSON.parse(content) as { name?: string };
return pkg.name === "@bomb.sh/tools";
}

async function exists(url: URL): Promise<boolean> {
try {
await readdir(url);
return true;
} catch {
try {
await readFile(url);
return true;
} catch {
return false;
}
}
}
Copy link
Copy Markdown
Contributor

@gameroman gameroman Apr 30, 2026

Choose a reason for hiding this comment

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

This might cause a race condition and it feels inefficient, exists calls readdir and readFile, for then to do readFile again

Something like this is probably better

async function isSelf(root: URL): Promise<boolean> {
  const content = await safeRead(new URL("package.json", root));
  if (!content) return false;
  const pkg = JSON.parse(content) as { name?: string };
  return pkg.name === "@bomb.sh/tools";
}

async function read(url: URL): Promise<string | null> {
  try {
    return await readFile(url, "utf8");
  } catch (err) {
    if (err.code === "ENOENT") return null;
    throw err;
  }
}

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.

2 participants