specrails-core 2.0.0 → 2.1.0
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/package.json +1 -1
- package/templates/commands/test.md +58 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "specrails-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "AI agent workflow system for Claude Code — installs 12 specialized agents, orchestration commands, and persona-driven product discovery into any repository",
|
|
5
5
|
"bin": {
|
|
6
6
|
"specrails-core": "bin/specrails-core.js"
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Test Writer"
|
|
3
|
+
description: "Generate comprehensive tests for files using sr-test-writer. Pass file paths or leave empty to test all recently changed files."
|
|
4
|
+
phases:
|
|
5
|
+
- key: detect
|
|
6
|
+
label: Detect
|
|
7
|
+
description: "Detects test framework and reads existing test patterns"
|
|
8
|
+
- key: write
|
|
9
|
+
label: Write Tests
|
|
10
|
+
description: "Generates test files targeting >80% coverage"
|
|
11
|
+
- key: report
|
|
12
|
+
label: Report
|
|
13
|
+
description: "Outputs test writer results summary"
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Test Writer
|
|
17
|
+
|
|
18
|
+
Invoke the `sr-test-writer` agent to generate comprehensive tests for recently changed or explicitly specified files.
|
|
19
|
+
|
|
20
|
+
**Input:** `$ARGUMENTS` — two modes:
|
|
21
|
+
- **Explicit paths** (comma or space separated): `src/module.ts src/utils.ts` — write tests for these specific files only.
|
|
22
|
+
- **Empty** (no arguments): defaults to `git diff --name-only HEAD` to discover all files changed since the last commit.
|
|
23
|
+
|
|
24
|
+
## Step 1: Resolve Files to Test
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
if [ -z "$ARGUMENTS" ]; then
|
|
28
|
+
RESOLVED_FILES="$(git diff --name-only HEAD)"
|
|
29
|
+
if [ -z "$RESOLVED_FILES" ]; then
|
|
30
|
+
echo "No changed files found. Pass explicit file paths or make changes before running /sr:test."
|
|
31
|
+
exit 0
|
|
32
|
+
fi
|
|
33
|
+
else
|
|
34
|
+
# Split $ARGUMENTS on commas and spaces into a newline-separated list
|
|
35
|
+
RESOLVED_FILES="$(echo "$ARGUMENTS" | tr ',' '\n' | tr ' ' '\n' | sed '/^$/d')"
|
|
36
|
+
fi
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The resolved file list (`RESOLVED_FILES`) is passed to `sr-test-writer` as `IMPLEMENTED_FILES_LIST`.
|
|
40
|
+
|
|
41
|
+
## Step 2: Invoke sr-test-writer
|
|
42
|
+
|
|
43
|
+
Launch the `sr-test-writer` agent with the following inputs:
|
|
44
|
+
|
|
45
|
+
- `IMPLEMENTED_FILES_LIST:` the resolved file list from Step 1 (one file per line)
|
|
46
|
+
- `TASK_DESCRIPTION:` "Standalone test generation run via /sr:test"
|
|
47
|
+
|
|
48
|
+
Run the agent in the foreground (`run_in_background: false`) and wait for completion before proceeding to Step 3.
|
|
49
|
+
|
|
50
|
+
## Step 3: Forward Results
|
|
51
|
+
|
|
52
|
+
Output the full `## Test Writer Results` block from the agent response directly to the user, including the `TEST_WRITER_STATUS:` line.
|
|
53
|
+
|
|
54
|
+
## Edge Cases
|
|
55
|
+
|
|
56
|
+
- **No files found** (empty git diff, no arguments): print a message explaining that no changed files were detected, suggest passing explicit paths, and stop without invoking the agent.
|
|
57
|
+
- **All files skipped**: the `sr-test-writer` agent will output `TEST_WRITER_STATUS: SKIPPED` — forward this result as-is.
|
|
58
|
+
- **Test framework not detected**: the agent outputs `TEST_WRITER_STATUS: SKIPPED` with reason "no test framework detected" — forward this result and suggest the user ensure a `package.json`, `pyproject.toml`, `go.mod`, or equivalent manifest exists at the project root.
|