@jals1212/ci-local-pi 0.1.0 → 0.1.1
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 +8 -0
- package/README.md +1 -3
- package/extensions/ci-local.ts +17 -34
- package/package.json +1 -1
- package/skills/ci-local/SKILL.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,14 @@ add or change behaviour and a patch version fixes.
|
|
|
6
6
|
|
|
7
7
|
## Unreleased
|
|
8
8
|
|
|
9
|
+
## 0.1.1
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- The bridge role is gone from the extension: the CLI 0.8.0 no longer has a
|
|
14
|
+
bridge. The flag that keeps a CLI 0.7.x bridge quiet while this package is
|
|
15
|
+
loaded stays. (#35)
|
|
16
|
+
|
|
9
17
|
## 0.1.0
|
|
10
18
|
|
|
11
19
|
### Added
|
package/README.md
CHANGED
|
@@ -15,9 +15,7 @@ bash tool).
|
|
|
15
15
|
|
|
16
16
|
Until 0.7.x, the extension shipped inside `@jals1212/ci-local`. If you
|
|
17
17
|
installed it from there, switch: `pi install npm:@jals1212/ci-local-pi`, then
|
|
18
|
-
`pi remove npm:@jals1212/ci-local`.
|
|
19
|
-
says so once per session and steps aside when this package is loaded, so
|
|
20
|
-
having both never shows a card twice.
|
|
18
|
+
`pi remove npm:@jals1212/ci-local`.
|
|
21
19
|
|
|
22
20
|
## What it follows
|
|
23
21
|
|
package/extensions/ci-local.ts
CHANGED
|
@@ -28,10 +28,6 @@
|
|
|
28
28
|
// It reads the events file each run writes (see README, "Following a run");
|
|
29
29
|
// it never runs ci-local or Docker. The logic lives in ./core.js.
|
|
30
30
|
//
|
|
31
|
-
// Two packages load this file: @jals1212/ci-local-pi (role 'package') and, for
|
|
32
|
-
// one more minor, the CLI's own `pi` entry (pi/bridge.ts, role 'bridge'). The
|
|
33
|
-
// bridge says once per session that the extension moved, and steps aside when
|
|
34
|
-
// the package is loaded too, so a user with both sees every card once.
|
|
35
31
|
|
|
36
32
|
import type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent'
|
|
37
33
|
import { Box, Text } from '@earendil-works/pi-tui'
|
|
@@ -56,31 +52,26 @@ const START_KEY = 'ci-local-start'
|
|
|
56
52
|
/** The hidden wake message (see createDelivery). */
|
|
57
53
|
const WAKE_KEY = 'ci-local-wake'
|
|
58
54
|
const POLL_MS = 1000
|
|
59
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Set on globalThis while this package is loaded. A CLI 0.7.x still installed in
|
|
57
|
+
* Pi loads a bridge that steps aside when it sees this flag, so a user with both
|
|
58
|
+
* sees every card once. The CLI 0.8.0 has no bridge; the flag stays for 0.7.x.
|
|
59
|
+
*/
|
|
60
60
|
const FLAG = Symbol.for('@jals1212/ci-local-pi')
|
|
61
|
-
const MOVED =
|
|
62
|
-
"ci-local's Pi extension moved to @jals1212/ci-local-pi: pi install npm:@jals1212/ci-local-pi, then pi remove npm:@jals1212/ci-local"
|
|
63
|
-
|
|
64
|
-
const packageLoaded = () => (globalThis as Record<symbol, unknown>)[FLAG] === true
|
|
65
61
|
|
|
66
62
|
type Card = { state: string; lines: string[] }
|
|
67
63
|
/** A start card: the run, its stage ('starting', then 'started'), the --status block. */
|
|
68
64
|
type StartCard = { key: string; phase: 'starting' | 'started'; lines: string[] }
|
|
69
65
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
export function createCiLocalExtension({ role }: { role: Role }) {
|
|
73
|
-
return (pi: ExtensionAPI) => ciLocal(pi, role)
|
|
66
|
+
export function createCiLocalExtension() {
|
|
67
|
+
return (pi: ExtensionAPI) => ciLocal(pi)
|
|
74
68
|
}
|
|
75
69
|
|
|
76
|
-
function ciLocal(pi: ExtensionAPI
|
|
77
|
-
// Said at load, before any session starts, so
|
|
78
|
-
// the load order; session_shutdown takes it back (a reload without
|
|
79
|
-
// package must not find it still there).
|
|
80
|
-
|
|
81
|
-
// Pi loads the package's extension first or last, we cannot know: the bridge
|
|
82
|
-
// looks at session_start, and its handlers look again.
|
|
83
|
-
const aside = () => role === 'bridge' && packageLoaded()
|
|
70
|
+
function ciLocal(pi: ExtensionAPI) {
|
|
71
|
+
// Said at load, before any session starts, so a CLI 0.7.x bridge can see it
|
|
72
|
+
// whatever the load order; session_shutdown takes it back (a reload without
|
|
73
|
+
// this package must not find it still there).
|
|
74
|
+
;(globalThis as Record<symbol, unknown>)[FLAG] = true
|
|
84
75
|
|
|
85
76
|
let timer: ReturnType<typeof setInterval> | undefined
|
|
86
77
|
// The session's end cards, and whether an agent run is under way: it spans
|
|
@@ -89,18 +80,16 @@ function ciLocal(pi: ExtensionAPI, role: Role) {
|
|
|
89
80
|
let runActive = false
|
|
90
81
|
|
|
91
82
|
pi.on('agent_start', async () => {
|
|
92
|
-
if (aside()) return
|
|
93
83
|
runActive = true
|
|
94
84
|
delivery?.boundary()
|
|
95
85
|
})
|
|
96
86
|
pi.on('agent_settled', async () => {
|
|
97
|
-
if (aside()) return
|
|
98
87
|
runActive = false
|
|
99
88
|
delivery?.boundary()
|
|
100
89
|
})
|
|
101
|
-
pi.on('turn_end', async () =>
|
|
102
|
-
pi.on('session_compact', async () =>
|
|
103
|
-
pi.on('session_compact_failed', async () =>
|
|
90
|
+
pi.on('turn_end', async () => delivery?.boundary())
|
|
91
|
+
pi.on('session_compact', async () => delivery?.boundary())
|
|
92
|
+
pi.on('session_compact_failed', async () => delivery?.boundary())
|
|
104
93
|
|
|
105
94
|
pi.registerEntryRenderer<StartCard>(START_KEY, (entry, _options, theme) => {
|
|
106
95
|
const lines = (entry.data?.lines ?? []).map((line) => line.replace(/^> ?/, '').replaceAll('**', ''))
|
|
@@ -154,12 +143,6 @@ function ciLocal(pi: ExtensionAPI, role: Role) {
|
|
|
154
143
|
stop()
|
|
155
144
|
runActive = false
|
|
156
145
|
if (!ctx.hasUI) return
|
|
157
|
-
if (aside()) {
|
|
158
|
-
delivery = undefined // the package does it all; this one shows and sends nothing
|
|
159
|
-
return
|
|
160
|
-
}
|
|
161
|
-
// Not on a reload: the session was told when it started.
|
|
162
|
-
if (role === 'bridge' && event.reason !== 'reload') ctx.ui.notify(MOVED, 'warning')
|
|
163
146
|
const found = findProject(ctx.cwd)
|
|
164
147
|
if (!found) return
|
|
165
148
|
const file = eventsFileFor(found.project, process.env, found.repo)
|
|
@@ -258,8 +241,8 @@ function ciLocal(pi: ExtensionAPI, role: Role) {
|
|
|
258
241
|
|
|
259
242
|
pi.on('session_shutdown', async () => {
|
|
260
243
|
stop()
|
|
261
|
-
|
|
244
|
+
delete (globalThis as Record<symbol, unknown>)[FLAG]
|
|
262
245
|
})
|
|
263
246
|
}
|
|
264
247
|
|
|
265
|
-
export default createCiLocalExtension(
|
|
248
|
+
export default createCiLocalExtension()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jals1212/ci-local-pi",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
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",
|