open-local-audit 0.61.0 → 0.63.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/CHANGELOG.md +12 -0
- package/README.md +42 -0
- package/dist/batch.d.ts +1 -0
- package/dist/batch.js +9 -3
- package/dist/batch.js.map +1 -1
- package/dist/cli.js +120 -167
- package/dist/cli.js.map +1 -1
- package/dist/discovery-runner.d.ts +28 -0
- package/dist/discovery-runner.js +136 -0
- package/dist/discovery-runner.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/output.d.ts +1 -0
- package/dist/output.js +20 -3
- package/dist/output.js.map +1 -1
- package/dist/shortlist-runner.d.ts +10 -0
- package/dist/shortlist-runner.js +25 -0
- package/dist/shortlist-runner.js.map +1 -0
- package/dist/workflow-config.d.ts +151 -0
- package/dist/workflow-config.js +104 -0
- package/dist/workflow-config.js.map +1 -0
- package/dist/workflow-output.d.ts +5 -0
- package/dist/workflow-output.js +70 -0
- package/dist/workflow-output.js.map +1 -0
- package/dist/workflow-paths.d.ts +19 -0
- package/dist/workflow-paths.js +111 -0
- package/dist/workflow-paths.js.map +1 -0
- package/dist/workflow-preflight.d.ts +38 -0
- package/dist/workflow-preflight.js +206 -0
- package/dist/workflow-preflight.js.map +1 -0
- package/dist/workflow.d.ts +85 -0
- package/dist/workflow.js +382 -0
- package/dist/workflow.js.map +1 -0
- package/docs/architecture/workflow-command.md +106 -0
- package/docs/architecture/workflow-preflight.md +131 -0
- package/package.json +4 -2
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Workflow Preflight
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Workflow preflight validates whether a version `1` workflow configuration is operationally ready without running discovery, calling external APIs, or creating or modifying workflow outputs.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
open-local-audit workflow --config workflow.json --check
|
|
9
|
+
open-local-audit workflow --config workflow.json --check --format json
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The existing `workflow --config <path>` execution behavior remains unchanged. `--format` is accepted only with `--check`.
|
|
13
|
+
|
|
14
|
+
## Goals
|
|
15
|
+
|
|
16
|
+
- Validate the strict workflow configuration before execution.
|
|
17
|
+
- Check local inputs, optional review state, API key availability, output writability, and managed-path safety.
|
|
18
|
+
- Show the stages and managed outputs that a real workflow would use.
|
|
19
|
+
- Produce stable terminal and JSON results for operators and CI jobs.
|
|
20
|
+
- Keep preflight read-only and prevent secrets from appearing in output.
|
|
21
|
+
|
|
22
|
+
## Non-Goals
|
|
23
|
+
|
|
24
|
+
Preflight does not:
|
|
25
|
+
|
|
26
|
+
- call Google Places or any audited website;
|
|
27
|
+
- create output directories or probe writability by creating temporary files;
|
|
28
|
+
- run discovery, shortlist, review, or packaging stages;
|
|
29
|
+
- estimate currency costs or promise external API availability;
|
|
30
|
+
- send outreach, upload reports, or synchronize CRM records.
|
|
31
|
+
|
|
32
|
+
## Checks
|
|
33
|
+
|
|
34
|
+
The preflight service performs these checks in order:
|
|
35
|
+
|
|
36
|
+
1. Read and validate the strict version `1` JSON configuration.
|
|
37
|
+
2. For `manual-csv`, require the discovery input to exist as a readable regular file.
|
|
38
|
+
3. For `google-places`, require the existing Google Maps API key resolver to return a nonblank value without exposing it or making a network request.
|
|
39
|
+
4. When a review CSV is configured, verify it is a readable regular file when present. A missing review CSV is a warning because the workflow may create it.
|
|
40
|
+
5. Find the nearest existing ancestor for `outDir` and verify that it is a directory with write access.
|
|
41
|
+
6. Inspect existing `outDir`, `reports/`, enabled `packages/`, and config-managed output files. Reject linked managed paths and canonical directories that escape `outDir`.
|
|
42
|
+
7. Report the enabled workflow stages, configured limits, and resolved managed output paths.
|
|
43
|
+
|
|
44
|
+
Filesystem access checks are advisory and can become stale before execution. The workflow retains its existing write-time containment checks as the authoritative enforcement boundary.
|
|
45
|
+
|
|
46
|
+
## Result Contract
|
|
47
|
+
|
|
48
|
+
The preflight report is versioned independently from the workflow configuration:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"version": 1,
|
|
53
|
+
"status": "ready",
|
|
54
|
+
"checks": [
|
|
55
|
+
{
|
|
56
|
+
"id": "configuration",
|
|
57
|
+
"status": "pass",
|
|
58
|
+
"message": "Workflow configuration is valid"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"stages": ["discovery", "shortlist"],
|
|
62
|
+
"outputs": {
|
|
63
|
+
"outDir": "C:/work/workflow-output",
|
|
64
|
+
"workflowSummaryJson": "C:/work/workflow-output/workflow-summary.json"
|
|
65
|
+
},
|
|
66
|
+
"limits": {
|
|
67
|
+
"maxCandidates": null,
|
|
68
|
+
"maxAudits": 10
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The report uses:
|
|
74
|
+
|
|
75
|
+
- `ready` when no check failed; warnings are allowed and the command exits `0`;
|
|
76
|
+
- `blocked` when one or more checks failed; the command exits `1`;
|
|
77
|
+
- `pass`, `warn`, or `fail` for individual checks.
|
|
78
|
+
|
|
79
|
+
Check identifiers are stable machine-readable strings. Messages are human-readable and must not contain API keys, environment values, or raw configuration contents.
|
|
80
|
+
|
|
81
|
+
`maxCandidates` is the configured Google Places candidate limit and is `null` for manual CSV. `maxAudits` is the configured audit cap and is `null` when no cap is configured. These values describe limits, not predicted usage or cost.
|
|
82
|
+
|
|
83
|
+
## Terminal Output
|
|
84
|
+
|
|
85
|
+
Terminal output is the default and is written to standard output:
|
|
86
|
+
|
|
87
|
+
```text
|
|
88
|
+
Workflow preflight: READY
|
|
89
|
+
Config: workflow.json
|
|
90
|
+
Provider: manual-csv
|
|
91
|
+
|
|
92
|
+
PASS Workflow configuration is valid
|
|
93
|
+
PASS Discovery input is readable
|
|
94
|
+
PASS Output location is writable
|
|
95
|
+
WARN Review CSV does not exist and will be created
|
|
96
|
+
|
|
97
|
+
Stages: discovery -> shortlist -> review
|
|
98
|
+
Managed output: ./workflow-output
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
For a blocked terminal preflight, the full report remains on standard output and the CLI writes its existing concise `open-local-audit:` error summary to standard error.
|
|
102
|
+
|
|
103
|
+
With `--format json`, standard output contains exactly one JSON document for both ready and blocked results. The exit code remains authoritative; no additional human-readable text is written to standard output.
|
|
104
|
+
|
|
105
|
+
## Components
|
|
106
|
+
|
|
107
|
+
- `workflow-preflight.ts` owns check orchestration and the versioned result type.
|
|
108
|
+
- Small shared workflow path and output modules own no-write inspection, write-time managed-directory preparation, and same-directory temporary-file replacement for managed outputs.
|
|
109
|
+
- Terminal and JSON renderers convert a preflight result without performing checks.
|
|
110
|
+
- `cli.ts` selects normal execution or preflight while preserving the existing error prefix and exit behavior.
|
|
111
|
+
|
|
112
|
+
## Failure Handling
|
|
113
|
+
|
|
114
|
+
Configuration read and validation errors are converted into a blocked preflight report. Independent checks continue where their prerequisites are available so one invocation can report all actionable local problems. Checks that depend on an invalid configuration are omitted rather than reported as additional failures.
|
|
115
|
+
|
|
116
|
+
Expected operational filesystem errors are sanitized and represented as failed checks; unexpected programming errors still propagate. The command must never include a resolved API key in thrown errors, terminal output, or JSON output.
|
|
117
|
+
|
|
118
|
+
## Acceptance Tests
|
|
119
|
+
|
|
120
|
+
- A valid manual CSV configuration is ready, exits `0`, and creates no files or directories.
|
|
121
|
+
- Missing, unreadable, or non-file manual input blocks execution.
|
|
122
|
+
- Google API key presence passes without a network request; a missing key blocks execution.
|
|
123
|
+
- A missing review CSV produces a warning, while an unreadable or non-file review path fails.
|
|
124
|
+
- A missing output tree passes when its nearest existing ancestor is writable.
|
|
125
|
+
- An unwritable output ancestor blocks execution without creating a probe file.
|
|
126
|
+
- Linked or canonically escaping managed directories, and linked managed output files, block execution.
|
|
127
|
+
- Terminal and JSON outputs contain no API key or raw environment value.
|
|
128
|
+
- JSON output is one parseable document for ready and blocked results.
|
|
129
|
+
- `--format` without `--check` is rejected.
|
|
130
|
+
- Existing workflow execution and failure behavior remains covered by regression tests.
|
|
131
|
+
- The release passes the full release check, package audit, and fresh consumer installation check.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-local-audit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.63.0",
|
|
4
4
|
"description": "Open-source website and local presence auditor for small businesses.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
"dist",
|
|
15
15
|
"README.md",
|
|
16
16
|
"LICENSE",
|
|
17
|
-
"CHANGELOG.md"
|
|
17
|
+
"CHANGELOG.md",
|
|
18
|
+
"docs/architecture/workflow-command.md",
|
|
19
|
+
"docs/architecture/workflow-preflight.md"
|
|
18
20
|
],
|
|
19
21
|
"scripts": {
|
|
20
22
|
"build": "tsc -p tsconfig.build.json",
|