cicy-code 2.3.348 → 2.3.353
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/bin/cicy-code.js +22 -2
- package/package.json +5 -5
package/bin/cicy-code.js
CHANGED
|
@@ -56,7 +56,11 @@ main().catch((err) => {
|
|
|
56
56
|
|
|
57
57
|
async function main() {
|
|
58
58
|
let cloudEnv = {};
|
|
59
|
-
if (cloudEmail)
|
|
59
|
+
if (Boolean(cloudEmail) !== Boolean(cloudTeam)) {
|
|
60
|
+
throw new Error('--email and --team must be provided together');
|
|
61
|
+
}
|
|
62
|
+
if (cloudEmail && cloudTeam) cloudEnv = await cloudLogin(cloudEmail, cloudTeam);
|
|
63
|
+
else cloudEnv = await savedCloudEnvironment();
|
|
60
64
|
if (!isUtility) ensurePortFree(PORT);
|
|
61
65
|
const child = spawn(binPath, args, {
|
|
62
66
|
stdio: 'inherit',
|
|
@@ -68,6 +72,22 @@ async function main() {
|
|
|
68
72
|
});
|
|
69
73
|
}
|
|
70
74
|
|
|
75
|
+
async function savedCloudEnvironment() {
|
|
76
|
+
const saved = readJSON(cloudCredentialPath());
|
|
77
|
+
const email = String(saved.email || '').trim().toLowerCase();
|
|
78
|
+
const instanceId = String(saved.instance_id || '').trim();
|
|
79
|
+
const teamId = String(saved.team_id || '').trim();
|
|
80
|
+
const token = String(saved.token || '').trim();
|
|
81
|
+
if (!email || !instanceId || !teamId || !token) return {};
|
|
82
|
+
try {
|
|
83
|
+
await registerCloudInstance(token, instanceId, teamId);
|
|
84
|
+
console.log(`cicy-code: CiCy Cloud connected from saved login as ${email} (team ${teamId})`);
|
|
85
|
+
} catch (err) {
|
|
86
|
+
console.warn(`cicy-code: saved CiCy Cloud login needs re-authentication: ${err && err.message ? err.message : err}`);
|
|
87
|
+
}
|
|
88
|
+
return cloudEnvironment(email, instanceId, teamId, token);
|
|
89
|
+
}
|
|
90
|
+
|
|
71
91
|
function takeCloudArgs(input) {
|
|
72
92
|
const output = [];
|
|
73
93
|
let email = '';
|
|
@@ -102,7 +122,7 @@ async function cloudLogin(email, requestedTeam) {
|
|
|
102
122
|
const saved = readJSON(credentialPath);
|
|
103
123
|
const instanceId = String(saved.instance_id || '').trim() ||
|
|
104
124
|
`code-${crypto.randomBytes(18).toString('hex')}`;
|
|
105
|
-
const teamId = requestedTeam
|
|
125
|
+
const teamId = requestedTeam;
|
|
106
126
|
let token = saved.email === email ? String(saved.token || '') : '';
|
|
107
127
|
|
|
108
128
|
if (token) {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "2.3.
|
|
6
|
+
"version": "2.3.353",
|
|
7
7
|
"description": "CiCy Code - AI-powered development environment",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "cicybot",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"bin/cicy-code.js"
|
|
17
17
|
],
|
|
18
18
|
"optionalDependencies": {
|
|
19
|
-
"cicy-code-darwin-arm64": "2.3.
|
|
20
|
-
"cicy-code-darwin-x64": "2.3.
|
|
21
|
-
"cicy-code-linux-arm64": "2.3.
|
|
22
|
-
"cicy-code-linux-x64": "2.3.
|
|
19
|
+
"cicy-code-darwin-arm64": "2.3.353",
|
|
20
|
+
"cicy-code-darwin-x64": "2.3.353",
|
|
21
|
+
"cicy-code-linux-arm64": "2.3.353",
|
|
22
|
+
"cicy-code-linux-x64": "2.3.353"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|