loom-context 0.1.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.
- loom_context-0.1.0/.github/workflows/ci.yml +131 -0
- loom_context-0.1.0/.github/workflows/pypi-publish.yml +120 -0
- loom_context-0.1.0/.gitignore +46 -0
- loom_context-0.1.0/CHANGELOG.md +31 -0
- loom_context-0.1.0/CONTRIBUTING.md +416 -0
- loom_context-0.1.0/LICENSE +21 -0
- loom_context-0.1.0/PKG-INFO +220 -0
- loom_context-0.1.0/README.md +177 -0
- loom_context-0.1.0/docs/INDEX.md +80 -0
- loom_context-0.1.0/docs/REFERENCES.md +153 -0
- loom_context-0.1.0/docs/architecture/directory-structure.md +144 -0
- loom_context-0.1.0/docs/architecture/overview.md +304 -0
- loom_context-0.1.0/docs/architecture/patterns.md +205 -0
- loom_context-0.1.0/docs/diagrams/component-map.md +158 -0
- loom_context-0.1.0/docs/diagrams/data-flow.md +122 -0
- loom_context-0.1.0/docs/guides/best-practices.md +167 -0
- loom_context-0.1.0/docs/guides/cli-reference.md +154 -0
- loom_context-0.1.0/docs/guides/context-output.md +239 -0
- loom_context-0.1.0/docs/guides/philosophy.md +179 -0
- loom_context-0.1.0/docs/guides/quickstart.md +153 -0
- loom_context-0.1.0/docs/guides/security.md +121 -0
- loom_context-0.1.0/pyproject.toml +112 -0
- loom_context-0.1.0/src/loom_context/__init__.py +3 -0
- loom_context-0.1.0/src/loom_context/auditors/__init__.py +6 -0
- loom_context-0.1.0/src/loom_context/auditors/naming.py +107 -0
- loom_context-0.1.0/src/loom_context/auditors/structure.py +134 -0
- loom_context-0.1.0/src/loom_context/cli.py +271 -0
- loom_context-0.1.0/src/loom_context/config.py +36 -0
- loom_context-0.1.0/src/loom_context/engine.py +80 -0
- loom_context-0.1.0/src/loom_context/generators/__init__.py +7 -0
- loom_context-0.1.0/src/loom_context/generators/context.py +214 -0
- loom_context-0.1.0/src/loom_context/generators/index.py +123 -0
- loom_context-0.1.0/src/loom_context/generators/prompt.py +111 -0
- loom_context-0.1.0/src/loom_context/py.typed +0 -0
- loom_context-0.1.0/src/loom_context/scanners/__init__.py +8 -0
- loom_context-0.1.0/src/loom_context/scanners/base.py +22 -0
- loom_context-0.1.0/src/loom_context/scanners/code.py +292 -0
- loom_context-0.1.0/src/loom_context/scanners/deps.py +303 -0
- loom_context-0.1.0/src/loom_context/scanners/docs.py +193 -0
- loom_context-0.1.0/src/loom_context/scanners/structure.py +372 -0
- loom_context-0.1.0/src/loom_context/security/__init__.py +5 -0
- loom_context-0.1.0/src/loom_context/security/filter.py +151 -0
- loom_context-0.1.0/src/loom_context/templates/architecture.md.j2 +59 -0
- loom_context-0.1.0/src/loom_context/templates/directory_map.md.j2 +26 -0
- loom_context-0.1.0/src/loom_context/templates/naming.md.j2 +70 -0
- loom_context-0.1.0/tests/__init__.py +0 -0
- loom_context-0.1.0/tests/conftest.py +111 -0
- loom_context-0.1.0/tests/test_cli.py +396 -0
|
@@ -0,0 +1,131 @@
|
|
|
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: ${{ matrix.os }}
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
15
|
+
python-version: ["3.9", "3.10", "3.11", "3.12"]
|
|
16
|
+
fail-fast: false
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: |
|
|
28
|
+
python -m pip install --upgrade pip
|
|
29
|
+
pip install -e ".[dev]"
|
|
30
|
+
|
|
31
|
+
- name: Run tests
|
|
32
|
+
run: pytest -v --tb=short
|
|
33
|
+
|
|
34
|
+
- name: Run tests with coverage
|
|
35
|
+
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'
|
|
36
|
+
run: |
|
|
37
|
+
pip install pytest-cov
|
|
38
|
+
pytest --cov=loom_context --cov-report=term-missing --cov-report=xml
|
|
39
|
+
|
|
40
|
+
- name: Upload coverage
|
|
41
|
+
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'
|
|
42
|
+
uses: actions/upload-artifact@v4
|
|
43
|
+
with:
|
|
44
|
+
name: coverage-report
|
|
45
|
+
path: coverage.xml
|
|
46
|
+
|
|
47
|
+
lint:
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
steps:
|
|
50
|
+
- uses: actions/checkout@v4
|
|
51
|
+
|
|
52
|
+
- name: Set up Python
|
|
53
|
+
uses: actions/setup-python@v5
|
|
54
|
+
with:
|
|
55
|
+
python-version: "3.12"
|
|
56
|
+
|
|
57
|
+
- name: Install dependencies
|
|
58
|
+
run: |
|
|
59
|
+
python -m pip install --upgrade pip
|
|
60
|
+
pip install -e ".[dev]"
|
|
61
|
+
|
|
62
|
+
- name: Ruff lint
|
|
63
|
+
run: ruff check src/ tests/
|
|
64
|
+
|
|
65
|
+
- name: Ruff format check
|
|
66
|
+
run: ruff format --check src/ tests/
|
|
67
|
+
|
|
68
|
+
type-check:
|
|
69
|
+
runs-on: ubuntu-latest
|
|
70
|
+
steps:
|
|
71
|
+
- uses: actions/checkout@v4
|
|
72
|
+
|
|
73
|
+
- name: Set up Python
|
|
74
|
+
uses: actions/setup-python@v5
|
|
75
|
+
with:
|
|
76
|
+
python-version: "3.12"
|
|
77
|
+
|
|
78
|
+
- name: Install dependencies
|
|
79
|
+
run: |
|
|
80
|
+
python -m pip install --upgrade pip
|
|
81
|
+
pip install -e ".[dev]"
|
|
82
|
+
|
|
83
|
+
- name: Mypy
|
|
84
|
+
run: mypy src/loom_context/ --ignore-missing-imports
|
|
85
|
+
|
|
86
|
+
security:
|
|
87
|
+
runs-on: ubuntu-latest
|
|
88
|
+
steps:
|
|
89
|
+
- uses: actions/checkout@v4
|
|
90
|
+
|
|
91
|
+
- name: Set up Python
|
|
92
|
+
uses: actions/setup-python@v5
|
|
93
|
+
with:
|
|
94
|
+
python-version: "3.12"
|
|
95
|
+
|
|
96
|
+
- name: Install dependencies
|
|
97
|
+
run: |
|
|
98
|
+
python -m pip install --upgrade pip
|
|
99
|
+
pip install pip-audit
|
|
100
|
+
|
|
101
|
+
- name: Audit dependencies
|
|
102
|
+
run: pip-audit --require-hashes=false -r <(pip freeze)
|
|
103
|
+
shell: bash
|
|
104
|
+
|
|
105
|
+
build:
|
|
106
|
+
runs-on: ubuntu-latest
|
|
107
|
+
needs: [test, lint, type-check]
|
|
108
|
+
steps:
|
|
109
|
+
- uses: actions/checkout@v4
|
|
110
|
+
|
|
111
|
+
- name: Set up Python
|
|
112
|
+
uses: actions/setup-python@v5
|
|
113
|
+
with:
|
|
114
|
+
python-version: "3.12"
|
|
115
|
+
|
|
116
|
+
- name: Install build tools
|
|
117
|
+
run: |
|
|
118
|
+
python -m pip install --upgrade pip
|
|
119
|
+
pip install build twine
|
|
120
|
+
|
|
121
|
+
- name: Build package
|
|
122
|
+
run: python -m build
|
|
123
|
+
|
|
124
|
+
- name: Verify package
|
|
125
|
+
run: twine check dist/*
|
|
126
|
+
|
|
127
|
+
- name: Upload artifacts
|
|
128
|
+
uses: actions/upload-artifact@v4
|
|
129
|
+
with:
|
|
130
|
+
name: dist
|
|
131
|
+
path: dist/
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
# Manual trigger for testing
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
inputs:
|
|
10
|
+
target:
|
|
11
|
+
description: "Publish target"
|
|
12
|
+
required: true
|
|
13
|
+
default: "testpypi"
|
|
14
|
+
type: choice
|
|
15
|
+
options:
|
|
16
|
+
- testpypi
|
|
17
|
+
- pypi
|
|
18
|
+
|
|
19
|
+
permissions:
|
|
20
|
+
contents: read
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
build:
|
|
24
|
+
name: Build distribution
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v4
|
|
28
|
+
|
|
29
|
+
- name: Set up Python
|
|
30
|
+
uses: actions/setup-python@v5
|
|
31
|
+
with:
|
|
32
|
+
python-version: "3.12"
|
|
33
|
+
|
|
34
|
+
- name: Install build tools
|
|
35
|
+
run: |
|
|
36
|
+
python -m pip install --upgrade pip
|
|
37
|
+
pip install build twine
|
|
38
|
+
|
|
39
|
+
- name: Build package
|
|
40
|
+
run: python -m build
|
|
41
|
+
|
|
42
|
+
- name: Verify package
|
|
43
|
+
run: twine check dist/*
|
|
44
|
+
|
|
45
|
+
- name: Upload build artifacts
|
|
46
|
+
uses: actions/upload-artifact@v4
|
|
47
|
+
with:
|
|
48
|
+
name: dist
|
|
49
|
+
path: dist/
|
|
50
|
+
|
|
51
|
+
test-install:
|
|
52
|
+
name: Test installation
|
|
53
|
+
needs: build
|
|
54
|
+
runs-on: ${{ matrix.os }}
|
|
55
|
+
strategy:
|
|
56
|
+
matrix:
|
|
57
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
58
|
+
python-version: ["3.9", "3.12"]
|
|
59
|
+
steps:
|
|
60
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
61
|
+
uses: actions/setup-python@v5
|
|
62
|
+
with:
|
|
63
|
+
python-version: ${{ matrix.python-version }}
|
|
64
|
+
|
|
65
|
+
- name: Download artifacts
|
|
66
|
+
uses: actions/download-artifact@v4
|
|
67
|
+
with:
|
|
68
|
+
name: dist
|
|
69
|
+
path: dist/
|
|
70
|
+
|
|
71
|
+
- name: Install from wheel
|
|
72
|
+
run: pip install dist/*.whl
|
|
73
|
+
shell: bash
|
|
74
|
+
|
|
75
|
+
- name: Verify CLI works
|
|
76
|
+
run: |
|
|
77
|
+
loom --version
|
|
78
|
+
loom --help
|
|
79
|
+
|
|
80
|
+
publish-testpypi:
|
|
81
|
+
name: Publish to TestPyPI
|
|
82
|
+
needs: [build, test-install]
|
|
83
|
+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'testpypi'
|
|
84
|
+
runs-on: ubuntu-latest
|
|
85
|
+
environment:
|
|
86
|
+
name: testpypi
|
|
87
|
+
url: https://test.pypi.org/p/loom-context
|
|
88
|
+
permissions:
|
|
89
|
+
id-token: write
|
|
90
|
+
steps:
|
|
91
|
+
- name: Download artifacts
|
|
92
|
+
uses: actions/download-artifact@v4
|
|
93
|
+
with:
|
|
94
|
+
name: dist
|
|
95
|
+
path: dist/
|
|
96
|
+
|
|
97
|
+
- name: Publish to TestPyPI
|
|
98
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
99
|
+
with:
|
|
100
|
+
repository-url: https://test.pypi.org/legacy/
|
|
101
|
+
|
|
102
|
+
publish-pypi:
|
|
103
|
+
name: Publish to PyPI
|
|
104
|
+
needs: [build, test-install]
|
|
105
|
+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'pypi')
|
|
106
|
+
runs-on: ubuntu-latest
|
|
107
|
+
environment:
|
|
108
|
+
name: pypi
|
|
109
|
+
url: https://pypi.org/p/loom-context
|
|
110
|
+
permissions:
|
|
111
|
+
id-token: write
|
|
112
|
+
steps:
|
|
113
|
+
- name: Download artifacts
|
|
114
|
+
uses: actions/download-artifact@v4
|
|
115
|
+
with:
|
|
116
|
+
name: dist
|
|
117
|
+
path: dist/
|
|
118
|
+
|
|
119
|
+
- name: Publish to PyPI
|
|
120
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
*.egg-info/
|
|
7
|
+
*.egg
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
.eggs/
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
env/
|
|
16
|
+
ENV/
|
|
17
|
+
|
|
18
|
+
# IDE
|
|
19
|
+
.vscode/
|
|
20
|
+
.idea/
|
|
21
|
+
*.swp
|
|
22
|
+
*.swo
|
|
23
|
+
*~
|
|
24
|
+
|
|
25
|
+
# Testing
|
|
26
|
+
.pytest_cache/
|
|
27
|
+
.coverage
|
|
28
|
+
htmlcov/
|
|
29
|
+
coverage.xml
|
|
30
|
+
|
|
31
|
+
# Linting / Type checking
|
|
32
|
+
.ruff_cache/
|
|
33
|
+
.mypy_cache/
|
|
34
|
+
|
|
35
|
+
# OS
|
|
36
|
+
.DS_Store
|
|
37
|
+
Thumbs.db
|
|
38
|
+
|
|
39
|
+
# Secrets
|
|
40
|
+
.env
|
|
41
|
+
.env.*
|
|
42
|
+
*.pem
|
|
43
|
+
*.key
|
|
44
|
+
|
|
45
|
+
# Loom output (optional - uncomment if you don't want to commit)
|
|
46
|
+
# .context/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Loom-Context will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-03-14
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- Initial release of Loom-Context
|
|
11
|
+
- **CLI** with 6 commands: `init`, `scan`, `prompt`, `audit`, `plan`, `watch`
|
|
12
|
+
- **StructureScanner**: detects project type (15+ types), architecture patterns (Clean Architecture, Hexagonal, MVC, MVVM, Feature-based, Layered), directory tree with 80+ semantic annotations
|
|
13
|
+
- **DependencyScanner**: parses package.json, pyproject.toml, requirements.txt; categorizes 130+ known packages into functional groups
|
|
14
|
+
- **CodeScanner**: infers naming conventions from code (PascalCase, camelCase, kebab-case, snake_case), detects suffix/prefix patterns (Service, Repository, Adapter, I-prefix, use-prefix), reads tsconfig.json import aliases
|
|
15
|
+
- **DocsScanner**: indexes markdown documentation, classifies by type (architecture, plan, feature, setup), extracts plan status items
|
|
16
|
+
- **ContextGenerator**: generates 7 structured files in `.context/` (index.json, architecture.md, naming.md, directory-map.md, stack.json, rules.json, plans-summary.md)
|
|
17
|
+
- **PromptGenerator**: compiles all `.context/` files into a single master AI system prompt
|
|
18
|
+
- **NamingAuditor**: validates interface prefix conventions
|
|
19
|
+
- **StructureAuditor**: validates layer boundary rules (forbidden imports between architectural layers)
|
|
20
|
+
- **Security**: 3-layer file filtering (`.gitignore` + `.contextignore` + hardcoded secrets patterns)
|
|
21
|
+
- **25 unit tests** covering all components
|
|
22
|
+
- **Documentation**: 13 docs covering philosophy, architecture, patterns, quickstart, CLI reference, security, best practices, diagrams, and scientific references
|
|
23
|
+
- Rich terminal output with tables and panels
|
|
24
|
+
|
|
25
|
+
### Known Limitations
|
|
26
|
+
- `.context/loom.json` overrides are read but `extra_rules` and `audit_exceptions` are not yet processed
|
|
27
|
+
- Incremental scan (`loom scan`) re-scans everything (true incremental planned for 0.2)
|
|
28
|
+
- Auditors only check TypeScript/JavaScript files for naming and imports
|
|
29
|
+
- No plugin system yet (scanners/auditors are hardcoded)
|
|
30
|
+
|
|
31
|
+
[0.1.0]: https://github.com/jadruiz/Loom-Context/releases/tag/v0.1.0
|