jarvis-ai-framework 8.2.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 +43 -99
- package/README.md +13 -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 +4 -4
- package/bin/commands/fork.js +562 -0
- package/bin/commands/init.js +147 -7
- package/bin/commands/rules.js +136 -0
- package/bin/lib/cli/program.js +36 -0
- package/bin/lib/config/constants.js +59 -38
- package/bin/lib/core/company-profile.js +92 -0
- 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 +343 -47
- 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 +11 -0
- 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 +15 -8
- package/skills/SKILLS-ROADMAP.md +21 -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 +179 -0
- package/skills/jarvis-init/SKILL.md +31 -364
- 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 +11 -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 -226
- 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
|
@@ -5,23 +5,25 @@ import {
|
|
|
5
5
|
readdirSync,
|
|
6
6
|
renameSync,
|
|
7
7
|
readFileSync,
|
|
8
|
+
realpathSync,
|
|
8
9
|
writeFileSync,
|
|
9
10
|
rmSync,
|
|
10
11
|
} from "node:fs";
|
|
11
12
|
import { execSync } from "node:child_process";
|
|
12
|
-
import { join, relative, basename } from "node:path";
|
|
13
|
+
import { join, relative, basename, dirname, sep } from "node:path";
|
|
13
14
|
import { getFrameworkRoot } from "../utils/paths.js";
|
|
14
15
|
import { getIDEFolder } from "../config/ide-config.js";
|
|
15
|
-
import { extractFrontmatterBlock } from "../utils/frontmatter.js";
|
|
16
|
+
import { extractFrontmatterBlock, readDescription } from "../utils/frontmatter.js";
|
|
17
|
+
import { readCompanyProfile } from "./company-profile.js";
|
|
18
|
+
import { parseAppliesTo, matchesProfile } from "./profile-filter.js";
|
|
16
19
|
import {
|
|
17
20
|
SYNC_DIRS,
|
|
18
21
|
SYNC_ROOT_FILES,
|
|
22
|
+
SYNC_EXCLUDE,
|
|
19
23
|
OBSOLETE_PATHS,
|
|
20
24
|
LOCK_FILE,
|
|
21
25
|
OPENCODE_MODEL_MAP,
|
|
22
26
|
OPENCODE_DEFAULT_PERMISSIONS,
|
|
23
|
-
OPENCODE_STRIP_FIELDS,
|
|
24
|
-
KIRO_STRIP_FIELDS,
|
|
25
27
|
KIRO_HUB_FILE_PATTERNS,
|
|
26
28
|
} from "../config/constants.js";
|
|
27
29
|
|
|
@@ -34,11 +36,7 @@ function parseSkillFrontmatter(content) {
|
|
|
34
36
|
const fm = extractFrontmatterBlock(content);
|
|
35
37
|
if (fm === null) return null;
|
|
36
38
|
const name = (fm.match(/^name:\s*(.+)$/m) || [])[1]?.trim();
|
|
37
|
-
|
|
38
|
-
const descMatch = fm.match(/^description:\s*[>|]?\n?([\s\S]*?)(?=\n\S|\n---|Z)/m);
|
|
39
|
-
const description = descMatch
|
|
40
|
-
? descMatch[1].replace(/^\s+/gm, "").replace(/\n+/g, " ").trim()
|
|
41
|
-
: "";
|
|
39
|
+
const description = readDescription(fm);
|
|
42
40
|
return name ? { name, description } : null;
|
|
43
41
|
}
|
|
44
42
|
|
|
@@ -64,6 +62,18 @@ function generateCodexOpenAIYaml(skillsDir) {
|
|
|
64
62
|
}
|
|
65
63
|
}
|
|
66
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Indica se um arquivo de uma pasta de SYNC_DIRS fica de fora da cópia para a IDE
|
|
67
|
+
* (documentação de pasta, ver SYNC_EXCLUDE).
|
|
68
|
+
* @param {string} dir - Pasta de SYNC_DIRS (ex.: "workflows")
|
|
69
|
+
* @param {string} relPath - Caminho relativo à pasta, com `/` (vazio para a própria pasta)
|
|
70
|
+
* @returns {boolean}
|
|
71
|
+
*/
|
|
72
|
+
export function isExcludedFromSync(dir, relPath) {
|
|
73
|
+
const rules = SYNC_EXCLUDE[dir];
|
|
74
|
+
return rules ? rules.some((re) => re.test(relPath)) : false;
|
|
75
|
+
}
|
|
76
|
+
|
|
67
77
|
export function syncAssets(targetDir, ide, opts = {}) {
|
|
68
78
|
const frameworkRoot = getFrameworkRoot();
|
|
69
79
|
const ideDir = join(targetDir, `.${getIDEFolder(ide)}`);
|
|
@@ -86,7 +96,12 @@ export function syncAssets(targetDir, ide, opts = {}) {
|
|
|
86
96
|
|
|
87
97
|
try {
|
|
88
98
|
if (!opts.dryRun) {
|
|
89
|
-
cpSync(src, dest, {
|
|
99
|
+
cpSync(src, dest, {
|
|
100
|
+
recursive: true,
|
|
101
|
+
force: opts.force ?? true,
|
|
102
|
+
filter: (srcPath) =>
|
|
103
|
+
!isExcludedFromSync(dir, relative(src, srcPath).split(sep).join("/")),
|
|
104
|
+
});
|
|
90
105
|
}
|
|
91
106
|
result.copied.push(`${destDirName}/`);
|
|
92
107
|
} catch (err) {
|
|
@@ -94,6 +109,9 @@ export function syncAssets(targetDir, ide, opts = {}) {
|
|
|
94
109
|
}
|
|
95
110
|
}
|
|
96
111
|
|
|
112
|
+
// RuleResolver (#199): rules/ e rules-on-demand/ do overlay do perfil ativo por cima das do core.
|
|
113
|
+
applyRuleOverlay(ideDir, result, { dryRun: opts.dryRun });
|
|
114
|
+
|
|
97
115
|
// Copy root files to IDE folder
|
|
98
116
|
for (const file of SYNC_ROOT_FILES) {
|
|
99
117
|
const src = join(frameworkRoot, file);
|
|
@@ -116,10 +134,12 @@ export function syncAssets(targetDir, ide, opts = {}) {
|
|
|
116
134
|
}
|
|
117
135
|
}
|
|
118
136
|
|
|
119
|
-
// Flatten workflows subfolders — todas as IDEs requerem arquivos na raiz sem subpastas
|
|
137
|
+
// Flatten workflows subfolders — todas as IDEs requerem arquivos na raiz sem subpastas.
|
|
138
|
+
// No Kiro a pasta de workflows é a própria steering/, onde o transformKiroAssets grava
|
|
139
|
+
// steering/skills/: achatá-la no upgrade soltava os skill-*.md na raiz (#83).
|
|
120
140
|
const workflowsDest = join(ideDir, opts.workflowsFolder || "workflows");
|
|
121
141
|
if (existsSync(workflowsDest)) {
|
|
122
|
-
const moved = flattenDir(workflowsDest);
|
|
142
|
+
const moved = flattenDir(workflowsDest, undefined, ide === "kiro" ? ["skills"] : []);
|
|
123
143
|
if (moved > 0) result.copied.push(`(flatten) ${moved} workflows movidos para raiz`);
|
|
124
144
|
}
|
|
125
145
|
|
|
@@ -198,6 +218,281 @@ export function syncAssets(targetDir, ide, opts = {}) {
|
|
|
198
218
|
return result;
|
|
199
219
|
}
|
|
200
220
|
|
|
221
|
+
/** Pastas do overlay que a IDE carrega sozinha e por isso são resolvidas aqui, na instalação. */
|
|
222
|
+
const OVERLAY_RULE_DIRS = Object.freeze(["rules", "rules-on-demand"]);
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Como `collectMdFiles`, mas inclui links simbólicos para arquivo (o `Dirent` de um link não é
|
|
226
|
+
* `isFile()`), para o `realpath` decidir se o alvo está dentro do overlay. Link para pasta não é seguido.
|
|
227
|
+
*/
|
|
228
|
+
function collectOverlayFiles(dir, acc) {
|
|
229
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
230
|
+
const full = join(dir, entry.name);
|
|
231
|
+
if (entry.isDirectory()) collectOverlayFiles(full, acc);
|
|
232
|
+
else if ((entry.isFile() || entry.isSymbolicLink()) && entry.name.endsWith(".md"))
|
|
233
|
+
acc.push(full);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Linha `> Overlay: {perfil} (forked_from …)` logo depois do frontmatter (ou na primeira linha,
|
|
239
|
+
* sem frontmatter): quem abre `.{ide}/rules/` vê que a cópia veio do overlay e onde editar.
|
|
240
|
+
* @param {string} content - Conteúdo do arquivo do overlay (não é alterado lá)
|
|
241
|
+
* @param {string} profile
|
|
242
|
+
* @returns {string}
|
|
243
|
+
*/
|
|
244
|
+
export function withOverlayMarker(rawContent, profile) {
|
|
245
|
+
// CRLF (fork editado no Windows) vira LF: a IDE lê igual e o frontmatter é reconhecido.
|
|
246
|
+
const content = rawContent.replace(/\r\n?/g, "\n");
|
|
247
|
+
const block = extractFrontmatterBlock(content);
|
|
248
|
+
const forked = block === null ? null : /^forked_from:\s*(.+)$/m.exec(block);
|
|
249
|
+
const marker = `> Overlay: ${profile} (forked_from ${forked ? forked[1].trim() : "sem carimbo"})`;
|
|
250
|
+
if (block === null) return `${marker}\n\n${content}`;
|
|
251
|
+
const fenceEnd = content.indexOf("\n---", 3);
|
|
252
|
+
const lineEnd = content.indexOf("\n", fenceEnd + 1);
|
|
253
|
+
if (lineEnd === -1) return `${content}\n\n${marker}\n`;
|
|
254
|
+
const head = content.slice(0, lineEnd + 1);
|
|
255
|
+
const tail = content.slice(lineEnd + 1).replace(/^\n+/, "");
|
|
256
|
+
return `${head}\n${marker}\n\n${tail}`;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/** A marcação exatamente como `withOverlayMarker` a escreve; captura o perfil. */
|
|
260
|
+
const OVERLAY_MARKER = /^> Overlay: ([a-z0-9][a-z0-9-]*) \(forked_from .*\)$/;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Lê a marcação de overlay de uma cópia na IDE: só vale na posição em que `withOverlayMarker` a
|
|
264
|
+
* grava (primeira linha útil depois do frontmatter, ou a primeira linha do arquivo) e no formato
|
|
265
|
+
* exato. Uma rule própria que cite a marcação no corpo não é confundida com uma cópia do overlay.
|
|
266
|
+
* @param {string} rawContent
|
|
267
|
+
* @returns {string | null} o perfil da marcação, ou `null`
|
|
268
|
+
*/
|
|
269
|
+
export function readOverlayMarker(rawContent) {
|
|
270
|
+
const content = rawContent.replace(/\r\n?/g, "\n");
|
|
271
|
+
let rest = content;
|
|
272
|
+
if (extractFrontmatterBlock(content) !== null) {
|
|
273
|
+
const fenceEnd = content.indexOf("\n---", 3);
|
|
274
|
+
const lineEnd = content.indexOf("\n", fenceEnd + 1);
|
|
275
|
+
rest = lineEnd === -1 ? "" : content.slice(lineEnd + 1);
|
|
276
|
+
}
|
|
277
|
+
const first = rest.split("\n").find((line) => line.trim() !== "");
|
|
278
|
+
const match = first ? OVERLAY_MARKER.exec(first) : null;
|
|
279
|
+
return match ? match[1] : null;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Cópia na IDE marcada `> Overlay: …` que o overlay **ativo** não tem é de outro perfil (ou saiu do
|
|
284
|
+
* overlay à mão). Sem isto, a IDE continuaria carregando a regra de uma empresa inativa, inclusive
|
|
285
|
+
* quando só este passo roda (`jarvis fork`, reaplicação do upgrade), sem o `cpSync` do core antes.
|
|
286
|
+
* Se o core tem o arquivo, a cópia volta a ser a do core; senão, é removida. Só a IDE é tocada.
|
|
287
|
+
*/
|
|
288
|
+
function removeOrphanOverlayRules(ideDir, overlayDir, result, { dryRun, frameworkRoot }) {
|
|
289
|
+
for (const dir of OVERLAY_RULE_DIRS) {
|
|
290
|
+
const ideRules = join(ideDir, dir);
|
|
291
|
+
if (!existsSync(ideRules)) continue;
|
|
292
|
+
const files = [];
|
|
293
|
+
collectMdFiles(ideRules, files);
|
|
294
|
+
for (const file of files) {
|
|
295
|
+
const marker = readOverlayMarker(readFileSync(file, "utf-8"));
|
|
296
|
+
if (marker === null) continue;
|
|
297
|
+
const rel = relative(ideRules, file);
|
|
298
|
+
if (existsSync(join(overlayDir, dir, rel))) continue; // o overlay ativo a recopia em seguida
|
|
299
|
+
const shown = `${dir}/${rel.split(sep).join("/")}`;
|
|
300
|
+
const core = join(frameworkRoot, dir, rel);
|
|
301
|
+
if (existsSync(core)) {
|
|
302
|
+
if (!dryRun) cpSync(core, file);
|
|
303
|
+
result.copied.push(`(overlay) ${shown}: voltou ao core (era do perfil ${marker})`);
|
|
304
|
+
} else {
|
|
305
|
+
if (!dryRun) rmSync(file, { force: true });
|
|
306
|
+
result.copied.push(`(overlay) ${shown}: órfã removida da IDE (era do perfil ${marker})`);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* RuleResolver (#199). Lê `COMPANY_PROFILE` do `.{ide}/ENV.md` (vazio, inválido ou sem ENV.md →
|
|
314
|
+
* `stark-industries`), garante a pasta `overlays/{perfil}/` e copia por cima de `.{ide}/rules/` e
|
|
315
|
+
* `.{ide}/rules-on-demand/` cada `.md` do overlay com o mesmo caminho relativo, marcado.
|
|
316
|
+
* Workflows, skills, agentes e templates não passam por aqui: a rule de precedência os resolve na chamada.
|
|
317
|
+
*
|
|
318
|
+
* Única escrita em `overlays/`: criar a pasta vazia do perfil. Nenhum arquivo é gravado, alterado
|
|
319
|
+
* ou apagado dentro dela. Caminho que resolve (realpath) para fora do overlay é ignorado com aviso.
|
|
320
|
+
* @param {string} ideDir - Pasta da IDE (ex.: `{workspace}/.claude`)
|
|
321
|
+
* @param {{ copied: string[], skipped: string[], errors: string[] }} result - Acumulador do sync
|
|
322
|
+
* @param {{ dryRun?: boolean, frameworkRoot?: string, envText?: string }} [opts] - `envText`: o
|
|
323
|
+
* ENV.md já lido (o `jarvis rules sync` passa o mesmo de onde veio o perfil); sem ele, lê o da IDE
|
|
324
|
+
* @returns {string} O perfil ativo
|
|
325
|
+
*/
|
|
326
|
+
export function applyRuleOverlay(ideDir, result, { dryRun = false, frameworkRoot, envText } = {}) {
|
|
327
|
+
if (envText === undefined) {
|
|
328
|
+
const envPath = join(ideDir, "ENV.md");
|
|
329
|
+
envText = existsSync(envPath) ? readFileSync(envPath, "utf-8") : undefined;
|
|
330
|
+
}
|
|
331
|
+
const { profile, warning } = readCompanyProfile(envText);
|
|
332
|
+
if (warning) result.skipped.push(`(overlay) ${warning}`);
|
|
333
|
+
|
|
334
|
+
const overlayDir = join(ideDir, "overlays", profile);
|
|
335
|
+
removeOrphanOverlayRules(ideDir, overlayDir, result, {
|
|
336
|
+
dryRun,
|
|
337
|
+
frameworkRoot: frameworkRoot ?? getFrameworkRoot(),
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
if (!existsSync(overlayDir)) {
|
|
341
|
+
if (!dryRun) mkdirSync(overlayDir, { recursive: true });
|
|
342
|
+
result.copied.push(`Overlay ${profile}: pasta ${dryRun ? "seria criada" : "criada"}`);
|
|
343
|
+
return profile;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
const overlayRoot = realpathSync(overlayDir);
|
|
347
|
+
for (const dir of OVERLAY_RULE_DIRS) {
|
|
348
|
+
const srcDir = join(overlayDir, dir);
|
|
349
|
+
if (!existsSync(srcDir)) continue;
|
|
350
|
+
const files = [];
|
|
351
|
+
collectOverlayFiles(srcDir, files);
|
|
352
|
+
for (const file of files) {
|
|
353
|
+
const rel = relative(srcDir, file);
|
|
354
|
+
const shown = `${dir}/${rel.split(sep).join("/")}`;
|
|
355
|
+
let real;
|
|
356
|
+
try {
|
|
357
|
+
real = realpathSync(file);
|
|
358
|
+
} catch {
|
|
359
|
+
result.skipped.push(`(overlay) ${shown}: link quebrado, ignorado`);
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
if (!real.startsWith(overlayRoot + sep)) {
|
|
363
|
+
result.skipped.push(`(overlay) ${shown}: aponta para fora do overlay, ignorado`);
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
try {
|
|
367
|
+
const content = readFileSync(file, "utf-8");
|
|
368
|
+
const dest = join(ideDir, dir, rel);
|
|
369
|
+
if (!dryRun) {
|
|
370
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
371
|
+
writeFileSync(dest, withOverlayMarker(content, profile), "utf-8");
|
|
372
|
+
}
|
|
373
|
+
result.copied.push(`(overlay) ${shown}`);
|
|
374
|
+
} catch (err) {
|
|
375
|
+
result.errors.push(`(overlay) ${shown}: ${err.message}`);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return profile;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Passo 8 do `/jarvis-init` (Profile-Aware Rules Sync) pelo CLI (#102): deixa em `.{ide}/rules/` e
|
|
384
|
+
* `.{ide}/rules-on-demand/` só as rules do perfil, com o filtro de `profile-filter.js`.
|
|
385
|
+
* Candidatos de cada pasta: todo `.md` do core mais os do overlay ativo que o core não tem. O arquivo
|
|
386
|
+
* efetivo é o do overlay, se existir (e estiver dentro dele), senão o do core; o `Applies to` lido é
|
|
387
|
+
* o dele. Entra → copia do core (o do overlay já foi gravado, marcado, por `applyRuleOverlay`); não
|
|
388
|
+
* entra → sai da IDE. `rtk-rules.md` só com `rtkEnabled`. Arquivo da IDE que não é candidato não é tocado.
|
|
389
|
+
* @param {string} ideDir - Pasta da IDE (ex.: `{workspace}/.claude`)
|
|
390
|
+
* @param {{ HUB: string, POSITION: string, AREA: string, SQUAD: string, ARTIFACT_STYLE?: string }} profile
|
|
391
|
+
* @param {{ rtkEnabled?: boolean, frameworkRoot?: string, dryRun?: boolean, envText?: string }} [opts]
|
|
392
|
+
* @returns {{ companyProfile: string, copied: Record<string, number>, removed: number,
|
|
393
|
+
* universal: number, fromOverlay: number, folderCreated: boolean, warnings: string[], errors: string[] }}
|
|
394
|
+
*/
|
|
395
|
+
export function syncRulesForProfile(
|
|
396
|
+
ideDir,
|
|
397
|
+
profile,
|
|
398
|
+
{ rtkEnabled = false, frameworkRoot = getFrameworkRoot(), dryRun = false, envText } = {}
|
|
399
|
+
) {
|
|
400
|
+
const overlayResult = { copied: [], skipped: [], errors: [] };
|
|
401
|
+
const companyProfile = applyRuleOverlay(ideDir, overlayResult, {
|
|
402
|
+
dryRun,
|
|
403
|
+
frameworkRoot,
|
|
404
|
+
envText,
|
|
405
|
+
});
|
|
406
|
+
const overlayDir = join(ideDir, "overlays", companyProfile);
|
|
407
|
+
const overlayRoot = existsSync(overlayDir) ? realpathSync(overlayDir) : null;
|
|
408
|
+
const out = {
|
|
409
|
+
companyProfile,
|
|
410
|
+
copied: {},
|
|
411
|
+
removed: 0,
|
|
412
|
+
universal: 0,
|
|
413
|
+
fromOverlay: 0,
|
|
414
|
+
folderCreated: overlayResult.copied.some((line) =>
|
|
415
|
+
line.startsWith(`Overlay ${companyProfile}:`)
|
|
416
|
+
),
|
|
417
|
+
warnings: overlayResult.skipped,
|
|
418
|
+
errors: overlayResult.errors,
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
// No Kiro, a IDE carrega steering/ (cópia de rules/ feita pelo transformKiroAssets): o filtro
|
|
422
|
+
// mantém o steering de cada rule junto com ela (#83).
|
|
423
|
+
const kiro = basename(ideDir) === ".kiro";
|
|
424
|
+
|
|
425
|
+
for (const dir of OVERLAY_RULE_DIRS) {
|
|
426
|
+
out.copied[dir] = 0;
|
|
427
|
+
// caminho relativo (com `sep` do sistema) → arquivo do overlay válido, se houver
|
|
428
|
+
const fromOverlay = new Map();
|
|
429
|
+
if (overlayRoot && existsSync(join(overlayDir, dir))) {
|
|
430
|
+
const files = [];
|
|
431
|
+
collectOverlayFiles(join(overlayDir, dir), files);
|
|
432
|
+
for (const file of files) {
|
|
433
|
+
try {
|
|
434
|
+
if (realpathSync(file).startsWith(overlayRoot + sep))
|
|
435
|
+
fromOverlay.set(relative(join(overlayDir, dir), file), file);
|
|
436
|
+
} catch {
|
|
437
|
+
// link quebrado: applyRuleOverlay já avisou; vale o core
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
const coreDir = join(frameworkRoot, dir);
|
|
442
|
+
const coreFiles = [];
|
|
443
|
+
if (existsSync(coreDir)) collectMdFiles(coreDir, coreFiles);
|
|
444
|
+
const candidates = new Set([
|
|
445
|
+
...coreFiles.map((file) => relative(coreDir, file)),
|
|
446
|
+
...fromOverlay.keys(),
|
|
447
|
+
]);
|
|
448
|
+
|
|
449
|
+
for (const rel of [...candidates].sort()) {
|
|
450
|
+
const overlayFile = fromOverlay.get(rel);
|
|
451
|
+
const source = overlayFile ?? join(coreDir, rel);
|
|
452
|
+
const dest = join(ideDir, dir, rel);
|
|
453
|
+
try {
|
|
454
|
+
const appliesTo = parseAppliesTo(readFileSync(source, "utf-8"));
|
|
455
|
+
const rtkOk = !rel.split(sep).join("/").endsWith("rtk-rules.md") || rtkEnabled;
|
|
456
|
+
if (rtkOk && matchesProfile(appliesTo, profile)) {
|
|
457
|
+
if (!overlayFile && !dryRun) {
|
|
458
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
459
|
+
cpSync(source, dest);
|
|
460
|
+
}
|
|
461
|
+
out.copied[dir]++;
|
|
462
|
+
if (appliesTo === null) out.universal++;
|
|
463
|
+
if (overlayFile) out.fromOverlay++;
|
|
464
|
+
if (kiro && dir === "rules" && !dryRun && existsSync(dest))
|
|
465
|
+
writeKiroRuleSteering(ideDir, dest);
|
|
466
|
+
} else if (existsSync(dest)) {
|
|
467
|
+
if (!dryRun) rmSync(dest, { force: true });
|
|
468
|
+
out.removed++;
|
|
469
|
+
}
|
|
470
|
+
if (kiro && dir === "rules" && !dryRun && !existsSync(dest)) {
|
|
471
|
+
const name = basename(rel);
|
|
472
|
+
if (name !== "AGENTS.md" && name !== "README.md")
|
|
473
|
+
rmSync(join(ideDir, "steering", name), { force: true });
|
|
474
|
+
}
|
|
475
|
+
} catch (err) {
|
|
476
|
+
out.errors.push(`${dir}/${rel.split(sep).join("/")}: ${err.message}`);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return out;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* O `rtk` (Token Killer) está no PATH e responde ao `rtk gain --help`?
|
|
485
|
+
* @returns {boolean}
|
|
486
|
+
*/
|
|
487
|
+
export function rtkAvailable() {
|
|
488
|
+
try {
|
|
489
|
+
execSync("rtk gain --help 2>/dev/null", { stdio: "pipe" });
|
|
490
|
+
return true;
|
|
491
|
+
} catch {
|
|
492
|
+
return false;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
201
496
|
/**
|
|
202
497
|
* Detecta RTK no PATH e reconcilia RTK_ENABLED no ENV.md + rtk-rules.md na IDE.
|
|
203
498
|
* - RTK encontrado → RTK_ENABLED=true no ENV.md, mantém rule
|
|
@@ -209,14 +504,7 @@ export function syncAssets(targetDir, ide, opts = {}) {
|
|
|
209
504
|
function reconcileRtk(ideDir, targetDir, ide, { keepEnvValues = false } = {}) {
|
|
210
505
|
const rtkRulePath = join(ideDir, "rules", "rtk-rules.md");
|
|
211
506
|
const envPath = join(ideDir, "ENV.md");
|
|
212
|
-
const hasRtk = (
|
|
213
|
-
try {
|
|
214
|
-
execSync("rtk gain --help 2>/dev/null", { stdio: "pipe" });
|
|
215
|
-
return true;
|
|
216
|
-
} catch {
|
|
217
|
-
return false;
|
|
218
|
-
}
|
|
219
|
-
})();
|
|
507
|
+
const hasRtk = rtkAvailable();
|
|
220
508
|
|
|
221
509
|
if (hasRtk) {
|
|
222
510
|
// Ativar RTK_ENABLED no ENV.md se existir e estiver false
|
|
@@ -286,7 +574,7 @@ function transformOpenCodeAgents(agentsDir) {
|
|
|
286
574
|
const body = content.slice(fmMatch[0].length).trim();
|
|
287
575
|
|
|
288
576
|
// Extract fields from Jarvis frontmatter
|
|
289
|
-
const description = (fm
|
|
577
|
+
const description = readDescription(fm);
|
|
290
578
|
const model = (fm.match(/^model:\s*(.+)$/m) || [])[1]?.trim();
|
|
291
579
|
const name = basename(filePath, ".md");
|
|
292
580
|
const isMainAgent = name === "eng.agent" || name === "eng-agent";
|
|
@@ -308,7 +596,7 @@ function transformOpenCodeAgents(agentsDir) {
|
|
|
308
596
|
|
|
309
597
|
/**
|
|
310
598
|
* Transforma frontmatter de commands (workflows) Jarvis para formato OpenCode.
|
|
311
|
-
*
|
|
599
|
+
* Remonta o frontmatter só com description, agent (nome) e model (resolvido de recommended_model).
|
|
312
600
|
* @param {string} commandsDir - Caminho para .opencode/commands/
|
|
313
601
|
*/
|
|
314
602
|
function transformOpenCodeCommands(commandsDir) {
|
|
@@ -325,7 +613,7 @@ function transformOpenCodeCommands(commandsDir) {
|
|
|
325
613
|
const body = content.slice(fmMatch[0].length).trim();
|
|
326
614
|
|
|
327
615
|
// Extract fields
|
|
328
|
-
const description = (fm
|
|
616
|
+
const description = readDescription(fm);
|
|
329
617
|
const model =
|
|
330
618
|
(fm.match(/^recommended_model:\s*(.+)$/m) || [])[1]?.trim() ||
|
|
331
619
|
(fm.match(/^model:\s*(.+)$/m) || [])[1]?.trim();
|
|
@@ -378,11 +666,19 @@ function collectMdFiles(dir, acc) {
|
|
|
378
666
|
}
|
|
379
667
|
}
|
|
380
668
|
|
|
381
|
-
|
|
669
|
+
/**
|
|
670
|
+
* Move os .md das subpastas de `dir` para a raiz e apaga as subpastas.
|
|
671
|
+
* @param {string} dir
|
|
672
|
+
* @param {string} [rootDir] - Raiz para onde os arquivos vão (recursão)
|
|
673
|
+
* @param {string[]} [skip] - Subpastas do primeiro nível que ficam como estão
|
|
674
|
+
* @returns {number} Quantos arquivos foram movidos
|
|
675
|
+
*/
|
|
676
|
+
function flattenDir(dir, rootDir, skip = []) {
|
|
382
677
|
const root = rootDir ?? dir;
|
|
383
678
|
let moved = 0;
|
|
384
679
|
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
385
680
|
const fullPath = join(dir, entry.name);
|
|
681
|
+
if (entry.isDirectory() && skip.includes(entry.name)) continue;
|
|
386
682
|
if (entry.isDirectory()) {
|
|
387
683
|
moved += flattenDir(fullPath, root);
|
|
388
684
|
try {
|
|
@@ -403,9 +699,7 @@ function flattenDir(dir, rootDir) {
|
|
|
403
699
|
|
|
404
700
|
/**
|
|
405
701
|
* Converte o frontmatter de um arquivo .md para um steering file Kiro.
|
|
406
|
-
* -
|
|
407
|
-
* - Adiciona `inclusion` se não presente
|
|
408
|
-
* - Preserva `name` e `description`
|
|
702
|
+
* - Remonta o frontmatter só com inclusion e description (e fileMatchPattern, quando houver)
|
|
409
703
|
* @param {string} content - Conteúdo original do .md
|
|
410
704
|
* @param {string} inclusion - Valor de inclusion: "auto" | "manual" | "fileMatch"
|
|
411
705
|
* @param {string} [fileMatchPattern] - Pattern para inclusion: fileMatch
|
|
@@ -422,13 +716,7 @@ function toKiroSteeringFile(content, inclusion, fileMatchPattern) {
|
|
|
422
716
|
|
|
423
717
|
if (fmMatch) {
|
|
424
718
|
const fm = fmMatch[1];
|
|
425
|
-
const
|
|
426
|
-
[])[1];
|
|
427
|
-
const descInline = (fm.match(/^description:\s*(.+)$/m) || [])[1];
|
|
428
|
-
const finalDesc = (description || descInline || "")
|
|
429
|
-
.replace(/^\s+/gm, "")
|
|
430
|
-
.replace(/\n+/g, " ")
|
|
431
|
-
.trim();
|
|
719
|
+
const finalDesc = readDescription(fm);
|
|
432
720
|
if (finalDesc) lines.push(`description: "${finalDesc.replace(/"/g, '\\"')}"`);
|
|
433
721
|
}
|
|
434
722
|
|
|
@@ -448,6 +736,24 @@ function detectRuleHub(content) {
|
|
|
448
736
|
return hub === "ALL" ? null : hub;
|
|
449
737
|
}
|
|
450
738
|
|
|
739
|
+
/**
|
|
740
|
+
* Grava o steering de uma rule do Kiro (`steering/{nome}`), com `inclusion` pelo HUB da rule.
|
|
741
|
+
* Arquivos de índice (`AGENTS.md`, `README.md`) não viram steering.
|
|
742
|
+
* @param {string} kiroDir - Pasta `.kiro/`
|
|
743
|
+
* @param {string} filePath - Rule em `.kiro/rules/`
|
|
744
|
+
*/
|
|
745
|
+
function writeKiroRuleSteering(kiroDir, filePath) {
|
|
746
|
+
const name = basename(filePath);
|
|
747
|
+
if (name === "AGENTS.md" || name === "README.md") return;
|
|
748
|
+
const content = readFileSync(filePath, "utf-8");
|
|
749
|
+
const hub = detectRuleHub(content);
|
|
750
|
+
const pattern = hub ? KIRO_HUB_FILE_PATTERNS[hub] : null;
|
|
751
|
+
const inclusion = pattern ? "fileMatch" : "auto";
|
|
752
|
+
const steeringDir = join(kiroDir, "steering");
|
|
753
|
+
mkdirSync(steeringDir, { recursive: true });
|
|
754
|
+
writeFileSync(join(steeringDir, name), toKiroSteeringFile(content, inclusion, pattern), "utf-8");
|
|
755
|
+
}
|
|
756
|
+
|
|
451
757
|
/**
|
|
452
758
|
* Transforma os assets copiados para .kiro/ em steering files.
|
|
453
759
|
* 1. Workflows em steering/ → adiciona inclusion: manual
|
|
@@ -478,19 +784,7 @@ function transformKiroAssets(kiroDir, targetDir) {
|
|
|
478
784
|
const ruleFiles = [];
|
|
479
785
|
collectMdFiles(rulesDir, ruleFiles);
|
|
480
786
|
|
|
481
|
-
for (const filePath of ruleFiles)
|
|
482
|
-
const name = basename(filePath);
|
|
483
|
-
// Ignorar arquivos de índice/meta
|
|
484
|
-
if (name === "AGENTS.md" || name === "README.md") continue;
|
|
485
|
-
|
|
486
|
-
const content = readFileSync(filePath, "utf-8");
|
|
487
|
-
const hub = detectRuleHub(content);
|
|
488
|
-
const pattern = hub ? KIRO_HUB_FILE_PATTERNS[hub] : null;
|
|
489
|
-
const inclusion = pattern ? "fileMatch" : "auto";
|
|
490
|
-
const transformed = toKiroSteeringFile(content, inclusion, pattern);
|
|
491
|
-
|
|
492
|
-
writeFileSync(join(steeringDir, name), transformed, "utf-8");
|
|
493
|
-
}
|
|
787
|
+
for (const filePath of ruleFiles) writeKiroRuleSteering(kiroDir, filePath);
|
|
494
788
|
}
|
|
495
789
|
|
|
496
790
|
// 3. Skills — copiar SKILL.md de cada skill para steering/skills/skill-{nome}.md
|
|
@@ -508,6 +802,8 @@ function transformKiroAssets(kiroDir, targetDir) {
|
|
|
508
802
|
const content = readFileSync(skillMdPath, "utf-8");
|
|
509
803
|
const transformed = toKiroSteeringFile(content, "manual");
|
|
510
804
|
writeFileSync(join(steeringSkillsDir, `skill-${skillName}.md`), transformed, "utf-8");
|
|
805
|
+
// Cópia solta que upgrades antigos deixaram na raiz de steering/ (só a que tem par aqui).
|
|
806
|
+
rmSync(join(steeringDir, `skill-${skillName}.md`), { force: true });
|
|
511
807
|
}
|
|
512
808
|
}
|
|
513
809
|
}
|
|
@@ -26,11 +26,45 @@ export function extractFrontmatterBlock(content) {
|
|
|
26
26
|
return match ? match[1] : null;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Lê o `description` de um bloco de frontmatter, numa linha só: o valor na mesma linha (sem as
|
|
31
|
+
* aspas; `\"` vira `"`) ou o bloco `>`/`|`, com ou sem indicador (`>-`, `|+`, `>2`), unido numa
|
|
32
|
+
* linha por espaço, que é como os SKILL.md e parte dos agents e workflows o escrevem. Fonte única
|
|
33
|
+
* do `jarvis list` e da geração para Codex, OpenCode e Kiro, que antes liam o bloco como ">" (#83).
|
|
34
|
+
* String entre aspas que continua na linha seguinte não é suportada (nenhum arquivo do framework usa).
|
|
35
|
+
* @param {string | null} block - Bloco do frontmatter (`extractFrontmatterBlock`)
|
|
36
|
+
* @returns {string} A descrição, ou "" sem o campo
|
|
37
|
+
*/
|
|
38
|
+
export function readDescription(block) {
|
|
39
|
+
if (!block) return "";
|
|
40
|
+
const lines = block.split("\n");
|
|
41
|
+
const start = lines.findIndex((line) => line.startsWith("description:"));
|
|
42
|
+
if (start === -1) return "";
|
|
43
|
+
|
|
44
|
+
let value = lines[start].slice("description:".length).trim();
|
|
45
|
+
if (value && !/^[>|](?:[1-9][+-]?|[+-][1-9]?)?$/.test(value)) {
|
|
46
|
+
if (value.length > 1 && value.startsWith('"') && value.endsWith('"')) {
|
|
47
|
+
value = value.slice(1, -1).replace(/\\"/g, '"');
|
|
48
|
+
} else if (value.length > 1 && value.startsWith("'") && value.endsWith("'")) {
|
|
49
|
+
value = value.slice(1, -1);
|
|
50
|
+
}
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Bloco: segue enquanto a linha é recuada (ou vazia); para na próxima chave sem recuo.
|
|
55
|
+
const parts = [];
|
|
56
|
+
for (const line of lines.slice(start + 1)) {
|
|
57
|
+
if (line.trim() === "") continue;
|
|
58
|
+
if (!/^\s/.test(line)) break;
|
|
59
|
+
parts.push(line.trim());
|
|
60
|
+
}
|
|
61
|
+
return parts.join(" ");
|
|
62
|
+
}
|
|
63
|
+
|
|
29
64
|
/**
|
|
30
65
|
* Parseia um bloco de frontmatter YAML simples (`chave: valor`, uma por linha,
|
|
31
66
|
* sem indentação). Não suporta estruturas aninhadas, listas ou blocos
|
|
32
|
-
* multilinha (`>`/`|`)
|
|
33
|
-
* que extrai campos específicos com necessidades diferentes.
|
|
67
|
+
* multilinha (`>`/`|`); para o `description` em bloco, use `readDescription`.
|
|
34
68
|
* @param {string} content - Conteúdo completo do arquivo (com ou sem frontmatter)
|
|
35
69
|
* @returns {Record<string, string>} Metadados; `{}` se não houver frontmatter
|
|
36
70
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jarvis-ai-framework",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.5.0",
|
|
4
4
|
"description": "Jarvis framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"prepublishOnly": "echo 'Publishing jarvis-framework...'",
|
|
12
12
|
"publish:gitlab": "npm publish",
|
|
13
13
|
"test:comandos": "node test/comandos-docs.test.js",
|
|
14
|
-
"test:filtro": "node --test test/profile-filter.test.js test/token-report.test.js test/flow-map.test.js test/env-loader.test.js test/sync-engine.test.js test/vcs-api.test.js test/fetch-file.test.js test/publish-file.test.js test/docs-storage.test.js test/env-upgrade.test.js test/docs-migrate.test.js test/init-upgrade.test.js test/workspace-mode.test.js test/stale-skills.test.js test/session-scan.test.js test/framework-refs.test.js test/validate-frontmatter.test.js test/mcp-config.test.js test/integrations-catalog.test.js test/cli-runner.test.js test/tasks-comment.test.js test/version.test.js test/gate-checklist-rodadas.test.js test/publish-comments-rules.test.js test/pre-pr-criterio.test.js test/nomes-soltos.test.js",
|
|
14
|
+
"test:filtro": "node --test test/profile-filter.test.js test/token-report.test.js test/flow-map.test.js test/env-loader.test.js test/sync-engine.test.js test/vcs-api.test.js test/fetch-file.test.js test/publish-file.test.js test/docs-storage.test.js test/env-upgrade.test.js test/docs-migrate.test.js test/init-upgrade.test.js test/workspace-mode.test.js test/stale-skills.test.js test/session-scan.test.js test/framework-refs.test.js test/validate-frontmatter.test.js test/mcp-config.test.js test/integrations-catalog.test.js test/cli-runner.test.js test/tasks-comment.test.js test/version.test.js test/gate-checklist-rodadas.test.js test/publish-comments-rules.test.js test/pre-pr-criterio.test.js test/nomes-soltos.test.js test/company-profile.test.js test/company-overlay-rules.test.js test/fork.test.js test/branch-chave.test.js test/rules-sync.test.js test/frontmatter.test.js",
|
|
15
15
|
"lint": "eslint bin/ test/",
|
|
16
16
|
"lint:fix": "eslint bin/ test/ --fix",
|
|
17
17
|
"format": "prettier --write bin/ test/",
|
|
@@ -52,4 +52,4 @@ Esta rule só é copiada para `$IDE/rules/` quando o perfil tem `ARTIFACT_STYLE=
|
|
|
52
52
|
- `templates/ENV-template.md` (`ARTIFACT_STYLE`)
|
|
53
53
|
- `skills/jarvis-init/SKILL.md` (Pergunta 9 e Passo 8)
|
|
54
54
|
- `workflows/engineering/eng.pr.md` (conferência antes do push)
|
|
55
|
-
- `rules
|
|
55
|
+
- `docs/estrutura/rules.md` (eixo `ARTIFACT_STYLE` do `Applies to`)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
> **Applies to:** HUB: all | POSITION: all | AREA: all | SQUAD: all
|
|
2
|
+
|
|
3
|
+
# Overlay de empresa — precedência na chamada
|
|
4
|
+
|
|
5
|
+
Perfil ativo: `COMPANY_PROFILE` do `ENV.md` (vazio = `stark-industries`, o overlay padrão). O overlay fica em `$IDE/overlays/{COMPANY_PROFILE}/` e espelha o core: `workflows/`, `skills/`, `agents/`, `rules/`, `rules-on-demand/`, `templates/`.
|
|
6
|
+
|
|
7
|
+
**Antes de seguir um workflow, skill ou agente, ou de ler um template ou uma rule-on-demand por caminho**, confira `$IDE/overlays/{COMPANY_PROFILE}/{tipo}/{mesmo caminho}`. Existe → leia-o e siga-o **em vez** do do core. Não existe → siga o core, sem aviso.
|
|
8
|
+
|
|
9
|
+
Precedência: **overlay > especialização de stack > core.**
|
|
10
|
+
|
|
11
|
+
Não escreva no overlay: só o `/jarvis-fork` (CLI `jarvis fork`) grava lá, com confirmação. `rules/` não passa por aqui: a cópia em `$IDE/rules/` já vem resolvida na instalação (sync e Passo 8 do `/jarvis-init`), marcada com `> Overlay: …` quando é da empresa.
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
env_file: "@/ENV.md"
|
|
3
|
-
---
|
|
4
|
-
|
|
5
1
|
> **Applies to:** HUB: all | POSITION: all | AREA: ENGINEERING | SQUAD: all
|
|
6
2
|
|
|
7
3
|
# Regras de Seguranca para Engenharia
|
|
@@ -12,19 +8,7 @@ padrao embutido nas bases `eng-backend`/`eng-frontend`; seguranca de infraestrut
|
|
|
12
8
|
de seguranca da informacao (risco, ameacas, identidade, resposta a incidente, GRC, privacidade)
|
|
13
9
|
ficam no `eng-platform` (temas 9 e 13).
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## Fase: eng.start (Arquitetura)
|
|
18
|
-
|
|
19
|
-
Ao definir a arquitetura de uma feature, o agente DEVE incluir no `architecture.md`:
|
|
20
|
-
|
|
21
|
-
1. **Dados sensiveis** — listar PII, dados financeiros e credenciais envolvidas na feature
|
|
22
|
-
2. **Superficie de ataque** — mapear endpoints publicos vs. autenticados
|
|
23
|
-
3. **Modelo de auth** — definir como autenticacao e autorizacao se aplicam (JWT, session, OAuth, RBAC)
|
|
24
|
-
4. **Integracoes externas** — listar e validar que usam TLS; documentar retry e fallback
|
|
25
|
-
5. **Estrategia de sanitizacao** — se a feature recebe inputs de usuario, documentar como serao validados
|
|
26
|
-
|
|
27
|
-
> Se a feature nao envolve nenhum destes pontos, registrar explicitamente: "Sem superficie de seguranca identificada".
|
|
11
|
+
> **Por etapa:** o que entra no `architecture.md` (`eng.start`, `eng.rpa.robot`, `eng.debug`) e o checklist de segurança do `gate-checklist.md` (`eng.pre-pr`) estão em `$IDE/rules-on-demand/engineering/eng.security-rules.md`, lido por esses comandos.
|
|
28
12
|
|
|
29
13
|
---
|
|
30
14
|
|
|
@@ -93,23 +77,6 @@ O agente DEVE aplicar as seguintes regras em todo codigo gerado ou revisado:
|
|
|
93
77
|
|
|
94
78
|
---
|
|
95
79
|
|
|
96
|
-
## Fase: eng.pre-pr (Validacao)
|
|
97
|
-
|
|
98
|
-
O agente DEVE incluir no checklist de pre-PR as seguintes verificacoes de seguranca:
|
|
99
|
-
|
|
100
|
-
- [ ] **Secrets scan**: nenhum token, senha ou API key no diff
|
|
101
|
-
- [ ] **Dependencias**: `npm audit` sem vulnerabilidades HIGH/CRITICAL
|
|
102
|
-
- [ ] **Lockfile**: commitado e atualizado
|
|
103
|
-
- [ ] **Inputs**: todo endpoint novo ou alterado valida inputs com schema
|
|
104
|
-
- [ ] **Auth guard**: todo endpoint novo tem guard (ou `@Public()` explicito com justificativa)
|
|
105
|
-
- [ ] **Outputs**: erros nao vazam detalhes internos
|
|
106
|
-
|
|
107
|
-
Se o PR toca em areas sensiveis (auth, sessions, RBAC, CORS, CSP, permissoes), o agente DEVE:
|
|
108
|
-
1. Registrar no PR Brief do `gate-checklist.md` que o PR leva o label `security` e orientar a pessoa a adiciona-lo ao PR (o Jarvis nao altera o PR no vendor sem perguntar, regra de ouro; o `jarvis vcs create-merge` nao poe label)
|
|
109
|
-
2. Seguir o gate de seguranca inline do `eng.pre-pr` (sanitizacao, auth guards, headers, secrets scan, `npm audit`) antes do merge
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
|
|
113
80
|
## Fase: eng.pr (Merge)
|
|
114
81
|
|
|
115
82
|
- PRs com label `security` devem ter review de seguranca aprovado manualmente antes do merge
|