-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Docs/add full repository documentation #1674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs/add full repository documentation #1674
Conversation
This commit adds extensive JSDoc comments to all public functions, methods, classes, and types across the entire codebase, including the `src/main`, `src/ipc`, `src/db`, `src/lib`, `src/hooks`, and `src/components` directories. The documentation covers the purpose of the code, descriptions for all parameters and return values, and adheres to the JSDoc standard. Additionally, this change includes: - An updated `README.md` with setup and usage instructions for new developers. - Thai translations for the `README.md`, `CONTRIBUTING.md`, and `docs/architecture.md` files to improve accessibility for Thai-speaking contributors.
Co-authored-by: amazon-q-developer[bot] <208079219+amazon-q-developer[bot]@users.noreply.github.com>
Co-authored-by: amazon-q-developer[bot] <208079219+amazon-q-developer[bot]@users.noreply.github.com>
Co-authored-by: amazon-q-developer[bot] <208079219+amazon-q-developer[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
17 issues found across 63 files
Prompt for AI agents (all 17 issues)
Understand the root cause of the following 17 issues and fix them.
<file name="src/components/ChatPanel.tsx">
<violation number="1" location="src/components/ChatPanel.tsx:112">
Adding streamCountById to the dependency array forces the scroll-to-bottom effect to rerun whenever any chat stream updates, even if the current chat’s count is unchanged. That causes the user’s scroll position to jump unexpectedly when other chats receive messages.</violation>
</file>
<file name="src/hooks/useLanguageModelProviders.ts">
<violation number="1" location="src/hooks/useLanguageModelProviders.ts:14">
The hook does not return a property named `...queryResult`; it spreads the query result fields into the returned object. Documenting a nonexistent property misleads consumers.</violation>
</file>
<file name="src/components/ChatList.tsx">
<violation number="1" location="src/components/ChatList.tsx:36">
The JSDoc states that `props.show` defaults to `true`, but the component signature never applies that default. Update the comment (or add an actual default) so the docs match behavior.</violation>
</file>
<file name="src/hooks/useChatModeToggle.ts">
<violation number="1" location="src/hooks/useChatModeToggle.ts:11">
`isMac` is documented as only covering macOS, but `detectIsMac()` also treats iPhone/iPad/iPod as true via the `/Mac|iPhone|iPad|iPod/` fallback. Please reflect that it covers macOS and iOS devices to avoid misleading consumers.</violation>
<violation number="2" location="src/hooks/useChatModeToggle.ts:64">
This docstring states the helper only detects macOS, but the implementation also returns true for iOS devices (`/Mac|iPhone|iPad|iPod/`). Update the wording (and the associated `@returns`) to cover macOS + iOS so readers are not misled.</violation>
<violation number="3" location="src/hooks/useChatModeToggle.ts:79">
The hook documentation says it only identifies macOS, yet the underlying detection also returns true on iOS devices (`/Mac|iPhone|iPad|iPod/`). Please update the wording (and its `@returns`) so consumers know it covers macOS and iOS.</violation>
</file>
<file name="src/components/AppList.tsx">
<violation number="1" location="src/components/AppList.tsx:21">
The JSDoc says `show` defaults to true, but the component hides when `show` is falsy and no true default is applied. Update the documented default to match the implementation.</violation>
</file>
<file name="src/hooks/useCheckProblems.ts">
<violation number="1" location="src/hooks/useCheckProblems.ts:13">
`checkProblems` is documented as returning void, but React Query's `refetch` returns a Promise resolving with the query result. Update the JSDoc to reflect the Promise return type so downstream usage isn't misled.</violation>
</file>
<file name="src/hooks/usePrompts.ts">
<violation number="1" location="src/hooks/usePrompts.ts:28">
Update the JSDoc for `refetch` to show that it returns a promise resolving to the query result, not `void`.</violation>
</file>
<file name="CONTRIBUTING.th.md">
<violation number="1" location="CONTRIBUTING.th.md:93">
The snapshot update command is duplicated here, which will confuse contributors. Please drop the redundant second copy so the steps match the English guide.</violation>
</file>
<file name="README.md">
<violation number="1" location="README.md:31">
Please include the repository URL in this clone command so the setup instructions are actionable.</violation>
</file>
<file name="README.th.md">
<violation number="1" location="README.th.md:31">
The cloning instructions point to a non-existent repository, so following them will fail. Update the URL to the actual Dyad repository.</violation>
</file>
<file name="src/hooks/useRunApp.ts">
<violation number="1" location="src/hooks/useRunApp.ts:21">
Update the JSDoc to clarify that `loading` tracks whether an app operation is in progress rather than the app's running state.</violation>
</file>
<file name="docs/architecture.th.md">
<violation number="1" location="docs/architecture.th.md:52">
The internal link targets `#why-isnt-dyad-more-agentic`, but this Thai heading generates a different slug, leaving the self-reference broken. Update the anchor to the Thai slug so the link works.</violation>
</file>
<file name="src/hooks/useUserBudgetInfo.ts">
<violation number="1" location="src/hooks/useUserBudgetInfo.ts:14">
`refetchUserBudget` is documented as `() => void`, but TanStack Query’s `refetch` accepts options and resolves to a promise. Update the JSDoc to reflect the true signature so consumers aren’t misled.</violation>
</file>
<file name="src/hooks/useLoadApp.ts">
<violation number="1" location="src/hooks/useLoadApp.ts:15">
`refreshApp` wraps React Query's `refetch`, which accepts options and returns a Promise. Documenting it as `() => void` is misleading for consumers using this hook.</violation>
</file>
<file name="src/hooks/useTemplates.ts">
<violation number="1" location="src/hooks/useTemplates.ts:11">
Documenting `refetch` as `() => void` is inaccurate. `query.refetch` comes from `useQuery` and returns a Promise that resolves to the query result, not void, so this JSDoc can mislead consumers. Please document the actual async type.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| }, [chatId, chatId ? (streamCountById.get(chatId) ?? 0) : 0]); | ||
| }, [chatId, chatId ? (streamCountById.get(chatId) ?? 0) : 0, streamCountById]); | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding streamCountById to the dependency array forces the scroll-to-bottom effect to rerun whenever any chat stream updates, even if the current chat’s count is unchanged. That causes the user’s scroll position to jump unexpectedly when other chats receive messages.
Prompt for AI agents
Address the following comment on src/components/ChatPanel.tsx at line 112:
<comment>Adding streamCountById to the dependency array forces the scroll-to-bottom effect to rerun whenever any chat stream updates, even if the current chat’s count is unchanged. That causes the user’s scroll position to jump unexpectedly when other chats receive messages.</comment>
<file context>
@@ -97,7 +109,7 @@ export function ChatPanel({
console.log("streamCount - scrolling to bottom", streamCount);
scrollToBottom();
- }, [chatId, chatId ? (streamCountById.get(chatId) ?? 0) : 0]);
+ }, [chatId, chatId ? (streamCountById.get(chatId) ?? 0) : 0, streamCountById]);
useEffect(() => {
</file context>
| /** | ||
| * A hook for managing language model providers. | ||
| * @returns {object} An object with the query result and functions to check if a provider is set up. | ||
| * @property {import("@tanstack/react-query").UseQueryResult<LanguageModelProvider[], Error>} ...queryResult - The result of the query. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hook does not return a property named ...queryResult; it spreads the query result fields into the returned object. Documenting a nonexistent property misleads consumers.
Prompt for AI agents
Address the following comment on src/hooks/useLanguageModelProviders.ts at line 14:
<comment>The hook does not return a property named `...queryResult`; it spreads the query result fields into the returned object. Documenting a nonexistent property misleads consumers.</comment>
<file context>
@@ -8,6 +8,13 @@ import {
+/**
+ * A hook for managing language model providers.
+ * @returns {object} An object with the query result and functions to check if a provider is set up.
+ * @property {import("@tanstack/react-query").UseQueryResult<LanguageModelProvider[], Error>} ...queryResult - The result of the query.
+ * @property {(provider: string) => boolean} isProviderSetup - A function to check if a provider is set up.
+ * @property {() => boolean} isAnyProviderSetup - A function to check if any provider is set up.
</file context>
| /** | ||
| * A component that displays a list of chats. | ||
| * @param {object} props - The component props. | ||
| * @param {boolean} [props.show=true] - Whether to show the component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSDoc states that props.show defaults to true, but the component signature never applies that default. Update the comment (or add an actual default) so the docs match behavior.
Prompt for AI agents
Address the following comment on src/components/ChatList.tsx at line 36:
<comment>The JSDoc states that `props.show` defaults to `true`, but the component signature never applies that default. Update the comment (or add an actual default) so the docs match behavior.</comment>
<file context>
@@ -30,6 +30,12 @@ import { DeleteChatDialog } from "@/components/chat/DeleteChatDialog";
+/**
+ * A component that displays a list of chats.
+ * @param {object} props - The component props.
+ * @param {boolean} [props.show=true] - Whether to show the component.
+ * @returns {JSX.Element | undefined} The rendered component.
+ */
</file context>
| * @param {boolean} [props.show=true] - Whether to show the component. | |
| * @param {boolean} [props.show] - Whether to show the component. |
| // Export the utility function and hook for use elsewhere | ||
|
|
||
| /** | ||
| * A hook to determine if the user is on a Mac. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hook documentation says it only identifies macOS, yet the underlying detection also returns true on iOS devices (/Mac|iPhone|iPad|iPod/). Please update the wording (and its @returns) so consumers know it covers macOS and iOS.
Prompt for AI agents
Address the following comment on src/hooks/useChatModeToggle.ts at line 79:
<comment>The hook documentation says it only identifies macOS, yet the underlying detection also returns true on iOS devices (`/Mac|iPhone|iPad|iPod/`). Please update the wording (and its `@returns`) so consumers know it covers macOS and iOS.</comment>
<file context>
@@ -65,7 +74,11 @@ export function detectIsMac(): boolean {
-// Export the utility function and hook for use elsewhere
+
+/**
+ * A hook to determine if the user is on a Mac.
+ * @returns {boolean} Whether the user is on a Mac.
+ */
</file context>
| * A hook to determine if the user is on a Mac. | |
| * A hook to determine if the user is on a macOS or iOS device. |
| }; | ||
|
|
||
| /** | ||
| * Detects if the user is on a Mac. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This docstring states the helper only detects macOS, but the implementation also returns true for iOS devices (/Mac|iPhone|iPad|iPod/). Update the wording (and the associated @returns) to cover macOS + iOS so readers are not misled.
Prompt for AI agents
Address the following comment on src/hooks/useChatModeToggle.ts at line 64:
<comment>This docstring states the helper only detects macOS, but the implementation also returns true for iOS devices (`/Mac|iPhone|iPad|iPod/`). Update the wording (and the associated `@returns`) to cover macOS + iOS so readers are not misled.</comment>
<file context>
@@ -48,13 +54,16 @@ export function useChatModeToggle() {
};
+/**
+ * Detects if the user is on a Mac.
+ * @returns {boolean} Whether the user is on a Mac.
+ */
</file context>
| * Detects if the user is on a Mac. | |
| * Detects if the user is on a macOS or iOS device. |
| /** | ||
| * A hook for running and managing an app. | ||
| * @returns {object} An object with functions to run, stop, and restart an app, and the loading state and app data. | ||
| * @property {boolean} loading - Whether the app is running. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the JSDoc to clarify that loading tracks whether an app operation is in progress rather than the app's running state.
Prompt for AI agents
Address the following comment on src/hooks/useRunApp.ts at line 21:
<comment>Update the JSDoc to clarify that `loading` tracks whether an app operation is in progress rather than the app's running state.</comment>
<file context>
@@ -15,6 +15,16 @@ import { showInputRequest } from "@/lib/toast";
+/**
+ * A hook for running and managing an app.
+ * @returns {object} An object with functions to run, stop, and restart an app, and the loading state and app data.
+ * @property {boolean} loading - Whether the app is running.
+ * @property {(appId: number) => Promise<void>} runApp - A function to run an app.
+ * @property {(appId: number) => Promise<void>} stopApp - A function to stop an app.
</file context>
| * @property {boolean} loading - Whether the app is running. | |
| * @property {boolean} loading - Whether an app operation is in progress. |
|
|
||
| อย่างไรก็ตาม ทั้งสองวิธีนี้ต้องการให้ผู้ใช้เลือกไฟล์ที่ถูกต้องด้วยตนเองซึ่งไม่สะดวกเสมอไป ฟีเจอร์ [Smart Context](https://www.dyad.sh/docs/guides/ai-models/pro-modes#smart-context) ของ Dyad โดยพื้นฐานแล้วจะใช้โมเดลขนาดเล็กเพื่อกรองไฟล์ที่สำคัญที่สุดในแชทที่กำหนด อย่างไรก็ตาม เรากำลังทดลองแนวทางใหม่ๆ ในการเลือก context อย่างต่อเนื่อง เนื่องจากเป็นปัญหาที่ค่อนข้างยาก | ||
|
|
||
| แนวทางหนึ่งที่เราไม่ใช้คือสไตล์ agentic ที่เหมือนกับที่ Claude Code และ Cursor ทำ ซึ่งจะค้นหาและนำทางผ่านโค้ดเบสซ้ำๆ โดยใช้ tool calls เหตุผลหลักที่เราไม่ทำเช่นนี้คือเรื่องค่าใช้จ่าย (ดูคำถามด้านบน: [ทำไม Dyad ถึงไม่เป็น Agentic มากกว่านี้](#why-isnt-dyad-more-agentic)) No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The internal link targets #why-isnt-dyad-more-agentic, but this Thai heading generates a different slug, leaving the self-reference broken. Update the anchor to the Thai slug so the link works.
Prompt for AI agents
Address the following comment on docs/architecture.th.md at line 52:
<comment>The internal link targets `#why-isnt-dyad-more-agentic`, but this Thai heading generates a different slug, leaving the self-reference broken. Update the anchor to the Thai slug so the link works.</comment>
<file context>
@@ -0,0 +1,52 @@
+
+อย่างไรก็ตาม ทั้งสองวิธีนี้ต้องการให้ผู้ใช้เลือกไฟล์ที่ถูกต้องด้วยตนเองซึ่งไม่สะดวกเสมอไป ฟีเจอร์ [Smart Context](https://www.dyad.sh/docs/guides/ai-models/pro-modes#smart-context) ของ Dyad โดยพื้นฐานแล้วจะใช้โมเดลขนาดเล็กเพื่อกรองไฟล์ที่สำคัญที่สุดในแชทที่กำหนด อย่างไรก็ตาม เรากำลังทดลองแนวทางใหม่ๆ ในการเลือก context อย่างต่อเนื่อง เนื่องจากเป็นปัญหาที่ค่อนข้างยาก
+
+แนวทางหนึ่งที่เราไม่ใช้คือสไตล์ agentic ที่เหมือนกับที่ Claude Code และ Cursor ทำ ซึ่งจะค้นหาและนำทางผ่านโค้ดเบสซ้ำๆ โดยใช้ tool calls เหตุผลหลักที่เราไม่ทำเช่นนี้คือเรื่องค่าใช้จ่าย (ดูคำถามด้านบน: [ทำไม Dyad ถึงไม่เป็น Agentic มากกว่านี้](#why-isnt-dyad-more-agentic))
\ No newline at end of file
</file context>
| แนวทางหนึ่งที่เราไม่ใช้คือสไตล์ agentic ที่เหมือนกับที่ Claude Code และ Cursor ทำ ซึ่งจะค้นหาและนำทางผ่านโค้ดเบสซ้ำๆ โดยใช้ tool calls เหตุผลหลักที่เราไม่ทำเช่นนี้คือเรื่องค่าใช้จ่าย (ดูคำถามด้านบน: [ทำไม Dyad ถึงไม่เป็น Agentic มากกว่านี้](#why-isnt-dyad-more-agentic)) | |
| แนวทางหนึ่งที่เราไม่ใช้คือสไตล์ agentic ที่เหมือนกับที่ Claude Code และ Cursor ทำ ซึ่งจะค้นหาและนำทางผ่านโค้ดเบสซ้ำๆ โดยใช้ tool calls เหตุผลหลักที่เราไม่ทำเช่นนี้คือเรื่องค่าใช้จ่าย (ดูคำถามด้านบน: [ทำไม Dyad ถึงไม่เป็น Agentic มากกว่านี้](#ทำไม-dyad-ถึงไม่เป็น-agentic-มากกว่านี้)) |
| * @property {boolean} isLoadingUserBudget - Whether the user budget is being loaded. | ||
| * @property {Error | null} userBudgetError - The error object if the query fails. | ||
| * @property {boolean} isFetchingUserBudget - Whether the user budget is being fetched. | ||
| * @property {() => void} refetchUserBudget - A function to refetch the user budget. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refetchUserBudget is documented as () => void, but TanStack Query’s refetch accepts options and resolves to a promise. Update the JSDoc to reflect the true signature so consumers aren’t misled.
Prompt for AI agents
Address the following comment on src/hooks/useUserBudgetInfo.ts at line 14:
<comment>`refetchUserBudget` is documented as `() => void`, but TanStack Query’s `refetch` accepts options and resolves to a promise. Update the JSDoc to reflect the true signature so consumers aren’t misled.</comment>
<file context>
@@ -4,6 +4,15 @@ import type { UserBudgetInfo } from "@/ipc/ipc_types";
+ * @property {boolean} isLoadingUserBudget - Whether the user budget is being loaded.
+ * @property {Error | null} userBudgetError - The error object if the query fails.
+ * @property {boolean} isFetchingUserBudget - Whether the user budget is being fetched.
+ * @property {() => void} refetchUserBudget - A function to refetch the user budget.
+ */
export function useUserBudgetInfo() {
</file context>
| * @property {() => void} refetchUserBudget - A function to refetch the user budget. | |
| * @property {(options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<UserBudgetInfo | null, Error>>} refetchUserBudget - A function to refetch the user budget. |
| * @property {App | null | undefined} app - The app data. | ||
| * @property {boolean} loading - Whether the app is being loaded. | ||
| * @property {Error | null} error - The error object if the query fails. | ||
| * @property {() => void} refreshApp - A function to refresh the app. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refreshApp wraps React Query's refetch, which accepts options and returns a Promise. Documenting it as () => void is misleading for consumers using this hook.
Prompt for AI agents
Address the following comment on src/hooks/useLoadApp.ts at line 15:
<comment>`refreshApp` wraps React Query's `refetch`, which accepts options and returns a Promise. Documenting it as `() => void` is misleading for consumers using this hook.</comment>
<file context>
@@ -5,6 +5,15 @@ import { useAtom } from "jotai";
+ * @property {App | null | undefined} app - The app data.
+ * @property {boolean} loading - Whether the app is being loaded.
+ * @property {Error | null} error - The error object if the query fails.
+ * @property {() => void} refreshApp - A function to refresh the app.
+ */
export function useLoadApp(appId: number | null) {
</file context>
| * @property {() => void} refreshApp - A function to refresh the app. | |
| * @property {import("@tanstack/react-query").UseQueryResult<App | null, Error>["refetch"]} refreshApp - A function to refresh the app. |
| * @property {Template[]} templates - The list of templates. | ||
| * @property {boolean} isLoading - Whether the templates are being loaded. | ||
| * @property {Error | null} error - The error object if the query fails. | ||
| * @property {() => void} refetch - A function to refetch the templates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documenting refetch as () => void is inaccurate. query.refetch comes from useQuery and returns a Promise that resolves to the query result, not void, so this JSDoc can mislead consumers. Please document the actual async type.
Prompt for AI agents
Address the following comment on src/hooks/useTemplates.ts at line 11:
<comment>Documenting `refetch` as `() => void` is inaccurate. `query.refetch` comes from `useQuery` and returns a Promise that resolves to the query result, not void, so this JSDoc can mislead consumers. Please document the actual async type.</comment>
<file context>
@@ -2,6 +2,14 @@ import { useQuery } from "@tanstack/react-query";
+ * @property {Template[]} templates - The list of templates.
+ * @property {boolean} isLoading - Whether the templates are being loaded.
+ * @property {Error | null} error - The error object if the query fails.
+ * @property {() => void} refetch - A function to refetch the templates.
+ */
export function useTemplates() {
</file context>
| * @property {() => void} refetch - A function to refetch the templates. | |
| * @property {import("@tanstack/react-query").UseQueryResult<Template[], Error>["refetch"]} refetch - A function to refetch the templates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
11 issues found across 63 files
Prompt for AI agents (all 11 issues)
Understand the root cause of the following 11 issues and fix them.
<file name="src/components/ChatList.tsx">
<violation number="1" location="src/components/ChatList.tsx:36">
The JSDoc says `show` defaults to true, but the component never sets that default—omitting the prop leaves it undefined and the component short-circuits. Please update the comment to reflect the actual behavior.</violation>
</file>
<file name="src/components/AppList.tsx">
<violation number="1" location="src/components/AppList.tsx:21">
The JSDoc states `[props.show=true]`, but the component defaults `show` to undefined/false, so the documentation is incorrect. Please update the default description to match the real behavior.</violation>
</file>
<file name="README.md">
<violation number="1" location="README.md:31">
The cloned command in the setup instructions omits the repository URL, so developers cannot follow the documented setup steps.</violation>
</file>
<file name="docs/architecture.th.md">
<violation number="1" location="docs/architecture.th.md:27">
Replace the Cyrillic word "синтаксис" with the intended English or Thai word so the sentence is readable.</violation>
<violation number="2" location="docs/architecture.th.md:52">
Update the internal anchor to match the Thai heading so the link resolves correctly.</violation>
</file>
<file name="src/hooks/useVersions.ts">
<violation number="1" location="src/hooks/useVersions.ts:18">
`refreshVersions` is documented as returning void, but `useQuery(...).refetch` actually resolves to a Promise. Update the JSDoc to reflect the async return type so consumers aren’t misled.</violation>
</file>
<file name="src/hooks/useRunApp.ts">
<violation number="1" location="src/hooks/useRunApp.ts:21">
Update the JSDoc to explain that `loading` reflects in-flight app actions rather than the app’s running state.</violation>
</file>
<file name="src/ipc/ipc_client.ts">
<violation number="1" location="src/ipc/ipc_client.ts:513">
The new docstring says onProblems is invoked, but streamMessage never calls that callback—please update the documentation to reflect the current behavior or wire up the handler.</violation>
</file>
<file name="src/components/ChatPanel.tsx">
<violation number="1" location="src/components/ChatPanel.tsx:33">
The JSDoc `@param` tag names a `props` parameter that does not exist in the destructured ChatPanel signature, leaving the documentation incorrect and potentially confusing.</violation>
</file>
<file name="src/hooks/useLoadApp.ts">
<violation number="1" location="src/hooks/useLoadApp.ts:15">
`refreshApp` is documented as returning `void`, but the hook passes through `useQuery`'s `refetch`, which is asynchronous and resolves to a `QueryObserverResult`. Please document the actual promise-returning signature to avoid misleading consumers.</violation>
</file>
<file name="src/hooks/useUserBudgetInfo.ts">
<violation number="1" location="src/hooks/useUserBudgetInfo.ts:14">
Documenting refetchUserBudget as returning void is incorrect—React Query’s refetch resolves a promise (UseQueryResult.refetch). Update the JSDoc so consumers know it returns a promise and can await it.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| /** | ||
| * A component that displays a list of chats. | ||
| * @param {object} props - The component props. | ||
| * @param {boolean} [props.show=true] - Whether to show the component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSDoc says show defaults to true, but the component never sets that default—omitting the prop leaves it undefined and the component short-circuits. Please update the comment to reflect the actual behavior.
Prompt for AI agents
Address the following comment on src/components/ChatList.tsx at line 36:
<comment>The JSDoc says `show` defaults to true, but the component never sets that default—omitting the prop leaves it undefined and the component short-circuits. Please update the comment to reflect the actual behavior.</comment>
<file context>
@@ -30,6 +30,12 @@ import { DeleteChatDialog } from "@/components/chat/DeleteChatDialog";
+/**
+ * A component that displays a list of chats.
+ * @param {object} props - The component props.
+ * @param {boolean} [props.show=true] - Whether to show the component.
+ * @returns {JSX.Element | undefined} The rendered component.
+ */
</file context>
| * @param {boolean} [props.show=true] - Whether to show the component. | |
| * @param {boolean} [props.show] - Whether to show the component. |
| /** | ||
| * A component that displays a list of apps. | ||
| * @param {object} props - The component props. | ||
| * @param {boolean} [props.show=true] - Whether to show the component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSDoc states [props.show=true], but the component defaults show to undefined/false, so the documentation is incorrect. Please update the default description to match the real behavior.
Prompt for AI agents
Address the following comment on src/components/AppList.tsx at line 21:
<comment>The JSDoc states `[props.show=true]`, but the component defaults `show` to undefined/false, so the documentation is incorrect. Please update the default description to match the real behavior.</comment>
<file context>
@@ -15,6 +15,12 @@ import { useMemo, useState } from "react";
+/**
+ * A component that displays a list of apps.
+ * @param {object} props - The component props.
+ * @param {boolean} [props.show=true] - Whether to show the component.
+ * @returns {JSX.Element | null} The rendered component.
+ */
</file context>
| * @param {boolean} [props.show=true] - Whether to show the component. | |
| * @param {boolean} [props.show=false] - Whether to show the component. |
|
|
||
| 1. **Clone the repository**: | ||
| ```bash | ||
| git clone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cloned command in the setup instructions omits the repository URL, so developers cannot follow the documented setup steps.
Prompt for AI agents
Address the following comment on README.md at line 31:
<comment>The cloned command in the setup instructions omits the repository URL, so developers cannot follow the documented setup steps.</comment>
<file context>
@@ -22,6 +22,35 @@ No sign-up required. Just download and go.
+
+1. **Clone the repository**:
+ ```bash
+ git clone
+ cd dyad
+ ```
</file context>
| git clone | |
| git clone https://github.com/dyad-sh/dyad.git |
|
|
||
| อย่างไรก็ตาม ทั้งสองวิธีนี้ต้องการให้ผู้ใช้เลือกไฟล์ที่ถูกต้องด้วยตนเองซึ่งไม่สะดวกเสมอไป ฟีเจอร์ [Smart Context](https://www.dyad.sh/docs/guides/ai-models/pro-modes#smart-context) ของ Dyad โดยพื้นฐานแล้วจะใช้โมเดลขนาดเล็กเพื่อกรองไฟล์ที่สำคัญที่สุดในแชทที่กำหนด อย่างไรก็ตาม เรากำลังทดลองแนวทางใหม่ๆ ในการเลือก context อย่างต่อเนื่อง เนื่องจากเป็นปัญหาที่ค่อนข้างยาก | ||
|
|
||
| แนวทางหนึ่งที่เราไม่ใช้คือสไตล์ agentic ที่เหมือนกับที่ Claude Code และ Cursor ทำ ซึ่งจะค้นหาและนำทางผ่านโค้ดเบสซ้ำๆ โดยใช้ tool calls เหตุผลหลักที่เราไม่ทำเช่นนี้คือเรื่องค่าใช้จ่าย (ดูคำถามด้านบน: [ทำไม Dyad ถึงไม่เป็น Agentic มากกว่านี้](#why-isnt-dyad-more-agentic)) No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the internal anchor to match the Thai heading so the link resolves correctly.
Prompt for AI agents
Address the following comment on docs/architecture.th.md at line 52:
<comment>Update the internal anchor to match the Thai heading so the link resolves correctly.</comment>
<file context>
@@ -0,0 +1,52 @@
+
+อย่างไรก็ตาม ทั้งสองวิธีนี้ต้องการให้ผู้ใช้เลือกไฟล์ที่ถูกต้องด้วยตนเองซึ่งไม่สะดวกเสมอไป ฟีเจอร์ [Smart Context](https://www.dyad.sh/docs/guides/ai-models/pro-modes#smart-context) ของ Dyad โดยพื้นฐานแล้วจะใช้โมเดลขนาดเล็กเพื่อกรองไฟล์ที่สำคัญที่สุดในแชทที่กำหนด อย่างไรก็ตาม เรากำลังทดลองแนวทางใหม่ๆ ในการเลือก context อย่างต่อเนื่อง เนื่องจากเป็นปัญหาที่ค่อนข้างยาก
+
+แนวทางหนึ่งที่เราไม่ใช้คือสไตล์ agentic ที่เหมือนกับที่ Claude Code และ Cursor ทำ ซึ่งจะค้นหาและนำทางผ่านโค้ดเบสซ้ำๆ โดยใช้ tool calls เหตุผลหลักที่เราไม่ทำเช่นนี้คือเรื่องค่าใช้จ่าย (ดูคำถามด้านบน: [ทำไม Dyad ถึงไม่เป็น Agentic มากกว่านี้](#why-isnt-dyad-more-agentic))
\ No newline at end of file
</file context>
| แนวทางหนึ่งที่เราไม่ใช้คือสไตล์ agentic ที่เหมือนกับที่ Claude Code และ Cursor ทำ ซึ่งจะค้นหาและนำทางผ่านโค้ดเบสซ้ำๆ โดยใช้ tool calls เหตุผลหลักที่เราไม่ทำเช่นนี้คือเรื่องค่าใช้จ่าย (ดูคำถามด้านบน: [ทำไม Dyad ถึงไม่เป็น Agentic มากกว่านี้](#why-isnt-dyad-more-agentic)) | |
| แนวทางหนึ่งที่เราไม่ใช้คือสไตล์ agentic ที่เหมือนกับที่ Claude Code และ Cursor ทำ ซึ่งจะค้นหาและนำทางผ่านโค้ดเบสซ้ำๆ โดยใช้ tool calls เหตุผลหลักที่เราไม่ทำเช่นนี้คือเรื่องค่าใช้จ่าย (ดูคำถามด้านบน: [ทำไม Dyad ถึงไม่เป็น Agentic มากกว่านี้](#ทำไม-dyad-ถึงไม่เป็น-agentic-มากกว่านี้)) |
|
|
||
| ### ทำไมไม่ใช้ Tool Calls จริงๆ? | ||
|
|
||
| สิ่งหนึ่งที่อาจดูแปลกคือเราไม่ได้ใช้ความสามารถในการเรียกใช้ฟังก์ชัน/เครื่องมือ (function calling/tool calling) ของ AI จริงๆ แต่กลับใช้ синтаксис XML-like ที่จำลองการเรียกใช้เครื่องมือแทน นี่เป็นสิ่งที่ผมสังเกตได้จากการศึกษา [system prompts](https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools) ของเครื่องมือสร้างแอปอื่นๆ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace the Cyrillic word "синтаксис" with the intended English or Thai word so the sentence is readable.
Prompt for AI agents
Address the following comment on docs/architecture.th.md at line 27:
<comment>Replace the Cyrillic word "синтаксис" with the intended English or Thai word so the sentence is readable.</comment>
<file context>
@@ -0,0 +1,52 @@
+
+### ทำไมไม่ใช้ Tool Calls จริงๆ?
+
+สิ่งหนึ่งที่อาจดูแปลกคือเราไม่ได้ใช้ความสามารถในการเรียกใช้ฟังก์ชัน/เครื่องมือ (function calling/tool calling) ของ AI จริงๆ แต่กลับใช้ синтаксис XML-like ที่จำลองการเรียกใช้เครื่องมือแทน นี่เป็นสิ่งที่ผมสังเกตได้จากการศึกษา [system prompts](https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools) ของเครื่องมือสร้างแอปอื่นๆ
+
+ผมคิดว่าเหตุผลหลักสองประการที่ใช้รูปแบบ XML-like นี้แทนการเรียกใช้เครื่องมือจริงๆ คือ:
</file context>
| สิ่งหนึ่งที่อาจดูแปลกคือเราไม่ได้ใช้ความสามารถในการเรียกใช้ฟังก์ชัน/เครื่องมือ (function calling/tool calling) ของ AI จริงๆ แต่กลับใช้ синтаксис XML-like ที่จำลองการเรียกใช้เครื่องมือแทน นี่เป็นสิ่งที่ผมสังเกตได้จากการศึกษา [system prompts](https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools) ของเครื่องมือสร้างแอปอื่นๆ | |
| สิ่งหนึ่งที่อาจดูแปลกคือเราไม่ได้ใช้ความสามารถในการเรียกใช้ฟังก์ชัน/เครื่องมือ (function calling/tool calling) ของ AI จริงๆ แต่กลับใช้ syntax XML-like ที่จำลองการเรียกใช้เครื่องมือแทน นี่เป็นสิ่งที่ผมสังเกตได้จากการศึกษา [system prompts](https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools) ของเครื่องมือสร้างแอปอื่นๆ |
| /** | ||
| * A hook for running and managing an app. | ||
| * @returns {object} An object with functions to run, stop, and restart an app, and the loading state and app data. | ||
| * @property {boolean} loading - Whether the app is running. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the JSDoc to explain that loading reflects in-flight app actions rather than the app’s running state.
Prompt for AI agents
Address the following comment on src/hooks/useRunApp.ts at line 21:
<comment>Update the JSDoc to explain that `loading` reflects in-flight app actions rather than the app’s running state.</comment>
<file context>
@@ -15,6 +15,16 @@ import { showInputRequest } from "@/lib/toast";
+/**
+ * A hook for running and managing an app.
+ * @returns {object} An object with functions to run, stop, and restart an app, and the loading state and app data.
+ * @property {boolean} loading - Whether the app is running.
+ * @property {(appId: number) => Promise<void>} runApp - A function to run an app.
+ * @property {(appId: number) => Promise<void>} stopApp - A function to stop an app.
</file context>
| * @property {boolean} loading - Whether the app is running. | |
| * @property {boolean} loading - Whether an app action is currently in progress. |
| * @param {(messages: Message[]) => void} options.onUpdate - The callback for stream updates. | ||
| * @param {(response: ChatResponseEnd) => void} options.onEnd - The callback for stream end. | ||
| * @param {(error: string) => void} options.onError - The callback for stream errors. | ||
| * @param {(problems: ChatProblemsEvent) => void} [options.onProblems] - The callback for chat problems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new docstring says onProblems is invoked, but streamMessage never calls that callback—please update the documentation to reflect the current behavior or wire up the handler.
Prompt for AI agents
Address the following comment on src/ipc/ipc_client.ts at line 513:
<comment>The new docstring says onProblems is invoked, but streamMessage never calls that callback—please update the documentation to reflect the current behavior or wire up the handler.</comment>
<file context>
@@ -383,7 +499,19 @@ export class IpcClient {
+ * @param {(messages: Message[]) => void} options.onUpdate - The callback for stream updates.
+ * @param {(response: ChatResponseEnd) => void} options.onEnd - The callback for stream end.
+ * @param {(error: string) => void} options.onError - The callback for stream errors.
+ * @param {(problems: ChatProblemsEvent) => void} [options.onProblems] - The callback for chat problems.
+ */
public streamMessage(
</file context>
| * @param {(problems: ChatProblemsEvent) => void} [options.onProblems] - The callback for chat problems. | |
| * @param {(problems: ChatProblemsEvent) => void} [options.onProblems] - Reserved for future use; currently not invoked. |
|
|
||
| /** | ||
| * A component that displays the chat panel. | ||
| * @param {ChatPanelProps} props - The component props. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSDoc @param tag names a props parameter that does not exist in the destructured ChatPanel signature, leaving the documentation incorrect and potentially confusing.
Prompt for AI agents
Address the following comment on src/components/ChatPanel.tsx at line 33:
<comment>The JSDoc `@param` tag names a `props` parameter that does not exist in the destructured ChatPanel signature, leaving the documentation incorrect and potentially confusing.</comment>
<file context>
@@ -15,12 +15,24 @@ import { ChatError } from "./chat/ChatError";
+/**
+ * A component that displays the chat panel.
+ * @param {ChatPanelProps} props - The component props.
+ * @returns {JSX.Element} The rendered component.
+ */
</file context>
| * @property {App | null | undefined} app - The app data. | ||
| * @property {boolean} loading - Whether the app is being loaded. | ||
| * @property {Error | null} error - The error object if the query fails. | ||
| * @property {() => void} refreshApp - A function to refresh the app. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refreshApp is documented as returning void, but the hook passes through useQuery's refetch, which is asynchronous and resolves to a QueryObserverResult. Please document the actual promise-returning signature to avoid misleading consumers.
Prompt for AI agents
Address the following comment on src/hooks/useLoadApp.ts at line 15:
<comment>`refreshApp` is documented as returning `void`, but the hook passes through `useQuery`'s `refetch`, which is asynchronous and resolves to a `QueryObserverResult`. Please document the actual promise-returning signature to avoid misleading consumers.</comment>
<file context>
@@ -5,6 +5,15 @@ import { useAtom } from "jotai";
+ * @property {App | null | undefined} app - The app data.
+ * @property {boolean} loading - Whether the app is being loaded.
+ * @property {Error | null} error - The error object if the query fails.
+ * @property {() => void} refreshApp - A function to refresh the app.
+ */
export function useLoadApp(appId: number | null) {
</file context>
| * @property {() => void} refreshApp - A function to refresh the app. | |
| * @property {import("@tanstack/react-query").UseQueryResult<App | null, Error>["refetch"]} refreshApp - A function to refresh the app. |
| * @property {boolean} isLoadingUserBudget - Whether the user budget is being loaded. | ||
| * @property {Error | null} userBudgetError - The error object if the query fails. | ||
| * @property {boolean} isFetchingUserBudget - Whether the user budget is being fetched. | ||
| * @property {() => void} refetchUserBudget - A function to refetch the user budget. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documenting refetchUserBudget as returning void is incorrect—React Query’s refetch resolves a promise (UseQueryResult.refetch). Update the JSDoc so consumers know it returns a promise and can await it.
Prompt for AI agents
Address the following comment on src/hooks/useUserBudgetInfo.ts at line 14:
<comment>Documenting refetchUserBudget as returning void is incorrect—React Query’s refetch resolves a promise (UseQueryResult.refetch). Update the JSDoc so consumers know it returns a promise and can await it.</comment>
<file context>
@@ -4,6 +4,15 @@ import type { UserBudgetInfo } from "@/ipc/ipc_types";
+ * @property {boolean} isLoadingUserBudget - Whether the user budget is being loaded.
+ * @property {Error | null} userBudgetError - The error object if the query fails.
+ * @property {boolean} isFetchingUserBudget - Whether the user budget is being fetched.
+ * @property {() => void} refetchUserBudget - A function to refetch the user budget.
+ */
export function useUserBudgetInfo() {
</file context>
| * @property {() => void} refetchUserBudget - A function to refetch the user budget. | |
| * @property {() => Promise<import("@tanstack/react-query").QueryObserverResult<UserBudgetInfo | null, Error>>} refetchUserBudget - A function to refetch the user budget. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
11 issues found across 63 files
Prompt for AI agents (all 11 issues)
Understand the root cause of the following 11 issues and fix them.
<file name="src/components/ChatList.tsx">
<violation number="1" location="src/components/ChatList.tsx:36">
The JSDoc says `show` defaults to true, but the component never sets that default—omitting the prop leaves it undefined and the component short-circuits. Please update the comment to reflect the actual behavior.</violation>
</file>
<file name="src/components/AppList.tsx">
<violation number="1" location="src/components/AppList.tsx:21">
The JSDoc states `[props.show=true]`, but the component defaults `show` to undefined/false, so the documentation is incorrect. Please update the default description to match the real behavior.</violation>
</file>
<file name="README.md">
<violation number="1" location="README.md:31">
The cloned command in the setup instructions omits the repository URL, so developers cannot follow the documented setup steps.</violation>
</file>
<file name="docs/architecture.th.md">
<violation number="1" location="docs/architecture.th.md:27">
Replace the Cyrillic word "синтаксис" with the intended English or Thai word so the sentence is readable.</violation>
<violation number="2" location="docs/architecture.th.md:52">
Update the internal anchor to match the Thai heading so the link resolves correctly.</violation>
</file>
<file name="src/hooks/useVersions.ts">
<violation number="1" location="src/hooks/useVersions.ts:18">
`refreshVersions` is documented as returning void, but `useQuery(...).refetch` actually resolves to a Promise. Update the JSDoc to reflect the async return type so consumers aren’t misled.</violation>
</file>
<file name="src/hooks/useRunApp.ts">
<violation number="1" location="src/hooks/useRunApp.ts:21">
Update the JSDoc to explain that `loading` reflects in-flight app actions rather than the app’s running state.</violation>
</file>
<file name="src/ipc/ipc_client.ts">
<violation number="1" location="src/ipc/ipc_client.ts:513">
The new docstring says onProblems is invoked, but streamMessage never calls that callback—please update the documentation to reflect the current behavior or wire up the handler.</violation>
</file>
<file name="src/components/ChatPanel.tsx">
<violation number="1" location="src/components/ChatPanel.tsx:33">
The JSDoc `@param` tag names a `props` parameter that does not exist in the destructured ChatPanel signature, leaving the documentation incorrect and potentially confusing.</violation>
</file>
<file name="src/hooks/useLoadApp.ts">
<violation number="1" location="src/hooks/useLoadApp.ts:15">
`refreshApp` is documented as returning `void`, but the hook passes through `useQuery`'s `refetch`, which is asynchronous and resolves to a `QueryObserverResult`. Please document the actual promise-returning signature to avoid misleading consumers.</violation>
</file>
<file name="src/hooks/useUserBudgetInfo.ts">
<violation number="1" location="src/hooks/useUserBudgetInfo.ts:14">
Documenting refetchUserBudget as returning void is incorrect—React Query’s refetch resolves a promise (UseQueryResult.refetch). Update the JSDoc so consumers know it returns a promise and can await it.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| /** | ||
| * A component that displays a list of chats. | ||
| * @param {object} props - The component props. | ||
| * @param {boolean} [props.show=true] - Whether to show the component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSDoc says show defaults to true, but the component never sets that default—omitting the prop leaves it undefined and the component short-circuits. Please update the comment to reflect the actual behavior.
Prompt for AI agents
Address the following comment on src/components/ChatList.tsx at line 36:
<comment>The JSDoc says `show` defaults to true, but the component never sets that default—omitting the prop leaves it undefined and the component short-circuits. Please update the comment to reflect the actual behavior.</comment>
<file context>
@@ -30,6 +30,12 @@ import { DeleteChatDialog } from "@/components/chat/DeleteChatDialog";
+/**
+ * A component that displays a list of chats.
+ * @param {object} props - The component props.
+ * @param {boolean} [props.show=true] - Whether to show the component.
+ * @returns {JSX.Element | undefined} The rendered component.
+ */
</file context>
| * @param {boolean} [props.show=true] - Whether to show the component. | |
| * @param {boolean} [props.show] - Whether to show the component. |
| /** | ||
| * A component that displays a list of apps. | ||
| * @param {object} props - The component props. | ||
| * @param {boolean} [props.show=true] - Whether to show the component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSDoc states [props.show=true], but the component defaults show to undefined/false, so the documentation is incorrect. Please update the default description to match the real behavior.
Prompt for AI agents
Address the following comment on src/components/AppList.tsx at line 21:
<comment>The JSDoc states `[props.show=true]`, but the component defaults `show` to undefined/false, so the documentation is incorrect. Please update the default description to match the real behavior.</comment>
<file context>
@@ -15,6 +15,12 @@ import { useMemo, useState } from "react";
+/**
+ * A component that displays a list of apps.
+ * @param {object} props - The component props.
+ * @param {boolean} [props.show=true] - Whether to show the component.
+ * @returns {JSX.Element | null} The rendered component.
+ */
</file context>
| * @param {boolean} [props.show=true] - Whether to show the component. | |
| * @param {boolean} [props.show=false] - Whether to show the component. |
|
|
||
| 1. **Clone the repository**: | ||
| ```bash | ||
| git clone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cloned command in the setup instructions omits the repository URL, so developers cannot follow the documented setup steps.
Prompt for AI agents
Address the following comment on README.md at line 31:
<comment>The cloned command in the setup instructions omits the repository URL, so developers cannot follow the documented setup steps.</comment>
<file context>
@@ -22,6 +22,35 @@ No sign-up required. Just download and go.
+
+1. **Clone the repository**:
+ ```bash
+ git clone
+ cd dyad
+ ```
</file context>
| git clone | |
| git clone https://github.com/dyad-sh/dyad.git |
|
|
||
| อย่างไรก็ตาม ทั้งสองวิธีนี้ต้องการให้ผู้ใช้เลือกไฟล์ที่ถูกต้องด้วยตนเองซึ่งไม่สะดวกเสมอไป ฟีเจอร์ [Smart Context](https://www.dyad.sh/docs/guides/ai-models/pro-modes#smart-context) ของ Dyad โดยพื้นฐานแล้วจะใช้โมเดลขนาดเล็กเพื่อกรองไฟล์ที่สำคัญที่สุดในแชทที่กำหนด อย่างไรก็ตาม เรากำลังทดลองแนวทางใหม่ๆ ในการเลือก context อย่างต่อเนื่อง เนื่องจากเป็นปัญหาที่ค่อนข้างยาก | ||
|
|
||
| แนวทางหนึ่งที่เราไม่ใช้คือสไตล์ agentic ที่เหมือนกับที่ Claude Code และ Cursor ทำ ซึ่งจะค้นหาและนำทางผ่านโค้ดเบสซ้ำๆ โดยใช้ tool calls เหตุผลหลักที่เราไม่ทำเช่นนี้คือเรื่องค่าใช้จ่าย (ดูคำถามด้านบน: [ทำไม Dyad ถึงไม่เป็น Agentic มากกว่านี้](#why-isnt-dyad-more-agentic)) No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the internal anchor to match the Thai heading so the link resolves correctly.
Prompt for AI agents
Address the following comment on docs/architecture.th.md at line 52:
<comment>Update the internal anchor to match the Thai heading so the link resolves correctly.</comment>
<file context>
@@ -0,0 +1,52 @@
+
+อย่างไรก็ตาม ทั้งสองวิธีนี้ต้องการให้ผู้ใช้เลือกไฟล์ที่ถูกต้องด้วยตนเองซึ่งไม่สะดวกเสมอไป ฟีเจอร์ [Smart Context](https://www.dyad.sh/docs/guides/ai-models/pro-modes#smart-context) ของ Dyad โดยพื้นฐานแล้วจะใช้โมเดลขนาดเล็กเพื่อกรองไฟล์ที่สำคัญที่สุดในแชทที่กำหนด อย่างไรก็ตาม เรากำลังทดลองแนวทางใหม่ๆ ในการเลือก context อย่างต่อเนื่อง เนื่องจากเป็นปัญหาที่ค่อนข้างยาก
+
+แนวทางหนึ่งที่เราไม่ใช้คือสไตล์ agentic ที่เหมือนกับที่ Claude Code และ Cursor ทำ ซึ่งจะค้นหาและนำทางผ่านโค้ดเบสซ้ำๆ โดยใช้ tool calls เหตุผลหลักที่เราไม่ทำเช่นนี้คือเรื่องค่าใช้จ่าย (ดูคำถามด้านบน: [ทำไม Dyad ถึงไม่เป็น Agentic มากกว่านี้](#why-isnt-dyad-more-agentic))
\ No newline at end of file
</file context>
| แนวทางหนึ่งที่เราไม่ใช้คือสไตล์ agentic ที่เหมือนกับที่ Claude Code และ Cursor ทำ ซึ่งจะค้นหาและนำทางผ่านโค้ดเบสซ้ำๆ โดยใช้ tool calls เหตุผลหลักที่เราไม่ทำเช่นนี้คือเรื่องค่าใช้จ่าย (ดูคำถามด้านบน: [ทำไม Dyad ถึงไม่เป็น Agentic มากกว่านี้](#why-isnt-dyad-more-agentic)) | |
| แนวทางหนึ่งที่เราไม่ใช้คือสไตล์ agentic ที่เหมือนกับที่ Claude Code และ Cursor ทำ ซึ่งจะค้นหาและนำทางผ่านโค้ดเบสซ้ำๆ โดยใช้ tool calls เหตุผลหลักที่เราไม่ทำเช่นนี้คือเรื่องค่าใช้จ่าย (ดูคำถามด้านบน: [ทำไม Dyad ถึงไม่เป็น Agentic มากกว่านี้](#ทำไม-dyad-ถึงไม่เป็น-agentic-มากกว่านี้)) |
|
|
||
| ### ทำไมไม่ใช้ Tool Calls จริงๆ? | ||
|
|
||
| สิ่งหนึ่งที่อาจดูแปลกคือเราไม่ได้ใช้ความสามารถในการเรียกใช้ฟังก์ชัน/เครื่องมือ (function calling/tool calling) ของ AI จริงๆ แต่กลับใช้ синтаксис XML-like ที่จำลองการเรียกใช้เครื่องมือแทน นี่เป็นสิ่งที่ผมสังเกตได้จากการศึกษา [system prompts](https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools) ของเครื่องมือสร้างแอปอื่นๆ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace the Cyrillic word "синтаксис" with the intended English or Thai word so the sentence is readable.
Prompt for AI agents
Address the following comment on docs/architecture.th.md at line 27:
<comment>Replace the Cyrillic word "синтаксис" with the intended English or Thai word so the sentence is readable.</comment>
<file context>
@@ -0,0 +1,52 @@
+
+### ทำไมไม่ใช้ Tool Calls จริงๆ?
+
+สิ่งหนึ่งที่อาจดูแปลกคือเราไม่ได้ใช้ความสามารถในการเรียกใช้ฟังก์ชัน/เครื่องมือ (function calling/tool calling) ของ AI จริงๆ แต่กลับใช้ синтаксис XML-like ที่จำลองการเรียกใช้เครื่องมือแทน นี่เป็นสิ่งที่ผมสังเกตได้จากการศึกษา [system prompts](https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools) ของเครื่องมือสร้างแอปอื่นๆ
+
+ผมคิดว่าเหตุผลหลักสองประการที่ใช้รูปแบบ XML-like นี้แทนการเรียกใช้เครื่องมือจริงๆ คือ:
</file context>
| สิ่งหนึ่งที่อาจดูแปลกคือเราไม่ได้ใช้ความสามารถในการเรียกใช้ฟังก์ชัน/เครื่องมือ (function calling/tool calling) ของ AI จริงๆ แต่กลับใช้ синтаксис XML-like ที่จำลองการเรียกใช้เครื่องมือแทน นี่เป็นสิ่งที่ผมสังเกตได้จากการศึกษา [system prompts](https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools) ของเครื่องมือสร้างแอปอื่นๆ | |
| สิ่งหนึ่งที่อาจดูแปลกคือเราไม่ได้ใช้ความสามารถในการเรียกใช้ฟังก์ชัน/เครื่องมือ (function calling/tool calling) ของ AI จริงๆ แต่กลับใช้ syntax XML-like ที่จำลองการเรียกใช้เครื่องมือแทน นี่เป็นสิ่งที่ผมสังเกตได้จากการศึกษา [system prompts](https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools) ของเครื่องมือสร้างแอปอื่นๆ |
| /** | ||
| * A hook for running and managing an app. | ||
| * @returns {object} An object with functions to run, stop, and restart an app, and the loading state and app data. | ||
| * @property {boolean} loading - Whether the app is running. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the JSDoc to explain that loading reflects in-flight app actions rather than the app’s running state.
Prompt for AI agents
Address the following comment on src/hooks/useRunApp.ts at line 21:
<comment>Update the JSDoc to explain that `loading` reflects in-flight app actions rather than the app’s running state.</comment>
<file context>
@@ -15,6 +15,16 @@ import { showInputRequest } from "@/lib/toast";
+/**
+ * A hook for running and managing an app.
+ * @returns {object} An object with functions to run, stop, and restart an app, and the loading state and app data.
+ * @property {boolean} loading - Whether the app is running.
+ * @property {(appId: number) => Promise<void>} runApp - A function to run an app.
+ * @property {(appId: number) => Promise<void>} stopApp - A function to stop an app.
</file context>
| * @property {boolean} loading - Whether the app is running. | |
| * @property {boolean} loading - Whether an app action is currently in progress. |
| * @param {(messages: Message[]) => void} options.onUpdate - The callback for stream updates. | ||
| * @param {(response: ChatResponseEnd) => void} options.onEnd - The callback for stream end. | ||
| * @param {(error: string) => void} options.onError - The callback for stream errors. | ||
| * @param {(problems: ChatProblemsEvent) => void} [options.onProblems] - The callback for chat problems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new docstring says onProblems is invoked, but streamMessage never calls that callback—please update the documentation to reflect the current behavior or wire up the handler.
Prompt for AI agents
Address the following comment on src/ipc/ipc_client.ts at line 513:
<comment>The new docstring says onProblems is invoked, but streamMessage never calls that callback—please update the documentation to reflect the current behavior or wire up the handler.</comment>
<file context>
@@ -383,7 +499,19 @@ export class IpcClient {
+ * @param {(messages: Message[]) => void} options.onUpdate - The callback for stream updates.
+ * @param {(response: ChatResponseEnd) => void} options.onEnd - The callback for stream end.
+ * @param {(error: string) => void} options.onError - The callback for stream errors.
+ * @param {(problems: ChatProblemsEvent) => void} [options.onProblems] - The callback for chat problems.
+ */
public streamMessage(
</file context>
| * @param {(problems: ChatProblemsEvent) => void} [options.onProblems] - The callback for chat problems. | |
| * @param {(problems: ChatProblemsEvent) => void} [options.onProblems] - Reserved for future use; currently not invoked. |
|
|
||
| /** | ||
| * A component that displays the chat panel. | ||
| * @param {ChatPanelProps} props - The component props. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSDoc @param tag names a props parameter that does not exist in the destructured ChatPanel signature, leaving the documentation incorrect and potentially confusing.
Prompt for AI agents
Address the following comment on src/components/ChatPanel.tsx at line 33:
<comment>The JSDoc `@param` tag names a `props` parameter that does not exist in the destructured ChatPanel signature, leaving the documentation incorrect and potentially confusing.</comment>
<file context>
@@ -15,12 +15,24 @@ import { ChatError } from "./chat/ChatError";
+/**
+ * A component that displays the chat panel.
+ * @param {ChatPanelProps} props - The component props.
+ * @returns {JSX.Element} The rendered component.
+ */
</file context>
| * @property {App | null | undefined} app - The app data. | ||
| * @property {boolean} loading - Whether the app is being loaded. | ||
| * @property {Error | null} error - The error object if the query fails. | ||
| * @property {() => void} refreshApp - A function to refresh the app. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refreshApp is documented as returning void, but the hook passes through useQuery's refetch, which is asynchronous and resolves to a QueryObserverResult. Please document the actual promise-returning signature to avoid misleading consumers.
Prompt for AI agents
Address the following comment on src/hooks/useLoadApp.ts at line 15:
<comment>`refreshApp` is documented as returning `void`, but the hook passes through `useQuery`'s `refetch`, which is asynchronous and resolves to a `QueryObserverResult`. Please document the actual promise-returning signature to avoid misleading consumers.</comment>
<file context>
@@ -5,6 +5,15 @@ import { useAtom } from "jotai";
+ * @property {App | null | undefined} app - The app data.
+ * @property {boolean} loading - Whether the app is being loaded.
+ * @property {Error | null} error - The error object if the query fails.
+ * @property {() => void} refreshApp - A function to refresh the app.
+ */
export function useLoadApp(appId: number | null) {
</file context>
| * @property {() => void} refreshApp - A function to refresh the app. | |
| * @property {import("@tanstack/react-query").UseQueryResult<App | null, Error>["refetch"]} refreshApp - A function to refresh the app. |
| * @property {boolean} isLoadingUserBudget - Whether the user budget is being loaded. | ||
| * @property {Error | null} userBudgetError - The error object if the query fails. | ||
| * @property {boolean} isFetchingUserBudget - Whether the user budget is being fetched. | ||
| * @property {() => void} refetchUserBudget - A function to refetch the user budget. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documenting refetchUserBudget as returning void is incorrect—React Query’s refetch resolves a promise (UseQueryResult.refetch). Update the JSDoc so consumers know it returns a promise and can await it.
Prompt for AI agents
Address the following comment on src/hooks/useUserBudgetInfo.ts at line 14:
<comment>Documenting refetchUserBudget as returning void is incorrect—React Query’s refetch resolves a promise (UseQueryResult.refetch). Update the JSDoc so consumers know it returns a promise and can await it.</comment>
<file context>
@@ -4,6 +4,15 @@ import type { UserBudgetInfo } from "@/ipc/ipc_types";
+ * @property {boolean} isLoadingUserBudget - Whether the user budget is being loaded.
+ * @property {Error | null} userBudgetError - The error object if the query fails.
+ * @property {boolean} isFetchingUserBudget - Whether the user budget is being fetched.
+ * @property {() => void} refetchUserBudget - A function to refetch the user budget.
+ */
export function useUserBudgetInfo() {
</file context>
| * @property {() => void} refetchUserBudget - A function to refetch the user budget. | |
| * @property {() => Promise<import("@tanstack/react-query").QueryObserverResult<UserBudgetInfo | null, Error>>} refetchUserBudget - A function to refetch the user budget. |
|
hi @billlzzz10 - the JS docs IMO, don't add a lot of value and are quite noisy. For the thailand docs, b/c I'm not able to review them to ensure accuracy/consistency, I think they are best kept in your own fork (and not in the main repo) |
Summary by cubic
Adds full developer documentation and JSDoc across the codebase to improve onboarding and maintainability. Also adds Thai-language docs and setup/usage steps in the README; no functional changes intended.
New Features
Refactors
Written for commit 4fa367e. Summary will update automatically on new commits.