@redplanethq/corebrain 1.0.0
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/LICENSE +44 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +7 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/index.d.ts +14 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +10 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/login.d.ts +8 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +131 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +8 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +52 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/me.d.ts +8 -0
- package/dist/commands/me.d.ts.map +1 -0
- package/dist/commands/me.js +59 -0
- package/dist/commands/me.js.map +1 -0
- package/dist/commands/token.d.ts +8 -0
- package/dist/commands/token.d.ts.map +1 -0
- package/dist/commands/token.js +31 -0
- package/dist/commands/token.js.map +1 -0
- package/dist/components/error-message.d.ts +7 -0
- package/dist/components/error-message.d.ts.map +1 -0
- package/dist/components/error-message.js +12 -0
- package/dist/components/error-message.js.map +1 -0
- package/dist/components/info-message.d.ts +6 -0
- package/dist/components/info-message.d.ts.map +1 -0
- package/dist/components/info-message.js +11 -0
- package/dist/components/info-message.js.map +1 -0
- package/dist/components/success-message.d.ts +6 -0
- package/dist/components/success-message.d.ts.map +1 -0
- package/dist/components/success-message.js +11 -0
- package/dist/components/success-message.js.map +1 -0
- package/dist/components/warning-message.d.ts +7 -0
- package/dist/components/warning-message.d.ts.map +1 -0
- package/dist/components/warning-message.js +12 -0
- package/dist/components/warning-message.js.map +1 -0
- package/dist/config/env-substitution.d.ts +2 -0
- package/dist/config/env-substitution.d.ts.map +1 -0
- package/dist/config/env-substitution.js +43 -0
- package/dist/config/env-substitution.js.map +1 -0
- package/dist/config/index.d.ts +11 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +139 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/paths.d.ts +3 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +51 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/config/themes.d.ts +10 -0
- package/dist/config/themes.d.ts.map +1 -0
- package/dist/config/themes.js +66 -0
- package/dist/config/themes.js.map +1 -0
- package/dist/hooks/useTerminalWidth.d.ts +18 -0
- package/dist/hooks/useTerminalWidth.d.ts.map +1 -0
- package/dist/hooks/useTerminalWidth.js +65 -0
- package/dist/hooks/useTerminalWidth.js.map +1 -0
- package/dist/hooks/useTheme.d.ts +10 -0
- package/dist/hooks/useTheme.d.ts.map +1 -0
- package/dist/hooks/useTheme.js +10 -0
- package/dist/hooks/useTheme.js.map +1 -0
- package/dist/types/config.d.ts +64 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +2 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/ui.d.ts +19 -0
- package/dist/types/ui.d.ts.map +1 -0
- package/dist/types/ui.js +2 -0
- package/dist/types/ui.js.map +1 -0
- package/dist/types/utils.d.ts +14 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/types/utils.js +2 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/utils/message-queue.d.ts +7 -0
- package/dist/utils/message-queue.d.ts.map +1 -0
- package/dist/utils/message-queue.js +58 -0
- package/dist/utils/message-queue.js.map +1 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Core License
|
|
2
|
+
|
|
3
|
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
4
|
+
Version 3, 19 November 2007
|
|
5
|
+
|
|
6
|
+
Copyright (c) 2025 — Poozle Inc.
|
|
7
|
+
|
|
8
|
+
This program is free software: you can redistribute it and/or modify
|
|
9
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
10
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
(at your option) any later version.
|
|
12
|
+
|
|
13
|
+
This program is distributed in the hope that it will be useful,
|
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
GNU Affero General Public License for more details.
|
|
17
|
+
|
|
18
|
+
You should have received a copy of the GNU Affero General Public License
|
|
19
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
|
+
|
|
21
|
+
Additional Terms:
|
|
22
|
+
|
|
23
|
+
As additional permission under GNU AGPL version 3 section 7, you
|
|
24
|
+
may combine or link a "work that uses the Library" with a publicly
|
|
25
|
+
distributed version of this library to produce a combined library or
|
|
26
|
+
application, then distribute that combined work under the terms of
|
|
27
|
+
your choice, with no requirement to comply with the obligations
|
|
28
|
+
normally placed on you by section 4 of the GNU AGPL version 3
|
|
29
|
+
(or the corresponding section of a later version of the GNU AGPL
|
|
30
|
+
version 3 license).
|
|
31
|
+
|
|
32
|
+
"Commons Clause" License Condition v1.0
|
|
33
|
+
|
|
34
|
+
The Software is provided to you by the Licensor under the License (defined below), subject to the following condition:
|
|
35
|
+
|
|
36
|
+
Without limiting other conditions in the License, the grant of rights under the License will not include, and the License does not grant to you, the right to Sell the Software.
|
|
37
|
+
|
|
38
|
+
For purposes of the foregoing, "Sell" means practicing any or all of the rights granted to you under the License to provide the Software to third parties, for a fee or other consideration (including without limitation fees for hosting or consulting/support services related to the Software), as part of a product or service whose value derives, entirely or substantially, from the functionality of the Software. Any license notice or attribution required by the License must also include this Commons Clause License Condition notice.
|
|
39
|
+
|
|
40
|
+
Software: All files in this repository.
|
|
41
|
+
|
|
42
|
+
License: GNU Affero General Public License v3.0
|
|
43
|
+
|
|
44
|
+
Licensor: Poozle Inc.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.tsx"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC,IAAI;CACvB,CAAC,CAAC;AAEH,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import zod from 'zod';
|
|
2
|
+
export declare const options: zod.ZodObject<{
|
|
3
|
+
name: zod.ZodDefault<zod.ZodString>;
|
|
4
|
+
}, "strip", zod.ZodTypeAny, {
|
|
5
|
+
name: string;
|
|
6
|
+
}, {
|
|
7
|
+
name?: string | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
type Props = {
|
|
10
|
+
options: zod.infer<typeof options>;
|
|
11
|
+
};
|
|
12
|
+
export default function Index({ options }: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.tsx"],"names":[],"mappings":"AAEA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,OAAO;;;;;;EAElB,CAAC;AAEH,KAAK,KAAK,GAAG;IACZ,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAC,OAAO,EAAC,EAAE,KAAK,2CAM7C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from 'ink';
|
|
3
|
+
import zod from 'zod';
|
|
4
|
+
export const options = zod.object({
|
|
5
|
+
name: zod.string().default('Stranger').describe('Name'),
|
|
6
|
+
});
|
|
7
|
+
export default function Index({ options }) {
|
|
8
|
+
return (_jsxs(Text, { children: ["Hello, ", _jsx(Text, { color: "green", children: options.name })] }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAC;AACzB,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;CACvD,CAAC,CAAC;AAMH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAC,OAAO,EAAQ;IAC7C,OAAO,CACN,MAAC,IAAI,0BACG,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,YAAE,OAAO,CAAC,IAAI,GAAQ,IAC1C,CACP,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import zod from 'zod';
|
|
2
|
+
export declare const options: zod.ZodObject<{}, "strip", zod.ZodTypeAny, {}, {}>;
|
|
3
|
+
type Props = {
|
|
4
|
+
options: zod.infer<typeof options>;
|
|
5
|
+
};
|
|
6
|
+
export default function Login(_props: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.tsx"],"names":[],"mappings":"AAEA,OAAO,GAAG,MAAM,KAAK,CAAC;AA4BtB,eAAO,MAAM,OAAO,oDAAiB,CAAC;AAEtC,KAAK,KAAK,GAAG;IACZ,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,MAAM,EAAE,KAAK,kDA0I1C"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Text } from 'ink';
|
|
4
|
+
import zod from 'zod';
|
|
5
|
+
import { exec } from 'node:child_process';
|
|
6
|
+
import { CoreClient } from '@redplanethq/sdk';
|
|
7
|
+
import { getConfig, updateConfig } from '../config/index.js';
|
|
8
|
+
const BASE_URL = 'https://app.getcore.me';
|
|
9
|
+
const POLL_INTERVAL_MS = 2000;
|
|
10
|
+
const POLL_TIMEOUT_MS = 300_000; // 5 minutes
|
|
11
|
+
/**
|
|
12
|
+
* Open URL in the default browser
|
|
13
|
+
*/
|
|
14
|
+
function openBrowser(url) {
|
|
15
|
+
const command = process.platform === 'darwin'
|
|
16
|
+
? `open "${url}"`
|
|
17
|
+
: process.platform === 'win32'
|
|
18
|
+
? `start "" "${url}"`
|
|
19
|
+
: `xdg-open "${url}"`;
|
|
20
|
+
exec(command, (error) => {
|
|
21
|
+
if (error) {
|
|
22
|
+
// Silently fail - user can still copy the URL manually
|
|
23
|
+
console.error('Failed to open browser:', error.message);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export const options = zod.object({});
|
|
28
|
+
export default function Login(_props) {
|
|
29
|
+
const [status, setStatus] = useState('checking');
|
|
30
|
+
const [url, setUrl] = useState('');
|
|
31
|
+
const [error, setError] = useState('');
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
let cancelled = false;
|
|
34
|
+
(async () => {
|
|
35
|
+
// Step 1: Check if already authenticated
|
|
36
|
+
const config = getConfig();
|
|
37
|
+
if (config.auth?.apiKey) {
|
|
38
|
+
try {
|
|
39
|
+
const client = new CoreClient({
|
|
40
|
+
baseUrl: config.auth.url || BASE_URL,
|
|
41
|
+
token: config.auth.apiKey,
|
|
42
|
+
});
|
|
43
|
+
await client.checkAuth();
|
|
44
|
+
if (!cancelled)
|
|
45
|
+
setStatus('already-authenticated');
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// Token invalid or expired — proceed with login flow
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Step 2: Request authorization code
|
|
53
|
+
setStatus('fetching-code');
|
|
54
|
+
const client = new CoreClient({ baseUrl: BASE_URL, token: '' });
|
|
55
|
+
let authCode = '';
|
|
56
|
+
let verifyUrl = '';
|
|
57
|
+
try {
|
|
58
|
+
const res = await client.getAuthorizationCode();
|
|
59
|
+
authCode = res.authorizationCode;
|
|
60
|
+
const base64Token = Buffer.from(JSON.stringify({ authorizationCode: authCode, source: 'core-cli', clientName: 'core-cli' })).toString("base64");
|
|
61
|
+
verifyUrl = `${BASE_URL}/agent/verify/${base64Token}?source=core-cli`;
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
if (!cancelled) {
|
|
65
|
+
setError(err instanceof Error ? err.message : 'Failed to get authorization code');
|
|
66
|
+
setStatus('error');
|
|
67
|
+
}
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (!cancelled) {
|
|
71
|
+
setUrl(verifyUrl);
|
|
72
|
+
setStatus('polling');
|
|
73
|
+
// Automatically open the URL in browser
|
|
74
|
+
openBrowser(verifyUrl);
|
|
75
|
+
}
|
|
76
|
+
// Step 3: Poll for token
|
|
77
|
+
const startedAt = Date.now();
|
|
78
|
+
while (!cancelled) {
|
|
79
|
+
if (Date.now() - startedAt > POLL_TIMEOUT_MS) {
|
|
80
|
+
if (!cancelled) {
|
|
81
|
+
setError('Login timed out after 5 minutes. Please try again.');
|
|
82
|
+
setStatus('error');
|
|
83
|
+
}
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
87
|
+
if (cancelled)
|
|
88
|
+
break;
|
|
89
|
+
try {
|
|
90
|
+
const tokenRes = await client.exchangeToken({ authorizationCode: authCode });
|
|
91
|
+
if (tokenRes.token) {
|
|
92
|
+
const pat = tokenRes.token.token;
|
|
93
|
+
// Step 4: Persist token
|
|
94
|
+
updateConfig({
|
|
95
|
+
auth: {
|
|
96
|
+
url: BASE_URL,
|
|
97
|
+
apiKey: pat,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
if (!cancelled)
|
|
101
|
+
setStatus('success');
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
// Token endpoint returned an error — keep polling
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
})();
|
|
110
|
+
return () => {
|
|
111
|
+
cancelled = true;
|
|
112
|
+
};
|
|
113
|
+
}, []);
|
|
114
|
+
switch (status) {
|
|
115
|
+
case 'checking':
|
|
116
|
+
return _jsx(Text, { dimColor: true, children: "Checking existing authentication..." });
|
|
117
|
+
case 'already-authenticated':
|
|
118
|
+
return (_jsx(Text, { color: "green", children: "Already authenticated. Use a different command or clear your config to re-login." }));
|
|
119
|
+
case 'fetching-code':
|
|
120
|
+
return _jsx(Text, { dimColor: true, children: "Requesting authorization code..." });
|
|
121
|
+
case 'polling':
|
|
122
|
+
return (_jsxs(_Fragment, { children: [_jsx(Text, { color: "green", children: "Opening browser to authorize... If it doesn't open automatically, visit:" }), _jsx(Text, { color: "cyan", children: url }), _jsx(Text, { dimColor: true, children: "Waiting for authorization..." })] }));
|
|
123
|
+
case 'success':
|
|
124
|
+
return (_jsx(Text, { color: "green", bold: true, children: "Successfully logged in. Token saved to config." }));
|
|
125
|
+
case 'error':
|
|
126
|
+
return _jsx(Text, { color: "red", children: error });
|
|
127
|
+
default:
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEzD,MAAM,QAAQ,GAAG,wBAAwB,CAAC;AAC1C,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,eAAe,GAAG,OAAO,CAAC,CAAC,YAAY;AAE7C;;GAEG;AACH,SAAS,WAAW,CAAC,GAAW;IAC/B,MAAM,OAAO,GACZ,OAAO,CAAC,QAAQ,KAAK,QAAQ;QAC5B,CAAC,CAAC,SAAS,GAAG,GAAG;QACjB,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO;YAC7B,CAAC,CAAC,aAAa,GAAG,GAAG;YACrB,CAAC,CAAC,aAAa,GAAG,GAAG,CAAC;IAEzB,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;QACvB,IAAI,KAAK,EAAE,CAAC;YACX,uDAAuD;YACvD,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACzD,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC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IAAI,qEAEjB,CACP,CAAC;QAEH,KAAK,OAAO;YACX,OAAO,KAAC,IAAI,IAAC,KAAK,EAAC,KAAK,YAAE,KAAK,GAAQ,CAAC;QAEzC;YACC,OAAO,IAAI,CAAC;IACd,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import zod from 'zod';
|
|
2
|
+
export declare const options: zod.ZodObject<{}, "strip", zod.ZodTypeAny, {}, {}>;
|
|
3
|
+
type Props = {
|
|
4
|
+
options: zod.infer<typeof options>;
|
|
5
|
+
};
|
|
6
|
+
export default function Logout(_props: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=logout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../src/commands/logout.tsx"],"names":[],"mappings":"AAEA,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,OAAO,oDAAiB,CAAC;AAEtC,KAAK,KAAK,GAAG;IACZ,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,MAAM,EAAE,KAAK,kDA+D3C"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Text } from 'ink';
|
|
4
|
+
import zod from 'zod';
|
|
5
|
+
import { getConfig, updateConfig } from '../config/index.js';
|
|
6
|
+
export const options = zod.object({});
|
|
7
|
+
export default function Logout(_props) {
|
|
8
|
+
const [status, setStatus] = useState('checking');
|
|
9
|
+
const [error, setError] = useState('');
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
let cancelled = false;
|
|
12
|
+
(async () => {
|
|
13
|
+
const config = getConfig();
|
|
14
|
+
// Check if already logged out
|
|
15
|
+
if (!config.auth?.apiKey) {
|
|
16
|
+
if (!cancelled)
|
|
17
|
+
setStatus('not-authenticated');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
// Remove auth from config
|
|
22
|
+
updateConfig({ auth: undefined });
|
|
23
|
+
if (!cancelled)
|
|
24
|
+
setStatus('success');
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
if (!cancelled) {
|
|
28
|
+
setError(err instanceof Error
|
|
29
|
+
? err.message
|
|
30
|
+
: 'Failed to clear authentication');
|
|
31
|
+
setStatus('error');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
})();
|
|
35
|
+
return () => {
|
|
36
|
+
cancelled = true;
|
|
37
|
+
};
|
|
38
|
+
}, []);
|
|
39
|
+
switch (status) {
|
|
40
|
+
case 'checking':
|
|
41
|
+
return _jsx(Text, { dimColor: true, children: "Logging out..." });
|
|
42
|
+
case 'not-authenticated':
|
|
43
|
+
return (_jsx(Text, { color: "yellow", children: "Already logged out. No authentication found in config." }));
|
|
44
|
+
case 'success':
|
|
45
|
+
return (_jsx(Text, { color: "green", bold: true, children: "Successfully logged out. Authentication cleared from config." }));
|
|
46
|
+
case 'error':
|
|
47
|
+
return _jsxs(Text, { color: "red", children: ["Error: ", error] });
|
|
48
|
+
default:
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=logout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../src/commands/logout.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACjD,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAC;AACzB,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,SAAS,EAAE,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAEvD,M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AE7C,KAAK,mBAAmB;YACvB,OAAO,CACN,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,uEAEb,CACP,CAAC;QAEH,KAAK,SAAS;YACb,OAAO,CACN,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,EAAC,IAAI,mFAEjB,CACP,CAAC;QAEH,KAAK,OAAO;YACX,OAAO,MAAC,IAAI,IAAC,KAAK,EAAC,KAAK,wBAAS,KAAK,IAAQ,CAAC;QAEhD;YACC,OAAO,IAAI,CAAC;IACd,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import zod from 'zod';
|
|
2
|
+
export declare const options: zod.ZodObject<{}, "strip", zod.ZodTypeAny, {}, {}>;
|
|
3
|
+
type Props = {
|
|
4
|
+
options: zod.infer<typeof options>;
|
|
5
|
+
};
|
|
6
|
+
export default function Me(_props: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=me.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../src/commands/me.tsx"],"names":[],"mappings":"AAEA,OAAO,GAAG,MAAM,KAAK,CAAC;AAMtB,eAAO,MAAM,OAAO,oDAAiB,CAAC;AAEtC,KAAK,KAAK,GAAG;IACZ,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,EAAE,CAAC,MAAM,EAAE,KAAK,kDA2EvC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Text } from 'ink';
|
|
4
|
+
import zod from 'zod';
|
|
5
|
+
import { CoreClient } from '@redplanethq/sdk';
|
|
6
|
+
import { getConfig } from '../config/index.js';
|
|
7
|
+
const BASE_URL = 'https://app.getcore.me';
|
|
8
|
+
export const options = zod.object({});
|
|
9
|
+
export default function Me(_props) {
|
|
10
|
+
const [status, setStatus] = useState('loading');
|
|
11
|
+
const [user, setUser] = useState(null);
|
|
12
|
+
const [error, setError] = useState('');
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
let cancelled = false;
|
|
15
|
+
(async () => {
|
|
16
|
+
const config = getConfig();
|
|
17
|
+
const apiKey = config.auth?.apiKey;
|
|
18
|
+
const url = config.auth?.url;
|
|
19
|
+
if (!apiKey) {
|
|
20
|
+
if (!cancelled)
|
|
21
|
+
setStatus('not-authenticated');
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const client = new CoreClient({
|
|
26
|
+
baseUrl: url || BASE_URL,
|
|
27
|
+
token: apiKey,
|
|
28
|
+
});
|
|
29
|
+
const response = await client.me();
|
|
30
|
+
if (!cancelled) {
|
|
31
|
+
setUser(response);
|
|
32
|
+
setStatus('success');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
if (!cancelled) {
|
|
37
|
+
setError(err instanceof Error ? err.message : 'Failed to fetch user info');
|
|
38
|
+
setStatus('error');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
})();
|
|
42
|
+
return () => {
|
|
43
|
+
cancelled = true;
|
|
44
|
+
};
|
|
45
|
+
}, []);
|
|
46
|
+
switch (status) {
|
|
47
|
+
case 'loading':
|
|
48
|
+
return _jsx(Text, { dimColor: true, children: "Fetching user info..." });
|
|
49
|
+
case 'not-authenticated':
|
|
50
|
+
return (_jsx(Text, { color: "red", children: "Not authenticated. Please run the login command first." }));
|
|
51
|
+
case 'success':
|
|
52
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Text, { color: "green", bold: true, children: ["Name: ", user?.name || 'Not set'] }), user?.email && _jsxs(Text, { dimColor: true, children: ["Email: ", user.email] }), user?.workspaceId && (_jsxs(Text, { dimColor: true, children: ["Workspace ID: ", user.workspaceId] }))] }));
|
|
53
|
+
case 'error':
|
|
54
|
+
return _jsxs(Text, { color: "red", children: ["Error: ", error] });
|
|
55
|
+
default:
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=me.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"me.js","sourceRoot":"","sources":["../../src/commands/me.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACjD,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAC;AACzB,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,UAAU,EAAkB,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,MAAM,QAAQ,GAAG,wBAAwB,CAAC;AAE1C,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAMtC,MAAM,CAAC,OAAO,UAAU,EAAE,CAAC,MAAa;IACvC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAElC,SAAS,CAAC,CAAC;IACb,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAoB,IAAI,CAAC,CAAC;IAC1D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEvC,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,SAAS,GAAG,KAAK,CAAC;QAEtB,CAAC,KAAK,IAAI,EAAE;YACX,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC;YACnC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC;YAE7B,IAAI,CAAC,MAAM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,IAAI,EAAE,WAAW,IAAI,CACrB,MAAC,IAAI,IAAC,QAAQ,qCAAgB,IAAI,CAAC,WAAW,IAAQ,CACtD,IACC,CACH,CAAC;QAEH,KAAK,OAAO;YACX,OAAO,MAAC,IAAI,IAAC,KAAK,EAAC,KAAK,wBAAS,KAAK,IAAQ,CAAC;QAEhD;YACC,OAAO,IAAI,CAAC;IACd,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import zod from 'zod';
|
|
2
|
+
export declare const options: zod.ZodObject<{}, "strip", zod.ZodTypeAny, {}, {}>;
|
|
3
|
+
type Props = {
|
|
4
|
+
options: zod.infer<typeof options>;
|
|
5
|
+
};
|
|
6
|
+
export default function Token(_props: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/commands/token.tsx"],"names":[],"mappings":"AAEA,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,OAAO,oDAAiB,CAAC;AAEtC,KAAK,KAAK,GAAG;IACZ,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,MAAM,EAAE,KAAK,kDAkC1C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Text } from 'ink';
|
|
4
|
+
import zod from 'zod';
|
|
5
|
+
import { getConfig } from '../config/index.js';
|
|
6
|
+
export const options = zod.object({});
|
|
7
|
+
export default function Token(_props) {
|
|
8
|
+
const [status, setStatus] = useState('loading');
|
|
9
|
+
const [token, setToken] = useState('');
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const config = getConfig();
|
|
12
|
+
const apiKey = config.auth?.apiKey;
|
|
13
|
+
if (!apiKey) {
|
|
14
|
+
setStatus('not-authenticated');
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
setToken(apiKey);
|
|
18
|
+
setStatus('found');
|
|
19
|
+
}, []);
|
|
20
|
+
switch (status) {
|
|
21
|
+
case 'loading':
|
|
22
|
+
return _jsx(Text, { dimColor: true, children: "Reading token..." });
|
|
23
|
+
case 'not-authenticated':
|
|
24
|
+
return (_jsx(Text, { color: "red", children: "Not authenticated. Please run the login command first." }));
|
|
25
|
+
case 'found':
|
|
26
|
+
return _jsx(Text, { children: token });
|
|
27
|
+
default:
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../src/commands/token.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAMtC,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,MAAa;IAC1C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAA4C,SAAS,CAAC,CAAC;IAC3F,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEvC,SAAS,CAAC,GAAG,EAAE;QACd,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC;QAEnC,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,SAAS,CAAC,mBAAmB,CAAC,CAAC;YAC/B,OAAO;QACR,CAAC;QAED,QAAQ,CAAC,MAAM,CAAC,CAAC;QACjB,SAAS,CAAC,OAAO,CAAC,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,QAAQ,MAAM,EAAE,CAAC;QAChB,KAAK,SAAS;YACb,OAAO,KAAC,IAAI,IAAC,QAAQ,uCAAwB,CAAC;QAE/C,KAAK,mBAAmB;YACvB,OAAO,CACN,KAAC,IAAI,IAAC,KAAK,EAAC,KAAK,uEAEV,CACP,CAAC;QAEH,KAAK,OAAO;YACX,OAAO,KAAC,IAAI,cAAE,KAAK,GAAQ,CAAC;QAE7B;YACC,OAAO,IAAI,CAAC;IACd,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-message.d.ts","sourceRoot":"","sources":["../../src/components/error-message.tsx"],"names":[],"mappings":";aAYU,MAAM;gBACH,OAAO;cACT,OAAO;;AAPlB,wBA6CG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { TitledBox, titleStyles } from '@mishieck/ink-titled-box';
|
|
3
|
+
import { Text, Box } from 'ink';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
6
|
+
import { useTerminalWidth } from '../hooks/useTerminalWidth.js';
|
|
7
|
+
export default memo(function ErrorMessage({ message, hideTitle = false, hideBox = false, }) {
|
|
8
|
+
const boxWidth = useTerminalWidth();
|
|
9
|
+
const { colors } = useTheme();
|
|
10
|
+
return (_jsx(_Fragment, { children: hideBox ? (_jsx(Box, { width: boxWidth, flexDirection: "column", marginBottom: 1, children: _jsx(Text, { color: colors.error, children: message }) })) : hideTitle ? (_jsx(Box, { borderStyle: "round", width: boxWidth, borderColor: colors.error, paddingX: 2, paddingY: 0, flexDirection: "column", children: _jsx(Text, { color: colors.error, children: message }) })) : (_jsx(TitledBox, { borderStyle: "round", titles: ['Error'], titleStyles: titleStyles.pill, width: boxWidth, borderColor: colors.error, paddingX: 2, paddingY: 1, flexDirection: "column", children: _jsx(Text, { color: colors.error, children: message }) }, colors.primary)) }));
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=error-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-message.js","sourceRoot":"","sources":["../../src/components/error-message.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,eAAe,IAAI,CAAC,SAAS,YAAY,CAAC,EACzC,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,KAAK,GAKf;IACA,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IACpC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC9B,OAAO,CACN,4BACE,OAAO,CAAC,CAAC,CAAC,CACV,KAAC,GAAG,IAAC,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAC,QAAQ,EAAC,YAAY,EAAE,CAAC,YAC3D,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,YAAG,OAAO,GAAQ,GACtC,CACN,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CACf,KAAC,GAAG,IACH,WAAW,EAAC,OAAO,EACnB,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,MAAM,CAAC,KAAK,EACzB,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,aAAa,EAAC,QAAQ,YAEtB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,YAAG,OAAO,GAAQ,GACtC,CACN,CAAC,CAAC,CAAC,CACH,KAAC,SAAS,IAET,WAAW,EAAC,OAAO,EACnB,MAAM,EAAE,CAAC,OAAO,CAAC,EACjB,WAAW,EAAE,WAAW,CAAC,IAAI,EAC7B,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,MAAM,CAAC,KAAK,EACzB,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,aAAa,EAAC,QAAQ,YAEtB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,YAAG,OAAO,GAAQ,IAVtC,MAAM,CAAC,OAAO,CAWR,CACZ,GACC,CACH,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info-message.d.ts","sourceRoot":"","sources":["../../src/components/info-message.tsx"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EACnC,OAAO,EACP,SAAiB,EACjB,OAAe,GACf,EAAE;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,2CAsCA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { TitledBox, titleStyles } from '@mishieck/ink-titled-box';
|
|
3
|
+
import { Text, Box } from 'ink';
|
|
4
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
5
|
+
import { useTerminalWidth } from '../hooks/useTerminalWidth.js';
|
|
6
|
+
export default function InfoMessage({ message, hideTitle = false, hideBox = false, }) {
|
|
7
|
+
const boxWidth = useTerminalWidth();
|
|
8
|
+
const { colors } = useTheme();
|
|
9
|
+
return (_jsx(_Fragment, { children: hideBox ? (_jsx(Box, { width: boxWidth, flexDirection: "column", marginBottom: 1, children: _jsx(Text, { color: colors.white, children: message }) })) : hideTitle ? (_jsx(Box, { borderStyle: "round", width: boxWidth, borderColor: colors.white, paddingX: 2, paddingY: 0, flexDirection: "column", children: _jsx(Text, { color: colors.white, children: message }) })) : (_jsx(TitledBox, { borderStyle: "round", titles: ['Info'], titleStyles: titleStyles.pill, width: boxWidth, borderColor: colors.white, paddingX: 2, paddingY: 1, flexDirection: "column", children: _jsx(Text, { color: colors.white, children: message }) }, colors.primary)) }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=info-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info-message.js","sourceRoot":"","sources":["../../src/components/info-message.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAC,IAAI,EAAE,GAAG,EAAC,MAAM,KAAK,CAAC;AAE9B,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAE1D,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EACnC,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,KAAK,GAKf;IACA,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IACpC,MAAM,EAAC,MAAM,EAAC,GAAG,QAAQ,EAAE,CAAC;IAE5B,OAAO,CACN,4BACE,OAAO,CAAC,CAAC,CAAC,CACV,KAAC,GAAG,IAAC,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAC,QAAQ,EAAC,YAAY,EAAE,CAAC,YAC3D,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,YAAG,OAAO,GAAQ,GACtC,CACN,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CACf,KAAC,GAAG,IACH,WAAW,EAAC,OAAO,EACnB,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,MAAM,CAAC,KAAK,EACzB,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,aAAa,EAAC,QAAQ,YAEtB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,YAAG,OAAO,GAAQ,GACtC,CACN,CAAC,CAAC,CAAC,CACH,KAAC,SAAS,IAET,WAAW,EAAC,OAAO,EACnB,MAAM,EAAE,CAAC,MAAM,CAAC,EAChB,WAAW,EAAE,WAAW,CAAC,IAAI,EAC7B,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,MAAM,CAAC,KAAK,EACzB,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,aAAa,EAAC,QAAQ,YAEtB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,YAAG,OAAO,GAAQ,IAVtC,MAAM,CAAC,OAAO,CAWR,CACZ,GACC,CACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"success-message.d.ts","sourceRoot":"","sources":["../../src/components/success-message.tsx"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACtC,OAAO,EACP,SAAiB,EACjB,OAAe,GACf,EAAE;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,2CAqCA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { TitledBox, titleStyles } from '@mishieck/ink-titled-box';
|
|
3
|
+
import { Text, Box } from 'ink';
|
|
4
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
5
|
+
import { useTerminalWidth } from '../hooks/useTerminalWidth.js';
|
|
6
|
+
export default function SuccessMessage({ message, hideTitle = false, hideBox = false, }) {
|
|
7
|
+
const boxWidth = useTerminalWidth();
|
|
8
|
+
const { colors } = useTheme();
|
|
9
|
+
return (_jsx(_Fragment, { children: hideBox ? (_jsx(Box, { width: boxWidth, flexDirection: "column", marginBottom: 1, children: _jsx(Text, { color: colors.success, children: message }) })) : hideTitle ? (_jsx(Box, { borderStyle: "round", width: boxWidth, borderColor: colors.success, paddingX: 2, paddingY: 0, flexDirection: "column", children: _jsx(Text, { color: colors.success, children: message }) })) : (_jsx(TitledBox, { borderStyle: "round", titles: ['Success'], titleStyles: titleStyles.pill, width: boxWidth, borderColor: colors.success, paddingX: 2, paddingY: 1, flexDirection: "column", children: _jsx(Text, { color: colors.success, children: message }) }, colors.primary)) }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=success-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"success-message.js","sourceRoot":"","sources":["../../src/components/success-message.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAEhC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACtC,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,KAAK,GAKf;IACA,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IACpC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC9B,OAAO,CACN,4BACE,OAAO,CAAC,CAAC,CAAC,CACV,KAAC,GAAG,IAAC,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAC,QAAQ,EAAC,YAAY,EAAE,CAAC,YAC3D,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,YAAG,OAAO,GAAQ,GACxC,CACN,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CACf,KAAC,GAAG,IACH,WAAW,EAAC,OAAO,EACnB,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,MAAM,CAAC,OAAO,EAC3B,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,aAAa,EAAC,QAAQ,YAEtB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,YAAG,OAAO,GAAQ,GACxC,CACN,CAAC,CAAC,CAAC,CACH,KAAC,SAAS,IAET,WAAW,EAAC,OAAO,EACnB,MAAM,EAAE,CAAC,SAAS,CAAC,EACnB,WAAW,EAAE,WAAW,CAAC,IAAI,EAC7B,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,MAAM,CAAC,OAAO,EAC3B,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,aAAa,EAAC,QAAQ,YAEtB,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,YAAG,OAAO,GAAQ,IAVxC,MAAM,CAAC,OAAO,CAWR,CACZ,GACC,CACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warning-message.d.ts","sourceRoot":"","sources":["../../src/components/warning-message.tsx"],"names":[],"mappings":";aAYU,MAAM;gBACH,OAAO;cACT,OAAO;;AAPlB,wBA6CG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { TitledBox, titleStyles } from '@mishieck/ink-titled-box';
|
|
3
|
+
import { Text, Box } from 'ink';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
6
|
+
import { useTerminalWidth } from '../hooks/useTerminalWidth.js';
|
|
7
|
+
export default memo(function WarningMessage({ message, hideTitle = false, hideBox = false, }) {
|
|
8
|
+
const boxWidth = useTerminalWidth();
|
|
9
|
+
const { colors } = useTheme();
|
|
10
|
+
return (_jsx(_Fragment, { children: hideBox ? (_jsx(Box, { width: boxWidth, flexDirection: "column", marginBottom: 1, children: _jsx(Text, { color: colors.warning, children: message }) })) : hideTitle ? (_jsx(Box, { borderStyle: "round", width: boxWidth, borderColor: colors.warning, paddingX: 2, paddingY: 0, flexDirection: "column", children: _jsx(Text, { color: colors.warning, children: message }) })) : (_jsx(TitledBox, { borderStyle: "round", titles: ['Warning'], titleStyles: titleStyles.pill, width: boxWidth, borderColor: colors.warning, paddingX: 2, paddingY: 1, flexDirection: "column", children: _jsx(Text, { color: colors.warning, children: message }) }, colors.primary)) }));
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=warning-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warning-message.js","sourceRoot":"","sources":["../../src/components/warning-message.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,eAAe,IAAI,CAAC,SAAS,cAAc,CAAC,EAC3C,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,KAAK,GAKf;IACA,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IACpC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC9B,OAAO,CACN,4BACE,OAAO,CAAC,CAAC,CAAC,CACV,KAAC,GAAG,IAAC,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAC,QAAQ,EAAC,YAAY,EAAE,CAAC,Y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