@clawplays/ospec-cli 0.4.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/README.md +36 -60
  2. package/SKILL.md +3 -0
  3. package/assets/for-ai/en-US/ai-guide.md +5 -32
  4. package/assets/for-ai/en-US/execution-protocol.md +5 -7
  5. package/assets/global-skills/claude/ospec-change/SKILL.md +4 -5
  6. package/assets/global-skills/codex/ospec-change/SKILL.md +4 -5
  7. package/assets/global-skills/codex/ospec-change/agents/openai.yaml +1 -1
  8. package/assets/global-skills/codex/ospec-change/skill.yaml +1 -3
  9. package/assets/plugins/registry.json +47 -0
  10. package/assets/project-conventions/en-US/workflow-conventions.md +1 -2
  11. package/dist/advanced/BatchOperations.d.ts +1 -1
  12. package/dist/advanced/BatchOperations.js +1 -1
  13. package/dist/advanced/CachingLayer.d.ts +13 -13
  14. package/dist/advanced/CachingLayer.js +16 -16
  15. package/dist/advanced/FeatureUpdater.d.ts +9 -9
  16. package/dist/advanced/FeatureUpdater.js +14 -14
  17. package/dist/advanced/PerformanceMonitor.d.ts +10 -10
  18. package/dist/advanced/PerformanceMonitor.js +11 -11
  19. package/dist/advanced/StatePersistence.d.ts +11 -11
  20. package/dist/advanced/StatePersistence.js +15 -15
  21. package/dist/advanced/index.d.ts +2 -2
  22. package/dist/advanced/index.js +2 -2
  23. package/dist/cli.d.ts +1 -1
  24. package/dist/cli.js +18 -4
  25. package/dist/commands/ArchiveCommand.d.ts +3 -1
  26. package/dist/commands/ArchiveCommand.js +84 -6
  27. package/dist/commands/BaseCommand.d.ts +8 -8
  28. package/dist/commands/BaseCommand.js +7 -7
  29. package/dist/commands/BatchCommand.d.ts +1 -1
  30. package/dist/commands/BatchCommand.js +1 -1
  31. package/dist/commands/ChangesCommand.js +1 -1
  32. package/dist/commands/DocsCommand.d.ts +1 -1
  33. package/dist/commands/DocsCommand.js +1 -1
  34. package/dist/commands/FinalizeCommand.js +1 -1
  35. package/dist/commands/IndexCommand.d.ts +1 -1
  36. package/dist/commands/IndexCommand.js +1 -1
  37. package/dist/commands/InitCommand.d.ts +1 -1
  38. package/dist/commands/InitCommand.js +1 -1
  39. package/dist/commands/LayoutCommand.d.ts +9 -0
  40. package/dist/commands/LayoutCommand.js +225 -0
  41. package/dist/commands/NewCommand.d.ts +1 -1
  42. package/dist/commands/NewCommand.js +59 -20
  43. package/dist/commands/PluginsCommand.d.ts +29 -3
  44. package/dist/commands/PluginsCommand.js +1217 -37
  45. package/dist/commands/ProgressCommand.d.ts +1 -1
  46. package/dist/commands/ProgressCommand.js +5 -2
  47. package/dist/commands/QueueCommand.d.ts +1 -1
  48. package/dist/commands/QueueCommand.js +1 -1
  49. package/dist/commands/RunCommand.d.ts +1 -1
  50. package/dist/commands/RunCommand.js +1 -1
  51. package/dist/commands/SkillCommand.d.ts +1 -1
  52. package/dist/commands/SkillCommand.js +23 -17
  53. package/dist/commands/SkillsCommand.d.ts +1 -1
  54. package/dist/commands/SkillsCommand.js +1 -1
  55. package/dist/commands/StatusCommand.d.ts +1 -1
  56. package/dist/commands/StatusCommand.js +8 -4
  57. package/dist/commands/UpdateCommand.d.ts +7 -1
  58. package/dist/commands/UpdateCommand.js +262 -27
  59. package/dist/commands/VerifyCommand.d.ts +2 -1
  60. package/dist/commands/VerifyCommand.js +80 -3
  61. package/dist/commands/WorkflowCommand.d.ts +3 -3
  62. package/dist/commands/WorkflowCommand.js +5 -5
  63. package/dist/commands/index.d.ts +3 -4
  64. package/dist/commands/index.js +5 -5
  65. package/dist/core/constants.d.ts +1 -1
  66. package/dist/core/constants.js +1 -1
  67. package/dist/core/errors.d.ts +2 -2
  68. package/dist/core/errors.js +2 -2
  69. package/dist/core/index.d.ts +2 -2
  70. package/dist/core/index.js +2 -2
  71. package/dist/core/types.d.ts +9 -5
  72. package/dist/core/types.js +1 -1
  73. package/dist/index.d.ts +2 -2
  74. package/dist/index.js +2 -2
  75. package/dist/presets/ProjectPresets.d.ts +1 -1
  76. package/dist/presets/ProjectPresets.js +1 -1
  77. package/dist/scaffolds/ProjectScaffoldPresets.d.ts +1 -1
  78. package/dist/scaffolds/ProjectScaffoldPresets.js +1 -1
  79. package/dist/services/ConfigManager.d.ts +1 -1
  80. package/dist/services/ConfigManager.js +271 -3
  81. package/dist/services/FileService.d.ts +2 -2
  82. package/dist/services/FileService.js +2 -2
  83. package/dist/services/IndexBuilder.d.ts +2 -1
  84. package/dist/services/IndexBuilder.js +24 -6
  85. package/dist/services/Logger.d.ts +2 -2
  86. package/dist/services/Logger.js +2 -2
  87. package/dist/services/PluginRegistryService.d.ts +175 -0
  88. package/dist/services/PluginRegistryService.js +1006 -0
  89. package/dist/services/ProjectAssetRegistry.d.ts +1 -1
  90. package/dist/services/ProjectAssetRegistry.js +1 -1
  91. package/dist/services/ProjectAssetService.d.ts +7 -4
  92. package/dist/services/ProjectAssetService.js +29 -22
  93. package/dist/services/ProjectScaffoldCommandService.d.ts +1 -1
  94. package/dist/services/ProjectScaffoldCommandService.js +1 -1
  95. package/dist/services/ProjectScaffoldService.d.ts +1 -1
  96. package/dist/services/ProjectScaffoldService.js +1 -1
  97. package/dist/services/ProjectService.d.ts +6 -1
  98. package/dist/services/ProjectService.js +134 -89
  99. package/dist/services/QueueService.d.ts +2 -1
  100. package/dist/services/QueueService.js +19 -4
  101. package/dist/services/RunService.d.ts +2 -1
  102. package/dist/services/RunService.js +25 -9
  103. package/dist/services/SkillParser.d.ts +5 -5
  104. package/dist/services/SkillParser.js +5 -5
  105. package/dist/services/StateManager.d.ts +1 -1
  106. package/dist/services/StateManager.js +1 -1
  107. package/dist/services/TemplateEngine.d.ts +1 -1
  108. package/dist/services/TemplateEngine.js +1 -1
  109. package/dist/services/TemplateGenerator.d.ts +11 -11
  110. package/dist/services/TemplateGenerator.js +22 -22
  111. package/dist/services/ValidationService.d.ts +5 -5
  112. package/dist/services/ValidationService.js +5 -5
  113. package/dist/services/index.d.ts +2 -2
  114. package/dist/services/index.js +10 -3
  115. package/dist/services/templates/ExecutionTemplateBuilder.d.ts +1 -1
  116. package/dist/services/templates/ExecutionTemplateBuilder.js +1 -1
  117. package/dist/services/templates/ProjectTemplateBuilder.d.ts +1 -1
  118. package/dist/services/templates/ProjectTemplateBuilder.js +3 -3
  119. package/dist/services/templates/TemplateBuilderBase.d.ts +1 -1
  120. package/dist/services/templates/TemplateBuilderBase.js +1 -1
  121. package/dist/services/templates/TemplateInputFactory.d.ts +1 -1
  122. package/dist/services/templates/TemplateInputFactory.js +1 -1
  123. package/dist/services/templates/templateTypes.d.ts +1 -1
  124. package/dist/services/templates/templateTypes.js +1 -1
  125. package/dist/tools/build-index.js +55 -11
  126. package/dist/utils/DateUtils.d.ts +5 -5
  127. package/dist/utils/DateUtils.js +5 -5
  128. package/dist/utils/PathUtils.d.ts +7 -3
  129. package/dist/utils/PathUtils.js +15 -5
  130. package/dist/utils/ProjectLayout.d.ts +8 -0
  131. package/dist/utils/ProjectLayout.js +102 -0
  132. package/dist/utils/StringUtils.d.ts +7 -7
  133. package/dist/utils/StringUtils.js +7 -7
  134. package/dist/utils/helpers.d.ts +1 -1
  135. package/dist/utils/helpers.js +1 -1
  136. package/dist/utils/index.d.ts +2 -2
  137. package/dist/utils/index.js +2 -2
  138. package/dist/utils/subcommandHelp.d.ts +1 -1
  139. package/dist/utils/subcommandHelp.js +7 -2
  140. package/dist/workflow/ArchiveGate.d.ts +1 -1
  141. package/dist/workflow/ArchiveGate.js +1 -1
  142. package/dist/workflow/ConfigurableWorkflow.d.ts +15 -15
  143. package/dist/workflow/ConfigurableWorkflow.js +16 -16
  144. package/dist/workflow/HookSystem.d.ts +8 -8
  145. package/dist/workflow/HookSystem.js +9 -9
  146. package/dist/workflow/IndexRegenerator.d.ts +8 -8
  147. package/dist/workflow/IndexRegenerator.js +12 -12
  148. package/dist/workflow/PluginWorkflowComposer.d.ts +1 -1
  149. package/dist/workflow/PluginWorkflowComposer.js +38 -50
  150. package/dist/workflow/SkillUpdateEngine.d.ts +1 -1
  151. package/dist/workflow/SkillUpdateEngine.js +1 -1
  152. package/dist/workflow/VerificationSystem.d.ts +1 -1
  153. package/dist/workflow/VerificationSystem.js +1 -1
  154. package/dist/workflow/WorkflowEngine.d.ts +1 -1
  155. package/dist/workflow/WorkflowEngine.js +1 -1
  156. package/dist/workflow/index.d.ts +2 -2
  157. package/dist/workflow/index.js +2 -2
  158. package/package.json +4 -13
  159. package/skill.yaml +0 -1
  160. package/dist/adapters/codex-stitch-adapter.js +0 -420
  161. package/dist/adapters/gemini-stitch-adapter.js +0 -408
  162. package/dist/adapters/playwright-checkpoint-adapter.js +0 -2205
  163. package/dist/cli/commands/config.d.ts +0 -4
  164. package/dist/cli/commands/config.js +0 -5
  165. package/dist/cli/commands/feature.d.ts +0 -4
  166. package/dist/cli/commands/feature.js +0 -5
  167. package/dist/cli/commands/index.d.ts +0 -4
  168. package/dist/cli/commands/index.js +0 -5
  169. package/dist/cli/commands/project.d.ts +0 -4
  170. package/dist/cli/commands/project.js +0 -5
  171. package/dist/cli/commands/validate.d.ts +0 -4
  172. package/dist/cli/commands/validate.js +0 -5
  173. package/dist/cli/index.d.ts +0 -4
  174. package/dist/cli/index.js +0 -5
  175. package/dist/services/FeatureManager.d.ts +0 -4
  176. package/dist/services/FeatureManager.js +0 -5
  177. package/dist/services/Validator.d.ts +0 -4
  178. package/dist/services/Validator.js +0 -5
  179. package/dist/utils/logger.d.ts +0 -4
  180. package/dist/utils/logger.js +0 -5
  181. package/dist/utils/path.d.ts +0 -4
  182. package/dist/utils/path.js +0 -5
package/README.md CHANGED
@@ -23,13 +23,13 @@
23
23
 
24
24
  The official OSpec CLI package is `@clawplays/ospec-cli`, and the official command is `ospec`. OSpec supports spec-driven development (SDD) and document-driven development for AI coding agents and CLI workflows.
25
25
 
26
- OSpec.ai is the official project site. `OSpec`, `ospec`, `ospec.ai`, `ospec ai`, `ospecai`, and `ospec-ai` all point to the same official project and CLI.
27
-
28
26
  <p align="center">
29
27
  <a href="docs/prompt-guide.md">Prompt Guide</a> |
30
28
  <a href="docs/usage.md">Usage</a> |
31
29
  <a href="docs/project-overview.md">Overview</a> |
32
30
  <a href="docs/installation.md">Installation</a> |
31
+ <a href="docs/external-plugins.md">External Plugins</a> |
32
+ <a href="docs/plugin-release.md">Plugin Release</a> |
33
33
  <a href="https://github.com/clawplays/ospec/issues">Issues</a>
34
34
  </p>
35
35
 
@@ -91,8 +91,10 @@ CLI notes:
91
91
  - `--architecture`: short architecture description
92
92
  - `--document-language`: generated doc language, choose from `en-US`, `zh-CN`, `ja-JP`, or `ar`
93
93
  - AI-first language resolution order: explicit language request in the conversation -> current conversation language -> persisted project language in `.skillrc`
94
- - CLI language resolution order: explicit `--document-language` -> persisted project language in `.skillrc` -> existing project docs / `for-ai/*` / asset manifest -> fallback `en-US`
94
+ - CLI language resolution order: explicit `--document-language` -> persisted project language in `.skillrc` -> existing project docs / managed `for-ai/*` guidance / asset manifest -> fallback `en-US`
95
95
  - OSpec persists the chosen project document language in `.skillrc` and reuses it for `for-ai` guidance, `ospec new`, and `ospec update`
96
+ - new projects initialized by `ospec init` default to the nested layout: root `.skillrc` and `README.md`, with OSpec-managed files under `.ospec/`
97
+ - CLI commands still accept shorthand like `changes/active/<change-name>`, but the physical path in nested projects is `.ospec/changes/active/<change-name>`
96
98
  - if you pass these values, OSpec uses them directly when generating project docs
97
99
  - if you do not pass them, OSpec reuses existing docs when possible and otherwise creates placeholder docs first
98
100
 
@@ -154,7 +156,8 @@ Archive notes:
154
156
  - run your project-specific deploy, test, and QA flow first
155
157
  - use `ospec verify` to confirm the active change is ready
156
158
  - use `ospec finalize` to rebuild indexes and archive the accepted change
157
- - new projects archive under `changes/archived/YYYY-MM/YYYY-MM-DD/<change-name>`; existing flat archives are reorganized by `ospec update`
159
+ - new nested projects archive under `.ospec/changes/archived/YYYY-MM/YYYY-MM-DD/<change-name>`; CLI shorthand under `changes/archived/...` still works
160
+ - existing flat archives are reorganized by `ospec update`
158
161
 
159
162
  </details>
160
163
 
@@ -167,6 +170,11 @@ ospec update
167
170
  ```
168
171
 
169
172
  `ospec update` also migrates legacy root-level `build-index-auto.cjs` / `build-index-auto.js` tooling into `.ospec/tools/build-index-auto.cjs` and refreshes OSpec-managed hook entrypoints to use the new location.
173
+ It also repairs older OSpec projects that still have an OSpec footprint but are missing newer core runtime directories, refreshes managed skills and archive layout metadata, and syncs project assets for already-enabled plugins.
174
+ When an already-enabled plugin has a newer compatible npm package version available, `ospec update` upgrades that global plugin package automatically and prints the version transition.
175
+ It does not upgrade the CLI itself, and it does not enable plugins or migrate active / queued changes automatically.
176
+ It also does not switch a classic project layout to nested automatically.
177
+ If you want to convert an older classic project to the new layout, run `ospec layout migrate --to nested` explicitly.
170
178
 
171
179
  ## How The OSpec Workflow Works
172
180
 
@@ -181,10 +189,11 @@ ospec update
181
189
  │ 2. INIT TO CHANGE-READY │
182
190
  │ ospec init │
183
191
  │ - .skillrc │
192
+ │ - README.md │
184
193
  │ - .ospec/ │
185
- │ - changes/active + changes/archived
186
- │ - root SKILL files and for-ai guidance
187
- │ - docs/project/* baseline knowledge docs
194
+ │ - .ospec/changes/active + .ospec/changes/archived
195
+ │ - .ospec/SKILL.md + .ospec/SKILL.index.json + .ospec/for-ai│
196
+ │ - .ospec/docs/project/* baseline knowledge docs
188
197
  │ - reuse docs or fall back to placeholders │
189
198
  └─────────────────────────────────────────────────────────────────┘
190
199
 
@@ -214,7 +223,7 @@ ospec update
214
223
 
215
224
  | Concept | What It Means |
216
225
  |---------|---------------|
217
- | **Protocol Shell** | The minimum collaboration skeleton: `.skillrc`, `.ospec/`, `changes/`, root `SKILL.md`, `SKILL.index.json`, and `for-ai/` guidance. |
226
+ | **Protocol Shell** | The minimum collaboration skeleton: root `.skillrc` and `README.md`, plus managed OSpec files under `.ospec/` for change state, SKILL docs, index state, `for-ai/` guidance, and project docs. |
218
227
  | **Project Knowledge Layer** | Explicit project context such as `docs/project/*`, layered skill files, and index state that AI can read consistently. |
219
228
  | **Active Change** | A dedicated execution container for one requirement, usually with `proposal.md`, `tasks.md`, `state.json`, `verification.md`, and `review.md`. |
220
229
 
@@ -226,70 +235,40 @@ ospec update
226
235
  - **Docs maintenance**: `ospec docs generate` refreshes or repairs project knowledge docs when you need it later.
227
236
  - **Tracked requirement execution**: each change can keep proposal, tasks, state, verification, and review files aligned.
228
237
  - **Queue helpers**: `queue` and `run` support explicit multi-change execution when one active change is not enough.
229
- - **Plugin workflow gates**: built-in plugin commands support Stitch design review and Checkpoint automation.
238
+ - **Plugin workflow gates**: plugin commands support Stitch design review and Checkpoint automation through npm-installed official plugins.
230
239
  - **Skill management**: install and inspect OSpec skills for Codex and Claude Code.
231
240
  - **Standard closeout**: `finalize` verifies, rebuilds indexes, and archives the change before manual Git commit.
232
241
 
233
- ## Plugin Features
234
-
235
- OSpec includes two optional plugins that extend the document-driven workflow with UI review and flow validation.
236
-
237
- ### Stitch
242
+ ## Plugin Installation
238
243
 
239
- Use Stitch for page design review and preview collaboration, especially for landing pages, marketing pages, and UI-heavy changes.
240
-
241
- AI conversation:
244
+ OSpec supports plugins for UI review and runtime validation.
245
+ Keep the public flow simple:
242
246
 
243
247
  ```text
244
- OSpec, enable the Stitch plugin and connect using Codex/Gemini.
248
+ $ospec open Stitch for this project.
249
+ $ospec open Checkpoint for this project.
245
250
  ```
246
251
 
247
- Claude / Codex skill mode:
252
+ In AI / `$ospec` flows, requests like "open Stitch" or "open Checkpoint" should be handled as: check whether the plugin is already installed globally, install only when missing, then enable it in the current project.
248
253
 
249
- ```text
250
- $ospec enable the Stitch plugin and connect using Codex/Gemini.
251
- ```
252
-
253
- <details>
254
- <summary>Command line</summary>
254
+ Command line fallback:
255
255
 
256
256
  ```bash
257
+ ospec plugins list
258
+ ospec plugins install stitch
257
259
  ospec plugins enable stitch .
258
- ```
259
-
260
- </details>
261
-
262
- ### Checkpoint
263
-
264
- Use Checkpoint for app flow validation and automated checks, especially for submission flows, critical paths, and pre-acceptance runtime verification.
265
-
266
- AI conversation:
267
-
268
- ```text
269
- OSpec, enable the Checkpoint plugin.
270
- ```
271
-
272
- Claude / Codex skill mode:
273
-
274
- ```text
275
- $ospec enable the Checkpoint plugin.
276
- ```
277
-
278
- <details>
279
- <summary>Command line</summary>
280
-
281
- ```bash
260
+ ospec plugins install checkpoint
282
261
  ospec plugins enable checkpoint . --base-url http://127.0.0.1:3000
283
262
  ```
284
263
 
285
- Notes:
264
+ Official npm plugin packages:
286
265
 
287
- - `--base-url` points to the running app used by automated checks
288
- - Enabling the built-in Checkpoint runner automatically installs `playwright`, `pixelmatch`, and `pngjs` into the target project
289
- - If a user asks an AI assistant to enable Checkpoint, that install step must complete before the plugin should be considered successfully enabled
290
- - Disabling Checkpoint only turns off the plugin configuration; it does not uninstall those project dependencies
266
+ - `@clawplays/ospec-plugin-stitch`
267
+ - `@clawplays/ospec-plugin-checkpoint`
291
268
 
292
- </details>
269
+ After a plugin is enabled, its detailed setup docs are synced into `.ospec/plugins/<plugin>/docs/`.
270
+
271
+ Maintainers can find plugin publishing and automation details in `docs/plugin-release.md`.
293
272
 
294
273
  ## Documentation
295
274
 
@@ -300,11 +279,8 @@ Notes:
300
279
  - [Project Overview](docs/project-overview.md)
301
280
  - [Installation](docs/installation.md)
302
281
  - [Skills Installation](docs/skills-installation.md)
303
-
304
- ### Plugin Specs
305
-
306
- - [Stitch Plugin Spec](docs/stitch-plugin-spec.md)
307
- - [Checkpoint Plugin Spec](docs/checkpoint-plugin-spec.md)
282
+ - [External Plugins](docs/external-plugins.md)
283
+ - [Plugin Release](docs/plugin-release.md)
308
284
 
309
285
  ## Repository Structure
310
286
 
package/SKILL.md CHANGED
@@ -198,6 +198,9 @@ ospec run status [path]
198
198
  ospec run step [path]
199
199
  ospec run resume [path]
200
200
  ospec run stop [path]
201
+ ospec plugins available
202
+ ospec plugins info <plugin>
203
+ ospec plugins install <plugin>
201
204
  ospec plugins status [path]
202
205
  ospec plugins approve stitch [changes/active/<change>]
203
206
  ospec plugins reject stitch [changes/active/<change>]
@@ -18,7 +18,7 @@ This document is the project-adopted AI guide copied from the OSpec mother spec.
18
18
  4. Read the relevant `SKILL.md` files
19
19
  5. Read the current change execution files
20
20
  6. If Stitch is enabled and the current change activates `stitch_design_review`, inspect `artifacts/stitch/approval.json` first
21
- 7. If you need to handle Stitch or Checkpoint installation, provider switching, doctor remediation, MCP setup, auth setup, or plugin enablement, read the repo-local localized plugin spec that matches the project document language first; only fall back when that language-specific file is missing
21
+ 7. If you need to handle Stitch or Checkpoint installation, provider switching, doctor remediation, MCP setup, auth setup, or plugin enablement, read the repo-local localized plugin docs under `.ospec/plugins/<plugin>/docs/` first; if they are missing, install or enable the plugin to sync its docs before changing config
22
22
 
23
23
  ## Required Behavior
24
24
 
@@ -41,7 +41,7 @@ This document is the project-adopted AI guide copied from the OSpec mother spec.
41
41
  - If the project uses a custom runner and `token_env` is configured, confirm the matching environment variable is set before running
42
42
  - If the runner, Gemini CLI, Codex CLI, stitch MCP, or auth readiness is unclear, run `ospec plugins doctor stitch <project-path>` first
43
43
  - If `plugins doctor stitch` reports non-PASS for the selected provider checks, prompt the user to install the required CLI and complete the stitch MCP / API token setup in the matching user config
44
- - For Stitch installation, provider switching, doctor remediation, MCP setup, or auth setup, read the repo-local localized Stitch spec first; copy the documented Gemini / Codex config shape instead of inventing a `command` / `args` / `env` or stdio-proxy workaround just to satisfy doctor
44
+ - For Stitch installation, provider switching, doctor remediation, MCP setup, or auth setup, read `.ospec/plugins/stitch/docs/` first and follow the plugin's documented config shape instead of inventing a `command` / `args` / `env` or stdio-proxy workaround just to satisfy doctor
45
45
  - If the built-in `codex` provider succeeds on read-only calls but `create_project`, `generate_screen`, or `edit_screens` stalls locally, first verify the run actually uses `codex exec --dangerously-bypass-approvals-and-sandbox`
46
46
  - If the project explicitly overrides `.skillrc.plugins.stitch.runner` and Codex still performs Stitch writes, the custom runner / wrapper must also pass `--dangerously-bypass-approvals-and-sandbox`
47
47
  - Sync `SKILL.md` after meaningful code changes
@@ -54,37 +54,10 @@ This document is the project-adopted AI guide copied from the OSpec mother spec.
54
54
  - Workflow conventions: `docs/project/workflow-conventions.md`
55
55
  - Development guide: `docs/project/development-guide.md`
56
56
 
57
- ## Stitch Provider Baseline
57
+ ## Stitch Provider Docs
58
58
 
59
- - When the repo contains a localized Stitch plugin spec that matches the project document language, use its original config snippets first.
60
- - When the repo does not contain that spec and the built-in Stitch provider must be enabled, use these baselines.
61
- - `gemini`: edit `%USERPROFILE%/.gemini/settings.json` and use `mcpServers.stitch.httpUrl` plus `headers.X-Goog-Api-Key`.
62
-
63
- ```json
64
- {
65
- "mcpServers": {
66
- "stitch": {
67
- "httpUrl": "https://stitch.googleapis.com/mcp",
68
- "headers": {
69
- "X-Goog-Api-Key": "your-stitch-api-key"
70
- }
71
- }
72
- }
73
- }
74
- ```
75
-
76
- - `codex`: edit `%USERPROFILE%/.codex/config.toml` and use HTTP transport, the fixed Stitch MCP URL, and the `X-Goog-Api-Key` header.
77
- - The built-in `codex` adapter should launch Stitch write operations through `codex exec --dangerously-bypass-approvals-and-sandbox`; if a custom runner replaces it, that runner must provide the same write-bypass behavior.
78
-
79
- ```toml
80
- [mcp_servers.stitch]
81
- type = "http"
82
- url = "https://stitch.googleapis.com/mcp"
83
- headers = { X-Goog-Api-Key = "your-stitch-api-key" }
84
-
85
- [mcp_servers.stitch.http_headers]
86
- X-Goog-Api-Key = "your-stitch-api-key"
87
- ```
59
+ - Provider, MCP, auth, and runner details live in `.ospec/plugins/stitch/docs/` after the Stitch plugin is installed and enabled for the project.
60
+ - If those docs are missing, install or enable Stitch first so the plugin can sync its localized docs into the repository before changing config.
88
61
 
89
62
  ## Stitch Canonical Layout
90
63
 
@@ -15,7 +15,7 @@ tags: [ai, protocol, ospec]
15
15
  5. `docs/project/workflow-conventions.md`
16
16
  6. The current change files: `proposal.md / tasks.md / state.json / verification.md`
17
17
  7. If `stitch_design_review` exists, read `artifacts/stitch/approval.json`
18
- 8. If Stitch or Checkpoint provider, MCP, auth, install, or enable config must be changed, read the repo-local localized plugin spec that matches the project document language first; only fall back to another localized spec when the matching file is missing
18
+ 8. If Stitch or Checkpoint provider, MCP, auth, install, or enable config must be changed, read the repo-local localized plugin docs under `.ospec/plugins/<plugin>/docs/` first; if they are missing, install or enable the plugin to sync its docs before changing config
19
19
 
20
20
  ## Mandatory Rules
21
21
 
@@ -36,7 +36,7 @@ tags: [ai, protocol, ospec]
36
36
  - Before running Stitch, assume the built-in `stitch` plugin uses the configured provider by default; only treat `.skillrc.plugins.stitch.runner` as authoritative when the project explicitly overrides it
37
37
  - If the project uses a custom runner and `token_env` is configured, confirm the matching environment variable is set
38
38
  - If the local Stitch bridge, Gemini CLI, Codex CLI, stitch MCP, or auth readiness is unclear, run `ospec plugins doctor stitch <project-path>` first
39
- - If `plugins doctor stitch` reveals provider, MCP, or auth issues, return to the repo-local localized Stitch spec first; do not invent an alternate `command` / `args` / `env` or stdio-proxy config outside that spec
39
+ - If `plugins doctor stitch` reveals provider, MCP, or auth issues, return to `.ospec/plugins/stitch/docs/` first; do not invent an alternate `command` / `args` / `env` or stdio-proxy config outside the plugin docs
40
40
  - If the built-in `codex` provider can complete read-only calls but `create_project`, `generate_screen`, or `edit_screens` stalls locally, first verify the run actually uses `codex exec --dangerously-bypass-approvals-and-sandbox`
41
41
  - If the project explicitly overrides `.skillrc.plugins.stitch.runner` and still uses Codex for Stitch writes, the custom runner / wrapper must also pass `--dangerously-bypass-approvals-and-sandbox`
42
42
  - If `stitch_design_review` is active and `approval.json.status != approved`, do not treat the change as ready for continued implementation, completion, or archive
@@ -47,12 +47,10 @@ tags: [ai, protocol, ospec]
47
47
 
48
48
  If the project rules differ from the mother spec, the project-adopted rules take precedence.
49
49
 
50
- ## Stitch Provider Baseline
50
+ ## Stitch Provider Docs
51
51
 
52
- - If the project contains a localized Stitch plugin spec matching the project document language, provider / MCP / auth config must follow that spec first.
53
- - If the project does not contain that spec and the built-in `gemini` provider is used, the baseline config is `%USERPROFILE%/.gemini/settings.json` with `mcpServers.stitch.httpUrl = "https://stitch.googleapis.com/mcp"` and `headers.X-Goog-Api-Key`.
54
- - If the project does not contain that spec and the built-in `codex` provider is used, the baseline config is `%USERPROFILE%/.codex/config.toml` with `[mcp_servers.stitch]`, `type = "http"`, `url = "https://stitch.googleapis.com/mcp"`, and `X-Goog-Api-Key` in `headers` or `[mcp_servers.stitch.http_headers]`.
55
- - The built-in `codex` provider should launch Stitch write operations with `--dangerously-bypass-approvals-and-sandbox`; if a custom runner replaces it, that runner must carry the same write-bypass behavior explicitly.
52
+ - Provider / MCP / auth config must follow the localized Stitch plugin docs under `.ospec/plugins/stitch/docs/`.
53
+ - If those docs are missing, install or enable Stitch first so the plugin can sync its localized docs into the repository before changing config.
56
54
 
57
55
  ## Stitch Theme Variant Prompt Contract
58
56
 
@@ -26,7 +26,9 @@ This skill is the single entry for the full change lifecycle inside an initializ
26
26
  2. `SKILL.index.json`
27
27
  3. `for-ai/ai-guide.md`
28
28
  4. `for-ai/execution-protocol.md`
29
- 5. If Stitch or Checkpoint installation, provider switching, doctor remediation, MCP setup, auth setup, or plugin enablement is involved, read the repo-local localized plugin spec that matches the project document language first. Only fall back to another localized spec when the matching file is missing.
29
+ 5. If Stitch or Checkpoint installation, provider switching, doctor remediation, MCP setup, auth setup, or plugin enablement is involved, read the localized plugin docs under `.ospec/plugins/<plugin>/docs/` first. Before any install step, check `ospec plugins info <plugin>` or `ospec plugins installed`. If the plugin is already installed globally, reuse it and enable it in the current project instead of reinstalling it.
30
+ 6. Treat `ospec update [path]` as project-scoped. It repairs the current project and only upgrades plugins that are enabled in that project.
31
+ 7. Do not run `ospec plugins update --all` unless the user explicitly asks to update every installed plugin on the machine.
30
32
  6. If the user explicitly asks for queue behavior, inspect `changes/queued/` before creating new queue items.
31
33
  7. `changes/active/<change>/proposal.md`
32
34
  8. `changes/active/<change>/tasks.md`
@@ -57,10 +59,7 @@ When `.skillrc.plugins.stitch.enabled = true` and `.skillrc.plugins.stitch.capab
57
59
  - treat the built-in `stitch` plugin with the configured provider adapter as the default path unless `.skillrc.plugins.stitch.runner` is explicitly overridden
58
60
  - if a custom runner is configured and `token_env` is set but missing, stop and request configuration first
59
61
  - if runner readiness, provider CLI, stitch MCP, or auth readiness is unclear, use `ospec plugins doctor stitch <project-path>` before `ospec plugins run stitch <change-path>`
60
- - if Stitch installation, provider switching, doctor remediation, MCP setup, or auth setup is involved, read the repo-local localized Stitch plugin spec first; use its documented Gemini / Codex config snippets instead of inventing `command` / `args` / `env` or stdio-proxy settings
61
- - if the repo-local Stitch spec is missing, use these built-in baselines instead of guessing:
62
- - `gemini`: `%USERPROFILE%/.gemini/settings.json` -> `mcpServers.stitch.httpUrl = "https://stitch.googleapis.com/mcp"` and `headers.X-Goog-Api-Key`
63
- - `codex`: `%USERPROFILE%/.codex/config.toml` -> `[mcp_servers.stitch]`, `type = "http"`, `url = "https://stitch.googleapis.com/mcp"`, and `X-Goog-Api-Key` in `headers` or `[mcp_servers.stitch.http_headers]`
62
+ - if Stitch installation, provider switching, doctor remediation, MCP setup, or auth setup is involved, read `.ospec/plugins/stitch/docs/` first and follow the plugin's documented config snippets instead of inventing `command` / `args` / `env` or stdio-proxy settings
64
63
  - use `ospec plugins approve stitch <change-path>` or `ospec plugins reject stitch <change-path>` to record the review result
65
64
 
66
65
  ## Required Logic
@@ -27,7 +27,9 @@ This skill is the single entry for the full change lifecycle inside an initializ
27
27
  2. `SKILL.index.json`
28
28
  3. `for-ai/ai-guide.md`
29
29
  4. `for-ai/execution-protocol.md`
30
- 5. If Stitch or Checkpoint installation, provider switching, doctor remediation, MCP setup, auth setup, or plugin enablement is involved, read the repo-local localized plugin spec that matches the project document language first. Only fall back to another localized spec when the matching file is missing.
30
+ 5. If Stitch or Checkpoint installation, provider switching, doctor remediation, MCP setup, auth setup, or plugin enablement is involved, read the localized plugin docs under `.ospec/plugins/<plugin>/docs/` first. Before any install step, check `ospec plugins info <plugin>` or `ospec plugins installed`. If the plugin is already installed globally, reuse it and enable it in the current project instead of reinstalling it.
31
+ 6. Treat `ospec update [path]` as project-scoped. It repairs the current project and only upgrades plugins that are enabled in that project.
32
+ 7. Do not run `ospec plugins update --all` unless the user explicitly asks to update every installed plugin on the machine.
31
33
  6. If the user explicitly asks for queue behavior, inspect `changes/queued/` before creating new queue items.
32
34
  7. `changes/active/<change>/proposal.md`
33
35
  8. `changes/active/<change>/tasks.md`
@@ -58,10 +60,7 @@ When `.skillrc.plugins.stitch.enabled = true` and `.skillrc.plugins.stitch.capab
58
60
  - treat the built-in `stitch` plugin with the configured provider adapter as the default path unless `.skillrc.plugins.stitch.runner` is explicitly overridden
59
61
  - if a custom runner is configured and `token_env` is set but missing, stop and request configuration first
60
62
  - if runner readiness, provider CLI, stitch MCP, or auth readiness is unclear, use `ospec plugins doctor stitch <project-path>` before `ospec plugins run stitch <change-path>`
61
- - if Stitch installation, provider switching, doctor remediation, MCP setup, or auth setup is involved, read the repo-local localized Stitch plugin spec first; use its documented Gemini / Codex config snippets instead of inventing `command` / `args` / `env` or stdio-proxy settings
62
- - if the repo-local Stitch spec is missing, use these built-in baselines instead of guessing:
63
- - `gemini`: `%USERPROFILE%/.gemini/settings.json` -> `mcpServers.stitch.httpUrl = "https://stitch.googleapis.com/mcp"` and `headers.X-Goog-Api-Key`
64
- - `codex`: `%USERPROFILE%/.codex/config.toml` -> `[mcp_servers.stitch]`, `type = "http"`, `url = "https://stitch.googleapis.com/mcp"`, and `X-Goog-Api-Key` in `headers` or `[mcp_servers.stitch.http_headers]`
63
+ - if Stitch installation, provider switching, doctor remediation, MCP setup, or auth setup is involved, read `.ospec/plugins/stitch/docs/` first and follow the plugin's documented config snippets instead of inventing `command` / `args` / `env` or stdio-proxy settings
65
64
  - use `ospec plugins approve stitch <change-path>` or `ospec plugins reject stitch <change-path>` to record the review result
66
65
 
67
66
  ## Required Logic
@@ -4,4 +4,4 @@ interface:
4
4
 
5
5
  short_description: "Create or advance a change"
6
6
 
7
- default_prompt: "Use $ospec-change to create or advance a OSpec change. Read .skillrc, SKILL.index.json, and the current change files first. Default to one active change and do not enter queue mode unless the user explicitly asks to split work into multiple changes, create a queue, or execute a queue. When queue behavior is explicitly requested, derive an ordered kebab-case list of change names, use ospec queue add to create queued changes, and use ospec run manual-safe only when the user explicitly asks to run the queue. Keep protocol execution inside changes/active/<change> and do not confuse bootstrap with change creation. If Stitch is enabled and stitch_design_review is active, inspect artifacts/stitch/approval.json. For Stitch installation, provider switching, doctor remediation, MCP setup, or auth setup, read the repo-local Stitch plugin spec first and use its documented config snippet instead of inventing a replacement. If that spec is missing, use these built-in baselines: Gemini uses %USERPROFILE%/.gemini/settings.json with mcpServers.stitch.httpUrl and headers.X-Goog-Api-Key; Codex uses %USERPROFILE%/.codex/config.toml with [mcp_servers.stitch], type=\"http\", url=\"https://stitch.googleapis.com/mcp\", and X-Goog-Api-Key in headers or [mcp_servers.stitch.http_headers]. If preview_url or submitted_at is empty, run ospec plugins run stitch <change-path> before asking for review."
7
+ default_prompt: "Use $ospec-change to create or advance a OSpec change. Read .skillrc, SKILL.index.json, and the current change files first. Default to one active change and do not enter queue mode unless the user explicitly asks to split work into multiple changes, create a queue, or execute a queue. When queue behavior is explicitly requested, derive an ordered kebab-case list of change names, use ospec queue add to create queued changes, and use ospec run manual-safe only when the user explicitly asks to run the queue. Keep protocol execution inside changes/active/<change> and do not confuse bootstrap with change creation. If Stitch is enabled and stitch_design_review is active, inspect artifacts/stitch/approval.json. Before any plugin install step, check `ospec plugins info <plugin>` or `ospec plugins installed`. If the plugin is already installed globally, reuse it and only enable it in the current project. Only run `ospec plugins install <plugin>` when the plugin is not installed yet or the user explicitly asks to reinstall or upgrade it. Treat `ospec update [path]` as project-scoped: it repairs the current project and only upgrades plugins that are enabled in that project. Do not run `ospec plugins update --all` unless the user explicitly asks to update every installed plugin on the machine. If plugin installation, provider switching, doctor remediation, MCP setup, auth setup, or plugin enablement is involved, read `.ospec/plugins/<plugin>/docs/` first; if those docs are missing, install or enable the plugin to sync them before changing config. If preview_url or submitted_at is empty, run ospec plugins run stitch <change-path> before asking for review."
@@ -4,8 +4,6 @@ title: OSpec Change
4
4
 
5
5
  description: Create or advance an active change inside a OSpec project while respecting workflow files and optional-step activation.
6
6
 
7
- version: 5.1.0
8
-
9
7
  author: OSpec Team
10
8
 
11
9
  license: MIT
@@ -16,4 +14,4 @@ interface:
16
14
 
17
15
  short_description: "Create or advance a change"
18
16
 
19
- default_prompt: "Use $ospec-change to create or advance a OSpec change. Read .skillrc, SKILL.index.json, and the current change files first. Default to one active change and do not enter queue mode unless the user explicitly asks to split work into multiple changes, create a queue, or execute a queue. When queue behavior is explicitly requested, derive an ordered kebab-case list of change names, use ospec queue add to create queued changes, and use ospec run manual-safe only when the user explicitly asks to run the queue. Keep protocol execution inside changes/active/<change> and do not confuse bootstrap with change creation. If Stitch is enabled and stitch_design_review is active, inspect artifacts/stitch/approval.json. For Stitch installation, provider switching, doctor remediation, MCP setup, or auth setup, read the repo-local Stitch plugin spec first and use its documented config snippet instead of inventing a replacement. If that spec is missing, use these built-in baselines: Gemini uses %USERPROFILE%/.gemini/settings.json with mcpServers.stitch.httpUrl and headers.X-Goog-Api-Key; Codex uses %USERPROFILE%/.codex/config.toml with [mcp_servers.stitch], type=\"http\", url=\"https://stitch.googleapis.com/mcp\", and X-Goog-Api-Key in headers or [mcp_servers.stitch.http_headers]. Reuse .skillrc.plugins.stitch.project.project_id when it already exists; if it is empty, treat the first successful Stitch run as the canonical project. If preview_url or submitted_at is empty, run ospec plugins run stitch <change-path> before asking for review."
17
+ default_prompt: "Use $ospec-change to create or advance a OSpec change. Read .skillrc, SKILL.index.json, and the current change files first. Default to one active change and do not enter queue mode unless the user explicitly asks to split work into multiple changes, create a queue, or execute a queue. When queue behavior is explicitly requested, derive an ordered kebab-case list of change names, use ospec queue add to create queued changes, and use ospec run manual-safe only when the user explicitly asks to run the queue. Keep protocol execution inside changes/active/<change> and do not confuse bootstrap with change creation. If Stitch is enabled and stitch_design_review is active, inspect artifacts/stitch/approval.json. Before any plugin install step, check `ospec plugins info <plugin>` or `ospec plugins installed`. If the plugin is already installed globally, reuse it and only enable it in the current project. Only run `ospec plugins install <plugin>` when the plugin is not installed yet or the user explicitly asks to reinstall or upgrade it. Treat `ospec update [path]` as project-scoped: it repairs the current project and only upgrades plugins that are enabled in that project. Do not run `ospec plugins update --all` unless the user explicitly asks to update every installed plugin on the machine. If plugin installation, provider switching, doctor remediation, MCP setup, auth setup, or plugin enablement is involved, read `.ospec/plugins/<plugin>/docs/` first; if those docs are missing, install or enable the plugin to sync them before changing config. Reuse .skillrc.plugins.stitch.project.project_id when it already exists; if it is empty, treat the first successful Stitch run as the canonical project. If preview_url or submitted_at is empty, run ospec plugins run stitch <change-path> before asking for review."
@@ -0,0 +1,47 @@
1
+ {
2
+ "version": 1,
3
+ "plugins": [
4
+ {
5
+ "id": "checkpoint",
6
+ "packageName": "@clawplays/ospec-plugin-checkpoint",
7
+ "installRange": ">=1.0.0 <2.0.0",
8
+ "displayName": "Checkpoint",
9
+ "official": true,
10
+ "description": "Runtime review and flow validation for OSpec projects.",
11
+ "kinds": [
12
+ "runtime",
13
+ "skill",
14
+ "knowledge"
15
+ ],
16
+ "docs": {
17
+ "locales": {
18
+ "en-US": "plugins/checkpoint/docs/plugin.md",
19
+ "zh-CN": "plugins/checkpoint/docs/plugin.zh-CN.md",
20
+ "ja-JP": "plugins/checkpoint/docs/plugin.ja.md",
21
+ "ar": "plugins/checkpoint/docs/plugin.ar.md"
22
+ }
23
+ }
24
+ },
25
+ {
26
+ "id": "stitch",
27
+ "packageName": "@clawplays/ospec-plugin-stitch",
28
+ "installRange": ">=1.0.0 <2.0.0",
29
+ "displayName": "Stitch",
30
+ "official": true,
31
+ "description": "Page design review and preview collaboration for OSpec projects.",
32
+ "kinds": [
33
+ "runtime",
34
+ "skill",
35
+ "knowledge"
36
+ ],
37
+ "docs": {
38
+ "locales": {
39
+ "en-US": "plugins/stitch/docs/plugin.md",
40
+ "zh-CN": "plugins/stitch/docs/plugin.zh-CN.md",
41
+ "ja-JP": "plugins/stitch/docs/plugin.ja.md",
42
+ "ar": "plugins/stitch/docs/plugin.ar.md"
43
+ }
44
+ }
45
+ }
46
+ ]
47
+ }
@@ -50,8 +50,7 @@ This document fixes the OSpec execution flow inside the project so requirements
50
50
  - `ospec plugins run stitch <change-path>` uses the configured Stitch provider adapter by default; if the project explicitly overrides `.skillrc.plugins.stitch.runner`, use the custom Stitch bridge / wrapper instead
51
51
  - For custom runners, use `token_env` when extra tokens are required; for the built-in Gemini adapter, auth is typically configured under `%USERPROFILE%/.gemini/settings.json` in `mcpServers.stitch`
52
52
  - Use `ospec plugins doctor stitch <project-path>` to validate the runner, provider CLI, stitch MCP, and auth-hint readiness
53
- - For Stitch or Checkpoint installation, provider switching, doctor remediation, MCP setup, auth setup, or plugin enablement, read the repo-local plugin spec that matches the project's adopted document language first; only fall back to another localized spec when that language-specific file is missing
54
- - If the repo does not contain a Stitch spec, use the built-in baselines instead: `gemini` edits `%USERPROFILE%/.gemini/settings.json` with `mcpServers.stitch.httpUrl` and `headers.X-Goog-Api-Key`; `codex` edits `%USERPROFILE%/.codex/config.toml` with `[mcp_servers.stitch]`, `type = "http"`, `url = "https://stitch.googleapis.com/mcp"`, and `X-Goog-Api-Key`
53
+ - For Stitch or Checkpoint installation, provider switching, doctor remediation, MCP setup, auth setup, or plugin enablement, read the localized plugin docs under `.ospec/plugins/<plugin>/docs/` first; if they are missing, install or enable the plugin to sync its docs before changing config
55
54
  - If the built-in `codex` provider succeeds on read-only calls but local write operations never reach `mcp_tool_call`, first verify the run actually uses `codex exec --dangerously-bypass-approvals-and-sandbox`
56
55
  - If the project overrides a custom Codex runner / wrapper, that custom execution path must also pass `--dangerously-bypass-approvals-and-sandbox`
57
56
  - When `approval.json.status` is not `approved`, do not claim the change has passed design review or is ready to archive
@@ -32,4 +32,4 @@ export declare class BatchOperations {
32
32
  }>;
33
33
  private matchesQuery;
34
34
  }
35
- export declare const batchOperations: BatchOperations;
35
+ export declare const batchOperations: BatchOperations;
@@ -155,4 +155,4 @@ class BatchOperations {
155
155
  }
156
156
  }
157
157
  exports.BatchOperations = BatchOperations;
158
- exports.batchOperations = new BatchOperations();
158
+ exports.batchOperations = new BatchOperations();
@@ -1,6 +1,6 @@
1
1
  /**
2
- * 缓存层系统
3
- * 优化性能和减少磁盘访问
2
+ * Caching layer.
3
+ * Optimizes performance and reduces disk access.
4
4
  */
5
5
  export interface CacheEntry<T> {
6
6
  key: string;
@@ -15,31 +15,31 @@ export declare class CachingLayer<T = any> {
15
15
  private cleanupInterval?;
16
16
  constructor(maxSize?: number);
17
17
  /**
18
- * 设置缓存值
18
+ * Set a cache value.
19
19
  */
20
20
  set(key: string, value: T, ttl?: number): void;
21
21
  /**
22
- * 获取缓存值
22
+ * Get a cache value.
23
23
  */
24
24
  get(key: string): T | null;
25
25
  /**
26
- * 检查键是否存在
26
+ * Check whether a key exists.
27
27
  */
28
28
  has(key: string): boolean;
29
29
  /**
30
- * 删除缓存
30
+ * Delete a cache entry.
31
31
  */
32
32
  delete(key: string): boolean;
33
33
  /**
34
- * 清空缓存
34
+ * Clear the cache.
35
35
  */
36
36
  clear(): void;
37
37
  /**
38
- * 获取缓存大小
38
+ * Get cache size.
39
39
  */
40
40
  size(): number;
41
41
  /**
42
- * 获取统计信息
42
+ * Get cache statistics.
43
43
  */
44
44
  getStats(): {
45
45
  hits: number;
@@ -50,16 +50,16 @@ export declare class CachingLayer<T = any> {
50
50
  maxSize: number;
51
51
  };
52
52
  /**
53
- * 启动清理过期条目
53
+ * Start cleaning expired entries.
54
54
  */
55
55
  private startCleanup;
56
56
  /**
57
- * 停止清理
57
+ * Stop cleanup.
58
58
  */
59
59
  stopCleanup(): void;
60
60
  /**
61
- * 销毁缓存
61
+ * Dispose the cache.
62
62
  */
63
63
  destroy(): void;
64
64
  }
65
- export declare const cachingLayer: CachingLayer<any>;
65
+ export declare const cachingLayer: CachingLayer<any>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
- * 缓存层系统
4
- * 优化性能和减少磁盘访问
3
+ * Caching layer.
4
+ * Optimizes performance and reduces disk access.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.cachingLayer = exports.CachingLayer = void 0;
@@ -18,10 +18,10 @@ class CachingLayer {
18
18
  this.startCleanup();
19
19
  }
20
20
  /**
21
- * 设置缓存值
21
+ * Set a cache value.
22
22
  */
23
23
  set(key, value, ttl) {
24
- // 如果超过最大大小,移除最旧的条目
24
+ // Remove the oldest entry when the cache exceeds the maximum size.
25
25
  if (this.cache.size >= this.maxSize) {
26
26
  const oldestKey = Array.from(this.cache.entries()).sort((a, b) => a[1].timestamp - b[1].timestamp)[0]?.[0];
27
27
  if (oldestKey) {
@@ -38,7 +38,7 @@ class CachingLayer {
38
38
  this.cache.set(key, entry);
39
39
  }
40
40
  /**
41
- * 获取缓存值
41
+ * Get a cache value.
42
42
  */
43
43
  get(key) {
44
44
  const entry = this.cache.get(key);
@@ -46,7 +46,7 @@ class CachingLayer {
46
46
  this.stats.misses++;
47
47
  return null;
48
48
  }
49
- // 检查是否过期
49
+ // Check whether the entry has expired.
50
50
  if (entry.ttl && Date.now() - entry.timestamp > entry.ttl) {
51
51
  this.cache.delete(key);
52
52
  this.stats.misses++;
@@ -56,31 +56,31 @@ class CachingLayer {
56
56
  return entry.value;
57
57
  }
58
58
  /**
59
- * 检查键是否存在
59
+ * Check whether a key exists.
60
60
  */
61
61
  has(key) {
62
62
  return this.get(key) !== null;
63
63
  }
64
64
  /**
65
- * 删除缓存
65
+ * Delete a cache entry.
66
66
  */
67
67
  delete(key) {
68
68
  return this.cache.delete(key);
69
69
  }
70
70
  /**
71
- * 清空缓存
71
+ * Clear the cache.
72
72
  */
73
73
  clear() {
74
74
  this.cache.clear();
75
75
  }
76
76
  /**
77
- * 获取缓存大小
77
+ * Get cache size.
78
78
  */
79
79
  size() {
80
80
  return this.cache.size;
81
81
  }
82
82
  /**
83
- * 获取统计信息
83
+ * Get cache statistics.
84
84
  */
85
85
  getStats() {
86
86
  const total = this.stats.hits + this.stats.misses;
@@ -95,7 +95,7 @@ class CachingLayer {
95
95
  };
96
96
  }
97
97
  /**
98
- * 启动清理过期条目
98
+ * Start cleaning expired entries.
99
99
  */
100
100
  startCleanup() {
101
101
  this.cleanupInterval = setInterval(() => {
@@ -110,12 +110,12 @@ class CachingLayer {
110
110
  if (removed > 0) {
111
111
  this.stats.evictions += removed;
112
112
  }
113
- }, 60000); // 每分钟检查一次
113
+ }, 60000); // Check once per minute.
114
114
  // Do not keep unrelated CLI commands alive just because the cache module was imported.
115
115
  this.cleanupInterval.unref?.();
116
116
  }
117
117
  /**
118
- * 停止清理
118
+ * Stop cleanup.
119
119
  */
120
120
  stopCleanup() {
121
121
  if (this.cleanupInterval) {
@@ -124,7 +124,7 @@ class CachingLayer {
124
124
  }
125
125
  }
126
126
  /**
127
- * 销毁缓存
127
+ * Dispose the cache.
128
128
  */
129
129
  destroy() {
130
130
  this.stopCleanup();
@@ -132,4 +132,4 @@ class CachingLayer {
132
132
  }
133
133
  }
134
134
  exports.CachingLayer = CachingLayer;
135
- exports.cachingLayer = new CachingLayer();
135
+ exports.cachingLayer = new CachingLayer();