@clidoc/core 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 +11 -0
- package/README.md +2 -2
- package/dist/discovery.d.ts +1 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +2 -2
- package/dist/discovery.js.map +1 -1
- package/dist/docgen.d.ts +2 -2
- package/dist/docgen.js +2 -2
- package/package.json +1 -1
- package/src/discovery.ts +2 -2
- package/src/docgen.ts +2 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## [@clidoc/core-v1.0.0](https://github.com/bhouston/clidoc/compare/@clidoc/core-v0.1.0...@clidoc/core-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
|
+
|
|
9
|
+
### Code Refactoring
|
|
10
|
+
|
|
11
|
+
* 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
|
@@ -23,7 +23,7 @@ const pages = generatePages(document, { basePath: '/cli' });
|
|
|
23
23
|
|
|
24
24
|
## Adding author-supplied metadata
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
The framework packages generate a document from what your CLI's argument parser already knows, so things like
|
|
27
27
|
`examples`, `exitCodes`, `info.license`/`contact`, `install`, and `global` config are usually
|
|
28
28
|
missing. Add them with `mergeDocument`, then re-validate:
|
|
29
29
|
|
|
@@ -57,7 +57,7 @@ validates an OpenCLI document and returns a standalone completion script. It
|
|
|
57
57
|
supports nested commands, aliases, global/local flags, option and positional
|
|
58
58
|
choices, and hidden entries, with no runtime dependency on Node or the target CLI.
|
|
59
59
|
The optional `binary` overrides only the registered executable name. See the
|
|
60
|
-
[completion guide](https://clidoc.dev/docs/
|
|
60
|
+
[completion guide](https://clidoc.dev/docs/completion) for activation,
|
|
61
61
|
supported syntax, and limitations.
|
|
62
62
|
|
|
63
63
|
## License
|
package/dist/discovery.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OpenCliDocument } from './types.js';
|
|
2
|
-
/** Hidden subcommand upstream OpenCLI
|
|
2
|
+
/** Hidden subcommand upstream OpenCLI libraries use for machine discovery. */
|
|
3
3
|
export declare const OPENCLI_DISCOVERY_COMMAND: '__opencli';
|
|
4
4
|
/**
|
|
5
5
|
* If argv requests the OpenCLI document (`__opencli` subcommand, optionally with upstream's
|
package/dist/discovery.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,8EAA8E;AAC9E,eAAO,MAAM,yBAAyB,EAAG,WAAoB,CAAC;AAoB9D;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,QAAQ,EAAE,MAAM,eAAe,EAC/B,KAAK,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAA6C,GACtE,OAAO,CAAC,OAAO,CAAC,CAUlB"}
|
package/dist/discovery.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { writeOpenCliDocument } from './docgen.js';
|
|
2
|
-
/** Hidden subcommand upstream OpenCLI
|
|
2
|
+
/** Hidden subcommand upstream OpenCLI libraries use for machine discovery. */
|
|
3
3
|
export const OPENCLI_DISCOVERY_COMMAND = '__opencli';
|
|
4
4
|
/** Sentinel returned by {@link parseOutArg} for argv this module doesn't recognize. */
|
|
5
5
|
const INVALID = Symbol('invalid');
|
|
6
6
|
/**
|
|
7
7
|
* Parse `-o <file>` / `--out <file>` / `--out=<file>` from the args following `__opencli`,
|
|
8
|
-
* matching upstream OpenCLI's `ocobra`
|
|
8
|
+
* matching upstream OpenCLI's `ocobra` flag. Returns `undefined` for no args (write to
|
|
9
9
|
* stdout), the file path for a recognized flag, or {@link INVALID} for anything else.
|
|
10
10
|
*/
|
|
11
11
|
function parseOutArg(args) {
|
package/dist/discovery.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,
|
|
1
|
+
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,yBAAyB,GAAG,WAAoB,CAAC;AAE9D,uFAAuF;AACvF,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAElC;;;;GAIG;AACH,SAAS,WAAW,CAAC,IAAuB;IAC1C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACxC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,CAAC;QACnD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,OAAO,CAAC;IACrC,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;IACnF,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,IAAuB,EACvB,QAA+B,EAC/B,KAAK,GAA4B,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;IAEvE,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,yBAAyB;QAAE,OAAO,KAAK,CAAC;IACxD,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,IAAI,OAAO,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC;IACtC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC;SAAM,CAAC;QACN,MAAM,oBAAoB,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/docgen.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type PackageJsonLike = {
|
|
|
7
7
|
bin?: string | Record<string, string>;
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
|
-
* Derive an {@link InfoObject} from a parsed `package.json`, so
|
|
10
|
+
* Derive an {@link InfoObject} from a parsed `package.json`, so framework packages don't each need their
|
|
11
11
|
* own `title`/`binary`/`version` bookkeeping. `overrides` wins over anything derived from `pkg`,
|
|
12
12
|
* and is required for whatever `pkg` cannot express (e.g. a package that exposes several binaries).
|
|
13
13
|
*/
|
|
@@ -16,7 +16,7 @@ export declare function infoFromPackageJson(pkg: PackageJsonLike, overrides?: Pa
|
|
|
16
16
|
export type DocumentFormat = 'json' | 'yaml' | 'markdown';
|
|
17
17
|
/**
|
|
18
18
|
* Render `document` (JSON, YAML, or Markdown) and write it to `output`, or to stdout if `output`
|
|
19
|
-
* is omitted. Shared by every
|
|
19
|
+
* is omitted. Shared by every framework package's docgen command and by `handleOpenCliRequest`.
|
|
20
20
|
*/
|
|
21
21
|
export declare function writeOpenCliDocument(document: OpenCliDocument, output?: string, format?: DocumentFormat): Promise<void>;
|
|
22
22
|
//# sourceMappingURL=docgen.d.ts.map
|
package/dist/docgen.js
CHANGED
|
@@ -6,7 +6,7 @@ function unscopedName(name) {
|
|
|
6
6
|
return name.replace(/^@[^/]+\//, '');
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Derive an {@link InfoObject} from a parsed `package.json`, so
|
|
9
|
+
* Derive an {@link InfoObject} from a parsed `package.json`, so framework packages don't each need their
|
|
10
10
|
* own `title`/`binary`/`version` bookkeeping. `overrides` wins over anything derived from `pkg`,
|
|
11
11
|
* and is required for whatever `pkg` cannot express (e.g. a package that exposes several binaries).
|
|
12
12
|
*/
|
|
@@ -27,7 +27,7 @@ export function infoFromPackageJson(pkg, overrides = {}) {
|
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Render `document` (JSON, YAML, or Markdown) and write it to `output`, or to stdout if `output`
|
|
30
|
-
* is omitted. Shared by every
|
|
30
|
+
* is omitted. Shared by every framework package's docgen command and by `handleOpenCliRequest`.
|
|
31
31
|
*/
|
|
32
32
|
export async function writeOpenCliDocument(document, output, format = 'json') {
|
|
33
33
|
const content = format === 'markdown'
|
package/package.json
CHANGED
package/src/discovery.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { writeOpenCliDocument } from './docgen.js';
|
|
2
2
|
import type { OpenCliDocument } from './types.js';
|
|
3
3
|
|
|
4
|
-
/** Hidden subcommand upstream OpenCLI
|
|
4
|
+
/** Hidden subcommand upstream OpenCLI libraries use for machine discovery. */
|
|
5
5
|
export const OPENCLI_DISCOVERY_COMMAND = '__opencli' as const;
|
|
6
6
|
|
|
7
7
|
/** Sentinel returned by {@link parseOutArg} for argv this module doesn't recognize. */
|
|
@@ -9,7 +9,7 @@ const INVALID = Symbol('invalid');
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Parse `-o <file>` / `--out <file>` / `--out=<file>` from the args following `__opencli`,
|
|
12
|
-
* matching upstream OpenCLI's `ocobra`
|
|
12
|
+
* matching upstream OpenCLI's `ocobra` flag. Returns `undefined` for no args (write to
|
|
13
13
|
* stdout), the file path for a recognized flag, or {@link INVALID} for anything else.
|
|
14
14
|
*/
|
|
15
15
|
function parseOutArg(args: readonly string[]): string | undefined | typeof INVALID {
|
package/src/docgen.ts
CHANGED
|
@@ -17,7 +17,7 @@ function unscopedName(name: string): string {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Derive an {@link InfoObject} from a parsed `package.json`, so
|
|
20
|
+
* Derive an {@link InfoObject} from a parsed `package.json`, so framework packages don't each need their
|
|
21
21
|
* own `title`/`binary`/`version` bookkeeping. `overrides` wins over anything derived from `pkg`,
|
|
22
22
|
* and is required for whatever `pkg` cannot express (e.g. a package that exposes several binaries).
|
|
23
23
|
*/
|
|
@@ -40,7 +40,7 @@ export type DocumentFormat = 'json' | 'yaml' | 'markdown';
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Render `document` (JSON, YAML, or Markdown) and write it to `output`, or to stdout if `output`
|
|
43
|
-
* is omitted. Shared by every
|
|
43
|
+
* is omitted. Shared by every framework package's docgen command and by `handleOpenCliRequest`.
|
|
44
44
|
*/
|
|
45
45
|
export async function writeOpenCliDocument(
|
|
46
46
|
document: OpenCliDocument,
|