openxiangda-skill-kit 2.0.0-alpha.12

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 (37) hide show
  1. package/README.md +10 -0
  2. package/dist/bin.d.ts +3 -0
  3. package/dist/bin.d.ts.map +1 -0
  4. package/dist/bin.js +35 -0
  5. package/dist/bin.js.map +1 -0
  6. package/dist/index.d.ts +29 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +205 -0
  9. package/dist/index.js.map +1 -0
  10. package/docs/architecture/repository-and-release.md +52 -0
  11. package/docs/backend.md +89 -0
  12. package/docs/concepts.md +34 -0
  13. package/docs/data-authz.md +100 -0
  14. package/docs/delivery.md +71 -0
  15. package/docs/frontend.md +46 -0
  16. package/docs/getting-started.md +120 -0
  17. package/docs/index.md +23 -0
  18. package/docs/llms.txt +12 -0
  19. package/docs/reference/cli.md +51 -0
  20. package/docs/reference/mcp.md +26 -0
  21. package/docs/workflow-events.md +63 -0
  22. package/package.json +39 -0
  23. package/skills/manifest.json +40 -0
  24. package/skills/openxiangda-v2/SKILL.md +38 -0
  25. package/skills/openxiangda-v2/agents/openai.yaml +4 -0
  26. package/skills/openxiangda-v2-architecture/SKILL.md +29 -0
  27. package/skills/openxiangda-v2-architecture/agents/openai.yaml +4 -0
  28. package/skills/openxiangda-v2-backend/SKILL.md +42 -0
  29. package/skills/openxiangda-v2-backend/agents/openai.yaml +4 -0
  30. package/skills/openxiangda-v2-data-authz/SKILL.md +44 -0
  31. package/skills/openxiangda-v2-data-authz/agents/openai.yaml +4 -0
  32. package/skills/openxiangda-v2-delivery/SKILL.md +63 -0
  33. package/skills/openxiangda-v2-delivery/agents/openai.yaml +4 -0
  34. package/skills/openxiangda-v2-frontend/SKILL.md +40 -0
  35. package/skills/openxiangda-v2-frontend/agents/openai.yaml +4 -0
  36. package/skills/openxiangda-v2-workflow-events/SKILL.md +39 -0
  37. package/skills/openxiangda-v2-workflow-events/agents/openai.yaml +4 -0
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: openxiangda-v2-data-authz
3
+ description: Design OpenXiangda 2.0 Data API and contextual authorization contracts. Use for RBAC, active-role behavior, department or record attributes, application-admin bypass, field policies, and restricted transactions.
4
+ ---
5
+
6
+ # OpenXiangda 2.0 Data and AuthZ
7
+
8
+ Model permissions as capability checks plus contextual data predicates. A role grants capabilities; policies decide which records and fields are available in the current role context.
9
+
10
+ ## Authorization Model
11
+
12
+ 1. Declare application roles and stable capability codes.
13
+ 2. Treat the selected active role as part of each request. Do not silently union all user roles.
14
+ 3. Resolve subject attributes such as departments and managed colleges from trusted platform or application providers.
15
+ 4. Resolve resource attributes such as instrument manager and college from the target record.
16
+ 5. Express allow rules as explicit subject, action, resource, and environment predicates.
17
+ 6. Grant application administrators the declared application-admin bypass and audit every bypassed write.
18
+ 7. Batch page-level authorization decisions under one RoleSession; never reuse
19
+ them after an identity switch and fail closed on transport or schema errors.
20
+
21
+ ## Data Rules
22
+
23
+ - Declare resources and fields in `openxiangda.config.ts`; generate types with `openxiangda generate`.
24
+ - Prefer server-enforced filters and field policies over client filtering.
25
+ - Use revision checks for updates and restricted transaction batches for related writes.
26
+ - Keep policy tests for multiple roles, role switching, cross-department denial, and administrator access.
27
+ - Require the application directory capability before using department or user
28
+ selectors. Store stable IDs and resolve display labels through Directory v2;
29
+ do not copy tenant contact data into application records.
30
+ - Apply field policies consistently to queries, search controls, forms, CSV
31
+ transfer and restricted transactions.
32
+ - Use the bounded server-side aggregate endpoint for charts and summaries. Only
33
+ declare readable fields, explicit aliases, supported measures and a small
34
+ result limit; never fetch all records into the browser to aggregate them.
35
+ - Read record history from the durable business-audit endpoint. It is still
36
+ row- and field-authorized for the current RoleSession; do not invent a second
37
+ client-side audit log.
38
+ - Model attachments as `file` fields containing platform `DataFileRef` values.
39
+ Use signed initiate/upload/complete, then save the reference through normal
40
+ Data API writes. Download only through the authenticated Data API endpoint.
41
+
42
+ Run `openxiangda check` and `openxiangda test` after every policy or schema change.
43
+
44
+ Read [Data and Authorization](../../docs/data-authz.md) for policy examples.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "OpenXiangda 2.0 Data and AuthZ"
3
+ short_description: "Model Data API contracts and contextual authorization"
4
+ default_prompt: "Use $openxiangda-v2-data-authz to design this application's data authorization."
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: openxiangda-v2-delivery
3
+ description: Validate, build, deploy, observe, promote, retry, and roll back an OpenXiangda 2.0 application. Use when preparing an immutable AppPackage or changing a platform-managed environment.
4
+ ---
5
+
6
+ # OpenXiangda 2.0 Delivery
7
+
8
+ Deliver the whole application as one immutable version. The client submits intent; the platform owns durable execution and environment state.
9
+
10
+ ## Preflight
11
+
12
+ 1. Run `openxiangda doctor` and confirm client/platform contract compatibility.
13
+ 2. For a first deployment only, confirm an authorized platform administrator has run `openxiangda app provision`.
14
+ 3. Run `openxiangda generate --check`, `openxiangda check`, and `openxiangda test`.
15
+ 4. Build and push the backend image; use an immutable digest reference.
16
+ 5. Run `openxiangda build --backend-image <immutable-image>` and retain the returned package digest.
17
+ 6. Confirm every required `backend.secrets` declaration exists and is active in
18
+ the target environment. Missing optional values are intentionally skipped.
19
+ 7. Do not copy or mutate `.openxiangda/build` artifacts after sealing. Deploy
20
+ re-hashes the package, component manifests, artifact bytes, frontend files,
21
+ backend image declaration, and config/contracts inventory before upload.
22
+
23
+ ## Deployment
24
+
25
+ - Inspect the plan before changing an environment.
26
+ - Use `openxiangda deploy` only with explicit user authorization.
27
+ - Follow the durable run with `openxiangda status` and `openxiangda logs`.
28
+ - Use `openxiangda retry` only for retryable failed runs.
29
+ - Use `openxiangda cancel <deploymentId>` to stop an obsolete or blocked run before submitting a replacement package.
30
+ - Use `openxiangda promote` to move the exact same application version between environments.
31
+ - Use `openxiangda rollback` to create a new run that activates a known historical version.
32
+
33
+ Do not rebuild during promotion or rollback. Do not expose injected secrets in logs, manifests returned to clients, or package metadata.
34
+ Provider key rotation is finalized by a successful deployment, not by the rotate
35
+ command itself. A failed deployment must leave the currently active key intact.
36
+
37
+ ## Toolchain release
38
+
39
+ When changing or publishing OpenXiangda 2.0 itself, run
40
+ `pnpm verify:release`. The gate is native to the independent 2.0 repository and
41
+ must not invoke 1.x compatibility suites. It packs every public package,
42
+ validates published `exports`, bin targets and dependency protocols, installs
43
+ the tarballs outside the monorepo, creates a new application from the packed
44
+ creator, and runs that application's generate/check/test/build lifecycle.
45
+ The packed application's lifecycle also installs the pinned Playwright Chromium
46
+ and runs its Admin browser acceptance exactly once before the production build.
47
+ The release pipeline builds/checks/tests the workspace once, then uses the
48
+ `:from-build` distribution, skill and docs stages so those gates reuse verified
49
+ artifacts instead of rebuilding the entire workspace.
50
+ `pnpm distribution:smoke` runs only this packed-distribution verification.
51
+ Keep `strictDepBuilds: true` in the official workspace and template. Permit only
52
+ reviewed dependency lifecycle scripts (`esbuild` today); never suppress the
53
+ warning with a broad allow-all setting. The packed gate must fail if a fresh
54
+ install reports an ignored build script.
55
+
56
+ If the same release train changes the OpenXiangda 2.0 platform server, run its
57
+ `npm run verify:openxiangda-v2` gate before the independent toolchain gate. It
58
+ must validate SQL migrations, discover every platform v2 suite, run the shared
59
+ HTTP/storage security suites, and compile without pulling in the 1.x baseline.
60
+ Passing either local gate is evidence for review, never authorization to commit,
61
+ publish, or deploy.
62
+
63
+ Read [Delivery](../../docs/delivery.md) for gates and failure handling.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "OpenXiangda 2.0 Delivery"
3
+ short_description: "Build deploy observe promote and rollback whole apps"
4
+ default_prompt: "Use $openxiangda-v2-delivery to validate and deploy this OpenXiangda 2.0 application."
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: openxiangda-v2-frontend
3
+ description: Build OpenXiangda 2.0 React and Ant Design admin experiences. Use when implementing menus, routes, CRUD pages, role switching, workflow task pages, or application-defined action components.
4
+ ---
5
+
6
+ # OpenXiangda 2.0 Frontend
7
+
8
+ Build inside `apps/web` with `openxiangda-admin`. Preserve the standard shell, role session, route guards, error handling, and typed clients.
9
+
10
+ ## Implementation Rules
11
+
12
+ 1. Register menus and routes through the application contribution API.
13
+ 2. Gate navigation and actions with generated capability names; the server remains authoritative.
14
+ 3. Use the active-role session supplied by the platform. Switching roles must refresh permissions and scoped data.
15
+ 4. Use the standard CRUD and workflow modules first; add application components only for real domain interactions.
16
+ 5. Render workflow actions and field policies from the backend protocol. Do not duplicate workflow transition rules in the browser.
17
+ 6. Keep data calls in typed client modules rather than components.
18
+ 7. Preserve the standard responsive layout, permission-filtered navigation,
19
+ cached tabs, personal center and stable role switcher. Build management lists
20
+ with the standard search, pagination, sorting, density, column settings,
21
+ revision-aware editing and batch action surfaces before adding custom UI.
22
+ 8. Use `department`, `user`, and `relation` search/form controls for persisted
23
+ identifiers. Render directory identifiers with `DepartmentText` or
24
+ `UserText`; do not expose internal IDs as the primary business label.
25
+ 9. Keep DataResource field policies effective across list columns, search,
26
+ forms, import and export. Authorization loading or errors must fail closed.
27
+ 10. Use the standard dashboard and CSV transfer modules before creating
28
+ application-specific copies. Imports must use restricted transactions and
29
+ stable idempotency keys.
30
+ 11. Keep the standard record detail drawer and business-audit timeline unless
31
+ the domain needs a genuinely different presentation. Use `DataFileField`
32
+ for managed attachments and the aggregate chart components for summaries;
33
+ never expose storage URLs or aggregate complete result sets in-browser.
34
+ 12. Import from the narrow `openxiangda-admin/core`, `/data`, `/dashboard`,
35
+ and `/workflow` entrypoints. Keep business route modules lazy and preserve
36
+ the template's chunk-cycle and size budgets.
37
+
38
+ Run `openxiangda generate`, `openxiangda check`, and `openxiangda test` after changing contracts or pages. Run `pnpm test:e2e` for shell, navigation, role, data-page or recovery changes; preserve the desktop and mobile Chromium paths and use accessible role/label locators instead of Ant Design private DOM. Use accessible Ant Design patterns and run the repository's Ant Design lint when available.
39
+
40
+ Read [Frontend](../../docs/frontend.md) for route, menu, role, and workflow page examples.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "OpenXiangda 2.0 Frontend"
3
+ short_description: "Build standard React and Ant Design application pages"
4
+ default_prompt: "Use $openxiangda-v2-frontend to implement this OpenXiangda 2.0 frontend."
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: openxiangda-v2-workflow-events
3
+ description: Implement OpenXiangda Workflow Kernel v2 and durable application events. Use for approval definitions, assignee providers, task actions, delegation, add-sign, previews, data-change events, workflow events, or timers.
4
+ ---
5
+
6
+ # OpenXiangda 2.0 Workflow and Events
7
+
8
+ The workflow kernel owns definitions, instances, tasks, transitions, delegation, add-sign, audit, and field policies. The application owns business records and application-specific logic.
9
+
10
+ ## Workflow
11
+
12
+ 1. Declare approval and conditional nodes in `openxiangda.config.ts`.
13
+ 2. Use provider contracts for application-data-dependent assignee resolution and custom action decisions.
14
+ 3. Keep submit preview and actual start on the same definition version and subject context.
15
+ 4. Return protocol `operations`, field policies, presentation hints, execution targets, and concurrency tokens from the backend. Task and instance operations may coexist on one Surface; dispatch them to their declared task/instance command scope.
16
+ 5. Persist business changes through Data API or App API, then correlate them to the workflow action.
17
+ 6. Test approve, reject, transfer, return, resubmit, delegation, add-sign, initiator withdrawal, admin termination, duplicate requests, and stale revisions.
18
+ 7. Rotate application Provider signing keys with `workflow provider rotate`,
19
+ then deploy. During that deployment the Nest adapter must accept both current
20
+ and `_NEXT` secrets; the platform activates the next version after readiness.
21
+
22
+ ## Events
23
+
24
+ - Subscribe to typed data and workflow events; implement idempotent consumers.
25
+ - Use timers as durable event producers.
26
+ - Verify signatures, propagate correlation IDs, and fail retryably for transient dependencies.
27
+ - Never assume event ordering unless the contract explicitly provides a partition key.
28
+ - Inspect dead letters with `event delivery list` and replay with a stable
29
+ idempotency key. Do not retry deterministic 4xx failures in a consumer loop.
30
+ - Keep the default platform-backed durable receipt store in production. It uses
31
+ the subscription HMAC secret and survives Pod restarts and multiple replicas;
32
+ inject `InMemoryOpenXiangdaEventReceiptStore` only in local tests.
33
+ - Treat an in-flight duplicate as retryable, not successful. Use `event.id` as
34
+ the Data API transaction or downstream idempotency key for side effects that
35
+ can succeed before the receipt completion request reaches the platform.
36
+
37
+ Use `openxiangda generate`, `openxiangda check`, and `openxiangda test` to keep providers and event payloads aligned.
38
+
39
+ Read [Workflow and Events](../../docs/workflow-events.md) for protocol details.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "OpenXiangda 2.0 Workflow and Events"
3
+ short_description: "Implement workflow providers and durable event consumers"
4
+ default_prompt: "Use $openxiangda-v2-workflow-events to implement this workflow and event behavior."