@carlosstenzel/opencode-git-sidebar 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,120 @@
1
+ # @carlosstenzel/opencode-git-sidebar
2
+
3
+ [English](README.md) · [Português (Brasil)](README-pt-br.md)
4
+
5
+ [npm](https://www.npmjs.com/package/@carlosstenzel/opencode-git-sidebar)
6
+
7
+ Plugin de GUI para o **OpenCode Desktop (Electron)** que adiciona um painel **Git/PR** na região lateral — a mesma região do painel do navegador.
8
+
9
+ > Não confundir com o OpenCode Rune: o Rune usa plugins Luau e não carrega a API `gui-experimental` deste pacote.
10
+
11
+ ## O que faz
12
+
13
+ - Painel lateral com cabeçalho estilo GitLens: repositório, badge da branch, chips de alterações/ahead/behind/upstream e botão de refresh.
14
+ - Abas **Branches / Commits / PRs / Issues / Arquivos**:
15
+ - Branches: filtro, branch atual, ahead/behind, último commit, checkout, criar, mesclar e excluir (checkout com árvore suja e ações destrutivas pedem confirmação).
16
+ - Commits: hash curto, assunto, autor, tempo relativo e arquivos alterados (expanda a linha para ver a lista).
17
+ - PRs: lista aberta com ícone de status de checks e abertura no navegador.
18
+ - Issues: issues abertas com número, título, autor, labels, contador de comentários e abertura no navegador.
19
+ - Arquivos: alterações agrupadas por tipo (Conflitos, Modificados, Adicionados, Removidos, Não rastreados) com contadores, badge de status colorido, nome em destaque + diretório atenuado e estatística `+/-` por arquivo, grupo e total. Seleção por arquivo, por grupo, `Selecionar todos` / `Limpar`, e barra fixa com o contador de selecionados e **Commit selecionados** (faz o commit somente dos paths marcados com `git commit --only`, preservando o que já estava staged em outros arquivos).
20
+ - Diff: clique no arquivo (ou no ícone de olho) para abrir o visualizador com linhas numeradas, gutter `+`/`-`, destaque do trecho alterado dentro da linha, quebra de linha opcional, copiar diff, `Incluir no commit` e navegação anterior/próximo (`K`/`J`) entre os arquivos selecionados — ou entre todos, quando o arquivo aberto não faz parte de uma seleção múltipla.
21
+ - Barra de ações: refresh, push, pull, commit-all (com confirmação e mensagem) e novo PR.
22
+ - Entrada no menu `+` da região lateral e botão na barra de abas do painel.
23
+ - Linha com a branch no menu do projeto.
24
+ - Pílula acima do composer com PRs abertos do diretório da sessão.
25
+ - Comandos na paleta: `Git: open panel`, `Git: push branch`, `Git: pull`, `Git: create pull request`, `Git: commit all changes`, `Git: commit selected files`.
26
+ - RPC no servidor do plugin usando `git` e `gh`.
27
+
28
+ ## Prévia
29
+
30
+ Imagens ilustrativas com dados fictícios (nenhum projeto, branch ou autor real):
31
+
32
+ ![Visão geral do painel Git](docs/images/git-sidebar-overview.svg)
33
+
34
+ ![Aba Arquivos com seleção e estatísticas](docs/images/git-sidebar-files.svg)
35
+
36
+ ![Visualizador de diff](docs/images/git-sidebar-diff.svg)
37
+
38
+ ## Requisitos
39
+
40
+ - OpenCode Desktop baseado em Electron com suporte a `@opencode/plugin/gui`.
41
+ - `git` no PATH.
42
+ - `gh` (GitHub CLI) no PATH e autenticado com `gh auth login` para listar/criar PRs.
43
+
44
+ ## Instalação
45
+
46
+ Instale pelo npm:
47
+
48
+ ```sh
49
+ opencode plugin add @carlosstenzel/opencode-git-sidebar
50
+ ```
51
+
52
+ Ou direto do GitHub (npm não é obrigatório):
53
+
54
+ ```sh
55
+ opencode plugin add github:carlosstenzel/opencode-git-sidebar
56
+ ```
57
+
58
+ O config é recarregado automaticamente. Para conferir:
59
+
60
+ ```sh
61
+ opencode plugin list
62
+ opencode plugin check
63
+ ```
64
+
65
+ Ou adicione manualmente em `~/.config/opencode/opencode.json`:
66
+
67
+ ```json
68
+ {
69
+ "plugins": ["@carlosstenzel/opencode-git-sidebar"]
70
+ }
71
+ ```
72
+
73
+ A parte GUI é o export `./gui-experimental`; o bundle `dist/gui-experimental.cjs` é gerado no `prepack`.
74
+
75
+ ## Desenvolvimento
76
+
77
+ ```sh
78
+ npm install
79
+ npm run build
80
+ npm run typecheck
81
+ npm test
82
+ ```
83
+
84
+ Rebuild automático:
85
+
86
+ ```sh
87
+ npm run dev
88
+ ```
89
+
90
+ O OpenCode recarrega a GUI após o build. Também é possível usar **Settings → Extensions → Plugins** para desligar a GUI sem remover o plugin.
91
+
92
+ ## CI e release
93
+
94
+ O CI (`.github/workflows/ci.yml`) roda em todo pull request e em todo push para `main`: typecheck, testes, build e `scripts/verify-package.mjs`. Um push normal nunca publica nada.
95
+
96
+ A publicação acontece apenas quando uma tag é enviada e o `.github/workflows/release.yml` roda. A tag precisa ser exatamente `v` mais a `version` do `package.json` (por exemplo `v0.1.2`), e o commit marcado precisa já estar na `main`:
97
+
98
+ ```sh
99
+ npm version patch # ou minor / major
100
+ git push --follow-tags
101
+ ```
102
+
103
+ Configure o secret `NPM_TOKEN` (um token de automação do npm) no GitHub. Ele é passado apenas para o passo de `npm publish`, que publica com provenance (`npm publish --provenance --access public`) e depois cria o GitHub Release.
104
+
105
+ O release executa `node scripts/verify-release.mjs` antes de publicar. Ele falha de forma segura se a tag não corresponder à `version`, se o commit marcado não estiver na `main` ou se a versão já existir no npm — aumente a versão em vez de reutilizar uma tag. Se o npm publicar mas o passo do GitHub Release falhar, crie o release manualmente com `gh release create` (ou atualize um existente com `gh release edit`); rodar o workflow de novo não republica a versão existente.
106
+
107
+ O `prepack` continua rodando `typecheck` e `build` antes de empacotar.
108
+
109
+ ## Notas
110
+
111
+ - A API de GUI do OpenCode Desktop é experimental (`gui-experimental`).
112
+ - Nenhuma ação de push, pull, commit, merge, delete ou PR é executada automaticamente; tudo é explícito e as ações destrutivas pedem confirmação.
113
+ - `commit all` adiciona todas as alterações (`git add -A`) antes de commitar.
114
+ - `commit selected` faz o commit somente dos paths marcados (e renames detectados) com `git commit --only`; o que já estava staged em outros arquivos é preservado — não é `git commit -a`.
115
+ - Excluir branch usa `git branch -d` (exclusão segura; branches não mescladas são recusadas pelo git).
116
+ - O plugin não mexe na configuração do navegador.
117
+
118
+ ## Licença
119
+
120
+ MIT — veja `LICENSE`.
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  [English](README.md) · [Português (Brasil)](README-pt-br.md)
4
4
 
5
+ [npm](https://www.npmjs.com/package/@carlosstenzel/opencode-git-sidebar)
6
+
5
7
  A GUI plugin for **OpenCode Desktop (Electron)** that adds a **Git/PR** panel to the side region — the same region used by the browser panel.
6
8
 
7
9
  > Not to be confused with OpenCode Rune: Rune uses Luau plugins and does not load this package's `gui-experimental` API.
@@ -9,11 +11,12 @@ A GUI plugin for **OpenCode Desktop (Electron)** that adds a **Git/PR** panel to
9
11
  ## Features
10
12
 
11
13
  - Side panel with a GitLens-style header: repository, branch badge, changes/ahead/behind/upstream chips, and a refresh button.
12
- - Tabs **Branches / Commits / PRs / Files**:
14
+ - Tabs **Branches / Commits / PRs / Issues / Files**:
13
15
  - Branches: filter, current branch, ahead/behind, latest commit, checkout, create, merge and delete (checkout with a dirty tree and destructive actions ask for confirmation).
14
16
  - Commits: short hash, subject, author, relative time and changed files (expand a row to see the list).
15
17
  - PRs: open pull requests with check-status icons and browser opening.
16
- - Files: changes grouped by type (Conflicts, Modified, Added, Removed, Untracked) with counters, colored status badges, prominent filename + muted directory, and `+/-` stats per file, group and total. Select individual files, a whole group, `Select all` / `Clear`, plus a sticky bar with the selected count and **Commit selected** (runs `git add` only for the checked files).
18
+ - Issues: open issues with number, title, author, labels, comment count and browser opening.
19
+ - Files: changes grouped by type (Conflicts, Modified, Added, Removed, Untracked) with counters, colored status badges, prominent filename + muted directory, and `+/-` stats per file, group and total. Select individual files, a whole group, `Select all` / `Clear`, plus a sticky bar with the selected count and **Commit selected** (commits only the checked paths with `git commit --only`, leaving anything else already staged untouched).
17
20
  - Diff: click a file (or the eye icon) to open the viewer with numbered lines, `+`/`-` gutters, inline highlight of the changed fragment, optional line wrapping, copy diff, `Include in commit`, and previous/next navigation (`K`/`J`) across selected files — or across all files when the open file is not part of a multi-selection.
18
21
  - Action bar: refresh, push, pull, commit-all (with message and confirmation) and new PR.
19
22
  - Entry in the side region's `+` menu and a button in the panel tab strip.
@@ -75,6 +78,7 @@ The GUI part is the `./gui-experimental` export; the `dist/gui-experimental.cjs`
75
78
  npm install
76
79
  npm run build
77
80
  npm run typecheck
81
+ npm test
78
82
  ```
79
83
 
80
84
  Watch rebuild:
@@ -85,19 +89,29 @@ npm run dev
85
89
 
86
90
  OpenCode reloads the GUI after the build. You can also use **Settings → Extensions → Plugins** to turn the GUI off without removing the plugin.
87
91
 
88
- ## Publishing
92
+ ## CI and releases
93
+
94
+ CI (`.github/workflows/ci.yml`) runs on every pull request and on every push to `main`: typecheck, tests, build and `scripts/verify-package.mjs`. A normal push never publishes anything.
95
+
96
+ Publishing happens only when a tag is pushed and `.github/workflows/release.yml` runs. The tag must be exactly `v` plus the `version` in `package.json` (for example `v0.1.2`), and the tagged commit must already be on `main`:
89
97
 
90
98
  ```sh
91
- npm publish --access public
99
+ npm version patch # or minor / major
100
+ git push --follow-tags
92
101
  ```
93
102
 
94
- `prepack` runs `typecheck` and `build` before packaging.
103
+ Configure the repository secret `NPM_TOKEN` (an npm automation token) in GitHub. It is passed only to the `npm publish` step, which publishes with provenance (`npm publish --provenance --access public`) and then creates the GitHub Release.
104
+
105
+ The release runs `node scripts/verify-release.mjs` before publishing. It fails closed if the tag does not match the `version`, if the tagged commit is not on `main`, or if the version already exists on npm — bump the version instead of reusing a tag. If npm publishes but the GitHub Release step fails, create the release manually with `gh release create` (or update an existing one with `gh release edit`); running the workflow again will not republish the existing version.
106
+
107
+ `prepack` still runs `typecheck` and `build` before packaging.
95
108
 
96
109
  ## Notes
97
110
 
98
111
  - The OpenCode Desktop GUI API is experimental (`gui-experimental`).
99
112
  - No push, pull, commit, merge, delete or PR action runs automatically; everything is explicit and destructive actions ask for confirmation.
100
113
  - `commit all` stages every change (`git add -A`) before committing.
114
+ - `commit selected` commits only the checked paths (and detected renames) with `git commit --only`; other staged changes are preserved and it is not `git commit -a`.
101
115
  - Deleting a branch uses `git branch -d` (safe delete; unmerged branches are refused by git).
102
116
  - The plugin does not touch the browser configuration.
103
117