DevContext.format.ps1xml

<?xml version="1.0" encoding="utf-8"?>
<!--
    Display formats for DevContext.

    Why this file exists: PowerShell falls back to a list layout as soon as an
    object exposes more than four display properties, and ctx-sb needs five to
    be useful. A command whose whole purpose is "see the estate at a glance"
    cannot ship a one-object-per-paragraph layout.

    The '!' column marks a project several folders point at: the shape that
    let three worktrees aim at one production project unnoticed until 13 Aug 2026.

    Note for future edits: an XML comment cannot contain a double hyphen.
    Getting that wrong does not merely break the layout, it makes the manifest
    refuse to load the whole module, so work and ctx stop existing.
-->
<Configuration>
  <ViewDefinitions>
    <View>
      <Name>DevContext.SupabaseMapEntry</Name>
      <ViewSelectedBy>
        <TypeName>DevContext.SupabaseMapEntry</TypeName>
      </ViewSelectedBy>
      <TableControl>
        <TableHeaders>
          <TableColumnHeader>
            <Label>Compte</Label>
            <Width>18</Width>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Projet</Label>
            <Width>20</Width>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Env</Label>
            <Width>5</Width>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>!</Label>
            <Width>1</Width>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Dossiers</Label>
          </TableColumnHeader>
        </TableHeaders>
        <TableRowEntries>
          <TableRowEntry>
            <TableColumnItems>
              <TableColumnItem>
                <PropertyName>Compte</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>Projet</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>if ($_.Env) { $_.Env.ToUpper() } else { '-' }</ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>if ($_.Partage) { '!' } else { '' }</ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>if ($_.Dossiers.Count) { $_.Dossiers -join ', ' } else { '(aucun dossier local)' }</ScriptBlock>
              </TableColumnItem>
            </TableColumnItems>
          </TableRowEntry>
        </TableRowEntries>
      </TableControl>
    </View>

    <!--
        ctx doctor. Same reason as above: five properties, so the default is a
        list, and a diagnostic read one paragraph per line is a diagnostic
        nobody reads to the end.

        The fix is folded into the same cell as the finding, on its own line:
        a separate column would be empty on most rows and would steal the width
        the finding needs. Wrap is on for that reason.

        Colour comes from $PSStyle, which PowerShell 7.2 and later measures
        correctly when sizing columns.
    -->
    <View>
      <Name>DevContext.DoctorCheck</Name>
      <ViewSelectedBy>
        <TypeName>DevContext.DoctorCheck</TypeName>
      </ViewSelectedBy>
      <TableControl>
        <TableHeaders>
          <TableColumnHeader>
            <Label>Verdict</Label>
            <Width>9</Width>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Domaine</Label>
            <Width>10</Width>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Sujet</Label>
            <Width>14</Width>
          </TableColumnHeader>
          <TableColumnHeader>
            <Label>Constat</Label>
          </TableColumnHeader>
        </TableHeaders>
        <TableRowEntries>
          <TableRowEntry>
            <Wrap/>
            <TableColumnItems>
              <TableColumnItem>
                <ScriptBlock>
                  $c = switch ($_.Verdict) {
                      'OK' { $PSStyle.Foreground.Green }
                      'INFO' { $PSStyle.Foreground.BrightBlack }
                      'ATTENTION' { $PSStyle.Foreground.Yellow }
                      'PROBLEME' { $PSStyle.Foreground.Red }
                      'ABSENT' { $PSStyle.Foreground.Magenta }
                      default { '' }
                  }
                  "$c$($_.Verdict)$($PSStyle.Reset)"
                </ScriptBlock>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>Domaine</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <PropertyName>Sujet</PropertyName>
              </TableColumnItem>
              <TableColumnItem>
                <ScriptBlock>
                  if ($_.Correctif) {
                      "$($_.Detail)`n $($PSStyle.Foreground.Cyan)-> $($_.Correctif)$($PSStyle.Reset)"
                  } else { $_.Detail }
                </ScriptBlock>
              </TableColumnItem>
            </TableColumnItems>
          </TableRowEntry>
        </TableRowEntries>
      </TableControl>
    </View>
  </ViewDefinitions>
</Configuration>