Skip to content

Commit 3e17a83

Browse files
authored
docs: aggiungi workflow locale Codex per agent-context (#8)
* docs: aggiungi workflow locale Codex per agent-context * docs: correggi accenti nel profilo operativo * docs: rendi portabile il wrapper Codex
1 parent ba7dd2b commit 3e17a83

3 files changed

Lines changed: 111 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ htmlcov/
3939

4040
# Generated artifacts
4141
generated/
42+
generated-*/
4243
out/
4344
_out/
4445

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,36 @@ Lookup semantico per topic — repo rilevanti, path, prossimo passo suggerito:
8282

8383
## Utilizzo
8484

85+
### Profili operativi
86+
87+
Il workflow è stato verificato in due modalità distinte:
88+
89+
- **Claude = shared mode**: usa `agent-context-mcp` e legge gli artifact pubblicati sul branch `context`
90+
- **Codex = local mode**: esegue il builder in locale con `--workspace-root` e legge gli artifact appena generati
91+
92+
Per Claude, la configurazione MCP consigliata è quella del server `agent-context-mcp`.
93+
94+
Per Codex, il comando quotidiano consigliato su Windows è:
95+
96+
```powershell
97+
.\codex-context.ps1 -WorkspaceRoot "C:\path\to\dataciviclab-workspace"
98+
```
99+
100+
Lo script:
101+
102+
- imposta `PYTHONIOENCODING=utf-8`
103+
- neutralizza `CURL_CA_BUNDLE` se ereditato dall'ambiente
104+
- richiede un `WorkspaceRoot` esplicito
105+
- prova a usare `.venv314`, poi `.venv`, se presenti nella repo
106+
- esegue `agent-context build`
107+
- scrive gli artifact in `generated-local/`
108+
109+
I file da leggere in ordine sono:
110+
111+
1. `generated-local/session_bootstrap.md`
112+
2. `generated-local/workspace_triage.json`
113+
3. `generated-local/topic_index.json`
114+
85115
### Solo GitHub (senza checkout locale)
86116

87117
```bash

codex-context.ps1

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<#
2+
.SYNOPSIS
3+
Build locale del contesto per Codex su Windows.
4+
5+
.DESCRIPTION
6+
Wrapper operativo per `agent-context build` in local mode.
7+
Richiede un workspace root esplicito e prova a usare prima `.venv314`,
8+
poi `.venv`, se presenti nella repo.
9+
#>
10+
11+
param(
12+
[Parameter(Mandatory = $true)]
13+
[string]$WorkspaceRoot,
14+
[string]$OutDir = "generated-local",
15+
[string]$ConfigPath = "dataciviclab.config.yml",
16+
[string]$VenvName = ""
17+
)
18+
19+
$ErrorActionPreference = "Stop"
20+
21+
$repoRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
22+
$resolvedOutDir = Join-Path $repoRoot $OutDir
23+
$resolvedConfig = Join-Path $repoRoot $ConfigPath
24+
25+
$candidateVenvs = @()
26+
if ($VenvName) {
27+
$candidateVenvs += $VenvName
28+
}
29+
$candidateVenvs += @(".venv314", ".venv")
30+
31+
$python = $null
32+
$agentContext = $null
33+
$resolvedVenv = $null
34+
foreach ($candidate in $candidateVenvs | Select-Object -Unique) {
35+
$candidatePython = Join-Path $repoRoot "$candidate\Scripts\python.exe"
36+
$candidateCli = Join-Path $repoRoot "$candidate\Scripts\agent-context.exe"
37+
if ((Test-Path $candidatePython) -and (Test-Path $candidateCli)) {
38+
$python = $candidatePython
39+
$agentContext = $candidateCli
40+
$resolvedVenv = $candidate
41+
break
42+
}
43+
}
44+
45+
if (-not (Test-Path $WorkspaceRoot)) {
46+
throw "Workspace root non trovato: $WorkspaceRoot"
47+
}
48+
49+
if (-not (Test-Path $python)) {
50+
throw "Nessun venv compatibile trovato. Attesi: .venv314 o .venv, oppure passa -VenvName."
51+
}
52+
53+
if (-not (Test-Path $resolvedConfig)) {
54+
throw "Config non trovata: $resolvedConfig"
55+
}
56+
57+
$env:PYTHONIOENCODING = "utf-8"
58+
$env:PYTHONUTF8 = "1"
59+
$env:CURL_CA_BUNDLE = ""
60+
61+
Write-Host "Building agent context for Codex..." -ForegroundColor Cyan
62+
Write-Host " repo: $repoRoot"
63+
Write-Host " venv: $resolvedVenv"
64+
Write-Host " workspace: $WorkspaceRoot"
65+
Write-Host " out: $resolvedOutDir"
66+
67+
& $agentContext build `
68+
--config $resolvedConfig `
69+
--out $resolvedOutDir `
70+
--workspace-root $WorkspaceRoot
71+
72+
if ($LASTEXITCODE -ne 0) {
73+
throw "agent-context build fallito con exit code $LASTEXITCODE"
74+
}
75+
76+
Write-Host ""
77+
Write-Host "Artifacts pronti:" -ForegroundColor Green
78+
Write-Host " $resolvedOutDir\session_bootstrap.md"
79+
Write-Host " $resolvedOutDir\workspace_triage.json"
80+
Write-Host " $resolvedOutDir\topic_index.json"

0 commit comments

Comments
 (0)