Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .claude/skills/verify-10x-cli/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: verify-10x-cli
description: Drive the real `10x` CLI (@przeprogramowani/10x-cli) end to end the way a learner does — login, list, get, sync, doctor — against a local fake delivery API with isolated config and project dirs, and capture stdout/stderr/exit codes, PTY screens and file-tree hashes as proof. Use after changing a command, the writer, conflict handling, auth or the API client, when unit tests pass but you need to see the shipped behaviour, or when asked to "verify", "run the CLI", "prove it works".
description: Drive the real `10x` CLI (@przeprogramowani/10x-cli) end to end the way a learner does — login, list, get, sync, changelog, doctor — against a local fake delivery API with isolated config and project dirs, and capture stdout/stderr/exit codes, PTY screens and file-tree hashes as proof. Use after changing a command, the writer, conflict handling, auth or the API client, when unit tests pass but you need to see the shipped behaviour, or when asked to "verify", "run the CLI", "prove it works".
---

# Verify 10x-cli
Expand Down Expand Up @@ -78,7 +78,9 @@ $V screen <label> # save the screen as evidence
$V wait-screen '10x exited' # the PTY prints "[10x exited <code>]" when done
```

Fake-world actions: `$V click` (the learner clicks the newest magic link), `$V bump <lesson>`.
Fake-world actions: `$V click` (the learner clicks the newest magic link), `$V bump <lesson>`,
`$V changelog release|off|on` (publish a newer toolkit release; remove / restore the
changelog route).
State proof: `$V snapshot <label>` (sha256 of every file in project + config dirs).
Narrative: `$V note "<text>"` appends to the run's `notes.md`.

Expand Down
1 change: 1 addition & 0 deletions .claude/skills/verify-10x-cli/features/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ proof.
- [Browse lessons](./list.md) — modules, lessons in a module, locked modules.
- [Get a lesson](./get.md) — apply, dry run, print, filters, errors, interactive conflicts.
- [Sync lessons](./sync.md) — upstream updates, preserved local edits, cheap skip, `--force`.
- [Toolkit changelog](./changelog.md) — baseline recorded by sync/get, new releases, `--since`, older backend.
- [Diagnose the setup](./doctor.md) — `10x doctor` report.

Not mapped yet: `10x helpers install` (offline, bundled skills), `10x bench`,
Expand Down
81 changes: 81 additions & 0 deletions .claude/skills/verify-10x-cli/features/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Toolkit changelog

A learner sees which 10x-toolkit releases (skills, prompts, rules, config templates) were
published since their project's last sync, or since a version or date they choose. A
successful sync or full get records the newest toolkit version as the project's baseline.
The command describes toolkit releases only; what a sync would download is still
`10x sync --dry-run`.

## Sub-features

- `changelog-record` — `sync` and an unfiltered `get` store `toolkit.version` in the manifest.
- `changelog-none` — nothing new since the recorded baseline.
- `changelog-new` — a newer release is listed, newest first.
- `changelog-since` — `--since vX.Y.Z` (exclusive) and `--since YYYY-MM-DD` (inclusive from
that UTC day) ignore the baseline; `--limit` caps the list.
- `changelog-fallback` — no `toolkit` field: last applied lesson date; no manifest: latest
5 releases plus the `Run 10x sync to record your baseline.` hint.
- `changelog-unsupported` — backend without the route: `sync`/`get` unchanged, `changelog`
fails with `changelog_unsupported`.
- `changelog-usage` — invalid `--since` / `--limit` exit `2`.

## How to get to it (user POV)

- Run `10x sync --tool claude-code` (or `10x get <ref>`), then `10x changelog`.
- Run `10x changelog --since v2.59.0` or `10x changelog --since 2026-10-01 [--limit <n>]`.

## Driving it with verify.sh

Preconditions:

- Baseline run with `$V seed-auth`. The fake serves toolkit releases `v2.59.0`
(2026-10-01), `v2.59.1` (2026-10-03) and `v2.59.2` (2026-10-05).
- Fake-world actions: `$V changelog release` publishes the next patch release, dated now;
`$V changelog off` makes `GET /api/changelog` answer 404 (an older backend);
`$V changelog on` restores it.

- **No baseline.** In the fresh project run `$V cli none -- changelog`. Exit `0`;
`data.baseline.source` `none`; `data.newEntries` `3`. In a TTY (`$V tty`) the screen
starts `Latest toolkit changes (no baseline recorded)` and ends with
`Run 10x sync to record your baseline.`
- **Applied fallback.** Run `$V cli filtered -- get m1l1 --type skills --name
verify-fixture-skill --tool claude-code` (a filtered get does not record), then
`$V cli applied -- changelog`: `data.baseline.source` `applied` with a `date`.
- **Record (Phase 1).** Run `$V cli get -- get m1l1 --tool claude-code` and
`$V cli sync -- sync --tool claude-code`. `.claude/.10x-cli-manifest.json` has
`toolkit.version` `v2.59.2`; `requests.log` shows `GET /api/changelog?limit=1 -> 200`
after each.
- **Nothing new (Phase 2).** Run `$V cli changelog -- changelog`. Exit `0`;
`data.baseline` `{ source: "sync", version: "v2.59.2" }`; `data.newEntries` `0`. The
TTY screen reads `Toolkit changes since v2.59.2 (recorded by your last 10x sync)` and
`No toolkit changes since v2.59.2.`
- **New release.** Run `$V changelog release` (prints `v2.59.3`), then
`$V cli changelog-new -- changelog`. `data.newEntries` `1`, `entries[0].version`
`v2.59.3`; the TTY shows `v2.59.3 — <today>` and its notes.
- **Since a date / version.** `$V cli since-date -- changelog --since 2026-10-01` lists
`v2.59.3` … `v2.59.0` (the 2026-10-01 release is included);
`$V cli since-ver -- changelog --since v2.59.0` lists everything except `v2.59.0`;
adding `--limit 2` returns `newEntries` `2`.
- **Usage.** `$V cli since-bad -- changelog --since yesterday` exits `2` with
`error.code` `invalid_since`; `--limit 0` exits `2` with `invalid_limit`.
- **Older backend.** Run `$V changelog off`, `$V snapshot before-off`,
`$V cli sync-off -- sync --tool claude-code`, `$V snapshot after-off`: exit `0`, the two
snapshots are identical (the manifest keeps `v2.59.2` although `v2.59.3` exists), and
`requests.log` shows `GET /api/changelog?limit=1 -> 404`. `$V cli chlog-off -- changelog`
exits `1` with `error.code` `changelog_unsupported`. Then `$V changelog on`,
`$V cli sync-on -- sync --tool claude-code`: its stdout equals `sync-off`'s, and the
manifest now records `v2.59.3`.

## Gotchas

- The fake route follows the toolkit contract: `since` and `sinceDate` together, a
malformed version/date, or `limit` outside 1–100 answer `400 {"error":"invalid_query"}`.
The CLI never sends both, so probe that with `curl -H 'Authorization: Bearer
fake-access-seed' "$API_URL/api/changelog?since=v2.59.0&sinceDate=2026-10-01"` (the API
URL is in `run.env`); without the header it answers `401`.
- Recording is silent: a 404 or empty list leaves the manifest untouched and changes
neither output nor exit code. Only `--verbose` mentions it.
- `$V changelog release` dates the new entry now (at least a minute after the previous
one), so `--since <today>` includes it.
- Fake releases do not change lesson content: `sync` reports `unchanged` lessons while the
changelog lists a release. Use `$V bump` for content changes.
77 changes: 76 additions & 1 deletion .claude/skills/verify-10x-cli/scripts/fake-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
// POST /__fake/click?session=<id> "click" the magic link for a session
// POST /__fake/bump?lesson=<id> publish a new upstream version of a lesson
// GET /__fake/requests request log (also <run-dir>/requests.log)
// POST /__fake/changelog/release publish a newer toolkit release (next patch, released now)
// POST /__fake/changelog/route?enabled=<0|1> remove / restore GET /api/changelog (404 = older backend)

import { createHash, generateKeyPairSync, sign } from "node:crypto";
import { appendFileSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import type { paths } from "../../../../src/generated/api-types";
// Not in the generated types yet (toolkit release-changelog); the CLI's hand-written shape.
import type { ChangelogEntry } from "../../../../src/lib/api-content";

// JSON body of a documented response, so regenerated api-types flag drift here too.
type Body<P extends keyof paths, M extends "get" | "post", S extends number = 200> =
Expand All @@ -29,7 +33,8 @@ type Body<P extends keyof paths, M extends "get" | "post", S extends number = 20
type Bundle = Body<"/api/lessons/{course}/{lessonId}", "get">;
type ErrorCode =
| "invalid_json" | "session_not_found" | "unauthorized" | "course_not_found"
| "module_not_found" | "lesson_not_found" | "module_locked" | "artifact_not_found" | "not_found";
| "module_not_found" | "lesson_not_found" | "module_locked" | "artifact_not_found" | "not_found"
| "invalid_query";

const runDir = process.argv[2];
if (!runDir) {
Expand Down Expand Up @@ -75,6 +80,62 @@ function bundle(l: Lesson): Bundle {
prompts: [], rules: [], configs: [],
};
}
// Toolkit release changelog, newest-first like the real endpoint.
const releaseEntry = (version: string, previousVersion: string | null, releasedAt: string): ChangelogEntry => ({
schemaVersion: 1, version, previousVersion, releasedAt, model: "fake-model",
markdown: `### Skills\n\n- verify-fixture-skill: fixture change in ${version}.\n`,
artifacts: { skills: [{ name: "verify-fixture-skill", status: "modified" }], prompts: [], rules: [], configTemplates: [] },
});
const changelog: ChangelogEntry[] = [
releaseEntry("v2.59.2", "v2.59.1", "2026-10-05T09:00:00.000Z"),
releaseEntry("v2.59.1", "v2.59.0", "2026-10-03T09:00:00.000Z"),
releaseEntry("v2.59.0", "v2.58.1", "2026-10-01T09:00:00.000Z"),
];
let changelogRoute = true;
const semver = (v: string) => /^v(\d+)\.(\d+)\.(\d+)$/.exec(v)?.slice(1).map(Number);
const semverGt = (a: number[], b: number[]) => {
for (let i = 0; i < 3; i++) if (a[i]! !== b[i]!) return a[i]! > b[i]!;
return false;
};
const DATE_ONLY = /^(\d{4})-(\d{2})-(\d{2})$/;
const DATE_TIME = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})$/;
/** Lower bound in ms: date-only = start of that UTC day; ISO datetime as given. */
function sinceDateMs(raw: string): number | undefined {
const d = DATE_ONLY.exec(raw);
if (d) {
const [y, m, day] = d.slice(1).map(Number) as [number, number, number];
const t = Date.UTC(y, m - 1, day);
const back = new Date(t);
return back.getUTCFullYear() === y && back.getUTCMonth() === m - 1 && back.getUTCDate() === day ? t : undefined;
}
if (!DATE_TIME.test(raw)) return undefined;
const t = Date.parse(raw);
return Number.isFinite(t) ? t : undefined;
}
/** GET /api/changelog?since=vX.Y.Z | sinceDate=<date> & limit=1-100 (default 20). */
function changelogResponse(q: URLSearchParams): Response {
const since = q.get("since");
const sinceDate = q.get("sinceDate");
const limitRaw = q.get("limit");
if (since !== null && sinceDate !== null) return fail("invalid_query", 400);
let limit = 20;
if (limitRaw !== null) {
if (!/^\d+$/.test(limitRaw) || Number(limitRaw) < 1 || Number(limitRaw) > 100) return fail("invalid_query", 400);
limit = Number(limitRaw);
}
let entries = changelog;
if (since !== null) {
const floor = semver(since);
if (!floor) return fail("invalid_query", 400);
entries = entries.filter((e) => semverGt(semver(e.version)!, floor)); // exclusive
} else if (sinceDate !== null) {
const floor = sinceDateMs(sinceDate);
if (floor === undefined) return fail("invalid_query", 400);
entries = entries.filter((e) => Date.parse(e.releasedAt) >= floor); // inclusive
}
return json({ entries: entries.slice(0, limit) });
}

const contentHash = (l: Lesson) => createHash("sha256").update(JSON.stringify(bundle(l))).digest("hex");
const summaryOf = (l: Lesson): Body<"/api/catalog/{course}", "get">["lessons"][number] => ({
lessonId: l.lessonId, module: l.module, lesson: l.lesson, title: l.title, summary: l.summary,
Expand Down Expand Up @@ -128,6 +189,19 @@ async function route(req: Request): Promise<Response> {
return json({ lessonId: l.lessonId, version: l.version, contentHash: contentHash(l) });
}

if (path === "/__fake/changelog/release" && req.method === "POST") {
const latest = changelog[0]!;
const [maj, min, pat] = semver(latest.version)!;
const releasedAt = new Date(Math.max(Date.now(), Date.parse(latest.releasedAt) + 60_000)).toISOString();
const entry = releaseEntry(`v${maj}.${min}.${pat! + 1}`, latest.version, releasedAt);
changelog.unshift(entry);
return json({ version: entry.version, releasedAt: entry.releasedAt });
}
if (path === "/__fake/changelog/route" && req.method === "POST") {
changelogRoute = url.searchParams.get("enabled") !== "0";
return json({ changelogRoute });
}

// --- public API ---
if (path === "/health") return json({ status: "ok" });
if (path === "/auth/login" && req.method === "POST") {
Expand All @@ -147,6 +221,7 @@ async function route(req: Request): Promise<Response> {
if (path === "/auth/refresh" && req.method === "POST") return json(tokens());

if (!authed(req)) return fail("unauthorized", 401);
if (path === "/api/changelog") return changelogRoute ? changelogResponse(url.searchParams) : fail("not_found", 404);
if (path === "/api/me/courses")
return json({ courses: [{ ...COURSE, available: true }], defaultCourse: COURSE.slug } satisfies Body<"/api/me/courses", "get">);

Expand Down
14 changes: 13 additions & 1 deletion .claude/skills/verify-10x-cli/scripts/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# wait-screen <regex> [s] wait until the PTY screen matches (default 20 s)
# click "click" the newest pending magic link (fake mailbox)
# bump <lessonId> publish a new upstream version of a fixture lesson
# changelog <action> fake toolkit changelog: release (newer entry) | off (route 404s) | on
# snapshot <label> save file tree + sha256 of project and config dirs
# note <text> append a line to the run's notes.md
# down stop what this run started, delete scratch, keep evidence
Expand Down Expand Up @@ -174,6 +175,17 @@ case "$CMD" in
curl -fsS -X POST "$API_URL/__fake/bump?lesson=${1:?lessonId}"; echo
;;

changelog)
load_run
case "${1:-}" in
release) curl -fsS -X POST "$API_URL/__fake/changelog/release" ;;
off) curl -fsS -X POST "$API_URL/__fake/changelog/route?enabled=0" ;;
on) curl -fsS -X POST "$API_URL/__fake/changelog/route?enabled=1" ;;
*) die "usage: verify.sh changelog release|off|on" ;;
esac
echo
;;

snapshot)
load_run
OUT="$EVID/$(next_seq)-${1:?label}.tree.txt"
Expand Down Expand Up @@ -201,6 +213,6 @@ case "$CMD" in
;;

*)
sed -n '2,24p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'
sed -n '2,25p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'
;;
esac
7 changes: 7 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ Profile migration preserves course and both ownership ledgers. It copies to the
- Reports include skill/prompt changes, managed-rule conflicts, config outcomes, removals, and preserved local files with reasons. Configs remain create-only; existing templates are not adopted or assigned a hash inferred from their local content.
- A complete, conflict-free `get` may retain an existing catalog digest for the same language/tool representation. Filtered or conflicted updates invalidate it. When a shared artifact changes, invalidate other affected lessons' representation metadata as well.

## `10x changelog` & toolkit baseline

`commands/changelog.ts` is read-only and shows 10x-toolkit release notes (`GET /api/changelog`), not local staleness — that stays `sync --dry-run`'s job. Its baseline is the manifest's optional `toolkit: { version, recordedAt }` (additive within schema 3; a malformed value is dropped on read).

- **Recording** (`lib/toolkit-baseline.ts`) runs after a real `sync` with no errored lesson and not aborted (skipped conflicts still count), and after an unfiltered, non-dry-run `get`. It fetches `limit=1` and calls `recordToolkitVersion()`, which re-reads the manifest right before writing so ownership written during the run is never clobbered. It is strictly best-effort: 404/network/empty/invalid responses leave the manifest untouched and never change output, JSON envelope or exit code (only `--verbose` mentions it).
- **Resolution** in `changelog`: `--since vX.Y.Z` (→ `since`, exclusive) or `YYYY-MM-DD` (→ `sinceDate`, inclusive) > `toolkit.version` > newest lesson `appliedAt` / `lastApplied` > none (limit 5 + "Run 10x sync" hint). A 404 maps to `changelog_unsupported` (exit 1). `ChangelogResponse` is hand-written in `api-content.ts` until generated types include the route.

## Conventions worth knowing

- TypeScript is `strict` + `noUncheckedIndexedAccess` + `noImplicitOverride`. Index access on arrays/records returns `T | undefined` — handle it.
Expand Down
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ remain visible. Full lesson downloads and other commands remain available below.
| `10x list` | Browse modules and lessons in your course |
| `10x get <ref>` | Fetch a lesson and apply artifacts to your workspace |
| `10x sync` | Bulk-download / refresh lessons and report what changed upstream |
| `10x changelog` | Show 10x-toolkit release notes since your last sync |
| `10x doctor` | Diagnose auth, API connectivity, and local config |
| `10x bench` | Live top-10 AI model leaderboard from [10xbench.ai](https://10xbench.ai) — no login needed |
| `10x bench-kit <action>` | Create (`init`) and update (`update`) a company benchmark instance from the [10x-bench-kit](https://github.com/przeprogramowani/10x-bench-kit) template |
Expand Down Expand Up @@ -278,6 +279,44 @@ all for skills and prompts. Config templates are create-only. Course rules retai
conflict is reported, not a failure), `1` if any lesson failed to fetch. The full
report is still emitted on a partial failure.

### `10x changelog`

`10x changelog` shows the **10x-toolkit release notes** — which course skills,
prompts, rules and config templates changed in each toolkit release — since your
project's baseline. It describes toolkit releases, not your files: to see what a
sync would actually download or update in this project, run `10x sync --dry-run`.
It needs a login and never writes anything.

The baseline is recorded per project: after a successful `10x sync` (not
`--dry-run`, no failed lessons) or a full, unfiltered `10x get`, the CLI stores the newest
toolkit release version in the project manifest (`toolkit.version`). If the
backend cannot answer, nothing is recorded and the sync/get result is unchanged.
Without a recorded version, `10x changelog` falls back to the date of the last
lesson applied in the project; in a project with no manifest it shows the latest 5
releases and suggests running `10x sync`.

| Flag | Description |
|------|-------------|
| `--since <ref>` | Ignore the baseline: `vX.Y.Z` lists releases **after** that version; `YYYY-MM-DD` lists releases **from** the start of that UTC day |
| `--limit <n>` | Maximum number of releases, 1-100 (default 20; 5 without a baseline) |

```bash
# What changed in the toolkit since this project's last sync
10x changelog

# Browse history regardless of the baseline
10x changelog --since v2.55.0
10x changelog --since 2026-10-01 --limit 50
```

Releases are listed newest first as `vX.Y.Z — <date>` followed by their notes, or
`No toolkit changes since <baseline>.` Exit code is `0` whether or not there are
new releases; an invalid `--since`/`--limit` exits `2`, a missing login `3`. Against
a backend that does not serve the changelog yet the command fails with
`changelog_unsupported` (exit `1`); `get` and `sync` keep working. JSON output
(`--json` or piped) is `{ baseline: { source, version?, date? }, newEntries,
entries }`, where `source` is `flag`, `sync`, `applied` or `none`.

### `10x bench`

Shows the [10xBench](https://10xbench.ai) leaderboard — the top 10 AI models
Expand Down
Loading
Loading