@axtary/cli 0.0.1
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 +35 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +4 -0
- package/dist/bin.js.map +1 -0
- package/dist/index.d.ts +156 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1275 -0
- package/dist/index.js.map +1 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# @axtary/cli
|
|
2
|
+
|
|
3
|
+
Axtary local CLI for deterministic proxy demos.
|
|
4
|
+
|
|
5
|
+
This package is private workspace code while `axtary proxy --config axtary.yml` is being shaped.
|
|
6
|
+
|
|
7
|
+
## Commands
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
axtary demo --config axtary.yml --json
|
|
11
|
+
axtary proxy --config axtary.yml
|
|
12
|
+
axtary smoke --config axtary.yml
|
|
13
|
+
axtary test-policy --config axtary.yml --fixtures examples/policy-fixtures
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
- `demo` loads config, creates an ephemeral signing key, runs fake GitHub, Slack, Linear, and Jira actions through the proxy, writes the local JSONL ledger, and prints a structured result.
|
|
17
|
+
- `proxy` starts a long-running local HTTP enforcement point with `GET /health`, `GET /state`, and `POST /actions`. It uses fake SaaS adapters by default and can route GitHub, Slack, Linear, AWS, GCP, and local docs actions when their adapter modes are enabled. File-backed configs are cached and policy is reloaded when `axtary.yml` changes.
|
|
18
|
+
- `smoke` validates configured providers without writes: GitHub REST calls `/user`, Slack Web calls `auth.test`, Linear GraphQL queries `viewer`, AWS calls STS `GetCallerIdentity`, GCP checks project access, and local docs checks configured roots.
|
|
19
|
+
- `test-policy` evaluates JSON fixtures against the loaded YAML policy and fails when an expected decision or reason differs.
|
|
20
|
+
|
|
21
|
+
## Real Provider Smoke Test
|
|
22
|
+
|
|
23
|
+
Set adapter modes and token environment variables in `axtary.yml`, then run:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
GITHUB_TOKEN=... SLACK_BOT_TOKEN=... LINEAR_API_KEY=... \
|
|
27
|
+
AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=... GCP_ACCESS_TOKEN=... \
|
|
28
|
+
axtary smoke --config axtary.yml
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Fake adapters are skipped. Missing token environment variables, provider auth failures, or missing local docs roots return a non-zero exit code.
|
|
32
|
+
|
|
33
|
+
## Design Notes
|
|
34
|
+
|
|
35
|
+
The CLI currently proves the local product loop. Real provider modes are opt-in through config and read tokens from configured environment variables, so demos remain deterministic and do not accidentally touch production providers.
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,CAAC,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { type JsonValue, type AxtaryDecision } from "@axtary/actionpass";
|
|
2
|
+
import { type FakeAdapterState } from "@axtary/adapters";
|
|
3
|
+
import { type LedgerExport, type LedgerExportFormat, type LedgerSyncResult } from "@axtary/ledger";
|
|
4
|
+
import { type ProxyHandleResult } from "@axtary/proxy";
|
|
5
|
+
export declare const DEMO_SCHEMA_VERSION = "axtary.demo.v0";
|
|
6
|
+
export declare const POLICY_TEST_SCHEMA_VERSION = "axtary.policy_test.v0";
|
|
7
|
+
export declare const LOCAL_PROXY_SCHEMA_VERSION = "axtary.local_proxy.v0";
|
|
8
|
+
export declare const LEDGER_EXPORT_RUN_SCHEMA_VERSION = "axtary.ledger_export_run.v0";
|
|
9
|
+
export declare const LEDGER_SYNC_RUN_SCHEMA_VERSION = "axtary.ledger_sync_run.v0";
|
|
10
|
+
export type DemoRunInput = {
|
|
11
|
+
configPath?: string;
|
|
12
|
+
ledgerPath?: string;
|
|
13
|
+
cwd?: string;
|
|
14
|
+
};
|
|
15
|
+
export type ProxyServerInput = DemoRunInput & {
|
|
16
|
+
host?: string;
|
|
17
|
+
port?: number;
|
|
18
|
+
};
|
|
19
|
+
export type ProxyServerHandle = {
|
|
20
|
+
schemaVersion: typeof LOCAL_PROXY_SCHEMA_VERSION;
|
|
21
|
+
url: string;
|
|
22
|
+
host: string;
|
|
23
|
+
port: number;
|
|
24
|
+
ledgerPath: string;
|
|
25
|
+
adapters: FakeAdapterState;
|
|
26
|
+
adapterModes: {
|
|
27
|
+
github: "fake" | "rest";
|
|
28
|
+
slack: "fake" | "web";
|
|
29
|
+
linear: "fake" | "graphql";
|
|
30
|
+
aws: "off" | "rest";
|
|
31
|
+
gcp: "off" | "rest";
|
|
32
|
+
docs: "off" | "local";
|
|
33
|
+
mcp: "fixture";
|
|
34
|
+
};
|
|
35
|
+
close: () => Promise<void>;
|
|
36
|
+
};
|
|
37
|
+
export type PolicyFixture = {
|
|
38
|
+
name?: string;
|
|
39
|
+
action: unknown;
|
|
40
|
+
expectedDecision: "allow" | "deny" | "step_up";
|
|
41
|
+
expectedReasons?: string[];
|
|
42
|
+
};
|
|
43
|
+
export type PolicyFixtureResult = {
|
|
44
|
+
filePath: string;
|
|
45
|
+
name: string;
|
|
46
|
+
passed: boolean;
|
|
47
|
+
expectedDecision: string;
|
|
48
|
+
actualDecision: string;
|
|
49
|
+
expectedReasons: string[] | null;
|
|
50
|
+
actualReasons: string[];
|
|
51
|
+
};
|
|
52
|
+
export type PolicyTestRunInput = {
|
|
53
|
+
configPath?: string;
|
|
54
|
+
fixturesPath: string;
|
|
55
|
+
cwd?: string;
|
|
56
|
+
};
|
|
57
|
+
export type PolicyTestRunResult = {
|
|
58
|
+
schemaVersion: typeof POLICY_TEST_SCHEMA_VERSION;
|
|
59
|
+
config: {
|
|
60
|
+
filePath: string | null;
|
|
61
|
+
policyVersion: string;
|
|
62
|
+
};
|
|
63
|
+
fixturesPath: string;
|
|
64
|
+
passed: boolean;
|
|
65
|
+
total: number;
|
|
66
|
+
failed: number;
|
|
67
|
+
results: PolicyFixtureResult[];
|
|
68
|
+
};
|
|
69
|
+
export type DemoActionResult = {
|
|
70
|
+
name: string;
|
|
71
|
+
tool: string;
|
|
72
|
+
status: ProxyHandleResult["status"];
|
|
73
|
+
decision: string | null;
|
|
74
|
+
reasons: string[];
|
|
75
|
+
actionPassId: string | null;
|
|
76
|
+
ledgerLine: number | null;
|
|
77
|
+
result: JsonValue | null;
|
|
78
|
+
};
|
|
79
|
+
export type DemoRunResult = {
|
|
80
|
+
schemaVersion: typeof DEMO_SCHEMA_VERSION;
|
|
81
|
+
config: {
|
|
82
|
+
filePath: string | null;
|
|
83
|
+
issuer: string;
|
|
84
|
+
tenant: string;
|
|
85
|
+
};
|
|
86
|
+
ledgerPath: string;
|
|
87
|
+
results: DemoActionResult[];
|
|
88
|
+
adapters: FakeAdapterState;
|
|
89
|
+
adapterModes: {
|
|
90
|
+
github: "fake";
|
|
91
|
+
slack: "fake";
|
|
92
|
+
linear: "fake";
|
|
93
|
+
aws: "off";
|
|
94
|
+
gcp: "off";
|
|
95
|
+
mcp: "fixture";
|
|
96
|
+
};
|
|
97
|
+
ledger: {
|
|
98
|
+
valid: boolean;
|
|
99
|
+
records: number;
|
|
100
|
+
lastLedgerHash: string | null;
|
|
101
|
+
failure: string | null;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
export type CliIo = {
|
|
105
|
+
stdout?: (text: string) => void;
|
|
106
|
+
stderr?: (text: string) => void;
|
|
107
|
+
cwd?: string;
|
|
108
|
+
};
|
|
109
|
+
type SmokeTestInput = DemoRunInput & {
|
|
110
|
+
env?: Record<string, string | undefined>;
|
|
111
|
+
fetch?: typeof fetch;
|
|
112
|
+
};
|
|
113
|
+
export type LedgerExportRunInput = DemoRunInput & {
|
|
114
|
+
from?: string;
|
|
115
|
+
to?: string;
|
|
116
|
+
decisions?: AxtaryDecision[];
|
|
117
|
+
outputPath?: string;
|
|
118
|
+
format?: LedgerExportFormat;
|
|
119
|
+
};
|
|
120
|
+
export type LedgerExportRunResult = {
|
|
121
|
+
schemaVersion: typeof LEDGER_EXPORT_RUN_SCHEMA_VERSION;
|
|
122
|
+
config: {
|
|
123
|
+
filePath: string | null;
|
|
124
|
+
tenant: string;
|
|
125
|
+
};
|
|
126
|
+
ledgerPath: string;
|
|
127
|
+
outputPath: string | null;
|
|
128
|
+
format: LedgerExportFormat;
|
|
129
|
+
export: LedgerExport;
|
|
130
|
+
};
|
|
131
|
+
export type LedgerSyncRunInput = LedgerExportRunInput & {
|
|
132
|
+
endpoint: string;
|
|
133
|
+
tenant?: string;
|
|
134
|
+
tokenEnv?: string;
|
|
135
|
+
env?: Record<string, string | undefined>;
|
|
136
|
+
fetch?: typeof fetch;
|
|
137
|
+
};
|
|
138
|
+
export type LedgerSyncRunResult = {
|
|
139
|
+
schemaVersion: typeof LEDGER_SYNC_RUN_SCHEMA_VERSION;
|
|
140
|
+
config: {
|
|
141
|
+
filePath: string | null;
|
|
142
|
+
tenant: string;
|
|
143
|
+
};
|
|
144
|
+
ledgerPath: string;
|
|
145
|
+
endpoint: string;
|
|
146
|
+
sync: LedgerSyncResult;
|
|
147
|
+
};
|
|
148
|
+
export declare function startProxyServer(input?: ProxyServerInput): Promise<ProxyServerHandle>;
|
|
149
|
+
export declare function runDemo(input?: DemoRunInput): Promise<DemoRunResult>;
|
|
150
|
+
export declare function runSmokeTest(input?: SmokeTestInput, io?: CliIo): Promise<number>;
|
|
151
|
+
export declare function runTestPolicy(input: PolicyTestRunInput): Promise<PolicyTestRunResult>;
|
|
152
|
+
export declare function runLedgerExport(input?: LedgerExportRunInput): Promise<LedgerExportRunResult>;
|
|
153
|
+
export declare function runLedgerSync(input: LedgerSyncRunInput): Promise<LedgerSyncRunResult>;
|
|
154
|
+
export declare function runAxtaryCli(argv?: string[], io?: CliIo): Promise<number>;
|
|
155
|
+
export {};
|
|
156
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,cAAc,EAEpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAgBL,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAML,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAQxB,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AACpD,eAAO,MAAM,0BAA0B,0BAA0B,CAAC;AAClE,eAAO,MAAM,0BAA0B,0BAA0B,CAAC;AAClE,eAAO,MAAM,gCAAgC,gCAAgC,CAAC;AAC9E,eAAO,MAAM,8BAA8B,8BAA8B,CAAC;AAE1E,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,OAAO,0BAA0B,CAAC;IACjD,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IAC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