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.
@@ -16,13 +16,16 @@ Red → Green → Refactor
16
16
 
17
17
  This applies to features, bug fixes, behaviour changes, risky refactors, API/CLI behaviour, validation, permissions, persistence, and error handling.
18
18
 
19
+ Tests must live outside production source directories by default.
20
+ Do not colocate test files beside production files in `src/` or equivalent source trees unless an existing project convention explicitly requires it or the user approves an exception.
21
+
19
22
  ## Red
20
23
 
21
24
  Before implementation, create, update, or identify a test that fails for the intended reason.
22
25
 
23
26
  Valid Red evidence includes:
24
27
 
25
- - a newly added failing test;
28
+ - a newly added failing test in the dedicated test directory;
26
29
  - an updated failing test;
27
30
  - an existing failing test that already captures the intended behaviour;
28
31
  - a documented inability to run the test, including the exact intended command and reason.
@@ -46,6 +49,32 @@ After Green, refactor only while tests remain green.
46
49
 
47
50
  Refactoring should improve clarity, structure, duplication, or maintainability without expanding scope or changing behaviour.
48
51
 
52
+ ## Test Location
53
+
54
+ Use a dedicated test/spec directory for automated tests.
55
+
56
+ Preferred locations include project conventions such as:
57
+
58
+ ```txt
59
+ tests/
60
+ test/
61
+ __tests__/
62
+ spec/
63
+ ```
64
+
65
+ When adding tests for code under `src/`, mirror the production module structure under the chosen test directory instead of creating sibling test files inside `src/`.
66
+
67
+ Example:
68
+
69
+ ```txt
70
+ src/domain/accounts/password-reset.ts
71
+ tests/domain/accounts/password-reset.test.ts
72
+ ```
73
+
74
+ If a repository already has a clear separate test root, follow it.
75
+ If it only has colocated tests, ask before continuing the pattern or migrating it.
76
+ If a framework mandates colocated tests, document the constraint in the final evidence.
77
+
49
78
  ## Bug Fixes
50
79
 
51
80
  Every bug fix requires a regression test.
@@ -82,5 +111,6 @@ Completion must report:
82
111
  - Green evidence;
83
112
  - refactor status;
84
113
  - commands run;
114
+ - test location and any exception to separate test directories;
85
115
  - tests not run and why;
86
116
  - residual risks.
@@ -23,6 +23,36 @@ Agents should assess test quality across these dimensions:
23
23
  5. **Minimal coupling:** the test avoids depending on private implementation details unless intentionally characterizing legacy code before refactor.
24
24
  6. **Maintainability:** the test is readable, focused, deterministic, and not overly broad.
25
25
  7. **Regression value:** for bug fixes, the test would have failed before the fix.
26
+ 8. **Source separation:** tests live in a dedicated test/spec directory rather than being colocated with production files, unless an explicit project or framework constraint justifies an exception.
27
+
28
+ ## Test Organisation
29
+
30
+ Tests should be organised outside production source directories.
31
+
32
+ Prefer a project-level test root such as:
33
+
34
+ ```txt
35
+ tests/
36
+ test/
37
+ __tests__/
38
+ spec/
39
+ ```
40
+
41
+ Mirror production structure inside that test root when useful.
42
+
43
+ Avoid creating files such as:
44
+
45
+ ```txt
46
+ src/foo.test.ts
47
+ src/foo.spec.ts
48
+ src/foo.test.py
49
+ ```
50
+
51
+ unless the repository has an established, user-approved, or framework-mandated colocated test convention.
52
+
53
+ This keeps production source trees clean,
54
+ makes generated tests easier to audit,
55
+ and avoids mixing executable product code with validation artefacts.
26
56
 
27
57
  ## Coverage
28
58
 
@@ -101,7 +131,8 @@ Agents must reject or improve tests that:
101
131
  - over-mock collaborators so the real contract is not exercised;
102
132
  - assert private structure instead of observable behaviour;
103
133
  - pass even if important logic is removed;
104
- - lack a clear connection to a spec, bug, or requirement.
134
+ - lack a clear connection to a spec, bug, or requirement;
135
+ - are colocated with production source files without an explicit project convention or approved exception.
105
136
 
106
137
  ## Negative and Edge Cases
107
138
 
@@ -130,7 +161,7 @@ If the answer is no, the test is probably weak.
130
161
 
131
162
  For non-trivial production changes, agents should report:
132
163
 
133
- - tests added or modified;
164
+ - tests added or modified, including their dedicated test directory location;
134
165
  - related Gherkin scenarios or requirements;
135
166
  - Red evidence;
136
167
  - Green evidence;
@@ -0,0 +1,151 @@
1
+ # Agent Instructions
2
+
3
+ This project uses Arey Pi.
4
+
5
+ ## Delivery Rules
6
+
7
+ - Treat canonical specs as the source of truth.
8
+ - Use Gherkin for behaviour specs.
9
+ - Use DBML for database specs when the project has persistence.
10
+ - Follow TDD for production behaviour changes.
11
+ - Put tests in a dedicated test/spec directory outside production source trees unless a documented project or framework convention requires otherwise.
12
+ - Keep specs, tests, code, DBML, ADRs, glossary, architecture docs, README files, docs, AGENTS.md, commands, and tooling instructions synchronised.
13
+ - Capture significant technical decisions in high-quality ADRs.
14
+ - Run formatter, lint/static analysis, typecheck, tests, and relevant dynamic analysis where available.
15
+ - Use incremental Conventional Commits for meaningful steps.
16
+
17
+ ## Project Commands
18
+
19
+ Document the project-specific commands here.
20
+ Agents should run the narrowest relevant validation first,
21
+ then the composed project check before completion.
22
+
23
+ ```bash
24
+ # Install dependencies
25
+ <package-manager> install
26
+
27
+ # Format
28
+ <package-manager> run format
29
+
30
+ # Lint/static analysis
31
+ <package-manager> run lint
32
+
33
+ # Typecheck
34
+ <package-manager> run typecheck
35
+
36
+ # Test
37
+ <package-manager> run test
38
+
39
+ # Full validation
40
+ <package-manager> run check
41
+ ```
42
+
43
+ ## Specs and Documentation
44
+
45
+ Canonical specs should live under:
46
+
47
+ ```txt
48
+ specs/features/
49
+ specs/database/
50
+ specs/architecture/
51
+ specs/decisions/
52
+ specs/glossary.md
53
+ ```
54
+
55
+ Project-facing documentation should live under:
56
+
57
+ ```txt
58
+ docs/
59
+ README.md
60
+ AGENTS.md
61
+ ```
62
+
63
+ Every completed change should report:
64
+
65
+ ```txt
66
+ Specs updated
67
+ ```
68
+
69
+ or:
70
+
71
+ ```txt
72
+ Specs unaffected: <reason>
73
+ ```
74
+
75
+ and:
76
+
77
+ ```txt
78
+ Docs updated
79
+ ```
80
+
81
+ or:
82
+
83
+ ```txt
84
+ Docs unaffected: <reason>
85
+ ```
86
+
87
+ ## Test Layout
88
+
89
+ Keep tests outside production source directories by default.
90
+
91
+ Preferred examples:
92
+
93
+ ```txt
94
+ src/domain/accounts/password-reset.ts
95
+ tests/domain/accounts/password-reset.test.ts
96
+ ```
97
+
98
+ Avoid creating colocated tests such as:
99
+
100
+ ```txt
101
+ src/domain/accounts/password-reset.test.ts
102
+ ```
103
+
104
+ unless this repository documents that convention explicitly.
105
+
106
+ ## Subagents
107
+
108
+ Keep orchestration in the parent Pi session.
109
+ Child agents should receive concrete,
110
+ bounded tasks and should not launch their own subagent workflows unless explicitly assigned a bounded fanout job.
111
+
112
+ Project-local Arey Pi subagents live in:
113
+
114
+ ```txt
115
+ .pi/agents/arey-pi/
116
+ ```
117
+
118
+ Use them through pi-subagents when available.
119
+ Run `/subagents-doctor` if subagent discovery or async coordination looks wrong.
120
+
121
+ Suggested Arey Pi roles:
122
+
123
+ - `arey-pi.tech-lead` for orchestration;
124
+ - `arey-pi.spec-author` for canonical specs;
125
+ - `arey-pi.tdd-implementer` for Red-Green-Refactor;
126
+ - `arey-pi.spec-syncer` for spec and documentation alignment;
127
+ - `arey-pi.engineering-reviewer` for adversarial quality review;
128
+ - `arey-pi.project-evaluator` for readiness assessment.
129
+
130
+ Useful builtin `pi-subagents` roles:
131
+
132
+ - `scout` for fast codebase reconnaissance;
133
+ - `context-builder` for stronger planning handoff context;
134
+ - `planner` for implementation plans;
135
+ - `worker` for approved generic implementation;
136
+ - `reviewer` for fresh-context reviews;
137
+ - `oracle` for risky decisions and second opinions;
138
+ - `researcher` for external evidence when web access is available.
139
+
140
+ Prefer fresh reviewers for independent review.
141
+ Use `oracle` when prior conversation context and decision drift matter.
142
+ Keep one writer in the active worktree at a time.
143
+
144
+ ## Local Overrides
145
+
146
+ Add repository-specific technology,
147
+ architecture,
148
+ safety,
149
+ and validation instructions below.
150
+
151
+ Nested `AGENTS.md` files may override or extend these instructions for specific subtrees.
@@ -0,0 +1,129 @@
1
+ # ADR-NNNN: Decision Title
2
+
3
+ ## Status
4
+
5
+ Proposed
6
+
7
+ Accepted values:
8
+ Proposed,
9
+ Accepted,
10
+ Superseded,
11
+ Deprecated.
12
+
13
+ ## Date
14
+
15
+ YYYY-MM-DD
16
+
17
+ ## Context
18
+
19
+ Describe the forces,
20
+ constraints,
21
+ requirements,
22
+ and tradeoffs that make this decision necessary.
23
+
24
+ Include:
25
+
26
+ - the problem being solved;
27
+ - relevant canonical specs or ADRs;
28
+ - operational constraints;
29
+ - security,
30
+ privacy,
31
+ performance,
32
+ reliability,
33
+ or maintainability concerns;
34
+ - what happens if no decision is made.
35
+
36
+ ## Decision Drivers
37
+
38
+ - Driver 1
39
+ - Driver 2
40
+ - Driver 3
41
+
42
+ ## Options Considered
43
+
44
+ ### Option 1: Name
45
+
46
+ Summary.
47
+
48
+ Pros:
49
+
50
+ - ...
51
+
52
+ Cons:
53
+
54
+ - ...
55
+
56
+ ### Option 2: Name
57
+
58
+ Summary.
59
+
60
+ Pros:
61
+
62
+ - ...
63
+
64
+ Cons:
65
+
66
+ - ...
67
+
68
+ ## Decision
69
+
70
+ State the chosen option clearly.
71
+
72
+ Explain why it best satisfies the decision drivers.
73
+
74
+ ## Consequences
75
+
76
+ Expected positive consequences:
77
+
78
+ - ...
79
+
80
+ Expected negative consequences or costs:
81
+
82
+ - ...
83
+
84
+ Operational impact:
85
+
86
+ - ...
87
+
88
+ Follow-up work:
89
+
90
+ - ...
91
+
92
+ ## Validation
93
+
94
+ Describe how the decision will be validated.
95
+
96
+ Examples:
97
+
98
+ - tests;
99
+ - operational metrics;
100
+ - migration checks;
101
+ - architecture review;
102
+ - project readiness assessment.
103
+
104
+ ## Supersession and Relationships
105
+
106
+ Supersedes:
107
+
108
+ - None
109
+
110
+ Superseded by:
111
+
112
+ - None
113
+
114
+ Related ADRs:
115
+
116
+ - None
117
+
118
+ Overlapping decisions:
119
+
120
+ - None
121
+
122
+ ## Revisit Conditions
123
+
124
+ Revisit this decision if:
125
+
126
+ - a listed constraint changes;
127
+ - implementation cost differs materially from expectations;
128
+ - operational evidence contradicts assumptions;
129
+ - a simpler option becomes viable.
@@ -0,0 +1,9 @@
1
+ # Architecture
2
+
3
+ Use this directory for durable architecture memory.
4
+
5
+ Document boundaries,
6
+ integrations,
7
+ ownership,
8
+ constraints,
9
+ and current system structure that future humans and agents need to preserve.
@@ -0,0 +1,10 @@
1
+ # Database Specs
2
+
3
+ Database projects must keep canonical DBML specs here or document the canonical DBML location.
4
+
5
+ DBML must stay synchronised with migrations,
6
+ ORM models,
7
+ SQL DDL,
8
+ constraints,
9
+ indexes,
10
+ and relationships.
@@ -0,0 +1,57 @@
1
+ // Canonical database specification.
2
+ // Keep this DBML synchronised with migrations,
3
+ // ORM models,
4
+ // SQL DDL,
5
+ // constraints,
6
+ // indexes,
7
+ // relationships,
8
+ // and persistence tests.
9
+
10
+ Project project_name {
11
+ database_type: 'PostgreSQL'
12
+ Note: '''
13
+ Replace this starter DBML with the canonical project schema.
14
+ Document the database engine,
15
+ important extensions,
16
+ ownership boundaries,
17
+ and migration constraints here.
18
+ '''
19
+ }
20
+
21
+ Enum example_status {
22
+ active
23
+ archived
24
+ }
25
+
26
+ Table example_entities {
27
+ id uuid [pk, note: 'Primary identifier']
28
+ name varchar [not null, unique, note: 'Human-readable unique name']
29
+ status example_status [not null, default: 'active']
30
+ created_at timestamptz [not null]
31
+ updated_at timestamptz [not null]
32
+
33
+ indexes {
34
+ name [unique, name: 'idx_example_entities_name_unique']
35
+ status [name: 'idx_example_entities_status']
36
+ }
37
+
38
+ Note: '''
39
+ Replace this example table with canonical project tables.
40
+ Include constraints,
41
+ indexes,
42
+ relationship intent,
43
+ and relevant domain notes.
44
+ '''
45
+ }
46
+
47
+ Table example_events {
48
+ id uuid [pk]
49
+ entity_id uuid [not null, ref: > example_entities.id]
50
+ event_type varchar [not null]
51
+ occurred_at timestamptz [not null]
52
+ payload jsonb [not null, default: '{}']
53
+
54
+ indexes {
55
+ (entity_id, occurred_at) [name: 'idx_example_events_entity_time']
56
+ }
57
+ }
@@ -0,0 +1,11 @@
1
+ # Decisions
2
+
3
+ Use this directory for high-quality ADRs.
4
+
5
+ ADRs should capture meaningful technical decisions,
6
+ context,
7
+ options,
8
+ tradeoffs,
9
+ consequences,
10
+ revisit conditions,
11
+ and supersession relationships.
@@ -0,0 +1,9 @@
1
+ # Documentation
2
+
3
+ Use this directory for project-facing documentation that is not itself a canonical spec.
4
+
5
+ Keep usage,
6
+ setup,
7
+ commands,
8
+ operations,
9
+ and workflow instructions synchronised with the implementation and Arey Pi rules.
@@ -0,0 +1,38 @@
1
+ @arey-pi @replace-me
2
+ Feature: Replace with capability name
3
+ This feature is a canonical behaviour spec.
4
+ It should describe externally observable behaviour,
5
+ not implementation details.
6
+
7
+ As a named actor or stakeholder
8
+ I want a concrete capability
9
+ So that a valuable outcome is achieved
10
+
11
+ Rule: Replace with the business rule being protected
12
+
13
+ Background:
14
+ Given relevant starting context
15
+ And any shared preconditions that every scenario needs
16
+
17
+ @happy-path
18
+ Scenario: Primary successful behaviour
19
+ Given a meaningful initial state
20
+ When the actor performs the behaviour
21
+ Then the expected outcome is observable
22
+ And important side effects are visible
23
+
24
+ @validation @edge-case
25
+ Scenario Outline: Important validation or boundary behaviour
26
+ Given <precondition>
27
+ When the actor performs the behaviour with <input>
28
+ Then <outcome> is reported
29
+
30
+ Examples:
31
+ | precondition | input | outcome |
32
+ | valid setup | value | result |
33
+
34
+ @regression
35
+ Scenario: Regression behaviour
36
+ Given the historical failure condition
37
+ When the triggering action occurs
38
+ Then the regression is prevented
@@ -0,0 +1,7 @@
1
+ # Behaviour Specs
2
+
3
+ Write behaviour specs in Gherkin.
4
+
5
+ Use semantic line breaks in feature files and accompanying notes.
6
+ Each feature should describe externally observable behaviour,
7
+ not implementation details.
@@ -0,0 +1,19 @@
1
+ # Glossary
2
+
3
+ Use this glossary for durable domain language.
4
+
5
+ ## Terms
6
+
7
+ <!--
8
+ Add terms as they become important.
9
+
10
+ Example:
11
+
12
+ ### Account
13
+
14
+ Definition.
15
+
16
+ Related specs:
17
+
18
+ - specs/features/example.feature
19
+ -->
@@ -0,0 +1,120 @@
1
+ # Arey Pi Project Readiness Report
2
+
3
+ ## Overall
4
+
5
+ - Overall Readiness: N/5
6
+ - Lowest Rule Scores:
7
+ - Highest Rule Scores:
8
+
9
+ ## Executive Summary
10
+
11
+ Summarise the current readiness posture.
12
+
13
+ ## Blockers
14
+
15
+ List issues that prevent reliable Arey Pi delivery.
16
+
17
+ ## Quick Wins
18
+
19
+ List low-effort improvements with high leverage.
20
+
21
+ ## Rule Scores
22
+
23
+ ### Canonical Specs
24
+
25
+ - Score:
26
+ - Evidence:
27
+ - Findings:
28
+ - Recommendations:
29
+
30
+ ### Gherkin Authoring
31
+
32
+ - Score:
33
+ - Evidence:
34
+ - Findings:
35
+ - Recommendations:
36
+
37
+ ### Tests/TDD
38
+
39
+ - Score:
40
+ - Evidence:
41
+ - Findings:
42
+ - Recommendations:
43
+
44
+ ### Test Quality
45
+
46
+ - Score:
47
+ - Evidence:
48
+ - Findings:
49
+ - Recommendations:
50
+
51
+ ### Quality Tooling
52
+
53
+ - Score:
54
+ - Evidence:
55
+ - Findings:
56
+ - Recommendations:
57
+
58
+ ### Engineering Quality
59
+
60
+ - Score:
61
+ - Evidence:
62
+ - Findings:
63
+ - Recommendations:
64
+
65
+ ### Spec Sync
66
+
67
+ - Score:
68
+ - Evidence:
69
+ - Findings:
70
+ - Recommendations:
71
+
72
+ ### Documentation Sync
73
+
74
+ - Score:
75
+ - Evidence:
76
+ - Findings:
77
+ - Recommendations:
78
+
79
+ ### Database Specs
80
+
81
+ - Score:
82
+ - Evidence:
83
+ - Findings:
84
+ - Recommendations:
85
+
86
+ ### Rebuildability
87
+
88
+ - Score:
89
+ - Evidence:
90
+ - Findings:
91
+ - Recommendations:
92
+
93
+ ### Architecture Memory and ADRs
94
+
95
+ - Score:
96
+ - Evidence:
97
+ - Findings:
98
+ - Recommendations:
99
+
100
+ ### Incremental Commits
101
+
102
+ - Score:
103
+ - Evidence:
104
+ - Findings:
105
+ - Recommendations:
106
+
107
+ ### AI Harness
108
+
109
+ - Score:
110
+ - Evidence:
111
+ - Findings:
112
+ - Recommendations:
113
+
114
+ ## Recommended Plan
115
+
116
+ 1. ...
117
+
118
+ ## Residual Risks / Unknowns
119
+
120
+ List what could not be verified.
@@ -0,0 +1,6 @@
1
+ # Specs
2
+
3
+ This directory contains canonical Arey Pi project specifications.
4
+
5
+ Specs are durable project knowledge.
6
+ Keep them synchronised with tests, code, DBML, ADRs, glossary, architecture docs, and project documentation.