biaws 0.1.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 (76) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +229 -0
  3. package/bin/biaws.js +3 -0
  4. package/docs/command-taxonomy.md +36 -0
  5. package/docs/instance-lifecycle.md +82 -0
  6. package/docs/releasing.md +105 -0
  7. package/package.json +63 -0
  8. package/shared/skillPackage.js +100 -0
  9. package/src/apiClient.js +89 -0
  10. package/src/baseCommands.js +122 -0
  11. package/src/commands/agent/configure.js +3 -0
  12. package/src/commands/agent/doctor.js +3 -0
  13. package/src/commands/agent.js +400 -0
  14. package/src/commands/api.js +17 -0
  15. package/src/commands/applications/get.js +17 -0
  16. package/src/commands/applications/list.js +32 -0
  17. package/src/commands/applications.js +7 -0
  18. package/src/commands/configure/claude.js +25 -0
  19. package/src/commands/configure/codex.js +25 -0
  20. package/src/commands/configure/doctor.js +49 -0
  21. package/src/commands/configure/skills.js +74 -0
  22. package/src/commands/configure.js +19 -0
  23. package/src/commands/demands/complete-task.js +6 -0
  24. package/src/commands/demands/get.js +16 -0
  25. package/src/commands/demands/list.js +48 -0
  26. package/src/commands/demands/task-status.js +49 -0
  27. package/src/commands/demands/tasks.js +44 -0
  28. package/src/commands/demands.js +7 -0
  29. package/src/commands/instance/backup.js +74 -0
  30. package/src/commands/instance/list.js +39 -0
  31. package/src/commands/instance/remove.js +72 -0
  32. package/src/commands/instance/restore.js +96 -0
  33. package/src/commands/instance/setup.js +349 -0
  34. package/src/commands/instance/show.js +31 -0
  35. package/src/commands/instance/start.js +32 -0
  36. package/src/commands/instance/status.js +42 -0
  37. package/src/commands/instance/stop.js +30 -0
  38. package/src/commands/instance.js +18 -0
  39. package/src/commands/issues/get.js +16 -0
  40. package/src/commands/issues/list.js +51 -0
  41. package/src/commands/issues/transition.js +33 -0
  42. package/src/commands/issues.js +7 -0
  43. package/src/commands/monitoring/describe.js +13 -0
  44. package/src/commands/monitoring/signal.js +25 -0
  45. package/src/commands/monitoring/signals.js +17 -0
  46. package/src/commands/monitoring/validate.js +14 -0
  47. package/src/commands/monitoring.js +163 -0
  48. package/src/commands/skills/install-all.js +13 -0
  49. package/src/commands/skills/install.js +16 -0
  50. package/src/commands/skills/list.js +5 -0
  51. package/src/commands/skills/publish-all.js +14 -0
  52. package/src/commands/skills/publish.js +11 -0
  53. package/src/commands/skills/status.js +7 -0
  54. package/src/commands/skills/update.js +12 -0
  55. package/src/commands/skills.js +303 -0
  56. package/src/commands/workspaces/get.js +15 -0
  57. package/src/commands/workspaces/list.js +20 -0
  58. package/src/commands/workspaces.js +7 -0
  59. package/src/compatibilityCommands.js +107 -0
  60. package/src/configure/command.js +50 -0
  61. package/src/core/context.js +162 -0
  62. package/src/core/errors.js +25 -0
  63. package/src/core/processRunner.js +119 -0
  64. package/src/core/prompts.js +138 -0
  65. package/src/core/redaction.js +29 -0
  66. package/src/core/terminal.js +72 -0
  67. package/src/core/wizard.js +279 -0
  68. package/src/domain/readCommand.js +65 -0
  69. package/src/domain/readService.js +126 -0
  70. package/src/domain/writeCommand.js +91 -0
  71. package/src/domain/writeService.js +122 -0
  72. package/src/index.js +5 -0
  73. package/src/instance/command.js +37 -0
  74. package/src/instance/service.js +515 -0
  75. package/src/localSkills.js +143 -0
  76. package/src/skillPackage.js +4 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Fabiano Bondia
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,229 @@
1
+ # Bondia Workspaces CLI
2
+
3
+ CLI do Bondia Workspaces para configurar capacidades locais e integrar agentes
4
+ externos aos contratos operacionais da plataforma.
5
+
6
+ ## Instalação
7
+
8
+ O pacote público usa o nome `biaws` e expõe um binário com shebang portátil:
9
+
10
+ ```bash
11
+ npm install --global biaws
12
+ biaws --help
13
+ biaws --version
14
+ ```
15
+
16
+ Para uma execução descartável, use `npx biaws --help`. Em um checkout para
17
+ desenvolvimento, `npm --prefix biaws-cli link` cria o mesmo comando global; a
18
+ rota direta equivalente é `./biaws-cli/bin/biaws.js`.
19
+
20
+ Consultas e escritas na API funcionam somente com o pacote npm. Operações de
21
+ instância e a configuração completa de MCP/skills também precisam dos assets
22
+ Docker e scripts do repositório. Nesse caso, execute a partir do checkout ou
23
+ defina sua raiz explicitamente:
24
+
25
+ ```bash
26
+ export BIAWS_ROOT=/caminho/absoluto/para/biaws
27
+ biaws instance list
28
+ ```
29
+
30
+ Windows é suportado por WSL2; o binário e os scripts não têm suporte em Windows
31
+ nativo.
32
+
33
+ ## Uso
34
+
35
+ Com a `biaws-api` em execução:
36
+
37
+ ```bash
38
+ biaws skills list
39
+ biaws skills publish \
40
+ --dir ../../.agents/skills/biaws-example \
41
+ --version 1.0.0 \
42
+ --changelog "Publicação inicial"
43
+ biaws skills publish-all \
44
+ --dir ../../.agents/skills \
45
+ --initial-version 1.0.0 \
46
+ --changelog "Publicação inicial do catálogo"
47
+ biaws skills install biaws-example
48
+ biaws skills install-all
49
+ biaws skills status
50
+ biaws skills update
51
+ biaws agent configure codex --project /caminho/do/projeto --workspace id-do-workspace
52
+ biaws agent configure claude --project /caminho/do/projeto --workspace id-do-workspace
53
+ biaws agent doctor codex --project /caminho/do/projeto --workspace id-do-workspace
54
+ biaws monitoring signal <aplicação.componente.deployment.runtime> \
55
+ --status healthy \
56
+ --source zabbix \
57
+ --signal-id zabbix:event:18492 \
58
+ --message "Serviço saudável" \
59
+ --metadata-profile sgmp-health/v1 \
60
+ --metadata '{"service_up":true,"database_up":true,"disk_usage_percent":73.42}'
61
+ biaws monitoring signals <runtime-uuid-ou-caminho> --limit 20
62
+ biaws monitoring describe --template sgmp-health --template-version 1
63
+ biaws monitoring validate --template sgmp-health --template-version 1 \
64
+ --payload '{"status":"healthy","message":"OK","metadata":{"service_up":true}}'
65
+ biaws monitoring signal <runtime-uuid-ou-caminho> \
66
+ --source external-monitor --template sgmp-health --template-version 1 \
67
+ --payload '{"status":"healthy","message":"OK","metadata":{"service_up":true}}'
68
+ ```
69
+
70
+ ### Consultas de domínio
71
+
72
+ As rotas `workspaces`, `applications`, `demands` e `issues` oferecem `list` e
73
+ `get`; `demands tasks <melhoria>` lista tarefas por ID ou código. Filtros de
74
+ workspace/aplicação, busca, status, página e limite são enviados à API sem
75
+ ampliar o escopo. A saída humana sempre informa escopo e paginação. `--json`
76
+ emite somente o envelope versionado `biaws.read.v1` em stdout; diagnósticos
77
+ permanecem em stderr.
78
+
79
+ As escritas remotas são restritas às ações `demands task-status`,
80
+ `demands complete-task` e `issues transition`. Elas resolvem a entidade antes
81
+ da alteração, exigem confirmação (`--yes` em CI), enviam somente o novo status
82
+ e retornam `biaws.write.v1`. Repetir o status atual não envia outra escrita.
83
+
84
+ ```bash
85
+ biaws workspaces list --json
86
+ biaws applications list --workspace "$ISSUE_WORKSPACE_ID" --page 1 --limit 20
87
+ biaws demands get CLI-OCLIF-2026-08-18 --workspace "$ISSUE_WORKSPACE_ID"
88
+ biaws demands tasks CLI-OCLIF-2026-08-18 --status Pendente --json
89
+ biaws issues list --application APPLICATION_ID --status open --json
90
+ biaws demands complete-task CLI-OCLIF-2026-08-18 CLI-OCLIF-09 --yes --json
91
+ biaws issues transition ISSUE_ID --status Resolvido --yes --json
92
+ ```
93
+
94
+ `monitoring signal` envia uma observação passiva para um runtime. A referência
95
+ pode ser o UUID ou o caminho de identificadores
96
+ `<aplicação>.<componente>.<deployment>.<runtime>`. Use
97
+ `--signal-id` para que retries sejam idempotentes e `--observed-at` quando a
98
+ observação ocorreu antes do envio. Estados aceitos: `unknown`, `healthy`,
99
+ `degraded`, `unavailable` e `stopped`. O contrato completo está em
100
+ [`../docs/monitoring.md`](../docs/monitoring.md).
101
+
102
+ `monitoring describe` retorna contrato, amostra e apresentação da versão;
103
+ `monitoring validate` executa JSONata sem persistir sinal. Ao enviar
104
+ `--template` e `--template-version`, informe `--payload`; `--status` deixa de ser
105
+ obrigatório porque o resultado é calculado pela API.
106
+
107
+ Por padrão, as skills são instaladas em `.agents/skills`, considerando o diretório
108
+ corrente. Outro destino pode ser informado com `--target`.
109
+
110
+ O CLI mantém `.agents/biaws-skills.lock.json` com as versões instaladas. Ao usar
111
+ `--force` ou `skills update`, a instalação anterior é preservada ao lado da nova com
112
+ o sufixo `.backup-<data>`.
113
+
114
+ `skills publish-all` examina somente os subdiretórios imediatos da pasta informada
115
+ que contenham `SKILL.md`. Uma skill cuja versão já esteja no catálogo é ignorada,
116
+ permitindo repetir a carga inicial sem gerar conflito. Falhas em uma skill não
117
+ interrompem as demais e fazem o comando terminar com código de saída diferente de
118
+ zero.
119
+
120
+ `agent configure` registra o `biaws-mcp` e instala todas as skills do catálogo.
121
+ Para Codex, usa `.codex/config.toml` e `.agents/skills`. Para Claude Code, usa
122
+ `.mcp.json` e `.claude/skills`. O comando preserva outros servidores MCP e não
123
+ altera configuração global. Ele grava `ISSUE_WORKSPACE_ID` na configuração MCP
124
+ do projeto; informe `--workspace` quando a chave acessar mais de um workspace.
125
+ Use `agent doctor` para verificar Node.js, API, autenticação, workspace,
126
+ configuração e skills.
127
+
128
+ As rotas `skills`, `agent` e `monitoring` são subcomandos oclif nativos: seus
129
+ argumentos, flags, ajuda e erros de uso são descobertos e validados pelo
130
+ framework. `agent configure` e `agent doctor` permanecem como aliases de
131
+ compatibilidade; para novas automações, prefira `configure codex|claude` e
132
+ `configure doctor`.
133
+
134
+ ## Configuração
135
+
136
+ - `ISSUE_API_URL` ou `ISSUE_API_BASE_URL`: endereço da API.
137
+ - `ISSUE_API_KEY`: chave enviada como `Authorization: Bearer`.
138
+ - `ISSUE_WORKSPACE_ID`: workspace usado em execuções diretas do CLI. Para MCP,
139
+ o `agent configure` grava esse valor na configuração local do projeto.
140
+ - `BIAWS_ENV_FILE`: caminho absoluto para o `.env` da instância selecionada;
141
+ contém URL e chave, e o setup o grava na configuração MCP do cliente.
142
+ - `--api-url`: sobrescreve o endereço apenas para a execução atual.
143
+ - `--api-key`: sobrescreve a chave apenas para a execução atual; evite porque o
144
+ valor pode ficar visível na lista de processos ou no histórico do shell.
145
+ - `--workspace`: seleciona o workspace e, em `agent configure`, persiste a
146
+ seleção na configuração MCP do projeto. A seleção não amplia as permissões da
147
+ identidade técnica.
148
+
149
+ O valor padrão é `http://127.0.0.1:3100`.
150
+
151
+ ## Fundação de comandos
152
+
153
+ Os novos comandos usam bases separadas por contexto:
154
+
155
+ - `LocalInstanceCommand` resolve raiz, diretório de instâncias e `.env` sem
156
+ exigir credenciais;
157
+ - `AuthenticatedApiCommand` valida a autenticação antes de criar o cliente HTTP;
158
+ - `ProjectCommand` acrescenta a resolução explícita do diretório do projeto.
159
+
160
+ Filesystem, processos, API e terminal ficam atrás de adapters injetáveis. A
161
+ resolução cria um snapshot do ambiente e não altera `process.env`. Subprocessos
162
+ são executados sem shell, recebem argumentos separados e encaminham sinais; ao
163
+ receber segredos para redaction, sua saída é sanitizada antes de chegar ao
164
+ terminal ou a erros.
165
+
166
+ ## Wizards e planos
167
+
168
+ Fluxos interativos usam `@inquirer/prompts` somente por meio de um
169
+ `PromptAdapter`. Há adapters real, não interativo e programável para testes. A
170
+ camada de wizard resolve flags e ambiente, coleta apenas campos ausentes, valida
171
+ o conjunto, cria um plano imutável, apresenta um resumo redigido, confirma e só
172
+ então chama o executor.
173
+
174
+ - `--interactive` habilita perguntas quando há TTY;
175
+ - `--non-interactive` nunca pergunta e lista todos os campos obrigatórios
176
+ ausentes;
177
+ - `--defaults` aplica defaults declarados explicitamente e é sempre opt-in;
178
+ - `--yes` pula somente a confirmação, sem preencher campos;
179
+ - `--json` não muda coleta ou confirmação e reserva o resumo serializado para
180
+ saída estruturada.
181
+
182
+ Segredos podem ser acessados pelo executor com `plan.get(campo)`, mas aparecem
183
+ como `[REDACTED]` em `plan.values`, `toJSON()` e no resumo. Cancelamento, EOF e
184
+ sinais abortam antes da chamada do executor com código estável.
185
+
186
+ ## Instâncias locais
187
+
188
+ `biaws instance setup`, `list`, `show`, `status`, `start` e `stop` cobrem o
189
+ setup e o ciclo de vida local sem exigir chave da API. O setup valida nomes,
190
+ URL, portas e storage antes de chamar Docker, preserva segredos existentes e
191
+ alerta quando uma reexecução muda os destinos persistentes sem mover dados.
192
+
193
+ A senha administrativa não possui flag: informe-a no prompt mascarado ou em
194
+ `BIAWS_BOOTSTRAP_ADMIN_PASSWORD` num ambiente privado. Consulte o fluxo de
195
+ automação e o smoke test Docker em
196
+ [`docs/instance-lifecycle.md`](docs/instance-lifecycle.md).
197
+
198
+ ## Desenvolvimento
199
+
200
+ ```bash
201
+ npm ci
202
+ npm run check
203
+ npm test
204
+ npm run package:verify
205
+ ```
206
+
207
+ O roteiro de publicação, migração dos wrappers e rollback está em
208
+ [`docs/releasing.md`](docs/releasing.md). O comando de publicação é dry-run por
209
+ padrão e nunca publica sem `--publish` explícito.
210
+
211
+ ### Configuração de clientes e skills
212
+
213
+ Os comandos nativos de projeto mantêm a chave exclusivamente no ambiente privado
214
+ (`ISSUE_API_KEY` ou `--env-file`) e gravam no projeto apenas a URL indireta do
215
+ runtime, o workspace e a configuração MCP gerenciada:
216
+
217
+ ```bash
218
+ biaws configure codex --project . --workspace <workspace-id>
219
+ biaws configure claude --project . --workspace <workspace-id>
220
+ biaws configure skills list --json
221
+ biaws configure skills install <skill-id>
222
+ biaws configure skills update [skill-id]
223
+ biaws configure skills verify
224
+ biaws configure doctor codex
225
+ ```
226
+
227
+ Configurações preexistentes de terceiros são preservadas. Um bloco `biaws`
228
+ conflitante só é assumido pelo CLI com `--force`. Sem TTY, cliente, workspace e
229
+ seleção de skill devem ser informados explicitamente; `--all` instala o catálogo.
package/bin/biaws.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import "../src/index.js";
@@ -0,0 +1,36 @@
1
+ # Taxonomia de comandos do BIAWS CLI
2
+
3
+ O executável `biaws` organiza os comandos em três contextos canônicos:
4
+
5
+ - `biaws instance ...`: administração local de instâncias. Não exige API key.
6
+ - `biaws configure ...`: configuração de projeto, Codex, Claude e skills.
7
+ - `biaws api ...`: leitura e escrita autenticadas em recursos do BIAWS.
8
+
9
+ Durante a migração, `skills`, `agent` e `monitoring` continuam disponíveis como
10
+ rotas de compatibilidade. Seus argumentos e opções são encaminhados às
11
+ implementações existentes; a substituição por comandos oclif específicos será
12
+ feita incrementalmente.
13
+
14
+ ## Convenções
15
+
16
+ - nomes de comandos e flags usam kebab-case;
17
+ - ajuda e versão são fornecidas pelo oclif;
18
+ - erros de uso retornam código 2 e falhas operacionais retornam código 1;
19
+ - `--json` reserva stdout para JSON e envia diagnósticos para stderr;
20
+ - aliases `get` e `set` só serão adicionados quando não reduzirem a descoberta;
21
+ - rotas antigas devem emitir depreciação antes de serem removidas.
22
+
23
+ ## Árvore planejada
24
+
25
+ ```text
26
+ biaws
27
+ ├── instance setup|list|show|status|start|stop|backup|restore|remove
28
+ ├── configure codex|claude|skills|doctor
29
+ ├── workspaces list|get
30
+ ├── applications list|get
31
+ ├── demands list|get|tasks|task-status|complete-task
32
+ ├── issues list|get|transition
33
+ ├── skills ... (compatibilidade)
34
+ ├── agent ... (compatibilidade)
35
+ └── monitoring ... (compatibilidade)
36
+ ```
@@ -0,0 +1,82 @@
1
+ # Ciclo de vida de instâncias
2
+
3
+ ## Setup
4
+
5
+ O setup interativo coleta entradas ausentes, mostra um plano redigido e pede
6
+ confirmação antes de mutar arquivos ou chamar Docker:
7
+
8
+ ```bash
9
+ biaws instance setup --interactive
10
+ ```
11
+
12
+ Em automação, defaults precisam ser autorizados e a senha deve vir de um
13
+ ambiente privado, nunca de argv:
14
+
15
+ ```bash
16
+ BIAWS_BOOTSTRAP_ADMIN_PASSWORD='...' \
17
+ biaws instance setup --name local --defaults --non-interactive --yes
18
+ ```
19
+
20
+ Use `--storage volumes` ou `--storage directories --storage-root /srv/biaws`.
21
+ Uma mudança de estratégia apenas atualiza a configuração e emite um alerta; o
22
+ CLI não move dados existentes implicitamente.
23
+
24
+ ## Operação
25
+
26
+ ```bash
27
+ biaws instance list
28
+ biaws instance show local
29
+ biaws instance status local
30
+ biaws instance start local
31
+ biaws instance stop local
32
+ ```
33
+
34
+ `list` e `show` omitem o conteúdo integral do `.env`. `start`, `stop` e
35
+ `status` invocam Docker Compose sem shell e com projeto, arquivo Compose e env
36
+ da instância resolvidos explicitamente.
37
+
38
+ ## Smoke test Docker real
39
+
40
+ Em um checkout descartável com Docker e OpenSSL disponíveis:
41
+
42
+ 1. Reserve as portas `27117`, `3110` e `4410`.
43
+ 2. Execute o setup não interativo abaixo.
44
+ 3. Confirme que `status` lista `mongo`, `api` e `ui` saudáveis.
45
+ 4. Pare e reinicie a instância, verificando que o mesmo `.env`, chave mestra e
46
+ volumes são reutilizados.
47
+
48
+ ```bash
49
+ BIAWS_BOOTSTRAP_ADMIN_PASSWORD='smoke-only-change-me' \
50
+ biaws instance setup \
51
+ --name smoke --mongo-port 27117 --api-port 3110 --ui-port 4410 \
52
+ --public-url http://localhost:4410 --storage volumes \
53
+ --admin-email smoke@example.test --admin-name Smoke \
54
+ --api-rate-limit-max 300 --api-rate-limit-window 60 \
55
+ --auth-rate-limit-max 100 --auth-rate-limit-window 10 \
56
+ --api-key-rate-limit-max 1000 --api-key-rate-limit-window 3600 \
57
+ --no-demo-seed --non-interactive --yes
58
+ biaws instance status smoke
59
+ biaws instance stop smoke
60
+ biaws instance start smoke
61
+ ```
62
+
63
+ ## Backup, restore e remoção
64
+
65
+ Os comandos oclif usam o archive portátil existente sem colocar a senha em
66
+ `argv`:
67
+
68
+ ```bash
69
+ biaws instance backup alpha --password-file /caminho/privado/senha
70
+ biaws instance restore beta --archive ./alpha.tar.gz.enc --password-file /caminho/privado/senha --yes
71
+ biaws instance remove beta --yes
72
+ ```
73
+
74
+ Em TTY, a senha pode ser solicitada de forma mascarada. Restore e remove
75
+ exigem o nome da instância como confirmação; em automação, `--yes` é
76
+ obrigatório. A remoção preserva bind mounts externos por padrão e só os apaga
77
+ com `--delete-external-data`.
78
+
79
+ O restore valida checksum, descriptografia, versão e entradas do tar antes de
80
+ substituir dados. Portas, URLs e caminhos de storage do destino são
81
+ preservados. Em falhas após a pausa, o mecanismo tenta recompor os serviços e
82
+ mantém o erro original como evidência.
@@ -0,0 +1,105 @@
1
+ # Publicação, migração e rollback do CLI
2
+
3
+ ## Publicar no npm
4
+
5
+ O pacote sem escopo chama-se `biaws`; o executável instalado também se chama
6
+ `biaws`. Antes de publicar, autentique a conta que controla o pacote:
7
+
8
+ ```bash
9
+ npm login
10
+ npm whoami
11
+ ```
12
+
13
+ Da raiz do repositório, valide testes, metadados, shebang e o conteúdo que seria
14
+ empacotado. Este é o modo padrão e não altera o registro npm:
15
+
16
+ ```bash
17
+ ./scripts/publish-biaws-cli.sh
18
+ ```
19
+
20
+ Revise a lista do `npm pack --dry-run`, atualize `version` em `package.json` e
21
+ `package-lock.json`, mantenha a árvore Git limpa e só então publique:
22
+
23
+ ```bash
24
+ ./scripts/publish-biaws-cli.sh --publish
25
+ ```
26
+
27
+ O script exige autenticação, recusa árvore suja, confirma que a versão ainda
28
+ retorna 404 no registro e executa toda a verificação novamente. MFA continua
29
+ sob controle do próprio npm; não passe OTP por arquivo versionado ou argumento
30
+ de outro wrapper. O nome disponível hoje ainda não fica reservado até a
31
+ primeira publicação bem-sucedida.
32
+
33
+ ## Validar uma instalação limpa
34
+
35
+ O CI empacota e instala o tarball em prefixo isolado no Node.js 20.19 e 22, em
36
+ Linux e macOS. O ensaio manual equivalente é:
37
+
38
+ ```bash
39
+ cd biaws-cli
40
+ package_file="$(npm pack --pack-destination /tmp)"
41
+ npm install --global --prefix /tmp/biaws-global "/tmp/${package_file}"
42
+ /tmp/biaws-global/bin/biaws --help
43
+ /tmp/biaws-global/bin/biaws --version
44
+ ```
45
+
46
+ Não use um prefixo real nesse ensaio: isso evita substituir outra instalação
47
+ global. Depois da publicação, confirme também `npx biaws@<versão> --help`.
48
+
49
+ ## Compatibilidade e migração
50
+
51
+ O shebang canônico está em `biaws-cli/bin/biaws.js`. O pacote npm cria o comando
52
+ `biaws`; no checkout, `npm --prefix biaws-cli link` oferece a mesma experiência.
53
+ O antigo `node biaws-cli/src/index.js ...` continua funcional durante a série
54
+ `0.x`, mas documentação e automações novas devem usar `biaws ...`.
55
+
56
+ Os wrappers públicos preservados são:
57
+
58
+ - `scripts/setup-local.sh`: setup co-localizado seguido de configuração;
59
+ - `scripts/setup-client.sh`: configuração de um cliente remoto;
60
+ - `scripts/configure.sh`: adapter legado para `biaws agent configure/doctor`.
61
+
62
+ Esses wrappers usam `scripts/run-biaws-cli.sh`, que fixa `BIAWS_ROOT` no
63
+ checkout e executa o entrypoint com shebang. Em um clone limpo, ele instala
64
+ somente as dependências de produção do CLI antes da primeira configuração.
65
+
66
+ Os scripts `setup-server.sh`, `backup-instance.sh`, `restore-instance.sh` e
67
+ `remove-instance.sh` são engines operacionais invocados pelos comandos oclif;
68
+ não são aliases circulares. A remoção dos wrappers públicos só pode ocorrer
69
+ após aviso de depreciação em uma release `0.x`, telemetria ou evidência de
70
+ adoção e um runbook de substituição atualizado.
71
+
72
+ O pacote npm isolado cobre ajuda e API remota. Instância, MCP e catálogo local
73
+ dependem do checkout completo; defina `BIAWS_ROOT` para sua raiz quando o
74
+ executável global for chamado fora dela.
75
+
76
+ ## Exercício de release
77
+
78
+ Antes de marcar uma release, use credenciais descartáveis e execute, nesta
79
+ ordem, em uma instância isolada:
80
+
81
+ 1. `biaws --help` e `biaws --version` pela instalação empacotada;
82
+ 2. `biaws instance setup` e `biaws configure codex|claude` com `BIAWS_ROOT`;
83
+ 3. uma consulta `workspaces list --json` e outra por código, como
84
+ `demands get <código> --json`;
85
+ 4. uma escrita idempotente com `demands task-status ... --yes --json`, seguida
86
+ de nova leitura;
87
+ 5. `biaws instance backup`, restore em uma instância de destino e validação de
88
+ API/UI;
89
+ 6. `biaws instance remove <destino> --yes`, preservando dados externos salvo
90
+ autorização explícita.
91
+
92
+ Capture somente códigos de saída, envelopes sanitizados e checksums. Não grave
93
+ `.env`, API keys, senhas, cookies, arquivos de password, chaves mestras ou
94
+ archives em snapshots, fixtures, logs ou artefatos de CI.
95
+
96
+ ## Rollback
97
+
98
+ `npm deprecate biaws@<versão> "mensagem"` é preferível a `npm unpublish`, que
99
+ quebra instalações reproduzíveis. Publique uma versão corretiva e fixe
100
+ temporariamente a última versão saudável (`npm install -g biaws@<versão>`).
101
+ Se o problema afetar somente o launcher, o comando legado
102
+ `node biaws-cli/src/index.js ...` permanece como fallback no checkout.
103
+
104
+ Não reverta dados de instância junto com o pacote CLI. Para mudanças de runtime
105
+ ou dados, siga o backup e rollback de `docs/operations.md` do repositório.