feat: Expand documentation with tutorials, guides, and API references#136
feat: Expand documentation with tutorials, guides, and API references#136caxtonacollins wants to merge 1 commit intonexoraorg:mainfrom
Conversation
📝 WalkthroughWalkthroughIntroduces comprehensive documentation infrastructure for ChenAIKit, including API references, architecture decision records (ADRs), tutorials, guides, and a Docusaurus-based website. Adds monorepo, blockchain, and SDK design documentation, along with troubleshooting guides, FAQs, security guidelines, and deployment tutorials. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@gelluisaac please review |
There was a problem hiding this comment.
Actionable comments posted: 15
🧹 Nitpick comments (16)
website/docs/tutorials/first-credit-score.md (1)
119-135: Add language specifier to the expected output code block.The console output example lacks a language identifier for consistent rendering.
📝 Proposed fix
-``` +```text 🔗 Connecting to Stellar testnet... 📊 Fetching account data for GABC...🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@website/docs/tutorials/first-credit-score.md` around lines 119 - 135, The console output example block is missing a language specifier; update the triple-backtick fence that wraps the console output starting with "🔗 Connecting to Stellar testnet..." (the block that shows "✅ Credit Score: 750/1000" and the score factors) to use a text language tag by replacing ``` with ```text so the example renders consistently as plain text.website/README.md (1)
67-80: Add language specifier to the fenced code block.The directory structure code block lacks a language identifier, which may affect rendering in some Markdown processors.
📝 Proposed fix
-``` +```text docs/ ├── getting-started.md ├── tutorials/🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@website/README.md` around lines 67 - 80, Update the fenced code block that documents the directory tree in README.md to include a language specifier (e.g., "text") so Markdown processors render it correctly; locate the triple-backtick block that begins with the docs/ tree (the directory structure snippet) and change the opening fence from ``` to ```text (or another appropriate language) to fix rendering.website/docusaurus.config.ts (1)
140-147: Reminder: Replace Algolia placeholder credentials before enabling search.The Algolia configuration contains placeholder values (
YOUR_APP_ID,YOUR_SEARCH_API_KEY). While documented in README.md, leaving these in production could cause search functionality to fail silently or throw errors.Consider either:
- Commenting out the
algoliaconfig until credentials are obtained- Adding a build-time check or environment variable fallback
📝 Option: Use environment variables with validation
algolia: { - appId: 'YOUR_APP_ID', - apiKey: 'YOUR_SEARCH_API_KEY', + appId: process.env.ALGOLIA_APP_ID || 'YOUR_APP_ID', + apiKey: process.env.ALGOLIA_SEARCH_API_KEY || 'YOUR_SEARCH_API_KEY', indexName: 'chenaikit', contextualSearch: true, searchParameters: {}, searchPagePath: 'search', },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@website/docusaurus.config.ts` around lines 140 - 147, The Algolia config block (algolia with appId, apiKey, indexName in docusaurus.config.ts) still contains placeholder credentials; replace it by reading from environment variables (e.g., process.env.ALGOLIA_APP_ID / ALGOLIA_API_KEY / ALGOLIA_INDEX_NAME) and add a validation/check at build time that either (a) conditionally omits or comments out the algolia object when required env vars are missing, or (b) fails the build with a clear error/log message if search is enabled but credentials are absent; ensure the code references the existing algolia config object so the site only uses Algolia when valid credentials are provided.website/docs/tutorials/deploying-contracts.md (3)
169-173: Add language identifier to deployment output code block.The contract deployment output should have a language identifier.
📝 Suggested fix
Save the contract ID from the output: -``` +```text Contract deployed successfully! Contract ID: CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM</details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against the current code and only fix it if needed.
In
@website/docs/tutorials/deploying-contracts.mdaround lines 169 - 173, Update
the Markdown code block that shows the deployment output so it includes a
language identifier (use "text") after the opening backticks; locate the block
containing the lines "Contract deployed successfully!" and "Contract ID:
CAAAAAAAA..." and change the openingtotext to ensure proper syntax
highlighting and clarity.</details> --- `96-99`: **Add language identifier to output code block.** The WASM file path output should have a language identifier for consistent rendering. <details> <summary>📝 Suggested fix</summary> ```diff The compiled WASM file will be at: -``` +```text target/wasm32-unknown-unknown/release/credit_score.wasm ``` ``` </details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against the current code and only fix it if needed.
In
@website/docs/tutorials/deploying-contracts.mdaround lines 96 - 99, The
markdown code block showing the compiled WASM path lacks a language identifier;
update the fenced code block that contains
"target/wasm32-unknown-unknown/release/credit_score.wasm" to use a language tag
(e.g., addtext before the path and close with) so the snippet is
rendered consistently.</details> --- `139-152`: **Add language identifier to test output code block.** The expected test output should have a language identifier. <details> <summary>📝 Suggested fix</summary> ```diff Expected output: -``` +```text running 8 tests test test::test_calculate_and_get_score ... ok ``` </details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against the current code and only fix it if needed.
In
@website/docs/tutorials/deploying-contracts.mdaround lines 139 - 152, The
fenced code block showing the expected test output is missing a language
identifier; update the markdown in the test output block (the triple-backtick
block that begins the expected output) to include a language tag such as "text"
(e.g.,text) so the test output renders correctly—locate the expected output block in the docs and prefix the openingwith the language identifier.</details> </blockquote></details> <details> <summary>website/docs/architecture/adrs/003-typescript-sdk-design.md (1)</summary><blockquote> `17-27`: **Add language identifier to directory structure code block.** Same fix as the docs/ version - the SDK structure diagram needs a language identifier. <details> <summary>📝 Suggested fix</summary> ```diff ### SDK Structure -``` +```text `@chenaikit/core/` ├── src/ ``` </details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against the current code and only fix it if needed.
In
@website/docs/architecture/adrs/003-typescript-sdk-design.mdaround lines 17
- 27, The SDK structure code block under the "SDK Structure" heading is missing
a language identifier; update the fenced code block that starts with
"@chenaikit/core/" to include a language tag (use "text") after the opening
triple backticks so the directory diagram is rendered correctly (i.e., change
totext for the block containing the@chenaikit/core/tree).</details> </blockquote></details> <details> <summary>docs/architecture/adrs/003-typescript-sdk-design.md (1)</summary><blockquote> `17-27`: **Add language identifier to directory structure code block.** The SDK structure diagram should have a language identifier for consistent markdown rendering. <details> <summary>📝 Suggested fix</summary> ```diff ### SDK Structure -``` +```text `@chenaikit/core/` ├── src/ ``` </details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against the current code and only fix it if needed.
In
@docs/architecture/adrs/003-typescript-sdk-design.mdaround lines 17 - 27,
The code block showing the SDK directory structure (the triple-backtick block
that begins with "@chenaikit/core/") lacks a language identifier; update the
markdown by adding a language tag (e.g., "text") immediately after the opening
so the directory tree is rendered consistently (changeto ```text for
the SDK Structure code block).</details> </blockquote></details> <details> <summary>website/docs/architecture/adrs/001-monorepo-structure.md (1)</summary><blockquote> `19-30`: **Add language identifier to fenced code block.** The directory tree structure should have a language identifier for consistent rendering. Use `text` or `plaintext` for non-code content. <details> <summary>📝 Suggested fix</summary> ```diff ### Repository Structure -``` +```text chenaikit/ ├── packages/ ``` </details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against the current code and only fix it if needed.
In
@website/docs/architecture/adrs/001-monorepo-structure.mdaround lines 19 -
30, The fenced code block that renders the directory tree (starting with the
line containing "chenaikit/") is missing a language identifier; update the
opening triple-backtick to include a plaintext identifier (e.g., ```text orlines with chenaikit/, packages/, core/, cli/, etc.) unchanged.website/docs/troubleshooting.md (1)
769-799: Security guidance for exposed secrets is critical and well-documented.The instructions for removing secrets from git history and rotating credentials are essential. Consider also mentioning
git-filter-repoas a modern alternative togit filter-branch, which is now deprecated.📝 Consider adding git-filter-repo alternative
### Exposed secrets **Problem:** Secrets committed to git **Solutions:** ```bash -# 1. Remove from git history +# 1. Remove from git history (using git-filter-repo - recommended) +git filter-repo --path .env --invert-paths + +# Or using git filter-branch (deprecated but still works) git filter-branch --force --index-filter \ "git rm --cached --ignore-unmatch .env" \ --prune-empty --tag-name-filter cat -- --all🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@website/docs/troubleshooting.md` around lines 769 - 799, Update the "Exposed secrets" section to recommend git-filter-repo as the modern alternative to git filter-branch: add a note under the "Remove from git history" step explaining to prefer git-filter-repo and include the equivalent git-filter-repo invocation as the recommended command, while keeping the existing git filter-branch example as a deprecated fallback; reference the "Exposed secrets" header and the existing git filter-branch snippet so reviewers can locate and replace/augment that block.docs/architecture/adrs/001-monorepo-structure.md (2)
19-30: Add language identifier to fenced code block.The directory tree structure should have a language identifier.
📝 Suggested fix
### Repository Structure -``` +```text chenaikit/ ├── packages/🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/architecture/adrs/001-monorepo-structure.md` around lines 19 - 30, Update the fenced code block containing the repository tree in docs/architecture/adrs/001-monorepo-structure.md to include a language identifier (e.g., change the opening ``` to ```text) so the directory tree is rendered with proper formatting; locate the fenced block that starts with the repository tree "chenaikit/" and add "text" (or another appropriate identifier) after the opening backticks.
1-118: Consider consolidating with website/docs/ version.Similar to ADR 003, this file appears to duplicate
website/docs/architecture/adrs/001-monorepo-structure.md. Consider establishing a single source of truth for ADRs to reduce maintenance overhead.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/architecture/adrs/001-monorepo-structure.md` around lines 1 - 118, This ADR duplicates the existing ADR titled "ADR 001: Monorepo Structure with pnpm Workspaces" (see ADR 003 reference), so consolidate to a single source of truth: pick the canonical ADR (the existing ADR 001), remove this duplicate file or replace it with a short redirect/metadata file pointing to the canonical ADR, update any docs index or TOC entries to reference only the canonical ADR, and add a brief metadata note in the canonical ADR indicating its canonical status so future duplicates are avoided; locate the content using the ADR title "ADR 001: Monorepo Structure with pnpm Workspaces" and ADR reference "ADR 003" to apply these changes.website/docs/api-reference.md (1)
1-50: Document theinvokeContractmethod if it exists, or note TODO status.The
StellarConnectorsection should clarify that some methods are still under development (TODO status visible in context snippets). Consider adding a note about the implementation status to set correct expectations for developers.📝 Suggested addition
### StellarConnector Main class for interacting with Stellar network. +> **Note:** Some methods are currently under active development. See [Issue `#24`](https://github.com/nexoraorg/chenaikit/issues/24) for implementation status. + #### Constructor🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@website/docs/api-reference.md` around lines 1 - 50, The StellarConnector docs are missing documentation for invokeContract and lack implementation status notes; update the API reference to either (1) add a clear entry for StellarConnector.invokeContract(signature: string, params: Record<string, any>) -> Promise<any> describing parameters, return type, and behavior if the method exists, or (2) add a TODO/Status note under the StellarConnector section stating which methods (e.g., invokeContract) are not yet implemented and expected timelines or links to the implementation issue; ensure you reference the class name StellarConnector and the method name invokeContract so readers can locate the code.docs/troubleshooting.md (2)
82-83:windows-build-toolsis deprecated.The
windows-build-toolsnpm package has been deprecated. For modern Windows development, users should install Visual Studio Build Tools directly or use the Visual Studio Installer to add the "Desktop development with C++" workload.📝 Proposed fix
# Install build tools (Windows) -npm install --global windows-build-tools +# Install Visual Studio Build Tools from: +# https://visualstudio.microsoft.com/visual-cpp-build-tools/ +# Or use winget: +winget install Microsoft.VisualStudio.2022.BuildTools🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/troubleshooting.md` around lines 82 - 83, Replace the deprecated npm command under the "Install build tools (Windows)" section: remove the use of `npm install --global windows-build-tools` and instead instruct users to install Visual Studio Build Tools or use the Visual Studio Installer to add the "Desktop development with C++" workload; update the heading content to mention Visual Studio Build Tools and include brief steps to open the Visual Studio Installer or download the Build Tools executable and select the C++ workload for native build support.
271-288: Use TOML language specifier for Cargo.toml content.The code block starting at line 276 contains TOML configuration but is inside a bash code block. This affects syntax highlighting and could confuse readers.
📝 Proposed fix
Split into separate code blocks:
```bash # 1. Use release profile cargo build --target wasm32-unknown-unknown --release +``` -# 2. Check Cargo.toml optimization settings +# 2. Check Cargo.toml optimization settings: + +```toml [profile.release] opt-level = "z" lto = true codegen-units = 1 strip = "symbols" +``` +```bash # 3. Use soroban optimize🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/troubleshooting.md` around lines 271 - 288, The bash code block mixes shell commands with Cargo.toml content; split the example into three blocks so the TOML snippet uses proper syntax highlighting: keep the first block as bash containing the cargo build command ("cargo build --target wasm32-unknown-unknown --release"), then add a separate ```toml block for the [profile.release] settings (opt-level, lto, codegen-units, strip) labeled as Cargo.toml content, and finally reopen a bash block for the soroban optimize command ("soroban contract optimize ...") and the ls check; ensure the Cargo.toml fragment is fenced with ```toml and the surrounding commands remain in ```bash.docs/tutorials/deploying-contracts.md (1)
97-99: Add language specifiers to fenced code blocks.Several code blocks are missing language specifiers, which affects syntax highlighting and accessibility. Add
textorplaintextfor output blocks.📝 Proposed fix
Line 97:
-``` +```text target/wasm32-unknown-unknown/release/credit_score.wasmLine 140:
-``` +```text running 8 testsLine 170:
-``` +```text Contract deployed successfully!Also applies to: 140-152, 170-173
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/tutorials/deploying-contracts.md` around lines 97 - 99, Add language specifiers to the plain fenced code blocks by replacing the opening ``` with ```text (or ```plaintext) for each output block shown (e.g., the blocks containing "target/wasm32-unknown-unknown/release/credit_score.wasm", "running 8 tests", and "Contract deployed successfully!"); update each of those fenced blocks so the first line is ```text to enable proper syntax highlighting and accessibility.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/architecture/adrs/002-stellar-soroban-blockchain.md`:
- Around line 114-128: The docs example incorrectly calls
StellarConnector.invokeContract which doesn't exist; update the snippet to use
the actual API (StellarConnector.getAccount and
StellarConnector.submitTransaction, and optionally
StellarConnector.getFee/getNetworkPassphrase) or explicitly mark invokeContract
as a planned/future API. Replace the invokeContract call with a brief example
that retrieves an account via getAccount and submits a transaction via
submitTransaction (using getFee/getNetworkPassphrase as needed), and/or add a
short note that invokeContract is not implemented in StellarConnector yet and
will be provided in a future release.
In `@docs/faq.md`:
- Around line 348-361: The example uses APIs that currently throw "Not
implemented yet" — update the docs to either mark StellarConnector and AIService
usage as WIP or adjust the example to avoid calling unimplemented methods: add a
short note after the code block stating that StellarConnector.getAccount and
AIService.calculateCreditScore are work-in-progress (reference Issue `#24` and
`#25`), or replace the calls with a mocked/example response so the snippet is
runnable; ensure you mention the exact symbols StellarConnector, getAccount,
AIService, and calculateCreditScore so readers know which APIs are incomplete.
In `@docs/tutorials/deploying-contracts.md`:
- Around line 385-390: The "Next Steps" links in the Next Steps section of the
deploying-contracts.md doc reference three missing files
(../architecture/contracts.md, ./api-integration.md, ./testing-contracts.md);
either create those three docs with the expected content under the appropriate
docs directories (implement pages for contract architecture, API integration,
and testing contracts) or update the links in the Next Steps block in
deploying-contracts.md to point to existing pages or remove the broken entries.
Locate the Next Steps block in deploying-contracts.md and fix the three link
targets (../architecture/contracts.md, ./api-integration.md,
./testing-contracts.md) accordingly so no broken links remain.
In `@docs/tutorials/first-credit-score.md`:
- Around line 172-175: Remove or replace the broken "Architecture Overview"
reference: locate the line containing the markdown link text "Architecture
Overview" that points to "../architecture/overview.md" and either delete that
entire list item or update the href to the correct existing documentation
location (or to a placeholder like "#") so the references list contains only
valid links (ensure the surrounding items "[API Reference]" and "[Examples]"
remain unchanged).
- Around line 75-91: The tutorial calls ai.getScoreFactors(account) but
AIService only exposes calculateCreditScore and detectFraud; move the
score-factor call to the class that implements it by replacing that call with
using CreditScorer.getScoreFactors (e.g., instantiate CreditScorer with the same
dependencies used to create AIService and call
creditScorer.getScoreFactors(account)), or alternatively add a
getScoreFactors(account) wrapper to AIService that delegates to CreditScorer;
update the code references to use CreditScorer.getScoreFactors (or
AIService.getScoreFactors if you add the wrapper) and remove the nonexistent
ai.getScoreFactors call to avoid the TypeError.
In `@website/docs/api-reference.md`:
- Around line 32-49: The API docs list non-existent StellarConnector methods
getAccountBalances and getAccountTransactions; remove those entries and instead
document the actual implemented methods: getAccount(accountId: string),
submitTransaction(txXdr: string), getFee(): Promise<number>, and
getNetworkPassphrase(): string (or the exact signatures found in
packages/core/src/stellar/connector.ts). Update the section headings/parameter
lists to match the real method names and signatures, remove any references to
the removed methods, and ensure return types and default values match the
connector.ts implementation so the docs and code stay in sync.
In `@website/docs/api/core-sdk.md`:
- Around line 156-253: The docs currently describe AIService methods as fully
functional while calculateCreditScore and detectFraud are unimplemented and
throw "Not implemented yet"; update the API docs for AIService to clearly mark
calculateCreditScore(accountData: AccountData) and detectFraud(transactionData:
TransactionData) as "Not implemented / experimental" (or add a short note and
link to the related issues `#25` and `#28`) OR implement those methods in AIService
so they no longer throw, then update examples and return/value descriptions
accordingly; reference the AIService class and the calculateCreditScore and
detectFraud method signatures when making the change.
- Around line 37-51: Docs list a timeout option that doesn't exist in the
StellarConfig type; add an optional timeout property to the config interface and
propagate it into the connector. Update the StellarConfig interface
(packages/core/src/stellar/types.ts) to include timeout?: number, then ensure
the StellarConnector constructor and any places that build HTTP/Horizon clients
consume this config (use the default 30000 if undefined) so the documented
option is respected.
- Around line 76-136: The docs list methods that don't exist on StellarConnector
(getAccountBalances, getAccountTransactions, invokeContract) while the class
only exposes getAccount, submitTransaction, getFee, and getNetworkPassphrase and
those methods are still TODO/unimplemented; fix by syncing docs with the
implementation: either (A) update core-sdk.md to document only getAccount,
submitTransaction, getFee, getNetworkPassphrase and mark any unimplemented
behavior clearly as "Not implemented / Planned" with no misleading examples, or
(B) implement the missing methods in StellarConnector (add getAccountBalances,
getAccountTransactions, invokeContract with real implementations or proper stubs
that reject with clear errors and remove the TODO throws) and then add matching
examples in the docs; ensure function names (StellarConnector.getAccount,
.submitTransaction, .getFee, .getNetworkPassphrase, .getAccountBalances,
.getAccountTransactions, .invokeContract) are referenced correctly and examples
reflect implemented behavior.
- Around line 779-820: The docs reference a non-existent ChenAIKitError class;
fix by either (A) adding and exporting a ChenAIKitError implementation that
extends Error (include constructor(message:string, code:string, details?:any)
and set this.name='ChenAIKitError') and export it from the core package
entrypoint so consumers can use instanceof ChenAIKitError, or (B) update the
documentation to stop using ChenAIKitError and instead show the actual error
types used (e.g., Error or existing AIModelError / GovernanceError) and change
the example instanceof checks and example text accordingly; locate usages by
searching for "ChenAIKitError", "AIModelError", and the core package entry
export to make the change.
In `@website/docs/architecture/adrs/003-typescript-sdk-design.md`:
- Around line 1-369: There are duplicate ADR docs in the repository root docs/
that are unused—remove the root docs/ folder and consolidate documentation under
website/docs/ (specifically keep website/docs/architecture/adrs/); delete the
entire root docs/ directory, run a repo-wide search for any references to
"docs/" (e.g., in Docusaurus config, package.json scripts, CI workflows) and
update them to "website/docs/" or remove them if obsolete, and verify the site
build/local dev (Docusaurus) still works using the website/docs source as the
single source of truth.
In `@website/docs/getting-started.md`:
- Around line 36-76: The Quick Start uses unimplemented methods
(StellarConnector.getAccount, AIService.calculateCreditScore,
AIService.detectFraud) and an undefined variable (transactionData); update the
docs to avoid runtime errors by adding a prominent notice that the SDK is under
development and the shown calls are placeholders, replace live calls with
mocked/example data and/or pseudo-responses for getAccount, calculateCreditScore
and detectFraud, and include a short note showing how to construct or obtain
transactionData (e.g., example JSON or a mocked transaction object) so readers
can copy a working example without invoking unimplemented methods.
In `@website/docs/tutorials/deploying-contracts.md`:
- Around line 385-391: The "Next Steps" section contains three broken links
(../architecture/contracts.md, ./api-integration.md, ./testing-contracts.md) and
one valid link (../../contracts/audit-report.md); either remove the three broken
entries from the Next Steps list or replace them with valid existing docs, or
add the missing files to the docs tree with the expected paths and content;
update the file that defines the Next Steps section (the block containing
"Contract Architecture", "API Integration", "Testing Guide", "Security Audit")
so only existing links remain or new files are created to match those link
paths.
In `@website/sidebars.ts`:
- Around line 3-85: The sidebar configuration in the sidebars object
(tutorialSidebar) references 16 document IDs that don't exist and will break the
build; fix by either creating the missing markdown files under docs with the
exact IDs listed (installation.md, quick-start.md,
tutorials/building-dashboard.md, tutorials/fraud-detection.md,
concepts/credit-scoring.md, concepts/fraud-detection.md,
concepts/smart-contracts.md, concepts/transaction-monitoring.md,
api/backend-api.md, api/smart-contracts.md, architecture/overview.md,
guides/deployment.md, guides/testing.md, guides/security.md,
guides/performance.md, contributing.md) or remove those specific string entries
from the items arrays in the tutorialSidebar (or replace them with existing doc
IDs) so that sidebars -> tutorialSidebar contains only IDs that actually exist.
In `@website/src/pages/index.tsx`:
- Line 76: The Home component's return annotation uses JSX.Element but the
project lacks the JSX namespace types; either add `@types/react` to
devDependencies and run install so TypeScript recognizes JSX.Element, or change
the Home function signature from "export default function Home(): JSX.Element"
to use the React namespace like "React.JSX.Element"; update the Home declaration
accordingly (symbol: Home) and ensure tsconfig/react settings remain compatible.
---
Nitpick comments:
In `@docs/architecture/adrs/001-monorepo-structure.md`:
- Around line 19-30: Update the fenced code block containing the repository tree
in docs/architecture/adrs/001-monorepo-structure.md to include a language
identifier (e.g., change the opening ``` to ```text) so the directory tree is
rendered with proper formatting; locate the fenced block that starts with the
repository tree "chenaikit/" and add "text" (or another appropriate identifier)
after the opening backticks.
- Around line 1-118: This ADR duplicates the existing ADR titled "ADR 001:
Monorepo Structure with pnpm Workspaces" (see ADR 003 reference), so consolidate
to a single source of truth: pick the canonical ADR (the existing ADR 001),
remove this duplicate file or replace it with a short redirect/metadata file
pointing to the canonical ADR, update any docs index or TOC entries to reference
only the canonical ADR, and add a brief metadata note in the canonical ADR
indicating its canonical status so future duplicates are avoided; locate the
content using the ADR title "ADR 001: Monorepo Structure with pnpm Workspaces"
and ADR reference "ADR 003" to apply these changes.
In `@docs/architecture/adrs/003-typescript-sdk-design.md`:
- Around line 17-27: The code block showing the SDK directory structure (the
triple-backtick block that begins with "@chenaikit/core/") lacks a language
identifier; update the markdown by adding a language tag (e.g., "text")
immediately after the opening ``` so the directory tree is rendered consistently
(change ``` to ```text for the SDK Structure code block).
In `@docs/troubleshooting.md`:
- Around line 82-83: Replace the deprecated npm command under the "Install build
tools (Windows)" section: remove the use of `npm install --global
windows-build-tools` and instead instruct users to install Visual Studio Build
Tools or use the Visual Studio Installer to add the "Desktop development with
C++" workload; update the heading content to mention Visual Studio Build Tools
and include brief steps to open the Visual Studio Installer or download the
Build Tools executable and select the C++ workload for native build support.
- Around line 271-288: The bash code block mixes shell commands with Cargo.toml
content; split the example into three blocks so the TOML snippet uses proper
syntax highlighting: keep the first block as bash containing the cargo build
command ("cargo build --target wasm32-unknown-unknown --release"), then add a
separate ```toml block for the [profile.release] settings (opt-level, lto,
codegen-units, strip) labeled as Cargo.toml content, and finally reopen a bash
block for the soroban optimize command ("soroban contract optimize ...") and the
ls check; ensure the Cargo.toml fragment is fenced with ```toml and the
surrounding commands remain in ```bash.
In `@docs/tutorials/deploying-contracts.md`:
- Around line 97-99: Add language specifiers to the plain fenced code blocks by
replacing the opening ``` with ```text (or ```plaintext) for each output block
shown (e.g., the blocks containing
"target/wasm32-unknown-unknown/release/credit_score.wasm", "running 8 tests",
and "Contract deployed successfully!"); update each of those fenced blocks so
the first line is ```text to enable proper syntax highlighting and
accessibility.
In `@website/docs/api-reference.md`:
- Around line 1-50: The StellarConnector docs are missing documentation for
invokeContract and lack implementation status notes; update the API reference to
either (1) add a clear entry for StellarConnector.invokeContract(signature:
string, params: Record<string, any>) -> Promise<any> describing parameters,
return type, and behavior if the method exists, or (2) add a TODO/Status note
under the StellarConnector section stating which methods (e.g., invokeContract)
are not yet implemented and expected timelines or links to the implementation
issue; ensure you reference the class name StellarConnector and the method name
invokeContract so readers can locate the code.
In `@website/docs/architecture/adrs/001-monorepo-structure.md`:
- Around line 19-30: The fenced code block that renders the directory tree
(starting with the line containing "chenaikit/") is missing a language
identifier; update the opening triple-backtick to include a plaintext identifier
(e.g., ```text or ```plaintext) so the tree renders consistently, leaving the
block contents (the lines with chenaikit/, packages/, core/, cli/, etc.)
unchanged.
In `@website/docs/architecture/adrs/003-typescript-sdk-design.md`:
- Around line 17-27: The SDK structure code block under the "SDK Structure"
heading is missing a language identifier; update the fenced code block that
starts with "@chenaikit/core/" to include a language tag (use "text") after the
opening triple backticks so the directory diagram is rendered correctly (i.e.,
change ``` to ```text for the block containing the `@chenaikit/core/` tree).
In `@website/docs/troubleshooting.md`:
- Around line 769-799: Update the "Exposed secrets" section to recommend
git-filter-repo as the modern alternative to git filter-branch: add a note under
the "Remove from git history" step explaining to prefer git-filter-repo and
include the equivalent git-filter-repo invocation as the recommended command,
while keeping the existing git filter-branch example as a deprecated fallback;
reference the "Exposed secrets" header and the existing git filter-branch
snippet so reviewers can locate and replace/augment that block.
In `@website/docs/tutorials/deploying-contracts.md`:
- Around line 169-173: Update the Markdown code block that shows the deployment
output so it includes a language identifier (use "text") after the opening
backticks; locate the block containing the lines "Contract deployed
successfully!" and "Contract ID: CAAAAAAAA..." and change the opening ``` to
```text to ensure proper syntax highlighting and clarity.
- Around line 96-99: The markdown code block showing the compiled WASM path
lacks a language identifier; update the fenced code block that contains
"target/wasm32-unknown-unknown/release/credit_score.wasm" to use a language tag
(e.g., add ```text before the path and close with ``` ) so the snippet is
rendered consistently.
- Around line 139-152: The fenced code block showing the expected test output is
missing a language identifier; update the markdown in the test output block (the
triple-backtick block that begins the expected output) to include a language tag
such as "text" (e.g., ```text) so the test output renders correctly—locate the
expected output block in the docs and prefix the opening ``` with the language
identifier.
In `@website/docs/tutorials/first-credit-score.md`:
- Around line 119-135: The console output example block is missing a language
specifier; update the triple-backtick fence that wraps the console output
starting with "🔗 Connecting to Stellar testnet..." (the block that shows "✅
Credit Score: 750/1000" and the score factors) to use a text language tag by
replacing ``` with ```text so the example renders consistently as plain text.
In `@website/docusaurus.config.ts`:
- Around line 140-147: The Algolia config block (algolia with appId, apiKey,
indexName in docusaurus.config.ts) still contains placeholder credentials;
replace it by reading from environment variables (e.g.,
process.env.ALGOLIA_APP_ID / ALGOLIA_API_KEY / ALGOLIA_INDEX_NAME) and add a
validation/check at build time that either (a) conditionally omits or comments
out the algolia object when required env vars are missing, or (b) fails the
build with a clear error/log message if search is enabled but credentials are
absent; ensure the code references the existing algolia config object so the
site only uses Algolia when valid credentials are provided.
In `@website/README.md`:
- Around line 67-80: Update the fenced code block that documents the directory
tree in README.md to include a language specifier (e.g., "text") so Markdown
processors render it correctly; locate the triple-backtick block that begins
with the docs/ tree (the directory structure snippet) and change the opening
fence from ``` to ```text (or another appropriate language) to fix rendering.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7fc1e02b-5ba1-49a4-aaa8-5656d676a17b
📒 Files selected for processing (29)
docs/api/core-sdk.mddocs/architecture/adrs/001-monorepo-structure.mddocs/architecture/adrs/002-stellar-soroban-blockchain.mddocs/architecture/adrs/003-typescript-sdk-design.mddocs/faq.mddocs/troubleshooting.mddocs/tutorials/deploying-contracts.mddocs/tutorials/first-credit-score.mdwebsite/.gitignorewebsite/README.mdwebsite/docs/api-reference.mdwebsite/docs/api/core-sdk.mdwebsite/docs/architecture/adrs/001-monorepo-structure.mdwebsite/docs/architecture/adrs/002-stellar-soroban-blockchain.mdwebsite/docs/architecture/adrs/003-typescript-sdk-design.mdwebsite/docs/faq.mdwebsite/docs/form-validation.mdwebsite/docs/getting-started.mdwebsite/docs/security-guidelines.mdwebsite/docs/troubleshooting.mdwebsite/docs/tutorials/deploying-contracts.mdwebsite/docs/tutorials/first-credit-score.mdwebsite/docusaurus.config.tswebsite/package.jsonwebsite/sidebars.tswebsite/src/css/custom.csswebsite/src/pages/index.module.csswebsite/src/pages/index.tsxwebsite/tsconfig.json
| ```typescript | ||
| import { StellarConnector } from '@chenaikit/core'; | ||
|
|
||
| const stellar = new StellarConnector({ | ||
| network: 'mainnet', | ||
| horizonUrl: 'https://horizon.stellar.org' | ||
| }); | ||
|
|
||
| // Interact with contracts | ||
| const score = await stellar.invokeContract( | ||
| contractId, | ||
| 'calculate_score', | ||
| [accountAddress] | ||
| ); | ||
| ``` |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify StellarConnector methods in actual implementation
ast-grep --pattern 'class StellarConnector {
$$$
}'Repository: nexoraorg/chenaikit
Length of output: 2010
Remove or clarify the invokeContract example — it does not exist in the current StellarConnector implementation.
The code snippet calls stellar.invokeContract(), but the actual StellarConnector class in packages/core/src/stellar/connector.ts only provides getAccount, submitTransaction, getFee, and getNetworkPassphrase. Update the example to use available methods, add a note explaining this is planned API for a future release, or implement the missing method before merge.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/architecture/adrs/002-stellar-soroban-blockchain.md` around lines 114 -
128, The docs example incorrectly calls StellarConnector.invokeContract which
doesn't exist; update the snippet to use the actual API
(StellarConnector.getAccount and StellarConnector.submitTransaction, and
optionally StellarConnector.getFee/getNetworkPassphrase) or explicitly mark
invokeContract as a planned/future API. Replace the invokeContract call with a
brief example that retrieves an account via getAccount and submits a transaction
via submitTransaction (using getFee/getNetworkPassphrase as needed), and/or add
a short note that invokeContract is not implemented in StellarConnector yet and
will be provided in a future release.
| ```typescript | ||
| // Express.js example | ||
| import { StellarConnector, AIService } from '@chenaikit/core'; | ||
|
|
||
| app.get('/api/credit-score/:accountId', async (req, res) => { | ||
| const stellar = new StellarConnector({ network: 'mainnet' }); | ||
| const ai = new AIService({ apiKey: process.env.AI_API_KEY }); | ||
|
|
||
| const account = await stellar.getAccount(req.params.accountId); | ||
| const score = await ai.calculateCreditScore(account); | ||
|
|
||
| res.json({ score }); | ||
| }); | ||
| ``` |
There was a problem hiding this comment.
Code example uses unimplemented methods.
The stellar.getAccount() and ai.calculateCreditScore() methods shown in this example currently throw "Not implemented yet" errors (see Issue #24 and #25). Consider adding a note indicating these APIs are work-in-progress, or ensure the methods are implemented before publishing this documentation.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/faq.md` around lines 348 - 361, The example uses APIs that currently
throw "Not implemented yet" — update the docs to either mark StellarConnector
and AIService usage as WIP or adjust the example to avoid calling unimplemented
methods: add a short note after the code block stating that
StellarConnector.getAccount and AIService.calculateCreditScore are
work-in-progress (reference Issue `#24` and `#25`), or replace the calls with a
mocked/example response so the snippet is runnable; ensure you mention the exact
symbols StellarConnector, getAccount, AIService, and calculateCreditScore so
readers know which APIs are incomplete.
| ## Next Steps | ||
|
|
||
| - [Contract Architecture](../architecture/contracts.md) - Understand contract design | ||
| - [API Integration](./api-integration.md) - Connect contracts to your backend | ||
| - [Testing Guide](./testing-contracts.md) - Comprehensive testing strategies | ||
| - [Security Audit](../../contracts/audit-report.md) - Review security findings |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if linked documentation files exist
echo "Checking for linked files from docs/tutorials/deploying-contracts.md..."
for file in "docs/architecture/contracts.md" "docs/tutorials/api-integration.md" "docs/tutorials/testing-contracts.md" "contracts/audit-report.md"; do
if [ -f "$file" ]; then
echo "✓ Found: $file"
else
echo "✗ Missing: $file"
fi
doneRepository: nexoraorg/chenaikit
Length of output: 303
Fix broken documentation links in "Next Steps" section.
Three of the four referenced documentation files do not exist:
../architecture/contracts.md✗ Missing./api-integration.md✗ Missing./testing-contracts.md✗ Missing../../contracts/audit-report.md✓ Found
Create the missing documentation files, update the links to point to existing documentation, or remove these references until the content is available.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/tutorials/deploying-contracts.md` around lines 385 - 390, The "Next
Steps" links in the Next Steps section of the deploying-contracts.md doc
reference three missing files (../architecture/contracts.md,
./api-integration.md, ./testing-contracts.md); either create those three docs
with the expected content under the appropriate docs directories (implement
pages for contract architecture, API integration, and testing contracts) or
update the links in the Next Steps block in deploying-contracts.md to point to
existing pages or remove the broken entries. Locate the Next Steps block in
deploying-contracts.md and fix the three link targets
(../architecture/contracts.md, ./api-integration.md, ./testing-contracts.md)
accordingly so no broken links remain.
| const ai = new AIService({ | ||
| apiKey: process.env.AI_API_KEY || 'demo' | ||
| }); | ||
|
|
||
| // Step 4: Calculate credit score | ||
| console.log('🎯 Calculating credit score...'); | ||
| const score = await ai.calculateCreditScore(account); | ||
|
|
||
| console.log(`\n✅ Credit Score: ${score}/1000`); | ||
|
|
||
| // Step 5: Get score factors | ||
| const factors = await ai.getScoreFactors(account); | ||
| console.log('\n📈 Score Factors:'); | ||
| factors.forEach(factor => { | ||
| console.log(` - ${factor}`); | ||
| }); | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify AIService methods in the actual implementation
echo "Checking AIService class methods..."
ast-grep --pattern 'class AIService {
$$$
}'
echo ""
echo "Checking if getScoreFactors exists anywhere..."
rg -n "getScoreFactors" --type tsRepository: nexoraorg/chenaikit
Length of output: 1540
AIService.getScoreFactors() method does not exist.
The tutorial calls ai.getScoreFactors(account) on line 86, but AIService only has calculateCreditScore and detectFraud methods. The getScoreFactors method exists on the CreditScorer class instead. Users following this tutorial will encounter a runtime error: TypeError: ai.getScoreFactors is not a function.
🐛 Proposed fix - use CreditScorer for score factors
import { StellarConnector, AIService } from '@chenaikit/core';
+import { CreditScorer } from '@chenaikit/core';
import dotenv from 'dotenv';
dotenv.config();
async function main() {
// ... existing code ...
// Step 3: Initialize AI service
console.log('\n🧠 Initializing AI service...');
const ai = new AIService({
apiKey: process.env.AI_API_KEY || 'demo'
});
// Step 4: Calculate credit score
console.log('🎯 Calculating credit score...');
const score = await ai.calculateCreditScore(account);
console.log(`\n✅ Credit Score: ${score}/1000`);
- // Step 5: Get score factors
- const factors = await ai.getScoreFactors(account);
+ // Step 5: Get score factors using CreditScorer
+ const scorer = new CreditScorer();
+ const factors = await scorer.getScoreFactors(account);
console.log('\n📈 Score Factors:');
factors.forEach(factor => {
console.log(` - ${factor}`);
});
}Alternatively, if getScoreFactors should be part of the AIService API, add this method to the implementation in packages/core/src/ai/service.ts.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const ai = new AIService({ | |
| apiKey: process.env.AI_API_KEY || 'demo' | |
| }); | |
| // Step 4: Calculate credit score | |
| console.log('🎯 Calculating credit score...'); | |
| const score = await ai.calculateCreditScore(account); | |
| console.log(`\n✅ Credit Score: ${score}/1000`); | |
| // Step 5: Get score factors | |
| const factors = await ai.getScoreFactors(account); | |
| console.log('\n📈 Score Factors:'); | |
| factors.forEach(factor => { | |
| console.log(` - ${factor}`); | |
| }); | |
| } | |
| const ai = new AIService({ | |
| apiKey: process.env.AI_API_KEY || 'demo' | |
| }); | |
| // Step 4: Calculate credit score | |
| console.log('🎯 Calculating credit score...'); | |
| const score = await ai.calculateCreditScore(account); | |
| console.log(`\n✅ Credit Score: ${score}/1000`); | |
| // Step 5: Get score factors using CreditScorer | |
| const scorer = new CreditScorer(); | |
| const factors = await scorer.getScoreFactors(account); | |
| console.log('\n📈 Score Factors:'); | |
| factors.forEach(factor => { | |
| console.log(` - ${factor}`); | |
| }); | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/tutorials/first-credit-score.md` around lines 75 - 91, The tutorial
calls ai.getScoreFactors(account) but AIService only exposes
calculateCreditScore and detectFraud; move the score-factor call to the class
that implements it by replacing that call with using
CreditScorer.getScoreFactors (e.g., instantiate CreditScorer with the same
dependencies used to create AIService and call
creditScorer.getScoreFactors(account)), or alternatively add a
getScoreFactors(account) wrapper to AIService that delegates to CreditScorer;
update the code references to use CreditScorer.getScoreFactors (or
AIService.getScoreFactors if you add the wrapper) and remove the nonexistent
ai.getScoreFactors call to avoid the TypeError.
| - [API Reference](../api-reference.md) - Complete API documentation | ||
| - [Deploying Contracts Tutorial](./deploying-contracts.md) - Deploy smart contracts | ||
| - [Architecture Overview](../architecture/overview.md) - System architecture | ||
| - [Examples](../../examples/) - More complete examples |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if linked files exist relative to docs/tutorials/
echo "Checking linked files from docs/tutorials/first-credit-score.md..."
for path in "docs/api-reference.md" "docs/architecture/overview.md" "examples"; do
if [ -e "$path" ]; then
echo "✓ Found: $path"
else
echo "✗ Missing: $path"
fi
doneRepository: nexoraorg/chenaikit
Length of output: 219
Fix broken documentation link in the references section.
The link ../architecture/overview.md references a file that does not exist. The other two links (../api-reference.md and ../../examples/) are valid. Remove or replace the broken architecture/overview.md reference.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/tutorials/first-credit-score.md` around lines 172 - 175, Remove or
replace the broken "Architecture Overview" reference: locate the line containing
the markdown link text "Architecture Overview" that points to
"../architecture/overview.md" and either delete that entire list item or update
the href to the correct existing documentation location (or to a placeholder
like "#") so the references list contains only valid links (ensure the
surrounding items "[API Reference]" and "[Examples]" remain unchanged).
| # ADR 003: TypeScript SDK Design and Architecture | ||
|
|
||
| ## Status | ||
| Accepted | ||
|
|
||
| ## Context | ||
| ChenAIKit needs a developer-friendly SDK that abstracts blockchain and AI complexity while providing: | ||
| - Type safety for better developer experience | ||
| - Modular architecture for tree-shaking | ||
| - Support for both Node.js and browser environments | ||
| - Extensibility for future features | ||
| - Clear separation of concerns | ||
|
|
||
| ## Decision | ||
| We will build a TypeScript-first SDK with a modular architecture organized by domain. | ||
|
|
||
| ### SDK Structure | ||
| ``` | ||
| @chenaikit/core/ | ||
| ├── src/ | ||
| │ ├── stellar/ # Stellar network operations | ||
| │ ├── ai/ # AI service integrations | ||
| │ ├── blockchain/ # Blockchain monitoring & governance | ||
| │ ├── utils/ # Shared utilities | ||
| │ ├── types/ # TypeScript type definitions | ||
| │ └── index.ts # Main entry point | ||
| ``` | ||
|
|
||
| ### Module Organization | ||
| Each domain module exports a focused API: | ||
| - **stellar/**: `StellarConnector`, `AssetManager`, `DEXIntegration` | ||
| - **ai/**: `AIService`, `CreditScorer`, `FraudDetector` | ||
| - **blockchain/**: `TransactionMonitor`, `GovernanceClient` | ||
| - **utils/**: `ValidationRules`, `ChartHelpers`, `ExportUtils` | ||
|
|
||
| ## Rationale | ||
|
|
||
| ### Why TypeScript? | ||
|
|
||
| 1. **Type Safety**: Catch errors at compile time, not runtime | ||
| 2. **IDE Support**: Excellent autocomplete and inline documentation | ||
| 3. **Refactoring**: Safe refactoring across the codebase | ||
| 4. **Documentation**: Types serve as living documentation | ||
| 5. **Ecosystem**: Largest JavaScript ecosystem with type definitions | ||
|
|
||
| ### Why Modular Architecture? | ||
|
|
||
| 1. **Tree Shaking**: Unused code is eliminated in production builds | ||
| 2. **Clear Boundaries**: Each module has a single responsibility | ||
| 3. **Independent Testing**: Modules can be tested in isolation | ||
| 4. **Parallel Development**: Teams can work on different modules | ||
| 5. **Gradual Adoption**: Users can import only what they need | ||
|
|
||
| ### Design Principles | ||
|
|
||
| 1. **Explicit over Implicit**: Clear, verbose APIs over magic | ||
| 2. **Fail Fast**: Validate inputs early and throw descriptive errors | ||
| 3. **Async by Default**: All I/O operations return Promises | ||
| 4. **Immutable Data**: Avoid mutating input parameters | ||
| 5. **Composable**: Small, focused functions that work together | ||
|
|
||
| ## Consequences | ||
|
|
||
| ### Positive | ||
| - **Developer Experience**: IntelliSense, type checking, and refactoring support | ||
| - **Maintainability**: Clear structure makes code easier to understand | ||
| - **Performance**: Tree-shaking reduces bundle size for web apps | ||
| - **Reliability**: Type system catches many bugs before runtime | ||
| - **Documentation**: Types provide inline documentation | ||
| - **Testing**: Easier to mock and test individual modules | ||
|
|
||
| ### Negative | ||
| - **Build Step**: Requires TypeScript compilation | ||
| - **Learning Curve**: Developers need TypeScript knowledge | ||
| - **Verbosity**: More code compared to plain JavaScript | ||
| - **Compilation Time**: Adds time to development workflow | ||
|
|
||
| ### Neutral | ||
| - **Type Definitions**: Need to maintain types for all public APIs | ||
| - **Breaking Changes**: Type changes can be breaking changes | ||
|
|
||
| ## API Design Patterns | ||
|
|
||
| ### 1. Configuration Objects | ||
| Use configuration objects instead of multiple parameters: | ||
|
|
||
| ```typescript | ||
| // Good | ||
| const stellar = new StellarConnector({ | ||
| network: 'testnet', | ||
| horizonUrl: 'https://horizon-testnet.stellar.org', | ||
| timeout: 30000 | ||
| }); | ||
|
|
||
| // Avoid | ||
| const stellar = new StellarConnector('testnet', 'https://...', 30000); | ||
| ``` | ||
|
|
||
| ### 2. Builder Pattern for Complex Objects | ||
| ```typescript | ||
| const monitor = new TransactionMonitor(config) | ||
| .addFilter({ account: 'GABC...' }) | ||
| .addAlertRule({ | ||
| type: 'high_value', | ||
| threshold: 10000, | ||
| action: 'webhook' | ||
| }) | ||
| .on('alert', handleAlert); | ||
|
|
||
| await monitor.start(); | ||
| ``` | ||
|
|
||
| ### 3. Async/Await for I/O | ||
| ```typescript | ||
| // All I/O operations are async | ||
| async function getAccountScore(accountId: string): Promise<number> { | ||
| const account = await stellar.getAccount(accountId); | ||
| const score = await ai.calculateCreditScore(account); | ||
| return score; | ||
| } | ||
| ``` | ||
|
|
||
| ### 4. Error Handling | ||
| ```typescript | ||
| class ChenAIKitError extends Error { | ||
| constructor( | ||
| message: string, | ||
| public code: string, | ||
| public details?: any | ||
| ) { | ||
| super(message); | ||
| this.name = 'ChenAIKitError'; | ||
| } | ||
| } | ||
|
|
||
| // Usage | ||
| throw new ChenAIKitError( | ||
| 'Account not found', | ||
| 'ACCOUNT_NOT_FOUND', | ||
| { accountId } | ||
| ); | ||
| ``` | ||
|
|
||
| ### 5. Event Emitters for Real-time Updates | ||
| ```typescript | ||
| import { EventEmitter } from 'eventemitter3'; | ||
|
|
||
| class TransactionMonitor extends EventEmitter { | ||
| on(event: 'transaction', handler: (tx: Transaction) => void): this; | ||
| on(event: 'alert', handler: (alert: Alert) => void): this; | ||
| on(event: string, handler: (...args: any[]) => void): this { | ||
| return super.on(event, handler); | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Type System Design | ||
|
|
||
| ### Strict Type Checking | ||
| ```json | ||
| { | ||
| "compilerOptions": { | ||
| "strict": true, | ||
| "noImplicitAny": true, | ||
| "strictNullChecks": true, | ||
| "strictFunctionTypes": true, | ||
| "noUnusedLocals": true, | ||
| "noUnusedParameters": true | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Discriminated Unions | ||
| ```typescript | ||
| type TransactionStatus = | ||
| | { status: 'pending'; submittedAt: Date } | ||
| | { status: 'confirmed'; confirmedAt: Date; ledger: number } | ||
| | { status: 'failed'; error: string }; | ||
|
|
||
| function handleTransaction(tx: TransactionStatus) { | ||
| switch (tx.status) { | ||
| case 'pending': | ||
| console.log('Submitted at', tx.submittedAt); | ||
| break; | ||
| case 'confirmed': | ||
| console.log('Confirmed in ledger', tx.ledger); | ||
| break; | ||
| case 'failed': | ||
| console.log('Failed:', tx.error); | ||
| break; | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Generic Types for Flexibility | ||
| ```typescript | ||
| interface Repository<T> { | ||
| find(id: string): Promise<T | null>; | ||
| findAll(): Promise<T[]>; | ||
| create(data: Omit<T, 'id'>): Promise<T>; | ||
| update(id: string, data: Partial<T>): Promise<T>; | ||
| delete(id: string): Promise<void>; | ||
| } | ||
|
|
||
| class AccountRepository implements Repository<Account> { | ||
| // Implementation | ||
| } | ||
| ``` | ||
|
|
||
| ## Module Exports | ||
|
|
||
| ### Barrel Exports | ||
| Each module has an index.ts that re-exports public APIs: | ||
|
|
||
| ```typescript | ||
| // src/stellar/index.ts | ||
| export { StellarConnector } from './connector'; | ||
| export { AssetManager } from './assets'; | ||
| export { DEXIntegration } from './dex'; | ||
| export type { StellarConfig, Account, Balance } from './types'; | ||
| ``` | ||
|
|
||
| ### Main Entry Point | ||
| ```typescript | ||
| // src/index.ts | ||
| export * from './stellar'; | ||
| export * from './ai'; | ||
| export * from './blockchain'; | ||
| export * from './utils'; | ||
| export type * from './types'; | ||
| ``` | ||
|
|
||
| ### Tree-Shakeable Exports | ||
| Users can import specific modules: | ||
| ```typescript | ||
| // Import everything | ||
| import { StellarConnector, AIService } from '@chenaikit/core'; | ||
|
|
||
| // Import specific module (better for tree-shaking) | ||
| import { StellarConnector } from '@chenaikit/core/stellar'; | ||
| import { AIService } from '@chenaikit/core/ai'; | ||
| ``` | ||
|
|
||
| ## Browser vs Node.js Support | ||
|
|
||
| ### Conditional Exports | ||
| ```json | ||
| { | ||
| "exports": { | ||
| ".": { | ||
| "import": "./dist/esm/index.js", | ||
| "require": "./dist/cjs/index.js", | ||
| "types": "./dist/types/index.d.ts" | ||
| }, | ||
| "./stellar": { | ||
| "import": "./dist/esm/stellar/index.js", | ||
| "require": "./dist/cjs/stellar/index.js", | ||
| "types": "./dist/types/stellar/index.d.ts" | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Platform-Specific Code | ||
| ```typescript | ||
| // Use conditional imports for platform-specific features | ||
| const WebSocket = typeof window !== 'undefined' | ||
| ? window.WebSocket | ||
| : require('ws'); | ||
| ``` | ||
|
|
||
| ## Testing Strategy | ||
|
|
||
| ### Unit Tests | ||
| - Test each module in isolation | ||
| - Mock external dependencies | ||
| - Use Jest with ts-jest | ||
|
|
||
| ### Integration Tests | ||
| - Test module interactions | ||
| - Use real testnet for blockchain operations | ||
| - Mock AI services with predictable responses | ||
|
|
||
| ### Type Tests | ||
| ```typescript | ||
| // Ensure types are correct | ||
| import { expectType } from 'tsd'; | ||
|
|
||
| const connector = new StellarConnector({ network: 'testnet' }); | ||
| const account = await connector.getAccount('GABC...'); | ||
|
|
||
| expectType<Account>(account); | ||
| expectType<Balance[]>(account.balances); | ||
| ``` | ||
|
|
||
| ## Documentation Strategy | ||
|
|
||
| ### TSDoc Comments | ||
| ```typescript | ||
| /** | ||
| * Calculates credit score for a Stellar account. | ||
| * | ||
| * @param accountId - Stellar account public key (G...) | ||
| * @returns Credit score between 0-1000 | ||
| * @throws {ChenAIKitError} If account not found or API error | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * const score = await ai.calculateCreditScore('GABC...'); | ||
| * console.log(`Score: ${score}/1000`); | ||
| * ``` | ||
| */ | ||
| async calculateCreditScore(accountId: string): Promise<number> { | ||
| // Implementation | ||
| } | ||
| ``` | ||
|
|
||
| ### Generated API Docs | ||
| Use TypeDoc to generate API documentation from TSDoc comments: | ||
| ```bash | ||
| typedoc --out docs/api src/index.ts | ||
| ``` | ||
|
|
||
| ## Versioning and Breaking Changes | ||
|
|
||
| ### Semantic Versioning | ||
| - **Major**: Breaking changes to public API | ||
| - **Minor**: New features, backward compatible | ||
| - **Patch**: Bug fixes, backward compatible | ||
|
|
||
| ### Deprecation Strategy | ||
| ```typescript | ||
| /** | ||
| * @deprecated Use `calculateCreditScore` instead. Will be removed in v2.0.0. | ||
| */ | ||
| async getCreditScore(accountId: string): Promise<number> { | ||
| console.warn('getCreditScore is deprecated, use calculateCreditScore'); | ||
| return this.calculateCreditScore(accountId); | ||
| } | ||
| ``` | ||
|
|
||
| ## Alternatives Considered | ||
|
|
||
| ### Plain JavaScript | ||
| - **Pros**: No build step, simpler setup | ||
| - **Cons**: No type safety, poor IDE support, more runtime errors | ||
| - **Rejected**: Type safety is critical for SDK reliability | ||
|
|
||
| ### Flow | ||
| - **Pros**: Type checking for JavaScript | ||
| - **Cons**: Smaller ecosystem, less tooling support, declining adoption | ||
| - **Rejected**: TypeScript has better ecosystem and tooling | ||
|
|
||
| ### ReScript/Reason | ||
| - **Pros**: Strong type system, functional programming | ||
| - **Cons**: Steep learning curve, smaller ecosystem, unfamiliar syntax | ||
| - **Rejected**: TypeScript is more accessible to JavaScript developers | ||
|
|
||
| ## References | ||
| - [TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/intro.html) | ||
| - [TypeScript Deep Dive](https://basarat.gitbook.io/typescript/) | ||
| - [API Design Patterns](https://www.patterns.dev/) | ||
| - [TSDoc Specification](https://tsdoc.org/) | ||
|
|
||
| ## Date | ||
| 2024-10-04 | ||
|
|
||
| ## Authors | ||
| ChenAIKit Team |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if the ADR files are duplicates and review Docusaurus config
echo "=== Checking for duplicate ADR content ==="
diff -q docs/architecture/adrs/003-typescript-sdk-design.md website/docs/architecture/adrs/003-typescript-sdk-design.md 2>/dev/null || echo "Files differ or one doesn't exist"
echo ""
echo "=== Checking Docusaurus docs path configuration ==="
cat website/docusaurus.config.ts 2>/dev/null | grep -A5 "docs:" || echo "Config not found"Repository: nexoraorg/chenaikit
Length of output: 363
🏁 Script executed:
#!/bin/bash
# Find all files matching the ADR pattern
echo "=== Searching for ADR 003 files ==="
find . -name "003-typescript-sdk-design.md" -type f 2>/dev/null
echo ""
echo "=== Checking directory structure ==="
ls -la docs/architecture/adrs/ 2>/dev/null || echo "docs/architecture/adrs/ does not exist"
echo ""
ls -la website/docs/architecture/adrs/ 2>/dev/null || echo "website/docs/architecture/adrs/ does not exist"
echo ""
echo "=== Checking if docs folder exists at repo root ==="
ls -la docs/ 2>/dev/null || echo "docs/ at repo root does not exist"Repository: nexoraorg/chenaikit
Length of output: 1708
🏁 Script executed:
#!/bin/bash
# Verify if the two files are identical
echo "=== Comparing file contents ==="
diff docs/architecture/adrs/003-typescript-sdk-design.md website/docs/architecture/adrs/003-typescript-sdk-design.md
echo "Exit code: $?"
echo ""
echo "=== File checksums ==="
md5sum docs/architecture/adrs/003-typescript-sdk-design.md
md5sum website/docs/architecture/adrs/003-typescript-sdk-design.mdRepository: nexoraorg/chenaikit
Length of output: 311
🏁 Script executed:
#!/bin/bash
# Verify which is the primary documentation source for Docusaurus
echo "=== Checking Docusaurus configuration paths ==="
cat website/docusaurus.config.ts | grep -B2 -A8 "docs:"
echo ""
echo "=== Looking for any references to docs/ at repo root ==="
grep -r "docs/architecture/adrs/003" . --include="*.ts" --include="*.json" --include="*.md" 2>/dev/null | grep -v node_modules | grep -v dist || echo "No references found"
echo ""
echo "=== Checking if all other ADR files are also duplicated ==="
for file in docs/architecture/adrs/*.md; do
base=$(basename "$file")
if [ -f "website/$file" ]; then
if cmp -s "$file" "website/$file"; then
echo "✓ $base - IDENTICAL"
else
echo "✗ $base - DIFFERENT"
fi
else
echo "✗ $base - ONLY IN ROOT"
fi
doneRepository: nexoraorg/chenaikit
Length of output: 885
🏁 Script executed:
#!/bin/bash
# Re-verify with diff instead of cmp (since cmp is not available)
echo "=== Verifying ADR file duplicates using diff ==="
for file in docs/architecture/adrs/*.md; do
base=$(basename "$file")
if [ -f "website/$file" ]; then
if diff -q "$file" "website/$file" > /dev/null; then
echo "✓ $base - IDENTICAL"
else
echo "✗ $base - DIFFERENT"
fi
else
echo "✗ $base - ONLY IN ROOT DOCS"
fi
done
echo ""
echo "=== Checking if docs/ at repo root is used anywhere ==="
cat website/docusaurus.config.ts | head -30Repository: nexoraorg/chenaikit
Length of output: 1006
Remove the duplicate documentation folder at repository root.
All ADR files in docs/architecture/adrs/ are identical to those in website/docs/architecture/adrs/. Since Docusaurus is configured to source documentation from website/docs/, the docs/ folder at the repository root is unused and creates maintenance burden. Consolidate by removing the root docs/ folder and keeping only website/docs/ as the single source of truth.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~328-~328: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...o public API - Minor: New features, backward compatible - Patch: Bug fixes, backward compat...
(EN_COMPOUND_ADJECTIVE_INTERNAL)
🪛 markdownlint-cli2 (0.21.0)
[warning] 18-18: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@website/docs/architecture/adrs/003-typescript-sdk-design.md` around lines 1 -
369, There are duplicate ADR docs in the repository root docs/ that are
unused—remove the root docs/ folder and consolidate documentation under
website/docs/ (specifically keep website/docs/architecture/adrs/); delete the
entire root docs/ directory, run a repo-wide search for any references to
"docs/" (e.g., in Docusaurus config, package.json scripts, CI workflows) and
update them to "website/docs/" or remove them if obsolete, and verify the site
build/local dev (Docusaurus) still works using the website/docs source as the
single source of truth.
| ## Quick Start | ||
|
|
||
| ### 1. Basic Setup | ||
|
|
||
| ```typescript | ||
| import { StellarConnector, AIService } from '@chenaikit/core'; | ||
|
|
||
| // Initialize Stellar connection | ||
| const stellar = new StellarConnector({ | ||
| network: 'testnet' | ||
| }); | ||
|
|
||
| // Initialize AI service | ||
| const ai = new AIService({ | ||
| apiKey: process.env.AI_API_KEY | ||
| }); | ||
| ``` | ||
|
|
||
| ### 2. Get Account Information | ||
|
|
||
| ```typescript | ||
| // Get account data | ||
| const account = await stellar.getAccount('G...'); | ||
| console.log('Account:', account); | ||
| ``` | ||
|
|
||
| ### 3. Calculate Credit Score | ||
|
|
||
| ```typescript | ||
| // Calculate credit score | ||
| const score = await ai.calculateCreditScore(account); | ||
| console.log('Credit Score:', score); | ||
| ``` | ||
|
|
||
| ### 4. Detect Fraud | ||
|
|
||
| ```typescript | ||
| // Detect fraud in transaction | ||
| const isFraud = await ai.detectFraud(transactionData); | ||
| console.log('Is Fraud:', isFraud); | ||
| ``` |
There was a problem hiding this comment.
Quick Start examples will fail at runtime.
All the methods shown in the Quick Start section throw "Not implemented yet" errors:
stellar.getAccount()→ Issue#24ai.calculateCreditScore()→ Issue#25ai.detectFraud()→ Issue#28
New users following this guide will immediately encounter runtime errors. Consider:
- Adding a prominent notice that the SDK is under development
- Deferring this documentation until core methods are implemented
- Providing mock/example data that doesn't require these calls
Additionally, Line 74 uses transactionData without showing how to obtain it.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@website/docs/getting-started.md` around lines 36 - 76, The Quick Start uses
unimplemented methods (StellarConnector.getAccount,
AIService.calculateCreditScore, AIService.detectFraud) and an undefined variable
(transactionData); update the docs to avoid runtime errors by adding a prominent
notice that the SDK is under development and the shown calls are placeholders,
replace live calls with mocked/example data and/or pseudo-responses for
getAccount, calculateCreditScore and detectFraud, and include a short note
showing how to construct or obtain transactionData (e.g., example JSON or a
mocked transaction object) so readers can copy a working example without
invoking unimplemented methods.
| ## Next Steps | ||
|
|
||
| - [Contract Architecture](../architecture/contracts.md) - Understand contract design | ||
| - [API Integration](./api-integration.md) - Connect contracts to your backend | ||
| - [Testing Guide](./testing-contracts.md) - Comprehensive testing strategies | ||
| - [Security Audit](../../contracts/audit-report.md) - Review security findings | ||
|
|
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify that the linked documentation files exist or are planned
echo "Checking for linked documentation files..."
fd -t f "contracts.md" docs website
fd -t f "api-integration.md" docs website
fd -t f "testing-contracts.md" docs website
fd -t f "audit-report.md" contractsRepository: nexoraorg/chenaikit
Length of output: 215
🏁 Script executed:
# Find the exact structure of docs directory
fd -t d "architecture" docs website
fd -t f "contracts.md" --search-path docs --search-path website
fd -t f "api-integration.md" --search-path docs --search-path website
fd -t f "testing-contracts.md" --search-path docs --search-path websiteRepository: nexoraorg/chenaikit
Length of output: 192
🏁 Script executed:
# List all files in architecture directories
echo "=== Files in docs/architecture/ ==="
find docs/architecture -type f 2>/dev/null | head -20
echo "=== Files in website/docs/architecture/ ==="
find website/docs/architecture -type f 2>/dev/null | head -20
echo "=== Files in website/docs/tutorials/ ==="
find website/docs/tutorials -type f 2>/dev/null | head -20Repository: nexoraorg/chenaikit
Length of output: 614
Remove or update Next Steps links to non-existent documentation files.
The Next Steps section references four files, but only one exists:
../architecture/contracts.md— does not exist./api-integration.md— does not exist./testing-contracts.md— does not exist../../contracts/audit-report.md— exists ✓
Either create these documentation files as part of this PR or remove the broken links.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@website/docs/tutorials/deploying-contracts.md` around lines 385 - 391, The
"Next Steps" section contains three broken links (../architecture/contracts.md,
./api-integration.md, ./testing-contracts.md) and one valid link
(../../contracts/audit-report.md); either remove the three broken entries from
the Next Steps list or replace them with valid existing docs, or add the missing
files to the docs tree with the expected paths and content; update the file that
defines the Next Steps section (the block containing "Contract Architecture",
"API Integration", "Testing Guide", "Security Audit") so only existing links
remain or new files are created to match those link paths.
| const sidebars: SidebarsConfig = { | ||
| tutorialSidebar: [ | ||
| { | ||
| type: 'category', | ||
| label: 'Getting Started', | ||
| items: [ | ||
| 'getting-started', | ||
| 'installation', | ||
| 'quick-start', | ||
| ], | ||
| }, | ||
| { | ||
| type: 'category', | ||
| label: 'Tutorials', | ||
| items: [ | ||
| 'tutorials/first-credit-score', | ||
| 'tutorials/deploying-contracts', | ||
| 'tutorials/building-dashboard', | ||
| 'tutorials/fraud-detection', | ||
| ], | ||
| }, | ||
| { | ||
| type: 'category', | ||
| label: 'Core Concepts', | ||
| items: [ | ||
| 'concepts/credit-scoring', | ||
| 'concepts/fraud-detection', | ||
| 'concepts/smart-contracts', | ||
| 'concepts/transaction-monitoring', | ||
| ], | ||
| }, | ||
| { | ||
| type: 'category', | ||
| label: 'API Reference', | ||
| items: [ | ||
| 'api/core-sdk', | ||
| 'api/backend-api', | ||
| 'api/smart-contracts', | ||
| ], | ||
| }, | ||
| { | ||
| type: 'category', | ||
| label: 'Architecture', | ||
| items: [ | ||
| 'architecture/overview', | ||
| { | ||
| type: 'category', | ||
| label: 'ADRs', | ||
| items: [ | ||
| 'architecture/adrs/001-monorepo-structure', | ||
| 'architecture/adrs/002-stellar-soroban-blockchain', | ||
| 'architecture/adrs/003-typescript-sdk-design', | ||
| ], | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| type: 'category', | ||
| label: 'Guides', | ||
| items: [ | ||
| 'guides/deployment', | ||
| 'guides/testing', | ||
| 'guides/security', | ||
| 'guides/performance', | ||
| ], | ||
| }, | ||
| { | ||
| type: 'doc', | ||
| id: 'troubleshooting', | ||
| label: 'Troubleshooting', | ||
| }, | ||
| { | ||
| type: 'doc', | ||
| id: 'faq', | ||
| label: 'FAQ', | ||
| }, | ||
| { | ||
| type: 'doc', | ||
| id: 'contributing', | ||
| label: 'Contributing', | ||
| }, | ||
| ], | ||
| }; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify all sidebar-referenced docs exist
echo "=== Checking for sidebar-referenced docs ==="
docs=(
"getting-started.md"
"installation.md"
"quick-start.md"
"tutorials/first-credit-score.md"
"tutorials/deploying-contracts.md"
"tutorials/building-dashboard.md"
"tutorials/fraud-detection.md"
"concepts/credit-scoring.md"
"concepts/fraud-detection.md"
"concepts/smart-contracts.md"
"concepts/transaction-monitoring.md"
"api/core-sdk.md"
"api/backend-api.md"
"api/smart-contracts.md"
"architecture/overview.md"
"architecture/adrs/001-monorepo-structure.md"
"architecture/adrs/002-stellar-soroban-blockchain.md"
"architecture/adrs/003-typescript-sdk-design.md"
"guides/deployment.md"
"guides/testing.md"
"guides/security.md"
"guides/performance.md"
"troubleshooting.md"
"faq.md"
"contributing.md"
)
for doc in "${docs[@]}"; do
if [ -f "website/docs/$doc" ]; then
echo "✓ Found: $doc"
else
echo "✗ MISSING: $doc"
fi
doneRepository: nexoraorg/chenaikit
Length of output: 1006
🏁 Script executed:
grep -n "onBrokenLinks" website/docusaurus.config.tsRepository: nexoraorg/chenaikit
Length of output: 91
Remove 16 missing documentation references from sidebar or add the missing files.
The sidebar references 16 documents that do not exist in website/docs/, and with onBrokenLinks: 'throw' configured in docusaurus.config.ts (line 16), this will cause the build to fail.
Missing files:
- Getting Started:
installation.md,quick-start.md - Tutorials:
tutorials/building-dashboard.md,tutorials/fraud-detection.md - Core Concepts:
concepts/credit-scoring.md,concepts/fraud-detection.md,concepts/smart-contracts.md,concepts/transaction-monitoring.md - API Reference:
api/backend-api.md,api/smart-contracts.md - Architecture:
architecture/overview.md - Guides:
guides/deployment.md,guides/testing.md,guides/security.md,guides/performance.md - Contributing:
contributing.md
Either create these files or remove their references from the sidebar configuration.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@website/sidebars.ts` around lines 3 - 85, The sidebar configuration in the
sidebars object (tutorialSidebar) references 16 document IDs that don't exist
and will break the build; fix by either creating the missing markdown files
under docs with the exact IDs listed (installation.md, quick-start.md,
tutorials/building-dashboard.md, tutorials/fraud-detection.md,
concepts/credit-scoring.md, concepts/fraud-detection.md,
concepts/smart-contracts.md, concepts/transaction-monitoring.md,
api/backend-api.md, api/smart-contracts.md, architecture/overview.md,
guides/deployment.md, guides/testing.md, guides/security.md,
guides/performance.md, contributing.md) or remove those specific string entries
from the items arrays in the tutorialSidebar (or replace them with existing doc
IDs) so that sidebars -> tutorialSidebar contains only IDs that actually exist.
| ); | ||
| } | ||
|
|
||
| export default function Home(): JSX.Element { |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check tsconfig.json jsx setting and `@types/react` installation
echo "Checking website/tsconfig.json..."
cat website/tsconfig.json | grep -E '"jsx"|"types"' || echo "jsx setting not found"
echo ""
echo "Checking for `@types/react` in package.json..."
cat website/package.json | grep -E '"@types/react"' || echo "@types/react not found in dependencies"Repository: nexoraorg/chenaikit
Length of output: 203
🏁 Script executed:
cat website/tsconfig.jsonRepository: nexoraorg/chenaikit
Length of output: 200
🏁 Script executed:
cat website/package.jsonRepository: nexoraorg/chenaikit
Length of output: 1159
🏁 Script executed:
head -n 30 website/src/pages/index.tsxRepository: nexoraorg/chenaikit
Length of output: 958
🏁 Script executed:
sed -n '70,85p' website/src/pages/index.tsxRepository: nexoraorg/chenaikit
Length of output: 520
🏁 Script executed:
grep -n "JSX.Element" website/src/pages/index.tsxRepository: nexoraorg/chenaikit
Length of output: 111
Install @types/react or change return type to React.JSX.Element.
The JSX namespace is not available because @types/react is missing from the project dependencies. While React 18.2.0 is installed, TypeScript requires the type definitions from @types/react to recognize JSX.Element.
Fix by either:
- Adding
@types/reacttodevDependencies(recommended) - Using
React.JSX.Elementas the return type instead
🧰 Tools
🪛 ESLint
[error] 76-76: 'JSX' is not defined.
(no-undef)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@website/src/pages/index.tsx` at line 76, The Home component's return
annotation uses JSX.Element but the project lacks the JSX namespace types;
either add `@types/react` to devDependencies and run install so TypeScript
recognizes JSX.Element, or change the Home function signature from "export
default function Home(): JSX.Element" to use the React namespace like
"React.JSX.Element"; update the Home declaration accordingly (symbol: Home) and
ensure tsconfig/react settings remain compatible.
|
@caxtonacollins look at the coderabbit review |
Expand Documentation with Tutorials, Guides, and API References
Closes #111
Summary
This PR significantly expands the ChenAIKit documentation with comprehensive tutorials, architecture decision records (ADRs), API references, troubleshooting guides, and a Docusaurus-based documentation website.
Changes Made
📚 New Documentation Files
Tutorials
docs/tutorials/first-credit-score.md- Step-by-step guide for calculating your first credit scoredocs/tutorials/deploying-contracts.md- Comprehensive smart contract deployment guideArchitecture Decision Records (ADRs)
docs/architecture/adrs/001-monorepo-structure.md- Monorepo with pnpm workspacesdocs/architecture/adrs/002-stellar-soroban-blockchain.md- Blockchain platform choicedocs/architecture/adrs/003-typescript-sdk-design.md- SDK architecture and design patternsAPI Reference
docs/api/core-sdk.md- Complete API documentation for@chenaikit/coreTroubleshooting Guide
docs/troubleshooting.md- Comprehensive troubleshooting guideFAQ
docs/faq.md- Frequently asked questions🌐 Documentation Website (Docusaurus)
Website Structure
Features
Quick Start
Documentation Coverage
✅ Completed Requirements from Issue #111
docs/tutorials/first-credit-score.mddocs/architecture/adrs/*.md(3 ADRs)docs/tutorials/deploying-contracts.mddocs/api/core-sdk.mddocs/troubleshooting.mdwebsite/directorydocs/faq.md📊 Documentation Statistics
Technical Implementation
Documentation Best Practices Applied
Docusaurus Features Used
Testing Performed
Next Steps (Future Enhancements)
Screenshots
Documentation Website Homepage
Tutorial Page
API Reference
Breaking Changes
None. This PR only adds documentation.
Checklist
How to Review
Check Documentation Quality
# Read the new documentation files cat docs/tutorials/first-credit-score.md cat docs/tutorials/deploying-contracts.md cat docs/api/core-sdk.md cat docs/troubleshooting.md cat docs/faq.mdTest Documentation Website
Verify Code Examples
Check Navigation
Related Issues
Additional Notes
This documentation provides a solid foundation for users to:
The Docusaurus website provides a professional, searchable, and maintainable documentation platform that can grow with the project.
Ready for review! 🚀
Summary by CodeRabbit
Documentation
Chores