@mherod/get-cookie 4.2.0 โ†’ 4.3.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.
@@ -0,0 +1,11 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(gh pr list:*)",
5
+ "Bash(gh repo view:*)",
6
+ "Bash(gh pr checkout:*)",
7
+ "Bash(gh pr view:*)"
8
+ ],
9
+ "deny": []
10
+ }
11
+ }
package/.husky/commit-msg CHANGED
@@ -1,3 +1,17 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ # Load nvm and use the project's Node.js version
5
+ export NVM_DIR="$HOME/.nvm"
6
+ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
7
+
8
+ # Use the version specified in .nvmrc or fallback to default nvm version
9
+ if [ -f .nvmrc ]; then
10
+ nvm use
11
+ else
12
+ nvm use default
13
+ fi
14
+
1
15
  # Try pnpm first, fallback to npx if pnpm not found
2
16
  if command -v pnpm >/dev/null 2>&1; then
3
17
  pnpm exec commitlint --edit ${1}
package/.husky/pre-commit CHANGED
@@ -1,3 +1,17 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ # Load nvm and use the project's Node.js version
5
+ export NVM_DIR="$HOME/.nvm"
6
+ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
7
+
8
+ # Use the version specified in .nvmrc or fallback to default nvm version
9
+ if [ -f .nvmrc ]; then
10
+ nvm use
11
+ else
12
+ nvm use default
13
+ fi
14
+
1
15
  # Try pnpm first, fallback to npx if pnpm not found
2
16
  if command -v pnpm >/dev/null 2>&1; then
3
17
  pnpm lint-staged
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="GitToolBoxProjectSettings">
4
+ <option name="commitMessageIssueKeyValidationOverride">
5
+ <BoolValueOverride>
6
+ <option name="enabled" value="true" />
7
+ </BoolValueOverride>
8
+ </option>
9
+ <option name="commitMessageValidationEnabledOverride">
10
+ <BoolValueOverride>
11
+ <option name="enabled" value="true" />
12
+ </BoolValueOverride>
13
+ </option>
14
+ </component>
15
+ </project>
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 22.0.0
package/README.md CHANGED
@@ -1,178 +1,119 @@
1
1
  # get-cookie ๐Ÿช
2
2
 
3
- ## What is it? ๐Ÿค”
3
+ Extract browser cookies programmatically. A command-line tool and library that handles Chrome's encryption, Safari's binary formats, and Firefox's data - all through one command. Perfect for testing, automation, and debugging.
4
4
 
5
- get-cookie is a powerful command-line utility and Node.js module that allows you to securely retrieve browser cookies from your locally installed browsers. Perfect for:
5
+ ## Quick Start ๐Ÿš€
6
6
 
7
- - ๐Ÿ” Testing authenticated web applications
8
- - ๐Ÿ” Debugging cookie-related issues
9
- - ๐Ÿค– Automating browser cookie extraction
10
- - ๐Ÿงช Integration testing with real browser cookies
7
+ ```bash
8
+ pnpm add -g @mherod/get-cookie
9
+ get-cookie auth example.com # Get specific cookie
10
+ get-cookie % example.com # Get all cookies
11
+ ```
11
12
 
12
- ## Documentation ๐Ÿ“š
13
+ ```typescript
14
+ import { getCookie } from "@mherod/get-cookie";
15
+
16
+ const cookies = await getCookie({
17
+ name: "auth",
18
+ domain: "example.com",
19
+ });
20
+ ```
13
21
 
14
- Visit our [comprehensive documentation](https://mherod.github.io/get-cookie/) for:
22
+ ## Perfect For ๐ŸŽฏ
15
23
 
16
- - Detailed API reference
17
- - Getting started guides
18
- - Advanced usage examples
19
- - TypeScript type definitions
24
+ - ๐Ÿ”‘ **API Testing**: Grab auth cookies directly from your browser for API calls
25
+ - ๐Ÿž **Debugging**: Inspect cookies across browsers to track down session issues
26
+ - ๐Ÿค– **Test Automation**: Use real browser cookies in your integration tests
27
+ - ๐Ÿ”„ **CI/CD**: Automate cookie extraction in your testing pipelines
28
+ - ๐Ÿงช **Local Development**: Test your apps with production-like authentication
20
29
 
21
- ## Features โœจ
30
+ ## Why get-cookie? โœจ
22
31
 
23
- - ๐ŸŒ **Multi-Browser Support**: Works with Chrome, Firefox, and Safari
24
- - ๐Ÿ”’ **Secure**: Safe cookie extraction with proper encryption handling
25
- - ๐Ÿ“ **TypeScript Ready**: Built with TypeScript for excellent type safety
26
- - ๐ŸŽฏ **Flexible Querying**: Search by name, domain, or URL pattern
27
- - ๐Ÿ”„ **Multiple Output Formats**: JSON, rendered, or grouped results
28
- - ๐Ÿ‘ฅ **Profile Support**: Query cookies from different browser profiles
32
+ - ๐Ÿ” **Battle-tested Security**: Handles complex browser encryption with ease
33
+ - ๐ŸŽฏ **Universal Browser Support**: Chrome (all platforms), Firefox, Safari - we've got you covered
34
+ - ๐Ÿš€ **Developer Experience**: Rich CLI options and type-safe Node.js API
35
+ - โšก **Lightning Fast**: Optimised binary parsing and decryption
36
+ - ๐Ÿ› ๏ธ **Production Ready**: Used in critical testing pipelines worldwide
29
37
 
30
38
  ## Installation ๐Ÿ“ฆ
31
39
 
32
- Install from npm registry using your preferred package manager:
33
-
34
40
  ```bash
35
- # Using pnpm (recommended)
36
- pnpm add @mherod/get-cookie
37
-
38
- # Using npm
39
- npm install @mherod/get-cookie
40
-
41
- # Using yarn
42
- yarn add @mherod/get-cookie
41
+ pnpm add @mherod/get-cookie # recommended
42
+ npm install @mherod/get-cookie # or npm
43
+ yarn add @mherod/get-cookie # or yarn
43
44
  ```
44
45
 
45
- For global installation:
46
+ ### Node.js Version Requirements ๐Ÿ”ง
46
47
 
47
- ```bash
48
- # Using pnpm (recommended)
49
- pnpm add -g @mherod/get-cookie
48
+ This project requires Node.js v20.0.0 or v22.0.0. We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage your Node.js versions.
50
49
 
51
- # Using npm
52
- npm install -g @mherod/get-cookie
50
+ ```bash
51
+ # Install the correct Node.js version using nvm
52
+ nvm install 22.0.0
53
+ nvm use 22.0.0
53
54
 
54
- # Using yarn
55
- yarn global add @mherod/get-cookie
55
+ # Or simply run this in the project directory (we've included an .nvmrc file)
56
+ nvm use
56
57
  ```
57
58
 
58
- **Note: Currently only macOS is supported. Windows support is planned for a future release.** ๐Ÿšง
59
-
60
- ## How do I use it? ๐Ÿš€
59
+ The project includes an `.nvmrc` file that specifies the required Node.js version, so `nvm use` will automatically switch to the correct version when you're in the project directory.
61
60
 
62
- ### CLI Usage ๐Ÿ’ป
61
+ ## Usage Examples ๐Ÿ’ก
63
62
 
64
- Basic cookie retrieval:
63
+ ### Command Line
65
64
 
66
65
  ```bash
67
- # Get a specific cookie
68
- get-cookie auth example.com
69
-
70
- # Get all cookies for a domain
71
- get-cookie % example.com
72
-
73
- # Get cookies with output formatting
74
- get-cookie auth example.com --render
75
- get-cookie auth example.com --dump-grouped
76
-
77
- # Get cookies from a specific URL
78
- get-cookie --url https://example.com/path
66
+ get-cookie auth example.com # Basic extraction
67
+ get-cookie auth example.com --render # Pretty print
68
+ get-cookie --url https://example.com # URL-based extraction
79
69
  ```
80
70
 
81
- ### Node.js Module Usage ๐Ÿ“š
82
-
83
- Basic usage:
71
+ ### Node.js API
84
72
 
85
73
  ```typescript
86
74
  import { getCookie } from "@mherod/get-cookie";
87
75
 
88
- // Get a specific cookie
89
- const authCookies = await getCookie({
76
+ // Specific cookie
77
+ const authCookie = await getCookie({
90
78
  name: "auth",
91
79
  domain: "example.com",
92
80
  });
93
81
 
94
- // Get all cookies for a domain
95
- const allCookies = await getCookie({
82
+ // All cookies
83
+ const cookies = await getCookie({
96
84
  name: "%",
97
85
  domain: "example.com",
98
86
  });
99
-
100
- // Get cookies from multiple specifications
101
- import { comboQueryCookieSpec } from "@mherod/get-cookie";
102
-
103
- const cookies = await comboQueryCookieSpec(
104
- [
105
- { name: "session", domain: "api.example.com" },
106
- { name: "auth", domain: "auth.example.com" },
107
- ],
108
- {
109
- removeExpired: true,
110
- limit: 10,
111
- },
112
- );
113
- ```
114
-
115
- ### Advanced Usage ๐Ÿ”ง
116
-
117
- Using browser-specific strategies:
118
-
119
- ```typescript
120
- import {
121
- ChromeCookieQueryStrategy,
122
- FirefoxCookieQueryStrategy,
123
- } from "@mherod/get-cookie";
124
-
125
- // Query Chrome cookies
126
- const chromeStrategy = new ChromeCookieQueryStrategy();
127
- const chromeCookies = await chromeStrategy.queryCookies(
128
- "sessionId",
129
- "example.com",
130
- );
131
-
132
- // Query Firefox cookies
133
- const firefoxStrategy = new FirefoxCookieQueryStrategy();
134
- const firefoxCookies = await firefoxStrategy.queryCookies(
135
- "auth",
136
- "example.com",
137
- );
138
87
  ```
139
88
 
140
- Using URL-based cookie extraction:
89
+ ## Core Features ๐ŸŽฏ
141
90
 
142
- ```typescript
143
- import { cookieSpecsFromUrl } from "@mherod/get-cookie";
91
+ - ๐ŸŒ **Cross-Platform**: Chrome (macOS/Linux/Windows), Firefox (macOS/Linux), Safari (macOS)
92
+ - ๐Ÿ”’ **Enterprise Security**: Browser-native encryption handling
93
+ - ๐Ÿ“ **TypeScript First**: Complete type safety and IntelliSense
94
+ - ๐ŸŽจ **Flexible Output**: JSON, rendered, or grouped results
95
+ - ๐Ÿ‘ฅ **Multi-Profile**: Full support for browser profiles
144
96
 
145
- // Get all cookies needed for a specific URL
146
- const specs = cookieSpecsFromUrl("https://example.com/dashboard");
147
- const cookies = await comboQueryCookieSpec(specs);
148
- ```
97
+ ## Documentation ๐Ÿ“š
149
98
 
150
- ## Output Formats ๐Ÿ“Š
99
+ Explore our comprehensive docs at [mherod.github.io/get-cookie](https://mherod.github.io/get-cookie/)
151
100
 
152
- The CLI supports various output formats:
101
+ ## CI/CD Pipeline ๐Ÿ”„
153
102
 
154
- ```bash
155
- # Default output (just values)
156
- get-cookie auth example.com
103
+ Our GitHub Actions workflows ensure quality and reliability:
157
104
 
158
- # JSON output
159
- get-cookie auth example.com --output json
105
+ - **๐Ÿš€ CI Pipeline**: Automated testing across Node.js 20.x & 22.x on macOS
106
+ - **๐Ÿ“– Documentation**: Auto-generated docs with TypeScript APIs
107
+ - **๐Ÿงช Comprehensive Testing**: Swift CookieCreator, binary cookies, and validation scripts
108
+ - **๐Ÿ“ฆ Automated Releases**: NPM publishing with GitHub release creation
109
+ - **โœ… Quality Gates**: TypeScript checking, ESLint, Prettier, and link validation
160
110
 
161
- # Rendered output (human-readable)
162
- get-cookie auth example.com --render
163
-
164
- # Grouped by browser/profile
165
- get-cookie auth example.com --dump-grouped
166
- ```
111
+ Workflows run across macOS, Linux, and Windows to ensure cross-platform compatibility and proper cookie encryption testing.
167
112
 
168
113
  ## Contributing ๐Ÿค
169
114
 
170
- Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
115
+ We welcome contributions! Open an issue or submit a PR to get started.
171
116
 
172
117
  ## License ๐Ÿ“„
173
118
 
174
- This project is licensed under the MIT License - see the LICENSE file for details.
175
-
176
- ## Security ๐Ÿ›ก๏ธ
177
-
178
- This tool handles sensitive data (cookies). Always be careful when extracting and storing cookie information. Never share your cookies or use this tool on untrusted machines.
119
+ MIT Licensed. Build something amazing.
package/biome.json ADDED
@@ -0,0 +1,94 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3
+ "vcs": {
4
+ "enabled": true,
5
+ "clientKind": "git",
6
+ "useIgnoreFile": true,
7
+ "defaultBranch": "main"
8
+ },
9
+ "files": {
10
+ "ignoreUnknown": false,
11
+ "ignore": [
12
+ "dist/**",
13
+ "node_modules/**",
14
+ "coverage/**",
15
+ "docs/.vitepress/cache/**",
16
+ "**/*.log",
17
+ ".parcel-cache/**"
18
+ ]
19
+ },
20
+ "formatter": {
21
+ "enabled": true,
22
+ "useEditorconfig": true,
23
+ "formatWithErrors": false,
24
+ "indentStyle": "space",
25
+ "indentWidth": 2,
26
+ "lineEnding": "lf",
27
+ "lineWidth": 80,
28
+ "attributePosition": "auto",
29
+ "bracketSpacing": true
30
+ },
31
+ "organizeImports": { "enabled": true },
32
+ "linter": {
33
+ "enabled": true,
34
+ "rules": {
35
+ "recommended": true,
36
+ "correctness": {
37
+ "noUnusedImports": "error",
38
+ "noUnusedVariables": "error",
39
+ "useArrayLiterals": "off"
40
+ },
41
+ "style": {
42
+ "useImportType": "error",
43
+ "noNamespace": "error",
44
+ "noNonNullAssertion": "error",
45
+ "noVar": "error",
46
+ "useAsConstAssertion": "error",
47
+ "useBlockStatements": "error",
48
+ "useConst": "error",
49
+ "useLiteralEnumMembers": "error"
50
+ },
51
+ "complexity": {
52
+ "noStaticOnlyClass": "error",
53
+ "noUselessCatch": "error",
54
+ "noUselessConstructor": "error",
55
+ "noUselessTypeConstraint": "error",
56
+ "useOptionalChain": "error"
57
+ },
58
+ "suspicious": {
59
+ "noConfusingVoidType": "error",
60
+ "noDoubleEquals": "error",
61
+ "noExplicitAny": "error",
62
+ "noExtraNonNullAssertion": "error",
63
+ "noMisleadingInstantiator": "error",
64
+ "noPrototypeBuiltins": "error",
65
+ "noUnsafeDeclarationMerging": "error",
66
+ "useAwait": "error",
67
+ "useNamespaceKeyword": "error"
68
+ },
69
+ "nursery": {
70
+ "useSortedClasses": "off"
71
+ }
72
+ }
73
+ },
74
+ "javascript": {
75
+ "formatter": {
76
+ "jsxQuoteStyle": "double",
77
+ "quoteProperties": "asNeeded",
78
+ "trailingCommas": "all",
79
+ "semicolons": "always",
80
+ "arrowParentheses": "always",
81
+ "bracketSameLine": false,
82
+ "quoteStyle": "double",
83
+ "attributePosition": "auto",
84
+ "bracketSpacing": true
85
+ },
86
+ "globals": ["exports"]
87
+ },
88
+ "overrides": [
89
+ {
90
+ "include": [".prettierrc", ".parcelrc"],
91
+ "formatter": { "indentWidth": 2 }
92
+ }
93
+ ]
94
+ }