@aigne/doc-smith 0.7.2 → 0.8.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.
@@ -4,6 +4,9 @@ env:
4
4
  NODE_OPTIONS: "--max_old_space_size=6144"
5
5
 
6
6
  on:
7
+ push:
8
+ branches:
9
+ - main
7
10
  pull_request:
8
11
  branches:
9
12
  - main
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.8.0](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.7.2...v0.8.0) (2025-09-03)
4
+
5
+
6
+ ### Features
7
+
8
+ * **tests:** add comprehensive workflow test coverage ([#76](https://github.com/AIGNE-io/aigne-doc-smith/issues/76)) ([d5f6062](https://github.com/AIGNE-io/aigne-doc-smith/commit/d5f6062311f36dc5b6394ae0768583fb8f3853a4))
9
+ * update custom component guidelines with formatting restrictions ([#79](https://github.com/AIGNE-io/aigne-doc-smith/issues/79)) ([76158de](https://github.com/AIGNE-io/aigne-doc-smith/commit/76158de236696e68c63c057f5ea4b8458a15e787))
10
+
3
11
  ## [0.7.2](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.7.1...v0.7.2) (2025-09-01)
4
12
 
5
13
 
package/README.md CHANGED
@@ -1,3 +1,8 @@
1
+ [![GitHub star chart](https://img.shields.io/github/stars/AIGNE-io/aigne-doc-smith?style=flat-square)](https://star-history.com/#AIGNE-io/aigne-doc-smith)
2
+ [![Open Issues](https://img.shields.io/github/issues-raw/AIGNE-io/aigne-doc-smith?style=flat-square)](https://github.com/AIGNE-io/aigne-doc-smith/issues)
3
+ [![codecov](https://codecov.io/gh/AIGNE-io/aigne-doc-smith/graph/badge.svg?token=95TQO2NKYC)](https://codecov.io/gh/AIGNE-io/aigne-doc-smith)
4
+ [![NPM Version](https://img.shields.io/npm/v/@aigne/core)](https://www.npmjs.com/package/@aigne/doc-smith)
5
+
1
6
  # AIGNE DocSmith
2
7
 
3
8
  AIGNE DocSmith is a powerful, AI-driven documentation generation tool built on the [AIGNE Framework](https://www.aigne.io/en/framework). It automates the creation of detailed, structured, and multi-language documentation directly from your source code.
@@ -1,6 +1,13 @@
1
1
  import { checkMarkdown } from "../utils/markdown-checker.mjs";
2
2
 
3
3
  export default async function checkDetailResult({ structurePlan, reviewContent, docsDir }) {
4
+ if (!reviewContent || reviewContent.trim() === "") {
5
+ return {
6
+ isApproved: false,
7
+ detailFeedback: "Review content is empty",
8
+ };
9
+ }
10
+
4
11
  let isApproved = true;
5
12
  const detailFeedback = [];
6
13
 
@@ -54,6 +54,9 @@ input_schema:
54
54
  feedback:
55
55
  type: string
56
56
  description: Feedback for content improvement
57
+ reset:
58
+ type: boolean
59
+ description: Ignore previous results and regenerate content from scratch
57
60
  output_schema:
58
61
  type: object
59
62
  properties:
@@ -7,7 +7,7 @@ import {
7
7
  } from "../utils/docs-finder-utils.mjs";
8
8
 
9
9
  export default async function selectedDocs(
10
- { docs, structurePlanResult, boardId, docsDir, isTranslate, feedback, locale },
10
+ { docs, structurePlanResult, boardId, docsDir, isTranslate, feedback, locale, reset = false },
11
11
  options,
12
12
  ) {
13
13
  let foundItems = [];
@@ -101,6 +101,14 @@ export default async function selectedDocs(
101
101
  // Add feedback to all results if provided
102
102
  foundItems = addFeedbackToItems(foundItems, userFeedback);
103
103
 
104
+ // if reset is true, set content to null for all items
105
+ if (reset) {
106
+ foundItems = foundItems.map((item) => ({
107
+ ...item,
108
+ content: null,
109
+ }));
110
+ }
111
+
104
112
  return {
105
113
  selectedDocs: foundItems,
106
114
  feedback: userFeedback,
@@ -2,7 +2,7 @@ import { mkdir, readFile, writeFile } from "node:fs/promises";
2
2
  import { dirname, join } from "node:path";
3
3
  import chalk from "chalk";
4
4
  import { stringify as yamlStringify } from "yaml";
5
- import { getFilteredOptions, validateSelection } from "../utils/conflict-detector.mjs";
5
+ import { getFilteredOptions } from "../utils/conflict-detector.mjs";
6
6
  import {
7
7
  DEPTH_RECOMMENDATION_LOGIC,
8
8
  DOCUMENT_STYLES,
@@ -63,7 +63,7 @@ export default async function init(
63
63
  if (input.length === 0) {
64
64
  return "Please select at least one purpose.";
65
65
  }
66
- return validateSelection("documentPurpose", input);
66
+ return true;
67
67
  },
68
68
  });
69
69
 
@@ -111,7 +111,7 @@ export default async function init(
111
111
  if (input.length === 0) {
112
112
  return "Please select at least one audience.";
113
113
  }
114
- return validateSelection("targetAudienceTypes", input);
114
+ return true;
115
115
  },
116
116
  });
117
117
 
@@ -19,6 +19,7 @@ export default async function loadSources({
19
19
  boardId,
20
20
  useDefaultPatterns = true,
21
21
  lastGitHead,
22
+ reset = false,
22
23
  } = {}) {
23
24
  let files = Array.isArray(sources) ? [...sources] : [];
24
25
 
@@ -190,7 +191,7 @@ export default async function loadSources({
190
191
 
191
192
  // Get the last output result of the specified path
192
193
  let content;
193
- if (docPath) {
194
+ if (docPath && !reset) {
194
195
  let fileFullName;
195
196
 
196
197
  // First try direct path matching (original format)
@@ -149,11 +149,7 @@ async function cleanupInvalidFiles(structurePlan, docsDir, translateLanguages, l
149
149
  message: `Deleted invalid file: ${file}`,
150
150
  });
151
151
  } catch (err) {
152
- results.push({
153
- path: file,
154
- success: false,
155
- error: `Failed to delete ${file}: ${err.message}`,
156
- });
152
+ console.warn(`Failed to delete invalid file: ${file}, error: ${err.message}`);
157
153
  }
158
154
  }
159
155
 
package/codecov.yml CHANGED
@@ -1,5 +1,13 @@
1
+ coverage:
2
+ status:
3
+ project: #add everything under here, more options at https://docs.codecov.com/docs/commit-status
4
+ default:
5
+ # basic
6
+ target: auto #default
7
+ threshold: 0%
8
+ base: auto
1
9
  comment:
2
- layout: " diff, flags, files"
10
+ layout: "header, changes, diff, flags, files"
3
11
  behavior: default
4
12
  require_changes: false
5
13
  require_base: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/doc-smith",
3
- "version": "0.7.2",
3
+ "version": "0.8.0",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,3 +1,4 @@
1
+ <custom_component>
1
2
  When generating document details, you can use the following custom components at appropriate locations based on their descriptions and functionality to enhance document presentation:
2
3
  - `<x-card>`
3
4
  - `<x-cards>`
@@ -24,7 +25,11 @@ Attribute Rules:
24
25
  - data-href (optional): Navigation link for clicking the card or button.
25
26
  - data-horizontal (optional): Whether to use horizontal layout.
26
27
  - data-cta (optional): Button text (call to action).
27
- - Body content: Must be written within <x-card>...</x-card> children.
28
+ - Body content:
29
+ - Must be written within <x-card>...</x-card> children.
30
+ - **Markdown format rendering is not supported**
31
+ - **Code block rendering is not supported**
32
+ - Only supports plain text format without styling
28
33
 
29
34
 
30
35
  ### 2. `<x-cards>` Card List Component
@@ -49,32 +54,51 @@ Attribute Rules:
49
54
  - Or all cards should have data-image.
50
55
  - Avoid mixing (some with icons, some with only images).
51
56
 
52
-
53
- ### 3. Examples
57
+ <good_example>
58
+ Use plain text without any styling
59
+ <x-card data-title="alarm()" data-icon="lucide:alarm-clock"> SIGALRM: Sent when a real-time timer has expired. </x-card>
54
60
 
55
61
  Single card:
56
-
57
- ```
58
62
  <x-card data-title="Horizontal card" data-icon="lucide:atom" data-horizontal="true">
59
63
  This is an example of a horizontal card.
60
64
  </x-card>
61
- ```
62
65
 
63
66
  Card list (all using icons, recommended approach):
64
-
65
- ```
66
67
  <x-cards data-columns="3">
67
68
  <x-card data-title="Feature 1" data-icon="lucide:rocket">Description of Feature 1.</x-card>
68
69
  <x-card data-title="Feature 2" data-icon="lucide:bolt">Description of Feature 2.</x-card>
69
70
  <x-card data-title="Feature 3" data-icon="material-symbols:rocket-outline">Description of Feature 3.</x-card>
70
71
  </x-cards>
71
- ```
72
72
 
73
73
  Card list (all using images):
74
-
75
- ```
76
74
  <x-cards data-columns="2">
77
75
  <x-card data-title="Card A" data-image="https://picsum.photos/id/10/300/300">Content A</x-card>
78
76
  <x-card data-title="Card B" data-image="https://picsum.photos/id/11/300/300">Content B</x-card>
79
77
  </x-cards>
80
- ```
78
+ </good_example>
79
+
80
+ <bad_example>
81
+
82
+ `x-card` component body does not support markdown formatting inline code block
83
+ <x-card data-title="alarm()" data-icon="lucide:alarm-clock"> `SIGALRM`: Sent when a real-time timer has expired. </x-card>
84
+
85
+
86
+ `x-card` component body does not support code blocks
87
+ <x-card data-title="ctrl_break()" data-icon="lucide:keyboard">
88
+ Creates a listener for "ctrl-break" events.
89
+ ```rust,no_run
90
+ use tokio::signal::windows::ctrl_break;
91
+
92
+ #[tokio::main]
93
+ async fn main() -> std::io::Result<()> {
94
+ let mut stream = ctrl_break()?;
95
+ stream.recv().await;
96
+ println!("got ctrl-break");
97
+ Ok(())
98
+ }
99
+ ```
100
+ </x-card>
101
+
102
+ </bad_example>
103
+
104
+ </custom_component>