@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/bin.js CHANGED
@@ -6,7 +6,7 @@ import { randomBytes, createCipheriv, createDecipheriv, createHash, randomUUID,
6
6
  import * as sp2 from 'path';
7
7
  import { resolve, join, dirname, relative, basename, sep, isAbsolute, extname, posix, normalize } from 'path';
8
8
  import * as nativeFs from 'fs';
9
- import { existsSync, readFileSync, rmSync, constants, statSync, stat as stat$1, realpathSync, realpath, readdirSync, readdir as readdir$1, unwatchFile, watchFile, watch as watch$1, writeFileSync, openSync, fstatSync, closeSync, readSync, mkdirSync } from 'fs';
9
+ import { existsSync, readFileSync, constants, statSync, stat as stat$1, realpathSync, realpath, readdirSync, readdir as readdir$1, unwatchFile, watchFile, watch as watch$1, writeFileSync, openSync, fstatSync, closeSync, readSync, mkdirSync } 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';
@@ -20,11 +20,11 @@ import { generateText } from 'ai';
20
20
  import { type, tmpdir, homedir, totalmem } from 'os';
21
21
  import { cosmiconfig } from 'cosmiconfig';
22
22
  import { stringify, parse as parse$1 } 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 { password, confirm, input, select } 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(
@@ -48938,11 +49063,29 @@ var FileWorkspaceLinkStore = class {
48938
49063
  constructor(root = process.cwd()) {
48939
49064
  this.#filePath = join(resolve(root), ".code-sentinel", stateFileName);
48940
49065
  }
49066
+ get filePath() {
49067
+ return this.#filePath;
49068
+ }
48941
49069
  async read() {
48942
49070
  try {
48943
- return parseLink(JSON.parse(await readFile(this.#filePath, "utf8")));
48944
- } catch {
48945
- return null;
49071
+ const content = await readFile(this.#filePath, "utf8");
49072
+ let parsedJson;
49073
+ try {
49074
+ parsedJson = JSON.parse(content);
49075
+ } catch (err2) {
49076
+ const msg = err2 instanceof Error ? err2.message : String(err2);
49077
+ throw new Error(`Workspace link state at ${this.#filePath} is invalid JSON: ${msg}`);
49078
+ }
49079
+ const parsed = parseLink(parsedJson);
49080
+ if (!parsed) {
49081
+ throw new Error(`Workspace link state at ${this.#filePath} is invalid or unsafe.`);
49082
+ }
49083
+ return parsed;
49084
+ } catch (error) {
49085
+ if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
49086
+ return null;
49087
+ }
49088
+ throw error;
48946
49089
  }
48947
49090
  }
48948
49091
  async write(link) {
@@ -48962,6 +49105,33 @@ var FileWorkspaceLinkStore = class {
48962
49105
  await rm4(this.#filePath, { force: true });
48963
49106
  }
48964
49107
  };
49108
+ var findWorkspaceLink = async (startDir) => {
49109
+ const { getRepoRoot: getRepoRoot2 } = await Promise.resolve().then(() => (init_git_filter(), git_filter_exports));
49110
+ let boundary = startDir;
49111
+ try {
49112
+ boundary = await getRepoRoot2(startDir, { fallbackToCwd: true });
49113
+ } catch {
49114
+ }
49115
+ let currentDir = resolve(startDir);
49116
+ const boundaryDir = resolve(boundary);
49117
+ while (true) {
49118
+ const store = new FileWorkspaceLinkStore(currentDir);
49119
+ const link = await store.read();
49120
+ if (link) {
49121
+ return {
49122
+ link,
49123
+ root: currentDir,
49124
+ filePath: store.filePath,
49125
+ store
49126
+ };
49127
+ }
49128
+ if (currentDir === boundaryDir || currentDir === dirname(currentDir)) {
49129
+ break;
49130
+ }
49131
+ currentDir = dirname(currentDir);
49132
+ }
49133
+ return null;
49134
+ };
48965
49135
 
48966
49136
  // src/commands/pentest-verify-io.ts
48967
49137
  init_dist5();
@@ -49649,8 +49819,11 @@ var runAssess = async (options, deps = {}) => {
49649
49819
  const match = triageResults.find(
49650
49820
  (r) => r.file === finding.file && r.category === category && !r.isFalseNegativeCandidate
49651
49821
  );
49652
- if (match && !match.vulnerable) {
49653
- return false;
49822
+ if (match) {
49823
+ const isExplicitlySafe = match.status === "safe" || match.status === void 0 && !match.vulnerable && typeof match.reason === "string" && !match.reason.startsWith("L\u1ED7i") && !match.reason.startsWith("LLM");
49824
+ if (isExplicitlySafe) {
49825
+ return false;
49826
+ }
49654
49827
  }
49655
49828
  return true;
49656
49829
  });
@@ -49999,7 +50172,8 @@ var runAssess = async (options, deps = {}) => {
49999
50172
  }
50000
50173
  }
50001
50174
  if (options.push === true) {
50002
- const link = await new FileWorkspaceLinkStore(target).read();
50175
+ const resolvedLink = await findWorkspaceLink(target);
50176
+ const link = resolvedLink?.link ?? null;
50003
50177
  if (!link) {
50004
50178
  console.error(
50005
50179
  red(
@@ -50743,11 +50917,11 @@ ${subject}`));
50743
50917
  };
50744
50918
 
50745
50919
  // src/commands/auth.command.ts
50746
- var execFile2 = promisify(execFile$1);
50920
+ var execFile3 = promisify(execFile$1);
50747
50921
  var openBrowser = async (url) => {
50748
- if (process.platform === "darwin") await execFile2("open", [url]);
50749
- else if (process.platform === "win32") await execFile2("cmd", ["/c", "start", "", url]);
50750
- else await execFile2("xdg-open", [url]);
50922
+ if (process.platform === "darwin") await execFile3("open", [url]);
50923
+ else if (process.platform === "win32") await execFile3("cmd", ["/c", "start", "", url]);
50924
+ else await execFile3("xdg-open", [url]);
50751
50925
  };
50752
50926
  var credentialStore = () => createPlatformCredentialStore();
50753
50927
  var sleep2 = (milliseconds) => new Promise((resolve55) => setTimeout(resolve55, milliseconds));
@@ -50908,7 +51082,8 @@ var authenticatedClient = async (server, store) => {
50908
51082
  };
50909
51083
  var projectIdFor = async (path, projectId) => {
50910
51084
  if (projectId) return projectId;
50911
- const link = await new FileWorkspaceLinkStore(path).read();
51085
+ const resolvedLink = await findWorkspaceLink(path ?? process.cwd());
51086
+ const link = resolvedLink?.link ?? null;
50912
51087
  if (!link)
50913
51088
  throw new Error("This workspace is not linked. Run `cs project` first or pass --project-id.");
50914
51089
  return link.projectId;
@@ -51385,76 +51560,8 @@ var createFindingBatchPublisher = (options) => {
51385
51560
  };
51386
51561
  };
51387
51562
 
51388
- // src/git-filter.ts
51389
- init_dist();
51390
- var execFileAsync = promisify(execFile$1);
51391
- var runGit = async (args, cwd) => {
51392
- const { stdout } = await execFileAsync("git", [...args], {
51393
- cwd,
51394
- encoding: "utf8",
51395
- // Allow up to 16 MiB of output — should be plenty for a path list.
51396
- maxBuffer: 16 * 1024 * 1024
51397
- });
51398
- return stdout;
51399
- };
51400
- var getRepoRoot = async (cwd, options = {}) => {
51401
- try {
51402
- const cdup = (await runGit(["rev-parse", "--show-cdup"], cwd)).trim();
51403
- return resolve(cwd, cdup);
51404
- } catch (error) {
51405
- if (options.fallbackToCwd) {
51406
- return resolve(cwd);
51407
- }
51408
- throw error;
51409
- }
51410
- };
51411
- var parseNulSeparated = (out) => {
51412
- return out.split("\0").filter((s) => s.length > 0);
51413
- };
51414
- var gitArgsForMode = (mode, sinceRef) => {
51415
- switch (mode) {
51416
- case "staged":
51417
- return [["diff", "--name-only", "--cached", "-z"]];
51418
- case "changed":
51419
- return [
51420
- ["diff", "--name-only", "HEAD", "-z"],
51421
- ["ls-files", "--others", "--exclude-standard", "-z"]
51422
- ];
51423
- case "since": {
51424
- if (sinceRef === void 0 || sinceRef.length === 0) {
51425
- throw new Error("--since requires a non-empty git ref");
51426
- }
51427
- return [["diff", "--name-only", sinceRef, "-z"]];
51428
- }
51429
- }
51430
- };
51431
- var getGitFilteredPaths = async (options) => {
51432
- try {
51433
- const repoRoot = await getRepoRoot(options.cwd);
51434
- const argSets = gitArgsForMode(options.mode, options.sinceRef);
51435
- const collected = /* @__PURE__ */ new Set();
51436
- for (const args of argSets) {
51437
- const out = await runGit(args, options.cwd);
51438
- for (const relPath of parseNulSeparated(out)) {
51439
- collected.add(resolve(repoRoot, relPath));
51440
- }
51441
- }
51442
- return ok(collected);
51443
- } catch (e) {
51444
- const ee = e;
51445
- const stderr = (ee.stderr ?? "").trim();
51446
- const msg = stderr.length > 0 ? stderr : ee.message ?? String(e);
51447
- return err(
51448
- new IOError(`Git filter failed (--${options.mode}): ${msg}`, {
51449
- cause: e,
51450
- context: {
51451
- mode: options.mode,
51452
- ...options.sinceRef !== void 0 ? { sinceRef: options.sinceRef } : {}
51453
- }
51454
- })
51455
- );
51456
- }
51457
- };
51563
+ // src/commands/review.command.ts
51564
+ init_git_filter();
51458
51565
 
51459
51566
  // src/match-glob.ts
51460
51567
  var REGEX_META = /[.+^${}()|[\]\\]/;
@@ -52101,7 +52208,11 @@ var runPush = async (options = {}, deps = {}) => {
52101
52208
  return EXIT.USAGE;
52102
52209
  }
52103
52210
  const config = loaded.value.config;
52104
- const link = await new FileWorkspaceLinkStore(target).read();
52211
+ const resolvedLinkStore = await findWorkspaceLink(target);
52212
+ const link = resolvedLinkStore?.link ?? null;
52213
+ if (resolvedLinkStore && !options.server) {
52214
+ console.log(dim(`S\u1EED d\u1EE5ng c\u1EA5u h\xECnh d\u1EF1 \xE1n t\u1EEB: ${resolvedLinkStore.filePath}`));
52215
+ }
52105
52216
  const serverUrl = options.server ?? link?.serverUrl ?? config.dashboard.serverUrl ?? process.env.CODE_SENTINEL_DASHBOARD_URL ?? getDefaultDashboardServerUrl();
52106
52217
  if (serverUrl === void 0 || serverUrl.length === 0) {
52107
52218
  console.error(
@@ -53138,6 +53249,7 @@ init_dist7();
53138
53249
  init_dist8();
53139
53250
  init_composition();
53140
53251
  init_find_files();
53252
+ init_git_filter();
53141
53253
 
53142
53254
  // src/rule-overrides.ts
53143
53255
  var buildRuleOverrides = (rulesCfg) => {
@@ -54876,10 +54988,10 @@ var ReaddirpStream = class extends Readable {
54876
54988
  }
54877
54989
  async _formatEntry(dirent, path) {
54878
54990
  let entry;
54879
- const basename11 = this._isDirent ? dirent.name : dirent;
54991
+ const basename12 = this._isDirent ? dirent.name : dirent;
54880
54992
  try {
54881
- const fullPath = resolve(join(path, basename11));
54882
- entry = { path: relative(this._root, fullPath), fullPath, basename: basename11 };
54993
+ const fullPath = resolve(join(path, basename12));
54994
+ entry = { path: relative(this._root, fullPath), fullPath, basename: basename12 };
54883
54995
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
54884
54996
  } catch (err2) {
54885
54997
  this._onError(err2);
@@ -55414,9 +55526,9 @@ var NodeFsHandler = class {
55414
55526
  _watchWithNodeFs(path, listener) {
55415
55527
  const opts = this.fsw.options;
55416
55528
  const directory = sp2.dirname(path);
55417
- const basename11 = sp2.basename(path);
55529
+ const basename12 = sp2.basename(path);
55418
55530
  const parent = this.fsw._getWatchedDir(directory);
55419
- parent.add(basename11);
55531
+ parent.add(basename12);
55420
55532
  const absolutePath = sp2.resolve(path);
55421
55533
  const options = {
55422
55534
  persistent: opts.persistent
@@ -55426,7 +55538,7 @@ var NodeFsHandler = class {
55426
55538
  let closer;
55427
55539
  if (opts.usePolling) {
55428
55540
  const enableBin = opts.interval !== opts.binaryInterval;
55429
- options.interval = enableBin && isBinaryPath(basename11) ? opts.binaryInterval : opts.interval;
55541
+ options.interval = enableBin && isBinaryPath(basename12) ? opts.binaryInterval : opts.interval;
55430
55542
  closer = setFsWatchFileListener(path, absolutePath, options, {
55431
55543
  listener,
55432
55544
  rawEmitter: this.fsw._emitRaw
@@ -55449,10 +55561,10 @@ var NodeFsHandler = class {
55449
55561
  return;
55450
55562
  }
55451
55563
  const dirname27 = sp2.dirname(file);
55452
- const basename11 = sp2.basename(file);
55564
+ const basename12 = sp2.basename(file);
55453
55565
  const parent = this.fsw._getWatchedDir(dirname27);
55454
55566
  let prevStats = stats;
55455
- if (parent.has(basename11))
55567
+ if (parent.has(basename12))
55456
55568
  return;
55457
55569
  const listener = async (path, newStats) => {
55458
55570
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
@@ -55477,9 +55589,9 @@ var NodeFsHandler = class {
55477
55589
  prevStats = newStats2;
55478
55590
  }
55479
55591
  } catch (error) {
55480
- this.fsw._remove(dirname27, basename11);
55592
+ this.fsw._remove(dirname27, basename12);
55481
55593
  }
55482
- } else if (parent.has(basename11)) {
55594
+ } else if (parent.has(basename12)) {
55483
55595
  const at = newStats.atimeMs;
55484
55596
  const mt = newStats.mtimeMs;
55485
55597
  if (!at || at <= mt || mt !== prevStats.mtimeMs) {
@@ -56605,7 +56717,8 @@ var runConfigEffective = async (options = {}) => {
56605
56717
  }
56606
56718
  if (options.online) {
56607
56719
  const root = resolve(options.path ?? process.cwd());
56608
- const link = await new FileWorkspaceLinkStore(root).read();
56720
+ const resolvedLink = await findWorkspaceLink(root);
56721
+ const link = resolvedLink?.link ?? null;
56609
56722
  if (!link) {
56610
56723
  writeError("Workspace is not linked. Run `cs project link` before online config resolution.");
56611
56724
  return EXIT.USAGE;
@@ -57565,7 +57678,11 @@ var runReview = async (options = {}) => {
57565
57678
  return EXIT.RUNTIME;
57566
57679
  }
57567
57680
  try {
57568
- const link = await new FileWorkspaceLinkStore(target).read();
57681
+ const resolvedLink = await findWorkspaceLink(target);
57682
+ const link = resolvedLink?.link ?? null;
57683
+ if (resolvedLink && options.push) {
57684
+ console.log(dim(`S\u1EED d\u1EE5ng c\u1EA5u h\xECnh d\u1EF1 \xE1n t\u1EEB: ${resolvedLink.filePath}`));
57685
+ }
57569
57686
  const credential = link ? await createPlatformCredentialStore().read(link.serverUrl) : null;
57570
57687
  if (link && credential) {
57571
57688
  await new FileProtectedRetryStore(target, createPlatformRetryKeyProvider()).enqueue({
@@ -60291,7 +60408,10 @@ init_schema();
60291
60408
  init_exit_codes();
60292
60409
  var execFile5 = promisify(execFile$1);
60293
60410
  var defaultDependencies = (root) => ({
60294
- readLink: () => new FileWorkspaceLinkStore(root).read(),
60411
+ readLink: async () => {
60412
+ const resolvedLink = await findWorkspaceLink(root);
60413
+ return resolvedLink?.link ?? null;
60414
+ },
60295
60415
  readOriginRemote: async () => {
60296
60416
  try {
60297
60417
  const { stdout } = await execFile5("git", ["remote", "get-url", "origin"], {
@@ -60516,7 +60636,8 @@ var runProjectLink = async (options) => {
60516
60636
  var linkedProjectId = async (options) => {
60517
60637
  const root = resolve(options.path ?? process.cwd());
60518
60638
  if (options.projectId) return { root, projectId: options.projectId };
60519
- const link = await new FileWorkspaceLinkStore(root).read();
60639
+ const resolvedLink = await findWorkspaceLink(root);
60640
+ const link = resolvedLink?.link ?? null;
60520
60641
  if (!link)
60521
60642
  throw new Error("This workspace is not linked. Run `cs project` first or pass --project-id.");
60522
60643
  return { root, projectId: link.projectId };
@@ -61146,888 +61267,202 @@ var runQuickstart = async (options = {}) => {
61146
61267
 
61147
61268
  // src/commands/package.command.ts
61148
61269
  init_dist2();
61149
- init_load();
61150
- init_ai_triage_command();
61151
-
61152
- // src/commands/runtime-auth-seed.command.ts
61153
- init_dist6();
61154
- init_dist2();
61155
61270
  init_dist5();
61156
- init_dist();
61157
- init_composition();
61158
61271
  init_load();
61159
- init_exit_codes();
61160
- init_find_files();
61161
- var CONFIG_GLOBS = [
61162
- "**/application*.yml",
61163
- "**/application*.yaml",
61164
- "**/application*.properties",
61165
- "**/bootstrap*.yml",
61166
- "**/bootstrap*.yaml",
61167
- "**/bootstrap*.properties"
61168
- ];
61169
- var POM_GLOBS = ["**/pom.xml"];
61170
- var JAVA_GLOBS2 = ["**/*.java"];
61171
- var EXCLUDES2 = ["**/node_modules/**", "**/dist/**", "**/target/**"];
61172
- var MAX_EXCERPTS = 40;
61173
- var AUTH_SOURCE_RE = /(Filter|Interceptor|Security(Config|Configuration)|Authentication|Authoriz|TokenService|TokenProvider|JwtUtil|UserContext|SessionRegistry)/;
61174
- var AUTH_CLASS_RE = /((Filter|Interceptor|Aspect)$)|^(UserContext|TokenService|TokenProvider|RedisAbstract|RedisKey|SecurityConfig)/;
61175
- var MAX_CLASS_NAMES = 120;
61176
- var MAX_SOURCE_EXCERPTS = 12;
61177
- var simpleClassName2 = (entry) => (entry.split("/").pop() ?? entry).replace(/\.class$/, "");
61178
- var DEFAULT_REDIS_HOST = "127.0.0.1";
61179
- var DEFAULT_REDIS_PORT = 6379;
61180
- var buildEvidence = (configs, bundled, sources, classNames, classConstants = []) => {
61181
- const relevant = classNames.filter((n) => AUTH_CLASS_RE.test(simpleClassName2(n))).slice(0, MAX_CLASS_NAMES);
61182
- const out = [];
61183
- if (relevant.length > 0) {
61184
- out.push({
61185
- path: "<declared jars> \u2014 auth-relevant class inventory",
61186
- content: [
61187
- "These classes ship inside the jars this project declares. The authentication gate may be",
61188
- "implemented here rather than in the source tree; name the scheme from these if so.",
61189
- "",
61190
- ...relevant
61191
- ].join(String.fromCharCode(10))
61192
- });
61193
- }
61194
- for (const c of classConstants) {
61195
- if (c.constants.length === 0) continue;
61196
- out.push({
61197
- path: `${c.entry} \u2014 string constants`,
61198
- content: c.constants.join(String.fromCharCode(10))
61199
- });
61272
+ init_git_filter();
61273
+ var HYPOTHESIS_ENTRY = ".code-sentinel/auth-hypothesis.json";
61274
+ var DATA_SEED_HYPOTHESIS_ENTRY = ".code-sentinel/data-seed-hypothesis.json";
61275
+ var AI_TRIAGE_ENTRY = ".code-sentinel/ai-triage-assessment.json";
61276
+ var formatBytes = (n) => n > 1024 * 1024 ? `${(n / (1024 * 1024)).toFixed(1)} MB` : `${(n / 1024).toFixed(0)} KB`;
61277
+ var runPackageCommand = async (options) => {
61278
+ const targetDirAbs = resolve(
61279
+ options.targetDir && options.targetDir.trim() !== "" ? options.targetDir : options.source && options.source.trim() !== "" ? options.source : "."
61280
+ );
61281
+ const repoRoot = await getRepoRoot(targetDirAbs, { fallbackToCwd: true });
61282
+ let modulePath = options.module;
61283
+ if (modulePath === void 0 || modulePath.trim() === "") {
61284
+ modulePath = relative(repoRoot, targetDirAbs);
61285
+ if (modulePath === "") modulePath = ".";
61200
61286
  }
61201
- return [...out, ...sources, ...bundled, ...configs].slice(0, MAX_EXCERPTS).map((f) => "path" in f ? f : { path: f.file, content: f.content });
61202
- };
61203
- var runRuntimeAuthSeed = async (options) => {
61204
- if (options.emitHypothesis !== void 0 && options.hypothesis !== void 0) {
61205
- console.error(
61206
- "[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)."
61287
+ const effectiveTarget = resolve(repoRoot, modulePath);
61288
+ if (!options.push && (options.resolveAuth || options.resolveDataSeed || options.refreshHypothesis)) {
61289
+ process.stderr.write(
61290
+ "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"
61207
61291
  );
61208
- return EXIT.USAGE;
61209
- }
61210
- const source = resolve(process.cwd(), options.source);
61211
- const configResult = await findFiles({
61212
- projectRoot: source,
61213
- include: CONFIG_GLOBS,
61214
- exclude: EXCLUDES2
61215
- });
61216
- if (!configResult.ok) {
61217
- console.error(`[auth-seed] Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c c\u1EA5u h\xECnh trong ${source} \u2192 kh\xF4ng gieo seed.`);
61218
- return EXIT.SUCCESS;
61219
- }
61220
- const files = configResult.value.map((f) => ({
61221
- file: f.path,
61222
- content: f.content
61223
- }));
61224
- let dependencyConfigFiles = [];
61225
- const pomsResult = await findFiles({
61226
- projectRoot: source,
61227
- include: POM_GLOBS,
61228
- exclude: EXCLUDES2
61229
- });
61230
- if (pomsResult.ok) {
61231
- dependencyConfigFiles = collectDependencyConfigFiles(
61232
- pomsResult.value.map((f) => ({ absolutePath: f.absolutePath, content: f.content }))
61233
- ).map((f) => ({ file: f.path, content: f.content }));
61234
- }
61235
- const javaResult = await findFiles({
61236
- projectRoot: source,
61237
- include: JAVA_GLOBS2,
61238
- exclude: EXCLUDES2
61239
- });
61240
- const endpoints = javaResult.ok ? extractHttpEndpoints(javaResult.value).map((e) => ({
61241
- httpMethod: e.httpMethod,
61242
- path: e.path
61243
- })) : [];
61244
- 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 })) : [];
61245
- const pomRefs = pomsResult.ok ? pomsResult.value.map((f) => ({ absolutePath: f.absolutePath, content: f.content })) : [];
61246
- const dependencyJarKeys = collectJwtKeyCandidates(pomRefs);
61247
- const decodeOnlyEvidence = collectDecodeOnlyEvidence(pomRefs);
61248
- const dependencyClasses = collectDependencyClassNames(pomRefs);
61249
- const dependencyConstants = collectDependencyClassConstants(
61250
- pomRefs,
61251
- (entry) => AUTH_CLASS_RE.test(simpleClassName2(entry))
61252
- );
61253
- const signingKeyAvailable = discoverJwtSigningKeys(files).length > 0 || discoverJwtSigningKeys(dependencyConfigFiles).length > 0 || dependencyJarKeys.length > 0 || decodeOnlyEvidence.length > 0;
61254
- const excerpts = buildEvidence(
61255
- files,
61256
- dependencyConfigFiles,
61257
- authSources,
61258
- dependencyClasses,
61259
- dependencyConstants
61260
- );
61261
- const rawPolicy = options.hypothesisProvenance ?? "warn";
61262
- if (options.hypothesisProvenance !== void 0 && !isProvenancePolicy(rawPolicy)) {
61263
- console.error(`[auth-seed] --hypothesis-provenance kh\xF4ng h\u1EE3p l\u1EC7 (${rawPolicy}); d\xF9ng 'warn'.`);
61264
61292
  }
61265
- const provenancePolicy = isProvenancePolicy(rawPolicy) ? rawPolicy : "warn";
61266
- let preResolved;
61267
- if (options.hypothesis !== void 0) {
61268
- const path = resolve(process.cwd(), options.hypothesis);
61269
- const read = await readHypothesisFile(path);
61270
- if (!read.ok) {
61293
+ let serverUrl = getDefaultDashboardServerUrl();
61294
+ let token = process.env.CODE_SENTINEL_DASHBOARD_TOKEN;
61295
+ let link = null;
61296
+ let resolvedLinkStore = null;
61297
+ if (options.push) {
61298
+ const loaded = await loadConfig(
61299
+ options.config === void 0 ? { cwd: repoRoot } : { cwd: repoRoot, configPath: options.config }
61300
+ );
61301
+ const config = loaded.ok ? loaded.value.config : void 0;
61302
+ resolvedLinkStore = await findWorkspaceLink(effectiveTarget);
61303
+ link = resolvedLinkStore?.link ?? null;
61304
+ if (!link) {
61271
61305
  console.error(
61272
- `[auth-seed] Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c gi\u1EA3 thuy\u1EBFt t\u1EEB ${options.hypothesis} (${read.error}) \u2192 b\u1ECF.`
61273
- );
61274
- preResolved = { hypothesis: null, outcome: "no-proposal" };
61275
- } else {
61276
- const validated = validateRuntimeAuthHypothesis(read.result.hypothesis);
61277
- const { provenance: provenance2 } = read.result;
61278
- const decision = resolveHypothesisProvenance({
61279
- policy: provenancePolicy,
61280
- provenance: provenance2,
61281
- expectedInputHash: hypothesisInputHash(
61282
- buildHypothesisInput({
61283
- kind: "runtime-auth",
61284
- promptVersion: RUNTIME_AUTH_PROMPT_VERSION,
61285
- provider: provenance2?.provider ?? "",
61286
- modelId: provenance2?.modelId ?? "",
61287
- excerpts,
61288
- endpoints,
61289
- signingKeyAvailable
61290
- })
61306
+ red(
61307
+ "\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`."
61291
61308
  )
61292
- });
61293
- console.error(`[auth-seed] ${describeHypothesisProvenance(provenance2, decision)}`);
61294
- const accepted = decision.useHypothesis ? validated : null;
61295
- preResolved = {
61296
- hypothesis: accepted,
61297
- outcome: accepted === null ? "rejected" : "accepted"
61298
- };
61299
- console.error(
61300
- 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).`
61301
61309
  );
61310
+ return 2;
61302
61311
  }
61303
- }
61304
- let resolver = createStubRuntimeAuthHypothesisResolver();
61305
- let providerName = "none";
61306
- let modelId = "<none>";
61307
- if (options.useAi === true && preResolved === void 0) {
61308
- const logger = createLogger({ level: "warn", destination: "stderr" });
61309
- const config = await loadConfig(
61310
- options.config === void 0 ? { cwd: source } : { cwd: source, configPath: resolve(process.cwd(), options.config) }
61311
- );
61312
- const client = config.ok ? buildAiClient(config.value.config, logger) : null;
61313
- if (!config.ok) {
61314
- console.error(
61315
- `[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.`
61316
- );
61317
- } else if (client === null) {
61318
- console.error(
61319
- "[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."
61320
- );
61321
- } else {
61322
- resolver = createRuntimeAuthHypothesisResolver({ client, logger });
61323
- providerName = client.name;
61324
- modelId = resolveActiveModel(config.value.config);
61325
- console.error(`[auth-seed] H\u1ECFi gi\u1EA3 thuy\u1EBFt x\xE1c th\u1EF1c qua ${client.name} (model ${modelId}).`);
61312
+ serverUrl = link.serverUrl ?? config?.dashboard?.serverUrl ?? getDefaultDashboardServerUrl();
61313
+ if (!token) {
61314
+ token = config?.dashboard?.token;
61315
+ }
61316
+ if (!token) {
61317
+ try {
61318
+ const store = createPlatformCredentialStore();
61319
+ const credential = await getAuthenticatedCredential({ server: serverUrl, store });
61320
+ token = credential.accessToken;
61321
+ } catch (e) {
61322
+ console.error(
61323
+ red(
61324
+ `
61325
+ Kh\xF4ng th\u1EC3 l\u1EA5y x\xE1c th\u1EF1c Dashboard: ${e instanceof Error ? e.message : String(e)}
61326
+ H\xE3y ch\u1EA1y \`cs auth login\`.`
61327
+ )
61328
+ );
61329
+ return 2;
61330
+ }
61331
+ }
61332
+ try {
61333
+ const configUrl = `${serverUrl.replace(/\/+$/, "")}/api/projects/${encodeURIComponent(link.projectId)}/review-config`;
61334
+ const configRes = await fetch(configUrl, {
61335
+ headers: { authorization: `Bearer ${token}` }
61336
+ });
61337
+ if (configRes.ok) {
61338
+ const payload = await configRes.json();
61339
+ const remoteConfig = payload.config ?? payload;
61340
+ const ai = remoteConfig?.ai;
61341
+ const provider = ai?.provider ?? remoteConfig?.aiProvider ?? "viettel-netmind";
61342
+ if (provider && provider !== "none" && provider !== "ollama") {
61343
+ const STORED_SECRET_PLACEHOLDER = "${CODE_SENTINEL_STORED_SECRET}";
61344
+ const pKey = provider === "viettel-netmind" ? "viettelNetmind" : provider === "openai-compatible" ? "openaiCompatible" : provider === "opencode-go" ? "opencodeGo" : provider;
61345
+ const providerConf = typeof ai?.[pKey] === "object" && ai?.[pKey] !== null ? ai[pKey] : {};
61346
+ const rawProviderApiKey = typeof providerConf.apiKey === "string" ? providerConf.apiKey.trim() : typeof ai?.apiKey === "string" ? ai.apiKey.trim() : "";
61347
+ const hasServerSecret = rawProviderApiKey === STORED_SECRET_PLACEHOLDER || rawProviderApiKey === "<configured server secret>" || rawProviderApiKey.startsWith("csenc:v1:");
61348
+ const hasExplicitKey = rawProviderApiKey.length > 0 && !hasServerSecret && !/^\$\{[A-Z0-9_]+\}$/.test(rawProviderApiKey);
61349
+ if (!hasServerSecret && !hasExplicitKey) {
61350
+ const drawerUrl = `${serverUrl.replace(/\/+$/, "")}/runs?project=${encodeURIComponent(link.projectId)}&drawer=pentest`;
61351
+ console.error(
61352
+ red("\n\u274C [Server] D\u1EF1 \xE1n ch\u01B0a \u0111\u01B0\u1EE3c c\u1EA5u h\xECnh Project AI Key tr\xEAn Web Dashboard.")
61353
+ );
61354
+ console.error(
61355
+ red(
61356
+ `\u{1F449} Vui l\xF2ng m\u1EDF drawer Pentest tr\xEAn Web Dashboard \u0111\u1EC3 nh\u1EADp API Key:
61357
+ ${drawerUrl}
61358
+ `
61359
+ )
61360
+ );
61361
+ console.error(
61362
+ red(
61363
+ `H\u01B0\u1EDBng d\u1EABn thao t\xE1c:
61364
+ 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").
61365
+ 2. T\u1EA1i m\u1EE5c "Project AI Key (${provider})", nh\u1EADp API Key v\xE0 nh\u1EA5n "L\u01B0u key cho d\u1EF1 \xE1n".
61366
+ 3. Sau khi l\u01B0u key, ch\u1EA1y l\u1EA1i l\u1EC7nh \`cs pentest\`.
61367
+
61368
+ 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:
61369
+ - Ph\xE2n t\xEDch & gi\u1EA3i quy\u1EBFt c\u01A1 ch\u1EBF x\xE1c th\u1EF1c (Auth Hypothesis)
61370
+ - Two-Way AI Triage (lo\u1EA1i b\u1ECF False Positive, t\xECm False Negative)
61371
+ - T\u1EA1o d\u1EEF li\u1EC7u m\u1ED3i (Data Seed Hypothesis)
61372
+ `
61373
+ )
61374
+ );
61375
+ return 2;
61376
+ }
61377
+ }
61378
+ }
61379
+ } catch {
61326
61380
  }
61327
61381
  }
61328
- if (options.useAi === true && preResolved === void 0) {
61329
- const chars = excerpts.reduce((n, e) => n + e.content.length, 0);
61330
- console.error(`[auth-seed] B\u1EB1ng ch\u1EE9ng: ${excerpts.length} excerpt \xB7 ${chars} k\xFD t\u1EF1.`);
61382
+ const rawPlan = planServicePackage(repoRoot, modulePath);
61383
+ if (rawPlan.entries.length === 0) {
61384
+ process.stderr.write(`cs package: no files found under ${modulePath}
61385
+ `);
61386
+ return 2;
61331
61387
  }
61332
- const hypothesisInput = buildHypothesisInput({
61333
- kind: "runtime-auth",
61334
- promptVersion: RUNTIME_AUTH_PROMPT_VERSION,
61335
- provider: providerName,
61336
- modelId,
61337
- excerpts,
61338
- endpoints,
61339
- signingKeyAvailable
61340
- });
61341
- const inputHash = hypothesisInputHash(hypothesisInput);
61342
- const pinned = preResolved === void 0 && options.refreshHypothesis !== true ? await loadPin(inputHash) : null;
61343
- const pinnedHypothesis = pinned === null ? null : validateRuntimeAuthHypothesis(pinned.hypothesis);
61344
- if (pinned !== null && pinnedHypothesis === null) {
61345
- console.error(
61346
- "[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."
61347
- );
61348
- } else if (pinnedHypothesis !== null) {
61349
- console.error(
61350
- `[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.`
61351
- );
61388
+ const cleanEntries = rawPlan.entries.filter(
61389
+ (e) => e.name !== HYPOTHESIS_ENTRY && e.name !== DATA_SEED_HYPOTHESIS_ENTRY && e.name !== AI_TRIAGE_ENTRY && !e.name.startsWith(".code-sentinel/")
61390
+ );
61391
+ const plan = { ...rawPlan, entries: cleanEntries };
61392
+ const outPath = resolve(
61393
+ options.out ?? `${basename(plan.modulePath.replace(/\/$/, "")) || "service"}.zip`
61394
+ );
61395
+ const bytes = writePackageZip(plan, outPath);
61396
+ process.stdout.write(`Packaged ${plan.modulePath} \u2192 ${outPath} (${formatBytes(bytes)})
61397
+ `);
61398
+ process.stdout.write(` ${plan.entries.length} files
61399
+ `);
61400
+ if (plan.parentPoms.length > 0) {
61401
+ process.stdout.write(` parent poms: ${plan.parentPoms.join(", ")}
61402
+ `);
61352
61403
  }
61353
- const resolution = pinnedHypothesis !== null ? { hypothesis: pinnedHypothesis, outcome: "accepted" } : preResolved !== void 0 ? preResolved : await resolveRuntimeAuthHypothesis(resolver, {
61354
- excerpts,
61355
- endpoints,
61356
- signingKeyAvailable
61357
- });
61358
- const { hypothesis, outcome, rejectedShape } = resolution;
61359
- if (hypothesis === null) {
61360
- 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)";
61361
- console.error(
61362
- 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).` : (
61363
- // No file is written, so downstream "no parameter" means "deterministic path" with no
61364
- // second way to spell it.
61365
- `[auth-seed] ${why} \u2192 KH\xD4NG ghi gi\u1EA3 thuy\u1EBFt; lane runtime s\u1EBD ch\u1EA1y \u0111\u01B0\u1EDDng t\u1EA5t \u0111\u1ECBnh.`
61366
- )
61404
+ if (plan.systemJars.length > 0) {
61405
+ process.stdout.write(` declared jars: ${plan.systemJars.join(", ")}
61406
+ `);
61407
+ }
61408
+ if (plan.missingSystemJars.length > 0) {
61409
+ process.stdout.write(
61410
+ ` \u26A0 declared but NOT in the repo: ${plan.missingSystemJars.join(", ")}
61411
+ `
61367
61412
  );
61368
- return EXIT.SUCCESS;
61369
61413
  }
61370
- if (options.emitHypothesis !== void 0) {
61371
- const out = resolve(process.cwd(), options.emitHypothesis);
61372
- const provenance2 = pinned?.provenance ?? stampProvenance({
61373
- input: hypothesisInput,
61374
- hypothesis,
61375
- attempts: resolution.attempts ?? 1
61376
- });
61377
- await writeEnvelopeFile(out, "runtime-auth", hypothesis, provenance2);
61378
- if (pinned === null) {
61379
- const saved = await savePin(inputHash, "runtime-auth", hypothesis, provenance2);
61380
- if (!saved) {
61381
- console.error(
61382
- "[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."
61414
+ const report2 = preflightArchive(outPath);
61415
+ const decision = classifyPreflight({ ...report2.signals, staticAssessmentCompleted: true });
61416
+ if (!decision.decided) {
61417
+ process.stdout.write("\n\u2713 preflight: ready to build\n");
61418
+ if (options.push && link) {
61419
+ process.stdout.write("\n\u{1F680} \u0110ang \u0111\u1EA9y d\u1EEF li\u1EC7u l\xEAn Dashboard...\n");
61420
+ try {
61421
+ const url = `${serverUrl.replace(/\/+$/, "")}/api/projects/${encodeURIComponent(link.projectId)}/pentest-requests`;
61422
+ const formData = new FormData();
61423
+ formData.append("sourceKind", "archive");
61424
+ formData.append("archive", new Blob([readFileSync(outPath)]), basename(outPath));
61425
+ formData.append("useAi", "true");
61426
+ if (link.codebaseId) {
61427
+ formData.append("repositoryId", link.codebaseId);
61428
+ }
61429
+ const res = await fetch(url, {
61430
+ method: "POST",
61431
+ headers: { authorization: `Bearer ${token}` },
61432
+ body: formData
61433
+ });
61434
+ if (!res.ok) {
61435
+ const text2 = await res.text().catch(() => "");
61436
+ console.error(red(`
61437
+ Server t\u1EEB ch\u1ED1i y\xEAu c\u1EA7u (HTTP ${res.status}): ${text2}`));
61438
+ return 2;
61439
+ }
61440
+ const body = await res.json().catch(() => ({}));
61441
+ const createdId = body.request?.id ?? body.id;
61442
+ console.log(green(`[\u2713] \u0110\u1EA9y th\xE0nh c\xF4ng! \u0110\xE3 t\u1EA1o request ID: ${createdId ?? "unknown"}`));
61443
+ console.log(
61444
+ `\u{1F517} Link theo d\xF5i: ${serverUrl.replace(/\/+$/, "")}/runs?project=${encodeURIComponent(link.projectId)}&type=pentest`
61383
61445
  );
61446
+ if (body.request?.status === "failed" && body.request.failureReason) {
61447
+ console.error(red(`
61448
+ \u26A0 Y\xEAu c\u1EA7u th\u1EA5t b\u1EA1i: ${body.request.failureReason}`));
61449
+ }
61450
+ } catch (e) {
61451
+ console.error(red(`
61452
+ L\u1ED7i m\u1EA1ng khi upload: ${e instanceof Error ? e.message : String(e)}`));
61453
+ return 2;
61384
61454
  }
61385
61455
  }
61386
- console.error(
61387
- `[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.`
61388
- );
61389
- return EXIT.SUCCESS;
61390
- }
61391
- const plan = buildRuntimeAuthSeedPlan(hypothesis, {
61392
- files,
61393
- dependencyConfigFiles,
61394
- dependencyJarKeys,
61395
- decodeOnlyEvidence
61396
- });
61397
- if (plan === null) {
61398
- console.error(
61399
- `[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.`
61400
- );
61401
- return EXIT.SUCCESS;
61456
+ return 0;
61402
61457
  }
61403
- const result = await applyRuntimeAuthSeed(plan, {
61404
- host: options.redisHost ?? DEFAULT_REDIS_HOST,
61405
- port: options.redisPort ?? DEFAULT_REDIS_PORT,
61406
- ...options.timeoutMs === void 0 ? {} : { timeoutMs: options.timeoutMs }
61407
- });
61408
- if (!result.ok) {
61409
- for (const f of result.failures) {
61410
- console.error(`[auth-seed] L\u1EC7nh th\u1EA5t b\u1EA1i: ${f.command} \u2014 ${f.error}`);
61411
- }
61412
- console.error(
61413
- `[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.`
61414
- );
61415
- return EXIT.SUCCESS;
61458
+ process.stdout.write(`
61459
+ \u2717 preflight still stops at ${decision.tier} \u2014 ${decision.stopReason}
61460
+ `);
61461
+ for (const evidence17 of report2.evidence.slice(0, 5)) {
61462
+ process.stdout.write(` ${evidence17.source}: ${evidence17.verbatim}
61463
+ `);
61416
61464
  }
61417
- console.error(
61418
- `[auth-seed] \u0110\xE3 gieo ${result.applied} kho\xE1 state cho scheme \`${hypothesis.scheme}\`.`
61419
- );
61420
- console.error(`[auth-seed] \u0110\u1ED8 L\u1EC6CH: ${plan.deviation}`);
61421
- process.stdout.write(
61422
- `${plan.credential.value.startsWith("Bearer ") ? plan.credential.value.slice(7) : plan.credential.value}
61423
- `
61424
- );
61425
- return EXIT.SUCCESS;
61426
- };
61427
-
61428
- // src/commands/runtime-data-seed.command.ts
61429
- init_dist6();
61430
- init_dist2();
61431
- init_dist2();
61432
- init_dist5();
61433
- init_dist();
61434
- init_dist4();
61435
- init_composition();
61436
- init_load();
61437
- init_exit_codes();
61438
- init_find_files();
61439
- var CONFIG_GLOBS2 = [
61440
- "**/application*.yml",
61441
- "**/application*.yaml",
61442
- "**/application*.properties",
61443
- "**/bootstrap*.yml",
61444
- "**/bootstrap*.yaml",
61445
- "**/bootstrap*.properties"
61446
- ];
61447
- var DB_BUILD_GLOBS2 = ["**/pom.xml", "**/build.gradle", "**/build.gradle.kts"];
61448
- var JAVA_GLOBS3 = ["**/*.java"];
61449
- var SCHEMA_GLOBS = [
61450
- "**/liquibase/**",
61451
- "**/flyway/**",
61452
- "**/db/migration/**",
61453
- "**/*changelog*.xml",
61454
- "**/schema.sql",
61455
- "**/data.sql",
61456
- "**/import.sql"
61457
- ];
61458
- var EXCLUDES3 = ["**/node_modules/**", "**/dist/**", "**/target/**"];
61459
- var ENV_SEED_GLOBS = ["**/.env", "**/*.env"];
61460
- var MAX_ENV_FILE_BYTES = 1024 * 1024;
61461
- var MAX_EXCERPTS2 = 40;
61462
- var ENTITY_RE = /@(Entity|Table)\b/;
61463
- var buildDataSeedEvidence = (schemaFiles, entityFiles, configs) => [...schemaFiles, ...entityFiles, ...configs].slice(0, MAX_EXCERPTS2);
61464
- var readEnvSeedFiles = async (root) => {
61465
- try {
61466
- const paths = await glob([...ENV_SEED_GLOBS], {
61467
- cwd: root,
61468
- ignore: [...EXCLUDES3, "**/.git/**"],
61469
- onlyFiles: true,
61470
- dot: true
61471
- });
61472
- const files = [];
61473
- for (const p of paths.sort()) {
61474
- let content;
61475
- try {
61476
- content = await readFile(resolve(root, p), "utf8");
61477
- } catch {
61478
- continue;
61479
- }
61480
- if (Buffer.byteLength(content, "utf8") > MAX_ENV_FILE_BYTES) continue;
61481
- const abs = resolve(root, p);
61482
- files.push({
61483
- path: toPosix(p),
61484
- absolutePath: abs,
61485
- language: languageFromPath(p) ?? "text",
61486
- content,
61487
- hash: sha256(content),
61488
- size: Buffer.byteLength(content, "utf8")
61489
- });
61490
- }
61491
- return files;
61492
- } catch {
61493
- return [];
61494
- }
61495
- };
61496
- var runRuntimeDataSeed = async (options) => {
61497
- if (options.emitHypothesis !== void 0 && options.hypothesis !== void 0) {
61498
- console.error(
61499
- "[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)."
61500
- );
61501
- return EXIT.USAGE;
61502
- }
61503
- if (options.renderSql !== void 0 && options.hypothesis === void 0) {
61504
- console.error("[data-seed] --render-sql c\u1EA7n --hypothesis (lane ti\xEAu th\u1EE5 trong pod).");
61505
- return EXIT.USAGE;
61506
- }
61507
- if (options.deriveObjectStoreSeed !== void 0 && (options.emitHypothesis !== void 0 || options.hypothesis !== void 0)) {
61508
- console.error(
61509
- "[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."
61510
- );
61511
- return EXIT.USAGE;
61512
- }
61513
- const source = resolve(process.cwd(), options.source);
61514
- const configResult = await findFiles({
61515
- projectRoot: source,
61516
- include: CONFIG_GLOBS2,
61517
- exclude: EXCLUDES3
61518
- });
61519
- const configs = configResult.ok ? configResult.value.map((f) => ({ path: f.path, content: f.content })) : [];
61520
- const buildResult2 = await findFiles({
61521
- projectRoot: source,
61522
- include: DB_BUILD_GLOBS2,
61523
- exclude: EXCLUDES3
61524
- });
61525
- const javaResult = await findFiles({
61526
- projectRoot: source,
61527
- include: JAVA_GLOBS3,
61528
- exclude: EXCLUDES3
61529
- });
61530
- const javaFiles = javaResult.ok ? javaResult.value : [];
61531
- const endpoints = javaResult.ok ? extractHttpEndpoints(javaResult.value) : [];
61532
- if (options.deriveObjectStoreSeed !== void 0) {
61533
- const poms = buildResult2.ok ? buildResult2.value : [];
61534
- const envFiles = await readEnvSeedFiles(source);
61535
- const jarConfigs = collectDependencyConfigFiles(poms);
61536
- const derivation = deriveObjectStoreSeedTargets([
61537
- ...configResult.ok ? configResult.value : [],
61538
- ...envFiles,
61539
- ...jarConfigs
61540
- ]);
61541
- if (derivation.targets.length === 0) {
61542
- console.error(
61543
- "[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)."
61544
- );
61545
- return EXIT.SUCCESS;
61546
- }
61547
- const validated = validateRuntimeDataSeedHypothesis({
61548
- scheme: "object-put",
61549
- targets: derivation.targets,
61550
- evidence: derivation.evidence
61551
- });
61552
- if (validated === null || validated.scheme !== "object-put") {
61553
- console.error(
61554
- "[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)."
61555
- );
61556
- return EXIT.SUCCESS;
61557
- }
61558
- const tsv = renderObjectStoreSeedTsv(validated);
61559
- const out = resolve(process.cwd(), options.deriveObjectStoreSeed);
61560
- await mkdir(resolve(out, ".."), { recursive: true });
61561
- await writeFile(out, tsv, "utf8");
61562
- console.error(
61563
- `[data-seed] \u0110\xE3 derive ${validated.targets.length} bucket object-store (baseline key \`1\`) \u2192 ${options.deriveObjectStoreSeed}.`
61564
- );
61565
- return EXIT.SUCCESS;
61566
- }
61567
- if (options.emitHypothesis !== void 0) {
61568
- let resolver = createStubRuntimeDataSeedResolver();
61569
- let providerName = "none";
61570
- let modelId = "<none>";
61571
- if (options.useAi === true) {
61572
- const logger = createLogger({ level: "warn", destination: "stderr" });
61573
- const config = await loadConfig(
61574
- options.config === void 0 ? { cwd: source } : { cwd: source, configPath: resolve(process.cwd(), options.config) }
61575
- );
61576
- const client = config.ok ? buildAiClient(config.value.config, logger) : null;
61577
- if (!config.ok) {
61578
- console.error(
61579
- `[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.`
61580
- );
61581
- } else if (client === null) {
61582
- console.error(
61583
- "\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)."
61584
- );
61585
- } else {
61586
- const resolverOptions = { client, logger };
61587
- resolver = createRuntimeDataSeedResolver(resolverOptions);
61588
- providerName = client.name;
61589
- modelId = resolveActiveModel(config.value.config);
61590
- console.error(`[data-seed] H\u1ECFi gi\u1EA3 thuy\u1EBFt d\u1EEF li\u1EC7u qua ${client.name} (model ${modelId}).`);
61591
- }
61592
- }
61593
- const manifest = buildReachabilityManifest(endpoints, {});
61594
- const endpointSummaries = dataSeedEndpointSummaries(manifest.entries);
61595
- const schemaResult = await findFiles({
61596
- projectRoot: source,
61597
- include: SCHEMA_GLOBS,
61598
- exclude: EXCLUDES3
61599
- });
61600
- const schemaFiles = schemaResult.ok ? schemaResult.value.map((f) => ({ path: f.path, content: f.content })) : [];
61601
- const entityFiles = javaFiles.filter((f) => ENTITY_RE.test(f.content)).map((f) => ({ path: f.path, content: f.content }));
61602
- const excerpts = buildDataSeedEvidence(schemaFiles, entityFiles, configs);
61603
- if (options.useAi === true) {
61604
- const chars = excerpts.reduce((n, e) => n + e.content.length, 0);
61605
- console.error(
61606
- `[data-seed] B\u1EB1ng ch\u1EE9ng: ${excerpts.length} excerpt \xB7 ${chars} k\xFD t\u1EF1 \xB7 ${endpointSummaries.length} endpoint c\u1EA7n seed.`
61607
- );
61608
- }
61609
- const hypothesisInput = buildHypothesisInput({
61610
- kind: "runtime-data-seed",
61611
- promptVersion: RUNTIME_DATA_SEED_PROMPT_VERSION,
61612
- provider: providerName,
61613
- modelId,
61614
- excerpts,
61615
- endpoints: endpointSummaries.map((e) => ({ httpMethod: e.httpMethod, path: e.path }))
61616
- });
61617
- const inputHash = hypothesisInputHash(hypothesisInput);
61618
- const pinned = options.refreshHypothesis === true ? null : await loadPin(inputHash);
61619
- const pinnedHypothesis = pinned === null ? null : validateRuntimeDataSeedHypothesis(pinned.hypothesis);
61620
- if (pinned !== null && pinnedHypothesis === null) {
61621
- console.error(
61622
- "[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."
61623
- );
61624
- } else if (pinnedHypothesis !== null) {
61625
- console.error(
61626
- `[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.`
61627
- );
61628
- }
61629
- const resolution = pinnedHypothesis !== null ? { hypothesis: pinnedHypothesis, outcome: "accepted" } : await resolveRuntimeDataSeedHypothesis(resolver, {
61630
- endpoints: endpointSummaries,
61631
- excerpts
61632
- });
61633
- const { hypothesis, outcome, rejectedShape } = resolution;
61634
- if (hypothesis === null) {
61635
- 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)";
61636
- console.error(
61637
- `[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).`
61638
- );
61639
- return EXIT.SUCCESS;
61640
- }
61641
- const out = resolve(process.cwd(), options.emitHypothesis);
61642
- const provenance2 = pinned?.provenance ?? stampProvenance({
61643
- input: hypothesisInput,
61644
- hypothesis,
61645
- attempts: resolution.attempts ?? 1
61646
- });
61647
- await writeEnvelopeFile(out, "runtime-data-seed", hypothesis, provenance2);
61648
- if (pinned === null) {
61649
- const saved = await savePin(inputHash, "runtime-data-seed", hypothesis, provenance2);
61650
- if (!saved) {
61651
- console.error(
61652
- "[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."
61653
- );
61654
- }
61655
- }
61656
- console.error(
61657
- `[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.`
61658
- );
61659
- return EXIT.SUCCESS;
61660
- }
61661
- if (options.hypothesis !== void 0) {
61662
- const path = resolve(process.cwd(), options.hypothesis);
61663
- let validated = null;
61664
- const read = await readHypothesisFile(path);
61665
- if (!read.ok) {
61666
- console.error(
61667
- `[data-seed] Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c gi\u1EA3 thuy\u1EBFt t\u1EEB ${options.hypothesis} (${read.error}) \u2192 KH\xD4NG render SQL.`
61668
- );
61669
- } else {
61670
- validated = validateRuntimeDataSeedHypothesis(read.result.hypothesis);
61671
- const decision = resolveHypothesisProvenance({
61672
- policy: "warn",
61673
- provenance: read.result.provenance
61674
- });
61675
- console.error(
61676
- `[data-seed] ${describeHypothesisProvenance(read.result.provenance, decision)}`
61677
- );
61678
- if (validated === null) {
61679
- const problem = describeRuntimeDataSeedHypothesisProblem(read.result.hypothesis);
61680
- console.error(
61681
- `[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.`
61682
- );
61683
- } else {
61684
- console.error(
61685
- `[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).`
61686
- );
61687
- }
61688
- }
61689
- if (validated === null) return EXIT.SUCCESS;
61690
- if (validated.scheme === "api-create") {
61691
- console.error(
61692
- "[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."
61693
- );
61694
- return EXIT.SUCCESS;
61695
- }
61696
- if (validated.scheme !== "sql-insert") {
61697
- console.error(
61698
- "[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."
61699
- );
61700
- return EXIT.SUCCESS;
61701
- }
61702
- const auditColumns = detectSeedAuditColumns(javaFiles);
61703
- const enriched = applySeedAuditColumns(validated, auditColumns);
61704
- const addedAuditColumns = seedAuditAddedColumns(validated, enriched);
61705
- if (addedAuditColumns.length > 0) {
61706
- console.error(
61707
- `[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).`
61708
- );
61709
- }
61710
- const dbTier = detectDbTier([
61711
- ...configResult.ok ? configResult.value : [],
61712
- ...buildResult2.ok ? buildResult2.value : []
61713
- ]);
61714
- const dialect = dbTier?.dialect ?? "generic";
61715
- let sql2;
61716
- try {
61717
- sql2 = renderDataSeedSql(enriched, dialect);
61718
- } catch (e) {
61719
- console.error(
61720
- `[data-seed] Render SQL th\u1EA5t b\u1EA1i (${e.message}) \u2192 KH\xD4NG gieo d\u1EEF li\u1EC7u.`
61721
- );
61722
- return EXIT.SUCCESS;
61723
- }
61724
- const renderOut = options.renderSql;
61725
- if (renderOut === void 0) return EXIT.USAGE;
61726
- const out = resolve(process.cwd(), renderOut);
61727
- await mkdir(resolve(out, ".."), { recursive: true });
61728
- await writeFile(out, sql2, "utf8");
61729
- console.error(
61730
- `[data-seed] \u0110\xE3 render ${validated.targets.length} target \u2192 ${renderOut} (dialect: ${dialect}).`
61731
- );
61732
- console.error(`[data-seed] \u0110\u1ED8 L\u1EC6CH: ${runtimeDataSeedDeviationBanner(validated)}`);
61733
- return EXIT.SUCCESS;
61734
- }
61735
- console.error(
61736
- "[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)."
61737
- );
61738
- return EXIT.USAGE;
61739
- };
61740
-
61741
- // src/commands/package.command.ts
61742
- init_dist5();
61743
- var HYPOTHESIS_ENTRY = ".code-sentinel/auth-hypothesis.json";
61744
- var DATA_SEED_HYPOTHESIS_ENTRY = ".code-sentinel/data-seed-hypothesis.json";
61745
- var AI_TRIAGE_ENTRY = ".code-sentinel/ai-triage-assessment.json";
61746
- var formatBytes = (n) => n > 1024 * 1024 ? `${(n / (1024 * 1024)).toFixed(1)} MB` : `${(n / 1024).toFixed(0)} KB`;
61747
- var runPackageCommand = async (options) => {
61748
- const targetDirAbs = resolve(
61749
- options.targetDir && options.targetDir.trim() !== "" ? options.targetDir : options.source && options.source.trim() !== "" ? options.source : "."
61750
- );
61751
- const repoRoot = await getRepoRoot(targetDirAbs, { fallbackToCwd: true });
61752
- let modulePath = options.module;
61753
- if (modulePath === void 0 || modulePath.trim() === "") {
61754
- modulePath = relative(repoRoot, targetDirAbs);
61755
- if (modulePath === "") modulePath = ".";
61756
- }
61757
- const plan = planServicePackage(repoRoot, modulePath);
61758
- if (plan.entries.length === 0) {
61759
- process.stderr.write(`cs package: no files found under ${modulePath}
61760
- `);
61761
- return 2;
61762
- }
61763
- let planWithAuth = plan;
61764
- const resolveAuthLocally = options.resolveAuth === true && !options.push;
61765
- const resolveAuthOnServer = options.resolveAuth === true && options.push === true;
61766
- if (resolveAuthOnServer) {
61767
- const loaded = await loadConfig(
61768
- options.config === void 0 ? { cwd: repoRoot } : { cwd: repoRoot, configPath: options.config }
61769
- );
61770
- if (!loaded.ok) {
61771
- console.error(red(`
61772
- L\u1ED7i \u0111\u1ECDc c\u1EA5u h\xECnh: ${loaded.error.message}`));
61773
- return 2;
61774
- }
61775
- const config = loaded.value.config;
61776
- const link = await new FileWorkspaceLinkStore(repoRoot).read();
61777
- if (!link) {
61778
- console.error(
61779
- red(
61780
- "\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`."
61781
- )
61782
- );
61783
- return 2;
61784
- }
61785
- const serverUrl = link.serverUrl ?? config.dashboard.serverUrl ?? getDefaultDashboardServerUrl();
61786
- let token = config.dashboard.token ?? process.env.CODE_SENTINEL_DASHBOARD_TOKEN;
61787
- if (!token) {
61788
- try {
61789
- const store = createPlatformCredentialStore();
61790
- const credential = await getAuthenticatedCredential({ server: serverUrl, store });
61791
- token = credential.accessToken;
61792
- } catch (e) {
61793
- console.error(
61794
- red(
61795
- `
61796
- Kh\xF4ng th\u1EC3 l\u1EA5y x\xE1c th\u1EF1c Dashboard: ${e instanceof Error ? e.message : String(e)}
61797
- H\xE3y ch\u1EA1y \`cs auth login\`.`
61798
- )
61799
- );
61800
- return 2;
61801
- }
61802
- }
61803
- try {
61804
- const configUrl = `${serverUrl.replace(/\/+$/, "")}/api/projects/${encodeURIComponent(link.projectId)}/review-config`;
61805
- const configRes = await fetch(configUrl, {
61806
- headers: { authorization: `Bearer ${token}` }
61807
- });
61808
- if (configRes.ok) {
61809
- const payload = await configRes.json();
61810
- const config2 = payload.config ?? payload;
61811
- const ai = config2?.ai;
61812
- const provider = ai?.provider ?? config2?.aiProvider ?? "viettel-netmind";
61813
- if (provider && provider !== "none" && provider !== "ollama") {
61814
- const STORED_SECRET_PLACEHOLDER = "${CODE_SENTINEL_STORED_SECRET}";
61815
- const pKey = provider === "viettel-netmind" ? "viettelNetmind" : provider === "openai-compatible" ? "openaiCompatible" : provider === "opencode-go" ? "opencodeGo" : provider;
61816
- const providerConf = typeof ai?.[pKey] === "object" && ai?.[pKey] !== null ? ai[pKey] : {};
61817
- const rawProviderApiKey = typeof providerConf.apiKey === "string" ? providerConf.apiKey.trim() : typeof ai?.apiKey === "string" ? ai.apiKey.trim() : "";
61818
- const aiStr = JSON.stringify(ai ?? {});
61819
- const hasServerSecret = aiStr.includes(STORED_SECRET_PLACEHOLDER) || aiStr.includes("<configured server secret>") || rawProviderApiKey === STORED_SECRET_PLACEHOLDER || rawProviderApiKey === "<configured server secret>" || rawProviderApiKey.startsWith("csenc:v1:");
61820
- const hasExplicitKey = rawProviderApiKey.length > 0 && !hasServerSecret && !/^\$\{[A-Z0-9_]+\}$/.test(rawProviderApiKey);
61821
- if (!hasServerSecret && !hasExplicitKey) {
61822
- const drawerUrl = `${serverUrl.replace(/\/+$/, "")}/runs?project=${encodeURIComponent(link.projectId)}&drawer=pentest`;
61823
- console.error(
61824
- red("\n\u274C [Server] D\u1EF1 \xE1n ch\u01B0a \u0111\u01B0\u1EE3c c\u1EA5u h\xECnh Project AI Key tr\xEAn Web Dashboard.")
61825
- );
61826
- console.error(
61827
- red(
61828
- `\u{1F449} Vui l\xF2ng m\u1EDF drawer Pentest tr\xEAn Web Dashboard \u0111\u1EC3 nh\u1EADp API Key:
61829
- ${drawerUrl}
61830
- `
61831
- )
61832
- );
61833
- console.error(
61834
- red(
61835
- `H\u01B0\u1EDBng d\u1EABn thao t\xE1c:
61836
- 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").
61837
- 2. T\u1EA1i m\u1EE5c "Project AI Key (${provider})", nh\u1EADp API Key v\xE0 nh\u1EA5n "L\u01B0u key cho d\u1EF1 \xE1n".
61838
- 3. Sau khi l\u01B0u key, ch\u1EA1y l\u1EA1i l\u1EC7nh \`cs pentest\`.
61839
-
61840
- 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:
61841
- - Ph\xE2n t\xEDch & gi\u1EA3i quy\u1EBFt c\u01A1 ch\u1EBF x\xE1c th\u1EF1c (Auth Hypothesis)
61842
- - Two-Way AI Triage (lo\u1EA1i b\u1ECF False Positive, t\xECm False Negative)
61843
- - T\u1EA1o d\u1EEF li\u1EC7u m\u1ED3i (Data Seed Hypothesis)
61844
- `
61845
- )
61846
- );
61847
- return 2;
61848
- }
61849
- }
61850
- }
61851
- } catch {
61852
- }
61853
- }
61854
- let hypothesisTmp;
61855
- let triageTmp;
61856
- if (resolveAuthLocally) {
61857
- hypothesisTmp = join(tmpdir(), `cs-auth-hypothesis-${process.pid}-${Date.now()}.json`);
61858
- await runRuntimeAuthSeed({
61859
- source: join(repoRoot, modulePath),
61860
- useAi: true,
61861
- emitHypothesis: hypothesisTmp,
61862
- ...options.refreshHypothesis === true ? { refreshHypothesis: true } : {},
61863
- ...options.config === void 0 ? {} : { config: options.config }
61864
- });
61865
- const newEntries = [...plan.entries];
61866
- if (existsSync(hypothesisTmp)) {
61867
- newEntries.push({ name: HYPOTHESIS_ENTRY, absolutePath: hypothesisTmp });
61868
- } else {
61869
- process.stderr.write(
61870
- `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)}`
61871
- );
61872
- }
61873
- planWithAuth = { ...plan, entries: newEntries };
61874
- }
61875
- if (options.resolveAuth === true) {
61876
- triageTmp = join(tmpdir(), `cs-ai-triage-${process.pid}-${Date.now()}.json`);
61877
- await runAiTriageCommand({
61878
- source: join(repoRoot, modulePath),
61879
- reportRoot: repoRoot,
61880
- emitReport: triageTmp,
61881
- twoWay: true,
61882
- ...options.config === void 0 ? {} : { config: options.config }
61883
- });
61884
- if (existsSync(triageTmp)) {
61885
- planWithAuth = {
61886
- ...planWithAuth,
61887
- entries: [...planWithAuth.entries, { name: AI_TRIAGE_ENTRY, absolutePath: triageTmp }]
61888
- };
61889
- } else {
61890
- process.stderr.write(
61891
- "[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"
61892
- );
61893
- }
61894
- }
61895
- let dataSeedTmp;
61896
- const resolveDataSeedLocally = options.resolveDataSeed === true && !options.push;
61897
- if (resolveDataSeedLocally) {
61898
- dataSeedTmp = join(tmpdir(), `cs-data-seed-${process.pid}-${Date.now()}.json`);
61899
- await runRuntimeDataSeed({
61900
- source: join(repoRoot, modulePath),
61901
- useAi: true,
61902
- emitHypothesis: dataSeedTmp,
61903
- ...options.refreshHypothesis === true ? { refreshHypothesis: true } : {},
61904
- ...options.config === void 0 ? {} : { config: options.config }
61905
- });
61906
- if (existsSync(dataSeedTmp)) {
61907
- planWithAuth = {
61908
- ...planWithAuth,
61909
- entries: [
61910
- ...planWithAuth.entries,
61911
- { name: DATA_SEED_HYPOTHESIS_ENTRY, absolutePath: dataSeedTmp }
61912
- ]
61913
- };
61914
- } else {
61915
- process.stderr.write(
61916
- `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)}`
61917
- );
61918
- }
61919
- }
61920
- const outPath = resolve(
61921
- options.out ?? `${basename(plan.modulePath.replace(/\/$/, "")) || "service"}.zip`
61922
- );
61923
- const bytes = writePackageZip(planWithAuth, outPath);
61924
- if (hypothesisTmp !== void 0) rmSync(hypothesisTmp, { force: true });
61925
- if (triageTmp !== void 0) rmSync(triageTmp, { force: true });
61926
- if (dataSeedTmp !== void 0) rmSync(dataSeedTmp, { force: true });
61927
- process.stdout.write(`Packaged ${plan.modulePath} \u2192 ${outPath} (${formatBytes(bytes)})
61928
- `);
61929
- process.stdout.write(` ${planWithAuth.entries.length} files
61930
- `);
61931
- if (plan.parentPoms.length > 0) {
61932
- process.stdout.write(` parent poms: ${plan.parentPoms.join(", ")}
61933
- `);
61934
- }
61935
- if (plan.systemJars.length > 0) {
61936
- process.stdout.write(` declared jars: ${plan.systemJars.join(", ")}
61937
- `);
61938
- }
61939
- if (plan.missingSystemJars.length > 0) {
61940
- process.stdout.write(
61941
- ` \u26A0 declared but NOT in the repo: ${plan.missingSystemJars.join(", ")}
61942
- `
61943
- );
61944
- }
61945
- const report2 = preflightArchive(outPath);
61946
- const decision = classifyPreflight({ ...report2.signals, staticAssessmentCompleted: true });
61947
- if (!decision.decided) {
61948
- process.stdout.write("\n\u2713 preflight: ready to build\n");
61949
- if (options.push) {
61950
- process.stdout.write("\n\u{1F680} \u0110ang \u0111\u1EA9y d\u1EEF li\u1EC7u l\xEAn Dashboard...\n");
61951
- const loaded = await loadConfig(
61952
- options.config === void 0 ? { cwd: repoRoot } : { cwd: repoRoot, configPath: options.config }
61953
- );
61954
- if (!loaded.ok) {
61955
- console.error(red(`
61956
- L\u1ED7i \u0111\u1ECDc c\u1EA5u h\xECnh: ${loaded.error.message}`));
61957
- return 2;
61958
- }
61959
- const config = loaded.value.config;
61960
- const link = await new FileWorkspaceLinkStore(repoRoot).read();
61961
- if (!link) {
61962
- console.error(
61963
- red(
61964
- "\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`."
61965
- )
61966
- );
61967
- return 2;
61968
- }
61969
- const serverUrl = link.serverUrl ?? config.dashboard.serverUrl ?? getDefaultDashboardServerUrl();
61970
- let token = config.dashboard.token ?? process.env.CODE_SENTINEL_DASHBOARD_TOKEN;
61971
- if (!token) {
61972
- try {
61973
- const store = createPlatformCredentialStore();
61974
- const credential = await getAuthenticatedCredential({ server: serverUrl, store });
61975
- token = credential.accessToken;
61976
- } catch (e) {
61977
- console.error(
61978
- red(
61979
- `
61980
- Kh\xF4ng th\u1EC3 l\u1EA5y x\xE1c th\u1EF1c Dashboard: ${e instanceof Error ? e.message : String(e)}
61981
- H\xE3y ch\u1EA1y \`cs auth login\`.`
61982
- )
61983
- );
61984
- return 2;
61985
- }
61986
- }
61987
- try {
61988
- const url = `${serverUrl.replace(/\/+$/, "")}/api/projects/${encodeURIComponent(link.projectId)}/pentest-requests`;
61989
- const { readFileSync: readFileSync3 } = await import('fs');
61990
- const formData = new FormData();
61991
- formData.append("sourceKind", "archive");
61992
- formData.append("archive", new Blob([readFileSync3(outPath)]), basename(outPath));
61993
- formData.append("useAi", resolveAuthOnServer ? "true" : "false");
61994
- const res = await fetch(url, {
61995
- method: "POST",
61996
- headers: { authorization: `Bearer ${token}` },
61997
- body: formData
61998
- });
61999
- if (!res.ok) {
62000
- const text2 = await res.text().catch(() => "");
62001
- console.error(red(`
62002
- Server t\u1EEB ch\u1ED1i y\xEAu c\u1EA7u (HTTP ${res.status}): ${text2}`));
62003
- return 2;
62004
- }
62005
- const body = await res.json().catch(() => ({}));
62006
- const createdId = body.request?.id ?? body.id;
62007
- console.log(green(`[\u2713] \u0110\u1EA9y th\xE0nh c\xF4ng! \u0110\xE3 t\u1EA1o request ID: ${createdId ?? "unknown"}`));
62008
- console.log(
62009
- `\u{1F517} Link theo d\xF5i: ${serverUrl}/projects/${link.projectId}/pentest-requests${createdId ? `/${createdId}` : ""}`
62010
- );
62011
- if (body.request?.status === "failed" && body.request.failureReason) {
62012
- console.error(red(`
62013
- \u26A0 Y\xEAu c\u1EA7u th\u1EA5t b\u1EA1i: ${body.request.failureReason}`));
62014
- }
62015
- } catch (e) {
62016
- console.error(red(`
62017
- L\u1ED7i m\u1EA1ng khi upload: ${e instanceof Error ? e.message : String(e)}`));
62018
- return 2;
62019
- }
62020
- }
62021
- return 0;
62022
- }
62023
- process.stdout.write(`
62024
- \u2717 preflight still stops at ${decision.tier} \u2014 ${decision.stopReason}
62025
- `);
62026
- for (const evidence17 of report2.evidence.slice(0, 5)) {
62027
- process.stdout.write(` ${evidence17.source}: ${evidence17.verbatim}
62028
- `);
62029
- }
62030
- return 1;
61465
+ return 1;
62031
61466
  };
62032
61467
 
62033
61468
  // src/commands/report.command.ts
@@ -62129,7 +61564,8 @@ var remoteClient = async (server) => {
62129
61564
  });
62130
61565
  };
62131
61566
  var linkedContext = async (path) => {
62132
- const link = await new FileWorkspaceLinkStore(resolve(path ?? process.cwd())).read();
61567
+ const resolvedLink = await findWorkspaceLink(resolve(path ?? process.cwd()));
61568
+ const link = resolvedLink?.link ?? null;
62133
61569
  if (!link)
62134
61570
  throw new Error("This workspace is not linked. Run `cs project` first or pass --project-id.");
62135
61571
  return { server: link.serverUrl, projectId: link.projectId };
@@ -62555,8 +61991,8 @@ var findProjectConfig = async (projectDir) => {
62555
61991
  );
62556
61992
  }
62557
61993
  }
62558
- for (const basename11 of READ_ONLY_BASENAMES) {
62559
- const p = resolve(projectDir, basename11);
61994
+ for (const basename12 of READ_ONLY_BASENAMES) {
61995
+ const p = resolve(projectDir, basename12);
62560
61996
  if (await fileExists3(p)) {
62561
61997
  return err(
62562
61998
  new ConfigInvalidError(
@@ -62686,7 +62122,8 @@ var runRulePull = async (options = {}) => {
62686
62122
  const writeError = options.writeError ?? console.error;
62687
62123
  const root = resolve(options.path ?? process.cwd());
62688
62124
  try {
62689
- const link = await new FileWorkspaceLinkStore(root).read();
62125
+ const resolvedLink = await findWorkspaceLink(root);
62126
+ const link = resolvedLink?.link ?? null;
62690
62127
  if (!link) {
62691
62128
  writeError("Workspace is not linked. Run `cs project link` before pulling Dashboard rules.");
62692
62129
  return EXIT.USAGE;
@@ -63598,11 +63035,287 @@ var runServerRunner = async (options = {}) => {
63598
63035
  return EXIT.SUCCESS;
63599
63036
  };
63600
63037
 
63038
+ // src/commands/runtime-auth-seed.command.ts
63039
+ init_dist6();
63040
+ init_dist2();
63041
+ init_dist5();
63042
+ init_dist();
63043
+ init_composition();
63044
+ init_load();
63045
+ init_exit_codes();
63046
+ init_find_files();
63047
+ var CONFIG_GLOBS = [
63048
+ "**/application*.yml",
63049
+ "**/application*.yaml",
63050
+ "**/application*.properties",
63051
+ "**/bootstrap*.yml",
63052
+ "**/bootstrap*.yaml",
63053
+ "**/bootstrap*.properties"
63054
+ ];
63055
+ var POM_GLOBS = ["**/pom.xml"];
63056
+ var JAVA_GLOBS2 = ["**/*.java"];
63057
+ var EXCLUDES2 = ["**/node_modules/**", "**/dist/**", "**/target/**"];
63058
+ var MAX_EXCERPTS = 40;
63059
+ var AUTH_SOURCE_RE = /(Filter|Interceptor|Security(Config|Configuration)|Authentication|Authoriz|TokenService|TokenProvider|JwtUtil|UserContext|SessionRegistry)/;
63060
+ var AUTH_CLASS_RE = /((Filter|Interceptor|Aspect)$)|^(UserContext|TokenService|TokenProvider|RedisAbstract|RedisKey|SecurityConfig)/;
63061
+ var MAX_CLASS_NAMES = 120;
63062
+ var MAX_SOURCE_EXCERPTS = 12;
63063
+ var simpleClassName2 = (entry) => (entry.split("/").pop() ?? entry).replace(/\.class$/, "");
63064
+ var DEFAULT_REDIS_HOST = "127.0.0.1";
63065
+ var DEFAULT_REDIS_PORT = 6379;
63066
+ var buildEvidence = (configs, bundled, sources, classNames, classConstants = []) => {
63067
+ const relevant = classNames.filter((n) => AUTH_CLASS_RE.test(simpleClassName2(n))).slice(0, MAX_CLASS_NAMES);
63068
+ const out = [];
63069
+ if (relevant.length > 0) {
63070
+ out.push({
63071
+ path: "<declared jars> \u2014 auth-relevant class inventory",
63072
+ content: [
63073
+ "These classes ship inside the jars this project declares. The authentication gate may be",
63074
+ "implemented here rather than in the source tree; name the scheme from these if so.",
63075
+ "",
63076
+ ...relevant
63077
+ ].join(String.fromCharCode(10))
63078
+ });
63079
+ }
63080
+ for (const c of classConstants) {
63081
+ if (c.constants.length === 0) continue;
63082
+ out.push({
63083
+ path: `${c.entry} \u2014 string constants`,
63084
+ content: c.constants.join(String.fromCharCode(10))
63085
+ });
63086
+ }
63087
+ return [...out, ...sources, ...bundled, ...configs].slice(0, MAX_EXCERPTS).map((f) => "path" in f ? f : { path: f.file, content: f.content });
63088
+ };
63089
+ var runRuntimeAuthSeed = async (options) => {
63090
+ if (options.emitHypothesis !== void 0 && options.hypothesis !== void 0) {
63091
+ console.error(
63092
+ "[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)."
63093
+ );
63094
+ return EXIT.USAGE;
63095
+ }
63096
+ const source = resolve(process.cwd(), options.source);
63097
+ const configResult = await findFiles({
63098
+ projectRoot: source,
63099
+ include: CONFIG_GLOBS,
63100
+ exclude: EXCLUDES2
63101
+ });
63102
+ if (!configResult.ok) {
63103
+ console.error(`[auth-seed] Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c c\u1EA5u h\xECnh trong ${source} \u2192 kh\xF4ng gieo seed.`);
63104
+ return EXIT.SUCCESS;
63105
+ }
63106
+ const files = configResult.value.map((f) => ({
63107
+ file: f.path,
63108
+ content: f.content
63109
+ }));
63110
+ let dependencyConfigFiles = [];
63111
+ const pomsResult = await findFiles({
63112
+ projectRoot: source,
63113
+ include: POM_GLOBS,
63114
+ exclude: EXCLUDES2
63115
+ });
63116
+ if (pomsResult.ok) {
63117
+ dependencyConfigFiles = collectDependencyConfigFiles(
63118
+ pomsResult.value.map((f) => ({ absolutePath: f.absolutePath, content: f.content }))
63119
+ ).map((f) => ({ file: f.path, content: f.content }));
63120
+ }
63121
+ const javaResult = await findFiles({
63122
+ projectRoot: source,
63123
+ include: JAVA_GLOBS2,
63124
+ exclude: EXCLUDES2
63125
+ });
63126
+ const endpoints = javaResult.ok ? extractHttpEndpoints(javaResult.value).map((e) => ({
63127
+ httpMethod: e.httpMethod,
63128
+ path: e.path
63129
+ })) : [];
63130
+ 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 })) : [];
63131
+ const pomRefs = pomsResult.ok ? pomsResult.value.map((f) => ({ absolutePath: f.absolutePath, content: f.content })) : [];
63132
+ const dependencyJarKeys = collectJwtKeyCandidates(pomRefs);
63133
+ const decodeOnlyEvidence = collectDecodeOnlyEvidence(pomRefs);
63134
+ const dependencyClasses = collectDependencyClassNames(pomRefs);
63135
+ const dependencyConstants = collectDependencyClassConstants(
63136
+ pomRefs,
63137
+ (entry) => AUTH_CLASS_RE.test(simpleClassName2(entry))
63138
+ );
63139
+ const signingKeyAvailable = discoverJwtSigningKeys(files).length > 0 || discoverJwtSigningKeys(dependencyConfigFiles).length > 0 || dependencyJarKeys.length > 0 || decodeOnlyEvidence.length > 0;
63140
+ const excerpts = buildEvidence(
63141
+ files,
63142
+ dependencyConfigFiles,
63143
+ authSources,
63144
+ dependencyClasses,
63145
+ dependencyConstants
63146
+ );
63147
+ const rawPolicy = options.hypothesisProvenance ?? "warn";
63148
+ if (options.hypothesisProvenance !== void 0 && !isProvenancePolicy(rawPolicy)) {
63149
+ console.error(`[auth-seed] --hypothesis-provenance kh\xF4ng h\u1EE3p l\u1EC7 (${rawPolicy}); d\xF9ng 'warn'.`);
63150
+ }
63151
+ const provenancePolicy = isProvenancePolicy(rawPolicy) ? rawPolicy : "warn";
63152
+ let preResolved;
63153
+ if (options.hypothesis !== void 0) {
63154
+ const path = resolve(process.cwd(), options.hypothesis);
63155
+ const read = await readHypothesisFile(path);
63156
+ if (!read.ok) {
63157
+ console.error(
63158
+ `[auth-seed] Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c gi\u1EA3 thuy\u1EBFt t\u1EEB ${options.hypothesis} (${read.error}) \u2192 b\u1ECF.`
63159
+ );
63160
+ preResolved = { hypothesis: null, outcome: "no-proposal" };
63161
+ } else {
63162
+ const validated = validateRuntimeAuthHypothesis(read.result.hypothesis);
63163
+ const { provenance: provenance2 } = read.result;
63164
+ const decision = resolveHypothesisProvenance({
63165
+ policy: provenancePolicy,
63166
+ provenance: provenance2,
63167
+ expectedInputHash: hypothesisInputHash(
63168
+ buildHypothesisInput({
63169
+ kind: "runtime-auth",
63170
+ promptVersion: RUNTIME_AUTH_PROMPT_VERSION,
63171
+ provider: provenance2?.provider ?? "",
63172
+ modelId: provenance2?.modelId ?? "",
63173
+ excerpts,
63174
+ endpoints,
63175
+ signingKeyAvailable
63176
+ })
63177
+ )
63178
+ });
63179
+ console.error(`[auth-seed] ${describeHypothesisProvenance(provenance2, decision)}`);
63180
+ const accepted = decision.useHypothesis ? validated : null;
63181
+ preResolved = {
63182
+ hypothesis: accepted,
63183
+ outcome: accepted === null ? "rejected" : "accepted"
63184
+ };
63185
+ console.error(
63186
+ 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).`
63187
+ );
63188
+ }
63189
+ }
63190
+ let resolver = createStubRuntimeAuthHypothesisResolver();
63191
+ let providerName = "none";
63192
+ let modelId = "<none>";
63193
+ if (options.useAi === true && preResolved === void 0) {
63194
+ const logger = createLogger({ level: "warn", destination: "stderr" });
63195
+ const config = await loadConfig(
63196
+ options.config === void 0 ? { cwd: source } : { cwd: source, configPath: resolve(process.cwd(), options.config) }
63197
+ );
63198
+ const client = config.ok ? buildAiClient(config.value.config, logger) : null;
63199
+ if (!config.ok) {
63200
+ console.error(
63201
+ `[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.`
63202
+ );
63203
+ } else if (client === null) {
63204
+ console.error(
63205
+ "[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."
63206
+ );
63207
+ } else {
63208
+ resolver = createRuntimeAuthHypothesisResolver({ client, logger });
63209
+ providerName = client.name;
63210
+ modelId = resolveActiveModel(config.value.config);
63211
+ console.error(`[auth-seed] H\u1ECFi gi\u1EA3 thuy\u1EBFt x\xE1c th\u1EF1c qua ${client.name} (model ${modelId}).`);
63212
+ }
63213
+ }
63214
+ if (options.useAi === true && preResolved === void 0) {
63215
+ const chars = excerpts.reduce((n, e) => n + e.content.length, 0);
63216
+ console.error(`[auth-seed] B\u1EB1ng ch\u1EE9ng: ${excerpts.length} excerpt \xB7 ${chars} k\xFD t\u1EF1.`);
63217
+ }
63218
+ const hypothesisInput = buildHypothesisInput({
63219
+ kind: "runtime-auth",
63220
+ promptVersion: RUNTIME_AUTH_PROMPT_VERSION,
63221
+ provider: providerName,
63222
+ modelId,
63223
+ excerpts,
63224
+ endpoints,
63225
+ signingKeyAvailable
63226
+ });
63227
+ const inputHash = hypothesisInputHash(hypothesisInput);
63228
+ const pinned = preResolved === void 0 && options.refreshHypothesis !== true ? await loadPin(inputHash) : null;
63229
+ const pinnedHypothesis = pinned === null ? null : validateRuntimeAuthHypothesis(pinned.hypothesis);
63230
+ if (pinned !== null && pinnedHypothesis === null) {
63231
+ console.error(
63232
+ "[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."
63233
+ );
63234
+ } else if (pinnedHypothesis !== null) {
63235
+ console.error(
63236
+ `[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.`
63237
+ );
63238
+ }
63239
+ const resolution = pinnedHypothesis !== null ? { hypothesis: pinnedHypothesis, outcome: "accepted" } : preResolved !== void 0 ? preResolved : await resolveRuntimeAuthHypothesis(resolver, {
63240
+ excerpts,
63241
+ endpoints,
63242
+ signingKeyAvailable
63243
+ });
63244
+ const { hypothesis, outcome, rejectedShape } = resolution;
63245
+ if (hypothesis === null) {
63246
+ 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)";
63247
+ console.error(
63248
+ 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).` : (
63249
+ // No file is written, so downstream "no parameter" means "deterministic path" with no
63250
+ // second way to spell it.
63251
+ `[auth-seed] ${why} \u2192 KH\xD4NG ghi gi\u1EA3 thuy\u1EBFt; lane runtime s\u1EBD ch\u1EA1y \u0111\u01B0\u1EDDng t\u1EA5t \u0111\u1ECBnh.`
63252
+ )
63253
+ );
63254
+ return EXIT.SUCCESS;
63255
+ }
63256
+ if (options.emitHypothesis !== void 0) {
63257
+ const out = resolve(process.cwd(), options.emitHypothesis);
63258
+ const provenance2 = pinned?.provenance ?? stampProvenance({
63259
+ input: hypothesisInput,
63260
+ hypothesis,
63261
+ attempts: resolution.attempts ?? 1
63262
+ });
63263
+ await writeEnvelopeFile(out, "runtime-auth", hypothesis, provenance2);
63264
+ if (pinned === null) {
63265
+ const saved = await savePin(inputHash, "runtime-auth", hypothesis, provenance2);
63266
+ if (!saved) {
63267
+ console.error(
63268
+ "[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."
63269
+ );
63270
+ }
63271
+ }
63272
+ console.error(
63273
+ `[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.`
63274
+ );
63275
+ return EXIT.SUCCESS;
63276
+ }
63277
+ const plan = buildRuntimeAuthSeedPlan(hypothesis, {
63278
+ files,
63279
+ dependencyConfigFiles,
63280
+ dependencyJarKeys,
63281
+ decodeOnlyEvidence
63282
+ });
63283
+ if (plan === null) {
63284
+ console.error(
63285
+ `[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.`
63286
+ );
63287
+ return EXIT.SUCCESS;
63288
+ }
63289
+ const result = await applyRuntimeAuthSeed(plan, {
63290
+ host: options.redisHost ?? DEFAULT_REDIS_HOST,
63291
+ port: options.redisPort ?? DEFAULT_REDIS_PORT,
63292
+ ...options.timeoutMs === void 0 ? {} : { timeoutMs: options.timeoutMs }
63293
+ });
63294
+ if (!result.ok) {
63295
+ for (const f of result.failures) {
63296
+ console.error(`[auth-seed] L\u1EC7nh th\u1EA5t b\u1EA1i: ${f.command} \u2014 ${f.error}`);
63297
+ }
63298
+ console.error(
63299
+ `[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.`
63300
+ );
63301
+ return EXIT.SUCCESS;
63302
+ }
63303
+ console.error(
63304
+ `[auth-seed] \u0110\xE3 gieo ${result.applied} kho\xE1 state cho scheme \`${hypothesis.scheme}\`.`
63305
+ );
63306
+ console.error(`[auth-seed] \u0110\u1ED8 L\u1EC6CH: ${plan.deviation}`);
63307
+ process.stdout.write(
63308
+ `${plan.credential.value.startsWith("Bearer ") ? plan.credential.value.slice(7) : plan.credential.value}
63309
+ `
63310
+ );
63311
+ return EXIT.SUCCESS;
63312
+ };
63313
+
63601
63314
  // src/commands/runtime-auth-token.command.ts
63602
63315
  init_dist5();
63603
63316
  init_exit_codes();
63604
63317
  init_find_files();
63605
- var CONFIG_GLOBS3 = [
63318
+ var CONFIG_GLOBS2 = [
63606
63319
  "**/application*.yml",
63607
63320
  "**/application*.yaml",
63608
63321
  "**/application*.properties",
@@ -63624,7 +63337,7 @@ var runRuntimeAuthToken = async (options) => {
63624
63337
  const source = resolve(process.cwd(), options.source);
63625
63338
  const filesResult = await findFiles({
63626
63339
  projectRoot: source,
63627
- include: CONFIG_GLOBS3,
63340
+ include: CONFIG_GLOBS2,
63628
63341
  exclude: CONFIG_EXCLUDES
63629
63342
  });
63630
63343
  if (!filesResult.ok) {
@@ -63691,6 +63404,319 @@ var runRuntimeAuthToken = async (options) => {
63691
63404
  return EXIT.SUCCESS;
63692
63405
  };
63693
63406
 
63407
+ // src/commands/runtime-data-seed.command.ts
63408
+ init_dist6();
63409
+ init_dist2();
63410
+ init_dist2();
63411
+ init_dist5();
63412
+ init_dist();
63413
+ init_dist4();
63414
+ init_composition();
63415
+ init_load();
63416
+ init_exit_codes();
63417
+ init_find_files();
63418
+ var CONFIG_GLOBS3 = [
63419
+ "**/application*.yml",
63420
+ "**/application*.yaml",
63421
+ "**/application*.properties",
63422
+ "**/bootstrap*.yml",
63423
+ "**/bootstrap*.yaml",
63424
+ "**/bootstrap*.properties"
63425
+ ];
63426
+ var DB_BUILD_GLOBS2 = ["**/pom.xml", "**/build.gradle", "**/build.gradle.kts"];
63427
+ var JAVA_GLOBS3 = ["**/*.java"];
63428
+ var SCHEMA_GLOBS = [
63429
+ "**/liquibase/**",
63430
+ "**/flyway/**",
63431
+ "**/db/migration/**",
63432
+ "**/*changelog*.xml",
63433
+ "**/schema.sql",
63434
+ "**/data.sql",
63435
+ "**/import.sql"
63436
+ ];
63437
+ var EXCLUDES3 = ["**/node_modules/**", "**/dist/**", "**/target/**"];
63438
+ var ENV_SEED_GLOBS = ["**/.env", "**/*.env"];
63439
+ var MAX_ENV_FILE_BYTES = 1024 * 1024;
63440
+ var MAX_EXCERPTS2 = 40;
63441
+ var ENTITY_RE = /@(Entity|Table)\b/;
63442
+ var buildDataSeedEvidence = (schemaFiles, entityFiles, configs) => [...schemaFiles, ...entityFiles, ...configs].slice(0, MAX_EXCERPTS2);
63443
+ var readEnvSeedFiles = async (root) => {
63444
+ try {
63445
+ const paths = await glob([...ENV_SEED_GLOBS], {
63446
+ cwd: root,
63447
+ ignore: [...EXCLUDES3, "**/.git/**"],
63448
+ onlyFiles: true,
63449
+ dot: true
63450
+ });
63451
+ const files = [];
63452
+ for (const p of paths.sort()) {
63453
+ let content;
63454
+ try {
63455
+ content = await readFile(resolve(root, p), "utf8");
63456
+ } catch {
63457
+ continue;
63458
+ }
63459
+ if (Buffer.byteLength(content, "utf8") > MAX_ENV_FILE_BYTES) continue;
63460
+ const abs = resolve(root, p);
63461
+ files.push({
63462
+ path: toPosix(p),
63463
+ absolutePath: abs,
63464
+ language: languageFromPath(p) ?? "text",
63465
+ content,
63466
+ hash: sha256(content),
63467
+ size: Buffer.byteLength(content, "utf8")
63468
+ });
63469
+ }
63470
+ return files;
63471
+ } catch {
63472
+ return [];
63473
+ }
63474
+ };
63475
+ var runRuntimeDataSeed = async (options) => {
63476
+ if (options.emitHypothesis !== void 0 && options.hypothesis !== void 0) {
63477
+ console.error(
63478
+ "[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)."
63479
+ );
63480
+ return EXIT.USAGE;
63481
+ }
63482
+ if (options.renderSql !== void 0 && options.hypothesis === void 0) {
63483
+ console.error("[data-seed] --render-sql c\u1EA7n --hypothesis (lane ti\xEAu th\u1EE5 trong pod).");
63484
+ return EXIT.USAGE;
63485
+ }
63486
+ if (options.deriveObjectStoreSeed !== void 0 && (options.emitHypothesis !== void 0 || options.hypothesis !== void 0)) {
63487
+ console.error(
63488
+ "[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."
63489
+ );
63490
+ return EXIT.USAGE;
63491
+ }
63492
+ const source = resolve(process.cwd(), options.source);
63493
+ const configResult = await findFiles({
63494
+ projectRoot: source,
63495
+ include: CONFIG_GLOBS3,
63496
+ exclude: EXCLUDES3
63497
+ });
63498
+ const configs = configResult.ok ? configResult.value.map((f) => ({ path: f.path, content: f.content })) : [];
63499
+ const buildResult2 = await findFiles({
63500
+ projectRoot: source,
63501
+ include: DB_BUILD_GLOBS2,
63502
+ exclude: EXCLUDES3
63503
+ });
63504
+ const javaResult = await findFiles({
63505
+ projectRoot: source,
63506
+ include: JAVA_GLOBS3,
63507
+ exclude: EXCLUDES3
63508
+ });
63509
+ const javaFiles = javaResult.ok ? javaResult.value : [];
63510
+ const endpoints = javaResult.ok ? extractHttpEndpoints(javaResult.value) : [];
63511
+ if (options.deriveObjectStoreSeed !== void 0) {
63512
+ const poms = buildResult2.ok ? buildResult2.value : [];
63513
+ const envFiles = await readEnvSeedFiles(source);
63514
+ const jarConfigs = collectDependencyConfigFiles(poms);
63515
+ const derivation = deriveObjectStoreSeedTargets([
63516
+ ...configResult.ok ? configResult.value : [],
63517
+ ...envFiles,
63518
+ ...jarConfigs
63519
+ ]);
63520
+ if (derivation.targets.length === 0) {
63521
+ console.error(
63522
+ "[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)."
63523
+ );
63524
+ return EXIT.SUCCESS;
63525
+ }
63526
+ const validated = validateRuntimeDataSeedHypothesis({
63527
+ scheme: "object-put",
63528
+ targets: derivation.targets,
63529
+ evidence: derivation.evidence
63530
+ });
63531
+ if (validated === null || validated.scheme !== "object-put") {
63532
+ console.error(
63533
+ "[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)."
63534
+ );
63535
+ return EXIT.SUCCESS;
63536
+ }
63537
+ const tsv = renderObjectStoreSeedTsv(validated);
63538
+ const out = resolve(process.cwd(), options.deriveObjectStoreSeed);
63539
+ await mkdir(resolve(out, ".."), { recursive: true });
63540
+ await writeFile(out, tsv, "utf8");
63541
+ console.error(
63542
+ `[data-seed] \u0110\xE3 derive ${validated.targets.length} bucket object-store (baseline key \`1\`) \u2192 ${options.deriveObjectStoreSeed}.`
63543
+ );
63544
+ return EXIT.SUCCESS;
63545
+ }
63546
+ if (options.emitHypothesis !== void 0) {
63547
+ let resolver = createStubRuntimeDataSeedResolver();
63548
+ let providerName = "none";
63549
+ let modelId = "<none>";
63550
+ if (options.useAi === true) {
63551
+ const logger = createLogger({ level: "warn", destination: "stderr" });
63552
+ const config = await loadConfig(
63553
+ options.config === void 0 ? { cwd: source } : { cwd: source, configPath: resolve(process.cwd(), options.config) }
63554
+ );
63555
+ const client = config.ok ? buildAiClient(config.value.config, logger) : null;
63556
+ if (!config.ok) {
63557
+ console.error(
63558
+ `[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.`
63559
+ );
63560
+ } else if (client === null) {
63561
+ console.error(
63562
+ "\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)."
63563
+ );
63564
+ } else {
63565
+ const resolverOptions = { client, logger };
63566
+ resolver = createRuntimeDataSeedResolver(resolverOptions);
63567
+ providerName = client.name;
63568
+ modelId = resolveActiveModel(config.value.config);
63569
+ console.error(`[data-seed] H\u1ECFi gi\u1EA3 thuy\u1EBFt d\u1EEF li\u1EC7u qua ${client.name} (model ${modelId}).`);
63570
+ }
63571
+ }
63572
+ const manifest = buildReachabilityManifest(endpoints, {});
63573
+ const endpointSummaries = dataSeedEndpointSummaries(manifest.entries);
63574
+ const schemaResult = await findFiles({
63575
+ projectRoot: source,
63576
+ include: SCHEMA_GLOBS,
63577
+ exclude: EXCLUDES3
63578
+ });
63579
+ const schemaFiles = schemaResult.ok ? schemaResult.value.map((f) => ({ path: f.path, content: f.content })) : [];
63580
+ const entityFiles = javaFiles.filter((f) => ENTITY_RE.test(f.content)).map((f) => ({ path: f.path, content: f.content }));
63581
+ const excerpts = buildDataSeedEvidence(schemaFiles, entityFiles, configs);
63582
+ if (options.useAi === true) {
63583
+ const chars = excerpts.reduce((n, e) => n + e.content.length, 0);
63584
+ console.error(
63585
+ `[data-seed] B\u1EB1ng ch\u1EE9ng: ${excerpts.length} excerpt \xB7 ${chars} k\xFD t\u1EF1 \xB7 ${endpointSummaries.length} endpoint c\u1EA7n seed.`
63586
+ );
63587
+ }
63588
+ const hypothesisInput = buildHypothesisInput({
63589
+ kind: "runtime-data-seed",
63590
+ promptVersion: RUNTIME_DATA_SEED_PROMPT_VERSION,
63591
+ provider: providerName,
63592
+ modelId,
63593
+ excerpts,
63594
+ endpoints: endpointSummaries.map((e) => ({ httpMethod: e.httpMethod, path: e.path }))
63595
+ });
63596
+ const inputHash = hypothesisInputHash(hypothesisInput);
63597
+ const pinned = options.refreshHypothesis === true ? null : await loadPin(inputHash);
63598
+ const pinnedHypothesis = pinned === null ? null : validateRuntimeDataSeedHypothesis(pinned.hypothesis);
63599
+ if (pinned !== null && pinnedHypothesis === null) {
63600
+ console.error(
63601
+ "[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."
63602
+ );
63603
+ } else if (pinnedHypothesis !== null) {
63604
+ console.error(
63605
+ `[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.`
63606
+ );
63607
+ }
63608
+ const resolution = pinnedHypothesis !== null ? { hypothesis: pinnedHypothesis, outcome: "accepted" } : await resolveRuntimeDataSeedHypothesis(resolver, {
63609
+ endpoints: endpointSummaries,
63610
+ excerpts
63611
+ });
63612
+ const { hypothesis, outcome, rejectedShape } = resolution;
63613
+ if (hypothesis === null) {
63614
+ 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)";
63615
+ console.error(
63616
+ `[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).`
63617
+ );
63618
+ return EXIT.SUCCESS;
63619
+ }
63620
+ const out = resolve(process.cwd(), options.emitHypothesis);
63621
+ const provenance2 = pinned?.provenance ?? stampProvenance({
63622
+ input: hypothesisInput,
63623
+ hypothesis,
63624
+ attempts: resolution.attempts ?? 1
63625
+ });
63626
+ await writeEnvelopeFile(out, "runtime-data-seed", hypothesis, provenance2);
63627
+ if (pinned === null) {
63628
+ const saved = await savePin(inputHash, "runtime-data-seed", hypothesis, provenance2);
63629
+ if (!saved) {
63630
+ console.error(
63631
+ "[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."
63632
+ );
63633
+ }
63634
+ }
63635
+ console.error(
63636
+ `[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.`
63637
+ );
63638
+ return EXIT.SUCCESS;
63639
+ }
63640
+ if (options.hypothesis !== void 0) {
63641
+ const path = resolve(process.cwd(), options.hypothesis);
63642
+ let validated = null;
63643
+ const read = await readHypothesisFile(path);
63644
+ if (!read.ok) {
63645
+ console.error(
63646
+ `[data-seed] Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c gi\u1EA3 thuy\u1EBFt t\u1EEB ${options.hypothesis} (${read.error}) \u2192 KH\xD4NG render SQL.`
63647
+ );
63648
+ } else {
63649
+ validated = validateRuntimeDataSeedHypothesis(read.result.hypothesis);
63650
+ const decision = resolveHypothesisProvenance({
63651
+ policy: "warn",
63652
+ provenance: read.result.provenance
63653
+ });
63654
+ console.error(
63655
+ `[data-seed] ${describeHypothesisProvenance(read.result.provenance, decision)}`
63656
+ );
63657
+ if (validated === null) {
63658
+ const problem = describeRuntimeDataSeedHypothesisProblem(read.result.hypothesis);
63659
+ console.error(
63660
+ `[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.`
63661
+ );
63662
+ } else {
63663
+ console.error(
63664
+ `[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).`
63665
+ );
63666
+ }
63667
+ }
63668
+ if (validated === null) return EXIT.SUCCESS;
63669
+ if (validated.scheme === "api-create") {
63670
+ console.error(
63671
+ "[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."
63672
+ );
63673
+ return EXIT.SUCCESS;
63674
+ }
63675
+ if (validated.scheme !== "sql-insert") {
63676
+ console.error(
63677
+ "[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."
63678
+ );
63679
+ return EXIT.SUCCESS;
63680
+ }
63681
+ const auditColumns = detectSeedAuditColumns(javaFiles);
63682
+ const enriched = applySeedAuditColumns(validated, auditColumns);
63683
+ const addedAuditColumns = seedAuditAddedColumns(validated, enriched);
63684
+ if (addedAuditColumns.length > 0) {
63685
+ console.error(
63686
+ `[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).`
63687
+ );
63688
+ }
63689
+ const dbTier = detectDbTier([
63690
+ ...configResult.ok ? configResult.value : [],
63691
+ ...buildResult2.ok ? buildResult2.value : []
63692
+ ]);
63693
+ const dialect = dbTier?.dialect ?? "generic";
63694
+ let sql2;
63695
+ try {
63696
+ sql2 = renderDataSeedSql(enriched, dialect);
63697
+ } catch (e) {
63698
+ console.error(
63699
+ `[data-seed] Render SQL th\u1EA5t b\u1EA1i (${e.message}) \u2192 KH\xD4NG gieo d\u1EEF li\u1EC7u.`
63700
+ );
63701
+ return EXIT.SUCCESS;
63702
+ }
63703
+ const renderOut = options.renderSql;
63704
+ if (renderOut === void 0) return EXIT.USAGE;
63705
+ const out = resolve(process.cwd(), renderOut);
63706
+ await mkdir(resolve(out, ".."), { recursive: true });
63707
+ await writeFile(out, sql2, "utf8");
63708
+ console.error(
63709
+ `[data-seed] \u0110\xE3 render ${validated.targets.length} target \u2192 ${renderOut} (dialect: ${dialect}).`
63710
+ );
63711
+ console.error(`[data-seed] \u0110\u1ED8 L\u1EC6CH: ${runtimeDataSeedDeviationBanner(validated)}`);
63712
+ return EXIT.SUCCESS;
63713
+ }
63714
+ console.error(
63715
+ "[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)."
63716
+ );
63717
+ return EXIT.USAGE;
63718
+ };
63719
+
63694
63720
  // src/commands/runtime-outcome.command.ts
63695
63721
  init_dist2();
63696
63722
  init_dist5();
@@ -65449,7 +65475,9 @@ var buildProgram = () => {
65449
65475
  ...typeof opts.deriveObjectStoreSeed === "string" && opts.deriveObjectStoreSeed.length > 0 ? { deriveObjectStoreSeed: opts.deriveObjectStoreSeed } : {}
65450
65476
  });
65451
65477
  });
65452
- 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(
65478
+ program.command("pentest [targetDir]").description(
65479
+ "\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)"
65480
+ ).addOption(new Option("--source <dir>", "th\u01B0 m\u1EE5c g\u1ED1c repository").hideHelp()).addOption(
65453
65481
  new Option(
65454
65482
  "--module <path>",
65455
65483
  "module c\u1EA7n \u0111\xF3ng g\xF3i, \u0111\u01B0\u1EDDng d\u1EABn t\u01B0\u01A1ng \u0111\u1ED1i so v\u1EDBi g\u1ED1c repo"
@@ -65460,14 +65488,14 @@ var buildProgram = () => {
65460
65488
  ...options,
65461
65489
  source: options.source ?? ".",
65462
65490
  targetDir,
65463
- resolveAuth: true,
65464
- resolveDataSeed: true,
65465
65491
  push: true
65466
65492
  // Always push by default for pentest
65467
65493
  });
65468
65494
  }
65469
65495
  );
65470
- 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(
65496
+ program.command("package [targetDir]").description(
65497
+ "\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"
65498
+ ).addOption(new Option("--source <dir>", "th\u01B0 m\u1EE5c g\u1ED1c repository").hideHelp()).addOption(
65471
65499
  new Option(
65472
65500
  "--module <path>",
65473
65501
  "module c\u1EA7n \u0111\xF3ng g\xF3i, \u0111\u01B0\u1EDDng d\u1EABn t\u01B0\u01A1ng \u0111\u1ED1i so v\u1EDBi g\u1ED1c repo"