@clawplays/ospec-cli 0.3.2 → 0.3.4

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 (35) hide show
  1. package/README.md +5 -1
  2. package/SKILL.md +278 -0
  3. package/agents/openai.yaml +4 -0
  4. package/assets/for-ai/ar/ai-guide.md +55 -0
  5. package/assets/for-ai/ar/execution-protocol.md +44 -0
  6. package/assets/for-ai/ja-JP/ai-guide.md +55 -0
  7. package/assets/for-ai/ja-JP/execution-protocol.md +44 -0
  8. package/assets/project-conventions/ar/development-guide.md +31 -0
  9. package/assets/project-conventions/ar/naming-conventions.md +37 -0
  10. package/assets/project-conventions/ar/skill-conventions.md +33 -0
  11. package/assets/project-conventions/ar/workflow-conventions.md +40 -0
  12. package/assets/project-conventions/ja-JP/development-guide.md +31 -0
  13. package/assets/project-conventions/ja-JP/naming-conventions.md +45 -0
  14. package/assets/project-conventions/ja-JP/skill-conventions.md +33 -0
  15. package/assets/project-conventions/ja-JP/workflow-conventions.md +40 -0
  16. package/dist/cli.js +2 -2
  17. package/dist/commands/NewCommand.js +39 -8
  18. package/dist/core/types.d.ts +1 -0
  19. package/dist/presets/ProjectPresets.d.ts +2 -2
  20. package/dist/presets/ProjectPresets.js +195 -69
  21. package/dist/services/ConfigManager.js +6 -0
  22. package/dist/services/ProjectAssetRegistry.d.ts +2 -2
  23. package/dist/services/ProjectAssetRegistry.js +12 -0
  24. package/dist/services/ProjectAssetService.js +7 -1
  25. package/dist/services/ProjectScaffoldCommandService.js +55 -21
  26. package/dist/services/ProjectScaffoldService.js +108 -12
  27. package/dist/services/ProjectService.js +229 -558
  28. package/dist/services/templates/ExecutionTemplateBuilder.js +235 -9
  29. package/dist/services/templates/ProjectTemplateBuilder.js +878 -276
  30. package/dist/services/templates/TemplateBuilderBase.d.ts +2 -2
  31. package/dist/services/templates/TemplateBuilderBase.js +12 -3
  32. package/dist/services/templates/TemplateInputFactory.js +102 -47
  33. package/dist/services/templates/templateTypes.d.ts +1 -1
  34. package/package.json +4 -1
  35. package/skill.yaml +151 -0
package/README.md CHANGED
@@ -74,7 +74,10 @@ CLI notes:
74
74
  - `--summary`: project overview text written into the generated docs
75
75
  - `--tech-stack`: comma-separated stack list such as `node,react,postgres`
76
76
  - `--architecture`: short architecture description
77
- - `--document-language`: generated doc language, usually `en-US` or `zh-CN`
77
+ - `--document-language`: generated doc language, choose from `en-US`, `zh-CN`, `ja-JP`, or `ar`
78
+ - AI-first language resolution order: explicit language request in the conversation -> current conversation language -> persisted project language in `.skillrc`
79
+ - CLI language resolution order: explicit `--document-language` -> persisted project language in `.skillrc` -> existing project docs / `for-ai/*` / asset manifest -> fallback `en-US`
80
+ - OSpec persists the chosen project document language in `.skillrc` and reuses it for `for-ai` guidance, `ospec new`, and `ospec update`
78
81
  - if you pass these values, OSpec uses them directly when generating project docs
79
82
  - if you do not pass them, OSpec reuses existing docs when possible and otherwise creates placeholder docs first
80
83
 
@@ -195,6 +198,7 @@ Archive notes:
195
198
 
196
199
  - **Change-ready initialization**: `ospec init` creates the protocol shell and baseline project knowledge docs in one pass.
197
200
  - **Guided initialization**: AI-assisted init can ask once for missing summary or tech stack; direct CLI init falls back to placeholder docs when context is missing.
201
+ - **Stable project language**: the chosen document language is stored in `.skillrc` so later guidance and generated change docs stay consistent unless you explicitly change it.
198
202
  - **Docs maintenance**: `ospec docs generate` refreshes or repairs project knowledge docs when you need it later.
199
203
  - **Tracked requirement execution**: each change can keep proposal, tasks, state, verification, and review files aligned.
200
204
  - **Queue helpers**: `queue` and `run` support explicit multi-change execution when one active change is not enough.
package/SKILL.md ADDED
@@ -0,0 +1,278 @@
1
+ ---
2
+ name: ospec
3
+ description: Document-driven OSpec workflow for AI-assisted development with change-ready initialization, execution, validation, and archive readiness.
4
+ tags: [cli, workflow, automation, typescript, ospec, bootstrap]
5
+ ---
6
+
7
+ # OSpec CLI
8
+
9
+ Document-driven OSpec workflow for AI-assisted development with change-ready initialization, execution, validation, archiving, and docs maintenance.
10
+
11
+ ## Default Entry
12
+
13
+ When the user says something short like:
14
+
15
+ - `使用 ospec 初始化项目`
16
+ - `使用 ospec 初始化这个目录`
17
+ - `use ospec to initialize this directory`
18
+ - `use ospec to initialize this repo`
19
+
20
+ expand it internally as:
21
+
22
+ 1. initialize the repository with `ospec init` so it ends in a change-ready state
23
+ 2. if project context is missing and the AI can ask follow-up questions, ask one concise question for project summary or tech stack
24
+ 3. if the user declines or the flow is CLI-only, continue with placeholder project docs
25
+ 4. create the first change only when explicitly requested
26
+
27
+ Do not force the user to repeat those steps manually when the request is already clear.
28
+
29
+ Treat plain project-init intent as enough to trigger this flow. Do not require the user to restate the guardrails in a longer prompt.
30
+
31
+ ## Mandatory Init Execution
32
+
33
+ When the user asks to initialize a directory, do not freehand the initialization flow.
34
+
35
+ If the user intent is simply to initialize the project or current directory, treat that as a request for this mandatory flow.
36
+
37
+ Use this exact behavior:
38
+
39
+ 1. run `ospec init [path]` when the directory is uninitialized or not yet change-ready
40
+ 2. if AI assistance is available and the repository lacks usable project context, ask one concise follow-up for summary or tech stack before init when helpful
41
+ 3. verify the actual filesystem result before claiming initialization is complete
42
+ 4. stop before `ospec new` unless the user explicitly asks to create a change
43
+
44
+ Never replace `ospec init` with manual directory creation or a hand-written approximation.
45
+
46
+ Do not say initialization is complete unless the managed protocol-shell assets and baseline project knowledge docs actually exist on disk.
47
+
48
+ Required checks after `ospec init`:
49
+
50
+ - `.skillrc`
51
+ - `.ospec/`
52
+ - `changes/active/`
53
+ - `changes/archived/`
54
+ - `SKILL.md`
55
+ - `SKILL.index.json`
56
+ - `build-index-auto.cjs`
57
+ - `for-ai/ai-guide.md`
58
+ - `for-ai/execution-protocol.md`
59
+ - `for-ai/naming-conventions.md`
60
+ - `for-ai/skill-conventions.md`
61
+ - `for-ai/workflow-conventions.md`
62
+ - `for-ai/development-guide.md`
63
+ - `docs/project/overview.md`
64
+ - `docs/project/tech-stack.md`
65
+ - `docs/project/architecture.md`
66
+ - `docs/project/module-map.md`
67
+ - `docs/project/api-overview.md`
68
+
69
+ During plain init, do not report `docs/SKILL.md`, `src/SKILL.md`, `tests/SKILL.md`, or business scaffold as if they were part of change-ready completion.
70
+
71
+ ## Prompt Profiles
72
+
73
+ Use these prompt styles as the preferred mental model.
74
+
75
+ ### 1. Minimal Prompt
76
+
77
+ Use when the user already trusts OSpec defaults.
78
+
79
+ ```text
80
+ Use ospec to initialize this project.
81
+ ```
82
+
83
+ ### 2. Standard Prompt
84
+
85
+ Use when you want short prompts and still want OSpec to finish initialization properly.
86
+
87
+ ```text
88
+ Use ospec to initialize this project according to current OSpec rules.
89
+ ```
90
+
91
+ ### 3. Guided Init Prompt
92
+
93
+ Use when you want the AI to gather missing context before initialization if needed.
94
+
95
+ ```text
96
+ Use ospec to initialize this project. If project context is missing, ask me for a short summary or tech stack first. If I skip it, continue with placeholder docs.
97
+ ```
98
+
99
+ ### 4. Docs Maintenance Prompt
100
+
101
+ Use when the repository is already initialized and the project knowledge layer needs a refresh or repair pass.
102
+
103
+ ```text
104
+ Use ospec to refresh or repair the project knowledge layer for this directory. Do not create a change yet.
105
+ ```
106
+
107
+ ### 5. Change-Creation Prompt
108
+
109
+ Use when the user is explicitly ready to move into execution.
110
+
111
+ ```text
112
+ Use ospec to create and advance a change for this requirement. Respect the current project state and do not create queue work unless I ask for it.
113
+ ```
114
+
115
+ ### 6. Queue Prompt
116
+
117
+ Use when the user explicitly wants multiple changes queued instead of one normal active change.
118
+
119
+ ```text
120
+ Use ospec to break this TODO into multiple changes, create a queue, show the queue first, and do not run it yet.
121
+ ```
122
+
123
+ ### 7. Queue-Run Prompt
124
+
125
+ Use when the user explicitly wants queue execution, not the normal single-change flow.
126
+
127
+ ```text
128
+ Use ospec to create a change queue and execute it explicitly with ospec run manual-safe.
129
+ ```
130
+
131
+ ## Anti-Drift Rules
132
+
133
+ Always keep these rules:
134
+
135
+ - `ospec init` should leave the repository in a change-ready state
136
+ - AI-assisted init may ask one concise follow-up question for missing summary or tech stack; if the user declines, continue with placeholder docs
137
+ - `ospec docs generate` refreshes, repairs, or backfills project knowledge docs after initialization
138
+ - when the user asks to initialize, execute the CLI init command and verify the protocol-shell files and `docs/project/*` files on disk before declaring success
139
+ - do not assume the project is a web or Next.js project unless the repository or user makes that explicit
140
+ - do not apply business scaffold during plain init or docs maintenance
141
+ - do not generate `docs/project/bootstrap-summary.md`
142
+ - do not create the first change automatically unless the user explicitly asks to create a change
143
+ - do not enter queue mode unless the user explicitly asks for queue behavior
144
+ - treat planning defaults as guidance, not as init-time templates
145
+ - use the CLI commands for verification, archiving, and targeted inspection instead of ad-hoc filesystem edits
146
+
147
+ ## What The CLI Manages
148
+
149
+ This CLI now covers:
150
+
151
+ - change-ready initialization
152
+ - project knowledge maintenance
153
+ - layered skill files
154
+ - execution-layer change workflow
155
+ - planning defaults for proposal and task setup
156
+ - explicit business scaffold generation when that scope is requested
157
+ - Codex and Claude Code skill install and sync checks
158
+
159
+ ## Canonical Execution Files
160
+
161
+ Treat these as the source of truth for active delivery work:
162
+
163
+ - `.skillrc`
164
+ - `docs/project/overview.md`
165
+ - `docs/project/tech-stack.md`
166
+ - `docs/project/architecture.md`
167
+ - `changes/active/<change>/proposal.md`
168
+ - `changes/active/<change>/tasks.md`
169
+ - `changes/active/<change>/state.json`
170
+ - `changes/active/<change>/verification.md`
171
+
172
+ ## Plugin Gates
173
+
174
+ Before advancing an active change:
175
+
176
+ - read `.skillrc.plugins` to detect enabled blocking plugins
177
+ - if the current change activates `stitch_design_review`, inspect `changes/active/<change>/artifacts/stitch/approval.json`
178
+ - when Stitch approval is missing or `status != approved`, treat the change as blocked and do not claim it is ready to continue or archive
179
+
180
+ Do not fall back to the old `features/...` layout unless the target repository really still uses it.
181
+
182
+ ## Commands To Prefer
183
+
184
+ ```bash
185
+ ospec status [path]
186
+ ospec init [path]
187
+ ospec init [path] --summary "..." --tech-stack node,react
188
+ ospec docs generate [path]
189
+ ospec new <change-name> [path]
190
+ ospec docs status [path]
191
+ ospec skills status [path]
192
+ ospec changes status [path]
193
+ ospec queue status [path]
194
+ ospec queue add <change-name> [path]
195
+ ospec queue next [path]
196
+ ospec run start [path] --profile manual-safe
197
+ ospec run status [path]
198
+ ospec run step [path]
199
+ ospec run resume [path]
200
+ ospec run stop [path]
201
+ ospec plugins status [path]
202
+ ospec plugins approve stitch [changes/active/<change>]
203
+ ospec plugins reject stitch [changes/active/<change>]
204
+ ospec index check [path]
205
+ ospec index build [path]
206
+ ospec workflow show
207
+ ospec workflow list-flags
208
+ ospec progress [changes/active/<change>]
209
+ ospec verify [changes/active/<change>]
210
+ ospec archive [changes/active/<change>]
211
+ ospec archive [changes/active/<change>] --check
212
+ ospec finalize [changes/active/<change>]
213
+ ospec skill status ospec
214
+ ospec skill install ospec
215
+ ospec skill status ospec-change
216
+ ospec skill install ospec-change
217
+ ospec skill status-claude ospec
218
+ ospec skill install-claude ospec
219
+ ospec skill status-claude ospec-change
220
+ ospec skill install-claude ospec-change
221
+ ```
222
+
223
+ Managed auto-sync targets for global install, `ospec init`, and `ospec update` are:
224
+
225
+ - `ospec`
226
+ - `ospec-change`
227
+
228
+ Additional packaged skills remain available for explicit install, for example:
229
+
230
+ ```bash
231
+ ospec skill install ospec-init
232
+ ospec skill install-claude ospec-init
233
+ ```
234
+
235
+ Preferred execution order for a new directory:
236
+
237
+ ```bash
238
+ ospec init [path]
239
+ ospec new <change-name> [path]
240
+ ospec verify [changes/active/<change>]
241
+ ospec finalize [changes/active/<change>]
242
+ ```
243
+
244
+ Use `ospec docs generate [path]` later when you need a docs-only maintenance pass.
245
+
246
+ Use `ospec status [path]` separately when you want an explicit troubleshooting snapshot.
247
+
248
+ For completed changes, archive before commit. Use `ospec archive [changes/active/<change>]` to execute the archive and `--check` only when you want a readiness preview without moving files.
249
+
250
+ For the normal closeout path, prefer `ospec finalize [changes/active/<change>]`. It should verify completeness, rebuild the index, archive the change, and leave Git commit as a separate manual step.
251
+
252
+ ## Project-Type Rules
253
+
254
+ If the repository type is unclear:
255
+
256
+ - inspect the real directory only when needed for troubleshooting or context gathering
257
+ - let initialization stay stack-agnostic
258
+ - allow the project to stay minimal except for OSpec-managed assets and baseline project docs
259
+ - let later skills or explicit project-knowledge steps shape the actual stack
260
+
261
+ This is important because valid OSpec projects include:
262
+
263
+ - web applications
264
+ - CLI tools
265
+ - Unity projects
266
+ - Godot projects
267
+ - desktop apps
268
+ - service backends
269
+ - protocol-only repositories
270
+
271
+ ## Verification Discipline
272
+
273
+ Before saying work is complete:
274
+
275
+ 1. verify the relevant active change
276
+ 2. confirm docs, skills, and index state if project knowledge changed
277
+ 3. keep `SKILL.index.json` current after meaningful skill updates
278
+ 4. treat `SKILL.index.json` section offsets as LF-normalized so Windows CRLF and Linux LF checkouts do not drift
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "OSpec"
3
+ short_description: "Inspect, initialize, and operate OSpec projects"
4
+ default_prompt: "Use $ospec to initialize this directory according to OSpec rules: use ospec init so the repository ends in change-ready state, reuse existing project docs when available, ask one concise follow-up for missing summary or tech stack in AI-assisted flows, fall back to placeholder docs when the user skips that context, do not assume a web template when the project type is unclear, do not create the first change automatically, and use ospec status or ospec changes status only when you need an explicit summary."
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: project-ai-guide
3
+ title: دليل الذكاء الاصطناعي
4
+ tags: [ai, guide, ospec]
5
+ ---
6
+
7
+ # دليل الذكاء الاصطناعي
8
+
9
+ ## الهدف
10
+
11
+ هذه الوثيقة هي النسخة المعتمدة داخل المشروع من مواصفة OSpec الأم. يجب على الذكاء الاصطناعي اتباع القواعد المعتمدة داخل المشروع أولاً بدلاً من الارتجال انطلاقاً من المستودع الأم.
12
+
13
+ ## ترتيب العمل
14
+
15
+ 1. اقرأ `.skillrc`
16
+ 2. اقرأ `SKILL.index.json`
17
+ 3. اقرأ القواعد المعتمدة للمشروع تحت `docs/project/`
18
+ 4. اقرأ ملفات `SKILL.md` ذات الصلة
19
+ 5. اقرأ ملفات التنفيذ الخاصة بالتغيير الحالي
20
+ 6. إذا كان Stitch مفعلاً وكان التغيير الحالي يفعّل `stitch_design_review`، فافحص `artifacts/stitch/approval.json` أولاً
21
+ 7. إذا احتجت إلى تثبيت Stitch أو تبديل provider أو إصلاح doctor أو إعداد MCP أو المصادقة، فاقرأ مواصفة Stitch المحلية في المستودع أولاً. وعندما يوجد `docs/stitch-plugin-spec.zh-CN.md` فاعتبر مقاطع الإعداد فيه هي المصدر المعتمد
22
+
23
+ ## السلوك المطلوب
24
+
25
+ - حافظ على `proposal.md` و`tasks.md` و`verification.md` و`review.md` باللغة المعتمدة للمشروع
26
+ - لا تستنتج لغة وثائق change من لغة واجهة المنتج أو locale الموقع أو من متطلب "الإنجليزية أولاً" فقط
27
+ - إذا كان البروتوكول المعتمد للمشروع بالصينية أو كانت وثائق change الحالية بالصينية بالفعل، فاستمر بالصينية ما لم تغيّر قواعد المشروع ذلك صراحةً
28
+ - استخدم الفهرس لتحديد موقع المعرفة قبل قراءة الملفات الهدف
29
+ - اقرأ القواعد المعتمدة للمشروع قبل بدء التنفيذ
30
+ - إذا كان `stitch_design_review` مفعلاً وكان `approval.json.preview_url` أو `submitted_at` فارغاً، فشغّل أولاً `ospec plugins run stitch <change-path>` لتوليد preview ثم أرسل الرابط للمستخدم
31
+ - إذا كانت `.skillrc.plugins.stitch.project.project_id` مضبوطة مسبقاً، فيجب إعادة استخدام مشروع Stitch نفسه وعدم إنشاء مشروع جديد
32
+ - إذا كانت `.skillrc.plugins.stitch.project.project_id` فارغة، فاعتبر أول تشغيل ناجح لـ Stitch هو المشروع canonical وأعد استخدامه لاحقاً
33
+ - إذا كان `stitch_design_review` مفعلاً وكان `approval.json.status != approved` فتوقف عند بوابة مراجعة التصميم
34
+ - يجب أن تفرض مراجعة صفحات Stitch تخطيطاً canonical واحداً لكل مسار أعمال
35
+ - عند إنتاج `light/dark` اشتق النسختين من الشاشة canonical نفسها ولا تعِد ترتيب الوحدات أو تغيّر هيكل المعلومات أو تنقل CTA أو تنشئ تركيباً مختلفاً
36
+ - إذا كانت الصفحة المطابقة موجودة بالفعل ففضّل `edit existing screen` أو `duplicate existing canonical screen and derive a theme variant`
37
+ - يجب أن يتضمن كل تسليم Stitch ملف `screen mapping` يحتوي على route ومعرفات canonical dark/light وعلاقة الاشتقاق ومعرفات الشاشات المؤرشفة
38
+ - يجب أرشفة أو إعادة تسمية الشاشات القديمة وشاشات الاستكشاف والشاشات المستبدلة بدلاً من تركها كصفحات رئيسية موازية للشاشة canonical
39
+ - إذا كان اختيار canonical أو pairing للثيمات أو screen mapping أو تنظيف التكرارات ناقصاً فلا تعتبر المراجعة مكتملة
40
+ - يستخدم `ospec plugins run stitch <change-path>` افتراضياً موائم Stitch provider المضبوط. استخدم runner مخصصاً فقط عند وجود override صريح في `.skillrc.plugins.stitch.runner`
41
+ - إذا استخدم runner مخصص `token_env` فتأكد من ضبط متغير البيئة الموافق قبل التشغيل
42
+ - إذا لم تتضح جاهزية runner أو Gemini CLI أو Codex CLI أو stitch MCP أو المصادقة، فشغّل أولاً `ospec plugins doctor stitch <project-path>`
43
+ - إذا أظهر `plugins doctor stitch` نتيجة غير PASS لفحوص provider المحدد، فاطلب من المستخدم تثبيت CLI المطلوب وإكمال إعداد stitch MCP / API token
44
+ - عند تثبيت Stitch أو تبديل provider أو إصلاح doctor أو إعداد MCP أو المصادقة، اقرأ مواصفة Stitch المحلية أولاً. وعندما يوجد `docs/stitch-plugin-spec.zh-CN.md` فانسخ شكل إعداد Gemini / Codex الموثق فيه بدلاً من ابتكار إعداد بديل
45
+ - إذا كان provider الداخلي `codex` ينجح في الاستدعاءات للقراءة فقط لكن `create_project` أو `generate_screen` أو `edit_screens` يتوقف محلياً، فتحقق أولاً من أن التشغيل يستخدم `codex exec --dangerously-bypass-approvals-and-sandbox`
46
+ - إذا كان المشروع يبدّل `.skillrc.plugins.stitch.runner` صراحةً ومع ذلك يبقى Codex مسؤولاً عن كتابات Stitch، فيجب على runner / wrapper المخصص تمرير `--dangerously-bypass-approvals-and-sandbox` أيضاً
47
+ - زامن `SKILL.md` بعد التغييرات البرمجية المهمة
48
+ - أعد بناء `SKILL.index.json` عند الحاجة
49
+
50
+ ## أولوية قواعد المشروع
51
+
52
+ - اتفاقيات التسمية: `docs/project/naming-conventions.md`
53
+ - اتفاقيات SKILL: `docs/project/skill-conventions.md`
54
+ - اتفاقيات سير العمل: `docs/project/workflow-conventions.md`
55
+ - دليل التطوير: `docs/project/development-guide.md`
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: project-execution-protocol
3
+ title: بروتوكول التنفيذ
4
+ tags: [ai, protocol, ospec]
5
+ ---
6
+
7
+ # بروتوكول تنفيذ الذكاء الاصطناعي
8
+
9
+ ## اقرأ هذا أولاً في كل مرة تدخل فيها إلى مشروع
10
+
11
+ 1. `.skillrc`
12
+ 2. `SKILL.index.json`
13
+ 3. `docs/project/naming-conventions.md`
14
+ 4. `docs/project/skill-conventions.md`
15
+ 5. `docs/project/workflow-conventions.md`
16
+ 6. ملفات change الحالية: `proposal.md / tasks.md / state.json / verification.md`
17
+ 7. إذا وُجد `stitch_design_review` فاقرأ `artifacts/stitch/approval.json`
18
+ 8. إذا كان يجب تعديل Stitch provider أو MCP أو إعدادات المصادقة، فاقرأ مواصفة Stitch المحلية أولاً. وعندما يوجد `docs/stitch-plugin-spec.zh-CN.md` فاعتبر مقاطع الإعداد فيه مرجعية
19
+
20
+ ## القواعد الإلزامية
21
+
22
+ - حافظ على `proposal.md` و`tasks.md` و`verification.md` و`review.md` باللغة المعتمدة للمشروع
23
+ - لا تعِد كتابة وثائق change إلى الإنجليزية فقط لأن واجهة المنتج أو locale الموقع أو نص المتطلب يميل إلى الإنجليزية
24
+ - إذا كانت وثائق change الحالية بالصينية بالفعل، فاستمر بالصينية ما لم تتطلب قواعد المشروع التحويل إلى الإنجليزية صراحةً
25
+ - لا تتجاوز proposal/tasks وتنتقل مباشرة إلى التنفيذ
26
+ - استخدم `state.json` كمصدر الحقيقة لحالة التنفيذ
27
+ - يجب أن تظهر optional steps المفعلة في `tasks.md` و`verification.md`
28
+ - إذا كان `stitch_design_review` مفعلاً وكان `approval.json.preview_url` أو `submitted_at` فارغاً، فشغّل أولاً `ospec plugins run stitch <change-path>` لإرسال preview
29
+ - يجب أن تفرض مراجعة تصميم Stitch تخطيطاً canonical واحداً لكل route، ويجب تصنيف الشاشات غير canonical على أنها `archive / old / exploration`
30
+ - في متغيرات الثيم `light/dark` حافظ على التخطيط canonical نفسه وحوّل الثيم البصري فقط من دون إعادة ترتيب الوحدات أو نقل CTA أو تغيير البنية
31
+ - إذا كانت الصفحة المطابقة موجودة بالفعل ففضّل `edit existing screen` أو `duplicate existing canonical screen and derive a theme variant`
32
+ - يجب أن يخرج كل تسليم Stitch `screen mapping` يتضمن route ومعرفات canonical dark/light وعلاقة الاشتقاق ومعرفات الشاشات المؤرشفة
33
+ - يجب ألا تبقى الشاشات القديمة أو الاستكشافية أو المستبدلة بجوار الشاشات canonical كصفحات رئيسية موازية
34
+ - إذا كانت `.skillrc.plugins.stitch.project.project_id` موجودة، فأعد استخدام معرف مشروع Stitch نفسه ولا تنشئ مشروعاً آخر لهذا التغيير
35
+ - إذا كان مشروع Stitch canonical ما زال فارغاً، فإن أول إرسال ناجح لـ Stitch يصبح المشروع canonical للمستودع
36
+ - قبل تشغيل Stitch افترض أن الإضافة الداخلية `stitch` تستخدم provider المضبوط افتراضياً؛ ولا تعتبر `.skillrc.plugins.stitch.runner` مرجعاً إلا إذا كان هناك override صريح
37
+ - إذا كان المشروع يستخدم runner مخصصاً وكان `token_env` مضبوطاً، فتأكد من ضبط متغير البيئة الموافق
38
+ - إذا كانت جاهزية Stitch bridge أو Gemini CLI أو Codex CLI أو stitch MCP أو المصادقة غير واضحة، فشغّل أولاً `ospec plugins doctor stitch <project-path>`
39
+ - إذا كشف `plugins doctor stitch` عن مشكلات في provider أو MCP أو المصادقة، فارجع أولاً إلى مواصفة Stitch المحلية في المستودع ولا تبتكر إعدادات بديلة خارجها
40
+ - إذا كان provider الداخلي `codex` يستطيع تنفيذ الاستدعاءات للقراءة فقط لكن `create_project` أو `generate_screen` أو `edit_screens` يتوقف محلياً، فتحقق أولاً من أن التشغيل يستخدم `codex exec --dangerously-bypass-approvals-and-sandbox`
41
+ - إذا كان المشروع يبدّل `.skillrc.plugins.stitch.runner` صراحةً وما زال يستخدم Codex في كتابات Stitch، فيجب على runner / wrapper المخصص تمرير `--dangerously-bypass-approvals-and-sandbox`
42
+ - إذا كان `stitch_design_review` مفعلاً وكان `approval.json.status != approved` فلا تعتبر التغيير جاهزاً للاستمرار أو الاكتمال أو الأرشفة
43
+ - إذا كان اختيار canonical أو pairing للثيمات أو screen mapping أو تنظيف التكرارات ناقصاً فلا تعتبر مراجعة التصميم ناجحة
44
+ - لا تعتبر العمل مكتملاً عندما تكون ملفات `SKILL.md` والفهرس غير متزامنة
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: project-ai-guide
3
+ title: AI ガイド
4
+ tags: [ai, guide, ospec]
5
+ ---
6
+
7
+ # AI ガイド
8
+
9
+ ## 目的
10
+
11
+ この文書は OSpec 母仕様からコピーされた、プロジェクト採用済みの AI ガイドです。AI は母リポジトリの規則を即興で当てはめるのではなく、まずこのプロジェクト採用ルールに従う必要があります。
12
+
13
+ ## 作業順序
14
+
15
+ 1. `.skillrc` を読む
16
+ 2. `SKILL.index.json` を読む
17
+ 3. `docs/project/` 配下のプロジェクト採用ルールを読む
18
+ 4. 関連する `SKILL.md` を読む
19
+ 5. 現在の change 実行ファイルを読む
20
+ 6. Stitch が有効で、現在の change が `stitch_design_review` を有効化している場合は、先に `artifacts/stitch/approval.json` を確認する
21
+ 7. Stitch のインストール、provider 切り替え、doctor 修復、MCP 設定、認証設定が必要な場合は、先にリポジトリ内の Stitch 仕様を読む。`docs/stitch-plugin-spec.zh-CN.md` が存在する場合、その設定断片を正とみなす
22
+
23
+ ## 必須動作
24
+
25
+ - `proposal.md`、`tasks.md`、`verification.md`、`review.md` はプロジェクト採用の文書言語で維持する
26
+ - 製品 UI、サイト locale、または「英語優先」という要件だけから change 文書言語を推測しない
27
+ - プロジェクト採用プロトコルが中国語、または現在の change 文書がすでに中国語なら、明示的なルール変更がない限り change 文書は中国語のまま維持する
28
+ - 目的の文書を読む前に、まず index を使って知識の所在を確認する
29
+ - 実装作業前にプロジェクト採用ルールを読む
30
+ - `stitch_design_review` が有効で `approval.json.preview_url` または `submitted_at` が空なら、まず `ospec plugins run stitch <change-path>` を実行して preview を生成し、その URL をユーザーに送る
31
+ - `.skillrc.plugins.stitch.project.project_id` が既に設定されている場合は、その Stitch project を再利用し、新しい project を作成しない
32
+ - `.skillrc.plugins.stitch.project.project_id` が空なら、最初に成功した Stitch 実行を canonical project として以後も再利用する
33
+ - `stitch_design_review` が有効で `approval.json.status != approved` の間は、デザインレビューゲートで停止する
34
+ - Stitch のページレビューでは、各業務ルートにつき canonical layout を 1 つだけ維持する
35
+ - `light/dark` を作る場合は同じ canonical screen から派生し、モジュール順、情報設計、CTA の位置、構成を変えない
36
+ - 対応するページが既にある場合は `edit existing screen` または `duplicate existing canonical screen and derive a theme variant` を優先する
37
+ - すべての Stitch 成果物には、route、canonical dark/light screen id、派生関係、archived screen id を含む `screen mapping` が必要
38
+ - 古い画面、探索案、置き換え済み画面は canonical 画面と並列の main page として残さず、archive または rename する
39
+ - canonical 選定、theme pairing、screen mapping、重複整理が欠けている場合は、レビュー完了とみなさない
40
+ - `ospec plugins run stitch <change-path>` は既定で設定済み provider adapter を使う。`.skillrc.plugins.stitch.runner` を明示的に上書きしている場合のみ custom runner を使う
41
+ - custom runner で `token_env` を使う場合は、対応する環境変数が設定済みかを確認する
42
+ - runner、Gemini CLI、Codex CLI、stitch MCP、認証準備が不明な場合は、まず `ospec plugins doctor stitch <project-path>` を実行する
43
+ - `plugins doctor stitch` が選択 provider のチェックで PASS 以外を返したら、必要な CLI の導入と stitch MCP / API token 設定をユーザーに依頼する
44
+ - Stitch のインストール、provider 切り替え、doctor 修復、MCP 設定、認証設定では、まずリポジトリ内の Stitch 仕様を読む。`docs/stitch-plugin-spec.zh-CN.md` が存在する場合は、Gemini / Codex の設定形をそのまま使い、回避目的の別設定を即興で作らない
45
+ - 内蔵 `codex` provider が read-only 呼び出しでは成功するのに `create_project`、`generate_screen`、`edit_screens` が止まる場合は、`codex exec --dangerously-bypass-approvals-and-sandbox` が実際に使われているか確認する
46
+ - プロジェクトが `.skillrc.plugins.stitch.runner` を明示的に上書きし、それでも Codex が Stitch 書き込みを担当する場合は、その custom runner / wrapper でも `--dangerously-bypass-approvals-and-sandbox` を渡す
47
+ - 重要なコード変更後は `SKILL.md` を同期する
48
+ - 必要に応じて `SKILL.index.json` を再生成する
49
+
50
+ ## プロジェクト採用ルール優先
51
+
52
+ - 命名規約: `docs/project/naming-conventions.md`
53
+ - SKILL 規約: `docs/project/skill-conventions.md`
54
+ - ワークフロー規約: `docs/project/workflow-conventions.md`
55
+ - 開発ガイド: `docs/project/development-guide.md`
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: project-execution-protocol
3
+ title: 実行プロトコル
4
+ tags: [ai, protocol, ospec]
5
+ ---
6
+
7
+ # AI 実行プロトコル
8
+
9
+ ## プロジェクトに入るたびに最初に読むもの
10
+
11
+ 1. `.skillrc`
12
+ 2. `SKILL.index.json`
13
+ 3. `docs/project/naming-conventions.md`
14
+ 4. `docs/project/skill-conventions.md`
15
+ 5. `docs/project/workflow-conventions.md`
16
+ 6. 現在の change ファイル: `proposal.md / tasks.md / state.json / verification.md`
17
+ 7. `stitch_design_review` がある場合は `artifacts/stitch/approval.json`
18
+ 8. Stitch provider、MCP、認証設定を変更する必要がある場合は、先にリポジトリ内の Stitch 仕様を読む。`docs/stitch-plugin-spec.zh-CN.md` が存在する場合、その設定断片を正とみなす
19
+
20
+ ## 必須ルール
21
+
22
+ - `proposal.md`、`tasks.md`、`verification.md`、`review.md` はプロジェクト採用の文書言語で維持する
23
+ - 製品 UI やサイト locale が英語中心でも、それだけを理由に change 文書を英語へ書き換えない
24
+ - 現在の change 文書が既に中国語なら、プロジェクトルールが明示的に英語切り替えを要求しない限り中国語のまま続ける
25
+ - proposal/tasks を飛ばして実装へ直行しない
26
+ - 実行状態の正は `state.json` とする
27
+ - 有効化された optional step は `tasks.md` と `verification.md` に出現していなければならない
28
+ - `stitch_design_review` が有効で `approval.json.preview_url` または `submitted_at` が空なら、まず `ospec plugins run stitch <change-path>` を実行して preview を提出する
29
+ - Stitch のデザインレビューでは、ルートごとに canonical layout を 1 つだけ維持する。非 canonical 画面は `archive / old / exploration` として明示する
30
+ - `light/dark` の theme 変体では canonical layout を維持し、モジュール再配置、セクション再編、CTA 移動、ナビ構造変更をしない
31
+ - 対応ページが既にある場合は `edit existing screen` または `duplicate existing canonical screen and derive a theme variant` を優先する
32
+ - Stitch 成果物は route、canonical dark/light screen id、派生関係、archived screen id を含む `screen mapping` を必ず出力する
33
+ - 古い画面、探索画面、置き換え済み画面を canonical 画面の横に main page として残さない
34
+ - `.skillrc.plugins.stitch.project.project_id` が存在する場合は、その Stitch project を再利用し、この change 用に別 project を作成しない
35
+ - canonical Stitch project がまだ空なら、最初に成功した Stitch 提出が canonical project になる
36
+ - Stitch 実行前は、既定では設定済み provider が使われるとみなす。`.skillrc.plugins.stitch.runner` が明示的に上書きされている場合のみ custom runner を使う
37
+ - custom runner で `token_env` を使う場合は、対応する環境変数が設定済みか確認する
38
+ - ローカル Stitch bridge、Gemini CLI、Codex CLI、stitch MCP、認証準備が不明なら、まず `ospec plugins doctor stitch <project-path>` を実行する
39
+ - `plugins doctor stitch` が provider、MCP、認証の問題を示した場合は、まずリポジトリ内 Stitch 仕様に戻る。`docs/stitch-plugin-spec.zh-CN.md` がある場合、その仕様外の代替設定を作らない
40
+ - 内蔵 `codex` provider が read-only 呼び出しは完了できるのに `create_project`、`generate_screen`、`edit_screens` が止まる場合は、`codex exec --dangerously-bypass-approvals-and-sandbox` が使われているか確認する
41
+ - プロジェクトが `.skillrc.plugins.stitch.runner` を明示的に上書きしつつ Codex で Stitch 書き込みを行う場合は、custom runner / wrapper でも `--dangerously-bypass-approvals-and-sandbox` を渡す
42
+ - `stitch_design_review` が有効で `approval.json.status != approved` の間は、その change を継続実装、完了、archive 可能と扱わない
43
+ - canonical 選定、theme pairing、screen mapping、重複整理が欠けている場合は、デザインレビュー通過とみなさない
44
+ - `SKILL.md` と index がずれている状態を完了扱いしない
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: project-development-guide
3
+ title: دليل تطوير المشروع
4
+ tags: [conventions, development, ospec]
5
+ ---
6
+
7
+ # دليل تطوير المشروع
8
+
9
+ ## الهدف
10
+
11
+ هذا الملف هو دليل التطوير المعتمد داخل المشروع الذي يربط بين تخطيط المشروع وطبقة المعرفة وطبقة التنفيذ وقواعد التعاون مع الذكاء الاصطناعي.
12
+
13
+ ## الخط الأساسي
14
+
15
+ - تعيش معرفة المشروع طويلة الأمد في `docs/project/`
16
+ - تعيش الحقائق الحالية في ملفات `SKILL.md` متعددة الطبقات
17
+ - تعيش تنفيذات change في `changes/active/<change>/`
18
+ - تعيش نقاط دخول تنفيذ الذكاء الاصطناعي في `for-ai/`
19
+
20
+ ## المسار الموصى به
21
+
22
+ 1. أكّد الاتفاقيات المعتمدة للمشروع
23
+ 2. اقرأ طبقة معرفة المشروع وملفات `SKILL.md` ذات الصلة
24
+ 3. ادخل إلى change النشط
25
+ 4. زامن الوثائق والفهرس بعد التنفيذ
26
+
27
+ ## تجنب
28
+
29
+ - لا تدع الذكاء الاصطناعي يخترع اتفاقيات التسمية أثناء العمل
30
+ - لا تتجاوز `changes/` في الأعمال طويلة الأمد
31
+ - لا تحدّث الكود من دون تحديث طبقة المعرفة
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: project-naming-conventions
3
+ title: اتفاقيات تسمية المشروع
4
+ tags: [conventions, naming, ospec]
5
+ ---
6
+
7
+ # اتفاقيات التسمية
8
+
9
+ ## الهدف
10
+
11
+ هذا الملف هو النسخة المعتمدة داخل المشروع من مواصفة OSpec الأم. وهو يثبت قواعد التسمية داخل المشروع حتى لا يخترع الذكاء الاصطناعي أو البشر أنماط تسمية عشوائية.
12
+
13
+ ## القواعد الأساسية
14
+
15
+ - تستخدم أسماء الأدلة والوحدات وchanges صيغة kebab-case الصغيرة
16
+ - تستخدم flags وoptional steps صيغة snake_case الصغيرة
17
+ - تحتفظ ملفات بروتوكول workflow بأسمائها الثابتة
18
+ - تستخدم وثائق API أسماء semantic بصيغة kebab-case
19
+
20
+ ## أسماء change
21
+
22
+ - استخدم `changes/active/<change-name>/`
23
+ - مثال: `add-token-refresh`
24
+ - تجنب التواريخ والمسافات والأحرف الكبيرة والتسميات غير الدلالية
25
+
26
+ ## أسماء الوحدات
27
+
28
+ - تستخدم أدلة الوحدات أسماء إنجليزية دلالية
29
+ - مثال: `src/modules/auth`, `src/modules/content`
30
+ - تحتفظ كل وحدة بملف `SKILL.md` في جذرها
31
+
32
+ ## أسماء الوثائق
33
+
34
+ - وثائق المشروع في `docs/project/`
35
+ - وثائق التصميم في `docs/design/`
36
+ - وثائق التخطيط في `docs/planning/`
37
+ - وثائق API في `docs/api/`
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: project-skill-conventions
3
+ title: اتفاقيات SKILL
4
+ tags: [conventions, skill, ospec]
5
+ ---
6
+
7
+ # اتفاقيات SKILL
8
+
9
+ ## الهدف
10
+
11
+ يثبت هذا الملف حدود المسؤولية لملفات `SKILL.md` متعددة الطبقات حتى يتمكن الذكاء الاصطناعي من الوصول إلى السياق بشكل ثابت عبر الفهرس ثم قراءة وثيقة المعرفة الصحيحة.
12
+
13
+ ## البنية متعددة الطبقات
14
+
15
+ - `SKILL.md` الجذري: خريطة دخول المشروع
16
+ - `docs/SKILL.md`: مركز docs
17
+ - `src/SKILL.md`: خريطة المصدر
18
+ - `src/core/SKILL.md`: طبقة المنصة الأساسية
19
+ - `src/modules/<module>/SKILL.md`: وحدة معرفة خاصة بالوحدة
20
+ - `tests/SKILL.md`: استراتيجية الاختبارات ومدخلها
21
+
22
+ ## قواعد التحرير
23
+
24
+ - توثق ملفات `SKILL.md` الحقائق الحالية لا الخطط المستقبلية
25
+ - يجب أن تغطي ملفات `SKILL.md` الخاصة بالوحدات المسؤوليات والبنية وAPI والاعتماديات وتوقعات الاختبار
26
+ - عند تغير API أو الحدود، حدّث ملف `SKILL.md` الموافق
27
+ - عند إنشاء وحدة جديدة، أضف ملف `SKILL.md` الخاص بها
28
+
29
+ ## العلاقة مع الفهرس
30
+
31
+ - `SKILL.index.json` للاكتشاف وليس بديلاً عن `SKILL.md`
32
+ - أعد بناء الفهرس بعد تحديث `SKILL.md`
33
+ - يجب على الذكاء الاصطناعي قراءة الفهرس أولاً ثم ملف `SKILL.md` الهدف