@syndicalt/snow-cli 1.5.0 → 2.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.
Files changed (3) hide show
  1. package/README.md +585 -2
  2. package/dist/index.js +5116 -2863
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # snow-cli
2
2
 
3
- A portable CLI for ServiceNow. Query tables, inspect schemas, edit and search script fields, bulk-update records, manage users and groups, handle attachments, promote update sets across environments, and generate complete applications using AI — all from your terminal.
3
+ A portable CLI for ServiceNow. Query tables, inspect schemas, edit and search script fields, bulk-update records, manage users and groups, handle attachments, promote update sets across environments, browse the Service Catalog, inspect Flow Designer flows, manage scoped applications, tail system logs, and generate complete applications using AI — all from your terminal.
4
4
 
5
5
  - [Installation](#installation)
6
6
  - [Quick Start](#quick-start)
@@ -15,6 +15,12 @@ A portable CLI for ServiceNow. Query tables, inspect schemas, edit and search sc
15
15
  - [snow attachment](#snow-attachment)
16
16
  - [snow updateset](#snow-updateset)
17
17
  - [snow status](#snow-status)
18
+ - [snow diff](#snow-diff)
19
+ - [snow factory](#snow-factory)
20
+ - [snow catalog](#snow-catalog)
21
+ - [snow flow](#snow-flow)
22
+ - [snow app](#snow-app)
23
+ - [snow log](#snow-log)
18
24
  - [snow provider](#snow-provider)
19
25
  - [snow ai](#snow-ai)
20
26
  - [Configuration File](#configuration-file)
@@ -22,6 +28,10 @@ A portable CLI for ServiceNow. Query tables, inspect schemas, edit and search sc
22
28
 
23
29
  ---
24
30
 
31
+ ## Full Documentation
32
+
33
+ The full documentation is available on the [documentation page](https://syndicalt.github.io/snow_cli/). This README provides a quick overview and examples to get started.
34
+
25
35
  ## Installation
26
36
 
27
37
  **From npm (when published):**
@@ -76,8 +86,38 @@ snow attachment pull incident <sys_id> --all --out ./downloads
76
86
  snow provider set openai
77
87
  snow ai build "Create a script include that auto-routes incidents by category and urgency"
78
88
 
79
- # 10. Start an interactive session to build iteratively
89
+ # 10. Compare schema/scripts between instances to detect drift
90
+ snow diff incident --against prod --fields
91
+ snow diff all --against test --scripts --scope x_myco_myapp
92
+
93
+ # 11. Run the full factory pipeline: plan → build → test → promote
94
+ snow factory "Build a hardware asset request app with approval workflow" --envs test,prod
95
+
96
+ # 11b. Run tests and auto-fix failures with the LLM optimization loop
97
+ snow factory "Create a Script Include named SLACalculator with risk level logic" --run-tests --optimize
98
+
99
+ # 12. Start an interactive session to build iteratively
80
100
  snow ai chat
101
+
102
+ # 13. Browse the Service Catalog
103
+ snow catalog list
104
+ snow catalog search "VPN"
105
+ snow catalog get "Request VPN Access"
106
+
107
+ # 14. Inspect Flow Designer flows and actions
108
+ snow flow list
109
+ snow flow list --subflows --scope x_myco_myapp
110
+ snow flow get "My Approval Flow"
111
+
112
+ # 15. List scoped applications
113
+ snow app list
114
+ snow app get x_myco_myapp
115
+
116
+ # 16. Tail system logs
117
+ snow log
118
+ snow log --level err --follow
119
+ snow log app --scope x_myco_myapp
120
+ snow log tx --slow 2000
81
121
  ```
82
122
 
83
123
  ---
@@ -699,6 +739,542 @@ snow status --no-errors
699
739
 
700
740
  ---
701
741
 
742
+ ### `snow diff`
743
+
744
+ Compare schema field definitions and script content between two configured instances. Useful for detecting drift — fields added/removed/changed, or scripts that diverged between dev and test/prod.
745
+
746
+ ```bash
747
+ # Compare field definitions for a table
748
+ snow diff incident --against prod --fields
749
+
750
+ # Compare script content in an app scope between dev and test
751
+ snow diff all --against test --scripts --scope x_myco_myapp
752
+
753
+ # Compare both fields and scripts
754
+ snow diff sys_script_include --against prod --fields --scripts
755
+
756
+ # Output as Markdown (for pasting into docs or tickets)
757
+ snow diff incident --against prod --fields --markdown
758
+
759
+ # Output as JSON (for scripting or CI pipelines)
760
+ snow diff incident --against prod --fields --scripts --json
761
+
762
+ # Save the diff report to a file (ANSI stripped automatically)
763
+ snow diff all --against prod --scripts --scope x_myco_myapp --output ./diff-report.txt
764
+ ```
765
+
766
+ The source is always the **active instance** (`snow instance use <alias>` to set it). `--against` specifies the target instance alias.
767
+
768
+ **Arguments:**
769
+
770
+ | Argument | Description |
771
+ |---|---|
772
+ | `<table>` | Table to compare for `--fields`. Use `all` with `--scripts` to scan all script-bearing tables. |
773
+
774
+ **Options:**
775
+
776
+ | Flag | Description |
777
+ |---|---|
778
+ | `--against <alias>` | Target instance alias to compare against (required) |
779
+ | `--fields` | Compare `sys_dictionary` field definitions |
780
+ | `--scripts` | Compare script field content across script-bearing tables |
781
+ | `--scope <prefix>` | Filter scripts by application scope prefix (e.g. `x_myco_myapp`) |
782
+ | `--markdown` | Output as Markdown for docs/tickets |
783
+ | `--json` | Output structured JSON (fields rows + script hunks) |
784
+ | `--output <file>` | Write the diff to a file (ANSI color codes stripped automatically) |
785
+
786
+ At least one of `--fields` or `--scripts` is required.
787
+
788
+ #### Field diff output
789
+
790
+ Shows every field that was **added** (only in target), **removed** (only in source), or **changed** (type, max_length, mandatory, read_only, reference, or active flag differs):
791
+
792
+ ```
793
+ Schema diff: incident
794
+ ──────────────────────────────────────────────────
795
+ Field Status Detail
796
+ ──────────────────────────────────────────────────────────────────────────
797
+ x_myco_priority_code added type=string
798
+ x_myco_legacy_flag removed type=boolean
799
+ category changed max_length: 40 → 100
800
+ ```
801
+
802
+ #### Script diff output
803
+
804
+ For each script-bearing table, shows scripts **added** (only in target), **removed** (only in source), or **changed** (content differs), with a contextual line diff for changed scripts:
805
+
806
+ ```
807
+ Script diff: sys_script_include
808
+ ──────────────────────────────────────────────────
809
+ + NewUtils (only in prod)
810
+ - OldHelper (only in dev)
811
+ ~ IncidentRouter
812
+
813
+ IncidentRouter
814
+ --- dev
815
+ +++ prod
816
+ @@ lines 12–16 @@
817
+ var gr = new GlideRecord('incident');
818
+ - gr.addQuery('state', 1);
819
+ + gr.addQuery('state', 2);
820
+ gr.query();
821
+ ```
822
+
823
+ **Script tables scanned** (when using `--scripts`):
824
+
825
+ | Table | Description |
826
+ |---|---|
827
+ | `sys_script_include` | Script Includes |
828
+ | `sys_script` | Business Rules |
829
+ | `sys_script_client` | Client Scripts |
830
+ | `sys_ui_action` | UI Actions |
831
+ | `sysauto_script` | Scheduled Script Executions |
832
+
833
+ ---
834
+
835
+ ### `snow factory`
836
+
837
+ AI-orchestrated multi-component application pipeline. Takes a natural language description, breaks it into a dependency-ordered build plan, generates each component via LLM, pushes to the source instance, optionally generates and runs ATF tests, then promotes through additional environments.
838
+
839
+ ```bash
840
+ # Plan and build (deploys to active instance only)
841
+ snow factory "Build an employee onboarding app with custom tables, approval workflow, and email notifications"
842
+
843
+ # Full pipeline: dev → test → prod
844
+ snow factory "Build a hardware asset request app" --envs test,prod
845
+
846
+ # Force all artifacts into an existing application scope
847
+ snow factory "Add an approval business rule to the asset request app" --scope x_myco_assetreq
848
+
849
+ # Preview the plan without building
850
+ snow factory "Build an incident escalation app" --dry-run
851
+
852
+ # Generate and immediately run ATF tests
853
+ snow factory "Build a change approval workflow" --run-tests
854
+
855
+ # Generate ATF tests, run them, and auto-fix failures with the LLM (up to 3 retries)
856
+ snow factory "Create a priority calculator script include" --run-tests --optimize
857
+
858
+ # Same, but allow up to 5 fix iterations
859
+ snow factory "Create a priority calculator script include" --run-tests --optimize --max-retries 5
860
+
861
+ # Skip ATF test generation (faster)
862
+ snow factory "Add a business rule to auto-assign P1 incidents" --skip-tests
863
+
864
+ # Resume a failed or interrupted run
865
+ snow factory "..." --resume abc12345
866
+
867
+ # List recent factory runs
868
+ snow factory "" --list
869
+ ```
870
+
871
+ **Options:**
872
+
873
+ | Flag | Description |
874
+ |---|---|
875
+ | `--envs <aliases>` | Comma-separated instance aliases to promote to after source, in order (e.g. `test,prod`) |
876
+ | `--scope <prefix>` | Override the application scope prefix for all artifacts (e.g. `x_myco_myapp`) |
877
+ | `--skip-tests` | Skip ATF test generation |
878
+ | `--run-tests` | Execute the generated ATF test suite immediately after pushing |
879
+ | `--optimize` | After running tests, auto-fix failures via LLM feedback loop (implies `--run-tests`) |
880
+ | `--max-retries <n>` | Max optimization iterations when using `--optimize` (default: `3`) |
881
+ | `--dry-run` | Show the generated plan only — no builds, no deployments |
882
+ | `--resume <id>` | Resume a previous run from its checkpoint (see `--list`) |
883
+ | `--list` | Show recent factory runs and their component completion status |
884
+
885
+ #### Pipeline phases
886
+
887
+ ```
888
+ [1/N] Planning
889
+ LLM analyzes the prompt → structured plan with components, dependencies, risks
890
+ Displays plan for review → confirm before proceeding
891
+
892
+ [2/N] Building components
893
+ Each component is built sequentially in dependency order
894
+ Tables first, then script includes, then business rules / client scripts
895
+ Each component saved to ~/.snow/factory/<run-id>/<component>/
896
+
897
+ [3/N] Pushing to <source-instance>
898
+ All artifacts pushed to the active instance via Table API
899
+ Creates or updates existing records
900
+
901
+ [4/N] Generating ATF tests (unless --skip-tests)
902
+ LLM generates a test suite with server-side script assertions
903
+ Tests pushed to the instance as sys_atf_test + sys_atf_step records
904
+ If --run-tests or --optimize: suite is executed via the CICD API
905
+ Pass/fail counts and per-test results are displayed
906
+
907
+ If --optimize and tests failed:
908
+ → LLM receives the failing test names + error messages + artifact source
909
+ → Generates corrected artifacts, re-pushes them, re-runs the suite
910
+ → Repeats until all pass or --max-retries is exhausted
911
+
912
+ [5/N] Promoting to <env> (once per additional env in --envs)
913
+ Checks for pre-existing artifacts on the target
914
+ Confirms before applying
915
+ Uploads combined update set XML to sys_remote_update_set
916
+ Prints direct link → then Load → Preview → Commit in the UI
917
+ ```
918
+
919
+ #### Checkpointing and resume
920
+
921
+ Every factory run is checkpointed to `~/.snow/factory/<run-id>/state.json` after each completed phase. If a run is interrupted (network error, LLM failure, manual cancellation), resume it:
922
+
923
+ ```bash
924
+ snow factory "" --list # find the run ID
925
+ snow factory "" --resume abc12345 # resume from last successful phase
926
+ ```
927
+
928
+ The resume prompt argument is ignored when `--resume` is provided — the original prompt and plan are loaded from the checkpoint.
929
+
930
+ #### Auto-optimization loop
931
+
932
+ When `--optimize` is set, the factory runs an automated fix cycle after the initial ATF test run. For each iteration:
933
+
934
+ 1. Failing test names and error messages are collected from the `sys_atf_result` table
935
+ 2. The current source code of every script-bearing artifact is extracted from the local manifest
936
+ 3. A structured fix prompt is sent to the LLM — no questions, just a corrected build
937
+ 4. Fixed artifacts are merged into the build (replaced by `type + name`), re-pushed to the instance
938
+ 5. The existing ATF suite is re-run; if all tests pass, the loop exits early
939
+
940
+ ```
941
+ [Optimize 1/3] 2 test(s) failing — asking LLM to fix...
942
+ ────────────────────────────────────────────────
943
+ Patching:
944
+ ~ script_include SLACalculator
945
+ Re-pushing fixed artifacts to instance...
946
+ Re-running ATF tests...
947
+ 3/3 tests passed
948
+ ✓ Test low risk level
949
+ ✓ Test medium risk level
950
+ ✓ Test high risk level
951
+
952
+ ✔ All tests passing after optimization!
953
+ ```
954
+
955
+ If failures persist after all retries, a warning is shown and the best-effort build is kept on disk.
956
+
957
+ **Requirements for ATF test execution:**
958
+ - The `sn_cicd` plugin must be active on the instance
959
+ - The authenticated user must have the `sn_cicd` role
960
+ - ATF must be enabled (`System ATF` → `Properties` → `Enable ATF`)
961
+
962
+ The optimization loop uses the same LLM provider as the build. Each iteration costs one LLM call, so `--max-retries 3` (default) means at most 3 additional calls beyond the initial build.
963
+
964
+ #### Example output
965
+
966
+ ```
967
+ ────────────────────────────────────────────────────────
968
+ snow factory · anthropic
969
+ Source: dev https://dev12345.service-now.com
970
+ Pipeline: dev → test → prod
971
+ ────────────────────────────────────────────────────────
972
+
973
+ [1/5] Planning
974
+ ────────────────────────────────────────────────────────
975
+ Employee Onboarding App
976
+ Automates new-hire onboarding with task assignment, document tracking, and notifications
977
+ scope: x_myco_onboard v1.0.0
978
+
979
+ Components (3) — ~14 artifacts
980
+ 1. Custom Tables (no deps)
981
+ Employee and HR document tracking tables
982
+ 2. Script Includes ← depends on: tables
983
+ OnboardingUtils class for task generation and notifications
984
+ 3. Business Rules ← depends on: tables, scripts
985
+ Auto-assign tasks on employee insert; notify on completion
986
+
987
+ ⚠ Risks:
988
+ • SMTP server must be configured for email notifications
989
+ • MID Server required for Active Directory sync
990
+
991
+ ? Execute factory pipeline? (3 components → dev → test → prod) Yes
992
+
993
+ [2/5] Building components
994
+ ────────────────────────────────────────────────────────
995
+ ✓ Custom Tables 2 artifacts
996
+ + table x_myco_onboard_employee
997
+ + table x_myco_onboard_doc
998
+ ✓ Script Includes 1 artifact
999
+ + script_include x_myco_onboard.OnboardingUtils
1000
+ ✓ Business Rules 3 artifacts
1001
+ + business_rule Auto-Assign Tasks on Insert
1002
+ + business_rule Notify Manager on Completion
1003
+ + scheduled_job Weekly Onboarding Report
1004
+
1005
+ ✔ 6 total artifacts combined
1006
+
1007
+ [3/5] Pushing to dev
1008
+ ────────────────────────────────────────────────────────
1009
+ created Table x_myco_onboard_employee
1010
+ created Table x_myco_onboard_doc
1011
+ created Script Include x_myco_onboard.OnboardingUtils
1012
+ created Business Rule Auto-Assign Tasks on Insert
1013
+ ...
1014
+ 6 pushed, 0 failed
1015
+
1016
+ [4/5] Generating ATF tests
1017
+ ────────────────────────────────────────────────────────
1018
+ Employee Onboarding App — ATF Suite
1019
+ 4 tests generated
1020
+ • Test employee record creation and field defaults (3 steps)
1021
+ • Test OnboardingUtils task generation (2 steps)
1022
+ • Test business rule fires on insert (3 steps)
1023
+ • Test manager notification trigger (2 steps)
1024
+ ✓ Test suite created
1025
+ https://dev12345.service-now.com/nav_to.do?uri=sys_atf_test_suite.do?sys_id=...
1026
+ Running ATF tests...
1027
+ 4/4 tests passed
1028
+ ✓ Test employee record creation and field defaults
1029
+ ✓ Test OnboardingUtils task generation
1030
+ ✓ Test business rule fires on insert
1031
+ ✓ Test manager notification trigger
1032
+ ```
1033
+
1034
+ #### Permission-denied errors
1035
+
1036
+ Some artifact types require elevated roles to push via the Table API:
1037
+
1038
+ | Artifact | Required role |
1039
+ |---|---|
1040
+ | `table` (`sys_db_object`) | `admin` or `delegated_developer` |
1041
+ | `decision_table` (`sys_decision`) | `admin` or `developer` |
1042
+ | `flow_action` (`sys_hub_action_type_definition`) | `flow_designer` + `IntegrationHub` |
1043
+
1044
+ When a 403 is encountered the artifact is **skipped** (shown in yellow) rather than failing the whole run. The generated update set XML is always written to disk regardless — use it to import via the UI when Table API access is restricted:
1045
+
1046
+ ```
1047
+ System Update Sets → Retrieved Update Sets → Import XML → Load → Preview → Commit
1048
+ ```
1049
+
1050
+ ---
1051
+
1052
+ ### `snow catalog`
1053
+
1054
+ Browse and search the ServiceNow Service Catalog.
1055
+
1056
+ ```bash
1057
+ # List catalog items
1058
+ snow catalog list
1059
+ snow catalog list --category "Hardware"
1060
+ snow catalog list --catalog "Employee Center" -l 50
1061
+
1062
+ # Search by name or description
1063
+ snow catalog search "VPN"
1064
+ snow catalog search "laptop" --limit 10
1065
+
1066
+ # Get details for a specific item (by name or sys_id)
1067
+ snow catalog get "Request VPN Access"
1068
+ snow catalog get abc1234...
1069
+
1070
+ # List catalog categories
1071
+ snow catalog categories
1072
+ snow catalog categories --catalog "IT Catalog"
1073
+ ```
1074
+
1075
+ **`snow catalog list` options:**
1076
+
1077
+ | Flag | Description |
1078
+ |---|---|
1079
+ | `-q, --query <encoded>` | Encoded query filter |
1080
+ | `--category <name>` | Filter by category name |
1081
+ | `--catalog <name>` | Filter by catalog title |
1082
+ | `-l, --limit <n>` | Max records (default: `25`) |
1083
+ | `--json` | Output as JSON |
1084
+
1085
+ **`snow catalog search` options:**
1086
+
1087
+ | Flag | Description |
1088
+ |---|---|
1089
+ | `-l, --limit <n>` | Max records (default: `20`) |
1090
+ | `--json` | Output as JSON |
1091
+
1092
+ **`snow catalog categories` options:**
1093
+
1094
+ | Flag | Description |
1095
+ |---|---|
1096
+ | `--catalog <name>` | Filter by catalog title |
1097
+ | `-l, --limit <n>` | Max records (default: `100`) |
1098
+ | `--json` | Output as JSON |
1099
+
1100
+ Sub-categories are indented based on their depth in the `full_name` hierarchy.
1101
+
1102
+ ---
1103
+
1104
+ ### `snow flow`
1105
+
1106
+ List and inspect Flow Designer flows, subflows, and custom actions.
1107
+
1108
+ ```bash
1109
+ # List flows
1110
+ snow flow list
1111
+ snow flow list --scope x_myco_myapp
1112
+ snow flow list -l 50
1113
+
1114
+ # List subflows instead
1115
+ snow flow list --subflows
1116
+ snow flow list --subflows --scope x_myco_myapp
1117
+
1118
+ # Get details and inputs for a specific flow (by name or sys_id)
1119
+ snow flow get "My Approval Flow"
1120
+ snow flow get abc1234...
1121
+
1122
+ # List custom Flow Designer actions
1123
+ snow flow actions
1124
+ snow flow actions --scope x_myco_myapp
1125
+ ```
1126
+
1127
+ **`snow flow list` options:**
1128
+
1129
+ | Flag | Description |
1130
+ |---|---|
1131
+ | `--subflows` | Show subflows instead of flows |
1132
+ | `--scope <prefix>` | Filter by application scope prefix |
1133
+ | `-q, --query <encoded>` | Additional encoded query filter |
1134
+ | `-l, --limit <n>` | Max records (default: `25`) |
1135
+ | `--json` | Output as JSON |
1136
+
1137
+ **`snow flow actions` options:**
1138
+
1139
+ | Flag | Description |
1140
+ |---|---|
1141
+ | `--scope <prefix>` | Filter by application scope prefix |
1142
+ | `-q, --query <encoded>` | Additional encoded query filter |
1143
+ | `-l, --limit <n>` | Max records (default: `25`) |
1144
+ | `--json` | Output as JSON |
1145
+
1146
+ `snow flow get` shows flow metadata, trigger type, run-as setting, and the list of typed input variables. It also prints the direct Flow Designer URL for the record.
1147
+
1148
+ Active flows are shown with a green `●`; inactive with a red `○`.
1149
+
1150
+ ---
1151
+
1152
+ ### `snow app`
1153
+
1154
+ List and inspect scoped applications on the active instance.
1155
+
1156
+ ```bash
1157
+ # List custom scoped applications (sys_app)
1158
+ snow app list
1159
+
1160
+ # Include all system scopes (sys_scope)
1161
+ snow app list --all
1162
+
1163
+ # Filter with an encoded query
1164
+ snow app list -q "vendor=Acme Corp"
1165
+
1166
+ # Get details for a specific app by scope prefix or name
1167
+ snow app get x_myco_myapp
1168
+ snow app get "My Custom App"
1169
+ snow app get abc1234... # sys_id also accepted
1170
+ ```
1171
+
1172
+ **`snow app list` options:**
1173
+
1174
+ | Flag | Description |
1175
+ |---|---|
1176
+ | `--all` | Include all system scopes, not just custom applications |
1177
+ | `-q, --query <encoded>` | Encoded query filter |
1178
+ | `-l, --limit <n>` | Max records (default: `50`) |
1179
+ | `--json` | Output as JSON |
1180
+
1181
+ `snow app get` shows scope prefix, sys_id, version, vendor, created/updated dates, and whether the scope has update set entries. It also prints helpful next-step commands for `snow factory` and `snow diff`.
1182
+
1183
+ ---
1184
+
1185
+ ### `snow log`
1186
+
1187
+ View system and application logs from the active instance.
1188
+
1189
+ ```bash
1190
+ # System log (default subcommand)
1191
+ snow log
1192
+ snow log system
1193
+ snow log --level err
1194
+ snow log --source Evaluator --limit 100
1195
+
1196
+ # Filter by scope
1197
+ snow log --scope x_myco_myapp
1198
+
1199
+ # Follow mode — polls for new entries every 5 seconds
1200
+ snow log --follow
1201
+ snow log --follow --interval 10000
1202
+
1203
+ # Application log (requires admin role)
1204
+ snow log app
1205
+ snow log app --scope x_myco_myapp
1206
+
1207
+ # Transaction log
1208
+ snow log tx
1209
+ snow log tx --slow 2000 # only show responses > 2000ms
1210
+ ```
1211
+
1212
+ #### `snow log system` (default)
1213
+
1214
+ Queries the `syslog` table. Output columns: timestamp, level, source, message.
1215
+
1216
+ | Flag | Description |
1217
+ |---|---|
1218
+ | `--level <level>` | Filter by level: `err`, `warn`, `info`, `debug` |
1219
+ | `--source <source>` | Filter by log source (e.g. `Evaluator`, `Script`) |
1220
+ | `--scope <prefix>` | Filter by application scope prefix |
1221
+ | `-q, --query <encoded>` | Additional encoded query filter |
1222
+ | `-l, --limit <n>` | Max records (default: `50`) |
1223
+ | `--follow` | Poll for new entries (Ctrl+C to stop) |
1224
+ | `--interval <ms>` | Polling interval in ms when using `--follow` (default: `5000`) |
1225
+ | `--json` | Output as JSON |
1226
+
1227
+ #### `snow log app`
1228
+
1229
+ Queries the `syslog_app_scope` table, which contains application-level log entries written by `gs.log()`, `gs.warn()`, etc. **Requires the `admin` role** — a clear error is shown if access is denied.
1230
+
1231
+ | Flag | Description |
1232
+ |---|---|
1233
+ | `--scope <prefix>` | Filter by application scope prefix |
1234
+ | `--source <source>` | Filter by log source |
1235
+ | `-l, --limit <n>` | Max records (default: `50`) |
1236
+ | `--follow` | Poll for new entries |
1237
+ | `--interval <ms>` | Polling interval in ms (default: `5000`) |
1238
+ | `--json` | Output as JSON |
1239
+
1240
+ #### `snow log tx`
1241
+
1242
+ Queries the `syslog_transaction` table. Output columns: timestamp, HTTP status, response time (highlighted red if > 2s), username, URL.
1243
+
1244
+ | Flag | Description |
1245
+ |---|---|
1246
+ | `-l, --limit <n>` | Max records (default: `25`) |
1247
+ | `--slow <ms>` | Only show transactions slower than this many milliseconds |
1248
+ | `--json` | Output as JSON |
1249
+
1250
+ ---
1251
+
1252
+ #### `snow ai test <path>`
1253
+
1254
+ Generate ATF tests for any previously generated build and push them to the active instance. Usable independently of `snow factory`.
1255
+
1256
+ ```bash
1257
+ # Generate and push tests for a build
1258
+ snow ai test ./my-build/
1259
+
1260
+ # Generate, push, and immediately run
1261
+ snow ai test ./my-build/ --run
1262
+
1263
+ # Custom suite name
1264
+ snow ai test ./my-build/my-build.manifest.json --suite-name "Sprint 42 — Onboarding Tests"
1265
+ ```
1266
+
1267
+ **Options:**
1268
+
1269
+ | Flag | Description |
1270
+ |---|---|
1271
+ | `--run` | Execute the test suite immediately after pushing via the ATF API |
1272
+ | `--suite-name <name>` | Override the generated suite name |
1273
+
1274
+ Requires access to `sys_atf_step_config`, `sys_atf_test`, `sys_atf_test_suite`, and `sys_atf_step` tables. ATF must be enabled on the instance.
1275
+
1276
+ ---
1277
+
702
1278
  ### `snow provider`
703
1279
 
704
1280
  Configure LLM providers used by `snow ai`. API keys and model preferences are stored in `~/.snow/config.json`.
@@ -1049,6 +1625,12 @@ src/
1049
1625
  attachment.ts snow attachment (list/pull/push)
1050
1626
  updateset.ts snow updateset (list/current/set/show/capture/export/apply/diff)
1051
1627
  status.ts snow status
1628
+ diff.ts snow diff (cross-instance schema/script comparison)
1629
+ factory.ts snow factory (AI-orchestrated multi-env app pipeline)
1630
+ catalog.ts snow catalog (Service Catalog browse/search)
1631
+ flow.ts snow flow (Flow Designer flows, subflows, actions)
1632
+ app.ts snow app (scoped application metadata)
1633
+ log.ts snow log (system, app, and transaction logs)
1052
1634
  provider.ts snow provider
1053
1635
  ai.ts snow ai (build, chat, review, push)
1054
1636
  lib/
@@ -1057,6 +1639,7 @@ src/
1057
1639
  llm.ts LLM provider abstraction (OpenAI, Anthropic, xAI, Ollama)
1058
1640
  sn-context.ts ServiceNow system prompt and artifact type definitions
1059
1641
  update-set.ts XML update set generation and Table API push
1642
+ atf.ts ATF test generation and execution utilities
1060
1643
  types/
1061
1644
  index.ts Shared TypeScript interfaces
1062
1645
  ```