124 Commits

Author SHA1 Message Date
Christopher Monsanto
f207627b49 Record each sprite's size in its set's manifest
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 22:07:13 -05:00
Christopher Monsanto
8c2bfc91b9 Make each comment say what the code it sits on does or is
No more free-relative headers ("What X ..."), verbless noun phrases on
functions, or "X is Y's" for "Y does X". Comments only; the code is
unchanged. Human-written comments are left as they were.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XoPaZShFdoo4JkGhDkqSnN
2026-10-29 09:31:44 -04:00
Christopher Monsanto
68cdcf9891 Publish straight into a served tree, and drop the smogonctl upload path
`publish <file> --tree <dir> --meta <dir>` places the outputs itself: the
tree is add-only (a name already there is touched, another size is refused),
CAS objects are hardlinked in, __meta/ goes to its own directory with the
links pointed into the tree, and __files/__digest record the publish. The
deploy verb, deploy.json5, the manifest/tar negotiation with `smogonctl assets
upload`, the progress bar and `run --tar` go with it; smogon.com's
sprites-sync service runs build and publish on the server now. The output
root is the served tree, no sprites/ prefix.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TNa8LzaaMo3QbEVuFUtFGU
2026-10-19 11:50:10 -04:00
Claude
02ff6940cf Send the upload a manifest, and then only what it asks for
Every deploy tarred the whole published tree into `smogonctl assets upload`:
a few hundred megabytes of stamped files the home already had, and a 512-byte
header for each of the thousands of links under __meta/. A served name carries
a content hash and the tree is add-only, so a name the home has is a file that
needn't travel.

The deploy now opens the same stdin with a manifest -- every name with its
size, every link -- and reads the reply off the command's stdout: the
positions it hasn't got. Only those and the __meta/ files are then tarred
into the same stream. The format is binary and length prefixed, so a name is
whatever bytes a tar would carry for it.

The reply is read strictly from the first byte: anything else on stdout, the
command's own refusal or a shell profile printing over ssh, is relayed whole,
stdin is closed so the command sees the end of the stream, and the deploy
fails with its exit code. The progress bar counts what travels. `run --tar`
still writes a bare tar, which the upload also takes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014b7csvcRmyygDYQun3mE6E
2026-09-12 17:29:38 +00:00
Claude
93ce1f50f9 Draw a progress bar for deploy on a terminal
A deploy's last phase is a long silent wait: thousands of files packed
into an upload or copied into a staging tree, with nothing between the
line naming the command and the line after it finishes.

Draw a bar over it when stderr is a terminal, and nothing at all when it
isn't -- piped or under CI a redraw per file is noise in the log, and
the stdout lines the deploy already prints are the record either way.

The tar entries a pack hands out are counted by their entry callbacks,
which wait on the pack draining into whoever is reading it, so the bar
follows what the upload command has taken rather than what has been read
off disk. The staging and -o paths count files as they land.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DRBNA4JH27Eq3cgJpzCLV2
2026-09-12 12:04:48 +00:00
Christopher Monsanto
a648c9e622 Let a deploy publish a link as well as a file
A served name carries a content hash, so a reader that composes a fixed path
can't find one. The way out is to publish the set twice, once under the stamped
names and once under the bare ones, and a link is the one thing the queue
couldn't say: Copy dereferences and Write has bytes.

Add a Symlink op beside them. What ctx.symlink takes is not a link target but
the destination of the thing being named, since a published tree is unpacked
somewhere else and its halves can land apart; the path between the two is
computed here and is what gets written. It takes the same duplicate-dst and
absolute-dst checks the other ops do, plus one of its own -- resolved lexically
against the directory it sits in, a target has to stay inside the tree, since
the receiving side extracts as root and a link that walks out of it is the same
write to anywhere that an absolute member name is.

run() makes a real symlink in every mode, clearing the name first so a rerun
over an existing tree behaves the way copy and write already do, and pack()
emits a symlink member with no body, which is what a stream reader on the other
end sees.

refactor digests bytes, and a link has none; what it publishes is the name it
points at, so that is what it records and what a retarget shows up as.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-23 15:22:45 -04:00
Christopher Monsanto
da25d70f78 Add a refactor verb, for what a change did to the published files
This repo owns xy/ and xyicons/ now, so nothing else writes there and asking
rsync what it would delete answers a question nobody has. The one worth asking
is whether an edit changed what we ship, which until now meant materializing a
deploy twice and diffing 300M of gifs.

Nothing has to be materialized. A finish already ends in an ActionQueue holding
one op per published file, and the bytes behind each are identified already: a
built artifact's CAS path spells its own digest, so only raw sources get read.
Digest those, keep the map in .build/ beside the rest of the build state, and a
comparison is a dictionary diff.

    node tools/deploy/index.ts refactor --record   # on what you are comparing to
    node tools/deploy/index.ts refactor            # after the change

prints + for a name that appeared, - for one that went, M for one whose bytes
moved, and exits non-zero if any did. Which is tup's refactor a layer out: it
checked that a Tupfile edit left the build graph alone, and this checks the
names and bytes the deploy blocks decide, where a lost alias or a rename
actually shows up.

Recording rather than failing when a file has no baseline yet, so the first run
in a checkout is useful instead of an error.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-23 02:01:02 -04:00
Christopher Monsanto
c076da9c0b Delete the coverage tool, and keep the targets out of the tree
rsync -n already answers the question the tool was wrapping, and it was the
only thing here that had to know where a deploy points, which is exactly what
deploy.json5 stays uncommitted to avoid. Say so in the README, and leave its
example a placeholder rather than a real target.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-23 01:54:30 -04:00
Christopher Monsanto
a919602cc2 Delete the PS build and the pokemon-showdown tooling
deploy.json5 has two targets, assets and smogon. ps.build.ts has none: nothing
it produces has shipped from this repo, and the ani/ rsync it was written for
lives in the README as an example. Everything it pulled along came with it.
tools/sheet is its montage tool and had no other caller.
ps-pokemon.dexnums.mjs, 1125 generated lines, existed only to hand its sheet a
dex number after data/species.json went away. tools/spritedata/{dexnums,names,
pokedex,rename}.ts all read a pokemon-showdown checkout, which is a dependency
nothing in either surviving deploy has.

The branch ps-build points at the commit before this, so it is one checkout
away if the PS side ever comes back.

tools/deploy/coverage.ts is the exception and moves rather than goes. It reads
no PS data and generates no table; it reports what a deploy would delete off
the server, which is what makes --delete-after safe to run, and it only lived
in tools/spritedata because that is where I put it.

Both remaining deploys materialize unchanged: xy/ 1651 names, xyicons/ 1556,
assets byte for byte. psid() keeps its caller in the smogdex sheet, which still
needs PS's spelling of a name even with the PS deploy gone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-23 01:50:21 -04:00
Christopher Monsanto
45adc3579f Make rule inputs source paths only
Nothing chains any more, so Input collapses to string and the machinery
that existed to order rules against each other goes with it: the
executor's demand graph and per-decl memo, the DryDirty sentinel, the
whole blocked outcome, the driver's producer closure, and inspect's
transitive-consumer fixpoint. What is left is a flat parallel sweep whose
only coupling is byte-identical declarations sharing one execution.

Every deploy's tree comes out byte-identical and every rule key is
unchanged: a full dry run reports 7748 up to date, 0 would run.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MQicnpaee6kQXGG7uVExLS
2026-08-21 01:13:15 -04:00
Christopher Monsanto
40bd3052f5 Make the deploy layer and tool I/O async
DeployCtx read/list/hash return promises (copy and write stay sync:
they only queue ops), the stamped copy helpers and buildfile deploy
blocks await them, ActionQueue materialization and packing use
fs/promises, and the CLI, config loaders, spritesheet writer, and
trim tool follow. Declaration-time globbing and the module-init data
reads stay sync: rules exist by the end of the import.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:15 -04:00
Christopher Monsanto
b8d7aa50eb Replace non-null assertions with explicit checks
Parsers use charAt or check-and-throw; the executor gets a paired()
helper for its parallel arrays; matchSubsets returns {entry, matched}
pairs so the deploy loop stops indexing two arrays; spawn stdin and
pid get real guards.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:15 -04:00
Christopher Monsanto
dc2bff9738 Convert declarations to the house shapes
Interfaces become type aliases with comma members (extends becomes
intersection), and class privates use #names instead of the private
keyword.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:15 -04:00
Christopher Monsanto
73f5954407 Adopt the house import style
Node builtins come in as node:-prefixed namespace imports;
multi-symbol internal imports use short namespace aliases (artifact,
cas, subst, db, api, executor). Single-symbol pulls, types, and the
buildfile DSL names stay braced, matching the sanctioned exceptions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:14 -04:00
Christopher Monsanto
3ec1abad12 Write let instead of const
Per the house rule, const survives only where TypeScript hangs
behavior off the spelling: the <const T> type parameter in rule()
and the as const option tables.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:14 -04:00
Christopher Monsanto
ebbb5e6f2e Tighten formatting to the smogon.com house style
Annotation colons are tight (ternaries keep their spaces), plain
double-quoted strings become single-quoted, and .editorconfig comes
over verbatim. Rule cmd values are untouched; the sheet rules reran
once because their tool sources are declared deps, byte-identically.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:14 -04:00
Christopher Monsanto
3e87df43da Replace defineDeploy with free-floating deploy() blocks
deploy(ctx => ...) registers like rule() does, so a buildFile
co-locates each shipping block with the rules it ships instead of
one monolithic finish; the blocks run in registration order after
the build, sharing one output tree per module. The CLI slices the
registry across its sequential imports to know which blocks belong
to which file.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:14 -04:00
Christopher Monsanto
dab5379faf Add a debug output mode to the deploy verb
deploy <names> -o <dir> materializes each entry's subset under
<dir>/<name>/<entry index>/ instead of running its command (tar
entries included), for eyeballing what would ship.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:14 -04:00
Christopher Monsanto
0a45fc92eb Drop unused debug and sprite-data deps
Nothing in tools/build or tools/deploy imports debug, and the
deploy package never imports sprite-data (its consumers live in
the root package, which declares it).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:14 -04:00
Christopher Monsanto
c1dfaaec8c Replace commander with node's builtin parseArgs
The deploy CLI gets a hand-rolled verb dispatch over per-verb
parseArgs option tables and one usage text; trim and
smogdexspritesheet are plain parseArgs calls. tools/build only
listed the dep without importing it.

The smogdex sheet rule depends on its tool's source, so it reran
once; the rebuild was byte-identical (stamps unchanged).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:13 -04:00
Christopher Monsanto
561b7ba0fd Add a dir mode to deploy entries
An entry with dir: true materializes its subset into a temp
directory whose path replaces %d in the cmd, instead of piping a
tar on stdin -- rsync-style transports (the PS ani sync) need real
files. The flag and %d must agree, so a forgotten one is caught at
config load.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:13 -04:00
Christopher Monsanto
c56428fd9d Survive an upload command that rejects the tar
A dying consumer destroys the tar pack and its pending entry sinks,
each of which emits the EPIPE as an unhandled streamx error and
crashed the process before the child's exit code was reported. Keep
the pack and its sinks quiet; the command's exit code is the report.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:13 -04:00
Christopher Monsanto
989ffd54ce Make bare deploy list the configured deploys
Deploying is opt-in per name; with no names the verb prints each
deploy's buildFile and (subset, cmd) entries instead of shipping
everything.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:13 -04:00
Christopher Monsanto
167de94fe4 Drop the last vestiges of the __key convention
The upload command names the asset set on its command line now.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:13 -04:00
Christopher Monsanto
8bf512480a Replace the .env deploy command with deploy.json5
An untracked json5 config maps deploy names to a buildFile plus
(subset globs, cmd) entries: the deploy verb builds the named
buildFiles, finishes each, routes the outputs through the subset
globs, and pipes one tar per entry to its command. Every glob must
match an output and every output must be covered by some entry.

The tar no longer carries __key; the upload command names the asset
set itself (smogonctl assets upload sprites).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:13 -04:00
Christopher Monsanto
a3f4dada09 Rename the deploy modules to *.build.ts
They are the buildFiles the upcoming deploy config points at; "deploy"
now belongs to the config entries that ship their outputs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:13 -04:00
Christopher Monsanto
bc39c94851 Fix review findings in the content-addressed core
- casInsert verifies an existing object's bytes before trusting it, fsyncs
  before the rename, and the store records object sizes so a crash-truncated
  object reads as dirty instead of clean forever.
- The driver hashes sources over the producer closure, so partial builds
  (inspect) that pull in producers outside the demanded set work.
- Unknown executor errors are reported and abort the build instead of
  vanishing into allSettled.
- %b/%B expand to nominal names at declaration (never CAS basenames), which
  also puts name-dependence in the identity key; cmds are key-joined with
  NUL so a multi-line command cannot collide with split commands. This
  churns every rule key once.
- Rules must declare at least one output; output names reject shell-hostile
  characters.
- run --link copies read-only (CAS) sources instead of hardlinking 0444
  modes into deploy trees; ctx.list filters dotfiles and directories like
  the build-side glob; inspect resolves targets against the invoking cwd.
- The registry dedupes identical declarations (same cmds/inputs/deps/
  outputs/display), returning the existing artifacts, so shared rule sets
  are plain functions and memo() is gone; ps.deploy.ts no longer declares
  the gen5 gif set it never ships.
- rule() returns a tuple typed by its literal output list (single string
  output returns the Artifact directly), so destructuring needs no
  non-null assertions.
- Manifest is a class carrying the deploy ctx: set() rejects duplicate
  keys, write(dst) emits the sorted JSON, and spritecopy/itemspritecopy/
  stampcopy take just the manifest. The unstamped smogon sets (xyitems,
  fbsprites, twittersprites) are deprecated and commented out.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:12 -04:00
Christopher Monsanto
f6e0b189f3 Cut over to content-addressed deploys
pnpm build/deploy now run the umbrella CLI (build/deploy/run/inspect); the
fixed-name build/ tree, the old planner (rename detection, adopt, tamper
checks), and the vm deploy sandbox are gone. Also lands tools/deploy/api.ts
and the CLI, which earlier commits referenced but an overbroad local
gitignore pattern had silently excluded.

Migration: the store migrates the v1 db in place; build/ is dead and can be
deleted. A full rebuild repopulated .build/cas, and the old and new deploy
trees were diffed: byte-identical except the two multi-file hash pointers
(algorithm change), fb/twitter PNG re-encodes (pixel-identical; old outputs
predated current tool versions), and a stale 2023 orphan sprite the old
system never cleaned up.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:12 -04:00
Christopher Monsanto
feb3166bbb Add the deploy finish API and umbrella CLI
makeCtx serves finish over the CAS and ActionQueue; cli.ts adds the
build/deploy/run/inspect verbs (unwired until cutover). Copy-mode
materialization chmods CAS-sourced files back to 0644.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:12 -04:00
Christopher Monsanto
dd2396719d Add pnpm deploy: pipe the assets tar to DEPLOY_COMMAND from .env
The deploy tool grows a deploy subcommand that runs the build, packs the
tar, and streams it to the command .env names. Packing now finalizes the
archive; without the end-of-archive marker, strict stream readers
(Python tarfile, hence smogonctl) die on truncation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:13:11 -04:00
Christopher Monsanto
75580a962a Run TS sources directly: ESM sprite-root, .ts imports, node:test
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-12 17:44:51 -04:00
Christopher Monsanto
ac0ef09084 Drop dist mains, thin tsconfigs, bump @types/node and better-sqlite3
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-12 17:43:53 -04:00
Christopher Monsanto
608a112faa deploy: write info to stderr instead of stdout
interferes with tar
2023-04-05 01:12:44 -04:00
Christopher Monsanto
9d3e9abebf deploy: add basic hash support so we can Just Ship It 2023-04-05 01:11:24 -04:00
Christopher Monsanto
0bc74044c6 deploy: add support for writing tar archives 2023-03-29 02:58:40 -04:00
Christopher Monsanto
3e35e84768 deploy: generalize aq mode a bit 2023-03-29 02:19:01 -04:00
Christopher Monsanto
472e6f4fd4 update typescript 2023-03-24 22:07:51 -04:00
Christopher Monsanto
e17c1d7634 prefer workspace build to prepare script 2020-09-02 00:54:13 -04:00
Christopher Monsanto
c202589c46 share typescript across monorepo 2020-08-27 04:56:11 -04:00
Christopher Monsanto
164d0e090e move deploy/spritename to data 2020-08-26 08:21:33 -04:00
Christopher Monsanto
c89e54efcb hoist @smogon/sprite-data to top 2020-08-25 04:36:43 -04:00
Christopher Monsanto
1a23009f34 deploy: remove old scripting functionality 2020-08-25 04:00:50 -04:00
Christopher Monsanto
e31ff207d2 deploy: remove unused jest config 2020-08-25 04:00:43 -04:00
Christopher Monsanto
a22db88368 deploy: normalize print() messages 2020-08-25 02:55:18 -04:00
Christopher Monsanto
6625b457e6 deploy: print # of characters in write 2020-08-25 02:40:22 -04:00
Christopher Monsanto
b666ad2619 deploy: procDst -> pushOp 2020-08-25 02:38:09 -04:00
Christopher Monsanto
a6f97fd561 stray comment 2020-08-24 19:20:48 -04:00
Christopher Monsanto
a850459a00 deploy/script: refactor Op for less typechecker hackery 2020-08-24 19:19:37 -04:00
Christopher Monsanto
bfb00891b8 deploy/script: factor out procDst 2020-08-24 18:27:16 -04:00
Christopher Monsanto
216c26cf99 deploy/script: add write() 2020-08-24 04:50:35 -04:00