cg-code-graph 0.10.1__py3-none-any.whl
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.
- cg_code_graph-0.10.1.dist-info/METADATA +678 -0
- cg_code_graph-0.10.1.dist-info/RECORD +174 -0
- cg_code_graph-0.10.1.dist-info/WHEEL +5 -0
- cg_code_graph-0.10.1.dist-info/entry_points.txt +3 -0
- cg_code_graph-0.10.1.dist-info/licenses/LICENSE +21 -0
- cg_code_graph-0.10.1.dist-info/top_level.txt +1 -0
- codegraph/__init__.py +2 -0
- codegraph/aitools.py +129 -0
- codegraph/apps.py +76 -0
- codegraph/blindspots.py +428 -0
- codegraph/bridges.py +1701 -0
- codegraph/cli.py +725 -0
- codegraph/concepts.py +362 -0
- codegraph/config.py +559 -0
- codegraph/core/__init__.py +0 -0
- codegraph/core/cache.py +375 -0
- codegraph/core/detect.py +80 -0
- codegraph/core/extractors.py +187 -0
- codegraph/core/fsutil.py +61 -0
- codegraph/core/generated.py +575 -0
- codegraph/core/model.py +174 -0
- codegraph/core/paths.py +175 -0
- codegraph/core/plugin.py +160 -0
- codegraph/core/store.py +80 -0
- codegraph/core/syntax_errors.py +132 -0
- codegraph/coverage.py +928 -0
- codegraph/doctor.py +453 -0
- codegraph/external.py +613 -0
- codegraph/indexer.py +336 -0
- codegraph/link.py +434 -0
- codegraph/lint_async.py +524 -0
- codegraph/mcp_server.py +1303 -0
- codegraph/parity.py +473 -0
- codegraph/parity_structure.py +307 -0
- codegraph/payload.py +321 -0
- codegraph/plans.py +1285 -0
- codegraph/platform_scan.py +643 -0
- codegraph/platforms.py +1369 -0
- codegraph/plugins/__init__.py +0 -0
- codegraph/plugins/cfamily/__init__.py +0 -0
- codegraph/plugins/cfamily/plugin.py +930 -0
- codegraph/plugins/cfamily/syntax.py +881 -0
- codegraph/plugins/dart/__init__.py +0 -0
- codegraph/plugins/dart/bridges.py +345 -0
- codegraph/plugins/dart/extractor/bin/extract.dart +717 -0
- codegraph/plugins/dart/extractor/pubspec.lock +149 -0
- codegraph/plugins/dart/extractor/pubspec.yaml +7 -0
- codegraph/plugins/dart/http.py +904 -0
- codegraph/plugins/dart/models.py +308 -0
- codegraph/plugins/dart/plugin.py +625 -0
- codegraph/plugins/dart/program.py +907 -0
- codegraph/plugins/django/__init__.py +0 -0
- codegraph/plugins/django/extras.py +378 -0
- codegraph/plugins/django/models.py +508 -0
- codegraph/plugins/django/plugin.py +728 -0
- codegraph/plugins/django/schemas.py +339 -0
- codegraph/plugins/django/shapes.py +216 -0
- codegraph/plugins/django/urls.py +603 -0
- codegraph/plugins/express/__init__.py +0 -0
- codegraph/plugins/express/plugin.py +428 -0
- codegraph/plugins/flutter/__init__.py +0 -0
- codegraph/plugins/flutter/plugin.py +538 -0
- codegraph/plugins/kotlin/__init__.py +0 -0
- codegraph/plugins/kotlin/exact.py +457 -0
- codegraph/plugins/kotlin/plugin.py +1961 -0
- codegraph/plugins/kotlin/reparse.py +234 -0
- codegraph/plugins/laravel/__init__.py +0 -0
- codegraph/plugins/laravel/broadcast.py +351 -0
- codegraph/plugins/laravel/plugin.py +863 -0
- codegraph/plugins/laravel/tests.py +262 -0
- codegraph/plugins/laravel/values.py +728 -0
- codegraph/plugins/native/__init__.py +0 -0
- codegraph/plugins/native/gates.py +286 -0
- codegraph/plugins/native/runner.py +183 -0
- codegraph/plugins/native/scipread.py +194 -0
- codegraph/plugins/native/ts.py +54 -0
- codegraph/plugins/nest/__init__.py +0 -0
- codegraph/plugins/nest/plugin.py +654 -0
- codegraph/plugins/nextjs/__init__.py +0 -0
- codegraph/plugins/nextjs/plugin.py +336 -0
- codegraph/plugins/nuxt/__init__.py +0 -0
- codegraph/plugins/nuxt/plugin.py +308 -0
- codegraph/plugins/php/__init__.py +0 -0
- codegraph/plugins/php/extractor/composer.json +5 -0
- codegraph/plugins/php/extractor/composer.lock +76 -0
- codegraph/plugins/php/extractor/extract.php +743 -0
- codegraph/plugins/php/gating.py +573 -0
- codegraph/plugins/php/plugin.py +668 -0
- codegraph/plugins/php/strings.py +197 -0
- codegraph/plugins/python/__init__.py +0 -0
- codegraph/plugins/python/aitools.py +664 -0
- codegraph/plugins/python/external.py +245 -0
- codegraph/plugins/python/fields.py +107 -0
- codegraph/plugins/python/plugin.py +1733 -0
- codegraph/plugins/python/refs.py +485 -0
- codegraph/plugins/python/roots.py +412 -0
- codegraph/plugins/python/socketio.py +210 -0
- codegraph/plugins/python/subproc.py +864 -0
- codegraph/plugins/python/tests.py +1040 -0
- codegraph/plugins/python/values.py +179 -0
- codegraph/plugins/pyweb/__init__.py +0 -0
- codegraph/plugins/pyweb/plugin.py +1334 -0
- codegraph/plugins/pyweb/values.py +68 -0
- codegraph/plugins/rust/__init__.py +0 -0
- codegraph/plugins/rust/cargo.py +226 -0
- codegraph/plugins/rust/plugin.py +980 -0
- codegraph/plugins/rust/syntax.py +678 -0
- codegraph/plugins/scip/__init__.py +0 -0
- codegraph/plugins/scip/importer.py +129 -0
- codegraph/plugins/scip/scip.proto +962 -0
- codegraph/plugins/scip/scip_pb2.py +97 -0
- codegraph/plugins/stubs/__init__.py +0 -0
- codegraph/plugins/stubs/plugins.py +38 -0
- codegraph/plugins/swift/__init__.py +0 -0
- codegraph/plugins/swift/baseurl.py +109 -0
- codegraph/plugins/swift/exact.py +415 -0
- codegraph/plugins/swift/indexstore.py +209 -0
- codegraph/plugins/swift/packages.py +174 -0
- codegraph/plugins/swift/plugin.py +2890 -0
- codegraph/plugins/ts/__init__.py +0 -0
- codegraph/plugins/ts/baseurl.py +185 -0
- codegraph/plugins/ts/extractor/extract.mjs +2652 -0
- codegraph/plugins/ts/extractor/fw.mjs +685 -0
- codegraph/plugins/ts/extractor/package-lock.json +205 -0
- codegraph/plugins/ts/extractor/package.json +9 -0
- codegraph/plugins/ts/plugin.py +480 -0
- codegraph/plugins/tsweb/__init__.py +0 -0
- codegraph/plugins/tsweb/common.py +290 -0
- codegraph/plugins/tsweb/data.py +276 -0
- codegraph/presets/__init__.py +146 -0
- codegraph/presets/c_cpp.yaml +9 -0
- codegraph/presets/common.yaml +66 -0
- codegraph/presets/dart.yaml +9 -0
- codegraph/presets/django-ninja.yaml +15 -0
- codegraph/presets/django.yaml +25 -0
- codegraph/presets/djangorestframework.yaml +17 -0
- codegraph/presets/express.yaml +17 -0
- codegraph/presets/kotlin.yaml +11 -0
- codegraph/presets/laravel.yaml +40 -0
- codegraph/presets/nest.yaml +11 -0
- codegraph/presets/nextjs.yaml +15 -0
- codegraph/presets/nuxt.yaml +9 -0
- codegraph/presets/php.yaml +5 -0
- codegraph/presets/python.yaml +10 -0
- codegraph/presets/rust.yaml +5 -0
- codegraph/presets/swift.yaml +10 -0
- codegraph/presets/typescript.yaml +13 -0
- codegraph/process_runs.py +328 -0
- codegraph/protocols/__init__.py +299 -0
- codegraph/protocols/builtin.py +67 -0
- codegraph/protocols/matchers.py +144 -0
- codegraph/protocols/view.py +334 -0
- codegraph/query.py +2089 -0
- codegraph/realtime.py +260 -0
- codegraph/roundtrip.py +346 -0
- codegraph/routes.py +442 -0
- codegraph/starters.py +218 -0
- codegraph/tests_index.py +117 -0
- codegraph/viz/__init__.py +0 -0
- codegraph/viz/graph.py +369 -0
- codegraph/viz/server.py +198 -0
- codegraph/viz/static/app.css +148 -0
- codegraph/viz/static/app.js +1082 -0
- codegraph/viz/static/index.html +81 -0
- codegraph/viz/static/layered.js +237 -0
- codegraph/viz/static/vendor/VERSIONS.txt +4 -0
- codegraph/viz/static/vendor/cose-base.js +3214 -0
- codegraph/viz/static/vendor/cytoscape-fcose.js +1549 -0
- codegraph/viz/static/vendor/cytoscape.min.js +31 -0
- codegraph/viz/static/vendor/layout-base.js +5230 -0
- codegraph/viz/tools/package-lock.json +303 -0
- codegraph/viz/tools/package.json +7 -0
- codegraph/viz/tools/shoot.mjs +165 -0
- codegraph/xcode.py +251 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"""Built-in presets: versioned data files with the per-language and per-framework knowledge cg applies.
|
|
2
|
+
|
|
3
|
+
common.yaml every project: name-based auth / secret token patterns, directories no walk descends into
|
|
4
|
+
<language>.yaml php, typescript, python, dart, rust, c_cpp: skip directories / paths of that ecosystem
|
|
5
|
+
<framework>.yaml laravel, django, djangorestframework, django-ninja, nest, next, express, nuxt: guard names
|
|
6
|
+
(auth / not_auth / secret), plan defaults, framework-specific skip directories
|
|
7
|
+
|
|
8
|
+
Detection picks them: `select()` returns the applied names in merge order (common -> languages -> frameworks); the
|
|
9
|
+
project's `.cg.yaml` and command-line flags come after them. The index records the applied names in its stats
|
|
10
|
+
(`stats.presets`), and `cg coverage`, `cg config show` and MCP `coverage` show them."""
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import functools
|
|
14
|
+
import re
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
PRESET_DIR = Path(__file__).parent
|
|
18
|
+
LANGUAGE_ORDER = ("php", "typescript", "python", "dart", "rust", "c_cpp", "kotlin", "swift")
|
|
19
|
+
# framework spellings accepted in .cg.yaml `frameworks.add/remove` -> framework plugin / preset name
|
|
20
|
+
FRAMEWORK_ALIASES = {"nestjs": "nest", "next": "nextjs", "next.js": "nextjs", "koa": "express", "fastify": "express",
|
|
21
|
+
"hono": "express", "starlette": "fastapi", "drf": "djangorestframework", "ninja": "django-ninja"}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class PresetError(ValueError):
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@functools.lru_cache(maxsize=None)
|
|
29
|
+
def load(name: str) -> dict:
|
|
30
|
+
p = PRESET_DIR / f"{name}.yaml"
|
|
31
|
+
if not p.is_file():
|
|
32
|
+
raise PresetError(f"no built-in preset '{name}' (available: {', '.join(available())})")
|
|
33
|
+
import yaml
|
|
34
|
+
d = yaml.safe_load(p.read_text(encoding="utf-8")) or {}
|
|
35
|
+
if d.get("name") != name:
|
|
36
|
+
raise PresetError(f"preset file {p.name}: name must be '{name}'")
|
|
37
|
+
return d
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def available() -> list[str]:
|
|
41
|
+
return sorted(p.stem for p in PRESET_DIR.glob("*.yaml"))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def has(name: str) -> bool:
|
|
45
|
+
return (PRESET_DIR / f"{name}.yaml").is_file()
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def skip_dirs(preset: str = "common", *keys: str) -> frozenset[str]:
|
|
49
|
+
"""Directory names a walk skips: common.skip_dirs plus `keys` of `preset` (default its own skip_dirs)."""
|
|
50
|
+
out = set(load("common").get("skip_dirs") or [])
|
|
51
|
+
for k in keys or ("skip_dirs",):
|
|
52
|
+
out |= set(load(preset).get(k) or [])
|
|
53
|
+
return frozenset(out)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def values(preset: str, *path: str, default=None):
|
|
57
|
+
"""A nested value of one preset file, e.g. values("laravel", "plans", "short_prefixes")."""
|
|
58
|
+
d = load(preset)
|
|
59
|
+
for k in path:
|
|
60
|
+
if not isinstance(d, dict) or k not in d:
|
|
61
|
+
return default
|
|
62
|
+
d = d[k]
|
|
63
|
+
return d
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def select(languages, frameworks) -> list[str]:
|
|
67
|
+
"""Applied preset names in merge order for the active language plugins and frameworks."""
|
|
68
|
+
out = ["common"]
|
|
69
|
+
out += [lang for lang in LANGUAGE_ORDER if lang in set(languages) and has(lang)]
|
|
70
|
+
for f in frameworks:
|
|
71
|
+
f = FRAMEWORK_ALIASES.get(f, f)
|
|
72
|
+
if f not in out and has(f) and load(f).get("kind") == "framework":
|
|
73
|
+
out.append(f)
|
|
74
|
+
return out
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def frameworks() -> list[str]:
|
|
78
|
+
return [n for n in available() if load(n).get("kind") == "framework"]
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def name_tokens(name: str) -> str:
|
|
82
|
+
"""'ApiKeyGuard' -> 'api_key_guard', 'auth:api' -> 'auth_api', 'password.confirm' -> 'password_confirm'."""
|
|
83
|
+
return "_".join(t.lower() for t in re.findall(r"[A-Z]?[a-z0-9]+|[A-Z]+(?![a-z])", name or ""))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class NameSet:
|
|
87
|
+
"""Guard names from presets. lookup() matches the guard's own name, so `auth` matches `auth:api`, `can` matches
|
|
88
|
+
`can:update,post`, `AuthGuard` matches `AuthGuard('jwt')` and `IsAuthenticated` matches
|
|
89
|
+
`rest_framework.permissions.IsAuthenticated`, while a project's own `MaintenanceAuthGuard` is left to the name
|
|
90
|
+
pattern. contains() matches the preset name anywhere in the guard's word tokens (for names that never count as
|
|
91
|
+
auth, such as `ThrottlerGuard` in `CustomThrottlerGuard`). Both name the preset the entry came from."""
|
|
92
|
+
|
|
93
|
+
def __init__(self, entries: list[tuple[str, str, str]]): # (name, preset, source)
|
|
94
|
+
self.by_tok: dict[str, tuple[str, str, str]] = {}
|
|
95
|
+
for name, preset, source in entries:
|
|
96
|
+
self.by_tok.setdefault(name_tokens(name), (name, preset, source))
|
|
97
|
+
toks = sorted((t for t in self.by_tok if t), key=len, reverse=True)
|
|
98
|
+
self.rx = re.compile(r"(?:^|_)(" + "|".join(map(re.escape, toks)) + r")(?=_|$)") if toks else None
|
|
99
|
+
|
|
100
|
+
def lookup(self, name: str) -> tuple[str, str, str] | None:
|
|
101
|
+
for c in own_names(name):
|
|
102
|
+
hit = self.by_tok.get(name_tokens(c))
|
|
103
|
+
if hit:
|
|
104
|
+
return hit
|
|
105
|
+
return None
|
|
106
|
+
|
|
107
|
+
def contains(self, name: str) -> tuple[str, str, str] | None:
|
|
108
|
+
if not self.rx:
|
|
109
|
+
return None
|
|
110
|
+
m = self.rx.search(name_tokens(name))
|
|
111
|
+
return self.by_tok[m.group(1)] if m else None
|
|
112
|
+
|
|
113
|
+
def __len__(self):
|
|
114
|
+
return len(self.by_tok)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def own_names(name: str) -> list[str]:
|
|
118
|
+
"""The names a guard is known by, without its namespace, parameters or call arguments:
|
|
119
|
+
'auth:sanctum' -> auth, 'Illuminate\\Auth\\Middleware\\Authenticate' -> Authenticate, "AuthGuard('jwt')" -> AuthGuard,
|
|
120
|
+
'App\\Http\\Middleware\\Authorize::handle' -> Authorize, 'rest_framework.permissions.IsAuthenticated' -> both the
|
|
121
|
+
dotted name and IsAuthenticated, 'passport.authenticate' stays whole."""
|
|
122
|
+
n = (name or "").strip().lstrip("@")
|
|
123
|
+
n = re.sub(r"::\w+$", "", n).split("(", 1)[0]
|
|
124
|
+
if "::" not in n:
|
|
125
|
+
n = n.split(":", 1)[0]
|
|
126
|
+
n = re.split(r"[\\/]", n)[-1].strip()
|
|
127
|
+
out = [n] if n else []
|
|
128
|
+
if "." in n:
|
|
129
|
+
last = n.rsplit(".", 1)[1]
|
|
130
|
+
if last[:1].isupper():
|
|
131
|
+
out.append(last)
|
|
132
|
+
return out
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def guard_names(applied: list[str], section: str, key: str = "guards") -> NameSet:
|
|
136
|
+
"""auth.guards / auth.not_auth / secret.guards of the applied presets, in merge order."""
|
|
137
|
+
entries = []
|
|
138
|
+
for p in applied:
|
|
139
|
+
if not has(p):
|
|
140
|
+
continue
|
|
141
|
+
for g in values(p, section, key, default=[]) or []:
|
|
142
|
+
if isinstance(g, dict) and g.get("name"):
|
|
143
|
+
entries.append((str(g["name"]), p, str(g.get("source") or "")))
|
|
144
|
+
elif isinstance(g, str):
|
|
145
|
+
entries.append((g, p, ""))
|
|
146
|
+
return NameSet(entries)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
name: c_cpp
|
|
2
|
+
kind: language
|
|
3
|
+
docs: docs/native.md
|
|
4
|
+
# version-control state, vendored third-party trees and test frameworks, CMake / Bazel build output, caches
|
|
5
|
+
# (CODEGRAPH_EXCLUDE_DIRS / CODEGRAPH_INCLUDE_DIRS adjust this list for C / C++; .cg.yaml skip_dirs for every language)
|
|
6
|
+
skip_dirs: [.hg, .svn, target, third_party, thirdparty, third-party, 3rdparty, googletest, gtest, gmock, catch2,
|
|
7
|
+
doctest, vendor, external, extern, deps, _deps, .cache, CMakeFiles, bazel-out, .venv]
|
|
8
|
+
# build trees by name prefix (build-release/, cmake-build-debug/); a directory holding CMakeCache.txt is skipped too
|
|
9
|
+
skip_dir_prefixes: [build, cmake-build]
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Built-in knowledge every project gets, before the language and framework presets and the project's .cg.yaml.
|
|
2
|
+
# Format (every preset file): name, kind (common | language | framework), docs, then any of the sections below.
|
|
3
|
+
# auth / secret guard names that count as user auth / as a shared-secret or signature check (`cg routes`)
|
|
4
|
+
# skip_dirs directory names that never hold project source: dependencies, build output, caches, tool state
|
|
5
|
+
# Lists are merged in order common -> language -> framework -> .cg.yaml -> command-line flags.
|
|
6
|
+
name: common
|
|
7
|
+
kind: common
|
|
8
|
+
docs: docs/configuration.md#presets
|
|
9
|
+
auth:
|
|
10
|
+
# Name-based fallback for every stack: matched against the guard name split into lower-case word tokens joined by
|
|
11
|
+
# "_" (ApiKeyGuard -> api_key_guard, auth:api -> auth_api, IsAuthenticated -> is_authenticated), so
|
|
12
|
+
# AuditLogInterceptor does not count as "login".
|
|
13
|
+
token_pattern: '(^|_)(auth|authn|authz|authed|authenticate[ds]?|authentication|authori[sz](e[ds]?|ation|er)|login|logged|jwt|token|session|sanctum|passport|bearer|api_key|permissions?|permission_[a-z]+|admin|staff|superuser|can|roles?|acl|verified|protected|protect|require_user|current_user|oauth[a-z0-9]*|oidc|saml|clerk|firebase_auth)(_|$)'
|
|
14
|
+
secret:
|
|
15
|
+
# shared-secret / signature verification (webhooks, signed URLs): the caller proves it knows a secret, not who it is
|
|
16
|
+
token_pattern: '(^|_)(signed|signature|signatures|hmac|secret|webhook_secret)(_|$)|(^|_)verify(_[a-z0-9]+)*_webhooks?(_|$)|(^|_)webhooks?(_[a-z0-9]+)*_(verify|verified|verification|signature|secret|hmac)(_|$)'
|
|
17
|
+
# skipped by every directory walk (language plugins, extractors, the coverage scan)
|
|
18
|
+
skip_dirs: [.git, node_modules, __pycache__]
|
|
19
|
+
# the coverage scan (`cg coverage`: which source files exist) also skips these dependency / build / IDE directories
|
|
20
|
+
scan_skip_dirs: [vendor, target, build, dist, .dart_tool, .venv, venv, .tox, .mypy_cache, .pytest_cache, .next, .output,
|
|
21
|
+
out, .gradle, .idea, Pods, .build, .swiftpm, DerivedData, Carthage]
|
|
22
|
+
# generated files (codegraph/core/generated.py): kept out of the graph by default and listed by `cg coverage`
|
|
23
|
+
generated:
|
|
24
|
+
# framework build output directories (names at any depth) -> reason
|
|
25
|
+
build_dirs:
|
|
26
|
+
.nuxt: Nuxt build output (.nuxt/)
|
|
27
|
+
.output: Nitro / Nuxt build output (.output/)
|
|
28
|
+
.next: Next.js build output (.next/)
|
|
29
|
+
.svelte-kit: SvelteKit build output (.svelte-kit/)
|
|
30
|
+
.docusaurus: Docusaurus build output (.docusaurus/)
|
|
31
|
+
dist: build output (dist/)
|
|
32
|
+
build: build output (build/)
|
|
33
|
+
# paths written by tools (gitignore-style globs) -> reason
|
|
34
|
+
paths:
|
|
35
|
+
"**/Flutter/ephemeral/**": Flutter tool output (ephemeral/)
|
|
36
|
+
"**/flutter/ephemeral/**": Flutter tool output (ephemeral/)
|
|
37
|
+
# file names written by code generators (globs on the file name) -> generator
|
|
38
|
+
files:
|
|
39
|
+
"*.g.dart": build_runner output (*.g.dart)
|
|
40
|
+
"*.freezed.dart": freezed output (*.freezed.dart)
|
|
41
|
+
"*.gr.dart": auto_route output (*.gr.dart)
|
|
42
|
+
"*.mocks.dart": mockito output (*.mocks.dart)
|
|
43
|
+
"*.config.dart": injectable output (*.config.dart)
|
|
44
|
+
"generated_plugin_registrant.*": Flutter plugin registrant
|
|
45
|
+
"GeneratedPluginRegistrant.*": Flutter plugin registrant
|
|
46
|
+
"*.pb.dart": protoc output (Dart)
|
|
47
|
+
"*.pbenum.dart": protoc output (Dart)
|
|
48
|
+
"*.pbjson.dart": protoc output (Dart)
|
|
49
|
+
"*.pbgrpc.dart": protoc output (Dart)
|
|
50
|
+
"*.pbserver.dart": protoc output (Dart)
|
|
51
|
+
"*_pb2.py": protoc output (Python)
|
|
52
|
+
"*_pb2_grpc.py": protoc output (Python)
|
|
53
|
+
"*.pb.go": protoc output (Go)
|
|
54
|
+
"*_grpc.pb.go": protoc output (Go)
|
|
55
|
+
"*_pb.ts": protoc output (TypeScript)
|
|
56
|
+
"*_pb.js": protoc output (JavaScript)
|
|
57
|
+
"*_grpc_pb.ts": protoc output (TypeScript)
|
|
58
|
+
"*_grpc_pb.js": protoc output (JavaScript)
|
|
59
|
+
"*.pb.swift": protoc output (Swift)
|
|
60
|
+
"*.grpc.swift": protoc output (Swift)
|
|
61
|
+
"R.generated.swift": R.swift output
|
|
62
|
+
"*.pb.cc": protoc output (C++)
|
|
63
|
+
"*.pb.h": protoc output (C++)
|
|
64
|
+
"*.grpc.pb.cc": protoc output (C++)
|
|
65
|
+
"*.grpc.pb.h": protoc output (C++)
|
|
66
|
+
"*.pb.rs": protoc output (Rust)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
name: dart
|
|
2
|
+
kind: language
|
|
3
|
+
docs: https://dart.dev/tools/pub/package-layout
|
|
4
|
+
# pub / build output, CocoaPods, FVM and IDE state
|
|
5
|
+
skip_dirs: [.dart_tool, build, .pub-cache, Pods, .symlinks, .fvm, .idea]
|
|
6
|
+
# platform runner directories of a Flutter app: never hold a Dart package of their own
|
|
7
|
+
package_skip_dirs: [build, Pods, ios, android, windows, linux, macos, web]
|
|
8
|
+
# generated Dart sources (freezed, mockito, injectable, auto_route); `dart_keep_generated` keeps them
|
|
9
|
+
generated_suffixes: [.freezed.dart, .mocks.dart, .config.dart, .gr.dart]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
name: django-ninja
|
|
2
|
+
kind: framework
|
|
3
|
+
docs: https://django-ninja.dev/guides/authentication/
|
|
4
|
+
auth:
|
|
5
|
+
# values of `auth=` on an operation, router or NinjaAPI
|
|
6
|
+
guards:
|
|
7
|
+
- {name: django_auth, source: "ninja.security.django_auth (session auth)"}
|
|
8
|
+
- {name: django_auth_superuser, source: "ninja.security.django_auth_superuser"}
|
|
9
|
+
- {name: django_auth_is_staff, source: "ninja.security.django_auth_is_staff"}
|
|
10
|
+
- {name: HttpBearer, source: "ninja.security.HttpBearer"}
|
|
11
|
+
- {name: HttpBasicAuth, source: "ninja.security.HttpBasicAuth"}
|
|
12
|
+
- {name: APIKeyHeader, source: "ninja.security.APIKeyHeader"}
|
|
13
|
+
- {name: APIKeyQuery, source: "ninja.security.APIKeyQuery"}
|
|
14
|
+
- {name: APIKeyCookie, source: "ninja.security.APIKeyCookie"}
|
|
15
|
+
- {name: SessionAuth, source: "ninja.security.SessionAuth"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: django
|
|
2
|
+
kind: framework
|
|
3
|
+
docs: https://docs.djangoproject.com/en/stable/topics/auth/default/#limiting-access-to-logged-in-users
|
|
4
|
+
auth:
|
|
5
|
+
guards:
|
|
6
|
+
- {name: login_required, source: "django.contrib.auth.decorators.login_required"}
|
|
7
|
+
- {name: permission_required, source: "django.contrib.auth.decorators.permission_required"}
|
|
8
|
+
- {name: user_passes_test, source: "django.contrib.auth.decorators.user_passes_test"}
|
|
9
|
+
- {name: staff_member_required, source: "django.contrib.admin.views.decorators.staff_member_required"}
|
|
10
|
+
- {name: LoginRequiredMixin, source: "django.contrib.auth.mixins.LoginRequiredMixin"}
|
|
11
|
+
- {name: PermissionRequiredMixin, source: "django.contrib.auth.mixins.PermissionRequiredMixin"}
|
|
12
|
+
- {name: UserPassesTestMixin, source: "django.contrib.auth.mixins.UserPassesTestMixin"}
|
|
13
|
+
- {name: LoginRequiredMiddleware, source: "django.contrib.auth.middleware.LoginRequiredMiddleware (Django 5.1)"}
|
|
14
|
+
# names that read like auth but mark a view public or check something else
|
|
15
|
+
not_auth:
|
|
16
|
+
- {name: login_not_required, source: "django.contrib.auth.decorators.login_not_required (Django 5.1): opts a view out of LoginRequiredMiddleware"}
|
|
17
|
+
- {name: csrf_protect, source: "django.views.decorators.csrf.csrf_protect: CSRF token check, not user auth"}
|
|
18
|
+
# what the Django plugin records as a view's access checks (route attrs.access, read by `cg routes`): these decorators
|
|
19
|
+
# and mixins by name, any decorator whose name matches name_pattern (unless opt_out_pattern), any decorator matching
|
|
20
|
+
# the project's .cg.yaml auth / secret extra_patterns, and signature-check decorators (common secret token pattern)
|
|
21
|
+
access:
|
|
22
|
+
decorators: [login_required, permission_required, user_passes_test, staff_member_required, superuser_required]
|
|
23
|
+
mixins: [LoginRequiredMixin, PermissionRequiredMixin, UserPassesTestMixin, AccessMixin]
|
|
24
|
+
name_pattern: '(auth|login|permission|staff|superuser|token|jwt)'
|
|
25
|
+
opt_out_pattern: 'not_required|exempt|optional|allow_any'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: djangorestframework
|
|
2
|
+
kind: framework
|
|
3
|
+
docs: https://www.django-rest-framework.org/api-guide/permissions/
|
|
4
|
+
auth:
|
|
5
|
+
guards:
|
|
6
|
+
- {name: IsAuthenticated, source: "rest_framework.permissions.IsAuthenticated"}
|
|
7
|
+
- {name: IsAdminUser, source: "rest_framework.permissions.IsAdminUser"}
|
|
8
|
+
- {name: IsAuthenticatedOrReadOnly, source: "rest_framework.permissions.IsAuthenticatedOrReadOnly (writes need auth)"}
|
|
9
|
+
- {name: DjangoModelPermissions, source: "rest_framework.permissions.DjangoModelPermissions"}
|
|
10
|
+
- {name: DjangoModelPermissionsOrAnonReadOnly, source: "rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly"}
|
|
11
|
+
- {name: DjangoObjectPermissions, source: "rest_framework.permissions.DjangoObjectPermissions"}
|
|
12
|
+
- {name: TokenAuthentication, source: "rest_framework.authentication.TokenAuthentication, https://www.django-rest-framework.org/api-guide/authentication/"}
|
|
13
|
+
- {name: SessionAuthentication, source: "rest_framework.authentication.SessionAuthentication"}
|
|
14
|
+
- {name: BasicAuthentication, source: "rest_framework.authentication.BasicAuthentication"}
|
|
15
|
+
- {name: JWTAuthentication, source: "rest_framework_simplejwt.authentication.JWTAuthentication"}
|
|
16
|
+
not_auth:
|
|
17
|
+
- {name: AllowAny, source: "rest_framework.permissions.AllowAny: explicitly public"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: express
|
|
2
|
+
kind: framework
|
|
3
|
+
docs: https://expressjs.com/en/guide/using-middleware.html
|
|
4
|
+
# Express, Koa, Fastify, Hono and the other servers of the express plugin (SERVER_DEPS in codegraph/plugins/tsweb/common.py)
|
|
5
|
+
auth:
|
|
6
|
+
guards:
|
|
7
|
+
- {name: passport.authenticate, source: "passport, https://www.passportjs.org/concepts/authentication/middleware/"}
|
|
8
|
+
- {name: ensureLoggedIn, source: "connect-ensure-login"}
|
|
9
|
+
- {name: expressjwt, source: "express-jwt v7+ (`expressjwt`), https://github.com/auth0/express-jwt"}
|
|
10
|
+
- {name: expressJwt, source: "express-jwt before v7"}
|
|
11
|
+
- {name: requiresAuth, source: "express-openid-connect requiresAuth"}
|
|
12
|
+
- {name: koaJwt, source: "koa-jwt"}
|
|
13
|
+
- {name: authenticate, source: "fastify.authenticate decorator convention, https://github.com/fastify/fastify-jwt"}
|
|
14
|
+
- {name: jwtVerify, source: "@fastify/jwt request.jwtVerify"}
|
|
15
|
+
- {name: basicAuth, source: "hono/basic-auth, express-basic-auth"}
|
|
16
|
+
- {name: bearerAuth, source: "hono/bearer-auth"}
|
|
17
|
+
- {name: jwt, source: "hono/jwt, koa-jwt"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
name: kotlin
|
|
2
|
+
kind: language
|
|
3
|
+
docs: docs/kotlin.md
|
|
4
|
+
# Gradle build output (KSP / kapt sources under build/generated), Gradle and IDE state, Kotlin/Native and JS caches
|
|
5
|
+
skip_dirs: [build, .gradle, .idea, .kotlin, .cxx, .externalNativeBuild, node_modules]
|
|
6
|
+
auth:
|
|
7
|
+
guards:
|
|
8
|
+
- {name: authenticate, source: "Ktor authenticate(\"name\") { } blocks, https://ktor.io/docs/server-auth.html"}
|
|
9
|
+
- {name: PreAuthorize, source: "Spring Security method security, https://docs.spring.io/spring-security/reference/servlet/authorization/method-security.html"}
|
|
10
|
+
- {name: Secured, source: "Spring Security @Secured"}
|
|
11
|
+
- {name: RolesAllowed, source: "Jakarta @RolesAllowed (Spring Security jsr250)"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: laravel
|
|
2
|
+
kind: framework
|
|
3
|
+
docs: https://laravel.com/docs/middleware
|
|
4
|
+
auth:
|
|
5
|
+
# route / group middleware aliases and classes (Illuminate\Foundation\Configuration\Middleware::defaultAliases)
|
|
6
|
+
guards:
|
|
7
|
+
- {name: auth, source: "Illuminate\\Auth\\Middleware\\Authenticate, https://laravel.com/docs/authentication#protecting-routes"}
|
|
8
|
+
- {name: auth.basic, source: "AuthenticateWithBasicAuth, https://laravel.com/docs/authentication#http-basic-authentication"}
|
|
9
|
+
- {name: auth.session, source: "Illuminate\\Session\\Middleware\\AuthenticateSession"}
|
|
10
|
+
- {name: can, source: "Illuminate\\Auth\\Middleware\\Authorize, https://laravel.com/docs/authorization#via-middleware"}
|
|
11
|
+
- {name: password.confirm, source: "RequirePassword, https://laravel.com/docs/authentication#password-confirmation"}
|
|
12
|
+
- {name: verified, source: "EnsureEmailIsVerified, https://laravel.com/docs/verification"}
|
|
13
|
+
- {name: abilities, source: "Laravel\\Sanctum\\Http\\Middleware\\CheckAbilities, https://laravel.com/docs/sanctum#token-ability-middleware"}
|
|
14
|
+
- {name: ability, source: "Laravel\\Sanctum\\Http\\Middleware\\CheckForAnyAbility"}
|
|
15
|
+
- {name: role, source: "spatie/laravel-permission RoleMiddleware, https://spatie.be/docs/laravel-permission/basic-usage/middleware"}
|
|
16
|
+
- {name: permission, source: "spatie/laravel-permission PermissionMiddleware"}
|
|
17
|
+
- {name: role_or_permission, source: "spatie/laravel-permission RoleOrPermissionMiddleware"}
|
|
18
|
+
- {name: Authenticate, source: "Illuminate\\Auth\\Middleware\\Authenticate / Filament\\Http\\Middleware\\Authenticate (class form)"}
|
|
19
|
+
# the same middleware referenced by class (Route::middleware(EnsureEmailIsVerified::class), $middlewareAliases)
|
|
20
|
+
- {name: AuthenticateWithBasicAuth, source: "Illuminate\\Auth\\Middleware\\AuthenticateWithBasicAuth"}
|
|
21
|
+
- {name: AuthenticateSession, source: "Illuminate\\Session\\Middleware\\AuthenticateSession"}
|
|
22
|
+
- {name: Authorize, source: "Illuminate\\Auth\\Middleware\\Authorize"}
|
|
23
|
+
- {name: RequirePassword, source: "Illuminate\\Auth\\Middleware\\RequirePassword"}
|
|
24
|
+
- {name: EnsureEmailIsVerified, source: "Illuminate\\Auth\\Middleware\\EnsureEmailIsVerified"}
|
|
25
|
+
- {name: CheckAbilities, source: "Laravel\\Sanctum\\Http\\Middleware\\CheckAbilities"}
|
|
26
|
+
- {name: CheckForAnyAbility, source: "Laravel\\Sanctum\\Http\\Middleware\\CheckForAnyAbility"}
|
|
27
|
+
- {name: RoleMiddleware, source: "Spatie\\Permission\\Middleware\\RoleMiddleware"}
|
|
28
|
+
- {name: PermissionMiddleware, source: "Spatie\\Permission\\Middleware\\PermissionMiddleware"}
|
|
29
|
+
- {name: RoleOrPermissionMiddleware, source: "Spatie\\Permission\\Middleware\\RoleOrPermissionMiddleware"}
|
|
30
|
+
secret:
|
|
31
|
+
guards:
|
|
32
|
+
- {name: signed, source: "Illuminate\\Routing\\Middleware\\ValidateSignature, https://laravel.com/docs/urls#signed-urls"}
|
|
33
|
+
- {name: ValidateSignature, source: "Illuminate\\Routing\\Middleware\\ValidateSignature (class form)"}
|
|
34
|
+
- {name: VerifyWebhookSignature, source: "Laravel\\Cashier\\Http\\Middleware\\VerifyWebhookSignature, https://laravel.com/docs/billing#verifying-webhook-signatures"}
|
|
35
|
+
plans:
|
|
36
|
+
# class-name prefixes shortened in plan reports (PSR-4 `App\` namespace, https://laravel.com/docs/structure)
|
|
37
|
+
short_prefixes: ["App\\Models\\", "App\\Services\\", "App\\Http\\Controllers\\", "App\\Http\\Requests\\", "App\\Support\\",
|
|
38
|
+
"App\\Jobs\\", "App\\Console\\Commands\\"]
|
|
39
|
+
# where plan completeness looks for text mentions of columns / relations (application code and Blade views)
|
|
40
|
+
text_mention_dirs: [app, resources/views]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
name: nest
|
|
2
|
+
kind: framework
|
|
3
|
+
docs: https://docs.nestjs.com/guards
|
|
4
|
+
auth:
|
|
5
|
+
guards:
|
|
6
|
+
- {name: AuthGuard, source: "@nestjs/passport AuthGuard('jwt' | 'local' | ...), https://docs.nestjs.com/recipes/passport"}
|
|
7
|
+
- {name: JwtAuthGuard, source: "conventional name of the AuthGuard('jwt') subclass, https://docs.nestjs.com/security/authentication"}
|
|
8
|
+
- {name: RolesGuard, source: "https://docs.nestjs.com/security/authorization#basic-rbac-implementation"}
|
|
9
|
+
- {name: PoliciesGuard, source: "https://docs.nestjs.com/security/authorization#implementing-a-policiesguard"}
|
|
10
|
+
not_auth:
|
|
11
|
+
- {name: ThrottlerGuard, source: "@nestjs/throttler rate limiting, https://docs.nestjs.com/security/rate-limiting"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
name: nextjs
|
|
2
|
+
kind: framework
|
|
3
|
+
docs: https://nextjs.org/docs/app/building-your-application/authentication
|
|
4
|
+
auth:
|
|
5
|
+
# middleware.ts exports and handler wrappers of the common auth libraries
|
|
6
|
+
guards:
|
|
7
|
+
- {name: withAuth, source: "next-auth/middleware withAuth, https://next-auth.js.org/configuration/nextjs#middleware"}
|
|
8
|
+
- {name: getServerSession, source: "next-auth getServerSession"}
|
|
9
|
+
- {name: auth, source: "Auth.js v5 auth() / export { auth as middleware }, https://authjs.dev/getting-started/session-management/protecting"}
|
|
10
|
+
- {name: clerkMiddleware, source: "@clerk/nextjs clerkMiddleware, https://clerk.com/docs/references/nextjs/clerk-middleware"}
|
|
11
|
+
- {name: authMiddleware, source: "@clerk/nextjs authMiddleware (Clerk v4)"}
|
|
12
|
+
- {name: withPageAuthRequired, source: "@auth0/nextjs-auth0 withPageAuthRequired"}
|
|
13
|
+
- {name: withApiAuthRequired, source: "@auth0/nextjs-auth0 withApiAuthRequired"}
|
|
14
|
+
- {name: withMiddlewareAuthRequired, source: "@auth0/nextjs-auth0 withMiddlewareAuthRequired"}
|
|
15
|
+
- {name: withIronSessionApiRoute, source: "iron-session withIronSessionApiRoute"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
name: nuxt
|
|
2
|
+
kind: framework
|
|
3
|
+
docs: https://nuxt.com/docs/guide/directory-structure/nuxt
|
|
4
|
+
# kept out of the generated tsconfig: build output, native shells (Capacitor), static assets, test reports
|
|
5
|
+
skip_dirs: [.output, .nuxt, dist, android, ios, public, coverage, playwright-report]
|
|
6
|
+
auth:
|
|
7
|
+
guards:
|
|
8
|
+
- {name: requireUserSession, source: "nuxt-auth-utils requireUserSession, https://github.com/atinux/nuxt-auth-utils"}
|
|
9
|
+
- {name: getServerSession, source: "@sidebase/nuxt-auth getServerSession"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
name: php
|
|
2
|
+
kind: language
|
|
3
|
+
docs: https://getcomposer.org/doc/articles/vendor-binaries.md
|
|
4
|
+
# root-relative paths the PHP file discovery skips: Composer dependencies, Laravel's runtime storage and cache
|
|
5
|
+
skip_paths: [vendor, node_modules, storage, bootstrap/cache, .git]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
name: python
|
|
2
|
+
kind: language
|
|
3
|
+
docs: https://docs.python.org/3/library/venv.html
|
|
4
|
+
# virtualenvs, packaging / tool caches, build output, and Django's collected static / uploaded media
|
|
5
|
+
skip_dirs: [venv, .venv, env, .env, site-packages, .tox, .nox, build, dist, .mypy_cache, .eggs, .pytest_cache,
|
|
6
|
+
.ruff_cache, htmlcov, static, media]
|
|
7
|
+
# also skipped when deciding whether a repository holds Python at all (vendored / other-stack build output)
|
|
8
|
+
detect_skip_dirs: [vendor, target, out, Pods, .next, .output]
|
|
9
|
+
# test directories: skipped when scanning imports to detect a web framework (test fixtures quote `from flask import ...`)
|
|
10
|
+
test_dirs: [tests, test, testing]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
name: swift
|
|
2
|
+
kind: language
|
|
3
|
+
docs: docs/swift.md
|
|
4
|
+
# SwiftPM build output and checkouts, Xcode DerivedData, CocoaPods / Carthage dependencies, IDE state
|
|
5
|
+
skip_dirs: [.build, .swiftpm, DerivedData, Pods, Carthage, xcuserdata, node_modules]
|
|
6
|
+
auth:
|
|
7
|
+
guards:
|
|
8
|
+
- {name: guardMiddleware, source: "Vapor Authenticatable.guardMiddleware(), https://docs.vapor.codes/security/authentication/"}
|
|
9
|
+
- {name: authenticator, source: "Vapor ModelAuthenticatable / BearerAuthenticator authenticators"}
|
|
10
|
+
- {name: redirectMiddleware, source: "Vapor session auth redirectMiddleware(path:)"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
name: typescript
|
|
2
|
+
kind: language
|
|
3
|
+
docs: https://www.typescriptlang.org/tsconfig#exclude
|
|
4
|
+
# not hashed into the extractor facts cache key (build output, tool caches, test reports)
|
|
5
|
+
skip_dirs: [.output, dist, .cache, coverage, playwright-report, test-results]
|
|
6
|
+
# the test-file walk (tests/, e2e/, ... and spec files in the source dirs) also skips build output, fixtures and snapshots
|
|
7
|
+
test_walk_skip_dirs: [build, fixtures, __fixtures__, __snapshots__]
|
|
8
|
+
# files the tsconfig pulls in from these directories are resolution input (dependency types, Nuxt's generated
|
|
9
|
+
# auto-import types), never project source
|
|
10
|
+
source_skip_dirs: [node_modules, .nuxt]
|
|
11
|
+
# build output of the JS frameworks cg models (Next.js .next, Nuxt .nuxt / .output, SvelteKit, Turborepo, Vercel,
|
|
12
|
+
# Storybook); never application source for the Nest / Next.js / Express plugins
|
|
13
|
+
build_dirs: [.next, .nuxt, .output, .svelte-kit, .turbo, .vercel, dist, build, out, coverage, storybook-static]
|