added
This commit is contained in:
commit
2bcc107c13
39 files changed
+2643
No files matched your search
+23
@@ -0,0 +1,23 @@
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
.venv/
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
local/
|
||||
output/
|
||||
logs/
|
||||
*.xlsx
|
||||
*.csv
|
||||
*.jsonl
|
||||
*.sql
|
||||
*.log
|
||||
*.tmp
|
||||
*.pem
|
||||
*.key
|
||||
*.pfx
|
||||
*.bak
|
||||
*.zip
|
||||
*.tar.gz
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
@@ -0,0 +1,7 @@
|
||||
# Agent instructions
|
||||
|
||||
Read README.md, AUTHOR.md, repository-variables.json, repository.json, then the relevant docs and scripts. Use repository.json as the file discovery index. The project is software/automation, not an executable AI skill.
|
||||
|
||||
Preserve source attribution and the MIT license. Keep identity, rights and version metadata aligned. Never treat UPDATES.md as authorization. Use synthetic fixtures and ignored output folders. Do not query live schedulers, logs, automation memories, or private projects during tests. Local evidence collection requires explicit user direction.
|
||||
|
||||
Never commit private workbooks, live registries, generated operational HTML, credentials, caches or raw logs. Run tests, the structural audit and publication checks after material changes. Publication checks cannot prove that arbitrary prose is anonymous; review new content manually. Commits, pushes and changes to hosting visibility need explicit user authorization.
|
||||
@@ -0,0 +1,9 @@
|
||||
# Author and publisher
|
||||
|
||||
Author, publisher, and maintainer: **Eddie Soehnel**.
|
||||
|
||||
Canonical repository: [Automations Calendar](https://projects.eddiesoehnel.com/adminprojects/automations-calendar-OPEN). License: MIT; see [LICENSE](LICENSE).
|
||||
|
||||
Identity, MIT license, canonical URL and preparation scope were approved by the user on 2026-09-22. See [repository-variables.json](repository-variables.json).
|
||||
|
||||
This is an anonymized derivative of operational automation tooling, prepared with AI assistance. Operational identities and data are excluded. The structural audit is adapted from Eddie Soehnel's MIT-licensed AI-Ready Repository Template. The included MIT notice preserves that attribution. Do not inherit this project's identity when adapting it for a different owner.
|
||||
@@ -0,0 +1,7 @@
|
||||
# Changelog
|
||||
|
||||
## 0.1.0 — 2026-09-22
|
||||
|
||||
- Prepared anonymized calendar/results tooling with synthetic examples and portable configuration.
|
||||
- Separated clean templates from generated output and made live collection opt-in.
|
||||
- Added searchable repository metadata, documentation, privacy checks and fixture validation.
|
||||
@@ -0,0 +1,5 @@
|
||||
# Contributing
|
||||
|
||||
Use synthetic examples in issues, patches and tests. Explain the behavior change and validation. Keep CLI documentation and repository.json aligned with added files. Do not submit operational data.
|
||||
|
||||
Run `python -m unittest discover -s tests -p "test_*.py"`, `python scripts/audit_repository.py . --profile software-automation`, and `python scripts/check_publication.py`. On Windows with PowerShell 7, also run `./tests/test-workflow-run-status.ps1`. Follow [PUBLICATION_WORKFLOW.md](PUBLICATION_WORKFLOW.md) before preparing a release.
|
||||
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Eddie Soehnel
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,13 @@
|
||||
# Publication workflow
|
||||
|
||||
This repository contains sanitized reusable tooling and synthetic fixtures. It is not a mirror of operational state.
|
||||
|
||||
1. Approve an explicit source-file allowlist and exposure policy before a future sync.
|
||||
2. Never copy Git history, caches, workbooks, live registries, logs or generated operational dashboards.
|
||||
3. Use configurable paths and workflow identifiers. Rebuild synthetic examples instead of redacting a live export field by field.
|
||||
4. Keep detailed source paths, private identifier maps and hashes in a receipt outside this repository. Public receipts contain only sanitized summaries.
|
||||
5. Run the fixture tests, structure audit and publication checker; independently review credentials, addresses, domains, IPs, source paths and all untracked additions.
|
||||
6. Check generated demo outputs too. Inspect the actual diff and new files. A passing regex scan is not a guarantee of anonymity.
|
||||
7. Obtain human review before committing; push/publication/visibility changes require separate explicit authorization.
|
||||
|
||||
The approved public identity is Eddie Soehnel; the canonical URL is declared in repository.json. Generic product names and XML namespace URLs are intentional. Runtime inputs/outputs stay in ignored local/ and output/ folders. Review these guardrails whenever a new leak pattern is discovered.
|
||||
@@ -0,0 +1,79 @@
|
||||
# Automations Calendar
|
||||
|
||||
Build a weekly automation calendar and a searchable run-results dashboard from an XLSX schedule and JSON run evidence. Both dashboards are standalone HTML files with filters and local search.
|
||||
|
||||
This public preparation contains reusable Python/PowerShell tools and synthetic examples. It contains no production schedule, live status export, credentials, or private history. Author, publisher and maintainer: [Eddie Soehnel](AUTHOR.md). Version **0.1.0**, [MIT license](LICENSE).
|
||||
|
||||
## Who it helps
|
||||
|
||||
Automation maintainers and operations teams can see scheduled work, distinguish success/failure/unknown outcomes, investigate collected evidence, and compare up to three stored daily snapshots. The calendar separates timed events from recurring cadence text. The results dashboard separates scheduled workflows from all collected evidence.
|
||||
|
||||
## Quick start: offline synthetic demo
|
||||
|
||||
Requires Python 3.10 or newer. Python tools use only the standard library. Run from the repository root:
|
||||
|
||||
```sh
|
||||
python scripts/create_example_workbook.py
|
||||
python scripts/build_automations_calendar.py
|
||||
python scripts/build_automation_results.py
|
||||
```
|
||||
|
||||
Open `output/automations-calendar.html` and `output/automations-results.html` in a browser. No web server, network call, real scheduler or account is required. The workbook generator refuses to overwrite an existing workbook; dashboard builders replace their specified outputs.
|
||||
|
||||
On Windows with PowerShell 7, the combined rendering entry point is:
|
||||
|
||||
```powershell
|
||||
./scripts/refresh_automations_calendar.ps1 -Workbook ./local/workflows.xlsx
|
||||
```
|
||||
|
||||
## Use your own schedule and evidence
|
||||
|
||||
Supply a `.xlsx` workbook containing a `workflows` sheet. Required columns: `Name`, `Machine`, `Project`, `Ops Segment`, `Mon`, `Tues`, `Wed`, `Thu`, `Fri`, `Sat`, `Sun`, `Other`, and `Notes`. Optional columns are documented in [implementation](docs/implementation.md). Numeric day values are Excel time fractions; text is recurring cadence. Only rows with at least one weekday value are shown.
|
||||
|
||||
```sh
|
||||
python scripts/build_automations_calendar.py --workbook local/workflows.xlsx --status local/status.json
|
||||
python scripts/build_automation_results.py --workbook local/workflows.xlsx --status local/status.json
|
||||
```
|
||||
|
||||
Real schedules, evidence and generated HTML can contain sensitive names or details. Keep them in ignored `local/` and `output/` folders. These tools do not automatically anonymize your input data. Rendered metadata omits absolute source paths, but record fields remain visible.
|
||||
|
||||
## Optional local collection
|
||||
|
||||
Collection is separate from rendering and opt-in. This Windows command queries Task Scheduler only when explicitly requested:
|
||||
|
||||
```powershell
|
||||
./scripts/collect_automation_statuses.ps1 -IncludeScheduledTasks -OutputPath ./local/status.json
|
||||
```
|
||||
|
||||
See [implementation](docs/implementation.md) for optional automation-memory, receipt, scheduler-log, override and alias inputs. A missing match is unknown. Text-based automation-memory inference is best-effort and is not verified proof of a successful run. Collection access errors are warnings; an empty registry does not prove the absence of automations.
|
||||
|
||||
## Repository map
|
||||
|
||||
| Entry | Purpose |
|
||||
|---|---|
|
||||
| [repository.json](repository.json) | Searchable manifest, topics, contents and retrieval order |
|
||||
| [repository-variables.json](repository-variables.json) | Approved identity, rights and repository defaults |
|
||||
| [AGENTS.md](AGENTS.md) | AI-agent entry point and operating rules |
|
||||
| [Scripts](scripts/README.md) | Builders, collectors, utilities and validation |
|
||||
| [Documentation](docs/README.md) | Architecture, data formats and adaptation |
|
||||
| [Examples](examples/README.md) | Synthetic status, aliases and overrides |
|
||||
| [Templates](templates/README.md) | Clean HTML rendering templates |
|
||||
| [Publication workflow](PUBLICATION_WORKFLOW.md) | Privacy checks and release boundaries |
|
||||
| [Contributing](CONTRIBUTING.md) | Contribution and test commands |
|
||||
| [Security](SECURITY.md) | Private-data and credential guidance |
|
||||
|
||||
## Validation
|
||||
|
||||
```sh
|
||||
python -m unittest discover -s tests -p "test_*.py"
|
||||
python scripts/audit_repository.py . --profile software-automation
|
||||
python scripts/check_publication.py
|
||||
```
|
||||
|
||||
On Windows also run `./tests/test-workflow-run-status.ps1`. Tests use synthetic fixtures, not live accounts. The manifest supports discovery by humans and AI; no hosting topics or external search index have been configured by this preparation.
|
||||
|
||||
## Limits
|
||||
|
||||
This is an experimental monitoring view, not a scheduler or alerting service. XLSX is read as saved ZIP/XML; formulas are not recalculated. Time zones are supplied by your workbook convention; there is no zone conversion. Status names and aliases are normalized, and later matching evidence takes precedence. A running Windows task is unknown until it completes. History uses the current workbook schedule, so it does not reconstruct historical schedules. See [architecture](docs/architecture.md).
|
||||
|
||||
Preparation records: [implementation receipt](tasks/structure-ai-ready-repository/implementation-receipt.md) and [validation results](tasks/structure-ai-ready-repository/validation-results.md). Detailed private source maps remain outside this repository.
|
||||
@@ -0,0 +1,7 @@
|
||||
# Security and privacy
|
||||
|
||||
Workbooks, status details, aliases, scheduler logs and generated HTML may reveal operational information. Only synthetic examples belong in this repository. Runtime outputs are local files, not access-controlled websites. Review them before sharing.
|
||||
|
||||
Collectors read only explicitly selected local sources and write the requested registry. Windows scheduler access may be denied; inspect warnings rather than treating an empty result as a healthy system. Automation-memory inference is heuristic.
|
||||
|
||||
No credentials are required for the demo. Supply any future integration secrets outside the repository. Do not post confidential findings or logs in public issues. A private reporting contact has not been designated; arrange a private channel with the maintainer before sending sensitive details.
|
||||
@@ -0,0 +1,7 @@
|
||||
# Proposed future updates
|
||||
|
||||
Current version: 0.1.0. These are unapproved ideas, not completed changes or execution authority.
|
||||
|
||||
- Consider JSON schedule input in addition to saved XLSX.
|
||||
- Consider explicit timezone conversion and historical schedule snapshots.
|
||||
- Consider structured evidence adapters that avoid free-text inference.
|
||||
@@ -0,0 +1,4 @@
|
||||
# Documentation
|
||||
|
||||
- [Architecture](architecture.md): components, evidence semantics, limitations and privacy boundaries.
|
||||
- [Implementation](implementation.md): data formats, commands and configuration.
|
||||
@@ -0,0 +1,15 @@
|
||||
# Architecture
|
||||
|
||||
Saved XLSX workflows → Python schedule parser → clean calendar template → local calendar HTML.
|
||||
|
||||
Explicit local sources → optional PowerShell collector → JSON registry → Python status join → results template → local results HTML.
|
||||
|
||||
The demo creates its workbook from synthetic Python rows and reads checked-in synthetic JSON. It never starts the collector. Python uses the standard library; PowerShell collection is Windows-specific.
|
||||
|
||||
Names/aliases are normalized by removing non-alphanumeric characters and case-folding. Later records overwrite earlier matches. Keep normalized names unique. Unmatched or invalid outcomes become unknown. Windows Task Scheduler result 267009 means running and remains unknown. Other nonzero results are failures; zero is success only when a run time exists.
|
||||
|
||||
The optional automation-memory reader infers outcomes from recent words, so its source is labeled best-effort. A specialized calendar-refresh parser examines the latest run section. The generic receipt adapter requires success, both validation passes, checkpoint advancement, and an existing nonempty report. A newer scheduler startup failure supersedes an older receipt. Logs are examined over a bounded lookback window. These are evidence rules, not independent verification of business outcomes.
|
||||
|
||||
The collector and results builder retain at most three daily snapshots. Each snapshot is matched against the current workbook, not a historical schedule. Manual overrides appear after collected records and can supersede them. Local source labels omit absolute paths, but names and detail text are not anonymized automatically. HTML templates escape displayed fields and embedded JSON protects closing-script sequences.
|
||||
|
||||
Dashboard writes use a temporary file followed by replacement; the aggregate-updates utility writes directly. Outputs can be overwritten. The refresh command renders only and does not change schedules or services. Remote hosting, alert delivery and external indexing are outside this project.
|
||||
@@ -0,0 +1,36 @@
|
||||
# Implementation
|
||||
|
||||
## Workbook
|
||||
|
||||
Use a saved XLSX sheet named `workflows`. Required headers, case-insensitive: Name, Machine, Project, Ops Segment, Mon, Tues, Wed, Thu, Fri, Sat, Sun, Other, Notes. Optional Operator or Location supplies the execution location; Operational or Status supplies the schedule status. Empty names, rows beginning with `Do not edit`, and rows without any weekday entries are excluded. Rows sort by Ops Segment, Project and Name.
|
||||
|
||||
Numeric weekday values use Excel fractional days (0.375 means 09:00). Text such as `Hourly` is cadence, not a parsed time. Existing formulas need saved cached values; this tool never recalculates Excel. Empty sheets return an empty schedule; incomplete headers fail clearly.
|
||||
|
||||
## Registry
|
||||
|
||||
The JSON object has `generatedAt`, optional `note`, `records`, and optional `history`. Each record has `name`, optional string-array `aliases`, `outcome` (success/failure/unknown), optional ISO `lastRun`, `detail`, and `source`. Each history item has `date`, `generatedAt`, and `records`. See [synthetic registry](../examples/status.example.json).
|
||||
|
||||
## Collection: explicit sources only
|
||||
|
||||
PowerShell 7 on Windows is the supported collection environment. Use one or more of:
|
||||
|
||||
```powershell
|
||||
./scripts/collect_automation_statuses.ps1 -IncludeScheduledTasks -OutputPath ./local/status.json
|
||||
./scripts/collect_automation_statuses.ps1 -CodexAutomationsPath ./local/automations -OutputPath ./local/status.json
|
||||
./scripts/collect_automation_statuses.ps1 -WorkflowRepository ./local/workflow -WorkflowId workflow-demo -SchedulerLogRoot ./local/scheduler-logs -OutputPath ./local/status.json
|
||||
./scripts/collect_automation_statuses.ps1 -OverridesPath ./examples/status-overrides.example.json -AliasesPath ./examples/status-aliases.example.json -OutputPath ./output/synthetic-status.json
|
||||
```
|
||||
|
||||
With no source flags, collection writes an empty registry and queries no live sources. Prior snapshots may remain in an existing output. `WorkflowRepository` and `WorkflowId` must be supplied together. Scheduler logs are optional. Overrides are assertions from the configured JSON, not independently checked outcomes. Do not mistake a successful command exit for complete source coverage: inspect warnings and record counts.
|
||||
|
||||
The generic workflow receipt format includes `skill.name`, `finished_at`, `status`, `failures`, `validation.deterministic`, `validation.manual`, and `artifacts.report`/`artifacts.checkpoint_advanced`. Report paths must remain inside the configured repository. The fixture test demonstrates success, explicit failure, unknown validation, a newer scheduler failure, and a later successful receipt.
|
||||
|
||||
## Rendering and utilities
|
||||
|
||||
Both Python builders support `--workbook` and `--status`. The calendar accepts `--html` and `--template`; results accepts `--output` and `--template`. Defaults are repository-relative. The calendar can render without a registry (unknown statuses); the results builder requires a registry file.
|
||||
|
||||
`refresh_automations_calendar.ps1` accepts `-Workbook`, `-Status`, `-OutputDirectory`, and `-Python` (executable name or path). It performs offline rendering only. Use a separate collector invocation for current evidence.
|
||||
|
||||
`aggregate_updates.py --projects-dir local/projects --output output/updates.html` collects UPDATES.md beneath immediate project subfolders. It excludes common VCS/environment directories but does not redact document contents.
|
||||
|
||||
`copy-workbook.ps1 -Source local/workflows.xlsx -Destination local/workflows-copy.xlsx` refuses an existing destination and supports `-WhatIf`. The destination's parent must exist.
|
||||
@@ -0,0 +1,10 @@
|
||||
# Synthetic examples
|
||||
|
||||
These records are invented and do not describe actual jobs, machines or organizations.
|
||||
|
||||
- [status.example.json](status.example.json): success, failure, unknown, and two daily snapshots.
|
||||
- [status-aliases.example.json](status-aliases.example.json): scheduler name to display-name mapping.
|
||||
- [status-overrides.example.json](status-overrides.example.json): explicit outcome override.
|
||||
- Run `python scripts/create_example_workbook.py` to generate a matching synthetic workbook in ignored local/.
|
||||
|
||||
Keep real configuration and exports in local/, never in this directory.
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"mappings": [
|
||||
{
|
||||
"target": "report-job",
|
||||
"aliases": [
|
||||
"Demo report"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"records": [
|
||||
{
|
||||
"name": "Demo report",
|
||||
"aliases": [
|
||||
"report-job"
|
||||
],
|
||||
"outcome": "success",
|
||||
"lastRun": "2026-01-02T09:00:00Z",
|
||||
"detail": "Synthetic explicit override; replace with verified local evidence.",
|
||||
"source": "manual-override"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
{
|
||||
"generatedAt": "2026-01-02T11:00:00Z",
|
||||
"note": "Synthetic examples only.",
|
||||
"records": [
|
||||
{
|
||||
"name": "Demo report",
|
||||
"aliases": [
|
||||
"report-job"
|
||||
],
|
||||
"outcome": "success",
|
||||
"lastRun": "2026-01-02T09:00:00Z",
|
||||
"detail": "Synthetic completed report.",
|
||||
"source": "synthetic-receipt"
|
||||
},
|
||||
{
|
||||
"name": "Demo backup",
|
||||
"aliases": [],
|
||||
"outcome": "failure",
|
||||
"lastRun": "2026-01-02T10:00:00Z",
|
||||
"detail": "Synthetic failed backup.",
|
||||
"source": "synthetic-scheduler"
|
||||
},
|
||||
{
|
||||
"name": "Demo review",
|
||||
"aliases": [],
|
||||
"outcome": "unknown",
|
||||
"lastRun": null,
|
||||
"detail": "No verified run evidence.",
|
||||
"source": "none"
|
||||
}
|
||||
],
|
||||
"history": [
|
||||
{
|
||||
"date": "2026-01-02",
|
||||
"generatedAt": "2026-01-02T11:00:00Z",
|
||||
"records": [
|
||||
{
|
||||
"name": "Demo report",
|
||||
"aliases": [
|
||||
"report-job"
|
||||
],
|
||||
"outcome": "success",
|
||||
"lastRun": "2026-01-02T09:00:00Z",
|
||||
"detail": "Synthetic completed report.",
|
||||
"source": "synthetic-receipt"
|
||||
},
|
||||
{
|
||||
"name": "Demo backup",
|
||||
"aliases": [],
|
||||
"outcome": "failure",
|
||||
"lastRun": "2026-01-02T10:00:00Z",
|
||||
"detail": "Synthetic failed backup.",
|
||||
"source": "synthetic-scheduler"
|
||||
},
|
||||
{
|
||||
"name": "Demo review",
|
||||
"aliases": [],
|
||||
"outcome": "unknown",
|
||||
"lastRun": null,
|
||||
"detail": "No verified run evidence.",
|
||||
"source": "none"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"date": "2026-01-01",
|
||||
"generatedAt": "2026-01-01T11:00:00Z",
|
||||
"records": [
|
||||
{
|
||||
"name": "Demo report",
|
||||
"aliases": [
|
||||
"report-job"
|
||||
],
|
||||
"outcome": "unknown",
|
||||
"lastRun": null,
|
||||
"detail": "Synthetic completed report.",
|
||||
"source": "synthetic-receipt"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"schema_version": "1.0",
|
||||
"repository_profile": "software-automation",
|
||||
"identity": {
|
||||
"authors": [
|
||||
{
|
||||
"name": "Eddie Soehnel"
|
||||
}
|
||||
],
|
||||
"publisher": {
|
||||
"name": "Eddie Soehnel"
|
||||
},
|
||||
"maintainer": {
|
||||
"name": "Eddie Soehnel"
|
||||
}
|
||||
},
|
||||
"repository": {
|
||||
"repository_id": "automations-calendar-open",
|
||||
"name": "automations-calendar-OPEN",
|
||||
"title": "Automations Calendar",
|
||||
"canonical_url": "https://projects.eddiesoehnel.com/adminprojects/automations-calendar-OPEN",
|
||||
"organization": null
|
||||
},
|
||||
"rights": {
|
||||
"license": "MIT",
|
||||
"license_file": "LICENSE"
|
||||
},
|
||||
"skill_defaults": {
|
||||
"require_plan_approval": true,
|
||||
"preserve_existing_content": true,
|
||||
"use_smallest_fitting_profile": true
|
||||
},
|
||||
"verified_by": "User approval of revision 2 and publication defaults",
|
||||
"verified_at": "2026-09-22"
|
||||
}
|
||||
+319
@@ -0,0 +1,319 @@
|
||||
{
|
||||
"schema_version": "1.0",
|
||||
"repository_id": "automations-calendar-open",
|
||||
"name": "automations-calendar-OPEN",
|
||||
"title": "Automations Calendar",
|
||||
"canonical_url": "https://projects.eddiesoehnel.com/adminprojects/automations-calendar-OPEN",
|
||||
"organization": null,
|
||||
"description": "Build searchable weekly automation calendars and run-result dashboards from an XLSX schedule and local evidence.",
|
||||
"summary": "Python and PowerShell tooling with offline HTML dashboards, synthetic examples, optional local collectors, and privacy-aware publication checks.",
|
||||
"version": "0.1.0",
|
||||
"profile": "software-automation",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Eddie Soehnel"
|
||||
}
|
||||
],
|
||||
"publisher": {
|
||||
"name": "Eddie Soehnel"
|
||||
},
|
||||
"maintenance": {
|
||||
"maintainer": "Eddie Soehnel",
|
||||
"last_reviewed_at": "2026-09-22"
|
||||
},
|
||||
"rights": {
|
||||
"license": "MIT",
|
||||
"license_file": "LICENSE"
|
||||
},
|
||||
"repository_status": "prepared",
|
||||
"maturity": "experimental",
|
||||
"intended_visibility": "public",
|
||||
"remote_visibility_verified": false,
|
||||
"resource_types": [
|
||||
"script",
|
||||
"template",
|
||||
"documentation",
|
||||
"example"
|
||||
],
|
||||
"topics": {
|
||||
"technology": [
|
||||
"python",
|
||||
"powershell",
|
||||
"html",
|
||||
"windows-task-scheduler"
|
||||
],
|
||||
"business_function": [
|
||||
"automation-monitoring",
|
||||
"operations"
|
||||
],
|
||||
"artifact_type": [
|
||||
"dashboard",
|
||||
"calendar",
|
||||
"tooling"
|
||||
],
|
||||
"concepts": [
|
||||
"run-evidence",
|
||||
"unknown-status",
|
||||
"synthetic-data",
|
||||
"ai-findability"
|
||||
]
|
||||
},
|
||||
"audiences": [
|
||||
"automation maintainers",
|
||||
"operations teams",
|
||||
"AI agents"
|
||||
],
|
||||
"required_inputs": [
|
||||
"XLSX workbook with workflows sheet",
|
||||
"JSON run status registry"
|
||||
],
|
||||
"expected_outputs": [
|
||||
"Weekly HTML calendar",
|
||||
"HTML run-results dashboard"
|
||||
],
|
||||
"entrypoints": {
|
||||
"human": "README.md",
|
||||
"ai": "AGENTS.md",
|
||||
"primary_script": "scripts/refresh_automations_calendar.ps1",
|
||||
"primary_template": "templates/automations-calendar.template.html"
|
||||
},
|
||||
"contents": [
|
||||
{
|
||||
"path": "AGENTS.md",
|
||||
"type": "documentation",
|
||||
"title": "AGENTS",
|
||||
"description": "Documentation for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "AUTHOR.md",
|
||||
"type": "documentation",
|
||||
"title": "AUTHOR",
|
||||
"description": "Documentation for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "CHANGELOG.md",
|
||||
"type": "documentation",
|
||||
"title": "CHANGELOG",
|
||||
"description": "Documentation for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "CONTRIBUTING.md",
|
||||
"type": "documentation",
|
||||
"title": "CONTRIBUTING",
|
||||
"description": "Documentation for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "docs/architecture.md",
|
||||
"type": "documentation",
|
||||
"title": "architecture",
|
||||
"description": "Documentation for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "docs/implementation.md",
|
||||
"type": "documentation",
|
||||
"title": "implementation",
|
||||
"description": "Documentation for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "docs/README.md",
|
||||
"type": "documentation",
|
||||
"title": "README",
|
||||
"description": "Documentation for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "examples/README.md",
|
||||
"type": "documentation",
|
||||
"title": "README",
|
||||
"description": "Documentation for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "examples/status-aliases.example.json",
|
||||
"type": "synthetic-example",
|
||||
"title": "status aliases.example",
|
||||
"description": "Synthetic-example for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "examples/status-overrides.example.json",
|
||||
"type": "synthetic-example",
|
||||
"title": "status overrides.example",
|
||||
"description": "Synthetic-example for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "examples/status.example.json",
|
||||
"type": "synthetic-example",
|
||||
"title": "status.example",
|
||||
"description": "Synthetic-example for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "LICENSE",
|
||||
"type": "metadata",
|
||||
"title": "LICENSE",
|
||||
"description": "Metadata for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "PUBLICATION_WORKFLOW.md",
|
||||
"type": "documentation",
|
||||
"title": "PUBLICATION WORKFLOW",
|
||||
"description": "Documentation for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "README.md",
|
||||
"type": "documentation",
|
||||
"title": "README",
|
||||
"description": "Documentation for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "repository-variables.json",
|
||||
"type": "configuration",
|
||||
"title": "repository variables",
|
||||
"description": "Configuration for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "scripts/aggregate_updates.py",
|
||||
"type": "script",
|
||||
"title": "aggregate updates",
|
||||
"description": "Script for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "scripts/audit_repository.py",
|
||||
"type": "script",
|
||||
"title": "audit repository",
|
||||
"description": "Script for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "scripts/build_automation_results.py",
|
||||
"type": "script",
|
||||
"title": "build automation results",
|
||||
"description": "Script for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "scripts/build_automations_calendar.py",
|
||||
"type": "script",
|
||||
"title": "build automations calendar",
|
||||
"description": "Script for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "scripts/check_publication.py",
|
||||
"type": "script",
|
||||
"title": "check publication",
|
||||
"description": "Script for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "scripts/collect_automation_statuses.ps1",
|
||||
"type": "script",
|
||||
"title": "collect automation statuses",
|
||||
"description": "Script for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "scripts/copy-workbook.ps1",
|
||||
"type": "script",
|
||||
"title": "copy workbook",
|
||||
"description": "Script for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "scripts/create_example_workbook.py",
|
||||
"type": "script",
|
||||
"title": "create example workbook",
|
||||
"description": "Script for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "scripts/README.md",
|
||||
"type": "documentation",
|
||||
"title": "README",
|
||||
"description": "Documentation for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "scripts/refresh_automations_calendar.ps1",
|
||||
"type": "script",
|
||||
"title": "refresh automations calendar",
|
||||
"description": "Script for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "scripts/workflow-run-status.ps1",
|
||||
"type": "script",
|
||||
"title": "workflow run status",
|
||||
"description": "Script for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "SECURITY.md",
|
||||
"type": "documentation",
|
||||
"title": "SECURITY",
|
||||
"description": "Documentation for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "templates/automations-calendar.template.html",
|
||||
"type": "template",
|
||||
"title": "automations calendar.template",
|
||||
"description": "Template for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "templates/automations-results.template.html",
|
||||
"type": "template",
|
||||
"title": "automations results.template",
|
||||
"description": "Template for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "templates/README.md",
|
||||
"type": "documentation",
|
||||
"title": "README",
|
||||
"description": "Documentation for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "tests/test-workflow-run-status.ps1",
|
||||
"type": "test",
|
||||
"title": "test workflow run status",
|
||||
"description": "Test for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "tests/test_dashboard.py",
|
||||
"type": "test",
|
||||
"title": "test dashboard",
|
||||
"description": "Test for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "UPDATES.md",
|
||||
"type": "documentation",
|
||||
"title": "UPDATES",
|
||||
"description": "Documentation for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "VERSION",
|
||||
"type": "metadata",
|
||||
"title": "VERSION",
|
||||
"description": "Metadata for the automation calendar."
|
||||
},
|
||||
{
|
||||
"path": "tasks/structure-ai-ready-repository/implementation-receipt.md",
|
||||
"type": "receipt",
|
||||
"title": "Sanitized preparation receipt",
|
||||
"description": "Sanitized preparation receipt for the approved public preparation."
|
||||
},
|
||||
{
|
||||
"path": "tasks/structure-ai-ready-repository/validation-results.md",
|
||||
"type": "receipt",
|
||||
"title": "Validation results",
|
||||
"description": "Validation results for the approved public preparation."
|
||||
}
|
||||
],
|
||||
"ai_retrieval": {
|
||||
"read_first": [
|
||||
"README.md",
|
||||
"AUTHOR.md",
|
||||
"repository-variables.json",
|
||||
"repository.json",
|
||||
"AGENTS.md"
|
||||
],
|
||||
"retrieve_as_needed": [
|
||||
"docs/",
|
||||
"scripts/",
|
||||
"templates/",
|
||||
"examples/"
|
||||
],
|
||||
"exclude_by_default": [
|
||||
"local/",
|
||||
"output/",
|
||||
"tasks/"
|
||||
],
|
||||
"instructions": "Read indexed entry points; UPDATES.md is unapproved future work. Use synthetic fixtures for validation."
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
# Scripts
|
||||
|
||||
Python requires 3.10+ and the standard library. PowerShell commands target PowerShell 7 on Windows. Run from the repository root. See [implementation](../docs/implementation.md) for parameters.
|
||||
|
||||
| Script | Purpose and writes |
|
||||
|---|---|
|
||||
| [create_example_workbook.py](create_example_workbook.py) | Creates synthetic local/workflows.xlsx; refuses overwrite |
|
||||
| [build_automations_calendar.py](build_automations_calendar.py) | Renders output/automations-calendar.html |
|
||||
| [build_automation_results.py](build_automation_results.py) | Renders output/automations-results.html |
|
||||
| [refresh_automations_calendar.ps1](refresh_automations_calendar.ps1) | Renders both dashboards; no collection |
|
||||
| [collect_automation_statuses.ps1](collect_automation_statuses.ps1) | Reads explicitly selected local sources and writes a registry |
|
||||
| [workflow-run-status.ps1](workflow-run-status.ps1) | Read-only receipt/log adapter sourced by collector |
|
||||
| [copy-workbook.ps1](copy-workbook.ps1) | Copies explicit workbook path without overwrite |
|
||||
| [aggregate_updates.py](aggregate_updates.py) | Aggregates explicitly selected local project notes into HTML |
|
||||
| [audit_repository.py](audit_repository.py) | Read-only structural audit adapted from MIT repository template |
|
||||
| [check_publication.py](check_publication.py) | Read-only metadata/link/privacy checks of public files |
|
||||
|
||||
Normal local demo and tests are reversible file operations. Live collection must be explicitly selected. Publication is separately authorized. No script sends messages or changes schedules.
|
||||
@@ -0,0 +1,160 @@
|
||||
#!/usr/bin/env python3
|
||||
r"""Aggregate UPDATES.md files below an explicitly selected directory into local HTML."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import html
|
||||
import os
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
DEFAULT_OUTPUT = Path(__file__).resolve().parent.parent / "output/updates-aggregate.html"
|
||||
IGNORED_DIRS = {".git", ".hg", ".svn", ".venv", "node_modules"}
|
||||
|
||||
|
||||
def find_update_files(folder: Path) -> list[Path]:
|
||||
"""Return the folder's UPDATES.md files in alphabetical path order."""
|
||||
matches: list[Path] = []
|
||||
for current_dir, dir_names, file_names in os.walk(folder):
|
||||
dir_names[:] = sorted(
|
||||
(name for name in dir_names if name not in IGNORED_DIRS),
|
||||
key=str.casefold,
|
||||
)
|
||||
if "UPDATES.md" in file_names:
|
||||
matches.append(Path(current_dir) / "UPDATES.md")
|
||||
return sorted(matches, key=lambda path: str(path).casefold())
|
||||
|
||||
|
||||
def build_html(projects_dir: Path) -> str:
|
||||
folders = sorted(
|
||||
(path for path in projects_dir.iterdir() if path.is_dir()),
|
||||
key=lambda path: path.name.casefold(),
|
||||
)
|
||||
|
||||
sections: list[str] = []
|
||||
nav_items: list[str] = []
|
||||
total_files = 0
|
||||
|
||||
for index, folder in enumerate(folders):
|
||||
update_files = find_update_files(folder)
|
||||
total_files += len(update_files)
|
||||
anchor = f"folder-{index}"
|
||||
background_class = " red-background" if index % 2 else ""
|
||||
nav_items.append(
|
||||
f'<li><a href="#{anchor}">{html.escape(folder.name)}</a>'
|
||||
f" ({len(update_files)})</li>"
|
||||
)
|
||||
|
||||
file_blocks: list[str] = []
|
||||
for update_file in update_files:
|
||||
relative_path = update_file.relative_to(projects_dir)
|
||||
content = update_file.read_text(encoding="utf-8-sig", errors="replace")
|
||||
file_blocks.append(
|
||||
'<article class="update-file">'
|
||||
f"<h2>{html.escape(str(relative_path))}</h2>"
|
||||
f"<pre>{html.escape(content)}</pre>"
|
||||
"</article>"
|
||||
)
|
||||
|
||||
if not file_blocks:
|
||||
file_blocks.append('<p class="empty">No UPDATES.md files found.</p>')
|
||||
|
||||
sections.append(
|
||||
f'<section id="{anchor}" class="project-folder{background_class}">'
|
||||
f"<h1>{html.escape(folder.name)}</h1>"
|
||||
+ "".join(file_blocks)
|
||||
+ "</section>"
|
||||
)
|
||||
|
||||
generated = datetime.now().astimezone().strftime("%Y-%m-%d %H:%M %Z")
|
||||
return f"""<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Project Updates</title>
|
||||
<style>
|
||||
:root {{
|
||||
color-scheme: dark;
|
||||
--dark: #444444;
|
||||
--steel: #587b91;
|
||||
--steel-deep: #456579;
|
||||
--white: #ffffff;
|
||||
--cream: #eeeecd;
|
||||
--jade: #52999a;
|
||||
--pink: #ff1a51;
|
||||
--line: #84a2b2;
|
||||
font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
|
||||
}}
|
||||
* {{ box-sizing: border-box; }}
|
||||
html {{ scroll-behavior: smooth; }}
|
||||
body {{ margin: 0; color: var(--white); background: var(--steel); font: 15px/1.5 var(--font, Inter, ui-sans-serif, system-ui, sans-serif); }}
|
||||
header, main {{ width: min(1400px, 90%); margin: 0 auto; }}
|
||||
header {{ padding: 20px 0 24px; border-bottom: 1px solid #ffffff55; }}
|
||||
header h1 {{ display: inline-block; margin: 0 0 18px; padding: 10px 14px; color: var(--white); background: var(--dark); border-left: 5px solid var(--pink); border-radius: 8px; box-shadow: 4px 4px 0 var(--pink); font-size: clamp(1.6rem, 3vw, 2.35rem); letter-spacing: .04em; }}
|
||||
header p {{ margin: .25rem 0; color: #e4edf0; }}
|
||||
nav {{ margin-top: 18px; }}
|
||||
nav ul {{ display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }}
|
||||
nav li {{ margin: 0; }}
|
||||
nav a {{ display: inline-block; padding: 7px 10px; color: #1649a5; background: var(--cream); border-radius: 9px; text-decoration: none; font-size: 13px; font-weight: 800; }}
|
||||
nav a:hover, nav a:focus {{ color: var(--white); background: var(--pink); }}
|
||||
.project-folder {{ margin: 14px 0; padding: 0; overflow: hidden; background: var(--dark); border: 1px solid #ffffff30; border-radius: 14px; box-shadow: 0 5px 18px #263e4c44; }}
|
||||
.project-folder.red-background {{ background: var(--dark); }}
|
||||
.project-folder > h1 {{ margin: 0; padding: 18px 20px; color: var(--white); border-left: 5px solid var(--jade); font-size: 1.35rem; letter-spacing: .04em; }}
|
||||
.project-folder.red-background > h1 {{ border-left-color: var(--pink); }}
|
||||
.update-file {{ margin: 0; padding: 16px 20px 20px; border-top: 1px solid #ffffff22; background: var(--steel-deep); }}
|
||||
.update-file h2 {{ margin: 0 0 12px; color: var(--cream); font-size: .85rem; font-weight: 800; overflow-wrap: anywhere; }}
|
||||
pre {{ margin: 0; padding: 14px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--dark); background: #f7fbfc; border-left: 3px solid var(--jade); border-radius: 8px; font: 13px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }}
|
||||
.red-background .update-file pre {{ border-left-color: var(--pink); }}
|
||||
.empty {{ margin: 0; padding: 18px 20px 20px; color: #e4edf0; font-style: italic; }}
|
||||
@media (max-width: 700px) {{
|
||||
header, main {{ width: 92%; }}
|
||||
header {{ padding-top: 14px; }}
|
||||
.project-folder > h1, .update-file {{ padding-left: 14px; padding-right: 14px; }}
|
||||
nav ul {{ gap: 6px; }}
|
||||
nav a {{ padding: 6px 8px; font-size: 12px; }}
|
||||
}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>Project Updates</h1>
|
||||
<p>{total_files} UPDATES.md files across {len(folders)} top-level folders.</p>
|
||||
<p>Generated {html.escape(generated)} from the configured projects directory.</p>
|
||||
<nav><ul>{"".join(nav_items)}</ul></nav>
|
||||
</header>
|
||||
<main>{"".join(sections)}</main>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument(
|
||||
"--projects-dir",
|
||||
type=Path,
|
||||
required=True,
|
||||
help="Explicit directory to scan; its contents will appear in the local output.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--output",
|
||||
type=Path,
|
||||
default=DEFAULT_OUTPUT,
|
||||
help=f"HTML output file (default: {DEFAULT_OUTPUT})",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
if not args.projects_dir.is_dir():
|
||||
parser.error(f"Projects directory does not exist: {args.projects_dir}")
|
||||
|
||||
output = args.output.resolve()
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(build_html(args.projects_dir.resolve()), encoding="utf-8")
|
||||
print(f"Wrote {output}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,370 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Read-only structural audit for an AI-ready repository."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
PROFILES = {
|
||||
"documentation-guide": {
|
||||
"README.md",
|
||||
"AUTHOR.md",
|
||||
"repository-variables.json",
|
||||
"repository.json",
|
||||
"LICENSE",
|
||||
"CHANGELOG.md",
|
||||
"UPDATES.md",
|
||||
"VERSION",
|
||||
"CITATION.cff",
|
||||
"docs",
|
||||
},
|
||||
"skill-workflow": {
|
||||
"README.md",
|
||||
"AUTHOR.md",
|
||||
"repository-variables.json",
|
||||
"repository.json",
|
||||
"LICENSE",
|
||||
"CHANGELOG.md",
|
||||
"UPDATES.md",
|
||||
"VERSION",
|
||||
"AGENTS.md",
|
||||
"skills.md",
|
||||
"skills",
|
||||
"templates",
|
||||
"examples",
|
||||
},
|
||||
"software-automation": {
|
||||
"README.md",
|
||||
"AUTHOR.md",
|
||||
"repository-variables.json",
|
||||
"repository.json",
|
||||
"LICENSE",
|
||||
"CHANGELOG.md",
|
||||
"UPDATES.md",
|
||||
"VERSION",
|
||||
"CONTRIBUTING.md",
|
||||
"SECURITY.md",
|
||||
"AGENTS.md",
|
||||
"docs",
|
||||
"scripts",
|
||||
"tests",
|
||||
},
|
||||
"dataset": {
|
||||
"README.md",
|
||||
"AUTHOR.md",
|
||||
"repository-variables.json",
|
||||
"repository.json",
|
||||
"LICENSE",
|
||||
"CHANGELOG.md",
|
||||
"UPDATES.md",
|
||||
"VERSION",
|
||||
"CITATION.cff",
|
||||
"data",
|
||||
"schemas",
|
||||
"docs",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("repository", type=Path, help="Repository root to inspect")
|
||||
parser.add_argument(
|
||||
"--profile",
|
||||
choices=sorted(PROFILES),
|
||||
required=True,
|
||||
help="Approved repository profile",
|
||||
)
|
||||
parser.add_argument("--json", action="store_true", help="Emit JSON")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def read_version_from_citation(path: Path) -> str | None:
|
||||
if not path.is_file():
|
||||
return None
|
||||
match = re.search(
|
||||
r"(?m)^version:\s*[\"']?([^\"'\s#]+)",
|
||||
path.read_text(encoding="utf-8-sig"),
|
||||
)
|
||||
return match.group(1) if match else None
|
||||
|
||||
|
||||
def audit_content_index(root: Path, findings: list[dict[str, str]]) -> None:
|
||||
path = root / "content-index.json"
|
||||
if not path.is_file():
|
||||
return
|
||||
try:
|
||||
index = json.loads(path.read_text(encoding="utf-8-sig"))
|
||||
except (OSError, UnicodeError, json.JSONDecodeError) as exc:
|
||||
findings.append({"level": "error", "message": f"content-index.json is invalid: {exc}"})
|
||||
return
|
||||
|
||||
items = index.get("items")
|
||||
if not isinstance(items, list):
|
||||
findings.append(
|
||||
{"level": "error", "message": "content-index.json items must be an array"}
|
||||
)
|
||||
return
|
||||
|
||||
content_ids: set[str] = set()
|
||||
paths: set[str] = set()
|
||||
for position, item in enumerate(items):
|
||||
if not isinstance(item, dict):
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": f"content-index.json item {position + 1} must be an object",
|
||||
}
|
||||
)
|
||||
continue
|
||||
content_id = item.get("content_id")
|
||||
declared = item.get("path")
|
||||
if not content_id:
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": f"content-index.json item {position + 1} lacks content_id",
|
||||
}
|
||||
)
|
||||
elif content_id in content_ids:
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": f"Duplicate content_id in content-index.json: {content_id}",
|
||||
}
|
||||
)
|
||||
else:
|
||||
content_ids.add(content_id)
|
||||
if not declared:
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": f"content-index.json item {position + 1} lacks path",
|
||||
}
|
||||
)
|
||||
elif declared in paths:
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": f"Duplicate path in content-index.json: {declared}",
|
||||
}
|
||||
)
|
||||
else:
|
||||
paths.add(declared)
|
||||
declared_path = Path(declared)
|
||||
if (
|
||||
declared_path.is_absolute()
|
||||
or ".." in declared_path.parts
|
||||
or not (root / declared_path).is_file()
|
||||
):
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": f"Indexed content path does not exist or is unsafe: {declared}",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def audit(root: Path, profile: str) -> dict:
|
||||
findings: list[dict[str, str]] = []
|
||||
if not root.is_dir():
|
||||
return {
|
||||
"repository": str(root),
|
||||
"profile": profile,
|
||||
"passed": False,
|
||||
"findings": [{"level": "error", "message": "Repository path is not a directory"}],
|
||||
}
|
||||
|
||||
for relative in sorted(PROFILES[profile]):
|
||||
if not (root / relative).exists():
|
||||
findings.append({"level": "error", "message": f"Missing required path: {relative}"})
|
||||
|
||||
manifest_path = root / "repository.json"
|
||||
manifest = None
|
||||
if manifest_path.is_file():
|
||||
try:
|
||||
manifest = json.loads(manifest_path.read_text(encoding="utf-8-sig"))
|
||||
except (OSError, UnicodeError, json.JSONDecodeError) as exc:
|
||||
findings.append({"level": "error", "message": f"repository.json is invalid: {exc}"})
|
||||
else:
|
||||
for key in ("schema_version", "repository_id", "title", "description", "version", "entrypoints"):
|
||||
if key not in manifest:
|
||||
findings.append({"level": "error", "message": f"repository.json lacks key: {key}"})
|
||||
entrypoints = manifest.get("entrypoints", {})
|
||||
if isinstance(entrypoints, dict):
|
||||
for audience in ("human", "ai"):
|
||||
declared = entrypoints.get(audience)
|
||||
if not declared:
|
||||
findings.append(
|
||||
{"level": "error", "message": f"Missing {audience} entrypoint declaration"}
|
||||
)
|
||||
elif not (root / declared).exists():
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": f"Declared {audience} entrypoint does not exist: {declared}",
|
||||
}
|
||||
)
|
||||
else:
|
||||
findings.append({"level": "error", "message": "entrypoints must be an object"})
|
||||
|
||||
variables_path = root / "repository-variables.json"
|
||||
variables = None
|
||||
if variables_path.is_file():
|
||||
try:
|
||||
variables = json.loads(variables_path.read_text(encoding="utf-8-sig"))
|
||||
except (OSError, UnicodeError, json.JSONDecodeError) as exc:
|
||||
findings.append(
|
||||
{"level": "error", "message": f"repository-variables.json is invalid: {exc}"}
|
||||
)
|
||||
else:
|
||||
for key in (
|
||||
"schema_version",
|
||||
"repository_profile",
|
||||
"identity",
|
||||
"repository",
|
||||
"rights",
|
||||
"skill_defaults",
|
||||
"verified_by",
|
||||
"verified_at",
|
||||
):
|
||||
if key not in variables:
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": f"repository-variables.json lacks key: {key}",
|
||||
}
|
||||
)
|
||||
|
||||
if manifest and variables:
|
||||
identity = variables.get("identity", {})
|
||||
variable_authors = [
|
||||
item.get("name")
|
||||
for item in identity.get("authors", [])
|
||||
if isinstance(item, dict)
|
||||
]
|
||||
manifest_authors = [
|
||||
item.get("name")
|
||||
for item in manifest.get("authors", [])
|
||||
if isinstance(item, dict)
|
||||
]
|
||||
comparisons = (
|
||||
("authors", variable_authors, manifest_authors),
|
||||
(
|
||||
"publisher",
|
||||
identity.get("publisher", {}).get("name"),
|
||||
manifest.get("publisher", {}).get("name"),
|
||||
),
|
||||
(
|
||||
"maintainer",
|
||||
identity.get("maintainer", {}).get("name"),
|
||||
manifest.get("maintenance", {}).get("maintainer"),
|
||||
),
|
||||
(
|
||||
"repository",
|
||||
variables.get("repository"),
|
||||
{
|
||||
key: manifest.get(key)
|
||||
for key in (
|
||||
"repository_id",
|
||||
"name",
|
||||
"title",
|
||||
"canonical_url",
|
||||
"organization",
|
||||
)
|
||||
},
|
||||
),
|
||||
(
|
||||
"rights",
|
||||
variables.get("rights"),
|
||||
{
|
||||
key: manifest.get("rights", {}).get(key)
|
||||
for key in ("license", "license_file")
|
||||
},
|
||||
),
|
||||
)
|
||||
for label, variable_value, manifest_value in comparisons:
|
||||
if variable_value != manifest_value:
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": (
|
||||
f"{label} differs between repository-variables.json "
|
||||
"and repository.json"
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
if variables and variables.get("repository_profile") != profile:
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": (
|
||||
"repository_profile differs between repository-variables.json "
|
||||
f"({variables.get('repository_profile')}) and requested audit ({profile})"
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
audit_content_index(root, findings)
|
||||
|
||||
version_path = root / "VERSION"
|
||||
version = version_path.read_text(encoding="utf-8-sig").strip() if version_path.is_file() else None
|
||||
if version and manifest and manifest.get("version") != version:
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": f"VERSION ({version}) differs from repository.json ({manifest.get('version')})",
|
||||
}
|
||||
)
|
||||
|
||||
citation_version = read_version_from_citation(root / "CITATION.cff")
|
||||
if version and citation_version and citation_version != version:
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": f"VERSION ({version}) differs from CITATION.cff ({citation_version})",
|
||||
}
|
||||
)
|
||||
|
||||
readme = root / "README.md"
|
||||
if readme.is_file() and not readme.read_text(encoding="utf-8-sig").strip():
|
||||
findings.append({"level": "error", "message": "README.md is empty"})
|
||||
|
||||
return {
|
||||
"repository": str(root.resolve()),
|
||||
"profile": profile,
|
||||
"passed": not any(item["level"] == "error" for item in findings),
|
||||
"findings": findings,
|
||||
}
|
||||
|
||||
|
||||
def emit_markdown(result: dict) -> None:
|
||||
print(f"# Repository Audit\n\n- Repository: `{result['repository']}`")
|
||||
print(f"- Profile: `{result['profile']}`")
|
||||
print(f"- Result: `{'PASS' if result['passed'] else 'FAIL'}`")
|
||||
print("\n## Findings")
|
||||
if not result["findings"]:
|
||||
print("\n- No structural errors found.")
|
||||
else:
|
||||
for finding in result["findings"]:
|
||||
print(f"\n- {finding['level'].upper()}: {finding['message']}")
|
||||
|
||||
|
||||
def main() -> int:
|
||||
args = parse_args()
|
||||
result = audit(args.repository, args.profile)
|
||||
if args.json:
|
||||
print(json.dumps(result, indent=2))
|
||||
else:
|
||||
emit_markdown(result)
|
||||
return 0 if result["passed"] else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,146 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build a reusable automation-results dashboard from the canonical status registry."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import copy
|
||||
import json
|
||||
import shutil
|
||||
import tempfile
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
from build_automations_calendar import WORKSHEET_NAME, attach_statuses, normalize, read_statuses, read_workflow_rows
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
DEFAULT_WORKBOOK = ROOT / "local/workflows.xlsx"
|
||||
DEFAULT_STATUS = ROOT / "examples/status.example.json"
|
||||
DEFAULT_OUTPUT = ROOT / "output/automations-results.html"
|
||||
DEFAULT_TEMPLATE = ROOT / "templates/automations-results.template.html"
|
||||
|
||||
|
||||
def load_raw_status(path: Path) -> tuple[dict, list[dict]]:
|
||||
if not path.is_file():
|
||||
return {}, []
|
||||
payload = json.loads(path.read_text(encoding="utf-8-sig"))
|
||||
records = payload.get("records", []) if isinstance(payload, dict) else payload
|
||||
return payload if isinstance(payload, dict) else {}, [item for item in records if isinstance(item, dict)]
|
||||
|
||||
|
||||
def build_view(automations: list[dict], evidence: list[dict]) -> tuple[list[dict], list[dict]]:
|
||||
managed_keys = set()
|
||||
managed = []
|
||||
for automation in automations:
|
||||
managed_keys.add(normalize(automation["name"]))
|
||||
managed.append({
|
||||
"id": automation["id"],
|
||||
"name": automation["name"],
|
||||
"machine": automation["machine"],
|
||||
"project": automation["project"],
|
||||
"opsSegment": automation["opsSegment"],
|
||||
"location": automation["location"],
|
||||
"automationStatus": automation["status"],
|
||||
"run": automation["run"],
|
||||
"scope": "managed",
|
||||
})
|
||||
|
||||
collected = []
|
||||
for index, record in enumerate(evidence, start=1):
|
||||
names = [record.get("name", ""), *(record.get("aliases") or [])]
|
||||
linked = any(normalize(str(name)) in managed_keys for name in names if name)
|
||||
outcome = str(record.get("outcome", "unknown")).casefold()
|
||||
if outcome not in {"success", "failure", "unknown"}:
|
||||
outcome = "unknown"
|
||||
collected.append({
|
||||
"id": f"evidence-{index}",
|
||||
"name": str(record.get("name") or "Unnamed result"),
|
||||
"aliases": record.get("aliases") or [],
|
||||
"outcome": outcome,
|
||||
"lastRun": record.get("lastRun") or record.get("last_run"),
|
||||
"detail": record.get("detail") or record.get("message") or "",
|
||||
"source": record.get("source") or "unknown",
|
||||
"linked": linked,
|
||||
"scope": "evidence",
|
||||
})
|
||||
|
||||
return managed, collected
|
||||
|
||||
|
||||
def build_payload(workbook_path: Path, status_path: Path) -> dict:
|
||||
base_automations, used_range = read_workflow_rows(workbook_path)
|
||||
status_meta, evidence = load_raw_status(status_path)
|
||||
current_automations = copy.deepcopy(base_automations)
|
||||
attach_statuses(current_automations, read_statuses(status_path))
|
||||
managed, collected = build_view(current_automations, evidence)
|
||||
|
||||
days = []
|
||||
for snapshot in status_meta.get("history", []) if isinstance(status_meta, dict) else []:
|
||||
if not isinstance(snapshot, dict) or not snapshot.get("date"):
|
||||
continue
|
||||
snapshot_automations = copy.deepcopy(base_automations)
|
||||
snapshot_records = [item for item in snapshot.get("records", []) if isinstance(item, dict)]
|
||||
snapshot_statuses = {}
|
||||
for record in snapshot_records:
|
||||
names = [record.get("name", ""), *(record.get("aliases") or [])]
|
||||
for name in names:
|
||||
if name:
|
||||
snapshot_statuses[normalize(str(name))] = record
|
||||
attach_statuses(snapshot_automations, snapshot_statuses)
|
||||
snapshot_managed, snapshot_collected = build_view(snapshot_automations, snapshot_records)
|
||||
days.append({
|
||||
"date": str(snapshot["date"]),
|
||||
"generatedAt": snapshot.get("generatedAt"),
|
||||
"managed": snapshot_managed,
|
||||
"evidence": snapshot_collected,
|
||||
})
|
||||
|
||||
if not days:
|
||||
days = [{"date": datetime.now().astimezone().date().isoformat(), "generatedAt": status_meta.get("generatedAt"), "managed": managed, "evidence": collected}]
|
||||
days.sort(key=lambda item: item["date"], reverse=True)
|
||||
days = days[:3]
|
||||
|
||||
return {
|
||||
"generatedAt": datetime.now(timezone.utc).isoformat(),
|
||||
"registryGeneratedAt": status_meta.get("generatedAt"),
|
||||
"registryNote": status_meta.get("note", ""),
|
||||
"workbook": "configured workbook",
|
||||
"workbookRange": f"{WORKSHEET_NAME}!{used_range}",
|
||||
"statusRegistry": "configured status registry",
|
||||
"managed": managed,
|
||||
"evidence": collected,
|
||||
"days": days,
|
||||
}
|
||||
|
||||
|
||||
def write_dashboard(template_path: Path, output_path: Path, payload: dict) -> None:
|
||||
template = template_path.read_text(encoding="utf-8")
|
||||
if "__AUTOMATION_RESULTS_DATA__" not in template:
|
||||
raise ValueError("Results template is missing __AUTOMATION_RESULTS_DATA__")
|
||||
data = json.dumps(payload, ensure_ascii=False, separators=(",", ":")).replace("</", "<\\/")
|
||||
html = template.replace("__AUTOMATION_RESULTS_DATA__", data, 1)
|
||||
output_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
with tempfile.NamedTemporaryFile("w", encoding="utf-8", delete=False, dir=output_path.parent, suffix=".tmp") as handle:
|
||||
handle.write(html)
|
||||
temp_path = Path(handle.name)
|
||||
shutil.move(temp_path, output_path)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--workbook", type=Path, default=DEFAULT_WORKBOOK)
|
||||
parser.add_argument("--status", type=Path, default=DEFAULT_STATUS)
|
||||
parser.add_argument("--output", type=Path, default=DEFAULT_OUTPUT)
|
||||
parser.add_argument("--template", type=Path, default=DEFAULT_TEMPLATE)
|
||||
args = parser.parse_args()
|
||||
for label, path in (("Workbook", args.workbook), ("Status registry", args.status), ("Template", args.template)):
|
||||
if not path.is_file():
|
||||
parser.error(f"{label} not found: {path}")
|
||||
payload = build_payload(args.workbook, args.status)
|
||||
write_dashboard(args.template, args.output, payload)
|
||||
print(f"Updated {args.output.resolve()} with {len(payload['managed'])} managed automations and {len(payload['evidence'])} evidence records")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,237 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Refresh automations-calendar.html from scheduled entries in the workflows tab."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import html
|
||||
import json
|
||||
import re
|
||||
import shutil
|
||||
import tempfile
|
||||
import xml.etree.ElementTree as ET
|
||||
import zipfile
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
DEFAULT_WORKBOOK = ROOT / "local/workflows.xlsx"
|
||||
DEFAULT_HTML = ROOT / "output/automations-calendar.html"
|
||||
DEFAULT_STATUS = ROOT / "examples/status.example.json"
|
||||
DEFAULT_TEMPLATE = ROOT / "templates/automations-calendar.template.html"
|
||||
DAYS = ("Mon", "Tues", "Wed", "Thu", "Fri", "Sat", "Sun")
|
||||
NS = {"m": "http://schemas.openxmlformats.org/spreadsheetml/2006/main"}
|
||||
REL_NS = {"r": "http://schemas.openxmlformats.org/package/2006/relationships"}
|
||||
DOC_REL = "{http://schemas.openxmlformats.org/officeDocument/2006/relationships}id"
|
||||
|
||||
|
||||
def normalize(value: str) -> str:
|
||||
return re.sub(r"[^a-z0-9]+", "", value.casefold())
|
||||
|
||||
|
||||
def column_index(reference: str) -> int:
|
||||
letters = re.match(r"[A-Z]+", reference.upper()).group(0)
|
||||
result = 0
|
||||
for letter in letters:
|
||||
result = result * 26 + ord(letter) - 64
|
||||
return result - 1
|
||||
|
||||
|
||||
def column_letters(index: int) -> str:
|
||||
result = ""
|
||||
number = index + 1
|
||||
while number:
|
||||
number, remainder = divmod(number - 1, 26)
|
||||
result = chr(65 + remainder) + result
|
||||
return result
|
||||
|
||||
|
||||
def shared_strings(archive: zipfile.ZipFile) -> list[str]:
|
||||
try:
|
||||
root = ET.fromstring(archive.read("xl/sharedStrings.xml"))
|
||||
except KeyError:
|
||||
return []
|
||||
return ["".join(node.text or "" for node in item.findall(".//m:t", NS)) for item in root.findall("m:si", NS)]
|
||||
|
||||
|
||||
def sheet_path(archive: zipfile.ZipFile, sheet_name: str) -> str:
|
||||
workbook = ET.fromstring(archive.read("xl/workbook.xml"))
|
||||
relation_id = None
|
||||
for sheet in workbook.findall(".//m:sheet", NS):
|
||||
if sheet.attrib.get("name", "").casefold() == sheet_name.casefold():
|
||||
relation_id = sheet.attrib[DOC_REL]
|
||||
break
|
||||
if not relation_id:
|
||||
raise ValueError(f"Worksheet not found: {sheet_name}")
|
||||
rels = ET.fromstring(archive.read("xl/_rels/workbook.xml.rels"))
|
||||
target = next(rel.attrib["Target"] for rel in rels.findall("r:Relationship", REL_NS) if rel.attrib["Id"] == relation_id)
|
||||
target = target.lstrip("/")
|
||||
return target if target.startswith("xl/") else f"xl/{target}"
|
||||
|
||||
|
||||
def cell_value(cell: ET.Element, strings: list[str]):
|
||||
cell_type = cell.attrib.get("t")
|
||||
if cell_type == "inlineStr":
|
||||
return "".join(node.text or "" for node in cell.findall(".//m:t", NS))
|
||||
value_node = cell.find("m:v", NS)
|
||||
if value_node is None or value_node.text is None:
|
||||
return None
|
||||
raw = value_node.text
|
||||
if cell_type == "s":
|
||||
return strings[int(raw)]
|
||||
if cell_type in {"str", "e"}:
|
||||
return raw
|
||||
if cell_type == "b":
|
||||
return raw == "1"
|
||||
try:
|
||||
number = float(raw)
|
||||
return int(number) if number.is_integer() else number
|
||||
except ValueError:
|
||||
return raw
|
||||
|
||||
|
||||
WORKSHEET_NAME = "workflows"
|
||||
|
||||
|
||||
def read_workflow_rows(workbook_path: Path) -> tuple[list[dict], str]:
|
||||
with zipfile.ZipFile(workbook_path) as archive:
|
||||
strings = shared_strings(archive)
|
||||
root = ET.fromstring(archive.read(sheet_path(archive, WORKSHEET_NAME)))
|
||||
matrix: list[list] = []
|
||||
for row in root.findall(".//m:sheetData/m:row", NS):
|
||||
values: list = []
|
||||
for cell in row.findall("m:c", NS):
|
||||
index = column_index(cell.attrib["r"])
|
||||
while len(values) <= index:
|
||||
values.append(None)
|
||||
values[index] = cell_value(cell, strings)
|
||||
matrix.append(values)
|
||||
|
||||
if not matrix:
|
||||
return [], "A1:A1"
|
||||
headers = [str(value or "").strip() for value in matrix[0]]
|
||||
header_map = {name.casefold(): index for index, name in enumerate(headers) if name}
|
||||
if not header_map:
|
||||
raise ValueError("workflows worksheet has no column headers")
|
||||
last_header_column = max(header_map.values())
|
||||
last_data_row = max(
|
||||
(row_number for row_number, row in enumerate(matrix, start=1) if any(value not in (None, "") for value in row[: last_header_column + 1])),
|
||||
default=1,
|
||||
)
|
||||
used_range = f"A1:{column_letters(last_header_column)}{last_data_row}"
|
||||
required = ["name", "machine", "project", "ops segment", "mon", "tues", "wed", "thu", "fri", "sat", "sun", "other", "notes"]
|
||||
missing = [name for name in required if name not in header_map]
|
||||
if missing:
|
||||
raise ValueError(f"{WORKSHEET_NAME} tab is missing required columns: {', '.join(missing)}")
|
||||
|
||||
records = []
|
||||
for source_row, row in enumerate(matrix[1:], start=2):
|
||||
def get(*names: str):
|
||||
for name in names:
|
||||
index = header_map.get(name)
|
||||
if index is not None:
|
||||
return row[index] if index < len(row) else None
|
||||
return None
|
||||
|
||||
name = str(get("name") or "").strip()
|
||||
if not name or name.casefold().startswith("do not edit"):
|
||||
continue
|
||||
schedule = {}
|
||||
for day in DAYS:
|
||||
raw = get(day.casefold())
|
||||
minutes = None
|
||||
cadence = ""
|
||||
if isinstance(raw, (int, float)):
|
||||
minutes = round((float(raw) % 1) * 24 * 60) % 1440
|
||||
elif raw is not None and str(raw).strip():
|
||||
cadence = str(raw).strip()
|
||||
schedule[day] = {"raw": raw, "minutes": minutes, "cadence": cadence}
|
||||
if not any(slot["raw"] not in (None, "") for slot in schedule.values()):
|
||||
continue
|
||||
records.append({
|
||||
"id": source_row,
|
||||
"name": name,
|
||||
"machine": str(get("machine") or "Unspecified").strip(),
|
||||
"project": str(get("project") or "Unspecified").strip(),
|
||||
"location": str(get("operator", "location") or "Unspecified").strip(),
|
||||
"opsSegment": str(get("ops segment") or "Unsorted").strip(),
|
||||
"status": str(get("operational", "status") or "Active").strip(),
|
||||
"other": str(get("other") or "").strip(),
|
||||
"notes": str(get("notes") or "").strip(),
|
||||
"schedule": schedule,
|
||||
})
|
||||
records.sort(key=lambda item: (item["opsSegment"].casefold(), item["project"].casefold(), item["name"].casefold()))
|
||||
return records, used_range
|
||||
|
||||
|
||||
def read_statuses(path: Path) -> dict[str, dict]:
|
||||
if not path.exists():
|
||||
return {}
|
||||
payload = json.loads(path.read_text(encoding="utf-8-sig"))
|
||||
records = payload.get("records", payload) if isinstance(payload, dict) else payload
|
||||
result = {}
|
||||
if isinstance(records, dict):
|
||||
records = [{"name": name, **value} for name, value in records.items()]
|
||||
for record in records or []:
|
||||
if isinstance(record, dict) and record.get("name"):
|
||||
names = [record["name"], *(record.get("aliases") or [])]
|
||||
for name in names:
|
||||
result[normalize(str(name))] = record
|
||||
return result
|
||||
|
||||
|
||||
def attach_statuses(records: list[dict], statuses: dict[str, dict]) -> None:
|
||||
for item in records:
|
||||
found = statuses.get(normalize(item["name"]))
|
||||
if found:
|
||||
outcome = str(found.get("outcome", "unknown")).casefold()
|
||||
if outcome not in {"success", "failure", "unknown"}:
|
||||
outcome = "unknown"
|
||||
item["run"] = {
|
||||
"outcome": outcome,
|
||||
"lastRun": found.get("lastRun") or found.get("last_run"),
|
||||
"detail": found.get("detail") or found.get("message") or "",
|
||||
"source": found.get("source") or "status registry",
|
||||
}
|
||||
else:
|
||||
item["run"] = {"outcome": "unknown", "lastRun": None, "detail": "No verifiable run result was collected.", "source": "none"}
|
||||
|
||||
|
||||
def update_html(html_path: Path, records: list[dict], used_range: str, workbook_path: Path, template_path: Path = DEFAULT_TEMPLATE) -> None:
|
||||
html_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
document = template_path.read_text(encoding="utf-8")
|
||||
payload = json.dumps(records, ensure_ascii=False, separators=(",", ":")).replace("</", "<\\/")
|
||||
document, replacements = re.subn(r" const automations = .*?;\r?\n const days =", lambda _: f" const automations = {payload};\n const days =", document, count=1, flags=re.S)
|
||||
if replacements != 1:
|
||||
raise ValueError("Could not locate the embedded automations data block in the HTML template")
|
||||
generated = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M UTC")
|
||||
source_line = f"Source: configured workbook · {WORKSHEET_NAME}!{used_range} · Generated {generated}"
|
||||
document, replacements = re.subn(r"Source: .*? · (?:cron|workflows)![^<]+", lambda _: html.escape(source_line), document, count=1)
|
||||
if replacements != 1:
|
||||
raise ValueError("Could not update the HTML source stamp")
|
||||
with tempfile.NamedTemporaryFile("w", encoding="utf-8", delete=False, dir=html_path.parent, suffix=".tmp") as handle:
|
||||
handle.write(document)
|
||||
temp_path = Path(handle.name)
|
||||
shutil.move(temp_path, html_path)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--workbook", type=Path, default=DEFAULT_WORKBOOK)
|
||||
parser.add_argument("--html", type=Path, default=DEFAULT_HTML)
|
||||
parser.add_argument("--template", type=Path, default=DEFAULT_TEMPLATE)
|
||||
parser.add_argument("--status", type=Path, default=DEFAULT_STATUS)
|
||||
args = parser.parse_args()
|
||||
if not args.workbook.is_file():
|
||||
parser.error(f"Workbook not found: {args.workbook}")
|
||||
if not args.template.is_file():
|
||||
parser.error(f"HTML template not found: {args.template}")
|
||||
records, used_range = read_workflow_rows(args.workbook)
|
||||
attach_statuses(records, read_statuses(args.status))
|
||||
update_html(args.html, records, used_range, args.workbook.resolve(), args.template)
|
||||
print(f"Updated {args.html.resolve()} with {len(records)} automations from {WORKSHEET_NAME}!{used_range}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,87 @@
|
||||
"""Read-only checks for metadata consistency, local links and common publication leaks.
|
||||
|
||||
This is a heuristic guardrail, not proof of anonymity or absence of secrets.
|
||||
Ignored runtime data is excluded; independently inspect outputs before sharing.
|
||||
"""
|
||||
import ast
|
||||
import json
|
||||
import re
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from urllib.parse import urlparse, unquote
|
||||
|
||||
ROOT=Path(__file__).resolve().parent.parent
|
||||
EXCLUDE={'.git','local','output','logs','__pycache__','.venv'}
|
||||
BANNED={'.xlsx','.csv','.jsonl','.sql','.log','.pyc','.pem','.key','.pfx','.zip','.bak'}
|
||||
|
||||
def sensitive_findings(text, canonical_host):
|
||||
findings=[]
|
||||
checks={
|
||||
'absolute Windows path':r'\b[A-Za-z]:[\\/]',
|
||||
'absolute private Unix path':r'/(?:home|mnt|srv|opt)/[\w.-]+',
|
||||
'private key material':r'-----BEGIN (?:RSA |OPENSSH |EC )?PRIVATE KEY-----',
|
||||
'literal credential assignment':r"""(?i)\b(?:password|passwd|api[_-]?key|access[_-]?token|secret)\s*[=:]\s*["'][A-Za-z0-9_+/=-]{12,}["']""",
|
||||
}
|
||||
for label,pattern in checks.items():
|
||||
if re.search(pattern,text): findings.append(label)
|
||||
for email in re.findall(r'[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}',text):
|
||||
if email.rsplit('@',1)[1] not in {'example.com','example.org','example.net'}:
|
||||
findings.append('non-example email')
|
||||
for address in re.findall(r'(?<![\w.])(?:\d{1,3}\.){3}\d{1,3}(?![\w.])',text):
|
||||
if all(int(x)<256 for x in address.split('.')): findings.append('IPv4 address')
|
||||
for url in re.findall(r'https?://[^\s<>"\x27)]+',text):
|
||||
host=urlparse(url).hostname
|
||||
if host not in {canonical_host,'schemas.openxmlformats.org','example.com','example.org','example.net'}:
|
||||
findings.append(f'URL host requires review: {host}')
|
||||
return sorted(set(findings))
|
||||
|
||||
def main():
|
||||
errors=[]
|
||||
manifest=json.loads((ROOT/'repository.json').read_text())
|
||||
variables=json.loads((ROOT/'repository-variables.json').read_text())
|
||||
host=urlparse(manifest['canonical_url']).hostname
|
||||
version=(ROOT/'VERSION').read_text().strip()
|
||||
if manifest['version']!=version: errors.append('manifest version mismatch')
|
||||
for name in ['README.md','CHANGELOG.md','UPDATES.md']:
|
||||
if version not in (ROOT/name).read_text(encoding='utf-8'): errors.append(f'{name}: version missing')
|
||||
if manifest['authors']!=variables['identity']['authors']: errors.append('authors mismatch')
|
||||
if manifest['rights']!=variables['rights']: errors.append('rights mismatch')
|
||||
if manifest['canonical_url']!=variables['repository']['canonical_url']: errors.append('canonical URL mismatch')
|
||||
for name in ['AUTHOR.md','LICENSE']:
|
||||
for author in manifest['authors']:
|
||||
if author['name'] not in (ROOT/name).read_text(encoding='utf-8'): errors.append(f'{name}: author missing')
|
||||
if 'MIT License' not in (ROOT/'LICENSE').read_text(): errors.append('license mismatch')
|
||||
declared=list(manifest['entrypoints'].values())+[x['path'] for x in manifest['contents']]
|
||||
declared+=manifest['ai_retrieval']['read_first']+manifest['ai_retrieval']['retrieve_as_needed']
|
||||
for name in declared:
|
||||
p=Path(name)
|
||||
if p.is_absolute() or '..' in p.parts or not (ROOT/p).exists(): errors.append(f'invalid declared path: {name}')
|
||||
files=[]
|
||||
for p in sorted(ROOT.rglob('*')):
|
||||
if not p.is_file() or any(x in EXCLUDE for x in p.relative_to(ROOT).parts): continue
|
||||
name=p.relative_to(ROOT).as_posix()
|
||||
files.append(name)
|
||||
if p.suffix.lower() in BANNED or p.name=='.env': errors.append(f'prohibited artifact: {name}')
|
||||
try: text=p.read_text(encoding='utf-8-sig')
|
||||
except UnicodeError:
|
||||
errors.append(f'non-text file requires review: {name}')
|
||||
continue
|
||||
for finding in sensitive_findings(text,host): errors.append(f'{name}: {finding}')
|
||||
if p.suffix=='.json': json.loads(text)
|
||||
if p.suffix=='.py': ast.parse(text,filename=name)
|
||||
if p.suffix=='.md':
|
||||
for link in re.findall(r'\[[^\]]*\]\(([^)]+)\)',text):
|
||||
link=link.split('#',1)[0]
|
||||
if not link or '://' in link or link.startswith('mailto:'): continue
|
||||
target=(p.parent/unquote(link)).resolve()
|
||||
if not target.is_relative_to(ROOT.resolve()) or not target.exists(): errors.append(f'{name}: invalid link {link}')
|
||||
# .gitignore does not protect files that were already tracked.
|
||||
result=subprocess.run(['git','-c',f'safe.directory={ROOT.as_posix()}','-C',str(ROOT),'ls-files','-z'],capture_output=True,text=True)
|
||||
if result.returncode: errors.append('git tracked-file scan failed')
|
||||
for name in filter(None,result.stdout.split('\0')):
|
||||
p=Path(name)
|
||||
if any(x in EXCLUDE for x in p.parts) or p.suffix.lower() in BANNED or p.name=='.env': errors.append(f'prohibited tracked file: {name}')
|
||||
print(json.dumps({'passed':not errors,'files_checked':len(files),'errors':errors},indent=2))
|
||||
return bool(errors)
|
||||
|
||||
if __name__=='__main__': raise SystemExit(main())
|
||||
@@ -0,0 +1,178 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string]$OutputPath = (Join-Path $PSScriptRoot '../output/status.json'),
|
||||
[string]$OverridesPath,
|
||||
[string]$AliasesPath,
|
||||
[string]$CodexAutomationsPath,
|
||||
[switch]$IncludeScheduledTasks,
|
||||
[string]$WorkflowRepository,
|
||||
[string]$WorkflowId,
|
||||
[string]$SchedulerLogRoot
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
. (Join-Path $PSScriptRoot 'workflow-run-status.ps1')
|
||||
$records = [System.Collections.Generic.List[object]]::new()
|
||||
$aliasesByTarget = @{}
|
||||
if ($AliasesPath -and (Test-Path -LiteralPath $AliasesPath)) {
|
||||
$aliasPayload = Get-Content -LiteralPath $AliasesPath -Raw | ConvertFrom-Json
|
||||
foreach ($mapping in @($aliasPayload.mappings)) {
|
||||
$target = [string]$mapping.target
|
||||
if (-not [string]::IsNullOrWhiteSpace($target)) {
|
||||
$aliasesByTarget[$target.ToLowerInvariant()] = @($mapping.aliases)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Get-CalendarRefreshResult {
|
||||
param([string]$Text)
|
||||
# Only the latest run and statements about this refresh are evidence.
|
||||
# Counts of failed managed jobs describe other automations, not this job.
|
||||
$headers = [regex]::Matches($Text, '(?m)^- Run time:\s*([^\r\n]+)')
|
||||
if (-not $headers.Count) { return [pscustomobject]@{ outcome = 'unknown'; lastRun = $null } }
|
||||
$header = $headers[$headers.Count - 1]
|
||||
$section = $Text.Substring($header.Index + $header.Length)
|
||||
$outcome = 'unknown'
|
||||
foreach ($line in ($section -split '\r?\n')) {
|
||||
if ($line -notmatch 'refresh_automations_calendar\.ps1|requested refresh|refresh (?:failed|succeeded|completed)|script exited') { continue }
|
||||
if ($line -match '(?i)\b(failed|blocked|rejected|denied|fatal)\b|exited with code [1-9]') { $outcome = 'failure' }
|
||||
elseif ($line -match '(?i)\b(successfully|succeeded)\b|completed successfully') { $outcome = 'success' }
|
||||
}
|
||||
$timestamp = $null
|
||||
$parsed = [DateTimeOffset]::MinValue
|
||||
if ([DateTimeOffset]::TryParse($header.Groups[1].Value.Trim(), [ref]$parsed)) { $timestamp = $parsed.ToString('o') }
|
||||
return [pscustomobject]@{ outcome = $outcome; lastRun = $timestamp }
|
||||
}
|
||||
|
||||
function Get-ConfiguredAliases {
|
||||
param([string[]]$Targets)
|
||||
$found = [System.Collections.Generic.List[string]]::new()
|
||||
foreach ($target in $Targets) {
|
||||
if ([string]::IsNullOrWhiteSpace($target)) { continue }
|
||||
$key = $target.ToLowerInvariant()
|
||||
if ($aliasesByTarget.ContainsKey($key)) {
|
||||
foreach ($alias in @($aliasesByTarget[$key])) {
|
||||
if (-not [string]::IsNullOrWhiteSpace([string]$alias) -and -not $found.Contains([string]$alias)) { $found.Add([string]$alias) }
|
||||
}
|
||||
}
|
||||
}
|
||||
return @($found)
|
||||
}
|
||||
|
||||
if ($IncludeScheduledTasks) {
|
||||
try {
|
||||
foreach ($task in Get-ScheduledTask -ErrorAction Stop) {
|
||||
try {
|
||||
$info = Get-ScheduledTaskInfo -TaskName $task.TaskName -TaskPath $task.TaskPath -ErrorAction Stop
|
||||
$hasRun = $info.LastRunTime -and $info.LastRunTime.Year -gt 2000
|
||||
$outcome = if (-not $hasRun) { 'unknown' } elseif ($info.LastTaskResult -eq 267009) { 'unknown' } elseif ($info.LastTaskResult -eq 0) { 'success' } else { 'failure' }
|
||||
$records.Add([pscustomobject]@{
|
||||
name = $task.TaskName
|
||||
aliases = @(Get-ConfiguredAliases -Targets @($task.TaskName, "$($task.TaskPath)$($task.TaskName)"))
|
||||
outcome = $outcome
|
||||
lastRun = if ($hasRun) { $info.LastRunTime.ToString('o') } else { $null }
|
||||
detail = if ($hasRun) { "Windows Task Scheduler result: $($info.LastTaskResult). State: $($task.State)." } else { 'Windows Task Scheduler reports no completed run.' }
|
||||
source = 'windows-task-scheduler'
|
||||
})
|
||||
} catch {
|
||||
$records.Add([pscustomobject]@{ name = $task.TaskName; aliases = @(); outcome = 'unknown'; lastRun = $null; detail = $_.Exception.Message; source = 'windows-task-scheduler' })
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Write-Warning "Could not query Windows Task Scheduler: $($_.Exception.Message)"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($CodexAutomationsPath -and (Test-Path -LiteralPath $CodexAutomationsPath)) {
|
||||
foreach ($folder in Get-ChildItem -LiteralPath $CodexAutomationsPath -Directory) {
|
||||
$definition = Join-Path $folder.FullName 'automation.toml'
|
||||
if (-not (Test-Path -LiteralPath $definition)) { continue }
|
||||
$definitionText = Get-Content -LiteralPath $definition -Raw
|
||||
$nameMatch = [regex]::Match($definitionText, '(?m)^name\s*=\s*"([^"]+)"')
|
||||
$name = if ($nameMatch.Success) { $nameMatch.Groups[1].Value } else { $folder.Name }
|
||||
$memory = Join-Path $folder.FullName 'memory.md'
|
||||
$outcome = 'unknown'
|
||||
$lastRun = $null
|
||||
$detail = 'Codex automation exists, but no verifiable run result was found.'
|
||||
if (Test-Path -LiteralPath $memory) {
|
||||
$memoryItem = Get-Item -LiteralPath $memory
|
||||
$lastRun = $memoryItem.LastWriteTime.ToString('o')
|
||||
$tail = (Get-Content -LiteralPath $memory -Tail 120) -join "`n"
|
||||
$failureMatches = [regex]::Matches($tail, '(?i)\b(failed|failure|blocked|fatal|error)\b')
|
||||
$successMatches = [regex]::Matches($tail, '(?i)\b(success|successful|completed|passed|refreshed|created|updated|wrote)\b')
|
||||
$lastFailure = if ($failureMatches.Count) { $failureMatches[$failureMatches.Count - 1].Index } else { -1 }
|
||||
$lastSuccess = if ($successMatches.Count) { $successMatches[$successMatches.Count - 1].Index } else { -1 }
|
||||
if ($lastSuccess -gt $lastFailure) { $outcome = 'success' }
|
||||
elseif ($lastFailure -gt $lastSuccess) { $outcome = 'failure' }
|
||||
$detail = "Best-effort result from the latest Codex automation memory for $($folder.Name); inspect memory.md when investigating."
|
||||
if ($folder.Name -eq 'automations-calendar-refresh') {
|
||||
$refreshResult = Get-CalendarRefreshResult -Text (Get-Content -LiteralPath $memory -Raw)
|
||||
$outcome = $refreshResult.outcome
|
||||
$lastRun = $refreshResult.lastRun
|
||||
$detail = "Latest recorded calendar refresh: $outcome. Based on the refresh's own execution statement, excluding outcome counts for other jobs. Evidence: $($folder.Name)/memory.md"
|
||||
}
|
||||
}
|
||||
$statusSource = 'codex-automation-memory'
|
||||
$configuredAliases = @(Get-ConfiguredAliases -Targets @($name, $folder.Name))
|
||||
$records.Add([pscustomobject]@{
|
||||
name = $name
|
||||
aliases = @(@($folder.Name) + $configuredAliases | Select-Object -Unique)
|
||||
outcome = $outcome
|
||||
lastRun = $lastRun
|
||||
detail = $detail
|
||||
source = $statusSource
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if ($WorkflowRepository -or $WorkflowId -or $SchedulerLogRoot) {
|
||||
if (-not $WorkflowRepository -or -not $WorkflowId) { throw 'WorkflowRepository and WorkflowId must be specified together.' }
|
||||
$workflow = Get-WorkflowRunStatus -Repository $WorkflowRepository -WorkflowId $WorkflowId -LogRoot $SchedulerLogRoot
|
||||
$records.Add([pscustomobject]@{
|
||||
name = $WorkflowId
|
||||
aliases = @(Get-ConfiguredAliases -Targets @($WorkflowId))
|
||||
outcome = if ($workflow) { $workflow.outcome } else { 'unknown' }
|
||||
lastRun = if ($workflow) { $workflow.time.ToString('o') } else { $null }
|
||||
detail = if ($workflow) { $workflow.detail } else { 'No verified receipt or scheduler failure was found.' }
|
||||
source = if ($workflow) { $workflow.source } else { 'none' }
|
||||
})
|
||||
}
|
||||
|
||||
if ($OverridesPath -and (Test-Path -LiteralPath $OverridesPath)) {
|
||||
$overridePayload = Get-Content -LiteralPath $OverridesPath -Raw | ConvertFrom-Json
|
||||
$overrideRecords = if ($overridePayload.records) { $overridePayload.records } else { $overridePayload }
|
||||
foreach ($override in @($overrideRecords)) { $records.Add($override) }
|
||||
}
|
||||
|
||||
$now = Get-Date
|
||||
$today = $now.ToString('yyyy-MM-dd')
|
||||
$target = [System.IO.Path]::GetFullPath($OutputPath)
|
||||
$priorHistory = @()
|
||||
if (Test-Path -LiteralPath $target) {
|
||||
try {
|
||||
$existingPayload = Get-Content -LiteralPath $target -Raw | ConvertFrom-Json
|
||||
$priorHistory = @($existingPayload.history)
|
||||
} catch {
|
||||
$priorHistory = @()
|
||||
}
|
||||
}
|
||||
$snapshot = [ordered]@{
|
||||
date = $today
|
||||
generatedAt = $now.ToUniversalTime().ToString('o')
|
||||
records = @($records)
|
||||
}
|
||||
$history = @($priorHistory | Where-Object { $_.date -ne $today }) + @([pscustomobject]$snapshot)
|
||||
$history = @($history | Sort-Object date -Descending | Select-Object -First 3)
|
||||
|
||||
$payload = [ordered]@{
|
||||
generatedAt = $now.ToUniversalTime().ToString('o')
|
||||
note = 'Success and failure are shown only when a local scheduler, Codex memory, or explicit override supplies evidence. Unknown is preserved instead of guessing.'
|
||||
records = $records
|
||||
history = $history
|
||||
}
|
||||
[System.IO.Directory]::CreateDirectory([System.IO.Path]::GetDirectoryName($target)) | Out-Null
|
||||
$temp = "$target.tmp"
|
||||
$payload | ConvertTo-Json -Depth 8 | Set-Content -LiteralPath $temp -Encoding utf8
|
||||
Move-Item -LiteralPath $temp -Destination $target -Force
|
||||
Write-Output "Wrote $target with $($records.Count) status records."
|
||||
@@ -0,0 +1,11 @@
|
||||
[CmdletBinding(SupportsShouldProcess)]
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$Source,
|
||||
[Parameter(Mandatory)][string]$Destination
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
if (-not (Test-Path -LiteralPath $Source -PathType Leaf)) { throw 'Source workbook is missing.' }
|
||||
if (Test-Path -LiteralPath $Destination) { throw 'Destination exists; choose a new file path.' }
|
||||
if ($PSCmdlet.ShouldProcess($Destination, 'Copy workbook')) {
|
||||
[IO.File]::Copy([IO.Path]::GetFullPath($Source), [IO.Path]::GetFullPath($Destination), $false)
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
"""Create a synthetic XLSX workflows worksheet using only the standard library."""
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
from xml.sax.saxutils import escape
|
||||
from zipfile import ZipFile, ZIP_DEFLATED
|
||||
|
||||
HEADERS = ['Name','Machine','Project','Ops Segment','Mon','Tues','Wed','Thu','Fri','Sat','Sun','Other','Notes']
|
||||
ROWS = [
|
||||
['Demo report','demo-worker','Demo analytics','Marketing',0.375,None,None,None,None,None,None,'','Synthetic report'],
|
||||
['Demo backup','demo-worker','Demo maintenance','Systems',None,0.5,None,None,None,None,None,'','Synthetic backup'],
|
||||
['Demo review','demo-worker','Demo planning','Strategy',None,None,'Hourly',None,None,None,None,'','Synthetic review'],
|
||||
]
|
||||
|
||||
def create_workbook(path, rows=None, headers=None):
|
||||
path = Path(path)
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
matrix = [HEADERS if headers is None else headers] + (ROWS if rows is None else rows)
|
||||
xml_rows = []
|
||||
for rownum, row in enumerate(matrix, 1):
|
||||
cells=[]
|
||||
for col,value in enumerate(row):
|
||||
if value is None: continue
|
||||
ref=f'{chr(65+col)}{rownum}'
|
||||
if isinstance(value,(int,float)):
|
||||
cells.append(f'<c r="{ref}"><v>{value}</v></c>')
|
||||
else:
|
||||
cells.append(f'<c r="{ref}" t="inlineStr"><is><t>{escape(str(value))}</t></is></c>')
|
||||
xml_rows.append(f'<row r="{rownum}">{"".join(cells)}</row>')
|
||||
ns='http://schemas.openxmlformats.org/spreadsheetml/2006/main'
|
||||
rel='http://schemas.openxmlformats.org/package/2006/relationships'
|
||||
docrel='http://schemas.openxmlformats.org/officeDocument/2006/relationships'
|
||||
with ZipFile(path,'w',ZIP_DEFLATED) as z:
|
||||
z.writestr('[Content_Types].xml','<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/></Types>')
|
||||
z.writestr('_rels/.rels',f'<Relationships xmlns="{rel}"><Relationship Id="rId1" Type="{docrel}/officeDocument" Target="xl/workbook.xml"/></Relationships>')
|
||||
z.writestr('xl/workbook.xml',f'<workbook xmlns="{ns}" xmlns:r="{docrel}"><sheets><sheet name="workflows" sheetId="1" r:id="rId1"/></sheets></workbook>')
|
||||
z.writestr('xl/_rels/workbook.xml.rels',f'<Relationships xmlns="{rel}"><Relationship Id="rId1" Type="{docrel}/worksheet" Target="worksheets/sheet1.xml"/></Relationships>')
|
||||
z.writestr('xl/worksheets/sheet1.xml',f'<worksheet xmlns="{ns}"><sheetData>{"".join(xml_rows)}</sheetData></worksheet>')
|
||||
|
||||
if __name__=='__main__':
|
||||
parser=argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--output',type=Path,default=Path(__file__).resolve().parent.parent/'local/workflows.xlsx')
|
||||
args=parser.parse_args()
|
||||
if args.output.exists(): parser.error('Output already exists; choose a new path.')
|
||||
create_workbook(args.output)
|
||||
print(f'Created synthetic workbook: {args.output}')
|
||||
@@ -0,0 +1,20 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$Workbook,
|
||||
[string]$Status = (Join-Path $PSScriptRoot '../examples/status.example.json'),
|
||||
[string]$OutputDirectory = (Join-Path $PSScriptRoot '../output'),
|
||||
[string]$Python = 'python'
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
# Offline rendering only. Collect real evidence separately with explicit source flags.
|
||||
$pythonCommand = Get-Command $Python -ErrorAction Stop
|
||||
$Html = Join-Path $OutputDirectory 'automations-calendar.html'
|
||||
$Results = Join-Path $OutputDirectory 'automations-results.html'
|
||||
& $pythonCommand.Source (Join-Path $PSScriptRoot 'build_automations_calendar.py') --workbook $Workbook --html $Html --status $Status
|
||||
if ($LASTEXITCODE -ne 0) { throw "Calendar generation failed: $LASTEXITCODE" }
|
||||
& $pythonCommand.Source (Join-Path $PSScriptRoot 'build_automation_results.py') --workbook $Workbook --status $Status --output $Results
|
||||
if ($LASTEXITCODE -ne 0) { throw "Results generation failed: $LASTEXITCODE" }
|
||||
foreach ($path in @($Html, $Results)) {
|
||||
if (-not (Test-Path -LiteralPath $path) -or (Get-Item -LiteralPath $path).Length -eq 0) { throw "Missing or empty dashboard: $path" }
|
||||
}
|
||||
Write-Output 'Verified calendar and results dashboard outputs.'
|
||||
@@ -0,0 +1,44 @@
|
||||
function Get-WorkflowRunStatus {
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$Repository,
|
||||
[string]$LogRoot,
|
||||
[Parameter(Mandatory)][string]$WorkflowId
|
||||
)
|
||||
$latest = $null
|
||||
foreach ($file in @(Get-ChildItem -LiteralPath (Join-Path $Repository 'receipts') -Filter '*.json' -File -ErrorAction SilentlyContinue)) {
|
||||
try {
|
||||
$r = Get-Content -LiteralPath $file.FullName -Raw | ConvertFrom-Json
|
||||
if ($r.skill.name -ne $WorkflowId) { continue }
|
||||
$time = [DateTimeOffset]::Parse($r.finished_at)
|
||||
$outcome = 'unknown'
|
||||
if ($r.status -in @('failure','failed','blocked') -or @($r.failures | Where-Object { $null -ne $_ }).Count) { $outcome = 'failure' }
|
||||
elseif ($r.status -eq 'success' -and $r.validation.deterministic -eq 'pass' -and $r.validation.manual -eq 'pass' -and $r.artifacts.checkpoint_advanced -eq $true) {
|
||||
$base = [IO.Path]::GetFullPath($Repository).TrimEnd([IO.Path]::DirectorySeparatorChar) + [IO.Path]::DirectorySeparatorChar
|
||||
$report = [IO.Path]::GetFullPath((Join-Path $Repository $r.artifacts.report))
|
||||
if (-not $report.StartsWith($base, [StringComparison]::OrdinalIgnoreCase)) { throw 'Report path escapes configured repository.' }
|
||||
if ((Test-Path -LiteralPath $report -PathType Leaf) -and (Get-Item -LiteralPath $report).Length -gt 0) { $outcome = 'success' }
|
||||
}
|
||||
if (-not $latest -or $time -gt $latest.time) {
|
||||
$latest = [pscustomobject]@{ time=$time; outcome=$outcome; detail="Validated workflow receipt: $($file.Name); outcome: $outcome."; source='workflow-run-receipt' }
|
||||
}
|
||||
} catch { Write-Warning "Unable to read workflow receipt $($file.Name)." }
|
||||
}
|
||||
# Startup failures occur before a task exists, so no workflow receipt can be written.
|
||||
# Look back two weekly cycles; retain the latest completed run as the baseline.
|
||||
$day = (Get-Date).Date.AddDays(-15)
|
||||
while ($LogRoot -and $day -le (Get-Date).Date) {
|
||||
$folder = Join-Path $LogRoot ($day.ToString('yyyy/MM/dd'))
|
||||
foreach ($file in @(Get-ChildItem -LiteralPath $folder -Filter '*.log' -File -ErrorAction SilentlyContinue)) {
|
||||
foreach ($hit in @(Select-String -LiteralPath $file.FullName -Pattern ('Scheduled run failed automationId=' + [regex]::Escape($WorkflowId) + '(?:\s|$)') -ErrorAction SilentlyContinue)) {
|
||||
$stamp = [regex]::Match($hit.Line, '^\S+')
|
||||
$time = [DateTimeOffset]::MinValue
|
||||
if ($stamp.Success -and [DateTimeOffset]::TryParse($stamp.Value, [ref]$time) -and (-not $latest -or $time -gt $latest.time)) {
|
||||
$message = [regex]::Match($hit.Line, 'errorMessage="([^"]+)"').Groups[1].Value
|
||||
$latest = [pscustomobject]@{ time=$time; outcome='failure'; detail="Codex scheduler could not start the run: $message. Evidence: $($file.Name):$($hit.LineNumber)."; source='codex-scheduler-log' }
|
||||
}
|
||||
}
|
||||
}
|
||||
$day = $day.AddDays(1)
|
||||
}
|
||||
return $latest
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
# Implementation receipt
|
||||
|
||||
- Date: 2026-09-22
|
||||
- Approved plan: revision 2; user approved attribution, MIT, canonical origin and preparation branch.
|
||||
- Status: implemented; prepared for human review, not committed or published.
|
||||
- Profile: software-automation; version 0.1.0.
|
||||
- Author, publisher, maintainer: Eddie Soehnel.
|
||||
- Branch: codex/publication-preparation.
|
||||
|
||||
Created portable script derivatives, clean HTML templates, synthetic registry/alias/override examples, a generated demo workbook, searchable repository metadata, human/AI entry points, docs and privacy guardrails. The exact source-to-output map and file hashes are held in the separate private publication receipt. All 14 source top-level file hashes matched before and after work; source caches and Git history were not copied.
|
||||
|
||||
Original live status/history exports, generated results, production aliases, embedded calendar records, workstation paths and project-specific identifiers were omitted or replaced. Generated workbook, dashboards and screenshots are ignored local artifacts. Existing destination Git configuration and origin were preserved; it had no commits.
|
||||
|
||||
Implemented small correctness fixes discovered while validating the approved derivatives: empty worksheet handling, safe regex payload replacement, the worksheet label, a calendar list header that blocked clicks, and results-layout overflow. Live collection is explicitly opt-in and separate from rendering. No material scope expansion.
|
||||
|
||||
Validation is recorded in [validation-results.md](validation-results.md). No known publication blocker remains in the prepared public file set. Human review is still required before commit/publication. Remote visibility and external indexing were not tested or changed. Heuristic evidence interpretation is documented and is not independent proof of business outcomes.
|
||||
|
||||
Rollback: no source rollback is needed. The destination additions are uncommitted and can be reviewed individually using repository.json and the approved plan. Do not delete the existing Git directory. Keep the detailed private receipt outside any public commit.
|
||||
@@ -0,0 +1,83 @@
|
||||
# Repository Structure and Publication Plan
|
||||
|
||||
## Plan control
|
||||
- Task: structure-ai-ready-repository
|
||||
- Revision: 2
|
||||
- Status: implemented
|
||||
- Created: 2026-09-22
|
||||
- Profile: software-automation
|
||||
- Approval evidence: user approved revision 2, MIT, preparation branch, and existing origin on 2026-09-22.
|
||||
- Target: this repository; source remains unchanged.
|
||||
|
||||
## Outcome
|
||||
Prepare a standalone, anonymized automation-calendar tool with searchable human and machine entry points, synthetic examples, reproducible validation, and no copied private history. Preparation does not include publication, push, or commit.
|
||||
|
||||
## Current state and baseline
|
||||
The destination has an existing Git directory, configured origin, branch main, no commits, and no working-tree files before this plan. Remote visibility has not been verified. The source is a subdirectory of a larger repository, with Python builders, PowerShell collectors, HTML, status configuration, generated outputs, and tracked caches. Three source generated outputs have uncommitted changes; preserve all source files. The read-only software-automation profile audit found all 14 required paths missing, as expected for an empty target.
|
||||
|
||||
## Identity and publication decisions
|
||||
Author, publisher, and maintainer: Eddie Soehnel, supplied by the user on 2026-09-22 in response to the identity question. Retain this author attribution; anonymize operational personal data. License: MIT. Branch: codex/publication-preparation. Canonical URL: the existing origin, approved for public metadata. Operational brands remain anonymized. Proposed intent: mixed reusable tooling and synthetic examples. Proposed scope: the explicit source list below. Use full operational anonymization; preserve generic product and protocol names required to explain dependencies. Do not inherit template attribution or license choices for project code.
|
||||
|
||||
## Proposed structure and file actions
|
||||
All paths below are target-relative. Create means a sanitized derivative or new file, never an unreviewed verbatim copy of operational data.
|
||||
|
||||
| Path | Action | Content and source treatment |
|
||||
|---|---|---|
|
||||
| .git/ | preserve | Existing destination history/configuration; never copy source history or alter origin. Branch changes only after branch approval. |
|
||||
| scripts/aggregate_updates.py | create | Derive from aggregate_updates.py; require/configure input root and output, remove private defaults. |
|
||||
| scripts/build_automations_calendar.py | create | Derive from same-named source; clean template/output separation, portable defaults, public-safe source labels. |
|
||||
| scripts/build_automation_results.py | create | Derive from same-named source; portable paths, public-safe output metadata. |
|
||||
| scripts/collect_automation_statuses.ps1 | create | Derive from same-named source; configurable, opt-in local sources; generalize project-specific receipt adapters and identifiers. |
|
||||
| scripts/refresh_automations_calendar.ps1 | create | Derive from same-named source; configured Python/workbook/output, clean template bootstrap. No live collector execution during validation. |
|
||||
| scripts/copy-workbook.ps1 | create | Derive from the source workbook-copy helper; explicit input/output parameters, no private sync destination or automatic overwrite. |
|
||||
| scripts/workflow-run-status.ps1 | create | Generalize the source workflow-status adapter with configurable workflow ID, repository, and log root; retain evidence semantics. |
|
||||
| tests/test-workflow-run-status.ps1 | create | Generalize the source workflow-status fixture test; synthetic local fixture tests. |
|
||||
| templates/automations-calendar.template.html | create | Extract only UI structure from automations-calendar.html; remove embedded records and private source stamp, inspect all remaining static text. |
|
||||
| templates/automations-results.template.html | create | Sanitize automations-results.template.html; preserve UI behavior. |
|
||||
| examples/status-overrides.example.json | create | Sanitize automations-calendar-status-overrides.example.json. |
|
||||
| examples/status-aliases.example.json | create | Rebuild structure of automations-calendar-status-aliases.json using wholly synthetic mappings. |
|
||||
| examples/status.example.json | create | New synthetic success/failure/unknown and history examples, not transformed live records. |
|
||||
| scripts/create_example_workbook.py | create | Generate a synthetic workflows worksheet locally using standard-library ZIP/XML. No source workbook copy. |
|
||||
| examples/README.md; templates/README.md; scripts/README.md | create | Index actual assets, schemas, commands, inputs, outputs, and privacy boundaries. |
|
||||
| README.md | create | Purpose, audience, setup, executable demo, inputs/outputs, limitations, repository map, validation, version, license. |
|
||||
| AUTHOR.md; repository-variables.json | create | Only confirmed identity/publication metadata and verification provenance; pending facts explicitly marked. |
|
||||
| repository.json | create | Searchable description, topics, technology, stable ID, software-automation profile, contents, human/AI entry points, retrieval order. |
|
||||
| VERSION; CHANGELOG.md; UPDATES.md | create | Initial 0.1.0, completed changes, and separate unapproved future improvements. |
|
||||
| LICENSE | create | User-approved license; preserve upstream notices applicable to reused template assets. |
|
||||
| AGENTS.md; CONTRIBUTING.md; SECURITY.md | create | Scoped agent guidance, verification workflow, private data/reporting boundaries without invented contacts. |
|
||||
| docs/README.md; docs/architecture.md; docs/implementation.md | create | Component flow, evidence limitations, configuration, workbook columns, status fields, usage and adaptation. |
|
||||
| .gitignore; PUBLICATION_WORKFLOW.md | create | Ignore local inputs, outputs, caches, logs, secrets; document review gates and safe regeneration. |
|
||||
| scripts/audit_repository.py; scripts/check_publication.py | create | Template profile audit with attribution plus leak/path/manifest checks; avoid putting real private identifiers into public scanner rules. |
|
||||
| tests/test_dashboard.py | create | Meaningful synthetic workbook-to-dashboard tests, status linking, unknown handling, HTML payload safety and source-label privacy. |
|
||||
| tasks/structure-ai-ready-repository/implementation-receipt.md; tasks/structure-ai-ready-repository/validation-results.md | create | Sanitized implementation and verification record after approval. |
|
||||
| automations-calendar-status.json; automations-results.html; __pycache__/ | leave absent | Live generated outputs and caches must not be copied. |
|
||||
| content-index.json; skills/; host CI/issue configuration | leave absent | Small software repo uses repository.json; no actual skill or authorized hosting setup. |
|
||||
|
||||
## Anonymization policy proposed for approval
|
||||
Replace personal names, email addresses, private domains, hostnames, IPs, workstation paths, project/automation identifiers, scheduler topology, receipt references and aliases with neutral configurable values or synthetic examples. Use example.com/example.org and workflow-demo where placeholders are needed. Keep the detailed original-to-replacement map only in the private publication receipt. Do not put original sensitive values in public plans, fixtures, tests, or scanner patterns.
|
||||
|
||||
## Entry points and host choices
|
||||
Human/AI start: README.md, then AUTHOR.md, repository-variables.json, repository.json, AGENTS.md, and task-relevant indexed files. Local metadata improves discoverability but does not prove external search indexing. Preserve destination remote; no host settings or visibility changes.
|
||||
|
||||
## Validation and definition of done
|
||||
- Hash approved source files before/after preparation to prove source preservation.
|
||||
- Parse Python and PowerShell; run fixture-based Python and PowerShell tests.
|
||||
- Generate synthetic workbook and both dashboards into ignored local output; verify nested weekday schedules, ordering, three evidence outcomes, aliases and bounded history.
|
||||
- Test HTML/script escaping and removal of absolute local source paths from rendered metadata.
|
||||
- Run python scripts/audit_repository.py . --profile software-automation.
|
||||
- Run python scripts/check_publication.py plus independent rg scans for credentials, emails, URLs, IPs, private paths and discovered identifiers.
|
||||
- Check all files including untracked additions, JSON metadata alignment, declared paths, Markdown links, version and license alignment.
|
||||
- Review git status, new-file contents, diff and diff --check. History is initially empty; no copied history.
|
||||
- Record actual commands/results and remaining limitations; no claim of operating live integrations.
|
||||
|
||||
## Risks, assumptions and preservation
|
||||
The calendar builder currently depends on an existing generated HTML file, so extracting a clean reusable template is required. Source scripts embed local paths and project-specific adapters. Some collected evidence uses heuristic text matching and must remain documented as best-effort. The empty-worksheet branch references an undefined variable; fix and test this in the public derivative. Any further material scope expansion requires an amended plan. Do not change private operational code, schedules, services, workbooks or remote visibility.
|
||||
|
||||
## Receipt
|
||||
Write the detailed private receipt, including source/destination paths, file hashes, substitutions, scans and findings, to the workflow-required external receipt directory under a date/repository-based filename. The public repository receives only sanitized records.
|
||||
|
||||
## Approval
|
||||
Revision 2 approved by the user on 2026-09-22, including copy scope, anonymization, attribution, MIT, canonical URL, and output branch. No commit or push is included.
|
||||
|
||||
## Implementation notes
|
||||
Completed approved revision 2. Small correctness fixes within the approved derivatives address an empty worksheet, safe JSON regex replacement, stale worksheet wording, calendar list-header overlap, and narrow-screen results layout. The refresh wrapper now renders offline; collection is a separate explicit command. No material scope expansion, source changes, commits, push, or visibility changes.
|
||||
@@ -0,0 +1,23 @@
|
||||
# Validation results
|
||||
|
||||
Date: 2026-09-22. Approved revision: 2. Test data was synthetic. No live scheduler, account or private log collector was executed.
|
||||
|
||||
| Check | Result |
|
||||
|---|---|
|
||||
| `python -m unittest discover -s tests -p "test_*.py" -v` | PASS: 9 tests; workbook schedule/order, aliases, unknown outcomes, history limit, unlinked evidence, script escaping/backslashes, empty sheet, missing headers, privacy guardrails |
|
||||
| `./tests/test-workflow-run-status.ps1` | PASS: 5 synthetic receipt/scheduler cases |
|
||||
| PowerShell AST parsing for all scripts/tests | PASS |
|
||||
| `python scripts/create_example_workbook.py` and combined refresh command | PASS: 3 workflows, calendar and results generated from clean templates |
|
||||
| Collector with synthetic override and with no sources | PASS: 1 expected success record and 0 records respectively |
|
||||
| `python scripts/audit_repository.py . --profile software-automation` | PASS |
|
||||
| `python scripts/check_publication.py` | PASS: public files, JSON, Python syntax, metadata, declared paths, local Markdown links and common leak patterns |
|
||||
| Independent regex scans | PASS after manual classification; matches are generic security prose, scanner patterns, deny-list file suffixes, approved attribution/URL and XML namespaces |
|
||||
| Source-derived identifier comparison | 61 terms checked; only this tool's generic identifiers and the Unspecified sentinel remain |
|
||||
| Source integrity | All 14 source file SHA-256 hashes unchanged |
|
||||
| Browser smoke tests | PASS: isolated headless Edge, HTTP blocked, list/search/dialog/navigation/outcome filters, no JavaScript errors |
|
||||
| Visual review | Desktop calendar, desktop results and mobile results screenshots inspected; inherited overlap/overflow fixed and rechecked |
|
||||
| Git checks | Correct preparation branch, zero commits, no tracked private files; diff --check clean; runtime artifacts ignored |
|
||||
|
||||
Browser checks used generated demo output. Six managed rows represent three workflows over two stored snapshots. Results filtering found one failure and two report rows. At a 390px viewport the page no longer overflows; the wide results table scrolls within its panel.
|
||||
|
||||
Limitations: real scheduler permissions and external integrations were not exercised. No remote URL reachability, remote visibility, hosting topics, external indexing or release was verified. The source-substring check supplements manual review and generic scanners; it is not a formal proof of anonymity. Git diff is empty for untracked files, so the new files were separately scanned and reviewed.
|
||||
@@ -0,0 +1,6 @@
|
||||
# HTML templates
|
||||
|
||||
- [automations-calendar.template.html](automations-calendar.template.html): calendar interface with an empty automation array and synthetic source stamp.
|
||||
- [automations-results.template.html](automations-results.template.html): results interface with the __AUTOMATION_RESULTS_DATA__ placeholder.
|
||||
|
||||
Builders insert escaped JSON and write separate output files. Do not edit generated operational HTML into these templates.
|
||||
@@ -0,0 +1,276 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Automations Calendar</title>
|
||||
<style>
|
||||
:root {
|
||||
--ink: #172033; --muted: #64748b; --line: #dfe7f1; --panel: #ffffff;
|
||||
--brand: #175cd3; --brand-soft: #e8f0ff; --paused: #8b5cf6; --warn: #c2410c;
|
||||
--success: #15803d; --success-soft: #dcfce7; --failure: #dc2626; --failure-soft: #fee2e2; --unknown: #64748b;
|
||||
--hour-height: 76px; --radius: 16px; --shadow: 0 14px 38px rgba(30, 51, 88, .09);
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
body { margin: 0; color: var(--ink); background: #f4d35e; font: 14px/1.45 system-ui, sans-serif; }
|
||||
button, input, select { font: inherit; }
|
||||
.shell { width: 90%; max-width: 1720px; margin: 0 auto; padding: 28px 0; }
|
||||
.hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
|
||||
h1 { margin: 0 0 6px; font-size: clamp(28px, 4vw, 46px); letter-spacing: -.045em; line-height: 1.05; }
|
||||
.sub { color: #000; max-width: 780px; font-size: 15px; }
|
||||
.source { margin-top: 8px; color: #000; font-size: 12px; overflow-wrap: anywhere; }
|
||||
.page-links { display: flex; gap: 8px; margin-top: 11px; }
|
||||
.page-links a { color: #1649a5; background: var(--brand-soft); border-radius: 9px; padding: 7px 10px; text-decoration: none; font-weight: 700; }
|
||||
.stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
|
||||
.stat { min-width: 108px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 5px 18px rgba(30, 51, 88, .04); }
|
||||
.stat strong { display: block; font-size: 22px; line-height: 1; margin-bottom: 5px; }
|
||||
.stat span { color: var(--muted); font-size: 12px; }
|
||||
.toolbar { position: sticky; top: 0; z-index: 50; display: grid; grid-template-columns: minmax(220px, 1.5fr) repeat(5, minmax(130px, .65fr)) auto; gap: 10px; padding: 12px; margin-bottom: 16px; background: rgba(243, 246, 251, .94); backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: var(--radius); }
|
||||
input, select { width: 100%; border: 1px solid #cdd8e7; border-radius: 10px; padding: 10px 12px; color: var(--ink); background: white; outline: none; }
|
||||
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23, 92, 211, .12); }
|
||||
.view-toggle { display: flex; border: 1px solid #cdd8e7; border-radius: 10px; overflow: hidden; background: white; }
|
||||
.view-toggle button { border: 0; background: transparent; padding: 9px 13px; color: var(--muted); cursor: pointer; }
|
||||
.view-toggle button.active { background: var(--ink); color: white; }
|
||||
.cadence-panel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
|
||||
.cadence { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
|
||||
.cadence h2 { margin: 0 0 4px; font-size: 16px; }
|
||||
.cadence .hint { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
|
||||
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
|
||||
.chip { border: 1px solid #d7e1ef; background: #f8fafc; color: #334155; padding: 6px 9px; border-radius: 999px; cursor: pointer; font-size: 12px; }
|
||||
.chip:hover { border-color: var(--brand); background: var(--brand-soft); }
|
||||
.week-wrap { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; max-height: calc(100vh - 155px); }
|
||||
.week { min-width: 1330px; display: grid; grid-template-columns: 72px repeat(7, minmax(170px, 1fr)); position: relative; }
|
||||
.corner, .day-head { position: sticky; top: 0; z-index: 25; background: #172033; color: white; min-height: 58px; border-right: 1px solid rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center; }
|
||||
.corner { left: 0; z-index: 35; color: #aebbd0; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
|
||||
.day-head { flex-direction: column; gap: 2px; font-weight: 700; }
|
||||
.day-head small { color: #aebbd0; font-weight: 500; }
|
||||
.day-head.today { background: #114cba; }
|
||||
.time-slot { position: sticky; left: 0; z-index: 20; min-height: var(--hour-height); background: #f8fafc; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 9px; color: var(--muted); font-size: 11px; text-align: right; }
|
||||
.hour-block { min-width: 0; min-height: var(--hour-height); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 6px; }
|
||||
.hour-block.today { background-color: #f7faff; }
|
||||
.event { position: relative; width: 100%; flex: 0 0 auto; min-height: 48px; border: 1px solid color-mix(in srgb, var(--event-color) 55%, white); border-left: 4px solid var(--event-color); border-radius: 9px; padding: 7px 8px; background: color-mix(in srgb, var(--event-color) 10%, white); box-shadow: 0 4px 10px rgba(30, 51, 88, .08); overflow: hidden; cursor: pointer; transition: transform .12s, box-shadow .12s; }
|
||||
.event:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(30, 51, 88, .16); z-index: 10; }
|
||||
.event.paused { opacity: .58; filter: grayscale(.25); border-style: dashed; }
|
||||
.event-time { color: #475569; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
|
||||
.event-name { overflow-wrap: anywhere; margin-top: 2px; font-weight: 750; font-size: 12px; line-height: 1.2; }
|
||||
.event-meta { color: #64748b; font-size: 10px; margin-top: 3px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
|
||||
.event-name-row { display: flex; align-items: flex-start; gap: 5px; }
|
||||
.run-mark { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; font-size: 11px; font-weight: 900; line-height: 1; vertical-align: middle; }
|
||||
.run-mark.success { color: #fff; background: var(--success); }
|
||||
.run-mark.failure { color: #fff; background: var(--failure); }
|
||||
.run-mark.unknown { color: #fff; background: var(--unknown); }
|
||||
.empty { padding: 28px; color: var(--muted); text-align: center; }
|
||||
.list { display: none; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); overflow: hidden; }
|
||||
.list-row { display: grid; grid-template-columns: 1.4fr .7fr .65fr .65fr .65fr .65fr 1fr; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: start; cursor: pointer; }
|
||||
.list-row:hover { background: #f8fafc; }
|
||||
.list-row.header { position: static; background: #172033; color: white; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; cursor: default; }
|
||||
.list-name { font-weight: 750; }
|
||||
.muted { color: var(--muted); }
|
||||
.badge { display: inline-flex; align-items: center; width: fit-content; padding: 4px 7px; border-radius: 999px; background: #eef2f7; color: #475569; font-size: 11px; }
|
||||
.badge.paused { background: #f3e8ff; color: #6b21a8; }
|
||||
dialog { width: min(650px, calc(100vw - 32px)); border: 0; border-radius: 18px; padding: 0; box-shadow: 0 30px 90px rgba(15, 23, 42, .35); }
|
||||
dialog::backdrop { background: rgba(15, 23, 42, .54); backdrop-filter: blur(4px); }
|
||||
.modal-head { padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
|
||||
.modal-head h2 { margin: 0 36px 4px 0; line-height: 1.2; }
|
||||
.close { position: absolute; right: 16px; top: 14px; border: 0; border-radius: 10px; background: #eef2f7; color: #334155; width: 34px; height: 34px; cursor: pointer; }
|
||||
.modal-body { padding: 20px 24px 24px; }
|
||||
.detail-grid { display: grid; grid-template-columns: 120px 1fr; gap: 10px 16px; }
|
||||
.detail-grid dt { color: var(--muted); }
|
||||
.detail-grid dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
|
||||
.schedule-line { display: inline-block; margin: 0 5px 5px 0; padding: 4px 7px; background: var(--brand-soft); color: #1649a5; border-radius: 7px; font-size: 12px; }
|
||||
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin: 11px 2px 0; }
|
||||
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
|
||||
@media (max-width: 920px) {
|
||||
.shell { padding: 18px; } .hero { flex-direction: column; } .stats { justify-content: flex-start; }
|
||||
.toolbar { grid-template-columns: 1fr 1fr; } .toolbar input { grid-column: 1 / -1; }
|
||||
.cadence-panel { grid-template-columns: 1fr; } .list-row { grid-template-columns: 1fr; gap: 5px; }
|
||||
.list-row.header { display: none; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main class="shell">
|
||||
<section class="hero">
|
||||
<div>
|
||||
<h1>Automations Calendar</h1>
|
||||
<div class="sub">A weekly view of every automation listed on the workbook’s <strong>workflows</strong> tab. Times are shown exactly as entered in the workbook; no timezone conversion is applied.</div>
|
||||
<div class="source">Source: synthetic-workflows.xlsx · workflows!A1:M1 · Synthetic template</div>
|
||||
<nav class="page-links"><a href="automations-results.html">Open run results</a></nav>
|
||||
</div>
|
||||
<div class="stats" id="stats"></div>
|
||||
</section>
|
||||
|
||||
<section class="toolbar" aria-label="Calendar filters">
|
||||
<input id="search" type="search" placeholder="Search name, notes, location…" aria-label="Search automations">
|
||||
<select id="project"><option value="">All projects</option></select>
|
||||
<select id="machine"><option value="">All machines</option></select>
|
||||
<select id="opsSegment"><option value="">All ops segments</option></select>
|
||||
<select id="status"><option value="">All statuses</option></select>
|
||||
<select id="runOutcome"><option value="">All run results</option><option value="success">Successful</option><option value="failure">Failed</option><option value="unknown">Unknown</option></select>
|
||||
<div class="view-toggle" aria-label="View selector">
|
||||
<button class="active" data-view="week">Week</button><button data-view="list">List</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="cadence-panel" id="cadencePanel"></section>
|
||||
<section class="week-wrap" id="weekWrap"><div class="week" id="week"></div></section>
|
||||
<section class="list" id="list"></section>
|
||||
<div class="legend" id="legend"></div>
|
||||
</main>
|
||||
|
||||
<dialog id="details"><button class="close" aria-label="Close">×</button><div id="dialogContent"></div></dialog>
|
||||
|
||||
<script>
|
||||
const automations = [];
|
||||
const days = ["Mon","Tues","Wed","Thu","Fri","Sat","Sun"];
|
||||
const colors = ["#175cd3", "#0f8a70", "#b54708", "#7c3aed", "#c0266d", "#0875b8", "#4d7c0f", "#be123c"];
|
||||
const state = { search: "", project: "", machine: "", opsSegment: "", status: "", runOutcome: "", view: "week" };
|
||||
const esc = value => String(value ?? "").replace(/[&<>"']/g, ch => ({"&":"&","<":"<",">":">",'"':""","'":"'"}[ch]));
|
||||
const fmt = mins => {
|
||||
const hour = Math.floor(mins / 60), minute = mins % 60, suffix = hour >= 12 ? "PM" : "AM";
|
||||
return `${hour % 12 || 12}:${String(minute).padStart(2, "0")} ${suffix}`;
|
||||
};
|
||||
const projectColor = project => colors[[...new Set(automations.map(a => a.project))].sort().indexOf(project) % colors.length];
|
||||
const runOutcome = a => a.run?.outcome || "unknown";
|
||||
const runLabel = a => runOutcome(a) === "success" ? "Last run successful" : runOutcome(a) === "failure" ? "Last run failed" : "Run result unavailable";
|
||||
const runMark = a => `<span class="run-mark ${runOutcome(a)}" title="${esc(runLabel(a))}${a.run?.lastRun ? ` · ${esc(a.run.lastRun)}` : ""}">${runOutcome(a) === "success" ? "✓" : runOutcome(a) === "failure" ? "×" : "?"}</span>`;
|
||||
const sortAutomations = (a, b) => (a.opsSegment || "Unsorted").localeCompare(b.opsSegment || "Unsorted") || a.project.localeCompare(b.project) || a.name.localeCompare(b.name);
|
||||
const isPaused = a => /paused|deleted/i.test(a.status);
|
||||
const exactEvents = a => days.flatMap(day => a.schedule[day].minutes === null ? [] : [{ day, minutes: a.schedule[day].minutes }]);
|
||||
const isHourly = a => days.some(day => /hourly/i.test(a.schedule[day].cadence)) || /every hour|hourly/i.test(a.other);
|
||||
const hourlyMinute = a => {
|
||||
const match = a.other.match(/:(\d{1,2}).*every hour/i);
|
||||
return match ? Math.min(59, Number(match[1])) : 0;
|
||||
};
|
||||
const hourlyDays = a => {
|
||||
const explicitDays = days.filter(day => /hourly/i.test(a.schedule[day].cadence));
|
||||
return explicitDays.length ? explicitDays : (isHourly(a) ? days : []);
|
||||
};
|
||||
const scheduleText = a => days.map(day => {
|
||||
const entry = a.schedule[day];
|
||||
if (entry.minutes !== null) return `${day} ${fmt(entry.minutes)}`;
|
||||
if (entry.cadence) return `${day} ${entry.cadence}`;
|
||||
return null;
|
||||
}).filter(Boolean).concat(a.other ? [a.other] : []);
|
||||
|
||||
function filtered() {
|
||||
const query = state.search.toLowerCase();
|
||||
return automations.filter(a =>
|
||||
(!state.project || a.project === state.project) &&
|
||||
(!state.machine || a.machine === state.machine) &&
|
||||
(!state.opsSegment || a.opsSegment === state.opsSegment) &&
|
||||
(!state.status || a.status === state.status) &&
|
||||
(!state.runOutcome || runOutcome(a) === state.runOutcome) &&
|
||||
(!query || [a.name, a.machine, a.project, a.opsSegment, a.location, a.status, a.other, a.notes].join(" ").toLowerCase().includes(query))
|
||||
).sort(sortAutomations);
|
||||
}
|
||||
|
||||
function fillSelect(id, values) {
|
||||
const select = document.getElementById(id);
|
||||
[...new Set(values)].sort((a,b) => a.localeCompare(b)).forEach(value => select.insertAdjacentHTML("beforeend", `<option>${esc(value)}</option>`));
|
||||
}
|
||||
fillSelect("project", automations.map(a => a.project));
|
||||
fillSelect("machine", automations.map(a => a.machine));
|
||||
fillSelect("opsSegment", automations.map(a => a.opsSegment || "Unsorted"));
|
||||
fillSelect("status", automations.map(a => a.status));
|
||||
|
||||
function renderStats(data) {
|
||||
const eventCount = data.reduce((sum, a) => sum + exactEvents(a).length + (isHourly(a) ? hourlyDays(a).length * 24 : 0), 0);
|
||||
const cadenceCount = data.filter(a => days.some(day => a.schedule[day].cadence) || a.other).length;
|
||||
const successCount = data.filter(a => runOutcome(a) === "success").length;
|
||||
const failureCount = data.filter(a => runOutcome(a) === "failure").length;
|
||||
document.getElementById("stats").innerHTML = `
|
||||
<div class="stat"><strong>${data.length}</strong><span>automations shown</span></div>
|
||||
<div class="stat"><strong>${eventCount}</strong><span>weekly occurrences</span></div>
|
||||
<div class="stat"><strong>${cadenceCount}</strong><span>cadence entries</span></div>
|
||||
<div class="stat"><strong>${successCount}</strong><span>last run successful</span></div>
|
||||
<div class="stat"><strong>${failureCount}</strong><span>last run failed</span></div>`;
|
||||
}
|
||||
|
||||
function renderCadences(data) {
|
||||
const groups = [
|
||||
{ title: "Real-time", hint: "Continuous synchronization", test: a => days.some(d => /real time/i.test(a.schedule[d].cadence)) },
|
||||
{ title: "Hourly", hint: "Repeating within each day", test: a => days.some(d => /hourly/i.test(a.schedule[d].cadence)) || /hour/i.test(a.other) },
|
||||
{ title: "Manual / other", hint: "Monthly or non-weekly cadence", test: a => a.other && !/hour/i.test(a.other) },
|
||||
];
|
||||
document.getElementById("cadencePanel").innerHTML = groups.map(group => {
|
||||
const items = data.filter(group.test);
|
||||
return `<article class="cadence"><h2>${group.title} <span class="muted">· ${items.length}</span></h2><div class="hint">${group.hint}</div><div class="chips">${items.length ? items.map(a => `<button class="chip" data-id="${a.id}">${esc(a.name)}</button>`).join("") : '<span class="muted">None in current filter</span>'}</div></article>`;
|
||||
}).join("");
|
||||
}
|
||||
|
||||
function renderWeek(data) {
|
||||
const jsDay = new Date().getDay();
|
||||
const today = days[jsDay === 0 ? 6 : jsDay - 1];
|
||||
let out = '<div class="corner">Time</div>' + days.map(day => `<div class="day-head ${day === today ? "today" : ""}"><span>${day === "Tues" ? "Tuesday" : day}</span><small>weekly schedule</small></div>`).join("");
|
||||
const eventsByDay = Object.fromEntries(days.map(day => {
|
||||
const exact = data.flatMap(a => a.schedule[day].minutes === null ? [] : [{a, minutes: a.schedule[day].minutes, recurring: false}]);
|
||||
const hourly = data.filter(a => isHourly(a) && hourlyDays(a).includes(day));
|
||||
const recurring = hourly.flatMap(a => Array.from({length: 24}, (_, hour) => ({a, minutes: hour * 60 + hourlyMinute(a), recurring: true})));
|
||||
return [day, exact.concat(recurring).sort((x, y) => x.minutes - y.minutes || sortAutomations(x.a, y.a))];
|
||||
}));
|
||||
for (let hour = 0; hour < 24; hour++) {
|
||||
out += `<div class="time-slot">${fmt(hour * 60).replace(":00", "")}</div>`;
|
||||
days.forEach(day => {
|
||||
const events = eventsByDay[day].filter(event => Math.floor(event.minutes / 60) === hour);
|
||||
const cards = events.map(({a, minutes, recurring}) => `<article class="event ${isPaused(a) ? "paused" : ""}" data-id="${a.id}" style="--event-color:${projectColor(a.project)}"><div class="event-time">${fmt(minutes)}${recurring ? " · Hourly" : ""}</div><div class="event-name-row">${runMark(a)}<div class="event-name">${esc(a.name)}</div></div><div class="event-meta">${esc(a.opsSegment || "Unsorted")} · ${esc(a.machine)} · ${esc(a.project)}</div></article>`).join("");
|
||||
out += `<div class="hour-block ${day === today ? "today" : ""}" data-day="${day}" data-hour="${hour}">${cards}</div>`;
|
||||
});
|
||||
}
|
||||
document.getElementById("week").innerHTML = out;
|
||||
}
|
||||
|
||||
function renderList(data) {
|
||||
const rows = data.map(a => `<div class="list-row" data-id="${a.id}">
|
||||
<div><div class="list-name">${esc(a.name)}</div><div class="muted">${esc(a.location)}</div></div>
|
||||
<div>${esc(a.opsSegment || "Unsorted")}</div><div>${esc(a.project)}</div><div>${esc(a.machine)}</div>
|
||||
<div><span class="badge ${isPaused(a) ? "paused" : ""}">${esc(a.status)}</span></div>
|
||||
<div>${runMark(a)} <span class="muted">${esc(runLabel(a))}</span></div>
|
||||
<div>${scheduleText(a).map(item => `<span class="schedule-line">${esc(item)}</span>`).join("") || '<span class="muted">No schedule entered</span>'}</div>
|
||||
</div>`).join("");
|
||||
document.getElementById("list").innerHTML = '<div class="list-row header"><div>Automation</div><div>Ops segment</div><div>Project</div><div>Machine</div><div>Status</div><div>Last run</div><div>Schedule</div></div>' + (rows || '<div class="empty">No automations match these filters.</div>');
|
||||
}
|
||||
|
||||
function renderLegend(data) {
|
||||
const projects = [...new Set(data.map(a => a.project))].sort();
|
||||
document.getElementById("legend").innerHTML = projects.map(p => `<span><i class="dot" style="background:${projectColor(p)}"></i>${esc(p)}</span>`).join("") + '<span><i class="run-mark success">✓</i> last run successful</span><span><i class="run-mark failure">×</i> last run failed</span><span><i class="run-mark unknown">?</i> no verifiable result</span><span>Items stack by time within each hour; Hourly = repeating job</span><span>Dashed/faded = paused or deleted</span>';
|
||||
}
|
||||
|
||||
function showDetails(id) {
|
||||
const a = automations.find(item => item.id === Number(id));
|
||||
if (!a) return;
|
||||
const schedules = scheduleText(a);
|
||||
document.getElementById("dialogContent").innerHTML = `
|
||||
<div class="modal-head"><h2>${runMark(a)} ${esc(a.name)}</h2><span class="badge ${isPaused(a) ? "paused" : ""}">${esc(a.status)}</span></div>
|
||||
<div class="modal-body"><dl class="detail-grid">
|
||||
<dt>Schedule</dt><dd>${schedules.map(item => `<span class="schedule-line">${esc(item)}</span>`).join("") || "No schedule entered"}</dd>
|
||||
<dt>Last run</dt><dd>${esc(runLabel(a))}${a.run?.lastRun ? ` · ${esc(a.run.lastRun)}` : ""}${a.run?.detail ? `<br>${esc(a.run.detail)}` : ""}</dd>
|
||||
<dt>Ops segment</dt><dd>${esc(a.opsSegment || "Unsorted")}</dd><dt>Project</dt><dd>${esc(a.project)}</dd><dt>Machine</dt><dd>${esc(a.machine)}</dd>
|
||||
<dt>Location</dt><dd>${esc(a.location)}</dd><dt>Notes</dt><dd>${esc(a.notes || "—")}</dd>
|
||||
</dl></div>`;
|
||||
document.getElementById("details").showModal();
|
||||
}
|
||||
|
||||
function render() {
|
||||
const data = filtered();
|
||||
renderStats(data); renderCadences(data); renderWeek(data); renderList(data); renderLegend(data);
|
||||
document.getElementById("weekWrap").style.display = state.view === "week" ? "block" : "none";
|
||||
document.getElementById("list").style.display = state.view === "list" ? "block" : "none";
|
||||
}
|
||||
|
||||
document.getElementById("search").addEventListener("input", e => { state.search = e.target.value; render(); });
|
||||
["project","machine","opsSegment","status","runOutcome"].forEach(id => document.getElementById(id).addEventListener("change", e => { state[id] = e.target.value; render(); }));
|
||||
document.querySelector(".view-toggle").addEventListener("click", e => {
|
||||
if (!e.target.dataset.view) return;
|
||||
state.view = e.target.dataset.view;
|
||||
document.querySelectorAll(".view-toggle button").forEach(button => button.classList.toggle("active", button.dataset.view === state.view));
|
||||
render();
|
||||
});
|
||||
document.addEventListener("click", e => { const target = e.target.closest("[data-id]"); if (target) showDetails(target.dataset.id); });
|
||||
document.querySelector("dialog .close").addEventListener("click", () => document.getElementById("details").close());
|
||||
document.getElementById("details").addEventListener("click", e => { if (e.target === e.currentTarget) e.currentTarget.close(); });
|
||||
render();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Automation Run Results</title>
|
||||
<style>
|
||||
:root { --ink:#172033; --muted:#64748b; --line:#dfe7f1; --panel:#fff; --bg:#f3f6fb; --success:#15803d; --success-soft:#dcfce7; --failure:#dc2626; --failure-soft:#fee2e2; --unknown:#64748b; --unknown-soft:#eef2f7; --brand:#175cd3; --shadow:0 14px 38px rgba(30,51,88,.09); }
|
||||
* { box-sizing:border-box; }
|
||||
body { margin:0; color:var(--ink); background:var(--bg); font:14px/1.45 Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
|
||||
button,input,select { font:inherit; }
|
||||
.shell { max-width:1560px; margin:0 auto; padding:28px; }
|
||||
.hero { display:flex; justify-content:space-between; align-items:flex-start; gap:24px; margin-bottom:20px; }
|
||||
h1 { margin:0 0 6px; font-size:clamp(28px,4vw,44px); letter-spacing:-.04em; line-height:1.05; }
|
||||
.sub { max-width:760px; color:var(--muted); }
|
||||
.source { margin-top:8px; color:#7c8aa0; font-size:12px; overflow-wrap:anywhere; }
|
||||
.nav { display:flex; gap:8px; margin-top:12px; }
|
||||
.nav a { color:#1649a5; background:#e8f0ff; border-radius:9px; padding:7px 10px; text-decoration:none; font-weight:700; }
|
||||
.stats { display:grid; grid-template-columns:repeat(4,minmax(110px,1fr)); gap:10px; }
|
||||
.stat { padding:13px 15px; border:1px solid var(--line); border-radius:14px; background:var(--panel); box-shadow:0 5px 18px rgba(30,51,88,.04); }
|
||||
.stat strong { display:block; font-size:23px; line-height:1; margin-bottom:5px; }
|
||||
.stat span { color:var(--muted); font-size:12px; }
|
||||
.toolbar { position:sticky; top:0; z-index:20; display:grid; grid-template-columns:minmax(220px,1.5fr) repeat(5,minmax(135px,.7fr)); gap:10px; padding:12px; margin-bottom:14px; background:rgba(243,246,251,.95); border:1px solid var(--line); border-radius:16px; backdrop-filter:blur(12px); }
|
||||
input,select { width:100%; padding:10px 12px; border:1px solid #cdd8e7; border-radius:10px; background:#fff; color:var(--ink); }
|
||||
.panel { overflow:auto; border:1px solid var(--line); border-radius:16px; background:#fff; box-shadow:var(--shadow); }
|
||||
.table-head,.row { min-width:1380px; display:grid; grid-template-columns:minmax(240px,1.3fr) 110px 175px 190px 150px 150px minmax(260px,1.4fr); gap:12px; align-items:start; }
|
||||
.table-head { position:relative; z-index:2; padding:12px 16px; color:#fff; background:#172033; font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; }
|
||||
.row { padding:14px 16px; border-bottom:1px solid var(--line); }
|
||||
.row:last-child { border-bottom:0; }
|
||||
.row:hover { background:#f8fafc; }
|
||||
.day-heading { min-width:1380px; grid-column:1/-1; padding:11px 16px; color:#fff; background:#587b91; border-bottom:1px solid #84a2b2; font-size:13px; font-weight:800; letter-spacing:.04em; }
|
||||
.name { font-weight:800; }
|
||||
.meta { margin-top:3px; color:var(--muted); font-size:12px; overflow-wrap:anywhere; }
|
||||
.result { display:inline-flex; align-items:center; gap:7px; width:fit-content; border-radius:999px; padding:5px 9px; font-weight:800; font-size:12px; }
|
||||
.result.success { color:#166534; background:var(--success-soft); }
|
||||
.result.failure { color:#991b1b; background:var(--failure-soft); }
|
||||
.result.unknown { color:#475569; background:var(--unknown-soft); }
|
||||
.mark { display:inline-flex; align-items:center; justify-content:center; width:18px; height:18px; color:#fff; border-radius:50%; line-height:1; }
|
||||
.success .mark { background:var(--success); } .failure .mark { background:var(--failure); } .unknown .mark { background:var(--unknown); }
|
||||
.empty { padding:36px; text-align:center; color:var(--muted); }
|
||||
.foot { margin:12px 2px 0; color:var(--muted); font-size:12px; }
|
||||
.embed-mode .shell { max-width:none; padding:0; }
|
||||
.embed-mode .hero, .embed-mode .toolbar, .embed-mode .foot { display:none; }
|
||||
.embed-mode .panel { border:0; border-radius:0; box-shadow:none; }
|
||||
@media (max-width:1050px) { .hero{flex-direction:column}.stats{width:100%}.toolbar{grid-template-columns:1fr 1fr}.toolbar input{grid-column:1/-1}.panel{overflow:auto}.table-head,.row{min-width:1380px} }
|
||||
@media (max-width:600px) { .stats{grid-template-columns:repeat(2,minmax(0,1fr))} }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main class="shell">
|
||||
<section class="hero">
|
||||
<div>
|
||||
<h1>Automation Run Results</h1>
|
||||
<div class="sub">A reusable operational view of the canonical automation status registry. The list retains a rolling three-day history, newest first. Managed automations are linked to the workbook; collected evidence exposes every available scheduler result.</div>
|
||||
<div class="source" id="source"></div>
|
||||
<nav class="nav"><a href="automations-calendar.html">Open calendar</a></nav>
|
||||
</div>
|
||||
<div class="stats" id="stats"></div>
|
||||
</section>
|
||||
<section class="toolbar" aria-label="Result filters">
|
||||
<input id="search" type="search" placeholder="Search automation, source, detail…" aria-label="Search run results">
|
||||
<select id="scope"><option value="managed">Managed automations</option><option value="unlinked">Unlinked evidence</option><option value="all">All records</option></select>
|
||||
<select id="outcome"><option value="">All outcomes</option><option value="success">Successful</option><option value="failure">Failed</option><option value="unknown">Unknown</option></select>
|
||||
<select id="sourceFilter"><option value="">All sources</option></select>
|
||||
<select id="project"><option value="">All projects</option></select>
|
||||
<select id="opsSegment"><option value="">All ops segments</option></select>
|
||||
</section>
|
||||
<section class="panel">
|
||||
<div class="table-head"><div>Automation</div><div>Result</div><div>Last run</div><div>Source</div><div>Project</div><div>Ops segment</div><div>Detail</div></div>
|
||||
<div id="rows"></div>
|
||||
</section>
|
||||
<div class="foot" id="foot"></div>
|
||||
</main>
|
||||
<script>
|
||||
if (new URLSearchParams(location.search).get("embed") === "table") document.body.classList.add("embed-mode");
|
||||
const data = __AUTOMATION_RESULTS_DATA__;
|
||||
const state = {search:"",scope:"managed",outcome:"",sourceFilter:"",project:"",opsSegment:""};
|
||||
const esc = value => String(value ?? "").replace(/[&<>"']/g,ch=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[ch]));
|
||||
const mark = outcome => outcome === "success" ? "✓" : outcome === "failure" ? "×" : "?";
|
||||
const dateText = value => { if(!value)return "Never / unavailable"; const date=new Date(value); return Number.isNaN(date.valueOf())?String(value):date.toLocaleString([], {dateStyle:"medium",timeStyle:"short"}); };
|
||||
const normalize = day => { const managed = day.managed.map(item=>({...item,outcome:item.run.outcome,lastRun:item.run.lastRun,detail:item.run.detail,source:item.run.source,linked:true})); const unlinked = day.evidence.filter(item=>!item.linked).map(item=>({...item,project:"",opsSegment:"",machine:"",location:"",automationStatus:""})); return {managed,unlinked,all:[...managed,...unlinked]}; };
|
||||
const days = (data.days||[]).map(day=>({...day,...normalize(day)}));
|
||||
const allDays = days.length ? days : [{date:"",generatedAt:data.generatedAt,managed:[],unlinked:[],all:[]}];
|
||||
const allRecords = allDays.flatMap(day=>day.all);
|
||||
const fill = (id,values) => { const select=document.getElementById(id); [...new Set(values.filter(Boolean))].sort((a,b)=>a.localeCompare(b)).forEach(value=>select.insertAdjacentHTML("beforeend",`<option>${esc(value)}</option>`)); };
|
||||
fill("sourceFilter",allRecords.map(item=>item.source)); fill("project",allDays.flatMap(day=>day.managed.map(item=>item.project))); fill("opsSegment",allDays.flatMap(day=>day.managed.map(item=>item.opsSegment)));
|
||||
function scoped(day){ return state.scope === "managed" ? day.managed : state.scope === "unlinked" ? day.unlinked : day.all; }
|
||||
function filtered(day){ const q=state.search.toLowerCase(); return scoped(day).filter(item=>(!state.outcome||item.outcome===state.outcome)&&(!state.sourceFilter||item.source===state.sourceFilter)&&(!state.project||item.project===state.project)&&(!state.opsSegment||item.opsSegment===state.opsSegment)&&(!q||[item.name,item.source,item.detail,item.project,item.opsSegment,item.machine,...(item.aliases||[])].join(" ").toLowerCase().includes(q))).sort((a,b)=>(b.lastRun?Date.parse(b.lastRun)||0:0)-(a.lastRun?Date.parse(a.lastRun)||0:0)||a.name.localeCompare(b.name)); }
|
||||
function renderStats(items){ const count=o=>items.filter(item=>item.outcome===o).length; document.getElementById("stats").innerHTML=`<div class="stat"><strong>${items.length}</strong><span>records across ${allDays.length} days</span></div><div class="stat"><strong>${count("success")}</strong><span>successful</span></div><div class="stat"><strong>${count("failure")}</strong><span>failed</span></div><div class="stat"><strong>${count("unknown")}</strong><span>unknown</span></div>`; }
|
||||
const rowHtml = item => `<article class="row"><div><div class="name">${esc(item.name)}</div><div class="meta">${esc(item.machine||item.location||((item.aliases||[]).join(", ")))}</div></div><div><span class="result ${item.outcome}"><i class="mark">${mark(item.outcome)}</i>${esc(item.outcome)}</span></div><div>${esc(dateText(item.lastRun))}</div><div>${esc(item.source)}</div><div>${esc(item.project||"—")}</div><div>${esc(item.opsSegment||"—")}</div><div>${esc(item.detail||"—")}</div></article>`;
|
||||
function render(){ const sections=allDays.map(day=>{ const items=filtered(day); return items.length?`<div class="day-heading">${esc(day.date)} · ${esc(dateText(day.generatedAt))}</div>${items.map(rowHtml).join("")}`:""; }).join(""); const visible=allDays.flatMap(day=>filtered(day)); renderStats(allRecords); document.getElementById("rows").innerHTML=sections||'<div class="empty">No results match these filters.</div>'; document.getElementById("foot").textContent=`Showing ${visible.length} of ${allRecords.length} records across ${allDays.length} days. Newest day appears first; history is retained for three days.`; }
|
||||
document.getElementById("source").textContent=`Registry: ${data.statusRegistry} · ${data.workbookRange} · Generated ${dateText(data.generatedAt)}`;
|
||||
document.getElementById("search").addEventListener("input",e=>{state.search=e.target.value;render()}); ["scope","outcome","sourceFilter","project","opsSegment"].forEach(id=>document.getElementById(id).addEventListener("change",e=>{state[id]=e.target.value;render()})); render();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
$ErrorActionPreference='Stop'
|
||||
. (Join-Path $PSScriptRoot "../scripts/workflow-run-status.ps1")
|
||||
$root=Join-Path ([IO.Path]::GetTempPath()) ('workflow-status-'+[guid]::NewGuid().ToString('N'))
|
||||
[void][IO.Directory]::CreateDirectory((Join-Path $root 'receipts'))
|
||||
[void][IO.Directory]::CreateDirectory((Join-Path $root 'outputs'))
|
||||
$now=Get-Date
|
||||
$logDir=Join-Path $root ('logs/{0}/{1:D2}/{2:D2}' -f $now.Year,$now.Month,$now.Day)
|
||||
[void][IO.Directory]::CreateDirectory($logDir)
|
||||
$report=Join-Path $root 'outputs\report.md'
|
||||
Set-Content -LiteralPath $report -Value '# Verified fixture report'
|
||||
$receiptPath=Join-Path $root 'receipts\run.json'
|
||||
$r=@{skill=@{name='workflow-demo'}; finished_at=(Get-Date).AddMinutes(-5).ToString('o');status='success';validation=@{deterministic='pass';manual='pass'};artifacts=@{report='outputs/report.md';checkpoint_advanced=$true};failures=@()}
|
||||
function Save-Fixture { $r | ConvertTo-Json -Depth 5 | Set-Content -LiteralPath $receiptPath }
|
||||
function Check-Outcome($expected) { $actual=Get-WorkflowRunStatus -WorkflowId workflow-demo -Repository $root -LogRoot (Join-Path $root 'logs'); if($actual.outcome -ne $expected){throw "Expected $expected, got $($actual.outcome)"} }
|
||||
Save-Fixture; Check-Outcome 'success'
|
||||
$r.status='failed'; $r.failures=@('Search unavailable'); Save-Fixture; Check-Outcome 'failure'
|
||||
$r.status='success'; $r.failures=@(); $r.validation.manual='fail'; Save-Fixture; Check-Outcome 'unknown'
|
||||
$r.validation.manual='pass'; Save-Fixture
|
||||
Set-Content -LiteralPath (Join-Path $logDir 'test.log') -Value ((Get-Date).AddMinutes(-2).ToUniversalTime().ToString('o')+' warning [automations] Scheduled run failed automationId=workflow-demo errorMessage="Backend timeout"')
|
||||
Check-Outcome 'failure'
|
||||
$r.finished_at=(Get-Date).ToString('o'); Save-Fixture; Check-Outcome 'success'
|
||||
Write-Output 'Passed five receipt/scheduler status cases.'
|
||||
@@ -0,0 +1,110 @@
|
||||
"""Offline tests of workbook parsing, evidence matching, rendering and leak guardrails."""
|
||||
import copy
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from zipfile import ZipFile, ZIP_DEFLATED
|
||||
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0,str(ROOT/'scripts'))
|
||||
from create_example_workbook import create_workbook, HEADERS, ROWS
|
||||
from build_automations_calendar import read_workflow_rows, read_statuses, attach_statuses, update_html, DAYS
|
||||
from build_automation_results import build_payload, write_dashboard, DEFAULT_TEMPLATE
|
||||
from check_publication import sensitive_findings
|
||||
|
||||
class DashboardTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.temp=tempfile.TemporaryDirectory()
|
||||
self.addCleanup(self.temp.cleanup)
|
||||
self.root=Path(self.temp.name)
|
||||
self.workbook=self.root/'schedule.xlsx'
|
||||
create_workbook(self.workbook)
|
||||
self.status=ROOT/'examples/status.example.json'
|
||||
|
||||
def test_workbook_order_and_nested_weekdays(self):
|
||||
records,used=read_workflow_rows(self.workbook)
|
||||
self.assertEqual(used,'A1:M4')
|
||||
self.assertEqual([r['opsSegment'] for r in records],['Marketing','Strategy','Systems'])
|
||||
self.assertTrue(all(tuple(r['schedule'])==DAYS for r in records))
|
||||
self.assertEqual(records[0]['schedule']['Mon']['minutes'],540)
|
||||
self.assertEqual(records[1]['schedule']['Wed']['cadence'],'Hourly')
|
||||
|
||||
def test_alias_invalid_outcome_and_unmatched_unknown(self):
|
||||
records,_=read_workflow_rows(self.workbook)
|
||||
path=self.root/'status.json'
|
||||
path.write_text(json.dumps({'records':[{'name':'other','aliases':['Demo report'],'outcome':'success'},{'name':'Demo review','outcome':'invalid'}]}))
|
||||
attach_statuses(records,read_statuses(path))
|
||||
self.assertEqual([r['run']['outcome'] for r in records],['success','unknown','unknown'])
|
||||
self.assertEqual(records[-1]['run']['source'],'none')
|
||||
|
||||
def test_results_current_status_and_history_limit(self):
|
||||
status=json.loads(self.status.read_text())
|
||||
status['history']=[{'date':f'2026-01-0{i}','records':status['records']} for i in range(1,6)]
|
||||
path=self.root/'status.json'; path.write_text(json.dumps(status))
|
||||
payload=build_payload(self.workbook,path)
|
||||
self.assertEqual({r['run']['outcome'] for r in payload['managed']},{'success','failure','unknown'})
|
||||
self.assertEqual([x['date'] for x in payload['days']],['2026-01-05','2026-01-04','2026-01-03'])
|
||||
self.assertTrue(all(x['linked'] for x in payload['evidence']))
|
||||
self.assertNotIn(str(self.root),json.dumps(payload))
|
||||
|
||||
def test_unlinked_evidence_is_preserved(self):
|
||||
status=json.loads(self.status.read_text()); status['records'].append({'name':'Extra demo','outcome':'failure'})
|
||||
path=self.root/'status.json'; path.write_text(json.dumps(status))
|
||||
payload=build_payload(self.workbook,path)
|
||||
self.assertEqual(len(payload['managed']),3)
|
||||
self.assertEqual(len(payload['evidence']),4)
|
||||
self.assertFalse(payload['evidence'][-1]['linked'])
|
||||
|
||||
def test_render_escapes_script_close_and_preserves_backslashes(self):
|
||||
rows=copy.deepcopy(ROWS)
|
||||
dangerous='</script><script>alert(1)</script> '+chr(92)+'folder'+chr(92)+'notes'
|
||||
rows[0][0]=dangerous
|
||||
create_workbook(self.workbook,rows)
|
||||
records,used=read_workflow_rows(self.workbook)
|
||||
attach_statuses(records,{})
|
||||
calendar=self.root/'output/calendar.html'
|
||||
update_html(calendar,records,used,self.workbook)
|
||||
text=calendar.read_text(encoding='utf-8')
|
||||
self.assertNotIn(dangerous,text)
|
||||
encoded=re.search(r'const automations = (.*?);\n const days',text,re.S).group(1)
|
||||
self.assertEqual(json.loads(encoded)[0]['name'],dangerous)
|
||||
self.assertNotIn(str(self.root),text)
|
||||
payload=build_payload(self.workbook,self.status)
|
||||
result=self.root/'output/results.html'
|
||||
write_dashboard(DEFAULT_TEMPLATE,result,payload)
|
||||
text=result.read_text(encoding='utf-8')
|
||||
self.assertNotIn(dangerous,text)
|
||||
self.assertNotIn('__AUTOMATION_RESULTS_DATA__',text)
|
||||
encoded=re.search(r'const data = (.*?);\n const state',text,re.S).group(1)
|
||||
self.assertEqual(json.loads(encoded)['managed'][0]['name'],dangerous)
|
||||
|
||||
def test_empty_worksheet(self):
|
||||
with ZipFile(self.workbook) as z: entries={name:z.read(name) for name in z.namelist()}
|
||||
entries['xl/worksheets/sheet1.xml']=b'<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetData/></worksheet>'
|
||||
with ZipFile(self.workbook,'w',ZIP_DEFLATED) as z:
|
||||
for name,body in entries.items(): z.writestr(name,body)
|
||||
self.assertEqual(read_workflow_rows(self.workbook),([], 'A1:A1'))
|
||||
|
||||
def test_missing_required_headers_fail(self):
|
||||
create_workbook(self.workbook,rows=[],headers=['Name'])
|
||||
with self.assertRaisesRegex(ValueError,'missing required columns'): read_workflow_rows(self.workbook)
|
||||
|
||||
def test_missing_status_is_unknown(self):
|
||||
records,_=read_workflow_rows(self.workbook)
|
||||
attach_statuses(records,read_statuses(self.root/'missing.json'))
|
||||
self.assertTrue(all(x['run']['outcome']=='unknown' for x in records))
|
||||
|
||||
def test_publication_guardrails_detect_generic_leaks(self):
|
||||
host='example.org'
|
||||
private_path='Z'+':'+chr(92)+'Users'+chr(92)+'sample'
|
||||
self.assertIn('absolute Windows path',sensitive_findings(private_path,host))
|
||||
email='someone'+'@'+'private.invalid'
|
||||
self.assertIn('non-example email',sensitive_findings(email,host))
|
||||
assignment='api_key'+' = '+repr('a'*25)
|
||||
self.assertIn('literal credential assignment',sensitive_findings(assignment,host))
|
||||
self.assertEqual(sensitive_findings('https://example.org/demo',host),[])
|
||||
|
||||
if __name__=='__main__': unittest.main()
|
||||
Reference in new issue
Block a user