@fink-andreas/pi-linear-tools 0.1.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/CHANGELOG.md +16 -0
- package/FUNCTIONALITY.md +57 -0
- package/LICENSE +21 -0
- package/POST_RELEASE_CHECKLIST.md +30 -0
- package/README.md +157 -0
- package/RELEASE.md +50 -0
- package/bin/pi-linear-tools.js +8 -0
- package/extensions/pi-linear-tools.js +582 -0
- package/index.js +8 -0
- package/package.json +49 -0
- package/settings.json.example +12 -0
- package/src/cli.js +729 -0
- package/src/handlers.js +781 -0
- package/src/linear-client.js +43 -0
- package/src/linear.js +1433 -0
- package/src/logger.js +128 -0
- package/src/settings.js +173 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Linear SDK client factory
|
|
3
|
+
*
|
|
4
|
+
* Creates a configured LinearClient instance for interacting with Linear API.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { LinearClient } from '@linear/sdk';
|
|
8
|
+
|
|
9
|
+
/** @type {Function|null} Test-only client factory override */
|
|
10
|
+
let _testClientFactory = null;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Create a Linear SDK client
|
|
14
|
+
* @param {string} apiKey - Linear API key
|
|
15
|
+
* @returns {LinearClient} Configured Linear client
|
|
16
|
+
*/
|
|
17
|
+
export function createLinearClient(apiKey) {
|
|
18
|
+
// Allow test override
|
|
19
|
+
if (_testClientFactory) {
|
|
20
|
+
return _testClientFactory(apiKey);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (!apiKey || typeof apiKey !== 'string') {
|
|
24
|
+
throw new Error('Linear API key is required');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return new LinearClient({ apiKey });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Set a mock client factory for testing (TEST ONLY)
|
|
32
|
+
* @param {Function|null} factory - Factory function that returns a mock client
|
|
33
|
+
*/
|
|
34
|
+
export function setTestClientFactory(factory) {
|
|
35
|
+
_testClientFactory = factory;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Reset test client factory
|
|
40
|
+
*/
|
|
41
|
+
export function resetTestClientFactory() {
|
|
42
|
+
_testClientFactory = null;
|
|
43
|
+
}
|