sdtk-spec-kit 0.8.1 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -12
- package/assets/manifest/toolkit-bundle.manifest.json +4 -4
- package/assets/manifest/toolkit-bundle.sha256.txt +1 -1
- package/assets/toolkit/toolkit/scripts/agents/run-codex-task.ps1 +88 -40
- package/package.json +1 -1
- package/src/commands/atlas.js +55 -344
- package/src/commands/help.js +12 -35
- package/src/lib/atlas-delegate.js +109 -0
- package/assets/atlas/build_atlas.py +0 -880
- package/assets/atlas/doc_atlas_viewer_template.html +0 -3796
- package/assets/atlas/vendor/mermaid.min.js +0 -2029
- package/src/lib/atlas-config.js +0 -200
- package/src/lib/atlas-runner.js +0 -435
- package/src/lib/browser-open.js +0 -39
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
It exposes the `sdtk-spec` CLI as the primary upstream command surface.
|
|
6
6
|
|
|
7
|
-
Package version in this source snapshot: `0.
|
|
7
|
+
Package version in this source snapshot: `0.9.1`
|
|
8
8
|
Full usage guide: `products/sdtk-spec/governance/SDTK_SPEC_USAGE_GUIDE.md`
|
|
9
9
|
|
|
10
10
|
Wraps the `SDTK-SPEC` PowerShell toolkit for portable, reproducible feature documentation scaffolding.
|
|
@@ -201,9 +201,9 @@ sdtk-spec analyze --source <requirements.md> --feature-key <UPPER_SNAKE_CASE> --
|
|
|
201
201
|
Build and browse a local document graph for your project.
|
|
202
202
|
|
|
203
203
|
Atlas is a free local compatibility feature in `sdtk-spec-kit`. No
|
|
204
|
-
authentication or entitlement is required.
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
authentication or entitlement is required. `sdtk-wiki` owns the graph builder
|
|
205
|
+
and the canonical `.sdtk/wiki` storage; `sdtk-spec atlas` remains the R1
|
|
206
|
+
compatibility namespace and forwards every subcommand to it.
|
|
207
207
|
|
|
208
208
|
#### Subcommands
|
|
209
209
|
|
|
@@ -222,7 +222,7 @@ cd <project>
|
|
|
222
222
|
sdtk-spec atlas init
|
|
223
223
|
```
|
|
224
224
|
|
|
225
|
-
This creates `.sdtk/
|
|
225
|
+
This delegates to `sdtk-wiki init`: it creates the graph workspace under `.sdtk/wiki`, scans local markdown, builds the document graph and static viewer, and opens the viewer in your browser by default.
|
|
226
226
|
|
|
227
227
|
#### Common flows
|
|
228
228
|
|
|
@@ -252,10 +252,11 @@ sdtk-spec atlas init [--project-path <path>] [--output-dir <path>] [--scan-root
|
|
|
252
252
|
|
|
253
253
|
#### Key facts
|
|
254
254
|
|
|
255
|
-
-
|
|
256
|
-
-
|
|
255
|
+
- `sdtk-spec atlas` is the R1 compatibility namespace. Every subcommand delegates to `sdtk-wiki`, which owns the graph builder; flags are forwarded verbatim.
|
|
256
|
+
- Requires `sdtk-wiki-kit`, which the SDTK suite installer brings in alongside this package. Without it, `atlas` exits 2 and prints the install steps.
|
|
257
|
+
- The builder is pure Node. No interpreter or extra runtime is required.
|
|
258
|
+
- Generated artifacts are written to `<project>/.sdtk/wiki/graph/` (project-local, not global). A legacy `<project>/.sdtk/atlas/` from an older release is left alone, never auto-deleted.
|
|
257
259
|
- The viewer server binds to `127.0.0.1` by default (loopback only).
|
|
258
|
-
- Python 3.8+ must be available in `PATH` for `atlas init`, `build`, and `watch`.
|
|
259
260
|
- Free Atlas scans local markdown files only and does not upload document content to external services.
|
|
260
261
|
- `sdtk-spec auth` and `sdtk-spec entitlement` are separate capability-management surfaces; they are not required for free Atlas commands.
|
|
261
262
|
- The old SPEC ask command path is not supported. Native Ask is owned by `sdtk-wiki ask` and capability `wiki.ask`.
|
|
@@ -362,7 +363,7 @@ sdtk-spec --version
|
|
|
362
363
|
|
|
363
364
|
- Node.js >= 18.13.0
|
|
364
365
|
- PowerShell (Windows PowerShell 5.1+ or PowerShell Core)
|
|
365
|
-
-
|
|
366
|
+
- `sdtk-wiki-kit` for the `atlas` commands
|
|
366
367
|
|
|
367
368
|
## Troubleshooting
|
|
368
369
|
|
|
@@ -386,9 +387,9 @@ sdtk-spec --version
|
|
|
386
387
|
**Payload hash mismatch**
|
|
387
388
|
- The bundled toolkit payload may be corrupted. Reinstall the package.
|
|
388
389
|
|
|
389
|
-
**Atlas
|
|
390
|
-
-
|
|
391
|
-
-
|
|
390
|
+
**Atlas exits 2 with "sdtk-wiki is not installed"**
|
|
391
|
+
- `sdtk-spec atlas` delegates to `sdtk-wiki`. Install it with `npm install -g sdtk-wiki-kit`.
|
|
392
|
+
- Then rerun `sdtk-spec atlas build`, or call `sdtk-wiki atlas build` directly.
|
|
392
393
|
|
|
393
394
|
## Development
|
|
394
395
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
3
|
-
"sourceCommit": "
|
|
2
|
+
"version": "0.9.1",
|
|
3
|
+
"sourceCommit": "7d819293a4fe710f43582c6d7b49757713e4d76c",
|
|
4
4
|
"fileCount": 100,
|
|
5
5
|
"files": [
|
|
6
6
|
{
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
"path": "toolkit/scripts/agents/run-codex-task.ps1",
|
|
38
|
-
"sha256": "
|
|
39
|
-
"size":
|
|
38
|
+
"sha256": "e84d86e8bd72a10875b403542c725d2c7a2e536920e501c6389ab0de9270b865",
|
|
39
|
+
"size": 32595
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
"path": "toolkit/scripts/agents/validate-mailbox-formal-artifact.py",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
301a604b2daa39f85a7b9cbf4b634df5dafd16f84622ad188bc214b34da226d7 toolkit/runtimes/claude/CLAUDE_TEMPLATE.md
|
|
5
5
|
6f1fd656e95906a054299312d44e63a28d948c634b6534089db3eeca9936bf70 toolkit/runtimes/codex/CODEX_TEMPLATE.md
|
|
6
6
|
8616291be4aaa4fb5cb0f1f4c738c108ab79090bf767ee2b4403d6d582c150c7 toolkit/scripts/agents/run-claude-task.ps1
|
|
7
|
-
|
|
7
|
+
e84d86e8bd72a10875b403542c725d2c7a2e536920e501c6389ab0de9270b865 toolkit/scripts/agents/run-codex-task.ps1
|
|
8
8
|
6bcebe5fdb87451a7260101eaed32c6b61a2cf07832be754790f5432e028a503 toolkit/scripts/agents/validate-mailbox-formal-artifact.py
|
|
9
9
|
b9bdb2489c2881d03e965c7dd849468f797e2070d30e6730ab9ddf37b54b7879 toolkit/scripts/generate-code-handoff.ps1
|
|
10
10
|
2b456e0e9ebeb948db9bdd1a905195285a8ae44839b09b5f0bbefac597cfd67a toolkit/scripts/init-feature.ps1
|
|
@@ -5,6 +5,7 @@ param(
|
|
|
5
5
|
[string] $LogFile = '',
|
|
6
6
|
[string] $Model = '',
|
|
7
7
|
[switch] $FullAuto,
|
|
8
|
+
[switch] $ExternallySandboxed,
|
|
8
9
|
[switch] $DryRun
|
|
9
10
|
)
|
|
10
11
|
|
|
@@ -294,18 +295,61 @@ function New-GitTruthBlock([string] $RepoRootPath) {
|
|
|
294
295
|
"@.TrimEnd()
|
|
295
296
|
}
|
|
296
297
|
|
|
298
|
+
# $IsWindows is an automatic variable on PowerShell 7 (Core); on Windows
|
|
299
|
+
# PowerShell 5.1 it does not exist, so a null falls back to Windows behavior.
|
|
300
|
+
$script:IsWindowsHost = if ($null -ne $IsWindows) { [bool] $IsWindows } else { $true }
|
|
301
|
+
|
|
302
|
+
# `/.dockerenv`, an explicit env flag, or the -ExternallySandboxed switch mark a
|
|
303
|
+
# container/externally-sandboxed host. Codex's workspace-write sandbox needs
|
|
304
|
+
# unprivileged user namespaces that such hosts usually disable, so we swap
|
|
305
|
+
# --full-auto for --dangerously-bypass-approvals-and-sandbox there. Read-only
|
|
306
|
+
# sandbox does not create namespaces and keeps working, so it is left alone.
|
|
307
|
+
function Test-ExternallySandboxedHost([bool] $SwitchRequested) {
|
|
308
|
+
if ($SwitchRequested) { return $true }
|
|
309
|
+
if ($env:SDTK_EXTERNALLY_SANDBOXED -eq '1') { return $true }
|
|
310
|
+
if (Test-Path '/.dockerenv') { return $true }
|
|
311
|
+
return $false
|
|
312
|
+
}
|
|
313
|
+
|
|
297
314
|
function Stop-ProcessTree([int] $ProcessId) {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
315
|
+
if ($script:IsWindowsHost) {
|
|
316
|
+
$children = @(Get-CimInstance Win32_Process -Filter "ParentProcessId=$ProcessId" -ErrorAction SilentlyContinue)
|
|
317
|
+
foreach ($child in $children) {
|
|
318
|
+
Stop-ProcessTree -ProcessId $child.ProcessId
|
|
319
|
+
}
|
|
320
|
+
Stop-Process -Id $ProcessId -Force -ErrorAction SilentlyContinue
|
|
321
|
+
return
|
|
322
|
+
}
|
|
323
|
+
# POSIX: enumerate children via `ps --ppid`, recurse, then SIGKILL.
|
|
324
|
+
$childOutput = ''
|
|
325
|
+
try { $childOutput = (& ps -o pid= --ppid $ProcessId 2>$null | Out-String) } catch { $childOutput = '' }
|
|
326
|
+
foreach ($line in ($childOutput -split "`n")) {
|
|
327
|
+
$pidText = $line.Trim()
|
|
328
|
+
if ($pidText -match '^\d+$') { Stop-ProcessTree -ProcessId ([int] $pidText) }
|
|
301
329
|
}
|
|
302
|
-
|
|
330
|
+
try { & kill -9 $ProcessId 2>$null } catch { }
|
|
303
331
|
}
|
|
304
332
|
|
|
305
333
|
function Convert-ToCmdQuoted([string] $Value) {
|
|
306
334
|
return '"' + ($Value -replace '"', '""') + '"'
|
|
307
335
|
}
|
|
308
336
|
|
|
337
|
+
# POSIX single-quote escaping: wrap in '...', and render embedded single quotes
|
|
338
|
+
# as the classic '\'' sequence so the shell sees the literal value.
|
|
339
|
+
function Convert-ToShQuoted([string] $Value) {
|
|
340
|
+
return "'" + ($Value -replace "'", "'\''") + "'"
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
# Build the codex sandbox flag(s) for a run. Writable runs use --full-auto,
|
|
344
|
+
# except on an externally-sandboxed host where that sandbox cannot create
|
|
345
|
+
# namespaces — there we bypass Codex's own sandbox (the container is the
|
|
346
|
+
# boundary). Read-only runs always use the read-only sandbox.
|
|
347
|
+
function Get-CodexSandboxArgs([bool] $UseWorkspaceWrite, [bool] $ExternallySandboxed) {
|
|
348
|
+
if (-not $UseWorkspaceWrite) { return @('--sandbox', 'read-only') }
|
|
349
|
+
if ($ExternallySandboxed) { return @('--dangerously-bypass-approvals-and-sandbox') }
|
|
350
|
+
return @('--full-auto')
|
|
351
|
+
}
|
|
352
|
+
|
|
309
353
|
function Invoke-CodexProcessWithWatchdog(
|
|
310
354
|
[string] $RepoRootPath,
|
|
311
355
|
[string] $PromptPath,
|
|
@@ -313,41 +357,46 @@ function Invoke-CodexProcessWithWatchdog(
|
|
|
313
357
|
[string] $LogPath,
|
|
314
358
|
[string] $ModelName,
|
|
315
359
|
[bool] $UseWorkspaceWrite,
|
|
360
|
+
[bool] $ExternallySandboxed,
|
|
316
361
|
[int] $WatchdogSeconds
|
|
317
362
|
) {
|
|
318
|
-
|
|
319
|
-
$
|
|
320
|
-
'codex',
|
|
321
|
-
'
|
|
322
|
-
'-c',
|
|
323
|
-
|
|
324
|
-
'-
|
|
325
|
-
(Convert-ToCmdQuoted 'model_reasoning_effort="medium"'),
|
|
326
|
-
'-C',
|
|
327
|
-
(Convert-ToCmdQuoted $RepoRootPath),
|
|
328
|
-
'--output-last-message',
|
|
329
|
-
(Convert-ToCmdQuoted $ReportPath)
|
|
363
|
+
# Raw (unquoted) argument vector; each element is quoted per-platform below.
|
|
364
|
+
$codexArgs = @(
|
|
365
|
+
'codex', 'exec',
|
|
366
|
+
'-c', 'mcp_servers={}',
|
|
367
|
+
'-c', 'model_reasoning_effort="medium"',
|
|
368
|
+
'-C', $RepoRootPath,
|
|
369
|
+
'--output-last-message', $ReportPath
|
|
330
370
|
)
|
|
331
|
-
|
|
332
|
-
|
|
371
|
+
$codexArgs += (Get-CodexSandboxArgs $UseWorkspaceWrite $ExternallySandboxed)
|
|
372
|
+
if ($ModelName) { $codexArgs += @('--model', $ModelName) }
|
|
373
|
+
$codexArgs += '-'
|
|
374
|
+
|
|
375
|
+
$runnerScriptPath = $null
|
|
376
|
+
if ($script:IsWindowsHost) {
|
|
377
|
+
$quoted = $codexArgs | ForEach-Object { Convert-ToCmdQuoted $_ }
|
|
378
|
+
$commandLine = ($quoted -join ' ') + ' < ' + (Convert-ToCmdQuoted $PromptPath)
|
|
379
|
+
if ($LogPath) { $commandLine += ' > ' + (Convert-ToCmdQuoted $LogPath) + ' 2>&1' }
|
|
380
|
+
$runnerScriptPath = Join-Path ([System.IO.Path]::GetTempPath()) ("sdtk-mailbox-codex-" + [guid]::NewGuid().ToString('N') + '.cmd')
|
|
381
|
+
$embedded = "@echo off`r`nsetlocal`r`n$commandLine`r`nexit /b %ERRORLEVEL%`r`n"
|
|
382
|
+
[System.IO.File]::WriteAllText($runnerScriptPath, $embedded, $Utf8NoBom)
|
|
383
|
+
$process = Start-Process -FilePath 'cmd.exe' -ArgumentList @('/d', '/c', $runnerScriptPath) -WorkingDirectory $RepoRootPath -PassThru -WindowStyle Hidden
|
|
333
384
|
} else {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
$
|
|
385
|
+
# POSIX: write the composed command line to a temp shell script and run it
|
|
386
|
+
# via /bin/sh. Passing the redirect-laden command line straight through
|
|
387
|
+
# Start-Process -ArgumentList mangles the `<`/`>` metacharacters (the child
|
|
388
|
+
# then loses its stdin redirect and Codex aborts with "stdin is not a
|
|
389
|
+
# terminal"); a script file sidesteps all argument re-quoting. No cmd.exe
|
|
390
|
+
# and no -WindowStyle (unsupported on the PowerShell Linux edition).
|
|
391
|
+
$quoted = $codexArgs | ForEach-Object { Convert-ToShQuoted $_ }
|
|
392
|
+
$commandLine = ($quoted -join ' ') + ' < ' + (Convert-ToShQuoted $PromptPath)
|
|
393
|
+
if ($LogPath) { $commandLine += ' > ' + (Convert-ToShQuoted $LogPath) + ' 2>&1' }
|
|
394
|
+
$runnerScriptPath = Join-Path ([System.IO.Path]::GetTempPath()) ("sdtk-mailbox-codex-" + [guid]::NewGuid().ToString('N') + '.sh')
|
|
395
|
+
$embedded = "#!/bin/sh`n" + $commandLine + "`n"
|
|
396
|
+
[System.IO.File]::WriteAllText($runnerScriptPath, $embedded, $Utf8NoBom)
|
|
397
|
+
$process = Start-Process -FilePath '/bin/sh' -ArgumentList @($runnerScriptPath) -WorkingDirectory $RepoRootPath -PassThru
|
|
344
398
|
}
|
|
345
399
|
|
|
346
|
-
$embedded = "@echo off`r`nsetlocal`r`n$commandLine`r`nexit /b %ERRORLEVEL%`r`n"
|
|
347
|
-
[System.IO.File]::WriteAllText($runnerScriptPath, $embedded, $Utf8NoBom)
|
|
348
|
-
|
|
349
|
-
$process = Start-Process -FilePath 'cmd.exe' -ArgumentList @('/d', '/c', $runnerScriptPath) -WorkingDirectory $RepoRootPath -PassThru -WindowStyle Hidden
|
|
350
|
-
|
|
351
400
|
$timedOut = $false
|
|
352
401
|
try {
|
|
353
402
|
if ($WatchdogSeconds -gt 0) {
|
|
@@ -364,7 +413,7 @@ function Invoke-CodexProcessWithWatchdog(
|
|
|
364
413
|
ExitCode = if ($timedOut) { -1 } else { $process.ExitCode }
|
|
365
414
|
}
|
|
366
415
|
} finally {
|
|
367
|
-
Remove-Item $runnerScriptPath -Force -ErrorAction SilentlyContinue
|
|
416
|
+
if ($runnerScriptPath) { Remove-Item $runnerScriptPath -Force -ErrorAction SilentlyContinue }
|
|
368
417
|
}
|
|
369
418
|
}
|
|
370
419
|
|
|
@@ -526,11 +575,8 @@ $watchdogSeconds = Get-StallBudgetSeconds -Phase $phase -RawValue $stallBudgetVa
|
|
|
526
575
|
$stallBudgetSource = Get-StallBudgetSource -RawValue $stallBudgetValue -Seconds $watchdogSeconds
|
|
527
576
|
$permissionAuditBlock = New-PermissionAuditBlock -DeclaredPermission $permissionMode -EffectiveMode $effectiveMode -ApprovalStatus $approvalStatus -ApprovedBy $approvedBy -ApprovalReason $approvalReason -ApprovedScope $approvedScope -ApprovalReference $approvalReference -DecisionSummary $decisionSummary
|
|
528
577
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
} else {
|
|
532
|
-
$cliArgs += @('--sandbox', 'read-only')
|
|
533
|
-
}
|
|
578
|
+
$isExternallySandboxed = [bool] (Test-ExternallySandboxedHost ([bool] $ExternallySandboxed))
|
|
579
|
+
$cliArgs += (Get-CodexSandboxArgs $useWorkspaceWrite $isExternallySandboxed)
|
|
534
580
|
if ($Model) { $cliArgs += @('--model', $Model) }
|
|
535
581
|
$cliArgs += '-'
|
|
536
582
|
|
|
@@ -550,6 +596,8 @@ if ($DryRun) {
|
|
|
550
596
|
ApprovedWritableScope = $approvedScope
|
|
551
597
|
ApprovalReference = $approvalReference
|
|
552
598
|
LauncherDecisionSummary = $decisionSummary
|
|
599
|
+
ExternallySandboxed = $isExternallySandboxed
|
|
600
|
+
HostIsWindows = $script:IsWindowsHost
|
|
553
601
|
RuntimeStallBudget = $stallBudgetValue
|
|
554
602
|
EffectiveWatchdogSeconds = $watchdogSeconds
|
|
555
603
|
PromptLength = $prompt.Length
|
|
@@ -561,7 +609,7 @@ if ($DryRun) {
|
|
|
561
609
|
$promptPath = Join-Path ([System.IO.Path]::GetTempPath()) ("sdtk-mailbox-prompt-" + [guid]::NewGuid().ToString('N') + '.md')
|
|
562
610
|
[System.IO.File]::WriteAllText($promptPath, $prompt, $Utf8NoBom)
|
|
563
611
|
try {
|
|
564
|
-
$processResult = Invoke-CodexProcessWithWatchdog -RepoRootPath $RepoRoot -PromptPath $promptPath -ReportPath $ReportFile -LogPath $LogFile -ModelName $Model -UseWorkspaceWrite:$useWorkspaceWrite -WatchdogSeconds $watchdogSeconds
|
|
612
|
+
$processResult = Invoke-CodexProcessWithWatchdog -RepoRootPath $RepoRoot -PromptPath $promptPath -ReportPath $ReportFile -LogPath $LogFile -ModelName $Model -UseWorkspaceWrite:$useWorkspaceWrite -ExternallySandboxed:$isExternallySandboxed -WatchdogSeconds $watchdogSeconds
|
|
565
613
|
$reportStateBeforeCloseout = Get-ReportState $ReportFile
|
|
566
614
|
$runtimeExitCode = if ($processResult.TimedOut) { 'timed-out' } else { [string]$processResult.ExitCode }
|
|
567
615
|
$needsPartialFailureCloseout = $processResult.TimedOut -or $processResult.ExitCode -ne 0 -or $reportStateBeforeCloseout -ne 'present'
|