@liquidmetal-ai/raindrop 0.9.1 → 0.9.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 +111 -85
- package/bundle/{chunk-ZHYJWVIA.js → chunk-33VVNTZ7.js} +2 -2
- package/bundle/{chunk-SP4Q3T7T.js → chunk-3EXF5SKZ.js} +1 -1
- package/bundle/{chunk-JXNZYHAI.js → chunk-3TJC2HRW.js} +89 -105
- package/bundle/{chunk-HBDFBL3W.js → chunk-44MKXST7.js} +1 -1
- package/bundle/{chunk-GDYEPR67.js → chunk-4RZFURCF.js} +1 -1
- package/bundle/{chunk-67CBWZ7Y.js → chunk-4UNXUMLE.js} +3 -3
- package/bundle/chunk-4VJ2X7ZI.js +48 -0
- package/bundle/{chunk-IMQTVYRB.js → chunk-4WGY3ATR.js} +1 -1
- package/bundle/{chunk-ORPX7FPP.js → chunk-5TPOE7P2.js} +1 -5
- package/bundle/chunk-7JFKALLH.js +133 -0
- package/bundle/chunk-7O6U3ZAR.js +75 -0
- package/bundle/chunk-AWUA3C2V.js +114 -0
- package/bundle/{chunk-QKHN66ZN.js → chunk-BEN3KZQU.js} +1 -1
- package/bundle/{chunk-JDMAG4KE.js → chunk-BPZWIRQS.js} +2 -2
- package/bundle/chunk-C7G6I3MQ.js +292 -0
- package/bundle/chunk-D23L4WLL.js +502 -0
- package/bundle/chunk-E2TCXKAT.js +48 -0
- package/bundle/{chunk-FTG32FZ4.js → chunk-E7K6Y6GO.js} +1 -1
- package/bundle/chunk-EBK2SJTZ.js +805 -0
- package/bundle/chunk-FTH4A227.js +46 -0
- package/bundle/chunk-HBWEGYBW.js +4486 -0
- package/bundle/chunk-HFEVZZHW.js +46 -0
- package/bundle/chunk-I5M6WZPS.js +384 -0
- package/bundle/chunk-J44ZDCXF.js +44 -0
- package/bundle/{chunk-D5TOYPUE.js → chunk-J6XV5EH5.js} +1 -1
- package/bundle/chunk-KE7CMLHP.js +292 -0
- package/bundle/{chunk-ZLRYUJ5P.js → chunk-KHYRZQSK.js} +4 -4
- package/bundle/chunk-KOYRAC7N.js +74 -0
- package/bundle/chunk-KQ3F5KG7.js +231 -0
- package/bundle/chunk-KSXGB4ZG.js +4539 -0
- package/bundle/{chunk-7ERI6IFL.js → chunk-LP3LXBGR.js} +1 -1
- package/bundle/chunk-MH3BACIP.js +238722 -0
- package/bundle/chunk-MM7BYDBJ.js +238725 -0
- package/bundle/chunk-MQUFNQI5.js +231 -0
- package/bundle/{chunk-4RVUC2XX.js → chunk-N3LTFUBJ.js} +1 -1
- package/bundle/chunk-NWYJJVCF.js +22452 -0
- package/bundle/chunk-OAMLVMOY.js +133 -0
- package/bundle/chunk-PBVMMANP.js +4480 -0
- package/bundle/chunk-PT6CYFBD.js +74 -0
- package/bundle/chunk-QAG6TIB7.js +12148 -0
- package/bundle/chunk-RSLQIAJB.js +12148 -0
- package/bundle/chunk-SAU2NEDC.js +147 -0
- package/bundle/chunk-SZ6TMVT4.js +22452 -0
- package/bundle/chunk-T3MAVQWW.js +292 -0
- package/bundle/chunk-TCGZNSBY.js +4539 -0
- package/bundle/chunk-TRIIBQDR.js +4480 -0
- package/bundle/chunk-UUTXTOE3.js +231 -0
- package/bundle/chunk-VMKGSIXK.js +75 -0
- package/bundle/chunk-XDCRA7Y2.js +805 -0
- package/bundle/chunk-XEMONOX2.js +384 -0
- package/bundle/chunk-YAPQ2CKV.js +115 -0
- package/bundle/chunk-YDDBYUDC.js +502 -0
- package/bundle/chunk-ZGLCW5YO.js +380 -0
- package/bundle/chunk-ZQ6BFQSX.js +44 -0
- package/bundle/chunk-ZZTNAQSE.js +147 -0
- package/bundle/commands/annotation/get.js +3 -3
- package/bundle/commands/annotation/list.js +3 -3
- package/bundle/commands/annotation/put.js +3 -3
- package/bundle/commands/auth/list.js +2 -2
- package/bundle/commands/auth/login.js +3 -3
- package/bundle/commands/auth/logout.js +2 -2
- package/bundle/commands/auth/select.js +3 -3
- package/bundle/commands/bucket/create-credential.js +2 -2
- package/bundle/commands/bucket/delete-credential.js +2 -2
- package/bundle/commands/bucket/get-credential.js +2 -2
- package/bundle/commands/bucket/list-credentials.js +2 -2
- package/bundle/commands/build/branch.js +9 -9
- package/bundle/commands/build/checkout.js +6 -5
- package/bundle/commands/build/clone.js +5 -5
- package/bundle/commands/build/delete.js +6 -5
- package/bundle/commands/build/deploy.js +9 -9
- package/bundle/commands/build/env/get.js +2 -2
- package/bundle/commands/build/env/set.js +2 -2
- package/bundle/commands/build/find.js +7 -3
- package/bundle/commands/build/generate.js +3 -3
- package/bundle/commands/build/init-workspace.js +102 -0
- package/bundle/commands/build/init.js +3 -3
- package/bundle/commands/build/list.js +5 -4
- package/bundle/commands/build/sandbox.js +7 -7
- package/bundle/commands/build/start.js +2 -2
- package/bundle/commands/build/status.js +8 -4
- package/bundle/commands/build/stop.js +2 -2
- package/bundle/commands/build/tools/check.js +2 -2
- package/bundle/commands/build/tools/fmt.js +2 -2
- package/bundle/commands/build/unsandbox.js +7 -7
- package/bundle/commands/build/upload.js +5 -5
- package/bundle/commands/build/validate.js +4 -4
- package/bundle/commands/build/workos/delete.js +4 -4
- package/bundle/commands/build/workos/env/attach.js +3 -3
- package/bundle/commands/build/workos/env/create.js +3 -3
- package/bundle/commands/build/workos/env/delete.js +3 -3
- package/bundle/commands/build/workos/env/detach.js +3 -3
- package/bundle/commands/build/workos/env/get.js +3 -3
- package/bundle/commands/build/workos/env/list.js +3 -3
- package/bundle/commands/build/workos/env/set.js +3 -3
- package/bundle/commands/build/workos/invite.js +3 -3
- package/bundle/commands/build/workos/setup.js +3 -3
- package/bundle/commands/build/workos/status.js +3 -3
- package/bundle/commands/dns/create.js +2 -2
- package/bundle/commands/dns/delete.js +4 -4
- package/bundle/commands/dns/get.js +4 -4
- package/bundle/commands/dns/list.js +3 -3
- package/bundle/commands/dns/records/create.js +2 -2
- package/bundle/commands/dns/records/delete.js +3 -3
- package/bundle/commands/dns/records/get.js +2 -2
- package/bundle/commands/dns/records/list.js +2 -2
- package/bundle/commands/dns/records/update.js +2 -2
- package/bundle/commands/logs/query.js +3 -3
- package/bundle/commands/logs/tail.js +3 -3
- package/bundle/commands/mcp/install-claude.js +2 -2
- package/bundle/commands/mcp/install-gemini.js +2 -2
- package/bundle/commands/mcp/install-goose.js +2 -2
- package/bundle/commands/mcp/status.js +2 -2
- package/bundle/commands/object/delete.js +2 -2
- package/bundle/commands/object/get.js +2 -2
- package/bundle/commands/object/list.js +2 -2
- package/bundle/commands/object/put.js +2 -2
- package/bundle/commands/query/chunk-search.js +3 -3
- package/bundle/commands/query/document.js +3 -3
- package/bundle/commands/query/events.js +2 -2
- package/bundle/commands/query/reindex.js +2 -2
- package/bundle/commands/query/search.js +3 -3
- package/bundle/commands/tail.js +2 -2
- package/bundle/index.js +1 -1
- package/dist/commands/build/find.d.ts.map +1 -1
- package/dist/commands/build/find.js +3 -0
- package/dist/commands/build/init-workspace.d.ts +16 -0
- package/dist/commands/build/init-workspace.d.ts.map +1 -0
- package/dist/commands/build/init-workspace.js +95 -0
- package/dist/commands/build/list.d.ts.map +1 -1
- package/dist/commands/build/list.js +3 -0
- package/dist/commands/build/status.d.ts.map +1 -1
- package/dist/commands/build/status.js +3 -0
- package/dist/killswitch-utils.d.ts +30 -0
- package/dist/killswitch-utils.d.ts.map +1 -0
- package/dist/killswitch-utils.js +83 -0
- package/oclif.manifest.json +2114 -2007
- package/package.json +3 -3
- package/templates/claude-code/debug-raindrop-app.md +12 -39
- package/templates/claude-code/update-raindrop-app.md +5 -6
- package/templates/db/node_modules/.bin/prisma +2 -2
- package/templates/db/node_modules/.bin/prisma-kysely +2 -2
- package/templates/db/node_modules/.bin/tsc +2 -2
- package/templates/db/node_modules/.bin/tsserver +2 -2
- package/templates/db/node_modules/.bin/zx +2 -2
- package/templates/gemini-code/debug-raindrop-app.toml +12 -39
- package/templates/gemini-code/update-raindrop-app.toml +5 -6
- package/templates/goose/debug-raindrop-app.yaml +12 -39
- package/templates/goose/update-raindrop-app.yaml +5 -6
- package/templates/workspace/.gitignore.hbs +40 -0
- package/templates/workspace/package.json.hbs +22 -0
- package/dist/commands/killswitch.d.ts +0 -20
- package/dist/commands/killswitch.d.ts.map +0 -1
- package/dist/commands/killswitch.js +0 -58
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/utils/mixpanel.d.ts +0 -10
- package/dist/utils/mixpanel.d.ts.map +0 -1
- package/dist/utils/mixpanel.js +0 -43
package/bundle/commands/tail.js
CHANGED
package/bundle/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../src/commands/build/find.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../src/commands/build/find.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIpD,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,WAAW,CAAC,OAAO,IAAI,CAAC;IACxD,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAAgC;IAElD,MAAM,CAAC,QAAQ,WAmBb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;;;;;;MAiDV;YAGY,oBAAoB;IA6B5B,YAAY,CAAC,KAAK,EAAE;QACxB,MAAM,EAAE,MAAM,CAAC;QACf,kBAAkB,EAAE,MAAM,CAAC;QAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,GAAG,CAAC,EAAE,OAAO,CAAC;KACf;IAoLD,OAAO,CAAC,uBAAuB;IAgB/B,OAAO,CAAC,aAAa;IAiCf,cAAc,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAiD5G,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAU3B"}
|
|
@@ -6,6 +6,7 @@ import { Flags } from '@oclif/core';
|
|
|
6
6
|
import chalk from 'chalk';
|
|
7
7
|
import { BaseCommand } from '../../base-command.js';
|
|
8
8
|
import { EPOCH_TS } from '../../index.js';
|
|
9
|
+
import { checkAndDisplayKillswitchStatus } from '../../killswitch-utils.js';
|
|
9
10
|
export default class Find extends BaseCommand {
|
|
10
11
|
static args = {};
|
|
11
12
|
static description = 'find resources in Raindrop';
|
|
@@ -353,6 +354,8 @@ Find modules for a specific application and version.
|
|
|
353
354
|
}
|
|
354
355
|
}
|
|
355
356
|
async run() {
|
|
357
|
+
// Check and display killswitch status before finding resources
|
|
358
|
+
await checkAndDisplayKillswitchStatus(this);
|
|
356
359
|
if (this.flags.sudo) {
|
|
357
360
|
await this.queryResources(this.flags);
|
|
358
361
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class InitWorkspace extends BaseCommand<typeof InitWorkspace> {
|
|
3
|
+
static args: {
|
|
4
|
+
path: import("@oclif/core/interfaces").Arg<string, {
|
|
5
|
+
exists?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
};
|
|
8
|
+
static description: string;
|
|
9
|
+
static examples: string[];
|
|
10
|
+
static flags: {
|
|
11
|
+
overwrite: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=init-workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-workspace.d.ts","sourceRoot":"","sources":["../../../src/commands/build/init-workspace.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAOpD,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW,CAAC,OAAO,aAAa,CAAC;IAC1E,MAAM,CAAC,IAAI;;;;MAET;IAEF,MAAM,CAAC,WAAW,SAA8D;IAEhF,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;MAGV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAoF3B"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { BaseCommand } from '../../base-command.js';
|
|
5
|
+
import { fileExists, renderTemplateFromFile, TEMPLATES_DIR } from '../../codegen.js';
|
|
6
|
+
// Constants for workspace configuration
|
|
7
|
+
const MIN_NODE_VERSION = '>=18.0.0';
|
|
8
|
+
const WORKSPACE_DESCRIPTION = 'LiquidMetal AI workspace';
|
|
9
|
+
export default class InitWorkspace extends BaseCommand {
|
|
10
|
+
static args = {
|
|
11
|
+
path: Args.directory({ default: '.', description: 'Path to initialize the workspace in', required: false }),
|
|
12
|
+
};
|
|
13
|
+
static description = 'initialize a new npm workspace for Raindrop applications';
|
|
14
|
+
static examples = [
|
|
15
|
+
`<%= config.bin %> <%= command.id %> .
|
|
16
|
+
Initialize a workspace in the current directory.
|
|
17
|
+
`,
|
|
18
|
+
];
|
|
19
|
+
static flags = {
|
|
20
|
+
overwrite: Flags.boolean({ description: 'Overwrite existing files', default: false }),
|
|
21
|
+
name: Flags.string({ char: 'n', description: 'Name of the workspace' }),
|
|
22
|
+
};
|
|
23
|
+
async run() {
|
|
24
|
+
const workspacePath = path.resolve(this.args.path);
|
|
25
|
+
// Use the directory name as default workspace name, or the flag if provided
|
|
26
|
+
const workspaceName = this.flags.name || path.basename(workspacePath);
|
|
27
|
+
this.log(`Initializing npm workspace at: ${workspacePath}`);
|
|
28
|
+
// Validate destination directory exists
|
|
29
|
+
if (!(await fileExists(workspacePath))) {
|
|
30
|
+
try {
|
|
31
|
+
await fs.mkdir(workspacePath, { recursive: true });
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
this.error(`Could not create directory ${workspacePath}: ${error}`, { exit: 1 });
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const pathStat = await fs.lstat(workspacePath);
|
|
38
|
+
if (!pathStat.isDirectory()) {
|
|
39
|
+
this.error(`${workspacePath} is not a directory.`, { exit: 1 });
|
|
40
|
+
}
|
|
41
|
+
// Check if directory already has a package.json (workspace might already exist)
|
|
42
|
+
const packageJsonPath = path.join(workspacePath, 'package.json');
|
|
43
|
+
if (!this.flags.overwrite && (await fileExists(packageJsonPath))) {
|
|
44
|
+
// Check if it's already a workspace
|
|
45
|
+
let existingPackageJson;
|
|
46
|
+
try {
|
|
47
|
+
existingPackageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'));
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
this.error(`Invalid package.json in ${workspacePath}: ${error}`, { exit: 1 });
|
|
51
|
+
}
|
|
52
|
+
if (existingPackageJson.workspaces) {
|
|
53
|
+
this.error(`This directory already contains an npm workspace.`, { exit: 1 });
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
this.error(`A package.json already exists in ${workspacePath}. Use --overwrite to replace it.`, { exit: 1 });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Check if apps directory already exists
|
|
60
|
+
const appsDir = path.join(workspacePath, 'apps');
|
|
61
|
+
if (!this.flags.overwrite && (await fileExists(appsDir))) {
|
|
62
|
+
this.error(`Apps directory already exists. Use --overwrite to replace it.`, { exit: 1 });
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
// Create root package.json with workspace configuration using template
|
|
66
|
+
const templatePath = path.join(TEMPLATES_DIR, 'workspace', 'package.json.hbs');
|
|
67
|
+
const packageJsonContent = await renderTemplateFromFile(templatePath, {
|
|
68
|
+
workspaceName,
|
|
69
|
+
workspaceDescription: WORKSPACE_DESCRIPTION,
|
|
70
|
+
minNodeVersion: MIN_NODE_VERSION,
|
|
71
|
+
});
|
|
72
|
+
await fs.writeFile(packageJsonPath, packageJsonContent);
|
|
73
|
+
// Create apps directory
|
|
74
|
+
await fs.mkdir(appsDir, { recursive: true });
|
|
75
|
+
// Create .gitignore for workspace using template
|
|
76
|
+
const gitignorePath = path.join(workspacePath, '.gitignore');
|
|
77
|
+
if (!this.flags.overwrite || !(await fileExists(gitignorePath))) {
|
|
78
|
+
const gitignoreTemplatePath = path.join(TEMPLATES_DIR, 'workspace', '.gitignore.hbs');
|
|
79
|
+
const gitignoreContent = await renderTemplateFromFile(gitignoreTemplatePath, {});
|
|
80
|
+
await fs.writeFile(gitignorePath, gitignoreContent);
|
|
81
|
+
}
|
|
82
|
+
this.log(`✅ Successfully initialized npm workspace at ${workspacePath}`);
|
|
83
|
+
this.log(`📁 Created apps/ directory for your Raindrop applications`);
|
|
84
|
+
this.log(`📝 Next steps:`);
|
|
85
|
+
this.log(` 1. cd ${workspacePath}`);
|
|
86
|
+
this.log(` 2. npm install`);
|
|
87
|
+
this.log(` 3. cd apps`);
|
|
88
|
+
this.log(` 4. raindrop build init <app-name>`);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
92
|
+
this.error(`Could not initialize workspace at ${workspacePath}: ${errorMessage}`, { exit: 1 });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/build/list.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gCAAgC,EAEhC,SAAS,EACV,MAAM,yDAAyD,CAAC;AAGjE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/build/list.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gCAAgC,EAEhC,SAAS,EACV,MAAM,yDAAyD,CAAC;AAGjE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKpD,UAAU,WAAW;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,WAAW,EAAE,gCAAgC,CAAC;IAC9C,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CASzC,CAAC;AAEX,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,WAAW,CAAC,OAAO,IAAI,CAAC;IACxD,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAAqC;IAEvD,MAAM,CAAC,QAAQ,WAgBb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;;;MAmCV;IAEF,gBAAgB,CAAC,YAAY,EAAE,gCAAgC,EAAE;;;;IAkCjE,iBAAiB,CAAC,YAAY,EAAE,gCAAgC,EAAE;IA0IlE,aAAa,CAAC,GAAG,EAAE,gCAAgC,GAAG,MAAM;IAM5D,uBAAuB,CAAC,YAAY,EAAE,gCAAgC,EAAE;IAwBxE,iBAAiB,CAAC,YAAY,EAAE,gCAAgC,EAAE;IAmElE,cAAc,CAAC,YAAY,EAAE,gCAAgC,EAAE;IAoDzD,gBAAgB;IA+DhB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAK3B"}
|
|
@@ -5,6 +5,7 @@ import { Flags } from '@oclif/core';
|
|
|
5
5
|
import chalk from 'chalk';
|
|
6
6
|
import { BaseCommand } from '../../base-command.js';
|
|
7
7
|
import { EPOCH_TS } from '../../index.js';
|
|
8
|
+
import { checkAndDisplayKillswitchStatus } from '../../killswitch-utils.js';
|
|
8
9
|
export const statusString = {
|
|
9
10
|
[UnitState.UNSPECIFIED]: '<unknown>',
|
|
10
11
|
[UnitState.PENDING]: 'pending...',
|
|
@@ -415,6 +416,8 @@ Show only running/active versions.
|
|
|
415
416
|
}
|
|
416
417
|
}
|
|
417
418
|
async run() {
|
|
419
|
+
// Check and display killswitch status before listing applications
|
|
420
|
+
await checkAndDisplayKillswitchStatus(this);
|
|
418
421
|
await this.listApplications();
|
|
419
422
|
}
|
|
420
423
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/build/status.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/build/status.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIpD,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,WAAW,CAAC,OAAO,MAAM,CAAC;IAC5D,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAAmD;IAErE,MAAM,CAAC,QAAQ,WAGb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;;;;MA0CV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAyD3B"}
|
|
@@ -3,6 +3,7 @@ import { StatusResponseSchema } from '@liquidmetal-ai/drizzle/liquidmetal/v1alph
|
|
|
3
3
|
import { Flags } from '@oclif/core';
|
|
4
4
|
import Table from 'cli-table3';
|
|
5
5
|
import { BaseCommand } from '../../base-command.js';
|
|
6
|
+
import { checkAndDisplayKillswitchStatus } from '../../killswitch-utils.js';
|
|
6
7
|
import { getStatus, StatusRenderer, statusString, watchStatus } from '../../status.js';
|
|
7
8
|
export default class Status extends BaseCommand {
|
|
8
9
|
static args = {};
|
|
@@ -55,6 +56,8 @@ export default class Status extends BaseCommand {
|
|
|
55
56
|
}),
|
|
56
57
|
};
|
|
57
58
|
async run() {
|
|
59
|
+
// Check and display killswitch status before showing application status
|
|
60
|
+
await checkAndDisplayKillswitchStatus(this);
|
|
58
61
|
const flags = (await this.parse(Status)).flags;
|
|
59
62
|
// Normalize flags (support both old and new names)
|
|
60
63
|
const versionId = flags['version-id'] || flags.version;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BaseCommand } from './base-command.js';
|
|
2
|
+
export interface KillswitchStatus {
|
|
3
|
+
isActive: boolean;
|
|
4
|
+
reason?: string;
|
|
5
|
+
updatedAt?: Date;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Utility function to fetch killswitch status from the catalog service
|
|
9
|
+
* @param command - BaseCommand instance with catalogService access
|
|
10
|
+
* @returns Promise<KillswitchStatus> - Killswitch status information
|
|
11
|
+
*/
|
|
12
|
+
export declare function getKillswitchStatus<T extends typeof BaseCommand>(command: BaseCommand<T>): Promise<{
|
|
13
|
+
status: KillswitchStatus;
|
|
14
|
+
organizationId: string;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Utility function to display killswitch warning if active
|
|
18
|
+
* @param killswitchStatus - Killswitch status to check
|
|
19
|
+
* @param command - BaseCommand instance for logging
|
|
20
|
+
* @param organizationId - Organization ID to display in the message
|
|
21
|
+
*/
|
|
22
|
+
export declare function displayKillswitchWarning<T extends typeof BaseCommand>(killswitchStatus: KillswitchStatus, command: BaseCommand<T>, organizationId: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Combined utility function to fetch and display killswitch status
|
|
25
|
+
* This follows DRY principles by combining the common pattern
|
|
26
|
+
* @param command - BaseCommand instance with catalogService access
|
|
27
|
+
* @returns Promise<KillswitchStatus> - Killswitch status information (for potential further use)
|
|
28
|
+
*/
|
|
29
|
+
export declare function checkAndDisplayKillswitchStatus<T extends typeof BaseCommand>(command: BaseCommand<T>): Promise<KillswitchStatus>;
|
|
30
|
+
//# sourceMappingURL=killswitch-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"killswitch-utils.d.ts","sourceRoot":"","sources":["../src/killswitch-utils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,OAAO,WAAW,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC,CA6B9J;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,OAAO,WAAW,EACnE,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EACvB,cAAc,EAAE,MAAM,GACrB,IAAI,CAgCN;AAED;;;;;GAKG;AACH,wBAAsB,+BAA+B,CAAC,CAAC,SAAS,OAAO,WAAW,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAItI"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// External imports
|
|
2
|
+
import { timestampDate } from '@bufbuild/protobuf/wkt';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
// Internal imports
|
|
5
|
+
import { GetKillswitchStatusResponse_State } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/catalog_pb';
|
|
6
|
+
/**
|
|
7
|
+
* Utility function to fetch killswitch status from the catalog service
|
|
8
|
+
* @param command - BaseCommand instance with catalogService access
|
|
9
|
+
* @returns Promise<KillswitchStatus> - Killswitch status information
|
|
10
|
+
*/
|
|
11
|
+
export async function getKillswitchStatus(command) {
|
|
12
|
+
try {
|
|
13
|
+
const { client: catalogService, userId, organizationId } = await command.catalogService();
|
|
14
|
+
const response = await catalogService.getKillswitchStatus({
|
|
15
|
+
userId,
|
|
16
|
+
organizationId,
|
|
17
|
+
});
|
|
18
|
+
const killswitchResponse = response;
|
|
19
|
+
return {
|
|
20
|
+
status: {
|
|
21
|
+
isActive: killswitchResponse.state === GetKillswitchStatusResponse_State.ACTIVE,
|
|
22
|
+
reason: killswitchResponse.reason || undefined,
|
|
23
|
+
updatedAt: killswitchResponse.at ? timestampDate(killswitchResponse.at) : undefined,
|
|
24
|
+
},
|
|
25
|
+
organizationId,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
catch (_error) {
|
|
29
|
+
// If we can't fetch killswitch status, log a debug message and return inactive
|
|
30
|
+
command.log('[DEBUG] Could not fetch killswitch status: Service unavailable');
|
|
31
|
+
return {
|
|
32
|
+
status: {
|
|
33
|
+
isActive: false,
|
|
34
|
+
},
|
|
35
|
+
organizationId: 'unknown',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Utility function to display killswitch warning if active
|
|
41
|
+
* @param killswitchStatus - Killswitch status to check
|
|
42
|
+
* @param command - BaseCommand instance for logging
|
|
43
|
+
* @param organizationId - Organization ID to display in the message
|
|
44
|
+
*/
|
|
45
|
+
export function displayKillswitchWarning(killswitchStatus, command, organizationId) {
|
|
46
|
+
if (!killswitchStatus.isActive) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const warningLines = [
|
|
50
|
+
'',
|
|
51
|
+
chalk.yellow.bold('⚠️ NOTICE'),
|
|
52
|
+
chalk.yellow(`Organization ${organizationId} is in a partially disabled state.`),
|
|
53
|
+
];
|
|
54
|
+
if (killswitchStatus.reason) {
|
|
55
|
+
warningLines.push(chalk.yellow(`Reason: ${killswitchStatus.reason}`));
|
|
56
|
+
}
|
|
57
|
+
if (killswitchStatus.updatedAt) {
|
|
58
|
+
const formattedDate = killswitchStatus.updatedAt.toLocaleString('en-US', {
|
|
59
|
+
weekday: 'short',
|
|
60
|
+
month: 'short',
|
|
61
|
+
day: 'numeric',
|
|
62
|
+
hour: 'numeric',
|
|
63
|
+
minute: 'numeric',
|
|
64
|
+
second: 'numeric',
|
|
65
|
+
hour12: false,
|
|
66
|
+
timeZoneName: 'short',
|
|
67
|
+
});
|
|
68
|
+
warningLines.push(chalk.dim(`Updated: ${formattedDate}`));
|
|
69
|
+
}
|
|
70
|
+
warningLines.push('');
|
|
71
|
+
command.log(warningLines.join('\n'));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Combined utility function to fetch and display killswitch status
|
|
75
|
+
* This follows DRY principles by combining the common pattern
|
|
76
|
+
* @param command - BaseCommand instance with catalogService access
|
|
77
|
+
* @returns Promise<KillswitchStatus> - Killswitch status information (for potential further use)
|
|
78
|
+
*/
|
|
79
|
+
export async function checkAndDisplayKillswitchStatus(command) {
|
|
80
|
+
const { status: killswitchStatus, organizationId } = await getKillswitchStatus(command);
|
|
81
|
+
displayKillswitchWarning(killswitchStatus, command, organizationId);
|
|
82
|
+
return killswitchStatus;
|
|
83
|
+
}
|