@integrity-labs/agt-cli 0.27.146 → 0.27.147
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
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
success,
|
|
29
29
|
table,
|
|
30
30
|
warn
|
|
31
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-T4LYV52L.js";
|
|
32
32
|
import {
|
|
33
33
|
CHANNEL_REGISTRY,
|
|
34
34
|
DEPLOYMENT_TEMPLATES,
|
|
@@ -4934,7 +4934,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
4934
4934
|
import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
|
|
4935
4935
|
import chalk18 from "chalk";
|
|
4936
4936
|
import ora16 from "ora";
|
|
4937
|
-
var cliVersion = true ? "0.27.
|
|
4937
|
+
var cliVersion = true ? "0.27.147" : "dev";
|
|
4938
4938
|
async function fetchLatestVersion() {
|
|
4939
4939
|
const host2 = getHost();
|
|
4940
4940
|
if (!host2) return null;
|
|
@@ -5857,7 +5857,7 @@ function handleError(err) {
|
|
|
5857
5857
|
}
|
|
5858
5858
|
|
|
5859
5859
|
// src/bin/agt.ts
|
|
5860
|
-
var cliVersion2 = true ? "0.27.
|
|
5860
|
+
var cliVersion2 = true ? "0.27.147" : "dev";
|
|
5861
5861
|
var program = new Command();
|
|
5862
5862
|
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");
|
|
5863
5863
|
program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
@@ -4881,6 +4881,111 @@ function provisionOrientHook(codeName) {
|
|
|
4881
4881
|
settings["hooks"] = hooks;
|
|
4882
4882
|
writeFileSync5(settingsPath, JSON.stringify(settings, null, 2));
|
|
4883
4883
|
}
|
|
4884
|
+
function provisionSessionStateHook(codeName) {
|
|
4885
|
+
const projectDir = getProjectDir(codeName);
|
|
4886
|
+
const claudeDir = join4(projectDir, ".claude");
|
|
4887
|
+
mkdirSync4(claudeDir, { recursive: true });
|
|
4888
|
+
const homeDir = getHomeDir3();
|
|
4889
|
+
const agentDir = join4(homeDir, ".augmented", codeName);
|
|
4890
|
+
const hookScriptPath = join4(claudeDir, "agt-session-state-hook.sh");
|
|
4891
|
+
const hookScript = `#!/usr/bin/env bash
|
|
4892
|
+
# Auto-generated by Augmented (ENG-6233 / ENG-6268) \u2014 SessionStart session-state
|
|
4893
|
+
# recorder. Writes the model + session origin (which only the agent's own
|
|
4894
|
+
# Claude Code session knows) to session-state.json, which the channel servers
|
|
4895
|
+
# read back for the /status command. Best-effort, silent; every path exits 0 so
|
|
4896
|
+
# it can NEVER block or fail session start.
|
|
4897
|
+
# Canonical source: packages/claudecode-plugin-augmented/hooks/session-state.sh
|
|
4898
|
+
|
|
4899
|
+
# Best-effort: any unexpected error just exits clean.
|
|
4900
|
+
trap 'exit 0' ERR
|
|
4901
|
+
|
|
4902
|
+
# Hook input (stdin canonical; CLAUDE_HOOK_INPUT kept as a fallback).
|
|
4903
|
+
INPUT="$(cat 2>/dev/null || true)"
|
|
4904
|
+
[ -n "$INPUT" ] || INPUT="\${CLAUDE_HOOK_INPUT:-}"
|
|
4905
|
+
[ -n "$INPUT" ] || exit 0
|
|
4906
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
4907
|
+
|
|
4908
|
+
# Identity / state dir are baked at provision time.
|
|
4909
|
+
CODE_NAME="${codeName}"
|
|
4910
|
+
STATE_DIR="${agentDir}"
|
|
4911
|
+
mkdir -p "$STATE_DIR" 2>/dev/null || exit 0
|
|
4912
|
+
|
|
4913
|
+
# Pull the fields we surface from the SessionStart payload.
|
|
4914
|
+
SESSION_ID="$(printf '%s' "$INPUT" | jq -r '.session_id // empty' 2>/dev/null || true)"
|
|
4915
|
+
SOURCE="$(printf '%s' "$INPUT" | jq -r '.source // empty' 2>/dev/null || true)"
|
|
4916
|
+
MODEL="$(printf '%s' "$INPUT" | jq -r '.model // empty' 2>/dev/null || true)"
|
|
4917
|
+
CWD="$(printf '%s' "$INPUT" | jq -r '.cwd // empty' 2>/dev/null || true)"
|
|
4918
|
+
[ -n "$CWD" ] || CWD="\${CLAUDE_PROJECT_DIR:-$PWD}"
|
|
4919
|
+
|
|
4920
|
+
# Channels: the channel MCP servers wired in the project .mcp.json. The adapter
|
|
4921
|
+
# writes each channel as a bare server id \u2014 slack / telegram / msteams (the
|
|
4922
|
+
# DEV_CHANNEL_SERVER_IDS set) plus direct-chat \u2014 NOT a "<name>-channel" key, so
|
|
4923
|
+
# match that allowlist and exclude the non-channel servers (augmented,
|
|
4924
|
+
# cloud-broker, composio_*). The "-channel" suffix only names the bundled .js
|
|
4925
|
+
# asset, never the .mcp.json key (verified against a live host, ENG-6268).
|
|
4926
|
+
CHANNELS_JSON='[]'
|
|
4927
|
+
if [ -f "$CWD/.mcp.json" ]; then
|
|
4928
|
+
CHANNELS_JSON="$(jq -c '
|
|
4929
|
+
["slack","telegram","msteams","direct-chat"] as $ch
|
|
4930
|
+
| [ (.mcpServers // {} | keys[]) | select(. as $k | $ch | index($k)) ]
|
|
4931
|
+
' "$CWD/.mcp.json" 2>/dev/null || echo '[]')"
|
|
4932
|
+
[ -n "$CHANNELS_JSON" ] || CHANNELS_JSON='[]'
|
|
4933
|
+
fi
|
|
4934
|
+
|
|
4935
|
+
# Environment: best-effort from the agent's CLAUDE.md frontmatter (CHARTER.md
|
|
4936
|
+
# maps to CLAUDE.md for the Claude Code adapter; the frontmatter carries
|
|
4937
|
+
# environment: dev|stage|prod). Missing / unreadable -> omitted.
|
|
4938
|
+
ENVIRONMENT=""
|
|
4939
|
+
if [ -f "$CWD/CLAUDE.md" ]; then
|
|
4940
|
+
ENVIRONMENT="$(grep -m1 -E '^environment:[[:space:]]*' "$CWD/CLAUDE.md" 2>/dev/null | sed -E 's/^environment:[[:space:]]*//; s/[[:space:]]*$//' || true)"
|
|
4941
|
+
fi
|
|
4942
|
+
|
|
4943
|
+
# Seconds->millis keeps this portable across GNU (Linux hosts) and BSD (macOS
|
|
4944
|
+
# dev) date; second granularity is plenty for "started 12m ago".
|
|
4945
|
+
RECORDED_AT="$(date +%s)000"
|
|
4946
|
+
|
|
4947
|
+
# Write atomically (temp + rename) so a concurrent reader never sees a
|
|
4948
|
+
# half-written file.
|
|
4949
|
+
OUT="$STATE_DIR/session-state.json"
|
|
4950
|
+
TMP="$OUT.$$.tmp"
|
|
4951
|
+
if jq -nc --arg session_id "$SESSION_ID" --arg source "$SOURCE" --arg model "$MODEL" --arg cwd "$CWD" --arg environment "$ENVIRONMENT" --argjson channels "$CHANNELS_JSON" --argjson recorded_at "$RECORDED_AT" '{
|
|
4952
|
+
session_id: $session_id,
|
|
4953
|
+
source: $source,
|
|
4954
|
+
model: $model,
|
|
4955
|
+
cwd: $cwd,
|
|
4956
|
+
channels: $channels,
|
|
4957
|
+
recorded_at: $recorded_at
|
|
4958
|
+
}
|
|
4959
|
+
| if $environment == "" then . else . + { environment: $environment } end' > "$TMP" 2>/dev/null; then
|
|
4960
|
+
mv -f "$TMP" "$OUT" 2>/dev/null || rm -f "$TMP" 2>/dev/null || true
|
|
4961
|
+
else
|
|
4962
|
+
rm -f "$TMP" 2>/dev/null || true
|
|
4963
|
+
fi
|
|
4964
|
+
|
|
4965
|
+
exit 0
|
|
4966
|
+
`;
|
|
4967
|
+
writeFileSync5(hookScriptPath, hookScript, { mode: 493 });
|
|
4968
|
+
const settingsPath = join4(claudeDir, "settings.local.json");
|
|
4969
|
+
let settings = {};
|
|
4970
|
+
try {
|
|
4971
|
+
settings = JSON.parse(readFileSync5(settingsPath, "utf-8"));
|
|
4972
|
+
} catch {
|
|
4973
|
+
}
|
|
4974
|
+
const hooks = settings["hooks"] ?? {};
|
|
4975
|
+
const existingSessionStart = Array.isArray(hooks["SessionStart"]) ? [...hooks["SessionStart"]] : [];
|
|
4976
|
+
const alreadyRegistered = existingSessionStart.some((entry) => {
|
|
4977
|
+
const entryHooks = entry.hooks;
|
|
4978
|
+
return Array.isArray(entryHooks) && entryHooks.some((h) => typeof h === "object" && h !== null && h.type === "command" && h.command === hookScriptPath);
|
|
4979
|
+
});
|
|
4980
|
+
if (!alreadyRegistered) {
|
|
4981
|
+
existingSessionStart.push({
|
|
4982
|
+
hooks: [{ type: "command", command: hookScriptPath }]
|
|
4983
|
+
});
|
|
4984
|
+
}
|
|
4985
|
+
hooks["SessionStart"] = existingSessionStart;
|
|
4986
|
+
settings["hooks"] = hooks;
|
|
4987
|
+
writeFileSync5(settingsPath, JSON.stringify(settings, null, 2));
|
|
4988
|
+
}
|
|
4884
4989
|
function modifyJsonConfig(filePath, fn) {
|
|
4885
4990
|
let originalContent;
|
|
4886
4991
|
let config;
|
|
@@ -7836,6 +7941,7 @@ export {
|
|
|
7836
7941
|
provisionIsolationHook,
|
|
7837
7942
|
provisionAutoKanbanProgressHook,
|
|
7838
7943
|
provisionOrientHook,
|
|
7944
|
+
provisionSessionStateHook,
|
|
7839
7945
|
setJsonMode,
|
|
7840
7946
|
isJsonMode,
|
|
7841
7947
|
jsonOutput,
|
|
@@ -7866,4 +7972,4 @@ export {
|
|
|
7866
7972
|
managerInstallSystemUnitCommand,
|
|
7867
7973
|
managerUninstallSystemUnitCommand
|
|
7868
7974
|
};
|
|
7869
|
-
//# sourceMappingURL=chunk-
|
|
7975
|
+
//# sourceMappingURL=chunk-T4LYV52L.js.map
|