Skip to content

Commit 0de8b2c

Browse files
committed
feat: Implement initial KnowCode project structure, core data models, and language specific parsers for Python, Markdown and YAML files.
1 parent 4faae0f commit 0de8b2c

24 files changed

Lines changed: 5019 additions & 1 deletion

.github/workflows/ci-cd.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
name: Test & Lint (${{ matrix.os }} / py${{ matrix.python-version }})
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-latest, windows-latest, macos-latest]
17+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0 # Fetch all history for changelog/commit analysis if needed
24+
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v3
27+
with:
28+
enable-cache: true
29+
cache-dependency-glob: "uv.lock"
30+
31+
- name: Install dependencies
32+
run: uv sync --all-extras --dev
33+
34+
- name: Lint with Ruff
35+
run: uv run ruff check .
36+
37+
- name: Test with pytest (and coverage)
38+
run: uv run pytest -v --cov=src --cov-report=xml
39+
40+
- name: Upload coverage to Codecov
41+
uses: codecov/codecov-action@v4
42+
with:
43+
token: ${{ secrets.CODECOV_TOKEN }}
44+
file: ./coverage.xml
45+
fail_ci_if_error: false # Don't fail the build if codecov is just down/unconfigured
46+
47+
- name: Prune uv cache
48+
run: uv cache prune --ci
49+
50+
docs:
51+
name: Build Documentation
52+
runs-on: ubuntu-latest
53+
needs: test # Only build docs if tests pass
54+
steps:
55+
- name: Checkout code
56+
uses: actions/checkout@v4
57+
58+
- name: Install uv
59+
uses: astral-sh/setup-uv@v3
60+
61+
- name: Install dependencies
62+
run: uv sync --all-extras --dev
63+
64+
- name: Build MkDocs
65+
run: uv run mkdocs build
66+
67+
# Optional: Deploy to GitHub Pages (disabled for this example, but ready to enable)
68+
# - name: Deploy to GitHub Pages
69+
# uses: mkdocs/gh-deployer@...
70+
71+
changelog:
72+
name: Generate Changelog
73+
runs-on: ubuntu-latest
74+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' # Only runs on push to main
75+
steps:
76+
- name: Checkout code
77+
uses: actions/checkout@v4
78+
with:
79+
fetch-depth: 100 # Fetch enough history for the log
80+
81+
- name: Generate Changelog Entry
82+
# We run the script directly. In a real scenario, this step might modify the file
83+
# and create a PR, or just upload the artifact.
84+
# For now, it appends to CHANGELOG.md in the runner.
85+
run: python3 scripts/generate_changelog.py
86+
87+
- name: Upload Changelog Artifact
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: changelog-update
91+
path: CHANGELOG.md

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,8 @@ cython_debug/
205205
marimo/_static/
206206
marimo/_lsp/
207207
__marimo__/
208+
209+
# KnowCode generated files
210+
knowcode_knowledge.json
211+
docs_test/
212+

EVOLUTION.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Project Evolution & Delta Log
2+
3+
This document tracks the incremental evolution of the codebase. It serves as a high-level narrative for human developers and a semantic anchor for LLMs.
4+
5+
---
6+
7+
## [v0.1.0] - 2023-10-27
8+
9+
**Commit Range:** `init...a1b2c3d`
10+
**Focus:** MVP Release - Core Parsing and Graph Building
11+
12+
### 🧠 Temporal Context & Intent
13+
Initial release of the KnowCode MVP. The primary focus was establishing the pipeline to convert raw source code into a queryable knowledge graph. The scope was strictly limited to Python, Markdown, and YAML to prove the concept of "token-efficient context generation" without tracking temporal changes (git history) yet.
14+
15+
### 🏗️ Architectural Impact
16+
* **Pipeline Established:** Implemented the core `Scanner` -> `Parser` -> `GraphBuilder` -> `ContextSynthesizer` flow.
17+
* **Graph Model:** Entities (Class, Function, Module) are now linked via simple relationships (Calls, Imports, Inherits) in an in-memory store.
18+
* **CLI:** Established `click`-based CLI as the sole entry point.
19+
20+
### 📝 Delta Changes
21+
22+
#### 🚀 Features (`feat`)
23+
* **parser:** Implement Python AST parser for function/class extraction
24+
* *Context:* Uses standard `ast` library to identify nodes and edges.
25+
* **graph:** Create in-memory KnowledgeStore with JSON export
26+
* **cli:** Add `analyze` and `query` commands
27+
* *Context:* Allows users to build the graph and perform relationship lookups (callers/callees).
28+
29+
#### 🐛 Fixes (`fix`)
30+
* **scanner:** Correctly ignore files listed in `.gitignore`
31+
* *Resolution:* Integrated `pathspec` to parse gitignore patterns before scanning.
32+
33+
#### 🔧 Maintenance (`chore`, `docs`)
34+
* **docs:** Add comprehensive project documentation and CLI reference
35+
* **ci:** Configure basic GitHub Actions for linting (ruff)

0 commit comments

Comments
 (0)