@trypattern/sdk 0.1.1 → 0.1.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.
- package/dist/auth/sessionApi.js +2 -1
- package/dist/cli/publishing.js +12 -3
- package/dist/server/auth.js +4 -1
- package/package.json +1 -1
package/dist/auth/sessionApi.js
CHANGED
|
@@ -85,7 +85,8 @@ export class HttpSessionApi {
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
startGoogleSignIn() {
|
|
88
|
-
location.
|
|
88
|
+
const next = `${location.pathname}${location.search}`;
|
|
89
|
+
location.assign(`/api/auth/google?next=${encodeURIComponent(next)}`);
|
|
89
90
|
}
|
|
90
91
|
onSignedOut(listener) {
|
|
91
92
|
this.#signedOutListeners.add(listener);
|
package/dist/cli/publishing.js
CHANGED
|
@@ -222,6 +222,15 @@ export async function login(io) {
|
|
|
222
222
|
function isEmptyFolder(path) {
|
|
223
223
|
return readdirSync(path).every((entry) => IGNORED_IN_EMPTY_FOLDER.has(entry));
|
|
224
224
|
}
|
|
225
|
+
function isInsideHome(path) {
|
|
226
|
+
const fromHome = relative(homedir(), path);
|
|
227
|
+
return !fromHome.startsWith('..') && !fromHome.startsWith('/');
|
|
228
|
+
}
|
|
229
|
+
function folderFor(name, cwd) {
|
|
230
|
+
if (isInsideHome(cwd) && cwd !== homedir() && isEmptyFolder(cwd))
|
|
231
|
+
return cwd;
|
|
232
|
+
return join(isInsideHome(cwd) ? cwd : homedir(), name);
|
|
233
|
+
}
|
|
225
234
|
function commandLineToolsReady() {
|
|
226
235
|
return spawnSync('xcode-select', ['-p'], { stdio: 'ignore' }).status === 0;
|
|
227
236
|
}
|
|
@@ -233,7 +242,7 @@ export async function pull(io, name, cwd) {
|
|
|
233
242
|
text: '✗ Which site? app pull sundayparty'
|
|
234
243
|
};
|
|
235
244
|
}
|
|
236
|
-
const target =
|
|
245
|
+
const target = folderFor(name, cwd);
|
|
237
246
|
if (target !== cwd && existsSync(target) && !isEmptyFolder(target)) {
|
|
238
247
|
return {
|
|
239
248
|
code: 1,
|
|
@@ -284,11 +293,11 @@ export async function pull(io, name, cwd) {
|
|
|
284
293
|
await io.run('git', ['add', '-A'], target);
|
|
285
294
|
await io.run('git', ['commit', '-q', '-m', `Version ${result.number} from onpattern.app`], target);
|
|
286
295
|
}
|
|
287
|
-
const moved =
|
|
296
|
+
const moved = `\n folder ${target}`;
|
|
288
297
|
return {
|
|
289
298
|
code: 0,
|
|
290
299
|
data: { name, folder: target, version: result.number, files },
|
|
291
|
-
text: `✓ ${result.title} is on this computer${moved}\n next read AGENTS.md, then app start`
|
|
300
|
+
text: `✓ ${result.title} is on this computer${moved}\n next cd into that folder, read AGENTS.md, then ./app start`
|
|
292
301
|
};
|
|
293
302
|
}
|
|
294
303
|
catch (error) {
|
package/dist/server/auth.js
CHANGED
|
@@ -29,7 +29,10 @@ function randomToken() {
|
|
|
29
29
|
.replaceAll('=', '');
|
|
30
30
|
}
|
|
31
31
|
function safePath(path) {
|
|
32
|
-
return path !== undefined &&
|
|
32
|
+
return path !== undefined &&
|
|
33
|
+
path.startsWith('/') &&
|
|
34
|
+
!path.startsWith('//') &&
|
|
35
|
+
!path.includes('\\')
|
|
33
36
|
? path
|
|
34
37
|
: '/';
|
|
35
38
|
}
|