@aigne/doc-smith 0.9.3-beta.2 → 0.9.4-beta

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.9.4-beta](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.9.3...v0.9.4-beta) (2025-11-14)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * resolve access key parsing issues and improve log output ([#309](https://github.com/AIGNE-io/aigne-doc-smith/issues/309)) ([c8d9bf3](https://github.com/AIGNE-io/aigne-doc-smith/commit/c8d9bf3e61d0126c7f117b38308c34cf73c8f141))
9
+
10
+ ## [0.9.3](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.9.3-beta.2...v0.9.3) (2025-11-13)
11
+
3
12
  ## [0.9.3-beta.2](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.9.3-beta.1...v0.9.3-beta.2) (2025-11-13)
4
13
 
5
14
 
@@ -6,8 +6,8 @@ import fs from "fs-extra";
6
6
 
7
7
  import {
8
8
  getAccessToken,
9
+ getCachedAccessToken,
9
10
  getDiscussKitMountPoint,
10
- getOfficialAccessToken,
11
11
  } from "../../utils/auth-utils.mjs";
12
12
  import {
13
13
  CLOUD_SERVICE_URL_PROD,
@@ -76,16 +76,15 @@ export default async function publishDocs(
76
76
  let shouldSyncBranding = void 0;
77
77
  let token = "";
78
78
  let client = null;
79
- let authToken = null;
80
79
  let sessionId = null;
81
80
  let locale = config?.locale;
82
81
 
83
82
  if (!hasInputAppUrl) {
84
- authToken = await getOfficialAccessToken(BASE_URL, false);
83
+ const officialAccessToken = await getCachedAccessToken(BASE_URL);
85
84
 
86
85
  sessionId = "";
87
- if (authToken) {
88
- client = new BrokerClient({ baseUrl: BASE_URL, authToken });
86
+ if (officialAccessToken) {
87
+ client = new BrokerClient({ baseUrl: BASE_URL, authToken: officialAccessToken });
89
88
  const info = await client.checkCacheSession({
90
89
  needShortUrl: true,
91
90
  sessionId: config?.checkoutId,
@@ -201,7 +200,7 @@ export default async function publishDocs(
201
200
  const discussKitMountPoint = await getDiscussKitMountPoint(appUrlInfo.origin);
202
201
  const discussKitUrl = joinURL(appUrlInfo.origin, discussKitMountPoint);
203
202
 
204
- console.log(`\nPublishing your documentation to ${chalk.cyan(discussKitUrl)}\n`);
203
+ console.log(`\nPublishing your documentation to ${chalk.cyan(discussKitUrl)}`);
205
204
 
206
205
  const accessToken = await getAccessToken(appUrlInfo.origin, token, locale);
207
206
 
@@ -218,6 +217,8 @@ export default async function publishDocs(
218
217
  };
219
218
  let finalPath = null;
220
219
 
220
+ console.log(`Publishing docs collection: ${chalk.cyan(projectInfo.name || boardId)}\n`);
221
+
221
222
  // Handle project logo download if it's a URL
222
223
  if (projectInfo.icon && isRemoteFile(projectInfo.icon)) {
223
224
  const { url: uploadedImageUrl, downloadFinalPath } = await downloadAndUploadImage(
@@ -254,11 +255,11 @@ export default async function publishDocs(
254
255
  if (translatedMetadata) {
255
256
  boardMeta.translation = translatedMetadata;
256
257
  }
257
-
258
258
  const {
259
259
  success,
260
260
  boardId: newBoardId,
261
261
  error,
262
+ docsUrl,
262
263
  } = await publishDocsFn({
263
264
  sidebarPath,
264
265
  accessToken,
@@ -286,7 +287,8 @@ export default async function publishDocs(
286
287
  if (boardId !== newBoardId) {
287
288
  await saveValueToConfig("boardId", newBoardId);
288
289
  }
289
- message = `✅ Documentation published successfully!`;
290
+ message = `✅ Documentation published successfully!\n📖 Docs available at: ${chalk.cyan(docsUrl)}`;
291
+
290
292
  await saveValueToConfig("checkoutId", "", "Checkout ID for document deployment service");
291
293
  await saveValueToConfig("shouldSyncBranding", "", "Should sync branding for documentation");
292
294
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/doc-smith",
3
- "version": "0.9.3-beta.2",
3
+ "version": "0.9.4-beta",
4
4
  "description": "AI-driven documentation generation tool built on the AIGNE Framework",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -19,7 +19,6 @@ import {
19
19
  CLOUD_SERVICE_URL_STAGING,
20
20
  DISCUSS_KIT_DID,
21
21
  DISCUSS_KIT_STORE_URL,
22
- DOC_OFFICIAL_ACCESS_TOKEN,
23
22
  PAYMENT_KIT_DID,
24
23
  } from "./constants/index.mjs";
25
24
  import { requestWithAuthToken } from "./request.mjs";
@@ -41,23 +40,23 @@ export function getDocSmithEnvFilePath() {
41
40
  * @param {string} baseUrl - The application URL
42
41
  * @returns {Promise<string>} - The access token
43
42
  */
44
- async function getCachedAccessToken(baseUrl) {
43
+ export async function getCachedAccessToken(baseUrl) {
45
44
  const { hostname: targetHostname } = new URL(baseUrl);
46
45
  const DOC_SMITH_ENV_FILE = getDocSmithEnvFilePath();
47
46
 
48
47
  let accessToken =
49
- process.env.DOC_SMITH_PUBLISH_ACCESS_TOKEN || process.env[DOC_OFFICIAL_ACCESS_TOKEN];
48
+ process.env.DOC_SMITH_PUBLISH_ACCESS_TOKEN || process.env.DOC_DISCUSS_KIT_ACCESS_TOKEN;
50
49
 
51
50
  // Check if access token exists in environment or config file
52
51
  if (!accessToken) {
53
52
  try {
54
53
  if (existsSync(DOC_SMITH_ENV_FILE)) {
55
54
  const data = await readFile(DOC_SMITH_ENV_FILE, "utf8");
56
- if (data.includes(DOC_OFFICIAL_ACCESS_TOKEN)) {
55
+ if (data.includes("DOC_DISCUSS_KIT_ACCESS_TOKEN")) {
57
56
  // Handle empty or invalid YAML files
58
57
  const envs = data.trim() ? parse(data) : null;
59
- if (envs?.[targetHostname]?.[DOC_OFFICIAL_ACCESS_TOKEN]) {
60
- accessToken = envs[targetHostname][DOC_OFFICIAL_ACCESS_TOKEN];
58
+ if (envs?.[targetHostname]?.DOC_DISCUSS_KIT_ACCESS_TOKEN) {
59
+ accessToken = envs[targetHostname].DOC_DISCUSS_KIT_ACCESS_TOKEN;
61
60
  }
62
61
  }
63
62
  }
@@ -144,7 +143,7 @@ export async function getAccessToken(appUrl, ltToken = "", locale = "en") {
144
143
 
145
144
  try {
146
145
  const officialBaseUrl = process.env.DOC_SMITH_BASE_URL || CLOUD_SERVICE_URL_PROD;
147
- const officialAccessToken = await getOfficialAccessToken(officialBaseUrl, false);
146
+ const officialAccessToken = await getCachedAccessToken(officialBaseUrl);
148
147
  if (officialAccessToken) {
149
148
  const mountPoint = await getComponentMountPoint(officialBaseUrl, PAYMENT_KIT_DID);
150
149
  const data = await requestWithAuthToken(
@@ -170,12 +169,10 @@ export async function getAccessToken(appUrl, ltToken = "", locale = "en") {
170
169
 
171
170
  accessToken = result.accessKeySecret;
172
171
  process.env.DOC_SMITH_PUBLISH_ACCESS_TOKEN = accessToken;
173
- process.env[DOC_OFFICIAL_ACCESS_TOKEN] = accessToken;
172
+ process.env.DOC_DISCUSS_KIT_ACCESS_TOKEN = accessToken;
174
173
 
175
174
  // Save the access token to config file
176
- await saveTokenToConfigFile(targetHostname, {
177
- [DOC_OFFICIAL_ACCESS_TOKEN]: accessToken,
178
- });
175
+ await saveTokenToConfigFile(targetHostname, { DOC_DISCUSS_KIT_ACCESS_TOKEN: accessToken });
179
176
  } catch {
180
177
  throw new Error(
181
178
  `${chalk.yellow("⚠️ Failed to obtain access token. This may be due to network issues or authorization timeout.")}\n\n` +
@@ -239,12 +236,9 @@ export async function getOfficialAccessToken(baseUrl, openPage = true, locale =
239
236
  });
240
237
 
241
238
  accessToken = result.accessKeySecret;
242
- process.env[DOC_OFFICIAL_ACCESS_TOKEN] = accessToken;
243
239
 
244
240
  // Save the access token to config file
245
- await saveTokenToConfigFile(targetHostname, {
246
- [DOC_OFFICIAL_ACCESS_TOKEN]: accessToken,
247
- });
241
+ await saveTokenToConfigFile(targetHostname, { DOC_DISCUSS_KIT_ACCESS_TOKEN: accessToken });
248
242
  } catch {
249
243
  throw new Error(
250
244
  `${chalk.yellow("⚠️ Failed to obtain official access token. This may be due to network issues or authorization timeout.")}\n\n` +
@@ -333,8 +333,6 @@ export const MEDIA_KIT_DID = "z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9";
333
333
 
334
334
  export const PAYMENT_KIT_DID = "z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk";
335
335
 
336
- export const DOC_OFFICIAL_ACCESS_TOKEN = "DOC_OFFICIAL_ACCESS_TOKEN";
337
-
338
336
  // Default application URL for the document deployment website.
339
337
  export const CLOUD_SERVICE_URL_PROD = "https://docsmith.aigne.io";
340
338
  export const CLOUD_SERVICE_URL_STAGING = "https://staging.docsmith.aigne.io";