arey-pi 0.2.0 → 0.4.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/README.md +19 -6
- package/agents/README.md +35 -6
- package/agents/engineering-reviewer.md +2 -1
- package/agents/tdd-implementer.md +5 -1
- package/agents/tech-lead.md +15 -7
- package/assets/arey-pi-logo.png +0 -0
- package/docs/adoption.md +218 -0
- package/docs/commands.md +81 -5
- package/docs/pi-subagents.md +292 -0
- package/docs/templates.md +146 -0
- package/docs/workflow-diagram.md +92 -0
- package/docs/workflows.md +213 -0
- package/extensions/arey-pi/core.ts +121 -0
- package/extensions/{arey-pi.ts → arey-pi/index.ts} +78 -73
- package/package.json +8 -4
- package/rules/assessment/project-readiness.md +1 -0
- package/rules/core/definition-of-done.md +3 -1
- package/rules/engineering/tdd.md +31 -1
- package/rules/engineering/test-quality.md +33 -2
- package/templates/AGENTS.md +151 -0
- package/templates/adr.md +129 -0
- package/templates/architecture-readme.md +9 -0
- package/templates/database-readme.md +10 -0
- package/templates/database.dbml +57 -0
- package/templates/decisions-readme.md +11 -0
- package/templates/docs-readme.md +9 -0
- package/templates/feature.feature +38 -0
- package/templates/features-readme.md +7 -0
- package/templates/glossary.md +19 -0
- package/templates/project-readiness-report.md +120 -0
- package/templates/specs-readme.md +6 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# Arey Pi Workflows
|
|
2
|
+
|
|
3
|
+
See `docs/workflow-diagram.md` for a visual overview of the framework workflow.
|
|
4
|
+
|
|
5
|
+
Arey Pi workflows can be started with slash commands or natural language.
|
|
6
|
+
|
|
7
|
+
The slash commands make the intended process explicit.
|
|
8
|
+
Natural language should still follow the same rules when the user asks to work following Arey Pi.
|
|
9
|
+
|
|
10
|
+
## Feature Workflow
|
|
11
|
+
|
|
12
|
+
Command:
|
|
13
|
+
|
|
14
|
+
```txt
|
|
15
|
+
/arey-feature <feature request>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Expected flow:
|
|
19
|
+
|
|
20
|
+
```txt
|
|
21
|
+
parent tech lead → arey-pi.spec-author → arey-pi.tdd-implementer → arey-pi.spec-syncer → fresh reviewers → parent finalisation
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
For broad or risky changes,
|
|
25
|
+
use builtin `scout`,
|
|
26
|
+
`context-builder`,
|
|
27
|
+
or `planner` before the Arey Pi delivery flow.
|
|
28
|
+
|
|
29
|
+
Use this for new behaviour or meaningful behaviour changes.
|
|
30
|
+
|
|
31
|
+
The workflow should:
|
|
32
|
+
|
|
33
|
+
1. clarify scope and change mode;
|
|
34
|
+
2. confirm or author canonical Gherkin specs;
|
|
35
|
+
3. add a failing test in a dedicated test directory;
|
|
36
|
+
4. implement the smallest high-quality production change;
|
|
37
|
+
5. refactor while tests remain green;
|
|
38
|
+
6. synchronise specs and documentation;
|
|
39
|
+
7. review engineering quality when risk warrants it;
|
|
40
|
+
8. report evidence and residual risks.
|
|
41
|
+
|
|
42
|
+
## Bugfix Workflow
|
|
43
|
+
|
|
44
|
+
Command:
|
|
45
|
+
|
|
46
|
+
```txt
|
|
47
|
+
/arey-bugfix <bug description>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Use this when behaviour is wrong.
|
|
51
|
+
|
|
52
|
+
Expected flow:
|
|
53
|
+
|
|
54
|
+
```txt
|
|
55
|
+
reproduce with failing regression test → fix → validate → sync → review
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Bug fixes require a regression test.
|
|
59
|
+
The regression test should fail for the bug before the fix,
|
|
60
|
+
and it should live outside production source directories by default.
|
|
61
|
+
|
|
62
|
+
## Sync Workflow
|
|
63
|
+
|
|
64
|
+
Command:
|
|
65
|
+
|
|
66
|
+
```txt
|
|
67
|
+
/arey-sync [scope]
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Use this before completing non-trivial work or when drift is suspected.
|
|
71
|
+
|
|
72
|
+
The sync check covers:
|
|
73
|
+
|
|
74
|
+
- Gherkin specs;
|
|
75
|
+
- tests;
|
|
76
|
+
- code;
|
|
77
|
+
- DBML;
|
|
78
|
+
- ADRs;
|
|
79
|
+
- glossary;
|
|
80
|
+
- architecture docs;
|
|
81
|
+
- README files;
|
|
82
|
+
- `docs/`;
|
|
83
|
+
- `AGENTS.md`;
|
|
84
|
+
- skills,
|
|
85
|
+
prompts,
|
|
86
|
+
rules,
|
|
87
|
+
agents,
|
|
88
|
+
commands,
|
|
89
|
+
tooling instructions,
|
|
90
|
+
examples,
|
|
91
|
+
and templates.
|
|
92
|
+
|
|
93
|
+
The final result should include both spec and documentation status:
|
|
94
|
+
|
|
95
|
+
```txt
|
|
96
|
+
Specs updated
|
|
97
|
+
Docs updated
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
or justified unaffected statuses.
|
|
101
|
+
|
|
102
|
+
## Review Workflow
|
|
103
|
+
|
|
104
|
+
Command:
|
|
105
|
+
|
|
106
|
+
```txt
|
|
107
|
+
/arey-review [scope]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Use this for adversarial engineering review.
|
|
111
|
+
|
|
112
|
+
Review should cover:
|
|
113
|
+
|
|
114
|
+
- architecture and code quality;
|
|
115
|
+
- test quality and test location;
|
|
116
|
+
- tooling and validation evidence;
|
|
117
|
+
- security and privacy;
|
|
118
|
+
- reliability and operability;
|
|
119
|
+
- maintainability;
|
|
120
|
+
- generated-code quality;
|
|
121
|
+
- spec,
|
|
122
|
+
ADR,
|
|
123
|
+
DBML,
|
|
124
|
+
glossary,
|
|
125
|
+
and documentation sync concerns.
|
|
126
|
+
|
|
127
|
+
Findings should be classified by severity.
|
|
128
|
+
|
|
129
|
+
## Assessment Workflow
|
|
130
|
+
|
|
131
|
+
Command:
|
|
132
|
+
|
|
133
|
+
```txt
|
|
134
|
+
/arey-assess [scope]
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Use this to assess project readiness.
|
|
138
|
+
|
|
139
|
+
The assessment is read-only by default.
|
|
140
|
+
It should produce scores,
|
|
141
|
+
evidence,
|
|
142
|
+
blockers,
|
|
143
|
+
quick wins,
|
|
144
|
+
and a prioritised improvement plan.
|
|
145
|
+
|
|
146
|
+
## Bootstrap Workflow
|
|
147
|
+
|
|
148
|
+
Command:
|
|
149
|
+
|
|
150
|
+
```txt
|
|
151
|
+
/arey-bootstrap
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
With no flags,
|
|
155
|
+
bootstrap installs project-local Arey Pi agents and creates starter harness files where missing.
|
|
156
|
+
|
|
157
|
+
Use selective flags only when needed:
|
|
158
|
+
|
|
159
|
+
```txt
|
|
160
|
+
/arey-bootstrap --agentsmd
|
|
161
|
+
/arey-bootstrap --specs
|
|
162
|
+
/arey-bootstrap --docs
|
|
163
|
+
/arey-bootstrap --force
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Subagent Orchestration Pattern
|
|
167
|
+
|
|
168
|
+
Keep orchestration in the parent Pi session.
|
|
169
|
+
Child agents should receive bounded tasks and should not launch their own subagent workflows unless explicitly assigned a bounded fanout job.
|
|
170
|
+
|
|
171
|
+
Use fresh-context reviewers for independent review.
|
|
172
|
+
Use `oracle` when a decision needs a second opinion before implementation.
|
|
173
|
+
Use one writer in the active worktree at a time.
|
|
174
|
+
|
|
175
|
+
For long-running work,
|
|
176
|
+
background subagents are appropriate.
|
|
177
|
+
If the parent has no useful independent work,
|
|
178
|
+
end the turn and wait for completion rather than polling repeatedly.
|
|
179
|
+
|
|
180
|
+
See `docs/pi-subagents.md` for detailed guidance.
|
|
181
|
+
|
|
182
|
+
## Natural Language Workflow
|
|
183
|
+
|
|
184
|
+
Users do not need to memorise commands.
|
|
185
|
+
|
|
186
|
+
This should work:
|
|
187
|
+
|
|
188
|
+
```txt
|
|
189
|
+
Implement password reset following Arey Pi.
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
The parent agent should act as tech lead,
|
|
193
|
+
select the appropriate workflow,
|
|
194
|
+
and use specialist subagents when available.
|
|
195
|
+
|
|
196
|
+
## Evidence Standard
|
|
197
|
+
|
|
198
|
+
Every non-trivial workflow should finish with:
|
|
199
|
+
|
|
200
|
+
```txt
|
|
201
|
+
Done summary:
|
|
202
|
+
- Behaviour/spec impact:
|
|
203
|
+
- Tests/TDD, including test location:
|
|
204
|
+
- Validation:
|
|
205
|
+
- Quality tooling:
|
|
206
|
+
- Spec sync:
|
|
207
|
+
- Documentation sync:
|
|
208
|
+
- Architecture/code quality:
|
|
209
|
+
- Architecture/ADR/glossary:
|
|
210
|
+
- Database/DBML:
|
|
211
|
+
- Commits:
|
|
212
|
+
- Residual risks:
|
|
213
|
+
```
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
export const requiredAgents = [
|
|
2
|
+
"tech-lead.md",
|
|
3
|
+
"spec-author.md",
|
|
4
|
+
"tdd-implementer.md",
|
|
5
|
+
"spec-syncer.md",
|
|
6
|
+
"engineering-reviewer.md",
|
|
7
|
+
"project-evaluator.md",
|
|
8
|
+
] as const;
|
|
9
|
+
|
|
10
|
+
export type ScaffoldFile = { template: string; target: string };
|
|
11
|
+
|
|
12
|
+
export const specScaffoldFiles: ScaffoldFile[] = [
|
|
13
|
+
{ template: "specs-readme.md", target: "specs/README.md" },
|
|
14
|
+
{ template: "features-readme.md", target: "specs/features/README.md" },
|
|
15
|
+
{ template: "feature.feature", target: "specs/features/example.feature" },
|
|
16
|
+
{ template: "database-readme.md", target: "specs/database/README.md" },
|
|
17
|
+
{ template: "database.dbml", target: "specs/database/schema.dbml" },
|
|
18
|
+
{ template: "architecture-readme.md", target: "specs/architecture/README.md" },
|
|
19
|
+
{ template: "decisions-readme.md", target: "specs/decisions/README.md" },
|
|
20
|
+
{ template: "adr.md", target: "specs/decisions/0001-record-architecture-decision.md" },
|
|
21
|
+
{ template: "glossary.md", target: "specs/glossary.md" },
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
export const docsScaffoldFiles: ScaffoldFile[] = [
|
|
25
|
+
{ template: "docs-readme.md", target: "docs/README.md" },
|
|
26
|
+
{ template: "project-readiness-report.md", target: "docs/project-readiness-report.md" },
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
const selectiveBootstrapFlags = ["--agentsmd", "--specs", "--docs", "--full"];
|
|
30
|
+
|
|
31
|
+
export type BootstrapPlan = {
|
|
32
|
+
flags: string[];
|
|
33
|
+
force: boolean;
|
|
34
|
+
full: boolean;
|
|
35
|
+
defaultFullBootstrap: boolean;
|
|
36
|
+
createAgentsMd: boolean;
|
|
37
|
+
createSpecs: boolean;
|
|
38
|
+
createDocs: boolean;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export function parseBootstrapFlags(args: string): BootstrapPlan {
|
|
42
|
+
const flags = args.split(/\s+/).filter(Boolean);
|
|
43
|
+
const force = flags.includes("--force");
|
|
44
|
+
const full = flags.includes("--full");
|
|
45
|
+
const hasSelectiveScaffoldFlag = flags.some((flag) => selectiveBootstrapFlags.includes(flag));
|
|
46
|
+
const defaultFullBootstrap = !hasSelectiveScaffoldFlag;
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
flags,
|
|
50
|
+
force,
|
|
51
|
+
full,
|
|
52
|
+
defaultFullBootstrap,
|
|
53
|
+
createAgentsMd: defaultFullBootstrap || flags.includes("--agentsmd") || full,
|
|
54
|
+
createSpecs: defaultFullBootstrap || flags.includes("--specs") || full,
|
|
55
|
+
createDocs: defaultFullBootstrap || flags.includes("--docs") || full,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type WorkflowKind = "feature" | "bugfix" | "sync" | "review" | "assess" | string;
|
|
60
|
+
|
|
61
|
+
export function workflowMessage(kind: WorkflowKind, args: string): string {
|
|
62
|
+
const target = args.trim() || "the current repository/task";
|
|
63
|
+
const common = `Act as the Arey Pi tech lead. Use pi-subagents when available and appropriate. Keep orchestration authority in the parent session, give child agents bounded tasks, and keep one writer in the active worktree at a time. Follow Arey Pi rules, preserve TDD, and report evidence clearly.`;
|
|
64
|
+
|
|
65
|
+
switch (kind) {
|
|
66
|
+
case "feature":
|
|
67
|
+
return `${common}\n\nRun the Arey Pi feature workflow for: ${target}\n\nExpected flow: arey-pi.spec-author for canonical specs, arey-pi.tdd-implementer for Red-Green-Refactor, arey-pi.spec-syncer for final alignment, and fresh reviewers or arey-pi.engineering-reviewer for adversarial quality review when risk warrants it. Use scout/context-builder/planner first if the codebase context is not clear.`;
|
|
68
|
+
case "bugfix":
|
|
69
|
+
return `${common}\n\nRun the Arey Pi bugfix workflow for: ${target}\n\nStart with a regression test that fails for the bug, keep tests outside production source directories by default, implement the minimal high-quality fix, synchronise specs and docs, and review engineering quality.`;
|
|
70
|
+
case "sync":
|
|
71
|
+
return `${common}\n\nRun Arey Pi spec and documentation sync for: ${target}\n\nVerify Gherkin, tests, code, DBML, ADRs, glossary, architecture docs, README files, docs, AGENTS.md, skills, prompts, rules, agents, commands, and tooling instructions. End with both a spec status and a documentation status.`;
|
|
72
|
+
case "review":
|
|
73
|
+
return `${common}\n\nRun an Arey Pi engineering review for: ${target}\n\nPrefer fresh-context review. Review architecture, code quality, test quality and location, quality tooling, security, privacy, operability, maintainability, and spec/ADR/DBML/documentation concerns. Classify findings by severity.`;
|
|
74
|
+
case "assess":
|
|
75
|
+
return `${common}\n\nAssess this repository against Arey Pi Project Readiness. Audit only by default. Produce scores, evidence, blockers, quick wins, and a prioritised improvement plan.`;
|
|
76
|
+
default:
|
|
77
|
+
return `${common}\n\nWork on: ${target}`;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type DoctorReportInput = {
|
|
82
|
+
packageVersion: string;
|
|
83
|
+
cwd: string;
|
|
84
|
+
packageRulesPresent: boolean;
|
|
85
|
+
packageTemplatesPresent: boolean;
|
|
86
|
+
packageAgentsCount: number;
|
|
87
|
+
requiredAgentsCount: number;
|
|
88
|
+
hasSubagentsCommand: boolean;
|
|
89
|
+
installedAgentsCount: number;
|
|
90
|
+
hasRootAgentsMd: boolean;
|
|
91
|
+
hasPiSettings: boolean;
|
|
92
|
+
promptsCount: number;
|
|
93
|
+
skillsCount: number;
|
|
94
|
+
missingAgents: string[];
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export function buildDoctorReport(input: DoctorReportInput): string {
|
|
98
|
+
return [
|
|
99
|
+
"# Arey Pi Doctor",
|
|
100
|
+
"",
|
|
101
|
+
`- Package: arey-pi@${input.packageVersion}`,
|
|
102
|
+
`- Project: ${input.cwd}`,
|
|
103
|
+
`- Package rules present: ${input.packageRulesPresent ? "yes" : "no"}`,
|
|
104
|
+
`- Package templates present: ${input.packageTemplatesPresent ? "yes" : "no"}`,
|
|
105
|
+
`- Package agents present: ${input.packageAgentsCount}/${input.requiredAgentsCount}`,
|
|
106
|
+
`- pi-subagents command detected: ${input.hasSubagentsCommand ? "yes" : "no"}`,
|
|
107
|
+
`- Project-local Arey Pi agents: ${input.installedAgentsCount}/${input.requiredAgentsCount}`,
|
|
108
|
+
`- Root AGENTS.md: ${input.hasRootAgentsMd ? "yes" : "no"}`,
|
|
109
|
+
`- .pi/settings.json: ${input.hasPiSettings ? "yes" : "no"}`,
|
|
110
|
+
`- Arey Pi prompts discovered: ${input.promptsCount}`,
|
|
111
|
+
`- Arey Pi skills discovered: ${input.skillsCount}`,
|
|
112
|
+
"",
|
|
113
|
+
"## Missing project agents",
|
|
114
|
+
input.missingAgents.length ? input.missingAgents.map((agent) => `- ${agent}`).join("\n") : "- none",
|
|
115
|
+
"",
|
|
116
|
+
"## Recommended next step",
|
|
117
|
+
input.installedAgentsCount === input.requiredAgentsCount
|
|
118
|
+
? "- Project-local Arey Pi subagents are installed. Use `/arey-feature`, `/arey-bugfix`, `/arey-sync`, `/arey-review`, or natural language."
|
|
119
|
+
: "- Run `/arey-bootstrap` to install project-local Arey Pi subagents.",
|
|
120
|
+
].join("\n");
|
|
121
|
+
}
|
|
@@ -2,18 +2,20 @@ import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync, writeFileS
|
|
|
2
2
|
import { dirname, join, relative } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
5
|
+
import {
|
|
6
|
+
buildDoctorReport,
|
|
7
|
+
docsScaffoldFiles,
|
|
8
|
+
parseBootstrapFlags,
|
|
9
|
+
requiredAgents,
|
|
10
|
+
specScaffoldFiles,
|
|
11
|
+
workflowMessage,
|
|
12
|
+
type ScaffoldFile,
|
|
13
|
+
} from "./core.ts";
|
|
5
14
|
|
|
6
15
|
const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
7
16
|
const agentSourceDir = join(packageRoot, "agents");
|
|
8
17
|
const rulesDir = join(packageRoot, "rules");
|
|
9
|
-
const
|
|
10
|
-
"tech-lead.md",
|
|
11
|
-
"spec-author.md",
|
|
12
|
-
"tdd-implementer.md",
|
|
13
|
-
"spec-syncer.md",
|
|
14
|
-
"engineering-reviewer.md",
|
|
15
|
-
"project-evaluator.md",
|
|
16
|
-
];
|
|
18
|
+
const templatesDir = join(packageRoot, "templates");
|
|
17
19
|
|
|
18
20
|
function cwdFrom(ctx: unknown): string {
|
|
19
21
|
const maybe = ctx as { cwd?: string };
|
|
@@ -64,52 +66,45 @@ function copyAgents(targetDir: string, force: boolean): { copied: string[]; skip
|
|
|
64
66
|
return { copied, skipped, missing };
|
|
65
67
|
}
|
|
66
68
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
type ScaffoldResult = { created: string[]; skipped: string[] };
|
|
70
|
+
|
|
71
|
+
function templateContent(name: string): string {
|
|
72
|
+
return readFileSync(join(templatesDir, name), "utf8");
|
|
73
|
+
}
|
|
69
74
|
|
|
70
|
-
|
|
75
|
+
function writeTemplateIfMissing(file: ScaffoldFile, force: boolean, cwd: string, result: ScaffoldResult) {
|
|
76
|
+
const target = join(cwd, file.target);
|
|
77
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
71
78
|
|
|
72
|
-
|
|
79
|
+
if (fileExists(target) && !force) {
|
|
80
|
+
result.skipped.push(file.target);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
73
83
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- Follow TDD for production behaviour changes.
|
|
78
|
-
- Keep specs, tests, code, DBML, ADRs, glossary, and architecture docs synchronised.
|
|
79
|
-
- Capture significant technical decisions in high-quality ADRs.
|
|
80
|
-
- Run formatter, lint/static analysis, typecheck, tests, and relevant dynamic analysis where available.
|
|
81
|
-
- Use incremental Conventional Commits for meaningful steps.
|
|
84
|
+
writeFileSync(target, templateContent(file.template));
|
|
85
|
+
result.created.push(file.target);
|
|
86
|
+
}
|
|
82
87
|
|
|
83
|
-
|
|
88
|
+
function scaffoldFiles(cwd: string, force: boolean, files: ScaffoldFile[]): ScaffoldResult {
|
|
89
|
+
const result: ScaffoldResult = { created: [], skipped: [] };
|
|
84
90
|
|
|
85
|
-
|
|
91
|
+
for (const file of files) {
|
|
92
|
+
writeTemplateIfMissing(file, force, cwd, result);
|
|
93
|
+
}
|
|
86
94
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
\`\`\`
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
90
97
|
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
function scaffoldSpecs(cwd: string, force: boolean): ScaffoldResult {
|
|
99
|
+
return scaffoldFiles(cwd, force, specScaffoldFiles);
|
|
93
100
|
}
|
|
94
101
|
|
|
95
|
-
function
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return `${common}\n\nRun the Arey Pi feature workflow for: ${target}\n\nExpected flow: spec-author for canonical specs, tdd-implementer for Red-Green-Refactor, spec-syncer for final alignment, and engineering-reviewer for adversarial quality review when risk warrants it.`;
|
|
102
|
-
case "bugfix":
|
|
103
|
-
return `${common}\n\nRun the Arey Pi bugfix workflow for: ${target}\n\nStart with a regression test that fails for the bug, then implement the minimal high-quality fix, synchronise specs, and review engineering quality.`;
|
|
104
|
-
case "sync":
|
|
105
|
-
return `${common}\n\nRun Arey Pi spec and documentation sync for: ${target}\n\nVerify Gherkin, tests, code, DBML, ADRs, glossary, architecture docs, README files, docs, AGENTS.md, skills, prompts, rules, agents, commands, and tooling instructions. End with both a spec status and a documentation status.`;
|
|
106
|
-
case "review":
|
|
107
|
-
return `${common}\n\nRun an Arey Pi engineering review for: ${target}\n\nReview architecture, code quality, test quality, quality tooling, security, privacy, operability, maintainability, and spec/ADR/DBML concerns. Classify findings by severity.`;
|
|
108
|
-
case "assess":
|
|
109
|
-
return `${common}\n\nAssess this repository against Arey Pi Project Readiness. Audit only by default. Produce scores, evidence, blockers, quick wins, and a prioritised improvement plan.`;
|
|
110
|
-
default:
|
|
111
|
-
return `${common}\n\nWork on: ${target}`;
|
|
112
|
-
}
|
|
102
|
+
function scaffoldDocs(cwd: string, force: boolean): ScaffoldResult {
|
|
103
|
+
return scaffoldFiles(cwd, force, docsScaffoldFiles);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function starterAgentsMd(): string {
|
|
107
|
+
return templateContent("AGENTS.md");
|
|
113
108
|
}
|
|
114
109
|
|
|
115
110
|
function sendWorkflow(
|
|
@@ -163,28 +158,21 @@ export default function areyPi(pi: ExtensionAPI) {
|
|
|
163
158
|
(command) => command.source === "skill" && command.sourceInfo?.source?.includes("arey-pi"),
|
|
164
159
|
);
|
|
165
160
|
|
|
166
|
-
const report =
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
missingAgents.length ? missingAgents.map((agent) => `- ${agent}`).join("\n") : "- none",
|
|
182
|
-
"",
|
|
183
|
-
"## Recommended next step",
|
|
184
|
-
installedAgents.length === requiredAgents.length
|
|
185
|
-
? "- Project-local Arey Pi subagents are installed. Use `/arey-feature`, `/arey-bugfix`, `/arey-sync`, `/arey-review`, or natural language."
|
|
186
|
-
: "- Run `/arey-bootstrap` to install project-local Arey Pi subagents.",
|
|
187
|
-
].join("\n");
|
|
161
|
+
const report = buildDoctorReport({
|
|
162
|
+
packageVersion: packageVersion(),
|
|
163
|
+
cwd,
|
|
164
|
+
packageRulesPresent: dirExists(rulesDir),
|
|
165
|
+
packageTemplatesPresent: dirExists(templatesDir),
|
|
166
|
+
packageAgentsCount: packageAgents.length,
|
|
167
|
+
requiredAgentsCount: requiredAgents.length,
|
|
168
|
+
hasSubagentsCommand,
|
|
169
|
+
installedAgentsCount: installedAgents.length,
|
|
170
|
+
hasRootAgentsMd: fileExists(join(cwd, "AGENTS.md")),
|
|
171
|
+
hasPiSettings: fileExists(join(cwd, ".pi", "settings.json")),
|
|
172
|
+
promptsCount: prompts.length,
|
|
173
|
+
skillsCount: skills.length,
|
|
174
|
+
missingAgents,
|
|
175
|
+
});
|
|
188
176
|
|
|
189
177
|
pi.sendMessage({
|
|
190
178
|
customType: "arey-pi-doctor",
|
|
@@ -196,19 +184,22 @@ export default function areyPi(pi: ExtensionAPI) {
|
|
|
196
184
|
});
|
|
197
185
|
|
|
198
186
|
pi.registerCommand("arey-bootstrap", {
|
|
199
|
-
description: "Install Arey Pi
|
|
187
|
+
description: "Install Arey Pi subagents and optionally scaffold specs/docs",
|
|
200
188
|
handler: async (args, ctx) => {
|
|
201
189
|
const cwd = cwdFrom(ctx);
|
|
202
|
-
const force = args
|
|
203
|
-
const createAgentsMd = args.split(/\s+/).includes("--agentsmd");
|
|
190
|
+
const { force, createAgentsMd, createSpecs, createDocs } = parseBootstrapFlags(args);
|
|
204
191
|
const targetDir = join(cwd, ".pi", "agents", "arey-pi");
|
|
205
192
|
const result = copyAgents(targetDir, force);
|
|
193
|
+
const specsResult = createSpecs ? scaffoldSpecs(cwd, force) : { created: [], skipped: [] };
|
|
194
|
+
const docsResult = createDocs ? scaffoldDocs(cwd, force) : { created: [], skipped: [] };
|
|
206
195
|
const agentsMdPath = join(cwd, "AGENTS.md");
|
|
207
196
|
let agentsMdStatus = "unchanged";
|
|
208
197
|
|
|
209
198
|
if (!fileExists(agentsMdPath) && (createAgentsMd || force)) {
|
|
210
199
|
writeFileSync(agentsMdPath, starterAgentsMd());
|
|
211
200
|
agentsMdStatus = "created";
|
|
201
|
+
} else if (fileExists(agentsMdPath) && createAgentsMd && !force) {
|
|
202
|
+
agentsMdStatus = "skipped existing";
|
|
212
203
|
}
|
|
213
204
|
|
|
214
205
|
const report = [
|
|
@@ -219,13 +210,27 @@ export default function areyPi(pi: ExtensionAPI) {
|
|
|
219
210
|
`- Skipped existing agents: ${result.skipped.length}`,
|
|
220
211
|
`- Missing package agents: ${result.missing.length}`,
|
|
221
212
|
`- AGENTS.md: ${agentsMdStatus}`,
|
|
213
|
+
`- Spec scaffold created: ${specsResult.created.length}`,
|
|
214
|
+
`- Spec scaffold skipped: ${specsResult.skipped.length}`,
|
|
215
|
+
`- Docs scaffold created: ${docsResult.created.length}`,
|
|
216
|
+
`- Docs scaffold skipped: ${docsResult.skipped.length}`,
|
|
222
217
|
"",
|
|
223
|
-
"## Copied",
|
|
218
|
+
"## Copied agents",
|
|
224
219
|
result.copied.length ? result.copied.map((agent) => `- ${agent}`).join("\n") : "- none",
|
|
225
220
|
"",
|
|
226
|
-
"## Skipped",
|
|
221
|
+
"## Skipped agents",
|
|
227
222
|
result.skipped.length ? result.skipped.map((agent) => `- ${agent}`).join("\n") : "- none",
|
|
228
223
|
"",
|
|
224
|
+
"## Created scaffold files",
|
|
225
|
+
[...specsResult.created, ...docsResult.created].length
|
|
226
|
+
? [...specsResult.created, ...docsResult.created].map((path) => `- ${path}`).join("\n")
|
|
227
|
+
: "- none",
|
|
228
|
+
"",
|
|
229
|
+
"## Skipped scaffold files",
|
|
230
|
+
[...specsResult.skipped, ...docsResult.skipped].length
|
|
231
|
+
? [...specsResult.skipped, ...docsResult.skipped].map((path) => `- ${path}`).join("\n")
|
|
232
|
+
: "- none",
|
|
233
|
+
"",
|
|
229
234
|
"Run `/arey-doctor` to verify setup.",
|
|
230
235
|
].join("\n");
|
|
231
236
|
|
|
@@ -233,7 +238,7 @@ export default function areyPi(pi: ExtensionAPI) {
|
|
|
233
238
|
customType: "arey-pi-bootstrap",
|
|
234
239
|
content: report,
|
|
235
240
|
display: true,
|
|
236
|
-
details: result,
|
|
241
|
+
details: { agents: result, specs: specsResult, docs: docsResult, agentsMd: agentsMdStatus },
|
|
237
242
|
});
|
|
238
243
|
},
|
|
239
244
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arey-pi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "A Pi package for canonical Gherkin specs, non-negotiable TDD, spec synchronisation, AI harness readiness, and senior-quality software delivery.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Alejandro Rey Leyva",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
],
|
|
25
25
|
"files": [
|
|
26
26
|
"agents/",
|
|
27
|
+
"assets/",
|
|
27
28
|
"extensions/",
|
|
28
29
|
"docs/",
|
|
29
30
|
"skills/",
|
|
@@ -35,20 +36,22 @@
|
|
|
35
36
|
],
|
|
36
37
|
"pi": {
|
|
37
38
|
"extensions": [
|
|
38
|
-
"./extensions/arey-pi.ts"
|
|
39
|
+
"./extensions/arey-pi/index.ts"
|
|
39
40
|
],
|
|
40
41
|
"skills": [
|
|
41
42
|
"./skills"
|
|
42
43
|
],
|
|
43
44
|
"prompts": [
|
|
44
45
|
"./prompts"
|
|
45
|
-
]
|
|
46
|
+
],
|
|
47
|
+
"image": "https://cdn.jsdelivr.net/gh/alereyleyva/arey-pi@main/assets/arey-pi-logo.png"
|
|
46
48
|
},
|
|
47
49
|
"scripts": {
|
|
48
50
|
"format": "biome format --write .",
|
|
49
51
|
"lint": "biome lint .",
|
|
50
52
|
"typecheck": "tsc --noEmit",
|
|
51
|
-
"
|
|
53
|
+
"test": "bun test",
|
|
54
|
+
"check": "bun run lint && bun run typecheck && bun run test",
|
|
52
55
|
"prepublishOnly": "bun run check && npm pack --dry-run"
|
|
53
56
|
},
|
|
54
57
|
"peerDependencies": {
|
|
@@ -65,6 +68,7 @@
|
|
|
65
68
|
"devDependencies": {
|
|
66
69
|
"@biomejs/biome": "^2.4.16",
|
|
67
70
|
"@earendil-works/pi-coding-agent": "^0.78.1",
|
|
71
|
+
"@types/bun": "^1.3.14",
|
|
68
72
|
"@types/node": "^25.9.2",
|
|
69
73
|
"typescript": "^6.0.3"
|
|
70
74
|
}
|
|
@@ -54,6 +54,7 @@ Check whether:
|
|
|
54
54
|
- coverage is available or intentionally absent;
|
|
55
55
|
- mutation testing is configured for critical code or proposed as an improvement;
|
|
56
56
|
- tests assert behaviour rather than implementation mechanics;
|
|
57
|
+
- tests are organised in a dedicated test/spec directory rather than colocated with production source files without justification;
|
|
57
58
|
- edge cases and failure paths are covered for important behaviour;
|
|
58
59
|
- surviving mutants or weak assertions are triaged when evidence exists.
|
|
59
60
|
|
|
@@ -12,6 +12,7 @@ A change is complete when:
|
|
|
12
12
|
|
|
13
13
|
- relevant Gherkin specs exist or are explicitly confirmed unaffected;
|
|
14
14
|
- production behaviour is covered by meaningful tests;
|
|
15
|
+
- tests are placed in a dedicated test/spec directory outside production source trees, unless an explicit project or framework constraint justifies an exception;
|
|
15
16
|
- test quality has been assessed with mutation testing, coverage, or explicit review appropriate to risk;
|
|
16
17
|
- TDD was followed for production behaviour;
|
|
17
18
|
- bug fixes include regression tests;
|
|
@@ -37,6 +38,7 @@ A change is not done if:
|
|
|
37
38
|
|
|
38
39
|
- behaviour changed but Gherkin was not updated or justified unaffected;
|
|
39
40
|
- tests were skipped silently;
|
|
41
|
+
- new tests are colocated inside production source directories without a documented convention or approved exception;
|
|
40
42
|
- production code was written without TDD evidence;
|
|
41
43
|
- failing tests remain unresolved without explicit blocker status;
|
|
42
44
|
- code contradicts canonical specs;
|
|
@@ -57,7 +59,7 @@ Agents should close with:
|
|
|
57
59
|
```txt
|
|
58
60
|
Done summary:
|
|
59
61
|
- Behaviour/spec impact:
|
|
60
|
-
- Tests/TDD:
|
|
62
|
+
- Tests/TDD, including test location:
|
|
61
63
|
- Validation:
|
|
62
64
|
- Quality tooling:
|
|
63
65
|
- Spec sync:
|