Skip to content

feat(cli): add asyar pack to build an installable .asyar locally - #989

Merged
Xoshbin merged 3 commits into
mainfrom
feat/asyar-pack
Nov 3, 2026
Merged

Xoshbin merged 3 commits into
mainfrom
feat/asyar-pack

Conversation

@Xoshbin

@Xoshbin Xoshbin commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Builds the same package asyar publish uploads and saves it as -.asyar (or --out), with no Store sign-in, GitHub or release needed. pack and publish share one set of validate/build/icon/README steps, so they can't package differently. Install the file via Settings → Extensions → Install from file; unlink the extension first, because a linked extension is loaded from the project folder.

Summary by CodeRabbit

  • New Features

    • Added asyar pack to create a local, installable .asyar package without signing in or publishing. Packages are saved in the extension folder by default; use --out to choose another path.
    • The command checks and prepares the extension, reports the package location and size, and warns if the extension is linked or the package is not ignored by Git.
  • Documentation

    • Added instructions for installing and testing a packaged extension, including unlinking it first so Asyar loads the installed package rather than the project copy.
    • Clarified that asyar publish --dry-run runs checks but does not create a local installable package.

Builds the same package asyar publish uploads and saves it as <id>-<version>.asyar (or --out), with no Store sign-in, GitHub or release needed. pack and publish share one set of validate/build/icon/README steps, so they can't package differently. Install the file via Settings → Extensions → Install from file; unlink the extension first, because a linked extension is loaded from the project folder.
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The CLI adds asyar pack to create a local .asyar package without publishing. Shared packaging preparation and README handling are used by both asyar pack and asyar publish. Documentation describes package output and how to install and test it.

Changes: Local package creation

Layer / File(s) Summary
Shared packaging preparation
asyar-sdk/cli/lib/packaging.ts, asyar-sdk/cli/lib/publishGitGuard.ts, asyar-sdk/cli/commands/publish.ts
Shared helpers validate manifests, build non-theme extensions, check output freshness and icons, and load packaged README content. publish uses these helpers and removes its temporary ZIP in a finally block. Origin repository parsing is exposed through readOriginRepo.
Pack command and output handling
asyar-sdk/cli/commands/pack.ts, asyar-sdk/cli/index.ts, asyar-sdk/cli/lib/extensionRepo.ts, asyar-sdk/cli/lib/zip.ts, asyar-sdk/cli/commands/pack.test.ts, asyar-sdk/cli/lib/zip.test.ts
The CLI registers asyar pack with --out path handling. The command creates the package and reports linked-extension or unignored-file warnings. ZIP filenames include a UUID, and generated .gitignore files exclude *.asyar. Tests cover packaging, output paths, cleanup, README links, and warnings.
Package testing guidance
asyar-sdk/README.md, docs/reference/cli.md, docs/guide/faq.md, docs/how-to/debugging.md, docs/reference/troubleshooting.md
Documentation describes local package creation, output options, and file installation. It explains that linked extensions must be unlinked before testing the installed package.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Developer
  participant AsyarCLI
  participant PackCommand
  participant PackagingHelpers
  participant LocalFilesystem
  Developer->>AsyarCLI: Run asyar pack
  AsyarCLI->>PackCommand: Execute registered command
  PackCommand->>PackagingHelpers: Prepare extension and read packaged README
  PackagingHelpers->>LocalFilesystem: Read manifest, build output, and README
  PackCommand->>LocalFilesystem: Copy package to selected destination
Loading

Possibly related PRs

  • Xoshbin/asyar#964: Changes extension icon resolution and README handling used in the packaging flow.
  • Xoshbin/asyar#956: Adds README and icon handling to publish and packageExtension, which this PR shares for local packages.
  • Xoshbin/asyar#988: Changes the install-from-file flow used to install packages created by asyar pack.

Suggested labels: javascript

Merge Risk: Minimal · up to 1c4ce

No merge-blocking issue was confirmed; the change is ready for normal checks.

Security architecture risk: Low · up to 1c4ce

Local packages use the same validation and archive preparation as published packages, without acquiring publishing credentials or automatically installing extensions. No introduced security issue was substantiated. End-to-end installation enforcement was outside this review.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The new command's direct authority is bounded by the invoking user's access to the project, temporary directory, and selected output path. It also executes the existing project build with host-process privileges, so local packaging is not a sandbox for untrusted projects. Archive creation itself does not install an extension or grant runtime permissions.

Trust Boundaries and Controls

  • observed — Remote publication still requires Store authentication and a separately acquired GitHub token. Pack does not call those authorization or publication paths. Sharing preparation therefore does not remove the credentials required to reach release, upload, or Store-submission sinks.
  • observed — Manifest-driven filenames follow validation of the extension ID against a dot-notation pattern and the version against semver. Explicit output files must end in .asyar; arbitrary output directories remain a deliberate caller-controlled capability rather than a project-containment guarantee.

Resilience and Maintainability Implications

  • observed — Publication recovery remains based on release lookup and existing asset state: an existing ZIP supplies the download URL and checksum, while a release missing its asset receives an upload. UUIDs affect only temporary filenames; uploaded asset names remain identity-and-version based. The cleanup refactor does not roll back or otherwise change remote release state.
Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding the asyar pack CLI command to build a local installable .asyar package.
Docstring Coverage Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 10 functions across 9 files.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d2d9e0ee-5c95-42ba-a557-f308e1fa1892
Commits

Reviewing files that changed from the base of the PR and between a60e377 and 1c4cedf.

Files selected for processing: 2
  • asyar-sdk/cli/commands/pack.test.ts
  • asyar-sdk/cli/commands/publish.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread asyar-sdk/cli/commands/pack.ts Resolved
- append random UUID to temporary packaging zip to prevent collision during concurrent runs
- ensure temporary zip is deleted in finally block if output directory creation or copy fails

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread asyar-sdk/cli/commands/pack.test.ts Resolved
Comment thread asyar-sdk/cli/lib/zip.ts Resolved
@Xoshbin
Xoshbin merged commit 519c304 into main Nov 3, 2026
10 of 11 checks passed
@Xoshbin
Xoshbin deleted the feat/asyar-pack branch November 3, 2026 18:09
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