@jals1212/ci-local-pi 0.4.0 → 0.5.0

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 CHANGED
@@ -6,6 +6,15 @@ add or change behaviour and a patch version fixes.
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## 0.5.0
10
+
11
+ ### Added
12
+
13
+ - The status line of a finished run says when it ended, so an old result is
14
+ not taken for a new one: how long ago for its first hour
15
+ (`🚦 ci-local · ✗ failed at lint · 32s · 10m ago`), then the local time it
16
+ ended (`· 13:10`). (#58)
17
+
9
18
  ## 0.4.0
10
19
 
11
20
  ### Added
package/README.md CHANGED
@@ -24,8 +24,9 @@ literal `CI_PROJECT=`), it follows the events file of that project; it never
24
24
  runs ci-local or Docker itself:
25
25
 
26
26
  - **Status line**: `🚦 ci-local · ◌ queued · 2 ahead (erp-ci running)`, `🚦 ci-local · ⧗ [3/8] lint · 2m05s`,
27
- then `🚦 ci-local · ✓ passed · 4m12s` or `🚦 ci-local · ✗ failed at lint · 2m10s` until
28
- the next run. A run already over when a session starts shows only while its
27
+ then `🚦 ci-local · ✓ passed · 4m12s · 10m ago` or `🚦 ci-local · ✗ failed at lint · 2m10s · just now`
28
+ until the next run. A result says how long ago it ended for its first hour,
29
+ then the local time it ended (`· 13:10`). A run already over when a session starts shows only while its
29
30
  result is undelivered, like an unread message: it ended with no session of
30
31
  the repository open. Once a session has shown it finished, a later session
31
32
  (new or resumed) leaves it out, and a reload keeps it out unless that
@@ -2,8 +2,9 @@
2
2
  // ci-local run in Pi's own UI, so neither the agent nor you write it by hand.
3
3
  //
4
4
  // - Status line: `🚦 ci-local · ⧗ [3/8] lint · 2m05s`, `🚦 ci-local · ◌ queued ·
5
- // 2 ahead (erp-ci running)`, then `🚦 ci-local · ✓ passed · 4m12s` / `🚦 ci-local ·
6
- // ✗ failed at lint` until the next run (🚦 is ci-local's own emoji, see BRAND).
5
+ // 2 ahead (erp-ci running)`, then `🚦 ci-local · ✓ passed · 4m12s · 10m ago` / `🚦 ci-local ·
6
+ // ✗ failed at lint · 2m10s · 13:10` (how long ago it ended, then from an
7
+ // hour on the time it ended) until the next run (🚦 is ci-local's own emoji, see BRAND).
7
8
  // A run already over when a session starts is shown only if no session
8
9
  // showed its result yet, like a message not yet delivered (createStatusLine).
9
10
  // - Cards and the agent: only for runs this session started, as Gentle AI's job
@@ -285,10 +285,30 @@ export function createStatusLine({ file, sessionId, reason }) {
285
285
  }
286
286
  }
287
287
 
288
- /** One short line for the footer: `🚦 ci-local · ✓ passed · 4m12s`. */
289
- export function footerText(state) {
288
+ /**
289
+ * One short line for the footer: `🚦 ci-local · ✓ passed · 4m12s · 10m ago`. A
290
+ * finished run says when it ended (from its end event), so an old result is
291
+ * not taken for a new one: how long ago within the first hour, then the local
292
+ * HH:MM, which no longer changes. `now` is the time it is said at.
293
+ */
294
+ export function footerText(state, now = Date.now()) {
290
295
  // The state's glyph sits by the state, after the name.
291
- return `${BRAND} ci-local · ${GLYPHS[state.state] ?? GLYPHS.stopped} ${stateText(state)}`
296
+ const line = `${BRAND} ci-local · ${GLYPHS[state.state] ?? GLYPHS.stopped} ${stateText(state)}`
297
+ const at = FINISHED.has(state.state) ? endedText(state.end?.ts, now) : null
298
+ return at ? `${line} · ${at}` : line
299
+ }
300
+
301
+ /** Until then a result says how long ago it ended; after, the time it ended. */
302
+ export const RELATIVE_END_MS = 60 * 60_000
303
+
304
+ /** When a run ended, as the footer says it, or null without an end time. */
305
+ function endedText(ts, now) {
306
+ const date = new Date(ts ?? '')
307
+ if (Number.isNaN(date.getTime())) return null
308
+ const age = now - date.getTime()
309
+ if (age < 60_000) return 'just now' // a clock a little ahead says so too
310
+ if (age < RELATIVE_END_MS) return `${Math.floor(age / 60_000)}m ago`
311
+ return `${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`
292
312
  }
293
313
 
294
314
  /** The state of a run in a few words, as the footer says it after its glyph. */
@@ -716,7 +736,7 @@ export function createHerdrLine({ now = Date.now } = {}) {
716
736
  endedAt.set(run.key, Number.isFinite(ended) ? ended : run.key === flying ? now() : null)
717
737
  }
718
738
  const ended = endedAt.get(run.key)
719
- return ended !== null && now() - ended < HERDR_RESULT_MS ? clip(footerText(run.state)) : null
739
+ return ended !== null && now() - ended < HERDR_RESULT_MS ? clip(footerText(run.state, now())) : null
720
740
  },
721
741
  }
722
742
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jals1212/ci-local-pi",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Pi extension and skill for @jals1212/ci-local: the state of this repository's ci-local run in Pi's status line, cards and a read-only tool for the agent.",
5
5
  "license": "MIT",
6
6
  "author": "jals1212",
@@ -4,7 +4,7 @@ description: "Trigger: ci-local, run CI locally, ci-local.config.sh, CI_PROJECT,
4
4
  license: MIT
5
5
  metadata:
6
6
  author: jals1212
7
- version: "0.4.0"
7
+ version: "0.5.0"
8
8
  ---
9
9
 
10
10
  ## Activation Contract
@@ -18,7 +18,7 @@ Use when running, waiting on, reading, or configuring `ci-local` (`npx ci-local`
18
18
  - Unwatched runs are quiet: milestones and the summary on stdout, each step's output in its own log. From 0.5.0 that is the default without a terminal; before 0.5.0, add `--quiet`. Never add `--live` to a background run.
19
19
  - Do not touch the checkout while a run is in flight (no edits, no branch switch): the steps read it.
20
20
  - Never start a second run to "check" the first. Runs queue machine-wide by themselves (one Docker user at a time); a waiting run is normal, not a hang.
21
- - Read the result from the run itself: `PASSED:` / `FAILED at step:` and `Development stack untouched`. A changed development stack is a failure.
21
+ - Read the result from the run itself: `PASSED:` / `FAILED at step:` / `STOPPED` (stopped on purpose, not a failure) and `Development stack untouched`. A changed development stack is a failure.
22
22
  - On failure, read only the failing step's log (named in the failure output or `--status`), not every log.
23
23
  - Everything a run creates carries the `$CI_PROJECT` prefix and the `$CI_LABEL` label; never hard-code another name, publish a port, or reuse a development container name. Local compose smokes use `-p <own-name>`.
24
24
 
@@ -45,7 +45,7 @@ Use when running, waiting on, reading, or configuring `ci-local` (`npx ci-local`
45
45
 
46
46
  ## Output Contract
47
47
 
48
- Report: project, commit, result line (`PASSED` / `FAILED at step`), total time, any `DEVIATES` lines, and whether the development stack was untouched.
48
+ Report: project, commit, result line (`PASSED` / `FAILED at step` / `STOPPED`), total time, any `DEVIATES` lines, and whether the development stack was untouched.
49
49
 
50
50
  ## References
51
51