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