@wtasnorg/node-lib 0.0.6 → 0.0.8
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.txt +14 -0
- package/dev_checklist.txt +56 -0
- package/docs/README.md +8 -34
- package/docs/docs.json +1538 -0
- package/docs/functions/createFindDirectories.md +2 -2
- package/docs/functions/hello.md +2 -2
- package/docs/functions/parseUserAgent.md +42 -0
- package/docs/functions/pojo.md +4 -4
- package/docs/interfaces/FileSystemDependencies.md +9 -9
- package/docs/interfaces/FindDirectoriesOptions.md +8 -8
- package/docs/interfaces/UserAgentInfo.md +61 -0
- package/eslint.config.js +52 -0
- package/gen-docs/001_commands.txt +44 -0
- package/gen-docs/001_coverage.txt +43 -0
- package/gen-docs/001_env.txt +33 -0
- package/gen-docs/001_lint.txt +40 -0
- package/gen-docs/001_state.txt +58 -0
- package/gen-docs/002_api.txt +34 -0
- package/gen-docs/002_deps.txt +46 -0
- package/gen-docs/002_errors.txt +34 -0
- package/gen-docs/002_naming.txt +36 -0
- package/gen-docs/002_notes.txt +20 -0
- package/gen-docs/002_purity.txt +36 -0
- package/gen-docs/002_scope.txt +28 -0
- package/gen-docs/002_srp.txt +34 -0
- package/gen-sec/001_commands.txt +65 -0
- package/gen-sec/001_env.txt +28 -0
- package/gen-sec/001_findings.txt +63 -0
- package/gen-sec/001_inventory.txt +41 -0
- package/gen-sec/001_owasp.txt +78 -0
- package/gen-sec/001_scope.txt +44 -0
- package/package.json +10 -3
- package/{README.md → readme.txt} +3 -1
- package/src/find.d.ts +4 -4
- package/src/find.js +13 -7
- package/src/find.test.js +2 -6
- package/src/find.test.ts +3 -11
- package/src/find.ts +13 -13
- package/src/index.d.ts +4 -2
- package/src/index.js +2 -1
- package/src/index.ts +6 -2
- package/src/pojo.d.ts +2 -2
- package/src/pojo.js +2 -2
- package/src/pojo.test.js +1 -3
- package/src/pojo.test.ts +2 -1
- package/src/pojo.ts +3 -3
- package/src/user-agent.d.ts +48 -0
- package/src/user-agent.js +189 -0
- package/src/user-agent.test.d.ts +2 -0
- package/src/user-agent.test.js +54 -0
- package/src/user-agent.test.ts +60 -0
- package/src/user-agent.ts +199 -0
- package/test_report +26 -0
- package/typedoc.json +6 -2
- package/DEV_CHECKLIST.md +0 -15
- package/docs/_media/LICENSE +0 -21
- package/docs/globals.md +0 -16
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
5
|
-
[@wtasnorg/node-lib](../
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / createFindDirectories
|
|
6
6
|
|
|
7
7
|
# Function: createFindDirectories()
|
|
8
8
|
|
|
9
9
|
> **createFindDirectories**(`deps`): (`root`, `options`) => `Promise`\<`string`[]\>
|
|
10
10
|
|
|
11
|
-
Defined in: [find.ts:19](https://github.com/wtasg/node-lib/blob/
|
|
11
|
+
Defined in: [find.ts:19](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/find.ts#L19)
|
|
12
12
|
|
|
13
13
|
Factory that produces an async findDirectories function with
|
|
14
14
|
injected filesystem dependencies for full testability.
|
package/docs/functions/hello.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
5
|
-
[@wtasnorg/node-lib](../
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / hello
|
|
6
6
|
|
|
7
7
|
# Function: hello()
|
|
8
8
|
|
|
9
9
|
> **hello**(): `Promise`\<`string`\>
|
|
10
10
|
|
|
11
|
-
Defined in: [hello.ts:6](https://github.com/wtasg/node-lib/blob/
|
|
11
|
+
Defined in: [hello.ts:6](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/hello.ts#L6)
|
|
12
12
|
|
|
13
13
|
A sample function that should work to test if lib is installed correctly.
|
|
14
14
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[**@wtasnorg/node-lib**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / parseUserAgent
|
|
6
|
+
|
|
7
|
+
# Function: parseUserAgent()
|
|
8
|
+
|
|
9
|
+
> **parseUserAgent**(`ua`): [`UserAgentInfo`](../interfaces/UserAgentInfo.md)
|
|
10
|
+
|
|
11
|
+
Defined in: [user-agent.ts:48](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/user-agent.ts#L48)
|
|
12
|
+
|
|
13
|
+
Parses a user-agent string into a UserAgentInfo object.
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### ua
|
|
18
|
+
|
|
19
|
+
`string`
|
|
20
|
+
|
|
21
|
+
The user-agent string to parse.
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
[`UserAgentInfo`](../interfaces/UserAgentInfo.md)
|
|
26
|
+
|
|
27
|
+
An object containing the extracted information.
|
|
28
|
+
|
|
29
|
+
## Examples
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
// Success Example (Chrome on Windows)
|
|
33
|
+
const ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36";
|
|
34
|
+
const info = parseUserAgent(ua);
|
|
35
|
+
// { browser: "Chrome", version: "120.0.0.0", os: "Windows", device: "Desktop", engine: "Blink" }
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
// Error/Fallback Example (Empty string)
|
|
40
|
+
const info = parseUserAgent("");
|
|
41
|
+
// { browser: "Other", version: "0", os: "Other", device: "Desktop", engine: "Other" }
|
|
42
|
+
```
|
package/docs/functions/pojo.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
5
|
-
[@wtasnorg/node-lib](../
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / pojo
|
|
6
6
|
|
|
7
7
|
# Function: pojo()
|
|
8
8
|
|
|
9
|
-
> **pojo**\<`T`\>(`instance`): `Record`\<`string`, `
|
|
9
|
+
> **pojo**\<`T`\>(`instance`): `Record`\<`string`, `unknown`\>
|
|
10
10
|
|
|
11
|
-
Defined in: [pojo.ts:10](https://github.com/wtasg/node-lib/blob/
|
|
11
|
+
Defined in: [pojo.ts:10](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/pojo.ts#L10)
|
|
12
12
|
|
|
13
13
|
Convert a class instance into a plain JavaScript object.
|
|
14
14
|
Copies only the instance's own enumerable data properties
|
|
@@ -30,6 +30,6 @@ A class instance to convert.
|
|
|
30
30
|
|
|
31
31
|
## Returns
|
|
32
32
|
|
|
33
|
-
`Record`\<`string`, `
|
|
33
|
+
`Record`\<`string`, `unknown`\>
|
|
34
34
|
|
|
35
35
|
A plain JavaScript object containing only data fields.
|
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
5
|
-
[@wtasnorg/node-lib](../
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / FileSystemDependencies
|
|
6
6
|
|
|
7
7
|
# Interface: FileSystemDependencies
|
|
8
8
|
|
|
9
|
-
Defined in: [find.ts:3](https://github.com/wtasg/node-lib/blob/
|
|
9
|
+
Defined in: [find.ts:3](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/find.ts#L3)
|
|
10
10
|
|
|
11
11
|
## Properties
|
|
12
12
|
|
|
13
13
|
### readdir()
|
|
14
14
|
|
|
15
|
-
> **readdir**: (`
|
|
15
|
+
> **readdir**: (`_path`, `_opts`) => `Promise`\<`object`[]\>
|
|
16
16
|
|
|
17
|
-
Defined in: [find.ts:4](https://github.com/wtasg/node-lib/blob/
|
|
17
|
+
Defined in: [find.ts:4](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/find.ts#L4)
|
|
18
18
|
|
|
19
19
|
#### Parameters
|
|
20
20
|
|
|
21
|
-
#####
|
|
21
|
+
##### \_path
|
|
22
22
|
|
|
23
23
|
`string`
|
|
24
24
|
|
|
25
|
-
#####
|
|
25
|
+
##### \_opts
|
|
26
26
|
|
|
27
27
|
###### withFileTypes
|
|
28
28
|
|
|
@@ -36,13 +36,13 @@ Defined in: [find.ts:4](https://github.com/wtasg/node-lib/blob/01d2e57d5a7dbc345
|
|
|
36
36
|
|
|
37
37
|
### stat()
|
|
38
38
|
|
|
39
|
-
> **stat**: (`
|
|
39
|
+
> **stat**: (`_path`) => `Promise`\<\{ `isDirectory`: `boolean`; \}\>
|
|
40
40
|
|
|
41
|
-
Defined in: [find.ts:5](https://github.com/wtasg/node-lib/blob/
|
|
41
|
+
Defined in: [find.ts:5](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/find.ts#L5)
|
|
42
42
|
|
|
43
43
|
#### Parameters
|
|
44
44
|
|
|
45
|
-
#####
|
|
45
|
+
##### \_path
|
|
46
46
|
|
|
47
47
|
`string`
|
|
48
48
|
|
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
5
|
-
[@wtasnorg/node-lib](../
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / FindDirectoriesOptions
|
|
6
6
|
|
|
7
7
|
# Interface: FindDirectoriesOptions
|
|
8
8
|
|
|
9
|
-
Defined in: [find.ts:8](https://github.com/wtasg/node-lib/blob/
|
|
9
|
+
Defined in: [find.ts:8](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/find.ts#L8)
|
|
10
10
|
|
|
11
11
|
## Properties
|
|
12
12
|
|
|
13
13
|
### allowlist?
|
|
14
14
|
|
|
15
|
-
> `optional` **allowlist**: `string`[] \| (`
|
|
15
|
+
> `optional` **allowlist**: `string`[] \| (`_absPath`, `_name`) => `boolean`
|
|
16
16
|
|
|
17
|
-
Defined in: [find.ts:11](https://github.com/wtasg/node-lib/blob/
|
|
17
|
+
Defined in: [find.ts:11](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/find.ts#L11)
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
21
21
|
### blocklist?
|
|
22
22
|
|
|
23
|
-
> `optional` **blocklist**: `string`[] \| (`
|
|
23
|
+
> `optional` **blocklist**: `string`[] \| (`_absPath`, `_name`) => `boolean`
|
|
24
24
|
|
|
25
|
-
Defined in: [find.ts:12](https://github.com/wtasg/node-lib/blob/
|
|
25
|
+
Defined in: [find.ts:12](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/find.ts#L12)
|
|
26
26
|
|
|
27
27
|
***
|
|
28
28
|
|
|
@@ -30,7 +30,7 @@ Defined in: [find.ts:12](https://github.com/wtasg/node-lib/blob/01d2e57d5a7dbc34
|
|
|
30
30
|
|
|
31
31
|
> `optional` **followSymlinks**: `boolean`
|
|
32
32
|
|
|
33
|
-
Defined in: [find.ts:10](https://github.com/wtasg/node-lib/blob/
|
|
33
|
+
Defined in: [find.ts:10](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/find.ts#L10)
|
|
34
34
|
|
|
35
35
|
***
|
|
36
36
|
|
|
@@ -38,4 +38,4 @@ Defined in: [find.ts:10](https://github.com/wtasg/node-lib/blob/01d2e57d5a7dbc34
|
|
|
38
38
|
|
|
39
39
|
> `optional` **maxDepth**: `number`
|
|
40
40
|
|
|
41
|
-
Defined in: [find.ts:9](https://github.com/wtasg/node-lib/blob/
|
|
41
|
+
Defined in: [find.ts:9](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/find.ts#L9)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
[**@wtasnorg/node-lib**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / UserAgentInfo
|
|
6
|
+
|
|
7
|
+
# Interface: UserAgentInfo
|
|
8
|
+
|
|
9
|
+
Defined in: [user-agent.ts:4](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/user-agent.ts#L4)
|
|
10
|
+
|
|
11
|
+
Information extracted from a user-agent string.
|
|
12
|
+
|
|
13
|
+
## Properties
|
|
14
|
+
|
|
15
|
+
### browser
|
|
16
|
+
|
|
17
|
+
> **browser**: `string`
|
|
18
|
+
|
|
19
|
+
Defined in: [user-agent.ts:8](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/user-agent.ts#L8)
|
|
20
|
+
|
|
21
|
+
Browser name (e.g., Chrome, Firefox, Safari, Edge, Opera, Other).
|
|
22
|
+
|
|
23
|
+
***
|
|
24
|
+
|
|
25
|
+
### device
|
|
26
|
+
|
|
27
|
+
> **device**: `string`
|
|
28
|
+
|
|
29
|
+
Defined in: [user-agent.ts:20](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/user-agent.ts#L20)
|
|
30
|
+
|
|
31
|
+
Device type (e.g., Mobile, Tablet, Desktop, Other).
|
|
32
|
+
|
|
33
|
+
***
|
|
34
|
+
|
|
35
|
+
### engine
|
|
36
|
+
|
|
37
|
+
> **engine**: `string`
|
|
38
|
+
|
|
39
|
+
Defined in: [user-agent.ts:24](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/user-agent.ts#L24)
|
|
40
|
+
|
|
41
|
+
Rendering engine (e.g., Blink, WebKit, Gecko, Presto, Other).
|
|
42
|
+
|
|
43
|
+
***
|
|
44
|
+
|
|
45
|
+
### os
|
|
46
|
+
|
|
47
|
+
> **os**: `string`
|
|
48
|
+
|
|
49
|
+
Defined in: [user-agent.ts:16](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/user-agent.ts#L16)
|
|
50
|
+
|
|
51
|
+
Operating system (e.g., Windows, macOS, Linux, iOS, Android, Other).
|
|
52
|
+
|
|
53
|
+
***
|
|
54
|
+
|
|
55
|
+
### version
|
|
56
|
+
|
|
57
|
+
> **version**: `string`
|
|
58
|
+
|
|
59
|
+
Defined in: [user-agent.ts:12](https://github.com/wtasg/node-lib/blob/ac07f7b7be8233cfd945908394ac10daf671e6a9/src/user-agent.ts#L12)
|
|
60
|
+
|
|
61
|
+
Browser version (e.g., 120.0.0.0).
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import eslint from "@eslint/js";
|
|
4
|
+
import { defineConfig } from "eslint/config";
|
|
5
|
+
import tseslint from "typescript-eslint";
|
|
6
|
+
import prettier from "eslint-config-prettier";
|
|
7
|
+
import globals from "globals";
|
|
8
|
+
import stylistic from "@stylistic/eslint-plugin";
|
|
9
|
+
|
|
10
|
+
export default defineConfig([
|
|
11
|
+
eslint.configs.recommended,
|
|
12
|
+
...tseslint.configs.recommended,
|
|
13
|
+
...tseslint.configs.strict,
|
|
14
|
+
...tseslint.configs.stylistic,
|
|
15
|
+
prettier,
|
|
16
|
+
|
|
17
|
+
{
|
|
18
|
+
languageOptions: {
|
|
19
|
+
globals: {
|
|
20
|
+
...globals.node,
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
plugins: {
|
|
27
|
+
"@stylistic": stylistic
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
{
|
|
32
|
+
ignores: ["**/*.d.ts"]
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
{
|
|
36
|
+
rules: {
|
|
37
|
+
"@typescript-eslint/no-unused-vars": [
|
|
38
|
+
"error",
|
|
39
|
+
{
|
|
40
|
+
argsIgnorePattern: "^_",
|
|
41
|
+
varsIgnorePattern: "^_",
|
|
42
|
+
caughtErrorsIgnorePattern: "^_"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
|
|
46
|
+
semi: ["error", "always"],
|
|
47
|
+
curly: ["error", "all"],
|
|
48
|
+
"prefer-const": "warn",
|
|
49
|
+
"@stylistic/quotes": ["error", "double"]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
]);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# 001 Commands Executed
|
|
2
|
+
Generated: 2026-01-19T20:40:49+05:30
|
|
3
|
+
|
|
4
|
+
## Environment
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
node -v
|
|
8
|
+
# v24.5.0
|
|
9
|
+
|
|
10
|
+
npm -v
|
|
11
|
+
# 11.7.0
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Verification Suite
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm run lint
|
|
18
|
+
# PASS - 0 errors, 0 warnings
|
|
19
|
+
|
|
20
|
+
npm run build
|
|
21
|
+
# PASS - tsc compiled successfully
|
|
22
|
+
|
|
23
|
+
npm run test
|
|
24
|
+
# PASS - 17/17 tests passed
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Coverage
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
node --test --experimental-test-coverage src/**/*.test.js
|
|
31
|
+
# Lines: 86.62%
|
|
32
|
+
# Branches: 76.56%
|
|
33
|
+
# Functions: 100%
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Documentation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm run docs
|
|
40
|
+
# Generated at ./docs
|
|
41
|
+
|
|
42
|
+
npm run docs:json
|
|
43
|
+
# Generated at ./docs/docs.json
|
|
44
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# 001 Coverage Report
|
|
2
|
+
Generated: 2026-01-19T20:40:49+05:30
|
|
3
|
+
|
|
4
|
+
## Summary
|
|
5
|
+
|
|
6
|
+
| Metric | Value | Target |
|
|
7
|
+
|-----------|--------|--------|
|
|
8
|
+
| Lines | 86.62% | >= 90% |
|
|
9
|
+
| Branches | 76.56% | >= 90% |
|
|
10
|
+
| Functions | 100% | >= 90% |
|
|
11
|
+
|
|
12
|
+
## Per-File Breakdown
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
file | line % | branch % | funcs % | uncovered lines
|
|
16
|
+
-------------------------------------------------------------------
|
|
17
|
+
src
|
|
18
|
+
find.js | 64.71 | 70.59 | 100.00 | 14-22 27-35 40-45
|
|
19
|
+
hello.js | 100.00 | 100.00 | 100.00 |
|
|
20
|
+
pojo.js | 100.00 | 100.00 | 100.00 |
|
|
21
|
+
user-agent.js | 92.55 | 76.19 | 100.00 | 80-83 119-122 175+
|
|
22
|
+
-------------------------------------------------------------------
|
|
23
|
+
all files | 86.62 | 76.56 | 100.00 |
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Analysis
|
|
27
|
+
|
|
28
|
+
### Meets Target
|
|
29
|
+
- hello.js: 100% (all metrics)
|
|
30
|
+
- pojo.js: 100% (all metrics)
|
|
31
|
+
|
|
32
|
+
### Below Target
|
|
33
|
+
- find.js: 64.71% lines, 70.59% branches
|
|
34
|
+
- `stat` dependency unused
|
|
35
|
+
- Allowlist/blocklist callback paths untested
|
|
36
|
+
- user-agent.js: 92.55% lines, 76.19% branches
|
|
37
|
+
- Edge case UA strings not covered
|
|
38
|
+
|
|
39
|
+
## Recommendations
|
|
40
|
+
|
|
41
|
+
1. Add tests for `find.js` allowlist/blocklist callbacks
|
|
42
|
+
2. Add edge case UA tests for user-agent.js
|
|
43
|
+
3. Consider removing unused `stat` from FileSystemDependencies
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# 001 Environment Verification
|
|
2
|
+
Generated: 2026-01-19T20:40:49+05:30
|
|
3
|
+
|
|
4
|
+
## Runtime Versions
|
|
5
|
+
|
|
6
|
+
- Node.js: v24.5.0
|
|
7
|
+
- npm: 11.7.0
|
|
8
|
+
- TypeScript: 5.9.3
|
|
9
|
+
|
|
10
|
+
## Dependencies Verified
|
|
11
|
+
|
|
12
|
+
All devDependencies installed and functional:
|
|
13
|
+
- @eslint/js: 9.39.1
|
|
14
|
+
- @stylistic/eslint-plugin: 5.6.1
|
|
15
|
+
- @types/node: 24.10.1
|
|
16
|
+
- eslint: 9.39.1
|
|
17
|
+
- eslint-config-prettier: 10.1.8
|
|
18
|
+
- globals: 16.5.0
|
|
19
|
+
- typedoc: 0.28.15
|
|
20
|
+
- typedoc-plugin-markdown: 4.9.0
|
|
21
|
+
- typescript: 5.9.3
|
|
22
|
+
- typescript-eslint: 8.48.1
|
|
23
|
+
|
|
24
|
+
## Tooling
|
|
25
|
+
|
|
26
|
+
- Test runner: node:test (built-in)
|
|
27
|
+
- Coverage: node --experimental-test-coverage
|
|
28
|
+
- Linter: eslint with typescript-eslint
|
|
29
|
+
- Docs: typedoc
|
|
30
|
+
|
|
31
|
+
## Status
|
|
32
|
+
|
|
33
|
+
Environment verified. No issues.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# 001 Lint Report
|
|
2
|
+
Generated: 2026-01-19T20:40:49+05:30
|
|
3
|
+
|
|
4
|
+
## Command
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm run lint
|
|
8
|
+
# => npx eslint src/*.ts --no-warn-ignored
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Results
|
|
12
|
+
|
|
13
|
+
- Errors: 0
|
|
14
|
+
- Warnings: 0
|
|
15
|
+
- Status: PASS
|
|
16
|
+
|
|
17
|
+
## Configuration
|
|
18
|
+
|
|
19
|
+
ESLint config: eslint.config.js
|
|
20
|
+
- eslint.configs.recommended
|
|
21
|
+
- tseslint.configs.recommended
|
|
22
|
+
- tseslint.configs.strict
|
|
23
|
+
- tseslint.configs.stylistic
|
|
24
|
+
- eslint-config-prettier
|
|
25
|
+
|
|
26
|
+
### Key Rules
|
|
27
|
+
|
|
28
|
+
| Rule | Setting |
|
|
29
|
+
|------------------------------------|---------|
|
|
30
|
+
| @typescript-eslint/no-unused-vars | error |
|
|
31
|
+
| no-unused-vars | off |
|
|
32
|
+
| semi | error |
|
|
33
|
+
| curly | error |
|
|
34
|
+
| prefer-const | warn |
|
|
35
|
+
| @stylistic/quotes | double |
|
|
36
|
+
|
|
37
|
+
## Notes
|
|
38
|
+
|
|
39
|
+
- Base `no-unused-vars` disabled in favor of TypeScript-aware version
|
|
40
|
+
- Ignore patterns: ^_ for args, vars, caught errors
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# 001 State Report
|
|
2
|
+
Generated: 2026-01-19T20:40:49+05:30
|
|
3
|
+
|
|
4
|
+
## Project Summary
|
|
5
|
+
|
|
6
|
+
- Package: @wtasnorg/node-lib@0.0.8
|
|
7
|
+
- Type: TypeScript/Node.js library
|
|
8
|
+
- Modules: find, hello, pojo, user-agent
|
|
9
|
+
|
|
10
|
+
## Baseline Results
|
|
11
|
+
|
|
12
|
+
### Lint
|
|
13
|
+
- Status: PASS
|
|
14
|
+
- Errors: 0
|
|
15
|
+
- Warnings: 0
|
|
16
|
+
|
|
17
|
+
### Build
|
|
18
|
+
- Status: PASS
|
|
19
|
+
- Compiler: tsc (TypeScript 5.9.3)
|
|
20
|
+
|
|
21
|
+
### Tests
|
|
22
|
+
- Status: PASS
|
|
23
|
+
- Total: 17
|
|
24
|
+
- Passed: 17
|
|
25
|
+
- Failed: 0
|
|
26
|
+
- Skipped: 0
|
|
27
|
+
|
|
28
|
+
### Coverage (Overall)
|
|
29
|
+
- Lines: 86.62%
|
|
30
|
+
- Branches: 76.56%
|
|
31
|
+
- Functions: 100.00%
|
|
32
|
+
|
|
33
|
+
### Coverage by Module
|
|
34
|
+
|
|
35
|
+
| Module | Lines | Branches | Functions |
|
|
36
|
+
|----------------|--------|----------|-----------|
|
|
37
|
+
| find.js | 64.71% | 70.59% | 100.00% |
|
|
38
|
+
| hello.js | 100% | 100% | 100% |
|
|
39
|
+
| pojo.js | 100% | 100% | 100% |
|
|
40
|
+
| user-agent.js | 92.55% | 76.19% | 100% |
|
|
41
|
+
|
|
42
|
+
## Gap Analysis
|
|
43
|
+
|
|
44
|
+
### Low Coverage: find.js (64.71%)
|
|
45
|
+
|
|
46
|
+
Uncovered lines: 14-22, 27-35, 40-45
|
|
47
|
+
- `stat` function defined but never used in tests
|
|
48
|
+
- Allowlist/blocklist function callback paths untested
|
|
49
|
+
|
|
50
|
+
### Medium Coverage: user-agent.js (92.55%)
|
|
51
|
+
|
|
52
|
+
Uncovered lines: 80-83, 119-122, 175+
|
|
53
|
+
- Some edge case UA strings not covered
|
|
54
|
+
- Fallback paths for unusual browsers
|
|
55
|
+
|
|
56
|
+
## Status
|
|
57
|
+
|
|
58
|
+
All gates passed. No blocking issues.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# 002 API Surface Findings
|
|
2
|
+
Generated: 2026-01-19T20:43:05+05:30
|
|
3
|
+
|
|
4
|
+
## Public Exports (index.ts)
|
|
5
|
+
|
|
6
|
+
- hello
|
|
7
|
+
- pojo
|
|
8
|
+
- createFindDirectories
|
|
9
|
+
- FindDirectoriesOptions (type)
|
|
10
|
+
- FileSystemDependencies (type)
|
|
11
|
+
|
|
12
|
+
## Issues Found
|
|
13
|
+
|
|
14
|
+
### [ISSUE] user-agent.ts - parseUserAgent not exported from index.ts
|
|
15
|
+
|
|
16
|
+
The main UA parsing function is exported from user-agent.ts but NOT re-exported from index.ts.
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
// index.ts - missing:
|
|
20
|
+
import { parseUserAgent, UserAgentInfo } from "./user-agent.js";
|
|
21
|
+
export { parseUserAgent };
|
|
22
|
+
export type { UserAgentInfo };
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Recommendation: Add to public API.
|
|
26
|
+
|
|
27
|
+
### [MINOR] user-agent.ts - Helper functions not exported
|
|
28
|
+
|
|
29
|
+
detectBrowser, detectOS, detectDeviceType, detectEngine are private.
|
|
30
|
+
This is correct - they are implementation details.
|
|
31
|
+
|
|
32
|
+
## Status
|
|
33
|
+
|
|
34
|
+
FAIL - parseUserAgent not in public API.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# 002 Dependency Findings
|
|
2
|
+
Generated: 2026-01-19T20:43:05+05:30
|
|
3
|
+
|
|
4
|
+
## Summary
|
|
5
|
+
|
|
6
|
+
Dependencies flow correctly. No circular dependencies. Clean architecture.
|
|
7
|
+
|
|
8
|
+
## Per-Module Analysis
|
|
9
|
+
|
|
10
|
+
### find.ts ✅
|
|
11
|
+
- Imports: node:path (resolve, join)
|
|
12
|
+
- Dependencies injected via factory pattern
|
|
13
|
+
- No framework coupling
|
|
14
|
+
|
|
15
|
+
### hello.ts ✅
|
|
16
|
+
- No imports
|
|
17
|
+
- Uses only global console (acceptable)
|
|
18
|
+
|
|
19
|
+
### pojo.ts ✅
|
|
20
|
+
- No imports
|
|
21
|
+
- Pure utility function
|
|
22
|
+
|
|
23
|
+
### user-agent.ts ✅
|
|
24
|
+
- No imports
|
|
25
|
+
- Pure parsing logic
|
|
26
|
+
|
|
27
|
+
### index.ts ✅
|
|
28
|
+
- Re-exports from modules
|
|
29
|
+
- Clean public API surface
|
|
30
|
+
|
|
31
|
+
## Issues Found
|
|
32
|
+
|
|
33
|
+
### [MINOR] find.ts - Unused `stat` dependency
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
interface FileSystemDependencies {
|
|
37
|
+
readdir: ...
|
|
38
|
+
stat: ... // Declared but never used
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Recommendation: Remove if not planned for use.
|
|
43
|
+
|
|
44
|
+
## Status
|
|
45
|
+
|
|
46
|
+
PASS - Minor cleanup opportunity.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# 002 Error Handling Findings
|
|
2
|
+
Generated: 2026-01-19T20:43:05+05:30
|
|
3
|
+
|
|
4
|
+
## Summary
|
|
5
|
+
|
|
6
|
+
Minimal error handling needed. Functions are defensive.
|
|
7
|
+
|
|
8
|
+
## Per-Module Analysis
|
|
9
|
+
|
|
10
|
+
### find.ts ⚠️
|
|
11
|
+
- No explicit error handling for readdir failures
|
|
12
|
+
- Errors will propagate as Promise rejection
|
|
13
|
+
- Acceptable for utility library
|
|
14
|
+
|
|
15
|
+
### hello.ts ✅
|
|
16
|
+
- Guards console access: `if (console?.log)`
|
|
17
|
+
- No errors expected
|
|
18
|
+
|
|
19
|
+
### pojo.ts ✅
|
|
20
|
+
- Pure function, no errors expected
|
|
21
|
+
- Handles non-objects via Object.entries (returns [])
|
|
22
|
+
|
|
23
|
+
### user-agent.ts ✅
|
|
24
|
+
- Defensive null check: `if (!ua) { return defaults }`
|
|
25
|
+
- Optional chaining on split: `?.split(" ")[0] || "0"`
|
|
26
|
+
- All branches return valid defaults
|
|
27
|
+
|
|
28
|
+
## Issues Found
|
|
29
|
+
|
|
30
|
+
None requiring action.
|
|
31
|
+
|
|
32
|
+
## Status
|
|
33
|
+
|
|
34
|
+
PASS - Error handling appropriate for library scope.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# 002 Naming Findings
|
|
2
|
+
Generated: 2026-01-19T20:43:05+05:30
|
|
3
|
+
|
|
4
|
+
## Summary
|
|
5
|
+
|
|
6
|
+
Generally good naming. A few opportunities for improvement.
|
|
7
|
+
|
|
8
|
+
## Issues Found
|
|
9
|
+
|
|
10
|
+
### [MINOR] user-agent.ts:193-194 - Unreachable condition
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
if (ua.includes("AppleWebKit")) {return "WebKit";}
|
|
14
|
+
if (ua.includes("Blink") || (ua.includes("Chrome/") && ua.includes("AppleWebKit/"))) {return "Blink";}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The second condition can never be fully reached because "AppleWebKit" already returns "WebKit".
|
|
18
|
+
Chrome uses AppleWebKit but should return "Blink".
|
|
19
|
+
|
|
20
|
+
Recommendation: Reorder conditions - check for Chrome/AppleWebKit combo first.
|
|
21
|
+
|
|
22
|
+
### [OK] find.ts - createFindDirectories
|
|
23
|
+
|
|
24
|
+
Factory name is accurate. Returns findDirectories function.
|
|
25
|
+
|
|
26
|
+
### [OK] pojo.ts - pojo
|
|
27
|
+
|
|
28
|
+
Short but descriptive. Common abbreviation.
|
|
29
|
+
|
|
30
|
+
### [OK] user-agent.ts - detectBrowser, detectOS, etc.
|
|
31
|
+
|
|
32
|
+
Verb prefix indicates action. Clear intent.
|
|
33
|
+
|
|
34
|
+
## Status
|
|
35
|
+
|
|
36
|
+
PASS with one logic issue noted.
|