@dench.com/cli 3.6.5-staging.384 → 3.7.0-staging.387

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dench.com/cli",
3
- "version": "3.6.5-staging.384",
3
+ "version": "3.7.0-staging.387",
4
4
  "description": "Dench agent workspace CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -37,6 +37,8 @@
37
37
  "crm-privacy.ts",
38
38
  "meetings.ts",
39
39
  "email.ts",
40
+ "email-inbox.ts",
41
+ "reference.ts",
40
42
  "campaign.ts",
41
43
  "members.ts",
42
44
  "notifications.ts",
package/reference.ts ADDED
@@ -0,0 +1,47 @@
1
+ import {
2
+ bundledReferenceIndex,
3
+ getBundledReference,
4
+ referenceRevision,
5
+ } from "./lib/bundled-references";
6
+ import { assertNoUnknownFlags, CliArgError, hasFlag } from "./lib/cli-args";
7
+
8
+ export const REFERENCE_HELP = `Usage: dench reference <name> [--json]
9
+ dench reference dench Read the bundled SKILL.md
10
+ dench reference crm Read the bundled CRM reference
11
+ dench reference --list [--json] List exact bundled paths and revision
12
+ References match this installed CLI version and are read locally without signing in.`;
13
+
14
+ export async function runReferenceCommand(argv: string[]): Promise<void> {
15
+ const args = [...argv];
16
+ const json = hasFlag(args, "--json");
17
+ const list = hasFlag(args, "--list");
18
+ assertNoUnknownFlags(args, "reference");
19
+ if (list) {
20
+ if (args.length)
21
+ throw new CliArgError("--list does not accept a reference name");
22
+ const index = bundledReferenceIndex();
23
+ console.log(
24
+ json
25
+ ? JSON.stringify(index)
26
+ : `Revision: ${index.revision}\n${index.references.map((entry) => entry.path).join("\n")}`,
27
+ );
28
+ return;
29
+ }
30
+ if (args.length !== 1) throw new CliArgError(REFERENCE_HELP);
31
+ const name = args[0];
32
+ const path = /^(dench|skill(?:\.md)?)$/i.test(name)
33
+ ? "SKILL.md"
34
+ : /^[A-Za-z0-9_-]+(?:\.md)?$/i.test(name)
35
+ ? `references/${name.replace(/\.md$/i, "").toUpperCase()}.md`
36
+ : name;
37
+ const content = getBundledReference(path);
38
+ if (content === undefined)
39
+ throw new CliArgError(
40
+ `Unknown bundled reference: ${name}. Run dench reference --list.`,
41
+ );
42
+ console.log(
43
+ json
44
+ ? JSON.stringify({ path, revision: referenceRevision, content })
45
+ : content,
46
+ );
47
+ }