@@ -9,21 +9,19 @@ import { RepositoryCache } from "./repository-cache"
99import { AbsolutePath } from "./schema"
1010import { State } from "./state"
1111
12- export class Info extends Schema . Class < Info > ( "Reference.Info" ) ( {
13- name : Schema . String ,
14- path : AbsolutePath ,
15- source : Schema . suspend ( ( ) => Source ) ,
16- } ) { }
17-
1812export class LocalSource extends Schema . Class < LocalSource > ( "Reference.LocalSource" ) ( {
1913 type : Schema . Literal ( "local" ) ,
2014 path : AbsolutePath ,
15+ description : Schema . String . pipe ( Schema . optional ) ,
16+ hidden : Schema . Boolean . pipe ( Schema . optional ) ,
2117} ) { }
2218
2319export class GitSource extends Schema . Class < GitSource > ( "Reference.GitSource" ) ( {
2420 type : Schema . Literal ( "git" ) ,
2521 repository : Schema . String ,
2622 branch : Schema . String . pipe ( Schema . optional ) ,
23+ description : Schema . String . pipe ( Schema . optional ) ,
24+ hidden : Schema . Boolean . pipe ( Schema . optional ) ,
2725} ) { }
2826
2927export const Source = Schema . Union ( [ LocalSource , GitSource ] ) . pipe ( Schema . toTaggedUnion ( "type" ) )
@@ -33,6 +31,14 @@ export const Event = {
3331 Updated : EventV2 . define ( { type : "reference.updated" , schema : { } } ) ,
3432}
3533
34+ export class Info extends Schema . Class < Info > ( "Reference.Info" ) ( {
35+ name : Schema . String ,
36+ path : AbsolutePath ,
37+ description : Schema . String . pipe ( Schema . optional ) ,
38+ hidden : Schema . Boolean . pipe ( Schema . optional ) ,
39+ source : Source ,
40+ } ) { }
41+
3642type Data = {
3743 sources : Map < string , Source >
3844}
@@ -71,7 +77,16 @@ export const layer = Layer.effect(
7177 const seen = new Map < string , string | undefined > ( )
7278 for ( const [ name , source ] of editor . list ( ) ) {
7379 if ( source . type === "local" ) {
74- materialized . set ( name , new Info ( { name, path : source . path , source } ) )
80+ materialized . set (
81+ name ,
82+ new Info ( {
83+ name,
84+ path : source . path ,
85+ description : source . description ,
86+ hidden : source . hidden ,
87+ source,
88+ } ) ,
89+ )
7590 continue
7691 }
7792 const repository = Repository . parse ( source . repository )
@@ -86,7 +101,16 @@ export const layer = Layer.effect(
86101 const target = Repository . cachePath ( global . repos , repository )
87102 if ( seen . has ( target ) && seen . get ( target ) !== source . branch ) continue
88103 seen . set ( target , source . branch )
89- materialized . set ( name , new Info ( { name, path : AbsolutePath . make ( target ) , source } ) )
104+ materialized . set (
105+ name ,
106+ new Info ( {
107+ name,
108+ path : AbsolutePath . make ( target ) ,
109+ description : source . description ,
110+ hidden : source . hidden ,
111+ source,
112+ } ) ,
113+ )
90114 yield * cache . ensure ( { reference : repository , branch : source . branch , refresh : true } ) . pipe (
91115 Effect . catchCause ( ( cause ) =>
92116 Effect . logWarning ( "failed to materialize reference" , {
0 commit comments