pi-ext bugabingas pi extensions
owned by bugabinga
README Source History Refs Compare Notes Search Skipped full governance imports when no .system exists; focused startup tax vanished on both platforms while exact governed-project notice behavior and 53 tests passed 9960d9afe61ecb282ece71a5836ad38fde179c01
Oliver Krylow <o.krylow@isp-insoft.de > · 24 Aug 2026
SSH signature · not checked
Browse files Compare with HEAD
Result: {"status":"keep","win32_the_system_startup_tax_ms":-148.853,"elapsed_s":122.8,"win32_start_reload_ms":5327.953,"win32_extension_tax_ms":3199.375,"the_system_import_ms":57,"win32_the_system_tax_ms":-128.368,"win32_the_system_reload_tax_ms":41.583,"win32_startup_ms":3568.321,"win32_reload_ms":1759.632,"wsl_start_reload_ms":1048.259,"wsl_extension_tax_ms":412.173,"wsl_the_system_import_ms":20,"wsl_the_system_tax_ms":9.655,"wsl_the_system_startup_tax_ms":-3.273,"wsl_the_system_reload_tax_ms":13.918}
Changed files (5) extensions/the-system/__tests__/system.test.ts Modified 10 10 import path
from "node:path" ;
11 11 import { afterEach, describe, it }
from "vitest" ;
12 12 import { applyInitialization }
from "../init.ts" ;
13 + import { startupRuntimeNotice }
from "../startup-notice.ts" ;
15 16 composeSystemPrompt,
62 63 describe (
"runtime notice" , ()
=> {
63 - it (
"stays quiet until the project opts into .system" , ()
=> {
64 + it (
"stays quiet until the project opts into .system" ,
async ()
=> {
64 65 const project
= mkdtempSync (path.
join (
tmpdir (),
"the-system-runtime-" ));
65 66 roots.
push (project);
66 67 mkdirSync (path.
join (project,
".git" ));
67 68 assert.
equal (
runtimeNotice (project),
undefined );
69 + assert.
equal (
await startupRuntimeNotice (project),
undefined );
68 70 mkdirSync (path.
join (project,
".system" ));
69 71 assert.
match (
runtimeNotice (project)
?? "" ,
/incomplete or invalid/ );
73 + (
await startupRuntimeNotice (project))
?? "" ,
74 + /incomplete or invalid/ ,
extensions/the-system/documents.ts Modified 1 - import { existsSync, lstatSync, readdirSync, readFileSync }
from "node:fs" ;
1 + import { lstatSync, readdirSync, readFileSync }
from "node:fs" ;
2 2 import path
from "node:path" ;
5 5 type MarkdownDocumentError,
7 7 }
from "./markdown.ts" ;
8 + import { SystemDocumentError }
from "./project-root.ts" ;
10 + export { discoverProjectRoot, SystemDocumentError }
from "./project-root.ts" ;
9 12 export const SCHEMA_VERSION
= 3 ;
11 - export class SystemDocumentError extends Error {
12 - readonly code
: string ;
14 - constructor (code
: string , message
: string ) {
17 - this.
name = "SystemDocumentError" ;
21 - const nearestMarker = (
24 - markerExists : (candidate
: string )
=> boolean ,
26 - let current
= path.
resolve (cwd);
28 - if (
markerExists (path.
join (current, marker)))
return current;
29 - const parent
= path.
dirname (current);
30 - if (parent
=== current)
return undefined ;
35 - export function discoverProjectRoot (
37 - markerExists
= existsSync,
39 - const resolvedCwd
= path.
resolve (cwd);
40 - const jj
= nearestMarker (resolvedCwd,
".jj" , markerExists);
41 - const git
= nearestMarker (resolvedCwd,
".git" , markerExists);
42 - if (jj
&& git
&& jj
!== git)
43 - throw new SystemDocumentError (
45 - `Conflicting project roots: Git ${git}; JJ ${jj}` ,
47 - return jj
?? git
?? resolvedCwd;
50 14 export function resolveGovernedPath (root
: string , candidate
: string )
: string {
51 15 const normalizedRoot
= path.
resolve (
root );
52 16 const target
= path.
resolve (normalizedRoot, candidate);
extensions/the-system/index.ts Modified 20 20 const notifyOnce = async (ctx
: ExtensionContext , ticket
: number )
=> {
21 21 if (notified
|| ticket
!== generation)
return ;
23 - const { runtimeNotice }
= await import (
"./system.js" );
23 + const { startupRuntimeNotice }
= await import (
"./startup-notice.js" );
24 24 if (notified
|| ticket
!== generation)
return ;
25 - const message
= runtimeNotice (ctx.cwd);
25 + const message
= await startupRuntimeNotice (ctx.cwd);
26 26 if (
! message)
return ;
27 27 if (ctx.hasUI) ctx.ui.
notify (message,
"warning" );
extensions/the-system/project-root.ts Added new file mode 100644 1 + import { existsSync }
from "node:fs" ;
2 + import path
from "node:path" ;
4 + export class SystemDocumentError extends Error {
5 + readonly code
: string ;
7 + constructor (code
: string , message
: string ) {
10 + this.
name = "SystemDocumentError" ;
14 + const nearestMarker = (
17 + markerExists : (candidate
: string )
=> boolean ,
19 + let current
= path.
resolve (cwd);
21 + if (
markerExists (path.
join (current, marker)))
return current;
22 + const parent
= path.
dirname (current);
23 + if (parent
=== current)
return undefined ;
28 + export function discoverProjectRoot (
30 + markerExists
= existsSync,
32 + const resolvedCwd
= path.
resolve (cwd);
33 + const jj
= nearestMarker (resolvedCwd,
".jj" , markerExists);
34 + const git
= nearestMarker (resolvedCwd,
".git" , markerExists);
35 + if (jj
&& git
&& jj
!== git)
36 + throw new SystemDocumentError (
38 + `Conflicting project roots: Git ${git}; JJ ${jj}` ,
40 + return jj
?? git
?? resolvedCwd;
extensions/the-system/startup-notice.ts Added new file mode 100644 1 + import { existsSync }
from "node:fs" ;
2 + import path
from "node:path" ;
3 + import { discoverProjectRoot }
from "./project-root.ts" ;
5 + export async function startupRuntimeNotice (
7 + )
: Promise <
string | undefined > {
10 + root = discoverProjectRoot (cwd);
14 + if (
! existsSync (path.
join (
root ,
".system" )))
return undefined ;
15 + const { runtimeNotice }
= await import (
"./system.ts" );
16 + return runtimeNotice (cwd);