@kiyeonjeon21/datacontext 0.2.0 → 0.3.1

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.
Files changed (55) hide show
  1. package/.cursorrules +12 -0
  2. package/.env.example +8 -0
  3. package/.github/workflows/ci.yml +21 -1
  4. package/.github/workflows/publish.yml +21 -1
  5. package/CHANGELOG.md +41 -0
  6. package/README.md +247 -239
  7. package/cursor-mcp-config.json.example +29 -0
  8. package/datacontext.db +0 -0
  9. package/dist/api/server.d.ts.map +1 -1
  10. package/dist/api/server.js +145 -0
  11. package/dist/api/server.js.map +1 -1
  12. package/dist/api/start-server.d.ts +10 -0
  13. package/dist/api/start-server.d.ts.map +1 -0
  14. package/dist/api/start-server.js +73 -0
  15. package/dist/api/start-server.js.map +1 -0
  16. package/dist/cli/index.js +462 -0
  17. package/dist/cli/index.js.map +1 -1
  18. package/dist/core/context-service.d.ts +72 -0
  19. package/dist/core/context-service.d.ts.map +1 -1
  20. package/dist/core/context-service.js +132 -0
  21. package/dist/core/context-service.js.map +1 -1
  22. package/dist/core/index.d.ts +2 -0
  23. package/dist/core/index.d.ts.map +1 -1
  24. package/dist/core/index.js +5 -1
  25. package/dist/core/index.js.map +1 -1
  26. package/dist/core/llm-service.d.ts +141 -0
  27. package/dist/core/llm-service.d.ts.map +1 -0
  28. package/dist/core/llm-service.js +284 -0
  29. package/dist/core/llm-service.js.map +1 -0
  30. package/dist/knowledge/store.d.ts +56 -3
  31. package/dist/knowledge/store.d.ts.map +1 -1
  32. package/dist/knowledge/store.js +193 -7
  33. package/dist/knowledge/store.js.map +1 -1
  34. package/dist/knowledge/types.d.ts +43 -1
  35. package/dist/knowledge/types.d.ts.map +1 -1
  36. package/dist/knowledge/types.js.map +1 -1
  37. package/dist/mcp/tools.d.ts.map +1 -1
  38. package/dist/mcp/tools.js +365 -0
  39. package/dist/mcp/tools.js.map +1 -1
  40. package/docs/API.md +173 -0
  41. package/docs/DEMO_SCRIPT.md +210 -0
  42. package/docs/MCP_TEST_GUIDE.md +414 -0
  43. package/docs/SYNC_GUIDE.md +242 -0
  44. package/package.json +4 -1
  45. package/src/api/server.ts +160 -0
  46. package/src/api/start-server.ts +78 -0
  47. package/src/cli/index.ts +534 -0
  48. package/src/core/context-service.ts +182 -0
  49. package/src/core/index.ts +7 -0
  50. package/src/core/llm-service.ts +359 -0
  51. package/src/knowledge/store.ts +232 -7
  52. package/src/knowledge/types.ts +45 -1
  53. package/src/mcp/tools.ts +415 -0
  54. package/test-glossary.yaml +55 -0
  55. package/test-mcp.db +0 -0
package/.cursorrules CHANGED
@@ -4,6 +4,8 @@
4
4
  MCP server + REST API + SDK for AI-native database context.
5
5
  Open-source, offline-first. Business docs in `../datacontext/`.
6
6
 
7
+ **중요:** 코드 변경 시 `docs/SYNC_GUIDE.md`를 참고하여 관련 컴포넌트(VSCode Extension, 문서 등)도 함께 업데이트하세요.
8
+
7
9
  ## Architecture
8
10
  ```
9
11
  src/
@@ -51,6 +53,16 @@ TypeScript (strict), Node.js 18+, npm, Vitest
51
53
  1. Add route in `src/api/server.ts`
52
54
  2. Use `service` (DataContextService), not adapters directly
53
55
  3. Update `docs/API.md`
56
+ 4. **Sync:** Update `vscode-datacontext/src/services/connectionManager.ts`
57
+ 5. **Sync:** Update `vscode-datacontext/README.md` API Endpoints 섹션
58
+
59
+ ### Sync Checklist (중요!)
60
+ REST API/MCP Tool 변경 시 아래 파일들도 확인:
61
+ - `vscode-datacontext/src/services/connectionManager.ts` — API 메서드
62
+ - `vscode-datacontext/src/extension.ts` — 명령어 핸들러
63
+ - `vscode-datacontext/package.json` — commands 정의
64
+ - `vscode-datacontext/README.md` — 문서
65
+ - 자세한 내용: `docs/SYNC_GUIDE.md`
54
66
 
55
67
  ## Testing
56
68
  ```bash
package/.env.example ADDED
@@ -0,0 +1,8 @@
1
+ # DataContext Environment Variables
2
+ # Copy this file to .env and fill in your values
3
+
4
+ # Claude API Key for LLM features (required for auto-glossary generation)
5
+ ANTHROPIC_API_KEY=your-api-key-here
6
+
7
+ # Optional: Default model
8
+ # ANTHROPIC_MODEL=claude-sonnet-4-20250514
@@ -10,6 +10,21 @@ jobs:
10
10
  test:
11
11
  runs-on: ubuntu-latest
12
12
 
13
+ services:
14
+ postgres:
15
+ image: postgres:15
16
+ env:
17
+ POSTGRES_USER: postgres
18
+ POSTGRES_PASSWORD: postgres
19
+ POSTGRES_DB: datacontext_test
20
+ ports:
21
+ - 5432:5432
22
+ options: >-
23
+ --health-cmd pg_isready
24
+ --health-interval 10s
25
+ --health-timeout 5s
26
+ --health-retries 5
27
+
13
28
  strategy:
14
29
  matrix:
15
30
  node-version: [18.x, 20.x]
@@ -31,6 +46,12 @@ jobs:
31
46
 
32
47
  - name: Run tests
33
48
  run: npm test
49
+ env:
50
+ PGHOST: localhost
51
+ PGPORT: 5432
52
+ PGUSER: postgres
53
+ PGPASSWORD: postgres
54
+ PGDATABASE: datacontext_test
34
55
 
35
56
  lint:
36
57
  runs-on: ubuntu-latest
@@ -49,4 +70,3 @@ jobs:
49
70
 
50
71
  - name: Build
51
72
  run: npm run build
52
-
@@ -8,6 +8,21 @@ jobs:
8
8
  publish:
9
9
  runs-on: ubuntu-latest
10
10
 
11
+ services:
12
+ postgres:
13
+ image: postgres:15
14
+ env:
15
+ POSTGRES_USER: postgres
16
+ POSTGRES_PASSWORD: postgres
17
+ POSTGRES_DB: datacontext_test
18
+ ports:
19
+ - 5432:5432
20
+ options: >-
21
+ --health-cmd pg_isready
22
+ --health-interval 10s
23
+ --health-timeout 5s
24
+ --health-retries 5
25
+
11
26
  permissions:
12
27
  contents: read
13
28
  id-token: write
@@ -30,9 +45,14 @@ jobs:
30
45
 
31
46
  - name: Run tests
32
47
  run: npm test
48
+ env:
49
+ PGHOST: localhost
50
+ PGPORT: 5432
51
+ PGUSER: postgres
52
+ PGPASSWORD: postgres
53
+ PGDATABASE: datacontext_test
33
54
 
34
55
  - name: Publish to npm
35
56
  run: npm publish --access public
36
57
  env:
37
58
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
38
-
package/CHANGELOG.md CHANGED
@@ -7,6 +7,47 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.0] - 2025-01-01
11
+
12
+ ### Added
13
+ - **Business Glossary System**: Define custom business terms and let AI use them
14
+ - `glossary add` - Add terms manually with SQL expressions
15
+ - `glossary list` - List all terms with filtering
16
+ - `glossary search` - Search for terms by name/synonyms
17
+ - `glossary generate` - AI-powered term generation from natural language
18
+ - `glossary export` - Export to YAML/JSON for version control
19
+ - `glossary import` - Import from YAML/JSON files
20
+ - `glossary delete` - Remove terms
21
+ - **Query Enhancement**: `enhance_query` MCP tool and REST endpoint
22
+ - Matches natural language queries to glossary terms
23
+ - Returns SQL conditions for matched terms
24
+ - Uses local matching first, then AI if available
25
+ - **REST API Endpoints**:
26
+ - `GET /api/terms` - List all terms
27
+ - `GET /api/terms/search?q=` - Search terms
28
+ - `POST /api/terms` - Add term manually
29
+ - `POST /api/terms/generate` - AI-powered generation
30
+ - `POST /api/terms/enhance` - Enhance query with terms
31
+ - `DELETE /api/terms/:id` - Delete term
32
+ - **MCP Tools**: `generate_glossary`, `add_term`, `list_terms`, `search_terms`, `enhance_query`
33
+ - API server start script: `npm run serve` for standalone server
34
+ - Claude API integration for AI features (requires `ANTHROPIC_API_KEY`)
35
+
36
+ ### Changed
37
+ - Updated documentation with glossary CLI commands
38
+ - Added glossary to knowledge store structure
39
+
40
+ ## [0.2.0] - 2025-01-01
41
+
42
+ ### Added
43
+ - REST API server with Express.js
44
+ - SQLite adapter
45
+ - MySQL/MariaDB adapter
46
+ - Feedback loop with query correction tracking
47
+ - Metrics collection and reporting
48
+ - Cost estimation with EXPLAIN analysis
49
+ - Auto-harvesting of DB metadata
50
+
10
51
  ## [0.1.0] - 2025-01-01
11
52
 
12
53
  ### Added