Repository navigation
Conversation
Reimplements the list, tokens and export commands in Go with no behaviour
change for existing invocations. The Deno sources are left in place by this
commit and removed in the next one.
Layout mirrors the TypeScript modules under internal/:
cli routing, global flags, top-level error reporting, the commands
args port of @std/cli parseArgs (the CLI relies on its lenient rules)
tokens token store, DTCG flattening, fetcher
jsonv JSON model with JavaScript semantics (see below)
jsnum JS number formatting / parseFloat / Number() / Math.round
output colour, writer, FormatValue
prompt raw-mode arrow-key select (golang.org/x/term)
help, errs
Go maps and encoding/json would reorder token scales ("50", "100", ...), so
jsonv keeps insertion order with JavaScript's integer-keys-first rule and
reproduces JSON.stringify layout, escaping and number formatting. Family
sorting uses golang.org/x/text/collate to match localeCompare.
The environment (streams, TTY state, fetch, prompt) is injected, so the
commands can be tested without a network or a terminal; the original had no
tests for list/tokens/export.
Verified against the original implementation:
- 95 golden cases captured from the Deno CLI (testdata/golden)
- byte-identical stdout/stderr/exit status on live data and on randomized
token documents, including under a real pty for prompts and colour
- arg parsing fuzzed against @std/cli parseArgs (40,000 vectors)
Known, intentional differences: JS stack traces under --debug, wording of
network/JSON-parse errors, non-object token documents are rejected, and the
fetch has a 30s timeout.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SYRWL23gQSxfUQzjQ1ysWf
Deletes main.ts, src/, tests/, deno.json, deno.lock and the Deno VS Code settings, now that the Go port replaces them. The Deno fixture lives on as internal/tokens/testdata/tokens.json. README now documents installing with `go install`, running with `go run .`, and the Go development commands. .gitignore drops the Node entries in favour of the built binary. This commit only deletes the old implementation; reverting it restores the Deno sources alongside the Go port. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SYRWL23gQSxfUQzjQ1ysWf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reimplements the
list,tokensandexportcommands in Go with no behaviour change for existing invocations, then removes the Deno implementation.Two commits, so the removal is easy to drop or revert on its own:
main.ts,src/,tests/,deno.json,deno.lockand.vscode/, and rewrites the README and.gitignore.How it is built
The layout under
internal/mirrors the TypeScript modules:cli,args,tokens,jsonv,jsnum,output,prompt,help,errs.jsonv: Go maps andencoding/jsonwould reorder token scales ("50","100", ...), so this package keeps JavaScript key order (integer-like keys first, then insertion order) and reproducesJSON.stringifylayout, escaping and number formatting.args: a port of the@std/cliparseArgscode the CLI used, because its lenient rules (global flags anywhere, unknown flags accepted) are part of the current behaviour.golang.org/x/text/collateto matchlocaleCompare(about 1.5 MB of binary size).golang.org/x/termfor raw mode.list,tokensorexport.Verification
I ran the original Deno CLI side by side with the Go binary:
NO_COLOR.parseArgs.localeCompare, and 60,000 floats againstString(n).go test -race ./...passes, including 95 golden cases captured from the Deno CLI (internal/cli/testdata/golden, so they pin the port to the behaviour it replaced).Intentional differences
--debugprints the error kind and cause chain instead of a JS stack trace.[]and crashed onnull.NaN% undefined/[object Object]. Examples are a group-level$descriptionstring and malformed gradient stops.-q0and-q=0now count as set. Deno turned them into the number 0, so the flag stayed off.Existing quirks preserved (candidates for follow-up)
mint list --quietwith no category exits 1 with no message.mint tokens -c colorin a terminal still prompts for a family.mint --typo listshows the short help, because the unknown flag swallowslist.Not covered
The Windows build compiles, but I could not run the interactive prompt there.
go install github.com/pglevy/mint@latest(as documented in the README) only works once this is merged.Generated by Claude Code