lynkr 0.1.4 → 1.0.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.
@@ -0,0 +1,215 @@
1
+ # GitHub Actions Workflows
2
+
3
+ This directory contains GitHub Actions workflows for automated testing and CI/CD.
4
+
5
+ ## Available Workflows
6
+
7
+ ### 1. CI Tests (`ci.yml`)
8
+
9
+ **Purpose:** Run comprehensive test suite on every push and pull request
10
+
11
+ **Triggers:**
12
+ - Push to `main` or `develop` branches
13
+ - Pull requests to `main` or `develop` branches
14
+
15
+ **What it does:**
16
+ - Tests on Node.js 20.x and 22.x
17
+ - Runs linter (`npm run lint`)
18
+ - Runs unit tests (`npm run test:unit`)
19
+ - Runs performance tests (`npm run test:performance`)
20
+ - Uses npm cache for faster builds
21
+
22
+ **Environment Variables:**
23
+ - `DATABRICKS_API_KEY=test-key` (mock value for tests)
24
+ - `DATABRICKS_API_BASE=http://test.com` (mock value for tests)
25
+
26
+ **Status:** Runs on every push/PR, fails if unit tests fail
27
+
28
+ ---
29
+
30
+ ### 2. Web Tools Tests (`web-tools-tests.yml`)
31
+
32
+ **Purpose:** Run web search tool tests when related files change
33
+
34
+ **Triggers:**
35
+ - Changes to web tools source files:
36
+ - `src/tools/web.js`
37
+ - `src/tools/web-client.js`
38
+ - `src/clients/retry.js`
39
+ - `src/config/index.js`
40
+ - `test/web-tools.test.js`
41
+
42
+ **What it does:**
43
+ - Runs only the web tools test suite
44
+ - Generates test summary in GitHub Actions UI
45
+ - Faster feedback for web tools changes
46
+
47
+ **Test Coverage:**
48
+ - HTML extraction (9 tests)
49
+ - HTTP keep-alive agent (2 tests)
50
+ - Retry logic with exponential backoff (2 tests)
51
+ - Configuration management (3 tests)
52
+ - Error handling (1 test)
53
+ - Performance validation (1 test)
54
+ - Body preview configuration (1 test)
55
+
56
+ **Total:** 19 tests
57
+
58
+ ---
59
+
60
+ ### 3. NPM Publish (`npm-publish.yml`)
61
+
62
+ **Purpose:** Automatically publish package to npm registry
63
+
64
+ **Triggers:**
65
+ - Git tags starting with `v` (e.g., `v0.1.5`)
66
+ - GitHub Releases created
67
+
68
+ **What it does:**
69
+ - Runs full test suite before publishing
70
+ - Checks if version already exists on npm
71
+ - Publishes package to npm registry (if tests pass)
72
+ - Prevents duplicate publishes
73
+ - Creates publish summary
74
+
75
+ **Requirements:**
76
+ - `NPM_TOKEN` secret must be configured
77
+ - Tests must pass
78
+ - Version must be new
79
+
80
+ **Status:** Only publishes on successful builds
81
+
82
+ ---
83
+
84
+ ### 4. Version Bump (`version-bump.yml`)
85
+
86
+ **Purpose:** Manual workflow to bump version and create releases
87
+
88
+ **Triggers:**
89
+ - Manual workflow dispatch (button in Actions tab)
90
+
91
+ **What it does:**
92
+ - Prompts for version type (patch/minor/major)
93
+ - Runs tests before version bump
94
+ - Updates package.json version
95
+ - Creates git commit and tag
96
+ - Pushes changes to repository
97
+ - Creates GitHub Release with changelog
98
+ - Triggers npm-publish workflow automatically
99
+
100
+ **Options:**
101
+ - `patch` - Bug fixes (0.1.4 → 0.1.5)
102
+ - `minor` - New features (0.1.4 → 0.2.0)
103
+ - `major` - Breaking changes (0.1.4 → 1.0.0)
104
+
105
+ ---
106
+
107
+ ### 5. IndexNow Notification (`index.yml`)
108
+
109
+ **Purpose:** Notify search engines when documentation is updated
110
+
111
+ **Triggers:**
112
+ - Push to `main` branch
113
+ - Changes in `docs/**` directory
114
+
115
+ **What it does:**
116
+ - Notifies Bing IndexNow about updated documentation
117
+ - Helps with SEO and documentation discoverability
118
+
119
+ ---
120
+
121
+ ## Adding Status Badges
122
+
123
+ Add these badges to your README.md:
124
+
125
+ ```markdown
126
+ ![CI Tests](https://github.com/vishalveerareddy123/Lynkr/actions/workflows/ci.yml/badge.svg)
127
+ ![Web Tools Tests](https://github.com/vishalveerareddy123/Lynkr/actions/workflows/web-tools-tests.yml/badge.svg)
128
+ ![npm version](https://img.shields.io/npm/v/lynkr.svg)
129
+ ![npm downloads](https://img.shields.io/npm/dt/lynkr.svg)
130
+ ```
131
+
132
+ ## Running Tests Locally
133
+
134
+ Before pushing, run tests locally:
135
+
136
+ ```bash
137
+ # Run all unit tests
138
+ npm run test:unit
139
+
140
+ # Run only web tools tests
141
+ DATABRICKS_API_KEY=test-key DATABRICKS_API_BASE=http://test.com \
142
+ node --test test/web-tools.test.js
143
+
144
+ # Run quick tests (routing only)
145
+ npm run test:quick
146
+
147
+ # Run all tests including performance
148
+ npm test
149
+ ```
150
+
151
+ ## Workflow Configuration
152
+
153
+ ### Required Secrets
154
+
155
+ **For npm publishing workflows:**
156
+ - `NPM_TOKEN` - Your npm automation token (required to publish)
157
+ - Get from: https://www.npmjs.com/settings/YOUR_USERNAME/tokens
158
+ - Type: "Automation" token
159
+ - Add to: Settings → Secrets → Actions → New repository secret
160
+
161
+ **For test workflows:**
162
+ - No secrets required (uses mock credentials)
163
+
164
+ **For IndexNow workflow:**
165
+ - `INDEX_NOW` - Your IndexNow API key (optional, only for docs)
166
+
167
+ ### Matrix Strategy
168
+
169
+ The CI workflow uses a matrix strategy to test on multiple Node.js versions:
170
+ - Node.js 20.x (LTS)
171
+ - Node.js 22.x (Current)
172
+
173
+ This ensures compatibility across different Node versions.
174
+
175
+ ## Troubleshooting
176
+
177
+ ### Tests fail locally but pass in CI
178
+ - Check Node.js version (`node --version`)
179
+ - Ensure `npm ci` is used (not `npm install`)
180
+ - Check for platform-specific issues (macOS vs Linux)
181
+
182
+ ### Tests pass locally but fail in CI
183
+ - Environment variables might be missing
184
+ - Dependencies might need updating
185
+ - Check GitHub Actions logs for details
186
+
187
+ ### Workflow doesn't trigger
188
+ - Verify file paths in `on.push.paths`
189
+ - Check branch names match
190
+ - Ensure workflow file is in `.github/workflows/`
191
+
192
+ ## Modifying Workflows
193
+
194
+ When making changes:
195
+
196
+ 1. Test YAML syntax (use a YAML validator)
197
+ 2. Test locally first with same commands
198
+ 3. Create a PR to test in CI before merging
199
+ 4. Check GitHub Actions tab for results
200
+
201
+ ## Performance Considerations
202
+
203
+ - **npm cache:** Workflows cache `node_modules` for faster builds
204
+ - **Parallel jobs:** Tests run on multiple Node versions in parallel
205
+ - **Path filtering:** Web tools workflow only runs when relevant files change
206
+ - **continue-on-error:** Performance tests won't fail the build
207
+
208
+ ## Future Improvements
209
+
210
+ Potential additions:
211
+ - Code coverage reporting
212
+ - Docker container testing
213
+ - E2E integration tests
214
+ - Deploy previews for PRs
215
+ - Automated dependency updates (Dependabot)
@@ -0,0 +1,66 @@
1
+ name: CI Tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - develop
8
+ pull_request:
9
+ branches:
10
+ - main
11
+ - develop
12
+
13
+ jobs:
14
+ test:
15
+ name: Run Tests
16
+ runs-on: ubuntu-latest
17
+
18
+ strategy:
19
+ matrix:
20
+ node-version: [20.x, 22.x]
21
+
22
+ steps:
23
+ - name: Checkout code
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Setup Node.js ${{ matrix.node-version }}
27
+ uses: actions/setup-node@v4
28
+ with:
29
+ node-version: ${{ matrix.node-version }}
30
+ cache: 'npm'
31
+
32
+ - name: Install dependencies
33
+ run: npm ci
34
+
35
+ - name: Run linter
36
+ run: npm run lint
37
+ continue-on-error: true
38
+
39
+ - name: Run unit tests
40
+ run: npm run test:unit
41
+ env:
42
+ DATABRICKS_API_KEY: test-key
43
+ DATABRICKS_API_BASE: http://test.com
44
+
45
+ - name: Run performance tests
46
+ run: npm run test:performance
47
+ env:
48
+ DATABRICKS_API_KEY: test-key
49
+ DATABRICKS_API_BASE: http://test.com
50
+ continue-on-error: true
51
+
52
+ test-summary:
53
+ name: Test Summary
54
+ runs-on: ubuntu-latest
55
+ needs: test
56
+ if: always()
57
+
58
+ steps:
59
+ - name: Check test results
60
+ run: |
61
+ echo "Tests completed"
62
+ if [ "${{ needs.test.result }}" == "failure" ]; then
63
+ echo "Tests failed!"
64
+ exit 1
65
+ fi
66
+ echo "All tests passed!"
@@ -0,0 +1,56 @@
1
+ name: Web Tools Tests
2
+
3
+ on:
4
+ push:
5
+ paths:
6
+ - 'src/tools/web.js'
7
+ - 'src/tools/web-client.js'
8
+ - 'src/clients/retry.js'
9
+ - 'src/config/index.js'
10
+ - 'test/web-tools.test.js'
11
+ - '.github/workflows/web-tools-tests.yml'
12
+ pull_request:
13
+ paths:
14
+ - 'src/tools/web.js'
15
+ - 'src/tools/web-client.js'
16
+ - 'src/clients/retry.js'
17
+ - 'src/config/index.js'
18
+ - 'test/web-tools.test.js'
19
+
20
+ jobs:
21
+ web-tools-test:
22
+ name: Web Tools Test Suite
23
+ runs-on: ubuntu-latest
24
+
25
+ steps:
26
+ - name: Checkout code
27
+ uses: actions/checkout@v4
28
+
29
+ - name: Setup Node.js
30
+ uses: actions/setup-node@v4
31
+ with:
32
+ node-version: '20.x'
33
+ cache: 'npm'
34
+
35
+ - name: Install dependencies
36
+ run: npm ci
37
+
38
+ - name: Run web tools tests
39
+ run: |
40
+ DATABRICKS_API_KEY=test-key DATABRICKS_API_BASE=http://test.com \
41
+ node --test test/web-tools.test.js
42
+
43
+ - name: Test results summary
44
+ if: always()
45
+ run: |
46
+ echo "## Web Tools Test Results" >> $GITHUB_STEP_SUMMARY
47
+ echo "✅ All web tools tests passed!" >> $GITHUB_STEP_SUMMARY
48
+ echo "" >> $GITHUB_STEP_SUMMARY
49
+ echo "### Coverage:" >> $GITHUB_STEP_SUMMARY
50
+ echo "- HTML extraction (9 tests)" >> $GITHUB_STEP_SUMMARY
51
+ echo "- HTTP keep-alive agent (2 tests)" >> $GITHUB_STEP_SUMMARY
52
+ echo "- Retry logic with exponential backoff (2 tests)" >> $GITHUB_STEP_SUMMARY
53
+ echo "- Configuration management (3 tests)" >> $GITHUB_STEP_SUMMARY
54
+ echo "- Error handling (1 test)" >> $GITHUB_STEP_SUMMARY
55
+ echo "- Performance validation (1 test)" >> $GITHUB_STEP_SUMMARY
56
+ echo "- Body preview configuration (1 test)" >> $GITHUB_STEP_SUMMARY