@theholocron/holocron-plugin-fern 5.0.0-alpha.181 → 5.0.0-alpha.183
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/dist/index.d.mts +27 -4
- package/dist/index.mjs +40 -8
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { AuthError, DnsRecordRequest, ResolveTokenInput, Wiki, WikiProvisionOpts, WikiProxyConfig } from "@theholocron/cli";
|
|
2
|
+
//#region src/auth.d.ts
|
|
3
|
+
declare const resolveToken: (input?: ResolveTokenInput) => string;
|
|
4
|
+
//#endregion
|
|
2
5
|
//#region src/capabilities/wiki.d.ts
|
|
3
6
|
declare const FERN_VERSION = "5.114.1";
|
|
4
|
-
interface FernWikiOptions {
|
|
7
|
+
interface FernWikiOptions extends ResolveTokenInput {
|
|
5
8
|
/** Absolute path to the working repo root. Injected by the loader from RuntimeContext. */
|
|
6
9
|
repoRoot?: string;
|
|
7
10
|
/** Active org name (e.g. "theholocron"). Injected by the loader from RuntimeContext. */
|
|
@@ -52,12 +55,32 @@ declare class FernWiki implements Wiki {
|
|
|
52
55
|
constructor(opts: FernWikiOptions);
|
|
53
56
|
provision(callOpts?: WikiProvisionOpts): Promise<string>;
|
|
54
57
|
proxyConfig(): WikiProxyConfig | null;
|
|
58
|
+
/**
|
|
59
|
+
* Confirms `HOLOCRON_FERN_TOKEN`/`FERN_TOKEN` resolves, or a Fern token
|
|
60
|
+
* is stored in the keyring — not a live check. Fern exposes no
|
|
61
|
+
* lightweight endpoint to verify a token actually works (the only
|
|
62
|
+
* token-consuming operation is a full `fern generate`, see
|
|
63
|
+
* holocron#1079); this only confirms one is configured, the same way
|
|
64
|
+
* CI's `fern generate --docs` step would find it.
|
|
65
|
+
*
|
|
66
|
+
* Deliberately ignores `cliToken` (`--token`): CI's step only ever sees
|
|
67
|
+
* the env var from a GitHub Actions secret, never a CLI flag — and a
|
|
68
|
+
* bare `--token <value>` meant for some OTHER provider is forwarded to
|
|
69
|
+
* every loaded plugin as a fallback (see AGENTS.md), so honoring it
|
|
70
|
+
* here would report "configured" even when no Fern-specific credential
|
|
71
|
+
* exists anywhere CI would actually look.
|
|
72
|
+
*
|
|
73
|
+
* Only `AuthError` (the specific "no token found" signal) is treated as
|
|
74
|
+
* `ok: false` — any other error (e.g. a real keyring failure) is a
|
|
75
|
+
* genuine problem and must surface as a failure, not get misreported as
|
|
76
|
+
* a missing token.
|
|
77
|
+
*/
|
|
78
|
+
whoami(): Promise<{
|
|
79
|
+
ok: boolean;
|
|
80
|
+
}>;
|
|
55
81
|
dnsRecord(): DnsRecordRequest | null;
|
|
56
82
|
}
|
|
57
83
|
//#endregion
|
|
58
|
-
//#region src/auth.d.ts
|
|
59
|
-
declare const resolveToken: (input?: ResolveTokenInput) => string;
|
|
60
|
-
//#endregion
|
|
61
84
|
//#region src/index.d.ts
|
|
62
85
|
type FernPluginOptions = FernWikiOptions;
|
|
63
86
|
declare function wiki(opts: FernPluginOptions): Wiki;
|
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,14 @@ import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { stringifyJson } from "@theholocron/json-utils";
|
|
4
4
|
import { AuthError, createResolveToken } from "@theholocron/cli";
|
|
5
|
+
//#region src/auth.ts
|
|
6
|
+
const resolveToken = createResolveToken({
|
|
7
|
+
envName: "HOLOCRON_FERN_TOKEN",
|
|
8
|
+
vendorEnvName: "FERN_TOKEN",
|
|
9
|
+
keyringService: "fern",
|
|
10
|
+
errorMessage: "no Fern token found. Set HOLOCRON_FERN_TOKEN / FERN_TOKEN, or run: holocron auth set fern <token>"
|
|
11
|
+
});
|
|
12
|
+
//#endregion
|
|
5
13
|
//#region src/capabilities/wiki.ts
|
|
6
14
|
const FERN_VERSION = "5.114.1";
|
|
7
15
|
var FernWiki = class {
|
|
@@ -34,6 +42,38 @@ var FernWiki = class {
|
|
|
34
42
|
headers: { "X-Fern-Host": this.opts.domain.split("/")[0] }
|
|
35
43
|
};
|
|
36
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Confirms `HOLOCRON_FERN_TOKEN`/`FERN_TOKEN` resolves, or a Fern token
|
|
47
|
+
* is stored in the keyring — not a live check. Fern exposes no
|
|
48
|
+
* lightweight endpoint to verify a token actually works (the only
|
|
49
|
+
* token-consuming operation is a full `fern generate`, see
|
|
50
|
+
* holocron#1079); this only confirms one is configured, the same way
|
|
51
|
+
* CI's `fern generate --docs` step would find it.
|
|
52
|
+
*
|
|
53
|
+
* Deliberately ignores `cliToken` (`--token`): CI's step only ever sees
|
|
54
|
+
* the env var from a GitHub Actions secret, never a CLI flag — and a
|
|
55
|
+
* bare `--token <value>` meant for some OTHER provider is forwarded to
|
|
56
|
+
* every loaded plugin as a fallback (see AGENTS.md), so honoring it
|
|
57
|
+
* here would report "configured" even when no Fern-specific credential
|
|
58
|
+
* exists anywhere CI would actually look.
|
|
59
|
+
*
|
|
60
|
+
* Only `AuthError` (the specific "no token found" signal) is treated as
|
|
61
|
+
* `ok: false` — any other error (e.g. a real keyring failure) is a
|
|
62
|
+
* genuine problem and must surface as a failure, not get misreported as
|
|
63
|
+
* a missing token.
|
|
64
|
+
*/
|
|
65
|
+
async whoami() {
|
|
66
|
+
try {
|
|
67
|
+
resolveToken({
|
|
68
|
+
...this.opts,
|
|
69
|
+
cliToken: void 0
|
|
70
|
+
});
|
|
71
|
+
return { ok: true };
|
|
72
|
+
} catch (err) {
|
|
73
|
+
if (err instanceof AuthError) return { ok: false };
|
|
74
|
+
throw err;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
37
77
|
dnsRecord() {
|
|
38
78
|
const { org, domain, fernOrg } = this.opts;
|
|
39
79
|
if (!domain) return null;
|
|
@@ -132,14 +172,6 @@ function updateInstancesBlock(content, instanceUrl, customDomain, multiSource, r
|
|
|
132
172
|
return content.replace(blockRe, newBlock);
|
|
133
173
|
}
|
|
134
174
|
//#endregion
|
|
135
|
-
//#region src/auth.ts
|
|
136
|
-
const resolveToken = createResolveToken({
|
|
137
|
-
envName: "HOLOCRON_FERN_TOKEN",
|
|
138
|
-
vendorEnvName: "FERN_TOKEN",
|
|
139
|
-
keyringService: "fern",
|
|
140
|
-
errorMessage: "no Fern token found. Set HOLOCRON_FERN_TOKEN / FERN_TOKEN, or run: holocron auth set fern <token>"
|
|
141
|
-
});
|
|
142
|
-
//#endregion
|
|
143
175
|
//#region src/index.ts
|
|
144
176
|
function wiki(opts) {
|
|
145
177
|
return new FernWiki(opts);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/holocron-plugin-fern",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.183",
|
|
4
4
|
"description": "Holocron plugin for Fern. Implements the wiki capability for engineering knowledge publishing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fern",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"tsx": "4.23.15",
|
|
48
48
|
"typescript": "^5.9.3",
|
|
49
49
|
"vitest": "^4.1.11",
|
|
50
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
50
|
+
"@theholocron/cli": "5.0.0-alpha.183"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
53
|
+
"@theholocron/cli": "5.0.0-alpha.183"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
56
56
|
"node": ">=22"
|