agentme 0.5.0 → 0.7.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/.xdrs/agentme/edrs/application/003-javascript-project-tooling.md +40 -24
- package/.xdrs/agentme/edrs/application/010-golang-project-tooling.md +43 -33
- package/.xdrs/agentme/edrs/application/014-python-project-tooling.md +80 -38
- package/.xdrs/agentme/edrs/application/skills/001-create-javascript-project/SKILL.md +65 -23
- package/.xdrs/agentme/edrs/application/skills/003-create-golang-project/SKILL.md +46 -20
- package/.xdrs/agentme/edrs/application/skills/005-create-python-project/SKILL.md +168 -78
- package/.xdrs/agentme/edrs/devops/005-monorepo-structure.md +36 -8
- package/.xdrs/agentme/edrs/devops/008-common-targets.md +59 -50
- package/.xdrs/agentme/edrs/devops/skills/002-monorepo-setup/SKILL.md +66 -20
- package/.xdrs/agentme/edrs/index.md +1 -0
- package/.xdrs/agentme/edrs/principles/016-cross-language-module-structure.md +133 -0
- package/README.md +9 -11
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agentme-edr-008-common-development-script-names
|
|
3
|
-
description: Defines standard
|
|
3
|
+
description: Defines standard Makefile target names and the mandatory tool-execution flow using Mise. Use when designing build, lint, test, and release entry points.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# agentme-edr-008: Common development script names
|
|
@@ -9,46 +9,67 @@ description: Defines standard development command names and lifecycle groups acr
|
|
|
9
9
|
|
|
10
10
|
Software projects use a wide variety of commands and tooling to perform the same fundamental tasks — building, testing, linting, and deploying. This diversity is amplified across language ecosystems, meaning developers must re-learn project-specific conventions every time they switch contexts. CI pipelines suffer from the same fragmentation, each one requiring bespoke scripts.
|
|
11
11
|
|
|
12
|
-
What standard set of
|
|
12
|
+
What standard set of Makefile target names and execution rules should projects adopt so that any developer or CI pipeline can immediately operate on any project without needing to read documentation first?
|
|
13
13
|
|
|
14
14
|
## Decision Outcome
|
|
15
15
|
|
|
16
|
-
**Every project must expose its development actions using a defined set of standardized
|
|
16
|
+
**Every project must expose its development actions through a root `Makefile` using a defined set of standardized target names. Makefile recipes must run explicit tool commands through `mise exec --`, so developers and CI use the same entry point and can see the real command path without extra script indirection.**
|
|
17
17
|
|
|
18
|
-
Standardizing
|
|
18
|
+
Standardizing both the target names and the execution chain removes per-project guesswork, makes CI pipelines reusable, and keeps tooling behavior visible in one place.
|
|
19
19
|
|
|
20
20
|
### Implementation Details
|
|
21
21
|
|
|
22
|
-
#### 1. Every project MUST have a root
|
|
22
|
+
#### 1. Every project MUST have a root `Makefile` exposing the standard target names
|
|
23
23
|
|
|
24
|
-
The project root must contain a single authoritative
|
|
24
|
+
The project root must contain a single authoritative `Makefile` that exposes the standard target names defined in rule 3. Developers and CI pipelines must invoke routine actions through this `Makefile`, never by calling underlying tools directly in documentation, CI, or daily workflow commands.
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
`make <target>` is the shared contract across projects and languages.
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
- The root `Makefile` must be the entry point for both developers and pipelines.
|
|
29
|
+
- The root `Makefile` must expose at minimum the common targets defined in this XDR.
|
|
30
|
+
- Reverse-compatibility wrappers are allowed when an ecosystem expects them, but they must stay trivial.
|
|
31
|
+
- Allowed: `package.json` script `"test": "make test"`
|
|
32
|
+
- Not allowed: `make test` -> `npm run test` -> tool command
|
|
33
|
+
- Project logic must not live in npm scripts, Mise tasks, shell wrappers, or other secondary runners when the same logic belongs in the `Makefile`.
|
|
29
34
|
|
|
30
|
-
|
|
31
|
-
|--------|--------------------|------------------|
|
|
32
|
-
| Makefile | `make build` | Default; recommended for all projects |
|
|
33
|
-
| npm scripts | `npm run build` | Pure Node.js/frontend projects without a Makefile |
|
|
34
|
-
| Shell script | `./dev.sh build` | Projects where `make` is unavailable or impractical |
|
|
35
|
-
| Other (Taskfile, just, etc.) | `task build` | When agreed upon at the project or org level |
|
|
35
|
+
*Why:* The project entry point must stay language-agnostic and obvious. A developer should be able to inspect the `Makefile` and immediately see which real tool commands will run.
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
#### 2. Makefile recipes MUST use the explicit tool-execution chain
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
After a checkout, the only assumed prerequisites are `make` and [Mise](https://mise.jdx.dev/). The standard execution flow is:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
make <target>
|
|
43
|
+
-> Makefile recipe
|
|
44
|
+
-> mise exec -- <tool> [tool arguments]
|
|
45
|
+
-> explicit tool command
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- The `setup` target must run `mise install` and any small project-specific bootstrap needed before normal targets work.
|
|
49
|
+
- Routine targets such as `build`, `lint`, `test`, `run`, and `publish` must be invoked as `make <target>` by both contributors and CI.
|
|
50
|
+
- Each Makefile recipe must call the real underlying command directly through `mise exec --`.
|
|
51
|
+
- Makefile recipes must not add extra script layers such as `npm run`, `pnpm run`, `yarn run`, `mise run`, `mise tasks`, or shell aliases when those layers only forward to another command.
|
|
52
|
+
- Calling the actual tool is allowed even when that tool itself launches another program as part of its normal interface.
|
|
53
|
+
- Allowed: `mise exec -- pnpm exec eslint ./src`
|
|
54
|
+
- Allowed: `mise exec -- go test -cover ./...`
|
|
55
|
+
- Allowed: `mise exec -- uv run --project . pytest`
|
|
56
|
+
- Disallowed: `mise exec -- pnpm run lint`
|
|
57
|
+
- Disallowed: `mise run lint`
|
|
58
|
+
- Disallowed: `make lint` implemented as `./scripts/lint.sh` when the shell script only forwards to one visible tool command
|
|
59
|
+
|
|
60
|
+
*Why:* This keeps the execution path inspectable, avoids hidden logic spread across multiple scripting systems, and makes CI behave the same way as local development.
|
|
40
61
|
|
|
41
62
|
---
|
|
42
63
|
|
|
43
|
-
####
|
|
64
|
+
#### 3. Standard target groups and names
|
|
44
65
|
|
|
45
|
-
|
|
66
|
+
Targets are organized into five lifecycle groups. Projects must use these names unchanged. Extensions are allowed (see rule 5) but the core names must not be repurposed.
|
|
46
67
|
|
|
47
68
|
##### Developer group
|
|
48
69
|
|
|
49
|
-
|
|
|
70
|
+
| Target | Purpose |
|
|
50
71
|
|--------|---------|
|
|
51
|
-
| `setup` |
|
|
72
|
+
| `setup` | Run `mise install` and any small project bootstrap needed before normal targets work. This is the first command after checkout. |
|
|
52
73
|
| `all` | Alias that runs `build`, `lint`, and `test` in sequence. Must be the default target (i.e., running `make` or the runner with no arguments invokes `all`). Used by developers as a fast pre-push check to verify the software meets minimum quality standards in one command. |
|
|
53
74
|
| `clean` | Remove all temporary or generated files created during build, lint, or test (e.g., `node_modules`, virtual environments, compiled binaries, generated files). Used both locally and in CI for a clean slate. |
|
|
54
75
|
| `dev` | Run the software locally for development (e.g., start a Node.js API server, open a Jupyter notebook, launch a React dev server). May have debugging tools, verbose logging, or hot reloading features enabled. |
|
|
@@ -57,7 +78,7 @@ Scripts are organized into five lifecycle groups. Projects must use these names
|
|
|
57
78
|
|
|
58
79
|
##### Build group
|
|
59
80
|
|
|
60
|
-
|
|
|
81
|
+
| Target | Purpose |
|
|
61
82
|
|--------|---------|
|
|
62
83
|
| `build` | Install dependencies, compile, and package the software. The full `install → compile → package` workflow. |
|
|
63
84
|
| `install` | Download and install all project dependencies. Assumes the language runtime is already available (installed via `setup`). |
|
|
@@ -67,13 +88,13 @@ Scripts are organized into five lifecycle groups. Projects must use these names
|
|
|
67
88
|
|
|
68
89
|
##### Lint group
|
|
69
90
|
|
|
70
|
-
|
|
|
91
|
+
| Target | Purpose |
|
|
71
92
|
|--------|---------|
|
|
72
93
|
| `lint` | Run **all static quality checks** outside of tests. This MUST include: code formatting validation, code style enforcement, code smell detection, static analysis, dependency audits for known CVEs, security vulnerability scans (e.g., SAST), and project/configuration structure checks. All checks must be non-destructive (read-only); fixes are handled by `lint-fix`. |
|
|
73
94
|
| `lint-fix` | Automatically fix linting and formatting issues where possible. || `lint-format` | *(Optional)* Check code formatting only (e.g., Prettier, gofmt, Black). |
|
|
74
95
|
##### Test group
|
|
75
96
|
|
|
76
|
-
|
|
|
97
|
+
| Target | Purpose |
|
|
77
98
|
|--------|---------|
|
|
78
99
|
| `test` | Run **all tests** required for the project. This MUST include unit tests (with coverage enforcement — the build MUST fail if coverage thresholds are not met) and integration/end-to-end tests. Normally delegates to `test-unit` and `test-integration` in sequence. |
|
|
79
100
|
| `test-unit` | Run unit tests only, including coverage report generation and coverage threshold enforcement. |
|
|
@@ -82,7 +103,7 @@ Scripts are organized into five lifecycle groups. Projects must use these names
|
|
|
82
103
|
|
|
83
104
|
##### Release group
|
|
84
105
|
|
|
85
|
-
|
|
|
106
|
+
| Target | Purpose |
|
|
86
107
|
|--------|---------|
|
|
87
108
|
| `release` | Determine the next version (e.g., via semantic versioning and git tags), generate changelogs and release notes, tag the repository, and create a release artifact. Normally invokes `docgen`. |
|
|
88
109
|
| `docgen` | Generate documentation (API docs, static sites, changelogs, example outputs). |
|
|
@@ -103,9 +124,9 @@ Two environment variables have defined semantics and must be used consistently.
|
|
|
103
124
|
|
|
104
125
|
---
|
|
105
126
|
|
|
106
|
-
####
|
|
127
|
+
#### 5. Extending targets with prefixes
|
|
107
128
|
|
|
108
|
-
Projects may add custom
|
|
129
|
+
Projects may add custom targets beyond the standard set. Custom targets must be named by prefixing a standard target name with a descriptive qualifier, keeping the naming intuitive and consistent with the group it belongs to.
|
|
109
130
|
|
|
110
131
|
**Examples:**
|
|
111
132
|
|
|
@@ -121,13 +142,13 @@ start-debugger # launch the software with a visual debugger attached
|
|
|
121
142
|
deploy-infra # deploy only the infrastructure layer
|
|
122
143
|
```
|
|
123
144
|
|
|
124
|
-
The prefix convention ensures developers can infer the purpose of any
|
|
145
|
+
The prefix convention ensures developers can infer the purpose of any target without documentation.
|
|
125
146
|
|
|
126
147
|
---
|
|
127
148
|
|
|
128
|
-
####
|
|
149
|
+
#### 6. Monorepo usage
|
|
129
150
|
|
|
130
|
-
In a monorepo, each module has its own `Makefile` with its own `build`, `lint`, `test`, and `deploy` targets scoped to that module. Parent-level Makefiles (at the application or repo root) delegate to
|
|
151
|
+
In a monorepo, each module has its own `Makefile` with its own `build`, `lint`, `test`, and `deploy` targets scoped to that module. Parent-level Makefiles (at the application or repo root) delegate to child Makefiles in sequence. The parent Makefile should call `$(MAKE) -C <child> <target>` directly, while each child `Makefile` runs its actual tool commands through `mise exec --`.
|
|
131
152
|
|
|
132
153
|
```makefile
|
|
133
154
|
# root Makefile — delegates to all modules
|
|
@@ -146,12 +167,12 @@ A developer can run `make test` at the repo root to test everything, or `cd modu
|
|
|
146
167
|
|
|
147
168
|
---
|
|
148
169
|
|
|
149
|
-
####
|
|
170
|
+
#### 7. Quick-reference — commands a developer can always rely on
|
|
150
171
|
|
|
151
|
-
Any project following this EDR supports the following actions
|
|
172
|
+
Any project following this EDR supports the following actions through the root `Makefile`.
|
|
152
173
|
|
|
153
174
|
```sh
|
|
154
|
-
# install
|
|
175
|
+
# install the pinned toolchain and project bootstrap
|
|
155
176
|
make setup
|
|
156
177
|
|
|
157
178
|
# build the software (install deps, compile, package)
|
|
@@ -188,25 +209,13 @@ make clean
|
|
|
188
209
|
make all
|
|
189
210
|
```
|
|
190
211
|
|
|
191
|
-
**Equivalent examples for npm scripts and shell:**
|
|
192
|
-
|
|
193
|
-
```sh
|
|
194
|
-
# npm scripts (package.json)
|
|
195
|
-
npm run build
|
|
196
|
-
npm run test
|
|
197
|
-
npm run lint
|
|
198
|
-
STAGE=dev npm run deploy
|
|
199
|
-
|
|
200
|
-
# shell wrapper
|
|
201
|
-
./dev.sh build
|
|
202
|
-
./dev.sh test
|
|
203
|
-
STAGE=dev ./dev.sh deploy
|
|
204
|
-
```
|
|
205
|
-
|
|
206
212
|
## Considered Options
|
|
207
213
|
|
|
208
|
-
* (REJECTED) **Language-native entry points only** - Use `npm run`, `python -m`, `go run
|
|
214
|
+
* (REJECTED) **Language-native entry points only** - Use `npm run`, `python -m`, `go run`, and similar tool-specific commands directly as the standard surface
|
|
209
215
|
* Reason: Ties CI pipelines and developer muscle memory to language-specific tooling; breaks the abstraction when the underlying tool changes; target names vary per ecosystem
|
|
210
216
|
|
|
211
|
-
* (
|
|
212
|
-
|
|
217
|
+
* (REJECTED) **Runner-agnostic targets with multiple primary runners** - Keep the target names standard but allow Makefile, npm scripts, shell wrappers, or other runners as equivalent first-class entry points
|
|
218
|
+
* Reason: Preserves naming consistency but still spreads behavior across multiple scripting systems, which hides the real command path and weakens CI standardization.
|
|
219
|
+
|
|
220
|
+
* (CHOSEN) **Standardized Makefile targets with Mise-managed explicit tool execution** - Use `make <target>` as the only routine entry point, keep target names standard, and run the actual underlying tool commands through `mise exec --`
|
|
221
|
+
* Reason: This keeps names, execution flow, and tool versions equally predictable while avoiding script indirection.
|
|
@@ -14,11 +14,11 @@ metadata:
|
|
|
14
14
|
## Overview
|
|
15
15
|
|
|
16
16
|
Creates or extends a monorepo that follows the standard layout from [agentme-edr-005](../../005-monorepo-structure.md):
|
|
17
|
-
top-level application folders,
|
|
18
|
-
level so any contributor can build, lint, and
|
|
19
|
-
predictable command.
|
|
17
|
+
top-level application folders, independent module roots, sibling example and multi-module test
|
|
18
|
+
areas, Mise-managed tooling, and Makefiles at every level so any contributor can build, lint, and
|
|
19
|
+
test any part of the monorepo with a single, predictable command.
|
|
20
20
|
|
|
21
|
-
Related EDRs: [agentme-edr-005](../../005-monorepo-structure.md), [agentme-edr-013](../../../governance/013-contributing-guide-requirements.md)
|
|
21
|
+
Related EDRs: [agentme-edr-005](../../005-monorepo-structure.md), [agentme-edr-013](../../../governance/013-contributing-guide-requirements.md), [agentme-edr-016](../../../principles/016-cross-language-module-structure.md)
|
|
22
22
|
|
|
23
23
|
## Instructions
|
|
24
24
|
|
|
@@ -51,10 +51,12 @@ golangci-lint = "1.57"
|
|
|
51
51
|
Coordinates `build`, `lint`, and `test` across all applications. Also exposes a `setup` target.
|
|
52
52
|
|
|
53
53
|
```makefile
|
|
54
|
-
.PHONY: build lint test setup
|
|
54
|
+
.PHONY: all build lint test clean setup
|
|
55
55
|
|
|
56
56
|
APPS := <app1> <app2> # replace with actual application names
|
|
57
57
|
|
|
58
|
+
all: build lint test
|
|
59
|
+
|
|
58
60
|
build:
|
|
59
61
|
$(foreach app,$(APPS),$(MAKE) -C $(app) build &&) true
|
|
60
62
|
|
|
@@ -64,12 +66,25 @@ lint:
|
|
|
64
66
|
test:
|
|
65
67
|
$(foreach app,$(APPS),$(MAKE) -C $(app) test &&) true
|
|
66
68
|
|
|
69
|
+
clean:
|
|
70
|
+
$(foreach app,$(APPS),$(MAKE) -C $(app) clean &&) true
|
|
71
|
+
rm -rf .cache
|
|
72
|
+
|
|
67
73
|
setup:
|
|
68
74
|
@echo "Install Mise: https://mise.jdx.dev/getting-started.html"
|
|
69
75
|
@echo "Then run: mise install"
|
|
70
76
|
@echo "See README.md for full setup instructions."
|
|
71
77
|
```
|
|
72
78
|
|
|
79
|
+
#### Root `.gitignore`
|
|
80
|
+
|
|
81
|
+
Must ignore shared artifact and cache folders:
|
|
82
|
+
|
|
83
|
+
```gitignore
|
|
84
|
+
dist/
|
|
85
|
+
.cache/
|
|
86
|
+
```
|
|
87
|
+
|
|
73
88
|
#### Root `README.md`
|
|
74
89
|
|
|
75
90
|
Must include four sections:
|
|
@@ -162,10 +177,12 @@ For each application:
|
|
|
162
177
|
3. **Create `<app>/Makefile`** that delegates to each module:
|
|
163
178
|
|
|
164
179
|
```makefile
|
|
165
|
-
.PHONY: build lint test
|
|
180
|
+
.PHONY: all build lint test clean
|
|
166
181
|
|
|
167
182
|
MODULES := <module1> <module2> # replace with actual module names
|
|
168
183
|
|
|
184
|
+
all: build lint test
|
|
185
|
+
|
|
169
186
|
build:
|
|
170
187
|
$(foreach mod,$(MODULES),$(MAKE) -C $(mod) build &&) true
|
|
171
188
|
|
|
@@ -174,10 +191,16 @@ For each application:
|
|
|
174
191
|
|
|
175
192
|
test:
|
|
176
193
|
$(foreach mod,$(MODULES),$(MAKE) -C $(mod) test &&) true
|
|
194
|
+
|
|
195
|
+
clean:
|
|
196
|
+
$(foreach mod,$(MODULES),$(MAKE) -C $(mod) clean &&) true
|
|
197
|
+
rm -rf .cache
|
|
177
198
|
```
|
|
178
199
|
|
|
179
200
|
4. **Create `<app>/shared/`** — leave empty if no cross-module shared code exists yet.
|
|
180
201
|
|
|
202
|
+
5. **Create sibling aggregation folders when needed**: `<app>/examples/`, `<app>/tests_integration/`, and `<app>/tests_benchmark/` for artifacts that apply to multiple modules.
|
|
203
|
+
|
|
181
204
|
---
|
|
182
205
|
|
|
183
206
|
### Phase 5: Scaffold each module
|
|
@@ -186,51 +209,70 @@ For each module inside an application:
|
|
|
186
209
|
|
|
187
210
|
1. **Create the module folder** using lowercase, hyphen-separated names (e.g., `data-loader`).
|
|
188
211
|
|
|
189
|
-
2. **Create `<app>/<module>/
|
|
212
|
+
2. **Create `<app>/<module>/README.md`** with consumer usage first and short developer commands at the end.
|
|
213
|
+
|
|
214
|
+
3. **Create `<app>/<module>/Makefile`** with the common targets, adapted to the module's language. Redirect persistent caches into `.cache/` and write distributable artifacts to `dist/`.
|
|
190
215
|
|
|
191
216
|
**Go:**
|
|
192
217
|
```makefile
|
|
193
|
-
.PHONY: build lint test
|
|
218
|
+
.PHONY: all build lint test clean
|
|
219
|
+
|
|
220
|
+
all: build lint test
|
|
194
221
|
|
|
195
222
|
build:
|
|
196
|
-
|
|
223
|
+
mise exec -- go build ./...
|
|
197
224
|
|
|
198
225
|
lint:
|
|
199
|
-
|
|
226
|
+
mise exec -- golangci-lint run ./...
|
|
200
227
|
|
|
201
228
|
test:
|
|
202
|
-
|
|
229
|
+
mise exec -- go test ./... -cover
|
|
230
|
+
|
|
231
|
+
clean:
|
|
232
|
+
rm -rf dist .cache
|
|
203
233
|
```
|
|
204
234
|
|
|
205
235
|
**Node.js / TypeScript:**
|
|
206
236
|
```makefile
|
|
207
|
-
.PHONY: build lint test
|
|
237
|
+
.PHONY: all build lint test clean
|
|
238
|
+
|
|
239
|
+
all: build lint test
|
|
208
240
|
|
|
209
241
|
build:
|
|
210
|
-
|
|
242
|
+
mise exec -- pnpm exec tsc --project tsconfig.json
|
|
211
243
|
|
|
212
244
|
lint:
|
|
213
|
-
|
|
245
|
+
mise exec -- pnpm exec eslint ./src
|
|
214
246
|
|
|
215
247
|
test:
|
|
216
|
-
|
|
248
|
+
mise exec -- pnpm exec jest --verbose
|
|
249
|
+
|
|
250
|
+
clean:
|
|
251
|
+
rm -rf dist .cache
|
|
217
252
|
```
|
|
218
253
|
|
|
219
254
|
**Python:**
|
|
220
255
|
```makefile
|
|
221
|
-
.PHONY: build lint test
|
|
256
|
+
.PHONY: all build lint test clean
|
|
257
|
+
|
|
258
|
+
all: build lint test
|
|
222
259
|
|
|
223
260
|
build:
|
|
224
|
-
|
|
261
|
+
mise exec -- uv build --project . --out-dir dist
|
|
225
262
|
|
|
226
263
|
lint:
|
|
227
|
-
|
|
264
|
+
mise exec -- uv run --project . ruff check .
|
|
228
265
|
|
|
229
266
|
test:
|
|
230
|
-
|
|
267
|
+
mise exec -- uv run --project . pytest
|
|
268
|
+
|
|
269
|
+
clean:
|
|
270
|
+
rm -rf dist .cache
|
|
231
271
|
```
|
|
232
272
|
|
|
233
|
-
|
|
273
|
+
4. **Add source files** appropriate to the language, placing them inside the module folder.
|
|
274
|
+
|
|
275
|
+
5. **Place module-specific integration tests and benchmarks predictably**: `<module>/tests_integration/` and `<module>/tests_benchmark/` when they are not co-located by language convention.
|
|
234
276
|
|
|
235
277
|
---
|
|
236
278
|
|
|
@@ -242,8 +284,10 @@ After scaffolding, run the following checks and fix any issues:
|
|
|
242
284
|
- `make lint` at the repository root passes.
|
|
243
285
|
- `make test` at the repository root passes.
|
|
244
286
|
- All folder and file names are lowercase and use hyphens.
|
|
287
|
+
- The root `.gitignore` ignores `dist/` and `.cache/`.
|
|
245
288
|
- A `CONTRIBUTING.md` exists at the repository root and covers bugs, feature discussions, pull requests, Conventional Comments, and small focused changes.
|
|
246
289
|
- Every application folder has a `README.md` covering all four required sections.
|
|
290
|
+
- Every module folder has a `README.md`, `Makefile`, `dist/` location, and `.cache/` strategy.
|
|
247
291
|
- A `.mise.toml` exists at the repository root with all required tool versions pinned.
|
|
248
292
|
|
|
249
293
|
---
|
|
@@ -256,8 +300,10 @@ After scaffolding, run the following checks and fix any issues:
|
|
|
256
300
|
pcb-devices/
|
|
257
301
|
├── README.md
|
|
258
302
|
├── Makefile
|
|
303
|
+
├── examples/
|
|
259
304
|
├── shared/
|
|
260
305
|
└── firmware/
|
|
306
|
+
├── README.md
|
|
261
307
|
└── Makefile
|
|
262
308
|
```
|
|
263
309
|
|
|
@@ -13,6 +13,7 @@ Foundational standards, principles, and guidelines.
|
|
|
13
13
|
- [agentme-edr-007](principles/007-project-quality-standards.md) - **Project quality standards**
|
|
14
14
|
- [agentme-edr-009](principles/009-error-handling.md) - **Error handling**
|
|
15
15
|
- [agentme-edr-012](principles/012-continuous-xdr-enrichment.md) - **Continuous xdr improvement policy**
|
|
16
|
+
- [agentme-edr-016](principles/016-cross-language-module-structure.md) - **Cross-language module structure**
|
|
16
17
|
|
|
17
18
|
## Articles
|
|
18
19
|
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agentme-edr-016-cross-language-module-structure
|
|
3
|
+
description: Defines the baseline module-root structure, artifact locations, cache placement, README expectations, examples layout, and test folder conventions across languages. Use when creating or reviewing buildable modules.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# agentme-edr-016: Cross-language module structure
|
|
7
|
+
|
|
8
|
+
## Context and Problem Statement
|
|
9
|
+
|
|
10
|
+
The language-specific tooling EDRs currently describe similar module layouts in different ways, which causes drift in example placement, cache folders, README expectations, and test organization.
|
|
11
|
+
|
|
12
|
+
What baseline structure rules must every buildable module follow regardless of language?
|
|
13
|
+
|
|
14
|
+
## Decision Outcome
|
|
15
|
+
|
|
16
|
+
**Standardize every buildable module around its own folder root, with `dist/`, `.cache/`, sibling consumer examples, a module README, and predictable test locations.**
|
|
17
|
+
|
|
18
|
+
Language-specific EDRs may add ecosystem details, but they must not redefine these baseline folder responsibilities.
|
|
19
|
+
|
|
20
|
+
### Implementation Details
|
|
21
|
+
|
|
22
|
+
#### 1. Every buildable or publishable module MUST own its folder root
|
|
23
|
+
|
|
24
|
+
A module is the smallest independently buildable, testable, or publishable unit. It MUST live in its own folder and that folder MUST contain:
|
|
25
|
+
|
|
26
|
+
- a `Makefile` following [agentme-edr-008](../devops/008-common-targets.md)
|
|
27
|
+
- a `README.md` for the module itself
|
|
28
|
+
- all configuration files required to build, lint, test, package, or publish that module
|
|
29
|
+
- its generated `dist/` directory when the module produces distributable artifacts
|
|
30
|
+
- a module-local `.cache/` when tool caches are not intentionally shared with a parent aggregation root
|
|
31
|
+
|
|
32
|
+
Example module root:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
<module>/
|
|
36
|
+
├── Makefile
|
|
37
|
+
├── README.md
|
|
38
|
+
├── dist/
|
|
39
|
+
├── .cache/
|
|
40
|
+
└── ... language-specific sources and config ...
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### 2. Parent folders are aggregation roots, not hidden implementation buckets
|
|
44
|
+
|
|
45
|
+
Parent folders such as a repository root, an application folder, or `lib/` may aggregate multiple modules. They may also hold shared consumer examples or multi-module test harnesses.
|
|
46
|
+
|
|
47
|
+
They MUST keep the public aggregation obvious: deleting an aggregation folder should remove a coherent API surface or entry-point area, not scatter unrelated internal implementation across the repository.
|
|
48
|
+
|
|
49
|
+
Recommended aggregation pattern:
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
<parent>/
|
|
53
|
+
├── <module-a>/
|
|
54
|
+
├── <module-b>/
|
|
55
|
+
├── examples/
|
|
56
|
+
├── tests_integration/
|
|
57
|
+
└── tests_benchmark/
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
#### 3. Build and publish outputs MUST go to `dist/`
|
|
61
|
+
|
|
62
|
+
Distributable outputs such as packages, wheels, archives, generated binaries, or packed example inputs MUST be written under the module's `dist/` folder.
|
|
63
|
+
|
|
64
|
+
`dist/` MUST be gitignored.
|
|
65
|
+
|
|
66
|
+
#### 4. Persistent tool caches MUST live under `.cache/`
|
|
67
|
+
|
|
68
|
+
Tool-generated caches and disposable machine-local state MUST be redirected into the nearest intended `.cache/` folder, either at monorepo level or module level.
|
|
69
|
+
|
|
70
|
+
Examples include:
|
|
71
|
+
|
|
72
|
+
- linter caches
|
|
73
|
+
- test runner caches
|
|
74
|
+
- transpiler incremental state
|
|
75
|
+
- formatter caches
|
|
76
|
+
- dependency-manager caches when local caching is desired
|
|
77
|
+
|
|
78
|
+
If a tool cannot natively choose its cache path, the module `Makefile` MUST wrap or clean that tool so persistent cache files do not remain scattered outside `.cache/` after standard targets run.
|
|
79
|
+
|
|
80
|
+
`.cache/` MUST be gitignored.
|
|
81
|
+
|
|
82
|
+
#### 5. Consumer examples MUST sit outside the module they exercise
|
|
83
|
+
|
|
84
|
+
Examples that demonstrate how to consume a library or reusable module MUST live in a sibling `examples/` folder under the nearest aggregation root, not inside the module folder itself.
|
|
85
|
+
|
|
86
|
+
Examples MUST exercise the module through its public distribution surface:
|
|
87
|
+
|
|
88
|
+
- use the package built into `dist/` when the ecosystem supports local packaged artifacts
|
|
89
|
+
- otherwise use the public module path or equivalent consumer-facing import surface, never relative source-file imports or direct references to internal implementation paths
|
|
90
|
+
|
|
91
|
+
Example:
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
lib/
|
|
95
|
+
└── mymodule/
|
|
96
|
+
|
|
97
|
+
examples/
|
|
98
|
+
└── using-mymodule/
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### 6. Every module README MUST explain both usage and development
|
|
102
|
+
|
|
103
|
+
Each module MUST contain a `README.md` that shows how to use the module as a consumer.
|
|
104
|
+
|
|
105
|
+
The end of the README MUST also include short developer instructions for that module, covering at least the standard build, lint, and test entry points.
|
|
106
|
+
|
|
107
|
+
Repository-level READMEs may describe the workspace, but they do not replace the module README.
|
|
108
|
+
|
|
109
|
+
#### 7. Unit, integration, and benchmark tests use predictable locations
|
|
110
|
+
|
|
111
|
+
Unit tests SHOULD be co-located with the file they exercise when that is idiomatic and common for the language.
|
|
112
|
+
|
|
113
|
+
When co-location is uncommon or awkward for the ecosystem, unit tests SHOULD live under `<module>/tests/`.
|
|
114
|
+
|
|
115
|
+
Integration tests MUST live in one of these locations:
|
|
116
|
+
|
|
117
|
+
- `<module>/tests_integration/` when they cover one module
|
|
118
|
+
- `<parent>/tests_integration/` when they cover multiple sibling modules
|
|
119
|
+
|
|
120
|
+
Benchmark tests MUST live in one of these locations:
|
|
121
|
+
|
|
122
|
+
- co-located with the source when the language has a first-class benchmark convention there
|
|
123
|
+
- `<module>/tests_benchmark/` for module-specific harnesses or datasets
|
|
124
|
+
- `<parent>/tests_benchmark/` when they cover multiple sibling modules
|
|
125
|
+
|
|
126
|
+
#### 8. Module Makefiles MUST expose the shared target vocabulary
|
|
127
|
+
|
|
128
|
+
Every module `Makefile` MUST expose the common target names from [agentme-edr-008](../devops/008-common-targets.md). At minimum, modules MUST provide `build`, `lint`, and `test`, and SHOULD also provide `all`, `clean`, and `lint-fix` when meaningful.
|
|
129
|
+
|
|
130
|
+
## References
|
|
131
|
+
|
|
132
|
+
- [agentme-edr-005](../devops/005-monorepo-structure.md) - Monorepo aggregation and delegation rules
|
|
133
|
+
- [agentme-edr-008](../devops/008-common-targets.md) - Shared Makefile target names
|
package/README.md
CHANGED
|
@@ -80,27 +80,25 @@ This is useful when you want to:
|
|
|
80
80
|
|
|
81
81
|
## Development
|
|
82
82
|
|
|
83
|
-
Install [Mise](https://mise.jdx.dev/getting-started.html), then
|
|
83
|
+
Install [Mise](https://mise.jdx.dev/getting-started.html), then bootstrap the repository through the root `Makefile`:
|
|
84
84
|
|
|
85
85
|
```sh
|
|
86
|
-
|
|
86
|
+
make setup
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
Use the root `Makefile` as the entry point for local verification
|
|
89
|
+
Use the root `Makefile` as the entry point for local verification:
|
|
90
90
|
|
|
91
91
|
```sh
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
make build
|
|
93
|
+
make lint
|
|
94
|
+
make test
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
Running `make build`, `make lint`, or `make test` from an already activated Mise shell is equivalent.
|
|
98
|
-
|
|
99
97
|
What these targets do:
|
|
100
98
|
|
|
101
|
-
- `
|
|
102
|
-
- `
|
|
103
|
-
- `
|
|
99
|
+
- `make build` installs dependencies and creates a local npm package in `dist/`.
|
|
100
|
+
- `make lint` runs the repository lint target.
|
|
101
|
+
- `make test` rebuilds the package and validates the consumer extraction flow through the runnable example in `examples/`.
|
|
104
102
|
|
|
105
103
|
## Repository Map
|
|
106
104
|
|