@agenttrail/cli 0.1.0 → 0.2.0
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/README.md +46 -6
- package/dist/chunk-WMGYTOQC.js +163 -0
- package/dist/cli/index.cjs +60 -50
- package/dist/cli/index.js +1 -1
- package/dist/cursor/capture-hook.mjs +2 -2
- package/dist/cursor/flush.mjs +6 -6
- package/dist/cursor/pep-hook.mjs +232 -45
- package/dist/index.cjs +65 -50
- package/dist/index.d.cts +39 -7
- package/dist/index.d.ts +39 -7
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/plugin/.claude-plugin/marketplace.json +2 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/scripts/pep-hook.mjs +232 -45
- package/dist/chunk-F6FLYISV.js +0 -148
package/dist/index.d.cts
CHANGED
|
@@ -68,6 +68,21 @@ interface AcquireOptions {
|
|
|
68
68
|
}
|
|
69
69
|
declare function withRefreshLock<T>(opts: AcquireOptions, fn: () => Promise<T>): Promise<T>;
|
|
70
70
|
|
|
71
|
+
interface HooksFileIO {
|
|
72
|
+
readText(path: string): string | undefined;
|
|
73
|
+
fileMode(path: string): number | undefined;
|
|
74
|
+
writeText(path: string, text: string, mode: number): void;
|
|
75
|
+
deleteFile(path: string): void;
|
|
76
|
+
dirExists(path: string): boolean;
|
|
77
|
+
removeDirIfEmpty(path: string): void;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface GitResult {
|
|
81
|
+
readonly code: number;
|
|
82
|
+
readonly stdout: string;
|
|
83
|
+
}
|
|
84
|
+
type GitRunner = (args: readonly string[], cwd: string) => GitResult;
|
|
85
|
+
|
|
71
86
|
declare const REFRESH_STALE_WINDOW_MS: number;
|
|
72
87
|
type RefreshOutcome = "no-op" | "rotated" | "not-logged-in";
|
|
73
88
|
|
|
@@ -92,6 +107,8 @@ interface LoginEnv {
|
|
|
92
107
|
readonly credentialsIO?: CredentialsIO;
|
|
93
108
|
readonly settingsIO?: SettingsIO;
|
|
94
109
|
readonly lockIO?: LockIO;
|
|
110
|
+
readonly git?: GitRunner;
|
|
111
|
+
readonly processEnv?: Readonly<Record<string, string | undefined>>;
|
|
95
112
|
readonly log: (msg: string) => void;
|
|
96
113
|
}
|
|
97
114
|
declare function runLogin(env: LoginEnv): Promise<DeviceCredentials>;
|
|
@@ -420,18 +437,18 @@ declare const agenttrailConfigSchema: z.ZodObject<{
|
|
|
420
437
|
orgId: string;
|
|
421
438
|
projectSlug: string;
|
|
422
439
|
projectId?: string | undefined;
|
|
423
|
-
agentId?: string | undefined;
|
|
424
440
|
developerId?: string | undefined;
|
|
425
|
-
apiKey?: string | undefined;
|
|
426
441
|
captureContent?: boolean | undefined;
|
|
442
|
+
agentId?: string | undefined;
|
|
443
|
+
apiKey?: string | undefined;
|
|
427
444
|
}, {
|
|
428
445
|
orgId: string;
|
|
429
446
|
projectSlug: string;
|
|
430
447
|
projectId?: string | undefined;
|
|
431
|
-
agentId?: string | undefined;
|
|
432
448
|
developerId?: string | undefined;
|
|
433
|
-
apiKey?: string | undefined;
|
|
434
449
|
captureContent?: boolean | undefined;
|
|
450
|
+
agentId?: string | undefined;
|
|
451
|
+
apiKey?: string | undefined;
|
|
435
452
|
}>;
|
|
436
453
|
type AgentTrailConfig = z.infer<typeof agenttrailConfigSchema>;
|
|
437
454
|
declare function parseAgentTrailConfig(raw: unknown): AgentTrailConfig;
|
|
@@ -442,9 +459,14 @@ interface PersistIO {
|
|
|
442
459
|
exists?: (p: string) => boolean;
|
|
443
460
|
mkdir?: (p: string, mode?: number) => void;
|
|
444
461
|
home?: string;
|
|
462
|
+
git?: GitRunner;
|
|
463
|
+
excludeIO?: HooksFileIO;
|
|
464
|
+
unlink?: (p: string) => void;
|
|
445
465
|
}
|
|
446
466
|
declare function ensureGitignored(rootDir: string, io?: PersistIO, line?: string): boolean;
|
|
447
|
-
declare function writeAgentTrailConfig(rootDir: string, config: AgentTrailConfig, io?: PersistIO
|
|
467
|
+
declare function writeAgentTrailConfig(rootDir: string, config: AgentTrailConfig, io?: PersistIO, opts?: {
|
|
468
|
+
readonly committable?: boolean;
|
|
469
|
+
}): {
|
|
448
470
|
path: string;
|
|
449
471
|
gitignoreModified: boolean;
|
|
450
472
|
mode: number;
|
|
@@ -490,12 +512,20 @@ interface InstallOptions {
|
|
|
490
512
|
readonly runner?: ClaudeRunner;
|
|
491
513
|
readonly marketplaceSource?: string;
|
|
492
514
|
readonly pathExists?: (p: string) => boolean;
|
|
515
|
+
readonly refresh?: boolean;
|
|
516
|
+
readonly packagedVersion?: string;
|
|
493
517
|
}
|
|
494
|
-
type InstallStatus = "installed" | "already-installed";
|
|
518
|
+
type InstallStatus = "installed" | "already-installed" | "refreshed" | "refresh-failed";
|
|
495
519
|
interface InstallResult {
|
|
496
520
|
readonly status: InstallStatus;
|
|
497
521
|
readonly pluginId: string;
|
|
498
522
|
readonly scope: PluginScope;
|
|
523
|
+
readonly foundVersion?: string;
|
|
524
|
+
readonly expectedVersion?: string;
|
|
525
|
+
readonly afterVersion?: string;
|
|
526
|
+
readonly refreshError?: string;
|
|
527
|
+
readonly note?: string;
|
|
528
|
+
readonly warning?: string;
|
|
499
529
|
}
|
|
500
530
|
declare function installAgentTrailPlugin(options?: InstallOptions): InstallResult;
|
|
501
531
|
interface UninstallOptions {
|
|
@@ -595,8 +625,10 @@ interface WriteSettingsResult {
|
|
|
595
625
|
}
|
|
596
626
|
declare function writeClaudeSettings(rootDir: string, env: Record<string, string>, io?: {
|
|
597
627
|
readFile?: (p: string) => string;
|
|
598
|
-
writeFile?: (p: string, c: string) => void;
|
|
628
|
+
writeFile?: (p: string, c: string, mode?: number) => void;
|
|
599
629
|
mkdir?: (p: string) => void;
|
|
630
|
+
}, opts?: {
|
|
631
|
+
mode?: number;
|
|
600
632
|
}): WriteSettingsResult;
|
|
601
633
|
|
|
602
634
|
interface SetupParams {
|
package/dist/index.d.ts
CHANGED
|
@@ -68,6 +68,21 @@ interface AcquireOptions {
|
|
|
68
68
|
}
|
|
69
69
|
declare function withRefreshLock<T>(opts: AcquireOptions, fn: () => Promise<T>): Promise<T>;
|
|
70
70
|
|
|
71
|
+
interface HooksFileIO {
|
|
72
|
+
readText(path: string): string | undefined;
|
|
73
|
+
fileMode(path: string): number | undefined;
|
|
74
|
+
writeText(path: string, text: string, mode: number): void;
|
|
75
|
+
deleteFile(path: string): void;
|
|
76
|
+
dirExists(path: string): boolean;
|
|
77
|
+
removeDirIfEmpty(path: string): void;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface GitResult {
|
|
81
|
+
readonly code: number;
|
|
82
|
+
readonly stdout: string;
|
|
83
|
+
}
|
|
84
|
+
type GitRunner = (args: readonly string[], cwd: string) => GitResult;
|
|
85
|
+
|
|
71
86
|
declare const REFRESH_STALE_WINDOW_MS: number;
|
|
72
87
|
type RefreshOutcome = "no-op" | "rotated" | "not-logged-in";
|
|
73
88
|
|
|
@@ -92,6 +107,8 @@ interface LoginEnv {
|
|
|
92
107
|
readonly credentialsIO?: CredentialsIO;
|
|
93
108
|
readonly settingsIO?: SettingsIO;
|
|
94
109
|
readonly lockIO?: LockIO;
|
|
110
|
+
readonly git?: GitRunner;
|
|
111
|
+
readonly processEnv?: Readonly<Record<string, string | undefined>>;
|
|
95
112
|
readonly log: (msg: string) => void;
|
|
96
113
|
}
|
|
97
114
|
declare function runLogin(env: LoginEnv): Promise<DeviceCredentials>;
|
|
@@ -420,18 +437,18 @@ declare const agenttrailConfigSchema: z.ZodObject<{
|
|
|
420
437
|
orgId: string;
|
|
421
438
|
projectSlug: string;
|
|
422
439
|
projectId?: string | undefined;
|
|
423
|
-
agentId?: string | undefined;
|
|
424
440
|
developerId?: string | undefined;
|
|
425
|
-
apiKey?: string | undefined;
|
|
426
441
|
captureContent?: boolean | undefined;
|
|
442
|
+
agentId?: string | undefined;
|
|
443
|
+
apiKey?: string | undefined;
|
|
427
444
|
}, {
|
|
428
445
|
orgId: string;
|
|
429
446
|
projectSlug: string;
|
|
430
447
|
projectId?: string | undefined;
|
|
431
|
-
agentId?: string | undefined;
|
|
432
448
|
developerId?: string | undefined;
|
|
433
|
-
apiKey?: string | undefined;
|
|
434
449
|
captureContent?: boolean | undefined;
|
|
450
|
+
agentId?: string | undefined;
|
|
451
|
+
apiKey?: string | undefined;
|
|
435
452
|
}>;
|
|
436
453
|
type AgentTrailConfig = z.infer<typeof agenttrailConfigSchema>;
|
|
437
454
|
declare function parseAgentTrailConfig(raw: unknown): AgentTrailConfig;
|
|
@@ -442,9 +459,14 @@ interface PersistIO {
|
|
|
442
459
|
exists?: (p: string) => boolean;
|
|
443
460
|
mkdir?: (p: string, mode?: number) => void;
|
|
444
461
|
home?: string;
|
|
462
|
+
git?: GitRunner;
|
|
463
|
+
excludeIO?: HooksFileIO;
|
|
464
|
+
unlink?: (p: string) => void;
|
|
445
465
|
}
|
|
446
466
|
declare function ensureGitignored(rootDir: string, io?: PersistIO, line?: string): boolean;
|
|
447
|
-
declare function writeAgentTrailConfig(rootDir: string, config: AgentTrailConfig, io?: PersistIO
|
|
467
|
+
declare function writeAgentTrailConfig(rootDir: string, config: AgentTrailConfig, io?: PersistIO, opts?: {
|
|
468
|
+
readonly committable?: boolean;
|
|
469
|
+
}): {
|
|
448
470
|
path: string;
|
|
449
471
|
gitignoreModified: boolean;
|
|
450
472
|
mode: number;
|
|
@@ -490,12 +512,20 @@ interface InstallOptions {
|
|
|
490
512
|
readonly runner?: ClaudeRunner;
|
|
491
513
|
readonly marketplaceSource?: string;
|
|
492
514
|
readonly pathExists?: (p: string) => boolean;
|
|
515
|
+
readonly refresh?: boolean;
|
|
516
|
+
readonly packagedVersion?: string;
|
|
493
517
|
}
|
|
494
|
-
type InstallStatus = "installed" | "already-installed";
|
|
518
|
+
type InstallStatus = "installed" | "already-installed" | "refreshed" | "refresh-failed";
|
|
495
519
|
interface InstallResult {
|
|
496
520
|
readonly status: InstallStatus;
|
|
497
521
|
readonly pluginId: string;
|
|
498
522
|
readonly scope: PluginScope;
|
|
523
|
+
readonly foundVersion?: string;
|
|
524
|
+
readonly expectedVersion?: string;
|
|
525
|
+
readonly afterVersion?: string;
|
|
526
|
+
readonly refreshError?: string;
|
|
527
|
+
readonly note?: string;
|
|
528
|
+
readonly warning?: string;
|
|
499
529
|
}
|
|
500
530
|
declare function installAgentTrailPlugin(options?: InstallOptions): InstallResult;
|
|
501
531
|
interface UninstallOptions {
|
|
@@ -595,8 +625,10 @@ interface WriteSettingsResult {
|
|
|
595
625
|
}
|
|
596
626
|
declare function writeClaudeSettings(rootDir: string, env: Record<string, string>, io?: {
|
|
597
627
|
readFile?: (p: string) => string;
|
|
598
|
-
writeFile?: (p: string, c: string) => void;
|
|
628
|
+
writeFile?: (p: string, c: string, mode?: number) => void;
|
|
599
629
|
mkdir?: (p: string) => void;
|
|
630
|
+
}, opts?: {
|
|
631
|
+
mode?: number;
|
|
600
632
|
}): WriteSettingsResult;
|
|
601
633
|
|
|
602
634
|
interface SetupParams {
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$,A as N,Aa as Ne,B as _,Ba as _e,C as x,Ca as xe,D as O,Da as Oe,E as h,F as G,G as k,H as v,I as D,J as U,K as F,L as b,M as j,N as B,O as M,P as w,Q as V,R as J,S as K,T as W,U as z,V as H,W as Q,X as q,Y as X,Z as Y,_ as Z,a as e,aa as ee,b as t,ba as te,c as o,ca as oe,d as r,da as re,e as n,ea as ne,f as p,fa as pe,g as i,ga as ie,h as s,ha as se,i as l,ia as le,j as a,ja as ae,k as u,ka as ue,l as c,la as ce,m as y,ma as ye,n as f,na as fe,o as S,oa as Se,p as d,pa as de,q as T,qa as Te,r as I,ra as Ie,s as m,sa as me,t as E,ta as Ee,u as R,ua as Re,v as C,va as Ce,w as g,wa as ge,x as A,xa as Ae,y as P,ya as Pe,z as L,za as Le}from"./chunk-
|
|
1
|
+
import{$,A as N,Aa as Ne,B as _,Ba as _e,C as x,Ca as xe,D as O,Da as Oe,E as h,F as G,G as k,H as v,I as D,J as U,K as F,L as b,M as j,N as B,O as M,P as w,Q as V,R as J,S as K,T as W,U as z,V as H,W as Q,X as q,Y as X,Z as Y,_ as Z,a as e,aa as ee,b as t,ba as te,c as o,ca as oe,d as r,da as re,e as n,ea as ne,f as p,fa as pe,g as i,ga as ie,h as s,ha as se,i as l,ia as le,j as a,ja as ae,k as u,ka as ue,l as c,la as ce,m as y,ma as ye,n as f,na as fe,o as S,oa as Se,p as d,pa as de,q as T,qa as Te,r as I,ra as Ie,s as m,sa as me,t as E,ta as Ee,u as R,ua as Re,v as C,va as Ce,w as g,wa as ge,x as A,xa as Ae,y as P,ya as Pe,z as L,za as Le}from"./chunk-WMGYTOQC.js";export{t as AGENTTRAIL_AGENT_NS,d as AGENTTRAIL_API_ENDPOINT,o as AGENTTRAIL_INGEST_ENDPOINT,Se as AGENTTRAIL_MARKETPLACE_NAME,Te as AGENTTRAIL_PLUGIN_ID,de as AGENTTRAIL_PLUGIN_NAME,e as AGENTTRAIL_PROJECT_NS,n as CLAUDE_CODE_VENDOR_SLUG,p as CONTENT_FLAGS,Ee as ClaudeCliNotFoundError,R as DEFAULT_LOCK_STALE_MS,Ie as MIN_CLAUDE_VERSION,P as PROJECT_CONFIG_FILE,Ce as PluginCommandError,Re as PluginUnsupportedError,$ as QuarantineError,j as REFRESH_STALE_WINDOW_MS,g as agenttrailConfigSchema,X as backfillSpanId,q as backfillTraceId,se as boundedPool,l as buildEnvBlock,s as buildResourceAttributes,Y as buildSpanTree,V as checkpointPath,S as clearCredentials,b as computeAgentId,F as computeProjectId,c as credentialsPath,me as defaultClaudeRunner,oe as defaultProjectsRoot,D as deriveProjectIdentity,U as deriveProjectSlug,i as encodeResourceValue,Pe as ensureClaudeSupportsPlugins,ce as ensureGitignored,ee as fileLineSource,_ as findGitRoot,N as findProjectConfig,L as globalConfigPath,Q as hashContent,H as hashFile,Ne as installAgentTrailPlugin,re as isSessionInProject,Ae as isVersionAtLeast,r as normalizeEndpoint,A as parseAgentTrailConfig,ge as parseClaudeVersion,k as parseGitRemote,te as parseSession,I as pollDeviceToken,y as readCredentials,v as readGitRemote,J as readState,m as refreshDeviceToken,h as resolveApiKey,O as resolveConfig,Le as resolvePluginScaffoldDir,x as resolveProjectRoot,E as revokeDeviceToken,Oe as run,ue as runImport,B as runLogin,w as runLogout,M as runRefresh,le as runScan,xe as runSetup,ae as runStatus,ne as scanTranscripts,Z as sessionToResourceSpans,a as settingsPath,z as shouldProcess,G as slugify,T as startDeviceAuth,pe as toOtlpJson,_e as uninstallAgentTrailPlugin,ie as uploadResourceSpans,W as upsertSession,C as withRefreshLock,ye as writeAgentTrailConfig,u as writeClaudeSettings,f as writeCredentials,fe as writeGlobalConfig,K as writeState};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agenttrail/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The AgentTrail command-line tool: connects an AI coding agent's sessions to AgentTrail, with setup, sign-in, status and history import for the agent named by --agent.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "AgentTrail's plugin marketplace — the enforcement plugin for agent governance.",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.2.0"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "agenttrail",
|
|
14
14
|
"source": "./",
|
|
15
15
|
"description": "AgentTrail enforcement plugin — PreToolUse governance hook (a fail-closed command shim).",
|
|
16
|
-
"version": "0.
|
|
16
|
+
"version": "0.2.0",
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "AgentTrail"
|
|
19
19
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agenttrail",
|
|
3
3
|
"description": "AgentTrail enforcement plugin for Claude Code — carries the PreToolUse governance hook, a fail-closed command shim.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "AgentTrail",
|
|
7
7
|
"url": "https://agenttrail.sh"
|