Skip to content

Commit 8f33f3a

Browse files
committed
Update main documentation with new features and improvements
- Update README.md with llms.txt, CI/CD, and raw markdown access info - Add workflow status badges to README - Update repository structure diagram - Update AGENTS.md with current project status and structure - Add changelog reference and quick access sections
1 parent a800cf9 commit 8f33f3a

2 files changed

Lines changed: 243 additions & 18 deletions

File tree

AGENTS.md

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
This repository contains extracted and cleaned API documentation for **both Affinity API v1 and v2**. Both versions will be maintained in this repository.
66

77
**Affinity API Versions:**
8+
89
- **v1**: Legacy API documented at https://api-docs.affinity.co/
910
- Currently being worked on - main file: `docs/v1/affinity_api_docs.md`
1011
- **v2**: New API with different approach/terminology, documented at https://developer.affinity.co/
1112
- Planned for future work - folder ready at `docs/v2/`
1213
- v2 is **not** a superset of v1 - they are separate APIs with different designs
1314

1415
The current v1 documentation file is located at `docs/v1/affinity_api_docs.md` and contains:
16+
1517
- Complete API endpoint documentation
1618
- Request/response formats
1719
- Parameter descriptions
@@ -23,40 +25,64 @@ The current v1 documentation file is located at `docs/v1/affinity_api_docs.md` a
2325
## Current Status
2426

2527
The markdown file has been:
28+
2629
- ✅ Extracted from the live documentation site
2730
- ✅ Fixed encoding issues and typos
2831
- ✅ Corrected formatting inconsistencies
2932
- ✅ Standardized markdown syntax
3033
- ✅ Fixed table formatting
3134
- ✅ Corrected outline/TOC structure
35+
- ✅ Automated updates via GitHub Actions
36+
- ✅ Last updated timestamp (automatically maintained)
3237
- ⚠️ **Missing**: Code examples (cURL, Ruby, Python, Node.js) for API endpoints
3338
- ⚠️ **Missing**: Request/response JSON examples
34-
- ⚠️ **Missing**: Last updated timestamp
3539

3640
## Project Structure
3741

3842
```
3943
affinity-api-docs/
4044
├── AGENTS.md (this file)
4145
├── README.md (project README)
46+
├── REPOSITORY_STRUCTURE.md (structure documentation)
47+
├── requirements-ci.txt (CI/CD dependencies)
48+
├── pytest.ini (pytest configuration)
49+
├── pyproject.toml (Python tooling config)
50+
├── .pre-commit-config.yaml (pre-commit hooks)
51+
├── .markdownlint.json (markdown linting rules)
52+
├── .yamllint.yml (YAML linting rules)
4253
├── .gitignore (gitignore rules)
54+
├── .github/
55+
│ ├── workflows/ (GitHub Actions workflows)
56+
│ │ ├── check-docs-updates.yml
57+
│ │ ├── pre-commit.yml
58+
│ │ └── tests.yml
59+
│ ├── scripts/ (CI/CD automation scripts)
60+
│ │ ├── check_and_update_docs.py
61+
│ │ └── validate_docs_structure.py
62+
│ ├── docs-version-v1.json (version tracking)
63+
│ └── docs-version-v2.json (version tracking)
4364
├── docs/
4465
│ ├── v1/
45-
│ │ └── affinity_api_docs.md (v1 documentation - in progress)
46-
│ └── v2/ (v2 documentation - planned for future)
47-
├── scripts/ (temporary extraction/processing scripts - gitignored)
48-
│ ├── extract_code_examples.py
49-
│ ├── parse_and_add_examples.py
50-
│ └── *.py (all scripts are temporary/throwaway)
51-
├── tmp/ (temporary outputs - gitignored)
52-
│ ├── api_docs_raw.html (fetched HTML)
53-
│ ├── code_blocks.json (extracted code blocks)
54-
│ └── extracted_*.json (other extracted data)
55-
└── .dev/ (development notes - gitignored)
56-
└── notes.md (development notes)
66+
│ │ └── affinity_api_docs.md (v1 documentation)
67+
│ ├── v2/ (v2 documentation - planned)
68+
│ └── development/ (development documentation)
69+
│ ├── TESTING.md
70+
│ ├── TEST_RESULTS.md
71+
│ └── PRE_COMMIT.md
72+
├── tests/ (test suite)
73+
│ ├── README.md
74+
│ ├── conftest.py
75+
│ ├── test_documentation_updates.py (pytest tests)
76+
│ ├── test-local.sh (legacy)
77+
│ ├── test-edge-cases.sh (legacy)
78+
│ ├── test-production-scenarios.sh (legacy)
79+
│ └── test-realistic-scenarios.py (legacy)
80+
├── scripts/ (temporary - gitignored)
81+
└── tmp/ (temporary outputs - gitignored)
5782
```
5883

5984
**Key Points:**
85+
6086
- `docs/` - All documentation files (committed to git)
6187
- `scripts/` - **All scripts are temporary/throwaway** (gitignored)
6288
- These are one-off extraction/processing scripts for this iterative project
@@ -84,12 +110,14 @@ The live API documentation site includes code examples in multiple languages (cU
84110
4. Include a `json` code block with example response data
85111

86112
Example structure:
113+
87114
- `#### Example Request` section with language-specific code blocks
88115
- `#### Example Response` section with JSON example
89116

90117
### 2. Extract Code Examples from Live Site
91118

92119
The HTML from https://api-docs.affinity.co/ has been fetched and saved. Code examples need to be:
120+
93121
- Parsed from the HTML
94122
- Matched to their corresponding endpoints
95123
- Cleaned of HTML entities and formatting
@@ -129,10 +157,12 @@ The live site includes a "Last updated" timestamp that should be added to the do
129157
## Authentication
130158

131159
**Affinity API v1** (this documentation) uses:
160+
132161
- **HTTP Basic Auth**: Provide API key as basic auth password (no username needed)
133162
- **HTTP Bearer Auth**: Also supported - provide API key as bearer token
134163

135164
**Affinity API v2** (separate API, not yet documented here) uses:
165+
136166
- **HTTP Bearer Auth only**: Provide API key as bearer token
137167

138168
All examples in this v1 documentation should use `YOUR_API_KEY` or `$APIKEY` as placeholder.
@@ -157,4 +187,3 @@ All examples in this v1 documentation should use `YOUR_API_KEY` or `$APIKEY` as
157187
- **v1**: Legacy API, uses Basic Auth (no username) or Bearer Auth
158188
- **v2**: New API, uses Bearer Auth only, different terminology and approach
159189
- v2 is **not** a superset of v1 - they are separate APIs with different designs
160-

README.md

Lines changed: 200 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Affinity API Documentation (Markdown Copy)
22

3+
[![Tests](https://github.com/yaniv-golan/affinity-api-docs/actions/workflows/tests.yml/badge.svg)](https://github.com/yaniv-golan/affinity-api-docs/actions/workflows/tests.yml)
4+
[![Pre-commit](https://github.com/yaniv-golan/affinity-api-docs/actions/workflows/pre-commit.yml/badge.svg)](https://github.com/yaniv-golan/affinity-api-docs/actions/workflows/pre-commit.yml)
5+
[![Documentation Updates](https://github.com/yaniv-golan/affinity-api-docs/actions/workflows/check-docs-updates.yml/badge.svg)](https://github.com/yaniv-golan/affinity-api-docs/actions/workflows/check-docs-updates.yml)
6+
37
This repository contains markdown versions of the official Affinity API documentation, making it easier to work with AI coding assistants and other tools that prefer static, text-based documentation.
48

59
## Official Documentation
@@ -19,22 +23,127 @@ The original Affinity API documentation is hosted on dynamic, interactive websit
1923
- **Better compatibility** with AI coding assistants and language models
2024
- **Offline access** to API documentation
2125
- **Version control** to track changes and updates over time
26+
- **Direct raw access** via GitHub raw URLs for programmatic use
27+
- **llms.txt format** - Standardized index format for LLM/IDE integration
28+
29+
## Quick Access
30+
31+
### llms.txt Format (Recommended for IDEs)
32+
33+
- 📋 [llms.txt](llms.txt) - Standardized index format for LLMs and IDEs (Cursor, Windsurf, Claude)
34+
- Follows [LangGraph llms.txt specification](https://langchain-ai.github.io/langgraph/llms-txt-overview/)
35+
- Provides links to full documentation
36+
- Optimized for IDE integration and MCP servers
37+
38+
### Raw Markdown Files (Direct Links)
39+
40+
**API v1 Documentation:**
41+
42+
- 📄 [View on GitHub](https://github.com/yaniv-golan/affinity-api-docs/blob/main/docs/v1/affinity_api_docs.md)
43+
- 🔗 [Raw Markdown](https://raw.githubusercontent.com/yaniv-golan/affinity-api-docs/main/docs/v1/affinity_api_docs.md) (for AI tools, parsers, curl, wget)
44+
45+
**API v2 Documentation:**
46+
47+
- 📋 Coming soon (planned)
48+
49+
### Accessing Raw Markdown
50+
51+
**For AI Coding Assistants:**
52+
53+
- Use the `llms.txt` file for IDE integration (recommended)
54+
- Or use the raw GitHub URL above for direct access
55+
- The raw markdown format is optimized for AI parsing and reference
56+
57+
**For Command Line:**
58+
59+
```bash
60+
# Download using curl
61+
curl -O https://raw.githubusercontent.com/yaniv-golan/affinity-api-docs/main/docs/v1/affinity_api_docs.md
62+
63+
# Download using wget
64+
wget https://raw.githubusercontent.com/yaniv-golan/affinity-api-docs/main/docs/v1/affinity_api_docs.md
65+
66+
# View directly
67+
curl https://raw.githubusercontent.com/yaniv-golan/affinity-api-docs/main/docs/v1/affinity_api_docs.md
68+
```
69+
70+
**For Git Clone:**
71+
72+
```bash
73+
git clone https://github.com/yaniv-golan/affinity-api-docs.git
74+
cd affinity-api-docs/docs/v1
75+
# Files are now available locally
76+
```
2277

2378
## Current Status
2479

2580
### API v1 Documentation
81+
2682
- ✅ Core documentation extracted and cleaned
2783
- ✅ Formatting standardized
84+
- ✅ Raw markdown accessible via direct links
2885
- ⚠️ **In Progress:** Adding code examples (cURL, Ruby, Python, Node.js)
2986
- 📂 Location: `docs/v1/affinity_api_docs.md`
3087

3188
### API v2 Documentation
89+
3290
- 📋 **Planned:** Not yet started
3391
- 📂 Location: `docs/v2/` (directory prepared)
3492

93+
## Automated Updates
94+
95+
This repository uses **automated GitHub Actions workflows** to keep the documentation synchronized with the official Affinity API documentation.
96+
97+
### How It Works
98+
99+
- **Schedule**: The workflow runs **daily at 00:00 UTC** to check for updates
100+
- **Manual Trigger**: You can also manually trigger the workflow from the GitHub Actions tab in your repository
101+
- **Process**:
102+
1. Fetches the latest documentation from the official Affinity websites
103+
2. Compares it with the current version in this repository
104+
3. If changes are detected, automatically creates a Pull Request (PR) with the updated documentation
105+
4. Adds a notice section to the documentation indicating that an update is available
106+
107+
### What to Expect
108+
109+
When an update is detected, you'll see:
110+
111+
- **A Pull Request** with the updated documentation
112+
- **A notice section** at the top of the documentation file indicating:
113+
- The date the update was detected
114+
- A link to view the diff
115+
- A link to the PR
116+
- Status information
117+
118+
### Reviewing Updates
119+
120+
All automated updates require **manual review** before merging:
121+
122+
1. Review the PR to verify the changes match the official documentation
123+
2. Check for any formatting issues
124+
3. Ensure all code examples are present and correct
125+
4. Merge the PR when satisfied
126+
127+
### Disabling Automated Updates
128+
129+
If you need to disable automated updates temporarily:
130+
131+
1. Edit `.github/workflows/check-docs-updates.yml`
132+
2. Comment out or remove the `schedule` section
133+
3. Commit the changes
134+
135+
### Workflow Details
136+
137+
- **Workflow File**: [`.github/workflows/check-docs-updates.yml`](.github/workflows/check-docs-updates.yml)
138+
- **Script**: [`.github/scripts/check_and_update_docs.py`](.github/scripts/check_and_update_docs.py)
139+
- **Version Tracking**: `.github/docs-version-v1.json` and `.github/docs-version-v2.json`
140+
- **Testing**: See [Testing Guide](docs/development/TESTING.md) for details
141+
142+
The workflow supports both **v1** and **v2** API documentation (v2 will be enabled when that documentation is added to the repository).
143+
35144
## Disclaimer
36145

37-
**Use at your own risk.** While every effort is made to ensure accuracy and keep this documentation synchronized with the official Affinity documentation, this is an unofficial copy and may contain errors, omissions, or outdated information.
146+
**Use at your own risk.** While every effort is made to ensure accuracy and keep this documentation synchronized with the official Affinity documentation, this is an unofficial copy and may contain errors, omissions, or outdated information.
38147

39148
For production use or critical implementations, always verify against the [official Affinity API documentation](https://developer.affinity.co/).
40149

@@ -43,11 +152,42 @@ For production use or critical implementations, always verify against the [offic
43152
```
44153
affinity-api-docs/
45154
├── README.md # This file
155+
├── CHANGELOG.md # Repository changelog
46156
├── AGENTS.md # Developer/AI agent guidelines
157+
├── llms.txt # llms.txt format index for LLMs/IDEs
158+
├── requirements-ci.txt # Python dependencies for CI/CD
159+
├── .github/
160+
│ ├── workflows/ # GitHub Actions workflows
161+
│ │ ├── check-docs-updates.yml # Automated documentation updates
162+
│ │ ├── pre-commit.yml # Pre-commit checks
163+
│ │ └── tests.yml # Test suite
164+
│ ├── scripts/ # CI/CD automation scripts
165+
│ │ ├── check_and_update_docs.py
166+
│ │ └── validate_docs_structure.py
167+
│ ├── docs-version-v1.json # Version tracking for v1
168+
│ └── docs-version-v2.json # Version tracking for v2
47169
├── docs/
48170
│ ├── v1/ # API v1 documentation
49171
│ │ └── affinity_api_docs.md
50-
│ └── v2/ # API v2 documentation (planned)
172+
│ ├── v2/ # API v2 documentation (planned)
173+
│ └── development/ # Development documentation
174+
│ ├── TESTING.md # Testing guide
175+
│ └── TEST_RESULTS.md # Test results
176+
├── tests/ # Test suite (pytest)
177+
│ ├── README.md # Test documentation
178+
│ ├── conftest.py # Pytest fixtures
179+
│ ├── test_documentation_updates.py # Main test suite
180+
│ ├── test-local.sh # Legacy test script
181+
│ ├── test-edge-cases.sh # Legacy test script
182+
│ ├── test-production-scenarios.sh # Legacy test script
183+
│ └── test-realistic-scenarios.py # Legacy test script
184+
├── pytest.ini # Pytest configuration
185+
├── .pre-commit-config.yaml # Pre-commit hooks configuration
186+
├── .markdownlint.json # Markdown linting rules
187+
├── .yamllint.yml # YAML linting configuration
188+
├── pyproject.toml # Python tooling configuration
189+
├── LICENSE # MIT License
190+
├── CONTRIBUTING.md # Contribution guidelines
51191
└── .gitignore
52192
```
53193

@@ -58,6 +198,50 @@ affinity-api-docs/
58198

59199
See the individual documentation files for detailed authentication instructions.
60200

201+
## Development
202+
203+
### Pre-commit Hooks
204+
205+
This repository uses [pre-commit](https://pre-commit.com/) hooks to ensure code quality and consistency.
206+
207+
**Setup**:
208+
209+
```bash
210+
# Install pre-commit
211+
pip install pre-commit
212+
213+
# Install hooks
214+
pre-commit install
215+
216+
# Run on all files (optional)
217+
pre-commit run --all-files
218+
```
219+
220+
**What's checked**:
221+
222+
- Python code formatting (black, isort, ruff)
223+
- Markdown linting (markdownlint)
224+
- YAML/JSON validation
225+
- Documentation structure validation
226+
- Trailing whitespace and end-of-file fixes
227+
228+
Hooks run automatically on `git commit`. They also run in CI/CD on every PR.
229+
230+
For more details, see [Pre-commit Hooks Guide](docs/development/PRE_COMMIT.md).
231+
232+
### Testing
233+
234+
See [Testing Guide](docs/development/TESTING.md) for details on running tests.
235+
236+
### Dependency Management
237+
238+
This repository uses [Dependabot](https://docs.github.com/en/code-security/dependabot) to automatically keep dependencies up to date:
239+
240+
- **Python packages**: Checked weekly (Mondays)
241+
- **GitHub Actions**: Checked monthly
242+
243+
Dependabot will automatically create pull requests for dependency updates. Review and merge these PRs to keep dependencies current.
244+
61245
## Contributing
62246

63247
If you notice discrepancies between this documentation and the official Affinity documentation, please:
@@ -66,17 +250,29 @@ If you notice discrepancies between this documentation and the official Affinity
66250
2. Open an issue describing the discrepancy
67251
3. If possible, submit a pull request with corrections
68252

253+
**Note**: All PRs are automatically checked by pre-commit hooks. Please ensure your code passes these checks before submitting.
254+
255+
For detailed contribution guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md).
256+
257+
## Changelog
258+
259+
See [CHANGELOG.md](CHANGELOG.md) for a detailed list of repository infrastructure changes and improvements.
260+
261+
**Note**: The changelog tracks repository changes (CI/CD, features, improvements). Individual documentation updates from the official Affinity API are tracked in Pull Requests.
262+
69263
## License
70264

71-
This is an unofficial documentation copy. The original Affinity API documentation and all associated intellectual property rights belong to Affinity. This repository is maintained for convenience and educational purposes only.
265+
This repository is licensed under the MIT License - see [LICENSE](LICENSE) for details.
266+
267+
**Note**: This is an unofficial documentation copy. The original Affinity API documentation and all associated intellectual property rights belong to Affinity. This repository is maintained for convenience and educational purposes only.
72268

73269
## Contact
74270

75271
For API support or questions about the Affinity API itself, contact Affinity directly:
272+
76273
- **Affinity Support:** support@affinity.co
77274
- **Official Documentation:** [https://developer.affinity.co/](https://developer.affinity.co/)
78275

79276
## Acknowledgments
80277

81278
All content is derived from the official Affinity API documentation. This repository simply provides an alternative format for easier consumption by development tools and AI assistants.
82-

0 commit comments

Comments
 (0)