@integrity-labs/agt-cli 0.28.781 → 0.28.782

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/agt.js CHANGED
@@ -40,7 +40,7 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-GFKNOWPF.js";
43
+ } from "../chunk-WP2NPGER.js";
44
44
  import {
45
45
  getProjectDir,
46
46
  isSessionResumeDisabled,
@@ -5467,7 +5467,7 @@ import { execFileSync, execSync } from "child_process";
5467
5467
  import { existsSync as existsSync11, realpathSync as realpathSync2 } from "fs";
5468
5468
  import chalk18 from "chalk";
5469
5469
  import ora16 from "ora";
5470
- var cliVersion = true ? "0.28.781" : "dev";
5470
+ var cliVersion = true ? "0.28.782" : "dev";
5471
5471
  async function fetchLatestVersion() {
5472
5472
  const host2 = getHost();
5473
5473
  if (!host2) return null;
@@ -6658,7 +6658,7 @@ function handleError(err) {
6658
6658
  }
6659
6659
 
6660
6660
  // src/bin/agt.ts
6661
- var cliVersion2 = true ? "0.28.781" : "dev";
6661
+ var cliVersion2 = true ? "0.28.782" : "dev";
6662
6662
  var program = new Command();
6663
6663
  program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
6664
6664
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -3647,6 +3647,7 @@ function provisionOrientHook(codeName) {
3647
3647
  const claudeDir = join3(projectDir, ".claude");
3648
3648
  mkdirSync3(claudeDir, { recursive: true });
3649
3649
  const agentDir = getAgentDir(codeName);
3650
+ const codeRoots = [join3(getHomeDir(), "code"), join3(agentDir, "code")];
3650
3651
  const hookScriptPath = join3(claudeDir, "agt-orient-hook.sh");
3651
3652
  const hookScript = [
3652
3653
  "#!/bin/bash",
@@ -3658,6 +3659,7 @@ function provisionOrientHook(codeName) {
3658
3659
  "",
3659
3660
  `CODE_NAME="${codeName}"`,
3660
3661
  `AGENT_DIR="${agentDir}"`,
3662
+ `CODE_ROOTS=(${codeRoots.map((d) => `"${d}"`).join(" ")})`,
3661
3663
  "NOW_ISO=$(date -u +%Y-%m-%dT%H:%M:%SZ)",
3662
3664
  'NOW_LOCAL=$(date "+%Y-%m-%d %H:%M %Z")',
3663
3665
  "",
@@ -3749,6 +3751,101 @@ function provisionOrientHook(codeName) {
3749
3751
  "echo",
3750
3752
  'echo "Before you respond, call **kanban_list** to see your in-progress and recently-completed cards and reconstruct what you were working on. If a card is still \\"in_progress\\" (or a queued message above maps to one), that is almost certainly the work you were interrupted on - pick it back up. Use **kanban_search** for older or already-closed cards if needed. As you resume, update the card (kanban_progress / kanban_log) so the next restart has an even clearer trail. Do NOT re-do a card already marked done."',
3751
3753
  "",
3754
+ "",
3755
+ "# --- Code checkouts (ENG-9863) -----------------------------------------",
3756
+ "# An agent clones a repo once and nothing ever moves it again, so a working",
3757
+ "# tree drifts silently and continuously behind the branch it was cut from.",
3758
+ "# The failure this prevents is specific and nasty: a grep against a stale",
3759
+ "# tree returns a CONFIDENT ZERO for a symbol that exists on main, and a",
3760
+ "# negative result reads as a finding rather than as an error. sherlock was",
3761
+ "# one step from telling a teammate her correct report was wrong, off a tree",
3762
+ "# 1,244 commits behind (ENG-9863).",
3763
+ "#",
3764
+ "# Two independent lags, and the second is the one that catches people out:",
3765
+ "# 1. the working tree behind the remote-tracking ref, and",
3766
+ "# 2. that ref behind the actual remote, because nothing fetches either.",
3767
+ "# So `git show origin/main:<path>` \u2014 the obvious workaround \u2014 is ALSO stale,",
3768
+ "# silently, which is why the advice below leads with a fetch.",
3769
+ "#",
3770
+ "# Local git only: no network. A fetch here would put an unbounded remote",
3771
+ "# round trip per repo in front of every session boot, and this hook has to",
3772
+ "# stay fast and offline-safe. Reporting the ref's AGE instead tells the",
3773
+ "# agent how much to trust it without paying for the answer.",
3774
+ "#",
3775
+ "# Clones only, never worktrees (`.git` as a FILE): a worktree sits on a",
3776
+ "# feature branch that is behind main on purpose, so counting it would emit",
3777
+ "# a line per branch and train the reader to skip the section.",
3778
+ "echo",
3779
+ 'echo "## Code checkouts"',
3780
+ "stale_repos=0",
3781
+ "checked_repos=0",
3782
+ "# Counted separately and REPORTED, never folded into checked_repos. A repo",
3783
+ "# with no upstream cannot be measured, and quietly excluding it would make",
3784
+ '# "All N checkout(s) current" a claim about a smaller set than the reader',
3785
+ "# thinks \u2014 which is this whole section's bug wearing a different number",
3786
+ "# (CodeRabbit, PR #5434).",
3787
+ "unmeasured_repos=0",
3788
+ "if command -v git >/dev/null 2>&1; then",
3789
+ ' for root in "${CODE_ROOTS[@]}"; do',
3790
+ ' [ -d "$root" ] || continue',
3791
+ ' for repo in "$root"/*; do',
3792
+ // `.git` must be a DIRECTORY: a worktree has it as a file containing `gitdir:`.
3793
+ ' [ -d "$repo/.git" ] || continue',
3794
+ ' name=$(basename "$repo")',
3795
+ " # The branch this checkout tracks, whatever it is called. Falls back to",
3796
+ " # origin/HEAD so a repo whose default is `preprod` (or anything else)",
3797
+ " # is measured against ITS default rather than an assumed `main`.",
3798
+ ' upstream=$(git -C "$repo" rev-parse --abbrev-ref --symbolic-full-name "@{upstream}" 2>/dev/null || true)',
3799
+ ' if [ -z "$upstream" ]; then',
3800
+ ' upstream=$(git -C "$repo" symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null || true)',
3801
+ " fi",
3802
+ " # Detached HEAD, no remote, a clone with no origin/HEAD, or a tree git",
3803
+ " # rejects outright. Say so out loud: an unmeasurable checkout is the",
3804
+ " # one most likely to be answering questions wrongly, and silence about",
3805
+ " # it reads exactly like health.",
3806
+ ' if [ -z "$upstream" ]; then',
3807
+ " unmeasured_repos=$((unmeasured_repos + 1))",
3808
+ ' echo "- ${name}: no upstream to compare against \u2014 NOT measured"',
3809
+ " continue",
3810
+ " fi",
3811
+ " checked_repos=$((checked_repos + 1))",
3812
+ ' behind=$(git -C "$repo" rev-list --count "HEAD..$upstream" 2>/dev/null || echo 0)',
3813
+ " # How old the remote-tracking ref itself is. No FETCH_HEAD means",
3814
+ " # nothing has fetched since the clone, which is the worst case and the",
3815
+ " # easiest one to mistake for a healthy repo.",
3816
+ " # No FETCH_HEAD means nothing has fetched SINCE THE CLONE, which is not",
3817
+ ' # the same as "stale" \u2014 a clone made ten minutes ago is current. So fall',
3818
+ " # back to the clone's own age (.git/config is written once, at clone,",
3819
+ " # and rarely again) rather than treating every new clone as rotten. A",
3820
+ " # false alarm on a fresh clone would be the fastest way to teach the",
3821
+ " # reader to skip this section.",
3822
+ ' fetch_head="$repo/.git/FETCH_HEAD"',
3823
+ ' if [ -f "$fetch_head" ]; then',
3824
+ ' fetch_age_h=$(( ( $(date +%s) - $(stat -c %Y "$fetch_head" 2>/dev/null || date +%s) ) / 3600 ))',
3825
+ ' fetch_note="refs fetched ${fetch_age_h}h ago"',
3826
+ " else",
3827
+ ' fetch_age_h=$(( ( $(date +%s) - $(stat -c %Y "$repo/.git/config" 2>/dev/null || date +%s) ) / 3600 ))',
3828
+ ' fetch_note="NEVER fetched since it was cloned ${fetch_age_h}h ago"',
3829
+ " fi",
3830
+ " # One line only when something is actually off. A current checkout",
3831
+ " # printing every session is noise, and noise is how a real warning",
3832
+ " # stops being read.",
3833
+ ' if [ "$behind" -gt 0 ] || [ "$fetch_age_h" -ge 24 ]; then',
3834
+ " stale_repos=$((stale_repos + 1))",
3835
+ ' echo "- ${name}: ${behind} commit(s) behind ${upstream}, ${fetch_note}"',
3836
+ " fi",
3837
+ " done",
3838
+ " done",
3839
+ "fi",
3840
+ 'if [ "$checked_repos" -eq 0 ] && [ "$unmeasured_repos" -eq 0 ]; then',
3841
+ ' echo "- No git checkouts found."',
3842
+ 'elif [ "$stale_repos" -eq 0 ] && [ "$unmeasured_repos" -eq 0 ]; then',
3843
+ ' echo "- All ${checked_repos} checkout(s) current."',
3844
+ "else",
3845
+ " echo",
3846
+ ' echo "**Do not answer a question about what the code currently does from a stale tree.** A grep that finds nothing there is not evidence the symbol does not exist. Run \\`git -C <repo> fetch\\` FIRST \u2014 the remote-tracking ref is stale too \u2014 then read through it: \\`git show <upstream>:<path>\\`, or \\`git grep <pattern> <upstream> -- <narrow path>\\` (narrow it; a whole-repo git grep against a ref can take minutes). Line numbers from a stale tree are wrong even when the conclusion is right."',
3847
+ "fi",
3848
+ "",
3752
3849
  "echo",
3753
3850
  'echo "## Next step"',
3754
3851
  "echo",
@@ -6395,7 +6492,7 @@ function exchangeFailureKind(err) {
6395
6492
  }
6396
6493
 
6397
6494
  // src/lib/api-client.ts
6398
- var agtCliVersion = true ? "0.28.781" : "dev";
6495
+ var agtCliVersion = true ? "0.28.782" : "dev";
6399
6496
  var lastConfigHash = null;
6400
6497
  function setConfigHash(hash) {
6401
6498
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -10632,4 +10729,4 @@ export {
10632
10729
  managerInstallSystemUnitCommand,
10633
10730
  managerUninstallSystemUnitCommand
10634
10731
  };
10635
- //# sourceMappingURL=chunk-GFKNOWPF.js.map
10732
+ //# sourceMappingURL=chunk-WP2NPGER.js.map