@fedify/cli 2.0.0-dev.1799 → 2.0.0-dev.1801

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/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/cli",
3
- "version": "2.0.0-dev.1799+383e3c21",
3
+ "version": "2.0.0-dev.1801+bca8ab87",
4
4
  "license": "MIT",
5
5
  "exports": "./src/mod.ts",
6
6
  "imports": {
package/dist/deno.js CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  //#region deno.json
5
5
  var name = "@fedify/cli";
6
- var version = "2.0.0-dev.1799+383e3c21";
6
+ var version = "2.0.0-dev.1801+bca8ab87";
7
7
  var license = "MIT";
8
8
  var exports = "./src/mod.ts";
9
9
  var imports = {
@@ -0,0 +1,20 @@
1
+
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+
4
+ import { stat } from "node:fs/promises";
5
+ import { printError } from "@optique/run";
6
+ import { generateVocab } from "@fedify/vocab-tools";
7
+ import { message } from "@optique/core/message";
8
+ import process from "node:process";
9
+
10
+ //#region src/generate-vocab/action.ts
11
+ async function runGenerateVocab({ schemaDir, generatedPath }) {
12
+ if (!(await stat(schemaDir)).isDirectory()) {
13
+ printError(message`${schemaDir} is not a directory.`);
14
+ process.exit(1);
15
+ }
16
+ await generateVocab(schemaDir, generatedPath);
17
+ }
18
+
19
+ //#endregion
20
+ export { runGenerateVocab };
@@ -0,0 +1,26 @@
1
+
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+
4
+ import { argument, command, constant, message, object, option, withDefault } from "@optique/core";
5
+ import { path } from "@optique/run";
6
+
7
+ //#region src/generate-vocab/command.ts
8
+ const schemaDir = withDefault(option("-i", "--input", path({
9
+ metavar: "DIR",
10
+ type: "directory",
11
+ mustExist: true
12
+ }), { description: message`Directory containing schema files.` }), ".");
13
+ const generatedPath = argument(path({
14
+ metavar: "PATH",
15
+ type: "file",
16
+ allowCreate: true
17
+ }), { description: message`Path to output the generated vocabulary classes. Should end with ${".ts"} suffix.` });
18
+ const generateVocabCommand = command("generate-vocab", object("Generation options", {
19
+ command: constant("generate-vocab"),
20
+ schemaDir,
21
+ generatedPath
22
+ }), { description: message`Generate vocabulary classes from schema files.` });
23
+ var command_default = generateVocabCommand;
24
+
25
+ //#endregion
26
+ export { command_default as default };
@@ -0,0 +1,5 @@
1
+
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+
4
+ import { runGenerateVocab } from "./action.js";
5
+ import command_default from "./command.js";
package/dist/globals.js CHANGED
@@ -3,8 +3,8 @@
3
3
 
4
4
  import { recordingSink } from "./log.js";
5
5
  import { message, object, option } from "@optique/core";
6
- import { configure, getConsoleSink } from "@logtape/logtape";
7
6
  import process from "node:process";
7
+ import { configure, getConsoleSink } from "@logtape/logtape";
8
8
  import { getFileSink } from "@logtape/file";
9
9
  import { AsyncLocalStorage } from "node:async_hooks";
10
10
 
package/dist/inbox.js CHANGED
@@ -10,11 +10,11 @@ import { tableStyle } from "./table.js";
10
10
  import { spawnTemporaryServer } from "./tempserver.js";
11
11
  import { colors } from "./utils.js";
12
12
  import { command, constant, merge, message, multiple, object, option, optional, string, withDefault } from "@optique/core";
13
+ import process from "node:process";
13
14
  import { Accept, Activity, Application, Delete, Endpoints, Follow, Image, MemoryKvStore, PUBLIC_COLLECTION, createFederation, generateCryptoKeyPair, getActorHandle, isActor, lookupObject } from "@fedify/fedify";
14
15
  import { getLogger } from "@logtape/logtape";
15
16
  import Table from "cli-table3";
16
17
  import { Hono } from "hono";
17
- import process from "node:process";
18
18
  import ora from "ora";
19
19
  import { jsx } from "hono/jsx/jsx-runtime";
20
20
 
@@ -4,9 +4,9 @@
4
4
  import { getCwd, getOsType, runSubCommand } from "../../utils.js";
5
5
  import { isDirectoryEmpty, logger } from "../lib.js";
6
6
  import { printError } from "@optique/run";
7
+ import { message } from "@optique/core/message";
7
8
  import { identity, pipe, when } from "@fxts/core";
8
9
  import { input } from "@inquirer/prompts";
9
- import { message } from "@optique/core/message";
10
10
  import toggle from "inquirer-toggle";
11
11
 
12
12
  //#region src/init/ask/dir.ts
@@ -5,8 +5,8 @@ import { PACKAGE_MANAGER } from "../const.js";
5
5
  import webframeworks_default from "../webframeworks.js";
6
6
  import { getInstallUrl, getLabel, isPackageManagerAvailable } from "../lib.js";
7
7
  import { print } from "@optique/run";
8
- import { select } from "@inquirer/prompts";
9
8
  import { message } from "@optique/core/message";
9
+ import { select } from "@inquirer/prompts";
10
10
 
11
11
  //#region src/init/ask/pm.ts
12
12
  /**
package/dist/init/lib.js CHANGED
@@ -10,8 +10,8 @@ import rt_default from "./json/rt.js";
10
10
  import webframeworks_default from "./webframeworks.js";
11
11
  import { dirname, join } from "node:path";
12
12
  import { mkdir, readdir, writeFile } from "node:fs/promises";
13
- import { getLogger } from "@logtape/logtape";
14
13
  import process from "node:process";
14
+ import { getLogger } from "@logtape/logtape";
15
15
  import { entries, evolve, fromEntries, isObject, map, negate, pipe, throwIf, when } from "@fxts/core";
16
16
  import { toMerged } from "es-toolkit";
17
17
  import { readFileSync } from "node:fs";
package/dist/log.js CHANGED
@@ -3,8 +3,8 @@
3
3
 
4
4
  import { dirname } from "node:path";
5
5
  import { mkdir } from "node:fs/promises";
6
- import { configure, getConsoleSink } from "@logtape/logtape";
7
6
  import process from "node:process";
7
+ import { configure, getConsoleSink } from "@logtape/logtape";
8
8
  import { getFileSink } from "@logtape/file";
9
9
  import { AsyncLocalStorage } from "node:async_hooks";
10
10
 
package/dist/lookup.js CHANGED
@@ -8,9 +8,9 @@ import { colorEnabled, colors, formatObject } from "./utils.js";
8
8
  import { renderImages } from "./imagerenderer.js";
9
9
  import { argument, choice, command, constant, flag, float, map, merge, message, multiple, object, option, optionNames, optional, or, string, withDefault } from "@optique/core";
10
10
  import { path, print, printError } from "@optique/run";
11
+ import process from "node:process";
11
12
  import { Application, Collection, CryptographicKey, Object as Object$1, generateCryptoKeyPair, getAuthenticatedDocumentLoader, lookupObject, respondWithObject, traverseCollection } from "@fedify/fedify";
12
13
  import { getLogger } from "@logtape/logtape";
13
- import process from "node:process";
14
14
  import ora from "ora";
15
15
  import { createWriteStream } from "node:fs";
16
16
 
package/dist/mod.js CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  import { Temporal } from "@js-temporal/polyfill";
4
4
 
5
+ import { runGenerateVocab } from "./generate-vocab/action.js";
6
+ import command_default from "./generate-vocab/command.js";
7
+ import "./generate-vocab/mod.js";
5
8
  import { inboxCommand, runInbox } from "./inbox.js";
6
9
  import action_default from "./init/action/mod.js";
7
10
  import { initCommand } from "./init/command.js";
@@ -16,7 +19,7 @@ import { or } from "@optique/core";
16
19
  import { run } from "@optique/run";
17
20
 
18
21
  //#region src/mod.ts
19
- const command$1 = or(initCommand, webFingerCommand, lookupCommand, inboxCommand, nodeInfoCommand, tunnelCommand);
22
+ const command$1 = or(initCommand, webFingerCommand, lookupCommand, inboxCommand, nodeInfoCommand, tunnelCommand, command_default);
20
23
  async function main() {
21
24
  const result = run(command$1, {
22
25
  programName: "fedify",
@@ -28,6 +31,7 @@ async function main() {
28
31
  if (result.command === "inbox") runInbox(result);
29
32
  if (result.command === "nodeinfo") runNodeInfo(result);
30
33
  if (result.command === "tunnel") await runTunnel(result);
34
+ if (result.command === "generate-vocab") await runGenerateVocab(result);
31
35
  }
32
36
  await main();
33
37
 
package/dist/nodeinfo.js CHANGED
@@ -5,9 +5,9 @@ import { debugOption } from "./globals.js";
5
5
  import { colors, formatObject } from "./utils.js";
6
6
  import { argument, command, constant, flag, merge, message, object, option, optional, or, string } from "@optique/core";
7
7
  import { print, printError } from "@optique/run";
8
+ import process from "node:process";
8
9
  import { getNodeInfo } from "@fedify/fedify";
9
10
  import { getLogger } from "@logtape/logtape";
10
- import process from "node:process";
11
11
  import ora from "ora";
12
12
  import { getUserAgent } from "@fedify/vocab-runtime";
13
13
  import os from "node:os";
@@ -5,8 +5,8 @@ import { formatObject } from "../utils.js";
5
5
  import { NotFoundError, getErrorMessage } from "./error.js";
6
6
  import { convertUrlIfHandle } from "./lib.js";
7
7
  import { print } from "@optique/run";
8
- import ora from "ora";
9
8
  import { formatMessage, message } from "@optique/core/message";
9
+ import ora from "ora";
10
10
  import { lookupWebFinger } from "@fedify/fedify/webfinger";
11
11
 
12
12
  //#region src/webfinger/action.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/cli",
3
- "version": "2.0.0-dev.1799+383e3c21",
3
+ "version": "2.0.0-dev.1801+bca8ab87",
4
4
  "description": "CLI toolchain for Fedify and debugging ActivityPub",
5
5
  "keywords": [
6
6
  "fedify",
@@ -61,7 +61,7 @@
61
61
  "cli-table3": "^0.6.5",
62
62
  "enquirer": "^2.4.1",
63
63
  "env-paths": "^3.0.0",
64
- "es-toolkit": "1.39.5",
64
+ "es-toolkit": "1.39.10",
65
65
  "fetch-mock": "^12.5.4",
66
66
  "hono": "^4.8.3",
67
67
  "icojs": "^0.19.5",
@@ -71,13 +71,14 @@
71
71
  "ora": "^8.2.0",
72
72
  "shiki": "^1.6.4",
73
73
  "srvx": "^0.8.7",
74
- "@fedify/fedify": "2.0.0-dev.1799+383e3c21",
75
- "@fedify/sqlite": "2.0.0-dev.1799+383e3c21",
76
- "@fedify/vocab-runtime": "2.0.0-dev.1799+383e3c21"
74
+ "@fedify/sqlite": "2.0.0-dev.1801+bca8ab87",
75
+ "@fedify/vocab-tools": "2.0.0-dev.1801+bca8ab87",
76
+ "@fedify/vocab-runtime": "2.0.0-dev.1801+bca8ab87",
77
+ "@fedify/fedify": "2.0.0-dev.1801+bca8ab87"
77
78
  },
78
79
  "devDependencies": {
79
80
  "@types/bun": "^1.2.23",
80
- "@types/node": "^22.16.0",
81
+ "@types/node": "^22.17.0",
81
82
  "tsdown": "^0.12.9",
82
83
  "typescript": "^5.9.2"
83
84
  },
@@ -0,0 +1,17 @@
1
+ import { generateVocab } from "@fedify/vocab-tools";
2
+ import { message } from "@optique/core/message";
3
+ import { printError } from "@optique/run";
4
+ import { stat } from "node:fs/promises";
5
+ import process from "node:process";
6
+ import type { GenerateVocabCommand } from "./command.ts";
7
+
8
+ export default async function runGenerateVocab(
9
+ { schemaDir, generatedPath }: GenerateVocabCommand,
10
+ ) {
11
+ if (!(await stat(schemaDir)).isDirectory()) {
12
+ printError(message`${schemaDir} is not a directory.`);
13
+ process.exit(1);
14
+ }
15
+
16
+ await generateVocab(schemaDir, generatedPath);
17
+ }
@@ -0,0 +1,44 @@
1
+ import {
2
+ argument,
3
+ command,
4
+ constant,
5
+ type InferValue,
6
+ message,
7
+ object,
8
+ option,
9
+ withDefault,
10
+ } from "@optique/core";
11
+ import { path } from "@optique/run";
12
+
13
+ const schemaDir = withDefault(
14
+ option(
15
+ "-i",
16
+ "--input",
17
+ path({ metavar: "DIR", type: "directory", mustExist: true }),
18
+ { description: message`Directory containing schema files.` },
19
+ ),
20
+ ".",
21
+ );
22
+ const generatedPath = argument(
23
+ path({ metavar: "PATH", type: "file", allowCreate: true }),
24
+ {
25
+ description:
26
+ message`Path to output the generated vocabulary classes. Should end with ${".ts"} suffix.`,
27
+ },
28
+ );
29
+
30
+ const generateVocabCommand = command(
31
+ "generate-vocab",
32
+ object("Generation options", {
33
+ command: constant("generate-vocab"),
34
+ schemaDir,
35
+ generatedPath,
36
+ }),
37
+ {
38
+ description: message`Generate vocabulary classes from schema files.`,
39
+ },
40
+ );
41
+
42
+ export default generateVocabCommand;
43
+
44
+ export type GenerateVocabCommand = InferValue<typeof generateVocabCommand>;
@@ -0,0 +1,2 @@
1
+ export { default as runGenerateVocab } from "./action.ts";
2
+ export { default as generateVocabCommand } from "./command.ts";
package/src/mod.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { or } from "@optique/core";
3
3
  import { run } from "@optique/run";
4
+ import {
5
+ generateVocabCommand,
6
+ runGenerateVocab,
7
+ } from "./generate-vocab/mod.ts";
4
8
  import { inboxCommand, runInbox } from "./inbox.tsx";
5
9
  import { initCommand, runInit } from "./init/mod.ts";
6
10
  import { lookupCommand, runLookup } from "./lookup.ts";
@@ -15,6 +19,7 @@ const command = or(
15
19
  inboxCommand,
16
20
  nodeInfoCommand,
17
21
  tunnelCommand,
22
+ generateVocabCommand,
18
23
  );
19
24
 
20
25
  async function main() {
@@ -40,6 +45,9 @@ async function main() {
40
45
  if (result.command === "tunnel") {
41
46
  await runTunnel(result);
42
47
  }
48
+ if (result.command === "generate-vocab") {
49
+ await runGenerateVocab(result);
50
+ }
43
51
  }
44
52
 
45
53
  await main();