Skip to content

Commit f12778f

Browse files
committed
Initial commit
0 parents  commit f12778f

92 files changed

Lines changed: 4798 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

$null

Whitespace-only changes.

.devcontainer/devcontainer.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "understand-first",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.11",
4+
"features": {
5+
"ghcr.io/devcontainers/features/node:1": {
6+
"version": "18"
7+
},
8+
"ghcr.io/devcontainers/features/common-utils:2": {},
9+
"ghcr.io/devcontainers/features/github-cli:1": {},
10+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
11+
"installDocker": false
12+
}
13+
},
14+
"customizations": {
15+
"vscode": {
16+
"settings": {
17+
"python.defaultInterpreterPath": "/usr/local/bin/python",
18+
"terminal.integrated.defaultProfile.linux": "bash"
19+
},
20+
"extensions": [
21+
"ms-python.python",
22+
"ms-python.vscode-pylance"
23+
]
24+
}
25+
},
26+
"postCreateCommand": "python -m pip install --upgrade pip && pip install -r requirements.txt && pip install -e cli && npm -v && python -m pytest -q",
27+
"remoteUser": "vscode"
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Understand-First task
2+
description: Bug/feature with seeds + failure context to generate a focused lens and tour
3+
title: "[UF] "
4+
labels: ["understand-first"]
5+
body:
6+
- type: textarea
7+
id: summary
8+
attributes:
9+
label: Summary
10+
description: What are you trying to fix or add?
11+
- type: textarea
12+
id: seeds
13+
attributes:
14+
label: Seeds (files/functions/keywords)
15+
description: e.g., path/to/file.py:fn, failing endpoint, stack trace function
16+
- type: textarea
17+
id: failing
18+
attributes:
19+
label: Failing logs / stack traces
20+
- type: textarea
21+
id: expected
22+
attributes:
23+
label: Expected behavior
24+
- type: textarea
25+
id: boundaries
26+
attributes:
27+
label: Boundary files touched
28+
description: OpenAPI, proto, SQL schema, env vars, feature flags

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Understand-First
2+
- [ ] Seeds used (or default from `.understand-first.yml`)
3+
- [ ] Lens generated and merged with trace
4+
- [ ] Tour attached by CI (see PR comment)
5+
- [ ] Contracts/fixtures updated if behavior changed
6+
7+
### Context
8+
- Seeds:
9+
- Failing logs:
10+
- Expected behavior:
11+
- Boundaries touched:

.github/workflows/ci-tests.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: CI
2+
on: [push, pull_request]
3+
jobs:
4+
test:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- uses: actions/setup-python@v5
9+
with: { python-version: '3.11' }
10+
- run: |
11+
python -m pip install --upgrade pip
12+
pip install -r requirements.txt
13+
pip install -e cli
14+
pytest -q
15+
build-wheel:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-python@v5
20+
with: { python-version: '3.11' }
21+
- run: |
22+
python -m pip install --upgrade build
23+
cd cli && python -m build
24+
- uses: actions/upload-artifact@v4
25+
with:
26+
name: cli-dist
27+
path: cli/dist/*

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Python CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out code
12+
uses: actions/checkout@v4
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: "3.10"
18+
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install -r requirements.txt
23+
pip install ruff
24+
25+
- name: Lint
26+
run: ruff check .
27+
28+
- name: Compose contracts and generate Lean stubs
29+
run: |
30+
python u.py contracts compose -i contracts/contracts_from_openapi.yaml -i contracts/contracts_from_proto.yaml -o contracts/contracts.yaml
31+
python u.py contracts lean-stubs contracts/contracts.yaml -o contracts/lean/
32+
python u.py contracts verify-lean contracts/contracts.yaml -l contracts/lean
33+
34+
- name: Run tests
35+
run: pytest -q

.github/workflows/codeql.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
jobs:
10+
analyze:
11+
permissions:
12+
security-events: write
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: github/codeql-action/init@v3
17+
with:
18+
languages: python, javascript
19+
- uses: github/codeql-action/analyze@v3

.github/workflows/pack-publish.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish Understanding Pack
2+
on:
3+
workflow_dispatch: {}
4+
push:
5+
branches: [ main ]
6+
paths: [ 'tours/**', 'docs/**', 'maps/**' ]
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-python@v5
13+
with: { python-version: '3.11' }
14+
- run: |
15+
pip install -e cli
16+
u pack --publish
17+
- name: Prepare site
18+
run: |
19+
mkdir -p site
20+
echo "<h1>Understanding Pack</h1><ul>" > site/index.html
21+
for f in docs/glossary.md docs/understanding-dashboard.md; do
22+
test -f "$f" && echo "<li><a href='/$f'>$f</a></li>" >> site/index.html
23+
done
24+
test -f maps/delta.svg && cp maps/delta.svg site/delta.svg && echo "<li><a href='/site/delta.svg'>delta.svg</a></li>" >> site/index.html || true
25+
echo "</ul>" >> site/index.html
26+
- uses: actions/upload-pages-artifact@v3
27+
with: { path: '.' }
28+
deploy:
29+
needs: build
30+
permissions:
31+
pages: write
32+
id-token: write
33+
environment:
34+
name: github-pages
35+
url: ${{ steps.deployment.outputs.page_url }}
36+
runs-on: ubuntu-latest
37+
steps:
38+
- id: deployment
39+
uses: actions/deploy-pages@v4
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: PR Delta Comment
2+
on:
3+
pull_request:
4+
types: [opened, synchronize]
5+
jobs:
6+
delta:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: actions/setup-python@v5
11+
with:
12+
python-version: '3.11'
13+
- name: Install CLI
14+
run: |
15+
cd cli && pip install -e .
16+
- name: Build lens (base)
17+
run: |
18+
git fetch origin ${{ github.base_ref }} --depth=1 || true
19+
git checkout -qf ${{ github.base_ref }} || true
20+
u scan . -o maps/repo_base.json || true
21+
u lens from-seeds --seed $(git ls-files | head -n 30) --map maps/repo_base.json -o maps/lens_base.json || true
22+
- name: Build lens (head)
23+
run: |
24+
git checkout -qf ${{ github.sha }}
25+
u scan . -o maps/repo_head.json || true
26+
u lens from-seeds --seed $(git diff --name-only ${{ github.base_ref }} | tr '\n' ' ') --map maps/repo_head.json -o maps/lens_head.json || true
27+
- name: Visualize delta
28+
run: |
29+
u visual delta maps/lens_base.json maps/lens_head.json -o maps/delta.svg || true
30+
- name: Comment on PR with delta
31+
uses: actions/github-script@v7
32+
with:
33+
script: |
34+
const fs = require('fs');
35+
let svg = ''; try { svg = fs.readFileSync('maps/delta.svg', 'utf8'); } catch(e) {}
36+
const b64 = Buffer.from(svg).toString('base64');
37+
const body = `### Understand-First Delta\n<img alt="delta" src="data:image/svg+xml;base64,${b64}" />`;
38+
github.rest.issues.createComment({ ...context.repo, issue_number: context.issue.number, body });

.github/workflows/publish-pypi.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish PyPI
2+
on:
3+
workflow_dispatch: {}
4+
release:
5+
types: [published]
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
id-token: write
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
with: { python-version: '3.11' }
15+
- run: |
16+
python -m pip install --upgrade build
17+
cd cli && python -m build
18+
- uses: pypa/gh-action-pypi-publish@release/v1
19+
with:
20+
packages-dir: cli/dist
21+
skip-existing: true

0 commit comments

Comments
 (0)