nightster 0.0.0-stage → 0.1.0-alpha.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/LICENSE +202 -0
- package/NOTICE +54 -0
- package/README.md +107 -2
- package/dist/cli/check.d.ts +35 -0
- package/dist/cli/check.js +91 -0
- package/dist/cli/doctor.d.ts +48 -0
- package/dist/cli/doctor.js +114 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +3 -0
- package/dist/cli/program.d.ts +27 -0
- package/dist/cli/program.js +48 -0
- package/dist/conformance/checks.d.ts +10 -0
- package/dist/conformance/checks.js +93 -0
- package/dist/conformance/discovery.d.ts +49 -0
- package/dist/conformance/discovery.js +81 -0
- package/dist/conformance/http.d.ts +60 -0
- package/dist/conformance/http.js +210 -0
- package/dist/conformance/index.d.ts +13 -0
- package/dist/conformance/index.js +10 -0
- package/dist/conformance/redact.d.ts +49 -0
- package/dist/conformance/redact.js +226 -0
- package/dist/conformance/registry.d.ts +99 -0
- package/dist/conformance/registry.js +70 -0
- package/dist/conformance/render.d.ts +8 -0
- package/dist/conformance/render.js +64 -0
- package/dist/conformance/result.d.ts +80 -0
- package/dist/conformance/result.js +75 -0
- package/dist/conformance/runner.d.ts +43 -0
- package/dist/conformance/runner.js +235 -0
- package/dist/core/check.d.ts +124 -0
- package/dist/core/check.js +286 -0
- package/dist/core/coverage.d.ts +50 -0
- package/dist/core/coverage.js +93 -0
- package/dist/core/doctor.d.ts +35 -0
- package/dist/core/doctor.js +102 -0
- package/dist/core/file-permissions.d.ts +55 -0
- package/dist/core/file-permissions.js +108 -0
- package/dist/core/flow.d.ts +215 -0
- package/dist/core/flow.js +278 -0
- package/dist/core/git.d.ts +38 -0
- package/dist/core/git.js +102 -0
- package/dist/core/index.d.ts +26 -0
- package/dist/core/index.js +16 -0
- package/dist/core/json-schema.d.ts +20 -0
- package/dist/core/json-schema.js +46 -0
- package/dist/core/load-runner-config.d.ts +57 -0
- package/dist/core/load-runner-config.js +113 -0
- package/dist/core/manifest.d.ts +50 -0
- package/dist/core/manifest.js +115 -0
- package/dist/core/runner-config.d.ts +68 -0
- package/dist/core/runner-config.js +157 -0
- package/dist/core/runner-paths.d.ts +27 -0
- package/dist/core/runner-paths.js +29 -0
- package/dist/core/secrets.d.ts +166 -0
- package/dist/core/secrets.js +650 -0
- package/dist/core/url-rules.d.ts +4 -0
- package/dist/core/url-rules.js +19 -0
- package/dist/core/validate.d.ts +65 -0
- package/dist/core/validate.js +462 -0
- package/dist/core/weak-checks.d.ts +23 -0
- package/dist/core/weak-checks.js +32 -0
- package/dist/driver/agent.d.ts +101 -0
- package/dist/driver/agent.js +303 -0
- package/dist/driver/assets/snapshot.js +107 -0
- package/dist/driver/browser.d.ts +118 -0
- package/dist/driver/browser.js +284 -0
- package/dist/driver/index.d.ts +13 -0
- package/dist/driver/index.js +10 -0
- package/dist/driver/jev.d.ts +279 -0
- package/dist/driver/jev.js +465 -0
- package/dist/driver/prompts.d.ts +3 -0
- package/dist/driver/prompts.js +39 -0
- package/dist/driver/revealable.d.ts +11 -0
- package/dist/driver/revealable.js +4 -0
- package/dist/driver/snapshot.d.ts +10 -0
- package/dist/driver/snapshot.js +24 -0
- package/dist/driver/text-helper.d.ts +198 -0
- package/dist/driver/text-helper.js +339 -0
- package/dist/driver/timeouts.d.ts +7 -0
- package/dist/driver/timeouts.js +9 -0
- package/examples/runner.yaml +54 -0
- package/package.json +55 -4
- package/schema/flow.schema.json +566 -0
- package/schema/nightster.schema.json +101 -0
- package/schema/runner.schema.json +125 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Nightster
|
|
2
|
+
Copyright 2026 Adeyemi Olaoye
|
|
3
|
+
|
|
4
|
+
This product includes software from jev-ultrafast
|
|
5
|
+
(https://github.com/browser-use/jev-ultrafast), Copyright (c) 2026 Browser Use,
|
|
6
|
+
licensed under the MIT License (full text below), at commit
|
|
7
|
+
1231850a0bf1a0c0341fe408ef1668dbbfdfac46 (2026-09-18, package version 0.1.0):
|
|
8
|
+
|
|
9
|
+
- src/driver/assets/snapshot.js (shipped as dist/driver/assets/snapshot.js):
|
|
10
|
+
jev_ultrafast/snapshot.js, copied unchanged.
|
|
11
|
+
SHA-256 e50473501c8fb8e70f3b21866d987393e3f2315c639d638bd477d170e81ed78d
|
|
12
|
+
- src/driver/prompts.ts (shipped as dist/driver/prompts.js): the prompt
|
|
13
|
+
strings NEXT_ACTION, TARGET and TEXT_VALUE from jev_ultrafast/questions.py,
|
|
14
|
+
ported to TypeScript verbatim.
|
|
15
|
+
- src/driver/jev.ts (shipped as dist/driver/jev.js): the Jev client,
|
|
16
|
+
post_json, validate_choice, action_space and choose from
|
|
17
|
+
jev_ultrafast/model.py (request body, retries and answer validation),
|
|
18
|
+
ported to TypeScript.
|
|
19
|
+
- src/driver/text-helper.ts (shipped as dist/driver/text-helper.js): the
|
|
20
|
+
text helper, field_text and field_context from jev_ultrafast/model.py
|
|
21
|
+
(request shape, retries and response validation), ported to TypeScript.
|
|
22
|
+
- src/driver/agent.ts (shipped as dist/driver/agent.js): the agent loop,
|
|
23
|
+
Agent's tick/predict/act from jev_ultrafast/agent.py (observe, choose, act,
|
|
24
|
+
stale-page retries, pending text reuse, the stall rule), ported to
|
|
25
|
+
TypeScript.
|
|
26
|
+
- src/driver/browser.ts (shipped as dist/driver/browser.js): observation,
|
|
27
|
+
freshness checks and action execution from jev_ultrafast/browser.py
|
|
28
|
+
(Browser.observe/fresh/act, fingerprint, browser_operation), ported to
|
|
29
|
+
TypeScript on Playwright, with its in-page scripts (target resolution and
|
|
30
|
+
the wait after input) copied verbatim.
|
|
31
|
+
|
|
32
|
+
-------------------------------------------------------------------------------
|
|
33
|
+
|
|
34
|
+
MIT License
|
|
35
|
+
|
|
36
|
+
Copyright (c) 2026 Browser Use
|
|
37
|
+
|
|
38
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
39
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
40
|
+
in the Software without restriction, including without limitation the rights
|
|
41
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
42
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
43
|
+
furnished to do so, subject to the following conditions:
|
|
44
|
+
|
|
45
|
+
The above copyright notice and this permission notice shall be included in all
|
|
46
|
+
copies or substantial portions of the Software.
|
|
47
|
+
|
|
48
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
49
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
50
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
51
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
52
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
53
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
54
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,108 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Nightster
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Agent-driven synthetic monitoring. User flows are described in plain language and shipped with the code. An agent runs them against production on a schedule, and confirmed regressions become JIRA tickets that dev agents can pick up and fix.
|
|
4
|
+
|
|
5
|
+
> **Status: early implementation.** Of the commands below, only `nightster check` is implemented so far. The full design lives in [`openspec/changes/nightster-poc/`](openspec/changes/nightster-poc/).
|
|
6
|
+
|
|
7
|
+
## Why
|
|
8
|
+
|
|
9
|
+
Deterministic E2E suites break on harmless UI changes, miss problems that only exist in production (config drift, real third parties, real data), and rarely get written for every change. Nightster puts an agent in charge of the browser while keeping a strict check on whether the flow actually worked. An agent saying "done" isn't treated as success: every flow needs checks that don't rely on the agent.
|
|
10
|
+
|
|
11
|
+
## How it works
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
product repo nightster (home box, systemd timer)
|
|
15
|
+
───────────── ───────────────────────────────────
|
|
16
|
+
flows/**/*.flow.yaml ── pulled ──▶ run each flow N× as a QA user, in prod
|
|
17
|
+
nightster.yaml nightly │
|
|
18
|
+
├─ driver: Jev picks op + target
|
|
19
|
+
CI: nightster check │ text helper fills fields
|
|
20
|
+
(plan exists & valid, │ Playwright drives Chromium
|
|
21
|
+
no browser) ├─ checks: URL / DOM / API as QA user
|
|
22
|
+
├─ classify: product · navigation ·
|
|
23
|
+
│ infra · dependency
|
|
24
|
+
└─ compare to 7-run baseline
|
|
25
|
+
│
|
|
26
|
+
product regression ──▶ JIRA (deduped,
|
|
27
|
+
deploy range,
|
|
28
|
+
repro command)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
A flow pairs a natural-language goal with checks Nightster verifies itself:
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
# flows/guest-checkout.flow.yaml
|
|
35
|
+
goal: Add the cheapest blue t-shirt to the cart and open the cart page
|
|
36
|
+
start: /shop
|
|
37
|
+
covers: ["src/routes/shop/**", "src/routes/cart/**"]
|
|
38
|
+
checks:
|
|
39
|
+
- url_matches: "/cart"
|
|
40
|
+
- api: { GET: "/api/cart", expect: { status: 200, "items.length": 1 } }
|
|
41
|
+
budget: { max_steps: 25, max_minutes: 4 }
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## CLI (planned)
|
|
45
|
+
|
|
46
|
+
| Command | Purpose |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `nightster init` | Set up a repo: manifest, `flows/`, CI step, instructions for your coding agent |
|
|
49
|
+
| `nightster doctor [--live]` | Report app-contract gaps and navigability blockers |
|
|
50
|
+
| `nightster auth login` | Device-flow login for the QA account |
|
|
51
|
+
| `nightster flow new <name>` | Scaffold a flow |
|
|
52
|
+
| `nightster check [--json] [--base <ref>]` | CI gate: schema, coverage, check quality. Runs nothing. **Implemented**: exits 1 on errors, 0 with only warnings, 2 if it can't run (including usage errors) |
|
|
53
|
+
| `nightster run <flow>` | Run one flow now. Also the repro command in tickets |
|
|
54
|
+
| `nightster monitor` | Scheduled runner: all flows, repeats, classification |
|
|
55
|
+
| `nightster report` | File or update JIRA tickets |
|
|
56
|
+
|
|
57
|
+
Flows are written by your coding agent, following instructions that `init` adds to the repo. Nightster itself only validates and verifies.
|
|
58
|
+
|
|
59
|
+
## App contract
|
|
60
|
+
|
|
61
|
+
Nightster works with any backend. Running in production requires the monitored app to implement a small, language-agnostic HTTP protocol built on OAuth standards:
|
|
62
|
+
|
|
63
|
+
- Its own OAuth device-flow login for QA accounts (RFC 8628), approved once by a user with `qa:approve`
|
|
64
|
+
- A QA account list in auth config. Tokens carry a `qa` claim and allowlisted scopes
|
|
65
|
+
- Short-lived access tokens, rotating refresh tokens, IP binding, an audit log and a kill switch
|
|
66
|
+
- Run tagging (`X-Nightster-Run`), automatic cleanup of QA data, a `/.well-known/nightster` discovery document, and a `nightster.yaml` manifest
|
|
67
|
+
|
|
68
|
+
The protocol is published as a spec with an implementation guide, so your coding agent can implement it in your stack, or you can configure an OIDC provider that already supports the device grant. `nightster doctor --live` runs a conformance suite that actively tests every rule it can observe over HTTP.
|
|
69
|
+
|
|
70
|
+
## Stack
|
|
71
|
+
|
|
72
|
+
- **TypeScript** (Node.js ≥ 22, published to npm) for the CLI and driver, with the official **Playwright** library for the browser
|
|
73
|
+
- **[Jev](https://docs.typesafe.ai/introduction)** (hosted by TypeSafe) chooses actions. The agent loop is ported from jev-ultrafast (MIT, Browser Use), and its `snapshot.js` is vendored
|
|
74
|
+
- **Text helper**: any OpenAI-compatible model, either Gemini Flash or hosted qwen2.5-14B (a spike will decide)
|
|
75
|
+
- **SQLite** for run history and baselines; **JIRA** REST API for tickets
|
|
76
|
+
- Runs on a Linux box with a fixed IP. No GPU needed
|
|
77
|
+
|
|
78
|
+
## Roadmap
|
|
79
|
+
|
|
80
|
+
1. Spikes: port the Jev loop to TypeScript, and pick the text helper
|
|
81
|
+
2. Flow format and `nightster check`
|
|
82
|
+
3. Driver: frames, popups, scripted steps, checks, artifacts
|
|
83
|
+
4. App-contract protocol spec and conformance suite
|
|
84
|
+
5. `auth`, `monitor`, `report`, `doctor`, `init`, and the docs site
|
|
85
|
+
6. First app monitored end to end
|
|
86
|
+
|
|
87
|
+
Out of scope for the POC: payments, DPoP, Svelte navigability linting, suppressing side effects such as emails and analytics, and per-language SDKs for the app contract.
|
|
88
|
+
|
|
89
|
+
## Working on this repo
|
|
90
|
+
|
|
91
|
+
Requires Node.js 22.12 or later (see `.nvmrc`).
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npm ci
|
|
95
|
+
npm run ci # what the CI workflow checks: lint, typecheck, test, build, pack smoke test (npm audit runs in CI only)
|
|
96
|
+
npm run lint # ESLint and Prettier (`npm run format` fixes formatting)
|
|
97
|
+
npm run build # compile src/ to dist/
|
|
98
|
+
npm run typecheck # type-check src/, tests included
|
|
99
|
+
npm test # unit tests (Vitest)
|
|
100
|
+
node dist/cli/index.js --help # or: npx . --help
|
|
101
|
+
npx playwright install chromium # the browser the driver uses; not needed for unit tests
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Planning uses [OpenSpec](https://github.com/Fission-AI/OpenSpec). Read the proposal, design, specs and tasks in [`openspec/changes/nightster-poc/`](openspec/changes/nightster-poc/), and implement tasks with `/opsx:apply`.
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
Apache License 2.0. See [`LICENSE`](LICENSE) and [`NOTICE`](NOTICE).
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { type CheckFinding, type CheckResult } from '../core/check.js';
|
|
3
|
+
import type { ProgramIO } from './program.js';
|
|
4
|
+
/**
|
|
5
|
+
* Exit codes: no errors (warnings allowed), error findings, or the check
|
|
6
|
+
* couldn't run (including a usage error, e.g. an unknown option).
|
|
7
|
+
*/
|
|
8
|
+
export declare const EXIT_OK = 0;
|
|
9
|
+
export declare const EXIT_FINDINGS = 1;
|
|
10
|
+
export declare const EXIT_CANNOT_RUN = 2;
|
|
11
|
+
export declare const CHECK_DESCRIPTION = "Validate flows, coverage of changed files and check quality (the CI gate; opens no browser)";
|
|
12
|
+
/**
|
|
13
|
+
* The `--json` document. On success: `{ ok, findings, summary }`. When the
|
|
14
|
+
* check can't run: `{ ok: false, error, findings: [], summary: null }`.
|
|
15
|
+
*/
|
|
16
|
+
export type CheckJson = CheckResult | {
|
|
17
|
+
ok: false;
|
|
18
|
+
error: string;
|
|
19
|
+
findings: [];
|
|
20
|
+
summary: null;
|
|
21
|
+
};
|
|
22
|
+
export declare function checkCommand(io: ProgramIO): Command;
|
|
23
|
+
/**
|
|
24
|
+
* The arguments the program was parsed with. commander keeps them on the
|
|
25
|
+
* root command as `rawArgs` (set by every parse), which its typings leave out.
|
|
26
|
+
*/
|
|
27
|
+
export declare function commandLine(command: Command): readonly string[];
|
|
28
|
+
/**
|
|
29
|
+
* The human report: one line per finding, in the compiler format
|
|
30
|
+
* `formatDiagnostic` uses (`file:line:column: severity: message`, or
|
|
31
|
+
* `file: severity: message` for a whole-file finding), then a summary line.
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatReport(result: CheckResult): string;
|
|
34
|
+
/** One finding as `file:line:column: severity: message` (`file: severity: message` without a line). */
|
|
35
|
+
export declare function formatFinding(finding: CheckFinding): string;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// `nightster check [--json] [--base <ref>]`: renders `runCheck()` (src/core/
|
|
2
|
+
// check.ts) as a readable report or one JSON document, and sets the exit code.
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import { DEFAULT_BASE_CANDIDATES } from '../core/git.js';
|
|
5
|
+
import { runCheck } from '../core/check.js';
|
|
6
|
+
/**
|
|
7
|
+
* Exit codes: no errors (warnings allowed), error findings, or the check
|
|
8
|
+
* couldn't run (including a usage error, e.g. an unknown option).
|
|
9
|
+
*/
|
|
10
|
+
export const EXIT_OK = 0;
|
|
11
|
+
export const EXIT_FINDINGS = 1;
|
|
12
|
+
export const EXIT_CANNOT_RUN = 2;
|
|
13
|
+
export const CHECK_DESCRIPTION = 'Validate flows, coverage of changed files and check quality (the CI gate; opens no browser)';
|
|
14
|
+
export function checkCommand(io) {
|
|
15
|
+
const command = new Command('check')
|
|
16
|
+
.description(CHECK_DESCRIPTION)
|
|
17
|
+
.option('--json', 'print one JSON document (findings with severity, file, line, message)')
|
|
18
|
+
.option('--base <ref>', `git ref to compare changed files against (default: the first of ${DEFAULT_BASE_CANDIDATES.join(', ')} that exists)`)
|
|
19
|
+
// A usage error (an unknown option, `--base` without a ref) means the
|
|
20
|
+
// check can't run: commander has already written its message to stderr;
|
|
21
|
+
// with `--json` on the command line, stdout still gets one JSON document.
|
|
22
|
+
// Then the error goes on to main(), which sets the exit code.
|
|
23
|
+
.exitOverride((error) => {
|
|
24
|
+
if (error.exitCode !== 0 && commandLine(command).includes('--json')) {
|
|
25
|
+
io.stdout(cannotRunJson(error.message));
|
|
26
|
+
}
|
|
27
|
+
throw error;
|
|
28
|
+
})
|
|
29
|
+
.action(async (options) => {
|
|
30
|
+
const json = options.json === true;
|
|
31
|
+
let result;
|
|
32
|
+
try {
|
|
33
|
+
result = await runCheck({ cwd: io.cwd(), base: options.base });
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
37
|
+
if (json)
|
|
38
|
+
io.stdout(cannotRunJson(message));
|
|
39
|
+
else
|
|
40
|
+
io.stderr(`nightster check: ${message}\n`);
|
|
41
|
+
io.setExitCode(EXIT_CANNOT_RUN);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
io.stdout(json ? `${JSON.stringify(result, null, 2)}\n` : formatReport(result));
|
|
45
|
+
io.setExitCode(result.ok ? EXIT_OK : EXIT_FINDINGS);
|
|
46
|
+
});
|
|
47
|
+
return command;
|
|
48
|
+
}
|
|
49
|
+
/** The `--json` document for a check that can't run. */
|
|
50
|
+
function cannotRunJson(error) {
|
|
51
|
+
const document = { ok: false, error, findings: [], summary: null };
|
|
52
|
+
return `${JSON.stringify(document, null, 2)}\n`;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The arguments the program was parsed with. commander keeps them on the
|
|
56
|
+
* root command as `rawArgs` (set by every parse), which its typings leave out.
|
|
57
|
+
*/
|
|
58
|
+
export function commandLine(command) {
|
|
59
|
+
let root = command;
|
|
60
|
+
while (root.parent)
|
|
61
|
+
root = root.parent;
|
|
62
|
+
return root.rawArgs ?? [];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The human report: one line per finding, in the compiler format
|
|
66
|
+
* `formatDiagnostic` uses (`file:line:column: severity: message`, or
|
|
67
|
+
* `file: severity: message` for a whole-file finding), then a summary line.
|
|
68
|
+
*/
|
|
69
|
+
export function formatReport(result) {
|
|
70
|
+
const lines = result.findings.map(formatFinding);
|
|
71
|
+
const { errors, warnings, flows, changedFiles, base } = result.summary;
|
|
72
|
+
const counts = errors + warnings === 0
|
|
73
|
+
? 'no problems'
|
|
74
|
+
: [plural(errors, 'error'), plural(warnings, 'warning')]
|
|
75
|
+
.filter((part) => !part.startsWith('0 '))
|
|
76
|
+
.join(', ');
|
|
77
|
+
const coverage = base === null || changedFiles === null
|
|
78
|
+
? 'coverage not checked: nightster.yaml is invalid'
|
|
79
|
+
: `${plural(changedFiles, 'changed file')} against ${base}`;
|
|
80
|
+
lines.push(`${counts} (${plural(flows, 'flow')} checked, ${coverage})`);
|
|
81
|
+
return `${lines.join('\n')}\n`;
|
|
82
|
+
}
|
|
83
|
+
/** One finding as `file:line:column: severity: message` (`file: severity: message` without a line). */
|
|
84
|
+
export function formatFinding(finding) {
|
|
85
|
+
const { file, line, column, severity, message } = finding;
|
|
86
|
+
const at = line === undefined ? '' : `:${String(line)}:${String(column ?? 1)}`;
|
|
87
|
+
return `${file}${at}: ${severity}: ${message}`;
|
|
88
|
+
}
|
|
89
|
+
function plural(count, noun) {
|
|
90
|
+
return `${String(count)} ${noun}${count === 1 ? '' : 's'}`;
|
|
91
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { type DoctorItem } from '../core/index.js';
|
|
3
|
+
import type { ProgramIO } from './program.js';
|
|
4
|
+
export declare const DOCTOR_DESCRIPTION = "Report readiness as a checklist: manifest and flow files (live app-contract and navigability items show as unknown)";
|
|
5
|
+
/** The id of the live navigability crawl's item (task 9.3). */
|
|
6
|
+
export declare const NAVIGABILITY_ITEM_ID = "navigability";
|
|
7
|
+
/** Why a live item is `unknown` in a static run. */
|
|
8
|
+
export declare const LIVE_REASON = "live check, not run without --live";
|
|
9
|
+
export interface DoctorSummary {
|
|
10
|
+
total: number;
|
|
11
|
+
pass: number;
|
|
12
|
+
fail: number;
|
|
13
|
+
warning: number;
|
|
14
|
+
unknown: number;
|
|
15
|
+
}
|
|
16
|
+
export interface DoctorReport {
|
|
17
|
+
/** False when any item fails. `warning` and `unknown` items keep it true. */
|
|
18
|
+
ok: boolean;
|
|
19
|
+
/** Whether live items were checked; always false until `--live` lands (task 9.2). */
|
|
20
|
+
live: false;
|
|
21
|
+
/** Static items first (`manifest`, `flows`), then the live ones. */
|
|
22
|
+
items: DoctorItem[];
|
|
23
|
+
summary: DoctorSummary;
|
|
24
|
+
}
|
|
25
|
+
/** The `--json` document: a `DoctorReport`, or `{ ok: false, error, items: [], summary: null }` when doctor can't run. */
|
|
26
|
+
export type DoctorJson = DoctorReport | {
|
|
27
|
+
ok: false;
|
|
28
|
+
error: string;
|
|
29
|
+
items: [];
|
|
30
|
+
summary: null;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The live-only items, all `unknown`: every app-contract conformance check in
|
|
34
|
+
* the catalogue (by rule ID, with its severity), then the navigability crawl.
|
|
35
|
+
*/
|
|
36
|
+
export declare function liveItems(): DoctorItem[];
|
|
37
|
+
/** Runs the static checklist for the repository `cwd` is in. Rejects when doctor can't run. */
|
|
38
|
+
export declare function runDoctor(options: {
|
|
39
|
+
cwd: string;
|
|
40
|
+
}): Promise<DoctorReport>;
|
|
41
|
+
export declare function doctorCommand(io: ProgramIO): Command;
|
|
42
|
+
/**
|
|
43
|
+
* The human checklist, in `renderChecklist`'s style (src/conformance/
|
|
44
|
+
* render.ts): one `[STATUS] id (severity) title: reason` line per item, each
|
|
45
|
+
* finding indented under it in `nightster check`'s format, then a summary and
|
|
46
|
+
* a verdict.
|
|
47
|
+
*/
|
|
48
|
+
export declare function formatChecklist(report: DoctorReport): string;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// `nightster doctor [--json]` (task 9.1; spec cli, "doctor reports contract
|
|
2
|
+
// and navigability readiness"): the readiness checklist. Without `--live` (task
|
|
3
|
+
// 9.2, not implemented yet) it runs only the static items, manifest and flow
|
|
4
|
+
// files (src/core/doctor.ts), and lists every live-only item, the app-contract
|
|
5
|
+
// conformance checks and the navigability crawl, as `unknown`. Files and `git`
|
|
6
|
+
// only: no browser, no network.
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
import { builtinCatalogue } from '../conformance/checks.js';
|
|
9
|
+
import { STATUS_LABELS } from '../conformance/render.js';
|
|
10
|
+
import { staticDoctorItems } from '../core/index.js';
|
|
11
|
+
import { commandLine, EXIT_CANNOT_RUN, EXIT_FINDINGS, EXIT_OK, formatFinding } from './check.js';
|
|
12
|
+
export const DOCTOR_DESCRIPTION = 'Report readiness as a checklist: manifest and flow files (live app-contract and navigability items show as unknown)';
|
|
13
|
+
/** The id of the live navigability crawl's item (task 9.3). */
|
|
14
|
+
export const NAVIGABILITY_ITEM_ID = 'navigability';
|
|
15
|
+
/** Why a live item is `unknown` in a static run. */
|
|
16
|
+
export const LIVE_REASON = 'live check, not run without --live';
|
|
17
|
+
/**
|
|
18
|
+
* The live-only items, all `unknown`: every app-contract conformance check in
|
|
19
|
+
* the catalogue (by rule ID, with its severity), then the navigability crawl.
|
|
20
|
+
*/
|
|
21
|
+
export function liveItems() {
|
|
22
|
+
const contract = builtinCatalogue().map((entry) => ({
|
|
23
|
+
id: entry.id,
|
|
24
|
+
title: entry.title,
|
|
25
|
+
live: true,
|
|
26
|
+
status: 'unknown',
|
|
27
|
+
reason: LIVE_REASON,
|
|
28
|
+
severity: entry.severity,
|
|
29
|
+
findings: [],
|
|
30
|
+
}));
|
|
31
|
+
return [
|
|
32
|
+
...contract,
|
|
33
|
+
{
|
|
34
|
+
id: NAVIGABILITY_ITEM_ID,
|
|
35
|
+
title: 'Pages are navigable by the agent (crawl as the QA user)',
|
|
36
|
+
live: true,
|
|
37
|
+
status: 'unknown',
|
|
38
|
+
reason: LIVE_REASON,
|
|
39
|
+
findings: [],
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
/** Runs the static checklist for the repository `cwd` is in. Rejects when doctor can't run. */
|
|
44
|
+
export async function runDoctor(options) {
|
|
45
|
+
const items = [...(await staticDoctorItems(options)), ...liveItems()];
|
|
46
|
+
const count = (status) => items.filter((i) => i.status === status).length;
|
|
47
|
+
const summary = {
|
|
48
|
+
total: items.length,
|
|
49
|
+
pass: count('pass'),
|
|
50
|
+
fail: count('fail'),
|
|
51
|
+
warning: count('warning'),
|
|
52
|
+
unknown: count('unknown'),
|
|
53
|
+
};
|
|
54
|
+
return { ok: summary.fail === 0, live: false, items, summary };
|
|
55
|
+
}
|
|
56
|
+
export function doctorCommand(io) {
|
|
57
|
+
const command = new Command('doctor')
|
|
58
|
+
.description(DOCTOR_DESCRIPTION)
|
|
59
|
+
.option('--json', 'print one JSON document (the checklist items with status and reason)')
|
|
60
|
+
// As in `check`: a usage error means doctor can't run; with `--json` on
|
|
61
|
+
// the command line, stdout still gets one JSON document.
|
|
62
|
+
.exitOverride((error) => {
|
|
63
|
+
if (error.exitCode !== 0 && commandLine(command).includes('--json')) {
|
|
64
|
+
io.stdout(cannotRunJson(error.message));
|
|
65
|
+
}
|
|
66
|
+
throw error;
|
|
67
|
+
})
|
|
68
|
+
.action(async (options) => {
|
|
69
|
+
const json = options.json === true;
|
|
70
|
+
let report;
|
|
71
|
+
try {
|
|
72
|
+
report = await runDoctor({ cwd: io.cwd() });
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
76
|
+
if (json)
|
|
77
|
+
io.stdout(cannotRunJson(message));
|
|
78
|
+
else
|
|
79
|
+
io.stderr(`nightster doctor: ${message}\n`);
|
|
80
|
+
io.setExitCode(EXIT_CANNOT_RUN);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
io.stdout(json ? `${JSON.stringify(report, null, 2)}\n` : formatChecklist(report));
|
|
84
|
+
io.setExitCode(report.ok ? EXIT_OK : EXIT_FINDINGS);
|
|
85
|
+
});
|
|
86
|
+
return command;
|
|
87
|
+
}
|
|
88
|
+
function cannotRunJson(error) {
|
|
89
|
+
const document = { ok: false, error, items: [], summary: null };
|
|
90
|
+
return `${JSON.stringify(document, null, 2)}\n`;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The human checklist, in `renderChecklist`'s style (src/conformance/
|
|
94
|
+
* render.ts): one `[STATUS] id (severity) title: reason` line per item, each
|
|
95
|
+
* finding indented under it in `nightster check`'s format, then a summary and
|
|
96
|
+
* a verdict.
|
|
97
|
+
*/
|
|
98
|
+
export function formatChecklist(report) {
|
|
99
|
+
const width = Math.max(...Object.values(STATUS_LABELS).map((l) => l.length)) + 2;
|
|
100
|
+
const lines = [];
|
|
101
|
+
for (const item of report.items) {
|
|
102
|
+
const label = `[${STATUS_LABELS[item.status]}]`.padEnd(width);
|
|
103
|
+
const severity = item.severity === undefined ? '' : ` (${item.severity})`;
|
|
104
|
+
lines.push(`${label} ${item.id}${severity} ${item.title}: ${item.reason}`);
|
|
105
|
+
for (const finding of item.findings) {
|
|
106
|
+
lines.push(`${' '.repeat(width)} ${formatFinding(finding)}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const { pass, fail, warning, unknown } = report.summary;
|
|
110
|
+
lines.push('', `${String(pass)} pass, ${String(fail)} fail, ${String(warning)} warning, ${String(unknown)} unknown`, report.ok
|
|
111
|
+
? 'Static checks OK. Live items (app contract, navigability) are not checked without --live.'
|
|
112
|
+
: 'Static checks FAILED.');
|
|
113
|
+
return `${lines.join('\n')}\n`;
|
|
114
|
+
}
|