github / github/copilot-sdk

Support autocomplete/ghost text for extension slash command arguments

Đang mở
#1,219 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Java
Star
10.5k
Fork
1.5k
Merge trung bình
1 ngày 14 giờ
Pull request đã merge (30 ngày)
129

Mô tả

## Summary

Please add an SDK/API surface that lets Copilot CLI extensions provide autocomplete, ghost text, or structured argument suggestions for extension slash commands.

## Scenario

I am building a Copilot CLI extension that registers a deterministic `/cost` command via `joinSession({ commands: [...] })`. The command has useful subcommands/options such as:

```text
/cost
/cost help
/cost panel on|off|refresh
/cost session
/cost live-session
/cost --plan pro|pro-plus|business|enterprise
/cost --billing-model usage-based|premium-requests
/cost --currency USD
```

Built-in slash commands appear to show ghost text / inline hints for supported arguments as the user types. For extension commands, I only see the command name/description; after typing `/cost` there does not appear to be a way to suggest supported subcommands/options.

## Current SDK surface

The generated/types docs I found for `CommandDefinition` only expose:

```ts
export interface CommandDefinition {
name: string;
description?: string;
handler: CommandHandler;
}
```

That is enough to register `/cost`, but not enough to provide argument completions, examples, or dynamic suggestions.

## Requested capability

It would be useful if extension commands could declare one or more of the following:

- static usage text/examples for ghost text after the command name
- structured subcommands/options/enum values
- dynamic completion callback based on the current argument prefix and session context
- optional descriptions for each subcommand/option

For example, something like:

```ts
commands: [
{
name: 'cost',
description: 'Show Copilot session cost.',
usage: 'panel on|off|refresh | session | --plan ',
completions: async ({ args, cursor, sessionId }) => [
{ value: 'panel', description: 'Open or manage the cost panel' },
{ value: 'session', description: 'Show cost for a completed session' },
{ value: '--plan', description: 'Compare against a subscription plan' }
],
handler
}
]
```

## Why this matters

Extension slash commands can be deterministic command surfaces rather than model-routed prompts. Without argument hints, users have to remember command syntax or run a separate help command. Built-in-command-quality discoverability would make SDK extensions feel native and easier to learn.

## Workaround today

The extension can implement `/cost help`, but that is less discoverable and does not help while typing.

## Environment

Observed with Copilot CLI / SDK builds around `1.0.41-0` / `1.0.43` on Windows while authoring a project-scoped extension under `.github/extensions//extension.mjs`.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với tài liệu generated/types cho CommandDefinition và phần đăng ký extension được thể hiện qua joinSession({ commands: [...] }). Theo dõi cách các lệnh extension theo phạm vi dự án được xử lý trong Copilot CLI. Done cần cung cấp một bề mặt SDK được tài liệu hóa cho việc sử dụng tĩnh hoặc các đề xuất có cấu trúc, cũng như hoàn thành đối số động, với mô tả khi được hỗ trợ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, typescript
Lĩnh vực
api, cli, developer-experience
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.