49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import { CNB } from "../src";
|
|
import dotenv from "dotenv";
|
|
import util from 'node:util';
|
|
import { useConfig, useKey } from "@kevisual/use-config";
|
|
const config = useConfig()
|
|
export const token = useKey("CNB_API_KEY") as string || '';
|
|
export const cookie = useKey("CNB_COOKIE") as string || '';
|
|
console.log('token', token)
|
|
import { app } from '../agent/index.ts'
|
|
|
|
export { app }
|
|
export const cnb = new CNB({ token, cookie });
|
|
export const showMore = (obj: any) => {
|
|
return util.inspect(obj, { showHidden: false, depth: null, colors: true });
|
|
}
|
|
// const worksaceList = await cnb.workspace.list({ status: 'running' });
|
|
|
|
// console.log("worksaceList", showMore(worksaceList));
|
|
|
|
// const sn = 'cnb-o18-1jbklfuoh'
|
|
|
|
|
|
// const worksace = await cnb.workspace.getDetail('kevisual/cnb', sn)
|
|
|
|
// console.log("worksace", worksace);
|
|
|
|
// const stop = await cnb.workspace.stopWorkspace({ sn })
|
|
|
|
// console.log("stop", stop);
|
|
|
|
// exebqzp8sc
|
|
// const start = await cnb.workspace.startWorkspace('kevisual/cnb', {
|
|
// branch: 'main',
|
|
// });
|
|
|
|
// console.log("start", start);
|
|
// const start = await cnb.workspace.startWorkspace('kevisual/assistant-app', {
|
|
// branch: 'main',
|
|
// });
|
|
// if(start.data) {
|
|
// const url = start.data.url;
|
|
// console.log("url", url);
|
|
// const consoleUrl = cnb.workspace.getConsoleUrl(url);
|
|
// console.log("consoleUrl", consoleUrl);
|
|
// }
|
|
// console.log("start", start);
|
|
// const deteail = await cnb.workspace.getDetail('kevisual/assistant-app',sn);
|
|
// console.log("deteail", showMore(deteail));
|