@aigis-ai/cli 2.0.1 → 2.0.2
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.
- package/README.md +58 -188
- package/aigis-ai-cli-2.0.1.tgz +0 -0
- package/package.json +1 -1
- package/cli-python/LICENSE +0 -21
- package/cli-python/README.md +0 -32
- package/cli-python/aigis_cli/SKILL.md +0 -70
- package/cli-python/aigis_cli/__init__.py +0 -3
- package/cli-python/aigis_cli/__pycache__/__init__.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/annotate.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/build.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/checksum.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/classify.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/cli.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/fetch.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/init_ide.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/keywords.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/search.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/annotate.py +0 -45
- package/cli-python/aigis_cli/auto_verify.py +0 -518
- package/cli-python/aigis_cli/build.py +0 -470
- package/cli-python/aigis_cli/checksum.py +0 -22
- package/cli-python/aigis_cli/classify.py +0 -192
- package/cli-python/aigis_cli/cli.py +0 -618
- package/cli-python/aigis_cli/content/index/audit-scan.md +0 -217
- package/cli-python/aigis_cli/content/index/auto-verify-rules.json +0 -439
- package/cli-python/aigis_cli/content/index/context-rules.json +0 -90
- package/cli-python/aigis_cli/content/index/frameworks.md +0 -82
- package/cli-python/aigis_cli/content/index/guardrails.json +0 -23
- package/cli-python/aigis_cli/content/index/taxonomy.md +0 -81
- package/cli-python/aigis_cli/content/resolvers/triggers.json +0 -229
- package/cli-python/aigis_cli/content/skills/areas/audit-logging.md +0 -176
- package/cli-python/aigis_cli/content/skills/areas/bias-monitoring.md +0 -172
- package/cli-python/aigis_cli/content/skills/areas/confidence-scoring.md +0 -180
- package/cli-python/aigis_cli/content/skills/areas/data-integrity.md +0 -257
- package/cli-python/aigis_cli/content/skills/areas/explainability.md +0 -174
- package/cli-python/aigis_cli/content/skills/areas/fallback-patterns.md +0 -200
- package/cli-python/aigis_cli/content/skills/areas/human-oversight.md +0 -220
- package/cli-python/aigis_cli/content/skills/areas/input-validation.md +0 -380
- package/cli-python/aigis_cli/content/skills/areas/monitoring.md +0 -207
- package/cli-python/aigis_cli/content/skills/areas/output-sanitization.md +0 -183
- package/cli-python/aigis_cli/content/skills/areas/pii-handling.md +0 -189
- package/cli-python/aigis_cli/content/skills/areas/prompt-security.md +0 -153
- package/cli-python/aigis_cli/content/skills/areas/rag-security.md +0 -230
- package/cli-python/aigis_cli/content/skills/areas/rate-limiting.md +0 -246
- package/cli-python/aigis_cli/content/skills/areas/supply-chain.md +0 -193
- package/cli-python/aigis_cli/content/skills/core.md +0 -62
- package/cli-python/aigis_cli/content/skills/infrastructure/logging.md +0 -202
- package/cli-python/aigis_cli/content/skills/infrastructure/rate-limiting.md +0 -169
- package/cli-python/aigis_cli/content/skills/infrastructure/secrets.md +0 -167
- package/cli-python/aigis_cli/content/skills/workflows/fastapi-llm.md +0 -86
- package/cli-python/aigis_cli/content/templates/ai-impact-assessment.md +0 -54
- package/cli-python/aigis_cli/content/templates/intended-purpose-doc.md +0 -39
- package/cli-python/aigis_cli/content/templates/risk-characterization.md +0 -34
- package/cli-python/aigis_cli/content/templates/third-party-assessment.md +0 -41
- package/cli-python/aigis_cli/content/verify/checklist-audit-logging.md +0 -13
- package/cli-python/aigis_cli/content/verify/checklist-bias-monitoring.md +0 -13
- package/cli-python/aigis_cli/content/verify/checklist-confidence-scoring.md +0 -13
- package/cli-python/aigis_cli/content/verify/checklist-data-integrity.md +0 -12
- package/cli-python/aigis_cli/content/verify/checklist-explainability.md +0 -13
- package/cli-python/aigis_cli/content/verify/checklist-fallback-patterns.md +0 -13
- package/cli-python/aigis_cli/content/verify/checklist-human-oversight.md +0 -14
- package/cli-python/aigis_cli/content/verify/checklist-input-validation.md +0 -16
- package/cli-python/aigis_cli/content/verify/checklist-monitoring.md +0 -13
- package/cli-python/aigis_cli/content/verify/checklist-output-sanitization.md +0 -14
- package/cli-python/aigis_cli/content/verify/checklist-pii-handling.md +0 -14
- package/cli-python/aigis_cli/content/verify/checklist-prompt-security.md +0 -13
- package/cli-python/aigis_cli/content/verify/checklist-rag-security.md +0 -12
- package/cli-python/aigis_cli/content/verify/checklist-rate-limiting.md +0 -13
- package/cli-python/aigis_cli/content/verify/checklist-supply-chain.md +0 -13
- package/cli-python/aigis_cli/fetch.py +0 -232
- package/cli-python/aigis_cli/init_ide.py +0 -159
- package/cli-python/aigis_cli/keywords.py +0 -73
- package/cli-python/aigis_cli/search.py +0 -69
- package/cli-python/aigis_cli.egg-info/PKG-INFO +0 -59
- package/cli-python/aigis_cli.egg-info/SOURCES.txt +0 -56
- package/cli-python/aigis_cli.egg-info/dependency_links.txt +0 -1
- package/cli-python/aigis_cli.egg-info/entry_points.txt +0 -2
- package/cli-python/aigis_cli.egg-info/requires.txt +0 -6
- package/cli-python/aigis_cli.egg-info/top_level.txt +0 -1
- package/cli-python/dist/aigis_cli-1.0.3-py3-none-any.whl +0 -0
- package/cli-python/dist/aigis_cli-1.0.3.tar.gz +0 -0
- package/cli-python/pyproject.toml +0 -49
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
ALL_TRAITS = [
|
|
4
|
-
"uses-llm", "uses-rag", "uses-finetuned", "uses-thirdparty-api", "is-agentic", "is-multimodal",
|
|
5
|
-
"processes-pii", "handles-financial", "handles-health", "handles-proprietary", "handles-minors",
|
|
6
|
-
"influences-decisions", "accepts-user-input", "is-external", "is-internal", "is-high-volume",
|
|
7
|
-
"generates-code", "generates-content", "multi-model-pipeline",
|
|
8
|
-
"jurisdiction-eu", "jurisdiction-us-regulated", "jurisdiction-global",
|
|
9
|
-
]
|
|
10
|
-
|
|
11
|
-
TRAIT_FILES: dict[str, list[str]] = {
|
|
12
|
-
"uses-llm": ["input-validation", "output-sanitization", "prompt-security", "audit-logging", "monitoring"],
|
|
13
|
-
"uses-rag": ["rag-security", "data-integrity"],
|
|
14
|
-
"uses-finetuned": ["data-integrity", "supply-chain"],
|
|
15
|
-
"uses-thirdparty-api": ["supply-chain"],
|
|
16
|
-
"is-agentic": ["human-oversight", "rate-limiting", "fallback-patterns", "audit-logging"],
|
|
17
|
-
"is-multimodal": ["input-validation", "output-sanitization", "pii-handling"],
|
|
18
|
-
"processes-pii": ["pii-handling", "audit-logging"],
|
|
19
|
-
"handles-financial": ["pii-handling", "audit-logging", "bias-monitoring"],
|
|
20
|
-
"handles-health": ["pii-handling", "audit-logging", "bias-monitoring", "explainability"],
|
|
21
|
-
"handles-proprietary": ["pii-handling", "prompt-security"],
|
|
22
|
-
"handles-minors": ["pii-handling", "bias-monitoring", "human-oversight"],
|
|
23
|
-
"influences-decisions": ["bias-monitoring", "confidence-scoring", "human-oversight", "explainability"],
|
|
24
|
-
"accepts-user-input": ["input-validation", "output-sanitization"],
|
|
25
|
-
"is-external": ["rate-limiting", "confidence-scoring"],
|
|
26
|
-
"is-internal": [],
|
|
27
|
-
"is-high-volume": ["rate-limiting", "monitoring", "fallback-patterns"],
|
|
28
|
-
"generates-code": ["output-sanitization", "human-oversight", "fallback-patterns"],
|
|
29
|
-
"generates-content": ["confidence-scoring", "bias-monitoring", "audit-logging"],
|
|
30
|
-
"multi-model-pipeline": ["audit-logging", "monitoring", "fallback-patterns", "data-integrity"],
|
|
31
|
-
"jurisdiction-eu": [],
|
|
32
|
-
"jurisdiction-us-regulated": [],
|
|
33
|
-
"jurisdiction-global": [],
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
FILE_CONTROLS: dict[str, dict[str, list[str]]] = {
|
|
37
|
-
"input-validation": {"owasp": ["LLM01"], "nist": ["MEASURE-2.7", "MANAGE-1.3"], "iso": ["Clause-8.2", "Annex-A.6"]},
|
|
38
|
-
"output-sanitization": {"owasp": ["LLM05"], "nist": ["MEASURE-2.6", "MEASURE-2.7"], "iso": ["Clause-8.2"]},
|
|
39
|
-
"pii-handling": {"owasp": ["LLM02"], "nist": ["MAP-2.1", "MEASURE-2.10"], "iso": ["Annex-A.7", "Annex-A.4"]},
|
|
40
|
-
"prompt-security": {"owasp": ["LLM07"], "nist": ["MEASURE-2.7", "MEASURE-2.8"], "iso": ["Clause-8.2"]},
|
|
41
|
-
"human-oversight": {"owasp": ["LLM06"], "nist": ["MAP-3.5", "MANAGE-1.3", "MANAGE-4.1"], "iso": ["Annex-A.9", "Clause-8.4"]},
|
|
42
|
-
"supply-chain": {"owasp": ["LLM03"], "nist": ["GOVERN-6.1", "GOVERN-6.2", "MANAGE-3.1", "MANAGE-3.2"], "iso": ["Annex-A.10"]},
|
|
43
|
-
"data-integrity": {"owasp": ["LLM04"], "nist": ["MAP-2.3", "MEASURE-2.6"], "iso": ["Annex-A.7"]},
|
|
44
|
-
"rag-security": {"owasp": ["LLM08"], "nist": ["MEASURE-2.7"], "iso": ["Clause-8.2", "Annex-A.7"]},
|
|
45
|
-
"confidence-scoring": {"owasp": ["LLM09"], "nist": ["MAP-2.2", "MEASURE-2.5", "MEASURE-2.9"], "iso": ["Annex-A.8"]},
|
|
46
|
-
"rate-limiting": {"owasp": ["LLM10"], "nist": ["MEASURE-2.6", "MANAGE-2.4"], "iso": ["Clause-8.2"]},
|
|
47
|
-
"audit-logging": {"owasp": [], "nist": ["MEASURE-2.8", "MANAGE-4.1", "MANAGE-4.3"], "iso": ["Clause-9.1", "Annex-A.6"]},
|
|
48
|
-
"bias-monitoring": {"owasp": [], "nist": ["MAP-2.3", "MEASURE-2.11", "MEASURE-3.1"], "iso": ["Clause-6.1", "Annex-C"]},
|
|
49
|
-
"fallback-patterns": {"owasp": [], "nist": ["MEASURE-2.6", "MANAGE-2.3", "MANAGE-2.4"], "iso": ["Clause-8.2"]},
|
|
50
|
-
"monitoring": {"owasp": [], "nist": ["MEASURE-2.4", "MEASURE-3.1", "MANAGE-4.1", "MANAGE-4.2"], "iso": ["Clause-9.1", "Clause-10"]},
|
|
51
|
-
"explainability": {"owasp": [], "nist": ["MEASURE-2.8", "MEASURE-2.9"], "iso": ["Annex-A.8", "Clause-7.4"]},
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def classify(trait_list: list[str]) -> dict:
|
|
56
|
-
ts = set(trait_list)
|
|
57
|
-
warnings: list[str] = []
|
|
58
|
-
|
|
59
|
-
invalid = [t for t in trait_list if t not in ALL_TRAITS]
|
|
60
|
-
if invalid:
|
|
61
|
-
raise ValueError(
|
|
62
|
-
f'Unknown traits: {", ".join(invalid)}. Run "aigis traits" to see available traits.'
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
# Constraint C1: is-internal + is-external
|
|
66
|
-
if "is-internal" in ts and "is-external" in ts:
|
|
67
|
-
warnings.append("Both is-internal and is-external selected. Treating as is-external (stricter).")
|
|
68
|
-
ts.discard("is-internal")
|
|
69
|
-
|
|
70
|
-
# Step 1: trait-based file selection
|
|
71
|
-
files: set[str] = set()
|
|
72
|
-
for t in ts:
|
|
73
|
-
for f in TRAIT_FILES.get(t, []):
|
|
74
|
-
files.add(f)
|
|
75
|
-
|
|
76
|
-
# Step 2: risk tier
|
|
77
|
-
sens_data = bool(
|
|
78
|
-
ts & {"processes-pii", "handles-financial", "handles-health", "handles-proprietary", "handles-minors"}
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
tier = "LOW"
|
|
82
|
-
reason = "no high/medium triggers"
|
|
83
|
-
|
|
84
|
-
if "influences-decisions" in ts:
|
|
85
|
-
tier, reason = "HIGH", "influences-decisions"
|
|
86
|
-
elif "handles-health" in ts:
|
|
87
|
-
tier, reason = "HIGH", "handles-health"
|
|
88
|
-
elif "handles-financial" in ts and "accepts-user-input" in ts:
|
|
89
|
-
tier, reason = "HIGH", "handles-financial + accepts-user-input"
|
|
90
|
-
elif "handles-minors" in ts:
|
|
91
|
-
tier, reason = "HIGH", "handles-minors"
|
|
92
|
-
elif ("jurisdiction-eu" in ts or "jurisdiction-global" in ts) and sens_data:
|
|
93
|
-
tier, reason = "HIGH", "jurisdiction-eu + sensitive data"
|
|
94
|
-
elif "generates-code" in ts and "is-external" in ts:
|
|
95
|
-
tier, reason = "HIGH", "generates-code + is-external"
|
|
96
|
-
elif "generates-code" in ts and "is-agentic" in ts:
|
|
97
|
-
tier, reason = "HIGH", "generates-code + is-agentic"
|
|
98
|
-
elif "processes-pii" in ts:
|
|
99
|
-
tier, reason = "MEDIUM", "processes-pii"
|
|
100
|
-
elif "is-external" in ts:
|
|
101
|
-
tier, reason = "MEDIUM", "is-external"
|
|
102
|
-
elif "is-agentic" in ts:
|
|
103
|
-
tier, reason = "MEDIUM", "is-agentic"
|
|
104
|
-
elif "handles-proprietary" in ts:
|
|
105
|
-
tier, reason = "MEDIUM", "handles-proprietary"
|
|
106
|
-
elif "generates-content" in ts:
|
|
107
|
-
tier, reason = "MEDIUM", "generates-content"
|
|
108
|
-
elif "multi-model-pipeline" in ts:
|
|
109
|
-
tier, reason = "MEDIUM", "multi-model-pipeline"
|
|
110
|
-
elif "jurisdiction-us-regulated" in ts:
|
|
111
|
-
tier, reason = "MEDIUM", "jurisdiction-us-regulated"
|
|
112
|
-
elif "generates-code" in ts:
|
|
113
|
-
tier, reason = "MEDIUM", "generates-code"
|
|
114
|
-
|
|
115
|
-
# Jurisdiction modifier
|
|
116
|
-
if ("jurisdiction-eu" in ts or "jurisdiction-global" in ts) and tier != "HIGH":
|
|
117
|
-
old_tier = tier
|
|
118
|
-
tier = "MEDIUM" if tier == "LOW" else "HIGH"
|
|
119
|
-
reason += f" (elevated from {old_tier} by EU/global jurisdiction)"
|
|
120
|
-
|
|
121
|
-
# Step 3: guardrails
|
|
122
|
-
guardrails_fired: list[dict] = []
|
|
123
|
-
|
|
124
|
-
# G12 removal guardrail fires first
|
|
125
|
-
if "uses-llm" in ts and "uses-thirdparty-api" not in ts and "supply-chain" in files:
|
|
126
|
-
files.discard("supply-chain")
|
|
127
|
-
guardrails_fired.append({
|
|
128
|
-
"id": "G12",
|
|
129
|
-
"action": "REMOVE supply-chain",
|
|
130
|
-
"rationale": "Self-hosted models skip third-party controls",
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
guardrails = [
|
|
134
|
-
("G1", lambda: sens_data and "audit-logging" not in files, "audit-logging", "Sensitive data requires traceability"),
|
|
135
|
-
("G2", lambda: "handles-health" in ts and "bias-monitoring" not in files, "bias-monitoring", "Health data has demographic bias risks"),
|
|
136
|
-
("G3", lambda: "handles-financial" in ts and "influences-decisions" in ts and "fallback-patterns" not in files, "fallback-patterns", "Financial decisions need safe failure"),
|
|
137
|
-
("G4", lambda: "is-agentic" in ts and "human-oversight" not in files, "human-oversight", "Autonomous systems need oversight"),
|
|
138
|
-
("G5", lambda: "generates-code" in ts and "output-sanitization" not in files, "output-sanitization", "Generated code is execution risk"),
|
|
139
|
-
("G6", lambda: "jurisdiction-eu" in ts and "explainability" not in files, "explainability", "EU AI Act requires explainability"),
|
|
140
|
-
("G7", lambda: "jurisdiction-eu" in ts and "bias-monitoring" not in files, "bias-monitoring", "EU AI Act mandates non-discrimination"),
|
|
141
|
-
("G8", lambda: "handles-minors" in ts and "human-oversight" not in files, "human-oversight", "Systems affecting children require review"),
|
|
142
|
-
("G9", lambda: "multi-model-pipeline" in ts and "monitoring" not in files, "monitoring", "Multi-model compounding failures"),
|
|
143
|
-
("G10", lambda: tier == "HIGH" and "monitoring" not in files, "monitoring", "High-risk systems need monitoring"),
|
|
144
|
-
("G11", lambda: tier == "HIGH" and "fallback-patterns" not in files, "fallback-patterns", "High-risk systems must fail safely"),
|
|
145
|
-
("G13", lambda: "jurisdiction-us-regulated" in ts and "audit-logging" not in files, "audit-logging", "US regulated industries need audit trails"),
|
|
146
|
-
("G14", lambda: "jurisdiction-us-regulated" in ts and "human-oversight" not in files, "human-oversight", "US regulated industries need human review"),
|
|
147
|
-
("G15", lambda: "generates-code" in ts and "human-oversight" not in files, "human-oversight", "Code generation needs human review"),
|
|
148
|
-
]
|
|
149
|
-
|
|
150
|
-
for gid, cond, file, rationale in guardrails:
|
|
151
|
-
if cond():
|
|
152
|
-
files.add(file)
|
|
153
|
-
guardrails_fired.append({"id": gid, "action": f"ADD {file}", "rationale": rationale})
|
|
154
|
-
|
|
155
|
-
# Step 4: templates
|
|
156
|
-
templates: list[str] = []
|
|
157
|
-
if tier == "HIGH" or "jurisdiction-eu" in ts or "jurisdiction-global" in ts or "influences-decisions" in ts:
|
|
158
|
-
templates.extend(["ai-impact-assessment", "intended-purpose-doc", "risk-characterization"])
|
|
159
|
-
elif tier == "MEDIUM" or "jurisdiction-us-regulated" in ts:
|
|
160
|
-
templates.append("intended-purpose-doc")
|
|
161
|
-
|
|
162
|
-
if "uses-thirdparty-api" in ts and tier != "LOW":
|
|
163
|
-
templates.append("third-party-assessment")
|
|
164
|
-
|
|
165
|
-
if "jurisdiction-us-regulated" in ts and "ai-impact-assessment" not in templates:
|
|
166
|
-
templates.insert(0, "ai-impact-assessment")
|
|
167
|
-
|
|
168
|
-
# Step 5: collect control IDs
|
|
169
|
-
all_owasp: set[str] = set()
|
|
170
|
-
all_nist: set[str] = set()
|
|
171
|
-
all_iso: set[str] = set()
|
|
172
|
-
for f in files:
|
|
173
|
-
c = FILE_CONTROLS.get(f)
|
|
174
|
-
if c:
|
|
175
|
-
all_owasp.update(c["owasp"])
|
|
176
|
-
all_nist.update(c["nist"])
|
|
177
|
-
all_iso.update(c["iso"])
|
|
178
|
-
|
|
179
|
-
return {
|
|
180
|
-
"risk_tier": tier,
|
|
181
|
-
"reason": reason,
|
|
182
|
-
"traits": list(ts),
|
|
183
|
-
"implement_files": sorted(files),
|
|
184
|
-
"templates": list(dict.fromkeys(templates)),
|
|
185
|
-
"guardrails_fired": guardrails_fired,
|
|
186
|
-
"warnings": warnings,
|
|
187
|
-
"controls": {
|
|
188
|
-
"owasp": sorted(all_owasp),
|
|
189
|
-
"nist": sorted(all_nist),
|
|
190
|
-
"iso": sorted(all_iso),
|
|
191
|
-
},
|
|
192
|
-
}
|