appstore-precheck 1.18.0 → 1.20.0
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/CHANGELOG.md +256 -0
- package/README.md +108 -39
- package/bin/cli.js +8 -0
- package/package.json +2 -2
- package/skills/appstore-precheck/SKILL.md +99 -157
- package/skills/appstore-precheck/guidelines-baseline.json +285 -36
- package/skills/appstore-precheck/guidelines-fingerprints.json +319 -93
- package/skills/appstore-precheck/references/finding-commentary.md +93 -0
- package/skills/appstore-precheck/references/methodology.md +81 -26
- package/skills/appstore-precheck/references/optional-review.md +56 -0
- package/skills/appstore-precheck/references/pierre-deep-review.md +323 -44
- package/skills/appstore-precheck/references/review-catalog.json +740 -0
- package/skills/appstore-precheck/references/screenshot-vision-review.md +8 -8
- package/skills/appstore-precheck/references/simulator-dynamic-review.md +398 -54
- package/skills/appstore-precheck/references/typesafe-example.json +239 -0
- package/skills/appstore-precheck/references/typesafe.md +216 -0
- package/skills/appstore-precheck/scripts/app-discover.sh +138 -0
- package/skills/appstore-precheck/scripts/artifact-review.sh +10 -0
- package/skills/appstore-precheck/scripts/augment-json.py +29 -0
- package/skills/appstore-precheck/scripts/build-run.sh +5 -0
- package/skills/appstore-precheck/scripts/coverage-sections.sh +6 -0
- package/skills/appstore-precheck/scripts/dynamic-run.sh +400 -0
- package/skills/appstore-precheck/scripts/dynamic.sh +329 -0
- package/skills/appstore-precheck/scripts/evidence.sh +49 -15
- package/skills/appstore-precheck/scripts/findings.sh +76 -26
- package/skills/appstore-precheck/scripts/framework-detect.sh +101 -0
- package/skills/appstore-precheck/scripts/guideline-cite.sh +4 -1
- package/skills/appstore-precheck/scripts/lib/artifact-review.py +518 -0
- package/skills/appstore-precheck/scripts/lib/asc-client.py +293 -0
- package/skills/appstore-precheck/scripts/lib/build-evidence.py +50 -0
- package/skills/appstore-precheck/scripts/lib/build-exec.py +50 -0
- package/skills/appstore-precheck/scripts/lib/build-plan.py +106 -0
- package/skills/appstore-precheck/scripts/lib/build-plan.sh +15 -0
- package/skills/appstore-precheck/scripts/lib/build-run.py +177 -0
- package/skills/appstore-precheck/scripts/lib/coverage-run.sh +23 -0
- package/skills/appstore-precheck/scripts/lib/coverage-sections.py +244 -0
- package/skills/appstore-precheck/scripts/lib/dyn-bundle.sh +185 -0
- package/skills/appstore-precheck/scripts/lib/dyn-demo-login.py +111 -0
- package/skills/appstore-precheck/scripts/lib/dyn-device.sh +123 -0
- package/skills/appstore-precheck/scripts/lib/dyn-explore.py +312 -0
- package/skills/appstore-precheck/scripts/lib/dyn-geometry.sh +75 -0
- package/skills/appstore-precheck/scripts/lib/dyn-guideline-capture.py +301 -0
- package/skills/appstore-precheck/scripts/lib/dyn-guidelines.py +112 -0
- package/skills/appstore-precheck/scripts/lib/dyn-guidelines.sh +23 -0
- package/skills/appstore-precheck/scripts/lib/dyn-hosts.sh +134 -0
- package/skills/appstore-precheck/scripts/lib/dyn-process.py +75 -0
- package/skills/appstore-precheck/scripts/lib/dyn-quorum.sh +90 -0
- package/skills/appstore-precheck/scripts/lib/dyn-scrub.py +79 -0
- package/skills/appstore-precheck/scripts/lib/dyn-signals.sh +120 -0
- package/skills/appstore-precheck/scripts/lib/guideline-text.sh +23 -5
- package/skills/appstore-precheck/scripts/lib/metadata-review.py +369 -0
- package/skills/appstore-precheck/scripts/lib/optin-scan.sh +73 -0
- package/skills/appstore-precheck/scripts/lib/optional-records.py +60 -0
- package/skills/appstore-precheck/scripts/lib/png-uniform.py +115 -0
- package/skills/appstore-precheck/scripts/lib/runtime-blocking.py +26 -0
- package/skills/appstore-precheck/scripts/lib/safe_write.py +61 -0
- package/skills/appstore-precheck/scripts/lib/scan-guidelines.sh +199 -0
- package/skills/appstore-precheck/scripts/lib/static-guidelines.py +341 -0
- package/skills/appstore-precheck/scripts/lib/static-reader.py +39 -0
- package/skills/appstore-precheck/scripts/metadata-review.sh +4 -0
- package/skills/appstore-precheck/scripts/opt-in-review.py +160 -0
- package/skills/appstore-precheck/scripts/runtime-review.sh +5 -0
- package/skills/appstore-precheck/scripts/scan.sh +132 -21
- package/skills/appstore-precheck/scripts/semantic/__init__.py +1 -0
- package/skills/appstore-precheck/scripts/semantic/client.py +95 -0
- package/skills/appstore-precheck/scripts/semantic/collect.py +165 -0
- package/skills/appstore-precheck/scripts/semantic/engine.py +320 -0
- package/skills/appstore-precheck/scripts/semantic/questions.py +167 -0
- package/skills/appstore-precheck/scripts/semantic/review_v4.py +81 -0
- package/skills/appstore-precheck/scripts/semantic-review.py +61 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"""Executable v4 advisory gates, including a separate host-vision composition boundary."""
|
|
2
|
+
UNKNOWN = {'', 'unknown', 'unverified', 'unspecified', 'missing', 'not supplied'}
|
|
3
|
+
# Explicit host-provided kinds require direct visual observation; the local collector cannot supply them.
|
|
4
|
+
HOST_INPUT_KINDS = {'screenshots', 'runtime-screenshots', 'icon'}
|
|
5
|
+
VISUAL = HOST_INPUT_KINDS
|
|
6
|
+
OUTCOMES = {
|
|
7
|
+
'finding': 'The supplied evidence establishes a concrete concern under this bounded question.',
|
|
8
|
+
'no_signal': 'The reviewed evidence contains no concrete concern; this is not a compliance pass.',
|
|
9
|
+
'insufficient_evidence': 'Required inputs, context, applicability, or observations are missing or conflicting.',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def is_v4(job):
|
|
14
|
+
check = job.get('context', {}).get('check_definition', {})
|
|
15
|
+
return job.get('workflow') == 'review' and isinstance(check, dict) and 'evidence_inputs' in check
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def known(value):
|
|
19
|
+
return value is not None and value is not False and str(value).strip().lower() not in UNKNOWN
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def evidence_gaps(job, text_only=True):
|
|
23
|
+
if not is_v4(job):
|
|
24
|
+
return []
|
|
25
|
+
check, context = job['context']['check_definition'], job['context']
|
|
26
|
+
evidence = job.get('evidence', [])
|
|
27
|
+
kinds = {kind for e in evidence if e.get('text', '').strip()
|
|
28
|
+
for kind in e.get('evidence_inputs', [e.get('kind')])}
|
|
29
|
+
gaps = ['missing evidence input: ' + kind for kind in check['evidence_inputs'] if kind not in kinds]
|
|
30
|
+
gaps += ['unknown required context: ' + key for key in check.get('required_context', [])
|
|
31
|
+
if not known(context.get(key))]
|
|
32
|
+
if check['requires_vision']:
|
|
33
|
+
if text_only:
|
|
34
|
+
gaps.append('requires host vision review; Jev is text-only')
|
|
35
|
+
else:
|
|
36
|
+
for kind in set(check['evidence_inputs']) & VISUAL:
|
|
37
|
+
if not any(e.get('kind') == kind and e.get('representation') == 'host visual observation'
|
|
38
|
+
for e in evidence):
|
|
39
|
+
gaps.append('missing host visual observation: ' + kind)
|
|
40
|
+
return gaps
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def outcome_question(check, boundary):
|
|
44
|
+
instructions = (boundary + check['question'] + ' Required evidence inputs: ' +
|
|
45
|
+
', '.join(check['evidence_inputs']) + '. Abstain when: ' +
|
|
46
|
+
' '.join(check['abstain_when']) + ' Required context: ' +
|
|
47
|
+
', '.join(check.get('required_context', [])) +
|
|
48
|
+
'. No signal is advisory and never establishes policy compliance.')
|
|
49
|
+
return {'type': 'choice', 'instructions': instructions, 'criteria': OUTCOMES}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def compose_host_review(job, body, text_only=False):
|
|
53
|
+
"""Compose explicit host observations; text-only clients must pass text_only=True."""
|
|
54
|
+
check = job['context']['check_definition']
|
|
55
|
+
result = {'id': job['id'], 'workflow': 'review', 'advisory': True, 'check_key': job.get('check_key'),
|
|
56
|
+
'guideline': check['guideline'], 'catalog_version': 4, 'advisory_only': True, 'outcome': 'insufficient_evidence',
|
|
57
|
+
'action': 'pierre_review', 'reason': 'incomplete evidence coverage', 'evidence': [],
|
|
58
|
+
'model_probability': None, 'model_confidence': None}
|
|
59
|
+
gaps = evidence_gaps(job, text_only)
|
|
60
|
+
if gaps or not job['coverage']['complete'] or job['coverage']['missing']:
|
|
61
|
+
result['reason'] = '; '.join(gaps or job['coverage']['missing'] or ['incomplete evidence coverage'])
|
|
62
|
+
return result
|
|
63
|
+
answer = body.get('answers', {}).get('outcome', {})
|
|
64
|
+
choice = answer.get('choice')
|
|
65
|
+
probability = answer.get('probabilities', {}).get(choice, 0)
|
|
66
|
+
confidence = answer.get('confidence', 0)
|
|
67
|
+
result.update(model_probability=probability, model_confidence=confidence)
|
|
68
|
+
if choice not in OUTCOMES or choice == 'insufficient_evidence' or probability < .90 or confidence < .50:
|
|
69
|
+
result['reason'] = 'uncertain or unsupported advisory judgment'
|
|
70
|
+
return result
|
|
71
|
+
citation = body.get('answers', {}).get('evidence', {})
|
|
72
|
+
selected = citation.get('choice')
|
|
73
|
+
if citation.get('probabilities', {}).get(selected, 0) >= .90 and citation.get('confidence', 0) >= .50:
|
|
74
|
+
result['evidence'] = [e for e in job['evidence'] if e['id'] == selected]
|
|
75
|
+
if choice == 'finding' and not result['evidence']:
|
|
76
|
+
result['reason'] = 'concern has no confidently selected evidence span'
|
|
77
|
+
return result
|
|
78
|
+
result.update(outcome=choice, action='advisory_finding' if choice == 'finding' else 'advisory_result',
|
|
79
|
+
reason='bounded advisory judgment; no scanner verdict or compliance pass',
|
|
80
|
+
judgments=body.get('answers', {}))
|
|
81
|
+
return result
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Prepare, execute, or replay advisory TypeSafe evidence bundles."""
|
|
3
|
+
import argparse
|
|
4
|
+
import json
|
|
5
|
+
import sys
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from semantic.collect import collect
|
|
9
|
+
from semantic.engine import render_text, request_for, run_job, validate_bundle
|
|
10
|
+
from semantic.questions import MODEL, VERSION, WORKFLOWS
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def main(argv=None):
|
|
14
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
15
|
+
source = parser.add_mutually_exclusive_group(required=True)
|
|
16
|
+
source.add_argument('--repo', type=Path, help='collect bounded app evidence locally')
|
|
17
|
+
source.add_argument('--bundle', type=Path, help='explicit evidence bundle; see references/typesafe.md')
|
|
18
|
+
source.add_argument('--workflows', action='store_true', help='show available workflows and required context')
|
|
19
|
+
mode = parser.add_mutually_exclusive_group()
|
|
20
|
+
mode.add_argument('--prepare', action='store_true', help='print bundle without inference (default for --repo)')
|
|
21
|
+
mode.add_argument('--dry-run', action='store_true', help='print exact requests without inference')
|
|
22
|
+
mode.add_argument('--live', action='store_true', help='send supplied evidence to TypeSafe; needs TYPESAFE_API_KEY')
|
|
23
|
+
parser.add_argument('--cache-dir', type=Path, help='optional private cache; without --live, replay only')
|
|
24
|
+
parser.add_argument('--model', default=MODEL)
|
|
25
|
+
parser.add_argument('--format', choices=['json', 'text'], default='json')
|
|
26
|
+
args = parser.parse_args(argv)
|
|
27
|
+
if args.workflows:
|
|
28
|
+
print(json.dumps(WORKFLOWS, ensure_ascii=False, indent=2))
|
|
29
|
+
return 0
|
|
30
|
+
try:
|
|
31
|
+
bundle = collect(args.repo) if args.repo else json.loads(args.bundle.read_text(encoding='utf-8'))
|
|
32
|
+
validate_bundle(bundle)
|
|
33
|
+
if args.prepare or (args.repo and not args.live and not args.dry_run and not args.cache_dir):
|
|
34
|
+
print(json.dumps(bundle, ensure_ascii=False, indent=2))
|
|
35
|
+
return 0
|
|
36
|
+
# Validate every request before starting any billable work.
|
|
37
|
+
requests = [request_for(j, args.model) for j in bundle['jobs']]
|
|
38
|
+
if args.dry_run:
|
|
39
|
+
print(json.dumps({'version': VERSION, 'requests': requests}, ensure_ascii=False, indent=2))
|
|
40
|
+
return 0
|
|
41
|
+
results = [run_job(j, args.model, args.live, args.cache_dir) for j in bundle['jobs']]
|
|
42
|
+
if args.format == 'text':
|
|
43
|
+
print('\n'.join(render_text(r) for r in results))
|
|
44
|
+
else:
|
|
45
|
+
print(json.dumps({'schema_version': 1, 'advisory': True, 'mode': 'shadow',
|
|
46
|
+
'questions_version': VERSION, 'model_requested': args.model,
|
|
47
|
+
'catalog_version': bundle.get('catalog_version'),
|
|
48
|
+
'results': results, 'summary': {
|
|
49
|
+
'jobs': len(results),
|
|
50
|
+
'pierre_review': sum(r['action'] == 'pierre_review' for r in results),
|
|
51
|
+
'estimated_cost_usd': sum(r.get('estimated_cost_usd') or 0 for r in results),
|
|
52
|
+
'unknown_cost_requests': sum(r.get('estimated_cost_usd') is None for r in results)}},
|
|
53
|
+
ensure_ascii=False, indent=2))
|
|
54
|
+
return 0 # Advisory outcomes have no scanner/release exit-code meaning.
|
|
55
|
+
except (ValueError, OSError, KeyError) as exc:
|
|
56
|
+
print('semantic-review: invalid or unreadable input (%s)' % type(exc).__name__, file=sys.stderr)
|
|
57
|
+
return 64
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
if __name__ == '__main__':
|
|
61
|
+
sys.exit(main())
|