Skip to content

feat: add @joint/cli package#3170

Open
kumilingus wants to merge 16 commits intoclientIO:masterfrom
kumilingus:cli
Open

feat: add @joint/cli package#3170
kumilingus wants to merge 16 commits intoclientIO:masterfrom
kumilingus:cli

Conversation

@kumilingus
Copy link
Contributor

@kumilingus kumilingus commented Feb 6, 2026

Summary

  • Add new @joint/cli package — a zero-dependency CLI tool for JointJS
  • joint list — lists available examples from the joint-demos repository via the GitHub Git Trees API (single API call)
  • joint download <name> [dest] — downloads an example via git sparse checkout
  • Supports --owner and --branch flags for working with forks
  • Supports --force flag to overwrite existing directories
  • Optional GITHUB_TOKEN env var to avoid API rate limiting
  • Includes unit tests (15 tests across github, list, and download modules)

Test plan

  • node packages/joint-cli/dist/cli.js --help shows usage
  • node packages/joint-cli/dist/cli.js --version prints version
  • node packages/joint-cli/dist/cli.js list lists examples
  • node packages/joint-cli/dist/cli.js download <name> downloads an example
  • yarn workspace @joint/cli test — all 15 tests pass
  • yarn workspace @joint/cli lint — no errors

🤖 Generated with Claude Code

kumilingus and others added 7 commits February 6, 2026 17:51
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new @joint/cli workspace package that provides a Node-based CLI for discovering and downloading JointJS demo examples from the clientIO/joint-demos repository.

Changes:

  • Introduces joint CLI entrypoint with list and download commands (GitHub Trees API + git sparse checkout).
  • Adds supporting libs (GitHub API wrapper, git runner, simple ANSI logger) and package scaffolding (TypeScript config, README).
  • Updates lockfile to include the new workspace and its dev dependencies.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
yarn.lock Adds the new workspace entry and resolves new dev dependency ranges.
packages/joint-cli/package.json Defines the new CLI package metadata, bin entry, scripts, and dev dependencies.
packages/joint-cli/tsconfig.json TypeScript build configuration for emitting the CLI into dist/.
packages/joint-cli/src/cli.ts CLI argument parsing, help/version handling, and command dispatch.
packages/joint-cli/src/constants.ts Default repo constants and helpers to build repo/API URLs.
packages/joint-cli/src/commands/list.ts Implements joint list output.
packages/joint-cli/src/commands/download.ts Implements joint download validation, destination resolution, and copy behavior.
packages/joint-cli/src/lib/github.ts Fetches the repository tree via GitHub API and derives available example folders.
packages/joint-cli/src/lib/git.ts Performs sparse checkout and copies downloaded content into the destination.
packages/joint-cli/src/lib/logger.ts Minimal colored logging helpers.
packages/joint-cli/README.md CLI usage and installation documentation.
packages/joint-cli/.gitignore Ignores node_modules/ and build output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

kumilingus and others added 3 commits February 6, 2026 19:49
- Fix cp into existing directory (e.g. `.`) by copying entries individually
- Throw error on 404 instead of returning empty list (bad --owner/--branch)
- Add prepack script to ensure dist/ is built before packing
- Fix success message for `.` destination

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Uses node:test with tsx for TypeScript support. Tests cover:
- GitHub API response parsing, filtering, sorting, error handling
- GITHUB_TOKEN header injection
- Custom --owner/--branch URL construction
- List command output
- Download validation (not found, empty repo, naming logic)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- URL-encode branch name in GitHub API URL for branches with slashes
- Add -- separator before user args in git commands to prevent option injection
- Error on missing --owner/--branch value instead of silently using defaults
- Use console.warn for warn() so stderr isn't mixed into piped stdout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Add dist, lint, lint-fix scripts so root-level yarn commands work
- Extend shared tsconfig.common.json for consistent compiler settings
- Add eslint.config.mjs using @joint/eslint-config
- Add --force flag required to overwrite existing files or non-empty dirs
- Reject download to "." in non-empty directory without --force

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kumilingus kumilingus marked this pull request as draft February 6, 2026 21:05
kumilingus and others added 2 commits February 6, 2026 22:33
…rough logger

Add logger.log() for plain output and replace direct console.log calls in source files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kumilingus kumilingus marked this pull request as ready for review February 6, 2026 22:13
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