@aigne/doc-smith 0.8.15-beta.12 → 0.8.15-beta.13

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.8.15-beta.13](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.12...v0.8.15-beta.13) (2025-11-05)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * make paid deployment more smooth stable ([#266](https://github.com/AIGNE-io/aigne-doc-smith/issues/266)) ([ce8c00a](https://github.com/AIGNE-io/aigne-doc-smith/commit/ce8c00ab3eb045c482e07dc3c4e3bd149e754a06))
9
+ * validate docsDir on init and ensure latest doc on view after publish ([#267](https://github.com/AIGNE-io/aigne-doc-smith/issues/267)) ([e45864d](https://github.com/AIGNE-io/aigne-doc-smith/commit/e45864da4a7fb5b09af2bbffdb7ca93abd74397c))
10
+
3
11
  ## [0.8.15-beta.12](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.11...v0.8.15-beta.12) (2025-11-05)
4
12
 
5
13
 
@@ -21,6 +21,7 @@ import {
21
21
  validatePath,
22
22
  } from "../../utils/utils.mjs";
23
23
  import { isRemoteFile } from "../../utils/file-utils.mjs";
24
+ import { validateDocDir } from "./validate.mjs";
24
25
 
25
26
  const _PRESS_ENTER_TO_FINISH = "Press Enter to finish";
26
27
 
@@ -64,7 +65,19 @@ export default async function init(
64
65
  // Only skip if file exists AND has non-empty content
65
66
  if (configContent && configContent.trim() !== "") {
66
67
  // load config from file
67
- return loadConfig({ config: filePath, appUrl });
68
+ const config = await loadConfig({ config: filePath, appUrl });
69
+ const isValid = validateDocDir(config.docsDir);
70
+ if (typeof isValid === "string") {
71
+ console.log(
72
+ `${chalk.red("Invalid docsDir")}: ${isValid}\nPlease check your configuration.`,
73
+ );
74
+ process.exit(1);
75
+ }
76
+ if (!isValid) {
77
+ console.log(`${chalk.red("Invalid docsDir")}, please check your configuration.`);
78
+ process.exit(1);
79
+ }
80
+ return config;
68
81
  }
69
82
  }
70
83
 
@@ -241,6 +254,7 @@ export default async function init(
241
254
  const docsDirInput = await options.prompts.input({
242
255
  message: `📁 [7/9]: Where should we save your documentation?`,
243
256
  default: `${outputPath}/docs`,
257
+ validate: validateDocDir,
244
258
  });
245
259
  input.docsDir = docsDirInput.trim() || `${outputPath}/docs`;
246
260
 
@@ -0,0 +1,16 @@
1
+ import path from "node:path";
2
+ export function validateDocDir(input) {
3
+ const currentDir = process.cwd();
4
+ const targetDir = path.resolve(input);
5
+ const relativePath = path.relative(currentDir, targetDir);
6
+ if (relativePath.length === 0) {
7
+ return `Can't use current directory: ${targetDir}`;
8
+ }
9
+ if (relativePath.startsWith("..")) {
10
+ return `Can't use directory outside current directory: ${targetDir}`;
11
+ }
12
+ if (path.isAbsolute(relativePath)) {
13
+ return `Can't use absolute path: ${targetDir}`;
14
+ }
15
+ return true;
16
+ }
@@ -163,8 +163,13 @@ export default async function publishDocs(
163
163
  } else {
164
164
  console.log(`\nCreating a new website for your documentation...`);
165
165
  }
166
- const { appUrl: homeUrl, token: ltToken } = (await deploy(id, paymentLink)) || {};
166
+ const {
167
+ appUrl: homeUrl,
168
+ token: ltToken,
169
+ sessionId: newSessionId,
170
+ } = (await deploy(id, paymentLink)) || {};
167
171
 
172
+ sessionId = newSessionId;
168
173
  appUrl = homeUrl;
169
174
  token = ltToken;
170
175
  } catch (error) {
@@ -174,13 +179,7 @@ export default async function publishDocs(
174
179
  }
175
180
  }
176
181
 
177
- if (sessionId) {
178
- authToken = await getOfficialAccessToken(BASE_URL, false);
179
- client = client || new BrokerClient({ baseUrl: BASE_URL, authToken });
180
-
181
- const { vendors } = await client.getSessionDetail(sessionId, false);
182
- token = vendors?.find((vendor) => vendor.vendorType === "launcher" && vendor.token)?.token;
183
- }
182
+ appUrl = appUrl ?? CLOUD_SERVICE_URL_PROD;
184
183
 
185
184
  console.log(`\nPublishing your documentation to ${chalk.cyan(appUrl)}\n`);
186
185
 
@@ -264,8 +263,10 @@ export default async function publishDocs(
264
263
  await saveValueToConfig("shouldSyncBranding", "", "Should sync branding for documentation");
265
264
  } else {
266
265
  // If the error is 401 or 403, it means the access token is invalid
267
- if (error?.includes("401") || error?.includes("403")) {
266
+ if (error?.includes("401")) {
268
267
  message = `❌ Publishing failed due to an authorization error. Please run ${chalk.cyan("aigne doc clear")} to reset your credentials and try again.`;
268
+ } else if (error?.includes("403")) {
269
+ message = `❌ Publishing failed due to an authorization error. \n - Please confirm you have permission to modify this document [boardId: "${newBoardId || boardId}"]. \n - Or run ${chalk.cyan("aigne doc clear")} to reset your credentials and try again.`;
269
270
  }
270
271
  }
271
272
 
@@ -208,13 +208,14 @@ export default async function userReviewDocument({ content, description, ...rest
208
208
 
209
209
  try {
210
210
  // Call updateDocument agent with feedback
211
- await options.context.invoke(updateAgent, {
211
+ const result = await options.context.invoke(updateAgent, {
212
212
  ...rest,
213
213
  originalContent: options.context.userContext.currentContent,
214
214
  feedback: feedback.trim(),
215
215
  userPreferences,
216
216
  title,
217
217
  });
218
+ options.context.userContext.currentContent = result.content;
218
219
 
219
220
  // Check if feedback should be saved as user preference
220
221
  const feedbackRefinerAgent = options.context.agents["checkFeedbackRefiner"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/doc-smith",
3
- "version": "0.8.15-beta.12",
3
+ "version": "0.8.15-beta.13",
4
4
  "description": "AI-driven documentation generation tool built on the AIGNE Framework",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -24,14 +24,14 @@
24
24
  "author": "Arcblock <blocklet@arcblock.io> https://github.com/blocklet",
25
25
  "license": "Elastic-2.0",
26
26
  "dependencies": {
27
- "@aigne/aigne-hub": "^0.10.0",
28
- "@aigne/anthropic": "^0.14.0",
29
- "@aigne/cli": "^1.49.1",
30
- "@aigne/core": "^1.61.0",
31
- "@aigne/gemini": "^0.14.0",
32
- "@aigne/openai": "^0.16.0",
27
+ "@aigne/aigne-hub": "^0.10.5-beta.3",
28
+ "@aigne/anthropic": "^0.14.5-beta.3",
29
+ "@aigne/cli": "^1.53.1-beta.4",
30
+ "@aigne/core": "^1.65.1-beta.3",
31
+ "@aigne/gemini": "^0.14.5-beta.3",
32
+ "@aigne/openai": "^0.16.5-beta.3",
33
33
  "@aigne/publish-docs": "^0.12.0",
34
- "@blocklet/payment-broker-client": "^1.21.10",
34
+ "@blocklet/payment-broker-client": "^1.22.7",
35
35
  "@terrastruct/d2": "^0.1.33",
36
36
  "chalk": "^5.5.0",
37
37
  "cli-highlight": "^2.1.11",
@@ -18,6 +18,11 @@ The following are the available enhanced attributes and their descriptions:
18
18
  * `language` and `title` are written directly after \`\`\`, separated by spaces.
19
19
  * Other attributes (`icon`) must be provided in **key=value** format, separated by spaces.
20
20
 
21
+ ### Special Rules
22
+ - If the language is a shell (includes `sh`, `bash`, `zsh`, etc.):
23
+ - Executable shell code blocks must be a single-line command to make copying and running easier.
24
+ - Do not include comments inside executable shell code blocks; place explanatory comments outside the code block.
25
+
21
26
  ### Examples
22
27
 
23
28
  <code_block_good_examples>
@@ -70,9 +75,26 @@ class ShoppingCart {
70
75
  }
71
76
  }
72
77
  ```
78
+
79
+ **Example 5: Shell code block should in one line**
80
+
81
+ ```sh Install aigne deps icon=lucide:terminal
82
+ npm i -g @aigne/cli @aigne/doc-smith @aigne/websmith-smith
83
+ ```
84
+
85
+ **Example 6: Shell code block use `\` to split multiple lines**
86
+ ```bash Deploying with Access Keys icon=lucide:terminal
87
+ blocklet deploy . \
88
+ --endpoint https://my-server.arcblock.io \
89
+ --access-key 'your_access_key_id' \
90
+ --access-secret 'your_access_key_secret' \
91
+ --app-id z2qa9sD2tFAP8gM7C1i8iETg3a1T3A3aT3bQ
92
+ ```
93
+
73
94
  </code_block_good_examples>
74
95
 
75
96
  <code_block_bad_examples>
97
+
76
98
  **Example 1**
77
99
 
78
100
  There are two errors in this example:
@@ -97,5 +119,18 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
97
119
  }
98
120
  ```
99
121
 
122
+ **Example 2: shell code block have multiple lines**
123
+ ```sh
124
+ npm i -g @aigne/cli
125
+ npm i -g @aigne/doc-smith
126
+ npm i -g @aigne/websmith-smith
127
+ ```
128
+
129
+ **Example 3: shell code block comments**
130
+ ```sh
131
+ # add aigne deps
132
+ npm i -g @aigne/cli
133
+ ```
134
+
100
135
  </code_block_bad_examples>
101
- </enhanced_code_block_rules>
136
+ </enhanced_code_block_rules>
package/utils/deploy.mjs CHANGED
@@ -71,7 +71,7 @@ export async function deploy(id, cachedUrl) {
71
71
  },
72
72
  });
73
73
 
74
- const { appUrl, homeUrl, subscriptionUrl, dashboardUrl, vendors } = result;
74
+ const { appUrl, homeUrl, subscriptionUrl, dashboardUrl, vendors, sessionId } = result;
75
75
  const token = vendors?.[0]?.token;
76
76
 
77
77
  return {
@@ -80,5 +80,6 @@ export async function deploy(id, cachedUrl) {
80
80
  dashboardUrl,
81
81
  subscriptionUrl,
82
82
  token,
83
+ sessionId,
83
84
  };
84
85
  }