ai-spector 0.9.21 → 0.9.25

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 (99) hide show
  1. package/contracts/bootstrap/config/prototype-screen-map.json +25 -0
  2. package/contracts/bootstrap/config/prototype.config.json +17 -0
  3. package/contracts/bootstrap/config/review-queue-pending.json +4 -0
  4. package/contracts/bootstrap/config/review-queue-registry.json +4 -0
  5. package/contracts/bootstrap/config/review.config.json +5 -0
  6. package/contracts/bootstrap/docs/ENTITY_REGISTRY_MIGRATION.md +192 -0
  7. package/contracts/bootstrap/docs/MIGRATION.md +463 -0
  8. package/contracts/bootstrap/docs/README.md +48 -0
  9. package/contracts/bootstrap/docs/adapters/README.md +32 -0
  10. package/contracts/bootstrap/docs/guides/COMMENTS_ENTITY_MIGRATION.md +195 -0
  11. package/contracts/bootstrap/docs/guides/DOCOPS_MANUAL_FALLBACK.md +177 -0
  12. package/contracts/bootstrap/docs/guides/PROJECT_LAYOUT.md +84 -0
  13. package/contracts/bootstrap/docs/modules/comments.md +77 -0
  14. package/contracts/bootstrap/docs/modules/generate.md +25 -0
  15. package/contracts/bootstrap/docs/modules/graph.md +31 -0
  16. package/contracts/bootstrap/docs/modules/prototype.md +26 -0
  17. package/contracts/bootstrap/docs/modules/review.md +25 -0
  18. package/contracts/bootstrap/docs/modules/translate.md +26 -0
  19. package/contracts/bootstrap/scripts/migrate-entity-registry.sh +55 -0
  20. package/contracts/bootstrap/templates/basic-design/db-design-template.md +177 -0
  21. package/contracts/bootstrap/templates/basic-design/detail-api-template.md +278 -0
  22. package/contracts/bootstrap/templates/basic-design/detail-screen-template.md +281 -0
  23. package/contracts/bootstrap/templates/basic-design/list-api-template.md +130 -0
  24. package/contracts/bootstrap/templates/basic-design/list-screen-template.md +242 -0
  25. package/contracts/bootstrap/templates/detail-design/common/architecture-overview-template.md +302 -0
  26. package/contracts/bootstrap/templates/detail-design/common/deployment-infrastructure-template.md +461 -0
  27. package/contracts/bootstrap/templates/detail-design/common/error-handling-patterns-template.md +460 -0
  28. package/contracts/bootstrap/templates/detail-design/common/integration-patterns-template.md +410 -0
  29. package/contracts/bootstrap/templates/detail-design/common/performance-standards-template.md +406 -0
  30. package/contracts/bootstrap/templates/detail-design/common/security-patterns-template.md +395 -0
  31. package/contracts/bootstrap/templates/detail-design/feature-detail-design-template.md +773 -0
  32. package/contracts/bootstrap/templates/detail-design/feature-list-template.md +39 -0
  33. package/contracts/bootstrap/templates/srs/1-introduction.md +58 -0
  34. package/contracts/bootstrap/templates/srs/2-overall-description.md +91 -0
  35. package/contracts/bootstrap/templates/srs/3-use-case-detail-template.md +142 -0
  36. package/contracts/bootstrap/templates/srs/3-use-cases.md +53 -0
  37. package/contracts/bootstrap/templates/srs/4-system-feature-detail-template.md +131 -0
  38. package/contracts/bootstrap/templates/srs/4-system-features-list-template.md +39 -0
  39. package/contracts/bootstrap/templates/srs/5-data-requirements.md +59 -0
  40. package/contracts/bootstrap/templates/srs/6-external-interfaces.md +56 -0
  41. package/contracts/bootstrap/templates/srs/7-quality-attributes.md +74 -0
  42. package/contracts/bootstrap/templates/srs/8-internationalization.md +36 -0
  43. package/contracts/bootstrap/templates/srs/9-other-requirements.md +46 -0
  44. package/contracts/examples/full-docops.config.json +54 -0
  45. package/contracts/examples/migrate-lifecycle.json +18 -0
  46. package/contracts/examples/minimal-comment-thread/comment-root.json +10 -0
  47. package/contracts/examples/minimal-comment-thread/meta_data.json +22 -0
  48. package/contracts/examples/minimal-docops.config.json +33 -0
  49. package/contracts/examples/minimal-lifecycle.json +17 -0
  50. package/contracts/examples/minimal-prototype.config.json +18 -0
  51. package/contracts/examples/minimal-screen-map.json +25 -0
  52. package/contracts/examples/registry/minimal-document.entity.json +15 -0
  53. package/contracts/examples/registry/minimal-manifest.json +7 -0
  54. package/contracts/examples/registry/minimal-screen.entity.json +11 -0
  55. package/contracts/examples/review/minimal-pending.json +14 -0
  56. package/contracts/examples/review/minimal-registry.json +31 -0
  57. package/contracts/examples/review/minimal-review.config.json +7 -0
  58. package/contracts/schemas/comments/comment_body.schema.json +19 -0
  59. package/contracts/schemas/comments/meta_data.schema.json +59 -0
  60. package/contracts/schemas/docops.config.schema.json +97 -0
  61. package/contracts/schemas/lifecycle.schema.json +43 -0
  62. package/contracts/schemas/prototype/config.schema.json +56 -0
  63. package/contracts/schemas/prototype/screen-map.schema.json +51 -0
  64. package/contracts/schemas/registry/document.entity.schema.json +38 -0
  65. package/contracts/schemas/registry/manifest.schema.json +18 -0
  66. package/contracts/schemas/registry/screen.entity.schema.json +28 -0
  67. package/contracts/schemas/review/registry.schema.json +72 -0
  68. package/contracts/schemas/review/review.config.schema.json +42 -0
  69. package/dist/cli.js +26 -1
  70. package/dist/cli.js.map +1 -1
  71. package/dist/core/docops/bootstrap.d.ts +4 -1
  72. package/dist/core/docops/bootstrap.d.ts.map +1 -1
  73. package/dist/core/docops/bootstrap.js +16 -9
  74. package/dist/core/docops/bootstrap.js.map +1 -1
  75. package/dist/core/docops/guide.d.ts +78 -0
  76. package/dist/core/docops/guide.d.ts.map +1 -0
  77. package/dist/core/docops/guide.js +554 -0
  78. package/dist/core/docops/guide.js.map +1 -0
  79. package/dist/core/docops/migrate.d.ts.map +1 -1
  80. package/dist/core/docops/migrate.js +40 -6
  81. package/dist/core/docops/migrate.js.map +1 -1
  82. package/dist/core/operations/docops.d.ts +8 -0
  83. package/dist/core/operations/docops.d.ts.map +1 -1
  84. package/dist/core/operations/docops.js +40 -0
  85. package/dist/core/operations/docops.js.map +1 -1
  86. package/dist/core/upgrade/checklist.json +2 -2
  87. package/package.json +2 -1
  88. package/scaffold/claude/.claude/skills/_skill-router.md +11 -8
  89. package/scaffold/claude/.claude/skills/ai-spector/references/cli-failures.md +3 -3
  90. package/scaffold/claude/.claude/skills/ai-spector/references/docops-migrate.md +112 -0
  91. package/scaffold/claude/.claude/skills/ai-spector/references/help.md +1 -1
  92. package/scaffold/claude/.claude/skills/ai-spector/references/runbook.md +49 -26
  93. package/scaffold/claude/.claude/skills/ai-spector/skill.md +3 -2
  94. package/scaffold/cursor/skills/_skill-router.md +11 -8
  95. package/scaffold/cursor/skills/ai-spector/SKILL.md +3 -2
  96. package/scaffold/cursor/skills/ai-spector/references/cli-failures.md +3 -3
  97. package/scaffold/cursor/skills/ai-spector/references/docops-migrate.md +112 -0
  98. package/scaffold/cursor/skills/ai-spector/references/help.md +1 -1
  99. package/scaffold/cursor/skills/ai-spector/references/runbook.md +49 -26
@@ -0,0 +1,25 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "buildMode": "static",
4
+ "defaultScreenId": "SCR-001",
5
+ "defaultScreen": {
6
+ "screenId": "SCR-001",
7
+ "displayName": "Login",
8
+ "screenDocPath": "basic-design/screens/login.md",
9
+ "prototypePath": "",
10
+ "route_exists": false
11
+ },
12
+ "screens": [
13
+ {
14
+ "screenId": "SCR-001",
15
+ "displayName": "Login",
16
+ "screenDocPath": "basic-design/screens/login.md",
17
+ "screenDocs": {
18
+ "en": "docs/basic-design/en/screens/login.md"
19
+ },
20
+ "prototypePath": "",
21
+ "route_exists": false,
22
+ "reviewUrl": null
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "version": 1,
4
+ "buildMode": "static",
5
+ "listScreenDoc": "docs/basic-design/en/list-screens.md",
6
+ "screenIndexSection": "## 4. Screen Index",
7
+ "screenDetailDir": "docs/basic-design/screens/",
8
+ "prototypeDir": "prototype",
9
+ "srcDir": "prototype/src",
10
+ "slugFrom": "screenName",
11
+ "defaultTheme": "vercel",
12
+ "htpasswdFile": "prototype/.htpasswd",
13
+ "prototypeBypassAuth": true,
14
+ "reviewHost": "",
15
+ "projectId": "",
16
+ "deployVersion": ""
17
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "version": 2,
3
+ "jobs": []
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "version": 4,
3
+ "documents": {}
4
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "schemaVersion": "1.0",
3
+ "extends": "kaopiz-default",
4
+ "meta": { "source": "docops-init" }
5
+ }
@@ -0,0 +1,192 @@
1
+ # Entity registry migration guide
2
+
3
+ > **Greenfield projects:** `docops init` and `docops migrate --repair` scaffold **entityId** keying by default (`.docops/registry/`, review registry v4). Path-keyed layouts are **legacy only** and will be removed in a future release.
4
+ >
5
+ > **Note:** `.docops/registry/documents/` is created by `docops registry sync` (also run automatically on init/repair/index when design docs exist). An empty project has no entity files until the first sync.
6
+
7
+ > **Audience:** Teams on legacy path-keyed docops (comments, prototype screen-map, review queue v3) migrating to stable **entity IDs** in `.docops/registry/`.
8
+ > **Prerequisite:** [MIGRATION.md](MIGRATION.md) — contract layout (`legacy` → `docops`) should be done first (or in parallel on the same branch).
9
+
10
+ **Related:** [README.md](README.md) · [modules/comments.md](modules/comments.md) · [modules/prototype.md](modules/prototype.md) · [examples/full-docops.config.json](../examples/full-docops.config.json)
11
+
12
+ ---
13
+
14
+ ## What changes
15
+
16
+ | Before (legacy) | After (entity registry) |
17
+ |-----------------|---------------------------|
18
+ | Comments at `comments/{logical_path}/` | `comments/documents/{entityId}/` or `comments/screens/{screenId}/` |
19
+ | `prototype/screen-map.json` | `registry/screens/{screenId}.json` + `registry/manifest.json` |
20
+ | Review queue keyed by `logicalPath` (v3) | Keys = `entityId` (v4) |
21
+ | APIs filter by `filePath` | Prefer `entityId` / `screenId` (`filePath` deprecated one release) |
22
+
23
+ **Source of truth:** git files under `.docops/registry/` — **not** a Postgres mirror. Kari Writer caches registry reads in **Redis** (invalidated on git push via repo generation bump). The existing `git_document_registry` table still lists design docs from `docs/` scans; it is separate from entity JSON files.
24
+
25
+ ---
26
+
27
+ ## 1. Detect readiness
28
+
29
+ On the branch you will migrate, confirm:
30
+
31
+ | Check | Path | Required |
32
+ |-------|------|----------|
33
+ | Docops contract | `.docops/docops.config.json` | Yes |
34
+ | Registry path configured | `"paths": { "registry": ".docops/registry", ... }` | Yes |
35
+ | Markdown in place | `docs/` per `docTypes.*.path` | Yes |
36
+ | Writer storage layout | Project Settings → `docops` when `.docops/` paths are live | Yes before Writer reads |
37
+
38
+ Legacy screen-map may still exist until step 2 runs — `registry sync` imports then removes it.
39
+
40
+ ---
41
+
42
+ ## 2. Migration commands (ordered)
43
+
44
+ Run **on each git branch** that should use ID-keyed artifacts (e.g. `main`, release branches). Install [ai-spector](https://www.npmjs.com/package/ai-spector) locally or use `npx`.
45
+
46
+ ```bash
47
+ # Preview (no writes)
48
+ npx ai-spector docops registry sync --dry-run
49
+ npx ai-spector docops comments migrate --dry-run
50
+ npx ai-spector docops review-registry migrate --dry-run
51
+
52
+ # Apply
53
+ npx ai-spector docops registry sync
54
+ npx ai-spector docops comments migrate
55
+ npx ai-spector docops review-registry migrate
56
+ ```
57
+
58
+ Or use the bundled script (from repo root):
59
+
60
+ ```bash
61
+ bash .docops/guide/scripts/migrate-entity-registry.sh --dry-run
62
+ bash .docops/guide/scripts/migrate-entity-registry.sh
63
+ ```
64
+
65
+ ### Step 2a — `registry sync`
66
+
67
+ - Scans `docs/` and creates/updates `registry/documents/{entityId}.json`
68
+ - Reuses existing `git_document_registry.registry_id` UUIDs when Writer DB is linked (optional; IDs are assigned in git if unknown)
69
+ - Imports `screen-map.json` → `registry/screens/*.json` + `registry/manifest.json`, then **deletes** legacy screen-map files
70
+ - Safe to re-run; does not overwrite unrelated files
71
+
72
+ ### Step 2b — `comments migrate`
73
+
74
+ - Moves `comments/{path}/` → `comments/documents/{entityId}/` or `comments/screens/{screenId}/`
75
+ - Backfills `meta_data.json`: `targetId`, `commentType`; drops redundant `filePath` from storage shape
76
+ - **Requires** registry from step 2a so paths resolve to entity IDs
77
+ - **Detail:** [guides/COMMENTS_ENTITY_MIGRATION.md](guides/COMMENTS_ENTITY_MIGRATION.md)
78
+
79
+ ### Step 2c — `review-registry migrate`
80
+
81
+ - Rekeys `.docops/review-queue/registry.json` from v3 (path keys) to v4 (`entityId` keys)
82
+ - Strips path fields from entries; resolve paths from registry at read time
83
+
84
+ ---
85
+
86
+ ## 3. Writer configuration
87
+
88
+ 1. **Storage layout:** Project Settings → Docops → set `storage_layout` to **`docops`** once `.docops/` contract paths exist on the working branch.
89
+ 2. **Comments API:** List/create with `entityId` (documents) or `screenId` (prototype). `filePath` still works but returns `Deprecation` / `Sunset` headers until 2026-12-31.
90
+ 3. **Cache:** After git push, Writer bumps Redis generation — registry JSON is re-read from git; no manual DB sync for entity files.
91
+
92
+ ---
93
+
94
+ ## 4. Legacy layout (`storage_layout: legacy`)
95
+
96
+ If the project still uses repo-root `comments/` or `prototype/screen-map.json` (not under `.docops/`):
97
+
98
+ 1. Complete [MIGRATION.md §2](MIGRATION.md#2-path-reference-legacy--contract) path copy first
99
+ 2. Set Writer `storage_layout: docops`
100
+ 3. Run §2 commands above — comment folders follow the configured `paths.comments` root
101
+
102
+ ---
103
+
104
+ ## 5. Verify
105
+
106
+ ### Git tree
107
+
108
+ ```bash
109
+ ls .docops/registry/documents/ # one JSON per design doc
110
+ ls .docops/registry/screens/ # one JSON per prototype screen
111
+ test -f .docops/registry/manifest.json
112
+ # screen-map should be gone after sync (unless --skip-screen-map)
113
+ test ! -f .docops/prototype/screen-map.json || echo "WARN: legacy screen-map still present"
114
+ ```
115
+
116
+ ### Comments
117
+
118
+ ```bash
119
+ npx ai-spector comments list --entity <uuid> --json
120
+ npx ai-spector comments list --screen-id <screenId> --type prototype --json
121
+ ```
122
+
123
+ ### Writer UI
124
+
125
+ - [ ] Documents tree loads
126
+ - [ ] Document comments visible after renaming a doc path (re-run `registry sync` on branch)
127
+ - [ ] Prototype gallery / per-screen comments work
128
+ - [ ] Review queue shows correct docs
129
+
130
+ ### API deprecation
131
+
132
+ Requests using only `filePath` receive:
133
+
134
+ ```http
135
+ Deprecation: true
136
+ Sunset: Sat, 31 Dec 2026 23:59:59 GMT
137
+ Link: </contracts/bootstrap/docs/MIGRATION.md#61-comment-storage-keys>; rel="deprecation"
138
+ ```
139
+
140
+ Update clients to send `entityId` or `screenId`.
141
+
142
+ ---
143
+
144
+ ## 6. Rollback (emergency)
145
+
146
+ Entity migration touches git only. To roll back **before push**:
147
+
148
+ ```bash
149
+ git checkout -- .docops/registry .docops/comments .docops/review-queue .docops/prototype
150
+ ```
151
+
152
+ If already pushed, restore from a pre-migration tag/branch. Dual-read of legacy comment paths is **not** guaranteed after the migration window — keep a backup branch.
153
+
154
+ ---
155
+
156
+ ## 7. For AI agents
157
+
158
+ | Rule | Detail |
159
+ |------|--------|
160
+ | Order | `registry sync` → `comments migrate` → `review-registry migrate` |
161
+ | Branch scope | Run on every branch that needs ID-keyed artifacts |
162
+ | No DB entity mirror | Do not insert into Postgres from `registry/documents/*.json`; git + Redis cache only |
163
+ | screen-map | Do not recreate `screen-map.json` after sync; use `registry/screens/` |
164
+ | UUID stability | Never change `entityId` / `screenId` when paths move — only update path fields inside entity JSON |
165
+
166
+ ---
167
+
168
+ ## 8. Schema references
169
+
170
+ | File | Schema |
171
+ |------|--------|
172
+ | `registry/documents/{id}.json` | [schemas/registry/document.entity.schema.json](../schemas/registry/document.entity.schema.json) |
173
+ | `registry/screens/{id}.json` | [schemas/registry/screen.entity.schema.json](../schemas/registry/screen.entity.schema.json) |
174
+ | `registry/manifest.json` | [schemas/registry/manifest.schema.json](../schemas/registry/manifest.schema.json) |
175
+
176
+ Examples: [examples/registry/](../examples/registry/)
177
+
178
+ ---
179
+
180
+ ## 9. Troubleshooting
181
+
182
+ | Symptom | Fix |
183
+ |---------|-----|
184
+ | Comments missing after migrate | Re-run `registry sync`; confirm `entityId` in document JSON matches thread `targetId` |
185
+ | `comments migrate` skips threads | Path not in registry — fix `repoDocs` / `logicalPath`, sync again |
186
+ | Prototype screens empty | Run `registry sync` to import screen-map; or `npx ai-spector prototype manifest` |
187
+ | Writer still reads screen-map | Confirm `storage_layout: docops` and registry has `screens/` |
188
+ | Stale prototype list in UI | Wait ~30s for Redis cache or push a noop commit to bump generation |
189
+
190
+ ---
191
+
192
+ *After migration, see [MIGRATION.md §8](MIGRATION.md#8-after-migration) for ongoing contract maintenance.*