@neilinger/businessmap-mcp 1.12.5 → 1.15.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/README.md +337 -15
- package/dist/client/businessmap-client.d.ts +33 -0
- package/dist/client/businessmap-client.d.ts.map +1 -1
- package/dist/client/businessmap-client.js +34 -2
- package/dist/client/businessmap-client.js.map +1 -1
- package/dist/client/client-factory.d.ts.map +1 -1
- package/dist/client/client-factory.js.map +1 -1
- package/dist/client/modules/base-client.d.ts.map +1 -1
- package/dist/client/modules/base-client.js +9 -5
- package/dist/client/modules/base-client.js.map +1 -1
- package/dist/client/modules/board-client.d.ts +32 -0
- package/dist/client/modules/board-client.d.ts.map +1 -1
- package/dist/client/modules/board-client.js +26 -0
- package/dist/client/modules/board-client.js.map +1 -1
- package/dist/client/modules/card-client.d.ts +60 -0
- package/dist/client/modules/card-client.d.ts.map +1 -1
- package/dist/client/modules/card-client.js +39 -9
- package/dist/client/modules/card-client.js.map +1 -1
- package/dist/client/modules/custom-field-client.d.ts +33 -0
- package/dist/client/modules/custom-field-client.d.ts.map +1 -1
- package/dist/client/modules/custom-field-client.js +33 -0
- package/dist/client/modules/custom-field-client.js.map +1 -1
- package/dist/client/modules/user-client.d.ts +23 -0
- package/dist/client/modules/user-client.d.ts.map +1 -1
- package/dist/client/modules/user-client.js +23 -0
- package/dist/client/modules/user-client.js.map +1 -1
- package/dist/client/modules/workspace-client.d.ts +27 -0
- package/dist/client/modules/workspace-client.d.ts.map +1 -1
- package/dist/client/modules/workspace-client.js +30 -1
- package/dist/client/modules/workspace-client.js.map +1 -1
- package/dist/config/environment.d.ts.map +1 -1
- package/dist/config/environment.js +7 -3
- package/dist/config/environment.js.map +1 -1
- package/dist/config/instance-manager.d.ts.map +1 -1
- package/dist/config/instance-manager.js +16 -7
- package/dist/config/instance-manager.js.map +1 -1
- package/dist/config/tool-profiles.d.ts +143 -0
- package/dist/config/tool-profiles.d.ts.map +1 -0
- package/dist/config/tool-profiles.js +275 -0
- package/dist/config/tool-profiles.js.map +1 -0
- package/dist/metrics/metrics-reporter.d.ts +129 -0
- package/dist/metrics/metrics-reporter.d.ts.map +1 -0
- package/dist/metrics/metrics-reporter.js +161 -0
- package/dist/metrics/metrics-reporter.js.map +1 -0
- package/dist/metrics/token-counter.d.ts +50 -0
- package/dist/metrics/token-counter.d.ts.map +1 -0
- package/dist/metrics/token-counter.js +99 -0
- package/dist/metrics/token-counter.js.map +1 -0
- package/dist/schemas/board-schemas.d.ts +61 -61
- package/dist/schemas/board-schemas.d.ts.map +1 -1
- package/dist/schemas/board-schemas.js +44 -50
- package/dist/schemas/board-schemas.js.map +1 -1
- package/dist/schemas/bulk-schemas.d.ts +71 -63
- package/dist/schemas/bulk-schemas.d.ts.map +1 -1
- package/dist/schemas/bulk-schemas.js +39 -36
- package/dist/schemas/bulk-schemas.js.map +1 -1
- package/dist/schemas/card-schemas.d.ts +1452 -1609
- package/dist/schemas/card-schemas.d.ts.map +1 -1
- package/dist/schemas/card-schemas.js +384 -462
- package/dist/schemas/card-schemas.js.map +1 -1
- package/dist/schemas/common-schemas.d.ts +16 -19
- package/dist/schemas/common-schemas.d.ts.map +1 -1
- package/dist/schemas/common-schemas.js +34 -38
- package/dist/schemas/common-schemas.js.map +1 -1
- package/dist/schemas/custom-field-schemas.d.ts +18 -18
- package/dist/schemas/custom-field-schemas.js +7 -7
- package/dist/schemas/custom-field-schemas.js.map +1 -1
- package/dist/schemas/index.d.ts +3 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +3 -0
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/security-validation.d.ts +161 -0
- package/dist/schemas/security-validation.d.ts.map +1 -0
- package/dist/schemas/security-validation.js +300 -0
- package/dist/schemas/security-validation.js.map +1 -0
- package/dist/schemas/shared-card-schemas.d.ts +151 -0
- package/dist/schemas/shared-card-schemas.d.ts.map +1 -0
- package/dist/schemas/shared-card-schemas.js +80 -0
- package/dist/schemas/shared-card-schemas.js.map +1 -0
- package/dist/schemas/shared-params.d.ts +121 -0
- package/dist/schemas/shared-params.d.ts.map +1 -0
- package/dist/schemas/shared-params.js +97 -0
- package/dist/schemas/shared-params.js.map +1 -0
- package/dist/schemas/user-schemas.d.ts +9 -9
- package/dist/schemas/user-schemas.js +4 -4
- package/dist/schemas/user-schemas.js.map +1 -1
- package/dist/schemas/utility-schemas.d.ts +6 -6
- package/dist/schemas/utility-schemas.js +3 -3
- package/dist/schemas/utility-schemas.js.map +1 -1
- package/dist/schemas/workflow-schemas.d.ts +6 -6
- package/dist/schemas/workflow-schemas.js +3 -3
- package/dist/schemas/workflow-schemas.js.map +1 -1
- package/dist/schemas/workspace-schemas.d.ts +27 -27
- package/dist/schemas/workspace-schemas.d.ts.map +1 -1
- package/dist/schemas/workspace-schemas.js +14 -13
- package/dist/schemas/workspace-schemas.js.map +1 -1
- package/dist/server/mcp-server.d.ts +5 -0
- package/dist/server/mcp-server.d.ts.map +1 -1
- package/dist/server/mcp-server.js +41 -3
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/server/tools/base-tool.d.ts +22 -1
- package/dist/server/tools/base-tool.d.ts.map +1 -1
- package/dist/server/tools/base-tool.js +27 -0
- package/dist/server/tools/base-tool.js.map +1 -1
- package/dist/server/tools/board-tools.d.ts +1 -1
- package/dist/server/tools/board-tools.d.ts.map +1 -1
- package/dist/server/tools/board-tools.js +51 -19
- package/dist/server/tools/board-tools.js.map +1 -1
- package/dist/server/tools/card-tools.d.ts +1 -1
- package/dist/server/tools/card-tools.d.ts.map +1 -1
- package/dist/server/tools/card-tools.js +244 -40
- package/dist/server/tools/card-tools.js.map +1 -1
- package/dist/server/tools/custom-field-tools.d.ts +1 -1
- package/dist/server/tools/custom-field-tools.d.ts.map +1 -1
- package/dist/server/tools/custom-field-tools.js +20 -8
- package/dist/server/tools/custom-field-tools.js.map +1 -1
- package/dist/server/tools/instance-tools.d.ts +1 -1
- package/dist/server/tools/instance-tools.d.ts.map +1 -1
- package/dist/server/tools/instance-tools.js +10 -6
- package/dist/server/tools/instance-tools.js.map +1 -1
- package/dist/server/tools/user-tools.d.ts +1 -1
- package/dist/server/tools/user-tools.d.ts.map +1 -1
- package/dist/server/tools/user-tools.js +11 -5
- package/dist/server/tools/user-tools.js.map +1 -1
- package/dist/server/tools/utility-tools.d.ts +1 -1
- package/dist/server/tools/utility-tools.d.ts.map +1 -1
- package/dist/server/tools/utility-tools.js +8 -4
- package/dist/server/tools/utility-tools.js.map +1 -1
- package/dist/server/tools/workflow-tools.d.ts +1 -1
- package/dist/server/tools/workflow-tools.d.ts.map +1 -1
- package/dist/server/tools/workflow-tools.js +11 -7
- package/dist/server/tools/workflow-tools.js.map +1 -1
- package/dist/server/tools/workspace-tools.d.ts +1 -1
- package/dist/server/tools/workspace-tools.d.ts.map +1 -1
- package/dist/server/tools/workspace-tools.js +34 -12
- package/dist/server/tools/workspace-tools.js.map +1 -1
- package/dist/services/confirmation-builder.d.ts.map +1 -1
- package/dist/services/confirmation-builder.js.map +1 -1
- package/dist/services/dependency-analyzer.d.ts.map +1 -1
- package/dist/services/dependency-analyzer.js.map +1 -1
- package/dist/types/instance-config.d.ts.map +1 -1
- package/dist/types/instance-config.js +5 -2
- package/dist/types/instance-config.js.map +1 -1
- package/package.json +25 -4
package/README.md
CHANGED
|
@@ -36,6 +36,58 @@ The server requires the following environment variables:
|
|
|
36
36
|
- `BUSINESSMAP_API_URL`: Your BusinessMap API URL (e.g., `https://your-account.kanbanize.com/api/v2`)
|
|
37
37
|
- `BUSINESSMAP_READ_ONLY_MODE`: Set to `"true"` for read-only mode, `"false"` to allow modifications (optional, defaults to `"false"`)
|
|
38
38
|
- `BUSINESSMAP_DEFAULT_WORKSPACE_ID`: Set the BusinessMap workspace ID (optional)
|
|
39
|
+
- `BUSINESSMAP_TOOL_PROFILE`: Token optimization profile for tool registration (optional, defaults to `"standard"`)
|
|
40
|
+
|
|
41
|
+
#### Tool Profile Configuration
|
|
42
|
+
|
|
43
|
+
The `BUSINESSMAP_TOOL_PROFILE` environment variable controls which tools are registered with the MCP server, allowing you to optimize token consumption based on your workflow needs.
|
|
44
|
+
|
|
45
|
+
**Available Profiles:**
|
|
46
|
+
|
|
47
|
+
| Profile | Tools | Token Count | Use Case |
|
|
48
|
+
| ---------- | ----- | ----------- | ----------------------------------------------------------------------------------------------------- |
|
|
49
|
+
| `minimal` | 10 | ~14,276 | Basic card and board operations only. Ideal for simple workflows or token-constrained environments. |
|
|
50
|
+
| `standard` | 24 | ~18,500 | Most common workflows including cards, boards, workspaces, and users. **Default if not specified.** |
|
|
51
|
+
| `full` | 59 | ~31,663 | All available tools including advanced features (custom fields, subtasks, outcomes, bulk operations). |
|
|
52
|
+
|
|
53
|
+
**Profile Contents:**
|
|
54
|
+
|
|
55
|
+
- **Minimal** (10 tools): `list_boards`, `list_cards`, `get_card`, `get_workspace`, `create_card`, `update_card`, `move_card`, `search_board`, `health_check`
|
|
56
|
+
- **Standard** (24 tools): Minimal + workspace management, board creation/updates/structure, card comments, card parents/children, custom field viewing, users, system tools
|
|
57
|
+
- **Full** (59 tools): Standard + advanced card features (subtasks, outcomes, history, linked cards), custom field management, workflow analysis, bulk operations
|
|
58
|
+
|
|
59
|
+
**Note:** Ghost tools (`list_instances`, `get_instance_info`, `get_board`) were defined but never properly registered. Tool counts reflect actual registered tools in `src/config/tool-profiles.ts`.
|
|
60
|
+
|
|
61
|
+
**Example Usage:**
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"mcpServers": {
|
|
66
|
+
"Businessmap": {
|
|
67
|
+
"command": "npx",
|
|
68
|
+
"args": ["-y", "@neilinger/businessmap-mcp"],
|
|
69
|
+
"env": {
|
|
70
|
+
"BUSINESSMAP_API_TOKEN": "your_token_here",
|
|
71
|
+
"BUSINESSMAP_API_URL": "https://your-account.kanbanize.com/api/v2",
|
|
72
|
+
"BUSINESSMAP_TOOL_PROFILE": "minimal"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Token Optimization Benefits:**
|
|
80
|
+
|
|
81
|
+
- **Reduced Context Size**: Lower token counts mean more room for conversation history and responses
|
|
82
|
+
- **Faster Tool Discovery**: Fewer tools make it easier for the AI to select appropriate actions
|
|
83
|
+
- **Cost Efficiency**: Lower token usage per request reduces API costs (especially important for Claude Desktop and Cursor)
|
|
84
|
+
- **Progressive Enhancement**: Start with `minimal`, upgrade to `standard` or `full` as needed
|
|
85
|
+
|
|
86
|
+
**Choosing a Profile:**
|
|
87
|
+
|
|
88
|
+
- Use **minimal** if you primarily work with cards and boards, or in token-constrained environments
|
|
89
|
+
- Use **standard** (default) for typical project management workflows covering 80% of common use cases
|
|
90
|
+
- Use **full** when you need advanced features like custom fields, bulk operations, or detailed card relationships
|
|
39
91
|
|
|
40
92
|
#### Claude Desktop
|
|
41
93
|
|
|
@@ -50,8 +102,9 @@ Add the following configuration to your `claude_desktop_config.json` file:
|
|
|
50
102
|
"env": {
|
|
51
103
|
"BUSINESSMAP_API_TOKEN": "your_token_here",
|
|
52
104
|
"BUSINESSMAP_API_URL": "https://your-account.kanbanize.com/api/v2",
|
|
53
|
-
"BUSINESSMAP_READ_ONLY_MODE": "false", // optional
|
|
54
|
-
"BUSINESSMAP_DEFAULT_WORKSPACE_ID": "1" // optional
|
|
105
|
+
"BUSINESSMAP_READ_ONLY_MODE": "false", // optional, defaults to false
|
|
106
|
+
"BUSINESSMAP_DEFAULT_WORKSPACE_ID": "1", // optional
|
|
107
|
+
"BUSINESSMAP_TOOL_PROFILE": "standard" // optional, defaults to standard (minimal|standard|full)
|
|
55
108
|
}
|
|
56
109
|
}
|
|
57
110
|
}
|
|
@@ -75,7 +128,8 @@ To use the BusinessMap MCP server with Cursor, add the following configuration t
|
|
|
75
128
|
"BUSINESSMAP_API_TOKEN": "your_token_here",
|
|
76
129
|
"BUSINESSMAP_API_URL": "https://your-account.kanbanize.com/api/v2",
|
|
77
130
|
"BUSINESSMAP_READ_ONLY_MODE": "false",
|
|
78
|
-
"BUSINESSMAP_DEFAULT_WORKSPACE_ID": "1"
|
|
131
|
+
"BUSINESSMAP_DEFAULT_WORKSPACE_ID": "1",
|
|
132
|
+
"BUSINESSMAP_TOOL_PROFILE": "standard"
|
|
79
133
|
}
|
|
80
134
|
}
|
|
81
135
|
```
|
|
@@ -96,7 +150,8 @@ To use the BusinessMap MCP server with VSCode, add the following configuration:
|
|
|
96
150
|
"BUSINESSMAP_API_TOKEN": "your_token_here",
|
|
97
151
|
"BUSINESSMAP_API_URL": "https://your-account.kanbanize.com/api/v2",
|
|
98
152
|
"BUSINESSMAP_READ_ONLY_MODE": "false",
|
|
99
|
-
"BUSINESSMAP_DEFAULT_WORKSPACE_ID": "1"
|
|
153
|
+
"BUSINESSMAP_DEFAULT_WORKSPACE_ID": "1",
|
|
154
|
+
"BUSINESSMAP_TOOL_PROFILE": "standard"
|
|
100
155
|
}
|
|
101
156
|
}
|
|
102
157
|
}
|
|
@@ -108,7 +163,7 @@ To use the BusinessMap MCP server with VSCode, add the following configuration:
|
|
|
108
163
|
For other MCP clients, use the appropriate configuration format for your client, ensuring you specify:
|
|
109
164
|
|
|
110
165
|
- Command: `npx @neilinger/businessmap-mcp` (or `businessmap-mcp` if globally installed)
|
|
111
|
-
- Environment variables: `BUSINESSMAP_API_TOKEN`, `BUSINESSMAP_API_URL`, and optionally `BUSINESSMAP_READ_ONLY_MODE`, `BUSINESSMAP_DEFAULT_WORKSPACE_ID`
|
|
166
|
+
- Environment variables: `BUSINESSMAP_API_TOKEN`, `BUSINESSMAP_API_URL`, and optionally `BUSINESSMAP_READ_ONLY_MODE`, `BUSINESSMAP_DEFAULT_WORKSPACE_ID`, `BUSINESSMAP_TOOL_PROFILE`
|
|
112
167
|
|
|
113
168
|
### Manual Setup
|
|
114
169
|
|
|
@@ -132,6 +187,7 @@ For other MCP clients, use the appropriate configuration format for your client,
|
|
|
132
187
|
BUSINESSMAP_API_URL=https://your-account.kanbanize.com/api/v2
|
|
133
188
|
BUSINESSMAP_READ_ONLY_MODE=false
|
|
134
189
|
BUSINESSMAP_DEFAULT_WORKSPACE_ID=1
|
|
190
|
+
BUSINESSMAP_TOOL_PROFILE=standard
|
|
135
191
|
```
|
|
136
192
|
|
|
137
193
|
> **Note**: When using as an MCP server with Claude Desktop, you don't need a `.env` file. Configure the environment variables directly in your MCP client configuration instead.
|
|
@@ -148,6 +204,254 @@ For other MCP clients, use the appropriate configuration format for your client,
|
|
|
148
204
|
npm start
|
|
149
205
|
```
|
|
150
206
|
|
|
207
|
+
## Quality Control System
|
|
208
|
+
|
|
209
|
+
This project implements a **five-layer defense-in-depth quality control architecture** designed to ensure code quality, prevent regressions, and maintain security throughout the development lifecycle.
|
|
210
|
+
|
|
211
|
+
### Five-Layer Architecture
|
|
212
|
+
|
|
213
|
+
The quality control system operates as a cascading defense mechanism, where each layer provides increasingly thorough validation:
|
|
214
|
+
|
|
215
|
+
```text
|
|
216
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
217
|
+
│ Layer 1: Branch Protection │
|
|
218
|
+
│ ├─ Blocks direct commits to main branch │
|
|
219
|
+
│ └─ Requires all checks to pass before merge │
|
|
220
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
221
|
+
↓
|
|
222
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
223
|
+
│ Layer 2: Pre-commit Hooks (< 2s) │
|
|
224
|
+
│ ├─ ESLint: Code quality and style enforcement │
|
|
225
|
+
│ ├─ Prettier: Automatic code formatting │
|
|
226
|
+
│ └─ TypeScript: Type checking and compilation │
|
|
227
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
228
|
+
↓
|
|
229
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
230
|
+
│ Layer 3: Commit Message Validation │
|
|
231
|
+
│ ├─ Conventional Commits: Semantic versioning support │
|
|
232
|
+
│ └─ Commitlint: Message format enforcement │
|
|
233
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
234
|
+
↓
|
|
235
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
236
|
+
│ Layer 4: Pre-push Hooks (30-90s) │
|
|
237
|
+
│ ├─ Unit Tests: Fast component validation │
|
|
238
|
+
│ └─ Integration Tests (REAL mode): Live API validation │
|
|
239
|
+
│ └─ Requires BUSINESSMAP_API_TOKEN credentials │
|
|
240
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
241
|
+
↓
|
|
242
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
243
|
+
│ Layer 5: CI Enforcement │
|
|
244
|
+
│ ├─ Hook Bypass Detection: Catches --no-verify attempts │
|
|
245
|
+
│ ├─ Pre-commit Validation: Re-runs Layer 2 checks │
|
|
246
|
+
│ └─ Integration Tests (MOCK mode): Schema validation │
|
|
247
|
+
│ └─ No credentials required │
|
|
248
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Layer Details
|
|
252
|
+
|
|
253
|
+
#### Layer 1: Branch Protection
|
|
254
|
+
|
|
255
|
+
**Purpose**: Prevent unauthorized direct commits to protected branches
|
|
256
|
+
|
|
257
|
+
- Blocks direct pushes to `main` branch
|
|
258
|
+
- Requires status checks to pass before merge:
|
|
259
|
+
- `CI / Build and Test` - Core compilation and unit tests
|
|
260
|
+
- `CI / Pre-commit Validation` - Detects pre-commit hook bypasses
|
|
261
|
+
- `CI / Integration Tests (Mock)` - Detects pre-push hook bypasses
|
|
262
|
+
- Enforced by GitHub branch protection rules
|
|
263
|
+
- **Maintenance**: Run `bash scripts/setup-branch-protection.sh` periodically to verify configuration
|
|
264
|
+
|
|
265
|
+
#### Layer 2: Pre-commit Hooks (< 2s)
|
|
266
|
+
|
|
267
|
+
**Purpose**: Fast feedback on code quality before commit creation
|
|
268
|
+
|
|
269
|
+
Implemented via Husky + lint-staged:
|
|
270
|
+
|
|
271
|
+
- **ESLint**: Enforces code quality rules and catches common errors
|
|
272
|
+
- **Prettier**: Automatically formats code to project standards
|
|
273
|
+
- **TypeScript**: Validates types and catches compilation errors
|
|
274
|
+
|
|
275
|
+
Performance target: Complete in under 2 seconds for rapid iteration.
|
|
276
|
+
|
|
277
|
+
#### Layer 3: Commit Message Validation
|
|
278
|
+
|
|
279
|
+
**Purpose**: Ensure consistent commit messages for semantic versioning
|
|
280
|
+
|
|
281
|
+
- **Commitlint**: Enforces Conventional Commits format (`feat:`, `fix:`, `docs:`, etc.)
|
|
282
|
+
- **Semantic Release**: Automatically determines version bumps from commit messages
|
|
283
|
+
- **Format**: `type(scope): description`
|
|
284
|
+
- `feat`: New features (minor version bump)
|
|
285
|
+
- `fix`: Bug fixes (patch version bump)
|
|
286
|
+
- `BREAKING CHANGE`: Breaking changes (major version bump)
|
|
287
|
+
|
|
288
|
+
#### Layer 4: Pre-push Hooks (30-90s)
|
|
289
|
+
|
|
290
|
+
**Purpose**: Thorough validation before code reaches remote repository
|
|
291
|
+
|
|
292
|
+
- **Unit Tests**: Fast component-level validation
|
|
293
|
+
- **Integration Tests (REAL mode)**: Live API validation with actual BusinessMap credentials
|
|
294
|
+
- Requires `BUSINESSMAP_API_TOKEN` environment variable
|
|
295
|
+
- Tests full CRUD workflows against real API
|
|
296
|
+
- Performance: 30-90 seconds for comprehensive validation
|
|
297
|
+
|
|
298
|
+
#### Layer 5: CI Enforcement
|
|
299
|
+
|
|
300
|
+
**Purpose**: Detect hook bypasses and provide final validation gate
|
|
301
|
+
|
|
302
|
+
Catches developers who use `git commit --no-verify` or `git push --no-verify`:
|
|
303
|
+
|
|
304
|
+
| Bypass Attempt | Caught By | CI Job |
|
|
305
|
+
| ------------------------ | ------------------------ | ------------------------------- |
|
|
306
|
+
| `git commit --no-verify` | Pre-commit Validation | `CI / Pre-commit Validation` |
|
|
307
|
+
| `git push --no-verify` | Integration Tests (Mock) | `CI / Integration Tests (Mock)` |
|
|
308
|
+
|
|
309
|
+
**CI runs in MOCK mode** (no credentials required):
|
|
310
|
+
|
|
311
|
+
- Schema and structure validation only
|
|
312
|
+
- No actual API calls to BusinessMap
|
|
313
|
+
- Fast execution (< 1 minute)
|
|
314
|
+
- Prevents credential exposure in CI environment
|
|
315
|
+
|
|
316
|
+
### Hook Bypass Detection (T059)
|
|
317
|
+
|
|
318
|
+
The system detects and blocks two common bypass attempts:
|
|
319
|
+
|
|
320
|
+
**1. Pre-commit Hook Bypass**
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
git commit --no-verify # Skips Layer 2 + Layer 3
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
**Detection**: `CI / Pre-commit Validation` job re-runs ESLint, Prettier, TypeScript, and Commitlint
|
|
327
|
+
**Outcome**: PR merge blocked if violations found
|
|
328
|
+
|
|
329
|
+
**2. Pre-push Hook Bypass**
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
git push --no-verify # Skips Layer 4
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
**Detection**: `CI / Integration Tests (Mock)` job runs schema validation
|
|
336
|
+
**Outcome**: PR merge blocked if integration test structure invalid
|
|
337
|
+
|
|
338
|
+
### Dual-Mode Testing (T060)
|
|
339
|
+
|
|
340
|
+
Integration tests support two operational modes:
|
|
341
|
+
|
|
342
|
+
| Mode | Environment | Credentials | API Calls | Performance | Use Case |
|
|
343
|
+
| -------- | ------------------- | ---------------------------------- | --------------------- | ----------- | -------------------------------- |
|
|
344
|
+
| **REAL** | Local (pre-push) | Required (`BUSINESSMAP_API_TOKEN`) | Live API validation | 30-90s | Developer validation before push |
|
|
345
|
+
| **MOCK** | CI (GitHub Actions) | Not required | Schema/structure only | < 1min | Hook bypass detection |
|
|
346
|
+
|
|
347
|
+
**Security**: Production credentials never exposed in CI environment. MOCK mode provides structural validation without requiring sensitive tokens.
|
|
348
|
+
|
|
349
|
+
**Configuration**:
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
# Local .env (REAL mode)
|
|
353
|
+
BUSINESSMAP_API_TOKEN=your_token_here
|
|
354
|
+
BUSINESSMAP_API_URL=https://your-account.kanbanize.com/api/v2
|
|
355
|
+
|
|
356
|
+
# CI environment (MOCK mode)
|
|
357
|
+
# No credentials configured - tests run in mock mode automatically
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Setup and Maintenance
|
|
361
|
+
|
|
362
|
+
#### Initial Setup
|
|
363
|
+
|
|
364
|
+
The quality control system is automatically configured during project setup:
|
|
365
|
+
|
|
366
|
+
```bash
|
|
367
|
+
npm install # Installs Husky, commitlint, lint-staged
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Husky git hooks are installed automatically via the `prepare` script.
|
|
371
|
+
|
|
372
|
+
#### Branch Protection Setup
|
|
373
|
+
|
|
374
|
+
Configure GitHub branch protection rules:
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
bash scripts/setup-branch-protection.sh
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
This script requires a GitHub personal access token with `repo` scope. Follow the interactive prompts to configure branch protection.
|
|
381
|
+
|
|
382
|
+
#### Periodic Maintenance
|
|
383
|
+
|
|
384
|
+
**Branch Protection Verification** (Monthly):
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
bash scripts/setup-branch-protection.sh
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
Verifies that branch protection rules remain correctly configured.
|
|
391
|
+
|
|
392
|
+
**NPM Token Rotation** (Every 90 days):
|
|
393
|
+
|
|
394
|
+
1. Generate new NPM automation token
|
|
395
|
+
2. Update `NPM_TOKEN` secret in GitHub repository settings
|
|
396
|
+
3. See [docs/ONBOARDING.md](docs/ONBOARDING.md) for detailed instructions
|
|
397
|
+
|
|
398
|
+
### Workflow Example
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
# 1. Developer makes changes
|
|
402
|
+
git add src/index.ts
|
|
403
|
+
|
|
404
|
+
# 2. Attempts to commit
|
|
405
|
+
git commit -m "feat: add new feature"
|
|
406
|
+
# → Layer 2: Pre-commit hooks run (ESLint, Prettier, TypeScript)
|
|
407
|
+
# → Layer 3: Commitlint validates message format
|
|
408
|
+
# ✓ Commit created if all checks pass
|
|
409
|
+
|
|
410
|
+
# 3. Attempts to push
|
|
411
|
+
git push origin feature-branch
|
|
412
|
+
# → Layer 4: Pre-push hooks run (tests + integration tests with REAL API)
|
|
413
|
+
# ✓ Push succeeds if all tests pass
|
|
414
|
+
|
|
415
|
+
# 4. Creates pull request
|
|
416
|
+
# → Layer 1: Branch protection requires status checks
|
|
417
|
+
# → Layer 5: CI runs all validations (including bypass detection)
|
|
418
|
+
# ✓ PR can be merged if all CI checks pass
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### Troubleshooting
|
|
422
|
+
|
|
423
|
+
**Pre-commit hooks not running?**
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
npm run prepare # Reinstall Husky hooks
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
**Integration tests failing locally?**
|
|
430
|
+
|
|
431
|
+
```bash
|
|
432
|
+
# Verify credentials are configured
|
|
433
|
+
echo $BUSINESSMAP_API_TOKEN
|
|
434
|
+
# Should output your API token
|
|
435
|
+
|
|
436
|
+
# Run tests manually to see detailed output
|
|
437
|
+
npm run test:integration
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
**CI integration tests failing?**
|
|
441
|
+
|
|
442
|
+
- CI runs in MOCK mode - verify test structure is valid
|
|
443
|
+
- Check that schema validation logic is correct
|
|
444
|
+
- MOCK mode failures indicate structural issues, not credential problems
|
|
445
|
+
|
|
446
|
+
### Documentation
|
|
447
|
+
|
|
448
|
+
For comprehensive implementation details, see:
|
|
449
|
+
|
|
450
|
+
- **[docs/ONBOARDING.md](docs/ONBOARDING.md)**: Complete setup guide and maintenance procedures
|
|
451
|
+
- **[docs/specs/T058-T060-five-layer-quality-control.md](docs/specs/T058-T060-five-layer-quality-control.md)**: Technical specification
|
|
452
|
+
- **[.husky/](.husky/)**: Git hook implementations
|
|
453
|
+
- **[scripts/hooks/](scripts/hooks/)**: Hook execution scripts
|
|
454
|
+
|
|
151
455
|
## Claude Code Skills
|
|
152
456
|
|
|
153
457
|
For Claude Code users, this project includes specialized skills for interactive API guidance and best practices.
|
|
@@ -167,6 +471,7 @@ Or for project-specific skills, copy to `.claude/skills/` in your project root.
|
|
|
167
471
|
**When to use**: Ask "How do I [work with boards/cards/workspaces]?" or any BusinessMap workflow questions.
|
|
168
472
|
|
|
169
473
|
The consultant skill provides:
|
|
474
|
+
|
|
170
475
|
- Interactive workflow guidance for board setup, card migrations, bulk operations
|
|
171
476
|
- Tool usage demonstrations with actual MCP tool calls
|
|
172
477
|
- Common patterns: board structure, card hierarchies, custom fields
|
|
@@ -179,6 +484,7 @@ The consultant skill provides:
|
|
|
179
484
|
**When to use**: Encountering API errors (403, 404, 429, BS05) or unexpected behavior.
|
|
180
485
|
|
|
181
486
|
The troubleshooting skill provides:
|
|
487
|
+
|
|
182
488
|
- Error code diagnosis (HTTP 403/404/429/500, BS05)
|
|
183
489
|
- Authentication and configuration issue resolution
|
|
184
490
|
- Rate limiting strategies and solutions
|
|
@@ -192,6 +498,7 @@ The troubleshooting skill provides:
|
|
|
192
498
|
**When to use**: Optimizing API usage, implementing production deployments, or bulk operations.
|
|
193
499
|
|
|
194
500
|
The best practices skill provides:
|
|
501
|
+
|
|
195
502
|
- Performance optimization patterns (bulk operations, pagination strategies)
|
|
196
503
|
- Rate limiting strategies (token bucket, exponential backoff, circuit breaker)
|
|
197
504
|
- Caching strategies (board structure, user data, custom fields)
|
|
@@ -314,16 +621,16 @@ The BusinessMap MCP server provides the following tools:
|
|
|
314
621
|
|
|
315
622
|
## Tool Summary
|
|
316
623
|
|
|
317
|
-
The BusinessMap MCP server provides **
|
|
624
|
+
The BusinessMap MCP server provides **59 registered tools** across 9 categories (in full profile):
|
|
318
625
|
|
|
319
626
|
- **Workspace Management**: 5 tools
|
|
320
|
-
- **Board Management**:
|
|
627
|
+
- **Board Management**: 10 tools (`get_board` removed in favor of `get_current_board_structure`)
|
|
321
628
|
- **Card Management**: 25 tools (organized in 6 subcategories)
|
|
322
629
|
- **Custom Field Management**: 7 tools
|
|
323
|
-
- **Workflow & Cycle Time Analysis**: 2 tools
|
|
630
|
+
- **Workflow & Cycle Time Analysis**: 2 tools (`calculate_card_cycle_time` removed)
|
|
324
631
|
- **Bulk Operations**: 6 tools
|
|
325
632
|
- **User Management**: 3 tools
|
|
326
|
-
- **System**:
|
|
633
|
+
- **System**: 1 tool (`health_check` only; `list_instances`/`get_instance_info` never registered)
|
|
327
634
|
|
|
328
635
|
## Key Features
|
|
329
636
|
|
|
@@ -379,7 +686,8 @@ All tools follow consistent error handling patterns with specific failure causes
|
|
|
379
686
|
- **Remediation**: Contact workspace/board administrator to request elevated permissions or have admin perform the operation
|
|
380
687
|
|
|
381
688
|
**Example**:
|
|
382
|
-
|
|
689
|
+
|
|
690
|
+
```text
|
|
383
691
|
Error: Insufficient permissions. Workspace archiving requires workspace admin role.
|
|
384
692
|
Remediation: Contact workspace administrator to request elevated permissions.
|
|
385
693
|
```
|
|
@@ -393,7 +701,8 @@ Remediation: Contact workspace administrator to request elevated permissions.
|
|
|
393
701
|
- **Remediation**: Use corresponding list/get tool to verify resource ID before retry
|
|
394
702
|
|
|
395
703
|
**Example**:
|
|
396
|
-
|
|
704
|
+
|
|
705
|
+
```text
|
|
397
706
|
Error: Board not found. Verify resource exists.
|
|
398
707
|
Remediation: Use list_boards to retrieve current board IDs.
|
|
399
708
|
```
|
|
@@ -407,7 +716,8 @@ Remediation: Use list_boards to retrieve current board IDs.
|
|
|
407
716
|
- **Remediation**: Wait indicated time and retry. Consider batching operations using bulk tools.
|
|
408
717
|
|
|
409
718
|
**Example**:
|
|
410
|
-
|
|
719
|
+
|
|
720
|
+
```text
|
|
411
721
|
Error: Rate limit exceeded. Retry after 60 seconds.
|
|
412
722
|
Remediation: Wait 60 seconds and retry. For multiple operations, use bulk_update_cards instead of individual updates.
|
|
413
723
|
```
|
|
@@ -421,7 +731,8 @@ Remediation: Wait 60 seconds and retry. For multiple operations, use bulk_update
|
|
|
421
731
|
- **Remediation**: Review parameter requirements and adjust input
|
|
422
732
|
|
|
423
733
|
**Example**:
|
|
424
|
-
|
|
734
|
+
|
|
735
|
+
```bash
|
|
425
736
|
Error: Validation failed: Custom field name must be unique within board.
|
|
426
737
|
Remediation: Use list_board_custom_fields to check existing names, then choose a unique name.
|
|
427
738
|
```
|
|
@@ -435,7 +746,8 @@ Remediation: Use list_board_custom_fields to check existing names, then choose a
|
|
|
435
746
|
- **Remediation**: Review dependencies and confirm operation or cancel
|
|
436
747
|
|
|
437
748
|
**Example**:
|
|
438
|
-
|
|
749
|
+
|
|
750
|
+
```sql
|
|
439
751
|
⚠️ Delete Confirmation Required
|
|
440
752
|
|
|
441
753
|
Workspace "Marketing Team" (ID: 123)
|
|
@@ -457,7 +769,8 @@ Proceed with deletion? (yes/no):
|
|
|
457
769
|
- **Remediation**: Check network connection and retry. If persists, check BusinessMap status.
|
|
458
770
|
|
|
459
771
|
**Example**:
|
|
460
|
-
|
|
772
|
+
|
|
773
|
+
```text
|
|
461
774
|
Error: Connection failed: ECONNREFUSED
|
|
462
775
|
Remediation: Verify BUSINESSMAP_API_URL is correct and BusinessMap service is accessible. Retry after verifying connection.
|
|
463
776
|
```
|
|
@@ -465,20 +778,24 @@ Remediation: Verify BUSINESSMAP_API_URL is correct and BusinessMap service is ac
|
|
|
465
778
|
### Error Handling by Tool Category
|
|
466
779
|
|
|
467
780
|
#### Workspace Operations
|
|
781
|
+
|
|
468
782
|
- `update_workspace`, `archive_workspace`: Permissions, NotFound, RateLimit
|
|
469
783
|
- `bulk_archive_workspaces`, `bulk_update_workspaces`: All above + CascadeConfirmation for workspaces with boards
|
|
470
784
|
|
|
471
785
|
#### Board Operations
|
|
786
|
+
|
|
472
787
|
- `update_board`, `delete_board`: Permissions, NotFound, RateLimit
|
|
473
788
|
- `bulk_delete_boards`, `bulk_update_boards`: All above + CascadeConfirmation for boards with cards
|
|
474
789
|
|
|
475
790
|
#### Card Operations
|
|
791
|
+
|
|
476
792
|
- `delete_card`: NotFound, RateLimit, CascadeConfirmation (if has children/comments/subtasks)
|
|
477
793
|
- `update_card_comment`, `delete_card_comment`: NotFound, RateLimit, Permissions
|
|
478
794
|
- `update_card_subtask`, `delete_card_subtask`: NotFound, RateLimit
|
|
479
795
|
- `bulk_delete_cards`, `bulk_update_cards`: All above + CascadeConfirmation
|
|
480
796
|
|
|
481
797
|
#### Custom Field Operations
|
|
798
|
+
|
|
482
799
|
- `create_custom_field`, `update_custom_field`: Validation (name uniqueness, type constraints), RateLimit
|
|
483
800
|
- `delete_custom_field`: Permissions, NotFound, CascadeConfirmation (shows affected boards/cards)
|
|
484
801
|
|
|
@@ -502,6 +819,11 @@ npm run build
|
|
|
502
819
|
# Run tests
|
|
503
820
|
npm test
|
|
504
821
|
|
|
822
|
+
# Performance benchmarks
|
|
823
|
+
npm run benchmark:profile # Profile registration performance
|
|
824
|
+
npm run measure:profile # Token usage by profile
|
|
825
|
+
npm run measure:baseline # Baseline token metrics
|
|
826
|
+
|
|
505
827
|
# Lint code
|
|
506
828
|
npm run lint
|
|
507
829
|
```
|
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
import { BusinessMapConfig } from '../types/index.js';
|
|
2
2
|
import { BoardFilters } from './modules/board-client.js';
|
|
3
3
|
import { BoardClient, CardClient, CardFilters, WorkspaceClient } from './modules/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* BusinessMap API Client
|
|
6
|
+
*
|
|
7
|
+
* Main client class for interacting with the BusinessMap API v2.
|
|
8
|
+
* Provides a comprehensive interface for managing workspaces, boards, cards,
|
|
9
|
+
* users, custom fields, and workflows.
|
|
10
|
+
*
|
|
11
|
+
* Features:
|
|
12
|
+
* - Automatic retry with exponential backoff for rate limits (429 errors)
|
|
13
|
+
* - Rate limit monitoring and warnings at 80% quota usage
|
|
14
|
+
* - Modular architecture with specialized clients for each resource type
|
|
15
|
+
* - Built-in caching support across all module clients
|
|
16
|
+
* - Request timeout of 30 seconds
|
|
17
|
+
* - Comprehensive error transformation and handling
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Create and initialize client
|
|
22
|
+
* const config = {
|
|
23
|
+
* apiUrl: 'https://mycompany.businessmap.io/api/v2',
|
|
24
|
+
* apiToken: process.env.BUSINESSMAP_API_TOKEN,
|
|
25
|
+
* };
|
|
26
|
+
* const client = new BusinessMapClient(config);
|
|
27
|
+
* await client.initialize();
|
|
28
|
+
*
|
|
29
|
+
* // Use the client
|
|
30
|
+
* const workspaces = await client.getWorkspaces();
|
|
31
|
+
* const boards = await client.getBoards({ workspace_id: 1 });
|
|
32
|
+
* const cards = await client.getCards(boardId, { owner_user_ids: [userId] });
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @see {@link BusinessMapClientFactory} for multi-instance support
|
|
36
|
+
*/
|
|
4
37
|
export declare class BusinessMapClient {
|
|
5
38
|
private http;
|
|
6
39
|
private readonly config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"businessmap-client.d.ts","sourceRoot":"","sources":["../../src/client/businessmap-client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EAKX,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAE5B,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,IAAI,CAAgB;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,aAAa,CAAkB;IAGvC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,UAAU,CAAa;IAC/B,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AU;IAIhB;;OAEG;IACH,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAYhG;;OAEG;IACH,cAAc,IAAI,IAAI;CAavB"}
|
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import axiosRetry from 'axios-retry';
|
|
3
3
|
import { BoardClient, CardClient, CustomFieldClient, UserClient, UtilityClient, WorkflowClient, WorkspaceClient, } from './modules/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* BusinessMap API Client
|
|
6
|
+
*
|
|
7
|
+
* Main client class for interacting with the BusinessMap API v2.
|
|
8
|
+
* Provides a comprehensive interface for managing workspaces, boards, cards,
|
|
9
|
+
* users, custom fields, and workflows.
|
|
10
|
+
*
|
|
11
|
+
* Features:
|
|
12
|
+
* - Automatic retry with exponential backoff for rate limits (429 errors)
|
|
13
|
+
* - Rate limit monitoring and warnings at 80% quota usage
|
|
14
|
+
* - Modular architecture with specialized clients for each resource type
|
|
15
|
+
* - Built-in caching support across all module clients
|
|
16
|
+
* - Request timeout of 30 seconds
|
|
17
|
+
* - Comprehensive error transformation and handling
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Create and initialize client
|
|
22
|
+
* const config = {
|
|
23
|
+
* apiUrl: 'https://mycompany.businessmap.io/api/v2',
|
|
24
|
+
* apiToken: process.env.BUSINESSMAP_API_TOKEN,
|
|
25
|
+
* };
|
|
26
|
+
* const client = new BusinessMapClient(config);
|
|
27
|
+
* await client.initialize();
|
|
28
|
+
*
|
|
29
|
+
* // Use the client
|
|
30
|
+
* const workspaces = await client.getWorkspaces();
|
|
31
|
+
* const boards = await client.getBoards({ workspace_id: 1 });
|
|
32
|
+
* const cards = await client.getCards(boardId, { owner_user_ids: [userId] });
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @see {@link BusinessMapClientFactory} for multi-instance support
|
|
36
|
+
*/
|
|
4
37
|
export class BusinessMapClient {
|
|
5
38
|
http;
|
|
6
39
|
config;
|
|
@@ -30,8 +63,7 @@ export class BusinessMapClient {
|
|
|
30
63
|
retryDelay: axiosRetry.exponentialDelay,
|
|
31
64
|
retryCondition: (error) => {
|
|
32
65
|
// Retry on rate limit (429) or network errors
|
|
33
|
-
return (axiosRetry.isNetworkOrIdempotentRequestError(error) ||
|
|
34
|
-
error.response?.status === 429);
|
|
66
|
+
return (axiosRetry.isNetworkOrIdempotentRequestError(error) || error.response?.status === 429);
|
|
35
67
|
},
|
|
36
68
|
onRetry: (retryCount, error) => {
|
|
37
69
|
const retryAfter = error.response?.headers?.['retry-after'];
|