@use-aistack/cli 0.6.1 → 0.6.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/README.md +2 -2
- package/dist/index.js +28 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ The default command. Scan your local transcripts (rolling 30 days), review the f
|
|
|
18
18
|
npx @use-aistack/cli sync
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
On an unlinked machine, `sync` starts the login flow inline — your browser opens to approve the machine, then the sync continues. One command is the whole onboarding.
|
|
22
22
|
|
|
23
23
|
### `npx @use-aistack/cli sync --auto on` / `off`
|
|
24
24
|
|
|
@@ -34,7 +34,7 @@ The silent run (`sync --auto`) never prompts and publishes only under this opt-i
|
|
|
34
34
|
|
|
35
35
|
### `npx @use-aistack/cli login`
|
|
36
36
|
|
|
37
|
-
Link this machine to your AI Stack account via browser.
|
|
37
|
+
Link this machine to your AI Stack account via browser. Optional — `sync` runs this inline when the machine is not linked yet.
|
|
38
38
|
|
|
39
39
|
```sh
|
|
40
40
|
npx @use-aistack/cli login
|
package/dist/index.js
CHANGED
|
@@ -1572,8 +1572,7 @@ function proposedMachineName(read = hostname) {
|
|
|
1572
1572
|
return void 0;
|
|
1573
1573
|
}
|
|
1574
1574
|
}
|
|
1575
|
-
async function
|
|
1576
|
-
intro2("login");
|
|
1575
|
+
async function performLogin() {
|
|
1577
1576
|
const s = p5.spinner();
|
|
1578
1577
|
s.start("Starting authentication...");
|
|
1579
1578
|
let session;
|
|
@@ -1583,8 +1582,7 @@ async function loginCommand() {
|
|
|
1583
1582
|
} catch (err) {
|
|
1584
1583
|
s.stop("Failed to start authentication");
|
|
1585
1584
|
p5.log.error(err instanceof Error ? err.message : String(err));
|
|
1586
|
-
|
|
1587
|
-
process.exit(1);
|
|
1585
|
+
return false;
|
|
1588
1586
|
}
|
|
1589
1587
|
p5.log.info(`${dim("CODE")} ${limeBold(session.userCode)}`);
|
|
1590
1588
|
p5.log.info(`${dim("OPEN")} ${dim(session.authUrl)}`);
|
|
@@ -1604,29 +1602,33 @@ async function loginCommand() {
|
|
|
1604
1602
|
if (result.status === "approved" && result.token) {
|
|
1605
1603
|
s.stop(lime("Authenticated"));
|
|
1606
1604
|
saveToken(result.token, result.userId);
|
|
1607
|
-
|
|
1608
|
-
`Token saved. Run ${limeBold("npx @use-aistack/cli collect")} to get started.`
|
|
1609
|
-
);
|
|
1610
|
-
outro2(lime("done"));
|
|
1611
|
-
return;
|
|
1605
|
+
return true;
|
|
1612
1606
|
}
|
|
1613
1607
|
if (result.status === "expired") {
|
|
1614
1608
|
s.stop("Session expired");
|
|
1615
1609
|
p5.log.error("Authentication session expired. Please try again.");
|
|
1616
|
-
|
|
1617
|
-
process.exit(1);
|
|
1610
|
+
return false;
|
|
1618
1611
|
}
|
|
1619
1612
|
} catch (err) {
|
|
1620
1613
|
s.stop("Error polling");
|
|
1621
1614
|
p5.log.error(err instanceof Error ? err.message : String(err));
|
|
1622
|
-
|
|
1623
|
-
process.exit(1);
|
|
1615
|
+
return false;
|
|
1624
1616
|
}
|
|
1625
1617
|
}
|
|
1626
1618
|
s.stop("Timed out");
|
|
1627
1619
|
p5.log.error("Authentication timed out after 3 minutes. Please try again.");
|
|
1628
|
-
|
|
1629
|
-
|
|
1620
|
+
return false;
|
|
1621
|
+
}
|
|
1622
|
+
async function loginCommand() {
|
|
1623
|
+
intro2("login");
|
|
1624
|
+
if (!await performLogin()) {
|
|
1625
|
+
outroError("error");
|
|
1626
|
+
process.exit(1);
|
|
1627
|
+
}
|
|
1628
|
+
p5.log.success(
|
|
1629
|
+
`Token saved. Run ${limeBold("npx @use-aistack/cli sync")} to publish your usage.`
|
|
1630
|
+
);
|
|
1631
|
+
outro2(lime("done"));
|
|
1630
1632
|
}
|
|
1631
1633
|
|
|
1632
1634
|
// src/commands/sync.ts
|
|
@@ -3607,7 +3609,7 @@ async function stageSync(deps) {
|
|
|
3607
3609
|
} else if (token === null) {
|
|
3608
3610
|
blockedReason = "This machine is not linked. Run `npx @use-aistack/cli login` first.";
|
|
3609
3611
|
} else if (config.stack === null) {
|
|
3610
|
-
blockedReason = source === "bundled" ? "Could not fetch your settings from aistack, so the destination stack is unknown. Publish needs it. Check the network and preview again." :
|
|
3612
|
+
blockedReason = source === "bundled" ? "Could not fetch your settings from aistack, so the destination stack is unknown. Publish needs it. Check the network and preview again." : `The token resolves no destination stack. Create one at ${deps.baseUrl}/stacks/new, then sync again.`;
|
|
3611
3613
|
}
|
|
3612
3614
|
return {
|
|
3613
3615
|
id: stageId(bodyJson),
|
|
@@ -3751,6 +3753,16 @@ async function syncCommand(options = {}) {
|
|
|
3751
3753
|
process.exitCode = 1;
|
|
3752
3754
|
return;
|
|
3753
3755
|
}
|
|
3756
|
+
if (getToken() === null) {
|
|
3757
|
+
p7.log.message(
|
|
3758
|
+
"This machine is not linked to an aistack account yet \u2014 linking it first."
|
|
3759
|
+
);
|
|
3760
|
+
if (!await performLogin()) {
|
|
3761
|
+
outroError("login failed \u2014 nothing was sent");
|
|
3762
|
+
process.exitCode = 1;
|
|
3763
|
+
return;
|
|
3764
|
+
}
|
|
3765
|
+
}
|
|
3754
3766
|
const s = p7.spinner();
|
|
3755
3767
|
s.start("Scanning local agent transcripts");
|
|
3756
3768
|
let staged;
|