소스 정보
- 저장소
- gitkraken/vscode-gitlens
- 최근 소스 활동
- 2026년 9월 9일 01:41
- 감지된 SKILL.md 언어
- 영어
- 스타
- 9,928
- 포크
- 1,801
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
SKILL.md 표시 중
SKILL.md
소스 지침 · 읽기 전용 미리보기- name
- add-command
- description
- Create new VS Code commands with all required boilerplate
# /add-command - Create New Command
Scaffold a new VS Code command with all required boilerplate.
## Usage
```
/add-command [name]
```
## Information Needed
1. **Command ID** — e.g., `myNewFeature` (becomes `gitlens.myNewFeature`)
2. **Label** — Display name in command palette
3. **Base class**:
- `GlCommandBase` — No editor required (opening panels, showing pickers)
- `ActiveEditorCommand` — Requires active editor
- `ActiveEditorCachedCommand` — Like ActiveEditorCommand with "repeat last command" support
4. **Variants** (optional): `:views`, `:graph`, `:scm` suffixes for context menus
## Files to Create/Modify
### 1. Command File: `src/commands/{commandName}.ts`
```typescript
import type { TextEditor, Uri } from 'vscode';
import type { Container } from '../container.js';
import { command } from '../system/-webview/command.js';
import { {BaseClass} } from './commandBase.js';
export interface {CommandName}CommandArgs {
// Define args if needed
}
@command()
export class {CommandName}Command extends {BaseClass} {
constructor(private readonly container: Container) {
super([
'gitlens.{commandId}',
// Add variants here
]);
}
async execute(editor?: TextEditor, uri?: Uri, args?: {CommandName}CommandArgs): Promise<void> {
// TODO: Implement
}
}
```
### 2. Import in `src/commands.ts`
```typescript
import './commands/{commandName}.js';
```
### 3. Add to `contributions.json`
Under `"commands"` key:
```json
"gitlens.{commandId}": {
"label": "{Label}",
"category": "GitLens",
"commandPalette": "gitlens:enabled"
}
```
For `:views` variant:
```json
"gitlens.{commandId}:views": {
"label": "{Label}",
"icon": "$(icon-name)",
"menus": {
"view/item/context": [{
"when": "viewItem =~ /gitlens:/ && gitlens:enabled",
"group": "1_gitlens"
}]
}
}
```
### 4. Run Generation
```bash
pnpm run generate:contributions && pnpm run generate:commandTypes
```
## Common `when` Clauses
- `gitlens:enabled` — Extension is enabled
- `!gitlens:readonly` — Not in readonly mode
- `!gitlens:untrusted` — Workspace is trusted
- `gitlens:plus` — Pro features available
- `viewItem =~ /gitlens:commit/` — On a commit node
- `viewItem =~ /gitlens:branch/` — On a branch node
## Localization
Every user-facing string in the new code (titles, notifications, quick pick items, placeholders, webview text, ARIA labels) must be a literal `l10n.t()` message — `{ l10n }` from `vscode` in host code, `* as l10n` from `@vscode/l10n` in webviews and packages. Run `pnpm run generate:l10n` afterward so the catalog check passes. Manifest text (command titles, view names) goes through `contributions.json` → `package.nls.json` as before. See `docs/localization.md`.
GitHub에서 보기