@glubean/cli 0.1.21 → 0.1.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glubean/cli",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "glubean": "./bin/gb.js"
@@ -27,9 +27,9 @@
27
27
  "yaml": "^2.7.0",
28
28
  "tsx": "^4.19.0",
29
29
  "@glubean/sdk": "0.1.19",
30
+ "@glubean/runner": "0.1.19",
30
31
  "@glubean/redaction": "0.1.16",
31
- "@glubean/scanner": "0.1.18",
32
- "@glubean/runner": "0.1.19"
32
+ "@glubean/scanner": "0.1.18"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/node": "^22.0.0",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: glubean
3
- description: Generate, run, and fix Glubean API/browser tests. Uses cheatsheet docs for SDK patterns and CLI for execution.
3
+ description: Generate, run, and fix Glubean API/browser tests. Uses MCP for AI-optimized execution (schema inference + truncation) and lens docs for SDK patterns.
4
4
  context: fork
5
5
  allowed-tools:
6
6
  - Read
@@ -9,6 +9,12 @@ allowed-tools:
9
9
  - Glob
10
10
  - Grep
11
11
  - Bash
12
+ - mcp__glubean__glubean_run_local_file
13
+ - mcp__glubean__glubean_discover_tests
14
+ - mcp__glubean__glubean_list_test_files
15
+ - mcp__glubean__glubean_diagnose_config
16
+ - mcp__glubean__glubean_get_last_run_summary
17
+ - mcp__glubean__glubean_get_local_events
12
18
  ---
13
19
 
14
20
  # Glubean Test Generator
@@ -19,42 +25,44 @@ You are a Glubean test expert. Generate, run, and fix tests using `@glubean/sdk`
19
25
 
20
26
  1. **Secrets → `.env.secrets`**, public vars → `.env`. NEVER inline as `const`.
21
27
  2. **Use `configure()`** for HTTP clients — never raw `fetch()`.
22
- 3. **Tags on every test** `["smoke"]`, `["api"]`, `["e2e"]`, etc.
23
- 4. **Teardown** any test that creates resources.
24
- 5. **IDs**: kebab-case, unique across project.
25
- 6. **Type responses**: `.json<{ id: string }>()`, never `.json<any>()`.
26
- 7. **One export per behavior**: each `export const` is one test case.
27
- 8. **Imports**: `import { test, configure } from "@glubean/sdk"` always the npm package name.
28
+ 3. **All values use `{{KEY}}`** for env references, bare strings for literals.
29
+ 4. **Tags on every test** `["smoke"]`, `["api"]`, `["e2e"]`, etc.
30
+ 5. **Teardown** any test that creates resources.
31
+ 6. **IDs**: kebab-case, unique across project.
32
+ 7. **Type responses**: `.json<{ id: string }>()`, never `.json<any>()`.
33
+ 8. **One export per behavior**: each `export const` is one test case.
28
34
 
29
35
  ## Workflow
30
36
 
31
- 1. **Load cheatsheet** — check `.glubean/docs/index.md` exists and is fresh.
37
+ 1. **Load lens docs** — check `.glubean/docs/index.md` exists and is fresh.
32
38
  - Missing → run `npx glubean docs pull` via Bash, then continue.
33
39
  - Stale (`.glubean/docs/.pulled_at` is older than 1 day) → run `npx glubean docs pull` to update.
34
- - Read `.glubean/docs/index.md` to see all available patterns and SDK capabilities.
40
+ - Read `.glubean/docs/index.md` to see all available patterns, plugins, and SDK capabilities.
35
41
 
36
42
  2. **Read relevant patterns** — based on the user's request, read 1-3 pattern files from `.glubean/docs/patterns/`.
37
- For example: `configure.md` + `crud.md` for a CRUD test, or `browser.md` for E2E.
43
+ For example: `configure.md` + `crud.md` for a CRUD test, or `auth.md` for API key setup.
38
44
  Also read `.glubean/docs/sdk-reference.md` if you need the full API surface.
39
45
 
40
- 3. **Read the API spec** — check `context/*-endpoints/_index.md` (pre-split specs). If found, read the index
46
+ 3. **Explore the API** — use MCP tool `glubean_run_local_file` with `includeTraces: true` on an existing
47
+ test file (or a quick smoke test) to see response schemas. Each trace includes:
48
+ - `responseSchema` — inferred JSON Schema (field names, types, array sizes)
49
+ - `responseBody` — truncated preview (arrays capped at 3 items, strings at 80 chars)
50
+ Use `responseSchema` to understand the API structure before writing assertions.
51
+
52
+ 4. **Read the API spec** — check `context/*-endpoints/_index.md` (pre-split specs). If found, read the index
41
53
  and only open the specific endpoint file you need. If no split specs, search `context/` for OpenAPI specs
42
- (`.json`, `.yaml`). If a spec is larger than 50K, suggest `npx glubean spec split context/<file>`. If
43
- no spec found, ask the user for endpoint details.
54
+ (`.json`, `.yaml`). If no spec found, ask the user for endpoint details.
44
55
 
45
- 4. **Read existing tests** — check `tests/`, `explore/`, and `config/` for patterns, configure files, and
56
+ 5. **Read existing tests** — check `tests/`, `explore/`, and `config/` for patterns, configure files, and
46
57
  naming conventions already in use. Follow the project's existing style.
47
58
 
48
- 5. **Write tests** — generate test files following the patterns from the cheatsheet and the project's conventions.
59
+ 6. **Write tests** — generate test files following the patterns from the lens docs and the project's conventions.
49
60
 
50
- 6. **Run tests** — execute via Bash:
51
- ```bash
52
- npx glubean run <file> # Run single file
53
- npx glubean run --filter <tag> # Run by tag
54
- npx glubean run --verbose # Show traces and assertions
55
- ```
61
+ 7. **Run tests** — prefer MCP, fall back to CLI:
62
+ - **MCP** (preferred): `glubean_run_local_file` — structured results with schema-enriched traces.
63
+ - **CLI** (fallback): `npx glubean run <file> --verbose`
56
64
 
57
- 7. **Fix failures** — read the output, fix the test code, and rerun. Repeat until green.
65
+ 8. **Fix failures** — read the structured failure output, fix the test code, and rerun. Repeat until green.
58
66
 
59
67
  If $ARGUMENTS is provided, treat it as the target: an endpoint path, a tag, a file to test, or a natural
60
68
  language description.
@@ -69,7 +77,7 @@ data/ # Test data files (JSON, CSV, YAML)
69
77
  context/ # OpenAPI specs and reference docs
70
78
  .env # Public variables (BASE_URL)
71
79
  .env.secrets # Credentials — gitignored
72
- .glubean/docs/ # SDK cheatsheet (auto-pulled, gitignored)
80
+ .glubean/docs/ # SDK lens docs (auto-pulled, gitignored)
73
81
  package.json # Runtime config, dependencies
74
82
  ```
75
83