@holdpoint/cli 0.1.0-alpha.3 → 0.1.0-alpha.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.
@@ -5,8 +5,8 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>holdpoint builder</title>
8
- <script type="module" crossorigin src="/assets/index-BxfWKnb5.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-DkLHZ-in.css">
8
+ <script type="module" crossorigin src="/assets/index-BqVxTIWS.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-3J1uDBNl.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="root"></div>
package/dist/index.js CHANGED
@@ -557,6 +557,8 @@ function detectStaleChecks(config, repoFiles) {
557
557
  // src/commands/check.ts
558
558
  var COMMIT_CACHE_PATH = ".holdpoint/checked-commits.json";
559
559
  var COMMIT_CACHE_MAX = 100;
560
+ var CHECK_REPORTS_PATH = ".holdpoint/check-reports.json";
561
+ var CHECK_REPORTS_MAX = 50;
560
562
  function getStagedFiles() {
561
563
  try {
562
564
  const out = execSync3("git diff --cached --name-only", {
@@ -618,6 +620,25 @@ function recordCommitCache(sha) {
618
620
  } catch {
619
621
  }
620
622
  }
623
+ function recordCheckReport(run) {
624
+ try {
625
+ mkdirSync2(join4(CHECK_REPORTS_PATH, ".."), { recursive: true });
626
+ let existing = { runs: [] };
627
+ if (existsSync5(CHECK_REPORTS_PATH)) {
628
+ try {
629
+ existing = JSON.parse(readFileSync4(CHECK_REPORTS_PATH, "utf8"));
630
+ if (!Array.isArray(existing.runs)) existing.runs = [];
631
+ } catch {
632
+ existing = { runs: [] };
633
+ }
634
+ }
635
+ const updated = {
636
+ runs: [run, ...existing.runs].slice(0, CHECK_REPORTS_MAX)
637
+ };
638
+ writeFileSync2(CHECK_REPORTS_PATH, JSON.stringify(updated, null, 2) + "\n", "utf8");
639
+ } catch {
640
+ }
641
+ }
621
642
  async function checkCommand(options) {
622
643
  if (!existsSync5("checks.yaml")) {
623
644
  console.error(chalk2.red("No checks.yaml found. Run `holdpoint init` first."));
@@ -631,14 +652,14 @@ async function checkCommand(options) {
631
652
  console.error(chalk2.red("Invalid checks.yaml:"), err.message);
632
653
  process.exit(1);
633
654
  }
655
+ const headSha = getHeadSha();
634
656
  let changedFiles;
635
- let headSha = null;
657
+ let usedHeadShaForCache = false;
636
658
  if (options.staged) {
637
659
  const staged = getStagedFiles();
638
660
  if (staged.length > 0) {
639
661
  changedFiles = staged;
640
662
  } else {
641
- headSha = getHeadSha();
642
663
  if (headSha && readCommitCache().has(headSha)) {
643
664
  console.log(
644
665
  chalk2.green(`\u2713 Commit ${headSha.slice(0, 8)} already verified \u2014 nothing to re-check.`)
@@ -648,6 +669,7 @@ async function checkCommand(options) {
648
669
  const lastCommit = getLastCommitFiles();
649
670
  if (lastCommit.length > 0) {
650
671
  changedFiles = lastCommit;
672
+ usedHeadShaForCache = true;
651
673
  console.log(
652
674
  chalk2.yellow("No staged files. Running checks scoped to the most recent commit's files.")
653
675
  );
@@ -662,6 +684,11 @@ async function checkCommand(options) {
662
684
  console.log(
663
685
  chalk2.yellow("No changed files detected. Running all checks with no file filter.")
664
686
  );
687
+ console.log(
688
+ chalk2.dim(
689
+ " Tip: if you just ran `holdpoint init`, commit the generated files to clear the git-commit check."
690
+ )
691
+ );
665
692
  }
666
693
  }
667
694
  const guides = Object.entries(config.context?.guides ?? {});
@@ -727,10 +754,41 @@ ${chalk2.cyan("Agent prompts to act on:")}`);
727
754
  console.log(` ${chalk2.yellow("\u25A1")} [${c.label}] ${c.prompt ?? ""}`);
728
755
  }
729
756
  }
757
+ const reportResults = [
758
+ ...results.map((r) => ({
759
+ id: r.check.id,
760
+ label: r.check.label,
761
+ kind: "cmd",
762
+ status: r.status,
763
+ ...r.output !== void 0 ? { output: r.output } : {},
764
+ ...r.exitCode !== void 0 ? { exitCode: r.exitCode } : {},
765
+ ...r.skipReason !== void 0 ? { skipReason: r.skipReason } : {}
766
+ })),
767
+ ...promptChecks.map((c) => ({
768
+ id: c.id,
769
+ label: c.label,
770
+ kind: "prompt",
771
+ status: "shown"
772
+ }))
773
+ ];
774
+ const run = {
775
+ sha: headSha,
776
+ shortSha: headSha ? headSha.slice(0, 8) : null,
777
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
778
+ files: changedFiles.length > 0 ? changedFiles : [],
779
+ results: reportResults,
780
+ summary: {
781
+ passed: passed.length,
782
+ failed: failed.length,
783
+ skipped: skipped.length,
784
+ shown: promptChecks.length
785
+ }
786
+ };
787
+ recordCheckReport(run);
730
788
  if (failed.length > 0) {
731
789
  process.exit(1);
732
790
  }
733
- if (headSha) {
791
+ if (usedHeadShaForCache && headSha) {
734
792
  recordCommitCache(headSha);
735
793
  }
736
794
  }
@@ -902,6 +960,17 @@ function handleRequest(req, res, uiDir) {
902
960
  }
903
961
  return;
904
962
  }
963
+ if (url === "/__holdpoint/initial-reports") {
964
+ const reportsPath = join5(process.cwd(), ".holdpoint", "check-reports.json");
965
+ if (existsSync8(reportsPath)) {
966
+ res.writeHead(200, { "Content-Type": "application/json" });
967
+ createReadStream(reportsPath).pipe(res);
968
+ } else {
969
+ res.writeHead(404, { "Content-Type": "text/plain" });
970
+ res.end("No check reports found");
971
+ }
972
+ return;
973
+ }
905
974
  const candidate = join5(uiDir, url === "/" ? "index.html" : url);
906
975
  const filePath = existsSync8(candidate) ? candidate : join5(uiDir, "index.html");
907
976
  serveFile(res, filePath);