@clidoc/cli 0.1.0 → 1.0.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 ADDED
@@ -0,0 +1,15 @@
1
+ ## [@clidoc/cli-v1.0.0](https://github.com/bhouston/clidoc/compare/@clidoc/cli-v0.1.0...@clidoc/cli-v1.0.0) (2026-09-22)
2
+
3
+ ### ⚠ BREAKING CHANGES
4
+
5
+ * @clidoc/adapter-yargs is now @clidoc/yargs,
6
+ @clidoc/adapter-commander is now @clidoc/commander, and @clidoc/adapter-oclif
7
+ is now @clidoc/oclif. Update imports and dependencies to the new names.
8
+ * **cli:** the `clidoc generate` command is removed. Use your CLI's own
9
+ `docgen`/`__opencli` command, or the framework adapters' `fromYargs`,
10
+ `fromCommander`, and `fromOclif` functions in code instead.
11
+
12
+ ### Code Refactoring
13
+
14
+ * **cli:** remove generate command ([2a821e7](https://github.com/bhouston/clidoc/commit/2a821e7ac1593e5bc1a87edf7c7373ade56039f3)), closes [#127](https://github.com/bhouston/clidoc/issues/127)
15
+ * rename adapter packages to @clidoc/yargs, @clidoc/commander, @clidoc/oclif ([0e53199](https://github.com/bhouston/clidoc/commit/0e53199031de597485399079076b4050e7f5fa6a)), closes [#129](https://github.com/bhouston/clidoc/issues/129)
package/README.md CHANGED
@@ -20,21 +20,14 @@ clidoc markdown cli.json --output reference.md
20
20
  ```
21
21
 
22
22
  `mycli __opencli` is the hidden, machine-facing discovery subcommand, matching
23
- upstream OpenCLI's Go adapters, including its `-o`/`--out <file>` flag
23
+ upstream OpenCLI's Go libraries, including its `-o`/`--out <file>` flag
24
24
  (`mycli __opencli --out cli.json`); omitted, it writes to stdout like
25
- `clidoc docgen`/`clidoc generate`/`clidoc markdown` do when their own
25
+ `clidoc docgen`/`clidoc markdown` do when their own
26
26
  `--output` is omitted. clidoc dogfoods this exact workflow on itself:
27
- `clidoc docgen` and `clidoc __opencli` both describe the `clidoc` binary. As a
28
- secondary option, trusted command definitions can be imported with
29
- `clidoc generate ./definition.mjs --adapter yargs --output cli.json`. Invalid
27
+ `clidoc docgen` and `clidoc __opencli` both describe the `clidoc` binary. Invalid
30
28
  input or command usage exits with status 1. `--help` describes command
31
29
  arguments, and `--version` prints the installed package version.
32
30
 
33
- The generation module must export `info` (`title`, `binary`, `version`) and a
34
- default value: Yargs command modules, a Commander `Command`, or an oclif manifest.
35
- Only import trusted modules: their top-level code and supported Yargs builder
36
- callbacks execute during generation. Command handlers are never invoked.
37
-
38
31
  Commands are separate files registered through `yargs-file-commands`, matching
39
32
  the `hdrify` approach. `cliDocument()` derives this tool's OpenCLI document from
40
33
  those same definitions. `runCli(argv)` supports embedding without exiting the
@@ -58,7 +51,7 @@ For Bash, activate with `source <(clidoc completion bash)`. For Zsh, run
58
51
  `source <(clidoc completion zsh)` after `autoload -Uz compinit; compinit`.
59
52
  Use `--binary name` to register an alternative executable name. Generated scripts
60
53
  need neither Node nor clidoc at completion time. Regenerate them after CLI changes.
61
- See the [completion guide](https://clidoc.dev/docs/guides/completion) for
54
+ See the [completion guide](https://clidoc.dev/docs/completion) for
62
55
  persistent installation, supported syntax, and limitations.
63
56
 
64
57
  ## MCP tools and stdio server
@@ -71,7 +64,7 @@ clidoc mcp cli.json --serve --executable /absolute/path/to/mycli
71
64
  Exporting does not execute the CLI. Serving requires an explicit trusted
72
65
  executable and validates every tool invocation. The bridge uses conventional
73
66
  long options and `--` before positional arguments; see the
74
- [MCP guide](../website/docs/guides/mcp.md) for the serialization contract,
67
+ [MCP guide](../website/docs/mcp.md) for the serialization contract,
75
68
  client configuration, limits, and supported spec features.
76
69
 
77
70
  Library users can import `compileMcpTools`, `createMcpServer`, and `serveMcp`
@@ -14,12 +14,6 @@ export declare const commands: (import("yargs-file-commands").DefineCommandResul
14
14
  input: string;
15
15
  } & {
16
16
  output: string | undefined;
17
- }> | import("yargs-file-commands").DefineCommandResult<{}, {
18
- module: string;
19
- } & {
20
- adapter: "commander" | "oclif" | "yargs";
21
- } & {
22
- output: string | undefined;
23
17
  }> | import("yargs-file-commands").DefineCommandResult<{}, {
24
18
  shell: "bash" | "fish" | "zsh";
25
19
  } & {
@@ -1 +1 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../src/definition.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,IAAI;IACf,KAAK;IACL,MAAM;IACN,OAAO;IACP,OAAO;CACR,CAAC;AACF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA0D,CAAC;AAChF,0EAA0E;AAC1E,wBAAgB,WAAW,2CAS1B"}
1
+ {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../src/definition.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,IAAI;IACf,KAAK;IACL,MAAM;IACN,OAAO;IACP,OAAO;CACR,CAAC;AACF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAAgD,CAAC;AACtE,0EAA0E;AAC1E,wBAAgB,WAAW,2CAS1B"}
@@ -1,8 +1,7 @@
1
1
  import { createRequire } from 'node:module';
2
- import { fromYargs } from '@clidoc/adapter-yargs';
2
+ import { fromYargs } from '@clidoc/yargs';
3
3
  import { command as completion } from './commands/completion.js';
4
4
  import { command as docgen } from './commands/docgen.js';
5
- import { command as generate } from './commands/generate.js';
6
5
  import { command as mcp } from './commands/mcp.js';
7
6
  import { command as markdown } from './commands/markdown.js';
8
7
  import { command as validate } from './commands/validate.js';
@@ -13,7 +12,7 @@ export const info = {
13
12
  version: packageJson.version,
14
13
  summary: 'Generate, validate, and publish CLI documentation through OpenCLI.',
15
14
  };
16
- export const commands = [generate, markdown, validate, docgen, completion, mcp];
15
+ export const commands = [markdown, validate, docgen, completion, mcp];
17
16
  /** Documentation and runtime share the exact same command definitions. */
18
17
  export function cliDocument() {
19
18
  const document = fromYargs(commands, info);
@@ -1 +1 @@
1
- {"version":3,"file":"definition.js","sourceRoot":"","sources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AAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clidoc/cli",
3
- "version": "0.1.0",
3
+ "version": "1.0.0",
4
4
  "description": "Generate and validate OpenCLI documentation",
5
5
  "keywords": [
6
6
  "cli",
@@ -54,10 +54,8 @@
54
54
  "tsc": "tsc --noEmit"
55
55
  },
56
56
  "dependencies": {
57
- "@clidoc/adapter-commander": "^0.1.0",
58
- "@clidoc/adapter-oclif": "^0.1.0",
59
- "@clidoc/adapter-yargs": "^0.1.0",
60
- "@clidoc/core": "^0.1.0",
57
+ "@clidoc/core": "^1.0.0",
58
+ "@clidoc/yargs": "^0.1.0",
61
59
  "@modelcontextprotocol/sdk": "^1.30.0",
62
60
  "ajv": "^8.20.0",
63
61
  "yargs": "^18.1.0",
package/src/definition.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { createRequire } from 'node:module';
2
- import { fromYargs } from '@clidoc/adapter-yargs';
2
+ import { fromYargs } from '@clidoc/yargs';
3
3
  import { command as completion } from './commands/completion.js';
4
4
  import { command as docgen } from './commands/docgen.js';
5
- import { command as generate } from './commands/generate.js';
6
5
  import { command as mcp } from './commands/mcp.js';
7
6
  import { command as markdown } from './commands/markdown.js';
8
7
  import { command as validate } from './commands/validate.js';
@@ -15,7 +14,7 @@ export const info = {
15
14
  version: packageJson.version,
16
15
  summary: 'Generate, validate, and publish CLI documentation through OpenCLI.',
17
16
  };
18
- export const commands = [generate, markdown, validate, docgen, completion, mcp];
17
+ export const commands = [markdown, validate, docgen, completion, mcp];
19
18
  /** Documentation and runtime share the exact same command definitions. */
20
19
  export function cliDocument() {
21
20
  const document = fromYargs(commands, info);
@@ -1,8 +0,0 @@
1
- export declare const command: import("yargs-file-commands").DefineCommandResult<{}, {
2
- module: string;
3
- } & {
4
- adapter: "commander" | "oclif" | "yargs";
5
- } & {
6
- output: string | undefined;
7
- }>;
8
- //# sourceMappingURL=generate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,OAAO;;;;;;EAgClB,CAAC"}
@@ -1,40 +0,0 @@
1
- import { resolve } from 'node:path';
2
- import { pathToFileURL } from 'node:url';
3
- import { parse } from '@clidoc/core';
4
- import { fromYargs } from '@clidoc/adapter-yargs';
5
- import { fromCommander } from '@clidoc/adapter-commander';
6
- import { fromOclif } from '@clidoc/adapter-oclif';
7
- import { defineCommand } from 'yargs-file-commands';
8
- import { output } from '../io.js';
9
- export const command = defineCommand({
10
- command: 'generate <module>',
11
- describe: 'Import a trusted framework definition module and generate OpenCLI JSON',
12
- builder: (yargs) => yargs
13
- .positional('module', {
14
- type: 'string',
15
- demandOption: true,
16
- describe: 'Trusted JS module exporting default metadata and info',
17
- })
18
- .option('adapter', {
19
- type: 'string',
20
- choices: ['yargs', 'commander', 'oclif'],
21
- demandOption: true,
22
- describe: 'Framework adapter',
23
- })
24
- .option('output', { type: 'string', alias: 'o', describe: 'Output JSON file; defaults to stdout' }),
25
- handler: async (argv) => {
26
- // Importing code is intentional: this command accepts trusted local modules only.
27
- const source = await import(pathToFileURL(resolve(argv.module)).href);
28
- if (!source.default || !source.info)
29
- throw new Error('Module must export default framework metadata and named info');
30
- const document = argv.adapter === 'yargs'
31
- ? fromYargs(source.default, source.info)
32
- : argv.adapter === 'commander'
33
- ? fromCommander(source.default, source.info)
34
- : fromOclif(source.default, source.info);
35
- const json = JSON.stringify(document, null, 2) + '\n';
36
- parse(json);
37
- await output(json, argv.output);
38
- },
39
- });
40
- //# sourceMappingURL=generate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,K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CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC;YACxC,CAAC,CAAC,IAAI,CAAC,OAAO,KAAK,WAAW;gBAC5B,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC;gBAC5C,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAC/C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;QACtD,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,MAAM,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;CACF,CAAC,CAAC"}
@@ -1,42 +0,0 @@
1
- import { resolve } from 'node:path';
2
- import { pathToFileURL } from 'node:url';
3
- import { parse } from '@clidoc/core';
4
- import { fromYargs } from '@clidoc/adapter-yargs';
5
- import { fromCommander } from '@clidoc/adapter-commander';
6
- import { fromOclif } from '@clidoc/adapter-oclif';
7
- import { defineCommand } from 'yargs-file-commands';
8
- import { output } from '../io.js';
9
-
10
- export const command = defineCommand({
11
- command: 'generate <module>',
12
- describe: 'Import a trusted framework definition module and generate OpenCLI JSON',
13
- builder: (yargs) =>
14
- yargs
15
- .positional('module', {
16
- type: 'string',
17
- demandOption: true,
18
- describe: 'Trusted JS module exporting default metadata and info',
19
- })
20
- .option('adapter', {
21
- type: 'string',
22
- choices: ['yargs', 'commander', 'oclif'] as const,
23
- demandOption: true,
24
- describe: 'Framework adapter',
25
- })
26
- .option('output', { type: 'string', alias: 'o', describe: 'Output JSON file; defaults to stdout' }),
27
- handler: async (argv) => {
28
- // Importing code is intentional: this command accepts trusted local modules only.
29
- const source = await import(pathToFileURL(resolve(argv.module)).href);
30
- if (!source.default || !source.info)
31
- throw new Error('Module must export default framework metadata and named info');
32
- const document =
33
- argv.adapter === 'yargs'
34
- ? fromYargs(source.default, source.info)
35
- : argv.adapter === 'commander'
36
- ? fromCommander(source.default, source.info)
37
- : fromOclif(source.default, source.info);
38
- const json = JSON.stringify(document, null, 2) + '\n';
39
- parse(json);
40
- await output(json, argv.output);
41
- },
42
- });