-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
🚀 Feature Request Description
I propose adding an extensible Hook capability to OpenSpec's /opsx:archive supportcommand. This would allow us to inject custom consolidation logic when a specification (spec) is archived, meeting project-specific post-processing requirements.
📜 Context & Motivation
Currently, OpenSpec's archiving operation might be a relatively closed process. However, in practical use, we often need to perform deeper consolidation work based on archived changes.
A typical scenario is Error Log Management:
OpenSpec may generate an "error log" recording issues during Schema definition and execution. When certain problems are fixed by modifying the Schema, we hope that during the archiving of these changes, we can:
Automatically Identify: Associate the "errors" fixed by this archival.
Update Status: Move these "errors" from the "to-be-fixed" list to the "fixed" historical archive.
Organize Metadata: Perhaps also tag the fixed errors with version, archiving time, etc.
Without a Hook mechanism, this consolidation work requires manual effort or relies on external scripts that are difficult to synchronize atomically with the archiving process, making errors or omissions likely.
💡 Proposed Solution
I suggest referencing common CI/CD or Git Hook designs, reserving the ability to execute user-defined scripts at key nodes in the archiving workflow.
Hook Types:
pre-archiveHook: Triggered beforethe archive operation executes. Can be used for validation, data preparation, or preliminary consolidation.
post-archiveHook: Triggered afterthe archive operation completes. Ideal for follow-up actions like updating the error log, generating reports, sending notifications, etc.
Configuration Method:
The path to the Hook scripts could be specified in OpenSpec's configuration file (e.g., config.yaml).