ai-or-die 0.1.9 → 0.1.11

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.
@@ -81,6 +81,13 @@ jobs:
81
81
  env:
82
82
  NODE_AUTH_TOKEN: ""
83
83
 
84
+ - name: Setup Node.js (GitHub Packages)
85
+ uses: actions/setup-node@v4
86
+ with:
87
+ node-version: '22'
88
+ registry-url: 'https://npm.pkg.github.com'
89
+ scope: '@animeshkundu'
90
+
84
91
  - name: Publish to GitHub Packages
85
92
  continue-on-error: true
86
93
  run: |
@@ -89,7 +96,7 @@ jobs:
89
96
  pkg.name = '@animeshkundu/ai-or-die';
90
97
  require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
91
98
  "
92
- npm publish --registry https://npm.pkg.github.com --access public
99
+ npm publish --access public
93
100
  git checkout -- package.json
94
101
  env:
95
102
  NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-or-die",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Universal AI coding terminal — Claude, Copilot, Gemini & more in your browser",
5
5
  "main": "src/server.js",
6
6
  "bin": {
@@ -33,6 +33,9 @@ class TunnelManager {
33
33
  const loggedIn = await this._checkLogin();
34
34
  if (!loggedIn) return;
35
35
 
36
+ const tunnelReady = await this._ensureTunnel();
37
+ if (!tunnelReady) return;
38
+
36
39
  await this._spawn();
37
40
  }
38
41
 
@@ -118,11 +121,38 @@ class TunnelManager {
118
121
  return false;
119
122
  }
120
123
 
124
+ /**
125
+ * Create the named tunnel if it doesn't already exist.
126
+ */
127
+ async _ensureTunnel() {
128
+ console.log(` Creating tunnel "${this.tunnelId}"...`);
129
+ return new Promise((resolve) => {
130
+ const args = ['create', this.tunnelId];
131
+ if (this.allowAnonymous) args.push('--allow-anonymous');
132
+ execFile('devtunnel', args, { timeout: 15000 }, (err, stdout, stderr) => {
133
+ if (err) {
134
+ const output = (stderr || stdout || '').toString();
135
+ // "already exists" is fine — we reuse it
136
+ if (output.includes('already exists') || output.includes('already in use')) {
137
+ console.log(` Reusing existing tunnel "${this.tunnelId}".`);
138
+ resolve(true);
139
+ } else {
140
+ console.error(` [devtunnel] Failed to create tunnel: ${output || err.message}`);
141
+ resolve(false);
142
+ }
143
+ } else {
144
+ console.log(` Tunnel "${this.tunnelId}" created.`);
145
+ resolve(true);
146
+ }
147
+ });
148
+ });
149
+ }
150
+
121
151
  /**
122
152
  * Spawn the devtunnel host process and wait for the public URL.
123
153
  */
124
154
  async _spawn() {
125
- const args = ['host', '-p', String(this.port), '--tunnel-id', this.tunnelId];
155
+ const args = ['host', this.tunnelId, '-p', String(this.port)];
126
156
  if (this.allowAnonymous) args.push('--allow-anonymous');
127
157
 
128
158
  return new Promise((resolve) => {