@openfort/cli 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.
Files changed (2) hide show
  1. package/dist/cli.js +68 -4
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -30,7 +30,7 @@ function base64url(buffer) {
30
30
  function generateState() {
31
31
  return base64url(randomBytes(16));
32
32
  }
33
- function callbackPage(title, description, variant = "success") {
33
+ function callbackPage(title, description, variant = "success", extraHtml = "") {
34
34
  const iconColor = variant === "success" ? "hsl(142 71% 45%)" : "hsl(0 84% 60%)";
35
35
  const icon = variant === "success" ? `<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="${iconColor}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>` : `<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="${iconColor}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>`;
36
36
  return `<!DOCTYPE html>
@@ -76,7 +76,7 @@ function callbackPage(title, description, variant = "success") {
76
76
  border: 1px solid var(--border);
77
77
  border-radius: var(--radius);
78
78
  width: 100%;
79
- max-width: 28rem;
79
+ max-width: 33rem;
80
80
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
81
81
  }
82
82
  .card-header {
@@ -99,6 +99,57 @@ function callbackPage(title, description, variant = "success") {
99
99
  color: var(--muted-foreground);
100
100
  line-height: 1.5;
101
101
  }
102
+ .card-extra {
103
+ padding: 0 1.5rem 1.5rem;
104
+ border-top: 1px solid var(--border);
105
+ margin-top: 0;
106
+ }
107
+ .card-extra-title {
108
+ font-size: 0.875rem;
109
+ font-weight: 500;
110
+ margin-top: 1rem;
111
+ margin-bottom: 0.5rem;
112
+ }
113
+ .code-block {
114
+ display: flex;
115
+ align-items: center;
116
+ gap: 0.5rem;
117
+ background-color: var(--border);
118
+ border-radius: var(--radius);
119
+ padding: 0.5rem 0.75rem;
120
+ font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
121
+ font-size: 0.75rem;
122
+ line-height: 1.5;
123
+ overflow-x: auto;
124
+ }
125
+ .code-block code {
126
+ flex: 1;
127
+ word-break: break-all;
128
+ }
129
+ .code-block button {
130
+ flex-shrink: 0;
131
+ background: none;
132
+ border: none;
133
+ color: var(--muted-foreground);
134
+ cursor: pointer;
135
+ padding: 0.25rem;
136
+ display: flex;
137
+ align-items: center;
138
+ }
139
+ .code-block button:hover {
140
+ color: var(--foreground);
141
+ }
142
+ .card-extra-link {
143
+ display: inline-block;
144
+ margin-top: 0.75rem;
145
+ font-size: 0.8rem;
146
+ color: var(--muted-foreground);
147
+ text-decoration: underline;
148
+ text-underline-offset: 2px;
149
+ }
150
+ .card-extra-link:hover {
151
+ color: var(--foreground);
152
+ }
102
153
  </style>
103
154
  </head>
104
155
  <body>
@@ -107,7 +158,7 @@ function callbackPage(title, description, variant = "success") {
107
158
  <div class="card-icon">${icon}</div>
108
159
  <h1 class="card-title">${title}</h1>
109
160
  <p class="card-description">${description}</p>
110
- </div>
161
+ </div>${extraHtml}
111
162
  </div>
112
163
  </body>
113
164
  </html>`;
@@ -116,6 +167,7 @@ function waitForCallback(port, state) {
116
167
  return new Promise((resolve, reject) => {
117
168
  const timeout = setTimeout(() => {
118
169
  server.close();
170
+ server.closeAllConnections();
119
171
  reject(new Error("Login timed out after 5 minutes. Please try again."));
120
172
  }, 5 * 60 * 1e3);
121
173
  const server = createServer((req, res) => {
@@ -133,6 +185,7 @@ function waitForCallback(port, state) {
133
185
  res.end(callbackPage("Login failed", "Something went wrong. You can close this window.", "error"));
134
186
  clearTimeout(timeout);
135
187
  server.close();
188
+ server.closeAllConnections();
136
189
  reject(new Error(errorDescription || error));
137
190
  return;
138
191
  }
@@ -142,9 +195,20 @@ function waitForCallback(port, state) {
142
195
  return;
143
196
  }
144
197
  res.writeHead(200, { "Content-Type": "text/html" });
145
- res.end(callbackPage("Login successful!", "You can close this window and return to your terminal."));
198
+ const skillCommand = "npx skills add openfort-xyz/agent-skills --skill openfort";
199
+ const agentSkillHtml = `
200
+ <div class="card-extra">
201
+ <p class="card-extra-title">Build with AI? Add the Openfort skill:</p>
202
+ <div class="code-block">
203
+ <code>${skillCommand}</code>
204
+ <button onclick="navigator.clipboard.writeText('${skillCommand}');this.innerHTML='<svg width=&quot;14&quot; height=&quot;14&quot; viewBox=&quot;0 0 24 24&quot; fill=&quot;none&quot; stroke=&quot;currentColor&quot; stroke-width=&quot;2&quot; stroke-linecap=&quot;round&quot; stroke-linejoin=&quot;round&quot;><polyline points=&quot;20 6 9 17 4 12&quot;/></svg>';setTimeout(()=>this.innerHTML='<svg width=&quot;14&quot; height=&quot;14&quot; viewBox=&quot;0 0 24 24&quot; fill=&quot;none&quot; stroke=&quot;currentColor&quot; stroke-width=&quot;2&quot; stroke-linecap=&quot;round&quot; stroke-linejoin=&quot;round&quot;><rect x=&quot;9&quot; y=&quot;9&quot; width=&quot;13&quot; height=&quot;13&quot; rx=&quot;2&quot; ry=&quot;2&quot;/><path d=&quot;M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1&quot;/></svg>',2000)"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg></button>
205
+ </div>
206
+ <a class="card-extra-link" href="https://www.openfort.io/docs/overview/building-with-cli" target="_blank" rel="noopener noreferrer">Learn more about building with the CLI</a>
207
+ </div>`;
208
+ res.end(callbackPage("Login successful!", "You can close this window and return to your terminal.", "success", agentSkillHtml));
146
209
  clearTimeout(timeout);
147
210
  server.close();
211
+ server.closeAllConnections();
148
212
  resolve({ apiKey, publishableKey: publishableKey || void 0, projectId: projectId || void 0, project: project || "unknown" });
149
213
  } else {
150
214
  res.writeHead(404);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfort/cli",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Openfort CLI — manage wallets, policies, and transactions from the terminal.",
5
5
  "author": "Openfort (https://www.openfort.io)",
6
6
  "bugs": "https://github.com/openfort-xyz/cli/issues",