@kisev/skills-opencode 1.2.0 → 2.0.0

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.
Files changed (153) hide show
  1. package/README.md +134 -112
  2. package/README.ru.md +242 -0
  3. package/dist/agent-profiles.d.ts +1 -1
  4. package/dist/agent-profiles.js +18 -9
  5. package/dist/assets/agents/architect.md +67 -0
  6. package/{assets → dist/assets}/agents/critic.md +17 -2
  7. package/dist/assets/agents/manager.md +36 -0
  8. package/{assets → dist/assets}/agents/mapper.md +2 -2
  9. package/dist/assets/agents/review.md +25 -0
  10. package/{assets → dist/assets}/agents/worker.md +7 -5
  11. package/dist/assets/commands/agent-profiles.md +9 -0
  12. package/dist/assets/commands/agents-md.md +10 -0
  13. package/dist/assets/commands/askme.md +10 -0
  14. package/dist/assets/commands/ast-grep.md +10 -0
  15. package/dist/assets/commands/capabilities.md +9 -0
  16. package/dist/assets/commands/code-explain.md +10 -0
  17. package/dist/assets/commands/code-review.md +10 -0
  18. package/dist/assets/commands/commit-msg.md +10 -0
  19. package/dist/assets/commands/docs-prepare.md +10 -0
  20. package/dist/assets/commands/docs-review.md +10 -0
  21. package/dist/assets/commands/doctor.md +9 -0
  22. package/dist/assets/commands/doit.md +10 -0
  23. package/dist/assets/commands/goal.md +10 -0
  24. package/dist/assets/commands/humanize.md +10 -0
  25. package/dist/assets/commands/lsp-report.md +10 -0
  26. package/dist/assets/commands/mattermost.md +10 -0
  27. package/dist/assets/commands/mr-prepare.md +10 -0
  28. package/dist/assets/commands/reconcile.md +9 -0
  29. package/dist/assets/commands/release-prepare.md +10 -0
  30. package/dist/assets/commands/release-review.md +10 -0
  31. package/dist/assets/commands/rtk.md +10 -0
  32. package/dist/assets/commands/skill-improve.md +10 -0
  33. package/dist/assets/commands/slides-prompts-prepare.md +10 -0
  34. package/dist/assets/commands/spec-manage.md +10 -0
  35. package/dist/assets/commands/stopit.md +10 -0
  36. package/dist/assets/commands/summary.md +10 -0
  37. package/dist/assets/commands/task-prepare.md +10 -0
  38. package/dist/assets/commands/task-review.md +10 -0
  39. package/dist/assets/commands/task-triage.md +10 -0
  40. package/dist/assets/commands/team-retro.md +10 -0
  41. package/dist/assets/commands/team-roadmap.md +10 -0
  42. package/dist/assets/commands/team-sprint-close.md +10 -0
  43. package/dist/assets/commands/team-sprint-start.md +10 -0
  44. package/dist/assets/lsp-catalog.json +30 -0
  45. package/dist/assets/migration-inventory.json +294 -0
  46. package/dist/catalog.d.ts +8 -0
  47. package/dist/catalog.js +38 -0
  48. package/dist/cli-output.d.ts +7 -0
  49. package/dist/cli-output.js +68 -1
  50. package/dist/cli.js +136 -10
  51. package/dist/contracts.d.ts +52 -0
  52. package/dist/contracts.js +98 -0
  53. package/dist/doctor.d.ts +44 -0
  54. package/dist/doctor.js +595 -0
  55. package/dist/generate-assets.js +17 -2
  56. package/dist/index.d.ts +80 -56
  57. package/dist/index.js +162 -37
  58. package/dist/installer.d.ts +33 -5
  59. package/dist/installer.js +252 -28
  60. package/dist/lifecycle.d.ts +3 -0
  61. package/dist/lifecycle.js +49 -17
  62. package/dist/plugins/rtk.js +4 -1
  63. package/dist/reconcile.d.ts +43 -0
  64. package/dist/reconcile.js +507 -0
  65. package/dist/registry.d.ts +7 -4
  66. package/dist/registry.js +28 -88
  67. package/dist/routing.d.ts +39 -2
  68. package/dist/routing.js +339 -27
  69. package/dist/runtime/worktree.d.ts +33 -0
  70. package/dist/runtime/worktree.js +220 -0
  71. package/package.json +10 -26
  72. package/assets/agents/architect.md +0 -33
  73. package/assets/agents/manager.md +0 -82
  74. package/assets/agents/review.md +0 -25
  75. package/assets/commands/agent-list.md +0 -9
  76. package/assets/commands/agent-model-set.md +0 -9
  77. package/assets/commands/askme.md +0 -10
  78. package/assets/commands/ast-grep-rewrite.md +0 -10
  79. package/assets/commands/ast-grep-search.md +0 -10
  80. package/assets/commands/attempt-cancel.md +0 -10
  81. package/assets/commands/attempt-list.md +0 -10
  82. package/assets/commands/attempt-result.md +0 -10
  83. package/assets/commands/attempt-show.md +0 -10
  84. package/assets/commands/capabilities.md +0 -9
  85. package/assets/commands/code-review.md +0 -10
  86. package/assets/commands/commit-msg.md +0 -10
  87. package/assets/commands/critic-add.md +0 -9
  88. package/assets/commands/critic-remove.md +0 -9
  89. package/assets/commands/docs-prepare.md +0 -10
  90. package/assets/commands/docs-review.md +0 -10
  91. package/assets/commands/doctor.md +0 -9
  92. package/assets/commands/doit.md +0 -10
  93. package/assets/commands/goal-list.md +0 -10
  94. package/assets/commands/goal-pause.md +0 -10
  95. package/assets/commands/goal-prepare.md +0 -10
  96. package/assets/commands/goal-remove.md +0 -10
  97. package/assets/commands/goal-show.md +0 -10
  98. package/assets/commands/goal-start.md +0 -10
  99. package/assets/commands/lsp-report.md +0 -10
  100. package/assets/commands/mattermost.md +0 -10
  101. package/assets/commands/mr-prepare.md +0 -10
  102. package/assets/commands/mr-review.md +0 -10
  103. package/assets/commands/multi-run-cancel.md +0 -10
  104. package/assets/commands/multi-run-compare.md +0 -10
  105. package/assets/commands/multi-run-fusion.md +0 -10
  106. package/assets/commands/multi-run-start.md +0 -10
  107. package/assets/commands/multi-run-status.md +0 -10
  108. package/assets/commands/overview.md +0 -10
  109. package/assets/commands/release-prepare.md +0 -10
  110. package/assets/commands/release-review.md +0 -10
  111. package/assets/commands/route.md +0 -9
  112. package/assets/commands/schedule-add.md +0 -10
  113. package/assets/commands/schedule-disable.md +0 -10
  114. package/assets/commands/schedule-enable.md +0 -10
  115. package/assets/commands/schedule-list.md +0 -10
  116. package/assets/commands/schedule-remove.md +0 -10
  117. package/assets/commands/schedule-status.md +0 -10
  118. package/assets/commands/skill-improver.md +0 -10
  119. package/assets/commands/spec-audit.md +0 -10
  120. package/assets/commands/spec-init.md +0 -10
  121. package/assets/commands/spec-onboard.md +0 -10
  122. package/assets/commands/spec-update.md +0 -10
  123. package/assets/commands/stopit.md +0 -10
  124. package/assets/commands/summary.md +0 -10
  125. package/assets/commands/task-prepare-batch.md +0 -10
  126. package/assets/commands/task-prepare.md +0 -10
  127. package/assets/commands/task-review.md +0 -10
  128. package/assets/commands/task-triage.md +0 -10
  129. package/assets/commands/team-planning.md +0 -10
  130. package/assets/commands/team-retro.md +0 -10
  131. package/assets/commands/team-roadmap.md +0 -10
  132. package/assets/commands/team-slides-prompts.md +0 -10
  133. package/assets/commands/team-sprint-close.md +0 -10
  134. package/assets/commands/team-sprint-status.md +0 -10
  135. package/assets/commands/walkthrough.md +0 -10
  136. package/assets/plugins/autonomy-policy.js +0 -3
  137. package/assets/plugins/background-attempts.js +0 -3
  138. package/assets/plugins/goal-loop.js +0 -3
  139. package/assets/plugins/schedule.js +0 -3
  140. package/assets/plugins/zed-clickable-paths.js +0 -3
  141. package/dist/plugins/autonomy-policy.d.ts +0 -21
  142. package/dist/plugins/autonomy-policy.js +0 -71
  143. package/dist/plugins/background-attempts.d.ts +0 -76
  144. package/dist/plugins/background-attempts.js +0 -124
  145. package/dist/plugins/goal-loop.d.ts +0 -62
  146. package/dist/plugins/goal-loop.js +0 -99
  147. package/dist/plugins/schedule.d.ts +0 -36
  148. package/dist/plugins/schedule.js +0 -100
  149. package/dist/plugins/zed-clickable-paths.d.ts +0 -11
  150. package/dist/plugins/zed-clickable-paths.js +0 -10
  151. /package/{assets → dist/assets}/plugins/rtk.js +0 -0
  152. /package/{assets → dist/assets}/plugins/rules-injector.js +0 -0
  153. /package/{assets → dist/assets}/plugins/zed-bell.js +0 -0
package/README.md CHANGED
@@ -1,70 +1,101 @@
1
- # Интеграция OpenCode
1
+ # OpenCode Integration
2
2
 
3
- `@kisev/skills-opencode` - npm package с capability router, OpenCode runtime,
4
- управлением agent profiles и opt-in installer для agents, commands и plugins. Он
5
- не включает portable skills и не меняет конфигурацию при import, plugin load или
6
- npm lifecycle. Package требует Node.js 22+ и OpenCode 1.18.29+.
3
+ [Русский](README.ru.md)
7
4
 
8
- ## Установка skills
5
+ `@kisev/skills-opencode` is the optional npm integration. It does not include
6
+ portable skills or mutate configuration on import.
7
+ Managed files use exact SHA-256 ownership checks.
8
+ It provides the capability router, OpenCode runtime, agent-profile management,
9
+ and an opt-in installer for agents, commands, and plugins. It requires Node.js
10
+ 22+ and OpenCode 1.18.29+; import, plugin loading, and npm lifecycle do not
11
+ write configuration.
9
12
 
10
- Сначала установите нужные portable skills через `npx skills` из публичного
11
- репозитория:
13
+ ## Install Skills
14
+
15
+ Install portable skills first:
12
16
 
13
17
  ```shell
14
18
  npx --yes skills add kisev/skills --agent opencode --skill '*' --copy --yes
15
19
  ```
16
20
 
17
- Для одного skill укажите `--skill <name>`. Для воспроизводимой установки можно
18
- передать URL GitHub tag, например
19
- `https://github.com/kisev/skills/tree/v1.1.1`. Package никогда не устанавливает
20
- и не обновляет skills. Если команда не нашла skill, она сообщает точную команду
21
- `npx skills add` для его установки.
22
-
23
- ## Установка integration
21
+ Use `--skill <name>` for one skill. `npx skills` accepts a reproducible tag URL,
22
+ for example `https://github.com/kisev/skills/tree/v2.0.0`; the package never
23
+ installs or updates skills and reports the exact `npx skills add` command when a
24
+ skill is missing.
24
25
 
25
- Установите npm package там, где OpenCode сможет разрешить plugin:
26
+ ## Install Integration
26
27
 
27
28
  ```shell
28
- npm install @kisev/skills-opencode@1.1.1
29
+ npm install @kisev/skills-opencode@2.0.0
29
30
  ```
30
31
 
31
- Сначала покажите план installer. По умолчанию CLI выводит короткую сводку:
32
- счётчики по группам, только изменяемые paths, conflicts, restart flag, digest и
33
- готовую confirm-команду. Эта команда не меняет deployment:
32
+ Interactive selection is available only in a TTY. Non-TTY installs require
33
+ explicit `--commands`, `--agents`, and `--plugins` flags; selectable plugins
34
+ default to an empty set. The wizard shows skill commands, package commands,
35
+ fixed agents, and `rules-injector`, `rtk`, `zed-bell`.
36
+
37
+ Preview before any write:
34
38
 
35
39
  ```shell
36
40
  npm exec -- skills-opencode install --scope global --dry-run
37
41
  ```
38
42
 
39
- Проверьте сводку и примените только показанный digest:
43
+ Apply the shown digest only:
40
44
 
41
45
  ```shell
42
46
  npm exec -- skills-opencode install --scope global --confirm <digest>
43
47
  ```
44
48
 
45
- `global` устанавливает assets в `~/.config/opencode/agents`,
46
- `~/.config/opencode/commands` и `~/.config/opencode/plugins`. Для текущего
47
- repository используйте `project`:
49
+ Use `--json` for automation.
50
+ The machine-readable plan includes `requires_restart`; a preview uses `--dry-run`
51
+ and an apply uses `--confirm <digest>` with identical arguments.
52
+
53
+ `global` manages `.config/opencode/agents`, `.config/opencode/commands`, and
54
+ `.config/opencode/plugins`. Project scope manages `.opencode/agents`,
55
+ `.opencode/commands`, and `.opencode/plugins`. Profile configuration is kept in
56
+ `.config/opencode/.skills-opencode/agent-profiles.json` globally or under
57
+ `.opencode/.skills-opencode` for a project.
58
+ Project assets are limited to the current working directory. Scope is required;
59
+ the installer never changes `opencode.json`, overwrites unknown or modified
60
+ files, or records ownership manifests before confirmed apply. The short preview
61
+ reports changed paths, conflicts, restart status, digest, and its confirm command.
62
+
63
+ ## Read-only Doctor
64
+
65
+ `doctor` reports facts without writing:
48
66
 
49
67
  ```shell
50
- npm exec -- skills-opencode install --scope project --dry-run
51
- npm exec -- skills-opencode install --scope project --confirm <digest>
68
+ npm exec -- skills-opencode doctor --scope project
69
+ npm exec -- skills-opencode doctor --scope global --json
52
70
  ```
53
71
 
54
- Project assets находятся в `.opencode/agents`, `.opencode/commands` и
55
- `.opencode/plugins` текущего working directory. Scope обязателен. Installer не изменяет `opencode.json`, не
56
- перезаписывает неизвестные или изменённые files и сохраняет ownership manifests
57
- только после confirmed apply.
72
+ It never creates lifecycle state, consumes receipts, recovers journals, starts
73
+ plugins, or starts LSP servers. Its versioned JSON report contains stable check
74
+ IDs, catalog and installed-manifest versions, ownership/drift/collision classes,
75
+ inventory findings, runtime summaries, redacted configuration projections, and
76
+ LSP facts. It never serializes secrets, raw configuration, environment values,
77
+ receipts, or credentials. Exit status `0` is clean, `1` reports findings, and
78
+ `2` means invalid input or an incomplete probe failure.
58
79
 
59
- Для automation добавьте `--json`. Этот режим сохраняет полный стабильный
60
- machine-readable plan, включая `operations` и `requires_restart`:
80
+ ## Reconcile Retired Assets
81
+
82
+ `reconcile` previews retirement and preserves conflicts:
61
83
 
62
84
  ```shell
63
- npm exec -- skills-opencode install --scope global --dry-run --json
64
- npm exec -- skills-opencode agent list --scope global --json
85
+ npm exec -- skills-opencode reconcile --scope project --dry-run
86
+ npm exec -- skills-opencode reconcile --scope project --confirm <digest>
87
+ npm exec -- skills-opencode reconcile --scope global --dry-run --json
65
88
  ```
66
89
 
67
- Добавьте plugin в `opencode.json` вручную:
90
+ It considers only public portable skills, package commands, plugins, agents, and
91
+ installation metadata for the selected scope. Retired exact-owned files move to
92
+ a private content-addressed XDG archive with an index, never disappear.
93
+ Modified-managed, user-owned, unknown, symlink, unsafe-path, worktree, and
94
+ ambiguous-source entries remain byte-for-byte conflicts. The journaled target and
95
+ archive transaction provides rollback, recovery, and repeatable no-op operation.
96
+ Doctor reports archive entries and conflicts read-only.
97
+
98
+ Add the plugin manually:
68
99
 
69
100
  ```json
70
101
  {
@@ -73,15 +104,9 @@ npm exec -- skills-opencode agent list --scope global --json
73
104
  }
74
105
  ```
75
106
 
76
- Полностью перезапустите OpenCode после install, upgrade или uninstall: registry
77
- agents и commands строится до plugin hooks.
107
+ ## Manage Agents
78
108
 
79
- ## Управление agents
80
-
81
- Рекомендуемый интерфейс - прямой terminal CLI: он не вызывает LLM и не расходует
82
- токены. Fixed roles `manager`, `architect`, `mapper`, `worker`, `review` и
83
- стандартный `critic` всегда сохраняют имена и canonical prompts/permissions.
84
- Меняются только `model` и `variant`:
109
+ The direct CLI manages models without LLM calls:
85
110
 
86
111
  ```shell
87
112
  npm exec -- skills-opencode agent list --scope global
@@ -91,17 +116,17 @@ npm exec -- skills-opencode agent model-set worker --scope global \
91
116
  npm exec -- skills-opencode agent reconcile --scope global --dry-run
92
117
  ```
93
118
 
94
- `agent configure` предлагает настоящий terminal wizard: стрелками выбираются
95
- agent из inventory, затем provider, только его models и, если metadata выбранной
96
- модели публикует variants, variant. Текущие model/variant и target показываются
97
- перед выбором; доступны `keep`, `change`, `clear variant`, `back` и `cancel`.
98
- Wizard не вызывает LLM, OpenCode Question или refresh catalog. Если catalog
99
- недоступен, он завершается без записи и печатает инструкцию для exact
100
- `--model <provider/model>` с optional `--variant`. Для модели без variants
101
- дополнительный selector не показывается.
119
+ Fixed roles preserve their names and canonical prompts and permissions; only
120
+ model and variant change. The interactive configuration wizard selects an agent,
121
+ provider, its models, and published variants, showing the current target and
122
+ offering keep, change, clear variant, back, and cancel. It does not invoke an
123
+ LLM, OpenCode Question, or catalog refresh. If the catalog is unavailable it
124
+ does not write and prints the exact model instruction.
102
125
 
103
- Additional critic имеет имя `critic-<safe-suffix>`. Стандартный `critic` и fixed
104
- roles нельзя удалить или переименовать:
126
+ When the catalog is unavailable, use exact `--model <provider/model>` and an
127
+ optional `--variant`; `provider/model` identifies the selected model. The
128
+ optional `agent_profiles` tool and slash commands adapt the same direct-CLI
129
+ plan/apply contract.
105
130
 
106
131
  ```shell
107
132
  npm exec -- skills-opencode critic add security --scope global \
@@ -109,77 +134,74 @@ npm exec -- skills-opencode critic add security --scope global \
109
134
  npm exec -- skills-opencode critic remove security --scope global --dry-run
110
135
  ```
111
136
 
112
- Для любой mutation используйте готовую confirm-команду из preview либо замените
113
- `--dry-run` на `--confirm <digest>` и повторите те же аргументы. Человекочитаемый
114
- plan не печатает полный JSON и сворачивает длинные группы paths. Digest связан с
115
- одноразовым private receipt, действует 10 минут и повторно не применяется. Для
116
- machine-readable result добавьте `--json`; поле `requires_restart` сообщает о
117
- необходимости полностью перезапустить OpenCode.
118
-
119
- В global scope profile configuration хранится в
120
- `~/.config/opencode/.skills-opencode/agent-profiles.json`, а semantic deployment
121
- manifest - рядом в `agent-profiles.manifest.json`. Для project scope те же файлы
122
- находятся под `.opencode/.skills-opencode/`. Configuration хранит выбранные
123
- model/variant и additional critics; package update её не сбрасывает. Manifest
124
- хранит package version, exact critic pool и hashes canonical configuration и
125
- rendered files.
126
-
127
- Inventory различает `package-owned`, `managed`, `user-owned`, `drift` и exact-name
128
- `collision`. User-owned и неизвестные agents не изменяются. Collision блокирует
129
- apply; drift исправляется только явным `agent reconcile`. Все mutations проходят
130
- под lifecycle lock, повторно проверяют inventory, используют journaled
131
- all-or-rollback transaction и выполняют final validation. После прерывания
132
- следующая mutation безопасно восстанавливает before-images и требует свежий plan.
133
-
134
- ## Upgrade и uninstall
135
-
136
- После обновления npm package снова выполните dry-run и подтвердите новый digest.
137
- Installer обновляет только files с совпадающим managed SHA-256.
138
-
139
- При первом upgrade с `1.0.0` installer передаёт ownership шести fixed agents из
140
- generic manifest в profile domain только при точном совпадении package/version,
141
- manifest records и SHA-256 каждого файла. Любое отличие остаётся конфликтом.
142
- Commands и plugins продолжают принадлежать generic installer. Uninstall удаляет
143
- неизменённые deployments, но сохраняет profile configuration для последующей
144
- установки.
137
+ Additional critics use `critic-<safe-suffix>`; fixed roles and the standard
138
+ critic cannot be renamed or removed. Every mutation uses a one-time private
139
+ receipt valid for 10 minutes, a lifecycle lock, inventory recheck, journaled
140
+ all-or-rollback transaction, and final validation. Interrupted mutations recover
141
+ before requiring a fresh plan. Global profile configuration and its semantic
142
+ deployment manifest are kept together; project scope keeps corresponding files
143
+ under its `.opencode` directory. Package updates do not reset selected models,
144
+ variants, or additional critics.
145
+
146
+ ## Upgrade and Uninstall
145
147
 
146
148
  ```shell
147
149
  npm exec -- skills-opencode uninstall --scope global --dry-run
148
150
  npm exec -- skills-opencode uninstall --scope global --confirm <digest>
149
151
  ```
150
152
 
151
- Uninstall удаляет только files из ownership manifest, если их SHA-256 не
152
- изменился. Изменённые пользователем files остаются как `conflict`.
153
+ The full JSON install preview is:
153
154
 
154
- ## Runtime options
155
+ ```shell
156
+ npm exec -- skills-opencode install --scope global --dry-run --json
157
+ ```
155
158
 
156
- Package экспортирует independent plugin factories `background-attempts`,
157
- `goal-loop`, `schedule`, `autonomy-policy`, `rules-injector`, `rtk`, `zed-bell`
158
- и `zed-clickable-paths`. Stateful plugins Background Attempts, Goal Loop,
159
- Scheduler и Autonomy Policy отключены по умолчанию. Zed integrations также
160
- optional. Включайте subsystem только в собственном user-owned plugin wrapper:
159
+ On upgrade, the installer updates only managed files whose SHA-256 still matches.
160
+ The one-time `1.0.0` migration transfers the six fixed-agent ownership records
161
+ only when package/version, manifest records, and every file hash match exactly.
162
+ Uninstall removes only unchanged manifest-owned files; modified files remain
163
+ conflicts and profile configuration is retained for a later installation.
161
164
 
162
- ```js
163
- import goalLoop from "@kisev/skills-opencode/plugins/goal-loop";
165
+ ## Runtime Options
164
166
 
165
- export default (input) => goalLoop(input, { enabled: true });
167
+ Plugins are independent and selectable ones are opt-in.
168
+
169
+ ```shell
170
+ npm exec -- skills-opencode agent list --scope global --json
166
171
  ```
167
172
 
168
- `rules-injector` fail-soft применяет ограниченный budget и пропускает native
169
- project/global rules. `rtk` fail-open сжимает большой bash output и добавляет
170
- подсказку для edit error, но не содержит ownership guard.
173
+ The package exports the core OpenCode plugin and independent factories for
174
+ `rules-injector`, `rtk`, and `zed-bell`. Retired plugin APIs and internal lifecycle
175
+ implementations are not public. Rules injection fails soft within a bounded
176
+ budget; RTK fails open.
177
+
178
+ ## Stage 18 Routing
179
+
180
+ `doit` owns the complete evidence -> plan -> confirmation -> execution -> checks
181
+ -> report lifecycle; `manager` only adapts it to OpenCode. The route tool has four
182
+ destinations: exploration to `mapper`, architecture to `architect`, implementation
183
+ to `worker`, and review to `review` or one selected `critic`. Documentation and
184
+ quick work remain in `doit`.
171
185
 
172
- ## Границы
186
+ The route inventory comes only from resolved host configuration. Callers cannot
187
+ inject agents, capabilities, tools, models, or availability. Versioned receipts,
188
+ cards, and mapper/worker/review/critic reports are checked at real Task dispatch
189
+ and result hooks. Cards bind paths, checks, explicit VCS operations, and separate
190
+ execution, publication, and history-rewrite confirmations.
191
+
192
+ ## Boundaries
193
+
194
+ Portable skills and package assets install independently.
195
+
196
+ ```shell
197
+ npm exec -- skills-opencode install --scope project --dry-run
198
+ npm exec -- skills-opencode install --scope project --confirm <digest>
199
+ ```
173
200
 
174
- Portable skills в корне `skills/` универсальны и устанавливаются только через
175
- `npx skills`. Этот package поставляет только OpenCode-specific assets и runtime
176
- router. Команды - тонкие adapters: передают `$ARGUMENTS` как недоверенный ввод
177
- в native Skill tool, а target validation, confirmation, batch/review rules и
178
- формат результата остаются ответственностью skill или runner.
179
- `capabilities`, `route` и `doctor` - package tools/commands для catalog, routing и
180
- health. Tool `agent_profiles` и четыре slash-команды `agent-list`,
181
- `agent-model-set`, `critic-add`, `critic-remove` - optional thin UX над теми же
182
- plan/apply contracts. Отдельного skill `agent-profiles` нет.
201
+ Commands are thin adapters that pass untrusted arguments to the native Skill
202
+ tool; validation, confirmation, batch/review rules, and result format remain the
203
+ skill or runner responsibility. `capabilities`, `route`, and `doctor` are package
204
+ tools and commands for catalog, routing, and health. `agent_profiles` and the
205
+ four agent slash commands are optional UX adapters, not a separate skill.
183
206
 
184
- Package распространяется по лицензии MIT. Полные инструкции по portable skills,
185
- upgrade и security boundaries находятся в корневом README репозитория.
207
+ The package is MIT-licensed; the repository root README has full instructions.
package/README.ru.md ADDED
@@ -0,0 +1,242 @@
1
+ # Интеграция OpenCode
2
+
3
+ [English](README.md) | [Русский](README.ru.md)
4
+
5
+ `@kisev/skills-opencode` - npm package с capability router, OpenCode runtime,
6
+ управлением agent profiles и opt-in installer для agents, commands и plugins. Он
7
+ не включает portable skills и не меняет конфигурацию при import, plugin load или
8
+ npm lifecycle. Package требует Node.js 22+ и OpenCode 1.18.29+.
9
+
10
+ ## Установка skills
11
+
12
+ Сначала установите нужные portable skills через `npx skills` из публичного
13
+ репозитория:
14
+
15
+ ```shell
16
+ npx --yes skills add kisev/skills --agent opencode --skill '*' --copy --yes
17
+ ```
18
+
19
+ Для одного skill укажите `--skill <name>`. Для воспроизводимой установки можно
20
+ передать URL GitHub tag, например
21
+ `https://github.com/kisev/skills/tree/v2.0.0`. Package никогда не устанавливает
22
+ и не обновляет skills. Если команда не нашла skill, она сообщает точную команду
23
+ `npx skills add` для его установки.
24
+
25
+ ## Установка integration
26
+
27
+ Установите npm package там, где OpenCode сможет разрешить plugin:
28
+
29
+ ```shell
30
+ npm install @kisev/skills-opencode@2.0.0
31
+ ```
32
+
33
+ Interactive selection доступен только в TTY. В non-TTY install нужно явно передать
34
+ `--commands`, `--agents` и `--plugins`; selectable plugins по умолчанию пусты.
35
+ Wizard показывает skill commands, package commands, fixed agents и
36
+ `rules-injector`, `rtk`, `zed-bell`. Сначала покажите план installer. CLI выводит короткую сводку:
37
+ счётчики по группам, только изменяемые paths, conflicts, restart flag, digest и
38
+ готовую confirm-команду. Эта команда не меняет deployment:
39
+
40
+ ```shell
41
+ npm exec -- skills-opencode install --scope global --dry-run
42
+ ```
43
+
44
+ Проверьте сводку и примените только показанный digest:
45
+
46
+ ```shell
47
+ npm exec -- skills-opencode install --scope global --confirm <digest>
48
+ ```
49
+
50
+ `global` устанавливает assets в `~/.config/opencode/agents`,
51
+ `~/.config/opencode/commands` и `~/.config/opencode/plugins`. Для текущего
52
+ repository используйте `project`:
53
+
54
+ ```shell
55
+ npm exec -- skills-opencode install --scope project --dry-run
56
+ npm exec -- skills-opencode install --scope project --confirm <digest>
57
+ ```
58
+
59
+ Project assets находятся в `.opencode/agents`, `.opencode/commands` и
60
+ `.opencode/plugins` текущего working directory. Scope обязателен. Installer не изменяет `opencode.json`, не
61
+ перезаписывает неизвестные или изменённые files и сохраняет ownership manifests
62
+ только после confirmed apply.
63
+
64
+ Для automation добавьте `--json`. Этот режим сохраняет полный стабильный
65
+ machine-readable plan, включая `operations` и `requires_restart`:
66
+
67
+ ```shell
68
+ npm exec -- skills-opencode install --scope global --dry-run --json
69
+ npm exec -- skills-opencode agent list --scope global --json
70
+ ```
71
+
72
+ ## Read-only doctor
73
+
74
+ `doctor` is a read-only installer health report. It never creates lifecycle
75
+ state, consumes receipts, recovers journals, starts plugins or starts LSP
76
+ servers. `project` and `global` are isolated scopes; unavailable OpenCode host
77
+ facts are reported as incomplete rather than inferred.
78
+
79
+ ```shell
80
+ npm exec -- skills-opencode doctor --scope project
81
+ npm exec -- skills-opencode doctor --scope global --json
82
+ ```
83
+
84
+ The JSON report is versioned and contains stable check IDs, package/catalog and
85
+ installed-manifest versions, ownership/drift/collision classifications, stage-8
86
+ inventory findings, lifecycle/runtime state summaries, redacted config
87
+ projections and LSP facts. Secrets, raw config, environment values, receipts
88
+ and credentials are never serialized. Exit code `0` is clean, `1` reports
89
+ findings, and `2` means invalid input or an incomplete probe failure.
90
+
91
+ ## Reconcile retired assets
92
+
93
+ `reconcile` проверяет только public portable skills, package commands, plugins,
94
+ agents и installation metadata выбранного scope. XDG runtime state не читается и
95
+ не изменяется. Preview сохраняет private receipt с TTL и печатает digest:
96
+
97
+ ```shell
98
+ npm exec -- skills-opencode reconcile --scope project --dry-run
99
+ npm exec -- skills-opencode reconcile --scope project --confirm <digest>
100
+ npm exec -- skills-opencode reconcile --scope global --dry-run --json
101
+ ```
102
+
103
+ Retired files с доказанным inventory ownership и exact SHA-256 перемещаются в
104
+ private content-addressed XDG archive с index, а не удаляются. Modified-managed,
105
+ user-owned, unknown, symlink, unsafe-path, worktree и ambiguous-source entries
106
+ остаются conflicts без изменения bytes. Journal target и archive обеспечивает
107
+ rollback, recovery и повторный no-op reconcile. Doctor показывает archive и
108
+ conflicts read-only.
109
+
110
+ Добавьте plugin в `opencode.json` вручную:
111
+
112
+ ```json
113
+ {
114
+ "$schema": "https://opencode.ai/config.json",
115
+ "plugin": ["@kisev/skills-opencode"]
116
+ }
117
+ ```
118
+
119
+ Полностью перезапустите OpenCode после install, upgrade или uninstall: registry
120
+ agents и commands строится до plugin hooks.
121
+
122
+ ## Управление agents
123
+
124
+ Рекомендуемый интерфейс - прямой terminal CLI: он не вызывает LLM и не расходует
125
+ токены. Fixed roles `manager`, `architect`, `mapper`, `worker`, `review` и
126
+ стандартный `critic` всегда сохраняют имена и canonical prompts/permissions.
127
+ Меняются только `model` и `variant`:
128
+
129
+ ```shell
130
+ npm exec -- skills-opencode agent list --scope global
131
+ npm exec -- skills-opencode agent configure manager --scope global --dry-run
132
+ npm exec -- skills-opencode agent model-set worker --scope global \
133
+ --model openai/gpt-5 --variant high --dry-run
134
+ npm exec -- skills-opencode agent reconcile --scope global --dry-run
135
+ ```
136
+
137
+ `agent configure` предлагает настоящий terminal wizard: стрелками выбираются
138
+ agent из inventory, затем provider, только его models и, если metadata выбранной
139
+ модели публикует variants, variant. Текущие model/variant и target показываются
140
+ перед выбором; доступны `keep`, `change`, `clear variant`, `back` и `cancel`.
141
+ Wizard не вызывает LLM, OpenCode Question или refresh catalog. Если catalog
142
+ недоступен, он завершается без записи и печатает инструкцию для exact
143
+ `--model <provider/model>` с optional `--variant`. Для модели без variants
144
+ дополнительный selector не показывается.
145
+
146
+ Additional critic имеет имя `critic-<safe-suffix>`. Стандартный `critic` и fixed
147
+ roles нельзя удалить или переименовать:
148
+
149
+ ```shell
150
+ npm exec -- skills-opencode critic add security --scope global \
151
+ --model anthropic/claude-sonnet-4-6 --dry-run
152
+ npm exec -- skills-opencode critic remove security --scope global --dry-run
153
+ ```
154
+
155
+ Для любой mutation используйте готовую confirm-команду из preview либо замените
156
+ `--dry-run` на `--confirm <digest>` и повторите те же аргументы. Человекочитаемый
157
+ plan не печатает полный JSON и сворачивает длинные группы paths. Digest связан с
158
+ одноразовым private receipt, действует 10 минут и повторно не применяется. Для
159
+ machine-readable result добавьте `--json`; поле `requires_restart` сообщает о
160
+ необходимости полностью перезапустить OpenCode.
161
+
162
+ В global scope profile configuration хранится в
163
+ `~/.config/opencode/.skills-opencode/agent-profiles.json`, а semantic deployment
164
+ manifest - рядом в `agent-profiles.manifest.json`. Для project scope те же файлы
165
+ находятся под `.opencode/.skills-opencode/`. Configuration хранит выбранные
166
+ model/variant и additional critics; package update её не сбрасывает. Manifest
167
+ хранит package version, exact critic pool и hashes canonical configuration и
168
+ rendered files.
169
+
170
+ Inventory различает `package-owned`, `managed`, `user-owned`, `drift` и exact-name
171
+ `collision`. User-owned и неизвестные agents не изменяются. Collision блокирует
172
+ apply; drift исправляется только явным `agent reconcile`. Все mutations проходят
173
+ под lifecycle lock, повторно проверяют inventory, используют journaled
174
+ all-or-rollback transaction и выполняют final validation. После прерывания
175
+ следующая mutation безопасно восстанавливает before-images и требует свежий plan.
176
+
177
+ ## Upgrade и uninstall
178
+
179
+ После обновления npm package снова выполните dry-run и подтвердите новый digest.
180
+ Installer обновляет только files с совпадающим managed SHA-256.
181
+
182
+ При первом upgrade с `1.0.0` installer передаёт ownership шести fixed agents из
183
+ generic manifest в profile domain только при точном совпадении package/version,
184
+ manifest records и SHA-256 каждого файла. Любое отличие остаётся конфликтом.
185
+ Commands и plugins продолжают принадлежать generic installer. Uninstall удаляет
186
+ неизменённые deployments, но сохраняет profile configuration для последующей
187
+ установки.
188
+
189
+ ```shell
190
+ npm exec -- skills-opencode uninstall --scope global --dry-run
191
+ npm exec -- skills-opencode uninstall --scope global --confirm <digest>
192
+ ```
193
+
194
+ Uninstall удаляет только files из ownership manifest, если их SHA-256 не
195
+ изменился. Изменённые пользователем files остаются как `conflict`.
196
+
197
+ ## Runtime options
198
+
199
+ Package экспортирует core OpenCode plugin и independent plugin factories
200
+ `rules-injector`, `rtk`, `zed-bell`. Retired plugin APIs и internal lifecycle
201
+ implementations public surface не входят:
202
+
203
+ Background Attempts создают workspace только через единый managed worktree
204
+ owner. Records используют private current-only state, marker и repository
205
+ fingerprint; release перепроверяет регистрацию, fingerprint и чистый status и
206
+ возвращает `blocked` без удаления при расхождении. Scheduler принимает строгий
207
+ five-field cron, не воспроизводит missed slots и пишет receipts `started`,
208
+ `completed`, `failed` или `overrun`.
209
+
210
+ `rules-injector` fail-soft применяет ограниченный budget и пропускает native
211
+ project/global rules. `rtk` fail-open сжимает большой bash output и добавляет
212
+ подсказку для edit error, но не содержит ownership guard.
213
+
214
+ ## Routing этапа 18
215
+
216
+ `doit` владеет полным lifecycle evidence -> plan -> confirmation -> execution ->
217
+ checks -> report; `manager` только адаптирует его к OpenCode. Tool `route` имеет
218
+ четыре назначения: exploration -> `mapper`, architecture -> `architect`,
219
+ implementation -> `worker`, review -> `review` или один `critic`. Documentation и
220
+ quick остаются у `doit`.
221
+
222
+ Inventory берётся только из resolved host config. Caller не может подменить agents,
223
+ capabilities, tools, models или availability. Versioned receipts, cards и
224
+ mapper/worker/review/critic reports проверяются на реальных Task dispatch/result
225
+ hooks. Card связывает paths, checks, явные VCS operations и отдельные confirmations
226
+ для execution, publication и history rewrite.
227
+
228
+ ## Границы
229
+
230
+ Portable skills в корне `skills/` универсальны и устанавливаются только через
231
+ `npx skills`. Этот package поставляет только OpenCode-specific assets и runtime
232
+ router. Команды - тонкие adapters: передают `$ARGUMENTS` как недоверенный ввод
233
+ в native Skill tool, а target validation, confirmation, batch/review rules и
234
+ формат результата остаются ответственностью skill или runner.
235
+ `capabilities`, `route` и `doctor` - package tools/commands для catalog, routing и
236
+ health. Tool `doctor` and direct CLI share one read-only facts API; `/doctor` is
237
+ only a thin adapter. Tool `agent_profiles` и четыре slash-команды `agent-list`,
238
+ `agent-model-set`, `critic-add`, `critic-remove` - optional thin UX над теми же
239
+ plan/apply contracts. Отдельного skill `agent-profiles` нет.
240
+
241
+ Package распространяется по лицензии MIT. Полные инструкции по portable skills,
242
+ upgrade и security boundaries находятся в корневом README репозитория.
@@ -109,7 +109,7 @@ export declare function validateAgentName(name: string): string;
109
109
  export declare function validateModel(model: string): string;
110
110
  export declare function validateVariant(variant: string | null | undefined): string | undefined;
111
111
  export declare function renderAgentProfile(name: string, config: AgentProfileConfig, canonical: Record<FixedAgentRole, Buffer>): Buffer;
112
- export declare function buildAgentProfilePlan(request: AgentProfileRequest, scope: Scope, cwd?: string, home?: string, legacy?: LegacyAgentOwnership): Promise<BuiltPlan>;
112
+ export declare function buildAgentProfilePlan(request: AgentProfileRequest, scope: Scope, cwd?: string, home?: string, legacy?: LegacyAgentOwnership, selectedAgents?: readonly FixedAgentRole[]): Promise<BuiltPlan>;
113
113
  export declare function validateBuiltAgentProfilePlan(built: BuiltPlan): Promise<void>;
114
114
  export declare function listAgentProfiles(scope: Scope, cwd?: string, home?: string): Promise<AgentInventory>;
115
115
  export declare function previewAgentProfileChange(request: AgentProfileRequest, scope: Scope, cwd?: string, home?: string): Promise<AgentProfilePlan>;