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.
@@ -13,12 +13,13 @@ compatibility: JavaScript/TypeScript, Node.js 18+
13
13
 
14
14
  ## Overview
15
15
 
16
- Creates a complete JavaScript/TypeScript library project from scratch. The layout separates
17
- library source (`lib/`) from runnable usage examples (`examples/`), coordinated by root-level
18
- Makefiles. Boilerplate is derived from the [filedist](https://github.com/flaviostutz/filedist)
16
+ Creates a complete JavaScript/TypeScript library project from scratch. The layout keeps the
17
+ published package self-contained in its module root (`lib/`), places runnable consumer examples in
18
+ the sibling `examples/` folder, redirects persistent caches into `.cache/`, and uses Makefiles as
19
+ the only entry points. Boilerplate is derived from the [filedist](https://github.com/flaviostutz/filedist)
19
20
  project.
20
21
 
21
- Related EDR: [agentme-edr-003](../../003-javascript-project-tooling.md)
22
+ Related EDRs: [agentme-edr-003](../../003-javascript-project-tooling.md), [agentme-edr-016](../../../principles/016-cross-language-module-structure.md)
22
23
 
23
24
  ## Instructions
24
25
 
@@ -38,7 +39,7 @@ Related EDR: [agentme-edr-003](../../003-javascript-project-tooling.md)
38
39
 
39
40
  **`./Makefile`**
40
41
 
41
- Delegates every make target to `/lib` then `/examples` in sequence:
42
+ Delegates every make target to `/lib` then `/examples` in sequence. Child Makefiles own the actual `mise exec -- <tool>` calls:
42
43
 
43
44
  ```makefile
44
45
  SHELL := /bin/bash
@@ -46,13 +47,13 @@ MISE := mise exec --
46
47
  %:
47
48
  @echo ''
48
49
  @echo '>>> Running /lib:$@...'
49
- @$(MISE) $(MAKE) -C lib $@
50
+ @$(MAKE) -C lib $@
50
51
  @echo ''
51
52
  @echo '>>> Running /examples:$@...'
52
- @STAGE=dev $(MISE) $(MAKE) -C examples $@
53
+ @STAGE=dev $(MAKE) -C examples $@
53
54
 
54
55
  publish:
55
- @$(MISE) $(MAKE) -C lib publish
56
+ @$(MAKE) -C lib publish
56
57
 
57
58
  setup:
58
59
  mise install
@@ -72,6 +73,7 @@ pnpm = "10.14.0"
72
73
  ```
73
74
  node_modules/
74
75
  dist/
76
+ .cache/
75
77
  *.tgz
76
78
  .filedist
77
79
  ```
@@ -105,24 +107,29 @@ describe('hello', () => {
105
107
  ```makefile
106
108
  SHELL := /bin/bash
107
109
  MISE := mise exec --
110
+ CACHE_DIR := .cache
108
111
 
109
112
  build: install
110
113
  @rm -rf dist
111
- $(MISE) pnpm exec tsc --outDir dist
114
+ @mkdir -p $(CACHE_DIR)/tsc
115
+ $(MISE) pnpm exec tsc --incremental --tsBuildInfoFile $(CACHE_DIR)/tsc/tsconfig.tsbuildinfo --outDir dist
112
116
  @-find ./dist \( -regex '.*\.test\..*' -o -regex '.*__tests.*' \) -exec rm -rf {} \; 2> /dev/null
113
117
  @# Create pack for use by examples to simulate real external usage
114
118
  $(MISE) pnpm pack --pack-destination dist
115
119
 
116
120
  build-module: install
117
121
  @rm -rf dist
118
- $(MISE) pnpm exec tsc --outDir dist
122
+ @mkdir -p $(CACHE_DIR)/tsc
123
+ $(MISE) pnpm exec tsc --incremental --tsBuildInfoFile $(CACHE_DIR)/tsc/tsconfig.tsbuildinfo --outDir dist
119
124
  @-find ./dist \( -regex '.*\.test\..*' -o -regex '.*__tests.*' \) -exec rm -rf {} \; 2> /dev/null
120
125
 
121
126
  lint:
122
- $(MISE) pnpm exec eslint ./src
127
+ @mkdir -p $(CACHE_DIR)/eslint
128
+ $(MISE) pnpm exec eslint ./src --cache --cache-location $(CACHE_DIR)/eslint/.eslintcache
123
129
 
124
130
  lint-fix:
125
- $(MISE) pnpm exec eslint ./src --fix
131
+ @mkdir -p $(CACHE_DIR)/eslint
132
+ $(MISE) pnpm exec eslint ./src --fix --cache --cache-location $(CACHE_DIR)/eslint/.eslintcache
126
133
 
127
134
  test-watch:
128
135
  $(MISE) pnpm exec jest --watch
@@ -133,6 +140,7 @@ test:
133
140
  clean:
134
141
  rm -rf node_modules
135
142
  rm -rf dist
143
+ rm -rf .cache
136
144
 
137
145
  all: build lint test
138
146
 
@@ -223,6 +231,8 @@ Use this single tsconfig for both build and type-aware linting. Keep `*.test.ts`
223
231
  module.exports = {
224
232
  testEnvironment: 'node',
225
233
  testMatch: ['**/*.test.ts'],
234
+ cacheDirectory: '<rootDir>/.cache/jest',
235
+ coverageDirectory: '<rootDir>/.cache/coverage',
226
236
  collectCoverageFrom: ['src/**/*.ts', '!src/**/*.test.ts'],
227
237
  transform: {
228
238
  '^.+\\.tsx?$': [
@@ -323,7 +333,29 @@ console.log(result);
323
333
 
324
334
  ---
325
335
 
326
- ### Phase 5: Create `README.md`
336
+ ### Phase 5: Create `README.md` and `lib/README.md`
337
+
338
+ Keep the repository README focused on the workspace and the module README focused on consumers of
339
+ the published package.
340
+
341
+ **`README.md`**
342
+
343
+ ```markdown
344
+ # [package-name]
345
+
346
+ [description]
347
+
348
+ ## Getting Started
349
+
350
+ ```bash
351
+ mise install
352
+ make test
353
+ ```
354
+
355
+ The published module lives in `lib/` and runnable consumer examples live in `examples/`.
356
+ ```
357
+
358
+ **`lib/README.md`**
327
359
 
328
360
  Quick Start must appear at the top — it is rendered first on the npm registry page.
329
361
 
@@ -334,28 +366,37 @@ Quick Start must appear at the top — it is rendered first on the npm registry
334
366
 
335
367
  ## Quick Start
336
368
 
337
- \`\`\`bash
369
+ ```bash
338
370
  pnpm add [package-name]
339
- \`\`\`
371
+ ```
340
372
 
341
- \`\`\`typescript
373
+ ```typescript
342
374
  import { hello } from '[package-name]';
343
375
 
344
376
  const greeting = hello('world');
345
377
  console.log(greeting); // Hello, world!
346
- \`\`\`
378
+ ```
347
379
 
348
380
  ## Installation
349
381
 
350
- \`\`\`bash
382
+ ```bash
351
383
  npm install [package-name]
352
384
  # or
353
385
  pnpm add [package-name]
354
- \`\`\`
386
+ ```
355
387
 
356
388
  ## Examples
357
389
 
358
- See the [examples/](examples/) folder for complete runnable examples.
390
+ See the sibling `examples/` folder for complete runnable examples that consume the packed artifact
391
+ from `lib/dist/`.
392
+
393
+ ## Development
394
+
395
+ ```bash
396
+ make build
397
+ make lint
398
+ make test
399
+ ```
359
400
 
360
401
  ## License
361
402
 
@@ -369,12 +410,13 @@ MIT
369
410
  Review all created files and confirm:
370
411
 
371
412
  - [ ] Root `Makefile` delegates to both `lib/` and `examples/`
413
+ - [ ] `.gitignore` ignores `dist/` and `.cache/`
372
414
  - [ ] `lib/src/index.ts` exports at least one symbol
373
415
  - [ ] `lib/src/index.test.ts` has at least one passing test
374
416
  - [ ] `lib/package.json` has `main`, `types`, and `files` set correctly
375
417
  - [ ] `lib/tsconfig.json` includes co-located `src/**/*.test.ts` files for ESLint type-aware parsing
376
418
  - [ ] `lib/eslint.config.mjs` points `parserOptions.project` to `tsconfig.json`
377
- - [ ] `README.md` starts with Quick Start containing a code example
419
+ - [ ] `lib/README.md` starts with Quick Start and ends with module development commands
378
420
  - [ ] All `[package-name]` placeholders are replaced with the actual name
379
421
  - [ ] Structure matches the layout in [agentme-edr-003](../../003-javascript-project-tooling.md)
380
422
 
@@ -384,9 +426,9 @@ Review all created files and confirm:
384
426
 
385
427
  **Agent action:** Gathers: name=`retry-client`, default Node.js 24, then creates:
386
428
  - `./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`
429
+ - `lib/src/index.ts`, `lib/src/index.test.ts`, `lib/Makefile`, `lib/README.md`, `lib/package.json`, `lib/tsconfig.json`, `lib/jest.config.js`, `lib/eslint.config.mjs`
388
430
  - `examples/Makefile`, `examples/usage-basic/package.json`, `examples/usage-basic/index.js`
389
- - `README.md` (Quick Start first)
431
+ - `README.md` (workspace overview)
390
432
 
391
433
  All `[package-name]` replaced with `retry-client`.
392
434
 
@@ -12,9 +12,9 @@ compatibility: Go 1.21+
12
12
 
13
13
  ## Overview
14
14
 
15
- Creates a complete Go CLI project from scratch, following the layout from [agentme-edr-010](../../010-golang-project-tooling.md). Business logic lives in named feature packages; CLI wiring lives in `cli/<feature>/`; `main.go` is a thin dispatcher. The project builds cross-platform static binaries via a Makefile.
15
+ Creates a complete Go CLI project from scratch, following the layout from [agentme-edr-010](../../010-golang-project-tooling.md). Business logic lives in named feature packages; CLI wiring lives in `cli/<feature>/`; `main.go` is a thin dispatcher. The module root owns its `Makefile`, `README.md`, `dist/`, and `.cache/` folders.
16
16
 
17
- Related EDR: [agentme-edr-010](../../010-golang-project-tooling.md)
17
+ Related EDRs: [agentme-edr-010](../../010-golang-project-tooling.md), [agentme-edr-016](../../../principles/016-cross-language-module-structure.md)
18
18
 
19
19
  ## Instructions
20
20
 
@@ -35,6 +35,16 @@ Ask for (or infer from context):
35
35
 
36
36
  ### Phase 2: Create root files
37
37
 
38
+ **`./.mise.toml`** (replace `[go-version]` and `[golangci-lint-version]`):
39
+
40
+ ```toml
41
+ [tools]
42
+ go = "[go-version]"
43
+ golangci-lint = "[golangci-lint-version]"
44
+ ```
45
+
46
+ Pin any additional project CLIs used by the Makefile here as well. Use an explicit `golangci-lint` version rather than `latest`.
47
+
38
48
  **`go.mod`** (replace `[module]`, `[go-version]`):
39
49
 
40
50
  ```
@@ -81,14 +91,24 @@ func main() {
81
91
 
82
92
  ```makefile
83
93
  SHELL := /bin/bash
94
+ MISE := mise exec --
84
95
 
85
96
  BINARY := [binary]
97
+ CACHE_DIR := .cache
98
+ export GOCACHE := $(abspath $(CACHE_DIR)/go-build)
99
+ export GOMODCACHE := $(abspath $(CACHE_DIR)/go-mod)
100
+ export GOLANGCI_LINT_CACHE := $(abspath $(CACHE_DIR)/golangci-lint)
86
101
 
87
102
  all: build lint test
88
103
 
104
+ setup:
105
+ mise install
106
+ $(MAKE) install
107
+
89
108
  build: install
90
109
  @mkdir -p dist
91
- go build -o dist/$(BINARY) .
110
+ @mkdir -p $(GOCACHE) $(GOMODCACHE)
111
+ $(MISE) go build -o dist/$(BINARY) .
92
112
 
93
113
  build-all: build-arch-os-darwin-amd64 build-arch-os-darwin-arm64 build-arch-os-linux-amd64 build-arch-os-linux-arm64 build-arch-os-windows-amd64
94
114
  @echo "All platform builds complete"
@@ -113,35 +133,37 @@ build-arch-os:
113
133
  @if [ "${ARCH}" == "" ]; then echo "ENV ARCH is required"; exit 1; fi
114
134
  @echo "Compiling $(BINARY) for ${OS}-${ARCH}..."
115
135
  @mkdir -p dist/${OS}-${ARCH}
116
- go mod download
117
- GOOS=${OS} GOARCH=${ARCH} CGO_ENABLED=0 go build -a -o dist/${OS}-${ARCH}/$(BINARY) .
136
+ @mkdir -p $(GOCACHE) $(GOMODCACHE)
137
+ $(MISE) go mod download
138
+ GOOS=${OS} GOARCH=${ARCH} CGO_ENABLED=0 $(MISE) go build -a -o dist/${OS}-${ARCH}/$(BINARY) .
118
139
  @echo "Done"
119
140
 
120
141
  install:
121
- go mod download
142
+ $(MISE) go mod download
122
143
 
123
144
  lint:
124
- golangci-lint run ./...
145
+ $(MISE) golangci-lint run ./...
125
146
 
126
147
  lint-fix:
127
- golangci-lint run --fix ./...
148
+ $(MISE) golangci-lint run --fix ./...
128
149
 
129
150
  test:
130
- go test -cover ./...
151
+ $(MISE) go test -cover ./...
131
152
 
132
153
  test-coverage:
133
- go test -coverprofile=coverage.out ./...
134
- go tool cover -func coverage.out
154
+ @mkdir -p $(CACHE_DIR)
155
+ $(MISE) go test -coverprofile=$(CACHE_DIR)/coverage.out ./...
156
+ $(MISE) go tool cover -func $(CACHE_DIR)/coverage.out
135
157
 
136
158
  benchmark:
137
- go test -bench . -benchmem -count 5 ./...
159
+ $(MISE) go test -bench . -benchmem -count 5 ./...
138
160
 
139
161
  clean:
140
162
  rm -rf dist
141
- rm -f coverage.out
163
+ rm -rf .cache
142
164
 
143
165
  start:
144
- go run ./ [subcommand]
166
+ $(MISE) go run ./ [subcommand]
145
167
  ```
146
168
 
147
169
  **`.golangci.yml`**:
@@ -164,6 +186,7 @@ run:
164
186
 
165
187
  ```
166
188
  dist/
189
+ .cache/
167
190
  coverage.out
168
191
  *.pprof
169
192
  .DS_Store
@@ -182,10 +205,11 @@ coverage.out
182
205
 
183
206
  ## Development
184
207
 
185
- make build # compile binary to dist/
186
- make lint # run golangci-lint
187
- make test # run tests with coverage
188
- make start # run locally with default args
208
+ make setup
209
+ make build # compile binary to dist/
210
+ make lint # run golangci-lint with cache in .cache/
211
+ make test # run tests with coverage artifacts in .cache/
212
+ make start # run locally with default args
189
213
  ```
190
214
 
191
215
  ---
@@ -292,7 +316,7 @@ func Run(args []string) {
292
316
  After creating all files, run the following in the project root:
293
317
 
294
318
  ```bash
295
- go mod tidy
319
+ make setup
296
320
  make all
297
321
  ```
298
322
 
@@ -306,6 +330,8 @@ Fix any compile or lint errors before finishing.
306
330
  - Business logic only in `[feature]/` packages — no flag parsing, no `fmt.Println` for diagnostics.
307
331
  - `cli/[feature]/` owns flags, output, and calls domain. No logic here beyond reading flags and printing results.
308
332
  - All tests co-located (`*_test.go` next to the file under test).
333
+ - Use `tests_integration/` for integration flows and `tests_benchmark/` when benchmarks need dedicated harnesses or datasets.
309
334
  - Log with `logrus`; never use `fmt.Println` for diagnostic/debug output.
310
- - All development tasks go through `make` targets never run `go` directly for routine ops.
335
+ - All development tasks go through `make` targets. The Makefile recipes call `mise exec -- go ...` and related tools directly.
311
336
  - Do not create an `internal/` package unless explicitly justified (importability is preferred).
337
+ - If the project is a reusable library, place consumer examples in a sibling `examples/` folder outside the module root and keep them on the public module import path.