@@ -83,11 +83,37 @@ export class FilesController {
8383 private readonly workspaces : WorkspaceService ,
8484 ) { }
8585
86+ /**
87+ * What the agent changed, straight from git — every workspace starts as a
88+ * clone of the template, so `status --porcelain` is the honest diff. 204
89+ * when there is no git baseline; the client falls back to the full tree.
90+ */
91+ @Get ( 'project/changes' )
92+ @UseGuards ( JWTAuthGuard )
93+ async changes ( @Req ( ) req : Request , @Query ( 'path' ) projectId ?: string ) {
94+ if ( ! projectId ) throw new BadRequestException ( 'Missing path' ) ;
95+ await assertProjectAccess ( {
96+ projects : this . projects ,
97+ req,
98+ projectPath : projectId ,
99+ write : false ,
100+ } ) ;
101+
102+ const workspace = await this . workspaces . for ( projectId ) ;
103+ const changes = await workspace . changedFiles ( ) ;
104+ return { changes } ;
105+ }
106+
86107 @Get ( 'project' )
87108 @UseGuards ( JWTAuthGuard )
88109 async tree ( @Req ( ) req : Request , @Query ( 'path' ) projectId ?: string ) {
89110 if ( ! projectId ) throw new BadRequestException ( 'Missing path' ) ;
90- await assertProjectAccess ( { projects : this . projects , req, projectPath : projectId , write : false } ) ;
111+ await assertProjectAccess ( {
112+ projects : this . projects ,
113+ req,
114+ projectPath : projectId ,
115+ write : false ,
116+ } ) ;
91117
92118 const workspace = await this . workspaces . for ( projectId ) ;
93119 const paths = await workspace . listFiles ( ) ;
@@ -191,7 +217,12 @@ export class FilesController {
191217 @UseGuards ( JWTAuthGuard )
192218 async read ( @Req ( ) req : Request , @Query ( 'path' ) filePath ?: string ) {
193219 if ( ! filePath ) throw new BadRequestException ( "Missing 'path'" ) ;
194- await assertProjectAccess ( { projects : this . projects , req, projectPath : filePath , write : false } ) ;
220+ await assertProjectAccess ( {
221+ projects : this . projects ,
222+ req,
223+ projectPath : filePath ,
224+ write : false ,
225+ } ) ;
195226
196227 const [ projectPath , ...rest ] = filePath . split ( '/' ) ;
197228 const workspace = await this . workspaces . for ( projectPath ) ;
@@ -211,7 +242,12 @@ export class FilesController {
211242 if ( ! filePath || newContent == null ) {
212243 throw new BadRequestException ( "Missing 'filePath' or 'newContent'" ) ;
213244 }
214- await assertProjectAccess ( { projects : this . projects , req, projectPath : filePath , write : true } ) ;
245+ await assertProjectAccess ( {
246+ projects : this . projects ,
247+ req,
248+ projectPath : filePath ,
249+ write : true ,
250+ } ) ;
215251
216252 const [ projectPath , ...rest ] = filePath . split ( '/' ) ;
217253 try {
0 commit comments