(filePath, sourceRoot)
| 420 | }; |
| 421 | } |
| 422 | async enqueueFile(filePath, sourceRoot) { |
| 423 | const startedAt = this.now(); |
| 424 | this.logSkillScanStart({ |
| 425 | phase: "queue", |
| 426 | path: filePath, |
| 427 | sourceRoot, |
| 428 | }); |
| 429 | this.clearCooldownIfElapsed(); |
| 430 | if (this.isCooldownActive()) { |
| 431 | const durationMs = this.now() - startedAt; |
| 432 | this.params.logger.warn("claw-aegis: 冷却期间已跳过 skill 扫描", { |
| 433 | event: "skill_scan_skipped", |
| 434 | state: "cooldown", |
| 435 | path: filePath, |
| 436 | durationMs, |
| 437 | }); |
| 438 | this.logSkillScanFinish({ |
| 439 | phase: "queue", |
| 440 | path: filePath, |
| 441 | sourceRoot, |
| 442 | result: "skipped_cooldown", |
| 443 | durationMs, |
| 444 | }); |
| 445 | return { status: "skipped-cooldown" }; |
| 446 | } |
| 447 | if (path.basename(filePath) !== SKILL_SCAN_TARGET_FILENAME) { |
| 448 | const durationMs = this.now() - startedAt; |
| 449 | this.logSkillScanResult({ |
| 450 | phase: "queue", |
| 451 | path: filePath, |
| 452 | sourceRoot, |
| 453 | result: "ignored_non_skill_file", |
| 454 | durationMs, |
| 455 | }); |
| 456 | this.logSkillScanFinish({ |
| 457 | phase: "queue", |
| 458 | path: filePath, |
| 459 | sourceRoot, |
| 460 | result: "ignored_non_skill_file", |
| 461 | durationMs, |
| 462 | }); |
| 463 | return { status: "already-reviewed" }; |
| 464 | } |
| 465 | let prepared; |
| 466 | try { |
| 467 | prepared = await this.prepareSkillFile(filePath, sourceRoot); |
| 468 | } |
| 469 | catch { |
| 470 | prepared = null; |
| 471 | } |
| 472 | if (!prepared) { |
| 473 | const durationMs = this.now() - startedAt; |
| 474 | this.logSkillScanResult({ |
| 475 | phase: "queue", |
| 476 | path: filePath, |
| 477 | sourceRoot, |
| 478 | result: "ignored_unreadable", |
| 479 | durationMs, |
no test coverage detected