Repoint every remaining literal `.specify/...` / `docs/input` reference to the real package/domain location and delete all compat symlinks. The harness now runs purely via packages/casan-harness/... with no .specify facade; .specify holds ONLY runtime state (logs/, agentops/alerts.log, level5/central-governance). Refs fixed (Phase 0.5 only caught `$VAR/.specify/` — these were bare/`__file__`/literal): - secrets-scan.sh: scan-target excludes -> packages/casan-harness/... (+ apps/okr/domain/corpus) - loop_common.py: loop-policy.yaml -> harness config (package-relative) - evidence-pack-build.py: judge-gate test + traceability-matrix.py -> harness/sibling - phase10-traceability: REQ -> $CASAN_DOMAIN_ROOT/input - run-casan-pipeline.mjs: model-fallback/drift-detect/rollback-manager -> HARNESS_BASH, golden -> GOLDEN_PLAN (apps/okr/domain), with .specify/logs state kept - casan-step.mjs: requirement fallback restored to docs/input for hermetic sandboxes - descriptive config (tool-registry/harness-package/drift-policy/hallucination/risk-registry/ loop-policy.schema + docstrings) repointed for accuracy - policy-bundle.yaml: 8 policy paths -> packages/casan-harness/...; manifest regenerated + re-signed (POLICY_HASHES_VALID files=8, POLICY_SIGNATURE_VALID) Removed 22 .specify code/config symlinks + docs/input symlink. Full gate via packages path, NO facade: PASS=64 FAIL=0 SKIP=3. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
43 lines
1.9 KiB
JavaScript
43 lines
1.9 KiB
JavaScript
// CASAN shared log helper (Node side).
|
|
// Taxonomy (shared with packages/casan-harness/scripts/bash/casan-log.sh):
|
|
// error(0) < warn(1) < info(2) < debug(3) < trace(4), default info.
|
|
// All lines go to stderr so stdout stays reserved for existing outputs.
|
|
|
|
export const LEVELS = { error: 0, warn: 1, info: 2, debug: 3, trace: 4 };
|
|
|
|
const raw = (process.env.CASAN_LOG_LEVEL ?? 'info').toLowerCase();
|
|
export const LOG_LEVEL = raw in LEVELS ? raw : 'info';
|
|
export const LOG_THRESHOLD = LEVELS[LOG_LEVEL];
|
|
|
|
export function enabled(level) {
|
|
return (LEVELS[level] ?? LEVELS.info) <= LOG_THRESHOLD;
|
|
}
|
|
|
|
export function log(level, component, message) {
|
|
if (!enabled(level)) return;
|
|
process.stderr.write(
|
|
`[${level.toUpperCase()}] ${new Date().toISOString()} [${component}] ${message}\n`,
|
|
);
|
|
}
|
|
|
|
// Redaction for trace-level payload excerpts. Mirrors the H4 masking families
|
|
// (email/phone/id/credit-card/secret/private-key/conn-string/AWS key) so no
|
|
// secret or PII ever reaches the terminal, even at trace.
|
|
const REDACTIONS = [
|
|
[/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?(-----END [A-Z ]*PRIVATE KEY-----|$)/g, '[REDACTED_PRIVATE_KEY]'],
|
|
[/(API[_-]?KEY|ACCESS[_-]?TOKEN|REFRESH[_-]?TOKEN|PASSWORD|JWT[_-]?SECRET|SECRET)\s*[:=]\s*\S+/gi, '$1=[REDACTED]'],
|
|
[/(postgres|mysql|mongodb):\/\/[^@\s]+@/gi, '$1://[REDACTED]@'],
|
|
[/AKIA[0-9A-Z]{16}/g, '[REDACTED_AWS_KEY]'],
|
|
[/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g, '***MASKED_EMAIL***'],
|
|
[/\b(?:[0-9]{4}[- ]?){3}[0-9]{4}\b/g, '***MASKED_CARD***'],
|
|
[/\b[0-9]{9,12}\b/g, '***MASKED_ID***'],
|
|
[/\+?[0-9][0-9 .-]{8,}[0-9]/g, '***MASKED_PHONE***'],
|
|
];
|
|
|
|
export function redact(text, maxLen = 200) {
|
|
let out = String(text ?? '');
|
|
for (const [re, sub] of REDACTIONS) out = out.replace(re, sub);
|
|
if (out.length > maxLen) out = `${out.slice(0, maxLen)}…(+${out.length - maxLen} chars)`;
|
|
return out.replace(/\n/g, '\\n');
|
|
}
|