@knowledgine/cli 0.2.0 → 0.2.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 (104) hide show
  1. package/dist/commands/capture.d.ts +13 -0
  2. package/dist/commands/capture.d.ts.map +1 -1
  3. package/dist/commands/capture.js +116 -11
  4. package/dist/commands/capture.js.map +1 -1
  5. package/dist/commands/demo.d.ts.map +1 -1
  6. package/dist/commands/demo.js +23 -19
  7. package/dist/commands/demo.js.map +1 -1
  8. package/dist/commands/feedback.d.ts +9 -0
  9. package/dist/commands/feedback.d.ts.map +1 -1
  10. package/dist/commands/feedback.js +62 -21
  11. package/dist/commands/feedback.js.map +1 -1
  12. package/dist/commands/ingest.d.ts +1 -0
  13. package/dist/commands/ingest.d.ts.map +1 -1
  14. package/dist/commands/ingest.js +82 -18
  15. package/dist/commands/ingest.js.map +1 -1
  16. package/dist/commands/init.d.ts.map +1 -1
  17. package/dist/commands/init.js +88 -60
  18. package/dist/commands/init.js.map +1 -1
  19. package/dist/commands/plugins.d.ts.map +1 -1
  20. package/dist/commands/plugins.js +14 -13
  21. package/dist/commands/plugins.js.map +1 -1
  22. package/dist/commands/search.d.ts.map +1 -1
  23. package/dist/commands/search.js +35 -12
  24. package/dist/commands/search.js.map +1 -1
  25. package/dist/commands/setup.d.ts +48 -5
  26. package/dist/commands/setup.d.ts.map +1 -1
  27. package/dist/commands/setup.js +263 -99
  28. package/dist/commands/setup.js.map +1 -1
  29. package/dist/commands/start.d.ts.map +1 -1
  30. package/dist/commands/start.js +27 -20
  31. package/dist/commands/start.js.map +1 -1
  32. package/dist/commands/status.d.ts.map +1 -1
  33. package/dist/commands/status.js +81 -53
  34. package/dist/commands/status.js.map +1 -1
  35. package/dist/commands/tool.d.ts.map +1 -1
  36. package/dist/commands/tool.js +5 -5
  37. package/dist/commands/tool.js.map +1 -1
  38. package/dist/commands/upgrade.d.ts.map +1 -1
  39. package/dist/commands/upgrade.js +64 -18
  40. package/dist/commands/upgrade.js.map +1 -1
  41. package/dist/index.js +51 -17
  42. package/dist/index.js.map +1 -1
  43. package/dist/lib/entity-extractor.d.ts +15 -0
  44. package/dist/lib/entity-extractor.d.ts.map +1 -0
  45. package/dist/lib/entity-extractor.js +86 -0
  46. package/dist/lib/entity-extractor.js.map +1 -0
  47. package/dist/lib/formatter.d.ts.map +1 -1
  48. package/dist/lib/formatter.js +35 -32
  49. package/dist/lib/formatter.js.map +1 -1
  50. package/dist/lib/indexer.d.ts +2 -0
  51. package/dist/lib/indexer.d.ts.map +1 -1
  52. package/dist/lib/indexer.js +2 -0
  53. package/dist/lib/indexer.js.map +1 -1
  54. package/dist/lib/ingest-watcher.d.ts.map +1 -1
  55. package/dist/lib/ingest-watcher.js +1 -0
  56. package/dist/lib/ingest-watcher.js.map +1 -1
  57. package/dist/lib/progress.d.ts +6 -0
  58. package/dist/lib/progress.d.ts.map +1 -1
  59. package/dist/lib/progress.js +42 -5
  60. package/dist/lib/progress.js.map +1 -1
  61. package/dist/lib/ui/box.d.ts +7 -0
  62. package/dist/lib/ui/box.d.ts.map +1 -0
  63. package/dist/lib/ui/box.js +19 -0
  64. package/dist/lib/ui/box.js.map +1 -0
  65. package/dist/lib/ui/error-formatter.d.ts +8 -0
  66. package/dist/lib/ui/error-formatter.d.ts.map +1 -0
  67. package/dist/lib/ui/error-formatter.js +21 -0
  68. package/dist/lib/ui/error-formatter.js.map +1 -0
  69. package/dist/lib/ui/index.d.ts +7 -0
  70. package/dist/lib/ui/index.d.ts.map +1 -0
  71. package/dist/lib/ui/index.js +7 -0
  72. package/dist/lib/ui/index.js.map +1 -0
  73. package/dist/lib/ui/output.d.ts +2 -0
  74. package/dist/lib/ui/output.d.ts.map +1 -0
  75. package/dist/lib/ui/output.js +4 -0
  76. package/dist/lib/ui/output.js.map +1 -0
  77. package/dist/lib/ui/spinner.d.ts +4 -0
  78. package/dist/lib/ui/spinner.d.ts.map +1 -0
  79. package/dist/lib/ui/spinner.js +5 -0
  80. package/dist/lib/ui/spinner.js.map +1 -0
  81. package/dist/lib/ui/table.d.ts +9 -0
  82. package/dist/lib/ui/table.d.ts.map +1 -0
  83. package/dist/lib/ui/table.js +28 -0
  84. package/dist/lib/ui/table.js.map +1 -0
  85. package/dist/lib/ui/theme.d.ts +21 -0
  86. package/dist/lib/ui/theme.d.ts.map +1 -0
  87. package/dist/lib/ui/theme.js +29 -0
  88. package/dist/lib/ui/theme.js.map +1 -0
  89. package/dist/lib/unknown-command-handler.d.ts +14 -0
  90. package/dist/lib/unknown-command-handler.d.ts.map +1 -0
  91. package/dist/lib/unknown-command-handler.js +25 -0
  92. package/dist/lib/unknown-command-handler.js.map +1 -0
  93. package/dist/lib/url-validator.d.ts.map +1 -1
  94. package/dist/lib/url-validator.js +5 -1
  95. package/dist/lib/url-validator.js.map +1 -1
  96. package/fixtures/demo/notes/api-design-decisions.md +7 -2
  97. package/fixtures/demo/notes/auth-debugging.md +8 -0
  98. package/fixtures/demo/notes/ci-cd-pipeline.md +7 -0
  99. package/fixtures/demo/notes/code-review-notes.md +7 -0
  100. package/fixtures/demo/notes/database-optimization.md +8 -0
  101. package/fixtures/demo/notes/docker-troubleshooting.md +7 -1
  102. package/fixtures/demo/notes/react-performance.md +7 -6
  103. package/fixtures/demo/notes/typescript-migration.md +13 -4
  104. package/package.json +11 -4
@@ -6,14 +6,18 @@ tags:
6
6
  author: demo-user
7
7
  project: infrastructure
8
8
  ---
9
+
9
10
  # CI/CD Pipeline Setup and Debugging
10
11
 
11
12
  ## Problem
13
+
12
14
  The CI pipeline was taking 25 minutes per push, blocking the
13
15
  development workflow. Flaky tests caused unnecessary re-runs.
14
16
 
15
17
  ## Investigation
18
+
16
19
  Analyzed GitHub Actions run logs:
20
+
17
21
  - Dependency install: 4 minutes (no caching)
18
22
  - Build: 3 minutes
19
23
  - Tests: 15 minutes (sequential, with 3 flaky tests)
@@ -59,6 +63,7 @@ jobs:
59
63
  ```
60
64
 
61
65
  ### Flaky Test Fix
66
+
62
67
  ```typescript
63
68
  // Before: timing-dependent test
64
69
  it("should debounce input", async () => {
@@ -78,11 +83,13 @@ it("should debounce input", () => {
78
83
  ```
79
84
 
80
85
  ## Results
86
+
81
87
  - Pipeline time: 25 min → 8 min (68% reduction)
82
88
  - Flaky test rate: 15% → 0%
83
89
  - Developer satisfaction significantly improved
84
90
 
85
91
  ## Learnings
92
+
86
93
  - Cache dependencies aggressively in CI
87
94
  - Run lint and tests in parallel jobs
88
95
  - Flaky tests erode trust — fix them immediately
@@ -6,15 +6,18 @@ tags:
6
6
  author: demo-user
7
7
  project: team-process
8
8
  ---
9
+
9
10
  # Code Review Guidelines and Common Issues
10
11
 
11
12
  ## Problem
13
+
12
14
  Code reviews were inconsistent. Some PRs got rubber-stamped while
13
15
  others received 50+ nitpick comments. Reviews took 2-3 days on average.
14
16
 
15
17
  ## Solution: Review Checklist
16
18
 
17
19
  ### What to Check
20
+
18
21
  1. **Correctness**: Does the code do what the PR description says?
19
22
  2. **Edge cases**: Null handling, empty arrays, boundary conditions
20
23
  3. **Security**: Input validation, SQL injection, XSS
@@ -24,6 +27,7 @@ others received 50+ nitpick comments. Reviews took 2-3 days on average.
24
27
  ### Common Issues Found in Reviews
25
28
 
26
29
  #### Error handling gaps
30
+
27
31
  ```typescript
28
32
  // Bad: swallows errors silently
29
33
  try {
@@ -42,6 +46,7 @@ try {
42
46
  ```
43
47
 
44
48
  #### Missing input validation
49
+
45
50
  ```typescript
46
51
  // Bad: trusts external input
47
52
  app.post("/api/users", (req, res) => {
@@ -59,12 +64,14 @@ app.post("/api/users", (req, res) => {
59
64
  ```
60
65
 
61
66
  ## Process Improvements
67
+
62
68
  - Max review turnaround: 4 hours for small PRs, 1 day for large
63
69
  - Use "Request changes" only for blocking issues
64
70
  - Prefix comments: `nit:`, `question:`, `suggestion:`, `blocking:`
65
71
  - Author should self-review before requesting review
66
72
 
67
73
  ## Learnings
74
+
68
75
  - Checklists reduce review inconsistency
69
76
  - Small PRs (< 300 lines) get better reviews and faster merges
70
77
  - Automate what you can (linting, formatting, type checking)
@@ -6,13 +6,16 @@ tags:
6
6
  author: demo-user
7
7
  project: backend-api
8
8
  ---
9
+
9
10
  # SQL Query Optimization and Indexing
10
11
 
11
12
  ## Problem
13
+
12
14
  The notes search endpoint was timing out with 100k+ rows.
13
15
  Average query time was 4.2 seconds, causing user-visible latency.
14
16
 
15
17
  ### Slow Query
18
+
16
19
  ```sql
17
20
  SELECT n.*, COUNT(p.id) as pattern_count
18
21
  FROM notes n
@@ -25,7 +28,9 @@ LIMIT 20;
25
28
  ```
26
29
 
27
30
  ## Investigation
31
+
28
32
  Used `EXPLAIN ANALYZE` to identify bottlenecks:
33
+
29
34
  ```sql
30
35
  EXPLAIN ANALYZE SELECT ...;
31
36
  -- Seq Scan on notes (cost=0.00..12847.00 rows=100234 width=412)
@@ -50,6 +55,7 @@ CREATE INDEX idx_patterns_note_id ON patterns (note_id);
50
55
  ```
51
56
 
52
57
  ### Rewritten Query
58
+
53
59
  ```sql
54
60
  SELECT n.*, COUNT(p.id) as pattern_count
55
61
  FROM notes n
@@ -62,10 +68,12 @@ LIMIT 20;
62
68
  ```
63
69
 
64
70
  ## Results
71
+
65
72
  - Query time: 4.2s → 18ms (233x improvement)
66
73
  - Index storage overhead: ~45MB (acceptable for 100k rows)
67
74
 
68
75
  ## Learnings
76
+
69
77
  - `LIKE '%term%'` cannot use indexes — always use full-text search
70
78
  - `EXPLAIN ANALYZE` is the first tool to reach for
71
79
  - Covering indexes avoid table lookups for frequently joined columns
@@ -6,9 +6,11 @@ tags:
6
6
  author: demo-user
7
7
  project: microservices
8
8
  ---
9
+
9
10
  # Docker Container Networking Issues
10
11
 
11
12
  ## Problem
13
+
12
14
  Containers in docker-compose could not communicate with each other.
13
15
  The API service failed to connect to the database container.
14
16
 
@@ -17,11 +19,13 @@ Error: connect ECONNREFUSED 127.0.0.1:5432
17
19
  ```
18
20
 
19
21
  ## Investigation
22
+
20
23
  - Verified both containers were running: `docker ps` showed healthy status
21
24
  - Checked network: `docker network ls` showed custom bridge network
22
25
  - The API was using `localhost` instead of the service name
23
26
 
24
27
  ## Solution
28
+
25
29
  Docker containers have their own network namespace. Use the service
26
30
  name as the hostname, not `localhost`.
27
31
 
@@ -32,7 +36,7 @@ services:
32
36
  build: ./api
33
37
  environment:
34
38
  # Wrong: DB_HOST=localhost
35
- DB_HOST: postgres # Use service name
39
+ DB_HOST: postgres # Use service name
36
40
  DB_PORT: 5432
37
41
  depends_on:
38
42
  postgres:
@@ -48,6 +52,7 @@ services:
48
52
  ```
49
53
 
50
54
  ## Additional Fix: DNS Resolution Timing
55
+
51
56
  Even with correct hostnames, the API started before DNS was ready.
52
57
 
53
58
  ```typescript
@@ -68,6 +73,7 @@ async function connectWithRetry(maxRetries = 5): Promise<Pool> {
68
73
  ```
69
74
 
70
75
  ## Learnings
76
+
71
77
  - Never use `localhost` for inter-container communication
72
78
  - Use `depends_on` with health checks, not just service ordering
73
79
  - Add connection retry logic for resilience
@@ -6,13 +6,16 @@ tags:
6
6
  author: demo-user
7
7
  project: dashboard-app
8
8
  ---
9
+
9
10
  # React Performance Optimization
10
11
 
11
12
  ## Issue
13
+
12
14
  The dashboard page was taking 3+ seconds to render with 500 items.
13
15
  React DevTools Profiler showed excessive re-renders on every state change.
14
16
 
15
17
  ## Root Cause Analysis
18
+
16
19
  1. Parent component state changes triggered full list re-render
17
20
  2. Inline arrow functions in JSX created new references each render
18
21
  3. Large bundle size from importing entire icon library
@@ -21,14 +24,10 @@ React DevTools Profiler showed excessive re-renders on every state change.
21
24
 
22
25
  ```tsx
23
26
  // Before: re-renders on every parent state change
24
- const ListItem = ({ item, onClick }) => (
25
- <div onClick={() => onClick(item.id)}>{item.name}</div>
26
- );
27
+ const ListItem = ({ item, onClick }) => <div onClick={() => onClick(item.id)}>{item.name}</div>;
27
28
 
28
29
  // After: memoized with stable callback
29
- const ListItem = React.memo(({ item, onClick }) => (
30
- <div onClick={onClick}>{item.name}</div>
31
- ));
30
+ const ListItem = React.memo(({ item, onClick }) => <div onClick={onClick}>{item.name}</div>);
32
31
 
33
32
  // Parent: stable callback reference
34
33
  const handleClick = useCallback((id: string) => {
@@ -55,11 +54,13 @@ function Dashboard() {
55
54
  ```
56
55
 
57
56
  ## Results
57
+
58
58
  - Initial render: 3.2s → 0.8s (75% improvement)
59
59
  - Re-render on selection: 450ms → 12ms
60
60
  - Bundle size: 1.2MB → 680KB
61
61
 
62
62
  ## Learnings
63
+
63
64
  - Profile before optimizing — measure actual bottlenecks
64
65
  - React.memo only helps when props are actually stable
65
66
  - Lazy loading is most effective for below-the-fold content
@@ -6,17 +6,21 @@ tags:
6
6
  author: demo-user
7
7
  project: legacy-app
8
8
  ---
9
+
9
10
  # JavaScript to TypeScript Migration
10
11
 
11
12
  ## Problem
13
+
12
14
  The legacy Express app (50+ files) had no type safety. Runtime errors
13
15
  were discovered only in production, and onboarding new developers
14
16
  took weeks due to lack of type documentation.
15
17
 
16
18
  ## Migration Strategy
19
+
17
20
  Adopted an incremental approach instead of a big-bang rewrite.
18
21
 
19
22
  ### Phase 1: Setup (Day 1)
23
+
20
24
  ```jsonc
21
25
  // tsconfig.json - permissive start
22
26
  {
@@ -25,13 +29,14 @@ Adopted an incremental approach instead of a big-bang rewrite.
25
29
  "checkJs": false,
26
30
  "strict": false,
27
31
  "outDir": "dist",
28
- "rootDir": "src"
32
+ "rootDir": "src",
29
33
  },
30
- "include": ["src/**/*"]
34
+ "include": ["src/**/*"],
31
35
  }
32
36
  ```
33
37
 
34
38
  ### Phase 2: Rename files (Week 1)
39
+
35
40
  ```bash
36
41
  # Renamed .js → .ts one directory at a time
37
42
  # Started with utility files that had no dependencies
@@ -39,6 +44,7 @@ find src/utils -name "*.js" -exec bash -c 'mv "$0" "${0%.js}.ts"' {} \;
39
44
  ```
40
45
 
41
46
  ### Phase 3: Add types gradually (Week 2-4)
47
+
42
48
  ```typescript
43
49
  // Before: implicit any everywhere
44
50
  function processUser(user) {
@@ -58,21 +64,24 @@ function processUser(user: User): { name: string; role: string } {
58
64
  ```
59
65
 
60
66
  ### Phase 4: Enable strict mode (Week 5)
67
+
61
68
  ```jsonc
62
69
  {
63
70
  "compilerOptions": {
64
71
  "strict": true,
65
- "noUncheckedIndexedAccess": true
66
- }
72
+ "noUncheckedIndexedAccess": true,
73
+ },
67
74
  }
68
75
  ```
69
76
 
70
77
  ## Results
78
+
71
79
  - Runtime type errors: 12/month → 0/month
72
80
  - Onboarding time: 3 weeks → 1 week
73
81
  - Refactoring confidence: significantly improved with IDE support
74
82
 
75
83
  ## Learnings
84
+
76
85
  - Incremental migration is key — never stop shipping features
77
86
  - Start with leaf files (utilities), move inward to core logic
78
87
  - `@ts-expect-error` is better than `any` for tracking tech debt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowledgine/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -14,11 +14,18 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
+ "@clack/prompts": "^1.1.0",
18
+ "boxen": "^8.0.1",
19
+ "chalk": "^5.6.2",
17
20
  "chokidar": "^5.0.0",
21
+ "cli-table3": "^0.6.5",
18
22
  "commander": "^14.0.3",
19
- "@knowledgine/core": "0.2.0",
20
- "@knowledgine/mcp-server": "0.2.0",
21
- "@knowledgine/ingest": "0.2.0"
23
+ "log-symbols": "^7.0.1",
24
+ "ora": "^9.3.0",
25
+ "smol-toml": "^1.6.0",
26
+ "@knowledgine/core": "0.2.1",
27
+ "@knowledgine/ingest": "0.2.1",
28
+ "@knowledgine/mcp-server": "0.2.1"
22
29
  },
23
30
  "files": [
24
31
  "dist",