jarvis-ai-framework 8.3.0 → 8.5.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.
- package/AGENTS.md +42 -100
- package/README.md +2 -2
- package/agents/README.md +1 -0
- package/agents/engineering/data/eng.data-engineer.agent.md +8 -44
- package/agents/engineering/eng.agent.md +5 -80
- package/agents/engineering/eng.bug-hunter.md +1 -10
- package/agents/engineering/eng.dev-code-reviewer.md +1 -1
- package/agents/engineering/eng.docs-writer.md +6 -87
- package/agents/engineering/eng.rpa.agent.md +6 -30
- package/agents/engineering/qa/eng.qa.test-architect.md +1 -33
- package/agents/engineering/qa/eng.qa.test-planner.md +3 -143
- package/agents/engineering/qa/eng.qa.testing-engineer.md +4 -53
- package/bin/README.md +1 -1
- package/bin/commands/init.js +86 -7
- package/bin/commands/rules.js +136 -0
- package/bin/lib/cli/program.js +9 -0
- package/bin/lib/config/constants.js +59 -38
- package/bin/lib/core/docs-migrate.js +2 -2
- package/bin/lib/core/env-upgrade.js +114 -15
- package/bin/lib/core/profile-filter.js +4 -9
- package/bin/lib/core/scanner.js +10 -4
- package/bin/lib/core/sync-engine.js +183 -50
- package/bin/lib/utils/frontmatter.js +36 -2
- package/package.json +2 -2
- package/rules/artifact-style-rules.md +1 -1
- package/rules/company-overlay-rules.md +0 -4
- package/rules/engineering/eng-rules.md +0 -4
- package/rules/engineering/eng-security-rules.md +1 -34
- package/rules/engineering/eng.integrations-rules.md +2 -2
- package/rules/engineering/eng.skills-rules.md +1 -1
- package/rules/engineering/eng.specializations-rules.md +1 -1
- package/rules/engineering/frontend/eng.frontend-rules.md +0 -3
- package/rules/engineering/qa/eng.qa.cypress-standards-rules.md +2 -256
- package/rules/product/prod-rules.md +9 -54
- package/rules/product/prod.spec-rules.md +1 -0
- package/rules/rtk-rules.md +0 -4
- package/rules-on-demand/engineering/eng.breakdown-subtasks-rules.md +3 -199
- package/{rules → rules-on-demand}/engineering/eng.bump-rules.md +0 -6
- package/rules-on-demand/engineering/eng.gate0-rules.md +56 -0
- package/rules-on-demand/engineering/eng.plan-rules.md +2 -49
- package/rules-on-demand/engineering/eng.pr-rules.md +29 -150
- package/rules-on-demand/engineering/eng.pre-pr-rules.md +5 -50
- package/{rules/engineering/rpa → rules-on-demand/engineering}/eng.rpa-rules.md +46 -10
- package/rules-on-demand/engineering/eng.security-rules.md +36 -0
- package/rules-on-demand/engineering/eng.start-rules.md +9 -3
- package/rules-on-demand/engineering/eng.tech-spec-rules.md +28 -473
- package/rules-on-demand/engineering/eng.transitions-rules.md +2 -1
- package/rules-on-demand/engineering/eng.work-rules.md +1 -48
- package/rules-on-demand/engineering/qa/eng.qa.cypress-standards-rules.md +259 -0
- package/rules-on-demand/product/prod.spec-common-rules.md +39 -0
- package/skills/AGENTS.md +12 -8
- package/skills/SKILLS-ROADMAP.md +16 -18
- package/skills/eng-ai/SKILL.md +5 -9
- package/skills/eng-automation/SKILL.md +7 -11
- package/skills/eng-backend/SKILL.md +4 -8
- package/skills/eng-backend-arch-c4/SKILL.md +18 -82
- package/skills/eng-backend-arch-c4/references/1-nivel-context.md +16 -0
- package/skills/eng-backend-arch-c4/references/2-nivel-container.md +17 -0
- package/skills/eng-backend-arch-c4/references/3-nivel-component.md +15 -0
- package/skills/eng-backend-arch-c4/references/4-nivel-code.md +12 -0
- package/skills/eng-backend-arch-c4/references/5-atualizacao-e-adrs.md +27 -0
- package/skills/eng-backend-microservices-trace/SKILL.md +4 -6
- package/skills/eng-backend-nestjs/SKILL.md +8 -57
- package/skills/eng-backend-nestjs/references/5-testes.md +13 -0
- package/skills/eng-backend-nestjs/references/6-problemas-comuns.md +37 -0
- package/skills/eng-data/SKILL.md +6 -10
- package/skills/eng-frontend/SKILL.md +6 -9
- package/skills/eng-global-branch/SKILL.md +124 -0
- package/skills/eng-global-docs-write/SKILL.md +1 -1
- package/skills/eng-global-investigation/SKILL.md +5 -6
- package/skills/eng-global-pr/SKILL.md +3 -17
- package/skills/eng-global-task-comment/SKILL.md +5 -2
- package/skills/eng-global-tech-spec/SKILL.md +4 -6
- package/skills/eng-global-tech-spec/references/delivery-spec.md +11 -179
- package/skills/eng-platform/SKILL.md +8 -14
- package/skills/eng-qa/SKILL.md +6 -11
- package/skills/eng-qa-planner/SKILL.md +0 -1
- package/skills/jarvis-context-detect/SKILL.md +29 -2
- package/skills/jarvis-context-detect/assets/context-profile-template.md +1 -1
- package/{templates → skills/jarvis-context-detect/references}/cdd-aplicado-a-prompts.md +1 -1
- package/skills/jarvis-context-detect/references/eng.work.md +28 -0
- package/skills/jarvis-create-specialization/SKILL.md +5 -9
- package/skills/jarvis-docs-central/SKILL.md +1 -2
- package/skills/jarvis-docs-index/SKILL.md +1 -1
- package/skills/jarvis-evolution-architect/SKILL.md +1 -2
- package/skills/jarvis-fork/SKILL.md +6 -11
- package/skills/jarvis-init/SKILL.md +28 -370
- package/skills/jarvis-init/assets/exemplo-execucao.md +46 -0
- package/skills/jarvis-init/assets/mcp-configs.md +0 -91
- package/skills/jarvis-init/assets/rules-sync-manual.md +100 -0
- package/skills/jarvis-init/assets/setup-guide.md +0 -1
- package/skills/jarvis-init/assets/upgrade.md +46 -0
- package/skills/jarvis-init/assets/validacoes.md +56 -0
- package/skills/jarvis-list-specializations/SKILL.md +4 -8
- package/skills/jarvis-report-issue/SKILL.md +1 -2
- package/skills/product-roadmap-report/SKILL.md +3 -2
- package/skills/product-specs/SKILL.md +1 -3
- package/skills/product-specs-update/SKILL.md +0 -1
- package/templates/AGENTS.md +9 -3
- package/templates/ENV-template.md +0 -57
- package/templates/engineering/AGENTS-template.md +0 -1
- package/templates/engineering/breakdown-subtasks-template.md +76 -447
- package/templates/engineering/data-contract-template.md +2 -2
- package/templates/engineering/qa/qa.test-coverage-report-template.md +62 -0
- package/templates/engineering/qa/qa.test-strategy-template.md +41 -0
- package/templates/engineering/qa/qa.test-suite-report-template.md +27 -0
- package/workflows/AGENTS.md +27 -36
- package/workflows/README.md +2 -11
- package/workflows/engineering/data/data.contract.md +1 -5
- package/workflows/engineering/data/data.new-pipeline.md +2 -6
- package/workflows/engineering/eng.breakdown-subtasks.md +8 -238
- package/workflows/engineering/eng.build-tech-spec.md +0 -2
- package/workflows/engineering/eng.create-ard-from-code.md +0 -2
- package/workflows/engineering/eng.create-ard.md +2 -7
- package/workflows/engineering/eng.create-rfc.md +2 -4
- package/workflows/engineering/eng.daily-report.md +0 -2
- package/workflows/engineering/eng.debug.md +1 -5
- package/workflows/engineering/eng.docs.md +1 -4
- package/workflows/engineering/eng.light-arch.md +0 -3
- package/workflows/engineering/eng.plan.md +1 -3
- package/workflows/engineering/eng.pr.md +8 -36
- package/workflows/engineering/eng.pre-pr.md +15 -7
- package/workflows/engineering/eng.review.md +0 -4
- package/workflows/engineering/eng.rpa.robot.md +4 -6
- package/workflows/engineering/eng.spec-consolidate.md +0 -2
- package/workflows/engineering/eng.start.md +14 -84
- package/workflows/engineering/eng.work.md +10 -149
- package/workflows/engineering/frontend/eng.frontend-component.md +1 -5
- package/workflows/engineering/frontend/eng.frontend-perf-audit.md +1 -4
- package/workflows/engineering/frontend/eng.frontend-review.md +1 -5
- package/workflows/engineering/qa/eng.qa-refinement-entry.md +0 -2
- package/workflows/engineering/qa/eng.qa-release-signoff.md +0 -3
- package/workflows/engineering/qa/eng.qa-sprint-planning.md +0 -4
- package/workflows/product/prod.roadmap.preview.md +0 -3
- package/workflows/product/prod.spec.ard.md +1 -4
- package/workflows/product/prod.spec.breakdown.md +4 -11
- package/workflows/product/prod.spec.clarify.md +1 -4
- package/workflows/product/prod.spec.discovery.md +1 -4
- package/workflows/product/prod.spec.epic.md +4 -18
- package/workflows/product/prod.spec.frd.md +5 -31
- package/workflows/product/prod.spec.issue.md +2 -3
- package/workflows/product/prod.spec.md +0 -3
- package/workflows/product/prod.spec.prd.md +6 -36
- package/workflows/warm-up.md +1 -4
- package/rules/AGENTS.md +0 -227
- package/rules/engineering/data/data-rules.md +0 -200
- package/rules/engineering/eng.docs-scraping-rules.md +0 -64
- package/rules/product/README.md +0 -27
- package/skills/eng-backend-rabbitmq/SKILL.md +0 -380
- package/skills/eng-backend-rabbitmq/references/1-referencia-endpoints.md +0 -28
- package/skills/eng-backend-rabbitmq/references/2-codigo-consumer-producer.md +0 -90
- package/skills/eng-backend-rabbitmq/references/3-arquiteturas-comuns.md +0 -101
- package/skills/eng-backend-rabbitmq/references/4-troubleshooting.md +0 -93
- package/skills/product-roadmap-report/rules/detailed-guide.md +0 -237
- package/templates/engineering/CONTACTS-template.md +0 -135
- package/templates/engineering/swagger-template.md +0 -145
- package/workflows/all-tools.md +0 -17
package/bin/lib/cli/program.js
CHANGED
|
@@ -24,6 +24,7 @@ import { docsSync } from "../../commands/docs-sync.js";
|
|
|
24
24
|
import { docsPublish } from "../../commands/docs-publish.js";
|
|
25
25
|
import { installRtk } from "../../commands/install-rtk.js";
|
|
26
26
|
import { tokens } from "../../commands/tokens.js";
|
|
27
|
+
import { rulesSync } from "../../commands/rules.js";
|
|
27
28
|
import { map } from "../../commands/map.js";
|
|
28
29
|
import { fork } from "../../commands/fork.js";
|
|
29
30
|
import { dailyReport } from "../../commands/daily-report.js";
|
|
@@ -178,6 +179,14 @@ export function buildProgram() {
|
|
|
178
179
|
.option("--env-file <path>")
|
|
179
180
|
.action((options) => tokens(toLegacyFlags(options)));
|
|
180
181
|
|
|
182
|
+
const rules = cmd(program, "rules").description("Rules da pasta da IDE");
|
|
183
|
+
const rulesSyncCmd = cmd(rules, "sync").description(
|
|
184
|
+
"Filtrar rules/ e rules-on-demand/ da IDE pelo perfil do ENV.md (Passo 8 do /jarvis-init)"
|
|
185
|
+
);
|
|
186
|
+
withEnvOptions(withLogOptions(rulesSyncCmd)).action((options) =>
|
|
187
|
+
rulesSync(toLegacyFlags(options))
|
|
188
|
+
);
|
|
189
|
+
|
|
181
190
|
cmd(program, "fork")
|
|
182
191
|
.description(
|
|
183
192
|
"Overlay de empresa: copia um artefato do core para $IDE/overlays/{COMPANY_PROFILE}/, com carimbo"
|
|
@@ -83,6 +83,9 @@ export const OBSOLETE_PATHS = Object.freeze([
|
|
|
83
83
|
"rules/engineering/eng.pre-pr-rules.md",
|
|
84
84
|
"rules/engineering/eng.tech-spec-rules.md",
|
|
85
85
|
"rules/engineering/eng.breakdown-subtasks-rules.md",
|
|
86
|
+
"rules/engineering/eng.bump-rules.md",
|
|
87
|
+
"rules/engineering/eng.docs-scraping-rules.md",
|
|
88
|
+
"rules/engineering/rpa",
|
|
86
89
|
// Consolidação de QA (removidos): área QA ficou só com eng-qa (base) e eng-qa-planner
|
|
87
90
|
"skills/eng-qa-test-plan",
|
|
88
91
|
"skills/eng-qa-gate",
|
|
@@ -143,8 +146,64 @@ export const OBSOLETE_PATHS = Object.freeze([
|
|
|
143
146
|
"skills/eng-frontend-microfrontend",
|
|
144
147
|
// eng.bug-audit (removido): virou o caso "varrer" do /eng.debug (#168)
|
|
145
148
|
"workflows/engineering/eng.bug-audit.md",
|
|
149
|
+
// eng-backend-rabbitmq e data-rules (removidos na limpeza do ENV.md, #209): o skill operava o
|
|
150
|
+
// broker pelas variáveis MESSAGE_BROKER_*; a rule fixava uma stack de dados que a base eng-data
|
|
151
|
+
// já cobre de forma neutra. No Kiro, a rule vira steering/{nome} e o skill, steering/skills/.
|
|
152
|
+
"skills/eng-backend-rabbitmq",
|
|
153
|
+
"steering/skills/skill-eng-backend-rabbitmq.md",
|
|
154
|
+
"rules/engineering/data/data-rules.md",
|
|
155
|
+
"steering/data-rules.md",
|
|
156
|
+
// Cópias do Kiro (steering/{nome}) das rules que saíram de rules/ no #133 (bump e rpa, com a
|
|
157
|
+
// docs-scraping fundida); rules-on-demand/ não vira steering, então nada válido tem esses nomes.
|
|
158
|
+
"steering/eng.bump-rules.md",
|
|
159
|
+
"steering/eng.docs-scraping-rules.md",
|
|
160
|
+
"steering/eng.rpa-rules.md",
|
|
161
|
+
// rules/AGENTS.md e rules/product/README.md (issue #84): conteúdo de autoria movido
|
|
162
|
+
// para docs/estrutura/rules.md; rules/product/README.md era órfão, sem referências
|
|
163
|
+
"rules/AGENTS.md",
|
|
164
|
+
"rules/product/README.md",
|
|
165
|
+
// Documentação de pasta e all-tools (issue #89): deixaram de ser copiados para a IDE (ver
|
|
166
|
+
// SYNC_EXCLUDE). O nome da pasta de workflows varia por IDE (commands, workflows, steering).
|
|
167
|
+
"commands/AGENTS.md",
|
|
168
|
+
"commands/README.md",
|
|
169
|
+
"commands/all-tools.md",
|
|
170
|
+
"workflows/AGENTS.md",
|
|
171
|
+
"workflows/README.md",
|
|
172
|
+
"workflows/all-tools.md",
|
|
173
|
+
"steering/AGENTS.md",
|
|
174
|
+
"steering/README.md",
|
|
175
|
+
"steering/all-tools.md",
|
|
176
|
+
"skills/AGENTS.md",
|
|
177
|
+
"skills/SKILLS-ROADMAP.md",
|
|
178
|
+
"skills/jarvis-docs-central/README.md",
|
|
179
|
+
"skills/product-roadmap-report/README.md",
|
|
180
|
+
"agents/AGENTS.md",
|
|
181
|
+
"agents/README.md",
|
|
182
|
+
// product-roadmap-report (issue #91): rules/detailed-guide.md era cópia de references/detailed-guide.md
|
|
183
|
+
// (a mantida), com uma linha de plugin externo inexistente
|
|
184
|
+
"skills/product-roadmap-report/rules/detailed-guide.md",
|
|
185
|
+
// templates sem consumidor (issue #92): swagger e CONTACTS apagados; o ensaio CDD foi para
|
|
186
|
+
// skills/jarvis-context-detect/references/
|
|
187
|
+
"templates/engineering/swagger-template.md",
|
|
188
|
+
"templates/engineering/CONTACTS-template.md",
|
|
189
|
+
"templates/cdd-aplicado-a-prompts.md",
|
|
146
190
|
]);
|
|
147
191
|
|
|
192
|
+
/**
|
|
193
|
+
* Arquivos de documentação de pasta que ficam só no repositório do framework e não são
|
|
194
|
+
* copiados para a IDE. Por pasta de `SYNC_DIRS`, expressões aplicadas ao caminho relativo
|
|
195
|
+
* (com `/`) dentro dela. `workflows/` vira `commands/` ou `steering/` conforme a IDE e é
|
|
196
|
+
* achatado depois da cópia; barrar na origem evita que um README aninhado sobrescreva outro.
|
|
197
|
+
* Em `skills/` todo `*.md` da raiz sai (skill é sempre uma pasta); em `agents/` só os nomes de
|
|
198
|
+
* documentação, porque um agent pode ficar direto na raiz da pasta.
|
|
199
|
+
* @constant {Readonly<Record<string, ReadonlyArray<RegExp>>>}
|
|
200
|
+
*/
|
|
201
|
+
export const SYNC_EXCLUDE = Object.freeze({
|
|
202
|
+
workflows: Object.freeze([/(^|\/)(AGENTS|README)\.md$/]),
|
|
203
|
+
skills: Object.freeze([/^[^/]+\.md$/, /^[^/]+\/README\.md$/]),
|
|
204
|
+
agents: Object.freeze([/^(AGENTS|README)\.md$/]),
|
|
205
|
+
});
|
|
206
|
+
|
|
148
207
|
/**
|
|
149
208
|
* Arquivos da raiz que devem ser sincronizados
|
|
150
209
|
* @constant {ReadonlyArray<string>}
|
|
@@ -193,44 +252,6 @@ export const OPENCODE_DEFAULT_PERMISSIONS = Object.freeze({
|
|
|
193
252
|
task: "allow",
|
|
194
253
|
});
|
|
195
254
|
|
|
196
|
-
/**
|
|
197
|
-
* Campos de frontmatter Jarvis-only que devem ser removidos para OpenCode commands
|
|
198
|
-
* @constant {ReadonlyArray<string>}
|
|
199
|
-
*/
|
|
200
|
-
export const OPENCODE_STRIP_FIELDS = Object.freeze([
|
|
201
|
-
"auto_execution_mode",
|
|
202
|
-
"rules_file",
|
|
203
|
-
"template_file",
|
|
204
|
-
"model_tier",
|
|
205
|
-
"model_justification",
|
|
206
|
-
"recommended_model",
|
|
207
|
-
"env_file",
|
|
208
|
-
"globs",
|
|
209
|
-
]);
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Campos de frontmatter Jarvis-only que devem ser removidos para steering files Kiro
|
|
213
|
-
* @constant {ReadonlyArray<string>}
|
|
214
|
-
*/
|
|
215
|
-
export const KIRO_STRIP_FIELDS = Object.freeze([
|
|
216
|
-
"trigger",
|
|
217
|
-
"auto_execution_mode",
|
|
218
|
-
"rules_file",
|
|
219
|
-
"template_file",
|
|
220
|
-
"model_tier",
|
|
221
|
-
"model_justification",
|
|
222
|
-
"recommended_model",
|
|
223
|
-
"env_file",
|
|
224
|
-
"globs",
|
|
225
|
-
"agent",
|
|
226
|
-
"allowed-tools",
|
|
227
|
-
"disable-model-invocation",
|
|
228
|
-
"compatibility",
|
|
229
|
-
"license",
|
|
230
|
-
"metadata",
|
|
231
|
-
"argument-hint",
|
|
232
|
-
]);
|
|
233
|
-
|
|
234
255
|
/**
|
|
235
256
|
* Mapeamento de HUB Jarvis para fileMatchPattern do Kiro
|
|
236
257
|
* Usado para gerar steering files de rules com inclusion: fileMatch
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Documentos de trabalho nos caminhos antigos → docs/jarvis/… (`jarvis init --upgrade`).
|
|
2
|
-
// Mesmas regras do item
|
|
2
|
+
// Mesmas regras do item 7 do Upgrade (C) do skill jarvis-init: conflito no destino pula,
|
|
3
3
|
// pasta antiga removida só se ficar vazia, `git mv` quando versionado, `related_discovery`
|
|
4
4
|
// reescrito pelo nome do arquivo e, na recusa, só chaves novas recebem o caminho antigo.
|
|
5
5
|
import {
|
|
@@ -73,7 +73,7 @@ function listFiles(dir) {
|
|
|
73
73
|
return files;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
/** Pares pasta antiga → pasta nova, na ordem do item
|
|
76
|
+
/** Pares pasta antiga → pasta nova, na ordem do item 7 + discoveries. */
|
|
77
77
|
function sourcePairs(f) {
|
|
78
78
|
const pairs = [
|
|
79
79
|
{ from: `${f.docs}/product`, to: f.prod, discoveriesSub: true },
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// Upgrade do ENV.md (`jarvis init --upgrade`): acrescenta as chaves do template que faltam.
|
|
2
2
|
// Regra: só acrescenta. Nenhuma chave existente muda, preenchida, vazia ou com lista de opções.
|
|
3
|
-
//
|
|
3
|
+
// Exceções declaradas (automáticas): `JARVIS_PROJECT=` vazio recebe o valor oficial do template, e
|
|
4
|
+
// as chaves de REMOVED_KEYS (blocos que saíram do template, #209) são apagadas, sem ler o valor.
|
|
4
5
|
// As outras exceções (CENTRAL_DOCS_LOCATION e esvaziar o TOKEN_TASK_MANAGER) pedem confirmação
|
|
5
|
-
// e ficam no Upgrade (C) do skill jarvis-init (item
|
|
6
|
+
// e ficam no Upgrade (C) do skill jarvis-init (item 8). Mesmas regras dos itens 3, 4, 8, 9 e 10.
|
|
6
7
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
7
8
|
import { detectWorkspaceMode } from "./workspace-mode.js";
|
|
8
9
|
import { getVendor } from "../integrations/cli-runner.js";
|
|
@@ -31,11 +32,55 @@ function isOptionList(value) {
|
|
|
31
32
|
return /^\[.*\]$/.test(value);
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
// Blocos que saíram do template (#209): o upgrade apaga as chaves e, quando o bloco fica vazio,
|
|
36
|
+
// a moldura dele. Os comentários são os do template na época; moldura diferente fica.
|
|
37
|
+
const REMOVED_BLOCKS = Object.freeze([
|
|
38
|
+
{
|
|
39
|
+
title: "Mensageria (opcional)",
|
|
40
|
+
keys: ["MESSAGE_BROKER", "MESSAGE_BROKER_URL_API", "MESSAGE_BROKER_API_AUTH"],
|
|
41
|
+
comments: [],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
title: "Banco de dados (opcional)",
|
|
45
|
+
keys: ["DATABASE", "USER_DATABASE", "PASSWORD_DATABASE", "HOST_DATABASE", "PORT_DATABASE"],
|
|
46
|
+
comments: [],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
title: "Observabilidade (opcional)",
|
|
50
|
+
keys: ["OBSERVABILITY", "TOKEN_OBSERVABILITY", "OBSERVABILITY_ORG"],
|
|
51
|
+
comments: [],
|
|
52
|
+
},
|
|
53
|
+
{ title: "SMTP (opcional)", keys: ["SMTP"], comments: [] },
|
|
54
|
+
{
|
|
55
|
+
title: "Data Engineering (só se HUB=DATA)",
|
|
56
|
+
keys: [
|
|
57
|
+
"DATA_ORCHESTRATOR",
|
|
58
|
+
"DATA_ETL_TOOL",
|
|
59
|
+
"DATA_QUALITY_TOOL",
|
|
60
|
+
"DATA_LAKE",
|
|
61
|
+
"DATA_QUERY_ENGINE",
|
|
62
|
+
"DATA_BI_TOOL",
|
|
63
|
+
"DATA_WAREHOUSE",
|
|
64
|
+
"DATA_REPO",
|
|
65
|
+
],
|
|
66
|
+
comments: [
|
|
67
|
+
"# Obrigatório quando HUB=DATA. Omitir o bloco inteiro se o HUB for outro.",
|
|
68
|
+
"# Vazio se não houver warehouse dedicado.",
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
title: "Code quality (opcional)",
|
|
73
|
+
keys: ["CODE_QUALITY_TOOL", "CODE_QUALITY_URL", "CODE_QUALITY_TOKEN"],
|
|
74
|
+
comments: [
|
|
75
|
+
"# Análise estática / quality gate. Em branco = sem MCP de code quality.",
|
|
76
|
+
"# URL da instância (self-hosted).",
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
]);
|
|
80
|
+
|
|
81
|
+
export const REMOVED_KEYS = Object.freeze(REMOVED_BLOCKS.flatMap((b) => b.keys));
|
|
82
|
+
|
|
83
|
+
const SEPARATOR = /^#\s*=+\s*$/;
|
|
39
84
|
|
|
40
85
|
// Chave existente e vazia que o upgrade preenche com o valor do template (exceção automática).
|
|
41
86
|
const FILL_WHEN_EMPTY = ["JARVIS_PROJECT"];
|
|
@@ -48,15 +93,15 @@ const AXES = ["TASK_MANAGER", "VERSION_CONTROL"];
|
|
|
48
93
|
* @param {string} envText
|
|
49
94
|
* @param {string} templateText
|
|
50
95
|
* @param {{ workspaceDir?: string }} [options] - `workspaceDir`: pasta que contém o `$IDE/`, para detectar o `WORKSPACE_MODE`
|
|
51
|
-
* @returns {{ added: {key: string, value: string}[], filled: {key: string, value: string}[], pending: string[], warnings: string[] }}
|
|
96
|
+
* @returns {{ added: {key: string, value: string}[], filled: {key: string, value: string}[], removed: string[], pending: string[], warnings: string[] }}
|
|
52
97
|
* `filled`: chaves existentes e vazias preenchidas com o valor do template (só `JARVIS_PROJECT`).
|
|
98
|
+
* `removed`: chaves de REMOVED_KEYS presentes no ENV, que o upgrade apaga (só nomes).
|
|
53
99
|
* `pending` e `warnings` trazem só nomes de chave, nunca valores do ENV
|
|
54
100
|
* (exceto o nome do vendor não suportado, em `UNSUPPORTED:{CHAVE}:{vendor}`).
|
|
55
101
|
*/
|
|
56
102
|
export function planEnvUpgrade(envText, templateText, { workspaceDir } = {}) {
|
|
57
103
|
const env = parseEnvEntries(envText);
|
|
58
104
|
const template = parseEnvEntries(templateText);
|
|
59
|
-
const hub = (env.get("HUB") || "").toUpperCase();
|
|
60
105
|
const area = (env.get("AREA") || "").toUpperCase();
|
|
61
106
|
|
|
62
107
|
const added = [];
|
|
@@ -65,8 +110,7 @@ export function planEnvUpgrade(envText, templateText, { workspaceDir } = {}) {
|
|
|
65
110
|
const warnings = [];
|
|
66
111
|
|
|
67
112
|
for (const [key, templateValue] of template) {
|
|
68
|
-
if (env.has(key)) continue;
|
|
69
|
-
if (hub !== "DATA" && isDataOnlyKey(key)) continue;
|
|
113
|
+
if (env.has(key) || REMOVED_KEYS.includes(key)) continue;
|
|
70
114
|
|
|
71
115
|
let value = isOptionList(templateValue) ? "" : templateValue;
|
|
72
116
|
if (key === "PROD_MODE") {
|
|
@@ -87,6 +131,8 @@ export function planEnvUpgrade(envText, templateText, { workspaceDir } = {}) {
|
|
|
87
131
|
|
|
88
132
|
if (env.has("PROD_MODE") && !env.get("PROD_MODE")) pending.push("PROD_MODE");
|
|
89
133
|
|
|
134
|
+
const removed = [...env.keys()].filter((key) => REMOVED_KEYS.includes(key));
|
|
135
|
+
|
|
90
136
|
for (const key of FILL_WHEN_EMPTY) {
|
|
91
137
|
const value = template.get(key);
|
|
92
138
|
if (env.has(key) && !env.get(key) && value && !isOptionList(value)) filled.push({ key, value });
|
|
@@ -106,22 +152,75 @@ export function planEnvUpgrade(envText, templateText, { workspaceDir } = {}) {
|
|
|
106
152
|
warnings.push("CENTRAL_DOCS_REPO");
|
|
107
153
|
}
|
|
108
154
|
|
|
109
|
-
return { added, filled, pending, warnings };
|
|
155
|
+
return { added, filled, removed, pending, warnings };
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Apaga do texto do ENV as linhas das chaves pedidas e, nos blocos de REMOVED_BLOCKS que ficaram
|
|
160
|
+
* vazios, a moldura (separador, título, separador), os comentários do template e as linhas em
|
|
161
|
+
* branco logo depois (no fim do arquivo, também as de antes). Moldura com outra coisa dentro
|
|
162
|
+
* (chave ou comentário próprio) fica. Nunca lê o valor das chaves: casa só o nome antes do `=`.
|
|
163
|
+
* @param {string} text
|
|
164
|
+
* @param {string[]} keys
|
|
165
|
+
* @returns {{ text: string, removed: string[] }} `removed`: as chaves que de fato saíram
|
|
166
|
+
*/
|
|
167
|
+
export function removeEnvKeys(text, keys) {
|
|
168
|
+
const wanted = new Set(keys);
|
|
169
|
+
const removed = [];
|
|
170
|
+
let lines = text.split("\n").filter((line) => {
|
|
171
|
+
const m = line.match(/^\s*([A-Z][A-Z0-9_]*)=/);
|
|
172
|
+
if (!m || !wanted.has(m[1])) return true;
|
|
173
|
+
if (!removed.includes(m[1])) removed.push(m[1]);
|
|
174
|
+
return false;
|
|
175
|
+
});
|
|
176
|
+
if (removed.length === 0) return { text, removed };
|
|
177
|
+
|
|
178
|
+
const bare = (line) => line.replace(/\r$/, "").trim();
|
|
179
|
+
// Só os blocos de onde saiu alguma chave: moldura vazia de outro bloco é escolha da pessoa.
|
|
180
|
+
for (const block of REMOVED_BLOCKS.filter((b) => b.keys.some((k) => removed.includes(k)))) {
|
|
181
|
+
const i = lines.findIndex(
|
|
182
|
+
(line, n) =>
|
|
183
|
+
bare(line) === `# ${block.title}` &&
|
|
184
|
+
SEPARATOR.test(bare(lines[n - 1] ?? "")) &&
|
|
185
|
+
SEPARATOR.test(bare(lines[n + 1] ?? ""))
|
|
186
|
+
);
|
|
187
|
+
if (i < 0) continue;
|
|
188
|
+
let j = i + 2;
|
|
189
|
+
while (j < lines.length && (bare(lines[j]) === "" || block.comments.includes(bare(lines[j])))) {
|
|
190
|
+
j++;
|
|
191
|
+
}
|
|
192
|
+
if (j < lines.length && !SEPARATOR.test(bare(lines[j]))) continue;
|
|
193
|
+
if (j < lines.length) {
|
|
194
|
+
lines = [...lines.slice(0, i - 1), ...lines.slice(j)];
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
// Bloco no fim do arquivo: tira também as linhas em branco antes dele e termina numa quebra só.
|
|
198
|
+
let end = i - 1;
|
|
199
|
+
while (end > 0 && bare(lines[end - 1]) === "") end--;
|
|
200
|
+
lines = [...lines.slice(0, end), ""];
|
|
201
|
+
}
|
|
202
|
+
return { text: lines.join("\n"), removed };
|
|
110
203
|
}
|
|
111
204
|
|
|
112
205
|
/**
|
|
113
|
-
* Grava as chaves novas no fim do ENV, num bloco datado,
|
|
114
|
-
* (linha `CHAVE=` vazia). Nenhuma outra linha
|
|
206
|
+
* Grava as chaves novas no fim do ENV, num bloco datado, preenche as chaves de `plan.filled`
|
|
207
|
+
* (linha `CHAVE=` vazia) e apaga as de `plan.removed` (`removeEnvKeys`). Nenhuma outra linha muda.
|
|
115
208
|
* `overrides` troca o valor de chaves novas (ex.: recusa em mover os discoveries).
|
|
116
209
|
* @returns {boolean} true se gravou
|
|
117
210
|
*/
|
|
118
211
|
export function applyEnvUpgrade(envPath, plan, today, overrides = {}) {
|
|
119
212
|
const filled = plan.filled || [];
|
|
120
|
-
|
|
213
|
+
const toRemove = plan.removed || [];
|
|
214
|
+
if (plan.added.length === 0 && filled.length === 0 && toRemove.length === 0) {
|
|
121
215
|
plan.filledApplied = [];
|
|
216
|
+
plan.removedApplied = [];
|
|
122
217
|
return false;
|
|
123
218
|
}
|
|
124
219
|
let text = readFileSync(envPath, "utf-8");
|
|
220
|
+
// `plan.removedApplied`: só as chaves que de fato saíram (para o resumo não mentir).
|
|
221
|
+
const removal = removeEnvKeys(text, toRemove);
|
|
222
|
+
text = removal.text;
|
|
223
|
+
plan.removedApplied = removal.removed;
|
|
125
224
|
// `plan.filledApplied`: só as chaves que de fato mudaram (para o resumo não mentir).
|
|
126
225
|
plan.filledApplied = [];
|
|
127
226
|
for (const { key, value } of filled) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Filtro de rules por perfil (bloco "Applies to").
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* `skills/jarvis-init/
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Usado por `jarvis tokens` e `jarvis rules sync` (Passo 8 do `/jarvis-init`). O fallback em
|
|
5
|
+
* prosa, para quando o CLI não está disponível, é `skills/jarvis-init/assets/rules-sync-manual.md`:
|
|
6
|
+
* ao mudar a lógica aqui, mude lá também. A documentação de autoria (hierarquia, convenções,
|
|
7
|
+
* estrutura de regra) vive em `docs/estrutura/rules.md`.
|
|
8
8
|
*
|
|
9
9
|
* Regras:
|
|
10
10
|
* - Os eixos (HUB, POSITION, AREA, SQUAD e o opcional ARTIFACT_STYLE) são combinados com AND.
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* - FULLCYCLE (HUB) satisfaz qualquer HUB.
|
|
15
15
|
* - GENERALIST (POSITION) satisfaz qualquer POSITION e qualquer AREA.
|
|
16
16
|
* - Arquivo sem bloco "Applies to" é universal.
|
|
17
|
-
* - `rules/AGENTS.md` nunca é filtrado.
|
|
18
17
|
* - `rtk-rules.md` só entra com RTK habilitado (opt-in).
|
|
19
18
|
* @module core/profile-filter
|
|
20
19
|
*/
|
|
@@ -115,10 +114,6 @@ export function listRulesForProfile(rulesDir, profile, opts = {}) {
|
|
|
115
114
|
const content = readFileSync(file, "utf-8");
|
|
116
115
|
const bytes = Buffer.byteLength(content, "utf-8");
|
|
117
116
|
|
|
118
|
-
if (rel === "AGENTS.md") {
|
|
119
|
-
result.push({ path: rel, bytes });
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
117
|
if (rel.endsWith("rtk-rules.md") && !opts.rtkEnabled) continue;
|
|
123
118
|
if (matchesProfile(parseAppliesTo(content), profile)) {
|
|
124
119
|
result.push({ path: rel, bytes });
|
package/bin/lib/core/scanner.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { getFrameworkRoot } from "../utils/paths.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
extractFrontmatterBlock,
|
|
6
|
+
parseFrontmatter,
|
|
7
|
+
readDescription,
|
|
8
|
+
} from "../utils/frontmatter.js";
|
|
5
9
|
|
|
6
10
|
function extractDeps(content) {
|
|
7
11
|
const deps = { rules: [], templates: [], skills: [], agents: [] };
|
|
@@ -37,11 +41,12 @@ function scanDir(dir, type) {
|
|
|
37
41
|
if (existsSync(skillFile)) {
|
|
38
42
|
const content = readFileSync(skillFile, "utf-8");
|
|
39
43
|
const fm = parseFrontmatter(content);
|
|
44
|
+
const description = readDescription(extractFrontmatterBlock(content));
|
|
40
45
|
results.push({
|
|
41
46
|
id: fm.name || entry.name,
|
|
42
47
|
type,
|
|
43
48
|
name: fm.name || entry.name,
|
|
44
|
-
description
|
|
49
|
+
description,
|
|
45
50
|
version: fm.version || "1.0.0",
|
|
46
51
|
deps: extractDeps(content),
|
|
47
52
|
path: skillFile,
|
|
@@ -59,13 +64,14 @@ function scanDir(dir, type) {
|
|
|
59
64
|
|
|
60
65
|
const content = readFileSync(fullPath, "utf-8");
|
|
61
66
|
const fm = parseFrontmatter(content);
|
|
67
|
+
const description = readDescription(extractFrontmatterBlock(content));
|
|
62
68
|
const id = entry.name.replace(".md", "");
|
|
63
69
|
|
|
64
70
|
results.push({
|
|
65
71
|
id,
|
|
66
72
|
type,
|
|
67
|
-
name:
|
|
68
|
-
description
|
|
73
|
+
name: description || id,
|
|
74
|
+
description,
|
|
69
75
|
model: fm.model || fm.recommended_model || "",
|
|
70
76
|
version: fm.version || "1.0.0",
|
|
71
77
|
deps: extractDeps(content),
|