httpcat-cli 0.0.26 → 0.0.27-rc.2

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 (67) hide show
  1. package/.github/workflows/README.md +19 -2
  2. package/.github/workflows/ci.yml +31 -20
  3. package/.github/workflows/homebrew-tap.yml +1 -1
  4. package/.github/workflows/rc-publish.yml +169 -0
  5. package/.github/workflows/release.yml +223 -71
  6. package/README.md +94 -76
  7. package/bun.lock +2933 -0
  8. package/dist/commands/account.d.ts.map +1 -1
  9. package/dist/commands/account.js +14 -7
  10. package/dist/commands/account.js.map +1 -1
  11. package/dist/commands/balances.d.ts.map +1 -0
  12. package/dist/commands/balances.js +171 -0
  13. package/dist/commands/balances.js.map +1 -0
  14. package/dist/commands/buy.d.ts.map +1 -1
  15. package/dist/commands/buy.js +739 -32
  16. package/dist/commands/buy.js.map +1 -1
  17. package/dist/commands/chat.d.ts.map +1 -1
  18. package/dist/commands/chat.js +467 -906
  19. package/dist/commands/chat.js.map +1 -1
  20. package/dist/commands/claim.d.ts.map +1 -0
  21. package/dist/commands/claim.js +65 -0
  22. package/dist/commands/claim.js.map +1 -0
  23. package/dist/commands/create.d.ts.map +1 -1
  24. package/dist/commands/create.js +0 -1
  25. package/dist/commands/create.js.map +1 -1
  26. package/dist/commands/info.d.ts.map +1 -1
  27. package/dist/commands/info.js +128 -26
  28. package/dist/commands/info.js.map +1 -1
  29. package/dist/commands/list.d.ts.map +1 -1
  30. package/dist/commands/list.js +30 -23
  31. package/dist/commands/list.js.map +1 -1
  32. package/dist/commands/positions.d.ts.map +1 -1
  33. package/dist/commands/positions.js +178 -105
  34. package/dist/commands/positions.js.map +1 -1
  35. package/dist/commands/sell.d.ts.map +1 -1
  36. package/dist/commands/sell.js +713 -24
  37. package/dist/commands/sell.js.map +1 -1
  38. package/dist/index.js +315 -99
  39. package/dist/index.js.map +1 -1
  40. package/dist/interactive/shell.d.ts.map +1 -1
  41. package/dist/interactive/shell.js +328 -179
  42. package/dist/interactive/shell.js.map +1 -1
  43. package/dist/mcp/tools.d.ts.map +1 -1
  44. package/dist/mcp/tools.js +8 -8
  45. package/dist/mcp/tools.js.map +1 -1
  46. package/dist/utils/constants.d.ts.map +1 -0
  47. package/dist/utils/constants.js +66 -0
  48. package/dist/utils/constants.js.map +1 -0
  49. package/dist/utils/formatting.d.ts.map +1 -1
  50. package/dist/utils/formatting.js +3 -5
  51. package/dist/utils/formatting.js.map +1 -1
  52. package/dist/utils/token-resolver.d.ts.map +1 -1
  53. package/dist/utils/token-resolver.js +71 -40
  54. package/dist/utils/token-resolver.js.map +1 -1
  55. package/dist/utils/validation.d.ts.map +1 -1
  56. package/dist/utils/validation.js +4 -3
  57. package/dist/utils/validation.js.map +1 -1
  58. package/jest.config.js +1 -1
  59. package/package.json +19 -13
  60. package/.claude/settings.local.json +0 -41
  61. package/dist/commands/balance.d.ts.map +0 -1
  62. package/dist/commands/balance.js +0 -112
  63. package/dist/commands/balance.js.map +0 -1
  64. package/homebrew-httpcat/Formula/httpcat.rb +0 -18
  65. package/homebrew-httpcat/README.md +0 -31
  66. package/homebrew-httpcat/homebrew-httpcat/Formula/httpcat.rb +0 -18
  67. package/homebrew-httpcat/homebrew-httpcat/README.md +0 -31
@@ -25,9 +25,26 @@ Manual workflow to update the Homebrew formula in the tap repository.
25
25
 
26
26
  ## Secrets Required
27
27
 
28
- Configure these in Repository Settings Secrets and variables Actions:
28
+ **No secrets needed for publishing!** We use npm's [trusted publishing](https://docs.npmjs.com/trusted-publishers) with OIDC.
29
29
 
30
- - `NPM_TOKEN`: npm authentication token with publish permissions
30
+ ### Setting up Trusted Publishing
31
+
32
+ 1. Go to your package settings: https://www.npmjs.com/package/httpcat-cli/settings
33
+ 2. Navigate to **"Trusted Publishers"** section
34
+ 3. Click **"Add Trusted Publisher"**
35
+ 4. Select **"GitHub Actions"**
36
+ 5. Configure:
37
+ - **Repository**: `hathbanger/httpcat-cli`
38
+ - **Workflow file**: `.github/workflows/rc-publish.yml` (for RC) or `.github/workflows/release.yml` (for releases)
39
+ - **Environment name**: `npm-publish` (optional, if using environments)
40
+ 6. Save the configuration
41
+
42
+ **Benefits:**
43
+ - ✅ No tokens needed - uses OIDC authentication
44
+ - ✅ Bypasses 2FA requirements automatically
45
+ - ✅ Automatic provenance generation
46
+ - ✅ More secure - short-lived credentials
47
+ - ✅ No token management or rotation needed
31
48
  - Generate at: https://www.npmjs.com/settings/YOUR_USERNAME/tokens
32
49
  - Required scopes: `read:packages`, `write:packages`
33
50
 
@@ -7,7 +7,7 @@ on:
7
7
  branches: [main, develop]
8
8
 
9
9
  env:
10
- NODE_VERSION: '20'
10
+ NODE_VERSION: "20"
11
11
 
12
12
  jobs:
13
13
  test:
@@ -15,29 +15,33 @@ jobs:
15
15
  runs-on: ubuntu-latest
16
16
  strategy:
17
17
  matrix:
18
- node-version: ['18', '20', '22']
18
+ node-version: ["18", "20", "22"]
19
19
  steps:
20
20
  - name: Checkout code
21
- uses: actions/checkout@v4
21
+ uses: actions/checkout@v6
22
+
23
+ - name: Setup Bun
24
+ uses: oven-sh/setup-bun@v1
25
+ with:
26
+ bun-version: latest
22
27
 
23
28
  - name: Setup Node.js ${{ matrix.node-version }}
24
- uses: actions/setup-node@v4
29
+ uses: actions/setup-node@v6
25
30
  with:
26
31
  node-version: ${{ matrix.node-version }}
27
- cache: 'yarn'
28
32
 
29
33
  - name: Install dependencies
30
- run: yarn install --frozen-lockfile
34
+ run: bun install --frozen-lockfile
31
35
 
32
36
  - name: Run tests
33
- run: yarn test
37
+ run: bun run test
34
38
 
35
39
  - name: Build
36
- run: yarn build
40
+ run: bun run build
37
41
 
38
42
  - name: Upload coverage reports
39
43
  if: matrix.node-version == '20'
40
- uses: codecov/codecov-action@v4
44
+ uses: codecov/codecov-action@v5
41
45
  with:
42
46
  files: ./coverage/lcov.info
43
47
  flags: unittests
@@ -49,19 +53,23 @@ jobs:
49
53
  runs-on: ubuntu-latest
50
54
  steps:
51
55
  - name: Checkout code
52
- uses: actions/checkout@v4
56
+ uses: actions/checkout@v6
57
+
58
+ - name: Setup Bun
59
+ uses: oven-sh/setup-bun@v1
60
+ with:
61
+ bun-version: latest
53
62
 
54
63
  - name: Setup Node.js
55
- uses: actions/setup-node@v4
64
+ uses: actions/setup-node@v6
56
65
  with:
57
66
  node-version: ${{ env.NODE_VERSION }}
58
- cache: 'yarn'
59
67
 
60
68
  - name: Install dependencies
61
- run: yarn install --frozen-lockfile
69
+ run: bun install --frozen-lockfile
62
70
 
63
71
  - name: Type check
64
- run: yarn build --noEmit || npx tsc --noEmit
72
+ run: bun run build --noEmit || npx tsc --noEmit
65
73
 
66
74
  - name: Check formatting (if configured)
67
75
  continue-on-error: true
@@ -77,19 +85,23 @@ jobs:
77
85
  runs-on: ubuntu-latest
78
86
  steps:
79
87
  - name: Checkout code
80
- uses: actions/checkout@v4
88
+ uses: actions/checkout@v6
89
+
90
+ - name: Setup Bun
91
+ uses: oven-sh/setup-bun@v1
92
+ with:
93
+ bun-version: latest
81
94
 
82
95
  - name: Setup Node.js
83
- uses: actions/setup-node@v4
96
+ uses: actions/setup-node@v6
84
97
  with:
85
98
  node-version: ${{ env.NODE_VERSION }}
86
- cache: 'yarn'
87
99
 
88
100
  - name: Install dependencies
89
- run: yarn install --frozen-lockfile
101
+ run: bun install --frozen-lockfile
90
102
 
91
103
  - name: Run security audit
92
- run: yarn audit --level moderate || true
104
+ run: bun audit --audit-level moderate || true
93
105
 
94
106
  - name: Check for known vulnerabilities
95
107
  uses: snyk/actions/node@master
@@ -98,4 +110,3 @@ jobs:
98
110
  SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
99
111
  with:
100
112
  args: --severity-threshold=high
101
-
@@ -14,7 +14,7 @@ jobs:
14
14
  runs-on: ubuntu-latest
15
15
  steps:
16
16
  - name: Checkout homebrew tap
17
- uses: actions/checkout@v4
17
+ uses: actions/checkout@v6
18
18
  with:
19
19
  repository: hathbanger/homebrew-httpcat
20
20
  token: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,169 @@
1
+ name: RC Publish
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - develop
7
+
8
+ env:
9
+ NODE_VERSION: "20"
10
+ REGISTRY_URL: "https://registry.npmjs.org"
11
+
12
+ jobs:
13
+ # Job 1: Determine RC version
14
+ prepare:
15
+ name: Prepare RC Version
16
+ runs-on: ubuntu-latest
17
+ outputs:
18
+ version: ${{ steps.version.outputs.version }}
19
+ base-version: ${{ steps.version.outputs.base-version }}
20
+ steps:
21
+ - name: Checkout code
22
+ uses: actions/checkout@v6
23
+
24
+ - name: Setup Node.js
25
+ uses: actions/setup-node@v6
26
+ with:
27
+ node-version: ${{ env.NODE_VERSION }}
28
+ registry-url: ${{ env.REGISTRY_URL }}
29
+
30
+ - name: Get base version from package.json
31
+ id: base-version
32
+ run: |
33
+ BASE_VERSION=$(node -p "require('./package.json').version")
34
+ # Remove any existing prerelease suffix (e.g., 0.0.28-rc.1 -> 0.0.28)
35
+ BASE_VERSION=$(echo "$BASE_VERSION" | sed 's/-.*$//')
36
+ echo "base-version=$BASE_VERSION" >> $GITHUB_OUTPUT
37
+ echo "✅ Base version: $BASE_VERSION"
38
+
39
+ - name: Find latest RC version and increment
40
+ id: version
41
+ run: |
42
+ BASE_VERSION="${{ steps.base-version.outputs.base-version }}"
43
+
44
+ echo "Querying npm for existing RC versions..."
45
+ # Get all versions from npm
46
+ ALL_VERSIONS=$(npm view httpcat-cli versions --json 2>/dev/null || echo "[]")
47
+
48
+ # Filter for versions matching base version with RC suffix
49
+ RC_VERSIONS=$(echo "$ALL_VERSIONS" | node -e "
50
+ const versions = JSON.parse(require('fs').readFileSync(0, 'utf-8'));
51
+ const base = process.argv[1];
52
+ const rcVersions = versions
53
+ .filter(v => v.startsWith(base + '-rc.'))
54
+ .map(v => {
55
+ const match = v.match(/-rc\.(\d+)$/);
56
+ return match ? parseInt(match[1]) : 0;
57
+ })
58
+ .filter(n => n > 0)
59
+ .sort((a, b) => b - a);
60
+ console.log(rcVersions.length > 0 ? rcVersions[0] : 0);
61
+ " "$BASE_VERSION")
62
+
63
+ # Increment RC number
64
+ NEXT_RC=$((RC_VERSIONS + 1))
65
+ RC_VERSION="${BASE_VERSION}-rc.${NEXT_RC}"
66
+
67
+ echo "version=$RC_VERSION" >> $GITHUB_OUTPUT
68
+ echo "✅ Next RC version: $RC_VERSION"
69
+
70
+ # Job 2: Build and test
71
+ test:
72
+ name: Build & Test
73
+ runs-on: ubuntu-latest
74
+ needs: prepare
75
+ steps:
76
+ - name: Checkout code
77
+ uses: actions/checkout@v6
78
+
79
+ - name: Setup Bun
80
+ uses: oven-sh/setup-bun@v1
81
+ with:
82
+ bun-version: latest
83
+
84
+ - name: Setup Node.js
85
+ uses: actions/setup-node@v6
86
+ with:
87
+ node-version: ${{ env.NODE_VERSION }}
88
+
89
+ - name: Install dependencies
90
+ run: bun install
91
+
92
+ - name: Run tests
93
+ run: bun run test
94
+ # Note: Using Vitest now instead of Jest
95
+
96
+ - name: Build
97
+ run: bun run build
98
+
99
+ - name: Verify build output
100
+ run: |
101
+ if [ ! -f "dist/index.js" ]; then
102
+ echo "❌ Build failed: dist/index.js not found"
103
+ exit 1
104
+ fi
105
+ echo "✅ Build successful"
106
+
107
+ # Job 3: Publish RC to npm
108
+ publish-npm:
109
+ name: Publish RC to npm
110
+ runs-on: ubuntu-latest
111
+ needs: [prepare, test]
112
+ environment:
113
+ name: npm-publish
114
+ url: https://www.npmjs.com/package/httpcat-cli
115
+ permissions:
116
+ contents: read
117
+ id-token: write # Required for OIDC trusted publishing (no token needed!)
118
+ steps:
119
+ - name: Checkout code
120
+ uses: actions/checkout@v6
121
+
122
+ - name: Setup Node.js
123
+ uses: actions/setup-node@v6
124
+ with:
125
+ node-version: ${{ env.NODE_VERSION }}
126
+ registry-url: ${{ env.REGISTRY_URL }}
127
+
128
+ - name: Update npm to latest
129
+ run: npm install -g npm@latest
130
+ # npm 11.5.1+ required for trusted publishing (OIDC)
131
+
132
+ - name: Update package.json version
133
+ run: |
134
+ npm version "${{ needs.prepare.outputs.version }}" --no-git-tag-version --allow-same-version
135
+
136
+ - name: Setup Bun
137
+ uses: oven-sh/setup-bun@v1
138
+ with:
139
+ bun-version: latest
140
+
141
+ - name: Install dependencies
142
+ run: bun install
143
+
144
+ - name: Build
145
+ run: bun run build
146
+
147
+ - name: Publish RC to npm
148
+ run: npm publish --tag rc --access public
149
+ # Uses trusted publishing (OIDC) - no token needed!
150
+ # Configure trusted publisher at: https://www.npmjs.com/package/httpcat-cli/settings
151
+ # Provenance is automatically generated when using trusted publishing
152
+
153
+ - name: Verify npm publication
154
+ run: |
155
+ sleep 5 # Wait for npm CDN propagation
156
+ VERSION="${{ needs.prepare.outputs.version }}"
157
+ if npm view httpcat-cli@$VERSION version > /dev/null 2>&1; then
158
+ echo "✅ Successfully published httpcat-cli@$VERSION to npm (rc tag)"
159
+ else
160
+ echo "❌ Failed to verify npm publication"
161
+ exit 1
162
+ fi
163
+
164
+ - name: RC summary
165
+ run: |
166
+ echo "✅ RC published successfully!"
167
+ echo "Version: ${{ needs.prepare.outputs.version }}"
168
+ echo "npm: https://www.npmjs.com/package/httpcat-cli/v/${{ needs.prepare.outputs.version }}"
169
+ echo "Install: npm install -g httpcat-cli@${{ needs.prepare.outputs.version }}"