Skip to content

fix(cosh): add installation of extension examples and update package …#271

Merged
samchu-zsl merged 1 commit intoalibaba:mainfrom
kongche-jbw:fix/cosh/extension-new-command-missing-examples
Apr 22, 2026
Merged

fix(cosh): add installation of extension examples and update package …#271
samchu-zsl merged 1 commit intoalibaba:mainfrom
kongche-jbw:fix/cosh/extension-new-command-missing-examples

Conversation

@kongche-jbw
Copy link
Copy Markdown
Collaborator

Description

The co extensions new command fails when the CLI is bundled (RPM installation) because the examples directory containing boilerplate templates is not included in the build output.

After bundling, import.meta.url in new.ts resolves to the directory of cli.js (e.g. /usr/lib/copilot-shell/), so join(__dirname, 'examples') points to a non-existent path. This fix ensures examples are copied into dist/examples/ during build and installed alongside the CLI.

Changes:

  • esbuild.config.js: Copy packages/cli/src/commands/extensions/examples/ to dist/examples/ after bundling
  • Makefile: Install dist/examples/ to $(LIBDIR)/examples/ during make install
  • prepare-package.js: Add examples to the npm publish files list

Related Issue

fixes #259

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Scope

  • cosh (copilot-shell)

Checklist

  • I have read the Contributing Guide
  • My code follows the project's code style
  • For cosh: Lint passes, type check passes, and tests pass

Testing

  1. Run npm run bundle in src/copilot-shell/ and verify dist/examples/ is created with all 5 template directories (agent, commands, context, mcp-server, skills)
  2. Run co extensions new test mcp-server and verify the template is successfully created
  3. Run make install DESTDIR=/tmp/test-install PREFIX=/usr and verify examples are installed to /tmp/test-install/usr/lib/copilot-shell/examples/

Additional Notes

No changes to new.ts — the existing path resolution join(__dirname, 'examples') works correctly once examples are placed alongside cli.js.

@kongche-jbw kongche-jbw requested a review from samchu-zsl as a code owner April 21, 2026 09:43
@gemini-code-assist
Copy link
Copy Markdown

Important

Installation incomplete: to start using Gemini Code Assist, please ask the organization owner(s) to visit the Gemini Code Assist Admin Console and sign the Terms of Services.

@kongche-jbw kongche-jbw self-assigned this Apr 21, 2026
@kongche-jbw kongche-jbw added type:bug Something isn't working component:cosh src/copilot-shell/ labels Apr 21, 2026
Copy link
Copy Markdown
Collaborator

@samchu-zsl samchu-zsl left a comment

Choose a reason for hiding this comment

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

LGTM, thx!

@samchu-zsl samchu-zsl merged commit 3274b73 into alibaba:main Apr 22, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:cosh src/copilot-shell/ type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[cosh]bug: co extension new command fail

2 participants