innernote 0.3.1 → 0.3.3

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
@@ -100,6 +100,7 @@ from it fails the suite, so what you read here is what the binary has.
100
100
  | `week` | what is scheduled for the next seven days |
101
101
  | `queue <post-id>` | schedule a post into your next open slot |
102
102
  | `unqueue <post-id>` | pull it back out before it goes live |
103
+ | `skill [--install]` | print the agent skill, or register it for Claude Code |
103
104
 
104
105
  ### write
105
106
 
package/dist/index.js CHANGED
@@ -261,6 +261,14 @@ var MARK_BLOCK_COUNT = MARK_GRID.reduce((n, row) => n + row.split("").filter((c)
261
261
  function paintRGB(r, g, b, s) {
262
262
  return paint(r, g, b, s);
263
263
  }
264
+ function paintBgRGB(r, g, b, s) {
265
+ if (!wantsColor)
266
+ return s;
267
+ if (truecolor)
268
+ return `\x1B[48;2;${r};${g};${b}m${s}\x1B[49m`;
269
+ const q = (v) => Math.round(v / 255 * 5);
270
+ return `\x1B[48;5;${16 + 36 * q(r) + 6 * q(g) + q(b)}m${s}\x1B[49m`;
271
+ }
264
272
  function logo(cells = 2) {
265
273
  return MARK_GRID.map((row) => row.split("").map((c) => c === "#" ? "█".repeat(cells) : " ".repeat(cells)).join(""));
266
274
  }
@@ -716,20 +724,47 @@ function level(s, t) {
716
724
  const tri = up <= 1 ? up : 2 - up;
717
725
  return 0.18 + tri * 0.82;
718
726
  }
719
- function paintAt(level2, s) {
727
+ function rampAt(level2) {
720
728
  const from = [74, 58, 44];
721
729
  const to = [232, 201, 176];
722
730
  const c = (i) => Math.round(from[i] + (to[i] - from[i]) * level2);
723
- return paintRGB(c(0), c(1), c(2), s);
731
+ return [c(0), c(1), c(2)];
724
732
  }
725
733
  function frame(t) {
726
734
  const grid = logoGrid();
727
735
  const lit = new Map;
728
736
  for (const s of SPARKS)
729
737
  lit.set(`${s.row},${s.col}`, level(s, t));
730
- return grid.map((line, row) => line.split("").map((ch, col) => ch === "#" ? paintAt(lit.get(`${row},${col}`) ?? 0.18, "██") : " ").join(""));
738
+ const levelAt = (row, col) => {
739
+ if (row >= grid.length || grid[row][col] !== "#")
740
+ return null;
741
+ return lit.get(`${row},${col}`) ?? 0.18;
742
+ };
743
+ const rows = [];
744
+ for (let top = 0;top < grid.length; top += 2) {
745
+ let line = "";
746
+ for (let col = 0;col < grid[0].length; col++) {
747
+ const upper = levelAt(top, col);
748
+ const lower = levelAt(top + 1, col);
749
+ if (upper == null && lower == null) {
750
+ line += " ";
751
+ } else if (upper != null && lower == null) {
752
+ const [r, g, b] = rampAt(upper);
753
+ line += paintRGB(r, g, b, "▀");
754
+ } else if (upper == null && lower != null) {
755
+ const [r, g, b] = rampAt(lower);
756
+ line += paintRGB(r, g, b, "▄");
757
+ } else {
758
+ const [r, g, b] = rampAt(upper);
759
+ const [br, bg, bb] = rampAt(lower);
760
+ line += paintBgRGB(br, bg, bb, paintRGB(r, g, b, "▀"));
761
+ }
762
+ }
763
+ rows.push(line.trimEnd());
764
+ }
765
+ return rows;
731
766
  }
732
- var HEIGHT = 9;
767
+ var HEIGHT = 5;
733
768
 
734
769
  class Thinking {
735
770
  phases;
@@ -760,7 +795,7 @@ class Thinking {
760
795
  this.label = p.text;
761
796
  const rows = frame(t);
762
797
  const mid = Math.floor(rows.length / 2);
763
- const out2 = rows.map((r, i) => ` ${r}${i === mid ? ` \x1B[2m${this.label}\x1B[0m` : ""}`).join(`
798
+ const out2 = rows.map((r, i) => ` ${r}${i === mid ? ` \x1B[2m${this.label}\x1B[0m` : ""}`).join(`
764
799
  `);
765
800
  if (this.drawn)
766
801
  process.stderr.write(`\x1B[${HEIGHT}A`);
@@ -1375,6 +1410,12 @@ var COMMANDS = {
1375
1410
  detail: "The undo for queue, while there is still time. The post returns to your drafts and nothing goes live. Once it has been published this refuses, because a live post cannot be unsent this way.",
1376
1411
  examples: ["innernote unqueue p17abc...", "innernote unqueue 3"]
1377
1412
  },
1413
+ skill: {
1414
+ summary: "print the agent skill, or install it for Claude Code",
1415
+ usage: "innernote skill [--install]",
1416
+ detail: "The playbook an agent should read before driving this CLI: the loop, the read-before-write rule, what the exit codes mean, and the one rule that protects real people. Prints to stdout so any agent can take it. --install also registers it in ~/.claude/skills so Claude Code knows it in every future session.",
1417
+ examples: ["innernote skill", "innernote skill --install"]
1418
+ },
1378
1419
  context: {
1379
1420
  summary: "what you post about: your pillars and your series",
1380
1421
  usage: "innernote context",
@@ -1498,7 +1539,7 @@ function suggest(state) {
1498
1539
  // package.json
1499
1540
  var package_default = {
1500
1541
  name: "innernote",
1501
- version: "0.3.1",
1542
+ version: "0.3.3",
1502
1543
  description: "Write LinkedIn posts in your voice, from the terminal.",
1503
1544
  type: "module",
1504
1545
  bin: {
@@ -1581,6 +1622,42 @@ async function home(inSession = false) {
1581
1622
  return 0;
1582
1623
  }
1583
1624
 
1625
+ // src/commands/skill.ts
1626
+ import { chmod as chmod2, mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
1627
+ import { homedir as homedir2 } from "node:os";
1628
+ import { dirname, join as join2 } from "node:path";
1629
+ import { fileURLToPath } from "node:url";
1630
+ async function readSkill() {
1631
+ const here = dirname(fileURLToPath(import.meta.url));
1632
+ for (const rel of ["../../skills/innernote-cli/SKILL.md", "../skills/innernote-cli/SKILL.md"]) {
1633
+ try {
1634
+ return await readFile2(join2(here, rel), "utf8");
1635
+ } catch {}
1636
+ }
1637
+ return null;
1638
+ }
1639
+ async function skill(args) {
1640
+ const install = args.includes("--install");
1641
+ const text = await readSkill();
1642
+ if (!text) {
1643
+ fail("The skill file is missing from this install.");
1644
+ note(dim2("Reinstall with `npm i -g innernote`, or read it on any machine with the package."));
1645
+ return 1;
1646
+ }
1647
+ if (install) {
1648
+ const dir = join2(homedir2(), ".claude", "skills", "innernote-cli");
1649
+ await mkdir2(dir, { recursive: true });
1650
+ const target = join2(dir, "SKILL.md");
1651
+ await writeFile2(target, text);
1652
+ await chmod2(target, 420);
1653
+ ok(`Installed for Claude Code at ${target}`);
1654
+ note(dim2("It loads in future sessions on its own. Here it is for this one:"));
1655
+ note("");
1656
+ }
1657
+ out(text);
1658
+ return 0;
1659
+ }
1660
+
1584
1661
  // src/session.ts
1585
1662
  import { createInterface } from "node:readline";
1586
1663
 
@@ -1726,6 +1803,12 @@ var COMMANDS2 = {
1726
1803
  detail: "The undo for queue, while there is still time. The post returns to your drafts and nothing goes live. Once it has been published this refuses, because a live post cannot be unsent this way.",
1727
1804
  examples: ["innernote unqueue p17abc...", "innernote unqueue 3"]
1728
1805
  },
1806
+ skill: {
1807
+ summary: "print the agent skill, or install it for Claude Code",
1808
+ usage: "innernote skill [--install]",
1809
+ detail: "The playbook an agent should read before driving this CLI: the loop, the read-before-write rule, what the exit codes mean, and the one rule that protects real people. Prints to stdout so any agent can take it. --install also registers it in ~/.claude/skills so Claude Code knows it in every future session.",
1810
+ examples: ["innernote skill", "innernote skill --install"]
1811
+ },
1729
1812
  context: {
1730
1813
  summary: "what you post about: your pillars and your series",
1731
1814
  usage: "innernote context",
@@ -1994,7 +2077,7 @@ function whatThereIs() {
1994
2077
  ["Writing", ["write", "shape", "ask", "save", "capture"]],
1995
2078
  ["Looking", ["show", "ideas", "drafts", "open", "week", "context", "whoami"]],
1996
2079
  ["Shipping", ["queue", "unqueue"]],
1997
- ["Connection", ["login", "logout"]]
2080
+ ["Connection", ["login", "logout", "skill"]]
1998
2081
  ];
1999
2082
  for (const [title, cmds] of groups) {
2000
2083
  lines.push(` ${bold2(title)}`);
@@ -2020,7 +2103,7 @@ var VERSION2 = package_default.version;
2020
2103
  // src/index.ts
2021
2104
  function commandList() {
2022
2105
  const groups = [
2023
- ["Getting connected", ["login", "logout", "whoami"]],
2106
+ ["Getting connected", ["login", "logout", "whoami", "skill"]],
2024
2107
  ["Writing", ["write", "shape", "ask", "save", "capture"]],
2025
2108
  ["Looking", ["show", "ideas", "drafts", "open", "week", "context"]],
2026
2109
  ["Shipping", ["queue", "unqueue"]]
@@ -2049,6 +2132,7 @@ var HELP = () => [
2049
2132
  `);
2050
2133
  var COMMANDS3 = {
2051
2134
  context,
2135
+ skill,
2052
2136
  login,
2053
2137
  logout: () => logout(),
2054
2138
  whoami,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "innernote",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Write LinkedIn posts in your voice, from the terminal.",
5
5
  "type": "module",
6
6
  "bin": {