jarvis-ai-framework 8.3.0 → 8.6.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 +46 -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-consolidator.agent.md +6 -3
- package/agents/engineering/eng.docs-writer.md +12 -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 +8 -6
- package/bin/commands/docs-archive.js +86 -0
- package/bin/commands/docs-finalize.js +82 -0
- package/bin/commands/docs-migrate.js +107 -0
- package/bin/commands/docs-publish.js +132 -67
- package/bin/commands/docs-sync.js +12 -7
- package/bin/commands/init.js +92 -7
- package/bin/commands/rules.js +136 -0
- package/bin/lib/cli/program.js +65 -4
- package/bin/lib/config/constants.js +60 -39
- package/bin/lib/core/docs-migrate.js +2 -2
- package/bin/lib/core/env-upgrade.js +132 -16
- package/bin/lib/core/profile-filter.js +4 -9
- package/bin/lib/core/scanner.js +10 -4
- package/bin/lib/core/sync-engine.js +184 -51
- package/bin/lib/docs/finish-delivery.js +493 -0
- package/bin/lib/docs/migrate-central.js +229 -0
- package/bin/lib/docs/publish-file.js +176 -46
- package/bin/lib/docs/storage/build-index.js +83 -47
- package/bin/lib/docs/storage/filesystem.js +341 -6
- package/bin/lib/docs/storage/index.js +0 -1
- package/bin/lib/docs/validate-frontmatter.js +34 -2
- 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 +3 -3
- 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 +3 -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 +40 -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/README.md +22 -10
- package/skills/jarvis-docs-central/SKILL.md +78 -43
- 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 +51 -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 +19 -3
- package/templates/ENV-template.md +0 -59
- package/templates/engineering/AGENTS-template.md +0 -1
- package/templates/engineering/breakdown-subtasks-template.md +76 -447
- package/templates/engineering/central-delivery-template.md +4 -1
- package/templates/engineering/central-feature-template.md +16 -7
- package/templates/engineering/central-home-template.md +31 -0
- package/templates/engineering/central-product-template.md +41 -0
- package/templates/engineering/data-contract-template.md +2 -2
- package/templates/engineering/light-arch-template.md +242 -0
- 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 +2 -6
- package/workflows/engineering/data/data.new-pipeline.md +3 -7
- package/workflows/engineering/eng.breakdown-subtasks.md +9 -239
- package/workflows/engineering/eng.build-tech-spec.md +1 -3
- package/workflows/engineering/eng.create-ard-from-code.md +5 -6
- package/workflows/engineering/eng.create-ard.md +6 -10
- package/workflows/engineering/eng.create-rfc.md +4 -6
- package/workflows/engineering/eng.daily-report.md +0 -2
- package/workflows/engineering/eng.debug.md +1 -5
- package/workflows/engineering/eng.docs.md +2 -5
- package/workflows/engineering/eng.light-arch.md +7 -7
- package/workflows/engineering/eng.plan.md +2 -4
- package/workflows/engineering/eng.pr.md +9 -37
- package/workflows/engineering/eng.pre-pr.md +16 -8
- package/workflows/engineering/eng.review.md +1 -5
- package/workflows/engineering/eng.rpa.robot.md +5 -7
- package/workflows/engineering/eng.spec-consolidate.md +106 -42
- package/workflows/engineering/eng.start.md +16 -86
- package/workflows/engineering/eng.work.md +18 -151
- 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 +1 -4
- package/workflows/engineering/qa/eng.qa-sprint-planning.md +1 -5
- 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 +2 -5
- 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
|
@@ -13,17 +13,17 @@ import { execSync } from "node:child_process";
|
|
|
13
13
|
import { join, relative, basename, dirname, sep } from "node:path";
|
|
14
14
|
import { getFrameworkRoot } from "../utils/paths.js";
|
|
15
15
|
import { getIDEFolder } from "../config/ide-config.js";
|
|
16
|
-
import { extractFrontmatterBlock } from "../utils/frontmatter.js";
|
|
16
|
+
import { extractFrontmatterBlock, readDescription } from "../utils/frontmatter.js";
|
|
17
17
|
import { readCompanyProfile } from "./company-profile.js";
|
|
18
|
+
import { parseAppliesTo, matchesProfile } from "./profile-filter.js";
|
|
18
19
|
import {
|
|
19
20
|
SYNC_DIRS,
|
|
20
21
|
SYNC_ROOT_FILES,
|
|
22
|
+
SYNC_EXCLUDE,
|
|
21
23
|
OBSOLETE_PATHS,
|
|
22
24
|
LOCK_FILE,
|
|
23
25
|
OPENCODE_MODEL_MAP,
|
|
24
26
|
OPENCODE_DEFAULT_PERMISSIONS,
|
|
25
|
-
OPENCODE_STRIP_FIELDS,
|
|
26
|
-
KIRO_STRIP_FIELDS,
|
|
27
27
|
KIRO_HUB_FILE_PATTERNS,
|
|
28
28
|
} from "../config/constants.js";
|
|
29
29
|
|
|
@@ -36,11 +36,7 @@ function parseSkillFrontmatter(content) {
|
|
|
36
36
|
const fm = extractFrontmatterBlock(content);
|
|
37
37
|
if (fm === null) return null;
|
|
38
38
|
const name = (fm.match(/^name:\s*(.+)$/m) || [])[1]?.trim();
|
|
39
|
-
|
|
40
|
-
const descMatch = fm.match(/^description:\s*[>|]?\n?([\s\S]*?)(?=\n\S|\n---|Z)/m);
|
|
41
|
-
const description = descMatch
|
|
42
|
-
? descMatch[1].replace(/^\s+/gm, "").replace(/\n+/g, " ").trim()
|
|
43
|
-
: "";
|
|
39
|
+
const description = readDescription(fm);
|
|
44
40
|
return name ? { name, description } : null;
|
|
45
41
|
}
|
|
46
42
|
|
|
@@ -66,6 +62,18 @@ function generateCodexOpenAIYaml(skillsDir) {
|
|
|
66
62
|
}
|
|
67
63
|
}
|
|
68
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
|
+
|
|
69
77
|
export function syncAssets(targetDir, ide, opts = {}) {
|
|
70
78
|
const frameworkRoot = getFrameworkRoot();
|
|
71
79
|
const ideDir = join(targetDir, `.${getIDEFolder(ide)}`);
|
|
@@ -88,7 +96,12 @@ export function syncAssets(targetDir, ide, opts = {}) {
|
|
|
88
96
|
|
|
89
97
|
try {
|
|
90
98
|
if (!opts.dryRun) {
|
|
91
|
-
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
|
+
});
|
|
92
105
|
}
|
|
93
106
|
result.copied.push(`${destDirName}/`);
|
|
94
107
|
} catch (err) {
|
|
@@ -121,10 +134,12 @@ export function syncAssets(targetDir, ide, opts = {}) {
|
|
|
121
134
|
}
|
|
122
135
|
}
|
|
123
136
|
|
|
124
|
-
// 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).
|
|
125
140
|
const workflowsDest = join(ideDir, opts.workflowsFolder || "workflows");
|
|
126
141
|
if (existsSync(workflowsDest)) {
|
|
127
|
-
const moved = flattenDir(workflowsDest);
|
|
142
|
+
const moved = flattenDir(workflowsDest, undefined, ide === "kiro" ? ["skills"] : []);
|
|
128
143
|
if (moved > 0) result.copied.push(`(flatten) ${moved} workflows movidos para raiz`);
|
|
129
144
|
}
|
|
130
145
|
|
|
@@ -304,12 +319,15 @@ function removeOrphanOverlayRules(ideDir, overlayDir, result, { dryRun, framewor
|
|
|
304
319
|
* ou apagado dentro dela. Caminho que resolve (realpath) para fora do overlay é ignorado com aviso.
|
|
305
320
|
* @param {string} ideDir - Pasta da IDE (ex.: `{workspace}/.claude`)
|
|
306
321
|
* @param {{ copied: string[], skipped: string[], errors: string[] }} result - Acumulador do sync
|
|
307
|
-
* @param {{ dryRun?: boolean }} [opts]
|
|
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
|
|
308
324
|
* @returns {string} O perfil ativo
|
|
309
325
|
*/
|
|
310
|
-
export function applyRuleOverlay(ideDir, result, { dryRun = false, frameworkRoot } = {}) {
|
|
311
|
-
|
|
312
|
-
|
|
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
|
+
}
|
|
313
331
|
const { profile, warning } = readCompanyProfile(envText);
|
|
314
332
|
if (warning) result.skipped.push(`(overlay) ${warning}`);
|
|
315
333
|
|
|
@@ -361,6 +379,120 @@ export function applyRuleOverlay(ideDir, result, { dryRun = false, frameworkRoot
|
|
|
361
379
|
return profile;
|
|
362
380
|
}
|
|
363
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
|
+
|
|
364
496
|
/**
|
|
365
497
|
* Detecta RTK no PATH e reconcilia RTK_ENABLED no ENV.md + rtk-rules.md na IDE.
|
|
366
498
|
* - RTK encontrado → RTK_ENABLED=true no ENV.md, mantém rule
|
|
@@ -372,14 +504,7 @@ export function applyRuleOverlay(ideDir, result, { dryRun = false, frameworkRoot
|
|
|
372
504
|
function reconcileRtk(ideDir, targetDir, ide, { keepEnvValues = false } = {}) {
|
|
373
505
|
const rtkRulePath = join(ideDir, "rules", "rtk-rules.md");
|
|
374
506
|
const envPath = join(ideDir, "ENV.md");
|
|
375
|
-
const hasRtk = (
|
|
376
|
-
try {
|
|
377
|
-
execSync("rtk gain --help 2>/dev/null", { stdio: "pipe" });
|
|
378
|
-
return true;
|
|
379
|
-
} catch {
|
|
380
|
-
return false;
|
|
381
|
-
}
|
|
382
|
-
})();
|
|
507
|
+
const hasRtk = rtkAvailable();
|
|
383
508
|
|
|
384
509
|
if (hasRtk) {
|
|
385
510
|
// Ativar RTK_ENABLED no ENV.md se existir e estiver false
|
|
@@ -413,7 +538,7 @@ function reconcileRtk(ideDir, targetDir, ide, { keepEnvValues = false } = {}) {
|
|
|
413
538
|
|
|
414
539
|
/**
|
|
415
540
|
* Resolve o model Jarvis para formato OpenCode (provider/model-id).
|
|
416
|
-
* @param {string} model - Model no formato Jarvis (ex: "opus", "claude-sonnet-
|
|
541
|
+
* @param {string} model - Model no formato Jarvis (ex: "opus", "claude-sonnet-5")
|
|
417
542
|
* @returns {string} Model no formato OpenCode (ex: "anthropic/claude-opus-4-6")
|
|
418
543
|
*/
|
|
419
544
|
function resolveOpenCodeModel(model) {
|
|
@@ -449,7 +574,7 @@ function transformOpenCodeAgents(agentsDir) {
|
|
|
449
574
|
const body = content.slice(fmMatch[0].length).trim();
|
|
450
575
|
|
|
451
576
|
// Extract fields from Jarvis frontmatter
|
|
452
|
-
const description = (fm
|
|
577
|
+
const description = readDescription(fm);
|
|
453
578
|
const model = (fm.match(/^model:\s*(.+)$/m) || [])[1]?.trim();
|
|
454
579
|
const name = basename(filePath, ".md");
|
|
455
580
|
const isMainAgent = name === "eng.agent" || name === "eng-agent";
|
|
@@ -471,7 +596,7 @@ function transformOpenCodeAgents(agentsDir) {
|
|
|
471
596
|
|
|
472
597
|
/**
|
|
473
598
|
* Transforma frontmatter de commands (workflows) Jarvis para formato OpenCode.
|
|
474
|
-
*
|
|
599
|
+
* Remonta o frontmatter só com description, agent (nome) e model (resolvido de recommended_model).
|
|
475
600
|
* @param {string} commandsDir - Caminho para .opencode/commands/
|
|
476
601
|
*/
|
|
477
602
|
function transformOpenCodeCommands(commandsDir) {
|
|
@@ -488,7 +613,7 @@ function transformOpenCodeCommands(commandsDir) {
|
|
|
488
613
|
const body = content.slice(fmMatch[0].length).trim();
|
|
489
614
|
|
|
490
615
|
// Extract fields
|
|
491
|
-
const description = (fm
|
|
616
|
+
const description = readDescription(fm);
|
|
492
617
|
const model =
|
|
493
618
|
(fm.match(/^recommended_model:\s*(.+)$/m) || [])[1]?.trim() ||
|
|
494
619
|
(fm.match(/^model:\s*(.+)$/m) || [])[1]?.trim();
|
|
@@ -541,11 +666,19 @@ function collectMdFiles(dir, acc) {
|
|
|
541
666
|
}
|
|
542
667
|
}
|
|
543
668
|
|
|
544
|
-
|
|
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 = []) {
|
|
545
677
|
const root = rootDir ?? dir;
|
|
546
678
|
let moved = 0;
|
|
547
679
|
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
548
680
|
const fullPath = join(dir, entry.name);
|
|
681
|
+
if (entry.isDirectory() && skip.includes(entry.name)) continue;
|
|
549
682
|
if (entry.isDirectory()) {
|
|
550
683
|
moved += flattenDir(fullPath, root);
|
|
551
684
|
try {
|
|
@@ -566,9 +699,7 @@ function flattenDir(dir, rootDir) {
|
|
|
566
699
|
|
|
567
700
|
/**
|
|
568
701
|
* Converte o frontmatter de um arquivo .md para um steering file Kiro.
|
|
569
|
-
* -
|
|
570
|
-
* - Adiciona `inclusion` se não presente
|
|
571
|
-
* - Preserva `name` e `description`
|
|
702
|
+
* - Remonta o frontmatter só com inclusion e description (e fileMatchPattern, quando houver)
|
|
572
703
|
* @param {string} content - Conteúdo original do .md
|
|
573
704
|
* @param {string} inclusion - Valor de inclusion: "auto" | "manual" | "fileMatch"
|
|
574
705
|
* @param {string} [fileMatchPattern] - Pattern para inclusion: fileMatch
|
|
@@ -585,13 +716,7 @@ function toKiroSteeringFile(content, inclusion, fileMatchPattern) {
|
|
|
585
716
|
|
|
586
717
|
if (fmMatch) {
|
|
587
718
|
const fm = fmMatch[1];
|
|
588
|
-
const
|
|
589
|
-
[])[1];
|
|
590
|
-
const descInline = (fm.match(/^description:\s*(.+)$/m) || [])[1];
|
|
591
|
-
const finalDesc = (description || descInline || "")
|
|
592
|
-
.replace(/^\s+/gm, "")
|
|
593
|
-
.replace(/\n+/g, " ")
|
|
594
|
-
.trim();
|
|
719
|
+
const finalDesc = readDescription(fm);
|
|
595
720
|
if (finalDesc) lines.push(`description: "${finalDesc.replace(/"/g, '\\"')}"`);
|
|
596
721
|
}
|
|
597
722
|
|
|
@@ -611,6 +736,24 @@ function detectRuleHub(content) {
|
|
|
611
736
|
return hub === "ALL" ? null : hub;
|
|
612
737
|
}
|
|
613
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
|
+
|
|
614
757
|
/**
|
|
615
758
|
* Transforma os assets copiados para .kiro/ em steering files.
|
|
616
759
|
* 1. Workflows em steering/ → adiciona inclusion: manual
|
|
@@ -641,19 +784,7 @@ function transformKiroAssets(kiroDir, targetDir) {
|
|
|
641
784
|
const ruleFiles = [];
|
|
642
785
|
collectMdFiles(rulesDir, ruleFiles);
|
|
643
786
|
|
|
644
|
-
for (const filePath of ruleFiles)
|
|
645
|
-
const name = basename(filePath);
|
|
646
|
-
// Ignorar arquivos de índice/meta
|
|
647
|
-
if (name === "AGENTS.md" || name === "README.md") continue;
|
|
648
|
-
|
|
649
|
-
const content = readFileSync(filePath, "utf-8");
|
|
650
|
-
const hub = detectRuleHub(content);
|
|
651
|
-
const pattern = hub ? KIRO_HUB_FILE_PATTERNS[hub] : null;
|
|
652
|
-
const inclusion = pattern ? "fileMatch" : "auto";
|
|
653
|
-
const transformed = toKiroSteeringFile(content, inclusion, pattern);
|
|
654
|
-
|
|
655
|
-
writeFileSync(join(steeringDir, name), transformed, "utf-8");
|
|
656
|
-
}
|
|
787
|
+
for (const filePath of ruleFiles) writeKiroRuleSteering(kiroDir, filePath);
|
|
657
788
|
}
|
|
658
789
|
|
|
659
790
|
// 3. Skills — copiar SKILL.md de cada skill para steering/skills/skill-{nome}.md
|
|
@@ -671,6 +802,8 @@ function transformKiroAssets(kiroDir, targetDir) {
|
|
|
671
802
|
const content = readFileSync(skillMdPath, "utf-8");
|
|
672
803
|
const transformed = toKiroSteeringFile(content, "manual");
|
|
673
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 });
|
|
674
807
|
}
|
|
675
808
|
}
|
|
676
809
|
}
|