Thin the app's comments
The same pass the server had, on the Kotlin side: comments restating what the code says are gone, and the ones recording a measurement, a constraint or an incident are kept but cut to a few lines each. 6540 comment lines to 5674, and 920 lines off the app. Two doc comments had drifted onto the item above the one they describe -- `contextAfter`'s onto `sessionWorking` in Events.kt, and `UsageMonitor`'s equivalent on the server was fixed in the previous commit. Each is back on its own item, which is the only non-comment line this diff moves. The comments are reflowed to the column limit at their own indentation: several were written wide, and ktfmt re-wrapped them into lines holding a single orphan word. `/tmp` script, not kept -- ktfmt is idempotent over the result, which is the check. Left alone deliberately: this codebase's remaining comment density is high because the comments carry things the code cannot say -- what a null means, what a number was measured against, which bug a guard exists for. Of the 238 one-line doc comments in the app, five were pure restatement of the name and were removed; the rest each say something the signature does not. ktfmtFormat, compileDebugKotlin, lintDebug and testDebugUnitTest pass; cargo test (127), clippy --all-targets and fmt still clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
79682f03a7
commit
edc39c7371
68 files changed
+2077
-2997
No files matched your search
@@ -44,16 +44,14 @@ private object Mocha {
|
||||
*
|
||||
* Copied from dev-updater rather than shared, which is a deliberate line: wg-app-link is the *link*
|
||||
* -- the tunnel, the pinned CA, enrollment -- and a palette is not that. The two apps looking alike
|
||||
* is a preference, not a contract, and the moment one wants a different accent the shared version
|
||||
* becomes a thing to fight rather than a thing to use.
|
||||
* is a preference, not a contract.
|
||||
*
|
||||
* The mapping that matters is the surface ladder. Mocha names its darks in order -- Crust, Mantle,
|
||||
* Base, Surface 0, Surface 1 -- and Material asks for the same thing under different names, so the
|
||||
* page is Base, a component's outlined card stays Base beside it, and a project's card is Surface
|
||||
* 0: one visible step up, which is the whole of what the nesting has to say.
|
||||
* Base, Surface 0, Surface 1 -- so the page is Base, a component's outlined card stays Base beside
|
||||
* it, and a project's card is Surface 0: one visible step up, which is the whole of what the
|
||||
* nesting has to say.
|
||||
*
|
||||
* Accents on this palette are light, so anything filled with one takes Crust for its text rather
|
||||
* than the near-white the roles default to.
|
||||
* Accents on this palette are light, so anything filled with one takes Crust for its text.
|
||||
*/
|
||||
val AiAppColors =
|
||||
darkColorScheme(
|
||||
@@ -94,10 +92,8 @@ val AiAppColors =
|
||||
* What a session is doing, said in colour.
|
||||
*
|
||||
* Here rather than beside each screen that shows a status. These were separate literals in two
|
||||
* other files -- an amber, a green and a red picked off Material's defaults -- so the same state
|
||||
* was a slightly different colour depending which screen you looked at, and none of them belonged
|
||||
* to this palette at all. A colour that carries meaning is part of the scheme, not a value typed
|
||||
* where it happened to be needed.
|
||||
* other files, so the same state was a slightly different colour depending which screen you looked
|
||||
* at. A colour that carries meaning is part of the scheme, not a value typed where it was needed.
|
||||
*/
|
||||
val runningColor: Color
|
||||
@Composable get() = Mocha.Green
|
||||
@@ -107,7 +103,7 @@ val runningColor: Color
|
||||
*
|
||||
* The scheme's error colour, and deliberately not "the same red as a destructive button" even
|
||||
* though it is the same red. They are the same red for different reasons, and a state is not an
|
||||
* action -- nothing here is a button.
|
||||
* action.
|
||||
*/
|
||||
val failedColor: Color
|
||||
@Composable get() = MaterialTheme.colorScheme.error
|
||||
@@ -116,10 +112,9 @@ val failedColor: Color
|
||||
* About the session rather than about the task: a command, and the compaction one of them starts.
|
||||
*
|
||||
* Its own colour because it is its own kind of work. Everything else a session does is progress
|
||||
* through what was asked of it; this is the session acting on itself -- rewriting what it
|
||||
* remembers, taking a new name -- and none of it appears in the transcript as an answer to
|
||||
* anything. A reader who has learned that blue means "not stuck, but not replying to you either"
|
||||
* has learned the thing that distinguishes it from a session that has hung.
|
||||
* through what was asked of it; this is the session acting on itself, and none of it appears in the
|
||||
* transcript as an answer to anything. A reader who has learned that blue means "not stuck, but not
|
||||
* replying to you either" has learned what distinguishes it from a session that has hung.
|
||||
*/
|
||||
val commandColor: Color
|
||||
@Composable get() = Mocha.Blue
|
||||
@@ -128,10 +123,9 @@ val commandColor: Color
|
||||
* A clear: the conversation taken out of what the session is given.
|
||||
*
|
||||
* Red because of what it does, not because anything went wrong -- somebody asked for this, and a
|
||||
* deliberate choice is not a problem to report. It is the same red as [failedColor] and [stopColor]
|
||||
* for a third reason, which is worth naming rather than collapsing: this is neither a fault nor a
|
||||
* button, it is the mark left where something was taken away. The reader never has to tell the
|
||||
* three apart, because no two of them can appear as the same kind of thing.
|
||||
* deliberate choice is not a problem to report. The same red as [failedColor] and [stopColor] for a
|
||||
* third reason: this is neither a fault nor a button, it is the mark left where something was taken
|
||||
* away. No two of the three can appear as the same kind of thing.
|
||||
*/
|
||||
val clearedColor: Color
|
||||
@Composable get() = Mocha.Red
|
||||
@@ -148,9 +142,9 @@ val warningColor: Color
|
||||
* The fill of a progress bar that is only reporting how far along something is.
|
||||
*
|
||||
* Blue because a bar like this reports a quantity rather than a verdict, and the scheme's primary
|
||||
* made it the loudest thing on a screen the reader opened to do something else. A download, or a
|
||||
* compaction, has no limit to be near: it finishes. Only a bar measuring a *quota* escalates, and
|
||||
* that one is [quotaColor].
|
||||
* made it the loudest thing on a screen the reader opened to do something else. A download has no
|
||||
* limit to be near: it finishes. Only a bar measuring a *quota* escalates -- that one is
|
||||
* [quotaColor].
|
||||
*/
|
||||
val progressColor: Color
|
||||
@Composable get() = Mocha.Blue
|
||||
@@ -158,15 +152,13 @@ val progressColor: Color
|
||||
/**
|
||||
* The fill of a bar measuring how much of a quota is gone: blue, then yellow, then red.
|
||||
*
|
||||
* One function rather than the same `when` written beside each bar, because the whole point of
|
||||
* colouring by consequence is that the reader learns the step once -- two bars showing the same 80%
|
||||
* in different colours teaches nothing except that the colour cannot be trusted. It reads as a
|
||||
* difference in degree, which is all colour can carry: the states that differ in *kind* from this
|
||||
* -- a window nobody could read, a machine that meters nothing -- are said in words elsewhere,
|
||||
* because a reader has no way to tell those from an ordinary low number by colour alone.
|
||||
* One function rather than the same `when` written beside each bar, because the point of colouring
|
||||
* by consequence is that the reader learns the step once. It reads as a difference in degree, which
|
||||
* is all colour can carry: the states that differ in *kind* -- a window nobody could read, a
|
||||
* machine that meters nothing -- are said in words elsewhere.
|
||||
*
|
||||
* [percent] is the API's own 0-100 rather than a fraction, so callers pass what the server sent
|
||||
* without each converting it first and one of them getting it wrong by a factor of a hundred.
|
||||
* without one of them getting it wrong by a factor of a hundred.
|
||||
*/
|
||||
@Composable
|
||||
fun quotaColor(percent: Double): Color =
|
||||
@@ -185,13 +177,11 @@ private const val OVER_LIMIT_PERCENT = 90.0
|
||||
/**
|
||||
* The surface verbatim text sits on: a command, a tool's output, a code block in a reply.
|
||||
*
|
||||
* The darkest value in the palette rather than a step up from the page, and that is the whole point
|
||||
* -- everything else on this screen is somebody's prose, and this is what a machine was handed and
|
||||
* The darkest value in the palette rather than a step up from the page, and that is the point --
|
||||
* everything else on this screen is somebody's prose, and this is what a machine was handed and
|
||||
* what it said back, character for character. Crust sits *below* Base, so the same colour reads as
|
||||
* one clear step down both on the page, where a reply is drawn, and on a card, where a tool call
|
||||
* is; a tint chosen upwards has to be picked twice and still collides with the card it lands on.
|
||||
* The renderer's default code background was `surfaceVariant`, which is exactly a card's own fill
|
||||
* -- so a code block inside a tool call had no background at all.
|
||||
* one clear step down both on the page and on a card; a tint chosen upwards has to be picked twice
|
||||
* and still collides with the card it lands on.
|
||||
*
|
||||
* One colour for all three, so "this is verbatim" is learnable once.
|
||||
*/
|
||||
@@ -202,11 +192,10 @@ val rawSurface: Color
|
||||
* Catppuccin Mocha as the highlighter's palette; see [SyntaxPalette].
|
||||
*
|
||||
* Here with the rest of the palette rather than beside the code that highlights: the colours a
|
||||
* fence is drawn in are the same accents every other coloured thing in the app already uses, and
|
||||
* splitting them out would make code the one surface whose palette came from somewhere else.
|
||||
* fence is drawn in are the same accents every other coloured thing already uses.
|
||||
*
|
||||
* Not a composable, because [highlight] runs off the drawing thread; these colours never vary with
|
||||
* the theme.
|
||||
* Not a composable, because [highlight] runs off the drawing thread; these never vary with the
|
||||
* theme.
|
||||
*/
|
||||
fun catppuccinSyntax(): SyntaxPalette =
|
||||
SyntaxPalette(
|
||||
@@ -227,8 +216,7 @@ fun catppuccinSyntax(): SyntaxPalette =
|
||||
* already made for every other blue on the screen.
|
||||
*
|
||||
* Mocha's bright half is the same accents as its normal half -- only the two greys differ -- which
|
||||
* is upstream's choice and not an omission here. A program that uses bright red to mean something
|
||||
* other than red is relying on a distinction its own terminal may not draw either.
|
||||
* is upstream's choice and not an omission here.
|
||||
*
|
||||
* The background is [rawSurface] because that is what a tool's output is drawn on, and reverse
|
||||
* video needs to know what it is reversing against.
|
||||
@@ -263,14 +251,12 @@ fun ansiPalette(): AnsiPalette =
|
||||
*
|
||||
* The default is `primary` at 40% alpha, which is a tint of whatever is behind it -- and this app
|
||||
* draws text on surfaces two full steps apart. Over a reply, on Base, that reads clearly. Over a
|
||||
* code block or a tool's output, on Crust, the same 40% composites to a barely-there smudge, so
|
||||
* selecting a line of code looks like nothing happened even though the selection is there and
|
||||
* copies correctly.
|
||||
* code block, on Crust, the same 40% composites to a barely-there smudge, so selecting a line of
|
||||
* code looks like nothing happened even though it copies correctly.
|
||||
*
|
||||
* Fixed and stronger, because "this is selected" is a meaning rather than decoration: a colour that
|
||||
* means something must carry its own contrast instead of borrowing it from the surface it happens
|
||||
* to land on. Raised only as far as it takes to read on the darkest of them -- past this the fill
|
||||
* starts competing with the syntax colours it sits behind, which are the thing being read.
|
||||
* Fixed and stronger, because "this is selected" is a meaning rather than decoration. Raised only
|
||||
* as far as it takes to read on the darkest of them -- past this the fill starts competing with the
|
||||
* syntax colours it sits behind.
|
||||
*/
|
||||
val AiAppSelectionColors =
|
||||
TextSelectionColors(
|
||||
@@ -288,11 +274,10 @@ val linkColor: Color
|
||||
* A list's markers: the bullets and numbers down its left edge.
|
||||
*
|
||||
* The scheme's secondary accent rather than the text colour, because a marker is structure rather
|
||||
* than words: coloured, the items of a list can be counted without reading them, and a nested list
|
||||
* reads as a shape before it reads as text. Lavender is not one of the colours that mean something
|
||||
* here -- green, red, peach and yellow are states and actions -- and it is the same at every depth,
|
||||
* since depth is said by the glyph and the indent; a colour per depth would make a difference in
|
||||
* degree look like one in kind.
|
||||
* than words: coloured, the items of a list can be counted without reading them. Lavender is not
|
||||
* one of the colours that mean something here, and it is the same at every depth, since depth is
|
||||
* said by the glyph and the indent -- a colour per depth would make a difference in degree look
|
||||
* like one in kind.
|
||||
*/
|
||||
val listMarkerColor: Color
|
||||
@Composable get() = Mocha.Lavender
|
||||
@@ -305,11 +290,9 @@ val overLimitColor: Color
|
||||
* The composer's buttons, coloured by what pressing one does rather than by where it sits.
|
||||
*
|
||||
* Green makes something happen now, blue makes it happen later, orange takes back what is in
|
||||
* flight, red ends the process. The near-collisions with the states above are deliberate and worth
|
||||
* naming rather than collapsing: [runningColor] is green because a session is working,
|
||||
* [failedColor] is red because one fell over, [awaitingColor] is the same orange because a session
|
||||
* is waiting on somebody -- those are *states*, and these are *actions*. A reader never has to tell
|
||||
* them apart, because nothing here is a state and nothing there is pressable.
|
||||
* flight, red ends the process. The near-collisions with the states above are deliberate: those are
|
||||
* *states*, and these are *actions*. A reader never has to tell them apart, because nothing here is
|
||||
* a state and nothing there is pressable.
|
||||
*/
|
||||
val sendColor: Color
|
||||
@Composable get() = Mocha.Green
|
||||
@@ -322,9 +305,8 @@ val queueColor: Color
|
||||
* Interrupting the running turn: the work stops and the session stays.
|
||||
*
|
||||
* Orange rather than red because of how much it takes: only what is in flight. The process is still
|
||||
* there holding the conversation, and the next message starts a turn as though nothing had
|
||||
* happened. Red is spent on [stopColor], which is the same button in the same place when what it
|
||||
* would end is the session's process.
|
||||
* there holding the conversation. Red is spent on [stopColor], which is the same button in the same
|
||||
* place when what it would end is the session's process.
|
||||
*/
|
||||
val pauseColor: Color
|
||||
@Composable get() = Mocha.Peach
|
||||
@@ -347,8 +329,7 @@ val startColor: Color
|
||||
*
|
||||
* The content colour is stated here beside the fill rather than inherited. A semantic colour has to
|
||||
* carry its own contrast: these fills are fixed whatever the surface under them does, so the theme
|
||||
* will not change to rescue a foreground that stops being readable on one of them. Crust is what
|
||||
* every accent on this palette takes, which is the same reason `onPrimary` is Crust above.
|
||||
* will not change to rescue a foreground that stops being readable on one of them.
|
||||
*/
|
||||
@Composable
|
||||
fun actionButtonColors(fill: Color): ButtonColors =
|
||||
|
||||
Reference in new issue
Block a user