agentme 0.3.1 → 0.3.3
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.
|
@@ -8,7 +8,7 @@ What tooling and project structure should JavaScript/TypeScript projects follow
|
|
|
8
8
|
|
|
9
9
|
## Decision Outcome
|
|
10
10
|
|
|
11
|
-
**Use pnpm, tsc, esbuild, eslint, and jest
|
|
11
|
+
**Use a Mise-managed Node.js and pnpm toolchain together with pnpm, tsc, esbuild, eslint, and jest in a standard layout separating library code (`lib/`) from runnable usage examples (`examples/`), coordinated by root-level Makefiles.**
|
|
12
12
|
|
|
13
13
|
Clear, consistent tooling and layout enable fast onboarding, reliable CI pipelines, and a predictable developer experience across projects.
|
|
14
14
|
|
|
@@ -18,30 +18,40 @@ Clear, consistent tooling and layout enable fast onboarding, reliable CI pipelin
|
|
|
18
18
|
|
|
19
19
|
| Tool | Purpose |
|
|
20
20
|
|------|---------|
|
|
21
|
+
| **Mise** | Tool version management for Node.js, pnpm, and project CLIs |
|
|
21
22
|
| **pnpm** | Package manager — strict linking, workspace support, fast installs |
|
|
22
23
|
| **tsc** | TypeScript compilation — type checking, declaration generation |
|
|
23
24
|
| **esbuild** | Bundling — fast bundling for distribution or single-binary outputs |
|
|
24
25
|
| **eslint** | Linting — code style and quality enforcement |
|
|
25
26
|
| **jest** | Testing — unit and integration test runner |
|
|
26
27
|
|
|
27
|
-
All commands are run exclusively through Makefiles, not through `package.json` scripts.
|
|
28
|
+
All commands are run exclusively through Makefiles, not through `package.json` scripts. The repository root must define a `.mise.toml` that pins at least Node.js and pnpm, and Makefile targets must run through `mise exec --` or an activated Mise shell.
|
|
28
29
|
|
|
29
30
|
#### ESLint
|
|
30
31
|
|
|
31
|
-
Use
|
|
32
|
+
Use `lib/eslint.config.mjs` as the ESLint entry point and configure it with `@stutzlab/eslint-config` plus `FlatCompat` from `@eslint/eslintrc`. Keep `package.json` in CommonJS mode without adding `"type": "module"`.
|
|
33
|
+
|
|
34
|
+
In flat-config mode, Makefile lint targets MUST NOT use `--ext`; file matching is defined in `eslint.config.mjs` instead. The flat config MUST declare TypeScript file globs such as `src/**/*.ts` and point `parserOptions.project` to `./tsconfig.json`.
|
|
35
|
+
|
|
36
|
+
#### TypeScript and Jest
|
|
37
|
+
|
|
38
|
+
Use a single `lib/tsconfig.json` for both build and type-aware linting. Keep co-located `*.test.ts` files included in that config so ESLint can resolve them through `parserOptions.project`, and rely on the Makefile cleanup step to remove compiled test artifacts from `dist/` after `tsc` runs.
|
|
39
|
+
|
|
40
|
+
When `tsconfig.json` extends `@tsconfig/node24/tsconfig.json`, the default `module` is `nodenext`. `ts-jest` still runs in CommonJS mode by default, so `lib/jest.config.js` MUST configure the `ts-jest` transform with an inline `tsconfig` override that sets `module: 'commonjs'`. Do not use the deprecated `globals['ts-jest']` configuration style.
|
|
32
41
|
|
|
33
42
|
#### Project structure
|
|
34
43
|
|
|
35
44
|
```
|
|
36
45
|
/ # workspace root
|
|
46
|
+
├── .mise.toml # pinned Node.js and pnpm versions
|
|
37
47
|
├── Makefile # delegates build/lint/test to /lib and /examples
|
|
38
48
|
├── README.md # Quick Start first; used as npm registry page
|
|
39
49
|
├── lib/ # the published npm package
|
|
40
50
|
│ ├── Makefile # build, lint, test, publish targets
|
|
41
51
|
│ ├── package.json # package manifest
|
|
42
|
-
│ ├── tsconfig.json # TypeScript config
|
|
52
|
+
│ ├── tsconfig.json # TypeScript config for build and linting
|
|
43
53
|
│ ├── jest.config.js # Jest config
|
|
44
|
-
│ ├── eslint.config.
|
|
54
|
+
│ ├── eslint.config.mjs # ESLint config (ESLint 9 flat config)
|
|
45
55
|
│ └── src/ # all TypeScript source files
|
|
46
56
|
│ ├── index.ts # public API re-exports
|
|
47
57
|
│ └── *.test.ts # test files co-located with source
|
|
@@ -53,7 +63,9 @@ Use `@stutzlab/eslint-config` as the base ESLint config. Use ESLint 9 flat confi
|
|
|
53
63
|
└── package.json
|
|
54
64
|
```
|
|
55
65
|
|
|
56
|
-
The root `Makefile` delegates every target to `/lib` then `/examples` in sequence.
|
|
66
|
+
The root `Makefile` delegates every target to `/lib` then `/examples` in sequence and is expected to execute module commands inside the repository's Mise-managed environment.
|
|
67
|
+
|
|
68
|
+
The commands below assume they are invoked through `mise exec -- make <target>` or from an activated Mise shell.
|
|
57
69
|
|
|
58
70
|
#### lib/Makefile targets
|
|
59
71
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: 001-create-javascript-project
|
|
3
3
|
description: >
|
|
4
4
|
Scaffolds the initial boilerplate structure for a JavaScript/TypeScript library project following
|
|
5
|
-
the standard tooling and layout defined in
|
|
5
|
+
the standard tooling and layout defined in agentme-edr-003. Activate this skill when the user
|
|
6
6
|
asks to create, scaffold, or initialize a new JavaScript or TypeScript library project, npm
|
|
7
7
|
package, or similar project structure.
|
|
8
8
|
metadata:
|
|
@@ -42,27 +42,30 @@ Delegates every make target to `/lib` then `/examples` in sequence:
|
|
|
42
42
|
|
|
43
43
|
```makefile
|
|
44
44
|
SHELL := /bin/bash
|
|
45
|
+
MISE := mise exec --
|
|
45
46
|
%:
|
|
46
47
|
@echo ''
|
|
47
48
|
@echo '>>> Running /lib:$@...'
|
|
48
|
-
|
|
49
|
+
@$(MISE) $(MAKE) -C lib $@
|
|
49
50
|
@echo ''
|
|
50
51
|
@echo '>>> Running /examples:$@...'
|
|
51
|
-
|
|
52
|
+
@STAGE=dev $(MISE) $(MAKE) -C examples $@
|
|
52
53
|
|
|
53
54
|
publish:
|
|
54
|
-
|
|
55
|
+
@$(MISE) $(MAKE) -C lib publish
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
setup:
|
|
58
|
+
mise install
|
|
58
59
|
```
|
|
59
60
|
|
|
60
|
-
**`./.
|
|
61
|
+
**`./.mise.toml`**
|
|
61
62
|
|
|
62
63
|
```
|
|
63
|
-
|
|
64
|
+
[tools]
|
|
65
|
+
node = "24.0.0"
|
|
66
|
+
pnpm = "10.14.0"
|
|
64
67
|
```
|
|
65
|
-
(Replace `24` with the chosen Node.js version.)
|
|
68
|
+
(Replace `24.0.0` with the chosen Node.js version and pin any additional project CLIs here.)
|
|
66
69
|
|
|
67
70
|
**`./.gitignore`**
|
|
68
71
|
|
|
@@ -101,30 +104,31 @@ describe('hello', () => {
|
|
|
101
104
|
|
|
102
105
|
```makefile
|
|
103
106
|
SHELL := /bin/bash
|
|
107
|
+
MISE := mise exec --
|
|
104
108
|
|
|
105
109
|
build: install
|
|
106
110
|
@rm -rf dist
|
|
107
|
-
|
|
111
|
+
$(MISE) pnpm exec tsc --outDir dist
|
|
108
112
|
@-find ./dist \( -regex '.*\.test\..*' -o -regex '.*__tests.*' \) -exec rm -rf {} \; 2> /dev/null
|
|
109
113
|
@# Create pack for use by examples to simulate real external usage
|
|
110
|
-
|
|
114
|
+
$(MISE) pnpm pack --pack-destination dist
|
|
111
115
|
|
|
112
116
|
build-module: install
|
|
113
117
|
@rm -rf dist
|
|
114
|
-
|
|
118
|
+
$(MISE) pnpm exec tsc --outDir dist
|
|
115
119
|
@-find ./dist \( -regex '.*\.test\..*' -o -regex '.*__tests.*' \) -exec rm -rf {} \; 2> /dev/null
|
|
116
120
|
|
|
117
121
|
lint:
|
|
118
|
-
|
|
122
|
+
$(MISE) pnpm exec eslint ./src
|
|
119
123
|
|
|
120
124
|
lint-fix:
|
|
121
|
-
|
|
125
|
+
$(MISE) pnpm exec eslint ./src --fix
|
|
122
126
|
|
|
123
127
|
test-watch:
|
|
124
|
-
|
|
128
|
+
$(MISE) pnpm exec jest --watch
|
|
125
129
|
|
|
126
130
|
test:
|
|
127
|
-
|
|
131
|
+
$(MISE) pnpm exec jest --verbose
|
|
128
132
|
|
|
129
133
|
clean:
|
|
130
134
|
rm -rf node_modules
|
|
@@ -133,22 +137,25 @@ clean:
|
|
|
133
137
|
all: build lint test
|
|
134
138
|
|
|
135
139
|
install:
|
|
136
|
-
|
|
140
|
+
mise install
|
|
141
|
+
$(MISE) pnpm install --frozen-lockfile --config.dedupe-peer-dependents=false
|
|
137
142
|
|
|
138
143
|
publish:
|
|
139
|
-
|
|
140
|
-
|
|
144
|
+
$(MISE) npx -y monotag@1.26.0 current --bump-action=latest --prefix=
|
|
145
|
+
@VERSION=$$($(MISE) node -p "require('./package.json').version"); \
|
|
141
146
|
if echo "$$VERSION" | grep -q '-'; then \
|
|
142
147
|
TAG=$$(echo "$$VERSION" | sed 's/[0-9]*\.[0-9]*\.[0-9]*-\([a-zA-Z][a-zA-Z0-9]*\).*/\1/'); \
|
|
143
148
|
echo "Prerelease version $$VERSION detected, publishing with --tag $$TAG"; \
|
|
144
|
-
|
|
149
|
+
$(MISE) npm publish --no-git-checks --provenance --tag "$$TAG"; \
|
|
145
150
|
else \
|
|
146
|
-
|
|
151
|
+
$(MISE) npm publish --no-git-checks --provenance; \
|
|
147
152
|
fi
|
|
148
153
|
```
|
|
149
154
|
|
|
150
155
|
**`lib/package.json`** (replace `[package-name]`, `[description]`, `[author]`, `[owner]`, `[repo]`):
|
|
151
156
|
|
|
157
|
+
Use this dependency set.
|
|
158
|
+
|
|
152
159
|
```json
|
|
153
160
|
{
|
|
154
161
|
"name": "[package-name]",
|
|
@@ -161,7 +168,7 @@ publish:
|
|
|
161
168
|
"package.json",
|
|
162
169
|
"README.md"
|
|
163
170
|
],
|
|
164
|
-
"packageManager": "pnpm@
|
|
171
|
+
"packageManager": "pnpm@10.14.0",
|
|
165
172
|
"scripts": {},
|
|
166
173
|
"repository": {
|
|
167
174
|
"type": "git",
|
|
@@ -174,19 +181,23 @@ publish:
|
|
|
174
181
|
},
|
|
175
182
|
"homepage": "https://github.com/[owner]/[repo]#readme",
|
|
176
183
|
"devDependencies": {
|
|
177
|
-
"@
|
|
184
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
178
185
|
"@stutzlab/eslint-config": "^3.2.1",
|
|
179
|
-
"@tsconfig/node24": "^24.0.
|
|
180
|
-
"@types/jest": "^29.5.
|
|
186
|
+
"@tsconfig/node24": "^24.0.1",
|
|
187
|
+
"@types/jest": "^29.5.14",
|
|
188
|
+
"@typescript-eslint/eslint-plugin": "^8.31.0",
|
|
189
|
+
"@typescript-eslint/parser": "^8.31.0",
|
|
181
190
|
"esbuild": "^0.20.0",
|
|
182
|
-
"eslint": "^
|
|
191
|
+
"eslint": "^9.25.1",
|
|
183
192
|
"jest": "^29.7.0",
|
|
184
|
-
"ts-jest": "^29.
|
|
185
|
-
"typescript": "^5.
|
|
193
|
+
"ts-jest": "^29.4.0",
|
|
194
|
+
"typescript": "^5.9.0"
|
|
186
195
|
}
|
|
187
196
|
}
|
|
188
197
|
```
|
|
189
198
|
|
|
199
|
+
Keep `package.json` without `"type": "module"`. Use `eslint.config.mjs` as the ESLint entry point so Jest can continue to run with its default CommonJS runtime.
|
|
200
|
+
|
|
190
201
|
**`lib/tsconfig.json`**:
|
|
191
202
|
|
|
192
203
|
```json
|
|
@@ -200,39 +211,65 @@ publish:
|
|
|
200
211
|
"sourceMap": true
|
|
201
212
|
},
|
|
202
213
|
"include": ["src/**/*"],
|
|
203
|
-
"exclude": ["node_modules", "dist"
|
|
214
|
+
"exclude": ["node_modules", "dist"]
|
|
204
215
|
}
|
|
205
216
|
```
|
|
206
217
|
|
|
218
|
+
Use this single tsconfig for both build and type-aware linting. Keep `*.test.ts` included so ESLint can resolve them through `parserOptions.project`, and rely on the existing `dist/` cleanup in the Makefile to remove emitted test files after compilation.
|
|
219
|
+
|
|
207
220
|
**`lib/jest.config.js`**:
|
|
208
221
|
|
|
209
222
|
```javascript
|
|
210
223
|
module.exports = {
|
|
211
|
-
preset: 'ts-jest',
|
|
212
224
|
testEnvironment: 'node',
|
|
213
225
|
testMatch: ['**/*.test.ts'],
|
|
214
226
|
collectCoverageFrom: ['src/**/*.ts', '!src/**/*.test.ts'],
|
|
227
|
+
transform: {
|
|
228
|
+
'^.+\\.tsx?$': [
|
|
229
|
+
'ts-jest',
|
|
230
|
+
{
|
|
231
|
+
tsconfig: {
|
|
232
|
+
module: 'commonjs',
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
},
|
|
215
237
|
};
|
|
216
238
|
```
|
|
217
239
|
|
|
218
|
-
|
|
240
|
+
This avoids the deprecated `globals['ts-jest']` configuration style while forcing `ts-jest` to transpile with CommonJS instead of the `nodenext` default inherited from `@tsconfig/node24`.
|
|
241
|
+
|
|
242
|
+
**`lib/eslint.config.mjs`** (ESLint 9 flat config format):
|
|
219
243
|
|
|
220
244
|
```js
|
|
245
|
+
import path from 'node:path';
|
|
246
|
+
import { fileURLToPath } from 'node:url';
|
|
247
|
+
import { FlatCompat } from '@eslint/eslintrc';
|
|
221
248
|
import baseConfig from '@stutzlab/eslint-config';
|
|
222
249
|
|
|
250
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
251
|
+
const __dirname = path.dirname(__filename);
|
|
252
|
+
|
|
253
|
+
const compat = new FlatCompat({
|
|
254
|
+
baseDirectory: __dirname,
|
|
255
|
+
});
|
|
256
|
+
|
|
223
257
|
export default [
|
|
224
|
-
...baseConfig,
|
|
258
|
+
...compat.config(baseConfig),
|
|
225
259
|
{
|
|
260
|
+
files: ['src/**/*.ts'],
|
|
226
261
|
languageOptions: {
|
|
227
262
|
parserOptions: {
|
|
228
263
|
project: ['./tsconfig.json'],
|
|
229
|
-
tsconfigRootDir:
|
|
264
|
+
tsconfigRootDir: __dirname,
|
|
230
265
|
},
|
|
231
266
|
},
|
|
232
267
|
},
|
|
233
268
|
];
|
|
234
269
|
```
|
|
235
270
|
|
|
271
|
+
Do not name this file `eslint.config.js` unless the generated package also opts into ESM with `"type": "module"`, because that produces Node.js warnings and conflicts with the recommended Jest CommonJS setup.
|
|
272
|
+
|
|
236
273
|
---
|
|
237
274
|
|
|
238
275
|
### Phase 4: Create `examples/`
|
|
@@ -335,17 +372,19 @@ Review all created files and confirm:
|
|
|
335
372
|
- [ ] `lib/src/index.ts` exports at least one symbol
|
|
336
373
|
- [ ] `lib/src/index.test.ts` has at least one passing test
|
|
337
374
|
- [ ] `lib/package.json` has `main`, `types`, and `files` set correctly
|
|
375
|
+
- [ ] `lib/tsconfig.json` includes co-located `src/**/*.test.ts` files for ESLint type-aware parsing
|
|
376
|
+
- [ ] `lib/eslint.config.mjs` points `parserOptions.project` to `tsconfig.json`
|
|
338
377
|
- [ ] `README.md` starts with Quick Start containing a code example
|
|
339
378
|
- [ ] All `[package-name]` placeholders are replaced with the actual name
|
|
340
|
-
- [ ] Structure matches the layout in [
|
|
379
|
+
- [ ] Structure matches the layout in [agentme-edr-003](../../003-javascript-project-tooling.md)
|
|
341
380
|
|
|
342
381
|
## Examples
|
|
343
382
|
|
|
344
383
|
**User:** "Create a new TypeScript library project called `retry-client`"
|
|
345
384
|
|
|
346
385
|
**Agent action:** Gathers: name=`retry-client`, default Node.js 24, then creates:
|
|
347
|
-
- `./Makefile`, `./.
|
|
348
|
-
- `lib/src/index.ts`, `lib/src/index.test.ts`, `lib/Makefile`, `lib/package.json`, `lib/tsconfig.json`, `lib/jest.config.js`, `lib/eslint.config.
|
|
386
|
+
- `./Makefile`, `./.mise.toml`, `./.gitignore`
|
|
387
|
+
- `lib/src/index.ts`, `lib/src/index.test.ts`, `lib/Makefile`, `lib/package.json`, `lib/tsconfig.json`, `lib/jest.config.js`, `lib/eslint.config.mjs`
|
|
349
388
|
- `examples/Makefile`, `examples/usage-basic/package.json`, `examples/usage-basic/index.js`
|
|
350
389
|
- `README.md` (Quick Start first)
|
|
351
390
|
|
|
@@ -354,7 +393,7 @@ All `[package-name]` replaced with `retry-client`.
|
|
|
354
393
|
## Edge Cases
|
|
355
394
|
|
|
356
395
|
- **Existing files** — skip creation; adapt references to the existing structure
|
|
357
|
-
- **Different Node.js version** — update `.
|
|
396
|
+
- **Different Node.js version** — update `.mise.toml` and `tsconfig.json` `extends` (e.g. `@tsconfig/node22`)
|
|
358
397
|
- **CLI tool** — add `"bin": "dist/main.js"` to `package.json` and create `lib/src/main.ts` as the CLI entry point; add `esbuild` bundle target in `lib/Makefile`
|
|
359
398
|
- **No examples needed** — omit the `examples/` directory; remove the `examples` delegation from root `Makefile`
|
|
360
399
|
- **Binary bundling (Lambda/browser)** — add an esbuild step to `lib/Makefile`: `pnpm exec esbuild src/main.ts --bundle --platform=node --outfile=dist/bundle.js`
|
package/.xdrs/index.md
CHANGED
|
@@ -9,7 +9,7 @@ XDRs in scopes listed last override the ones listed first
|
|
|
9
9
|
### _core
|
|
10
10
|
|
|
11
11
|
Decisions about how XDRs work
|
|
12
|
-
[View
|
|
12
|
+
[View _core ADRs Index](_core/adrs/index.md)
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
@@ -23,8 +23,4 @@ Opiniated set of decisions and skills for common development tasks
|
|
|
23
23
|
|
|
24
24
|
### _local (reserved)
|
|
25
25
|
|
|
26
|
-
Project-local XDRs that must not be shared with other contexts. Always keep this scope last so its decisions override or extend all scopes listed above.
|
|
27
|
-
|
|
28
|
-
[View _local BDRs Index](_local/bdrs/index.md)
|
|
29
|
-
|
|
30
|
-
[View _local ADRs Index](_local/adrs/index.md)
|
|
26
|
+
Project-local XDRs that must not be shared with other contexts. Always keep this scope last so its decisions override or extend all scopes listed above. Keep `_local` canonical indexes in the workspace tree only; do not link them from this shared index. Readers and tools should still try to discover existing `_local` indexes in the current workspace by default.
|
package/README.md
CHANGED
|
@@ -17,9 +17,9 @@ npx agentme
|
|
|
17
17
|
If you want the version pinned in a project, add `agentme` to a repository that already has a `package.json` and run it through the local dependency:
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
|
-
pnpm add -D agentme
|
|
21
|
-
pnpm exec agentme extract --output . --presets basic
|
|
22
|
-
pnpm exec agentme check --output . --presets basic
|
|
20
|
+
mise exec -- pnpm add -D agentme
|
|
21
|
+
mise exec -- pnpm exec agentme extract --output . --presets basic
|
|
22
|
+
mise exec -- pnpm exec agentme check --output . --presets basic
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
## Overview
|
|
@@ -80,19 +80,27 @@ This is useful when you want to:
|
|
|
80
80
|
|
|
81
81
|
## Development
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
Install [Mise](https://mise.jdx.dev/getting-started.html), then sync the pinned toolchain:
|
|
84
84
|
|
|
85
85
|
```sh
|
|
86
|
-
|
|
87
|
-
make lint
|
|
88
|
-
make test
|
|
86
|
+
mise install
|
|
89
87
|
```
|
|
90
88
|
|
|
89
|
+
Use the root `Makefile` as the entry point for local verification inside the Mise-managed environment:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
mise exec -- make build
|
|
93
|
+
mise exec -- make lint
|
|
94
|
+
mise exec -- make test
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Running `make build`, `make lint`, or `make test` from an already activated Mise shell is equivalent.
|
|
98
|
+
|
|
91
99
|
What these targets do:
|
|
92
100
|
|
|
93
|
-
- `make build` installs dependencies and creates a local npm package in `dist/`.
|
|
94
|
-
- `make lint` runs the repository lint target.
|
|
95
|
-
- `make test` rebuilds the package and validates the consumer extraction flow through the runnable example in `examples/`.
|
|
101
|
+
- `mise exec -- make build` installs dependencies and creates a local npm package in `dist/`.
|
|
102
|
+
- `mise exec -- make lint` runs the repository lint target.
|
|
103
|
+
- `mise exec -- make test` rebuilds the package and validates the consumer extraction flow through the runnable example in `examples/`.
|
|
96
104
|
|
|
97
105
|
## Repository Map
|
|
98
106
|
|
package/package.json
CHANGED