@mrciphersmith/roomyx 0.11.3 → 0.11.4

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/CHANGELOG.md CHANGED
@@ -13,6 +13,39 @@ patch and never a minor. The rule, the reason, and an audit of the four of seven
13
13
  releases that followed it are in
14
14
  [`docs/roomyx/versioning.md`](docs/roomyx/versioning.md) and decision D-13.
15
15
 
16
+ ## [0.11.4] — 2026-09-11
17
+
18
+ A patch about not doing things.
19
+
20
+ ### Changed
21
+
22
+ - **A sync that would change nothing does nothing.** `syncSkill` had no
23
+ "already up to date" branch, so every `--yes` rewrote the file with the same
24
+ bytes and left another backup beside it. Run after each release, that is a
25
+ directory of identical copies and a modification time that lies about when the
26
+ skill last changed. It now reports `already in sync`, touches neither the file
27
+ nor a backup, and still adopts the hash — so a copy roomyx did not write but
28
+ that matches what it would have written stops being treated as unrecorded
29
+ content.
30
+ - **One backup, at a fixed name.** `SKILL.md.bak` replaces
31
+ `SKILL.md.bak-<timestamp>`. Nobody reads the fourth-oldest copy of a skill
32
+ file; a backup exists to undo the change that was just made, and combined with
33
+ the branch above it now always holds the last version that actually differed.
34
+ - `SyncResult` gains `upToDate`, so a caller can tell "nothing to do" from a
35
+ refusal. `roomyx init`, `roomyx setup` and `roomyx skills sync` all say which
36
+ one happened.
37
+
38
+ ### Fixed
39
+
40
+ - **`roomyx init` no longer re-derives a rule `syncSkill` owns.** It re-read
41
+ both files and compared them itself to decide whether the staged copy was
42
+ already the bundled skill. The two promptly disagreed: the early return above
43
+ stopped building the warnings `init` was reading to infer that same fact, and
44
+ the adoption path went silent — a moved project would have kept a stale staged
45
+ copy forever. It now asks for the verdict instead of computing a second
46
+ opinion. Caught by an existing test, which is the only reason this is a
47
+ paragraph and not a defect.
48
+
16
49
  ## [0.11.3] — 2026-09-11
17
50
 
18
51
  A patch, and a deliberately partial one: it makes a known gap visible instead of
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrciphersmith/roomyx",
3
- "version": "0.11.3",
3
+ "version": "0.11.4",
4
4
  "description": "MCP server + terminal UI for startup-room: live room status, chat, per-agent modal, an installable room registry, and skill-sync.",
5
5
  "publishConfig": {
6
6
  "access": "public"
package/src/cli.ts CHANGED
@@ -803,7 +803,9 @@ const COMMANDS: Record<string, Command> = {
803
803
  });
804
804
  console.log(name === path ? path : `${name}: ${path}`);
805
805
  for (const warning of result.warnings) console.log(` warning: ${warning}`);
806
- if (result.written) {
806
+ if (result.upToDate) {
807
+ console.log(" already in sync — nothing written, no backup made");
808
+ } else if (result.written) {
807
809
  console.log(result.backedUpTo ? ` written (backup: ${result.backedUpTo})` : " written");
808
810
  } else {
809
811
  // "not written" was the message whenever `dryRun` was false, which
@@ -61,6 +61,7 @@ function applyOne(item: PlanItem, context: ApplyContext): string {
61
61
  // they saw the exact path before agreeing to it.
62
62
  yes: true,
63
63
  });
64
+ if (result.upToDate) return "already in sync";
64
65
  if (!result.written) return result.warnings[0] ?? "not written";
65
66
  return result.backedUpTo ? `written (backup: ${result.backedUpTo})` : "written";
66
67
  }
@@ -76,34 +76,32 @@ export function init(options: InitOptions): InitResult {
76
76
 
77
77
  // Asked before writing, so the decision is made from `syncSkill`'s own
78
78
  // verdict rather than from a second copy of its rules here.
79
+ //
80
+ // It *was* a second copy: this function re-read both files and compared them
81
+ // itself to work out whether the staged copy was already the bundled skill.
82
+ // `syncSkill` now answers that directly with `upToDate`, and asking it is the
83
+ // only way the two cannot disagree — which they did, the moment `syncSkill`
84
+ // learned to return early on identical content and stopped building the
85
+ // warnings this code was reading to infer the same fact.
79
86
  const dryRun = syncSkill({ ...syncOptions, dryRun: true });
80
- const bundledContent = readFileSync(options.bundledSkillPath, "utf8");
81
- const stagedContent = existsSync(stagedSkill) ? readFileSync(stagedSkill, "utf8") : null;
82
- const identical = stagedContent === bundledContent;
83
87
 
84
- if (dryRun.warnings.length > 0 && !identical) {
85
- // Ours to refresh only while it is still ours. A hand-edited or unrecorded
86
- // staged copy is left exactly as it is, and the caller is told why — the
87
- // silence was the defect, not the staleness.
88
- return { created: !registryAlreadyHasRooms, roomyxDir, skillWarnings: dryRun.warnings };
89
- }
90
- if (dryRun.warnings.length > 0 && identical) {
91
- // The refusal protects content, and byte-identical content cannot be lost —
92
- // so there is nothing to refuse. Writing here is what records the hash, and
93
- // the hash is what the next real upgrade needs: the sync keys its records by
88
+ if (dryRun.upToDate) {
89
+ // Byte-identical, so there is nothing a refusal could protect. The call
90
+ // records the hash and writes no file: the sync keys its records by
94
91
  // absolute path, so a moved project otherwise keeps this copy stale forever
95
- // and says so on every run. One adoption, one backup, and refreshes work
96
- // again.
92
+ // and says so on every run.
97
93
  syncSkill({ ...syncOptions, yes: true });
98
94
  return { created: !registryAlreadyHasRooms, roomyxDir };
99
95
  }
100
96
 
101
- if (!identical) {
102
- // Only when there is a difference: a write with identical content still
103
- // takes a timestamped backup, so a no-op `init` would fill the directory
104
- // with copies of the same file and make a real backup impossible to find.
105
- syncSkill({ ...syncOptions, yes: true });
97
+ if (dryRun.warnings.length > 0) {
98
+ // Ours to refresh only while it is still ours. A hand-edited or unrecorded
99
+ // staged copy is left exactly as it is, and the caller is told why — the
100
+ // silence was the defect, not the staleness.
101
+ return { created: !registryAlreadyHasRooms, roomyxDir, skillWarnings: dryRun.warnings };
106
102
  }
107
103
 
104
+ syncSkill({ ...syncOptions, yes: true });
105
+
108
106
  return { created: !registryAlreadyHasRooms, roomyxDir };
109
107
  }
@@ -17,6 +17,13 @@ export interface SyncResult {
17
17
  written: boolean;
18
18
  backedUpTo: string | null;
19
19
  warnings: string[];
20
+ /**
21
+ * The target already holds exactly the bundled content, so there was nothing
22
+ * to do. Distinct from `written: false`, which also covers a refusal — a
23
+ * caller that cannot tell them apart prints "not written" at someone whose
24
+ * file is perfectly up to date.
25
+ */
26
+ upToDate: boolean;
20
27
  }
21
28
 
22
29
  function hashOf(content: string): string {
@@ -50,6 +57,28 @@ export function syncSkill(options: SyncOptions): SyncResult {
50
57
 
51
58
  const targetExists = existsSync(options.targetPath);
52
59
  const targetContent = targetExists ? readFileSync(options.targetPath, "utf8") : null;
60
+
61
+ // Byte-identical: do nothing, and say so.
62
+ //
63
+ // There was no such branch, so every `--yes` rewrote the file and left another
64
+ // `.bak-<timestamp>` beside it even when not one character differed. Run on a
65
+ // schedule, or after each release, that is a directory of identical backups
66
+ // and a modification time that lies about when the skill last changed.
67
+ //
68
+ // The hash is still adopted, so a file roomyx did not write but that matches
69
+ // what it would have written stops being "unrecorded content" — the next real
70
+ // update then proceeds without a warning about hand edits that do not exist.
71
+ // Adopted only under `yes`, because the CLI promises that without it nothing
72
+ // is written, and the config is a file.
73
+ if (targetContent === bundledContent) {
74
+ if (options.dryRun !== true && options.yes === true && lastSyncedHash !== hashOf(bundledContent)) {
75
+ writeConfig(options.configPath, {
76
+ ...config,
77
+ lastSyncedHashes: { ...config.lastSyncedHashes, [options.targetPath]: hashOf(bundledContent) },
78
+ });
79
+ }
80
+ return { wouldWrite: false, written: false, backedUpTo: null, warnings: [], upToDate: true };
81
+ }
53
82
  // Two distinct "don't touch this blindly" cases, both requiring --yes:
54
83
  // (a) we synced before and the target has since been hand-edited, or
55
84
  // (b) the target already existed with content we have no record of ever
@@ -83,12 +112,19 @@ export function syncSkill(options: SyncOptions): SyncResult {
83
112
  // subsumed: nothing reaches here without `yes: true`. The warnings above are
84
113
  // still built, so a refusal still says which target had unrecorded content.
85
114
  if (options.dryRun === true || options.yes !== true) {
86
- return { wouldWrite: true, written: false, backedUpTo: null, warnings };
115
+ return { wouldWrite: true, written: false, backedUpTo: null, warnings, upToDate: false };
87
116
  }
88
117
 
118
+ // ONE backup, at a fixed name, replaced each time.
119
+ //
120
+ // It used to be `.bak-<timestamp>`, which kept every version forever. Nobody
121
+ // reads the fourth-oldest copy of a skill file; what a backup is for is
122
+ // undoing the change that was just made. Combined with the identical-content
123
+ // branch above, this file now always holds the last version that actually
124
+ // differed — a no-op sync does not touch it.
89
125
  let backedUpTo: string | null = null;
90
126
  if (targetExists) {
91
- backedUpTo = `${options.targetPath}.bak-${new Date().toISOString().replace(/[:.]/g, "-")}`;
127
+ backedUpTo = `${options.targetPath}.bak`;
92
128
  copyFileSync(options.targetPath, backedUpTo);
93
129
  }
94
130
 
@@ -103,5 +139,5 @@ export function syncSkill(options: SyncOptions): SyncResult {
103
139
  lastSyncedHashes: { ...config.lastSyncedHashes, [options.targetPath]: hashOf(bundledContent) },
104
140
  });
105
141
 
106
- return { wouldWrite: true, written: true, backedUpTo, warnings };
142
+ return { wouldWrite: true, written: true, backedUpTo, warnings, upToDate: false };
107
143
  }