@looop-games/cli 0.1.9 → 0.1.10

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 ADDED
@@ -0,0 +1,75 @@
1
+ # Changelog — @looop-games/cli
2
+
3
+ The `looop` command itself. This is the one piece of Looop you install from npm;
4
+ everything else (the component library, the room primitives, your game's skills)
5
+ lives in the engine and has [its own changelog](https://docs.looop.games), which
6
+ you can read with `looop changelog`.
7
+
8
+ Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
9
+ Versions: [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
10
+
11
+ > Entries for 0.1.9 and earlier were reconstructed from the release history after
12
+ > the fact, so they are short and may miss detail. Everything from 0.1.10 on is
13
+ > written as the change is made.
14
+
15
+ ## [Unreleased]
16
+
17
+ ## [0.1.10] - 2026-07-12
18
+
19
+ ### Added
20
+ - `looop changelog` — what changed in the engine. With no arguments it shows
21
+ every release newer than the version your game is pinned to; `looop changelog
22
+ <version>` shows one release, `--all` shows the whole history.
23
+ - `looop update` now prints the changelog for every version it crosses, with
24
+ **BREAKING** entries called out separately, so you find out what has to change
25
+ in your game at the moment you take the update — not when something breaks.
26
+
27
+ ## [0.1.9] - 2026-07-12
28
+
29
+ ### Changed
30
+ - `looop create` now signs you in and downloads the engine, which carries the
31
+ starter game and your game's skills. The login used to happen at your first
32
+ `looop dev`, one command later.
33
+ - The published package is now just the command itself. Everything you receive as
34
+ a creator — the starter game, the skills, the shared libraries — comes from the
35
+ engine, so the two can no longer drift apart.
36
+
37
+ ## [0.1.8] - 2026-07-12
38
+
39
+ ### Added
40
+ - `looop feedback` sends the files a report attaches, so whoever reads it can see
41
+ the code you are talking about.
42
+
43
+ ## [0.1.7] - 2026-07-11
44
+
45
+ ### Changed
46
+ - `looop update` refreshes your game's skills and `AGENTS.md`, and reports every
47
+ file it touched. A file you edited yourself is kept, not overwritten.
48
+
49
+ ## [0.1.6] - 2026-07-11
50
+
51
+ ### Added
52
+ - `looop update` — move a game onto the latest engine release and re-pin it.
53
+
54
+ ## [0.1.5] - 2026-07-11
55
+
56
+ ### Added
57
+ - `looop feedback` — send the reports under `notes/feedback/` to the Looop team.
58
+
59
+ ## [0.1.4] - 2026-07-11
60
+
61
+ ### Fixed
62
+ - `looop create` installs cleanly on macOS (`fsevents` is pre-approved along with
63
+ the other install scripts).
64
+
65
+ ## [0.1.3] - 2026-07-11
66
+
67
+ ### Fixed
68
+ - `looop create` works on Windows.
69
+
70
+ ## [0.1.2] - 2026-07-10
71
+
72
+ ### Added
73
+ - First public release. `looop create` scaffolds a game, `looop dev` runs it with
74
+ multiplayer, `looop publish` puts it on play.looop.games, `looop login`
75
+ authenticates the machine.
package/bin/looop.mjs CHANGED
@@ -9,6 +9,7 @@ import { publish } from '../lib/publish.mjs';
9
9
  import { create } from '../lib/create.mjs';
10
10
  import { testCmd } from '../lib/test-cmd.mjs';
11
11
  import { update } from '../lib/update.mjs';
12
+ import { changelog } from '../lib/changelog.mjs';
12
13
  import { sendFeedback } from '../lib/feedback.mjs';
13
14
  import { clearToken } from '../lib/config.mjs';
14
15
 
@@ -25,6 +26,7 @@ Usage:
25
26
  looop create <name> Bootstrap a new game folder (multiplayer works out of the box)
26
27
  looop dev [--port <n>] Run the full dev stack (game + multiplayer + services)
27
28
  looop test Run the game's tests (*.test.mjs) and smokes (*.smoke.mjs)
29
+ looop changelog [<v>] What changed in the engine (default: everything newer than your pin)
28
30
  looop update Move this game to the latest engine release (re-pins looop.engine)
29
31
  looop publish [--slug <s>] Publish this game to play.looop.games (--slug for an A/B copy)
30
32
  looop feedback Send the unsent reports under notes/feedback/ to the Looop team
@@ -57,6 +59,12 @@ try {
57
59
  const { ok } = await testCmd();
58
60
  process.exit(ok ? 0 : 1);
59
61
  }
62
+ case 'changelog':
63
+ await changelog({
64
+ version: rest.find((a) => !a.startsWith('--')),
65
+ all: rest.includes('--all'),
66
+ });
67
+ break;
60
68
  case 'update':
61
69
  await update();
62
70
  break;
@@ -0,0 +1,171 @@
1
+ // `looop changelog` — what changed in the engine (project note azlqm2).
2
+ //
3
+ // The gap this closes: `looop update` used to say "Engine updated: 0.1.10 →
4
+ // 0.1.12" and then list the SKILL FILES it rewrote. It said nothing about what
5
+ // changed in the engine itself, so the agent crossed two versions of the shared
6
+ // library blind — it could not know a call it makes is now wrong, or that the
7
+ // thing it was about to hand-roll now exists.
8
+ //
9
+ // Two moments matter, and they are different:
10
+ // BEFORE an update — "what am I about to take?" → the default, vs your pin
11
+ // AFTER an update — "what do I have to change?" → the BREAKING callout
12
+ //
13
+ // Reading is NOT login-gated. The version list is public by design (a version
14
+ // number is not a secret — see builder/functions/api/creator/engine/index.ts);
15
+ // only the DOWNLOAD carries a token. Requiring a login to read what an update
16
+ // would do to you would be exactly backwards.
17
+ import { findProject } from './project.mjs';
18
+ import { readEnginePin } from './engine.mjs';
19
+ import { getApiBase } from './config.mjs';
20
+ import { DEFAULT_API_BASE } from './llm-shim.mjs';
21
+
22
+ const RULE = '─'.repeat(64);
23
+
24
+ // Semver by NUMBER. String order would put 0.1.9 after 0.1.10 and quietly show
25
+ // the wrong set — the kind of bug nobody notices until a release is missing
26
+ // from someone's update.
27
+ export function compareVersions(a, b) {
28
+ const pa = a.split('.').map(Number);
29
+ const pb = b.split('.').map(Number);
30
+ for (let i = 0; i < 3; i++) {
31
+ if ((pa[i] ?? 0) !== (pb[i] ?? 0)) return (pa[i] ?? 0) > (pb[i] ?? 0) ? 1 : -1;
32
+ }
33
+ return 0;
34
+ }
35
+
36
+ export function selectReleases(releases, { pinned, version, all } = {}) {
37
+ const newestFirst = [...releases].sort((a, b) => compareVersions(b.version, a.version));
38
+
39
+ if (version) {
40
+ const one = newestFirst.find((r) => r.version === version);
41
+ if (!one) {
42
+ throw new Error(
43
+ `no engine release ${version}. Known: ${newestFirst.map((r) => r.version).join(', ')}`,
44
+ );
45
+ }
46
+ return [one];
47
+ }
48
+ if (all) return newestFirst;
49
+ // No pin means the game has never installed an engine (no `dev` yet). There is
50
+ // no "since" to work from, so show what it would get: the newest.
51
+ if (!pinned) return newestFirst.slice(0, 1);
52
+ return newestFirst.filter((r) => compareVersions(r.version, pinned) > 0);
53
+ }
54
+
55
+ // The actionable half. Everything else in a changelog is informative; a BREAKING
56
+ // entry means code in THIS game has to change, so it gets hoisted out of the
57
+ // prose and repeated on its own — with its migration line, which is the part the
58
+ // reader actually needs.
59
+ //
60
+ // The marker is POSITIONAL: a breaking change is a bullet that STARTS with it.
61
+ // Two false positives got here by loosening that, and both were found by reading
62
+ // real output rather than by any test:
63
+ //
64
+ // 1. matching the bare word case-insensitively flagged the ordinary sentence
65
+ // "when your game turns out to be breaking a Looop rule";
66
+ // 2. matching `**BREAKING**` anywhere on a line flagged a changelog entry that
67
+ // merely DESCRIBED the feature ("...calls out **BREAKING** entries
68
+ // separately...") — prose about breaking changes is not a breaking change.
69
+ //
70
+ // A callout that cries wolf is worse than no callout: it gets ignored, and the
71
+ // next real one is ignored with it.
72
+ // Bold form is case-insensitive (`**BREAKING**`, `**Breaking**` — the markup is
73
+ // the deliberate part). The bare-word form must be ALL CAPS with punctuation, so
74
+ // a bullet that merely opens with the ordinary word ("- breaking the sound
75
+ // barrier: …") can't pass as a marker.
76
+ const BREAKING_BOLD = /^\s*[-*]\s+\*\*breaking\*\*/i;
77
+ const BREAKING_CAPS = /^\s*[-*]\s+BREAKING\b\s*[:—–-]/;
78
+ const BREAKING_BULLET = { test: (l) => BREAKING_BOLD.test(l) || BREAKING_CAPS.test(l) };
79
+
80
+ // True for a line that continues the bullet above it: indented, non-blank, and
81
+ // not itself a new bullet or heading. That's how the migration line rides along.
82
+ const CONTINUATION = /^\s+\S/;
83
+ const NEW_BULLET_OR_HEADING = /^\s*(?:[-*]\s|#)/;
84
+
85
+ export function breakingLines(notes) {
86
+ const lines = (notes ?? '').split('\n');
87
+ const out = [];
88
+ for (let i = 0; i < lines.length; i++) {
89
+ if (!BREAKING_BULLET.test(lines[i])) continue;
90
+ const block = [lines[i].trim()];
91
+ for (let j = i + 1; j < lines.length; j++) {
92
+ const l = lines[j];
93
+ if (!CONTINUATION.test(l) || NEW_BULLET_OR_HEADING.test(l)) break;
94
+ block.push(l.trim());
95
+ i = j;
96
+ }
97
+ out.push(block.join(' '));
98
+ }
99
+ return out;
100
+ }
101
+
102
+ export function renderReleases(selected, { pinned, latest } = {}) {
103
+ const out = [];
104
+ if (!selected.length) {
105
+ out.push(`Engine ${pinned ?? '(unpinned)'} — nothing new. This game is up to date with ${latest}.`);
106
+ return out.join('\n');
107
+ }
108
+
109
+ const head =
110
+ selected.length === 1
111
+ ? `Engine ${selected[0].version}`
112
+ : `${selected.length} engine releases newer than ${pinned}, newest first (latest is ${latest})`;
113
+ out.push(head, '');
114
+
115
+ for (const r of selected) {
116
+ out.push(RULE);
117
+ out.push(`## ${r.version}`);
118
+ out.push('');
119
+ out.push(r.notes?.trim() ? r.notes.trim() : ' (no notes recorded — this release predates the changelog)');
120
+ out.push('');
121
+ }
122
+
123
+ const breaking = selected.flatMap((r) => breakingLines(r.notes).map((l) => ` ${r.version} ${l}`));
124
+ if (breaking.length) {
125
+ out.push(RULE);
126
+ out.push('');
127
+ out.push(
128
+ `⚠ ${breaking.length} BREAKING change${breaking.length === 1 ? '' : 's'} in this range.`,
129
+ ' These are the entries that mean code in THIS game has to change — check each one',
130
+ ' against the game before you call the update done.',
131
+ '',
132
+ ...breaking,
133
+ '',
134
+ );
135
+ }
136
+ return out.join('\n');
137
+ }
138
+
139
+ export async function fetchReleases({ apiBase, fetchImpl = fetch }) {
140
+ const res = await fetchImpl(`${apiBase}/api/creator/engine`);
141
+ if (!res.ok) throw new Error(`could not read the engine changelog (HTTP ${res.status})`);
142
+ const body = await res.json();
143
+ // An older platform has no `releases` key. Printing "nothing new" there would
144
+ // be a lie in the most dangerous direction — it reads as "safe to update".
145
+ //
146
+ // Do NOT tell them to upgrade the CLI: the missing half is the PLATFORM's, and
147
+ // a creator cannot deploy it. Advice they can't act on is worse than none.
148
+ if (!Array.isArray(body.releases)) {
149
+ throw new Error(
150
+ 'this Looop platform is not serving the engine changelog yet. Nothing is wrong with your ' +
151
+ 'game — try again later, and `npx looop update` still works in the meantime.',
152
+ );
153
+ }
154
+ return body;
155
+ }
156
+
157
+ export async function changelog({
158
+ cwd = process.cwd(),
159
+ apiBase = getApiBase(DEFAULT_API_BASE),
160
+ log = console.log,
161
+ fetchImpl = fetch,
162
+ readPin,
163
+ version,
164
+ all = false,
165
+ } = {}) {
166
+ const pinned = readPin ? readPin() : readEnginePin(findProject(cwd).dir);
167
+ const { releases, latest } = await fetchReleases({ apiBase, fetchImpl });
168
+ const selected = selectReleases(releases, { pinned, version, all });
169
+ log(renderReleases(selected, { pinned, latest }));
170
+ return { pinned, latest, selected };
171
+ }
package/lib/update.mjs CHANGED
@@ -15,6 +15,7 @@ import { reconcileAgentSurface } from './agent-surface.mjs';
15
15
  import { getToken, getApiBase } from './config.mjs';
16
16
  import { login } from './login.mjs';
17
17
  import { DEFAULT_API_BASE } from './llm-shim.mjs';
18
+ import { compareVersions, renderReleases } from './changelog.mjs';
18
19
 
19
20
  // The report is the point. A creator reading this must be able to answer, with
20
21
  // no further digging: what changed, was any of it mine, and what do I do now.
@@ -72,9 +73,28 @@ export async function update({
72
73
  });
73
74
  if (res.status === 401) throw new Error('the platform rejected this machine’s token — run `looop login` again.');
74
75
  if (!res.ok) throw new Error(`could not list engine releases (HTTP ${res.status})`);
75
- const { latest } = await res.json();
76
+ const { latest, releases } = await res.json();
76
77
  if (!latest) throw new Error('the platform has no downloadable engine releases yet.');
77
78
 
79
+ // What the update is about to change UNDER the game (project note azlqm2).
80
+ // Reporting the skill files we rewrote and nothing about the engine was the
81
+ // whole gap: an agent crossed two versions of the shared library blind.
82
+ //
83
+ // A platform too old to serve `releases` must NOT block the update — it just
84
+ // has to be honest that it cannot say what changed. (`looop changelog`, whose
85
+ // only job is to answer that question, refuses outright instead.)
86
+ // Newest first, to match `looop changelog` and — more importantly — to match
87
+ // what renderReleases' own header SAYS. The endpoint returns them ascending;
88
+ // passing that straight through printed 0.1.13 above 0.1.14 under a heading
89
+ // that read "newest first". Caught by reading a real production run.
90
+ const crossed = Array.isArray(releases)
91
+ ? releases
92
+ .filter(
93
+ (r) => compareVersions(r.version, latest) <= 0 && (!from || compareVersions(r.version, from) > 0),
94
+ )
95
+ .sort((a, b) => compareVersions(b.version, a.version))
96
+ : null;
97
+
78
98
  let engineDir = null;
79
99
  let updated = false;
80
100
 
@@ -103,8 +123,15 @@ export async function update({
103
123
  if (!surface.skipped) report(log, surface.engineVersion ?? latest, surface);
104
124
 
105
125
  if (updated) {
126
+ log('');
127
+ if (crossed === null) {
128
+ log(' This Looop platform could not tell us what changed in the engine — no changelog');
129
+ log(' is available for the versions you just crossed.');
130
+ } else if (crossed.length) {
131
+ log(renderReleases(crossed, { pinned: from, latest }));
132
+ }
106
133
  log('');
107
134
  log(' Republish (`npx looop publish`) when you want the live game on it.');
108
135
  }
109
- return { from, to: latest, updated, surface };
136
+ return { from, to: latest, updated, surface, crossed };
110
137
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@looop-games/cli",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Looop game development CLI — dev server, login, and publishing for standalone Looop games.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -8,6 +8,7 @@
8
8
  "looop": "bin/looop.mjs"
9
9
  },
10
10
  "files": [
11
+ "CHANGELOG.md",
11
12
  "bin",
12
13
  "lib",
13
14
  "!lib/**/*.test.mjs"