diff --git a/.github/workflows/consistency.yml b/.github/workflows/consistency.yml new file mode 100644 index 0000000..dcb7140 --- /dev/null +++ b/.github/workflows/consistency.yml @@ -0,0 +1,14 @@ +name: Docs consistency + +on: + push: + branches: [main] + pull_request: + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run consistency checks + run: bash scripts/check-consistency.sh diff --git a/SKILL.md b/SKILL.md index 52b18c3..fa751bd 100644 --- a/SKILL.md +++ b/SKILL.md @@ -17,7 +17,7 @@ allowed-tools: mcp__trustless-work__searchDocumentation mcp__trustless-work__get # Trustless Work Development Skill -[View on skills.sh](https://www.skills.sh/trustless-work/trustless-work-dev-skill) +[View on skills.sh](https://www.skills.sh/trustless-work/trustlesswork-skill) This skill provides comprehensive guidance for integrating Trustless Work escrow contracts into applications. Use the reference files below for detailed implementation guides. @@ -28,7 +28,7 @@ This skill provides comprehensive guidance for integrating Trustless Work escrow Install this skill using: ```bash -npx skills add trustless-work/trustless-work-dev-skill +npx skills add trustless-work/trustlesswork-skill ``` ### When working with Trustless Work: diff --git a/scripts/check-consistency.sh b/scripts/check-consistency.sh new file mode 100755 index 0000000..9074ff4 --- /dev/null +++ b/scripts/check-consistency.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash +# Consistency checks for the Trustless Work skill (issue #5). +# Greps the tracked markdown files for known documentation regressions +# and exits non-zero if any reappear. + +set -u +cd "$(git rev-parse --show-toplevel)" + +FILES=$(git ls-files '*.md') +FAIL=0 + +check() { + local name="$1" pattern="$2" exclude="${3:-}" + local hits + hits=$(grep -rnE "$pattern" $FILES 2>/dev/null || true) + if [ -n "$exclude" ] && [ -n "$hits" ]; then + hits=$(printf '%s\n' "$hits" | grep -vE "$exclude" || true) + fi + if [ -n "$hits" ]; then + echo "FAIL: $name" + printf '%s\n' "$hits" | sed 's/^/ /' + FAIL=1 + else + echo "ok: $name" + fi +} + +# 1. Amounts must be numbers, never quoted strings. +check "quoted numeric amounts" '"amount": "[0-9]|amount: "[0-9]|amount: '\''[0-9]' + +# 2. Auth header is x-api-key; Bearer only allowed in "do not use" warnings. +check "stale Authorization: Bearer" 'Authorization: Bearer' '[Nn]ot |NOT |[Nn]ever ' + +# 3. Canonical repo/package naming only. +check "old repository names" 'trustless-work-dev-skill|Trustless-Work-Skill|wmendes/' + +# 4. milestoneIndex is a string — in examples and in API interface declarations. +# (A UI prop typed `number` is fine when the payload converts it with .toString().) +check "numeric milestoneIndex" '"milestoneIndex": [0-9]|milestoneIndex: [0-9]|milestoneIndex: number;' + +# 5. Use @stellar/stellar-sdk, not the deprecated package. +check "deprecated stellar-sdk import" "from '(stellar-sdk)'|from \"(stellar-sdk)\"" + +# 6. Distributions are { address, amount } objects, not tuples. +check "tuple-style distributions" '\[\"G[A-Z0-9]' + +# 7. Fees are deducted at release, never an extra funding amount. +check "fee-as-funding-amount guidance" '\+ platform fee|amount \+ platformFee|plus platform fee' + +# 8. All API calls require x-api-key. +check "claims that reads skip the API key" 'without an API key|[Rr]ead-only acceptable|no API key needed' + +if [ "$FAIL" -ne 0 ]; then + echo + echo "Consistency check failed — see FAIL entries above." + exit 1 +fi +echo +echo "All consistency checks passed." diff --git a/skills/api/core-concepts.md b/skills/api/core-concepts.md index 058a8b6..e420482 100644 --- a/skills/api/core-concepts.md +++ b/skills/api/core-concepts.md @@ -136,8 +136,8 @@ All escrow write operations follow this pattern: ### Example Transaction Flow ```typescript -// 1. Get unsigned transaction -const response = await fetch('https://api.trustlesswork.com/deployer/single-release', { +// 1. Get unsigned transaction (testnet base URL — use https://api.trustlesswork.com for mainnet) +const response = await fetch('https://dev.api.trustlesswork.com/deployer/single-release', { method: 'POST', headers: { 'x-api-key': apiKey, @@ -155,7 +155,7 @@ const { signedTxXdr } = await signTransaction(unsignedTransaction, { }); // 3. Submit transaction -const submitResponse = await fetch('https://api.trustlesswork.com/helper/send-transaction', { +const submitResponse = await fetch('https://dev.api.trustlesswork.com/helper/send-transaction', { method: 'POST', headers: { 'x-api-key': apiKey, @@ -166,7 +166,7 @@ const submitResponse = await fetch('https://api.trustlesswork.com/helper/send-tr // 4. Verify on-chain const verifyResponse = await fetch( - `https://api.trustlesswork.com/helper/get-escrows-by-signer?signer=${signerAddress}&validateOnChain=true`, + `https://dev.api.trustlesswork.com/helper/get-escrows-by-signer?signer=${signerAddress}&validateOnChain=true`, { headers: { 'x-api-key': apiKey } } ); ``` diff --git a/skills/api/multi-release-escrow.md b/skills/api/multi-release-escrow.md index 7c87020..91f0e45 100644 --- a/skills/api/multi-release-escrow.md +++ b/skills/api/multi-release-escrow.md @@ -322,7 +322,7 @@ Service Provider marks a milestone as complete. interface CompleteMilestone { contractId: string; // ID (address) that identifies the escrow contract signer: string; // Service Provider address - milestoneIndex: number; // Index of milestone (0-based) + milestoneIndex: string; // Index of milestone (0-based, as string: "0", "1", ...) } ``` @@ -330,7 +330,7 @@ interface CompleteMilestone { - `contractId` (required) - `signer` (required) -- `milestoneIndex` (required) +- `milestoneIndex` (required) - as string ### Example Request @@ -338,7 +338,7 @@ interface CompleteMilestone { { "contractId": "CHASVBD1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ", "signer": "GDEF4567890123456789012345678901234567890", - "milestoneIndex": 0 + "milestoneIndex": "0" } ``` diff --git a/skills/api/trustlines.md b/skills/api/trustlines.md index f60918d..a3b7eb8 100644 --- a/skills/api/trustlines.md +++ b/skills/api/trustlines.md @@ -13,7 +13,7 @@ A trustline is an explicit opt-in configuration that authorizes a Stellar accoun ## Trustline Requirements -- **0.5 XLM reserve**: Each trustline requires 0.5 XLM in base reserve +- **Base reserve**: Each trustline adds to the account's XLM base reserve — currently 0.5 XLM. This is a Stellar network parameter (it can change via network vote), not a Trustless Work constant - **Prevents abuse**: Limits spam and unauthorized asset creation - **Trust limit**: Maximum amount the account is willing to hold diff --git a/skills/api/types.md b/skills/api/types.md index c668cc0..038bacb 100644 --- a/skills/api/types.md +++ b/skills/api/types.md @@ -922,6 +922,7 @@ export type GetEscrowsFromIndexerResponse = { disputeStartedBy?: string; fundedBy?: string; isActive?: boolean; + /** @deprecated Legacy indexer fields from the old two-party resolution model — superseded by `distributions: { address, amount }[]`. Do not build new logic on them. */ approverFunds?: string; receiverFunds?: string; user: string;