openxiangda 1.0.264 → 2.0.0-alpha.2
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/README.md +11 -666
- package/bin/run.js +11 -0
- package/dist/browser/AuthoritativeSelector.d.ts +37 -0
- package/dist/browser/AuthoritativeSelector.d.ts.map +1 -0
- package/dist/browser/AuthoritativeSelector.js +357 -0
- package/dist/browser/AuthoritativeSelector.js.map +1 -0
- package/dist/browser/FilePreviewPage.d.ts +2 -0
- package/dist/browser/FilePreviewPage.d.ts.map +1 -0
- package/dist/browser/FilePreviewPage.js +191 -0
- package/dist/browser/FilePreviewPage.js.map +1 -0
- package/dist/browser/Shell.d.ts +6 -0
- package/dist/browser/Shell.d.ts.map +1 -0
- package/dist/browser/Shell.js +198 -0
- package/dist/browser/Shell.js.map +1 -0
- package/dist/browser/appearance.d.ts +12 -0
- package/dist/browser/appearance.d.ts.map +1 -0
- package/dist/browser/appearance.js +100 -0
- package/dist/browser/appearance.js.map +1 -0
- package/dist/browser/application.d.ts +8 -0
- package/dist/browser/application.d.ts.map +1 -0
- package/dist/browser/application.js +42 -0
- package/dist/browser/application.js.map +1 -0
- package/dist/browser/components/platform-fields/AddressField.d.ts +12 -0
- package/dist/browser/components/platform-fields/AddressField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/AddressField.js +179 -0
- package/dist/browser/components/platform-fields/AddressField.js.map +1 -0
- package/dist/browser/components/platform-fields/AttachmentFileList.d.ts +9 -0
- package/dist/browser/components/platform-fields/AttachmentFileList.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/AttachmentFileList.js +164 -0
- package/dist/browser/components/platform-fields/AttachmentFileList.js.map +1 -0
- package/dist/browser/components/platform-fields/CascadeField.d.ts +13 -0
- package/dist/browser/components/platform-fields/CascadeField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/CascadeField.js +14 -0
- package/dist/browser/components/platform-fields/CascadeField.js.map +1 -0
- package/dist/browser/components/platform-fields/DateTimeField.d.ts +16 -0
- package/dist/browser/components/platform-fields/DateTimeField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/DateTimeField.js +51 -0
- package/dist/browser/components/platform-fields/DateTimeField.js.map +1 -0
- package/dist/browser/components/platform-fields/JsonField.d.ts +11 -0
- package/dist/browser/components/platform-fields/JsonField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/JsonField.js +40 -0
- package/dist/browser/components/platform-fields/JsonField.js.map +1 -0
- package/dist/browser/components/platform-fields/LocationField.d.ts +11 -0
- package/dist/browser/components/platform-fields/LocationField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/LocationField.js +73 -0
- package/dist/browser/components/platform-fields/LocationField.js.map +1 -0
- package/dist/browser/components/platform-fields/PlatformDirectoryPicker.d.ts +12 -0
- package/dist/browser/components/platform-fields/PlatformDirectoryPicker.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/PlatformDirectoryPicker.js +269 -0
- package/dist/browser/components/platform-fields/PlatformDirectoryPicker.js.map +1 -0
- package/dist/browser/components/platform-fields/ResourceReferenceField.d.ts +12 -0
- package/dist/browser/components/platform-fields/ResourceReferenceField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/ResourceReferenceField.js +22 -0
- package/dist/browser/components/platform-fields/ResourceReferenceField.js.map +1 -0
- package/dist/browser/components/platform-fields/RichTextField.d.ts +14 -0
- package/dist/browser/components/platform-fields/RichTextField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/RichTextField.js +214 -0
- package/dist/browser/components/platform-fields/RichTextField.js.map +1 -0
- package/dist/browser/components/platform-fields/SignatureField.d.ts +15 -0
- package/dist/browser/components/platform-fields/SignatureField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/SignatureField.js +179 -0
- package/dist/browser/components/platform-fields/SignatureField.js.map +1 -0
- package/dist/browser/components/platform-fields/SubtableField.d.ts +18 -0
- package/dist/browser/components/platform-fields/SubtableField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/SubtableField.js +236 -0
- package/dist/browser/components/platform-fields/SubtableField.js.map +1 -0
- package/dist/browser/components/platform-fields/address-value.d.ts +13 -0
- package/dist/browser/components/platform-fields/address-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/address-value.js +70 -0
- package/dist/browser/components/platform-fields/address-value.js.map +1 -0
- package/dist/browser/components/platform-fields/cascade-value.d.ts +6 -0
- package/dist/browser/components/platform-fields/cascade-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/cascade-value.js +47 -0
- package/dist/browser/components/platform-fields/cascade-value.js.map +1 -0
- package/dist/browser/components/platform-fields/directory-value.d.ts +7 -0
- package/dist/browser/components/platform-fields/directory-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/directory-value.js +35 -0
- package/dist/browser/components/platform-fields/directory-value.js.map +1 -0
- package/dist/browser/components/platform-fields/field-form-codec.d.ts +10 -0
- package/dist/browser/components/platform-fields/field-form-codec.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/field-form-codec.js +82 -0
- package/dist/browser/components/platform-fields/field-form-codec.js.map +1 -0
- package/dist/browser/components/platform-fields/location-value.d.ts +20 -0
- package/dist/browser/components/platform-fields/location-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/location-value.js +57 -0
- package/dist/browser/components/platform-fields/location-value.js.map +1 -0
- package/dist/browser/components/platform-fields/resource-query.d.ts +14 -0
- package/dist/browser/components/platform-fields/resource-query.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/resource-query.js +102 -0
- package/dist/browser/components/platform-fields/resource-query.js.map +1 -0
- package/dist/browser/components/platform-fields/rich-text-value.d.ts +12 -0
- package/dist/browser/components/platform-fields/rich-text-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/rich-text-value.js +83 -0
- package/dist/browser/components/platform-fields/rich-text-value.js.map +1 -0
- package/dist/browser/components/platform-fields/subtable-value.d.ts +31 -0
- package/dist/browser/components/platform-fields/subtable-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/subtable-value.js +120 -0
- package/dist/browser/components/platform-fields/subtable-value.js.map +1 -0
- package/dist/browser/components/resource/GeneratedResourceCrud.d.ts +8 -0
- package/dist/browser/components/resource/GeneratedResourceCrud.d.ts.map +1 -0
- package/dist/browser/components/resource/GeneratedResourceCrud.js +580 -0
- package/dist/browser/components/resource/GeneratedResourceCrud.js.map +1 -0
- package/dist/browser/components/resource/ResourceBatchActions.d.ts +25 -0
- package/dist/browser/components/resource/ResourceBatchActions.d.ts.map +1 -0
- package/dist/browser/components/resource/ResourceBatchActions.js +168 -0
- package/dist/browser/components/resource/ResourceBatchActions.js.map +1 -0
- package/dist/browser/components/resource/StandardResourcePages.d.ts +57 -0
- package/dist/browser/components/resource/StandardResourcePages.d.ts.map +1 -0
- package/dist/browser/components/resource/StandardResourcePages.js +89 -0
- package/dist/browser/components/resource/StandardResourcePages.js.map +1 -0
- package/dist/browser/components/resource/SurfaceFields.d.ts +88 -0
- package/dist/browser/components/resource/SurfaceFields.d.ts.map +1 -0
- package/dist/browser/components/resource/SurfaceFields.js +497 -0
- package/dist/browser/components/resource/SurfaceFields.js.map +1 -0
- package/dist/browser/components/resource/generated-resource-definition.d.ts +19 -0
- package/dist/browser/components/resource/generated-resource-definition.d.ts.map +1 -0
- package/dist/browser/components/resource/generated-resource-definition.js +2 -0
- package/dist/browser/components/resource/generated-resource-definition.js.map +1 -0
- package/dist/browser/components/resource/resource-import.d.ts +15 -0
- package/dist/browser/components/resource/resource-import.d.ts.map +1 -0
- package/dist/browser/components/resource/resource-import.js +197 -0
- package/dist/browser/components/resource/resource-import.js.map +1 -0
- package/dist/browser/data-provider.d.ts +4 -0
- package/dist/browser/data-provider.d.ts.map +1 -0
- package/dist/browser/data-provider.js +45 -0
- package/dist/browser/data-provider.js.map +1 -0
- package/dist/browser/platform-client.d.ts +81 -0
- package/dist/browser/platform-client.d.ts.map +1 -0
- package/dist/browser/platform-client.js +422 -0
- package/dist/browser/platform-client.js.map +1 -0
- package/dist/browser/resource-definitions.d.ts +8 -0
- package/dist/browser/resource-definitions.d.ts.map +1 -0
- package/dist/browser/resource-definitions.js +14 -0
- package/dist/browser/resource-definitions.js.map +1 -0
- package/dist/browser/runtime-meta.d.ts +22 -0
- package/dist/browser/runtime-meta.d.ts.map +1 -0
- package/dist/browser/runtime-meta.js +79 -0
- package/dist/browser/runtime-meta.js.map +1 -0
- package/dist/browser/runtime.d.ts +13 -0
- package/dist/browser/runtime.d.ts.map +1 -0
- package/dist/browser/runtime.js +47 -0
- package/dist/browser/runtime.js.map +1 -0
- package/dist/browser/styles.css +1941 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -0
- package/dist/core.d.ts +6 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +4 -0
- package/dist/core.js.map +1 -0
- package/dist/field-kit.d.ts +22 -0
- package/dist/field-kit.d.ts.map +1 -0
- package/dist/field-kit.js +22 -0
- package/dist/field-kit.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/nest.d.ts +10 -0
- package/dist/nest.d.ts.map +1 -0
- package/dist/nest.js +9 -0
- package/dist/nest.js.map +1 -0
- package/dist/react.d.ts +12 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +11 -0
- package/dist/react.js.map +1 -0
- package/dist/testing.d.ts +4 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +4 -0
- package/dist/testing.js.map +1 -0
- package/package.json +95 -200
- package/skills/manifest.json +10 -0
- package/skills/openxiangda-v2/SKILL.md +55 -0
- package/skills/openxiangda-v2/references/architecture.md +7 -0
- package/skills/openxiangda-v2/references/backend.md +116 -0
- package/skills/openxiangda-v2/references/data-authz.md +93 -0
- package/skills/openxiangda-v2/references/delivery.md +11 -0
- package/skills/openxiangda-v2/references/discovery.md +15 -0
- package/skills/openxiangda-v2/references/frontend.md +10 -0
- package/skills/openxiangda-v2/references/testing.md +16 -0
- package/skills/openxiangda-v2/references/workflow-notification.md +69 -0
- package/skills/openxiangda-v2/references/workspace.md +21 -0
- package/bin/openxiangda.js +0 -26
- package/lib/app-function-invoke.js +0 -28
- package/lib/application-environments.js +0 -1134
- package/lib/change-baseline.js +0 -1359
- package/lib/cli.js +0 -31084
- package/lib/config.js +0 -450
- package/lib/content-cache.js +0 -97
- package/lib/delivery-v2-cli.js +0 -329
- package/lib/delivery-v2-executor.js +0 -1703
- package/lib/delivery-v2-package.js +0 -1176
- package/lib/dependency-capsule.js +0 -246
- package/lib/design-gates.js +0 -668
- package/lib/design-review.js +0 -220
- package/lib/developer-center.js +0 -160
- package/lib/form-field-contract.js +0 -79
- package/lib/form-schema-loader.js +0 -181
- package/lib/git-remote-identity.js +0 -89
- package/lib/http.js +0 -196
- package/lib/integration-bundle.js +0 -225
- package/lib/js-code-build.js +0 -175
- package/lib/open-api.js +0 -256
- package/lib/policy.js +0 -137
- package/lib/publish-context.js +0 -98
- package/lib/publish-lease-heartbeat.js +0 -182
- package/lib/publish-lease.js +0 -221
- package/lib/release-error-classification.js +0 -41
- package/lib/release-explain.js +0 -75
- package/lib/release-mainline.js +0 -654
- package/lib/release-plan.js +0 -550
- package/lib/release-telemetry.js +0 -182
- package/lib/resource-binding-contract.js +0 -210
- package/lib/role-resolution.js +0 -57
- package/lib/runtime-lineage.js +0 -326
- package/lib/sdd.js +0 -3306
- package/lib/skills.js +0 -453
- package/lib/source-dependencies.js +0 -921
- package/lib/task-status.js +0 -330
- package/lib/utils.js +0 -178
- package/lib/workspace-bootstrap.js +0 -268
- package/lib/workspace-init.js +0 -202
- package/lib/worktree-cleanup.js +0 -631
- package/lib/worktree-owner.js +0 -354
- package/openxiangda-skills/SKILL.md +0 -226
- package/openxiangda-skills/references/architecture-design.md +0 -409
- package/openxiangda-skills/references/architecture-patterns.md +0 -264
- package/openxiangda-skills/references/automation-v3.md +0 -349
- package/openxiangda-skills/references/best-practices.md +0 -272
- package/openxiangda-skills/references/component-guide.md +0 -287
- package/openxiangda-skills/references/connector-resources.md +0 -80
- package/openxiangda-skills/references/data-views.md +0 -360
- package/openxiangda-skills/references/forms/component-registry.md +0 -90
- package/openxiangda-skills/references/forms/form-schema.md +0 -146
- package/openxiangda-skills/references/forms/layout-and-rules.md +0 -24
- package/openxiangda-skills/references/notifications.md +0 -227
- package/openxiangda-skills/references/openxiangda-api.md +0 -971
- package/openxiangda-skills/references/pages/app-shell.md +0 -66
- package/openxiangda-skills/references/pages/page-sdk.md +0 -401
- package/openxiangda-skills/references/pages/publish-flow.md +0 -84
- package/openxiangda-skills/references/pages/workspace-structure.md +0 -41
- package/openxiangda-skills/references/permission-design-patterns.md +0 -313
- package/openxiangda-skills/references/permissions-settings.md +0 -468
- package/openxiangda-skills/references/platform-data-model.md +0 -340
- package/openxiangda-skills/references/resource-manifest-cheatsheet.md +0 -936
- package/openxiangda-skills/references/school-contact-relations.md +0 -224
- package/openxiangda-skills/references/style-system.md +0 -218
- package/openxiangda-skills/references/troubleshooting.md +0 -271
- package/openxiangda-skills/references/workflow-v3.md +0 -441
- package/openxiangda-skills/references/workspace-state.md +0 -115
- package/openxiangda-skills/skills/openxiangda-app/SKILL.md +0 -118
- package/openxiangda-skills/skills/openxiangda-architecture-design/SKILL.md +0 -137
- package/openxiangda-skills/skills/openxiangda-core/SKILL.md +0 -222
- package/openxiangda-skills/skills/openxiangda-form/SKILL.md +0 -184
- package/openxiangda-skills/skills/openxiangda-inspect/SKILL.md +0 -63
- package/openxiangda-skills/skills/openxiangda-open-api/SKILL.md +0 -57
- package/openxiangda-skills/skills/openxiangda-open-api/agents/openai.yaml +0 -4
- package/openxiangda-skills/skills/openxiangda-open-api/references/backend-authentication.md +0 -63
- package/openxiangda-skills/skills/openxiangda-open-api/references/dingtalk-api.openapi.json +0 -15653
- package/openxiangda-skills/skills/openxiangda-page/SKILL.md +0 -154
- package/openxiangda-skills/skills/openxiangda-permission-settings/SKILL.md +0 -209
- package/openxiangda-skills/skills/openxiangda-workflow-automation/SKILL.md +0 -201
- package/packages/sdk/bin/lowcode-workspace.mjs +0 -4
- package/packages/sdk/dist/ProcessPreview-DSUIJi5V.d.mts +0 -1292
- package/packages/sdk/dist/ProcessPreview-DSUIJi5V.d.ts +0 -1292
- package/packages/sdk/dist/build/index.cjs +0 -1
- package/packages/sdk/dist/build/index.d.mts +0 -60
- package/packages/sdk/dist/build/index.d.ts +0 -60
- package/packages/sdk/dist/build/index.mjs +0 -1
- package/packages/sdk/dist/components/index.cjs +0 -148
- package/packages/sdk/dist/components/index.d.mts +0 -970
- package/packages/sdk/dist/components/index.d.ts +0 -970
- package/packages/sdk/dist/components/index.mjs +0 -148
- package/packages/sdk/dist/dataManagementApi-Ro9itwm8.d.ts +0 -142
- package/packages/sdk/dist/dataManagementApi-p_HOhQnA.d.mts +0 -142
- package/packages/sdk/dist/runtime/index.cjs +0 -148
- package/packages/sdk/dist/runtime/index.d.mts +0 -171
- package/packages/sdk/dist/runtime/index.d.ts +0 -171
- package/packages/sdk/dist/runtime/index.mjs +0 -148
- package/packages/sdk/dist/runtime/react.cjs +0 -148
- package/packages/sdk/dist/runtime/react.d.mts +0 -3202
- package/packages/sdk/dist/runtime/react.d.ts +0 -3202
- package/packages/sdk/dist/runtime/react.mjs +0 -148
- package/packages/sdk/dist/styles/antd-theme.cjs +0 -1
- package/packages/sdk/dist/styles/antd-theme.d.mts +0 -6
- package/packages/sdk/dist/styles/antd-theme.d.ts +0 -6
- package/packages/sdk/dist/styles/antd-theme.mjs +0 -1
- package/packages/sdk/dist/styles/tailwind-preset.cjs +0 -1
- package/packages/sdk/dist/styles/tailwind-preset.d.mts +0 -74
- package/packages/sdk/dist/styles/tailwind-preset.d.ts +0 -74
- package/packages/sdk/dist/styles/tailwind-preset.mjs +0 -1
- package/packages/sdk/dist/styles/tokens.css +0 -74
- package/packages/sdk/dist/workflow/index.cjs +0 -3
- package/packages/sdk/dist/workflow/index.d.mts +0 -291
- package/packages/sdk/dist/workflow/index.d.ts +0 -291
- package/packages/sdk/dist/workflow/index.mjs +0 -3
- package/packages/sdk/source/admin-list/AdminList.tsx +0 -1734
- package/packages/sdk/source/admin-list/README.md +0 -12
- package/packages/sdk/source/admin-list/dataSources.ts +0 -345
- package/packages/sdk/source/admin-list/index.ts +0 -42
- package/packages/sdk/source/admin-list/preferences.ts +0 -174
- package/packages/sdk/source/admin-list/types.ts +0 -273
- package/packages/sdk/src/build-source/README.md +0 -9
- package/packages/sdk/src/build-source/bin/lowcode-workspace.mjs +0 -7
- package/packages/sdk/src/build-source/package.json +0 -34
- package/packages/sdk/src/build-source/scripts/build-forms.mjs +0 -1129
- package/packages/sdk/src/build-source/scripts/build-pages.mjs +0 -897
- package/packages/sdk/src/build-source/scripts/build-workspace.mjs +0 -89
- package/packages/sdk/src/build-source/scripts/publish-all.mjs +0 -190
- package/packages/sdk/src/build-source/scripts/publish-oss.mjs +0 -144
- package/packages/sdk/src/build-source/scripts/register-bundle.mjs +0 -1
- package/packages/sdk/src/build-source/scripts/register.mjs +0 -362
- package/packages/sdk/src/build-source/scripts/sync-schema.mjs +0 -381
- package/packages/sdk/src/build-source/scripts/utils/form-api.mjs +0 -1058
- package/packages/sdk/src/build-source/scripts/utils/form-runtime-assets.mjs +0 -57
- package/packages/sdk/src/build-source/scripts/utils/incremental.mjs +0 -348
- package/packages/sdk/src/build-source/scripts/utils/load-config.mjs +0 -331
- package/packages/sdk/src/build-source/scripts/utils/mime-types.mjs +0 -70
- package/packages/sdk/src/build-source/scripts/utils/namespace-css.mjs +0 -77
- package/packages/sdk/src/build-source/scripts/utils/oss-client.mjs +0 -128
- package/packages/sdk/src/build-source/scripts/utils/pages.mjs +0 -150
- package/packages/sdk/src/build-source/scripts/utils/progress.mjs +0 -57
- package/packages/sdk/src/build-source/scripts/utils/publish-oss-patterns.mjs +0 -20
- package/packages/sdk/src/build-source/scripts/utils/register-payload.mjs +0 -90
- package/packages/sdk/src/build-source/scripts/utils/runtime-css-check.mjs +0 -44
- package/packages/sdk/src/build-source/scripts/utils/schema-transform.mjs +0 -142
- package/packages/sdk/src/build-source/scripts/utils/static-assets.mjs +0 -165
- package/packages/sdk/src/build-source/scripts/utils/tailwind-config.mjs +0 -283
- package/packages/sdk/src/build-source/scripts/utils/tailwind-token-warnings.mjs +0 -146
- package/packages/sdk/src/build-source/scripts/utils/workspace-style-entry.mjs +0 -29
- package/packages/sdk/src/build-source/src/cli.mjs +0 -735
- package/policy/openxiangda-policy.json +0 -72
- package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-form.mdc +0 -24
- package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-page.mdc +0 -25
- package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-resources.mdc +0 -32
- package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-workflow-automation.mdc +0 -26
- package/templates/openxiangda-react-spa/.cursor/rules/openxiangda.mdc +0 -68
- package/templates/openxiangda-react-spa/.env.example +0 -4
- package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-form.md +0 -37
- package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-page.md +0 -29
- package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-resources.md +0 -32
- package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-workflow-automation.md +0 -34
- package/templates/openxiangda-react-spa/.qoder/rules/openxiangda.md +0 -66
- package/templates/openxiangda-react-spa/AGENTS.md +0 -192
- package/templates/openxiangda-react-spa/DELIVERY.md +0 -43
- package/templates/openxiangda-react-spa/app-workspace.config.ts +0 -50
- package/templates/openxiangda-react-spa/index.html +0 -12
- package/templates/openxiangda-react-spa/package.json +0 -53
- package/templates/openxiangda-react-spa/postcss.config.cjs +0 -6
- package/templates/openxiangda-react-spa/scripts/build-js-code.mjs +0 -600
- package/templates/openxiangda-react-spa/scripts/deploy.mjs +0 -18
- package/templates/openxiangda-react-spa/scripts/guard-publish.mjs +0 -21
- package/templates/openxiangda-react-spa/src/app/navigation.ts +0 -73
- package/templates/openxiangda-react-spa/src/app/router.tsx +0 -146
- package/templates/openxiangda-react-spa/src/app/starter-content.ts +0 -144
- package/templates/openxiangda-react-spa/src/forms/.gitkeep +0 -1
- package/templates/openxiangda-react-spa/src/layouts/AdminShell.tsx +0 -570
- package/templates/openxiangda-react-spa/src/main.tsx +0 -21
- package/templates/openxiangda-react-spa/src/pages/admin/AdminDashboardPage.tsx +0 -170
- package/templates/openxiangda-react-spa/src/pages/admin/LoginLogPage.tsx +0 -425
- package/templates/openxiangda-react-spa/src/pages/defaults/DataRoutePage.tsx +0 -36
- package/templates/openxiangda-react-spa/src/pages/defaults/FilePreviewRoutePage.tsx +0 -65
- package/templates/openxiangda-react-spa/src/pages/defaults/FormRoutePage.tsx +0 -235
- package/templates/openxiangda-react-spa/src/pages/public/PublicRegisterPage.tsx +0 -15
- package/templates/openxiangda-react-spa/src/pages/states/NotFoundPage.tsx +0 -31
- package/templates/openxiangda-react-spa/src/resources/menus/menus.json +0 -22
- package/templates/openxiangda-react-spa/src/resources/permissions/page-groups/app-admin.json +0 -8
- package/templates/openxiangda-react-spa/src/resources/permissions/page-groups/public-visitor.json +0 -8
- package/templates/openxiangda-react-spa/src/resources/public-access/public-register.json +0 -14
- package/templates/openxiangda-react-spa/src/resources/roles/roles.json +0 -15
- package/templates/openxiangda-react-spa/src/resources/routes/public-register.json +0 -8
- package/templates/openxiangda-react-spa/src/runtime/default-page-overrides.tsx +0 -35
- package/templates/openxiangda-react-spa/src/runtime/default-routes.ts +0 -16
- package/templates/openxiangda-react-spa/src/shared/form-schema.ts +0 -135
- package/templates/openxiangda-react-spa/src/shared/mac-admin.tsx +0 -651
- package/templates/openxiangda-react-spa/src/shared/ui.tsx +0 -22
- package/templates/openxiangda-react-spa/src/styles/index.css +0 -105
- package/templates/openxiangda-react-spa/tailwind.config.cjs +0 -37
- package/templates/openxiangda-react-spa/tsconfig.app.json +0 -36
- package/templates/openxiangda-react-spa/tsconfig.js-code-nodes.json +0 -19
- package/templates/openxiangda-react-spa/tsconfig.json +0 -7
- package/templates/openxiangda-react-spa/tsconfig.node.json +0 -10
- package/templates/openxiangda-react-spa/vite.config.ts +0 -209
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-form.mdc +0 -24
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-page.mdc +0 -21
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-resources.mdc +0 -40
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-workflow-automation.mdc +0 -21
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda.mdc +0 -81
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-form.md +0 -38
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-page.md +0 -39
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-resources.md +0 -59
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-workflow-automation.md +0 -46
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda.md +0 -82
- package/templates/sy-lowcode-app-workspace/AGENTS.md +0 -158
- package/templates/sy-lowcode-app-workspace/DELIVERY.md +0 -43
- package/templates/sy-lowcode-app-workspace/app-workspace.config.ts +0 -51
- package/templates/sy-lowcode-app-workspace/examples/best-practices/README.md +0 -43
- package/templates/sy-lowcode-app-workspace/examples/best-practices/access-governance.md +0 -239
- package/templates/sy-lowcode-app-workspace/examples/best-practices/catalog.json +0 -99
- package/templates/sy-lowcode-app-workspace/examples/best-practices/decision-guide.md +0 -94
- package/templates/sy-lowcode-app-workspace/examples/best-practices/design-style.md +0 -91
- package/templates/sy-lowcode-app-workspace/examples/best-practices/module-structure.md +0 -48
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/role-governance/index.ts +0 -2
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/role-governance/permissions.test.ts +0 -52
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/role-governance/permissions.ts +0 -37
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/role-governance/types.ts +0 -19
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/index.ts +0 -4
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/permissions.test.ts +0 -42
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/permissions.ts +0 -25
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/state-machine.test.ts +0 -63
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/state-machine.ts +0 -73
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/ticket-query.test.ts +0 -34
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/ticket-query.ts +0 -73
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/types.ts +0 -66
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/app-role/page.tsx +0 -1
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/app-role/schema.ts +0 -109
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/customer-profile/page.tsx +0 -1
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/customer-profile/schema.ts +0 -92
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/service-ticket/page.tsx +0 -1
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/service-ticket/schema.ts +0 -153
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/ticket-action-log/page.tsx +0 -1
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/ticket-action-log/schema.ts +0 -65
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/js-code-nodes/daily_ticket_digest/index.ts +0 -44
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/js-code-nodes/sync_roles_to_platform/index.ts +0 -33
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/App.tsx +0 -8
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/GlassHomeDashboard.tsx +0 -232
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/styles.css +0 -196
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/App.tsx +0 -7
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/WorkbenchPage.tsx +0 -36
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/components/ConfigPanel.tsx +0 -34
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/components/PreviewPanel.tsx +0 -17
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/page.config.ts +0 -9
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/reducer.ts +0 -29
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/styles.css +0 -24
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/App.tsx +0 -8
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/MintAnalyticsDashboard.tsx +0 -279
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/styles.css +0 -163
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/App.tsx +0 -7
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/MobilePortalShell.tsx +0 -31
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/modules/MobileHome.tsx +0 -13
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/routes.ts +0 -13
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/styles.css +0 -11
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/App.tsx +0 -8
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/OpsMonitorDashboard.tsx +0 -306
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/styles.css +0 -248
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/App.tsx +0 -7
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/PcPortalShell.tsx +0 -35
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/components/PortalMetric.tsx +0 -11
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/modules/HomeModule.tsx +0 -25
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/modules/TicketsModule.tsx +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/routes.ts +0 -19
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/styles.css +0 -35
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/App.tsx +0 -7
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/TicketOpsPage.tsx +0 -105
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/components/TicketActionTimeline.tsx +0 -22
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/components/TicketDetailDrawer.tsx +0 -44
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/components/TicketTableActions.tsx +0 -57
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/page.config.ts +0 -9
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/styles.css +0 -35
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/App.tsx +0 -8
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/WorkOrderListDrawerPage.tsx +0 -371
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/styles.css +0 -182
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/automations/daily-ticket-digest/automation.json +0 -25
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/automations/daily-ticket-digest/trigger.json +0 -9
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/notifications/daily-ticket-digest.json +0 -24
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/permissions/form-groups/service-ticket-college.json +0 -21
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/permissions/roles.json +0 -17
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/workflows/expense-approval-workflow.json +0 -48
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/ConfirmAction.tsx +0 -22
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/QueryState.tsx +0 -37
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/StatusTag.tsx +0 -20
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/DashboardPrimitives.tsx +0 -832
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/chartOptions.ts +0 -140
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/sampleData.ts +0 -466
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/styles.css +0 -874
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/types.ts +0 -150
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/hooks/useTicketOps.ts +0 -96
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/services/role-governance.ts +0 -48
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/services/service-ticket.ts +0 -113
- package/templates/sy-lowcode-app-workspace/examples/forms/customer/page.tsx +0 -1
- package/templates/sy-lowcode-app-workspace/examples/forms/customer/schema.ts +0 -36
- package/templates/sy-lowcode-app-workspace/index.html +0 -12
- package/templates/sy-lowcode-app-workspace/package.json +0 -58
- package/templates/sy-lowcode-app-workspace/postcss.config.cjs +0 -9
- package/templates/sy-lowcode-app-workspace/scripts/build-js-code.mjs +0 -600
- package/templates/sy-lowcode-app-workspace/scripts/guard-publish.mjs +0 -29
- package/templates/sy-lowcode-app-workspace/src/dev/App.tsx +0 -820
- package/templates/sy-lowcode-app-workspace/src/forms/.gitkeep +0 -1
- package/templates/sy-lowcode-app-workspace/src/forms/README.md +0 -52
- package/templates/sy-lowcode-app-workspace/src/index.css +0 -26
- package/templates/sy-lowcode-app-workspace/src/js-code-nodes/.gitkeep +0 -1
- package/templates/sy-lowcode-app-workspace/src/js-code-nodes/types.d.ts +0 -3
- package/templates/sy-lowcode-app-workspace/src/main.tsx +0 -29
- package/templates/sy-lowcode-app-workspace/src/pages/.gitkeep +0 -1
- package/templates/sy-lowcode-app-workspace/src/runtime/builtin-overrides.tsx +0 -8
- package/templates/sy-lowcode-app-workspace/src/shared/form-schema.ts +0 -135
- package/templates/sy-lowcode-app-workspace/src/types/app-workspace.types.ts +0 -88
- package/templates/sy-lowcode-app-workspace/tailwind.config.cjs +0 -31
- package/templates/sy-lowcode-app-workspace/tsconfig.app.json +0 -40
- package/templates/sy-lowcode-app-workspace/tsconfig.examples.json +0 -24
- package/templates/sy-lowcode-app-workspace/tsconfig.js-code-nodes.json +0 -19
- package/templates/sy-lowcode-app-workspace/tsconfig.json +0 -7
- package/templates/sy-lowcode-app-workspace/tsconfig.node.json +0 -10
- package/templates/sy-lowcode-app-workspace/vite.config.ts +0 -85
- package/v2/README.md +0 -35
- package/v2/skills/manifest.json +0 -45
- package/v2/skills/openxiangda-v1-maintenance/SKILL.md +0 -21
- package/v2/skills/openxiangda-v1-maintenance/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2/SKILL.md +0 -38
- package/v2/skills/openxiangda-v2-architecture/SKILL.md +0 -29
- package/v2/skills/openxiangda-v2-architecture/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2-backend/SKILL.md +0 -28
- package/v2/skills/openxiangda-v2-backend/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2-data-authz/SKILL.md +0 -28
- package/v2/skills/openxiangda-v2-data-authz/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2-delivery/SKILL.md +0 -30
- package/v2/skills/openxiangda-v2-delivery/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2-frontend/SKILL.md +0 -21
- package/v2/skills/openxiangda-v2-frontend/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2-workflow-events/SKILL.md +0 -28
- package/v2/skills/openxiangda-v2-workflow-events/agents/openai.yaml +0 -4
- /package/{v2/skills → skills}/openxiangda-v2/agents/openai.yaml +0 -0
package/lib/worktree-cleanup.js
DELETED
|
@@ -1,631 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const crypto = require('crypto');
|
|
4
|
-
const { spawnSync } = require('child_process');
|
|
5
|
-
|
|
6
|
-
const { resolveAuthoritativeMainline } = require('./release-mainline');
|
|
7
|
-
const {
|
|
8
|
-
getWorktreeOwnerStatus,
|
|
9
|
-
hasManagedWorktreeMarker,
|
|
10
|
-
managedWorktreeMarkerFile,
|
|
11
|
-
withWorktreeOwnerLock,
|
|
12
|
-
} = require('./worktree-owner');
|
|
13
|
-
|
|
14
|
-
const GIT_OUTPUT_LIMIT = 16 * 1024 * 1024;
|
|
15
|
-
const PRIVATE_RELEASE_PATHS = [
|
|
16
|
-
path.join('.openxiangda', 'candidates'),
|
|
17
|
-
path.join('.openxiangda', 'releases'),
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
function planWorktreeCleanup(options = {}) {
|
|
21
|
-
const cwd = path.resolve(options.cwd || process.cwd());
|
|
22
|
-
const repositoryRoot = readGit(cwd, ['rev-parse', '--show-toplevel']).stdout;
|
|
23
|
-
const currentWorktree = normalizeExistingPath(repositoryRoot);
|
|
24
|
-
const currentBranch = readGit(cwd, ['branch', '--show-current'], {
|
|
25
|
-
allowFailure: true,
|
|
26
|
-
}).stdout;
|
|
27
|
-
const currentHead = readGit(cwd, ['rev-parse', 'HEAD']).stdout;
|
|
28
|
-
const mainline = resolveAuthoritativeMainline({ cwd });
|
|
29
|
-
const currentDirtyPaths = readStatusPaths(cwd);
|
|
30
|
-
const globalBlockers = [];
|
|
31
|
-
|
|
32
|
-
if (currentBranch !== mainline.branchName) {
|
|
33
|
-
globalBlockers.push(
|
|
34
|
-
blocker(
|
|
35
|
-
'WORKTREE_CLEANUP_MAINLINE_REQUIRED',
|
|
36
|
-
`清理只能从 canonical ${mainline.branchName} 工作区执行;当前分支为 ${currentBranch || '(detached)'}`
|
|
37
|
-
)
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
if (currentHead !== mainline.tipCommit) {
|
|
41
|
-
globalBlockers.push(
|
|
42
|
-
blocker(
|
|
43
|
-
'WORKTREE_CLEANUP_MAINLINE_NOT_SYNCED',
|
|
44
|
-
`canonical 工作区 ${shortCommit(currentHead)} 必须与 ${mainline.remoteName}/${mainline.branchName}@${shortCommit(mainline.tipCommit)} 完全一致`
|
|
45
|
-
)
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
if (currentDirtyPaths.length > 0) {
|
|
49
|
-
globalBlockers.push(
|
|
50
|
-
blocker(
|
|
51
|
-
'WORKTREE_CLEANUP_MAINLINE_DIRTY',
|
|
52
|
-
`canonical 工作区必须干净;未提交路径: ${summarizePaths(currentDirtyPaths)}`,
|
|
53
|
-
{ dirtyPaths: currentDirtyPaths }
|
|
54
|
-
)
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const worktrees = parseWorktreeList(
|
|
59
|
-
readGit(cwd, ['worktree', 'list', '--porcelain']).stdout
|
|
60
|
-
);
|
|
61
|
-
const candidates = worktrees
|
|
62
|
-
.map(record =>
|
|
63
|
-
inspectWorktree(record, {
|
|
64
|
-
cwd,
|
|
65
|
-
currentHead,
|
|
66
|
-
currentWorktree,
|
|
67
|
-
mainline,
|
|
68
|
-
})
|
|
69
|
-
)
|
|
70
|
-
.filter(Boolean);
|
|
71
|
-
const safeCandidates = candidates.filter(candidate => candidate.safeToRemove);
|
|
72
|
-
const blockedCandidates = candidates.filter(candidate => !candidate.safeToRemove);
|
|
73
|
-
|
|
74
|
-
const plan = {
|
|
75
|
-
schemaVersion: 1,
|
|
76
|
-
dryRun: true,
|
|
77
|
-
repositoryRoot,
|
|
78
|
-
canonical: {
|
|
79
|
-
worktree: currentWorktree,
|
|
80
|
-
branch: currentBranch || null,
|
|
81
|
-
commit: currentHead,
|
|
82
|
-
clean: currentDirtyPaths.length === 0,
|
|
83
|
-
dirtyPaths: currentDirtyPaths,
|
|
84
|
-
},
|
|
85
|
-
mainline,
|
|
86
|
-
globalBlockers,
|
|
87
|
-
canApply: globalBlockers.length === 0,
|
|
88
|
-
candidates,
|
|
89
|
-
summary: {
|
|
90
|
-
linkedWorktrees: worktrees.length,
|
|
91
|
-
safe: safeCandidates.length,
|
|
92
|
-
blocked: blockedCandidates.length,
|
|
93
|
-
staleRecords: candidates.filter(candidate => candidate.prunable).length,
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
plan.planHash = cleanupPlanHash(plan);
|
|
97
|
-
return plan;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function applyWorktreeCleanup(plan, options = {}) {
|
|
101
|
-
if (!plan || typeof plan !== 'object') {
|
|
102
|
-
throw cleanupError(
|
|
103
|
-
'WORKTREE_CLEANUP_PLAN_REQUIRED',
|
|
104
|
-
'apply 需要同一进程刚生成的 cleanup plan'
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
const cwd = path.resolve(options.cwd || plan.repositoryRoot || process.cwd());
|
|
108
|
-
if (plan.planHash !== cleanupPlanHash(plan)) {
|
|
109
|
-
throw cleanupError(
|
|
110
|
-
'WORKTREE_CLEANUP_PLAN_TAMPERED',
|
|
111
|
-
'cleanup plan 内容与 planHash 不一致;请重新执行 dry-run'
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
if (!plan.canApply) {
|
|
115
|
-
throw cleanupError(
|
|
116
|
-
'WORKTREE_CLEANUP_PLAN_BLOCKED',
|
|
117
|
-
'dry-run 计划本身未通过 canonical 门禁;状态修复后请重新审阅'
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
const currentPlan = planWorktreeCleanup({ cwd });
|
|
121
|
-
if (
|
|
122
|
-
normalizeExistingPath(currentPlan.repositoryRoot) !==
|
|
123
|
-
normalizeExistingPath(plan.repositoryRoot)
|
|
124
|
-
) {
|
|
125
|
-
throw cleanupError(
|
|
126
|
-
'WORKTREE_CLEANUP_REPOSITORY_CHANGED',
|
|
127
|
-
'apply 必须在生成 dry-run 的同一仓库执行'
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
if (!currentPlan.canApply) {
|
|
131
|
-
throw cleanupError(
|
|
132
|
-
'WORKTREE_CLEANUP_MAINLINE_BLOCKED',
|
|
133
|
-
`canonical 工作区未通过清理门禁: ${currentPlan.globalBlockers
|
|
134
|
-
.map(item => item.code)
|
|
135
|
-
.join(', ')}`
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
const applied = [];
|
|
139
|
-
const failures = [];
|
|
140
|
-
const approvedCandidates = (plan.candidates || []).filter(
|
|
141
|
-
candidate => candidate.safeToRemove
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
for (const approved of approvedCandidates) {
|
|
145
|
-
const candidate = findExactCandidate(
|
|
146
|
-
currentPlan.candidates,
|
|
147
|
-
approved
|
|
148
|
-
);
|
|
149
|
-
if (!candidate?.safeToRemove) {
|
|
150
|
-
failures.push({
|
|
151
|
-
action: approved.prunable
|
|
152
|
-
? 'prune-worktree-record'
|
|
153
|
-
: 'remove-worktree',
|
|
154
|
-
path: approved.path,
|
|
155
|
-
branch: approved.branch,
|
|
156
|
-
code: 'WORKTREE_CLEANUP_PLAN_STALE',
|
|
157
|
-
message:
|
|
158
|
-
'dry-run 后 worktree 身份或安全状态已变化;本次跳过,请重新审查',
|
|
159
|
-
});
|
|
160
|
-
continue;
|
|
161
|
-
}
|
|
162
|
-
if (candidate.prunable) {
|
|
163
|
-
failures.push({
|
|
164
|
-
action: 'prune-worktree-record',
|
|
165
|
-
path: candidate.path,
|
|
166
|
-
branch: candidate.branch,
|
|
167
|
-
code: 'WORKTREE_CLEANUP_STALE_RECORD_MANUAL_PRUNE_REQUIRED',
|
|
168
|
-
message:
|
|
169
|
-
'失效记录不自动全局 prune;请确认全部 stale 记录后手工执行 git worktree prune',
|
|
170
|
-
});
|
|
171
|
-
continue;
|
|
172
|
-
}
|
|
173
|
-
try {
|
|
174
|
-
withWorktreeOwnerLock({ cwd: candidate.path }, () => {
|
|
175
|
-
const lockedPlan = planWorktreeCleanup({ cwd });
|
|
176
|
-
const lockedCandidate = findExactCandidate(
|
|
177
|
-
lockedPlan.candidates,
|
|
178
|
-
approved
|
|
179
|
-
);
|
|
180
|
-
if (!lockedPlan.canApply || !lockedCandidate?.safeToRemove) {
|
|
181
|
-
throw cleanupError(
|
|
182
|
-
'WORKTREE_CLEANUP_REVALIDATION_FAILED',
|
|
183
|
-
'owner lock 内复核发现 worktree 已变化或不再安全'
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
const managedMarker = managedWorktreeMarkerFile({
|
|
187
|
-
cwd: candidate.path,
|
|
188
|
-
});
|
|
189
|
-
runGit(cwd, ['worktree', 'remove', candidate.path]);
|
|
190
|
-
fs.rmSync(managedMarker, { force: true });
|
|
191
|
-
});
|
|
192
|
-
applied.push({
|
|
193
|
-
action: 'remove-worktree',
|
|
194
|
-
path: candidate.path,
|
|
195
|
-
branch: candidate.branch,
|
|
196
|
-
});
|
|
197
|
-
} catch (error) {
|
|
198
|
-
failures.push({
|
|
199
|
-
action: 'remove-worktree',
|
|
200
|
-
path: candidate.path,
|
|
201
|
-
branch: candidate.branch,
|
|
202
|
-
code: error.code || 'WORKTREE_CLEANUP_REMOVE_FAILED',
|
|
203
|
-
message: error.message,
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
for (const approved of approvedCandidates) {
|
|
209
|
-
const candidate = findExactCandidate(
|
|
210
|
-
currentPlan.candidates,
|
|
211
|
-
approved
|
|
212
|
-
);
|
|
213
|
-
if (
|
|
214
|
-
!candidate ||
|
|
215
|
-
candidate.prunable ||
|
|
216
|
-
!candidate.branch ||
|
|
217
|
-
!candidate.localBranch
|
|
218
|
-
) {
|
|
219
|
-
continue;
|
|
220
|
-
}
|
|
221
|
-
const worktreeFailure = failures.some(
|
|
222
|
-
failure =>
|
|
223
|
-
failure.action === 'remove-worktree' &&
|
|
224
|
-
failure.path === candidate.path
|
|
225
|
-
);
|
|
226
|
-
if (worktreeFailure) continue;
|
|
227
|
-
try {
|
|
228
|
-
const branchHead = readGit(
|
|
229
|
-
cwd,
|
|
230
|
-
['rev-parse', `refs/heads/${candidate.branch}`],
|
|
231
|
-
{ allowFailure: true }
|
|
232
|
-
);
|
|
233
|
-
if (!branchHead.ok || branchHead.stdout !== candidate.head) {
|
|
234
|
-
throw cleanupError(
|
|
235
|
-
'WORKTREE_CLEANUP_BRANCH_MOVED',
|
|
236
|
-
`本地分支 ${candidate.branch} 在 dry-run 后已移动,拒绝删除`
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
runGit(cwd, ['branch', '-d', candidate.branch]);
|
|
240
|
-
applied.push({
|
|
241
|
-
action: 'delete-local-branch',
|
|
242
|
-
branch: candidate.branch,
|
|
243
|
-
});
|
|
244
|
-
} catch (error) {
|
|
245
|
-
failures.push({
|
|
246
|
-
action: 'delete-local-branch',
|
|
247
|
-
branch: candidate.branch,
|
|
248
|
-
code: error.code || 'WORKTREE_CLEANUP_BRANCH_DELETE_FAILED',
|
|
249
|
-
message: error.message,
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
return {
|
|
255
|
-
...currentPlan,
|
|
256
|
-
dryRun: false,
|
|
257
|
-
applied,
|
|
258
|
-
failures,
|
|
259
|
-
remoteBranchesRetained: true,
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
function inspectWorktree(record, context) {
|
|
264
|
-
const worktreePath = normalizePath(record.path);
|
|
265
|
-
if (samePath(worktreePath, context.currentWorktree)) return null;
|
|
266
|
-
|
|
267
|
-
const exists = fs.existsSync(worktreePath);
|
|
268
|
-
const prunable = Boolean(record.prunable || !exists);
|
|
269
|
-
const branch = normalizeLocalBranch(record.branch);
|
|
270
|
-
const managed =
|
|
271
|
-
Boolean(branch?.startsWith('codex/')) ||
|
|
272
|
-
(exists && hasManagedWorktreeMarker({ cwd: worktreePath }));
|
|
273
|
-
const localBranch = branch
|
|
274
|
-
? readGit(context.cwd, ['show-ref', '--verify', '--quiet', `refs/heads/${branch}`], {
|
|
275
|
-
allowFailure: true,
|
|
276
|
-
}).ok
|
|
277
|
-
: false;
|
|
278
|
-
const blockers = [];
|
|
279
|
-
const headContained = Boolean(
|
|
280
|
-
record.head &&
|
|
281
|
-
readGit(
|
|
282
|
-
context.cwd,
|
|
283
|
-
['merge-base', '--is-ancestor', record.head, context.currentHead],
|
|
284
|
-
{ allowFailure: true }
|
|
285
|
-
).status === 0
|
|
286
|
-
);
|
|
287
|
-
|
|
288
|
-
if (!branch) {
|
|
289
|
-
blockers.push(
|
|
290
|
-
blocker(
|
|
291
|
-
'WORKTREE_CLEANUP_NAMED_BRANCH_REQUIRED',
|
|
292
|
-
'detached worktree 不自动删除;请先人工确认用途'
|
|
293
|
-
)
|
|
294
|
-
);
|
|
295
|
-
} else if (branch === context.mainline.branchName) {
|
|
296
|
-
blockers.push(
|
|
297
|
-
blocker(
|
|
298
|
-
'WORKTREE_CLEANUP_MAINLINE_PROTECTED',
|
|
299
|
-
`禁止删除 ${context.mainline.branchName} worktree`
|
|
300
|
-
)
|
|
301
|
-
);
|
|
302
|
-
}
|
|
303
|
-
if (!headContained) {
|
|
304
|
-
blockers.push(
|
|
305
|
-
blocker(
|
|
306
|
-
'WORKTREE_CLEANUP_NOT_IN_MAINLINE',
|
|
307
|
-
`${shortCommit(record.head)} 尚未包含在 ${context.mainline.remoteName}/${context.mainline.branchName}@${shortCommit(context.currentHead)}`
|
|
308
|
-
)
|
|
309
|
-
);
|
|
310
|
-
}
|
|
311
|
-
if (record.locked) {
|
|
312
|
-
blockers.push(
|
|
313
|
-
blocker(
|
|
314
|
-
'WORKTREE_CLEANUP_LOCKED',
|
|
315
|
-
`Git worktree 仍被锁定${record.lockedReason ? `: ${record.lockedReason}` : ''}`
|
|
316
|
-
)
|
|
317
|
-
);
|
|
318
|
-
}
|
|
319
|
-
if (!managed) {
|
|
320
|
-
blockers.push(
|
|
321
|
-
blocker(
|
|
322
|
-
'WORKTREE_CLEANUP_UNMANAGED',
|
|
323
|
-
'仅自动删除 OpenXiangda 标记或 codex/* 任务 worktree'
|
|
324
|
-
)
|
|
325
|
-
);
|
|
326
|
-
}
|
|
327
|
-
if (prunable) {
|
|
328
|
-
blockers.push(
|
|
329
|
-
blocker(
|
|
330
|
-
'WORKTREE_CLEANUP_STALE_RECORD_MANUAL_PRUNE_REQUIRED',
|
|
331
|
-
'stale 记录只能整体 prune,自动清理禁止执行全局 git worktree prune'
|
|
332
|
-
)
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
let dirtyPaths = [];
|
|
337
|
-
let owner = null;
|
|
338
|
-
let privateReleasePaths = [];
|
|
339
|
-
let promotionStatePaths = [];
|
|
340
|
-
if (prunable && exists) {
|
|
341
|
-
blockers.push(
|
|
342
|
-
blocker(
|
|
343
|
-
'WORKTREE_CLEANUP_STALE_PATH_PRESENT',
|
|
344
|
-
'Git 记录已失效但目录仍存在;请先人工检查目录内容,禁止自动清理'
|
|
345
|
-
)
|
|
346
|
-
);
|
|
347
|
-
} else if (exists) {
|
|
348
|
-
dirtyPaths = readStatusPaths(worktreePath);
|
|
349
|
-
if (dirtyPaths.length > 0) {
|
|
350
|
-
blockers.push(
|
|
351
|
-
blocker(
|
|
352
|
-
'WORKTREE_CLEANUP_DIRTY',
|
|
353
|
-
`存在未提交路径: ${summarizePaths(dirtyPaths)}`,
|
|
354
|
-
{ dirtyPaths }
|
|
355
|
-
)
|
|
356
|
-
);
|
|
357
|
-
}
|
|
358
|
-
owner = getWorktreeOwnerStatus({ cwd: worktreePath });
|
|
359
|
-
if (owner.invalid) {
|
|
360
|
-
blockers.push(
|
|
361
|
-
blocker(
|
|
362
|
-
'WORKTREE_CLEANUP_OWNER_STATE_INVALID',
|
|
363
|
-
'worktree ownership 文件无法解析;按占用状态处理,禁止自动删除'
|
|
364
|
-
)
|
|
365
|
-
);
|
|
366
|
-
} else if (owner.active) {
|
|
367
|
-
blockers.push(
|
|
368
|
-
blocker(
|
|
369
|
-
'WORKTREE_CLEANUP_OWNER_ACTIVE',
|
|
370
|
-
`worktree 仍由任务 ${owner.owner?.threadId || '(unknown)'} 占用`,
|
|
371
|
-
{
|
|
372
|
-
threadId: owner.owner?.threadId || null,
|
|
373
|
-
changeId: owner.owner?.changeId || null,
|
|
374
|
-
expiresAt: owner.owner?.expiresAt || null,
|
|
375
|
-
}
|
|
376
|
-
)
|
|
377
|
-
);
|
|
378
|
-
}
|
|
379
|
-
privateReleasePaths = PRIVATE_RELEASE_PATHS.filter(relativePath =>
|
|
380
|
-
directoryHasEntries(path.join(worktreePath, relativePath))
|
|
381
|
-
);
|
|
382
|
-
if (privateReleasePaths.length > 0) {
|
|
383
|
-
blockers.push(
|
|
384
|
-
blocker(
|
|
385
|
-
'WORKTREE_CLEANUP_RELEASE_JOURNAL_PRESENT',
|
|
386
|
-
`存在私有发布进度: ${privateReleasePaths.join(', ')};请先在该 worktree 完成 release status/end 或恢复处理`,
|
|
387
|
-
{ paths: privateReleasePaths }
|
|
388
|
-
)
|
|
389
|
-
);
|
|
390
|
-
}
|
|
391
|
-
promotionStatePaths = inspectPromotionState(worktreePath);
|
|
392
|
-
if (promotionStatePaths.length > 0) {
|
|
393
|
-
blockers.push(
|
|
394
|
-
blocker(
|
|
395
|
-
'WORKTREE_CLEANUP_PROMOTION_STATE_PRESENT',
|
|
396
|
-
`state.json 仍包含 lease/baseline: ${promotionStatePaths.join(', ')}`,
|
|
397
|
-
{ paths: promotionStatePaths }
|
|
398
|
-
)
|
|
399
|
-
);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
return {
|
|
404
|
-
path: worktreePath,
|
|
405
|
-
head: record.head || null,
|
|
406
|
-
branch,
|
|
407
|
-
localBranch,
|
|
408
|
-
exists,
|
|
409
|
-
prunable,
|
|
410
|
-
dirtyPaths,
|
|
411
|
-
owner: owner?.owner || null,
|
|
412
|
-
managed,
|
|
413
|
-
privateReleasePaths,
|
|
414
|
-
promotionStatePaths,
|
|
415
|
-
headContained,
|
|
416
|
-
blockers,
|
|
417
|
-
safeToRemove: blockers.length === 0,
|
|
418
|
-
plannedActions: blockers.length === 0
|
|
419
|
-
? [
|
|
420
|
-
prunable ? 'prune-worktree-record' : 'remove-worktree',
|
|
421
|
-
...(localBranch ? ['delete-local-branch'] : []),
|
|
422
|
-
]
|
|
423
|
-
: [],
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
function candidateIdentity(candidate) {
|
|
428
|
-
return [
|
|
429
|
-
normalizePath(candidate?.path),
|
|
430
|
-
candidate?.head || '',
|
|
431
|
-
candidate?.branch || '',
|
|
432
|
-
candidate?.prunable ? 'prunable' : 'linked',
|
|
433
|
-
].join('\n');
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
function findExactCandidate(candidates, expected) {
|
|
437
|
-
const identity = candidateIdentity(expected);
|
|
438
|
-
return (candidates || []).find(
|
|
439
|
-
candidate => candidateIdentity(candidate) === identity
|
|
440
|
-
);
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
function cleanupPlanHash(plan) {
|
|
444
|
-
const canonical = {
|
|
445
|
-
schemaVersion: plan?.schemaVersion,
|
|
446
|
-
repositoryRoot: plan?.repositoryRoot,
|
|
447
|
-
canonical: plan?.canonical,
|
|
448
|
-
mainline: plan?.mainline,
|
|
449
|
-
globalBlockers: plan?.globalBlockers,
|
|
450
|
-
candidates: plan?.candidates,
|
|
451
|
-
};
|
|
452
|
-
return crypto
|
|
453
|
-
.createHash('sha256')
|
|
454
|
-
.update(JSON.stringify(canonical))
|
|
455
|
-
.digest('hex');
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
function inspectPromotionState(worktreePath) {
|
|
459
|
-
const stateFile = path.join(worktreePath, '.openxiangda', 'state.json');
|
|
460
|
-
if (!fs.existsSync(stateFile)) return [];
|
|
461
|
-
let state;
|
|
462
|
-
try {
|
|
463
|
-
state = JSON.parse(fs.readFileSync(stateFile, 'utf8'));
|
|
464
|
-
} catch {
|
|
465
|
-
return ['.openxiangda/state.json#invalid'];
|
|
466
|
-
}
|
|
467
|
-
const matches = [];
|
|
468
|
-
for (const [name, binding] of Object.entries(state.profiles || {})) {
|
|
469
|
-
collectPromotionState(matches, `profiles.${name}`, binding);
|
|
470
|
-
}
|
|
471
|
-
for (const [name, binding] of Object.entries(state.targets || {})) {
|
|
472
|
-
collectPromotionState(matches, `targets.${name}`, binding);
|
|
473
|
-
}
|
|
474
|
-
return matches;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
function collectPromotionState(matches, prefix, binding) {
|
|
478
|
-
const promotion = binding?.promotion;
|
|
479
|
-
if (!promotion || typeof promotion !== 'object') return;
|
|
480
|
-
if (promotion.publishLease) matches.push(`${prefix}.promotion.publishLease`);
|
|
481
|
-
if (promotion.changeBaseline) {
|
|
482
|
-
matches.push(`${prefix}.promotion.changeBaseline`);
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
function parseWorktreeList(output) {
|
|
487
|
-
const records = [];
|
|
488
|
-
let current = null;
|
|
489
|
-
for (const rawLine of String(output || '').split(/\r?\n/)) {
|
|
490
|
-
const line = rawLine.trimEnd();
|
|
491
|
-
if (!line) {
|
|
492
|
-
if (current) records.push(current);
|
|
493
|
-
current = null;
|
|
494
|
-
continue;
|
|
495
|
-
}
|
|
496
|
-
const separator = line.indexOf(' ');
|
|
497
|
-
const key = separator === -1 ? line : line.slice(0, separator);
|
|
498
|
-
const value = separator === -1 ? '' : line.slice(separator + 1);
|
|
499
|
-
if (key === 'worktree') {
|
|
500
|
-
if (current) records.push(current);
|
|
501
|
-
current = { path: value };
|
|
502
|
-
continue;
|
|
503
|
-
}
|
|
504
|
-
if (!current) continue;
|
|
505
|
-
if (key === 'HEAD') current.head = value;
|
|
506
|
-
else if (key === 'branch') current.branch = value;
|
|
507
|
-
else if (key === 'detached') current.detached = true;
|
|
508
|
-
else if (key === 'locked') {
|
|
509
|
-
current.locked = true;
|
|
510
|
-
current.lockedReason = value || null;
|
|
511
|
-
} else if (key === 'prunable') {
|
|
512
|
-
current.prunable = true;
|
|
513
|
-
current.prunableReason = value || null;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
if (current) records.push(current);
|
|
517
|
-
return records;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
function readStatusPaths(cwd) {
|
|
521
|
-
return String(
|
|
522
|
-
readGit(cwd, ['status', '--porcelain=v1', '--untracked-files=all']).stdout ||
|
|
523
|
-
''
|
|
524
|
-
)
|
|
525
|
-
.split(/\r?\n/)
|
|
526
|
-
.filter(Boolean)
|
|
527
|
-
.map(line => line.slice(3).trim())
|
|
528
|
-
.filter(Boolean);
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
function directoryHasEntries(dir) {
|
|
532
|
-
if (!fs.existsSync(dir)) return false;
|
|
533
|
-
try {
|
|
534
|
-
return fs.statSync(dir).isDirectory() && fs.readdirSync(dir).length > 0;
|
|
535
|
-
} catch {
|
|
536
|
-
return true;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
function normalizeLocalBranch(value) {
|
|
541
|
-
const prefix = 'refs/heads/';
|
|
542
|
-
const text = String(value || '').trim();
|
|
543
|
-
return text.startsWith(prefix) ? text.slice(prefix.length) : null;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
function normalizeExistingPath(value) {
|
|
547
|
-
const resolved = normalizePath(value);
|
|
548
|
-
try {
|
|
549
|
-
return fs.realpathSync.native(resolved);
|
|
550
|
-
} catch {
|
|
551
|
-
return resolved;
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
function normalizePath(value) {
|
|
556
|
-
return path.resolve(String(value || ''));
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
function samePath(left, right) {
|
|
560
|
-
return normalizeExistingPath(left) === normalizeExistingPath(right);
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
function runGit(cwd, args) {
|
|
564
|
-
return readGit(cwd, args);
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
function readGit(cwd, args, options = {}) {
|
|
568
|
-
const result = spawnSync('git', ['-C', cwd, ...args], {
|
|
569
|
-
encoding: 'utf8',
|
|
570
|
-
maxBuffer: GIT_OUTPUT_LIMIT,
|
|
571
|
-
timeout: 30_000,
|
|
572
|
-
env: {
|
|
573
|
-
...process.env,
|
|
574
|
-
GIT_TERMINAL_PROMPT: '0',
|
|
575
|
-
},
|
|
576
|
-
});
|
|
577
|
-
const stdout = String(result.stdout || '').trim();
|
|
578
|
-
const stderr = String(result.stderr || '').trim();
|
|
579
|
-
const ok = !result.error && result.status === 0;
|
|
580
|
-
if (!ok && !options.allowFailure) {
|
|
581
|
-
throw cleanupError(
|
|
582
|
-
'WORKTREE_CLEANUP_GIT_FAILED',
|
|
583
|
-
`git ${args.join(' ')} 失败${stderr ? `: ${sanitizeGitError(stderr)}` : ''}`
|
|
584
|
-
);
|
|
585
|
-
}
|
|
586
|
-
return {
|
|
587
|
-
ok,
|
|
588
|
-
stdout,
|
|
589
|
-
stderr,
|
|
590
|
-
status: result.status,
|
|
591
|
-
error: result.error,
|
|
592
|
-
};
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
function blocker(code, message, details) {
|
|
596
|
-
return {
|
|
597
|
-
code,
|
|
598
|
-
message,
|
|
599
|
-
...(details === undefined ? {} : { details }),
|
|
600
|
-
};
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
function cleanupError(code, message) {
|
|
604
|
-
const error = new Error(`${code}: ${message}`);
|
|
605
|
-
error.code = code;
|
|
606
|
-
return error;
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
function sanitizeGitError(value) {
|
|
610
|
-
return String(value || '')
|
|
611
|
-
.replace(/https?:\/\/[^\s/@]+@/gi, 'https://***@')
|
|
612
|
-
.replace(/\s+/g, ' ')
|
|
613
|
-
.slice(0, 500);
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
function summarizePaths(paths, limit = 6) {
|
|
617
|
-
const selected = paths.slice(0, limit).join(', ');
|
|
618
|
-
return paths.length > limit
|
|
619
|
-
? `${selected}(另有 ${paths.length - limit} 项)`
|
|
620
|
-
: selected;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
function shortCommit(value) {
|
|
624
|
-
return String(value || '').slice(0, 12) || '-';
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
module.exports = {
|
|
628
|
-
applyWorktreeCleanup,
|
|
629
|
-
parseWorktreeList,
|
|
630
|
-
planWorktreeCleanup,
|
|
631
|
-
};
|