@code-sentinel-cli/code-sentinel-cli 4.0.5 → 4.0.6

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/dist/index.js CHANGED
@@ -6,11 +6,11 @@ import { randomBytes, createCipheriv, createDecipheriv, createHash, randomUUID,
6
6
  import * as sp2 from 'path';
7
7
  import { resolve, extname, isAbsolute, relative, dirname, join, basename, posix, sep, normalize } from 'path';
8
8
  import * as nativeFs from 'fs';
9
- import { existsSync, mkdirSync, rmSync, constants, readFileSync, statSync, stat as stat$1, realpathSync, realpath, readdirSync, readdir as readdir$1, unwatchFile, watchFile, watch as watch$1, writeFileSync, openSync, fstatSync, closeSync, readSync } from 'fs';
9
+ import { existsSync, readFileSync, constants, mkdirSync, statSync, stat as stat$1, realpathSync, realpath, readdirSync, readdir as readdir$1, unwatchFile, watchFile, watch as watch$1, writeFileSync, openSync, fstatSync, closeSync, readSync } from 'fs';
10
10
  import { fileURLToPath, pathToFileURL } from 'url';
11
11
  import { Language, Parser, Query } from 'web-tree-sitter';
12
12
  import { Project, SyntaxKind, Node, VariableDeclarationKind, ScriptKind } from 'ts-morph';
13
- import { readFile, stat, writeFile, mkdir, rename, readdir, rm, access, mkdtemp, unlink, chmod, lstat, realpath as realpath$1, open } from 'fs/promises';
13
+ import { readFile, stat, mkdir, writeFile, rename, readdir, rm, access, mkdtemp, unlink, chmod, lstat, realpath as realpath$1, open } from 'fs/promises';
14
14
  import { Socket } from 'net';
15
15
  import { deflateRawSync, inflateRawSync } from 'zlib';
16
16
  import { createGoogleGenerativeAI } from '@ai-sdk/google';
@@ -20,11 +20,11 @@ import { generateText } from 'ai';
20
20
  import { type, homedir, totalmem, tmpdir } from 'os';
21
21
  import { cosmiconfig } from 'cosmiconfig';
22
22
  import { parse, stringify } from 'yaml';
23
+ import { execFile as execFile$1, spawn, execFileSync, execSync } from 'child_process';
24
+ import { promisify } from 'util';
23
25
  import { createClient } from '@libsql/client';
24
26
  import 'mariadb';
25
27
  import { Command, Option } from 'commander';
26
- import { execFile as execFile$1, spawn, execFileSync, execSync } from 'child_process';
27
- import { promisify } from 'util';
28
28
  import { confirm, password, select, input } from '@inquirer/prompts';
29
29
  import { render, Static, Box, Text } from 'ink';
30
30
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
@@ -11603,7 +11603,7 @@ function parseParams2(url) {
11603
11603
  function normalizeUrl(url) {
11604
11604
  return url.replace(/^\/+/, "");
11605
11605
  }
11606
- var createCompositeParser, SUPPORTED, createTextParser, requireFromHere, grammarCache, parserInitialized, initParser, resolveGrammarPath, loadGrammar, LANGUAGE_TO_GRAMMAR, SUPPORTED2, createTreeSitterParser, asTreeSitterTree, SUPPORTED3, scriptKindFor, createTsMorphParser, createParser, TS_LANGUAGES, EXTENSIONS, TS_SOURCE_EXTENSIONS_BY_RUNTIME_EXT, scriptKindFor2, normalizeRelativePath, candidatePaths, normalizeConfigPath, stripJsonComments, loadTsConfigResolver, matchPathPattern, applyPathTarget, resolveAliasModule, resolveModule, aliasIfDifferent, exportedSymbols, expressionRootName, addSymbol, compareText, variableBindingNames, importEqualsSpecifier, extractSymbols, fingerprintFor, createTsAstDependencyGraphBuilder, isTsLike, debug, warn, tryLoad, trySave, createIncrementalAstGraphBuilder, SOURCES, SINKS, SANITIZERS, DEFAULT_TS_TAINT_TABLES, JAVA_SOURCES, JAVA_SINKS, JAVA_SANITIZERS, DEFAULT_JAVA_TAINT_TABLES, EMPTY_SUMMARY, paramSentinel, PARAM_SENTINEL_RE, MAX_CROSS_FILE_DEPTH, TYPE_DECL_NODES, indexCache, SCOPE_BOUNDARY, SCOPE_BOUNDARY2, TYPE_DECL, STRING_PASSTHROUGH, ARG_PASSTHROUGH, CONTAINER_ELEMENT, BUILDER_APPENDERS, COLLECTION_MUTATORS, RECEIVER_FOLD_MUTATORS, CONDITIONAL_CONSTRUCT, EMPTY_SUMMARY2, paramSentinel2, PARAM_SENTINEL_RE2, MAX_CROSS_METHOD_DEPTH, SANITIZE_CALL, BYPASS_CALL, PREFIX_GATE, MAX_VALUE_HOPS, SOURCE_PATTERNS, maskJavaComments, maskedCorpusCache, maskJavaFiles, MAPPING_ANNOTATIONS, PARAM_ANNOTATIONS, AUTHZ_ANNOTATIONS, VALIDATION_ANNOTATIONS, annotationScanner, TYPE_DECL2, MODIFIER, METHOD_NAME, LEADING_ANNOTATION, simpleName, lineOf, readBalanced, annotationArgs, firstStringLiteral, readMappingPath, readMappingMethod, joinPaths, skipToDeclaration, isTypeDeclaration, splitParams, parseParam, readAuthAnnotations, ROLE_ANNOTATIONS, stripRolePrefix, readAuthRoles, precedingBlock, readClassContext, extractFromFile, extractHttpEndpoints, findEnclosingEndpoint, SINK_ATTACKS, AI_TRIAGE_ATTACK_ALIASES, SOURCE_KIND, kindsFromSources, deriveAuthContext, resolveCompanionParams, resolveInjectionPoint, buildServerRequest, buildClientRequest, generateAttackScenario, UNASSESSED_CATALOG, BY_ID, buildUnassessedItems, INJECTION_LANGUAGES, TIER_A_INJECTION_ITEMS, CONFIRMED_LIMITATION, INCONCLUSIVE_LIMITATION, evidenceFrom, byFileLine, CHECKLIST_VERDICT_RANK, mergeEqualRank, dedupeByChecklistId, scenarioByFileLine, PENTEST_CHECKLIST_TOTAL, DECLARED_CHECKLIST_IDS, buildChecklistCoverage, buildCoverage, assembleAssessment, MAX_EVIDENCE3, REVIEW_SIGNAL_MAP, asJsonRecord, readReviewFinding, parseReviewReport, evidenceOf, sortEvidence, foldReviewSignals, MAX_EVIDENCE22, AUTHORIZATION_RISK_EVIDENCE, MASS_ASSIGNMENT_EVIDENCE, OWNERSHIP_SCOPE_EVIDENCE, STATE_TRANSITION_EVIDENCE, AI_SIGNAL_MAP, readPerRule, parseAiReviewReport, evidenceOf2, sortEvidence2, scopeClauseOf, provenanceOf, skipReasonOf, anchorResolves, anchorOf, unresolvableCitationClause, citationGateClause, citationTargetNoun, anchorAccepts, foldAiSignals, IMPORT_LINE_RE, isImportOrPackageLine, CSRF_SPEC, CORS_SPEC, HEADERS_SPEC, STACKTRACE_SPEC, MESSAGE_SPEC, COOKIE_SPEC, SESSION_FIXATION_SPEC, SESSION_TIMEOUT_SPEC, AUTH_CACHE_SPEC, lineOf2, SECURITY_CONFIG_RE, CSRF_DISABLE_RE, CORS_WILDCARD_RE, CROSS_ORIGIN_BARE_RE, ALLOW_CREDENTIALS_RE, CORS_EXPLICIT_ORIGIN_RE, CORS_ANY_RE, HEADERS_DISABLE_RES, HEADERS_CONFIGURED_RE, CSP_CONFIGURED_RE, STACKTRACE_EXPOSE_RE, STACKTRACE_NEVER_RE, MESSAGE_EXPOSE_RE, MESSAGE_NEVER_RE, COOKIE_CONTEXT_RE, COOKIE_INSECURE_CHECKS, COOKIE_HARDENED_RE, SESSION_FIXATION_DISABLED_RE, CACHE_CONTROL_DISABLE_RE, CACHE_CONTROL_CONFIGURED_RE, SESSION_TIMEOUT_PATH_RE, SESSION_BLOCK_HEADER_RE, SESSION_TIMEOUT_LEAF_RE, YAML_INDENT_RE, control, configEvidence, firstMatch, firstMatchAny, scanCsrf, CORS_ORIGINS_YAML_RE, CORS_CREDENTIALS_YAML_RE, isWildcardOrigins, corsConfigRank, corsOriginHits, scanCors, scanSecurityHeaders, NON_PROD_PROFILE_RE, scanStacktraceExposure, scanErrorMessageExposure, scanCookieAttributes, scanSessionFixation, scanAuthCacheControl, findSessionTimeout, timeoutNeverExpires, timeoutToMinutes, JWT_VALIDITY_RE, NON_PROD_CONFIG_RE, findJwtValidities, hoursOf, judgeJwtValidity, judgeServletTimeout, scanSessionTimeout, scanSecurityConfig, TEST_SOURCE_SET_RE, isTestSourcePath, WEAK_CRYPTO_SPEC, MAX_EVIDENCE32, lineOf3, classifyAlgorithm, GET_INSTANCE_RE, COMMONS_DIGEST_RE, GUAVA_HASHING_RE, SECRET_KEY_SPEC_RE, SHORTHAND_ALGO, collectWeakHits, STRONG_CRYPTO_RE, STRONG_CRYPTO_RE_G, firstStrong, evidence, item, scanWeakCrypto, REGEX_PRECEDING_KEYWORDS, isIdentChar, regexAllowedAt, maskJsComments, maskedCorpusCache2, maskJsFiles, BROWSER_STORAGE_SPEC, MAX_EVIDENCE4, lineOf4, HIGH_SENSITIVITY_RE, TOKEN_FAMILY_RE, classifyStorageKey, VALUE_TOKEN_FAMILY_RE, classifyStorageValue, keyToken, SET_ITEM_RE, BRACKET_ASSIGN_RE, STORAGE_USE_RE, IDB_CONTEXT_RE, LOCALFORAGE_SET_RE, IDB_STORE_WRITE_RE, collectStorageHits, collectIndexedDbHits, finalizeHits, firstStorageUse, evidence2, item2, scanSensitiveBrowserStorage, AT_REST_SPEC, MAX_EVIDENCE5, lineOf5, PWD_GETTER, PWD_EQUALS_RECEIVER_RE, PWD_EQUALS_ARG_RE, collectPasswordComparisonHits, SENSITIVE_FIELD_NAMES, FIELD_DECL_RE, FIELD_PROTECTED_RE, precedingBlock2, collectPlaintextFieldHits, finalizeHits2, PROTECTION_RE, firstProtection, AT_REST_SURFACE_RE, evidence3, item3, scanSensitiveDataAtRest, PADDING_ORACLE_SPEC, MAX_EVIDENCE6, lineOf6, GET_INSTANCE_RE2, collectCbcHits, BAD_PADDING_CATCH_RE, collectBadPaddingHits, finalizeHits3, AEAD_RE, firstAead, CIPHER_SURFACE_RE, evidence4, item4, scanPaddingOracle, LOGGING_SPEC, MAX_EVIDENCE7, lineOf7, JAVA_LOG_CALL_RE, JAVA_CONSOLE_CALL_RE, JS_CONSOLE_CALL_RE, LOG_SURFACE_RE, stripStringLiterals, SECRET_RE, PII_RE, PROTECTED_TAIL_RE, findSensitiveToken, collectSensitiveContainers, findSensitiveArgument, findSensitiveOutput, firstLogSurface, evidence5, item5, scanSensitiveLogging, CHECKLIST_ID, CONTROL_ID, TITLE, CWE, MAX_EVIDENCE8, ADMIN_PATH_RE, ADMIN_CONTROLLER_RE, isAdminEndpoint, ADMIN_ROLE_RE, ROLE_CAPABLE_AUTHZ, ROLE_ANNOTATION_RE, SEC_CONFIG_HINT_RE, MATCHER_RE, ACCESS_AFTER_RE, ANY_REQUEST_RE, offsetOfLine, readBalanced2, stringLiterals, antMatches, hasAdminRoleAnnotation, classHeaderOf, memberWindow, annotationStance, accessKind, collectFilterConfig, filterStanceFor, combineProtection, publicNote, item6, auditAdminSurface, CLOUD_ACL_SPEC, MAX_EVIDENCE9, lineOf8, PUBLIC_ACL_PATTERNS, finalizeHits4, collectCannedAclHits, EFFECT_ALLOW_RE, WILDCARD_PRINCIPAL_RE, S3_ACTION_RE, enclosingObject, collectBucketPolicyHits, evidence6, item7, scanCloudStorageAcl, ACTUATOR_SPEC, MAX_EVIDENCE10, CONFIG_FILE_RE, SENSITIVE_ACTUATOR_ENDPOINTS, lineOf9, indentOf, isBlankOrComment, splitEndpoints, classifyExposure, exposureNote, H2_NOTE, findChildKey, collectListItems, collectExposureHits, collectH2Hits, finalizeHits5, evidence7, item8, scanActuatorExposure, BACKUP_FILE_SPEC, BACKUP_FILE_GLOBS, BACKUP_FILE_RE, SENSITIVE_BASE_RE, MAX_EVIDENCE11, stripBackupSuffix, classify2, evidence8, scanBackupFiles, CROSSDOMAIN_SPEC, CROSSDOMAIN_GLOBS, MAX_EVIDENCE12, lineOf10, PERMISSIVE_PATTERNS, collectHits, evidence9, scanCrossDomainPolicy, CLIENT_INFO_SPEC, ANGULAR_CONFIG_GLOBS, MAX_EVIDENCE13, lineOf11, asRecord, sourceMapEnabled, buildConfigurations, scanConfigFile, evidence10, item9, scanClientInfoLeak, SENSITIVE_FILE_SPEC, SENSITIVE_FILE_GLOBS, SENSITIVE_FILE_RE, PEM_TEXT_RE, PRIVATE_KEY_HEADER_RE, MAX_EVIDENCE14, classify22, evidence11, scanSensitiveFiles, INSECURE_TRANSPORT_SPEC, ENVIRONMENT_FILE_RE, MAX_EVIDENCE15, lineOf12, extractStringLiterals, HTTP_URL_RE, HTTPS_PRESENCE_RE, isExcludedHost, TEMPLATE_FILE_RE, scanInsecureFormSubmission, isTestPath, scanExternalCleartextLinks, JAVA_FILE_RE, CLEARTEXT_JAVA_CLIENT_RE, scanJavaCleartextClients, scanInsecureTransport, WEBSOCKET_SPEC, MAX_EVIDENCE16, WS_URL_RE, WSS_PRESENCE_RE, scanWebSocketSecurity, authFillKey, createStubAuthFillResolver, buildAuthFillMap, ALG_TO_HASH, SIGNING_KEY_LINE, ENV_PLACEHOLDER, lineOf13, cleanValue, discoverJwtSigningKeys, b64url, b64urlStr, signingKeyBytes, mintJwt, DEFAULT_JHIPSTER_CLAIMS, RECIPE_NOTE, DECODE_ONLY_NOTE, jarKeysToSigningKeys, sha256Hex, buildRuntimeAuthRecipe, mintTokenFromRecipe, DEFAULT_TTL_SECONDS, commandsFor, credentialFor, runtimeAuthSeedDeviation, runtimeAuthSeedDecodeOnlyDeviation, planFor, buildRuntimeAuthSeedPlan, DEFAULT_TIMEOUT_MS, CRLF, encodeResp, identify, readReply, applyRuntimeAuthSeed, describeShape, resolveRuntimeAuthHypothesis, THREW, createStubRuntimeAuthHypothesisResolver, dataSeedKey, describeShape2, THREW2, resolveRuntimeDataSeedHypothesis, createStubRuntimeDataSeedResolver, buildDataSeedPlan, buildApiCreateSeedPlan, dataSeedEndpointSummaries, IDEMPOTENT_INSERT, BACKSLASH_IS_ESCAPE, escapeSqlString, sqlLiteral, assertIdentifier, renderDataSeedSql, SEED_AUDIT_SENTINEL, AUDIT_FIELD_RE, CLASS_DECL_RE, TABLE_RE, EXTENDS_RE, NULLABLE_FALSE_RE, LENGTH_RE, stripJavaComments, group, detectSeedAuditColumns, applySeedAuditColumns, seedAuditAddedColumns, OBJECT_SEED_BASELINE_KEY, OBJECT_SEED_BASELINE_CONTENT_BASE64, PENTEST_CANARY_BUCKET, MAX_DERIVED_TARGETS, MAX_DERIVED_EVIDENCE, CONFIG_PATH_RE, BUCKET_KEY_RE, LINE_RE, PLACEHOLDER_RE, ENC_PREFIX_RE, BOOLEAN_VALUE_RE, HAS_LOWERCASE_RE, canonicalKey, cleanValue2, resolveValue, referencesToken, deriveObjectStoreSeedTargets, renderObjectStoreSeedTsv, REACHABILITY_MANIFEST_SCHEMA_VERSION, MANIFEST_NOTE, SCALAR_JAVA_TYPES, baseTypeName, seedForParam, METHOD_INTENT, buildHint, buildReachabilityManifest, norm, dirOf, baseName, isMavenPom, isGradleBuild, stripXmlComments, isAncestorDir, normModulePath, selectRunnableModule, PACKAGE_DECL, BOOT_CLASS, posix22, detectSpringBootClass, BASE_CONFIG_RE, PROFILE_CONFIG_RE, HARNESS_PORT, KEY_LINE_RE, yamlEntries, emptyKeys, isConfigYaml, profileRank, declaresDatasource, detectDatasourceProfileBlocker, detectProfileCompositionBlocker, detectServerPortBlocker, XML_COMMENT_RE, INCLUDE_RE, CREATE_TABLE_RE, ALTER_TARGET_RE, matchAllGroups, detectUnrunnableMigrationBlocker, detectPolicyBootBlockers, composeSuggested, BINDABLE_NAME_RE, YAML_KEY_RE, PROPS_KEY_RE, configValueOf, rawTokensOf, MARK, AUTHORITY_LIKE_RE, shapeInAuthority, nextOf, shapeInPath, shapeAt, parseConfigValue, renderTemplate, DIALECT_SPECS, JDBC_URL_PATTERNS, DRIVER_PATTERNS, isConfigFile, isBuildFile, dialectsMatching, resolveDialect, DDL_AUTO_CREATE_RE, FLYWAY_RE, LIQUIBASE_RE, resolveSchemaProvisioning, detectSchemaProvisioning, detectDbTier, DB_SIDECAR_PORT, DISPOSABLE_DB, dbSidecarEnv, buildDbSidecarSpec, PROFILE_GATED_JAR_BEANS, JHIPSTER_PROFILE_CONSTANTS, isJava, CLASS_DECL_RE2, PROFILE_ANNOTATION_RE, CONDITIONAL_ANNOTATION_RE, CONFIG_ANNOTATION_RE, readProfileAnnotation, declarationHead, braceMatch, lineAt, parsedClasses, simpleTypeName2, parseParams, beanMethods, collectProducers, detectUngatedProfileDependencies, ungatedProfileDeviationText, STANDALONE_BOOT_PROFILE, ENTITY_SCHEMA_GAPS, NOTE, isConfigFile2, leafKey, indentOf2, fullPathFor, usesJpa, KAFKA_BUILD_RE, KAFKA_CONFIG_RE, STREAM_BUILD_RE, STREAM_CONFIG_RE, declaresKafka, declaresStreamBinder, hasPinnedListenerAutoStartup, ENDPOINT_PROPERTY_RULES, ENDPOINT_VALUE_RE, CLUSTER_TOPOLOGY_RULES, literalDatabaseOf, resolveSchemaResolution, buildStandaloneBootProfile, runtimeEnvKeyFor, A_SENTINEL, ENC_SENTINEL, isEndpointShaped, isEndpointPropertyPath, hasToken, dummyFor, RELAXED_ENV, envKeyFor, buildSidecars, renderSidecar, identifyByName, PATH_KINDS, PATH_LEAF_ROLES, identifyByPath, roleFromShape, shapedDummy, resolveSlot, resolvePlaceholder, encSentinelFor, SHAPE_PRECEDENCE, strongerShape, buildBootResolution, CONFIG_ENTRY_RE, SKIPPED_ENTRY_RE, XML_COMMENT_RE2, SYSTEM_PATH_RE, declaredSystemJarEntries, declaredSystemJarPaths, readCentralDirectory, readEntryBytes, readEntryText, languageFor, detectMissingSystemJars, readJarConfigFiles, listJarClassNames, MIN_CONSTANT_LEN, MAX_CONSTANT_LEN, MAX_CONSTANTS_PER_CLASS, NOISE_CONSTANT_RE, parseClassConstants, constantRank, readJarClassConstants, collectDependencyClassConstants, collectDependencyClassNames, collectDependencyConfigFiles, JWT_CONTEXT_MARKER_RE, BASE64_SHAPE_RE, MIN_BASE64_KEY_CHARS, MAX_BASE64_KEY_CHARS, decodedByteLength, readJarJwtKeyCandidates, collectJwtKeyCandidates, JWT_FACADE_RE, JWT_DECODE_CALL_RE, JWT_VERIFY_MARKER_RE, readJarDecodeOnlyEvidence, collectDecodeOnlyEvidence, EOCD_SIGNATURE, CENTRAL_SIGNATURE, EOCD_SEARCH_WINDOW, MAX_COMPRESSION_RATIO, MAX_UNCOMPRESSED_BYTES, MAX_ENTRIES, fail, isUnsafeName, readArchive, readArchiveEntryText, SOURCE_EXTENSIONS, extensionOf, baseNameOf, XML_COMMENT_RE3, isAggregatorPom, declaresParentPath, declaresSystemPaths, resolveAgainst, preflightArchive, SKIP_DIRS, MAX_FILE_BYTES, MAX_PARENT_DEPTH, toPosix2, isFile, walk, XML_COMMENT_RE4, RELATIVE_PATH_RE, SYSTEM_PATH_RE2, PARENT_BLOCK_RE, EMPTY_RELATIVE_PATH_RE, readPom, expandBasedir, planServicePackage, CRC_TABLE, crc32, writePackageZip, SIDECAR_IMAGES, HARNESS_PLAN_SCHEMA_VERSION, isConfigFile3, isBuildFile2, stripComments, SERVICE_DEPS, detectDatabaseDependency, detectServiceDependencies, detectHarnessDependencies, AUTO_CONFIGURED_LISTENER_FACTORY, KAFKA_LISTENER_ARGS_RE, LISTENER_PIN_RE, LISTENER_FACTORY_RE, SELF_OFF_FACTORY_BEAN_RE, SET_AUTO_STARTUP_FALSE_RE, classifyKafkaBootPath, buildHarnessPlan, applyKafkaBrokerCoherence, RUNTIME_PLAN_SCHEMA_VERSION, PLAN_NOTE, describeSidecar, buildSteps, buildRuntimeBringUpPlan, RUNTIME_OVERLAY_FILE, RUNTIME_COMPOSE_FILE, RUNTIME_GUIDE_FILE, RUNTIME_BOOT_ENV_FILE, SIDECAR_IMAGE, REDIS_CLUSTER_COMMAND, renderNestedYaml, renderOverlay, publishLine, renderCompose, renderGuide, renderBootEnv, generateRuntimeArtifacts, SUBMISSION_REQUIREMENTS_SCHEMA_VERSION, MAX_EVIDENCE17, NOTE2, capEvidence, totalSuffix, blockerEvidence, groupBy, packagingRequirements, secretRequirements, POLICY_KINDS, policyRequirements, infrastructureRequirements, authRequirements, seedRequirements, TIER_ORDER, buildSubmissionRequirements, renderSubmissionRequirements, REJECT_SIDECAR, applyRuntimeInput, DESER_SPEC, MAX_EVIDENCE18, lineOf14, UNSAFE_PATTERNS, collectHits2, SAFE_VALIDATOR_RE, firstSafeValidator, evidence12, item10, scanUnsafeDeserialization, WEAK_RANDOM_SPEC, MAX_EVIDENCE19, lineOf15, WEAK_RNG_PATTERNS, SECURITY_ID_RE, statementAround, COOKIE_SINK_MAX_HOPS, namesCarrying, reachesCookie, collectHits3, SECURE_RANDOM_RE, firstSecureRandom, evidence13, item11, scanWeakSecureRandom, POSTMESSAGE_SPEC, MAX_EVIDENCE20, lineOf16, WINDOW_LISTENER_PATTERNS, ORIGIN_RE, isFrontend, listenersIn, evidence14, item12, scanPostMessageOrigin, XXE_SPEC, MAX_EVIDENCE21, lineOf17, XML_PARSER_PATTERNS, HARDENING_RE, parsersIn, evidence15, item13, scanXxe, WEAK_TLS_SPEC, MAX_EVIDENCE222, lineOf18, BYPASS_PATTERNS, TLS_SURFACE_RE, bypassesIn, evidence16, item14, scanWeakTls, DOCKERFILE_SPEC, DOCKERFILE_RE, DOCKERFILE_GLOBS, isLoopback, auditDockerfileDependencyConfusion, auditDockerfileContent, scanDockerfile, HOST_HEADER_SPEC, MAX_EVIDENCE23, lineOf20, HOST_PATTERNS, collectHits5, evidence18, item16, scanHostHeader, CHECKLIST_ID2, CONTROL_ID2, TITLE2, evidenceOf3, item17, VALUE_ANNOTATION_RE, FIELD_AFTER_VALUE_RE, LIFETIME_TOKEN_RE, tokenize, hasOtpToken, TIME_UNIT_RE, NAME_UNIT_HINTS, TO_SECONDS, lineOf21, isOtpLifetimeName, configRank, inconclusive, scanOtpPolicy, PASSWORD_POLICY_SPEC, MAX_EVIDENCE24, lineOf22, precedingBlock3, PASSWORD_NAME_RE, NOT_A_SECRET_RE, isPasswordName, STRING_DECL_RE, SIZE_MIN_RE, ANNOTATION_IN_BLOCK_RE, LENGTH_CHECK_RE, CONSTRAINT_VALIDATOR_RE, ANNOTATION_DECL_RE, STRING_LITERAL_RE, QUANT_MIN_RE, POLICY_SURFACE_PATTERNS, ACCOUNT_SURFACE_RE, baseName2, isAccountSurface, collectCustomConstraintMins, sitesIn, firstUsageIndex, pointersIn, dedupeSort, evidenceOf4, item18, policyNote, scanPasswordPolicy, SPEC, MAX_EVIDENCE25, AUTH_SURFACE_RE, ACCOUNT_EXISTENCE_RE, PASSWORD_ONLY_RE, COMBINED_RE, STRING_LITERAL_RE2, lineOf23, scanAuthFile, dedupeSort2, evidenceOf5, item19, scanAccountEnumeration, SPEC2, MAX_EVIDENCE26, LOGOUT_ENDPOINT_RE, LOGOUT_MENTION_RE, INVALIDATION_PATTERNS, lineOf24, invalidationHits, dedupeSort3, evidenceOf6, item20, scanLogoutInvalidation, SPEC3, MAX_EVIDENCE27, OTP_ISSUE_RE, OTP_MENTION_RE, THROTTLE_PATTERNS, lineOf25, firstMatch2, dedupeSort4, evidenceOf7, item21, scanOtpThrottle, MAX_EVIDENCE28, REST_TEMPLATE_CALL_RE, NEW_URL_RE, URL_TAIL_RE, URI_TAIL_RE, OPEN_CONNECTION_RE, SIGNALS, lineOf26, scanSsrfEndpointHints, SPEC4, MAX_EVIDENCE29, HARD_MUTATION_HANDLER_RE, DIRECT_WRITE_RE, DELEGATION_WRITE_RE, TXN_RE, READ_ONLY_TXN_RE, offsetOfLine2, insideLiteral, extractHandlerBody, braceMatchedBlock, signatureRegion, confirmWrite, dedupeSort5, evidenceOf8, item22, scanStateChangingGet, KEY_MANAGEMENT_SPEC, JAVA_FILE_RE2, CONFIG_FILE_RE2, EMPTY_SECRET_KEY_SPEC_RE, EMPTY_KEY_VAR_RE, scanEmptyEncryptionKeys, MFA_AUTH_SPEC, JAVA_FILE_RE3, CONFIG_FILE_RE3, AUTH_SURFACE_RE2, MFA_INDICATORS_RE, MFA_VERIFY_ENDPOINT_RE, SSO_INDICATORS_RE, isTestPath2, isNonSiteLine, scanMfaAuth, PASSWORD_EXPIRY_SPEC, JAVA_FILE_RE4, CONFIG_FILE_RE4, USER_DETAILS_RE, HARDCODED_CREDENTIALS_NON_EXPIRED_RE, ACTIVE_EXPIRY_CHECK_RE, isTestPath3, scanPasswordExpiryPolicy, SETTER_RE, HTTP_STATUS_RECEIVER, HTTP_STATUS_ARG, CONSTANT_ARG, ENUM_ARG, LOADS_EXISTING, ENTITY_DECL_RE, PRINCIPAL_RE, STATE_NOUN, escapeRegExp, stateReadBefore, hasSameReceiverStateReadBefore, hasCopySourceStateReadBefore, CONSTRUCTED_AS_RE, loadedTypesIn, receiverOriginOf, lineOf27, methodsOf, isJava2, isControllerPath, scanStateTransitionSites, MAX_EVIDENCE30, SEVERITY_ORDER2, SCORE_FLOOR, asRecord2, asString, stripMountPrefix, severityFromTags, field, parseScaReport, effectiveScore, passesThreshold, distinctPairs, bySeverityThenName, evidenceOf9, countBySeverity, provenance, foldScaReport, BRUTE_FORCE_SPEC, MAX_EVIDENCE31, lineOf28, AUTH_CONTEXT_RE, LIMIT_NAME_RE, MAX_VALUE_ASSIGN_RE, MECHANISM_PATTERNS, failOpenHits, mechanismHits, dedupeSort6, evidenceOf10, item23, scanBruteForceProtection, TS_LANGS, MOUNT_ROOT, MOUNT_ANY, TS_EXT_CANDIDATES, MAX_CHAIN_DEPTH, MAX_REEXPORT_DEPTH, UNRESOLVED_PATH, keyOf, applyRouteConfigOverrides, CLIENT_CLASSES, MANUAL_DELIVERY_SOURCES, ENC, ROUTE_BASE_PREFIX, BENIGN_PARAM, CLIENT_ORACLE, deliveryFor, jsStr, normFile, camel, urlChunk, buildGoto, manualComment, renderMethod, renderSpec, dedupeRoutes, generateClientVerificationSuite, buildClientVerificationManifest, WSTG, TC16, MANUAL_CHECKLIST_ITEMS, NEEDS_MANUAL_LIMITATION, buildManualChecklistItems, handoffFileName, MAX_SURFACE_SAMPLE, surfaceContext, INFRA_CONTEXT, buildHandoffPackets, OBJECT_STORE_PROBE_SINKS, GENERATED_PACKAGE, SERVER_CLASSES, BOOLEAN_BLIND_CLASSES, BOOLEAN_BLIND_PAIRS, CLASS_CANARY, COMMAND_CANARY, VALIDATION_REJECT_CLASSES2, CANON_HELPER, CLASS_ORACLE, javaStr, SSRF_BASELINE_WORKBOOK_ENTRIES, SSRF_BASELINE_WORKBOOK_HELPER, BENIGN_SEED, BUCKET_BENIGN_SEED, benignSeedFor, companionBenignSeed, renderAuthSuffix, RUNTIME_AUTH_SUFFIX, renderRuntimeAuthHelper, pascal, camel2, verificationTestClassName, identChunk, fillPath, companionCalls, ssrfPayloadPath, requestExpr, isVerifiable, SERVER_SKIP_REASON, renderBooleanBlind, renderCanary, isObjectStoreProbeSink, OBJECT_STORE_REJECT_CATCH_LINES, wrapObjectStoreAttackGuard, wrapObjectStoreEvidenceAttackGuard, resolveAuth, renderMethod2, renderEvidenceMethod, renderEvidenceHelpers, renderTestcontainersDbTierFields, renderExternalDbTierFields, javaSeedValue, renderSeedMethod, renderApiCreateSeedMethod, renderClass, toManifestEntries, generateVerificationSuite, buildVerificationManifest, decodeEntities, attr, stripCdata, childMessage, classify3, parseJUnitXml, simpleClassName, joinKey, DEFAULT_TRUST_TIER, resolveFromEnvelope, ingestVerification, PROVENANCE_DETAIL, applyProvenanceDowngrades, asRecord3, asString2, asBool, asInt, asHttpStatus, SIGNALS2, ATTESTATION_METHODS, parseProvenance, parseOracle, parseEffectBoundary, parseDefenseControl, parseBaseline, parseAttack, parseEvidenceEnvelope, asRecord4, asArray, asString3, asNumber, basename22, specOutcome, walkSuite, parsePlaywrightReport, joinKey2, ingestClientVerification, compareChecklistId, correlateVerification, EMPTY_CORRELATION, notTestedItem, groupDastByChecklist, dastAxisFor, groupClientByChecklist, clientAxisFor, correlateAssessment, ZAP_SCAN_RULES, DEFAULT_DAST_OPTIONS, DAST_PLAN_FILE, DAST_MANIFEST_FILE, DAST_PROBE_SCRIPT_FILE, DAST_API_SEED_SCRIPT_FILE, API_SEED_VAR_PREFIX, PROBE_VICTIM_BUCKET_REF, PROBE_CANARY_OBJECT_REF, PROBE_INJECTION_KINDS, isScannable, skipReason, yamlStr, normMethod, toTarget, SEED_VALUE, SSRF_SEED_VALUE, seedValue, pathInjectionSeed, computeApiSeedVars, allParams, queryString, requestPath, renderRequest, renderPlanYaml, generateDastPlan, buildProbeSpec, buildProbe, buildDastManifest, cmpStr3, compareScenarioRef, compareExecutionTarget, shq, PROBE_SCRIPT_PROLOGUE, PROBE_SCRIPT_EPILOGUE, renderDastProbeScript, shLiteral, API_SEED_PY, renderDastApiSeedScript, HTTP_EVIDENCE_MAX_HEADER_BYTES, HTTP_EVIDENCE_MAX_BODY_BYTES, REDACTION_WINDOW_BYTES, HTTP_REDACTED, SENSITIVE_HEADER_RE, NEVER_SENSITIVE_HEADER_RE, SCHEMED_HEADER_RE, COOKIE_HEADER_RE, COOKIE_ATTRIBUTE_RE, JSON_SECRET_MEMBER_RE, HEADER_LINE_RE, TOKEN_RUN_RE, redactJwtRun, redactJwts, URL_USERINFO_RE, redactInline, redactHeaderValue, redactHeaderBlock, redactBody, looksBinary, cutUtf8, boundedPart, sanitizeHttpMessage, httpStatusOf, RISK_BY_CODE, asString4, firstLine, httpEvidenceOf, parseZapReport, firstLineOf, usableTimestamp, latestMessageInstant, parseZapMessages, pathOf, stripTrailingSlash, pathMatches, methodMatches, injectionMatches, routeMatchesOrUnknown, alertMatchesTarget, queryHasParam, messageMatchesSurface, computeDastCoverage, detailOf, DAST_HTTP_EVIDENCE_MAX_RESOLUTIONS, carriesHttpText, evidenceOf11, ingestDast, SEMGREP_CWE_MAP, asRecord5, asString5, asNonNegativeInteger, compareText2, compareCwe, stringsFrom, cwesFromProperties, messageText, compareFinding, findingKey, ruleMetadata, metadataForResult, locationsOf, findingsFromRun, parseSemgrepSarif, compareChecklistId2, unmatchedKey, ingestSemgrep, CHECKLIST_ID3, CONTROL_ID3, MAX_EVIDENCE322, OWNER_SCOPED_FINDER, REPOSITORY_DECL, lineOf29, fieldNameFor, collectOwnerScopedRepositories, scanIdor, CHECKLIST_ID4, CONTROL_ID4, MAX_EVIDENCE33, CONTROLLER, MULTIPART_PARAM, ALLOWLIST, CONTENT_SNIFF, lineOf30, collectUploadHandlers, firstMatch3, scanUploadValidation, CHECKLIST_ID5, CONTROL_ID5, MAX_EVIDENCE34, SECRET_KEY_LINE, SELF_IDENTIFYING_KEYS, JWT_CONTEXT_RE, PARENT_KEY_LINE, ancestorPath, ENV_PLACEHOLDER2, NON_PROD_PROFILE, CONFIG_FILE, lineOf31, byFileLine2, collectSecrets, scanJwtSecret, DEVTOOLS_SPEC, BUILD_FILE_RE, auditPomXmlDevTools, auditGradleDevTools, auditBuildFile, scanDevTools, PASSWORD_AUTOCOMPLETE_SPEC, HTML_TEMPLATE_FILE_RE, SECURE_AUTOCOMPLETE_VALUES, isTestPath4, auditPasswordAutocompleteContent, scanPasswordAutocomplete, SYSTEM_INFO_LEAK_SPEC, JAVA_FILE_RE5, isTestPath5, PRINT_STACK_TRACE_RE, SYSTEM_PRINT_EXCEPTION_RE, auditJavaErrorDisclosure, scanSystemInfoLeak;
11606
+ var createCompositeParser, SUPPORTED, createTextParser, requireFromHere, grammarCache, parserInitialized, initParser, resolveGrammarPath, loadGrammar, LANGUAGE_TO_GRAMMAR, SUPPORTED2, createTreeSitterParser, asTreeSitterTree, SUPPORTED3, scriptKindFor, createTsMorphParser, createParser, TS_LANGUAGES, EXTENSIONS, TS_SOURCE_EXTENSIONS_BY_RUNTIME_EXT, scriptKindFor2, normalizeRelativePath, candidatePaths, normalizeConfigPath, stripJsonComments, loadTsConfigResolver, matchPathPattern, applyPathTarget, resolveAliasModule, resolveModule, aliasIfDifferent, exportedSymbols, expressionRootName, addSymbol, compareText, variableBindingNames, importEqualsSpecifier, extractSymbols, fingerprintFor, createTsAstDependencyGraphBuilder, isTsLike, debug, warn, tryLoad, trySave, createIncrementalAstGraphBuilder, SOURCES, SINKS, SANITIZERS, DEFAULT_TS_TAINT_TABLES, JAVA_SOURCES, JAVA_SINKS, JAVA_SANITIZERS, DEFAULT_JAVA_TAINT_TABLES, EMPTY_SUMMARY, paramSentinel, PARAM_SENTINEL_RE, MAX_CROSS_FILE_DEPTH, TYPE_DECL_NODES, indexCache, SCOPE_BOUNDARY, SCOPE_BOUNDARY2, TYPE_DECL, STRING_PASSTHROUGH, ARG_PASSTHROUGH, CONTAINER_ELEMENT, BUILDER_APPENDERS, COLLECTION_MUTATORS, RECEIVER_FOLD_MUTATORS, CONDITIONAL_CONSTRUCT, EMPTY_SUMMARY2, paramSentinel2, PARAM_SENTINEL_RE2, MAX_CROSS_METHOD_DEPTH, SANITIZE_CALL, BYPASS_CALL, PREFIX_GATE, MAX_VALUE_HOPS, SOURCE_PATTERNS, maskJavaComments, maskedCorpusCache, maskJavaFiles, MAPPING_ANNOTATIONS, PARAM_ANNOTATIONS, AUTHZ_ANNOTATIONS, VALIDATION_ANNOTATIONS, annotationScanner, TYPE_DECL2, MODIFIER, METHOD_NAME, LEADING_ANNOTATION, simpleName, lineOf, readBalanced, annotationArgs, firstStringLiteral, readMappingPath, readMappingMethod, joinPaths, skipToDeclaration, isTypeDeclaration, splitParams, parseParam, readAuthAnnotations, ROLE_ANNOTATIONS, stripRolePrefix, readAuthRoles, precedingBlock, readClassContext, extractFromFile, extractHttpEndpoints, findEnclosingEndpoint, SINK_ATTACKS, AI_TRIAGE_ATTACK_ALIASES, SOURCE_KIND, kindsFromSources, deriveAuthContext, resolveCompanionParams, resolveInjectionPoint, buildServerRequest, buildClientRequest, generateAttackScenario, UNASSESSED_CATALOG, BY_ID, buildUnassessedItems, INJECTION_LANGUAGES, TIER_A_INJECTION_ITEMS, CONFIRMED_LIMITATION, INCONCLUSIVE_LIMITATION, evidenceFrom, byFileLine, CHECKLIST_VERDICT_RANK, mergeEqualRank, dedupeByChecklistId, scenarioByFileLine, PENTEST_CHECKLIST_TOTAL, DECLARED_CHECKLIST_IDS, buildChecklistCoverage, buildCoverage, assembleAssessment, MAX_EVIDENCE3, REVIEW_SIGNAL_MAP, asJsonRecord, readReviewFinding, parseReviewReport, evidenceOf, sortEvidence, foldReviewSignals, MAX_EVIDENCE22, AUTHORIZATION_RISK_EVIDENCE, MASS_ASSIGNMENT_EVIDENCE, OWNERSHIP_SCOPE_EVIDENCE, STATE_TRANSITION_EVIDENCE, AI_SIGNAL_MAP, readPerRule, parseAiReviewReport, evidenceOf2, sortEvidence2, scopeClauseOf, provenanceOf, skipReasonOf, anchorResolves, anchorOf, unresolvableCitationClause, citationGateClause, citationTargetNoun, anchorAccepts, foldAiSignals, IMPORT_LINE_RE, isImportOrPackageLine, CSRF_SPEC, CORS_SPEC, HEADERS_SPEC, STACKTRACE_SPEC, MESSAGE_SPEC, COOKIE_SPEC, SESSION_FIXATION_SPEC, SESSION_TIMEOUT_SPEC, AUTH_CACHE_SPEC, lineOf2, SECURITY_CONFIG_RE, CSRF_DISABLE_RE, CORS_WILDCARD_RE, CROSS_ORIGIN_BARE_RE, ALLOW_CREDENTIALS_RE, CORS_EXPLICIT_ORIGIN_RE, CORS_ANY_RE, HEADERS_DISABLE_RES, HEADERS_CONFIGURED_RE, CSP_CONFIGURED_RE, STACKTRACE_EXPOSE_RE, STACKTRACE_NEVER_RE, MESSAGE_EXPOSE_RE, MESSAGE_NEVER_RE, COOKIE_CONTEXT_RE, COOKIE_INSECURE_CHECKS, COOKIE_HARDENED_RE, SESSION_FIXATION_DISABLED_RE, CACHE_CONTROL_DISABLE_RE, CACHE_CONTROL_CONFIGURED_RE, SESSION_TIMEOUT_PATH_RE, SESSION_BLOCK_HEADER_RE, SESSION_TIMEOUT_LEAF_RE, YAML_INDENT_RE, control, configEvidence, firstMatch, firstMatchAny, scanCsrf, CORS_ORIGINS_YAML_RE, CORS_CREDENTIALS_YAML_RE, isWildcardOrigins, corsConfigRank, corsOriginHits, scanCors, scanSecurityHeaders, NON_PROD_PROFILE_RE, scanStacktraceExposure, scanErrorMessageExposure, scanCookieAttributes, scanSessionFixation, scanAuthCacheControl, findSessionTimeout, timeoutNeverExpires, timeoutToMinutes, JWT_VALIDITY_RE, NON_PROD_CONFIG_RE, findJwtValidities, hoursOf, judgeJwtValidity, judgeServletTimeout, scanSessionTimeout, scanSecurityConfig, TEST_SOURCE_SET_RE, isTestSourcePath, WEAK_CRYPTO_SPEC, MAX_EVIDENCE32, lineOf3, classifyAlgorithm, GET_INSTANCE_RE, COMMONS_DIGEST_RE, GUAVA_HASHING_RE, SECRET_KEY_SPEC_RE, SHORTHAND_ALGO, collectWeakHits, STRONG_CRYPTO_RE, STRONG_CRYPTO_RE_G, firstStrong, evidence, item, scanWeakCrypto, REGEX_PRECEDING_KEYWORDS, isIdentChar, regexAllowedAt, maskJsComments, maskedCorpusCache2, maskJsFiles, BROWSER_STORAGE_SPEC, MAX_EVIDENCE4, lineOf4, HIGH_SENSITIVITY_RE, TOKEN_FAMILY_RE, classifyStorageKey, VALUE_TOKEN_FAMILY_RE, classifyStorageValue, keyToken, SET_ITEM_RE, BRACKET_ASSIGN_RE, STORAGE_USE_RE, IDB_CONTEXT_RE, LOCALFORAGE_SET_RE, IDB_STORE_WRITE_RE, collectStorageHits, collectIndexedDbHits, finalizeHits, firstStorageUse, evidence2, item2, scanSensitiveBrowserStorage, AT_REST_SPEC, MAX_EVIDENCE5, lineOf5, PWD_GETTER, PWD_EQUALS_RECEIVER_RE, PWD_EQUALS_ARG_RE, collectPasswordComparisonHits, SENSITIVE_FIELD_NAMES, FIELD_DECL_RE, FIELD_PROTECTED_RE, precedingBlock2, collectPlaintextFieldHits, finalizeHits2, PROTECTION_RE, firstProtection, AT_REST_SURFACE_RE, evidence3, item3, scanSensitiveDataAtRest, PADDING_ORACLE_SPEC, MAX_EVIDENCE6, lineOf6, GET_INSTANCE_RE2, collectCbcHits, BAD_PADDING_CATCH_RE, collectBadPaddingHits, finalizeHits3, AEAD_RE, firstAead, CIPHER_SURFACE_RE, evidence4, item4, scanPaddingOracle, LOGGING_SPEC, MAX_EVIDENCE7, lineOf7, JAVA_LOG_CALL_RE, JAVA_CONSOLE_CALL_RE, JS_CONSOLE_CALL_RE, LOG_SURFACE_RE, stripStringLiterals, SECRET_RE, PII_RE, PROTECTED_TAIL_RE, findSensitiveToken, collectSensitiveContainers, findSensitiveArgument, findSensitiveOutput, firstLogSurface, evidence5, item5, scanSensitiveLogging, CHECKLIST_ID, CONTROL_ID, TITLE, CWE, MAX_EVIDENCE8, ADMIN_PATH_RE, ADMIN_CONTROLLER_RE, isAdminEndpoint, ADMIN_ROLE_RE, ROLE_CAPABLE_AUTHZ, ROLE_ANNOTATION_RE, SEC_CONFIG_HINT_RE, MATCHER_RE, ACCESS_AFTER_RE, ANY_REQUEST_RE, offsetOfLine, readBalanced2, stringLiterals, antMatches, hasAdminRoleAnnotation, classHeaderOf, memberWindow, annotationStance, accessKind, collectFilterConfig, filterStanceFor, combineProtection, publicNote, item6, auditAdminSurface, CLOUD_ACL_SPEC, MAX_EVIDENCE9, lineOf8, PUBLIC_ACL_PATTERNS, finalizeHits4, collectCannedAclHits, EFFECT_ALLOW_RE, WILDCARD_PRINCIPAL_RE, S3_ACTION_RE, enclosingObject, collectBucketPolicyHits, evidence6, item7, scanCloudStorageAcl, ACTUATOR_SPEC, MAX_EVIDENCE10, CONFIG_FILE_RE, SENSITIVE_ACTUATOR_ENDPOINTS, lineOf9, indentOf, isBlankOrComment, splitEndpoints, classifyExposure, exposureNote, H2_NOTE, findChildKey, collectListItems, collectExposureHits, collectH2Hits, finalizeHits5, evidence7, item8, scanActuatorExposure, BACKUP_FILE_SPEC, BACKUP_FILE_GLOBS, BACKUP_FILE_RE, SENSITIVE_BASE_RE, MAX_EVIDENCE11, stripBackupSuffix, classify2, evidence8, scanBackupFiles, CROSSDOMAIN_SPEC, CROSSDOMAIN_GLOBS, MAX_EVIDENCE12, lineOf10, PERMISSIVE_PATTERNS, collectHits, evidence9, scanCrossDomainPolicy, CLIENT_INFO_SPEC, ANGULAR_CONFIG_GLOBS, MAX_EVIDENCE13, lineOf11, asRecord, sourceMapEnabled, buildConfigurations, scanConfigFile, evidence10, item9, scanClientInfoLeak, SENSITIVE_FILE_SPEC, SENSITIVE_FILE_GLOBS, SENSITIVE_FILE_RE, PEM_TEXT_RE, PRIVATE_KEY_HEADER_RE, MAX_EVIDENCE14, classify22, evidence11, scanSensitiveFiles, INSECURE_TRANSPORT_SPEC, ENVIRONMENT_FILE_RE, MAX_EVIDENCE15, lineOf12, extractStringLiterals, HTTP_URL_RE, HTTPS_PRESENCE_RE, isExcludedHost, TEMPLATE_FILE_RE, scanInsecureFormSubmission, isTestPath, scanExternalCleartextLinks, JAVA_FILE_RE, CLEARTEXT_JAVA_CLIENT_RE, scanJavaCleartextClients, scanInsecureTransport, WEBSOCKET_SPEC, MAX_EVIDENCE16, WS_URL_RE, WSS_PRESENCE_RE, scanWebSocketSecurity, authFillKey, createStubAuthFillResolver, buildAuthFillMap, ALG_TO_HASH, SIGNING_KEY_LINE, ENV_PLACEHOLDER, lineOf13, cleanValue, discoverJwtSigningKeys, b64url, b64urlStr, signingKeyBytes, mintJwt, DEFAULT_JHIPSTER_CLAIMS, RECIPE_NOTE, DECODE_ONLY_NOTE, jarKeysToSigningKeys, sha256Hex, buildRuntimeAuthRecipe, mintTokenFromRecipe, DEFAULT_TTL_SECONDS, commandsFor, credentialFor, runtimeAuthSeedDeviation, runtimeAuthSeedDecodeOnlyDeviation, planFor, buildRuntimeAuthSeedPlan, DEFAULT_TIMEOUT_MS, CRLF, encodeResp, identify, readReply, applyRuntimeAuthSeed, describeShape, resolveRuntimeAuthHypothesis, THREW, createStubRuntimeAuthHypothesisResolver, dataSeedKey, describeShape2, THREW2, resolveRuntimeDataSeedHypothesis, createStubRuntimeDataSeedResolver, buildDataSeedPlan, buildApiCreateSeedPlan, dataSeedEndpointSummaries, IDEMPOTENT_INSERT, BACKSLASH_IS_ESCAPE, escapeSqlString, sqlLiteral, assertIdentifier, renderDataSeedSql, SEED_AUDIT_SENTINEL, AUDIT_FIELD_RE, CLASS_DECL_RE, TABLE_RE, EXTENDS_RE, NULLABLE_FALSE_RE, LENGTH_RE, stripJavaComments, group, detectSeedAuditColumns, applySeedAuditColumns, seedAuditAddedColumns, OBJECT_SEED_BASELINE_KEY, OBJECT_SEED_BASELINE_CONTENT_BASE64, PENTEST_CANARY_BUCKET, MAX_DERIVED_TARGETS, MAX_DERIVED_EVIDENCE, CONFIG_PATH_RE, BUCKET_KEY_RE, LINE_RE, PLACEHOLDER_RE, ENC_PREFIX_RE, BOOLEAN_VALUE_RE, HAS_LOWERCASE_RE, canonicalKey, cleanValue2, resolveValue, referencesToken, deriveObjectStoreSeedTargets, renderObjectStoreSeedTsv, REACHABILITY_MANIFEST_SCHEMA_VERSION, MANIFEST_NOTE, SCALAR_JAVA_TYPES, baseTypeName, seedForParam, METHOD_INTENT, buildHint, buildReachabilityManifest, norm, dirOf, baseName, isMavenPom, isGradleBuild, stripXmlComments, isAncestorDir, normModulePath, selectRunnableModule, PACKAGE_DECL, BOOT_CLASS, posix22, detectSpringBootClass, BASE_CONFIG_RE, PROFILE_CONFIG_RE, HARNESS_PORT, KEY_LINE_RE, yamlEntries, emptyKeys, isConfigYaml, profileRank, declaresDatasource, detectDatasourceProfileBlocker, detectProfileCompositionBlocker, detectServerPortBlocker, XML_COMMENT_RE, INCLUDE_RE, CREATE_TABLE_RE, ALTER_TARGET_RE, matchAllGroups, detectUnrunnableMigrationBlocker, detectPolicyBootBlockers, composeSuggested, BINDABLE_NAME_RE, YAML_KEY_RE, PROPS_KEY_RE, configValueOf, rawTokensOf, MARK, AUTHORITY_LIKE_RE, shapeInAuthority, nextOf, shapeInPath, shapeAt, parseConfigValue, renderTemplate, DIALECT_SPECS, JDBC_URL_PATTERNS, DRIVER_PATTERNS, isConfigFile, isBuildFile, dialectsMatching, resolveDialect, DDL_AUTO_CREATE_RE, FLYWAY_RE, LIQUIBASE_RE, resolveSchemaProvisioning, detectSchemaProvisioning, detectDbTier, DB_SIDECAR_PORT, DISPOSABLE_DB, dbSidecarEnv, buildDbSidecarSpec, PROFILE_GATED_JAR_BEANS, JHIPSTER_PROFILE_CONSTANTS, isJava, CLASS_DECL_RE2, PROFILE_ANNOTATION_RE, CONDITIONAL_ANNOTATION_RE, CONFIG_ANNOTATION_RE, readProfileAnnotation, declarationHead, braceMatch, lineAt, parsedClasses, simpleTypeName2, parseParams, beanMethods, collectProducers, detectUngatedProfileDependencies, ungatedProfileDeviationText, STANDALONE_BOOT_PROFILE, ENTITY_SCHEMA_GAPS, NOTE, isConfigFile2, leafKey, indentOf2, fullPathFor, usesJpa, KAFKA_BUILD_RE, KAFKA_CONFIG_RE, STREAM_BUILD_RE, STREAM_CONFIG_RE, declaresKafka, declaresStreamBinder, hasPinnedListenerAutoStartup, ENDPOINT_PROPERTY_RULES, ENDPOINT_VALUE_RE, CLUSTER_TOPOLOGY_RULES, literalDatabaseOf, resolveSchemaResolution, buildStandaloneBootProfile, runtimeEnvKeyFor, A_SENTINEL, ENC_SENTINEL, isEndpointShaped, isEndpointPropertyPath, hasToken, dummyFor, RELAXED_ENV, envKeyFor, buildSidecars, renderSidecar, identifyByName, PATH_KINDS, PATH_LEAF_ROLES, identifyByPath, roleFromShape, shapedDummy, resolveSlot, resolvePlaceholder, encSentinelFor, SHAPE_PRECEDENCE, strongerShape, buildBootResolution, CONFIG_ENTRY_RE, SKIPPED_ENTRY_RE, XML_COMMENT_RE2, SYSTEM_PATH_RE, declaredSystemJarEntries, declaredSystemJarPaths, readCentralDirectory, readEntryBytes, readEntryText, languageFor, detectMissingSystemJars, readJarConfigFiles, listJarClassNames, MIN_CONSTANT_LEN, MAX_CONSTANT_LEN, MAX_CONSTANTS_PER_CLASS, NOISE_CONSTANT_RE, parseClassConstants, constantRank, readJarClassConstants, collectDependencyClassConstants, collectDependencyClassNames, collectDependencyConfigFiles, JWT_CONTEXT_MARKER_RE, BASE64_SHAPE_RE, MIN_BASE64_KEY_CHARS, MAX_BASE64_KEY_CHARS, decodedByteLength, readJarJwtKeyCandidates, collectJwtKeyCandidates, JWT_FACADE_RE, JWT_DECODE_CALL_RE, JWT_VERIFY_MARKER_RE, readJarDecodeOnlyEvidence, collectDecodeOnlyEvidence, EOCD_SIGNATURE, CENTRAL_SIGNATURE, EOCD_SEARCH_WINDOW, MAX_COMPRESSION_RATIO, MAX_UNCOMPRESSED_BYTES, MAX_ENTRIES, fail, isUnsafeName, readArchive, readArchiveEntryText, SOURCE_EXTENSIONS, extensionOf, baseNameOf, XML_COMMENT_RE3, isAggregatorPom, declaresParentPath, declaresSystemPaths, resolveAgainst, preflightArchive, SKIP_DIRS, SECRET_FILE_EXACT, SECRET_EXTENSIONS, isSecretOrIgnoredFile, MAX_FILE_BYTES, MAX_PARENT_DEPTH, toPosix2, isFile, walk, XML_COMMENT_RE4, RELATIVE_PATH_RE, SYSTEM_PATH_RE2, PARENT_BLOCK_RE, EMPTY_RELATIVE_PATH_RE, readPom, expandBasedir, planServicePackage, CRC_TABLE, crc32, writePackageZip, SIDECAR_IMAGES, HARNESS_PLAN_SCHEMA_VERSION, isConfigFile3, isBuildFile2, stripComments, SERVICE_DEPS, detectDatabaseDependency, detectServiceDependencies, detectHarnessDependencies, AUTO_CONFIGURED_LISTENER_FACTORY, KAFKA_LISTENER_ARGS_RE, LISTENER_PIN_RE, LISTENER_FACTORY_RE, SELF_OFF_FACTORY_BEAN_RE, SET_AUTO_STARTUP_FALSE_RE, classifyKafkaBootPath, buildHarnessPlan, applyKafkaBrokerCoherence, RUNTIME_PLAN_SCHEMA_VERSION, PLAN_NOTE, describeSidecar, buildSteps, buildRuntimeBringUpPlan, RUNTIME_OVERLAY_FILE, RUNTIME_COMPOSE_FILE, RUNTIME_GUIDE_FILE, RUNTIME_BOOT_ENV_FILE, SIDECAR_IMAGE, REDIS_CLUSTER_COMMAND, renderNestedYaml, renderOverlay, publishLine, renderCompose, renderGuide, renderBootEnv, generateRuntimeArtifacts, SUBMISSION_REQUIREMENTS_SCHEMA_VERSION, MAX_EVIDENCE17, NOTE2, capEvidence, totalSuffix, blockerEvidence, groupBy, packagingRequirements, secretRequirements, POLICY_KINDS, policyRequirements, infrastructureRequirements, authRequirements, seedRequirements, TIER_ORDER, buildSubmissionRequirements, renderSubmissionRequirements, REJECT_SIDECAR, applyRuntimeInput, DESER_SPEC, MAX_EVIDENCE18, lineOf14, UNSAFE_PATTERNS, collectHits2, SAFE_VALIDATOR_RE, firstSafeValidator, evidence12, item10, scanUnsafeDeserialization, WEAK_RANDOM_SPEC, MAX_EVIDENCE19, lineOf15, WEAK_RNG_PATTERNS, SECURITY_ID_RE, statementAround, COOKIE_SINK_MAX_HOPS, namesCarrying, reachesCookie, collectHits3, SECURE_RANDOM_RE, firstSecureRandom, evidence13, item11, scanWeakSecureRandom, POSTMESSAGE_SPEC, MAX_EVIDENCE20, lineOf16, WINDOW_LISTENER_PATTERNS, ORIGIN_RE, isFrontend, listenersIn, evidence14, item12, scanPostMessageOrigin, XXE_SPEC, MAX_EVIDENCE21, lineOf17, XML_PARSER_PATTERNS, HARDENING_RE, parsersIn, evidence15, item13, scanXxe, WEAK_TLS_SPEC, MAX_EVIDENCE222, lineOf18, BYPASS_PATTERNS, TLS_SURFACE_RE, bypassesIn, evidence16, item14, scanWeakTls, DOCKERFILE_SPEC, DOCKERFILE_RE, DOCKERFILE_GLOBS, isLoopback, auditDockerfileDependencyConfusion, auditDockerfileContent, scanDockerfile, HOST_HEADER_SPEC, MAX_EVIDENCE23, lineOf20, HOST_PATTERNS, collectHits5, evidence18, item16, scanHostHeader, CHECKLIST_ID2, CONTROL_ID2, TITLE2, evidenceOf3, item17, VALUE_ANNOTATION_RE, FIELD_AFTER_VALUE_RE, LIFETIME_TOKEN_RE, tokenize, hasOtpToken, TIME_UNIT_RE, NAME_UNIT_HINTS, TO_SECONDS, lineOf21, isOtpLifetimeName, configRank, inconclusive, scanOtpPolicy, PASSWORD_POLICY_SPEC, MAX_EVIDENCE24, lineOf22, precedingBlock3, PASSWORD_NAME_RE, NOT_A_SECRET_RE, isPasswordName, STRING_DECL_RE, SIZE_MIN_RE, ANNOTATION_IN_BLOCK_RE, LENGTH_CHECK_RE, CONSTRAINT_VALIDATOR_RE, ANNOTATION_DECL_RE, STRING_LITERAL_RE, QUANT_MIN_RE, POLICY_SURFACE_PATTERNS, ACCOUNT_SURFACE_RE, baseName2, isAccountSurface, collectCustomConstraintMins, sitesIn, firstUsageIndex, pointersIn, dedupeSort, evidenceOf4, item18, policyNote, scanPasswordPolicy, SPEC, MAX_EVIDENCE25, AUTH_SURFACE_RE, ACCOUNT_EXISTENCE_RE, PASSWORD_ONLY_RE, COMBINED_RE, STRING_LITERAL_RE2, lineOf23, scanAuthFile, dedupeSort2, evidenceOf5, item19, scanAccountEnumeration, SPEC2, MAX_EVIDENCE26, LOGOUT_ENDPOINT_RE, LOGOUT_MENTION_RE, INVALIDATION_PATTERNS, lineOf24, invalidationHits, dedupeSort3, evidenceOf6, item20, scanLogoutInvalidation, SPEC3, MAX_EVIDENCE27, OTP_ISSUE_RE, OTP_MENTION_RE, THROTTLE_PATTERNS, lineOf25, firstMatch2, dedupeSort4, evidenceOf7, item21, scanOtpThrottle, MAX_EVIDENCE28, REST_TEMPLATE_CALL_RE, NEW_URL_RE, URL_TAIL_RE, URI_TAIL_RE, OPEN_CONNECTION_RE, SIGNALS, lineOf26, scanSsrfEndpointHints, SPEC4, MAX_EVIDENCE29, HARD_MUTATION_HANDLER_RE, DIRECT_WRITE_RE, DELEGATION_WRITE_RE, TXN_RE, READ_ONLY_TXN_RE, offsetOfLine2, insideLiteral, extractHandlerBody, braceMatchedBlock, signatureRegion, confirmWrite, dedupeSort5, evidenceOf8, item22, scanStateChangingGet, KEY_MANAGEMENT_SPEC, JAVA_FILE_RE2, CONFIG_FILE_RE2, EMPTY_SECRET_KEY_SPEC_RE, EMPTY_KEY_VAR_RE, scanEmptyEncryptionKeys, MFA_AUTH_SPEC, JAVA_FILE_RE3, CONFIG_FILE_RE3, AUTH_SURFACE_RE2, MFA_INDICATORS_RE, MFA_VERIFY_ENDPOINT_RE, SSO_INDICATORS_RE, isTestPath2, isNonSiteLine, scanMfaAuth, PASSWORD_EXPIRY_SPEC, JAVA_FILE_RE4, CONFIG_FILE_RE4, USER_DETAILS_RE, HARDCODED_CREDENTIALS_NON_EXPIRED_RE, ACTIVE_EXPIRY_CHECK_RE, isTestPath3, scanPasswordExpiryPolicy, SETTER_RE, HTTP_STATUS_RECEIVER, HTTP_STATUS_ARG, CONSTANT_ARG, ENUM_ARG, LOADS_EXISTING, ENTITY_DECL_RE, PRINCIPAL_RE, STATE_NOUN, escapeRegExp, stateReadBefore, hasSameReceiverStateReadBefore, hasCopySourceStateReadBefore, CONSTRUCTED_AS_RE, loadedTypesIn, receiverOriginOf, lineOf27, methodsOf, isJava2, isControllerPath, scanStateTransitionSites, MAX_EVIDENCE30, SEVERITY_ORDER2, SCORE_FLOOR, asRecord2, asString, stripMountPrefix, severityFromTags, field, parseScaReport, effectiveScore, passesThreshold, distinctPairs, bySeverityThenName, evidenceOf9, countBySeverity, provenance, foldScaReport, BRUTE_FORCE_SPEC, MAX_EVIDENCE31, lineOf28, AUTH_CONTEXT_RE, LIMIT_NAME_RE, MAX_VALUE_ASSIGN_RE, MECHANISM_PATTERNS, failOpenHits, mechanismHits, dedupeSort6, evidenceOf10, item23, scanBruteForceProtection, TS_LANGS, MOUNT_ROOT, MOUNT_ANY, TS_EXT_CANDIDATES, MAX_CHAIN_DEPTH, MAX_REEXPORT_DEPTH, UNRESOLVED_PATH, keyOf, applyRouteConfigOverrides, CLIENT_CLASSES, MANUAL_DELIVERY_SOURCES, ENC, ROUTE_BASE_PREFIX, BENIGN_PARAM, CLIENT_ORACLE, deliveryFor, jsStr, normFile, camel, urlChunk, buildGoto, manualComment, renderMethod, renderSpec, dedupeRoutes, generateClientVerificationSuite, buildClientVerificationManifest, WSTG, TC16, MANUAL_CHECKLIST_ITEMS, NEEDS_MANUAL_LIMITATION, buildManualChecklistItems, handoffFileName, MAX_SURFACE_SAMPLE, surfaceContext, INFRA_CONTEXT, buildHandoffPackets, OBJECT_STORE_PROBE_SINKS, GENERATED_PACKAGE, SERVER_CLASSES, BOOLEAN_BLIND_CLASSES, BOOLEAN_BLIND_PAIRS, CLASS_CANARY, COMMAND_CANARY, VALIDATION_REJECT_CLASSES2, CANON_HELPER, CLASS_ORACLE, javaStr, SSRF_BASELINE_WORKBOOK_ENTRIES, SSRF_BASELINE_WORKBOOK_HELPER, BENIGN_SEED, BUCKET_BENIGN_SEED, benignSeedFor, companionBenignSeed, renderAuthSuffix, RUNTIME_AUTH_SUFFIX, renderRuntimeAuthHelper, pascal, camel2, verificationTestClassName, identChunk, fillPath, companionCalls, ssrfPayloadPath, requestExpr, isVerifiable, SERVER_SKIP_REASON, renderBooleanBlind, renderCanary, isObjectStoreProbeSink, OBJECT_STORE_REJECT_CATCH_LINES, wrapObjectStoreAttackGuard, wrapObjectStoreEvidenceAttackGuard, resolveAuth, renderMethod2, renderEvidenceMethod, renderEvidenceHelpers, renderTestcontainersDbTierFields, renderExternalDbTierFields, javaSeedValue, renderSeedMethod, renderApiCreateSeedMethod, renderClass, toManifestEntries, generateVerificationSuite, buildVerificationManifest, decodeEntities, attr, stripCdata, childMessage, classify3, parseJUnitXml, simpleClassName, joinKey, DEFAULT_TRUST_TIER, resolveFromEnvelope, ingestVerification, PROVENANCE_DETAIL, applyProvenanceDowngrades, asRecord3, asString2, asBool, asInt, asHttpStatus, SIGNALS2, ATTESTATION_METHODS, parseProvenance, parseOracle, parseEffectBoundary, parseDefenseControl, parseBaseline, parseAttack, parseEvidenceEnvelope, asRecord4, asArray, asString3, asNumber, basename3, specOutcome, walkSuite, parsePlaywrightReport, joinKey2, ingestClientVerification, compareChecklistId, correlateVerification, EMPTY_CORRELATION, notTestedItem, groupDastByChecklist, dastAxisFor, groupClientByChecklist, clientAxisFor, correlateAssessment, ZAP_SCAN_RULES, DEFAULT_DAST_OPTIONS, DAST_PLAN_FILE, DAST_MANIFEST_FILE, DAST_PROBE_SCRIPT_FILE, DAST_API_SEED_SCRIPT_FILE, API_SEED_VAR_PREFIX, PROBE_VICTIM_BUCKET_REF, PROBE_CANARY_OBJECT_REF, PROBE_INJECTION_KINDS, isScannable, skipReason, yamlStr, normMethod, toTarget, SEED_VALUE, SSRF_SEED_VALUE, seedValue, pathInjectionSeed, computeApiSeedVars, allParams, queryString, requestPath, renderRequest, renderPlanYaml, generateDastPlan, buildProbeSpec, buildProbe, buildDastManifest, cmpStr3, compareScenarioRef, compareExecutionTarget, shq, PROBE_SCRIPT_PROLOGUE, PROBE_SCRIPT_EPILOGUE, renderDastProbeScript, shLiteral, API_SEED_PY, renderDastApiSeedScript, HTTP_EVIDENCE_MAX_HEADER_BYTES, HTTP_EVIDENCE_MAX_BODY_BYTES, REDACTION_WINDOW_BYTES, HTTP_REDACTED, SENSITIVE_HEADER_RE, NEVER_SENSITIVE_HEADER_RE, SCHEMED_HEADER_RE, COOKIE_HEADER_RE, COOKIE_ATTRIBUTE_RE, JSON_SECRET_MEMBER_RE, HEADER_LINE_RE, TOKEN_RUN_RE, redactJwtRun, redactJwts, URL_USERINFO_RE, redactInline, redactHeaderValue, redactHeaderBlock, redactBody, looksBinary, cutUtf8, boundedPart, sanitizeHttpMessage, httpStatusOf, RISK_BY_CODE, asString4, firstLine, httpEvidenceOf, parseZapReport, firstLineOf, usableTimestamp, latestMessageInstant, parseZapMessages, pathOf, stripTrailingSlash, pathMatches, methodMatches, injectionMatches, routeMatchesOrUnknown, alertMatchesTarget, queryHasParam, messageMatchesSurface, computeDastCoverage, detailOf, DAST_HTTP_EVIDENCE_MAX_RESOLUTIONS, carriesHttpText, evidenceOf11, ingestDast, SEMGREP_CWE_MAP, asRecord5, asString5, asNonNegativeInteger, compareText2, compareCwe, stringsFrom, cwesFromProperties, messageText, compareFinding, findingKey, ruleMetadata, metadataForResult, locationsOf, findingsFromRun, parseSemgrepSarif, compareChecklistId2, unmatchedKey, ingestSemgrep, CHECKLIST_ID3, CONTROL_ID3, MAX_EVIDENCE322, OWNER_SCOPED_FINDER, REPOSITORY_DECL, lineOf29, fieldNameFor, collectOwnerScopedRepositories, scanIdor, CHECKLIST_ID4, CONTROL_ID4, MAX_EVIDENCE33, CONTROLLER, MULTIPART_PARAM, ALLOWLIST, CONTENT_SNIFF, lineOf30, collectUploadHandlers, firstMatch3, scanUploadValidation, CHECKLIST_ID5, CONTROL_ID5, MAX_EVIDENCE34, SECRET_KEY_LINE, SELF_IDENTIFYING_KEYS, JWT_CONTEXT_RE, PARENT_KEY_LINE, ancestorPath, ENV_PLACEHOLDER2, NON_PROD_PROFILE, CONFIG_FILE, lineOf31, byFileLine2, collectSecrets, scanJwtSecret, DEVTOOLS_SPEC, BUILD_FILE_RE, auditPomXmlDevTools, auditGradleDevTools, auditBuildFile, scanDevTools, PASSWORD_AUTOCOMPLETE_SPEC, HTML_TEMPLATE_FILE_RE, SECURE_AUTOCOMPLETE_VALUES, isTestPath4, auditPasswordAutocompleteContent, scanPasswordAutocomplete, SYSTEM_INFO_LEAK_SPEC, JAVA_FILE_RE5, isTestPath5, PRINT_STACK_TRACE_RE, SYSTEM_PRINT_EXCEPTION_RE, auditJavaErrorDisclosure, scanSystemInfoLeak;
11607
11607
  var init_dist5 = __esm({
11608
11608
  "../parsers/dist/index.js"() {
11609
11609
  init_dist();
@@ -21356,8 +21356,43 @@ ${edgePart}`);
21356
21356
  ".idea",
21357
21357
  ".vscode",
21358
21358
  ".settings",
21359
- "deploy-logs"
21359
+ "deploy-logs",
21360
+ ".code-sentinel"
21360
21361
  ]);
21362
+ SECRET_FILE_EXACT = /* @__PURE__ */ new Set([
21363
+ ".npmrc",
21364
+ ".yarnrc",
21365
+ ".netrc",
21366
+ ".pypirc",
21367
+ ".ds_store",
21368
+ "thumbs.db",
21369
+ "id_rsa",
21370
+ "id_dsa",
21371
+ "id_ecdsa",
21372
+ "id_ed25519"
21373
+ ]);
21374
+ SECRET_EXTENSIONS = [
21375
+ ".pem",
21376
+ ".key",
21377
+ ".pfx",
21378
+ ".p12",
21379
+ ".pkcs12",
21380
+ ".keystore",
21381
+ ".jks"
21382
+ ];
21383
+ isSecretOrIgnoredFile = (fileName2) => {
21384
+ const lower2 = fileName2.toLowerCase();
21385
+ if (lower2 === ".env" || lower2.startsWith(".env.") || lower2.startsWith(".env_")) return true;
21386
+ if (SECRET_FILE_EXACT.has(lower2)) return true;
21387
+ if (lower2.startsWith("id_rsa") || lower2.startsWith("id_dsa") || lower2.startsWith("id_ecdsa") || lower2.startsWith("id_ed25519")) {
21388
+ return true;
21389
+ }
21390
+ if (lower2.startsWith(".code-sentinel.local.")) return true;
21391
+ for (const ext of SECRET_EXTENSIONS) {
21392
+ if (lower2.endsWith(ext)) return true;
21393
+ }
21394
+ return false;
21395
+ };
21361
21396
  MAX_FILE_BYTES = 32 * 1024 * 1024;
21362
21397
  MAX_PARENT_DEPTH = 8;
21363
21398
  toPosix2 = (p) => p.split(sep).join(posix.sep);
@@ -21381,6 +21416,7 @@ ${edgePart}`);
21381
21416
  if (SKIP_DIRS.has(item24.name)) continue;
21382
21417
  walk(full, repoRoot, out);
21383
21418
  } else if (item24.isFile()) {
21419
+ if (isSecretOrIgnoredFile(item24.name)) continue;
21384
21420
  try {
21385
21421
  if (statSync(full).size > MAX_FILE_BYTES) continue;
21386
21422
  } catch {
@@ -21412,6 +21448,7 @@ ${edgePart}`);
21412
21448
  const add = (absolutePath) => {
21413
21449
  const name = toPosix2(relative(root, absolutePath));
21414
21450
  if (name.startsWith("..") || seen.has(name)) return;
21451
+ if (isSecretOrIgnoredFile(basename(absolutePath))) return;
21415
21452
  seen.add(name);
21416
21453
  entries.push({ name, absolutePath });
21417
21454
  };
@@ -27450,7 +27487,7 @@ ${runtimeAuthHelper}` : ""}
27450
27487
  asArray = (v) => Array.isArray(v) ? v : [];
27451
27488
  asString3 = (v) => typeof v === "string" ? v : void 0;
27452
27489
  asNumber = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
27453
- basename22 = (p) => p.replace(/\\/g, "/").split("/").pop() ?? p;
27490
+ basename3 = (p) => p.replace(/\\/g, "/").split("/").pop() ?? p;
27454
27491
  specOutcome = (spec) => {
27455
27492
  let last = null;
27456
27493
  for (const testU of asArray(spec.tests)) {
@@ -27484,7 +27521,7 @@ ${runtimeAuthHelper}` : ""}
27484
27521
  const specFile = asString3(spec.file) ?? suiteFile;
27485
27522
  const { outcome, message, durationMs } = specOutcome(spec);
27486
27523
  out.push({
27487
- file: basename22(specFile),
27524
+ file: basename3(specFile),
27488
27525
  testName,
27489
27526
  outcome,
27490
27527
  ...message !== void 0 ? { message } : {},
@@ -27512,7 +27549,7 @@ ${runtimeAuthHelper}` : ""}
27512
27549
  }
27513
27550
  return out;
27514
27551
  };
27515
- joinKey2 = (file, testName) => `${basename22(file)}::${testName}`;
27552
+ joinKey2 = (file, testName) => `${basename3(file)}::${testName}`;
27516
27553
  ingestClientVerification = (manifest, cases) => {
27517
27554
  const byKey = /* @__PURE__ */ new Map();
27518
27555
  for (const c of cases) {
@@ -29819,19 +29856,25 @@ async function evaluateSliceWithAi(options) {
29819
29856
  const result = await complete(prompt);
29820
29857
  if (!result.ok) {
29821
29858
  logger?.warn(`ai-triage executor: provider call FAILED \u2014 ${result.error.message}`);
29822
- return { vulnerable: false, reason: `L\u1ED7i LLM: ${result.error.message}` };
29859
+ return { status: "error", vulnerable: false, reason: `L\u1ED7i LLM: ${result.error.message}` };
29823
29860
  }
29824
29861
  const text2 = result.value.text.trim();
29825
29862
  if (text2.length === 0) {
29826
- return { vulnerable: false, reason: "LLM tr\u1EA3 v\u1EC1 ph\u1EA3n h\u1ED3i r\u1ED7ng" };
29863
+ return { status: "error", vulnerable: false, reason: "LLM tr\u1EA3 v\u1EC1 ph\u1EA3n h\u1ED3i r\u1ED7ng" };
29827
29864
  }
29828
29865
  const parsed = parse2(text2);
29829
29866
  if (parsed === null) {
29830
- return { vulnerable: false, reason: "Kh\xF4ng ph\xE2n t\xEDch \u0111\u01B0\u1EE3c JSON t\u1EEB ph\u1EA3n h\u1ED3i c\u1EE7a LLM" };
29867
+ return {
29868
+ status: "error",
29869
+ vulnerable: false,
29870
+ reason: "Kh\xF4ng ph\xE2n t\xEDch \u0111\u01B0\u1EE3c JSON t\u1EEB ph\u1EA3n h\u1ED3i c\u1EE7a LLM"
29871
+ };
29831
29872
  }
29873
+ const isVulnerable = Boolean(parsed.vulnerable);
29832
29874
  const endpoint = parseEndpointHint(parsed.endpoint);
29833
29875
  const initial = {
29834
- vulnerable: Boolean(parsed.vulnerable),
29876
+ status: isVulnerable ? "vulnerable" : "safe",
29877
+ vulnerable: isVulnerable,
29835
29878
  reason: String(parsed.reason ?? ""),
29836
29879
  ...endpoint !== void 0 ? { endpoint } : {}
29837
29880
  };
@@ -29860,7 +29903,7 @@ Language guard retry: the previous response contained an empty or English explan
29860
29903
  } catch (err9) {
29861
29904
  const message = err9 instanceof Error ? err9.message : String(err9);
29862
29905
  logger?.warn(`ai-triage executor: provider call THREW \u2014 ${message}`);
29863
- return { vulnerable: false, reason: `L\u1ED7i th\u1EF1c thi LLM: ${message}` };
29906
+ return { status: "error", vulnerable: false, reason: `L\u1ED7i th\u1EF1c thi LLM: ${message}` };
29864
29907
  }
29865
29908
  }
29866
29909
  var OLLAMA_DEFAULT_BASE, NETMIND_DEFAULT_BASE, OPENCODE_GO_DEFAULT_BASE, stripTrailingSlash2, buildLanguageModel, resolveModelOverride, pingTarget, shouldUseRawJsonChat, openAICompatibleChatUrl, REASONING_HEADROOM_TOKENS, NETMIND_MINIMAX_M3_MODEL, NETMIND_SMALL_PROMPT_MAX_CHARS, NETMIND_MEDIUM_PROMPT_MAX_CHARS, NETMIND_SMALL_OUTPUT_TOKENS, NETMIND_MEDIUM_OUTPUT_TOKENS, NETMIND_LARGE_OUTPUT_TOKENS, NETMIND_MAX_OUTPUT_TOKENS, supportsNetmindJsonResponseFormat, emptyResponseDiagnostics, effectiveMaxTokensFor, completeRawOpenAICompatibleJsonChat, createAiSdkProvider, createFallbackClient, numberLines, renderPrompt, cache, loadPromptTemplate, nullableOptional, AI_VIOLATION_MESSAGE_MAX_LENGTH, aiViolationSchema, aiResponseSchema, stripCodeFence, parseAiResponse, VIETNAMESE_OUTPUT_POLICY_VERSION, VIETNAMESE_OUTPUT_INSTRUCTION, TOKEN_BUDGET_WARN_DEFAULT, CHARS_PER_TOKEN, SAFETY_MARGIN, estimateTokens, formatTokenWarning, braceDelta, chunkSourceForAi, CACHE_NAMESPACE, DEFAULT_PROVIDER_RETRY_MAX_RETRIES, DEFAULT_PROVIDER_RETRY_MAX_DELAY_MS, DEFAULT_ADAPTIVE_RETRY_MAX_RETRIES, DEFAULT_ADAPTIVE_CONTEXT_REDUCTION_FACTOR, DEFAULT_ADAPTIVE_TIMEOUT_MULTIPLIER, DEFAULT_ADAPTIVE_MAX_DELAY_MS, DEFAULT_PROVIDER_TIMEOUT_MS, sleep, parseRetryDelayMs, providerRetryDelayMs, adaptiveFailureKind, compactClusterContext, findingDedupeKey, dedupeFindings, capFindings, createAiExecutor, PATH_FAST_PATHS, SPRING_BOOT_PATTERNS, ANGULAR_PATTERNS, FLUTTER_PATTERNS, ENTRY_HINTS, ALL_PATTERNS, matchesRule, classifyLayer, classifyLayers, PRIMARY_LAYER_CANDIDATES, TEST_AND_GENERATED, LAYER_SUFFIXES, FILE_SUFFIX_RE, ANY_EXT_RE, dropExt, stripPascalSuffix, normalize3, extractDomainTokens, extractDomainTokensBatch, TRIVIAL_TOKENS, sharesDomainToken, TS_IMPORT_RE, JAVA_IMPORT_RE, extractImports, POSIX_SEP_RE, sharedDirDepth, resolveImportTarget, KIND_STRENGTH, upsertEdge, buildEdges, ADVICE_ANNOTATION, isGlobalAdviceFile, findGlobalAdvicePaths, DEFAULT_MAX_CANDIDATES, DEFAULT_MAX_SUPPORT_FILES, DEFAULT_TOKEN_BUDGET, SCORE_DIRECT_NEIGHBOR, SCORE_SECOND_DEGREE, SCORE_SIBLING_STEM, SCORE_ANGULAR_TEMPLATE_SIBLING, SCORE_DOMAIN_TOKEN, PENALTY_TEST_VS_NON_TEST, PENALTY_GENERATED, SCORE_GLOBAL_ADVICE, prefilterCandidates, layerFlowBonus, isTest, isGenerated, scoreFor, tokensOf, trimToBudget, toMember, clusterIdFor, createClusterAssembler, CLUSTER_TREE_BUILDER_VERSION, DEFAULT_MODULE_DEPTH, posixDirname, moduleGroupKey, uniqueSortedPaths, memberFingerprint, featureNodeFor, moduleNodeFor, appNodeFor, countCrossModuleEdges, createClusterTreeBuilder, TRANSACTIONAL, TYPE_DECL3, METHOD_NAME2, MUTATION_CALL, LEADING_ANNOTATION2, SPRING_TX_SUPPORT_IMPORT, PROGRAMMATIC_TYPE, PROGRAMMATIC_CALL, INLINE_TEMPLATE_CALL, CONTROL_FLOW_NAMES, maskNonCode, methodNameFromHeader, methodAt, delegatedTargetAt, collectProgrammaticReceivers, readAttr, skipToDeclaration2, countMutations, lineOf19, configuredReadOnly, extractProgrammaticFromFile, extractFromFile2, extractTransactionBoundaries, renderPrDiffPrompt, nullableOptional2, prDiffResponseSchema, createPrDiffReviewer, renderGroupedRulePrompt, confidenceLabelSchema, severitySchema, groupedResponseSchema, labelToConfidence, createGroupedRuleReviewer, renderPerRulePrompt, createPerRuleReviewer, DEFAULT_MAX_TOKENS, SYSTEM_PROMPT, SCHEMA_PROMPT, clip, buildUserPrompt, extractJsonObject, describeUnusableAnswer, createRuntimeAuthHypothesisResolver, DEFAULT_MAX_TOKENS2, SYSTEM_PROMPT2, SCHEMA_PROMPT2, clip2, buildUserPrompt2, describeUnusableAnswer2, createRuntimeDataSeedResolver, endpointSchema, extractJsonObject2, HTTP_METHODS, PARAMETER_KINDS, ENGLISH_REASON_WORDS, ENGLISH_TECHNICAL_WORDS, VIETNAMESE_DIACRITICS, isLikelyEnglishReason, normalizeTriageReason, parseEndpointHint;
@@ -31186,10 +31229,10 @@ ${VIETNAMESE_OUTPUT_INSTRUCTION}`
31186
31229
  ];
31187
31230
  FILE_SUFFIX_RE = /\.(?:component|service|module|directive|pipe|model|interface|type|spec|test)\.[a-z]+$/i;
31188
31231
  ANY_EXT_RE = /\.[a-z]+$/i;
31189
- dropExt = (basename11) => {
31190
- const dotted = basename11.replace(FILE_SUFFIX_RE, "");
31191
- if (dotted !== basename11) return dotted;
31192
- return basename11.replace(ANY_EXT_RE, "");
31232
+ dropExt = (basename12) => {
31233
+ const dotted = basename12.replace(FILE_SUFFIX_RE, "");
31234
+ if (dotted !== basename12) return dotted;
31235
+ return basename12.replace(ANY_EXT_RE, "");
31193
31236
  };
31194
31237
  stripPascalSuffix = (s) => {
31195
31238
  for (const suffix of LAYER_SUFFIXES) {
@@ -31204,9 +31247,9 @@ ${VIETNAMESE_OUTPUT_INSTRUCTION}`
31204
31247
  extractDomainTokens = (file) => {
31205
31248
  const out = /* @__PURE__ */ new Set();
31206
31249
  const segments = file.path.split(/[\\/]/);
31207
- const basename11 = segments[segments.length - 1] ?? "";
31208
- if (basename11.length > 0) {
31209
- const stem = dropExt(basename11);
31250
+ const basename12 = segments[segments.length - 1] ?? "";
31251
+ if (basename12.length > 0) {
31252
+ const stem = dropExt(basename12);
31210
31253
  const token = normalize3(stripPascalSuffix(stem));
31211
31254
  if (token.length >= 2) out.add(token);
31212
31255
  }
@@ -31270,9 +31313,9 @@ ${VIETNAMESE_OUTPUT_INSTRUCTION}`
31270
31313
  if (terminal.length === 0) return null;
31271
31314
  const matches = [];
31272
31315
  for (const c of candidates) {
31273
- const basename11 = c.path.split(POSIX_SEP_RE).pop() ?? "";
31274
- const baseNoExt = basename11.replace(/\.[a-z0-9]+$/i, "");
31275
- if (baseNoExt === terminal || basename11 === terminal) {
31316
+ const basename12 = c.path.split(POSIX_SEP_RE).pop() ?? "";
31317
+ const baseNoExt = basename12.replace(/\.[a-z0-9]+$/i, "");
31318
+ if (baseNoExt === terminal || basename12 === terminal) {
31276
31319
  if (isRelative) {
31277
31320
  const fromDir = fromFile.path.split(POSIX_SEP_RE).slice(0, -1).join("/");
31278
31321
  const toDir = c.path.split(POSIX_SEP_RE).slice(0, -1).join("/");
@@ -36742,6 +36785,87 @@ var init_find_files = __esm({
36742
36785
  };
36743
36786
  }
36744
36787
  });
36788
+
36789
+ // src/git-filter.ts
36790
+ var git_filter_exports = {};
36791
+ __export(git_filter_exports, {
36792
+ getGitFilteredPaths: () => getGitFilteredPaths,
36793
+ getRepoRoot: () => getRepoRoot
36794
+ });
36795
+ var execFileAsync, runGit, getRepoRoot, parseNulSeparated, gitArgsForMode, getGitFilteredPaths;
36796
+ var init_git_filter = __esm({
36797
+ "src/git-filter.ts"() {
36798
+ init_dist();
36799
+ execFileAsync = promisify(execFile$1);
36800
+ runGit = async (args, cwd) => {
36801
+ const { stdout } = await execFileAsync("git", [...args], {
36802
+ cwd,
36803
+ encoding: "utf8",
36804
+ // Allow up to 16 MiB of output — should be plenty for a path list.
36805
+ maxBuffer: 16 * 1024 * 1024
36806
+ });
36807
+ return stdout;
36808
+ };
36809
+ getRepoRoot = async (cwd, options = {}) => {
36810
+ try {
36811
+ const cdup = (await runGit(["rev-parse", "--show-cdup"], cwd)).trim();
36812
+ return resolve(cwd, cdup);
36813
+ } catch (error) {
36814
+ if (options.fallbackToCwd) {
36815
+ return resolve(cwd);
36816
+ }
36817
+ throw error;
36818
+ }
36819
+ };
36820
+ parseNulSeparated = (out) => {
36821
+ return out.split("\0").filter((s) => s.length > 0);
36822
+ };
36823
+ gitArgsForMode = (mode, sinceRef) => {
36824
+ switch (mode) {
36825
+ case "staged":
36826
+ return [["diff", "--name-only", "--cached", "-z"]];
36827
+ case "changed":
36828
+ return [
36829
+ ["diff", "--name-only", "HEAD", "-z"],
36830
+ ["ls-files", "--others", "--exclude-standard", "-z"]
36831
+ ];
36832
+ case "since": {
36833
+ if (sinceRef === void 0 || sinceRef.length === 0) {
36834
+ throw new Error("--since requires a non-empty git ref");
36835
+ }
36836
+ return [["diff", "--name-only", sinceRef, "-z"]];
36837
+ }
36838
+ }
36839
+ };
36840
+ getGitFilteredPaths = async (options) => {
36841
+ try {
36842
+ const repoRoot = await getRepoRoot(options.cwd);
36843
+ const argSets = gitArgsForMode(options.mode, options.sinceRef);
36844
+ const collected = /* @__PURE__ */ new Set();
36845
+ for (const args of argSets) {
36846
+ const out = await runGit(args, options.cwd);
36847
+ for (const relPath of parseNulSeparated(out)) {
36848
+ collected.add(resolve(repoRoot, relPath));
36849
+ }
36850
+ }
36851
+ return ok(collected);
36852
+ } catch (e) {
36853
+ const ee = e;
36854
+ const stderr = (ee.stderr ?? "").trim();
36855
+ const msg = stderr.length > 0 ? stderr : ee.message ?? String(e);
36856
+ return err(
36857
+ new IOError(`Git filter failed (--${options.mode}): ${msg}`, {
36858
+ cause: e,
36859
+ context: {
36860
+ mode: options.mode,
36861
+ ...options.sinceRef !== void 0 ? { sinceRef: options.sinceRef } : {}
36862
+ }
36863
+ })
36864
+ );
36865
+ }
36866
+ };
36867
+ }
36868
+ });
36745
36869
  var severitySchema3, languageSchema, scopeSchema, parserLayerSchema, ruleIdSchema2, confidenceSchema, ruleBaseSchema, staticYamlFixSchema, staticYamlRuleSchema, staticTsRuleSchema, aiConfigSchema, prRoutingSchema, aiRuleSchema, anyRuleSchema, DEFAULT_FINDING_CONFIDENCE, clampConfidence, toFinding, YAML_PATTERN, loadYamlRules, TS_PATTERN, extractRuleExport, loadTsRules, createRuleLoader, ROUTING_PROFILES, DEFAULT_ROUTING_PROFILE, termsFor, inferIntent, routingGroupFor, targetLayersFor, riskWeightFor, relatedContextFor, inferAiRuleRouting, queryCache, predicatesCache, extractPredicates, resolveQuerySource, findCapture, matchSatisfies, getLanguage, getOrCompileQuery, getOrExtractPredicates, nodeRangeToFileRange, pickCaptureNode, executeYamlRule, executeTsRule, DIRECTIVE_RE, parseRuleList, mergeLine, parseSuppressions, normalizeForFingerprint, optionsFingerprint, ruleCacheKey, findingDedupeKey2, findingRootCauseDedupeKey, selectRootCauseRepresentatives, createTaskScheduler, ruleAppliesToFile, requiredLayer, createStaticExecutor, here, compiledRulesDir, sourceRulesDir, builtinRulesDir;
36746
36870
  var init_dist8 = __esm({
36747
36871
  "../rule-engine/dist/index.js"() {
@@ -39070,7 +39194,7 @@ var init_sql = __esm({
39070
39194
  return new SQL([new StringChunk(str)]);
39071
39195
  }
39072
39196
  sql2.raw = raw;
39073
- function join16(chunks, separator) {
39197
+ function join15(chunks, separator) {
39074
39198
  const result = [];
39075
39199
  for (const [i, chunk] of chunks.entries()) {
39076
39200
  if (i > 0 && separator !== void 0) {
@@ -39080,7 +39204,7 @@ var init_sql = __esm({
39080
39204
  }
39081
39205
  return new SQL(result);
39082
39206
  }
39083
- sql2.join = join16;
39207
+ sql2.join = join15;
39084
39208
  function identifier(value) {
39085
39209
  return new Name(value);
39086
39210
  }
@@ -41627,7 +41751,7 @@ var init_select2 = __esm({
41627
41751
  return (table, on) => {
41628
41752
  const baseTableName = this.tableName;
41629
41753
  const tableName = getTableLikeName(table);
41630
- if (typeof tableName === "string" && this.config.joins?.some((join16) => join16.alias === tableName)) {
41754
+ if (typeof tableName === "string" && this.config.joins?.some((join15) => join15.alias === tableName)) {
41631
41755
  throw new Error(`Alias "${tableName}" is already used in this query`);
41632
41756
  }
41633
41757
  if (!this.isPartialSelect) {
@@ -42455,7 +42579,7 @@ var init_update = __esm({
42455
42579
  createJoin(joinType) {
42456
42580
  return (table, on) => {
42457
42581
  const tableName = getTableLikeName(table);
42458
- if (typeof tableName === "string" && this.config.joins.some((join16) => join16.alias === tableName)) {
42582
+ if (typeof tableName === "string" && this.config.joins.some((join15) => join15.alias === tableName)) {
42459
42583
  throw new Error(`Alias "${tableName}" is already used in this query`);
42460
42584
  }
42461
42585
  if (typeof on === "function") {
@@ -47259,6 +47383,7 @@ var init_ai_triage_command = __esm({
47259
47383
  results.push({
47260
47384
  file: toPosix(relative(reportRoot, resolve(source, candidate.file))),
47261
47385
  category: candidate.category,
47386
+ status: triageRes.status,
47262
47387
  vulnerable: triageRes.vulnerable,
47263
47388
  reason: triageRes.reason,
47264
47389
  isFalseNegativeCandidate: candidate.isFalseNegativeCandidate,
@@ -47302,11 +47427,11 @@ var definedBuildValue = (value, fallback) => typeof value === "string" && value.
47302
47427
  var getCliBuildMetadata = (version2) => ({
47303
47428
  version: version2,
47304
47429
  gitSha: definedBuildValue(
47305
- "e8df2c6d599c" ,
47430
+ "30c03b37b3a4" ,
47306
47431
  "unknown"
47307
47432
  ),
47308
47433
  buildTimestamp: definedBuildValue(
47309
- "2026-09-16T03:16:43.210Z" ,
47434
+ "2026-09-16T04:32:54.599Z" ,
47310
47435
  "unknown"
47311
47436
  ),
47312
47437
  configSchemaRange: definedBuildValue(
@@ -48955,11 +49080,29 @@ var FileWorkspaceLinkStore = class {
48955
49080
  constructor(root = process.cwd()) {
48956
49081
  this.#filePath = join(resolve(root), ".code-sentinel", stateFileName);
48957
49082
  }
49083
+ get filePath() {
49084
+ return this.#filePath;
49085
+ }
48958
49086
  async read() {
48959
49087
  try {
48960
- return parseLink(JSON.parse(await readFile(this.#filePath, "utf8")));
48961
- } catch {
48962
- return null;
49088
+ const content = await readFile(this.#filePath, "utf8");
49089
+ let parsedJson;
49090
+ try {
49091
+ parsedJson = JSON.parse(content);
49092
+ } catch (err2) {
49093
+ const msg = err2 instanceof Error ? err2.message : String(err2);
49094
+ throw new Error(`Workspace link state at ${this.#filePath} is invalid JSON: ${msg}`);
49095
+ }
49096
+ const parsed = parseLink(parsedJson);
49097
+ if (!parsed) {
49098
+ throw new Error(`Workspace link state at ${this.#filePath} is invalid or unsafe.`);
49099
+ }
49100
+ return parsed;
49101
+ } catch (error) {
49102
+ if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
49103
+ return null;
49104
+ }
49105
+ throw error;
48963
49106
  }
48964
49107
  }
48965
49108
  async write(link) {
@@ -48979,6 +49122,33 @@ var FileWorkspaceLinkStore = class {
48979
49122
  await rm4(this.#filePath, { force: true });
48980
49123
  }
48981
49124
  };
49125
+ var findWorkspaceLink = async (startDir) => {
49126
+ const { getRepoRoot: getRepoRoot2 } = await Promise.resolve().then(() => (init_git_filter(), git_filter_exports));
49127
+ let boundary = startDir;
49128
+ try {
49129
+ boundary = await getRepoRoot2(startDir, { fallbackToCwd: true });
49130
+ } catch {
49131
+ }
49132
+ let currentDir = resolve(startDir);
49133
+ const boundaryDir = resolve(boundary);
49134
+ while (true) {
49135
+ const store = new FileWorkspaceLinkStore(currentDir);
49136
+ const link = await store.read();
49137
+ if (link) {
49138
+ return {
49139
+ link,
49140
+ root: currentDir,
49141
+ filePath: store.filePath,
49142
+ store
49143
+ };
49144
+ }
49145
+ if (currentDir === boundaryDir || currentDir === dirname(currentDir)) {
49146
+ break;
49147
+ }
49148
+ currentDir = dirname(currentDir);
49149
+ }
49150
+ return null;
49151
+ };
48982
49152
 
48983
49153
  // src/commands/pentest-verify-io.ts
48984
49154
  init_dist5();
@@ -49666,8 +49836,11 @@ var runAssess = async (options, deps = {}) => {
49666
49836
  const match = triageResults.find(
49667
49837
  (r) => r.file === finding.file && r.category === category && !r.isFalseNegativeCandidate
49668
49838
  );
49669
- if (match && !match.vulnerable) {
49670
- return false;
49839
+ if (match) {
49840
+ const isExplicitlySafe = match.status === "safe" || match.status === void 0 && !match.vulnerable && typeof match.reason === "string" && !match.reason.startsWith("L\u1ED7i") && !match.reason.startsWith("LLM");
49841
+ if (isExplicitlySafe) {
49842
+ return false;
49843
+ }
49671
49844
  }
49672
49845
  return true;
49673
49846
  });
@@ -50016,7 +50189,8 @@ var runAssess = async (options, deps = {}) => {
50016
50189
  }
50017
50190
  }
50018
50191
  if (options.push === true) {
50019
- const link = await new FileWorkspaceLinkStore(target).read();
50192
+ const resolvedLink = await findWorkspaceLink(target);
50193
+ const link = resolvedLink?.link ?? null;
50020
50194
  if (!link) {
50021
50195
  console.error(
50022
50196
  red(
@@ -50773,11 +50947,11 @@ ${subject}`;
50773
50947
  };
50774
50948
 
50775
50949
  // src/commands/auth.command.ts
50776
- var execFile2 = promisify(execFile$1);
50950
+ var execFile3 = promisify(execFile$1);
50777
50951
  var openBrowser = async (url) => {
50778
- if (process.platform === "darwin") await execFile2("open", [url]);
50779
- else if (process.platform === "win32") await execFile2("cmd", ["/c", "start", "", url]);
50780
- else await execFile2("xdg-open", [url]);
50952
+ if (process.platform === "darwin") await execFile3("open", [url]);
50953
+ else if (process.platform === "win32") await execFile3("cmd", ["/c", "start", "", url]);
50954
+ else await execFile3("xdg-open", [url]);
50781
50955
  };
50782
50956
  var credentialStore = () => createPlatformCredentialStore();
50783
50957
  var sleep2 = (milliseconds) => new Promise((resolve55) => setTimeout(resolve55, milliseconds));
@@ -50938,7 +51112,8 @@ var authenticatedClient = async (server, store) => {
50938
51112
  };
50939
51113
  var projectIdFor = async (path, projectId) => {
50940
51114
  if (projectId) return projectId;
50941
- const link = await new FileWorkspaceLinkStore(path).read();
51115
+ const resolvedLink = await findWorkspaceLink(path ?? process.cwd());
51116
+ const link = resolvedLink?.link ?? null;
50942
51117
  if (!link)
50943
51118
  throw new Error("This workspace is not linked. Run `cs project` first or pass --project-id.");
50944
51119
  return link.projectId;
@@ -51415,76 +51590,8 @@ var createFindingBatchPublisher = (options) => {
51415
51590
  };
51416
51591
  };
51417
51592
 
51418
- // src/git-filter.ts
51419
- init_dist();
51420
- var execFileAsync = promisify(execFile$1);
51421
- var runGit = async (args, cwd) => {
51422
- const { stdout } = await execFileAsync("git", [...args], {
51423
- cwd,
51424
- encoding: "utf8",
51425
- // Allow up to 16 MiB of output — should be plenty for a path list.
51426
- maxBuffer: 16 * 1024 * 1024
51427
- });
51428
- return stdout;
51429
- };
51430
- var getRepoRoot = async (cwd, options = {}) => {
51431
- try {
51432
- const cdup = (await runGit(["rev-parse", "--show-cdup"], cwd)).trim();
51433
- return resolve(cwd, cdup);
51434
- } catch (error) {
51435
- if (options.fallbackToCwd) {
51436
- return resolve(cwd);
51437
- }
51438
- throw error;
51439
- }
51440
- };
51441
- var parseNulSeparated = (out) => {
51442
- return out.split("\0").filter((s) => s.length > 0);
51443
- };
51444
- var gitArgsForMode = (mode, sinceRef) => {
51445
- switch (mode) {
51446
- case "staged":
51447
- return [["diff", "--name-only", "--cached", "-z"]];
51448
- case "changed":
51449
- return [
51450
- ["diff", "--name-only", "HEAD", "-z"],
51451
- ["ls-files", "--others", "--exclude-standard", "-z"]
51452
- ];
51453
- case "since": {
51454
- if (sinceRef === void 0 || sinceRef.length === 0) {
51455
- throw new Error("--since requires a non-empty git ref");
51456
- }
51457
- return [["diff", "--name-only", sinceRef, "-z"]];
51458
- }
51459
- }
51460
- };
51461
- var getGitFilteredPaths = async (options) => {
51462
- try {
51463
- const repoRoot = await getRepoRoot(options.cwd);
51464
- const argSets = gitArgsForMode(options.mode, options.sinceRef);
51465
- const collected = /* @__PURE__ */ new Set();
51466
- for (const args of argSets) {
51467
- const out = await runGit(args, options.cwd);
51468
- for (const relPath of parseNulSeparated(out)) {
51469
- collected.add(resolve(repoRoot, relPath));
51470
- }
51471
- }
51472
- return ok(collected);
51473
- } catch (e) {
51474
- const ee = e;
51475
- const stderr = (ee.stderr ?? "").trim();
51476
- const msg = stderr.length > 0 ? stderr : ee.message ?? String(e);
51477
- return err(
51478
- new IOError(`Git filter failed (--${options.mode}): ${msg}`, {
51479
- cause: e,
51480
- context: {
51481
- mode: options.mode,
51482
- ...options.sinceRef !== void 0 ? { sinceRef: options.sinceRef } : {}
51483
- }
51484
- })
51485
- );
51486
- }
51487
- };
51593
+ // src/commands/review.command.ts
51594
+ init_git_filter();
51488
51595
 
51489
51596
  // src/match-glob.ts
51490
51597
  var REGEX_META = /[.+^${}()|[\]\\]/;
@@ -52131,7 +52238,11 @@ var runPush = async (options = {}, deps = {}) => {
52131
52238
  return EXIT.USAGE;
52132
52239
  }
52133
52240
  const config = loaded.value.config;
52134
- const link = await new FileWorkspaceLinkStore(target).read();
52241
+ const resolvedLinkStore = await findWorkspaceLink(target);
52242
+ const link = resolvedLinkStore?.link ?? null;
52243
+ if (resolvedLinkStore && !options.server) {
52244
+ console.log(dim(`S\u1EED d\u1EE5ng c\u1EA5u h\xECnh d\u1EF1 \xE1n t\u1EEB: ${resolvedLinkStore.filePath}`));
52245
+ }
52135
52246
  const serverUrl = options.server ?? link?.serverUrl ?? config.dashboard.serverUrl ?? process.env.CODE_SENTINEL_DASHBOARD_URL ?? getDefaultDashboardServerUrl();
52136
52247
  if (serverUrl === void 0 || serverUrl.length === 0) {
52137
52248
  console.error(
@@ -53168,6 +53279,7 @@ init_dist7();
53168
53279
  init_dist8();
53169
53280
  init_composition();
53170
53281
  init_find_files();
53282
+ init_git_filter();
53171
53283
 
53172
53284
  // src/rule-overrides.ts
53173
53285
  var buildRuleOverrides = (rulesCfg) => {
@@ -54906,10 +55018,10 @@ var ReaddirpStream = class extends Readable {
54906
55018
  }
54907
55019
  async _formatEntry(dirent, path) {
54908
55020
  let entry;
54909
- const basename11 = this._isDirent ? dirent.name : dirent;
55021
+ const basename12 = this._isDirent ? dirent.name : dirent;
54910
55022
  try {
54911
- const fullPath = resolve(join(path, basename11));
54912
- entry = { path: relative(this._root, fullPath), fullPath, basename: basename11 };
55023
+ const fullPath = resolve(join(path, basename12));
55024
+ entry = { path: relative(this._root, fullPath), fullPath, basename: basename12 };
54913
55025
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
54914
55026
  } catch (err2) {
54915
55027
  this._onError(err2);
@@ -55444,9 +55556,9 @@ var NodeFsHandler = class {
55444
55556
  _watchWithNodeFs(path, listener) {
55445
55557
  const opts = this.fsw.options;
55446
55558
  const directory = sp2.dirname(path);
55447
- const basename11 = sp2.basename(path);
55559
+ const basename12 = sp2.basename(path);
55448
55560
  const parent = this.fsw._getWatchedDir(directory);
55449
- parent.add(basename11);
55561
+ parent.add(basename12);
55450
55562
  const absolutePath = sp2.resolve(path);
55451
55563
  const options = {
55452
55564
  persistent: opts.persistent
@@ -55456,7 +55568,7 @@ var NodeFsHandler = class {
55456
55568
  let closer;
55457
55569
  if (opts.usePolling) {
55458
55570
  const enableBin = opts.interval !== opts.binaryInterval;
55459
- options.interval = enableBin && isBinaryPath(basename11) ? opts.binaryInterval : opts.interval;
55571
+ options.interval = enableBin && isBinaryPath(basename12) ? opts.binaryInterval : opts.interval;
55460
55572
  closer = setFsWatchFileListener(path, absolutePath, options, {
55461
55573
  listener,
55462
55574
  rawEmitter: this.fsw._emitRaw
@@ -55479,10 +55591,10 @@ var NodeFsHandler = class {
55479
55591
  return;
55480
55592
  }
55481
55593
  const dirname27 = sp2.dirname(file);
55482
- const basename11 = sp2.basename(file);
55594
+ const basename12 = sp2.basename(file);
55483
55595
  const parent = this.fsw._getWatchedDir(dirname27);
55484
55596
  let prevStats = stats;
55485
- if (parent.has(basename11))
55597
+ if (parent.has(basename12))
55486
55598
  return;
55487
55599
  const listener = async (path, newStats) => {
55488
55600
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
@@ -55507,9 +55619,9 @@ var NodeFsHandler = class {
55507
55619
  prevStats = newStats2;
55508
55620
  }
55509
55621
  } catch (error) {
55510
- this.fsw._remove(dirname27, basename11);
55622
+ this.fsw._remove(dirname27, basename12);
55511
55623
  }
55512
- } else if (parent.has(basename11)) {
55624
+ } else if (parent.has(basename12)) {
55513
55625
  const at = newStats.atimeMs;
55514
55626
  const mt = newStats.mtimeMs;
55515
55627
  if (!at || at <= mt || mt !== prevStats.mtimeMs) {
@@ -56635,7 +56747,8 @@ var runConfigEffective = async (options = {}) => {
56635
56747
  }
56636
56748
  if (options.online) {
56637
56749
  const root = resolve(options.path ?? process.cwd());
56638
- const link = await new FileWorkspaceLinkStore(root).read();
56750
+ const resolvedLink = await findWorkspaceLink(root);
56751
+ const link = resolvedLink?.link ?? null;
56639
56752
  if (!link) {
56640
56753
  writeError("Workspace is not linked. Run `cs project link` before online config resolution.");
56641
56754
  return EXIT.USAGE;
@@ -57595,7 +57708,11 @@ var runReview = async (options = {}) => {
57595
57708
  return EXIT.RUNTIME;
57596
57709
  }
57597
57710
  try {
57598
- const link = await new FileWorkspaceLinkStore(target).read();
57711
+ const resolvedLink = await findWorkspaceLink(target);
57712
+ const link = resolvedLink?.link ?? null;
57713
+ if (resolvedLink && options.push) {
57714
+ console.log(dim(`S\u1EED d\u1EE5ng c\u1EA5u h\xECnh d\u1EF1 \xE1n t\u1EEB: ${resolvedLink.filePath}`));
57715
+ }
57599
57716
  const credential = link ? await createPlatformCredentialStore().read(link.serverUrl) : null;
57600
57717
  if (link && credential) {
57601
57718
  await new FileProtectedRetryStore(target, createPlatformRetryKeyProvider()).enqueue({
@@ -60321,7 +60438,10 @@ init_schema();
60321
60438
  init_exit_codes();
60322
60439
  var execFile5 = promisify(execFile$1);
60323
60440
  var defaultDependencies = (root) => ({
60324
- readLink: () => new FileWorkspaceLinkStore(root).read(),
60441
+ readLink: async () => {
60442
+ const resolvedLink = await findWorkspaceLink(root);
60443
+ return resolvedLink?.link ?? null;
60444
+ },
60325
60445
  readOriginRemote: async () => {
60326
60446
  try {
60327
60447
  const { stdout } = await execFile5("git", ["remote", "get-url", "origin"], {
@@ -60546,7 +60666,8 @@ var runProjectLink = async (options) => {
60546
60666
  var linkedProjectId = async (options) => {
60547
60667
  const root = resolve(options.path ?? process.cwd());
60548
60668
  if (options.projectId) return { root, projectId: options.projectId };
60549
- const link = await new FileWorkspaceLinkStore(root).read();
60669
+ const resolvedLink = await findWorkspaceLink(root);
60670
+ const link = resolvedLink?.link ?? null;
60550
60671
  if (!link)
60551
60672
  throw new Error("This workspace is not linked. Run `cs project` first or pass --project-id.");
60552
60673
  return { root, projectId: link.projectId };
@@ -61176,888 +61297,202 @@ var runQuickstart = async (options = {}) => {
61176
61297
 
61177
61298
  // src/commands/package.command.ts
61178
61299
  init_dist2();
61179
- init_load();
61180
- init_ai_triage_command();
61181
-
61182
- // src/commands/runtime-auth-seed.command.ts
61183
- init_dist6();
61184
- init_dist2();
61185
61300
  init_dist5();
61186
- init_dist();
61187
- init_composition();
61188
61301
  init_load();
61189
- init_exit_codes();
61190
- init_find_files();
61191
- var CONFIG_GLOBS = [
61192
- "**/application*.yml",
61193
- "**/application*.yaml",
61194
- "**/application*.properties",
61195
- "**/bootstrap*.yml",
61196
- "**/bootstrap*.yaml",
61197
- "**/bootstrap*.properties"
61198
- ];
61199
- var POM_GLOBS = ["**/pom.xml"];
61200
- var JAVA_GLOBS2 = ["**/*.java"];
61201
- var EXCLUDES2 = ["**/node_modules/**", "**/dist/**", "**/target/**"];
61202
- var MAX_EXCERPTS = 40;
61203
- var AUTH_SOURCE_RE = /(Filter|Interceptor|Security(Config|Configuration)|Authentication|Authoriz|TokenService|TokenProvider|JwtUtil|UserContext|SessionRegistry)/;
61204
- var AUTH_CLASS_RE = /((Filter|Interceptor|Aspect)$)|^(UserContext|TokenService|TokenProvider|RedisAbstract|RedisKey|SecurityConfig)/;
61205
- var MAX_CLASS_NAMES = 120;
61206
- var MAX_SOURCE_EXCERPTS = 12;
61207
- var simpleClassName2 = (entry) => (entry.split("/").pop() ?? entry).replace(/\.class$/, "");
61208
- var DEFAULT_REDIS_HOST = "127.0.0.1";
61209
- var DEFAULT_REDIS_PORT = 6379;
61210
- var buildEvidence = (configs, bundled, sources, classNames, classConstants = []) => {
61211
- const relevant = classNames.filter((n) => AUTH_CLASS_RE.test(simpleClassName2(n))).slice(0, MAX_CLASS_NAMES);
61212
- const out = [];
61213
- if (relevant.length > 0) {
61214
- out.push({
61215
- path: "<declared jars> \u2014 auth-relevant class inventory",
61216
- content: [
61217
- "These classes ship inside the jars this project declares. The authentication gate may be",
61218
- "implemented here rather than in the source tree; name the scheme from these if so.",
61219
- "",
61220
- ...relevant
61221
- ].join(String.fromCharCode(10))
61222
- });
61223
- }
61224
- for (const c of classConstants) {
61225
- if (c.constants.length === 0) continue;
61226
- out.push({
61227
- path: `${c.entry} \u2014 string constants`,
61228
- content: c.constants.join(String.fromCharCode(10))
61229
- });
61302
+ init_git_filter();
61303
+ var HYPOTHESIS_ENTRY = ".code-sentinel/auth-hypothesis.json";
61304
+ var DATA_SEED_HYPOTHESIS_ENTRY = ".code-sentinel/data-seed-hypothesis.json";
61305
+ var AI_TRIAGE_ENTRY = ".code-sentinel/ai-triage-assessment.json";
61306
+ var formatBytes = (n) => n > 1024 * 1024 ? `${(n / (1024 * 1024)).toFixed(1)} MB` : `${(n / 1024).toFixed(0)} KB`;
61307
+ var runPackageCommand = async (options) => {
61308
+ const targetDirAbs = resolve(
61309
+ options.targetDir && options.targetDir.trim() !== "" ? options.targetDir : options.source && options.source.trim() !== "" ? options.source : "."
61310
+ );
61311
+ const repoRoot = await getRepoRoot(targetDirAbs, { fallbackToCwd: true });
61312
+ let modulePath = options.module;
61313
+ if (modulePath === void 0 || modulePath.trim() === "") {
61314
+ modulePath = relative(repoRoot, targetDirAbs);
61315
+ if (modulePath === "") modulePath = ".";
61230
61316
  }
61231
- return [...out, ...sources, ...bundled, ...configs].slice(0, MAX_EXCERPTS).map((f) => "path" in f ? f : { path: f.file, content: f.content });
61232
- };
61233
- var runRuntimeAuthSeed = async (options) => {
61234
- if (options.emitHypothesis !== void 0 && options.hypothesis !== void 0) {
61235
- console.error(
61236
- "[auth-seed] --emit-hypothesis v\xE0 --hypothesis lo\u1EA1i tr\u1EEB nhau: m\u1ED9t b\xEAn GI\u1EA2I (ch\u1EA1y ngo\xE0i namespace c\xF4 l\u1EADp), m\u1ED9t b\xEAn TI\xCAU TH\u1EE4 (ch\u1EA1y trong pod)."
61317
+ const effectiveTarget = resolve(repoRoot, modulePath);
61318
+ if (!options.push && (options.resolveAuth || options.resolveDataSeed || options.refreshHypothesis)) {
61319
+ process.stderr.write(
61320
+ "cs package: C\xE1c c\u1EDD AI c\u1EE5c b\u1ED9 (--resolve-auth, --resolve-data-seed, --refresh-hypothesis) \u0111\xE3 b\u1ECB lo\u1EA1i b\u1ECF. AI hi\u1EC7n \u0111\u01B0\u1EE3c th\u1EF1c thi t\u1EADp trung tr\xEAn m\xE1y ch\u1EE7 (Server-Centric). H\xE3y d\xF9ng l\u1EC7nh `cs pentest` \u0111\u1EC3 t\u1EF1 \u0111\u1ED9ng \u0111\xF3ng g\xF3i v\xE0 ch\u1EA1y AI tr\xEAn m\xE1y ch\u1EE7.\n"
61237
61321
  );
61238
- return EXIT.USAGE;
61239
- }
61240
- const source = resolve(process.cwd(), options.source);
61241
- const configResult = await findFiles({
61242
- projectRoot: source,
61243
- include: CONFIG_GLOBS,
61244
- exclude: EXCLUDES2
61245
- });
61246
- if (!configResult.ok) {
61247
- console.error(`[auth-seed] Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c c\u1EA5u h\xECnh trong ${source} \u2192 kh\xF4ng gieo seed.`);
61248
- return EXIT.SUCCESS;
61249
- }
61250
- const files = configResult.value.map((f) => ({
61251
- file: f.path,
61252
- content: f.content
61253
- }));
61254
- let dependencyConfigFiles = [];
61255
- const pomsResult = await findFiles({
61256
- projectRoot: source,
61257
- include: POM_GLOBS,
61258
- exclude: EXCLUDES2
61259
- });
61260
- if (pomsResult.ok) {
61261
- dependencyConfigFiles = collectDependencyConfigFiles(
61262
- pomsResult.value.map((f) => ({ absolutePath: f.absolutePath, content: f.content }))
61263
- ).map((f) => ({ file: f.path, content: f.content }));
61264
- }
61265
- const javaResult = await findFiles({
61266
- projectRoot: source,
61267
- include: JAVA_GLOBS2,
61268
- exclude: EXCLUDES2
61269
- });
61270
- const endpoints = javaResult.ok ? extractHttpEndpoints(javaResult.value).map((e) => ({
61271
- httpMethod: e.httpMethod,
61272
- path: e.path
61273
- })) : [];
61274
- const authSources = javaResult.ok ? javaResult.value.filter((f) => AUTH_SOURCE_RE.test(f.path) || AUTH_SOURCE_RE.test(f.content)).slice(0, MAX_SOURCE_EXCERPTS).map((f) => ({ file: f.path, content: f.content })) : [];
61275
- const pomRefs = pomsResult.ok ? pomsResult.value.map((f) => ({ absolutePath: f.absolutePath, content: f.content })) : [];
61276
- const dependencyJarKeys = collectJwtKeyCandidates(pomRefs);
61277
- const decodeOnlyEvidence = collectDecodeOnlyEvidence(pomRefs);
61278
- const dependencyClasses = collectDependencyClassNames(pomRefs);
61279
- const dependencyConstants = collectDependencyClassConstants(
61280
- pomRefs,
61281
- (entry) => AUTH_CLASS_RE.test(simpleClassName2(entry))
61282
- );
61283
- const signingKeyAvailable = discoverJwtSigningKeys(files).length > 0 || discoverJwtSigningKeys(dependencyConfigFiles).length > 0 || dependencyJarKeys.length > 0 || decodeOnlyEvidence.length > 0;
61284
- const excerpts = buildEvidence(
61285
- files,
61286
- dependencyConfigFiles,
61287
- authSources,
61288
- dependencyClasses,
61289
- dependencyConstants
61290
- );
61291
- const rawPolicy = options.hypothesisProvenance ?? "warn";
61292
- if (options.hypothesisProvenance !== void 0 && !isProvenancePolicy(rawPolicy)) {
61293
- console.error(`[auth-seed] --hypothesis-provenance kh\xF4ng h\u1EE3p l\u1EC7 (${rawPolicy}); d\xF9ng 'warn'.`);
61294
61322
  }
61295
- const provenancePolicy = isProvenancePolicy(rawPolicy) ? rawPolicy : "warn";
61296
- let preResolved;
61297
- if (options.hypothesis !== void 0) {
61298
- const path = resolve(process.cwd(), options.hypothesis);
61299
- const read = await readHypothesisFile(path);
61300
- if (!read.ok) {
61323
+ let serverUrl = getDefaultDashboardServerUrl();
61324
+ let token = process.env.CODE_SENTINEL_DASHBOARD_TOKEN;
61325
+ let link = null;
61326
+ let resolvedLinkStore = null;
61327
+ if (options.push) {
61328
+ const loaded = await loadConfig(
61329
+ options.config === void 0 ? { cwd: repoRoot } : { cwd: repoRoot, configPath: options.config }
61330
+ );
61331
+ const config = loaded.ok ? loaded.value.config : void 0;
61332
+ resolvedLinkStore = await findWorkspaceLink(effectiveTarget);
61333
+ link = resolvedLinkStore?.link ?? null;
61334
+ if (!link) {
61301
61335
  console.error(
61302
- `[auth-seed] Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c gi\u1EA3 thuy\u1EBFt t\u1EEB ${options.hypothesis} (${read.error}) \u2192 b\u1ECF.`
61303
- );
61304
- preResolved = { hypothesis: null, outcome: "no-proposal" };
61305
- } else {
61306
- const validated = validateRuntimeAuthHypothesis(read.result.hypothesis);
61307
- const { provenance: provenance2 } = read.result;
61308
- const decision = resolveHypothesisProvenance({
61309
- policy: provenancePolicy,
61310
- provenance: provenance2,
61311
- expectedInputHash: hypothesisInputHash(
61312
- buildHypothesisInput({
61313
- kind: "runtime-auth",
61314
- promptVersion: RUNTIME_AUTH_PROMPT_VERSION,
61315
- provider: provenance2?.provider ?? "",
61316
- modelId: provenance2?.modelId ?? "",
61317
- excerpts,
61318
- endpoints,
61319
- signingKeyAvailable
61320
- })
61336
+ red(
61337
+ "\nD\u1EF1 \xE1n ch\u01B0a \u0111\u01B0\u1EE3c li\xEAn k\u1EBFt (link) v\u1EDBi m\xE1y ch\u1EE7! H\xE3y ch\u1EA1y `cs project link` tr\u01B0\u1EDBc khi ch\u1EA1y `cs pentest`."
61321
61338
  )
61322
- });
61323
- console.error(`[auth-seed] ${describeHypothesisProvenance(provenance2, decision)}`);
61324
- const accepted = decision.useHypothesis ? validated : null;
61325
- preResolved = {
61326
- hypothesis: accepted,
61327
- outcome: accepted === null ? "rejected" : "accepted"
61328
- };
61329
- console.error(
61330
- validated === null ? `[auth-seed] Gi\u1EA3 thuy\u1EBFt n\u1EA1p t\u1EEB ${options.hypothesis} KH\xD4NG qua \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t (sai h\xECnh d\u1EA1ng) \u2192 b\u1ECF.` : accepted === null ? "[auth-seed] Gi\u1EA3 thuy\u1EBFt h\u1EE3p l\u1EC7 nh\u01B0ng L\u1EC6CH ngu\u1ED3n (ch\xEDnh s\xE1ch enforce) \u2192 qu\xE9t kh\xF4ng x\xE1c th\u1EF1c (ADR-0067)." : `[auth-seed] D\xF9ng gi\u1EA3 thuy\u1EBFt \`${validated.scheme}\` \u0111\xE3 gi\u1EA3i s\u1EB5n ngo\xE0i namespace c\xF4 l\u1EADp (kh\xF4ng g\u1ECDi model \u1EDF \u0111\xE2y).`
61331
61339
  );
61340
+ return 2;
61332
61341
  }
61333
- }
61334
- let resolver = createStubRuntimeAuthHypothesisResolver();
61335
- let providerName = "none";
61336
- let modelId = "<none>";
61337
- if (options.useAi === true && preResolved === void 0) {
61338
- const logger = createLogger({ level: "warn", destination: "stderr" });
61339
- const config = await loadConfig(
61340
- options.config === void 0 ? { cwd: source } : { cwd: source, configPath: resolve(process.cwd(), options.config) }
61341
- );
61342
- const client = config.ok ? buildAiClient(config.value.config, logger) : null;
61343
- if (!config.ok) {
61344
- console.error(
61345
- `[auth-seed] KH\xD4NG N\u1EA0P \u0110\u01AF\u1EE2C CONFIG (${config.error.message.split(String.fromCharCode(10))[0]}) \u2192 d\xF9ng resolver r\u1ED7ng. \u0110\xE2y l\xE0 l\u1ED7i FILE C\u1EA4U H\xCCNH, kh\xF4ng ph\u1EA3i thi\u1EBFu provider.`
61346
- );
61347
- } else if (client === null) {
61348
- console.error(
61349
- "[auth-seed] --ai \u0111\u01B0\u1EE3c y\xEAu c\u1EA7u nh\u01B0ng kh\xF4ng c\xF3 provider AI n\xE0o c\u1EA5u h\xECnh \u0111\u01B0\u1EE3c (ai.provider=none ho\u1EB7c thi\u1EBFu key) \u2192 d\xF9ng resolver r\u1ED7ng."
61350
- );
61351
- } else {
61352
- resolver = createRuntimeAuthHypothesisResolver({ client, logger });
61353
- providerName = client.name;
61354
- modelId = resolveActiveModel(config.value.config);
61355
- console.error(`[auth-seed] H\u1ECFi gi\u1EA3 thuy\u1EBFt x\xE1c th\u1EF1c qua ${client.name} (model ${modelId}).`);
61342
+ serverUrl = link.serverUrl ?? config?.dashboard?.serverUrl ?? getDefaultDashboardServerUrl();
61343
+ if (!token) {
61344
+ token = config?.dashboard?.token;
61345
+ }
61346
+ if (!token) {
61347
+ try {
61348
+ const store = createPlatformCredentialStore();
61349
+ const credential = await getAuthenticatedCredential({ server: serverUrl, store });
61350
+ token = credential.accessToken;
61351
+ } catch (e) {
61352
+ console.error(
61353
+ red(
61354
+ `
61355
+ Kh\xF4ng th\u1EC3 l\u1EA5y x\xE1c th\u1EF1c Dashboard: ${e instanceof Error ? e.message : String(e)}
61356
+ H\xE3y ch\u1EA1y \`cs auth login\`.`
61357
+ )
61358
+ );
61359
+ return 2;
61360
+ }
61361
+ }
61362
+ try {
61363
+ const configUrl = `${serverUrl.replace(/\/+$/, "")}/api/projects/${encodeURIComponent(link.projectId)}/review-config`;
61364
+ const configRes = await fetch(configUrl, {
61365
+ headers: { authorization: `Bearer ${token}` }
61366
+ });
61367
+ if (configRes.ok) {
61368
+ const payload = await configRes.json();
61369
+ const remoteConfig = payload.config ?? payload;
61370
+ const ai = remoteConfig?.ai;
61371
+ const provider = ai?.provider ?? remoteConfig?.aiProvider ?? "viettel-netmind";
61372
+ if (provider && provider !== "none" && provider !== "ollama") {
61373
+ const STORED_SECRET_PLACEHOLDER = "${CODE_SENTINEL_STORED_SECRET}";
61374
+ const pKey = provider === "viettel-netmind" ? "viettelNetmind" : provider === "openai-compatible" ? "openaiCompatible" : provider === "opencode-go" ? "opencodeGo" : provider;
61375
+ const providerConf = typeof ai?.[pKey] === "object" && ai?.[pKey] !== null ? ai[pKey] : {};
61376
+ const rawProviderApiKey = typeof providerConf.apiKey === "string" ? providerConf.apiKey.trim() : typeof ai?.apiKey === "string" ? ai.apiKey.trim() : "";
61377
+ const hasServerSecret = rawProviderApiKey === STORED_SECRET_PLACEHOLDER || rawProviderApiKey === "<configured server secret>" || rawProviderApiKey.startsWith("csenc:v1:");
61378
+ const hasExplicitKey = rawProviderApiKey.length > 0 && !hasServerSecret && !/^\$\{[A-Z0-9_]+\}$/.test(rawProviderApiKey);
61379
+ if (!hasServerSecret && !hasExplicitKey) {
61380
+ const drawerUrl = `${serverUrl.replace(/\/+$/, "")}/runs?project=${encodeURIComponent(link.projectId)}&drawer=pentest`;
61381
+ console.error(
61382
+ red("\n\u274C [Server] D\u1EF1 \xE1n ch\u01B0a \u0111\u01B0\u1EE3c c\u1EA5u h\xECnh Project AI Key tr\xEAn Web Dashboard.")
61383
+ );
61384
+ console.error(
61385
+ red(
61386
+ `\u{1F449} Vui l\xF2ng m\u1EDF drawer Pentest tr\xEAn Web Dashboard \u0111\u1EC3 nh\u1EADp API Key:
61387
+ ${drawerUrl}
61388
+ `
61389
+ )
61390
+ );
61391
+ console.error(
61392
+ red(
61393
+ `H\u01B0\u1EDBng d\u1EABn thao t\xE1c:
61394
+ 1. M\u1EDF link tr\xEAn (ho\u1EB7c v\xE0o D\u1EF1 \xE1n -> b\u1EA5m n\xFAt "Pentest" \u0111\u1EC3 m\u1EDF drawer "Ki\u1EC3m th\u1EED trong m\xF4i tr\u01B0\u1EDDng c\xF4 l\u1EADp").
61395
+ 2. T\u1EA1i m\u1EE5c "Project AI Key (${provider})", nh\u1EADp API Key v\xE0 nh\u1EA5n "L\u01B0u key cho d\u1EF1 \xE1n".
61396
+ 3. Sau khi l\u01B0u key, ch\u1EA1y l\u1EA1i l\u1EC7nh \`cs pentest\`.
61397
+
61398
+ Ghi ch\xFA: L\u1EC7nh \`cs pentest\` s\u1EED d\u1EE5ng Project AI Key tr\xEAn m\xE1y ch\u1EE7 \u0111\u1EC3 t\u1EF1 \u0111\u1ED9ng th\u1EF1c hi\u1EC7n:
61399
+ - Ph\xE2n t\xEDch & gi\u1EA3i quy\u1EBFt c\u01A1 ch\u1EBF x\xE1c th\u1EF1c (Auth Hypothesis)
61400
+ - Two-Way AI Triage (lo\u1EA1i b\u1ECF False Positive, t\xECm False Negative)
61401
+ - T\u1EA1o d\u1EEF li\u1EC7u m\u1ED3i (Data Seed Hypothesis)
61402
+ `
61403
+ )
61404
+ );
61405
+ return 2;
61406
+ }
61407
+ }
61408
+ }
61409
+ } catch {
61356
61410
  }
61357
61411
  }
61358
- if (options.useAi === true && preResolved === void 0) {
61359
- const chars = excerpts.reduce((n, e) => n + e.content.length, 0);
61360
- console.error(`[auth-seed] B\u1EB1ng ch\u1EE9ng: ${excerpts.length} excerpt \xB7 ${chars} k\xFD t\u1EF1.`);
61412
+ const rawPlan = planServicePackage(repoRoot, modulePath);
61413
+ if (rawPlan.entries.length === 0) {
61414
+ process.stderr.write(`cs package: no files found under ${modulePath}
61415
+ `);
61416
+ return 2;
61361
61417
  }
61362
- const hypothesisInput = buildHypothesisInput({
61363
- kind: "runtime-auth",
61364
- promptVersion: RUNTIME_AUTH_PROMPT_VERSION,
61365
- provider: providerName,
61366
- modelId,
61367
- excerpts,
61368
- endpoints,
61369
- signingKeyAvailable
61370
- });
61371
- const inputHash = hypothesisInputHash(hypothesisInput);
61372
- const pinned = preResolved === void 0 && options.refreshHypothesis !== true ? await loadPin(inputHash) : null;
61373
- const pinnedHypothesis = pinned === null ? null : validateRuntimeAuthHypothesis(pinned.hypothesis);
61374
- if (pinned !== null && pinnedHypothesis === null) {
61375
- console.error(
61376
- "[auth-seed] C\xE2u tr\u1EA3 l\u1EDDi \u0111\xE3 ghim KH\xD4NG qua \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t \u2192 b\u1ECF ghim, h\u1ECFi l\u1EA1i model."
61377
- );
61378
- } else if (pinnedHypothesis !== null) {
61379
- console.error(
61380
- `[auth-seed] TR\xDANG ghim ${inputHash.slice(0, 12)} \u2014 d\xF9ng l\u1EA1i c\xE2u tr\u1EA3 l\u1EDDi \u0111\xE3 ghim, KH\xD4NG g\u1ECDi model.`
61381
- );
61418
+ const cleanEntries = rawPlan.entries.filter(
61419
+ (e) => e.name !== HYPOTHESIS_ENTRY && e.name !== DATA_SEED_HYPOTHESIS_ENTRY && e.name !== AI_TRIAGE_ENTRY && !e.name.startsWith(".code-sentinel/")
61420
+ );
61421
+ const plan = { ...rawPlan, entries: cleanEntries };
61422
+ const outPath = resolve(
61423
+ options.out ?? `${basename(plan.modulePath.replace(/\/$/, "")) || "service"}.zip`
61424
+ );
61425
+ const bytes = writePackageZip(plan, outPath);
61426
+ process.stdout.write(`Packaged ${plan.modulePath} \u2192 ${outPath} (${formatBytes(bytes)})
61427
+ `);
61428
+ process.stdout.write(` ${plan.entries.length} files
61429
+ `);
61430
+ if (plan.parentPoms.length > 0) {
61431
+ process.stdout.write(` parent poms: ${plan.parentPoms.join(", ")}
61432
+ `);
61382
61433
  }
61383
- const resolution = pinnedHypothesis !== null ? { hypothesis: pinnedHypothesis, outcome: "accepted" } : preResolved !== void 0 ? preResolved : await resolveRuntimeAuthHypothesis(resolver, {
61384
- excerpts,
61385
- endpoints,
61386
- signingKeyAvailable
61387
- });
61388
- const { hypothesis, outcome, rejectedShape } = resolution;
61389
- if (hypothesis === null) {
61390
- const why = outcome === "resolver-error" ? "G\u1ECCI PROVIDER TH\u1EA4T B\u1EA0I (m\u1EA1ng/egress/kho\xE1) \u2014 kh\xF4ng ph\u1EA3i model kh\xF4ng t\xECm ra g\xEC; xem d\xF2ng WARN c\u1EE7a resolver ngay tr\xEAn" : outcome === "rejected" ? `model C\xD3 tr\u1EA3 l\u1EDDi nh\u01B0ng KH\xD4NG QUA \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t (sai h\xECnh d\u1EA1ng) \u2014 v\u1EA5n \u0111\u1EC1 schema/prompt, kh\xF4ng ph\u1EA3i m\u1EA1ng. H\xECnh d\u1EA1ng nh\u1EADn \u0111\u01B0\u1EE3c: ${rejectedShape ?? "(kh\xF4ng c\xF3)"}` : "kh\xF4ng c\xF3 \u0111\u1EC1 xu\u1EA5t n\xE0o (resolver t\u1EEB ch\u1ED1i, ho\u1EB7c \u0111ang d\xF9ng resolver r\u1ED7ng)";
61391
- console.error(
61392
- options.emitHypothesis === void 0 ? `[auth-seed] ${why} \u2192 KH\xD4NG gieo seed; qu\xE9t \u1EDF tr\u1EA1ng th\xE1i kh\xF4ng x\xE1c th\u1EF1c (ADR-0067).` : (
61393
- // No file is written, so downstream "no parameter" means "deterministic path" with no
61394
- // second way to spell it.
61395
- `[auth-seed] ${why} \u2192 KH\xD4NG ghi gi\u1EA3 thuy\u1EBFt; lane runtime s\u1EBD ch\u1EA1y \u0111\u01B0\u1EDDng t\u1EA5t \u0111\u1ECBnh.`
61396
- )
61434
+ if (plan.systemJars.length > 0) {
61435
+ process.stdout.write(` declared jars: ${plan.systemJars.join(", ")}
61436
+ `);
61437
+ }
61438
+ if (plan.missingSystemJars.length > 0) {
61439
+ process.stdout.write(
61440
+ ` \u26A0 declared but NOT in the repo: ${plan.missingSystemJars.join(", ")}
61441
+ `
61397
61442
  );
61398
- return EXIT.SUCCESS;
61399
61443
  }
61400
- if (options.emitHypothesis !== void 0) {
61401
- const out = resolve(process.cwd(), options.emitHypothesis);
61402
- const provenance2 = pinned?.provenance ?? stampProvenance({
61403
- input: hypothesisInput,
61404
- hypothesis,
61405
- attempts: resolution.attempts ?? 1
61406
- });
61407
- await writeEnvelopeFile(out, "runtime-auth", hypothesis, provenance2);
61408
- if (pinned === null) {
61409
- const saved = await savePin(inputHash, "runtime-auth", hypothesis, provenance2);
61410
- if (!saved) {
61411
- console.error(
61412
- "[auth-seed] Kh\xF4ng ghi \u0111\u01B0\u1EE3c ghim (cache) \u2192 l\u1EA7n \u0111\xF3ng g\xF3i sau s\u1EBD h\u1ECFi l\u1EA1i model."
61444
+ const report2 = preflightArchive(outPath);
61445
+ const decision = classifyPreflight({ ...report2.signals, staticAssessmentCompleted: true });
61446
+ if (!decision.decided) {
61447
+ process.stdout.write("\n\u2713 preflight: ready to build\n");
61448
+ if (options.push && link) {
61449
+ process.stdout.write("\n\u{1F680} \u0110ang \u0111\u1EA9y d\u1EEF li\u1EC7u l\xEAn Dashboard...\n");
61450
+ try {
61451
+ const url = `${serverUrl.replace(/\/+$/, "")}/api/projects/${encodeURIComponent(link.projectId)}/pentest-requests`;
61452
+ const formData = new FormData();
61453
+ formData.append("sourceKind", "archive");
61454
+ formData.append("archive", new Blob([readFileSync(outPath)]), basename(outPath));
61455
+ formData.append("useAi", "true");
61456
+ if (link.codebaseId) {
61457
+ formData.append("repositoryId", link.codebaseId);
61458
+ }
61459
+ const res = await fetch(url, {
61460
+ method: "POST",
61461
+ headers: { authorization: `Bearer ${token}` },
61462
+ body: formData
61463
+ });
61464
+ if (!res.ok) {
61465
+ const text2 = await res.text().catch(() => "");
61466
+ console.error(red(`
61467
+ Server t\u1EEB ch\u1ED1i y\xEAu c\u1EA7u (HTTP ${res.status}): ${text2}`));
61468
+ return 2;
61469
+ }
61470
+ const body = await res.json().catch(() => ({}));
61471
+ const createdId = body.request?.id ?? body.id;
61472
+ console.log(green(`[\u2713] \u0110\u1EA9y th\xE0nh c\xF4ng! \u0110\xE3 t\u1EA1o request ID: ${createdId ?? "unknown"}`));
61473
+ console.log(
61474
+ `\u{1F517} Link theo d\xF5i: ${serverUrl.replace(/\/+$/, "")}/runs?project=${encodeURIComponent(link.projectId)}&type=pentest`
61413
61475
  );
61476
+ if (body.request?.status === "failed" && body.request.failureReason) {
61477
+ console.error(red(`
61478
+ \u26A0 Y\xEAu c\u1EA7u th\u1EA5t b\u1EA1i: ${body.request.failureReason}`));
61479
+ }
61480
+ } catch (e) {
61481
+ console.error(red(`
61482
+ L\u1ED7i m\u1EA1ng khi upload: ${e instanceof Error ? e.message : String(e)}`));
61483
+ return 2;
61414
61484
  }
61415
61485
  }
61416
- console.error(
61417
- `[auth-seed] \u0110\xE3 ghi gi\u1EA3 thuy\u1EBFt \`${hypothesis.scheme}\` ra ${options.emitHypothesis} (ngu\u1ED3n: ${provenance2.provider}/${provenance2.modelId}, ghim ${inputHash.slice(0, 12)}); KH\xD4NG mint v\xE0 KH\xD4NG gieo seed \u1EDF \u0111\xE2y.`
61418
- );
61419
- return EXIT.SUCCESS;
61420
- }
61421
- const plan = buildRuntimeAuthSeedPlan(hypothesis, {
61422
- files,
61423
- dependencyConfigFiles,
61424
- dependencyJarKeys,
61425
- decodeOnlyEvidence
61426
- });
61427
- if (plan === null) {
61428
- console.error(
61429
- `[auth-seed] C\xF3 gi\u1EA3 thuy\u1EBFt (\`${hypothesis.scheme}\`) nh\u01B0ng kh\xF4ng t\xECm \u0111\u01B0\u1EE3c kho\xE1 k\xFD trong ngu\u1ED3n hay jar khai b\xE1o v\xE0 kh\xF4ng c\xF3 b\u1EB1ng ch\u1EE9ng decode-only \u2192 KH\xD4NG gieo seed. K\xFD b\u1EB1ng kho\xE1 t\u1EF1 ch\u1ECDn s\u1EBD b\u1ECB \u1EE9ng d\u1EE5ng t\u1EEB ch\u1ED1i y nh\u01B0 kh\xF4ng k\xFD, nh\u01B0ng l\u1EA1i TR\xD4NG nh\u01B0 m\u1ED9t phi\xEAn h\u1EE3p l\u1EC7.`
61430
- );
61431
- return EXIT.SUCCESS;
61486
+ return 0;
61432
61487
  }
61433
- const result = await applyRuntimeAuthSeed(plan, {
61434
- host: options.redisHost ?? DEFAULT_REDIS_HOST,
61435
- port: options.redisPort ?? DEFAULT_REDIS_PORT,
61436
- ...options.timeoutMs === void 0 ? {} : { timeoutMs: options.timeoutMs }
61437
- });
61438
- if (!result.ok) {
61439
- for (const f of result.failures) {
61440
- console.error(`[auth-seed] L\u1EC7nh th\u1EA5t b\u1EA1i: ${f.command} \u2014 ${f.error}`);
61441
- }
61442
- console.error(
61443
- `[auth-seed] Gieo seed KH\xD4NG tr\u1ECDn v\u1EB9n (${result.applied}/${plan.commands.length}) \u2192 KH\xD4NG ph\xE1t token; qu\xE9t \u1EDF tr\u1EA1ng th\xE1i kh\xF4ng x\xE1c th\u1EF1c.`
61444
- );
61445
- return EXIT.SUCCESS;
61488
+ process.stdout.write(`
61489
+ \u2717 preflight still stops at ${decision.tier} \u2014 ${decision.stopReason}
61490
+ `);
61491
+ for (const evidence17 of report2.evidence.slice(0, 5)) {
61492
+ process.stdout.write(` ${evidence17.source}: ${evidence17.verbatim}
61493
+ `);
61446
61494
  }
61447
- console.error(
61448
- `[auth-seed] \u0110\xE3 gieo ${result.applied} kho\xE1 state cho scheme \`${hypothesis.scheme}\`.`
61449
- );
61450
- console.error(`[auth-seed] \u0110\u1ED8 L\u1EC6CH: ${plan.deviation}`);
61451
- process.stdout.write(
61452
- `${plan.credential.value.startsWith("Bearer ") ? plan.credential.value.slice(7) : plan.credential.value}
61453
- `
61454
- );
61455
- return EXIT.SUCCESS;
61456
- };
61457
-
61458
- // src/commands/runtime-data-seed.command.ts
61459
- init_dist6();
61460
- init_dist2();
61461
- init_dist2();
61462
- init_dist5();
61463
- init_dist();
61464
- init_dist4();
61465
- init_composition();
61466
- init_load();
61467
- init_exit_codes();
61468
- init_find_files();
61469
- var CONFIG_GLOBS2 = [
61470
- "**/application*.yml",
61471
- "**/application*.yaml",
61472
- "**/application*.properties",
61473
- "**/bootstrap*.yml",
61474
- "**/bootstrap*.yaml",
61475
- "**/bootstrap*.properties"
61476
- ];
61477
- var DB_BUILD_GLOBS2 = ["**/pom.xml", "**/build.gradle", "**/build.gradle.kts"];
61478
- var JAVA_GLOBS3 = ["**/*.java"];
61479
- var SCHEMA_GLOBS = [
61480
- "**/liquibase/**",
61481
- "**/flyway/**",
61482
- "**/db/migration/**",
61483
- "**/*changelog*.xml",
61484
- "**/schema.sql",
61485
- "**/data.sql",
61486
- "**/import.sql"
61487
- ];
61488
- var EXCLUDES3 = ["**/node_modules/**", "**/dist/**", "**/target/**"];
61489
- var ENV_SEED_GLOBS = ["**/.env", "**/*.env"];
61490
- var MAX_ENV_FILE_BYTES = 1024 * 1024;
61491
- var MAX_EXCERPTS2 = 40;
61492
- var ENTITY_RE = /@(Entity|Table)\b/;
61493
- var buildDataSeedEvidence = (schemaFiles, entityFiles, configs) => [...schemaFiles, ...entityFiles, ...configs].slice(0, MAX_EXCERPTS2);
61494
- var readEnvSeedFiles = async (root) => {
61495
- try {
61496
- const paths = await glob([...ENV_SEED_GLOBS], {
61497
- cwd: root,
61498
- ignore: [...EXCLUDES3, "**/.git/**"],
61499
- onlyFiles: true,
61500
- dot: true
61501
- });
61502
- const files = [];
61503
- for (const p of paths.sort()) {
61504
- let content;
61505
- try {
61506
- content = await readFile(resolve(root, p), "utf8");
61507
- } catch {
61508
- continue;
61509
- }
61510
- if (Buffer.byteLength(content, "utf8") > MAX_ENV_FILE_BYTES) continue;
61511
- const abs = resolve(root, p);
61512
- files.push({
61513
- path: toPosix(p),
61514
- absolutePath: abs,
61515
- language: languageFromPath(p) ?? "text",
61516
- content,
61517
- hash: sha256(content),
61518
- size: Buffer.byteLength(content, "utf8")
61519
- });
61520
- }
61521
- return files;
61522
- } catch {
61523
- return [];
61524
- }
61525
- };
61526
- var runRuntimeDataSeed = async (options) => {
61527
- if (options.emitHypothesis !== void 0 && options.hypothesis !== void 0) {
61528
- console.error(
61529
- "[data-seed] --emit-hypothesis v\xE0 --hypothesis lo\u1EA1i tr\u1EEB nhau: m\u1ED9t b\xEAn GI\u1EA2I (ch\u1EA1y ngo\xE0i namespace c\xF4 l\u1EADp, n\u01A1i c\xF3 egress AI), m\u1ED9t b\xEAn TI\xCAU TH\u1EE4 (ch\u1EA1y trong pod, render SQL)."
61530
- );
61531
- return EXIT.USAGE;
61532
- }
61533
- if (options.renderSql !== void 0 && options.hypothesis === void 0) {
61534
- console.error("[data-seed] --render-sql c\u1EA7n --hypothesis (lane ti\xEAu th\u1EE5 trong pod).");
61535
- return EXIT.USAGE;
61536
- }
61537
- if (options.deriveObjectStoreSeed !== void 0 && (options.emitHypothesis !== void 0 || options.hypothesis !== void 0)) {
61538
- console.error(
61539
- "[data-seed] --derive-object-store-seed l\xE0 lane \u0111\u1ED9c l\u1EADp (kh\xF4ng g\u1ECDi model, kh\xF4ng c\u1EA7n gi\u1EA3 thuy\u1EBFt) v\xE0 lo\u1EA1i tr\u1EEB --emit-hypothesis / --hypothesis."
61540
- );
61541
- return EXIT.USAGE;
61542
- }
61543
- const source = resolve(process.cwd(), options.source);
61544
- const configResult = await findFiles({
61545
- projectRoot: source,
61546
- include: CONFIG_GLOBS2,
61547
- exclude: EXCLUDES3
61548
- });
61549
- const configs = configResult.ok ? configResult.value.map((f) => ({ path: f.path, content: f.content })) : [];
61550
- const buildResult2 = await findFiles({
61551
- projectRoot: source,
61552
- include: DB_BUILD_GLOBS2,
61553
- exclude: EXCLUDES3
61554
- });
61555
- const javaResult = await findFiles({
61556
- projectRoot: source,
61557
- include: JAVA_GLOBS3,
61558
- exclude: EXCLUDES3
61559
- });
61560
- const javaFiles = javaResult.ok ? javaResult.value : [];
61561
- const endpoints = javaResult.ok ? extractHttpEndpoints(javaResult.value) : [];
61562
- if (options.deriveObjectStoreSeed !== void 0) {
61563
- const poms = buildResult2.ok ? buildResult2.value : [];
61564
- const envFiles = await readEnvSeedFiles(source);
61565
- const jarConfigs = collectDependencyConfigFiles(poms);
61566
- const derivation = deriveObjectStoreSeedTargets([
61567
- ...configResult.ok ? configResult.value : [],
61568
- ...envFiles,
61569
- ...jarConfigs
61570
- ]);
61571
- if (derivation.targets.length === 0) {
61572
- console.error(
61573
- "[data-seed] KH\xD4NG derive \u0111\u01B0\u1EE3c bucket object-store n\xE0o t\u1EEB source (config/jar/.env) \u2192 KH\xD4NG ghi file TSV (fail-closed)."
61574
- );
61575
- return EXIT.SUCCESS;
61576
- }
61577
- const validated = validateRuntimeDataSeedHypothesis({
61578
- scheme: "object-put",
61579
- targets: derivation.targets,
61580
- evidence: derivation.evidence
61581
- });
61582
- if (validated === null || validated.scheme !== "object-put") {
61583
- console.error(
61584
- "[data-seed] K\u1EBFt qu\u1EA3 derive KH\xD4NG qua \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t \u2192 KH\xD4NG ghi file TSV (fail-closed)."
61585
- );
61586
- return EXIT.SUCCESS;
61587
- }
61588
- const tsv = renderObjectStoreSeedTsv(validated);
61589
- const out = resolve(process.cwd(), options.deriveObjectStoreSeed);
61590
- await mkdir(resolve(out, ".."), { recursive: true });
61591
- await writeFile(out, tsv, "utf8");
61592
- console.error(
61593
- `[data-seed] \u0110\xE3 derive ${validated.targets.length} bucket object-store (baseline key \`1\`) \u2192 ${options.deriveObjectStoreSeed}.`
61594
- );
61595
- return EXIT.SUCCESS;
61596
- }
61597
- if (options.emitHypothesis !== void 0) {
61598
- let resolver = createStubRuntimeDataSeedResolver();
61599
- let providerName = "none";
61600
- let modelId = "<none>";
61601
- if (options.useAi === true) {
61602
- const logger = createLogger({ level: "warn", destination: "stderr" });
61603
- const config = await loadConfig(
61604
- options.config === void 0 ? { cwd: source } : { cwd: source, configPath: resolve(process.cwd(), options.config) }
61605
- );
61606
- const client = config.ok ? buildAiClient(config.value.config, logger) : null;
61607
- if (!config.ok) {
61608
- console.error(
61609
- `[data-seed] KH\xD4NG N\u1EA0P \u0110\u01AF\u1EE2C CONFIG (${config.error.message.split(String.fromCharCode(10))[0]}) \u2192 d\xF9ng resolver r\u1ED7ng. \u0110\xE2y l\xE0 l\u1ED7i FILE C\u1EA4U H\xCCNH, kh\xF4ng ph\u1EA3i thi\u1EBFu provider.`
61610
- );
61611
- } else if (client === null) {
61612
- console.error(
61613
- "\u26A0\uFE0F [Local] Kh\xF4ng t\xECm th\u1EA5y `LLM_API_KEY` \u1EDF file `.env` t\u1EA1i m\xE1y c\u1EE7a b\u1EA1n. B\u1ECF qua b\u01B0\u1EDBc t\u1EA1o d\u1EEF li\u1EC7u gi\u1EA3 l\u1EADp (Data-seed). (N\u1EBFu \u0111\u1EA9y l\xEAn Server, Server s\u1EBD t\u1EF1 d\xF9ng Project AI Key c\u1EE7a n\xF3)."
61614
- );
61615
- } else {
61616
- const resolverOptions = { client, logger };
61617
- resolver = createRuntimeDataSeedResolver(resolverOptions);
61618
- providerName = client.name;
61619
- modelId = resolveActiveModel(config.value.config);
61620
- console.error(`[data-seed] H\u1ECFi gi\u1EA3 thuy\u1EBFt d\u1EEF li\u1EC7u qua ${client.name} (model ${modelId}).`);
61621
- }
61622
- }
61623
- const manifest = buildReachabilityManifest(endpoints, {});
61624
- const endpointSummaries = dataSeedEndpointSummaries(manifest.entries);
61625
- const schemaResult = await findFiles({
61626
- projectRoot: source,
61627
- include: SCHEMA_GLOBS,
61628
- exclude: EXCLUDES3
61629
- });
61630
- const schemaFiles = schemaResult.ok ? schemaResult.value.map((f) => ({ path: f.path, content: f.content })) : [];
61631
- const entityFiles = javaFiles.filter((f) => ENTITY_RE.test(f.content)).map((f) => ({ path: f.path, content: f.content }));
61632
- const excerpts = buildDataSeedEvidence(schemaFiles, entityFiles, configs);
61633
- if (options.useAi === true) {
61634
- const chars = excerpts.reduce((n, e) => n + e.content.length, 0);
61635
- console.error(
61636
- `[data-seed] B\u1EB1ng ch\u1EE9ng: ${excerpts.length} excerpt \xB7 ${chars} k\xFD t\u1EF1 \xB7 ${endpointSummaries.length} endpoint c\u1EA7n seed.`
61637
- );
61638
- }
61639
- const hypothesisInput = buildHypothesisInput({
61640
- kind: "runtime-data-seed",
61641
- promptVersion: RUNTIME_DATA_SEED_PROMPT_VERSION,
61642
- provider: providerName,
61643
- modelId,
61644
- excerpts,
61645
- endpoints: endpointSummaries.map((e) => ({ httpMethod: e.httpMethod, path: e.path }))
61646
- });
61647
- const inputHash = hypothesisInputHash(hypothesisInput);
61648
- const pinned = options.refreshHypothesis === true ? null : await loadPin(inputHash);
61649
- const pinnedHypothesis = pinned === null ? null : validateRuntimeDataSeedHypothesis(pinned.hypothesis);
61650
- if (pinned !== null && pinnedHypothesis === null) {
61651
- console.error(
61652
- "[data-seed] C\xE2u tr\u1EA3 l\u1EDDi \u0111\xE3 ghim KH\xD4NG qua \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t \u2192 b\u1ECF ghim, h\u1ECFi l\u1EA1i model."
61653
- );
61654
- } else if (pinnedHypothesis !== null) {
61655
- console.error(
61656
- `[data-seed] TR\xDANG ghim ${inputHash.slice(0, 12)} \u2014 d\xF9ng l\u1EA1i c\xE2u tr\u1EA3 l\u1EDDi \u0111\xE3 ghim, KH\xD4NG g\u1ECDi model.`
61657
- );
61658
- }
61659
- const resolution = pinnedHypothesis !== null ? { hypothesis: pinnedHypothesis, outcome: "accepted" } : await resolveRuntimeDataSeedHypothesis(resolver, {
61660
- endpoints: endpointSummaries,
61661
- excerpts
61662
- });
61663
- const { hypothesis, outcome, rejectedShape } = resolution;
61664
- if (hypothesis === null) {
61665
- const why = outcome === "resolver-error" ? "G\u1ECCI PROVIDER TH\u1EA4T B\u1EA0I (m\u1EA1ng/egress/kho\xE1) \u2014 kh\xF4ng ph\u1EA3i model kh\xF4ng t\xECm ra g\xEC; xem d\xF2ng WARN c\u1EE7a resolver ngay tr\xEAn" : outcome === "rejected" ? `model C\xD3 tr\u1EA3 l\u1EDDi nh\u01B0ng KH\xD4NG QUA \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t (sai h\xECnh d\u1EA1ng) \u2014 v\u1EA5n \u0111\u1EC1 schema/prompt, kh\xF4ng ph\u1EA3i m\u1EA1ng. H\xECnh d\u1EA1ng nh\u1EADn \u0111\u01B0\u1EE3c: ${rejectedShape ?? "(kh\xF4ng c\xF3)"}` : "kh\xF4ng c\xF3 \u0111\u1EC1 xu\u1EA5t n\xE0o (resolver t\u1EEB ch\u1ED1i, ho\u1EB7c \u0111ang d\xF9ng resolver r\u1ED7ng)";
61666
- console.error(
61667
- `[data-seed] ${why} \u2192 KH\xD4NG ghi gi\u1EA3 thuy\u1EBFt; lane runtime s\u1EBD ch\u1EA1y \u0111\u01B0\u1EDDng t\u1EA5t \u0111\u1ECBnh (kh\xF4ng gieo d\u1EEF li\u1EC7u).`
61668
- );
61669
- return EXIT.SUCCESS;
61670
- }
61671
- const out = resolve(process.cwd(), options.emitHypothesis);
61672
- const provenance2 = pinned?.provenance ?? stampProvenance({
61673
- input: hypothesisInput,
61674
- hypothesis,
61675
- attempts: resolution.attempts ?? 1
61676
- });
61677
- await writeEnvelopeFile(out, "runtime-data-seed", hypothesis, provenance2);
61678
- if (pinned === null) {
61679
- const saved = await savePin(inputHash, "runtime-data-seed", hypothesis, provenance2);
61680
- if (!saved) {
61681
- console.error(
61682
- "[data-seed] Kh\xF4ng ghi \u0111\u01B0\u1EE3c ghim (cache) \u2192 l\u1EA7n \u0111\xF3ng g\xF3i sau s\u1EBD h\u1ECFi l\u1EA1i model."
61683
- );
61684
- }
61685
- }
61686
- console.error(
61687
- `[data-seed] \u0110\xE3 ghi gi\u1EA3 thuy\u1EBFt \`${hypothesis.scheme}\` (${hypothesis.targets.length} target) ra ${options.emitHypothesis} (ngu\u1ED3n: ${provenance2.provider}/${provenance2.modelId}, ghim ${inputHash.slice(0, 12)}); KH\xD4NG render SQL \u1EDF \u0111\xE2y.`
61688
- );
61689
- return EXIT.SUCCESS;
61690
- }
61691
- if (options.hypothesis !== void 0) {
61692
- const path = resolve(process.cwd(), options.hypothesis);
61693
- let validated = null;
61694
- const read = await readHypothesisFile(path);
61695
- if (!read.ok) {
61696
- console.error(
61697
- `[data-seed] Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c gi\u1EA3 thuy\u1EBFt t\u1EEB ${options.hypothesis} (${read.error}) \u2192 KH\xD4NG render SQL.`
61698
- );
61699
- } else {
61700
- validated = validateRuntimeDataSeedHypothesis(read.result.hypothesis);
61701
- const decision = resolveHypothesisProvenance({
61702
- policy: "warn",
61703
- provenance: read.result.provenance
61704
- });
61705
- console.error(
61706
- `[data-seed] ${describeHypothesisProvenance(read.result.provenance, decision)}`
61707
- );
61708
- if (validated === null) {
61709
- const problem = describeRuntimeDataSeedHypothesisProblem(read.result.hypothesis);
61710
- console.error(
61711
- `[data-seed] Gi\u1EA3 thuy\u1EBFt n\u1EA1p t\u1EEB ${options.hypothesis} KH\xD4NG qua \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t (sai h\xECnh d\u1EA1ng${problem !== null ? `: ${problem}` : ""}) \u2192 KH\xD4NG render SQL.`
61712
- );
61713
- } else {
61714
- console.error(
61715
- `[data-seed] D\xF9ng gi\u1EA3 thuy\u1EBFt \`${validated.scheme}\` \u0111\xE3 gi\u1EA3i s\u1EB5n ngo\xE0i namespace c\xF4 l\u1EADp (kh\xF4ng g\u1ECDi model \u1EDF \u0111\xE2y).`
61716
- );
61717
- }
61718
- }
61719
- if (validated === null) return EXIT.SUCCESS;
61720
- if (validated.scheme === "api-create") {
61721
- console.error(
61722
- "[data-seed] Gi\u1EA3 thuy\u1EBFt `api-create` (seed qua API \u1EE9ng d\u1EE5ng, ADR-0082) kh\xF4ng render b\u1EB1ng SQL \u2014 lane c\u1EE7a n\xF3 l\xE0 `cs assess --emit-tests --data-seed` (suite t\u1EF1 replay create qua MockMvc) \u2192 KH\xD4NG render seed SQL \u1EDF \u0111\xE2y."
61723
- );
61724
- return EXIT.SUCCESS;
61725
- }
61726
- if (validated.scheme !== "sql-insert") {
61727
- console.error(
61728
- "[data-seed] Gi\u1EA3 thuy\u1EBFt `object-put` (seed object-store, ADR-0074) kh\xF4ng render b\u1EB1ng SQL \u2014 lane object-store l\xE0 --derive-object-store-seed \u2192 KH\xD4NG gieo seed \u1EDF lane n\xE0y."
61729
- );
61730
- return EXIT.SUCCESS;
61731
- }
61732
- const auditColumns = detectSeedAuditColumns(javaFiles);
61733
- const enriched = applySeedAuditColumns(validated, auditColumns);
61734
- const addedAuditColumns = seedAuditAddedColumns(validated, enriched);
61735
- if (addedAuditColumns.length > 0) {
61736
- console.error(
61737
- `[data-seed] B\u1ED5 sung ${addedAuditColumns.length} c\u1ED9t audit NOT NULL t\u1EEB entity: ${addedAuditColumns.join(", ")} (raw JDBC INSERT kh\xF4ng qua AuditingEntityListener \u2014 tr\xE1nh ERROR 1364).`
61738
- );
61739
- }
61740
- const dbTier = detectDbTier([
61741
- ...configResult.ok ? configResult.value : [],
61742
- ...buildResult2.ok ? buildResult2.value : []
61743
- ]);
61744
- const dialect = dbTier?.dialect ?? "generic";
61745
- let sql2;
61746
- try {
61747
- sql2 = renderDataSeedSql(enriched, dialect);
61748
- } catch (e) {
61749
- console.error(
61750
- `[data-seed] Render SQL th\u1EA5t b\u1EA1i (${e.message}) \u2192 KH\xD4NG gieo d\u1EEF li\u1EC7u.`
61751
- );
61752
- return EXIT.SUCCESS;
61753
- }
61754
- const renderOut = options.renderSql;
61755
- if (renderOut === void 0) return EXIT.USAGE;
61756
- const out = resolve(process.cwd(), renderOut);
61757
- await mkdir(resolve(out, ".."), { recursive: true });
61758
- await writeFile(out, sql2, "utf8");
61759
- console.error(
61760
- `[data-seed] \u0110\xE3 render ${validated.targets.length} target \u2192 ${renderOut} (dialect: ${dialect}).`
61761
- );
61762
- console.error(`[data-seed] \u0110\u1ED8 L\u1EC6CH: ${runtimeDataSeedDeviationBanner(validated)}`);
61763
- return EXIT.SUCCESS;
61764
- }
61765
- console.error(
61766
- "[data-seed] Ch\u01B0a ch\u1EC9 \u0111\u1ECBnh vi\u1EC7c c\u1EA7n l\xE0m: d\xF9ng --emit-hypothesis (gi\u1EA3i ngo\xE0i pod, k\xE8m --ai) ho\u1EB7c --hypothesis + --render-sql (ti\xEAu th\u1EE5 trong pod)."
61767
- );
61768
- return EXIT.USAGE;
61769
- };
61770
-
61771
- // src/commands/package.command.ts
61772
- init_dist5();
61773
- var HYPOTHESIS_ENTRY = ".code-sentinel/auth-hypothesis.json";
61774
- var DATA_SEED_HYPOTHESIS_ENTRY = ".code-sentinel/data-seed-hypothesis.json";
61775
- var AI_TRIAGE_ENTRY = ".code-sentinel/ai-triage-assessment.json";
61776
- var formatBytes = (n) => n > 1024 * 1024 ? `${(n / (1024 * 1024)).toFixed(1)} MB` : `${(n / 1024).toFixed(0)} KB`;
61777
- var runPackageCommand = async (options) => {
61778
- const targetDirAbs = resolve(
61779
- options.targetDir && options.targetDir.trim() !== "" ? options.targetDir : options.source && options.source.trim() !== "" ? options.source : "."
61780
- );
61781
- const repoRoot = await getRepoRoot(targetDirAbs, { fallbackToCwd: true });
61782
- let modulePath = options.module;
61783
- if (modulePath === void 0 || modulePath.trim() === "") {
61784
- modulePath = relative(repoRoot, targetDirAbs);
61785
- if (modulePath === "") modulePath = ".";
61786
- }
61787
- const plan = planServicePackage(repoRoot, modulePath);
61788
- if (plan.entries.length === 0) {
61789
- process.stderr.write(`cs package: no files found under ${modulePath}
61790
- `);
61791
- return 2;
61792
- }
61793
- let planWithAuth = plan;
61794
- const resolveAuthLocally = options.resolveAuth === true && !options.push;
61795
- const resolveAuthOnServer = options.resolveAuth === true && options.push === true;
61796
- if (resolveAuthOnServer) {
61797
- const loaded = await loadConfig(
61798
- options.config === void 0 ? { cwd: repoRoot } : { cwd: repoRoot, configPath: options.config }
61799
- );
61800
- if (!loaded.ok) {
61801
- console.error(red(`
61802
- L\u1ED7i \u0111\u1ECDc c\u1EA5u h\xECnh: ${loaded.error.message}`));
61803
- return 2;
61804
- }
61805
- const config = loaded.value.config;
61806
- const link = await new FileWorkspaceLinkStore(repoRoot).read();
61807
- if (!link) {
61808
- console.error(
61809
- red(
61810
- "\nD\u1EF1 \xE1n ch\u01B0a \u0111\u01B0\u1EE3c li\xEAn k\u1EBFt (link) v\u1EDBi m\xE1y ch\u1EE7! H\xE3y ch\u1EA1y `cs project link` tr\u01B0\u1EDBc khi d\xF9ng `--push`."
61811
- )
61812
- );
61813
- return 2;
61814
- }
61815
- const serverUrl = link.serverUrl ?? config.dashboard.serverUrl ?? getDefaultDashboardServerUrl();
61816
- let token = config.dashboard.token ?? process.env.CODE_SENTINEL_DASHBOARD_TOKEN;
61817
- if (!token) {
61818
- try {
61819
- const store = createPlatformCredentialStore();
61820
- const credential = await getAuthenticatedCredential({ server: serverUrl, store });
61821
- token = credential.accessToken;
61822
- } catch (e) {
61823
- console.error(
61824
- red(
61825
- `
61826
- Kh\xF4ng th\u1EC3 l\u1EA5y x\xE1c th\u1EF1c Dashboard: ${e instanceof Error ? e.message : String(e)}
61827
- H\xE3y ch\u1EA1y \`cs auth login\`.`
61828
- )
61829
- );
61830
- return 2;
61831
- }
61832
- }
61833
- try {
61834
- const configUrl = `${serverUrl.replace(/\/+$/, "")}/api/projects/${encodeURIComponent(link.projectId)}/review-config`;
61835
- const configRes = await fetch(configUrl, {
61836
- headers: { authorization: `Bearer ${token}` }
61837
- });
61838
- if (configRes.ok) {
61839
- const payload = await configRes.json();
61840
- const config2 = payload.config ?? payload;
61841
- const ai = config2?.ai;
61842
- const provider = ai?.provider ?? config2?.aiProvider ?? "viettel-netmind";
61843
- if (provider && provider !== "none" && provider !== "ollama") {
61844
- const STORED_SECRET_PLACEHOLDER = "${CODE_SENTINEL_STORED_SECRET}";
61845
- const pKey = provider === "viettel-netmind" ? "viettelNetmind" : provider === "openai-compatible" ? "openaiCompatible" : provider === "opencode-go" ? "opencodeGo" : provider;
61846
- const providerConf = typeof ai?.[pKey] === "object" && ai?.[pKey] !== null ? ai[pKey] : {};
61847
- const rawProviderApiKey = typeof providerConf.apiKey === "string" ? providerConf.apiKey.trim() : typeof ai?.apiKey === "string" ? ai.apiKey.trim() : "";
61848
- const aiStr = JSON.stringify(ai ?? {});
61849
- const hasServerSecret = aiStr.includes(STORED_SECRET_PLACEHOLDER) || aiStr.includes("<configured server secret>") || rawProviderApiKey === STORED_SECRET_PLACEHOLDER || rawProviderApiKey === "<configured server secret>" || rawProviderApiKey.startsWith("csenc:v1:");
61850
- const hasExplicitKey = rawProviderApiKey.length > 0 && !hasServerSecret && !/^\$\{[A-Z0-9_]+\}$/.test(rawProviderApiKey);
61851
- if (!hasServerSecret && !hasExplicitKey) {
61852
- const drawerUrl = `${serverUrl.replace(/\/+$/, "")}/runs?project=${encodeURIComponent(link.projectId)}&drawer=pentest`;
61853
- console.error(
61854
- red("\n\u274C [Server] D\u1EF1 \xE1n ch\u01B0a \u0111\u01B0\u1EE3c c\u1EA5u h\xECnh Project AI Key tr\xEAn Web Dashboard.")
61855
- );
61856
- console.error(
61857
- red(
61858
- `\u{1F449} Vui l\xF2ng m\u1EDF drawer Pentest tr\xEAn Web Dashboard \u0111\u1EC3 nh\u1EADp API Key:
61859
- ${drawerUrl}
61860
- `
61861
- )
61862
- );
61863
- console.error(
61864
- red(
61865
- `H\u01B0\u1EDBng d\u1EABn thao t\xE1c:
61866
- 1. M\u1EDF link tr\xEAn (ho\u1EB7c v\xE0o D\u1EF1 \xE1n -> b\u1EA5m n\xFAt "Pentest" \u0111\u1EC3 m\u1EDF drawer "Ki\u1EC3m th\u1EED trong m\xF4i tr\u01B0\u1EDDng c\xF4 l\u1EADp").
61867
- 2. T\u1EA1i m\u1EE5c "Project AI Key (${provider})", nh\u1EADp API Key v\xE0 nh\u1EA5n "L\u01B0u key cho d\u1EF1 \xE1n".
61868
- 3. Sau khi l\u01B0u key, ch\u1EA1y l\u1EA1i l\u1EC7nh \`cs pentest\`.
61869
-
61870
- Ghi ch\xFA: L\u1EC7nh \`cs pentest\` s\u1EED d\u1EE5ng Project AI Key tr\xEAn m\xE1y ch\u1EE7 \u0111\u1EC3 t\u1EF1 \u0111\u1ED9ng th\u1EF1c hi\u1EC7n:
61871
- - Ph\xE2n t\xEDch & gi\u1EA3i quy\u1EBFt c\u01A1 ch\u1EBF x\xE1c th\u1EF1c (Auth Hypothesis)
61872
- - Two-Way AI Triage (lo\u1EA1i b\u1ECF False Positive, t\xECm False Negative)
61873
- - T\u1EA1o d\u1EEF li\u1EC7u m\u1ED3i (Data Seed Hypothesis)
61874
- `
61875
- )
61876
- );
61877
- return 2;
61878
- }
61879
- }
61880
- }
61881
- } catch {
61882
- }
61883
- }
61884
- let hypothesisTmp;
61885
- let triageTmp;
61886
- if (resolveAuthLocally) {
61887
- hypothesisTmp = join(tmpdir(), `cs-auth-hypothesis-${process.pid}-${Date.now()}.json`);
61888
- await runRuntimeAuthSeed({
61889
- source: join(repoRoot, modulePath),
61890
- useAi: true,
61891
- emitHypothesis: hypothesisTmp,
61892
- ...options.refreshHypothesis === true ? { refreshHypothesis: true } : {},
61893
- ...options.config === void 0 ? {} : { config: options.config }
61894
- });
61895
- const newEntries = [...plan.entries];
61896
- if (existsSync(hypothesisTmp)) {
61897
- newEntries.push({ name: HYPOTHESIS_ENTRY, absolutePath: hypothesisTmp });
61898
- } else {
61899
- process.stderr.write(
61900
- `cs package: kh\xF4ng gi\u1EA3i \u0111\u01B0\u1EE3c gi\u1EA3 thuy\u1EBFt x\xE1c th\u1EF1c \u2014 ZIP kh\xF4ng mang gi\u1EA3 thuy\u1EBFt, lane runtime s\u1EBD ch\u1EA1y \u0111\u01B0\u1EDDng t\u1EA5t \u0111\u1ECBnh${String.fromCharCode(10)}`
61901
- );
61902
- }
61903
- planWithAuth = { ...plan, entries: newEntries };
61904
- }
61905
- if (options.resolveAuth === true) {
61906
- triageTmp = join(tmpdir(), `cs-ai-triage-${process.pid}-${Date.now()}.json`);
61907
- await runAiTriageCommand({
61908
- source: join(repoRoot, modulePath),
61909
- reportRoot: repoRoot,
61910
- emitReport: triageTmp,
61911
- twoWay: true,
61912
- ...options.config === void 0 ? {} : { config: options.config }
61913
- });
61914
- if (existsSync(triageTmp)) {
61915
- planWithAuth = {
61916
- ...planWithAuth,
61917
- entries: [...planWithAuth.entries, { name: AI_TRIAGE_ENTRY, absolutePath: triageTmp }]
61918
- };
61919
- } else {
61920
- process.stderr.write(
61921
- "[ai-triage] Kh\xF4ng t\u1EA1o \u0111\u01B0\u1EE3c b\xE1o c\xE1o AI triage; ZIP kh\xF4ng mang k\u1EBFt qu\u1EA3 triage.\n"
61922
- );
61923
- }
61924
- }
61925
- let dataSeedTmp;
61926
- const resolveDataSeedLocally = options.resolveDataSeed === true && !options.push;
61927
- if (resolveDataSeedLocally) {
61928
- dataSeedTmp = join(tmpdir(), `cs-data-seed-${process.pid}-${Date.now()}.json`);
61929
- await runRuntimeDataSeed({
61930
- source: join(repoRoot, modulePath),
61931
- useAi: true,
61932
- emitHypothesis: dataSeedTmp,
61933
- ...options.refreshHypothesis === true ? { refreshHypothesis: true } : {},
61934
- ...options.config === void 0 ? {} : { config: options.config }
61935
- });
61936
- if (existsSync(dataSeedTmp)) {
61937
- planWithAuth = {
61938
- ...planWithAuth,
61939
- entries: [
61940
- ...planWithAuth.entries,
61941
- { name: DATA_SEED_HYPOTHESIS_ENTRY, absolutePath: dataSeedTmp }
61942
- ]
61943
- };
61944
- } else {
61945
- process.stderr.write(
61946
- `cs package: kh\xF4ng gi\u1EA3i \u0111\u01B0\u1EE3c gi\u1EA3 thuy\u1EBFt d\u1EEF li\u1EC7u \u2014 ZIP kh\xF4ng mang data-seed, E1.5 s\u1EBD \u0111\u1ECDc baseline-unreachable th\u1EADt${String.fromCharCode(10)}`
61947
- );
61948
- }
61949
- }
61950
- const outPath = resolve(
61951
- options.out ?? `${basename(plan.modulePath.replace(/\/$/, "")) || "service"}.zip`
61952
- );
61953
- const bytes = writePackageZip(planWithAuth, outPath);
61954
- if (hypothesisTmp !== void 0) rmSync(hypothesisTmp, { force: true });
61955
- if (triageTmp !== void 0) rmSync(triageTmp, { force: true });
61956
- if (dataSeedTmp !== void 0) rmSync(dataSeedTmp, { force: true });
61957
- process.stdout.write(`Packaged ${plan.modulePath} \u2192 ${outPath} (${formatBytes(bytes)})
61958
- `);
61959
- process.stdout.write(` ${planWithAuth.entries.length} files
61960
- `);
61961
- if (plan.parentPoms.length > 0) {
61962
- process.stdout.write(` parent poms: ${plan.parentPoms.join(", ")}
61963
- `);
61964
- }
61965
- if (plan.systemJars.length > 0) {
61966
- process.stdout.write(` declared jars: ${plan.systemJars.join(", ")}
61967
- `);
61968
- }
61969
- if (plan.missingSystemJars.length > 0) {
61970
- process.stdout.write(
61971
- ` \u26A0 declared but NOT in the repo: ${plan.missingSystemJars.join(", ")}
61972
- `
61973
- );
61974
- }
61975
- const report2 = preflightArchive(outPath);
61976
- const decision = classifyPreflight({ ...report2.signals, staticAssessmentCompleted: true });
61977
- if (!decision.decided) {
61978
- process.stdout.write("\n\u2713 preflight: ready to build\n");
61979
- if (options.push) {
61980
- process.stdout.write("\n\u{1F680} \u0110ang \u0111\u1EA9y d\u1EEF li\u1EC7u l\xEAn Dashboard...\n");
61981
- const loaded = await loadConfig(
61982
- options.config === void 0 ? { cwd: repoRoot } : { cwd: repoRoot, configPath: options.config }
61983
- );
61984
- if (!loaded.ok) {
61985
- console.error(red(`
61986
- L\u1ED7i \u0111\u1ECDc c\u1EA5u h\xECnh: ${loaded.error.message}`));
61987
- return 2;
61988
- }
61989
- const config = loaded.value.config;
61990
- const link = await new FileWorkspaceLinkStore(repoRoot).read();
61991
- if (!link) {
61992
- console.error(
61993
- red(
61994
- "\nD\u1EF1 \xE1n ch\u01B0a \u0111\u01B0\u1EE3c li\xEAn k\u1EBFt (link) v\u1EDBi m\xE1y ch\u1EE7! H\xE3y ch\u1EA1y `cs project link` tr\u01B0\u1EDBc khi d\xF9ng `--push`."
61995
- )
61996
- );
61997
- return 2;
61998
- }
61999
- const serverUrl = link.serverUrl ?? config.dashboard.serverUrl ?? getDefaultDashboardServerUrl();
62000
- let token = config.dashboard.token ?? process.env.CODE_SENTINEL_DASHBOARD_TOKEN;
62001
- if (!token) {
62002
- try {
62003
- const store = createPlatformCredentialStore();
62004
- const credential = await getAuthenticatedCredential({ server: serverUrl, store });
62005
- token = credential.accessToken;
62006
- } catch (e) {
62007
- console.error(
62008
- red(
62009
- `
62010
- Kh\xF4ng th\u1EC3 l\u1EA5y x\xE1c th\u1EF1c Dashboard: ${e instanceof Error ? e.message : String(e)}
62011
- H\xE3y ch\u1EA1y \`cs auth login\`.`
62012
- )
62013
- );
62014
- return 2;
62015
- }
62016
- }
62017
- try {
62018
- const url = `${serverUrl.replace(/\/+$/, "")}/api/projects/${encodeURIComponent(link.projectId)}/pentest-requests`;
62019
- const { readFileSync: readFileSync3 } = await import('fs');
62020
- const formData = new FormData();
62021
- formData.append("sourceKind", "archive");
62022
- formData.append("archive", new Blob([readFileSync3(outPath)]), basename(outPath));
62023
- formData.append("useAi", resolveAuthOnServer ? "true" : "false");
62024
- const res = await fetch(url, {
62025
- method: "POST",
62026
- headers: { authorization: `Bearer ${token}` },
62027
- body: formData
62028
- });
62029
- if (!res.ok) {
62030
- const text2 = await res.text().catch(() => "");
62031
- console.error(red(`
62032
- Server t\u1EEB ch\u1ED1i y\xEAu c\u1EA7u (HTTP ${res.status}): ${text2}`));
62033
- return 2;
62034
- }
62035
- const body = await res.json().catch(() => ({}));
62036
- const createdId = body.request?.id ?? body.id;
62037
- console.log(green(`[\u2713] \u0110\u1EA9y th\xE0nh c\xF4ng! \u0110\xE3 t\u1EA1o request ID: ${createdId ?? "unknown"}`));
62038
- console.log(
62039
- `\u{1F517} Link theo d\xF5i: ${serverUrl}/projects/${link.projectId}/pentest-requests${createdId ? `/${createdId}` : ""}`
62040
- );
62041
- if (body.request?.status === "failed" && body.request.failureReason) {
62042
- console.error(red(`
62043
- \u26A0 Y\xEAu c\u1EA7u th\u1EA5t b\u1EA1i: ${body.request.failureReason}`));
62044
- }
62045
- } catch (e) {
62046
- console.error(red(`
62047
- L\u1ED7i m\u1EA1ng khi upload: ${e instanceof Error ? e.message : String(e)}`));
62048
- return 2;
62049
- }
62050
- }
62051
- return 0;
62052
- }
62053
- process.stdout.write(`
62054
- \u2717 preflight still stops at ${decision.tier} \u2014 ${decision.stopReason}
62055
- `);
62056
- for (const evidence17 of report2.evidence.slice(0, 5)) {
62057
- process.stdout.write(` ${evidence17.source}: ${evidence17.verbatim}
62058
- `);
62059
- }
62060
- return 1;
61495
+ return 1;
62061
61496
  };
62062
61497
 
62063
61498
  // src/commands/report.command.ts
@@ -62159,7 +61594,8 @@ var remoteClient = async (server) => {
62159
61594
  });
62160
61595
  };
62161
61596
  var linkedContext = async (path) => {
62162
- const link = await new FileWorkspaceLinkStore(resolve(path ?? process.cwd())).read();
61597
+ const resolvedLink = await findWorkspaceLink(resolve(path ?? process.cwd()));
61598
+ const link = resolvedLink?.link ?? null;
62163
61599
  if (!link)
62164
61600
  throw new Error("This workspace is not linked. Run `cs project` first or pass --project-id.");
62165
61601
  return { server: link.serverUrl, projectId: link.projectId };
@@ -62585,8 +62021,8 @@ var findProjectConfig = async (projectDir) => {
62585
62021
  );
62586
62022
  }
62587
62023
  }
62588
- for (const basename11 of READ_ONLY_BASENAMES) {
62589
- const p = resolve(projectDir, basename11);
62024
+ for (const basename12 of READ_ONLY_BASENAMES) {
62025
+ const p = resolve(projectDir, basename12);
62590
62026
  if (await fileExists3(p)) {
62591
62027
  return err(
62592
62028
  new ConfigInvalidError(
@@ -62716,7 +62152,8 @@ var runRulePull = async (options = {}) => {
62716
62152
  const writeError = options.writeError ?? console.error;
62717
62153
  const root = resolve(options.path ?? process.cwd());
62718
62154
  try {
62719
- const link = await new FileWorkspaceLinkStore(root).read();
62155
+ const resolvedLink = await findWorkspaceLink(root);
62156
+ const link = resolvedLink?.link ?? null;
62720
62157
  if (!link) {
62721
62158
  writeError("Workspace is not linked. Run `cs project link` before pulling Dashboard rules.");
62722
62159
  return EXIT.USAGE;
@@ -63628,11 +63065,287 @@ var runServerRunner = async (options = {}) => {
63628
63065
  return EXIT.SUCCESS;
63629
63066
  };
63630
63067
 
63068
+ // src/commands/runtime-auth-seed.command.ts
63069
+ init_dist6();
63070
+ init_dist2();
63071
+ init_dist5();
63072
+ init_dist();
63073
+ init_composition();
63074
+ init_load();
63075
+ init_exit_codes();
63076
+ init_find_files();
63077
+ var CONFIG_GLOBS = [
63078
+ "**/application*.yml",
63079
+ "**/application*.yaml",
63080
+ "**/application*.properties",
63081
+ "**/bootstrap*.yml",
63082
+ "**/bootstrap*.yaml",
63083
+ "**/bootstrap*.properties"
63084
+ ];
63085
+ var POM_GLOBS = ["**/pom.xml"];
63086
+ var JAVA_GLOBS2 = ["**/*.java"];
63087
+ var EXCLUDES2 = ["**/node_modules/**", "**/dist/**", "**/target/**"];
63088
+ var MAX_EXCERPTS = 40;
63089
+ var AUTH_SOURCE_RE = /(Filter|Interceptor|Security(Config|Configuration)|Authentication|Authoriz|TokenService|TokenProvider|JwtUtil|UserContext|SessionRegistry)/;
63090
+ var AUTH_CLASS_RE = /((Filter|Interceptor|Aspect)$)|^(UserContext|TokenService|TokenProvider|RedisAbstract|RedisKey|SecurityConfig)/;
63091
+ var MAX_CLASS_NAMES = 120;
63092
+ var MAX_SOURCE_EXCERPTS = 12;
63093
+ var simpleClassName2 = (entry) => (entry.split("/").pop() ?? entry).replace(/\.class$/, "");
63094
+ var DEFAULT_REDIS_HOST = "127.0.0.1";
63095
+ var DEFAULT_REDIS_PORT = 6379;
63096
+ var buildEvidence = (configs, bundled, sources, classNames, classConstants = []) => {
63097
+ const relevant = classNames.filter((n) => AUTH_CLASS_RE.test(simpleClassName2(n))).slice(0, MAX_CLASS_NAMES);
63098
+ const out = [];
63099
+ if (relevant.length > 0) {
63100
+ out.push({
63101
+ path: "<declared jars> \u2014 auth-relevant class inventory",
63102
+ content: [
63103
+ "These classes ship inside the jars this project declares. The authentication gate may be",
63104
+ "implemented here rather than in the source tree; name the scheme from these if so.",
63105
+ "",
63106
+ ...relevant
63107
+ ].join(String.fromCharCode(10))
63108
+ });
63109
+ }
63110
+ for (const c of classConstants) {
63111
+ if (c.constants.length === 0) continue;
63112
+ out.push({
63113
+ path: `${c.entry} \u2014 string constants`,
63114
+ content: c.constants.join(String.fromCharCode(10))
63115
+ });
63116
+ }
63117
+ return [...out, ...sources, ...bundled, ...configs].slice(0, MAX_EXCERPTS).map((f) => "path" in f ? f : { path: f.file, content: f.content });
63118
+ };
63119
+ var runRuntimeAuthSeed = async (options) => {
63120
+ if (options.emitHypothesis !== void 0 && options.hypothesis !== void 0) {
63121
+ console.error(
63122
+ "[auth-seed] --emit-hypothesis v\xE0 --hypothesis lo\u1EA1i tr\u1EEB nhau: m\u1ED9t b\xEAn GI\u1EA2I (ch\u1EA1y ngo\xE0i namespace c\xF4 l\u1EADp), m\u1ED9t b\xEAn TI\xCAU TH\u1EE4 (ch\u1EA1y trong pod)."
63123
+ );
63124
+ return EXIT.USAGE;
63125
+ }
63126
+ const source = resolve(process.cwd(), options.source);
63127
+ const configResult = await findFiles({
63128
+ projectRoot: source,
63129
+ include: CONFIG_GLOBS,
63130
+ exclude: EXCLUDES2
63131
+ });
63132
+ if (!configResult.ok) {
63133
+ console.error(`[auth-seed] Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c c\u1EA5u h\xECnh trong ${source} \u2192 kh\xF4ng gieo seed.`);
63134
+ return EXIT.SUCCESS;
63135
+ }
63136
+ const files = configResult.value.map((f) => ({
63137
+ file: f.path,
63138
+ content: f.content
63139
+ }));
63140
+ let dependencyConfigFiles = [];
63141
+ const pomsResult = await findFiles({
63142
+ projectRoot: source,
63143
+ include: POM_GLOBS,
63144
+ exclude: EXCLUDES2
63145
+ });
63146
+ if (pomsResult.ok) {
63147
+ dependencyConfigFiles = collectDependencyConfigFiles(
63148
+ pomsResult.value.map((f) => ({ absolutePath: f.absolutePath, content: f.content }))
63149
+ ).map((f) => ({ file: f.path, content: f.content }));
63150
+ }
63151
+ const javaResult = await findFiles({
63152
+ projectRoot: source,
63153
+ include: JAVA_GLOBS2,
63154
+ exclude: EXCLUDES2
63155
+ });
63156
+ const endpoints = javaResult.ok ? extractHttpEndpoints(javaResult.value).map((e) => ({
63157
+ httpMethod: e.httpMethod,
63158
+ path: e.path
63159
+ })) : [];
63160
+ const authSources = javaResult.ok ? javaResult.value.filter((f) => AUTH_SOURCE_RE.test(f.path) || AUTH_SOURCE_RE.test(f.content)).slice(0, MAX_SOURCE_EXCERPTS).map((f) => ({ file: f.path, content: f.content })) : [];
63161
+ const pomRefs = pomsResult.ok ? pomsResult.value.map((f) => ({ absolutePath: f.absolutePath, content: f.content })) : [];
63162
+ const dependencyJarKeys = collectJwtKeyCandidates(pomRefs);
63163
+ const decodeOnlyEvidence = collectDecodeOnlyEvidence(pomRefs);
63164
+ const dependencyClasses = collectDependencyClassNames(pomRefs);
63165
+ const dependencyConstants = collectDependencyClassConstants(
63166
+ pomRefs,
63167
+ (entry) => AUTH_CLASS_RE.test(simpleClassName2(entry))
63168
+ );
63169
+ const signingKeyAvailable = discoverJwtSigningKeys(files).length > 0 || discoverJwtSigningKeys(dependencyConfigFiles).length > 0 || dependencyJarKeys.length > 0 || decodeOnlyEvidence.length > 0;
63170
+ const excerpts = buildEvidence(
63171
+ files,
63172
+ dependencyConfigFiles,
63173
+ authSources,
63174
+ dependencyClasses,
63175
+ dependencyConstants
63176
+ );
63177
+ const rawPolicy = options.hypothesisProvenance ?? "warn";
63178
+ if (options.hypothesisProvenance !== void 0 && !isProvenancePolicy(rawPolicy)) {
63179
+ console.error(`[auth-seed] --hypothesis-provenance kh\xF4ng h\u1EE3p l\u1EC7 (${rawPolicy}); d\xF9ng 'warn'.`);
63180
+ }
63181
+ const provenancePolicy = isProvenancePolicy(rawPolicy) ? rawPolicy : "warn";
63182
+ let preResolved;
63183
+ if (options.hypothesis !== void 0) {
63184
+ const path = resolve(process.cwd(), options.hypothesis);
63185
+ const read = await readHypothesisFile(path);
63186
+ if (!read.ok) {
63187
+ console.error(
63188
+ `[auth-seed] Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c gi\u1EA3 thuy\u1EBFt t\u1EEB ${options.hypothesis} (${read.error}) \u2192 b\u1ECF.`
63189
+ );
63190
+ preResolved = { hypothesis: null, outcome: "no-proposal" };
63191
+ } else {
63192
+ const validated = validateRuntimeAuthHypothesis(read.result.hypothesis);
63193
+ const { provenance: provenance2 } = read.result;
63194
+ const decision = resolveHypothesisProvenance({
63195
+ policy: provenancePolicy,
63196
+ provenance: provenance2,
63197
+ expectedInputHash: hypothesisInputHash(
63198
+ buildHypothesisInput({
63199
+ kind: "runtime-auth",
63200
+ promptVersion: RUNTIME_AUTH_PROMPT_VERSION,
63201
+ provider: provenance2?.provider ?? "",
63202
+ modelId: provenance2?.modelId ?? "",
63203
+ excerpts,
63204
+ endpoints,
63205
+ signingKeyAvailable
63206
+ })
63207
+ )
63208
+ });
63209
+ console.error(`[auth-seed] ${describeHypothesisProvenance(provenance2, decision)}`);
63210
+ const accepted = decision.useHypothesis ? validated : null;
63211
+ preResolved = {
63212
+ hypothesis: accepted,
63213
+ outcome: accepted === null ? "rejected" : "accepted"
63214
+ };
63215
+ console.error(
63216
+ validated === null ? `[auth-seed] Gi\u1EA3 thuy\u1EBFt n\u1EA1p t\u1EEB ${options.hypothesis} KH\xD4NG qua \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t (sai h\xECnh d\u1EA1ng) \u2192 b\u1ECF.` : accepted === null ? "[auth-seed] Gi\u1EA3 thuy\u1EBFt h\u1EE3p l\u1EC7 nh\u01B0ng L\u1EC6CH ngu\u1ED3n (ch\xEDnh s\xE1ch enforce) \u2192 qu\xE9t kh\xF4ng x\xE1c th\u1EF1c (ADR-0067)." : `[auth-seed] D\xF9ng gi\u1EA3 thuy\u1EBFt \`${validated.scheme}\` \u0111\xE3 gi\u1EA3i s\u1EB5n ngo\xE0i namespace c\xF4 l\u1EADp (kh\xF4ng g\u1ECDi model \u1EDF \u0111\xE2y).`
63217
+ );
63218
+ }
63219
+ }
63220
+ let resolver = createStubRuntimeAuthHypothesisResolver();
63221
+ let providerName = "none";
63222
+ let modelId = "<none>";
63223
+ if (options.useAi === true && preResolved === void 0) {
63224
+ const logger = createLogger({ level: "warn", destination: "stderr" });
63225
+ const config = await loadConfig(
63226
+ options.config === void 0 ? { cwd: source } : { cwd: source, configPath: resolve(process.cwd(), options.config) }
63227
+ );
63228
+ const client = config.ok ? buildAiClient(config.value.config, logger) : null;
63229
+ if (!config.ok) {
63230
+ console.error(
63231
+ `[auth-seed] KH\xD4NG N\u1EA0P \u0110\u01AF\u1EE2C CONFIG (${config.error.message.split(String.fromCharCode(10))[0]}) \u2192 d\xF9ng resolver r\u1ED7ng. \u0110\xE2y l\xE0 l\u1ED7i FILE C\u1EA4U H\xCCNH, kh\xF4ng ph\u1EA3i thi\u1EBFu provider.`
63232
+ );
63233
+ } else if (client === null) {
63234
+ console.error(
63235
+ "[auth-seed] --ai \u0111\u01B0\u1EE3c y\xEAu c\u1EA7u nh\u01B0ng kh\xF4ng c\xF3 provider AI n\xE0o c\u1EA5u h\xECnh \u0111\u01B0\u1EE3c (ai.provider=none ho\u1EB7c thi\u1EBFu key) \u2192 d\xF9ng resolver r\u1ED7ng."
63236
+ );
63237
+ } else {
63238
+ resolver = createRuntimeAuthHypothesisResolver({ client, logger });
63239
+ providerName = client.name;
63240
+ modelId = resolveActiveModel(config.value.config);
63241
+ console.error(`[auth-seed] H\u1ECFi gi\u1EA3 thuy\u1EBFt x\xE1c th\u1EF1c qua ${client.name} (model ${modelId}).`);
63242
+ }
63243
+ }
63244
+ if (options.useAi === true && preResolved === void 0) {
63245
+ const chars = excerpts.reduce((n, e) => n + e.content.length, 0);
63246
+ console.error(`[auth-seed] B\u1EB1ng ch\u1EE9ng: ${excerpts.length} excerpt \xB7 ${chars} k\xFD t\u1EF1.`);
63247
+ }
63248
+ const hypothesisInput = buildHypothesisInput({
63249
+ kind: "runtime-auth",
63250
+ promptVersion: RUNTIME_AUTH_PROMPT_VERSION,
63251
+ provider: providerName,
63252
+ modelId,
63253
+ excerpts,
63254
+ endpoints,
63255
+ signingKeyAvailable
63256
+ });
63257
+ const inputHash = hypothesisInputHash(hypothesisInput);
63258
+ const pinned = preResolved === void 0 && options.refreshHypothesis !== true ? await loadPin(inputHash) : null;
63259
+ const pinnedHypothesis = pinned === null ? null : validateRuntimeAuthHypothesis(pinned.hypothesis);
63260
+ if (pinned !== null && pinnedHypothesis === null) {
63261
+ console.error(
63262
+ "[auth-seed] C\xE2u tr\u1EA3 l\u1EDDi \u0111\xE3 ghim KH\xD4NG qua \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t \u2192 b\u1ECF ghim, h\u1ECFi l\u1EA1i model."
63263
+ );
63264
+ } else if (pinnedHypothesis !== null) {
63265
+ console.error(
63266
+ `[auth-seed] TR\xDANG ghim ${inputHash.slice(0, 12)} \u2014 d\xF9ng l\u1EA1i c\xE2u tr\u1EA3 l\u1EDDi \u0111\xE3 ghim, KH\xD4NG g\u1ECDi model.`
63267
+ );
63268
+ }
63269
+ const resolution = pinnedHypothesis !== null ? { hypothesis: pinnedHypothesis, outcome: "accepted" } : preResolved !== void 0 ? preResolved : await resolveRuntimeAuthHypothesis(resolver, {
63270
+ excerpts,
63271
+ endpoints,
63272
+ signingKeyAvailable
63273
+ });
63274
+ const { hypothesis, outcome, rejectedShape } = resolution;
63275
+ if (hypothesis === null) {
63276
+ const why = outcome === "resolver-error" ? "G\u1ECCI PROVIDER TH\u1EA4T B\u1EA0I (m\u1EA1ng/egress/kho\xE1) \u2014 kh\xF4ng ph\u1EA3i model kh\xF4ng t\xECm ra g\xEC; xem d\xF2ng WARN c\u1EE7a resolver ngay tr\xEAn" : outcome === "rejected" ? `model C\xD3 tr\u1EA3 l\u1EDDi nh\u01B0ng KH\xD4NG QUA \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t (sai h\xECnh d\u1EA1ng) \u2014 v\u1EA5n \u0111\u1EC1 schema/prompt, kh\xF4ng ph\u1EA3i m\u1EA1ng. H\xECnh d\u1EA1ng nh\u1EADn \u0111\u01B0\u1EE3c: ${rejectedShape ?? "(kh\xF4ng c\xF3)"}` : "kh\xF4ng c\xF3 \u0111\u1EC1 xu\u1EA5t n\xE0o (resolver t\u1EEB ch\u1ED1i, ho\u1EB7c \u0111ang d\xF9ng resolver r\u1ED7ng)";
63277
+ console.error(
63278
+ options.emitHypothesis === void 0 ? `[auth-seed] ${why} \u2192 KH\xD4NG gieo seed; qu\xE9t \u1EDF tr\u1EA1ng th\xE1i kh\xF4ng x\xE1c th\u1EF1c (ADR-0067).` : (
63279
+ // No file is written, so downstream "no parameter" means "deterministic path" with no
63280
+ // second way to spell it.
63281
+ `[auth-seed] ${why} \u2192 KH\xD4NG ghi gi\u1EA3 thuy\u1EBFt; lane runtime s\u1EBD ch\u1EA1y \u0111\u01B0\u1EDDng t\u1EA5t \u0111\u1ECBnh.`
63282
+ )
63283
+ );
63284
+ return EXIT.SUCCESS;
63285
+ }
63286
+ if (options.emitHypothesis !== void 0) {
63287
+ const out = resolve(process.cwd(), options.emitHypothesis);
63288
+ const provenance2 = pinned?.provenance ?? stampProvenance({
63289
+ input: hypothesisInput,
63290
+ hypothesis,
63291
+ attempts: resolution.attempts ?? 1
63292
+ });
63293
+ await writeEnvelopeFile(out, "runtime-auth", hypothesis, provenance2);
63294
+ if (pinned === null) {
63295
+ const saved = await savePin(inputHash, "runtime-auth", hypothesis, provenance2);
63296
+ if (!saved) {
63297
+ console.error(
63298
+ "[auth-seed] Kh\xF4ng ghi \u0111\u01B0\u1EE3c ghim (cache) \u2192 l\u1EA7n \u0111\xF3ng g\xF3i sau s\u1EBD h\u1ECFi l\u1EA1i model."
63299
+ );
63300
+ }
63301
+ }
63302
+ console.error(
63303
+ `[auth-seed] \u0110\xE3 ghi gi\u1EA3 thuy\u1EBFt \`${hypothesis.scheme}\` ra ${options.emitHypothesis} (ngu\u1ED3n: ${provenance2.provider}/${provenance2.modelId}, ghim ${inputHash.slice(0, 12)}); KH\xD4NG mint v\xE0 KH\xD4NG gieo seed \u1EDF \u0111\xE2y.`
63304
+ );
63305
+ return EXIT.SUCCESS;
63306
+ }
63307
+ const plan = buildRuntimeAuthSeedPlan(hypothesis, {
63308
+ files,
63309
+ dependencyConfigFiles,
63310
+ dependencyJarKeys,
63311
+ decodeOnlyEvidence
63312
+ });
63313
+ if (plan === null) {
63314
+ console.error(
63315
+ `[auth-seed] C\xF3 gi\u1EA3 thuy\u1EBFt (\`${hypothesis.scheme}\`) nh\u01B0ng kh\xF4ng t\xECm \u0111\u01B0\u1EE3c kho\xE1 k\xFD trong ngu\u1ED3n hay jar khai b\xE1o v\xE0 kh\xF4ng c\xF3 b\u1EB1ng ch\u1EE9ng decode-only \u2192 KH\xD4NG gieo seed. K\xFD b\u1EB1ng kho\xE1 t\u1EF1 ch\u1ECDn s\u1EBD b\u1ECB \u1EE9ng d\u1EE5ng t\u1EEB ch\u1ED1i y nh\u01B0 kh\xF4ng k\xFD, nh\u01B0ng l\u1EA1i TR\xD4NG nh\u01B0 m\u1ED9t phi\xEAn h\u1EE3p l\u1EC7.`
63316
+ );
63317
+ return EXIT.SUCCESS;
63318
+ }
63319
+ const result = await applyRuntimeAuthSeed(plan, {
63320
+ host: options.redisHost ?? DEFAULT_REDIS_HOST,
63321
+ port: options.redisPort ?? DEFAULT_REDIS_PORT,
63322
+ ...options.timeoutMs === void 0 ? {} : { timeoutMs: options.timeoutMs }
63323
+ });
63324
+ if (!result.ok) {
63325
+ for (const f of result.failures) {
63326
+ console.error(`[auth-seed] L\u1EC7nh th\u1EA5t b\u1EA1i: ${f.command} \u2014 ${f.error}`);
63327
+ }
63328
+ console.error(
63329
+ `[auth-seed] Gieo seed KH\xD4NG tr\u1ECDn v\u1EB9n (${result.applied}/${plan.commands.length}) \u2192 KH\xD4NG ph\xE1t token; qu\xE9t \u1EDF tr\u1EA1ng th\xE1i kh\xF4ng x\xE1c th\u1EF1c.`
63330
+ );
63331
+ return EXIT.SUCCESS;
63332
+ }
63333
+ console.error(
63334
+ `[auth-seed] \u0110\xE3 gieo ${result.applied} kho\xE1 state cho scheme \`${hypothesis.scheme}\`.`
63335
+ );
63336
+ console.error(`[auth-seed] \u0110\u1ED8 L\u1EC6CH: ${plan.deviation}`);
63337
+ process.stdout.write(
63338
+ `${plan.credential.value.startsWith("Bearer ") ? plan.credential.value.slice(7) : plan.credential.value}
63339
+ `
63340
+ );
63341
+ return EXIT.SUCCESS;
63342
+ };
63343
+
63631
63344
  // src/commands/runtime-auth-token.command.ts
63632
63345
  init_dist5();
63633
63346
  init_exit_codes();
63634
63347
  init_find_files();
63635
- var CONFIG_GLOBS3 = [
63348
+ var CONFIG_GLOBS2 = [
63636
63349
  "**/application*.yml",
63637
63350
  "**/application*.yaml",
63638
63351
  "**/application*.properties",
@@ -63654,7 +63367,7 @@ var runRuntimeAuthToken = async (options) => {
63654
63367
  const source = resolve(process.cwd(), options.source);
63655
63368
  const filesResult = await findFiles({
63656
63369
  projectRoot: source,
63657
- include: CONFIG_GLOBS3,
63370
+ include: CONFIG_GLOBS2,
63658
63371
  exclude: CONFIG_EXCLUDES
63659
63372
  });
63660
63373
  if (!filesResult.ok) {
@@ -63721,6 +63434,319 @@ var runRuntimeAuthToken = async (options) => {
63721
63434
  return EXIT.SUCCESS;
63722
63435
  };
63723
63436
 
63437
+ // src/commands/runtime-data-seed.command.ts
63438
+ init_dist6();
63439
+ init_dist2();
63440
+ init_dist2();
63441
+ init_dist5();
63442
+ init_dist();
63443
+ init_dist4();
63444
+ init_composition();
63445
+ init_load();
63446
+ init_exit_codes();
63447
+ init_find_files();
63448
+ var CONFIG_GLOBS3 = [
63449
+ "**/application*.yml",
63450
+ "**/application*.yaml",
63451
+ "**/application*.properties",
63452
+ "**/bootstrap*.yml",
63453
+ "**/bootstrap*.yaml",
63454
+ "**/bootstrap*.properties"
63455
+ ];
63456
+ var DB_BUILD_GLOBS2 = ["**/pom.xml", "**/build.gradle", "**/build.gradle.kts"];
63457
+ var JAVA_GLOBS3 = ["**/*.java"];
63458
+ var SCHEMA_GLOBS = [
63459
+ "**/liquibase/**",
63460
+ "**/flyway/**",
63461
+ "**/db/migration/**",
63462
+ "**/*changelog*.xml",
63463
+ "**/schema.sql",
63464
+ "**/data.sql",
63465
+ "**/import.sql"
63466
+ ];
63467
+ var EXCLUDES3 = ["**/node_modules/**", "**/dist/**", "**/target/**"];
63468
+ var ENV_SEED_GLOBS = ["**/.env", "**/*.env"];
63469
+ var MAX_ENV_FILE_BYTES = 1024 * 1024;
63470
+ var MAX_EXCERPTS2 = 40;
63471
+ var ENTITY_RE = /@(Entity|Table)\b/;
63472
+ var buildDataSeedEvidence = (schemaFiles, entityFiles, configs) => [...schemaFiles, ...entityFiles, ...configs].slice(0, MAX_EXCERPTS2);
63473
+ var readEnvSeedFiles = async (root) => {
63474
+ try {
63475
+ const paths = await glob([...ENV_SEED_GLOBS], {
63476
+ cwd: root,
63477
+ ignore: [...EXCLUDES3, "**/.git/**"],
63478
+ onlyFiles: true,
63479
+ dot: true
63480
+ });
63481
+ const files = [];
63482
+ for (const p of paths.sort()) {
63483
+ let content;
63484
+ try {
63485
+ content = await readFile(resolve(root, p), "utf8");
63486
+ } catch {
63487
+ continue;
63488
+ }
63489
+ if (Buffer.byteLength(content, "utf8") > MAX_ENV_FILE_BYTES) continue;
63490
+ const abs = resolve(root, p);
63491
+ files.push({
63492
+ path: toPosix(p),
63493
+ absolutePath: abs,
63494
+ language: languageFromPath(p) ?? "text",
63495
+ content,
63496
+ hash: sha256(content),
63497
+ size: Buffer.byteLength(content, "utf8")
63498
+ });
63499
+ }
63500
+ return files;
63501
+ } catch {
63502
+ return [];
63503
+ }
63504
+ };
63505
+ var runRuntimeDataSeed = async (options) => {
63506
+ if (options.emitHypothesis !== void 0 && options.hypothesis !== void 0) {
63507
+ console.error(
63508
+ "[data-seed] --emit-hypothesis v\xE0 --hypothesis lo\u1EA1i tr\u1EEB nhau: m\u1ED9t b\xEAn GI\u1EA2I (ch\u1EA1y ngo\xE0i namespace c\xF4 l\u1EADp, n\u01A1i c\xF3 egress AI), m\u1ED9t b\xEAn TI\xCAU TH\u1EE4 (ch\u1EA1y trong pod, render SQL)."
63509
+ );
63510
+ return EXIT.USAGE;
63511
+ }
63512
+ if (options.renderSql !== void 0 && options.hypothesis === void 0) {
63513
+ console.error("[data-seed] --render-sql c\u1EA7n --hypothesis (lane ti\xEAu th\u1EE5 trong pod).");
63514
+ return EXIT.USAGE;
63515
+ }
63516
+ if (options.deriveObjectStoreSeed !== void 0 && (options.emitHypothesis !== void 0 || options.hypothesis !== void 0)) {
63517
+ console.error(
63518
+ "[data-seed] --derive-object-store-seed l\xE0 lane \u0111\u1ED9c l\u1EADp (kh\xF4ng g\u1ECDi model, kh\xF4ng c\u1EA7n gi\u1EA3 thuy\u1EBFt) v\xE0 lo\u1EA1i tr\u1EEB --emit-hypothesis / --hypothesis."
63519
+ );
63520
+ return EXIT.USAGE;
63521
+ }
63522
+ const source = resolve(process.cwd(), options.source);
63523
+ const configResult = await findFiles({
63524
+ projectRoot: source,
63525
+ include: CONFIG_GLOBS3,
63526
+ exclude: EXCLUDES3
63527
+ });
63528
+ const configs = configResult.ok ? configResult.value.map((f) => ({ path: f.path, content: f.content })) : [];
63529
+ const buildResult2 = await findFiles({
63530
+ projectRoot: source,
63531
+ include: DB_BUILD_GLOBS2,
63532
+ exclude: EXCLUDES3
63533
+ });
63534
+ const javaResult = await findFiles({
63535
+ projectRoot: source,
63536
+ include: JAVA_GLOBS3,
63537
+ exclude: EXCLUDES3
63538
+ });
63539
+ const javaFiles = javaResult.ok ? javaResult.value : [];
63540
+ const endpoints = javaResult.ok ? extractHttpEndpoints(javaResult.value) : [];
63541
+ if (options.deriveObjectStoreSeed !== void 0) {
63542
+ const poms = buildResult2.ok ? buildResult2.value : [];
63543
+ const envFiles = await readEnvSeedFiles(source);
63544
+ const jarConfigs = collectDependencyConfigFiles(poms);
63545
+ const derivation = deriveObjectStoreSeedTargets([
63546
+ ...configResult.ok ? configResult.value : [],
63547
+ ...envFiles,
63548
+ ...jarConfigs
63549
+ ]);
63550
+ if (derivation.targets.length === 0) {
63551
+ console.error(
63552
+ "[data-seed] KH\xD4NG derive \u0111\u01B0\u1EE3c bucket object-store n\xE0o t\u1EEB source (config/jar/.env) \u2192 KH\xD4NG ghi file TSV (fail-closed)."
63553
+ );
63554
+ return EXIT.SUCCESS;
63555
+ }
63556
+ const validated = validateRuntimeDataSeedHypothesis({
63557
+ scheme: "object-put",
63558
+ targets: derivation.targets,
63559
+ evidence: derivation.evidence
63560
+ });
63561
+ if (validated === null || validated.scheme !== "object-put") {
63562
+ console.error(
63563
+ "[data-seed] K\u1EBFt qu\u1EA3 derive KH\xD4NG qua \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t \u2192 KH\xD4NG ghi file TSV (fail-closed)."
63564
+ );
63565
+ return EXIT.SUCCESS;
63566
+ }
63567
+ const tsv = renderObjectStoreSeedTsv(validated);
63568
+ const out = resolve(process.cwd(), options.deriveObjectStoreSeed);
63569
+ await mkdir(resolve(out, ".."), { recursive: true });
63570
+ await writeFile(out, tsv, "utf8");
63571
+ console.error(
63572
+ `[data-seed] \u0110\xE3 derive ${validated.targets.length} bucket object-store (baseline key \`1\`) \u2192 ${options.deriveObjectStoreSeed}.`
63573
+ );
63574
+ return EXIT.SUCCESS;
63575
+ }
63576
+ if (options.emitHypothesis !== void 0) {
63577
+ let resolver = createStubRuntimeDataSeedResolver();
63578
+ let providerName = "none";
63579
+ let modelId = "<none>";
63580
+ if (options.useAi === true) {
63581
+ const logger = createLogger({ level: "warn", destination: "stderr" });
63582
+ const config = await loadConfig(
63583
+ options.config === void 0 ? { cwd: source } : { cwd: source, configPath: resolve(process.cwd(), options.config) }
63584
+ );
63585
+ const client = config.ok ? buildAiClient(config.value.config, logger) : null;
63586
+ if (!config.ok) {
63587
+ console.error(
63588
+ `[data-seed] KH\xD4NG N\u1EA0P \u0110\u01AF\u1EE2C CONFIG (${config.error.message.split(String.fromCharCode(10))[0]}) \u2192 d\xF9ng resolver r\u1ED7ng. \u0110\xE2y l\xE0 l\u1ED7i FILE C\u1EA4U H\xCCNH, kh\xF4ng ph\u1EA3i thi\u1EBFu provider.`
63589
+ );
63590
+ } else if (client === null) {
63591
+ console.error(
63592
+ "\u26A0\uFE0F [Local] Kh\xF4ng t\xECm th\u1EA5y `LLM_API_KEY` \u1EDF file `.env` t\u1EA1i m\xE1y c\u1EE7a b\u1EA1n. B\u1ECF qua b\u01B0\u1EDBc t\u1EA1o d\u1EEF li\u1EC7u gi\u1EA3 l\u1EADp (Data-seed). (N\u1EBFu \u0111\u1EA9y l\xEAn Server, Server s\u1EBD t\u1EF1 d\xF9ng Project AI Key c\u1EE7a n\xF3)."
63593
+ );
63594
+ } else {
63595
+ const resolverOptions = { client, logger };
63596
+ resolver = createRuntimeDataSeedResolver(resolverOptions);
63597
+ providerName = client.name;
63598
+ modelId = resolveActiveModel(config.value.config);
63599
+ console.error(`[data-seed] H\u1ECFi gi\u1EA3 thuy\u1EBFt d\u1EEF li\u1EC7u qua ${client.name} (model ${modelId}).`);
63600
+ }
63601
+ }
63602
+ const manifest = buildReachabilityManifest(endpoints, {});
63603
+ const endpointSummaries = dataSeedEndpointSummaries(manifest.entries);
63604
+ const schemaResult = await findFiles({
63605
+ projectRoot: source,
63606
+ include: SCHEMA_GLOBS,
63607
+ exclude: EXCLUDES3
63608
+ });
63609
+ const schemaFiles = schemaResult.ok ? schemaResult.value.map((f) => ({ path: f.path, content: f.content })) : [];
63610
+ const entityFiles = javaFiles.filter((f) => ENTITY_RE.test(f.content)).map((f) => ({ path: f.path, content: f.content }));
63611
+ const excerpts = buildDataSeedEvidence(schemaFiles, entityFiles, configs);
63612
+ if (options.useAi === true) {
63613
+ const chars = excerpts.reduce((n, e) => n + e.content.length, 0);
63614
+ console.error(
63615
+ `[data-seed] B\u1EB1ng ch\u1EE9ng: ${excerpts.length} excerpt \xB7 ${chars} k\xFD t\u1EF1 \xB7 ${endpointSummaries.length} endpoint c\u1EA7n seed.`
63616
+ );
63617
+ }
63618
+ const hypothesisInput = buildHypothesisInput({
63619
+ kind: "runtime-data-seed",
63620
+ promptVersion: RUNTIME_DATA_SEED_PROMPT_VERSION,
63621
+ provider: providerName,
63622
+ modelId,
63623
+ excerpts,
63624
+ endpoints: endpointSummaries.map((e) => ({ httpMethod: e.httpMethod, path: e.path }))
63625
+ });
63626
+ const inputHash = hypothesisInputHash(hypothesisInput);
63627
+ const pinned = options.refreshHypothesis === true ? null : await loadPin(inputHash);
63628
+ const pinnedHypothesis = pinned === null ? null : validateRuntimeDataSeedHypothesis(pinned.hypothesis);
63629
+ if (pinned !== null && pinnedHypothesis === null) {
63630
+ console.error(
63631
+ "[data-seed] C\xE2u tr\u1EA3 l\u1EDDi \u0111\xE3 ghim KH\xD4NG qua \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t \u2192 b\u1ECF ghim, h\u1ECFi l\u1EA1i model."
63632
+ );
63633
+ } else if (pinnedHypothesis !== null) {
63634
+ console.error(
63635
+ `[data-seed] TR\xDANG ghim ${inputHash.slice(0, 12)} \u2014 d\xF9ng l\u1EA1i c\xE2u tr\u1EA3 l\u1EDDi \u0111\xE3 ghim, KH\xD4NG g\u1ECDi model.`
63636
+ );
63637
+ }
63638
+ const resolution = pinnedHypothesis !== null ? { hypothesis: pinnedHypothesis, outcome: "accepted" } : await resolveRuntimeDataSeedHypothesis(resolver, {
63639
+ endpoints: endpointSummaries,
63640
+ excerpts
63641
+ });
63642
+ const { hypothesis, outcome, rejectedShape } = resolution;
63643
+ if (hypothesis === null) {
63644
+ const why = outcome === "resolver-error" ? "G\u1ECCI PROVIDER TH\u1EA4T B\u1EA0I (m\u1EA1ng/egress/kho\xE1) \u2014 kh\xF4ng ph\u1EA3i model kh\xF4ng t\xECm ra g\xEC; xem d\xF2ng WARN c\u1EE7a resolver ngay tr\xEAn" : outcome === "rejected" ? `model C\xD3 tr\u1EA3 l\u1EDDi nh\u01B0ng KH\xD4NG QUA \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t (sai h\xECnh d\u1EA1ng) \u2014 v\u1EA5n \u0111\u1EC1 schema/prompt, kh\xF4ng ph\u1EA3i m\u1EA1ng. H\xECnh d\u1EA1ng nh\u1EADn \u0111\u01B0\u1EE3c: ${rejectedShape ?? "(kh\xF4ng c\xF3)"}` : "kh\xF4ng c\xF3 \u0111\u1EC1 xu\u1EA5t n\xE0o (resolver t\u1EEB ch\u1ED1i, ho\u1EB7c \u0111ang d\xF9ng resolver r\u1ED7ng)";
63645
+ console.error(
63646
+ `[data-seed] ${why} \u2192 KH\xD4NG ghi gi\u1EA3 thuy\u1EBFt; lane runtime s\u1EBD ch\u1EA1y \u0111\u01B0\u1EDDng t\u1EA5t \u0111\u1ECBnh (kh\xF4ng gieo d\u1EEF li\u1EC7u).`
63647
+ );
63648
+ return EXIT.SUCCESS;
63649
+ }
63650
+ const out = resolve(process.cwd(), options.emitHypothesis);
63651
+ const provenance2 = pinned?.provenance ?? stampProvenance({
63652
+ input: hypothesisInput,
63653
+ hypothesis,
63654
+ attempts: resolution.attempts ?? 1
63655
+ });
63656
+ await writeEnvelopeFile(out, "runtime-data-seed", hypothesis, provenance2);
63657
+ if (pinned === null) {
63658
+ const saved = await savePin(inputHash, "runtime-data-seed", hypothesis, provenance2);
63659
+ if (!saved) {
63660
+ console.error(
63661
+ "[data-seed] Kh\xF4ng ghi \u0111\u01B0\u1EE3c ghim (cache) \u2192 l\u1EA7n \u0111\xF3ng g\xF3i sau s\u1EBD h\u1ECFi l\u1EA1i model."
63662
+ );
63663
+ }
63664
+ }
63665
+ console.error(
63666
+ `[data-seed] \u0110\xE3 ghi gi\u1EA3 thuy\u1EBFt \`${hypothesis.scheme}\` (${hypothesis.targets.length} target) ra ${options.emitHypothesis} (ngu\u1ED3n: ${provenance2.provider}/${provenance2.modelId}, ghim ${inputHash.slice(0, 12)}); KH\xD4NG render SQL \u1EDF \u0111\xE2y.`
63667
+ );
63668
+ return EXIT.SUCCESS;
63669
+ }
63670
+ if (options.hypothesis !== void 0) {
63671
+ const path = resolve(process.cwd(), options.hypothesis);
63672
+ let validated = null;
63673
+ const read = await readHypothesisFile(path);
63674
+ if (!read.ok) {
63675
+ console.error(
63676
+ `[data-seed] Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c gi\u1EA3 thuy\u1EBFt t\u1EEB ${options.hypothesis} (${read.error}) \u2192 KH\xD4NG render SQL.`
63677
+ );
63678
+ } else {
63679
+ validated = validateRuntimeDataSeedHypothesis(read.result.hypothesis);
63680
+ const decision = resolveHypothesisProvenance({
63681
+ policy: "warn",
63682
+ provenance: read.result.provenance
63683
+ });
63684
+ console.error(
63685
+ `[data-seed] ${describeHypothesisProvenance(read.result.provenance, decision)}`
63686
+ );
63687
+ if (validated === null) {
63688
+ const problem = describeRuntimeDataSeedHypothesisProblem(read.result.hypothesis);
63689
+ console.error(
63690
+ `[data-seed] Gi\u1EA3 thuy\u1EBFt n\u1EA1p t\u1EEB ${options.hypothesis} KH\xD4NG qua \u0111\u01B0\u1EE3c ki\u1EC3m duy\u1EC7t (sai h\xECnh d\u1EA1ng${problem !== null ? `: ${problem}` : ""}) \u2192 KH\xD4NG render SQL.`
63691
+ );
63692
+ } else {
63693
+ console.error(
63694
+ `[data-seed] D\xF9ng gi\u1EA3 thuy\u1EBFt \`${validated.scheme}\` \u0111\xE3 gi\u1EA3i s\u1EB5n ngo\xE0i namespace c\xF4 l\u1EADp (kh\xF4ng g\u1ECDi model \u1EDF \u0111\xE2y).`
63695
+ );
63696
+ }
63697
+ }
63698
+ if (validated === null) return EXIT.SUCCESS;
63699
+ if (validated.scheme === "api-create") {
63700
+ console.error(
63701
+ "[data-seed] Gi\u1EA3 thuy\u1EBFt `api-create` (seed qua API \u1EE9ng d\u1EE5ng, ADR-0082) kh\xF4ng render b\u1EB1ng SQL \u2014 lane c\u1EE7a n\xF3 l\xE0 `cs assess --emit-tests --data-seed` (suite t\u1EF1 replay create qua MockMvc) \u2192 KH\xD4NG render seed SQL \u1EDF \u0111\xE2y."
63702
+ );
63703
+ return EXIT.SUCCESS;
63704
+ }
63705
+ if (validated.scheme !== "sql-insert") {
63706
+ console.error(
63707
+ "[data-seed] Gi\u1EA3 thuy\u1EBFt `object-put` (seed object-store, ADR-0074) kh\xF4ng render b\u1EB1ng SQL \u2014 lane object-store l\xE0 --derive-object-store-seed \u2192 KH\xD4NG gieo seed \u1EDF lane n\xE0y."
63708
+ );
63709
+ return EXIT.SUCCESS;
63710
+ }
63711
+ const auditColumns = detectSeedAuditColumns(javaFiles);
63712
+ const enriched = applySeedAuditColumns(validated, auditColumns);
63713
+ const addedAuditColumns = seedAuditAddedColumns(validated, enriched);
63714
+ if (addedAuditColumns.length > 0) {
63715
+ console.error(
63716
+ `[data-seed] B\u1ED5 sung ${addedAuditColumns.length} c\u1ED9t audit NOT NULL t\u1EEB entity: ${addedAuditColumns.join(", ")} (raw JDBC INSERT kh\xF4ng qua AuditingEntityListener \u2014 tr\xE1nh ERROR 1364).`
63717
+ );
63718
+ }
63719
+ const dbTier = detectDbTier([
63720
+ ...configResult.ok ? configResult.value : [],
63721
+ ...buildResult2.ok ? buildResult2.value : []
63722
+ ]);
63723
+ const dialect = dbTier?.dialect ?? "generic";
63724
+ let sql2;
63725
+ try {
63726
+ sql2 = renderDataSeedSql(enriched, dialect);
63727
+ } catch (e) {
63728
+ console.error(
63729
+ `[data-seed] Render SQL th\u1EA5t b\u1EA1i (${e.message}) \u2192 KH\xD4NG gieo d\u1EEF li\u1EC7u.`
63730
+ );
63731
+ return EXIT.SUCCESS;
63732
+ }
63733
+ const renderOut = options.renderSql;
63734
+ if (renderOut === void 0) return EXIT.USAGE;
63735
+ const out = resolve(process.cwd(), renderOut);
63736
+ await mkdir(resolve(out, ".."), { recursive: true });
63737
+ await writeFile(out, sql2, "utf8");
63738
+ console.error(
63739
+ `[data-seed] \u0110\xE3 render ${validated.targets.length} target \u2192 ${renderOut} (dialect: ${dialect}).`
63740
+ );
63741
+ console.error(`[data-seed] \u0110\u1ED8 L\u1EC6CH: ${runtimeDataSeedDeviationBanner(validated)}`);
63742
+ return EXIT.SUCCESS;
63743
+ }
63744
+ console.error(
63745
+ "[data-seed] Ch\u01B0a ch\u1EC9 \u0111\u1ECBnh vi\u1EC7c c\u1EA7n l\xE0m: d\xF9ng --emit-hypothesis (gi\u1EA3i ngo\xE0i pod, k\xE8m --ai) ho\u1EB7c --hypothesis + --render-sql (ti\xEAu th\u1EE5 trong pod)."
63746
+ );
63747
+ return EXIT.USAGE;
63748
+ };
63749
+
63724
63750
  // src/commands/runtime-outcome.command.ts
63725
63751
  init_dist2();
63726
63752
  init_dist5();
@@ -65479,7 +65505,9 @@ var buildProgram = () => {
65479
65505
  ...typeof opts.deriveObjectStoreSeed === "string" && opts.deriveObjectStoreSeed.length > 0 ? { deriveObjectStoreSeed: opts.deriveObjectStoreSeed } : {}
65480
65506
  });
65481
65507
  });
65482
- program.command("pentest [targetDir]").description("\u0110\xF3ng g\xF3i, gi\u1EA3i quy\u1EBFt x\xE1c th\u1EF1c b\u1EB1ng AI v\xE0 \u0111\u1EA9y m\xE3 ngu\u1ED3n l\xEAn Server Pentest").addOption(new Option("--source <dir>", "th\u01B0 m\u1EE5c g\u1ED1c repository").hideHelp()).addOption(
65508
+ program.command("pentest [targetDir]").description(
65509
+ "\u0110\xF3ng g\xF3i m\xE3 ngu\u1ED3n v\xE0 \u0111\u1EA9y l\xEAn Server Pentest (AI Triage & Auth th\u1EF1c thi tr\xEAn server)"
65510
+ ).addOption(new Option("--source <dir>", "th\u01B0 m\u1EE5c g\u1ED1c repository").hideHelp()).addOption(
65483
65511
  new Option(
65484
65512
  "--module <path>",
65485
65513
  "module c\u1EA7n \u0111\xF3ng g\xF3i, \u0111\u01B0\u1EDDng d\u1EABn t\u01B0\u01A1ng \u0111\u1ED1i so v\u1EDBi g\u1ED1c repo"
@@ -65490,14 +65518,14 @@ var buildProgram = () => {
65490
65518
  ...options,
65491
65519
  source: options.source ?? ".",
65492
65520
  targetDir,
65493
- resolveAuth: true,
65494
- resolveDataSeed: true,
65495
65521
  push: true
65496
65522
  // Always push by default for pentest
65497
65523
  });
65498
65524
  }
65499
65525
  );
65500
- program.command("package [targetDir]").description("\u0110\xF3ng g\xF3i M\u1ED8T service (k\xE8m parent pom + jar khai b\xE1o) th\xE0nh ZIP, c\xF3 t\u1EF1 ki\u1EC3m").addOption(new Option("--source <dir>", "th\u01B0 m\u1EE5c g\u1ED1c repository").hideHelp()).addOption(
65526
+ program.command("package [targetDir]").description(
65527
+ "\u0110\xF3ng g\xF3i M\u1ED8T service (k\xE8m parent pom + jar khai b\xE1o) th\xE0nh ZIP thu\u1EA7n t\xFAy, c\xF3 t\u1EF1 ki\u1EC3m"
65528
+ ).addOption(new Option("--source <dir>", "th\u01B0 m\u1EE5c g\u1ED1c repository").hideHelp()).addOption(
65501
65529
  new Option(
65502
65530
  "--module <path>",
65503
65531
  "module c\u1EA7n \u0111\xF3ng g\xF3i, \u0111\u01B0\u1EDDng d\u1EABn t\u01B0\u01A1ng \u0111\u1ED1i so v\u1EDBi g\u1ED1c repo"