@sreetej510/pi-shipd-checks 0.2.1 → 0.3.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 CHANGED
@@ -33,7 +33,11 @@ For the flags you pass, `/checks`:
33
33
  `trajectory.json` (its raw session entries), `solution.patch`, and `./test.sh new` output
34
34
  are also persisted to `.pi/shipd-checks/<run-id>/solver_<n>/` in your project root, for
35
35
  later inspection independent of `shipd_report.json`.
36
- 5. Posts a chat summary and merges the gap-finder results into `shipd_report.json` in your
36
+ 5. Runs the solver workers in one AWS ECS Fargate Spot task (when the solver finder is enabled),
37
+ with the source snapshot and partial results in S3. A Spot interruption retries the task and
38
+ resumes solver indexes whose results were already uploaded; the final comparison still runs
39
+ locally.
40
+ 6. Posts a chat summary and merges the gap-finder results into `shipd_report.json` in your
37
41
  project root. Running either finder separately builds up one combined report without any
38
42
  PASS/FAIL verdict.
39
43
 
@@ -43,10 +47,10 @@ The two finder flags are additive/combinable; `--config` must be used alone.
43
47
 
44
48
  | Command | Effect |
45
49
  |---|---|
46
- | `/checks` | List available options (runs nothing) |
47
- | `/checks --gap-finder` | Find gaps sentence-by-sentence, then review them for fairness |
48
- | `/checks --solver-gap-finder` | Run several solver agents TDD-style against `agent_prompt.md` + `test.patch`, then compare their solutions to the real solution to find gaps |
50
+ | `/checks` | Open a menu with config, solver-gap-finder, and gap-finder options |
49
51
  | `/checks --config` | Configure behavioral and solver gap-finder models |
52
+ | `/checks --solver-gap-finder` | Run several solver agents TDD-style against `agent_prompt.md` + `test.patch`, then compare their solutions to the real solution to find gaps |
53
+ | `/checks --gap-finder` | Find gaps sentence-by-sentence, then review them for fairness |
50
54
  | `/analyze:on` | Enable the agent-callable Gap Finder tool for the current project |
51
55
  | `/analyze:off` | Disable the agent-callable Gap Finder tool for the current project |
52
56
 
@@ -54,13 +58,87 @@ The two finder flags are additive/combinable; `--config` must be used alone.
54
58
 
55
59
  ## Configuration
56
60
 
57
- `/checks --config` opens the row-based settings menu with three sections:
61
+ `/checks --config` opens the row-based settings menu with four sections:
58
62
 
59
63
  - **Reviewer**: model and thinking level used by the behavioral gap finders, validator, and
60
64
  solver-solution comparison agent.
61
65
  - **Solver**: model and thinking level for TDD solver agents, plus their timeout, parallel solver
62
66
  count, and artifact-saving setting.
63
67
  - **Analyze Tool**: pick the model + thinking level for the agent-callable Gap Finder tool.
68
+ - **Fargate**: choose the shared-task resource profile for the current project: `small` (1 vCPU,
69
+ 2 GB), `medium` (2 vCPU, 4 GB), or `large` (4 vCPU, 8 GB).
70
+
71
+ AWS credentials stay local. Configure the AWS CLI profile, then set `AWS_PROFILE`/`AWS_REGION` (or add
72
+ `fargate.awsProfile`/`fargate.region` to `checks-config.json`). The runner discovers the default
73
+ VPC, public subnets, security group, ECS cluster, and an account-scoped private S3 bucket unless
74
+ explicit IDs are configured. It uses the `FARGATE_SPOT` capacity provider only; there is no
75
+ On-Demand fallback. Spot interruptions are retried according to `fargate.maxRetries`.
76
+
77
+ ### Fargate setup
78
+
79
+ 1. Create a dedicated, least-privilege IAM user in the AWS Console (do not use root), create an
80
+ access key under **Security credentials**, and save it locally in
81
+ `%USERPROFILE%\\.aws\\credentials`—no AWS CLI is required:
82
+
83
+ ```ini
84
+ [shipd-static]
85
+ aws_access_key_id = YOUR_ACCESS_KEY_ID
86
+ aws_secret_access_key = YOUR_SECRET_ACCESS_KEY
87
+ ```
88
+
89
+ Use `"awsProfile": "shipd-static"` in the checks config. The AWS SDK reads this file directly.
90
+ Keep it outside the repository, rotate the key periodically, and never paste it into chat or
91
+ commit it. The IAM user needs the runtime ECS, S3, EC2-discovery, STS, and `iam:PassRole`
92
+ permissions for the configured task/execution roles.
93
+
94
+ Alternatively, AWS CLI browser login/SSO profiles work and are automatically refreshed by the
95
+ SDK; CLI setup is optional.
96
+
97
+ 2. Create an ECS task role with this trust policy (`ecs-tasks.amazonaws.com`) and an inline S3
98
+ policy. Use an explicit bucket name so the policy stays narrow:
99
+
100
+ ```json
101
+ {
102
+ "Version": "2012-10-17",
103
+ "Statement": [{
104
+ "Effect": "Allow",
105
+ "Action": ["s3:GetObject", "s3:PutObject"],
106
+ "Resource": "arn:aws:s3:::BUCKET_NAME/runs/*"
107
+ }]
108
+ }
109
+ ```
110
+
111
+ The task role is required for long-running jobs because temporary presigned URLs can expire
112
+ while dependencies or agents are running.
113
+
114
+ 3. Create an ECS execution role trusted by `ecs-tasks.amazonaws.com`, attach the AWS-managed
115
+ `service-role/AmazonECSTaskExecutionRolePolicy`, and create the CloudWatch log group. The
116
+ execution role is used for `awslogs` and image startup; the task role is used for S3 data.
117
+
118
+ 4. Add the role ARNs and bucket to `~/.pi/agent/checks-config.json`:
119
+
120
+ ```json
121
+ {
122
+ "fargate": {
123
+ "awsProfile": "shipd-fargate",
124
+ "region": "us-east-1",
125
+ "bucket": "BUCKET_NAME",
126
+ "taskRoleArn": "arn:aws:iam::ACCOUNT_ID:role/pi-shipd-checks-task",
127
+ "executionRoleArn": "arn:aws:iam::ACCOUNT_ID:role/pi-shipd-checks-execution",
128
+ "logGroup": "/aws/ecs/pi-shipd-checks",
129
+ "resourceProfile": "medium",
130
+ "maxRetries": 1
131
+ }
132
+ }
133
+ ```
134
+
135
+ `cluster`, `subnetIds`, and `securityGroupId` are optional when a default VPC is available.
136
+ Set `projectProfiles` to override resources per repository:
137
+ `{"C:/path/to/repo":"large"}`.
138
+
139
+ 5. Restart pi, use `/checks --config` to select the solver model and project resource profile,
140
+ then run `/checks --solver-gap-finder`. Projects need `Dockerfile`, `agent_prompt.md`,
141
+ `solution.patch`, `test.patch`, and `test.sh`.
64
142
 
65
143
  Use `/analyze:on` and `/analyze:off` to control the tool per project, like HPC. The enabled project
66
144
  list is stored alongside the other settings in `~/.pi/agent/checks-config.json`:
@@ -104,7 +182,10 @@ Or, for local development, point at the entry point directly:
104
182
  | `src/index.ts` | Extension entry point: message renderer, cancel shortcut, command registration |
105
183
  | `src/command.ts` | The `/checks` command: argument parsing, `--config` flow, run orchestration |
106
184
  | `src/agents.ts` | Spawns and races the gap-finder/reviewer/solver agent sessions |
107
- | `src/solvergap.ts` | Solver-gap-finder workspace lifecycle: setup, verification, artifact persistence, cleanup |
185
+ | `src/solvergap.ts` | Local solver result persistence and comparison artifacts |
186
+ | `src/fargate-docker.ts` | Supported Dockerfile parsing for remote solver setup |
187
+ | `src/fargate-runner.ts` | ECS Fargate Spot/S3 orchestration, retries, and cleanup |
188
+ | `src/fargate-worker.ts` | ESM worker that runs concurrent solver workspaces in the shared task |
108
189
  | `src/prompts.ts` | All prompt text sent to those agents |
109
190
  | `src/tools.ts` | Custom tools the agents call to submit their structured results |
110
191
  | `src/rubric.ts` | Embedded guidelines/fairness rubric text + per-role section loaders |