anchormd 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. anchormd-0.4.0/.dockerignore +19 -0
  2. anchormd-0.4.0/.github/dependabot.yml +30 -0
  3. anchormd-0.4.0/.github/workflows/ci.yml +27 -0
  4. anchormd-0.4.0/.github/workflows/codeql.yml +33 -0
  5. anchormd-0.4.0/.github/workflows/pages.yml +31 -0
  6. anchormd-0.4.0/.github/workflows/publish.yml +23 -0
  7. anchormd-0.4.0/.github/workflows/secret-scan.yml +33 -0
  8. anchormd-0.4.0/.github/workflows/security.yml +25 -0
  9. anchormd-0.4.0/.gitignore +25 -0
  10. anchormd-0.4.0/.gitleaks.toml +4 -0
  11. anchormd-0.4.0/BUILD_GUIDE.md +85 -0
  12. anchormd-0.4.0/CLAUDE.md +167 -0
  13. anchormd-0.4.0/LICENSE +21 -0
  14. anchormd-0.4.0/PKG-INFO +216 -0
  15. anchormd-0.4.0/README.md +176 -0
  16. anchormd-0.4.0/action.yml +182 -0
  17. anchormd-0.4.0/docs/ARCHITECTURE.md +76 -0
  18. anchormd-0.4.0/docs/MONETIZATION.md +117 -0
  19. anchormd-0.4.0/docs/index.html +396 -0
  20. anchormd-0.4.0/license_server/.dockerignore +5 -0
  21. anchormd-0.4.0/license_server/Dockerfile +40 -0
  22. anchormd-0.4.0/license_server/__init__.py +3 -0
  23. anchormd-0.4.0/license_server/config.py +56 -0
  24. anchormd-0.4.0/license_server/database.py +83 -0
  25. anchormd-0.4.0/license_server/email_delivery.py +168 -0
  26. anchormd-0.4.0/license_server/fly.toml +28 -0
  27. anchormd-0.4.0/license_server/key_gen.py +104 -0
  28. anchormd-0.4.0/license_server/litestream.yml +12 -0
  29. anchormd-0.4.0/license_server/main.py +77 -0
  30. anchormd-0.4.0/license_server/migrations/001_initial_schema.sql +40 -0
  31. anchormd-0.4.0/license_server/migrations/002_add_product_column.sql +6 -0
  32. anchormd-0.4.0/license_server/migrations/003_add_bundle_support.sql +3 -0
  33. anchormd-0.4.0/license_server/models.py +96 -0
  34. anchormd-0.4.0/license_server/pyproject.toml +37 -0
  35. anchormd-0.4.0/license_server/rate_limit.py +8 -0
  36. anchormd-0.4.0/license_server/requirements.txt +5 -0
  37. anchormd-0.4.0/license_server/routes/__init__.py +0 -0
  38. anchormd-0.4.0/license_server/routes/activate.py +83 -0
  39. anchormd-0.4.0/license_server/routes/revoke.py +80 -0
  40. anchormd-0.4.0/license_server/routes/validate.py +124 -0
  41. anchormd-0.4.0/license_server/routes/webhook.py +60 -0
  42. anchormd-0.4.0/license_server/scripts/restore.sh +22 -0
  43. anchormd-0.4.0/license_server/stripe_webhooks.py +272 -0
  44. anchormd-0.4.0/packs/README.md +31 -0
  45. anchormd-0.4.0/packs/django-pro/CLAUDE.md +175 -0
  46. anchormd-0.4.0/packs/fastapi-pro/CLAUDE.md +165 -0
  47. anchormd-0.4.0/packs/nextjs-pro/CLAUDE.md +156 -0
  48. anchormd-0.4.0/packs/rust-pro/CLAUDE.md +163 -0
  49. anchormd-0.4.0/prompts/01_foundation.md +107 -0
  50. anchormd-0.4.0/prompts/02_scanner.md +68 -0
  51. anchormd-0.4.0/prompts/03_analyzers.md +140 -0
  52. anchormd-0.4.0/prompts/04_generators.md +110 -0
  53. anchormd-0.4.0/prompts/05_cli.md +129 -0
  54. anchormd-0.4.0/prompts/06_auditor.md +112 -0
  55. anchormd-0.4.0/prompts/07_templates.md +204 -0
  56. anchormd-0.4.0/prompts/08_publish.md +181 -0
  57. anchormd-0.4.0/pyproject.toml +72 -0
  58. anchormd-0.4.0/scripts/keygen.py +45 -0
  59. anchormd-0.4.0/scripts/stripe_setup.py +103 -0
  60. anchormd-0.4.0/setup.cfg +4 -0
  61. anchormd-0.4.0/src/anchormd/__init__.py +7 -0
  62. anchormd-0.4.0/src/anchormd/__main__.py +6 -0
  63. anchormd-0.4.0/src/anchormd/analyzers/__init__.py +32 -0
  64. anchormd-0.4.0/src/anchormd/analyzers/commands.py +249 -0
  65. anchormd-0.4.0/src/anchormd/analyzers/domain.py +238 -0
  66. anchormd-0.4.0/src/anchormd/analyzers/github.py +396 -0
  67. anchormd-0.4.0/src/anchormd/analyzers/language.py +254 -0
  68. anchormd-0.4.0/src/anchormd/analyzers/patterns.py +298 -0
  69. anchormd-0.4.0/src/anchormd/analyzers/skills.py +212 -0
  70. anchormd-0.4.0/src/anchormd/analyzers/tech_debt.py +499 -0
  71. anchormd-0.4.0/src/anchormd/ci.py +119 -0
  72. anchormd-0.4.0/src/anchormd/cleanup.py +330 -0
  73. anchormd-0.4.0/src/anchormd/cli.py +936 -0
  74. anchormd-0.4.0/src/anchormd/config.py +133 -0
  75. anchormd-0.4.0/src/anchormd/drift/__init__.py +1 -0
  76. anchormd-0.4.0/src/anchormd/drift/adapters/__init__.py +56 -0
  77. anchormd-0.4.0/src/anchormd/drift/adapters/anthropic.py +40 -0
  78. anchormd-0.4.0/src/anchormd/drift/adapters/base.py +17 -0
  79. anchormd-0.4.0/src/anchormd/drift/adapters/google.py +38 -0
  80. anchormd-0.4.0/src/anchormd/drift/adapters/ollama.py +51 -0
  81. anchormd-0.4.0/src/anchormd/drift/adapters/openai.py +41 -0
  82. anchormd-0.4.0/src/anchormd/drift/cli.py +358 -0
  83. anchormd-0.4.0/src/anchormd/drift/fixer.py +111 -0
  84. anchormd-0.4.0/src/anchormd/drift/generator.py +124 -0
  85. anchormd-0.4.0/src/anchormd/drift/models.py +86 -0
  86. anchormd-0.4.0/src/anchormd/drift/reporter.py +134 -0
  87. anchormd-0.4.0/src/anchormd/drift/runner.py +248 -0
  88. anchormd-0.4.0/src/anchormd/drift/scorer.py +61 -0
  89. anchormd-0.4.0/src/anchormd/drift/storage.py +131 -0
  90. anchormd-0.4.0/src/anchormd/drift/templates/report.html +113 -0
  91. anchormd-0.4.0/src/anchormd/drift/trend.py +70 -0
  92. anchormd-0.4.0/src/anchormd/exceptions.py +29 -0
  93. anchormd-0.4.0/src/anchormd/gates.py +107 -0
  94. anchormd-0.4.0/src/anchormd/generators/__init__.py +1 -0
  95. anchormd-0.4.0/src/anchormd/generators/auditor.py +106 -0
  96. anchormd-0.4.0/src/anchormd/generators/checkers/__init__.py +15 -0
  97. anchormd-0.4.0/src/anchormd/generators/checkers/accuracy.py +61 -0
  98. anchormd-0.4.0/src/anchormd/generators/checkers/anti_patterns.py +96 -0
  99. anchormd-0.4.0/src/anchormd/generators/checkers/coverage.py +38 -0
  100. anchormd-0.4.0/src/anchormd/generators/checkers/freshness.py +39 -0
  101. anchormd-0.4.0/src/anchormd/generators/checkers/specificity.py +73 -0
  102. anchormd-0.4.0/src/anchormd/generators/composer.py +121 -0
  103. anchormd-0.4.0/src/anchormd/generators/sections.py +263 -0
  104. anchormd-0.4.0/src/anchormd/licensing.py +438 -0
  105. anchormd-0.4.0/src/anchormd/machine_id.py +19 -0
  106. anchormd-0.4.0/src/anchormd/models.py +94 -0
  107. anchormd-0.4.0/src/anchormd/scanner.py +373 -0
  108. anchormd-0.4.0/src/anchormd/telemetry.py +153 -0
  109. anchormd-0.4.0/src/anchormd/templates/__init__.py +1 -0
  110. anchormd-0.4.0/src/anchormd/templates/base.py +55 -0
  111. anchormd-0.4.0/src/anchormd/templates/frameworks.py +313 -0
  112. anchormd-0.4.0/src/anchormd/templates/presets.py +32 -0
  113. anchormd-0.4.0/src/anchormd.egg-info/PKG-INFO +216 -0
  114. anchormd-0.4.0/src/anchormd.egg-info/SOURCES.txt +161 -0
  115. anchormd-0.4.0/src/anchormd.egg-info/dependency_links.txt +1 -0
  116. anchormd-0.4.0/src/anchormd.egg-info/entry_points.txt +2 -0
  117. anchormd-0.4.0/src/anchormd.egg-info/requires.txt +20 -0
  118. anchormd-0.4.0/src/anchormd.egg-info/top_level.txt +1 -0
  119. anchormd-0.4.0/tests/__init__.py +0 -0
  120. anchormd-0.4.0/tests/conftest.py +95 -0
  121. anchormd-0.4.0/tests/drift/__init__.py +0 -0
  122. anchormd-0.4.0/tests/drift/fixtures/sample_benchmarks.yaml +23 -0
  123. anchormd-0.4.0/tests/drift/test_adapters.py +240 -0
  124. anchormd-0.4.0/tests/drift/test_cli.py +214 -0
  125. anchormd-0.4.0/tests/drift/test_fixer.py +157 -0
  126. anchormd-0.4.0/tests/drift/test_generator.py +148 -0
  127. anchormd-0.4.0/tests/drift/test_models.py +147 -0
  128. anchormd-0.4.0/tests/drift/test_reporter.py +133 -0
  129. anchormd-0.4.0/tests/drift/test_runner.py +209 -0
  130. anchormd-0.4.0/tests/drift/test_scorer.py +131 -0
  131. anchormd-0.4.0/tests/drift/test_storage.py +212 -0
  132. anchormd-0.4.0/tests/drift/test_trend.py +77 -0
  133. anchormd-0.4.0/tests/license_server/__init__.py +0 -0
  134. anchormd-0.4.0/tests/license_server/conftest.py +49 -0
  135. anchormd-0.4.0/tests/license_server/test_activate.py +151 -0
  136. anchormd-0.4.0/tests/license_server/test_database.py +183 -0
  137. anchormd-0.4.0/tests/license_server/test_email_delivery.py +78 -0
  138. anchormd-0.4.0/tests/license_server/test_health.py +59 -0
  139. anchormd-0.4.0/tests/license_server/test_key_gen.py +181 -0
  140. anchormd-0.4.0/tests/license_server/test_models.py +117 -0
  141. anchormd-0.4.0/tests/license_server/test_multi_product.py +167 -0
  142. anchormd-0.4.0/tests/license_server/test_rate_limit.py +110 -0
  143. anchormd-0.4.0/tests/license_server/test_revoke.py +157 -0
  144. anchormd-0.4.0/tests/license_server/test_stripe_webhooks.py +318 -0
  145. anchormd-0.4.0/tests/license_server/test_validate.py +158 -0
  146. anchormd-0.4.0/tests/license_server/test_webhook_route.py +177 -0
  147. anchormd-0.4.0/tests/test_analyzers.py +383 -0
  148. anchormd-0.4.0/tests/test_auditor.py +145 -0
  149. anchormd-0.4.0/tests/test_checkers.py +197 -0
  150. anchormd-0.4.0/tests/test_ci.py +77 -0
  151. anchormd-0.4.0/tests/test_cleanup.py +259 -0
  152. anchormd-0.4.0/tests/test_cli.py +152 -0
  153. anchormd-0.4.0/tests/test_gates.py +166 -0
  154. anchormd-0.4.0/tests/test_generators.py +221 -0
  155. anchormd-0.4.0/tests/test_github_analyzer.py +209 -0
  156. anchormd-0.4.0/tests/test_integration.py +167 -0
  157. anchormd-0.4.0/tests/test_licensing.py +552 -0
  158. anchormd-0.4.0/tests/test_machine_id.py +49 -0
  159. anchormd-0.4.0/tests/test_models.py +232 -0
  160. anchormd-0.4.0/tests/test_scanner.py +313 -0
  161. anchormd-0.4.0/tests/test_tech_debt.py +507 -0
  162. anchormd-0.4.0/tests/test_telemetry.py +147 -0
  163. anchormd-0.4.0/tests/test_templates.py +152 -0
@@ -0,0 +1,19 @@
1
+ __pycache__
2
+ *.pyc
3
+ .pytest_cache
4
+ *.db
5
+ .env
6
+ .venv
7
+ .git
8
+ tests
9
+ docs
10
+ output
11
+ packs
12
+ prompts
13
+ src
14
+ scripts
15
+ .github
16
+ *.md
17
+ LICENSE
18
+ action.yml
19
+ pyproject.toml
@@ -0,0 +1,30 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "pip"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ day: "monday"
8
+ open-pull-requests-limit: 5
9
+ labels:
10
+ - "dependencies"
11
+ - "python"
12
+ commit-message:
13
+ prefix: "deps"
14
+ groups:
15
+ python-minor:
16
+ update-types:
17
+ - "minor"
18
+ - "patch"
19
+
20
+ - package-ecosystem: "github-actions"
21
+ directory: "/"
22
+ schedule:
23
+ interval: "weekly"
24
+ open-pull-requests-limit: 5
25
+ labels:
26
+ - "dependencies"
27
+ - "ci"
28
+ commit-message:
29
+ prefix: "ci"
30
+
@@ -0,0 +1,27 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12", "3.13"]
15
+ steps:
16
+ - uses: actions/checkout@v6
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: ${{ matrix.python-version }}
20
+ - name: Install dependencies
21
+ run: pip install -e ".[dev]"
22
+ - name: Lint
23
+ run: ruff check src/ tests/
24
+ - name: Format check
25
+ run: ruff format --check src/ tests/
26
+ - name: Test
27
+ run: pytest tests/ -v --tb=short
@@ -0,0 +1,33 @@
1
+ name: CodeQL Security Scan
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+ schedule:
9
+ - cron: '0 6 * * 1' # Weekly on Monday at 6 AM UTC
10
+
11
+ jobs:
12
+ analyze:
13
+ name: Analyze
14
+ runs-on: ubuntu-latest
15
+ permissions:
16
+ actions: read
17
+ contents: read
18
+ security-events: write
19
+
20
+ steps:
21
+ - name: Checkout repository
22
+ uses: actions/checkout@v6
23
+
24
+ - name: Initialize CodeQL
25
+ uses: github/codeql-action/init@v4
26
+ with:
27
+ languages: python
28
+ queries: security-and-quality
29
+
30
+ - name: Perform CodeQL Analysis
31
+ uses: github/codeql-action/analyze@v4
32
+ with:
33
+ category: "/language:python"
@@ -0,0 +1,31 @@
1
+ name: Deploy Landing Page
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths: [docs/**]
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+ pages: write
12
+ id-token: write
13
+
14
+ concurrency:
15
+ group: pages
16
+ cancel-in-progress: true
17
+
18
+ jobs:
19
+ deploy:
20
+ runs-on: ubuntu-latest
21
+ environment:
22
+ name: github-pages
23
+ url: ${{ steps.deployment.outputs.page_url }}
24
+ steps:
25
+ - uses: actions/checkout@v6
26
+ - uses: actions/configure-pages@v5
27
+ - uses: actions/upload-pages-artifact@v4
28
+ with:
29
+ path: docs
30
+ - id: deployment
31
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,23 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ environment: pypi
11
+ permissions:
12
+ id-token: write
13
+ steps:
14
+ - uses: actions/checkout@v6
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.12"
18
+ - name: Install build tools
19
+ run: pip install build
20
+ - name: Build package
21
+ run: python -m build
22
+ - name: Publish to PyPI
23
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,33 @@
1
+ # Secret Scanning with Gitleaks
2
+ #
3
+ # Scans for secrets in:
4
+ # - All commits in PRs
5
+ # - Push to main/master
6
+ #
7
+ name: Secret Scan
8
+
9
+ on:
10
+ push:
11
+ branches: [main, master]
12
+ pull_request:
13
+ branches: [main, master]
14
+
15
+ jobs:
16
+ gitleaks:
17
+ name: Scan for secrets
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - name: Checkout
21
+ uses: actions/checkout@v6
22
+ with:
23
+ fetch-depth: 0
24
+
25
+ - name: Install Gitleaks
26
+ run: |
27
+ curl -sSfL https://github.com/gitleaks/gitleaks/releases/download/v8.24.3/gitleaks_8.24.3_linux_x64.tar.gz | tar xz
28
+ chmod +x gitleaks
29
+
30
+ - name: Run Gitleaks
31
+ run: |
32
+ ./gitleaks detect --source . --verbose --redact --exit-code 2
33
+
@@ -0,0 +1,25 @@
1
+ name: Security
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+ schedule:
9
+ - cron: '0 6 * * 1'
10
+
11
+ jobs:
12
+ pip-audit:
13
+ name: Dependency Audit
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v6
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.12"
20
+ - name: Install dependencies
21
+ run: |
22
+ pip install -e ".[dev]" 2>/dev/null || pip install -e . 2>/dev/null || pip install -r requirements.txt
23
+ pip install pip-audit
24
+ - name: Run pip-audit
25
+ run: pip-audit
@@ -0,0 +1,25 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+ .venv/
10
+ venv/
11
+ .mypy_cache/
12
+ .ruff_cache/
13
+ .pytest_cache/
14
+ .tox/
15
+ *.so
16
+ .DS_Store
17
+ Thumbs.db
18
+ *.swp
19
+ *.swo
20
+ *~
21
+ .idea/
22
+ .vscode/
23
+ *.iml
24
+ .env*
25
+ output/
@@ -0,0 +1,4 @@
1
+ [allowlist]
2
+ description = "Allowlisted false positives"
3
+ regexTarget = "match"
4
+ regexes = ['''anchormd-v1''']
@@ -0,0 +1,85 @@
1
+ # AnchorMD — Build Execution Guide
2
+
3
+ ## How to Use These Prompts
4
+
5
+ Each prompt in `/prompts/` is designed to be fed to Claude Code as a single session.
6
+ Run them **in order** — each builds on the previous.
7
+
8
+ ### Setup
9
+
10
+ ```bash
11
+ # Create repo
12
+ mkdir anchormd && cd anchormd
13
+ git init
14
+
15
+ # Copy this entire scaffold into the repo
16
+ # (CLAUDE.md, prompts/, docs/ should all be at root)
17
+
18
+ git add -A
19
+ git commit -m "feat: initial scaffold with CLAUDE.md and build prompts"
20
+ ```
21
+
22
+ ### Execution Sequence
23
+
24
+ | Prompt | Time Estimate | What It Builds | Commit After |
25
+ |--------|---------------|----------------|--------------|
26
+ | 01_foundation | 15-20 min | pyproject.toml, models, config, exceptions | `feat: project foundation and data models` |
27
+ | 02_scanner | 20-30 min | Filesystem scanner with tests | `feat: codebase scanner` |
28
+ | 03_analyzers | 30-45 min | 4 analyzers (language, patterns, commands, domain) | `feat: codebase analyzers` |
29
+ | 04_generators | 20-30 min | Section generator + document composer | `feat: CLAUDE.md generators` |
30
+ | 05_cli | 20-30 min | Typer CLI with rich output | `feat: CLI interface` |
31
+ | 06_auditor | 20-30 min | CLAUDE.md quality auditor | `feat: audit command` |
32
+ | 07_templates | 30-40 min | Framework presets + Jinja2 templates | `feat: framework presets and templates` |
33
+ | 08_publish | 15-20 min | README, CI/CD, PyPI prep | `feat: publish pipeline` |
34
+
35
+ **Total estimated: 3-4 hours of Claude Code sessions**
36
+
37
+ ### Per-Prompt Workflow
38
+
39
+ ```bash
40
+ # 1. Open Claude Code in the project root
41
+ cd anchormd
42
+ claude
43
+
44
+ # 2. Feed the prompt
45
+ # Copy contents of prompts/01_foundation.md into Claude Code
46
+
47
+ # 3. Let it build. Review output.
48
+
49
+ # 4. Run tests
50
+ pytest tests/ -v
51
+
52
+ # 5. Run lint
53
+ ruff check src/ tests/
54
+
55
+ # 6. If tests pass, commit
56
+ git add -A
57
+ git commit -m "feat: project foundation and data models"
58
+
59
+ # 7. Move to next prompt
60
+ ```
61
+
62
+ ### Tips
63
+
64
+ - **Always run tests before committing.** If tests fail, paste the failure into Claude Code and ask it to fix.
65
+ - **Dogfood early.** After prompt 05, run `anchormd generate .` on the project itself. Fix issues immediately.
66
+ - **Don't skip the auditor.** Prompt 06 is what makes this tool premium — it's the reason someone would pay for it.
67
+ - **The templates in prompt 07 are your monetization lever.** Curated, opinionated presets are the value-add over hand-rolling.
68
+
69
+ ### Post-Build Checklist
70
+
71
+ - [ ] `anchormd generate .` works on itself
72
+ - [ ] `anchormd audit CLAUDE.md` scores > 60 on its own CLAUDE.md
73
+ - [ ] `anchormd generate /path/to/some/react/project` produces good output
74
+ - [ ] `anchormd generate /path/to/some/python/project` produces good output
75
+ - [ ] All tests pass across Python 3.11+
76
+ - [ ] Published to PyPI
77
+ - [ ] GitHub repo has: pinned, README with badges, release tagged
78
+
79
+ ### Monetization Next Steps (After v0.1.0 ships)
80
+
81
+ 1. **Free CLI on PyPI** — builds adoption, gets stars
82
+ 2. **Gumroad template packs** ($5-10 each): "Enterprise Python", "Full-Stack TypeScript", "Rust Systems"
83
+ 3. **GitHub Action** (free tier + paid): auto-audit on PR, comment with score
84
+ 4. **Pro CLI** ($5/mo via license key): team templates, custom rules, CI integration
85
+ 5. **Landing page**: benchmarks showing quality improvement with Forge-generated CLAUDE.md vs hand-written
@@ -0,0 +1,167 @@
1
+ # CLAUDE.md — anchormd
2
+
3
+ ## Project Overview
4
+
5
+ Generate and audit CLAUDE.md files for AI coding agents. Freemium CLI with Pro license server and Stripe-automated fulfillment.
6
+
7
+ ## Current State
8
+
9
+ - **Version**: 0.3.0
10
+ - **Language**: Python
11
+ - **Tests**: 134 (license server) + client-side tests
12
+ - **License Server**: `https://anmd-license.fly.dev` (Fly.io, SQLite + WAL)
13
+ - **Stripe**: Live — automated checkout → key generation → email delivery
14
+
15
+ ## Monetization
16
+
17
+ - **Free**: `generate`, `audit`, 11 community presets
18
+ - **Pro ($8/mo or $69/yr)**: `init`, `diff`, CI integration, 6 premium presets, team templates
19
+ - **Template Packs**: Gumroad ($5-10 each)
20
+ - **Payment Links**: Stripe Payment Links → webhook → auto key + email
21
+ - **Do NOT modify pricing without explicit approval**
22
+
23
+ ## Architecture
24
+
25
+ ```
26
+ anchormd/
27
+ ├── .github/workflows/
28
+ ├── docs/
29
+ ├── license_server/ # FastAPI license server (separate deployable)
30
+ │ ├── migrations/ # SQLite schema migrations
31
+ │ ├── routes/
32
+ │ │ ├── activate.py # POST /v1/activate (admin)
33
+ │ │ ├── validate.py # POST /v1/validate
34
+ │ │ ├── revoke.py # POST /v1/revoke (admin)
35
+ │ │ └── webhook.py # POST /v1/webhooks/stripe
36
+ │ ├── stripe_webhooks.py # Event handlers (checkout, cancel, payment_failed)
37
+ │ ├── email_delivery.py # SMTP license key delivery
38
+ │ ├── key_gen.py # ANMD-XXXX-XXXX-XXXX generation + hashing
39
+ │ ├── config.py # Env var configuration
40
+ │ ├── database.py # SQLite connection + migration runner
41
+ │ ├── models.py # Pydantic request/response models
42
+ │ ├── rate_limit.py # slowapi rate limiter
43
+ │ ├── Dockerfile # Multi-stage build for Fly.io
44
+ │ ├── fly.toml # Fly.io deployment config
45
+ │ └── requirements.txt # Server dependencies
46
+ ├── output/
47
+ ├── packs/ # Gumroad template packs
48
+ ├── prompts/
49
+ ├── scripts/
50
+ │ ├── stripe_setup.py # Create Stripe products/prices/payment links
51
+ │ └── keygen.py # Manual key generation (legacy)
52
+ ├── src/anchormd/ # CLI package (PyPI: anchormd)
53
+ │ ├── licensing.py # Client-side key detection, validation, caching
54
+ │ ├── machine_id.py # Hostname+username hash
55
+ │ ├── gates.py # @require_pro feature gating
56
+ │ └── cli.py # Typer CLI
57
+ ├── tests/
58
+ │ ├── drift/
59
+ │ └── license_server/
60
+ ├── .dockerignore
61
+ ├── pyproject.toml
62
+ ```
63
+
64
+ ## Tech Stack
65
+
66
+ - **Language**: Python, HTML, SQL
67
+ - **Package Manager**: pip
68
+ - **Linters**: ruff
69
+ - **Formatters**: ruff
70
+ - **Type Checkers**: mypy
71
+ - **Test Frameworks**: pytest
72
+ - **CI/CD**: GitHub Actions
73
+ - **Hosting**: Fly.io (license server), PyPI (CLI)
74
+ - **Payments**: Stripe (webhooks + payment links)
75
+ - **Email**: SMTP (Gmail app password)
76
+
77
+ ## API Endpoints (License Server)
78
+
79
+ | Endpoint | Auth | Rate Limit | Purpose |
80
+ |----------|------|------------|---------|
81
+ | `GET /v1/health` | None | 120/min | Health check + license counts |
82
+ | `POST /v1/activate` | Admin Bearer | 10/min | Create license key |
83
+ | `POST /v1/validate` | None | 60/min | Validate license key |
84
+ | `POST /v1/revoke` | Admin Bearer | 10/min | Revoke license key |
85
+ | `POST /v1/webhooks/stripe` | Stripe signature | 30/min | Automated fulfillment |
86
+
87
+ ## License Key System
88
+
89
+ - **Format**: `ANMD-XXXX-XXXX-XXXX` (uppercase alphanumeric)
90
+ - **Checksum**: Segment 3 = first 4 hex chars of `SHA256("anchormd-v1:{seg1}-{seg2}")`
91
+ - **Storage**: SHA-256 hash only — plaintext never stored
92
+ - **Masking**: `ANMD-****-****-{last4}` for display
93
+ - **Client detection**: `ANCHORMD_LICENSE` env var → `.anchormd-license` → `~/.config/anchormd/license`
94
+ - **Validation**: Local checksum → server call (5s timeout) → 24h cache → fail-open to local-only
95
+
96
+ ## Environment Variables
97
+
98
+ ### License Server (Fly.io secrets)
99
+ - `ANMD_ADMIN_SECRET` — Bearer token for admin endpoints
100
+ - `ANMD_DB_PATH` — SQLite path (default: `/data/license_server.db`)
101
+ - `STRIPE_SECRET_KEY` — Stripe API key
102
+ - `STRIPE_WEBHOOK_SECRET` — Stripe webhook signing secret
103
+ - `ANMD_SMTP_USER` — Gmail address
104
+ - `ANMD_SMTP_PASSWORD` — Gmail app password
105
+ - `ANMD_SMTP_FROM` — From address for emails
106
+
107
+ ### Client (user-side)
108
+ - `ANCHORMD_LICENSE` — License key
109
+ - `ANCHORMD_LICENSE_SERVER` — Server URL (optional)
110
+
111
+ ## Common Commands
112
+
113
+ ```bash
114
+ # test (all)
115
+ .venv/bin/python -m pytest tests/ -v
116
+ # test (license server only)
117
+ .venv/bin/python -m pytest tests/license_server/ -v
118
+ # lint
119
+ ruff check src/ tests/ license_server/
120
+ # format
121
+ ruff format src/ tests/ license_server/
122
+ # type check
123
+ mypy src/
124
+ # deploy license server
125
+ fly deploy --dockerfile license_server/Dockerfile -a anmd-license --config license_server/fly.toml
126
+ # health check
127
+ curl https://anmd-license.fly.dev/v1/health
128
+ ```
129
+
130
+ ## Coding Standards
131
+
132
+ - **Naming**: snake_case
133
+ - **Quote Style**: double quotes
134
+ - **Type Hints**: present
135
+ - **Imports**: absolute
136
+ - **Path Handling**: pathlib
137
+ - **Line Length**: 100 characters
138
+ - **Error Handling**: Custom exception classes, `from exc` in re-raises
139
+
140
+ ## Anti-Patterns (Do NOT Do)
141
+
142
+ - Do NOT commit secrets, API keys, or credentials
143
+ - Do NOT skip writing tests for new code
144
+ - Do NOT use `os.path` — use `pathlib.Path` everywhere
145
+ - Do NOT use bare `except:` — catch specific exceptions
146
+ - Do NOT use mutable default arguments
147
+ - Do NOT use `print()` for logging — use the `logging` module
148
+ - Do NOT store plaintext license keys in the database
149
+ - Do NOT modify pricing tiers without approval
150
+
151
+ ## Dependencies
152
+
153
+ ### CLI (PyPI)
154
+ - typer, rich, pydantic, tomli, pyyaml, jinja2
155
+ - httpx (optional, for server validation)
156
+
157
+ ### License Server (Fly.io)
158
+ - fastapi, uvicorn, pydantic, slowapi, stripe
159
+
160
+ ### Dev
161
+ - pytest, mypy, ruff, httpx
162
+
163
+ ## Git Conventions
164
+
165
+ - Commit messages: Conventional commits (`feat:`, `fix:`, `docs:`, `test:`, `refactor:`)
166
+ - Branch naming: `feat/description`, `fix/description`
167
+ - Run tests before committing
anchormd-0.4.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AreteDriver
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.