Skip to content
Back to skills

198 Fn 95 3f41cb2c

ASecurity

Create run discovery library to find and manage Ralph runs.

  • 9 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 31, 2026
testingtypescript

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned May 31, 2026

npx -y skills add tools-only/X-Skills --skill 198-fn-95_3f41cb2c --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 198 Fn 95 3f41cb2c?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 198 Fn 95 3f41cb2c
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-198-fn-95-3f41cb2c/badge)](https://www.skillsdirectory.com/skills/tools-only-198-fn-95-3f41cb2c)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# fn-9.5 Run discovery lib

## Description

Create run discovery library to find and manage Ralph runs.

### File

`src/lib/runs.ts`

### Functions

```typescript
// Scan runs directory for all runs
async function discoverRuns(): Promise<Run[]>

// Detect if run is active (check progress.txt for COMPLETE)
async function isRunActive(runPath: string): Promise<boolean>

// Get latest run (by date-based ID)
function getLatestRun(runs: Run[]): Run | undefined

// Get run details (iteration, epic, etc)
async function getRunDetails(runPath: string): Promise<RunDetails>
```

### Run directory structure

```
scripts/ralph/runs/<run-id>/
├── progress.txt     # Check for COMPLETE marker
├── iter-*.log       # Count for iteration number
├── attempts.json
├── branches.json
└── receipts/
```

### Active detection

Parse progress.txt, look for line containing `promise=COMPLETE` or `<promise>COMPLETE</promise>`.

### Receipts access

```typescript
// Get receipt status for a task
async function getReceiptStatus(runPath: string, taskId: string): Promise<{plan?: boolean, impl?: boolean}>
```

Receipts live in `runs/<id>/receipts/`. Files: `plan-<task-id>.json`, `impl-<task-id>.json`.

### Block reason

```typescript
// Get block reason if task is blocked
async function getBlockReason(taskId: string): Promise<string | null>
```

Block reason files: `.flow/blocks/block-<task-id>.md` or `runs/<id>/block-<task-id>.md`.

### Run validation

`--run <id>` validation rules:
- Exact match required on run ID
- If not found: error "Run '<id>' not found. Available: <list>"
- If corrupt (missing progress.txt): warn but allow
## Acceptance
- [ ] `discoverRuns()` returns Run[] sorted by date (newest first)
- [ ] `isRunActive()` correctly detects COMPLETE marker
- [ ] `getLatestRun()` returns most recent run
- [ ] Handles missing runs directory gracefully
- [ ] Handles empty runs directory
- [ ] `getReceiptStatus()` returns receipt state for task
- [ ] `getBlockReason()` returns block reason or null
- [ ] Run validation returns clear error for invalid run ID
## Done summary
- Added run discovery library with discoverRuns(), isRunActive(), getLatestRun()
- Added getRunDetails() for detailed run information
- Added getReceiptStatus() and getBlockReason() for receipts/blocks
- Added validateRun() with clear error messages for invalid run IDs

Why:
- TUI needs to find and display Ralph runs
- Receipt/block status needed for task detail panel

Verification:
- 23 tests pass covering all functions
- Lint clean
## Evidence
- Commits: f2bcbc2e51ad40985f9b7f9bce17b738d9b8a087
- Tests: bun test
- PRs:

Files in this skill

  • README.md819 B
  • skill.md2.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.