openuispec 0.1.28 → 0.1.29

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.
@@ -36,24 +36,57 @@
36
36
 
37
37
  ## `prepare` command
38
38
 
39
- - `openuispec prepare --target <target>` is the operational bridge between spec drift and AI implementation work.
39
+ - `openuispec prepare --target <target>` is the operational bridge between the spec and AI implementation work.
40
+ - `openuispec configure-target <target>` is the target stack selection step that feeds `prepare`.
41
+ - it should offer preset defaults for known stacks
42
+ - it must still allow custom values when the project uses frameworks or libraries outside the catalog
43
+ - `openuispec init --no-configure-targets` should remain available for users who want to defer target stack decisions until later
44
+ - It should support two modes:
45
+ 1. bootstrap mode when no target snapshot exists yet
46
+ 2. update mode when a target snapshot exists
40
47
  - It should be documented as:
41
- 1. read the target's snapshot baseline
42
- 2. compute semantic spec changes since that baseline
43
- 3. produce an AI-ready bundle with likely target scope
48
+ 1. if no snapshot exists, produce a first-time generation bundle from the manifest and current spec files
49
+ 2. if a snapshot exists, compute semantic spec changes since that baseline
50
+ 3. produce the target work bundle with likely target scope
44
51
  - Current output includes:
45
52
  - project and target
46
53
  - output directory
47
54
  - likely code roots
48
- - baseline commit info
49
- - semantic change summary
50
- - per-spec-file work items
51
- - best-effort candidate target files
55
+ - mode (`bootstrap` or `update`)
56
+ - baseline commit info when available
57
+ - target stack summary from `platform/<target>.yaml`
58
+ - selected option refs for known preset values
59
+ - semantic change summary for update mode
60
+ - per-spec-file work items or first-time generation spec inventory
61
+ - best-effort candidate target files for update mode
52
62
  - next-step guidance
63
+ - Selected option refs should be package-manager oriented, not artifact web pages:
64
+ - Android: Gradle plugin ids plus `group:artifact:{latest}` library coordinates
65
+ - Web: npm package specs like `react-router@{latest}`
66
+ - iOS: package identifiers plus docs links
67
+ - `prepare` must also carry dependency guidance explaining that these refs are anchors only.
68
+ - AI should add supporting build, plugin, repository, annotation-processing, runtime, dev, and test dependencies required by the chosen stack and current toolchain
69
+ - AI should resolve exact versions and wiring from current platform docs instead of assuming the preset list is exhaustive
70
+ - Bootstrap mode should surface soft warnings when configured framework/stack values are custom and therefore not covered by preset dependency refs.
71
+ - these warnings should explain that dependency guidance is incomplete, not silently omit the missing refs
72
+ - Bootstrap mode should also carry explicit generation constraints for the target:
73
+ - localization rules
74
+ - use target-native runtime localization resources
75
+ - forbid in-memory string maps embedded in app code
76
+ - file structure rules
77
+ - forbid single-file app output
78
+ - require separate screen/component/support/resource modules
79
+ - platform setup rules
80
+ - refresh current target/framework setup guidance before generation
81
+ - do not rely on stale memory for project layout, resource wiring, navigation APIs, or packaging conventions
82
+ - target-specific directory expectations for generated code
83
+ - backend generation context
84
+ - if the manifest declares `api.endpoints`, `generation.code_roots.backend` is required
85
+ - `prepare` should surface the resolved backend root so AI can inspect backend code when generating API clients
53
86
  - Important positioning:
54
87
  - `prepare` does not generate code
55
88
  - `prepare` does not verify code correctness
56
- - `prepare` packages the spec delta into scoped implementation work for AI or developers
89
+ - `prepare` packages either the current spec or the spec delta into scoped implementation work for AI or developers
57
90
 
58
91
  ## Semantic linting
59
92
 
@@ -11,7 +11,7 @@ This release expands OpenUISpec as a spec-management and AI-orchestration tool f
11
11
  Drift snapshots now record the git baseline commit and branch for each target.
12
12
 
13
13
  - `openuispec prepare --target <target>`
14
- Produces an AI-ready target update bundle with:
14
+ Produces the target work bundle with:
15
15
  - semantic change summary
16
16
  - likely code roots
17
17
  - candidate target files
package/drift/index.ts CHANGED
@@ -73,7 +73,7 @@ export interface ExplainResult {
73
73
 
74
74
  // ── helpers ───────────────────────────────────────────────────────────
75
75
 
76
- function listFiles(dir: string, ext: string): string[] {
76
+ export function listFiles(dir: string, ext: string): string[] {
77
77
  try {
78
78
  return readdirSync(dir)
79
79
  .filter((f) => f.endsWith(ext))
@@ -106,7 +106,7 @@ function parseSpecDocument(relPath: string, content: string): unknown {
106
106
  }
107
107
 
108
108
  /** Read the status field from a screen or flow YAML file. */
109
- function readStatus(filePath: string): string {
109
+ export function readStatus(filePath: string): string {
110
110
  try {
111
111
  const doc = YAML.parse(readFileSync(filePath, "utf-8"));
112
112
  if (doc && typeof doc === "object") {
@@ -123,12 +123,12 @@ function readStatus(filePath: string): string {
123
123
  }
124
124
 
125
125
  /** Returns true if a file is a screen or flow (has status semantics). */
126
- function hasStatusSemantics(relPath: string): boolean {
126
+ export function hasStatusSemantics(relPath: string): boolean {
127
127
  const dir = dirname(relPath);
128
128
  return dir === "screens" || dir === "flows";
129
129
  }
130
130
 
131
- function discoverSpecFiles(projectDir: string): string[] {
131
+ export function discoverSpecFiles(projectDir: string): string[] {
132
132
  const manifest = join(projectDir, "openuispec.yaml");
133
133
  if (!existsSync(manifest)) {
134
134
  console.error(`Error: No openuispec.yaml found in ${projectDir}`);
@@ -434,11 +434,14 @@ export function findProjectDir(cwd: string): string {
434
434
  process.exit(1);
435
435
  }
436
436
 
437
+ /** Read and parse the manifest YAML. */
438
+ export function readManifest(projectDir: string): Record<string, any> {
439
+ return YAML.parse(readFileSync(join(projectDir, "openuispec.yaml"), "utf-8"));
440
+ }
441
+
437
442
  /** Read the project name from the manifest. */
438
443
  export function readProjectName(projectDir: string): string {
439
- const doc = YAML.parse(
440
- readFileSync(join(projectDir, "openuispec.yaml"), "utf-8")
441
- );
444
+ const doc = readManifest(projectDir);
442
445
  return doc.project?.name ?? basename(projectDir);
443
446
  }
444
447
 
@@ -55,7 +55,7 @@ This means the project has existing UI code but hasn't been specced yet. Your jo
55
55
  type: scroll_vertical
56
56
  ```
57
57
  4. **Extract tokens** — scan for colors, fonts, spacing and create files in `openuispec/tokens/`.
58
- 5. **Update the manifest** — fill in `data_model` and `api.endpoints` in `openuispec/openuispec.yaml`.
58
+ 5. **Update the manifest** — fill in `data_model`, `api.endpoints`, and `generation.code_roots.backend` in `openuispec/openuispec.yaml`.
59
59
 
60
60
  ## OpenUISpec Source Of Truth
61
61
 
@@ -76,7 +76,7 @@ Spec-first workflow:
76
76
  4. Run `openuispec validate`.
77
77
  5. Run `openuispec validate semantic`.
78
78
  6. Run `openuispec drift --target <target> --explain` to inspect semantic changes since that target's baseline.
79
- 7. Run `openuispec prepare --target <target>` to build the AI/developer work bundle for that target.
79
+ 7. Run `openuispec prepare --target <target>` to build the target work bundle for that target. In `bootstrap` mode it provides first-generation constraints; in `update` mode it provides drift-based update scope.
80
80
  8. Verify the affected UI targets build/run if possible.
81
81
  9. Only then run `openuispec drift --snapshot --target <target>` for affected targets, after that target output directory exists.
82
82
  10. Run `openuispec drift --target <target> --explain` again to confirm no spec changes remain for that target.
@@ -102,10 +102,11 @@ Platform-first workflow:
102
102
  - `openuispec init` — scaffold a new spec project
103
103
  - `openuispec validate [group...]` — validate spec files against schemas
104
104
  - `openuispec validate semantic` — run semantic cross-reference linting
105
+ - `openuispec configure-target <t> [--defaults]` — configure target stack defaults
105
106
  - `openuispec drift --target <t>` — check for spec drift
106
107
  - `openuispec drift --target <t> --explain` — explain semantic spec drift since the target baseline
107
108
  - `openuispec drift --snapshot --target <t>` — snapshot current state after the target output exists
108
- - `openuispec prepare --target <t>` — build an AI-ready target update bundle
109
+ - `openuispec prepare --target <t>` — build the target work bundle
109
110
  - `openuispec status` — show cross-target baseline/drift status
110
111
  - `openuispec update-rules` — update AI rules to match installed package version
111
112
  - `openuispec drift --all` — include stubs in drift check
@@ -55,7 +55,7 @@ This means the project has existing UI code but hasn't been specced yet. Your jo
55
55
  type: scroll_vertical
56
56
  ```
57
57
  4. **Extract tokens** — scan for colors, fonts, spacing and create files in `openuispec/tokens/`.
58
- 5. **Update the manifest** — fill in `data_model` and `api.endpoints` in `openuispec/openuispec.yaml`.
58
+ 5. **Update the manifest** — fill in `data_model`, `api.endpoints`, and `generation.code_roots.backend` in `openuispec/openuispec.yaml`.
59
59
 
60
60
  ## OpenUISpec Source Of Truth
61
61
 
@@ -76,7 +76,7 @@ Spec-first workflow:
76
76
  4. Run `openuispec validate`.
77
77
  5. Run `openuispec validate semantic`.
78
78
  6. Run `openuispec drift --target <target> --explain` to inspect semantic changes since that target's baseline.
79
- 7. Run `openuispec prepare --target <target>` to build the AI/developer work bundle for that target.
79
+ 7. Run `openuispec prepare --target <target>` to build the target work bundle for that target. In `bootstrap` mode it provides first-generation constraints; in `update` mode it provides drift-based update scope.
80
80
  8. Verify the affected UI targets build/run if possible.
81
81
  9. Only then run `openuispec drift --snapshot --target <target>` for affected targets, after that target output directory exists.
82
82
  10. Run `openuispec drift --target <target> --explain` again to confirm no spec changes remain for that target.
@@ -102,10 +102,11 @@ Platform-first workflow:
102
102
  - `openuispec init` — scaffold a new spec project
103
103
  - `openuispec validate [group...]` — validate spec files against schemas
104
104
  - `openuispec validate semantic` — run semantic cross-reference linting
105
+ - `openuispec configure-target <t> [--defaults]` — configure target stack defaults
105
106
  - `openuispec drift --target <t>` — check for spec drift
106
107
  - `openuispec drift --target <t> --explain` — explain semantic spec drift since the target baseline
107
108
  - `openuispec drift --snapshot --target <t>` — snapshot current state after the target output exists
108
- - `openuispec prepare --target <t>` — build an AI-ready target update bundle
109
+ - `openuispec prepare --target <t>` — build the target work bundle
109
110
  - `openuispec status` — show cross-target baseline/drift status
110
111
  - `openuispec update-rules` — update AI rules to match installed package version
111
112
  - `openuispec drift --all` — include stubs in drift check
@@ -0,0 +1 @@
1
+
@@ -27,7 +27,7 @@ Do NOT guess the file format — skipping this step will produce invalid YAML th
27
27
  3. Online: `https://openuispec.rsteam.uz/llms-full.txt` (if not installed)
28
28
 
29
29
  **Reference files inside the package (read in this order):**
30
- 1. `README.md` — schema tables, file format reference, root keys
30
+ 1. `README.md` — schema tables, file format reference, root wrapper keys
31
31
  2. `spec/openuispec-v0.1.md` — full specification (contracts, layout, expressions, etc.)
32
32
  3. `examples/taskflow/openuispec/` — complete working example with all file types
33
33
  4. `schema/` — JSON Schemas for validation
@@ -38,12 +38,17 @@ Do NOT guess the file format — skipping this step will produce invalid YAML th
38
38
  openuispec validate # Validate spec files against schemas
39
39
  openuispec validate semantic # Check semantic cross-references
40
40
  openuispec validate screens # Validate only screens
41
+ openuispec configure-target ios [--defaults] # Configure target stack defaults
41
42
  openuispec status # Show which targets are behind
42
43
  openuispec drift --target ios --explain # Explain semantic spec drift since ios baseline
43
- openuispec prepare --target ios # Build an AI-ready ios update bundle
44
+ openuispec prepare --target ios # Build the target work bundle
44
45
  openuispec drift --snapshot --target ios # Snapshot current state + git baseline after ios output exists
45
46
  ```
46
47
 
48
+ The target work bundle has two modes:
49
+ - `bootstrap` when no snapshot exists yet, for first-time generation
50
+ - `update` after a snapshot exists, for drift-based target updates
51
+
47
52
  ## Learn more
48
53
 
49
54
  Docs: https://openuispec.rsteam.uz
@@ -31,6 +31,8 @@ i18n:
31
31
 
32
32
  generation:
33
33
  targets: [ios, android, web]
34
+ code_roots:
35
+ backend: "../backend/"
34
36
  output_format:
35
37
  ios: { language: swift, framework: swiftui, min_version: "17.0" }
36
38
  android: { language: kotlin, framework: compose, min_sdk: 26 }
@@ -55,7 +55,7 @@ This means the project has existing UI code but hasn't been specced yet. Your jo
55
55
  type: scroll_vertical
56
56
  ```
57
57
  4. **Extract tokens** — scan for colors, fonts, spacing and create files in `openuispec/tokens/`.
58
- 5. **Update the manifest** — fill in `data_model` and `api.endpoints` in `openuispec/openuispec.yaml`.
58
+ 5. **Update the manifest** — fill in `data_model`, `api.endpoints`, and `generation.code_roots.backend` in `openuispec/openuispec.yaml`.
59
59
 
60
60
  ## OpenUISpec Source Of Truth
61
61
 
@@ -76,7 +76,7 @@ Spec-first workflow:
76
76
  4. Run `openuispec validate`.
77
77
  5. Run `openuispec validate semantic`.
78
78
  6. Run `openuispec drift --target <target> --explain` to inspect semantic changes since that target's baseline.
79
- 7. Run `openuispec prepare --target <target>` to build the AI/developer work bundle for that target.
79
+ 7. Run `openuispec prepare --target <target>` to build the target work bundle for that target. In `bootstrap` mode it provides first-generation constraints; in `update` mode it provides drift-based update scope.
80
80
  8. Verify the affected UI targets build/run if possible.
81
81
  9. Only then run `openuispec drift --snapshot --target <target>` for affected targets, after that target output directory exists.
82
82
  10. Run `openuispec drift --target <target> --explain` again to confirm no spec changes remain for that target.
@@ -102,10 +102,11 @@ Platform-first workflow:
102
102
  - `openuispec init` — scaffold a new spec project
103
103
  - `openuispec validate [group...]` — validate spec files against schemas
104
104
  - `openuispec validate semantic` — run semantic cross-reference linting
105
+ - `openuispec configure-target <t> [--defaults]` — configure target stack defaults
105
106
  - `openuispec drift --target <t>` — check for spec drift
106
107
  - `openuispec drift --target <t> --explain` — explain semantic spec drift since the target baseline
107
108
  - `openuispec drift --snapshot --target <t>` — snapshot current state after the target output exists
108
- - `openuispec prepare --target <t>` — build an AI-ready target update bundle
109
+ - `openuispec prepare --target <t>` — build the target work bundle
109
110
  - `openuispec status` — show cross-target baseline/drift status
110
111
  - `openuispec update-rules` — update AI rules to match installed package version
111
112
  - `openuispec drift --all` — include stubs in drift check
@@ -55,7 +55,7 @@ This means the project has existing UI code but hasn't been specced yet. Your jo
55
55
  type: scroll_vertical
56
56
  ```
57
57
  4. **Extract tokens** — scan for colors, fonts, spacing and create files in `openuispec/tokens/`.
58
- 5. **Update the manifest** — fill in `data_model` and `api.endpoints` in `openuispec/openuispec.yaml`.
58
+ 5. **Update the manifest** — fill in `data_model`, `api.endpoints`, and `generation.code_roots.backend` in `openuispec/openuispec.yaml`.
59
59
 
60
60
  ## OpenUISpec Source Of Truth
61
61
 
@@ -76,7 +76,7 @@ Spec-first workflow:
76
76
  4. Run `openuispec validate`.
77
77
  5. Run `openuispec validate semantic`.
78
78
  6. Run `openuispec drift --target <target> --explain` to inspect semantic changes since that target's baseline.
79
- 7. Run `openuispec prepare --target <target>` to build the AI/developer work bundle for that target.
79
+ 7. Run `openuispec prepare --target <target>` to build the target work bundle for that target. In `bootstrap` mode it provides first-generation constraints; in `update` mode it provides drift-based update scope.
80
80
  8. Verify the affected UI targets build/run if possible.
81
81
  9. Only then run `openuispec drift --snapshot --target <target>` for affected targets, after that target output directory exists.
82
82
  10. Run `openuispec drift --target <target> --explain` again to confirm no spec changes remain for that target.
@@ -102,10 +102,11 @@ Platform-first workflow:
102
102
  - `openuispec init` — scaffold a new spec project
103
103
  - `openuispec validate [group...]` — validate spec files against schemas
104
104
  - `openuispec validate semantic` — run semantic cross-reference linting
105
+ - `openuispec configure-target <t> [--defaults]` — configure target stack defaults
105
106
  - `openuispec drift --target <t>` — check for spec drift
106
107
  - `openuispec drift --target <t> --explain` — explain semantic spec drift since the target baseline
107
108
  - `openuispec drift --snapshot --target <t>` — snapshot current state after the target output exists
108
- - `openuispec prepare --target <t>` — build an AI-ready target update bundle
109
+ - `openuispec prepare --target <t>` — build the target work bundle
109
110
  - `openuispec status` — show cross-target baseline/drift status
110
111
  - `openuispec update-rules` — update AI rules to match installed package version
111
112
  - `openuispec drift --all` — include stubs in drift check
@@ -27,7 +27,7 @@ Do NOT guess the file format — skipping this step will produce invalid YAML th
27
27
  3. Online: `https://openuispec.rsteam.uz/llms-full.txt` (if not installed)
28
28
 
29
29
  **Reference files inside the package (read in this order):**
30
- 1. `README.md` — schema tables, file format reference, root keys
30
+ 1. `README.md` — schema tables, file format reference, root wrapper keys
31
31
  2. `spec/openuispec-v0.1.md` — full specification (contracts, layout, expressions, etc.)
32
32
  3. `examples/taskflow/openuispec/` — complete working example with all file types
33
33
  4. `schema/` — JSON Schemas for validation
@@ -38,12 +38,17 @@ Do NOT guess the file format — skipping this step will produce invalid YAML th
38
38
  openuispec validate # Validate spec files against schemas
39
39
  openuispec validate semantic # Check semantic cross-references
40
40
  openuispec validate screens # Validate only screens
41
+ openuispec configure-target ios [--defaults] # Configure target stack defaults
41
42
  openuispec status # Show which targets are behind
42
43
  openuispec drift --target ios --explain # Explain semantic spec drift since ios baseline
43
- openuispec prepare --target ios # Build an AI-ready ios update bundle
44
+ openuispec prepare --target ios # Build the target work bundle
44
45
  openuispec drift --snapshot --target ios # Snapshot current state + git baseline after ios output exists
45
46
  ```
46
47
 
48
+ The target work bundle has two modes:
49
+ - `bootstrap` when no snapshot exists yet, for first-time generation
50
+ - `update` after a snapshot exists, for drift-based target updates
51
+
47
52
  If a target snapshot was created before baseline metadata was added, `--explain` and `status` will ask you to re-run `openuispec drift --snapshot --target <target>` for that target.
48
53
 
49
54
  ## Learn more
@@ -29,6 +29,8 @@ generation:
29
29
  # ios: "../ios-app/" # relative to this file
30
30
  # android: "../android-app/"
31
31
  # web: "../web-ui/"
32
+ code_roots:
33
+ backend: "../backend/"
32
34
  output_format:
33
35
  ios: { language: swift, framework: swiftui, min_version: "17.0" }
34
36
  android: { language: kotlin, framework: compose, min_sdk: 26 }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openuispec",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "A semantic UI specification format for AI-native, platform-native app development",