TenantAtlas/apps/platform/.pnpm-store/v10/files/d1/4597b80c51f5b8a31a05bf73b43a8d4bee4e1b6a36f4831ffdb59dfdf5cf93f1c96d460a5922a30ea64df19fffeabd7cf784f0318533d4b14e513729749f01-exec
ahmido 1fec9c6f9d
Some checks failed
Main Confidence / confidence (push) Failing after 45s
feat: compress governance operator outcomes (#253)
## Summary
- introduce surface-aware compressed governance outcomes and reuse the shared truth/explanation seams for operator-first summaries
- apply the compressed outcome hierarchy across baseline, evidence, review, review-pack, canonical review/evidence, and artifact-oriented operation-run surfaces
- expand spec 214 fixtures and Pest coverage, and fix tenant-panel route assertions by generating explicit tenant-panel URLs in the affected Filament tests

## Validation
- `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent`
- focused governance compression suite from `specs/214-governance-outcome-compression/quickstart.md` passed (`68` tests, `445` assertions)
- `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Filament/InventoryItemResourceTest.php tests/Feature/Filament/BackupSetUiEnforcementTest.php tests/Feature/Filament/RestoreRunUiEnforcementTest.php` passed (`18` tests, `81` assertions)

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #253
2026-04-19 12:30:36 +00:00

93 lines
2.5 KiB
JavaScript
Executable File

#!/usr/bin/env node
import { readFileSync, readdirSync, unlinkSync, existsSync } from 'fs'
import { dirname } from 'path'
/*
* Argv helpers.
*/
const argument = (name) => {
const index = process.argv.findIndex(argument => argument.startsWith(`--${name}=`))
return index === -1
? undefined
: process.argv[index].substring(`--${name}=`.length)
}
const option = (name) => process.argv.includes(`--${name}`)
/*
* Helpers.
*/
const info = option(`quiet`) ? (() => undefined) : console.log
const error = option(`quiet`) ? (() => undefined) : console.error
/*
* Clean.
*/
const main = () => {
const manifestPaths = argument(`manifest`) ? [argument(`manifest`)] : (option(`ssr`)
? [`./bootstrap/ssr/ssr-manifest.json`, `./bootstrap/ssr/manifest.json`]
: [`./public/build/manifest.json`])
const foundManifestPath = manifestPaths.find(existsSync)
if (! foundManifestPath) {
error(`Unable to find manifest file.`)
process.exit(1)
}
info(`Reading manifest [${foundManifestPath}].`)
const manifest = JSON.parse(readFileSync(foundManifestPath).toString())
const manifestFiles = Object.keys(manifest)
const isSsr = Array.isArray(manifest[manifestFiles[0]])
isSsr
? info(`SSR manifest found.`)
: info(`Non-SSR manifest found.`)
const manifestAssets = isSsr
? manifestFiles.flatMap(key => manifest[key])
: manifestFiles.flatMap(key => [
...manifest[key].css ?? [],
manifest[key].file,
])
const assetsPath = argument('assets') ?? dirname(foundManifestPath)+'/assets'
info(`Verify assets in [${assetsPath}].`)
const existingAssets = readdirSync(assetsPath, { withFileTypes: true })
const orphanedAssets = existingAssets.filter(file => file.isFile())
.filter(file => manifestAssets.findIndex(asset => asset.endsWith(`/${file.name}`)) === -1)
if (orphanedAssets.length === 0) {
info(`No ophaned assets found.`)
} else {
orphanedAssets.length === 1
? info(`[${orphanedAssets.length}] orphaned asset found.`)
: info(`[${orphanedAssets.length}] orphaned assets found.`)
orphanedAssets.forEach(asset => {
const path = `${assetsPath}/${asset.name}`
option(`dry-run`)
? info(`Orphaned asset [${path}] would be removed.`)
: info(`Removing orphaned asset [${path}].`)
if (! option(`dry-run`)) {
unlinkSync(path)
}
})
}
}
main()