Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/consistency.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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:
Expand Down
59 changes: 59 additions & 0 deletions scripts/check-consistency.sh
Original file line number Diff line number Diff line change
@@ -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."
8 changes: 4 additions & 4 deletions skills/api/core-concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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 } }
);
```
Expand Down
6 changes: 3 additions & 3 deletions skills/api/multi-release-escrow.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,23 +322,23 @@ 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", ...)
}
```

### Required Fields

- `contractId` (required)
- `signer` (required)
- `milestoneIndex` (required)
- `milestoneIndex` (required) - as string

### Example Request

```json
{
"contractId": "CHASVBD1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"signer": "GDEF4567890123456789012345678901234567890",
"milestoneIndex": 0
"milestoneIndex": "0"
}
```

Expand Down
2 changes: 1 addition & 1 deletion skills/api/trustlines.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions skills/api/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading