wrxn-reversa 1.8.1 → 1.8.2

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/README.md CHANGED
@@ -49,7 +49,7 @@ The installer will:
49
49
  2. Ask which agents to install — all selected by default
50
50
  3. Collect project name, language, and preferences
51
51
  4. Install skills in `.agents/skills/` and add a discovery mirror for engines such as Claude Code.
52
- 5. Write the routing card for each engine (`.claude/rules/reversa.md`, `.agents/rules/reversa.md`, or a marked block in `AGENTS.md`, etc.)
52
+ 5. Write the routing card in a marked block in `AGENTS.md`, in `CLAUDE.md` for Claude Code, and in the engine rule files.
53
53
  6. Create the `.reversa/` structure with state, configuration, and plan
54
54
  7. Generate SHA-256 manifest for safe updates
55
55
 
@@ -416,9 +416,9 @@ Every statement in the specs is marked with:
416
416
 
417
417
  | Engine | File created | Skills path | Activation |
418
418
  |--------|-------------|-------------|------------|
419
- | Claude Code ⭐ | `.claude/rules/reversa.md` | `.claude/skills/reversa-*/` and `.agents/skills/reversa-*/` | `/reversa` |
419
+ | Claude Code ⭐ | `CLAUDE.md` and `.claude/rules/reversa.md` | `.claude/skills/reversa-*/` and `.agents/skills/reversa-*/` | `/reversa` |
420
420
  | Codex ⭐ | `AGENTS.md` | `.agents/skills/reversa-*/` | `reversa` |
421
- | OMP ⭐ | `.agents/rules/reversa.md` | `.agents/skills/reversa-*/` | `reversa` |
421
+ | OMP ⭐ | `AGENTS.md` and `.agents/rules/reversa.md` | `.agents/skills/reversa-*/` | `reversa` |
422
422
  | Cursor ⭐ | `.cursor/rules/reversa.mdc` | `.agents/skills/reversa-*/` | `/reversa` |
423
423
  | Gemini CLI | `GEMINI.md` | `.agents/skills/reversa-*/` | `/reversa` |
424
424
  | Windsurf | `.windsurfrules` | `.agents/skills/reversa-*/` | `/reversa` |
@@ -3,16 +3,17 @@ import { join } from 'path';
3
3
  import { execFileSync } from 'child_process';
4
4
 
5
5
  import { CANONICAL_SKILLS_DIR } from './skill-layout.js';
6
- const AGENTS_BLOCK = { file: 'AGENTS.md', kind: 'block' };
6
+ const AGENTS_BLOCK = { file: 'AGENTS.md', kind: 'block', addOnUpdate: true };
7
+ const CLAUDE_BLOCK = { file: 'CLAUDE.md', kind: 'block', compact: true, addOnUpdate: true };
7
8
  const engine = (id, name, star, entry, skillsDir = CANONICAL_SKILLS_DIR) => ({ id, name, star, entry, skillsDir });
8
9
 
9
10
  // entry: onde fica o cartão de roteamento do Reversa.
10
11
  // kind 'owned' = arquivo só do Reversa; 'block' = bloco com marcas num arquivo do usuário.
11
12
  export const ENGINES = [
12
13
  engine('claude-code', 'Claude Code', true,
13
- { file: '.claude/rules/reversa.md', kind: 'owned', compact: true, legacyFile: 'CLAUDE.md' }, '.claude/skills'),
14
+ { file: '.claude/rules/reversa.md', kind: 'owned', compact: true }, '.claude/skills'),
14
15
  engine('codex', 'Codex', true, AGENTS_BLOCK),
15
- engine('omp', 'OMP', true, { file: '.agents/rules/reversa.md', kind: 'owned' }),
16
+ engine('omp', 'OMP', true, AGENTS_BLOCK),
16
17
  engine('cursor', 'Cursor', true,
17
18
  { file: '.cursor/rules/reversa.mdc', kind: 'owned', frontmatter: 'alwaysApply', legacyFile: '.cursorrules' }),
18
19
  engine('gemini-cli', 'Gemini CLI', false, { file: 'GEMINI.md', kind: 'block' }),
@@ -33,8 +34,9 @@ export const SHARED_RULE = { file: '.agents/rules/reversa.md', kind: 'owned', fr
33
34
 
34
35
  // Destinos únicos do cartão para um conjunto de engines.
35
36
  export function entryTargets(engines) {
36
- const targets = new Map([[SHARED_RULE.file, SHARED_RULE]]);
37
- for (const { entry } of engines) {
37
+ const targets = new Map([[SHARED_RULE.file, SHARED_RULE], [AGENTS_BLOCK.file, AGENTS_BLOCK]]);
38
+ for (const { id, entry } of engines) {
39
+ if (id === 'claude-code') targets.set(CLAUDE_BLOCK.file, CLAUDE_BLOCK);
38
40
  const seen = targets.get(entry.file);
39
41
  if (!seen) targets.set(entry.file, entry);
40
42
  else if (entry.compact && !seen.compact) targets.set(entry.file, { ...seen, compact: true });
@@ -424,20 +424,22 @@ export class Writer {
424
424
  for (const target of targets) {
425
425
  const card = renderCard(target, opts);
426
426
  if (target.kind === 'owned') this._planContent(plan, target.file, card, index);
427
- else this._planBlock(plan, target.file, card, index, records);
427
+ else this._planBlock(plan, target, card, index, records);
428
428
  if (target.legacyFile) this._planLegacy(plan, target.legacyFile, index);
429
429
  }
430
430
  return plan;
431
431
  }
432
432
 
433
- _planBlock(plan, rel, card, index, records) {
433
+ _planBlock(plan, { file: rel, addOnUpdate }, card, index, records) {
434
434
  const block = renderBlock(card);
435
435
  const sha256 = cardHash(card);
436
436
  const state = pathState(this.projectRoot, rel);
437
437
  const dropKey = index.get(rel)?.key;
438
438
  if (state === 'missing') {
439
- if (records[rel]?.mode === 'created' || index.has(rel)) {
440
- plan.writes.push({ rel, reason: 'restore', content: block, block: { mode: 'created', sha256 }, dropKey });
439
+ if (records[rel]?.mode === 'skipped') return;
440
+ const restore = records[rel]?.mode === 'created' || index.has(rel);
441
+ if (restore || addOnUpdate) {
442
+ plan.writes.push({ rel, reason: restore ? 'restore' : 'new', content: block, block: { mode: 'created', sha256 }, dropKey });
441
443
  }
442
444
  return;
443
445
  }
@@ -466,15 +468,20 @@ export class Writer {
466
468
  plan.kept.push({ rel, reason: 'damaged markers' });
467
469
  } else {
468
470
  const legacy = findLegacyBlock(text);
469
- if (!legacy) return;
471
+ if (!legacy && (!addOnUpdate || records[rel]?.mode === 'skipped')) return;
472
+ const content = upsertBlock(text, block, legacy);
473
+ if (rel === 'AGENTS.md' && Buffer.byteLength(content) > 32768) {
474
+ plan.kept.push({ rel, reason: "would exceed Codex's 32 KiB project_doc_max_bytes limit" });
475
+ return;
476
+ }
470
477
  plan.writes.push({
471
- rel, reason: 'migrate', content: upsertBlock(text, block, legacy), baseline,
472
- block: { mode: index.has(rel) && legacy.start === 0 ? 'created' : 'merged', sha256 }, dropKey,
478
+ rel, reason: legacy ? 'migrate' : 'refresh', content, baseline,
479
+ block: { mode: index.has(rel) && legacy?.start === 0 ? 'created' : 'merged', sha256 }, dropKey,
473
480
  });
474
481
  }
475
482
  }
476
483
 
477
- // Arquivo usado antes do cartão (CLAUDE.md, .cursorrules): sai só o texto do Reversa.
484
+ // Remove the old Reversa text after moving the card to a different file.
478
485
  _planLegacy(plan, rel, index) {
479
486
  if (pathState(this.projectRoot, rel) !== 'file') return;
480
487
  const text = readFileSync(join(this.projectRoot, rel), 'utf8');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrxn-reversa",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "description": "Transform legacy systems into executable specifications for AI coding agents",
5
5
  "bin": {
6
6
  "wrxn-reversa": "bin/reversa.js"