kibi-plugin-ui 0.0.0-stage → 0.1.0
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.
- package/CHANGELOG.md +20 -0
- package/README.md +80 -2
- package/check-policy.json +64 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/package.json +48 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# kibi-plugin-ui
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ee91b85: Projects with a UI can opt into the experimental `kibi-plugin-ui`, which keeps agents on the agreed design: `kb_check` then requires every React or Angular component to implement a design requirement and blocks a component that loses the class names or test ids marking its agreed pattern, such as a timeline rewritten as cards. `/kibi-bootstrap` offers the plugin when it finds component files, and a declined offer is remembered in `package.json` `kibi.declinedPlugins`. Requirements that only name a UI pattern are now proved by fresh isolated component tests, so pattern rules do not need browser tests. Projects without the plugin see no new blocking findings.
|
|
8
|
+
- Add the `kibi.check-policy.v1` capability to `kibi-plugin-sdk`: a JSON policy with ownership and pattern-marker rules, validated by `validateCheckPolicyDocument`. `kb_check` reads activated policies as data from the package and never imports plugin code; an unreadable policy blocks. The builtin plugin ships an empty policy.
|
|
9
|
+
- Add the canonical `policy-ownership` and `policy-markers` rules (inert without an activated policy) to the rule registry, the `kb_check` schema and the CLI.
|
|
10
|
+
- Add built-in `ui_pattern`, `same_pattern`, `pattern_marker` and `ui_container` predicate schemas with suggestion keywords.
|
|
11
|
+
- Proof ladder: a scenario whose requirements are grounded only in `ui_pattern`, `same_pattern` and `pattern_marker` accepts `unit` and `integration` tests with fresh receipts; each scenario obligation now reports `acceptedScopes`.
|
|
12
|
+
- `kb_plan_bootstrap` returns `pluginOffers` and a `plugin_offer` recommended action; `kibi.declinedPlugins` is validated as a list of bare package names. The `kibi-bootstrap` and `kibi-usage` skills cover the offer and the UI pattern workflow.
|
|
13
|
+
- New package `kibi-plugin-ui` ships the UI design policy. It is optional and not part of the default install.
|
|
14
|
+
|
|
15
|
+
Migration: none required. To enable the guard, install `kibi-plugin-ui` as a dev dependency and activate `kibi.check-policy.v1` in `augment` mode under `package.json` `kibi.plugins`; expect `policy-ownership` findings for existing components until they are linked to design requirements or tagged `review:ui-unconstrained`.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [ee91b85]
|
|
20
|
+
- kibi-plugin-sdk@0.5.0
|
package/README.md
CHANGED
|
@@ -1,3 +1,81 @@
|
|
|
1
|
-
#
|
|
1
|
+
# kibi-plugin-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Experimental Kibi plugin that keeps UI components on their agreed design
|
|
4
|
+
patterns. It contributes one capability, `kibi.check-policy.v1`: a JSON policy
|
|
5
|
+
that `kb_check` reads as data. Kibi never imports this package's code while
|
|
6
|
+
checking.
|
|
7
|
+
|
|
8
|
+
With the plugin active, `kb_check` blocks two kinds of drift:
|
|
9
|
+
|
|
10
|
+
- **`policy-ownership`**: a React or Angular component (`*.tsx`, `*.jsx`,
|
|
11
|
+
`*.component.ts`, tests and stories excluded) must implement a current
|
|
12
|
+
requirement grounded in UI design vocabulary: `ui_pattern`, `same_pattern`,
|
|
13
|
+
`ui_container` or `visual_layout_rule`. In React files the rule matches
|
|
14
|
+
PascalCase symbols and skips names ending in `Props`, `State`, `Context`,
|
|
15
|
+
`Variant(s)` or `Type(s)`. Tag a component
|
|
16
|
+
`review:ui-unconstrained` when it genuinely has no design constraint.
|
|
17
|
+
- **`policy-markers`**: a component implementing a requirement that names a
|
|
18
|
+
`ui_pattern` must still contain every `pattern_marker` the KB declares for
|
|
19
|
+
that pattern, in its source file or its `.html` template. Rewriting a
|
|
20
|
+
line-and-dots timeline as cards drops the timeline markers and fails the
|
|
21
|
+
check.
|
|
22
|
+
|
|
23
|
+
Requirements grounded only in `ui_pattern`, `same_pattern` and
|
|
24
|
+
`pattern_marker` are proved by component-scope tests (`verification_scope:
|
|
25
|
+
unit` or `integration`) with fresh proof receipts, so pattern requirements do
|
|
26
|
+
not need end-to-end tests. Those three predicates and the scope rule are part
|
|
27
|
+
of Kibi core; this plugin only turns enforcement on.
|
|
28
|
+
|
|
29
|
+
Colours, spacing and which component library renders a scrollbar are lint
|
|
30
|
+
concerns and stay out of this plugin.
|
|
31
|
+
|
|
32
|
+
## Install and activate
|
|
33
|
+
|
|
34
|
+
`/kibi-bootstrap` offers this plugin when it finds UI sources. To enable it by
|
|
35
|
+
hand:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install --save-dev kibi-plugin-ui
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"kibi": {
|
|
44
|
+
"plugins": [
|
|
45
|
+
{
|
|
46
|
+
"package": "kibi-plugin-ui",
|
|
47
|
+
"capabilities": {
|
|
48
|
+
"kibi.check-policy.v1": { "mode": "augment" }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Check policies only support `augment`. To decline the bootstrap offer
|
|
57
|
+
permanently, list the package under `kibi.declinedPlugins`:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{ "kibi": { "declinedPlugins": ["kibi-plugin-ui"] } }
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Modeling a pattern
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
REQ-feed-timeline-pattern requires_predicate
|
|
67
|
+
FACT-feed-timeline ui_pattern(activity_feed, line_dots_timeline)
|
|
68
|
+
FACT-feed-variants same_pattern(activity_feed, editor_view, read_only_view)
|
|
69
|
+
FACT-timeline-dot pattern_marker(line_dots_timeline, timeline_dot)
|
|
70
|
+
FACT-timeline-connector pattern_marker(line_dots_timeline, timeline-connector)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Markers are literal class names or test ids. Both `timeline_dot` and
|
|
74
|
+
`timeline-dot` spellings match. Write one component test per variant so a
|
|
75
|
+
divergent branch inside a single template is caught by proof rather than by
|
|
76
|
+
the static marker check, which cannot see branches.
|
|
77
|
+
|
|
78
|
+
See the [plugin guide](https://looted.github.io/kibi/reference/plugins.html)
|
|
79
|
+
for how check policies work and the
|
|
80
|
+
[UI requirements guide](https://github.com/Looted/kibi/blob/master/docs/ui-requirements.md)
|
|
81
|
+
for the full modeling workflow.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"contractVersion": "kibi.check-policy.v1",
|
|
3
|
+
"id": "ui-design",
|
|
4
|
+
"title": "UI design coverage",
|
|
5
|
+
"ownership": [
|
|
6
|
+
{
|
|
7
|
+
"id": "ui-component-ownership",
|
|
8
|
+
"description": "Every UI component implements a current requirement grounded in UI design vocabulary (ui_pattern, same_pattern, ui_container or visual_layout_rule), or carries review:ui-unconstrained.",
|
|
9
|
+
"include": ["**/*.tsx", "**/*.jsx"],
|
|
10
|
+
"exclude": [
|
|
11
|
+
"**/*.test.*",
|
|
12
|
+
"**/*.spec.*",
|
|
13
|
+
"**/*.stories.*",
|
|
14
|
+
"**/__tests__/**",
|
|
15
|
+
"**/tests/**",
|
|
16
|
+
"**/e2e/**",
|
|
17
|
+
"**/dist/**",
|
|
18
|
+
"**/build/**",
|
|
19
|
+
"**/node_modules/**"
|
|
20
|
+
],
|
|
21
|
+
"symbolTitlePattern": "^(?![A-Za-z0-9]*(Props|State|Context|Variants?|Types?)$)[A-Z][A-Za-z0-9]*$",
|
|
22
|
+
"requirePredicates": [
|
|
23
|
+
"ui_pattern",
|
|
24
|
+
"same_pattern",
|
|
25
|
+
"ui_container",
|
|
26
|
+
"visual_layout_rule"
|
|
27
|
+
],
|
|
28
|
+
"exemptTag": "review:ui-unconstrained"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"id": "ui-angular-component-ownership",
|
|
32
|
+
"description": "Every Angular component class implements a current requirement grounded in UI design vocabulary, or carries review:ui-unconstrained.",
|
|
33
|
+
"include": ["**/*.component.ts"],
|
|
34
|
+
"exclude": [
|
|
35
|
+
"**/*.spec.ts",
|
|
36
|
+
"**/__tests__/**",
|
|
37
|
+
"**/tests/**",
|
|
38
|
+
"**/e2e/**",
|
|
39
|
+
"**/dist/**",
|
|
40
|
+
"**/node_modules/**"
|
|
41
|
+
],
|
|
42
|
+
"symbolTitlePattern": "^[A-Za-z0-9]+Component$",
|
|
43
|
+
"requirePredicates": [
|
|
44
|
+
"ui_pattern",
|
|
45
|
+
"same_pattern",
|
|
46
|
+
"ui_container",
|
|
47
|
+
"visual_layout_rule"
|
|
48
|
+
],
|
|
49
|
+
"exemptTag": "review:ui-unconstrained"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"markers": [
|
|
53
|
+
{
|
|
54
|
+
"id": "ui-pattern-markers",
|
|
55
|
+
"description": "A component implementing a requirement that names a ui_pattern keeps every pattern_marker of that pattern in its source or its .html template.",
|
|
56
|
+
"patternPredicate": "ui_pattern",
|
|
57
|
+
"patternArgument": 1,
|
|
58
|
+
"markerPredicate": "pattern_marker",
|
|
59
|
+
"markerPatternArgument": 0,
|
|
60
|
+
"markerArgument": 1,
|
|
61
|
+
"siblingExtensions": [".html"]
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type CheckPolicyDocument } from "kibi-plugin-sdk";
|
|
2
|
+
/**
|
|
3
|
+
* The UI design check policy this package ships. Kibi reads the same
|
|
4
|
+
* `check-policy.json` as data during `kb_check`; this export exists for tools
|
|
5
|
+
* and tests that want the document without reading the file.
|
|
6
|
+
*/
|
|
7
|
+
export declare const UI_CHECK_POLICY: CheckPolicyDocument;
|
|
8
|
+
/**
|
|
9
|
+
* Named plugin export required by the Kibi host loader. The plugin declares no
|
|
10
|
+
* permissions: it only contributes a check policy document.
|
|
11
|
+
*/
|
|
12
|
+
export declare const kibiPlugin: {
|
|
13
|
+
apiVersion: "kibi.plugin.v1";
|
|
14
|
+
id: string;
|
|
15
|
+
version: string;
|
|
16
|
+
permissions: {
|
|
17
|
+
network: false;
|
|
18
|
+
metered: false;
|
|
19
|
+
secrets: never[];
|
|
20
|
+
};
|
|
21
|
+
capabilities: {
|
|
22
|
+
checkPolicy: {
|
|
23
|
+
id: string;
|
|
24
|
+
document: CheckPolicyDocument;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export default kibiPlugin;
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,mBAAmB,EAIzB,MAAM,iBAAiB,CAAC;AAKzB;;;;GAIG;AAEH,eAAO,MAAM,eAAe,EAAE,mBAE7B,CAAC;AAEF;;;GAGG;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;CAerB,CAAC;AAGH,eAAe,UAAU,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { KIBI_PLUGIN_API_VERSION, defineKibiPlugin, validateCheckPolicyDocument, } from "kibi-plugin-sdk";
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
const packageJson = require("../package.json");
|
|
5
|
+
/**
|
|
6
|
+
* The UI design check policy this package ships. Kibi reads the same
|
|
7
|
+
* `check-policy.json` as data during `kb_check`; this export exists for tools
|
|
8
|
+
* and tests that want the document without reading the file.
|
|
9
|
+
*/
|
|
10
|
+
// implements REQ-ui-plugin-design-policy
|
|
11
|
+
export const UI_CHECK_POLICY = validateCheckPolicyDocument(require("../check-policy.json"));
|
|
12
|
+
/**
|
|
13
|
+
* Named plugin export required by the Kibi host loader. The plugin declares no
|
|
14
|
+
* permissions: it only contributes a check policy document.
|
|
15
|
+
*/
|
|
16
|
+
// implements REQ-ui-plugin-design-policy
|
|
17
|
+
export const kibiPlugin = defineKibiPlugin({
|
|
18
|
+
apiVersion: KIBI_PLUGIN_API_VERSION,
|
|
19
|
+
id: "kibi-plugin-ui",
|
|
20
|
+
version: packageJson.version,
|
|
21
|
+
permissions: {
|
|
22
|
+
network: false,
|
|
23
|
+
metered: false,
|
|
24
|
+
secrets: [],
|
|
25
|
+
},
|
|
26
|
+
capabilities: {
|
|
27
|
+
checkPolicy: {
|
|
28
|
+
id: "kibi-plugin-ui.check-policy",
|
|
29
|
+
document: UI_CHECK_POLICY,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
// implements REQ-ui-plugin-design-policy
|
|
34
|
+
export default kibiPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kibi-plugin-ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Experimental Kibi check policy that keeps UI components on their agreed design patterns",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./check-policy.json": "./check-policy.json"
|
|
14
|
+
},
|
|
15
|
+
"files": ["dist", "check-policy.json", "CHANGELOG.md", "README.md"],
|
|
16
|
+
"kibi": {
|
|
17
|
+
"checkPolicy": "check-policy.json"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc -p tsconfig.json",
|
|
21
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
22
|
+
"test": "bun test --timeout 15000 .",
|
|
23
|
+
"prepack": "npm run build && node ../../scripts/verify-package-contract.mjs kibi-plugin-ui"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=22"
|
|
27
|
+
},
|
|
28
|
+
"license": "AGPL-3.0-or-later",
|
|
29
|
+
"author": "Piotr Franczyk",
|
|
30
|
+
"homepage": "https://looted.github.io/kibi/",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/Looted/kibi.git",
|
|
34
|
+
"directory": "packages/plugin-ui"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/Looted/kibi/issues"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"keywords": ["kibi", "kibi-plugin", "design-system", "ui"],
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"kibi-plugin-sdk": "^0.5.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/node": "latest",
|
|
48
|
+
"typescript": "^5.7.0"
|
|
49
|
+
}
|
|
50
|
+
}
|