@helyx/cli 1.7.0 → 1.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add helyx help connect, status and disconnect for opt-in online Help, encrypted local credentials and credential revocation. Package the compatible bot and updated self-host catalogue while retaining offline Help without enrolment.
8
+
3
9
  ## 1.7.0
4
10
 
5
11
  ### Minor Changes
package/dist/cli.js CHANGED
@@ -7,6 +7,7 @@ import { resolveDatabaseAdapter } from "@helyx/database/adapters";
7
7
  import { formatCommandError } from "./errors.js";
8
8
  import { runSelfHostCommand } from "./self-host/command.js";
9
9
  import { loadLocalEnvironment, setupSelfHostEnvironment } from "./setup.js";
10
+ import { runHelpCommand } from "./help-command.js";
10
11
  const command = process.argv[2];
11
12
  try {
12
13
  if (command === "start") {
@@ -31,6 +32,9 @@ try {
31
32
  else if (command === "self-host") {
32
33
  await runSelfHostCommand(process.argv.slice(3));
33
34
  }
35
+ else if (command === "help" && process.argv[3]) {
36
+ await runHelpCommand(process.argv.slice(3));
37
+ }
34
38
  else if (command === "help" || command === "--help" || command === "-h") {
35
39
  printHelp();
36
40
  }
@@ -149,6 +153,8 @@ Commands:
149
153
  start Start the Helyx Discord bot
150
154
  migrate Apply core migrations for the selected database engine and exit
151
155
  doctor Validate environment, database schema and module packages
156
+ help connect|status|disconnect [--project <path>] [--confirm]
157
+ Manage optional Help-only online access; local Help needs no account
152
158
  self-host init --manifest <path> [--output <path>] [--install]
153
159
  Generate a self-hosted starter project from a reviewed manifest
154
160
  self-host update --check [--project <path>]
@@ -0,0 +1,8 @@
1
+ export declare function runHelpCommand(args: readonly string[], options?: {
2
+ cwd?: string;
3
+ environment?: NodeJS.ProcessEnv;
4
+ question?: (prompt: string) => Promise<string>;
5
+ write?: (message: string) => void;
6
+ fetch?: typeof fetch;
7
+ }): Promise<void>;
8
+ //# sourceMappingURL=help-command.d.ts.map
@@ -0,0 +1,71 @@
1
+ import { resolve } from "node:path";
2
+ import { createInterface } from "node:readline/promises";
3
+ import { HelpCredentialStore, exchangeHelpEnrolment, revokeHelpCredential, } from "@helyx/bot";
4
+ import { loadLocalEnvironment } from "./setup.js";
5
+ export async function runHelpCommand(args, options = {}) {
6
+ const [action, ...rest] = args;
7
+ let directory = resolve(options.cwd ?? process.cwd()), confirm = false;
8
+ if (!["connect", "status", "disconnect"].includes(action ?? ""))
9
+ throw new Error("Use: helyx help connect|status|disconnect [--project <path>] [--confirm]");
10
+ for (let index = 0; index < rest.length; index++) {
11
+ if (rest[index] === "--project" && rest[index + 1])
12
+ directory = resolve(directory, rest[++index]);
13
+ else if (rest[index] === "--confirm")
14
+ confirm = true;
15
+ else
16
+ throw new Error("Unsupported Help option. Paste enrolment codes at the prompt, not in command arguments.");
17
+ }
18
+ const environment = { ...(options.environment ?? process.env) };
19
+ await loadLocalEnvironment(directory, environment);
20
+ if (!environment.HELYX_DATA_ENCRYPTION_KEY)
21
+ throw new Error("Set up the local HELYX_DATA_ENCRYPTION_KEY before managing online Help. Local Help remains available.");
22
+ if (action === "connect" &&
23
+ environment.HELYX_RUNTIME_PROFILE !== "self-hosted")
24
+ throw new Error("Online Help enrolment is for a self-hosted installation. Set HELYX_RUNTIME_PROFILE=self-hosted in that project's environment.");
25
+ const store = new HelpCredentialStore(directory, environment.HELYX_DATA_ENCRYPTION_KEY), write = options.write ?? console.log;
26
+ if (action === "status") {
27
+ const credential = await store.read();
28
+ write(!credential
29
+ ? "Help: local bundled FAQs. No online credential saved."
30
+ : `Help: ${Date.parse(credential.expiresAt) > Date.now() ? "online credential saved" : "credential expired; local FAQs remain available"}. Installation ${credential.installationId}. Expires ${credential.expiresAt}.`);
31
+ return;
32
+ }
33
+ if (action === "disconnect") {
34
+ const credential = await store.read();
35
+ let remote = true;
36
+ if (credential && Date.parse(credential.expiresAt) > Date.now())
37
+ try {
38
+ await revokeHelpCredential(credential.token, options.fetch);
39
+ }
40
+ catch {
41
+ remote = false;
42
+ }
43
+ await store.remove();
44
+ write(remote
45
+ ? "Online Help disconnected. Local bundled FAQs remain available."
46
+ : "Online Help disconnected locally. Revoke its credential from your dashboard when the service is available.");
47
+ return;
48
+ }
49
+ const reader = options.question
50
+ ? null
51
+ : createInterface({ input: process.stdin, output: process.stdout }), question = options.question ?? ((prompt) => reader.question(prompt));
52
+ try {
53
+ write("Optional online Help sends your public Helyx question to Helyx and its embedding provider. It does not connect guild settings or require Cloud Connect.");
54
+ if (!confirm &&
55
+ (await question("Type CONNECT to save an encrypted Help-only credential: ")).trim() !== "CONNECT") {
56
+ write("Cancelled. Local Help remains available.");
57
+ return;
58
+ }
59
+ const code = (await question("Paste the one-time Help code from your self-host dashboard: ")).trim();
60
+ const credential = await exchangeHelpEnrolment(code, options.fetch);
61
+ await store.save(credential);
62
+ write(`Online Help connected for installation ${credential.installationId}. Credential expires ${credential.expiresAt}.`);
63
+ }
64
+ catch {
65
+ throw new Error("Online Help could not be connected. Check the one-time code, service availability, local encryption key and write permissions. No credential value was printed.");
66
+ }
67
+ finally {
68
+ reader?.close();
69
+ }
70
+ }
71
+ //# sourceMappingURL=help-command.js.map
package/dist/index.d.ts CHANGED
@@ -6,4 +6,5 @@ export * from "./self-host/manifest.js";
6
6
  export * from "./self-host/project-generator.js";
7
7
  export * from "./self-host/update.js";
8
8
  export * from "./setup.js";
9
+ export * from "./help-command.js";
9
10
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -6,4 +6,5 @@ export * from "./self-host/manifest.js";
6
6
  export * from "./self-host/project-generator.js";
7
7
  export * from "./self-host/update.js";
8
8
  export * from "./setup.js";
9
+ export * from "./help-command.js";
9
10
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helyx/cli",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Command-line tools for running and generating self-hosted Helyx deployments.",
5
5
  "keywords": [
6
6
  "helyx",
@@ -52,9 +52,9 @@
52
52
  "build": "tsc -b"
53
53
  },
54
54
  "dependencies": {
55
- "@helyx/bot": ">=1.6.0 <2.0.0",
56
- "@helyx/config": ">=1.6.0 <2.0.0",
57
- "@helyx/database": ">=2.5.0 <3.0.0",
55
+ "@helyx/bot": ">=1.7.0 <2.0.0",
56
+ "@helyx/config": ">=1.7.0 <2.0.0",
57
+ "@helyx/database": ">=2.5.1 <3.0.0",
58
58
  "semver": "7.8.5",
59
59
  "zod": "4.6.7"
60
60
  },
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
- "catalogueVersion": 88,
3
+ "catalogueVersion": 89,
4
4
  "core": {
5
5
  "package": "@helyx/bot",
6
- "version": "1.6.0",
6
+ "version": "1.7.0",
7
7
  "availability": "published"
8
8
  },
9
9
  "generator": {
10
10
  "package": "@helyx/cli",
11
- "version": "1.7.0",
11
+ "version": "1.8.0",
12
12
  "command": "helyx",
13
13
  "availability": "published"
14
14
  },
15
15
  "databaseAdapters": [
16
16
  {
17
17
  "package": "@helyx/database",
18
- "version": "2.5.0"
18
+ "version": "2.5.1"
19
19
  },
20
20
  {
21
21
  "package": "@helyx/database-mysql",
@@ -273,7 +273,7 @@
273
273
  {
274
274
  "id": "helyx.account-gate",
275
275
  "package": "@helyx/module-account-gate",
276
- "version": "2.1.2",
276
+ "version": "2.1.3",
277
277
  "name": "Access Control",
278
278
  "description": "Require new members to complete configurable Discord interaction checks before gaining access.",
279
279
  "category": "Safety",
@@ -558,7 +558,7 @@
558
558
  {
559
559
  "id": "helyx.reactionroles",
560
560
  "package": "@helyx/module-reactionroles",
561
- "version": "1.1.2",
561
+ "version": "1.1.3",
562
562
  "name": "Reaction Roles",
563
563
  "description": "Let members select approved roles themselves.",
564
564
  "category": "Automation",
@@ -938,7 +938,7 @@
938
938
  {
939
939
  "id": "helyx.achievements",
940
940
  "package": "@helyx/module-achievements",
941
- "version": "2.1.3",
941
+ "version": "2.1.4",
942
942
  "name": "Achievements",
943
943
  "description": "Configurable member milestones, scores and optional rewards.",
944
944
  "category": "Gaming",
@@ -9,6 +9,7 @@ COPY helyx.modules.json ./
9
9
 
10
10
  ENV HELYX_MODULE_CATALOGUE_PATH=/app/helyx.modules.json
11
11
  ENV NODE_ENV=production
12
+ RUN mkdir -p /app/.helyx && chown node:node /app/.helyx
12
13
 
13
14
  USER node
14
15
 
@@ -4,3 +4,8 @@ services:
4
4
  restart: unless-stopped
5
5
  env_file:
6
6
  - .env
7
+ volumes:
8
+ - helyx-private:/app/.helyx
9
+
10
+ volumes:
11
+ helyx-private:
@@ -4,6 +4,8 @@ services:
4
4
  restart: unless-stopped
5
5
  env_file:
6
6
  - .env
7
+ volumes:
8
+ - helyx-private:/app/.helyx
7
9
  depends_on:
8
10
  database:
9
11
  condition: service_healthy
@@ -25,3 +27,4 @@ services:
25
27
 
26
28
  volumes:
27
29
  helyx-database:
30
+ helyx-private: