@rowan-hiro/inkan 0.2.1 → 0.2.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.
Files changed (3) hide show
  1. package/README.md +2 -1
  2. package/package.json +1 -1
  3. package/src/api.js +9 -0
package/README.md CHANGED
@@ -208,7 +208,8 @@ must carry, and leaves flag-level syntax to `inkan help`, so a CLI change
208
208
  does not bump the protocol. The block carries a protocol number. `init`
209
209
  upgrades a block it generated under an earlier protocol in place and refuses
210
210
  to overwrite a block that was edited by hand, so the policy lives in exactly
211
- one place. `--lang <tag>` sets the language agents should write outcome
211
+ one place. A block stamped with a protocol newer than the installed Inkan
212
+ is reported as such, with a prompt to upgrade the tool, not as a hand edit. `--lang <tag>` sets the language agents should write outcome
212
213
  prose in. `inkan init --claude` also creates `CLAUDE.md` as a symlink to
213
214
  `AGENTS.md`: Claude Code reads its own file name, and there is still one
214
215
  policy, not a copy.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rowan-hiro/inkan",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Seal the authoritative outcome; keep a trustworthy record of the process.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/api.js CHANGED
@@ -651,6 +651,15 @@ function writeProtocol(dir, lang) {
651
651
  fs.writeFileSync(agentsFile, content, 'utf8');
652
652
  return { root: dir, agentsFile, changed: true };
653
653
  }
654
+ // A block stamped with a protocol this tool does not know yet was written
655
+ // by a newer Inkan, not by hand. Say so and leave it alone.
656
+ const stamped = found.text.match(/<!-- inkan-protocol: (\d+) -->/);
657
+ const foundVersion = stamped ? Number(stamped[1]) : 0;
658
+ if (foundVersion > PROTOCOL_VERSION) {
659
+ throw new InkanError(
660
+ `${AGENTS_FILENAME} inkan block is protocol ${foundVersion}; this Inkan knows up to ${PROTOCOL_VERSION}. Upgrade Inkan; refusing to overwrite it`,
661
+ );
662
+ }
654
663
  throw new InkanError(`${AGENTS_FILENAME} inkan block was edited by hand; refusing to overwrite it`);
655
664
  }
656
665