silvermoon 0.3.0-rc.2 → 0.4.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/README.md +28 -28
- package/README.zh-CN.md +26 -24
- package/dist/bin/build-npm-tarball.d.ts +28 -0
- package/dist/bin/build-npm-tarball.d.ts.map +1 -0
- package/dist/bin/build-npm-tarball.js +200 -0
- package/dist/bin/build-npm-tarball.js.map +1 -0
- package/dist/bin/check-pack.d.ts +2 -0
- package/dist/bin/check-pack.d.ts.map +1 -0
- package/dist/bin/check-pack.js +421 -0
- package/dist/bin/check-pack.js.map +1 -0
- package/dist/bin/ci-package-risk.d.ts +19 -0
- package/dist/bin/ci-package-risk.d.ts.map +1 -0
- package/dist/bin/ci-package-risk.js +78 -0
- package/dist/bin/ci-package-risk.js.map +1 -0
- package/dist/bin/generate-npm-readme.d.ts +7 -0
- package/dist/bin/generate-npm-readme.d.ts.map +1 -0
- package/dist/bin/generate-npm-readme.js +232 -0
- package/dist/bin/generate-npm-readme.js.map +1 -0
- package/dist/bin/migrate-v1-to-v2.d.ts +3 -0
- package/dist/bin/migrate-v1-to-v2.d.ts.map +1 -0
- package/dist/bin/migrate-v1-to-v2.js +25 -0
- package/dist/bin/migrate-v1-to-v2.js.map +1 -0
- package/dist/bin/prepare-npm-release.d.ts +46 -0
- package/dist/bin/prepare-npm-release.d.ts.map +1 -0
- package/dist/bin/prepare-npm-release.js +210 -0
- package/dist/bin/prepare-npm-release.js.map +1 -0
- package/dist/bin/pure-check.d.ts +15 -0
- package/dist/bin/pure-check.d.ts.map +1 -0
- package/dist/bin/pure-check.js +448 -0
- package/dist/bin/pure-check.js.map +1 -0
- package/dist/bin/run-checks.d.ts +34 -0
- package/dist/bin/run-checks.d.ts.map +1 -0
- package/dist/bin/run-checks.js +149 -0
- package/dist/bin/run-checks.js.map +1 -0
- package/dist/bin/silvermoon.d.ts +76 -0
- package/dist/bin/silvermoon.d.ts.map +1 -0
- package/dist/bin/silvermoon.js +401 -0
- package/dist/bin/silvermoon.js.map +1 -0
- package/dist/bin/sync-skills.d.ts +2 -0
- package/dist/bin/sync-skills.d.ts.map +1 -0
- package/dist/bin/sync-skills.js +78 -0
- package/dist/bin/sync-skills.js.map +1 -0
- package/dist/bin/verify-npm-release.d.ts +55 -0
- package/dist/bin/verify-npm-release.d.ts.map +1 -0
- package/dist/bin/verify-npm-release.js +418 -0
- package/dist/bin/verify-npm-release.js.map +1 -0
- package/dist/src/business/agent-copilot.d.ts +82 -0
- package/dist/src/business/agent-copilot.d.ts.map +1 -0
- package/dist/src/business/agent-copilot.js +330 -0
- package/dist/src/business/agent-copilot.js.map +1 -0
- package/dist/src/business/agent-project-registry.d.ts +22 -0
- package/dist/src/business/agent-project-registry.d.ts.map +1 -0
- package/dist/src/business/agent-project-registry.js +239 -0
- package/dist/src/business/agent-project-registry.js.map +1 -0
- package/dist/src/business/agent-project-runtime.d.ts +37 -0
- package/dist/src/business/agent-project-runtime.d.ts.map +1 -0
- package/dist/src/business/agent-project-runtime.js +198 -0
- package/dist/src/business/agent-project-runtime.js.map +1 -0
- package/dist/src/business/append-event-history.d.ts +21 -0
- package/dist/src/business/append-event-history.d.ts.map +1 -0
- package/dist/src/business/append-event-history.js +138 -0
- package/dist/src/business/append-event-history.js.map +1 -0
- package/dist/src/business/append-event.d.ts +140 -0
- package/dist/src/business/append-event.d.ts.map +1 -0
- package/dist/src/business/append-event.js +292 -0
- package/dist/src/business/append-event.js.map +1 -0
- package/dist/src/business/check-repository.d.ts +109 -0
- package/dist/src/business/check-repository.d.ts.map +1 -0
- package/dist/src/business/check-repository.js +379 -0
- package/dist/src/business/check-repository.js.map +1 -0
- package/dist/src/business/create-idea.d.ts +100 -0
- package/dist/src/business/create-idea.d.ts.map +1 -0
- package/dist/src/business/create-idea.js +224 -0
- package/dist/src/business/create-idea.js.map +1 -0
- package/dist/src/business/event-command.d.ts +111 -0
- package/dist/src/business/event-command.d.ts.map +1 -0
- package/dist/src/business/event-command.js +239 -0
- package/dist/src/business/event-command.js.map +1 -0
- package/dist/src/business/index.d.ts +7 -0
- package/dist/src/business/index.d.ts.map +1 -0
- package/dist/src/business/index.js +7 -0
- package/dist/src/business/index.js.map +1 -0
- package/dist/src/business/list-ideas.d.ts +97 -0
- package/dist/src/business/list-ideas.d.ts.map +1 -0
- package/dist/src/business/list-ideas.js +177 -0
- package/dist/src/business/list-ideas.js.map +1 -0
- package/dist/src/business/migrate-v1-to-v2.d.ts +23 -0
- package/dist/src/business/migrate-v1-to-v2.d.ts.map +1 -0
- package/dist/src/business/migrate-v1-to-v2.js +152 -0
- package/dist/src/business/migrate-v1-to-v2.js.map +1 -0
- package/dist/src/business/replay-events.d.ts +20 -0
- package/dist/src/business/replay-events.d.ts.map +1 -0
- package/dist/src/business/replay-events.js +27 -0
- package/dist/src/business/replay-events.js.map +1 -0
- package/dist/src/business/schema-migration.d.ts +19 -0
- package/dist/src/business/schema-migration.d.ts.map +1 -0
- package/dist/src/business/schema-migration.js +23 -0
- package/dist/src/business/schema-migration.js.map +1 -0
- package/dist/src/business/shared/assess-idea-creation-readiness.d.ts +3 -0
- package/dist/src/business/shared/assess-idea-creation-readiness.d.ts.map +1 -0
- package/dist/src/business/shared/assess-idea-creation-readiness.js +9 -0
- package/dist/src/business/shared/assess-idea-creation-readiness.js.map +1 -0
- package/dist/src/business/shared/assess-repository-readiness-with.d.ts +18 -0
- package/dist/src/business/shared/assess-repository-readiness-with.d.ts.map +1 -0
- package/dist/src/business/shared/assess-repository-readiness-with.js +125 -0
- package/dist/src/business/shared/assess-repository-readiness-with.js.map +1 -0
- package/dist/src/business/shared/assess-repository-readiness.d.ts +3 -0
- package/dist/src/business/shared/assess-repository-readiness.d.ts.map +1 -0
- package/dist/src/business/shared/assess-repository-readiness.js +6 -0
- package/dist/src/business/shared/assess-repository-readiness.js.map +1 -0
- package/dist/src/business/shared/business-types.d.ts +151 -0
- package/dist/src/business/shared/business-types.d.ts.map +1 -0
- package/dist/src/business/shared/business-types.js +83 -0
- package/dist/src/business/shared/business-types.js.map +1 -0
- package/dist/src/business/shared/evaluate-local-readiness.d.ts +9 -0
- package/dist/src/business/shared/evaluate-local-readiness.d.ts.map +1 -0
- package/dist/src/business/shared/evaluate-local-readiness.js +97 -0
- package/dist/src/business/shared/evaluate-local-readiness.js.map +1 -0
- package/dist/src/business/shared/evaluate-primary-relation.d.ts +12 -0
- package/dist/src/business/shared/evaluate-primary-relation.d.ts.map +1 -0
- package/dist/src/business/shared/evaluate-primary-relation.js +40 -0
- package/dist/src/business/shared/evaluate-primary-relation.js.map +1 -0
- package/dist/src/business/shared/idea-layout.d.ts +55 -0
- package/dist/src/business/shared/idea-layout.d.ts.map +1 -0
- package/dist/src/business/shared/idea-layout.js +434 -0
- package/dist/src/business/shared/idea-layout.js.map +1 -0
- package/dist/src/business/shared/index.d.ts +18 -0
- package/dist/src/business/shared/index.d.ts.map +1 -0
- package/dist/src/business/shared/index.js +17 -0
- package/dist/src/business/shared/index.js.map +1 -0
- package/dist/src/business/shared/inspect-candidate.d.ts +5 -0
- package/dist/src/business/shared/inspect-candidate.d.ts.map +1 -0
- package/dist/src/business/shared/inspect-candidate.js +57 -0
- package/dist/src/business/shared/inspect-candidate.js.map +1 -0
- package/dist/src/business/shared/metadata-failure-observation.d.ts +21 -0
- package/dist/src/business/shared/metadata-failure-observation.d.ts.map +1 -0
- package/dist/src/business/shared/metadata-failure-observation.js +30 -0
- package/dist/src/business/shared/metadata-failure-observation.js.map +1 -0
- package/dist/src/business/shared/observe-device.d.ts +150 -0
- package/dist/src/business/shared/observe-device.d.ts.map +1 -0
- package/dist/src/business/shared/observe-device.js +71 -0
- package/dist/src/business/shared/observe-device.js.map +1 -0
- package/dist/src/business/shared/observe-idea.d.ts +14 -0
- package/dist/src/business/shared/observe-idea.d.ts.map +1 -0
- package/dist/src/business/shared/observe-idea.js +14 -0
- package/dist/src/business/shared/observe-idea.js.map +1 -0
- package/dist/src/business/shared/observe-project.d.ts +39 -0
- package/dist/src/business/shared/observe-project.d.ts.map +1 -0
- package/dist/src/business/shared/observe-project.js +11 -0
- package/dist/src/business/shared/observe-project.js.map +1 -0
- package/dist/src/business/shared/observe-snapshot.d.ts +35 -0
- package/dist/src/business/shared/observe-snapshot.d.ts.map +1 -0
- package/dist/src/business/shared/observe-snapshot.js +518 -0
- package/dist/src/business/shared/observe-snapshot.js.map +1 -0
- package/dist/src/business/shared/read-idea-inventory-item.d.ts +13 -0
- package/dist/src/business/shared/read-idea-inventory-item.d.ts.map +1 -0
- package/dist/src/business/shared/read-idea-inventory-item.js +18 -0
- package/dist/src/business/shared/read-idea-inventory-item.js.map +1 -0
- package/dist/src/business/shared/resolve-idea.d.ts +7 -0
- package/dist/src/business/shared/resolve-idea.d.ts.map +1 -0
- package/dist/src/business/shared/resolve-idea.js +14 -0
- package/dist/src/business/shared/resolve-idea.js.map +1 -0
- package/dist/src/business/shared/with-observation-language.d.ts +3 -0
- package/dist/src/business/shared/with-observation-language.d.ts.map +1 -0
- package/dist/src/business/shared/with-observation-language.js +20 -0
- package/dist/src/business/shared/with-observation-language.js.map +1 -0
- package/dist/src/business/whats-next.d.ts +94 -0
- package/dist/src/business/whats-next.d.ts.map +1 -0
- package/dist/src/business/whats-next.js +208 -0
- package/dist/src/business/whats-next.js.map +1 -0
- package/dist/src/foundation/command-message/index.d.ts +3 -0
- package/dist/src/foundation/command-message/index.d.ts.map +1 -0
- package/dist/src/foundation/command-message/index.js +3 -0
- package/dist/src/foundation/command-message/index.js.map +1 -0
- package/dist/src/foundation/command-message/observation.d.ts +223 -0
- package/dist/src/foundation/command-message/observation.d.ts.map +1 -0
- package/dist/src/foundation/command-message/observation.js +364 -0
- package/dist/src/foundation/command-message/observation.js.map +1 -0
- package/dist/src/foundation/command-message/runtime.d.ts +214 -0
- package/dist/src/foundation/command-message/runtime.d.ts.map +1 -0
- package/dist/src/foundation/command-message/runtime.js +215 -0
- package/dist/src/foundation/command-message/runtime.js.map +1 -0
- package/dist/src/foundation/coordinates/index.d.ts +3 -0
- package/dist/src/foundation/coordinates/index.d.ts.map +1 -0
- package/dist/src/foundation/coordinates/index.js +3 -0
- package/dist/src/foundation/coordinates/index.js.map +1 -0
- package/dist/src/foundation/coordinates/layout.d.ts +27 -0
- package/dist/src/foundation/coordinates/layout.d.ts.map +1 -0
- package/dist/src/foundation/coordinates/layout.js +41 -0
- package/dist/src/foundation/coordinates/layout.js.map +1 -0
- package/dist/src/foundation/coordinates/repository.d.ts +16 -0
- package/dist/src/foundation/coordinates/repository.d.ts.map +1 -0
- package/dist/src/foundation/coordinates/repository.js +75 -0
- package/dist/src/foundation/coordinates/repository.js.map +1 -0
- package/dist/src/foundation/device-config/index.d.ts +2 -0
- package/dist/src/foundation/device-config/index.d.ts.map +1 -0
- package/dist/src/foundation/device-config/index.js +2 -0
- package/dist/src/foundation/device-config/index.js.map +1 -0
- package/dist/src/foundation/device-config/user-config.d.ts +19 -0
- package/dist/src/foundation/device-config/user-config.d.ts.map +1 -0
- package/dist/src/foundation/device-config/user-config.js +94 -0
- package/dist/src/foundation/device-config/user-config.js.map +1 -0
- package/dist/src/foundation/event-codec/grammar.d.ts +172 -0
- package/dist/src/foundation/event-codec/grammar.d.ts.map +1 -0
- package/dist/src/foundation/event-codec/grammar.js +383 -0
- package/dist/src/foundation/event-codec/grammar.js.map +1 -0
- package/dist/src/foundation/event-codec/index.d.ts +3 -0
- package/dist/src/foundation/event-codec/index.d.ts.map +1 -0
- package/dist/src/foundation/event-codec/index.js +2 -0
- package/dist/src/foundation/event-codec/index.js.map +1 -0
- package/dist/src/foundation/event-cursor/cursor.d.ts +40 -0
- package/dist/src/foundation/event-cursor/cursor.d.ts.map +1 -0
- package/dist/src/foundation/event-cursor/cursor.js +42 -0
- package/dist/src/foundation/event-cursor/cursor.js.map +1 -0
- package/dist/src/foundation/event-cursor/index.d.ts +2 -0
- package/dist/src/foundation/event-cursor/index.d.ts.map +1 -0
- package/dist/src/foundation/event-cursor/index.js +2 -0
- package/dist/src/foundation/event-cursor/index.js.map +1 -0
- package/dist/src/foundation/event-history/digest.d.ts +2 -0
- package/dist/src/foundation/event-history/digest.d.ts.map +1 -0
- package/dist/src/foundation/event-history/digest.js +2 -0
- package/dist/src/foundation/event-history/digest.js.map +1 -0
- package/dist/src/foundation/event-history/history.d.ts +86 -0
- package/dist/src/foundation/event-history/history.d.ts.map +1 -0
- package/dist/src/foundation/event-history/history.js +481 -0
- package/dist/src/foundation/event-history/history.js.map +1 -0
- package/dist/src/foundation/event-history/index.d.ts +3 -0
- package/dist/src/foundation/event-history/index.d.ts.map +1 -0
- package/dist/src/foundation/event-history/index.js +3 -0
- package/dist/src/foundation/event-history/index.js.map +1 -0
- package/dist/src/foundation/event-reducer/index.d.ts +2 -0
- package/dist/src/foundation/event-reducer/index.d.ts.map +1 -0
- package/dist/src/foundation/event-reducer/index.js +2 -0
- package/dist/src/foundation/event-reducer/index.js.map +1 -0
- package/dist/src/foundation/event-reducer/policy.d.ts +69 -0
- package/dist/src/foundation/event-reducer/policy.d.ts.map +1 -0
- package/dist/src/foundation/event-reducer/policy.js +138 -0
- package/dist/src/foundation/event-reducer/policy.js.map +1 -0
- package/dist/src/foundation/event-store/digest.d.ts +11 -0
- package/dist/src/foundation/event-store/digest.d.ts.map +1 -0
- package/dist/src/foundation/event-store/digest.js +38 -0
- package/dist/src/foundation/event-store/digest.js.map +1 -0
- package/dist/src/foundation/event-store/index.d.ts +3 -0
- package/dist/src/foundation/event-store/index.d.ts.map +1 -0
- package/dist/src/foundation/event-store/index.js +3 -0
- package/dist/src/foundation/event-store/index.js.map +1 -0
- package/dist/src/foundation/event-store/storage.d.ts +50 -0
- package/dist/src/foundation/event-store/storage.d.ts.map +1 -0
- package/dist/src/foundation/event-store/storage.js +109 -0
- package/dist/src/foundation/event-store/storage.js.map +1 -0
- package/dist/src/foundation/git/derived-cache.d.ts +5 -0
- package/dist/src/foundation/git/derived-cache.d.ts.map +1 -0
- package/dist/src/foundation/git/derived-cache.js +117 -0
- package/dist/src/foundation/git/derived-cache.js.map +1 -0
- package/dist/src/foundation/git/git.d.ts +100 -0
- package/dist/src/foundation/git/git.d.ts.map +1 -0
- package/dist/src/foundation/git/git.js +677 -0
- package/dist/src/foundation/git/git.js.map +1 -0
- package/dist/src/foundation/git/index.d.ts +3 -0
- package/dist/src/foundation/git/index.d.ts.map +1 -0
- package/dist/src/foundation/git/index.js +3 -0
- package/dist/src/foundation/git/index.js.map +1 -0
- package/dist/src/foundation/guidance/guidance.d.ts +36 -0
- package/dist/src/foundation/guidance/guidance.d.ts.map +1 -0
- package/dist/src/foundation/guidance/guidance.js +198 -0
- package/dist/src/foundation/guidance/guidance.js.map +1 -0
- package/dist/src/foundation/guidance/index.d.ts +3 -0
- package/dist/src/foundation/guidance/index.d.ts.map +1 -0
- package/dist/src/foundation/guidance/index.js +3 -0
- package/dist/src/foundation/guidance/index.js.map +1 -0
- package/dist/src/foundation/guidance/rules.d.ts +36 -0
- package/dist/src/foundation/guidance/rules.d.ts.map +1 -0
- package/dist/src/foundation/guidance/rules.js +65 -0
- package/dist/src/foundation/guidance/rules.js.map +1 -0
- package/dist/src/foundation/idea-model/index.d.ts +3 -0
- package/dist/src/foundation/idea-model/index.d.ts.map +1 -0
- package/dist/src/foundation/idea-model/index.js +3 -0
- package/dist/src/foundation/idea-model/index.js.map +1 -0
- package/dist/src/foundation/idea-model/status.d.ts +28 -0
- package/dist/src/foundation/idea-model/status.d.ts.map +1 -0
- package/dist/src/foundation/idea-model/status.js +192 -0
- package/dist/src/foundation/idea-model/status.js.map +1 -0
- package/dist/src/foundation/idea-model/ulid.d.ts +6 -0
- package/dist/src/foundation/idea-model/ulid.d.ts.map +1 -0
- package/dist/src/foundation/idea-model/ulid.js +16 -0
- package/dist/src/foundation/idea-model/ulid.js.map +1 -0
- package/dist/src/foundation/idea-query/index.d.ts +3 -0
- package/dist/src/foundation/idea-query/index.d.ts.map +1 -0
- package/dist/src/foundation/idea-query/index.js +3 -0
- package/dist/src/foundation/idea-query/index.js.map +1 -0
- package/dist/src/foundation/idea-query/query.d.ts +13 -0
- package/dist/src/foundation/idea-query/query.d.ts.map +1 -0
- package/dist/src/foundation/idea-query/query.js +17 -0
- package/dist/src/foundation/idea-query/query.js.map +1 -0
- package/dist/src/foundation/idea-query/rules.d.ts +55 -0
- package/dist/src/foundation/idea-query/rules.d.ts.map +1 -0
- package/dist/src/foundation/idea-query/rules.js +223 -0
- package/dist/src/foundation/idea-query/rules.js.map +1 -0
- package/dist/src/foundation/idea-template/index.d.ts +2 -0
- package/dist/src/foundation/idea-template/index.d.ts.map +1 -0
- package/dist/src/foundation/idea-template/index.js +2 -0
- package/dist/src/foundation/idea-template/index.js.map +1 -0
- package/dist/src/foundation/idea-template/templates.d.ts +21 -0
- package/dist/src/foundation/idea-template/templates.d.ts.map +1 -0
- package/dist/src/foundation/idea-template/templates.js +265 -0
- package/dist/src/foundation/idea-template/templates.js.map +1 -0
- package/dist/src/foundation/installation/device-readiness.d.ts +94 -0
- package/dist/src/foundation/installation/device-readiness.d.ts.map +1 -0
- package/dist/src/foundation/installation/device-readiness.js +274 -0
- package/dist/src/foundation/installation/device-readiness.js.map +1 -0
- package/dist/src/foundation/installation/index.d.ts +4 -0
- package/dist/src/foundation/installation/index.d.ts.map +1 -0
- package/dist/src/foundation/installation/index.js +4 -0
- package/dist/src/foundation/installation/index.js.map +1 -0
- package/dist/src/foundation/installation/installation.d.ts +25 -0
- package/dist/src/foundation/installation/installation.d.ts.map +1 -0
- package/dist/src/foundation/installation/installation.js +125 -0
- package/dist/src/foundation/installation/installation.js.map +1 -0
- package/dist/src/foundation/installation/rules.d.ts +12 -0
- package/dist/src/foundation/installation/rules.d.ts.map +1 -0
- package/dist/src/foundation/installation/rules.js +63 -0
- package/dist/src/foundation/installation/rules.js.map +1 -0
- package/dist/src/foundation/language/index.d.ts +3 -0
- package/dist/src/foundation/language/index.d.ts.map +1 -0
- package/dist/src/foundation/language/index.js +2 -0
- package/dist/src/foundation/language/index.js.map +1 -0
- package/dist/src/foundation/language/language.d.ts +36 -0
- package/dist/src/foundation/language/language.d.ts.map +1 -0
- package/dist/src/foundation/language/language.js +94 -0
- package/dist/src/foundation/language/language.js.map +1 -0
- package/dist/src/foundation/owned-write/index.d.ts +2 -0
- package/dist/src/foundation/owned-write/index.d.ts.map +1 -0
- package/dist/src/foundation/owned-write/index.js +2 -0
- package/dist/src/foundation/owned-write/index.js.map +1 -0
- package/dist/src/foundation/owned-write/writer.d.ts +86 -0
- package/dist/src/foundation/owned-write/writer.d.ts.map +1 -0
- package/dist/src/foundation/owned-write/writer.js +244 -0
- package/dist/src/foundation/owned-write/writer.js.map +1 -0
- package/dist/src/foundation/package-resource/index.d.ts +2 -0
- package/dist/src/foundation/package-resource/index.d.ts.map +1 -0
- package/dist/src/foundation/package-resource/index.js +2 -0
- package/dist/src/foundation/package-resource/index.js.map +1 -0
- package/dist/src/foundation/package-resource/npm-tarball.d.ts +15 -0
- package/dist/src/foundation/package-resource/npm-tarball.d.ts.map +1 -0
- package/dist/src/foundation/package-resource/npm-tarball.js +124 -0
- package/dist/src/foundation/package-resource/npm-tarball.js.map +1 -0
- package/dist/src/foundation/process/index.d.ts +3 -0
- package/dist/src/foundation/process/index.d.ts.map +1 -0
- package/dist/src/foundation/process/index.js +3 -0
- package/dist/src/foundation/process/index.js.map +1 -0
- package/dist/src/foundation/process/npm-command.d.ts +9 -0
- package/dist/src/foundation/process/npm-command.d.ts.map +1 -0
- package/dist/src/foundation/process/npm-command.js +11 -0
- package/dist/src/foundation/process/npm-command.js.map +1 -0
- package/dist/src/foundation/process/subprocess.d.ts +8 -0
- package/dist/src/foundation/process/subprocess.d.ts.map +1 -0
- package/dist/src/foundation/process/subprocess.js +12 -0
- package/dist/src/foundation/process/subprocess.js.map +1 -0
- package/dist/src/foundation/project-config/config.d.ts +30 -0
- package/dist/src/foundation/project-config/config.d.ts.map +1 -0
- package/dist/src/foundation/project-config/config.js +112 -0
- package/dist/src/foundation/project-config/config.js.map +1 -0
- package/dist/src/foundation/project-config/index.d.ts +3 -0
- package/dist/src/foundation/project-config/index.d.ts.map +1 -0
- package/dist/src/foundation/project-config/index.js +3 -0
- package/dist/src/foundation/project-config/index.js.map +1 -0
- package/dist/src/foundation/project-config/rules.d.ts +32 -0
- package/dist/src/foundation/project-config/rules.d.ts.map +1 -0
- package/dist/src/foundation/project-config/rules.js +119 -0
- package/dist/src/foundation/project-config/rules.js.map +1 -0
- package/dist/src/foundation/projection-cache/index.d.ts +2 -0
- package/dist/src/foundation/projection-cache/index.d.ts.map +1 -0
- package/dist/src/foundation/projection-cache/index.js +2 -0
- package/dist/src/foundation/projection-cache/index.js.map +1 -0
- package/dist/src/foundation/projection-cache/projection.d.ts +36 -0
- package/dist/src/foundation/projection-cache/projection.d.ts.map +1 -0
- package/dist/src/foundation/projection-cache/projection.js +105 -0
- package/dist/src/foundation/projection-cache/projection.js.map +1 -0
- package/dist/src/foundation/renderer/index.d.ts +3 -0
- package/dist/src/foundation/renderer/index.d.ts.map +1 -0
- package/dist/src/foundation/renderer/index.js +3 -0
- package/dist/src/foundation/renderer/index.js.map +1 -0
- package/dist/src/foundation/renderer/markdown.d.ts +7 -0
- package/dist/src/foundation/renderer/markdown.d.ts.map +1 -0
- package/dist/src/foundation/renderer/markdown.js +355 -0
- package/dist/src/foundation/renderer/markdown.js.map +1 -0
- package/dist/src/foundation/renderer/render.d.ts +6 -0
- package/dist/src/foundation/renderer/render.d.ts.map +1 -0
- package/dist/src/foundation/renderer/render.js +23 -0
- package/dist/src/foundation/renderer/render.js.map +1 -0
- package/dist/src/foundation/report/dialogue.d.ts +37 -0
- package/dist/src/foundation/report/dialogue.d.ts.map +1 -0
- package/dist/src/foundation/report/dialogue.js +59 -0
- package/dist/src/foundation/report/dialogue.js.map +1 -0
- package/dist/src/foundation/report/index.d.ts +6 -0
- package/dist/src/foundation/report/index.d.ts.map +1 -0
- package/dist/src/foundation/report/index.js +6 -0
- package/dist/src/foundation/report/index.js.map +1 -0
- package/dist/src/foundation/report/instructions.d.ts +77 -0
- package/dist/src/foundation/report/instructions.d.ts.map +1 -0
- package/dist/src/foundation/report/instructions.js +374 -0
- package/dist/src/foundation/report/instructions.js.map +1 -0
- package/dist/src/foundation/report/observation.d.ts +31 -0
- package/dist/src/foundation/report/observation.d.ts.map +1 -0
- package/dist/src/foundation/report/observation.js +83 -0
- package/dist/src/foundation/report/observation.js.map +1 -0
- package/dist/src/foundation/report/projection.d.ts +7 -0
- package/dist/src/foundation/report/projection.d.ts.map +1 -0
- package/dist/src/foundation/report/projection.js +199 -0
- package/dist/src/foundation/report/projection.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/contract.d.ts +148 -0
- package/dist/src/foundation/report/templates/whats-next/contract.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/contract.js +34 -0
- package/dist/src/foundation/report/templates/whats-next/contract.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/content-language.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/content-language.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/content-language.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/content-language.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/detached-head.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/detached-head.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/detached-head.js +10 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/detached-head.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/event-history-invalid.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/event-history-invalid.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/event-history-invalid.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/event-history-invalid.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/head-missing.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/head-missing.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/head-missing.js +8 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/head-missing.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/idea-metadata-unavailable.d.ts +12 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/idea-metadata-unavailable.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/idea-metadata-unavailable.js +8 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/idea-metadata-unavailable.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/idea-not-found.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/idea-not-found.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/idea-not-found.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/idea-not-found.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/index.d.ts +63 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/index.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/index.js +63 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/index.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/lifecycle-deploying.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/lifecycle-deploying.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/lifecycle-deploying.js +13 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/lifecycle-deploying.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/lifecycle-implementing.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/lifecycle-implementing.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/lifecycle-implementing.js +13 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/lifecycle-implementing.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/lifecycle-inactive.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/lifecycle-inactive.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/lifecycle-inactive.js +11 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/lifecycle-inactive.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/lifecycle-preparing.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/lifecycle-preparing.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/lifecycle-preparing.js +13 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/lifecycle-preparing.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/navigation-ready.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/navigation-ready.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/navigation-ready.js +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/navigation-ready.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/phase-guidance-invalid.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/phase-guidance-invalid.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/phase-guidance-invalid.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/phase-guidance-invalid.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/preparation-seed.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/preparation-seed.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/preparation-seed.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/preparation-seed.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-ahead.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-ahead.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-ahead.js +8 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-ahead.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-ancestry-inspection-failed.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-ancestry-inspection-failed.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-ancestry-inspection-failed.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-ancestry-inspection-failed.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-behind.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-behind.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-behind.js +8 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-behind.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-diverged.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-diverged.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-diverged.js +8 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-diverged.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-fetch-failed.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-fetch-failed.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-fetch-failed.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-fetch-failed.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-history-incomplete.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-history-incomplete.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-history-incomplete.js +8 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-history-incomplete.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-upstream-mismatch.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-upstream-mismatch.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-upstream-mismatch.js +11 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/primary-upstream-mismatch.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/project-recheck.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/project-recheck.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/project-recheck.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/project-recheck.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/repository-recheck.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/repository-recheck.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/repository-recheck.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/repository-recheck.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/review-presentation-instruction.d.ts +8 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/review-presentation-instruction.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/review-presentation-instruction.js +10 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/review-presentation-instruction.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/review-presentation.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/review-presentation.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/review-presentation.js +39 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/review-presentation.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-changes-step.d.ts +8 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-changes-step.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-changes-step.js +10 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-changes-step.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-conflict-step.d.ts +8 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-conflict-step.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-conflict-step.js +10 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-conflict-step.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-conflicts.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-conflicts.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-conflicts.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-conflicts.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-inspection-failed.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-inspection-failed.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-inspection-failed.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-inspection-failed.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-summary.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-summary.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-summary.js +12 -0
- package/dist/src/foundation/report/templates/whats-next/en-US/worktree-summary.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/index.d.ts +5 -0
- package/dist/src/foundation/report/templates/whats-next/index.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/index.js +4 -0
- package/dist/src/foundation/report/templates/whats-next/index.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/registry.d.ts +4 -0
- package/dist/src/foundation/report/templates/whats-next/registry.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/registry.js +14 -0
- package/dist/src/foundation/report/templates/whats-next/registry.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/renderers.d.ts +63 -0
- package/dist/src/foundation/report/templates/whats-next/renderers.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/renderers.js +176 -0
- package/dist/src/foundation/report/templates/whats-next/renderers.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/content-language.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/content-language.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/content-language.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/content-language.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/detached-head.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/detached-head.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/detached-head.js +10 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/detached-head.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/event-history-invalid.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/event-history-invalid.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/event-history-invalid.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/event-history-invalid.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/head-missing.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/head-missing.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/head-missing.js +8 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/head-missing.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/idea-metadata-unavailable.d.ts +12 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/idea-metadata-unavailable.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/idea-metadata-unavailable.js +8 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/idea-metadata-unavailable.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/idea-not-found.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/idea-not-found.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/idea-not-found.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/idea-not-found.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/index.d.ts +63 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/index.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/index.js +63 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/index.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/lifecycle-deploying.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/lifecycle-deploying.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/lifecycle-deploying.js +13 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/lifecycle-deploying.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/lifecycle-implementing.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/lifecycle-implementing.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/lifecycle-implementing.js +13 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/lifecycle-implementing.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/lifecycle-inactive.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/lifecycle-inactive.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/lifecycle-inactive.js +11 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/lifecycle-inactive.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/lifecycle-preparing.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/lifecycle-preparing.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/lifecycle-preparing.js +13 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/lifecycle-preparing.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/navigation-ready.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/navigation-ready.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/navigation-ready.js +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/navigation-ready.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/phase-guidance-invalid.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/phase-guidance-invalid.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/phase-guidance-invalid.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/phase-guidance-invalid.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/preparation-seed.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/preparation-seed.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/preparation-seed.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/preparation-seed.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-ahead.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-ahead.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-ahead.js +8 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-ahead.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-ancestry-inspection-failed.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-ancestry-inspection-failed.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-ancestry-inspection-failed.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-ancestry-inspection-failed.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-behind.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-behind.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-behind.js +8 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-behind.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-diverged.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-diverged.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-diverged.js +8 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-diverged.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-fetch-failed.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-fetch-failed.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-fetch-failed.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-fetch-failed.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-history-incomplete.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-history-incomplete.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-history-incomplete.js +8 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-history-incomplete.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-upstream-mismatch.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-upstream-mismatch.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-upstream-mismatch.js +11 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/primary-upstream-mismatch.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/project-recheck.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/project-recheck.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/project-recheck.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/project-recheck.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/repository-recheck.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/repository-recheck.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/repository-recheck.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/repository-recheck.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/review-presentation-instruction.d.ts +8 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/review-presentation-instruction.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/review-presentation-instruction.js +10 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/review-presentation-instruction.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/review-presentation.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/review-presentation.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/review-presentation.js +39 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/review-presentation.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-changes-step.d.ts +8 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-changes-step.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-changes-step.js +10 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-changes-step.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-conflict-step.d.ts +8 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-conflict-step.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-conflict-step.js +10 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-conflict-step.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-conflicts.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-conflicts.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-conflicts.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-conflicts.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-inspection-failed.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-inspection-failed.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-inspection-failed.js +5 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-inspection-failed.js.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-summary.d.ts +9 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-summary.d.ts.map +1 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-summary.js +12 -0
- package/dist/src/foundation/report/templates/whats-next/zh-CN/worktree-summary.js.map +1 -0
- package/dist/src/foundation/report/types.d.ts +321 -0
- package/dist/src/foundation/report/types.d.ts.map +1 -0
- package/dist/src/foundation/report/types.js +2 -0
- package/dist/src/foundation/report/types.js.map +1 -0
- package/dist/src/foundation/scaffold-plan/index.d.ts +2 -0
- package/dist/src/foundation/scaffold-plan/index.d.ts.map +1 -0
- package/dist/src/foundation/scaffold-plan/index.js +2 -0
- package/dist/src/foundation/scaffold-plan/index.js.map +1 -0
- package/dist/src/foundation/scaffold-plan/scaffold-plan.d.ts +11 -0
- package/dist/src/foundation/scaffold-plan/scaffold-plan.d.ts.map +1 -0
- package/dist/src/foundation/scaffold-plan/scaffold-plan.js +36 -0
- package/dist/src/foundation/scaffold-plan/scaffold-plan.js.map +1 -0
- package/dist/src/foundation/schema/index.d.ts +3 -0
- package/dist/src/foundation/schema/index.d.ts.map +1 -0
- package/dist/src/foundation/schema/index.js +3 -0
- package/dist/src/foundation/schema/index.js.map +1 -0
- package/dist/src/foundation/schema/schema.d.ts +3 -0
- package/dist/src/foundation/schema/schema.d.ts.map +1 -0
- package/dist/src/foundation/schema/schema.js +10 -0
- package/dist/src/foundation/schema/schema.js.map +1 -0
- package/dist/src/foundation/schema/yaml.d.ts +10 -0
- package/dist/src/foundation/schema/yaml.d.ts.map +1 -0
- package/dist/src/foundation/schema/yaml.js +60 -0
- package/dist/src/foundation/schema/yaml.js.map +1 -0
- package/dist/src/foundation/schema-capability/index.d.ts +6 -0
- package/dist/src/foundation/schema-capability/index.d.ts.map +1 -0
- package/dist/src/foundation/schema-capability/index.js +4 -0
- package/dist/src/foundation/schema-capability/index.js.map +1 -0
- package/dist/src/foundation/schema-capability/inspection.d.ts +38 -0
- package/dist/src/foundation/schema-capability/inspection.d.ts.map +1 -0
- package/dist/src/foundation/schema-capability/inspection.js +249 -0
- package/dist/src/foundation/schema-capability/inspection.js.map +1 -0
- package/dist/src/foundation/schema-capability/manifest.d.ts +6 -0
- package/dist/src/foundation/schema-capability/manifest.d.ts.map +1 -0
- package/dist/src/foundation/schema-capability/manifest.js +17 -0
- package/dist/src/foundation/schema-capability/manifest.js.map +1 -0
- package/dist/src/foundation/schema-capability/rules.d.ts +38 -0
- package/dist/src/foundation/schema-capability/rules.d.ts.map +1 -0
- package/dist/src/foundation/schema-capability/rules.js +297 -0
- package/dist/src/foundation/schema-capability/rules.js.map +1 -0
- package/dist/src/foundation/skill-registration/adoption.d.ts +40 -0
- package/dist/src/foundation/skill-registration/adoption.d.ts.map +1 -0
- package/dist/src/foundation/skill-registration/adoption.js +63 -0
- package/dist/src/foundation/skill-registration/adoption.js.map +1 -0
- package/dist/src/foundation/skill-registration/index.d.ts +2 -0
- package/dist/src/foundation/skill-registration/index.d.ts.map +1 -0
- package/dist/src/foundation/skill-registration/index.js +2 -0
- package/dist/src/foundation/skill-registration/index.js.map +1 -0
- package/dist/src/foundation/skill-registration/rules.d.ts +2 -0
- package/dist/src/foundation/skill-registration/rules.d.ts.map +1 -0
- package/dist/src/foundation/skill-registration/rules.js +2 -0
- package/dist/src/foundation/skill-registration/rules.js.map +1 -0
- package/dist/src/foundation/snapshot/git-snapshot.d.ts +40 -0
- package/dist/src/foundation/snapshot/git-snapshot.d.ts.map +1 -0
- package/dist/src/foundation/snapshot/git-snapshot.js +168 -0
- package/dist/src/foundation/snapshot/git-snapshot.js.map +1 -0
- package/dist/src/foundation/snapshot/index.d.ts +2 -0
- package/dist/src/foundation/snapshot/index.d.ts.map +1 -0
- package/dist/src/foundation/snapshot/index.js +2 -0
- package/dist/src/foundation/snapshot/index.js.map +1 -0
- package/dist/src/foundation/state-transaction/index.d.ts +2 -0
- package/dist/src/foundation/state-transaction/index.d.ts.map +1 -0
- package/dist/src/foundation/state-transaction/index.js +2 -0
- package/dist/src/foundation/state-transaction/index.js.map +1 -0
- package/dist/src/foundation/state-transaction/state-transaction.d.ts +48 -0
- package/dist/src/foundation/state-transaction/state-transaction.d.ts.map +1 -0
- package/dist/src/foundation/state-transaction/state-transaction.js +364 -0
- package/dist/src/foundation/state-transaction/state-transaction.js.map +1 -0
- package/dist/src/foundation/terminal/index.d.ts +2 -0
- package/dist/src/foundation/terminal/index.d.ts.map +1 -0
- package/dist/src/foundation/terminal/index.js +2 -0
- package/dist/src/foundation/terminal/index.js.map +1 -0
- package/dist/src/foundation/terminal/terminal.d.ts +17 -0
- package/dist/src/foundation/terminal/terminal.d.ts.map +1 -0
- package/dist/src/foundation/terminal/terminal.js +12 -0
- package/dist/src/foundation/terminal/terminal.js.map +1 -0
- package/dist/src/foundation/trace/index.d.ts +2 -0
- package/dist/src/foundation/trace/index.d.ts.map +1 -0
- package/dist/src/foundation/trace/index.js +2 -0
- package/dist/src/foundation/trace/index.js.map +1 -0
- package/dist/src/foundation/trace/trace.d.ts +12 -0
- package/dist/src/foundation/trace/trace.d.ts.map +1 -0
- package/dist/src/foundation/trace/trace.js +299 -0
- package/dist/src/foundation/trace/trace.js.map +1 -0
- package/dist/src/foundation/tui/index.d.ts +3 -0
- package/dist/src/foundation/tui/index.d.ts.map +1 -0
- package/dist/src/foundation/tui/index.js +3 -0
- package/dist/src/foundation/tui/index.js.map +1 -0
- package/dist/src/foundation/tui/table.d.ts +10 -0
- package/dist/src/foundation/tui/table.d.ts.map +1 -0
- package/dist/src/foundation/tui/table.js +91 -0
- package/dist/src/foundation/tui/table.js.map +1 -0
- package/dist/src/foundation/tui/tui.d.ts +33 -0
- package/dist/src/foundation/tui/tui.d.ts.map +1 -0
- package/dist/src/foundation/tui/tui.js +157 -0
- package/dist/src/foundation/tui/tui.js.map +1 -0
- package/dist/src/index.d.ts +17 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +16 -0
- package/dist/src/index.js.map +1 -0
- package/docs/core-concepts.md +48 -7
- package/docs/getting-started.md +60 -45
- package/docs/maintaining.md +132 -9
- package/docs/npm-package-releases.md +38 -9
- package/docs/operations.md +109 -35
- package/docs/reference.md +304 -35
- package/docs/repository-tasks.md +61 -20
- package/package.json +53 -27
- package/schema/capabilities.json +95 -0
- package/schema/capability-manifest.schema.json +139 -0
- package/schema/v1/command-report.schema.json +4 -2
- package/schema/v1/domain-message.schema.json +2 -1
- package/schema/v2/config.schema.json +14 -0
- package/schema/v2/idea-event.schema.json +121 -0
- package/skills/silvermoon/SKILL.md +204 -112
- package/skills/silvermoon/references/adoption.md +55 -24
- package/skills/silvermoon/references/events.md +296 -0
- package/bin/silvermoon.js +0 -10
- package/src/adoption.js +0 -559
- package/src/cli.js +0 -377
- package/src/config.js +0 -253
- package/src/create-idea.js +0 -497
- package/src/dialogue.js +0 -69
- package/src/domain.js +0 -592
- package/src/git-snapshot.js +0 -212
- package/src/git.js +0 -624
- package/src/guidance.js +0 -281
- package/src/idea-layout.js +0 -411
- package/src/idea-metadata.js +0 -48
- package/src/idea-query.js +0 -230
- package/src/idea-templates.js +0 -242
- package/src/ideas.js +0 -142
- package/src/index.js +0 -386
- package/src/language.js +0 -78
- package/src/layout.js +0 -38
- package/src/list-ideas.js +0 -196
- package/src/observation.js +0 -370
- package/src/repository.js +0 -82
- package/src/response.js +0 -492
- package/src/subprocess.js +0 -27
- package/src/trace.js +0 -292
- package/src/tui-table.js +0 -71
- package/src/tui.js +0 -205
- package/src/user-config.js +0 -135
- package/src/whatsnext.js +0 -726
- package/src/yaml.js +0 -66
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
3
|
+
import { constants } from "node:fs";
|
|
4
|
+
import { access, lstat, open } from "node:fs/promises";
|
|
5
|
+
import { dirname, resolve } from "node:path";
|
|
6
|
+
export const TRACE_SCHEMA_VERSION = 2;
|
|
7
|
+
const traceContext = new AsyncLocalStorage();
|
|
8
|
+
function durationMilliseconds(started) {
|
|
9
|
+
return Math.round(Number(process.hrtime.bigint() - started) / 1_000) / 1_000;
|
|
10
|
+
}
|
|
11
|
+
function errorName(caught) {
|
|
12
|
+
return caught instanceof Error ? caught.name : typeof caught;
|
|
13
|
+
}
|
|
14
|
+
class Trace {
|
|
15
|
+
events;
|
|
16
|
+
nextSequence;
|
|
17
|
+
nextSpanId;
|
|
18
|
+
traceId;
|
|
19
|
+
constructor() {
|
|
20
|
+
this.events = [];
|
|
21
|
+
this.nextSequence = 1;
|
|
22
|
+
this.nextSpanId = 1;
|
|
23
|
+
this.traceId = randomUUID();
|
|
24
|
+
}
|
|
25
|
+
emit(event) {
|
|
26
|
+
this.events.push({
|
|
27
|
+
schemaVersion: TRACE_SCHEMA_VERSION,
|
|
28
|
+
traceId: this.traceId,
|
|
29
|
+
sequence: this.nextSequence,
|
|
30
|
+
timestamp: new Date().toISOString(),
|
|
31
|
+
...event,
|
|
32
|
+
});
|
|
33
|
+
this.nextSequence += 1;
|
|
34
|
+
}
|
|
35
|
+
start(name, parentSpanId, attributes) {
|
|
36
|
+
const span = {
|
|
37
|
+
attributes,
|
|
38
|
+
id: String(this.nextSpanId),
|
|
39
|
+
name,
|
|
40
|
+
parentSpanId,
|
|
41
|
+
started: process.hrtime.bigint(),
|
|
42
|
+
};
|
|
43
|
+
this.nextSpanId += 1;
|
|
44
|
+
this.emit({
|
|
45
|
+
channel: "telemetry",
|
|
46
|
+
event: "span-start",
|
|
47
|
+
spanId: span.id,
|
|
48
|
+
parentSpanId,
|
|
49
|
+
name,
|
|
50
|
+
attributes,
|
|
51
|
+
});
|
|
52
|
+
return span;
|
|
53
|
+
}
|
|
54
|
+
end(span, status, attributes = {}) {
|
|
55
|
+
this.emit({
|
|
56
|
+
channel: "telemetry",
|
|
57
|
+
event: "span-end",
|
|
58
|
+
spanId: span.id,
|
|
59
|
+
parentSpanId: span.parentSpanId,
|
|
60
|
+
name: span.name,
|
|
61
|
+
status,
|
|
62
|
+
durationMs: durationMilliseconds(span.started),
|
|
63
|
+
attributes: { ...span.attributes, ...attributes },
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
serialize() {
|
|
67
|
+
return `${this.events.map((event) => JSON.stringify(event)).join("\n")}\n`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function requireAvailableTracePath(path) {
|
|
71
|
+
const parent = dirname(path);
|
|
72
|
+
const parentMetadata = await lstat(parent);
|
|
73
|
+
if (!parentMetadata.isDirectory()) {
|
|
74
|
+
throw new Error(`Trace parent is not a directory: ${parent}`);
|
|
75
|
+
}
|
|
76
|
+
await access(parent, constants.W_OK);
|
|
77
|
+
try {
|
|
78
|
+
await lstat(path);
|
|
79
|
+
}
|
|
80
|
+
catch (caught) {
|
|
81
|
+
if (caught instanceof Error && "code" in caught && caught.code === "ENOENT")
|
|
82
|
+
return;
|
|
83
|
+
throw caught;
|
|
84
|
+
}
|
|
85
|
+
throw new Error(`Trace file already exists: ${path}`);
|
|
86
|
+
}
|
|
87
|
+
async function traceAsyncLegacy(name, attributes, callback, summarize = () => ({})) {
|
|
88
|
+
const context = traceContext.getStore();
|
|
89
|
+
if (!context)
|
|
90
|
+
return callback();
|
|
91
|
+
const span = context.trace.start(name, context.parentSpanId, attributes);
|
|
92
|
+
return traceContext.run({ parentSpanId: span.id, trace: context.trace }, async () => {
|
|
93
|
+
try {
|
|
94
|
+
const result = await callback();
|
|
95
|
+
const summary = summarize(result);
|
|
96
|
+
context.trace.end(span, summary.status ?? "ok", summary.attributes ?? {});
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
catch (caught) {
|
|
100
|
+
context.trace.end(span, "error", { errorName: errorName(caught) });
|
|
101
|
+
throw caught;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export async function traceAsync(name, attributes, callback, summarize = () => ({})) {
|
|
106
|
+
const context = traceContext.getStore();
|
|
107
|
+
if (!context)
|
|
108
|
+
return callback();
|
|
109
|
+
const span = context.trace.start(name, context.parentSpanId, attributes);
|
|
110
|
+
return traceContext.run({ parentSpanId: span.id, trace: context.trace }, async () => {
|
|
111
|
+
try {
|
|
112
|
+
const result = await callback();
|
|
113
|
+
const summary = summarize(result);
|
|
114
|
+
context.trace.end(span, summary.status ?? "ok", summary.attributes ?? {});
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
catch (caught) {
|
|
118
|
+
context.trace.end(span, "error", { errorName: errorName(caught) });
|
|
119
|
+
throw caught;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function hash(value) {
|
|
124
|
+
return createHash("sha256")
|
|
125
|
+
.update(JSON.stringify(value))
|
|
126
|
+
.digest("hex");
|
|
127
|
+
}
|
|
128
|
+
function isRecord(value) {
|
|
129
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
130
|
+
}
|
|
131
|
+
function projectDomainMessage(message) {
|
|
132
|
+
const base = {
|
|
133
|
+
channel: "domain",
|
|
134
|
+
event: message.type,
|
|
135
|
+
messageSequence: message.sequence,
|
|
136
|
+
};
|
|
137
|
+
if (message.type === "intention.accepted") {
|
|
138
|
+
if (!isRecord(message.intention))
|
|
139
|
+
throw new TypeError("Invalid traced intention");
|
|
140
|
+
return {
|
|
141
|
+
...base,
|
|
142
|
+
command: message.intention.command,
|
|
143
|
+
argumentNames: Object.keys(message.intention.args ?? {}).sort(),
|
|
144
|
+
intentionHash: hash(message.intention),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
if (message.type === "observation.fact") {
|
|
148
|
+
if (!isRecord(message.fact) || !isRecord(message.fact.observation)) {
|
|
149
|
+
throw new TypeError("Invalid traced observation fact");
|
|
150
|
+
}
|
|
151
|
+
const observation = message.fact.observation;
|
|
152
|
+
const problems = Array.isArray(observation.problems) ? observation.problems : [];
|
|
153
|
+
const selectedIdea = isRecord(observation.selectedIdea) ? observation.selectedIdea : undefined;
|
|
154
|
+
const createdIdea = isRecord(observation.createdIdea) ? observation.createdIdea : undefined;
|
|
155
|
+
return {
|
|
156
|
+
...base,
|
|
157
|
+
factType: message.fact.type,
|
|
158
|
+
progress: message.fact.progress,
|
|
159
|
+
state: observation.state,
|
|
160
|
+
problemCount: problems.length,
|
|
161
|
+
problemTypes: problems.map((problem) => isRecord(problem) ? problem.type : undefined),
|
|
162
|
+
...(selectedIdea?.id === undefined
|
|
163
|
+
? {}
|
|
164
|
+
: { selectedIdeaId: selectedIdea.id }),
|
|
165
|
+
...(createdIdea?.id === undefined
|
|
166
|
+
? {}
|
|
167
|
+
: { createdIdeaId: createdIdea.id }),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
if (message.type === "action.requested") {
|
|
171
|
+
if (!isRecord(message.action))
|
|
172
|
+
throw new TypeError("Invalid traced action");
|
|
173
|
+
return {
|
|
174
|
+
...base,
|
|
175
|
+
actionId: message.actionId,
|
|
176
|
+
actionType: message.action.type,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
if (message.type === "action.finished") {
|
|
180
|
+
const problem = isRecord(message.problem) ? message.problem : undefined;
|
|
181
|
+
const result = isRecord(message.result) ? message.result : {};
|
|
182
|
+
return {
|
|
183
|
+
...base,
|
|
184
|
+
actionId: message.actionId,
|
|
185
|
+
actionType: message.actionType,
|
|
186
|
+
status: message.status,
|
|
187
|
+
...(problem?.type === undefined
|
|
188
|
+
? {}
|
|
189
|
+
: { problemType: problem.type }),
|
|
190
|
+
resultFields: Object.keys(result).sort(),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
if (message.type === "response.created") {
|
|
194
|
+
if (!isRecord(message.metadata))
|
|
195
|
+
throw new TypeError("Invalid traced response metadata");
|
|
196
|
+
return {
|
|
197
|
+
...base,
|
|
198
|
+
kind: message.kind,
|
|
199
|
+
responseHash: message.metadata.hash,
|
|
200
|
+
nextStepCount: message.metadata.nextStepCount,
|
|
201
|
+
itemCount: message.metadata.itemCount,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
throw new Error(`Cannot trace unknown domain message type: ${message.type}`);
|
|
205
|
+
}
|
|
206
|
+
export function emitDomainMessage(message) {
|
|
207
|
+
const context = traceContext.getStore();
|
|
208
|
+
if (!context)
|
|
209
|
+
return;
|
|
210
|
+
if (!isRecord(message))
|
|
211
|
+
throw new TypeError("Invalid traced domain message");
|
|
212
|
+
context.trace.emit(projectDomainMessage(message));
|
|
213
|
+
}
|
|
214
|
+
export function traceSync(name, attributes, callback, summarize = () => ({})) {
|
|
215
|
+
const context = traceContext.getStore();
|
|
216
|
+
if (!context)
|
|
217
|
+
return callback();
|
|
218
|
+
const span = context.trace.start(name, context.parentSpanId, attributes);
|
|
219
|
+
return traceContext.run({ parentSpanId: span.id, trace: context.trace }, () => {
|
|
220
|
+
try {
|
|
221
|
+
const result = callback();
|
|
222
|
+
const summary = summarize(result);
|
|
223
|
+
context.trace.end(span, summary.status ?? "ok", summary.attributes ?? {});
|
|
224
|
+
return result;
|
|
225
|
+
}
|
|
226
|
+
catch (caught) {
|
|
227
|
+
context.trace.end(span, "error", { errorName: errorName(caught) });
|
|
228
|
+
throw caught;
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
async function flushTrace(path, trace) {
|
|
233
|
+
const span = trace.start("trace.flush", null, {});
|
|
234
|
+
let handle;
|
|
235
|
+
let failure;
|
|
236
|
+
let spanEnded = false;
|
|
237
|
+
try {
|
|
238
|
+
handle = await open(path, "wx");
|
|
239
|
+
await handle.writeFile(trace.serialize(), { encoding: "utf8" });
|
|
240
|
+
await handle.sync();
|
|
241
|
+
trace.end(span, "ok", { eventCount: trace.events.length + 1 });
|
|
242
|
+
spanEnded = true;
|
|
243
|
+
await handle.appendFile(`${JSON.stringify(trace.events.at(-1))}\n`, { encoding: "utf8" });
|
|
244
|
+
await handle.sync();
|
|
245
|
+
}
|
|
246
|
+
catch (caught) {
|
|
247
|
+
if (!spanEnded) {
|
|
248
|
+
trace.end(span, "error", { errorName: errorName(caught) });
|
|
249
|
+
}
|
|
250
|
+
failure = caught;
|
|
251
|
+
}
|
|
252
|
+
if (handle) {
|
|
253
|
+
try {
|
|
254
|
+
await handle.close();
|
|
255
|
+
}
|
|
256
|
+
catch (caught) {
|
|
257
|
+
failure = failure
|
|
258
|
+
? new AggregateError([failure, caught], `Cannot close trace file: ${path}`)
|
|
259
|
+
: caught;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (failure)
|
|
263
|
+
throw failure;
|
|
264
|
+
}
|
|
265
|
+
export async function withTraceFile(file, name, attributes, callback) {
|
|
266
|
+
if (file === undefined)
|
|
267
|
+
return callback();
|
|
268
|
+
const path = resolve(file);
|
|
269
|
+
await requireAvailableTracePath(path);
|
|
270
|
+
const trace = new Trace();
|
|
271
|
+
let outcome;
|
|
272
|
+
try {
|
|
273
|
+
const value = await traceContext.run({ parentSpanId: null, trace }, () => traceAsync(name, attributes, callback));
|
|
274
|
+
outcome = { ok: true, value };
|
|
275
|
+
}
|
|
276
|
+
catch (caught) {
|
|
277
|
+
outcome = { ok: false, error: caught };
|
|
278
|
+
}
|
|
279
|
+
let traceError;
|
|
280
|
+
try {
|
|
281
|
+
await flushTrace(path, trace);
|
|
282
|
+
}
|
|
283
|
+
catch (caught) {
|
|
284
|
+
traceError = caught;
|
|
285
|
+
}
|
|
286
|
+
if (!outcome.ok && traceError) {
|
|
287
|
+
throw new AggregateError([outcome.error, traceError], `Command failed and trace file could not be written: ${path}`);
|
|
288
|
+
}
|
|
289
|
+
if (!outcome.ok)
|
|
290
|
+
throw outcome.error;
|
|
291
|
+
if (traceError) {
|
|
292
|
+
const message = traceError instanceof Error ? traceError.message : String(traceError);
|
|
293
|
+
throw new Error(`Cannot write trace file ${path}: ${message}`, {
|
|
294
|
+
cause: traceError,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
return outcome.value;
|
|
298
|
+
}
|
|
299
|
+
//# sourceMappingURL=trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.js","sourceRoot":"","sources":["../../../../src/foundation/trace/trace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAqBtC,MAAM,YAAY,GAAG,IAAI,iBAAiB,EAAgB,CAAC;AAE3D,SAAS,oBAAoB,CAAC,OAAe;IAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAC/E,CAAC;AAED,SAAS,SAAS,CAAC,MAAe;IAChC,OAAO,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,MAAM,CAAC;AAC/D,CAAC;AAED,MAAM,KAAK;IACT,MAAM,CAAoB;IAC1B,YAAY,CAAS;IACrB,UAAU,CAAS;IACnB,OAAO,CAAS;IAEhB;QACE,IAAI,CAAC,MAAM,GAAG,EAAE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AAAA,OAAO,EACL,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,GAChB,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/foundation/tui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,GAChB,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type TuiMarkdownBlock = {
|
|
2
|
+
kind: "markdown";
|
|
3
|
+
content: string;
|
|
4
|
+
} | {
|
|
5
|
+
kind: "table";
|
|
6
|
+
lines: string[];
|
|
7
|
+
width: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function tuiMarkdownBlocks(content: string, availableWidth: number): TuiMarkdownBlock[];
|
|
10
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/foundation/tui/table.ts"],"names":[],"mappings":"AAoBA,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAuEtD,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,GACrB,gBAAgB,EAAE,CAgCpB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import stringWidth from "string-width";
|
|
2
|
+
import { parse } from "tui-md";
|
|
3
|
+
function isRecord(value) {
|
|
4
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5
|
+
}
|
|
6
|
+
function isMarkdownNode(value) {
|
|
7
|
+
return isRecord(value)
|
|
8
|
+
&& typeof value.type === "string"
|
|
9
|
+
&& (value.children === undefined
|
|
10
|
+
|| (Array.isArray(value.children) && value.children.every(isMarkdownNode)));
|
|
11
|
+
}
|
|
12
|
+
function isTableNode(value) {
|
|
13
|
+
return isMarkdownNode(value)
|
|
14
|
+
&& value.type === "table"
|
|
15
|
+
&& Array.isArray(value.children)
|
|
16
|
+
&& value.children.every((row) => isRecord(row)
|
|
17
|
+
&& Array.isArray(row.children)
|
|
18
|
+
&& row.children.every((cell) => isRecord(cell)
|
|
19
|
+
&& Array.isArray(cell.children)
|
|
20
|
+
&& cell.children.every(isMarkdownNode)));
|
|
21
|
+
}
|
|
22
|
+
function cellText(node) {
|
|
23
|
+
if (node.type === "image")
|
|
24
|
+
return node.alt ?? "";
|
|
25
|
+
if (typeof node.value === "string")
|
|
26
|
+
return node.value;
|
|
27
|
+
return node.children?.map(cellText).join("") ?? "";
|
|
28
|
+
}
|
|
29
|
+
function terminalCellText(node) {
|
|
30
|
+
return cellText(node).replaceAll("\t", " ");
|
|
31
|
+
}
|
|
32
|
+
function tableLines(node) {
|
|
33
|
+
const rows = node.children.map((row) => row.children.map((cell) => cell.children.map(terminalCellText).join("")));
|
|
34
|
+
const firstRow = rows[0] ?? [];
|
|
35
|
+
const widths = firstRow.map((_, column) => Math.max(3, ...rows.map((row) => stringWidth(row[column] ?? "") + 2)));
|
|
36
|
+
const border = (left, middle, right) => `${left}${widths.map((width) => "─".repeat(width)).join(middle)}${right}`;
|
|
37
|
+
const rowLine = (row) => `│${widths.map((width, column) => {
|
|
38
|
+
const value = row[column] ?? "";
|
|
39
|
+
const space = width - 2 - stringWidth(value);
|
|
40
|
+
const alignment = node.align?.[column];
|
|
41
|
+
const left = alignment === "right"
|
|
42
|
+
? space
|
|
43
|
+
: alignment === "center" ? Math.floor(space / 2) : 0;
|
|
44
|
+
return ` ${" ".repeat(left)}${value}${" ".repeat(space - left)} │`;
|
|
45
|
+
}).join("")}`;
|
|
46
|
+
const lines = [
|
|
47
|
+
border("┌", "┬", "┐"),
|
|
48
|
+
rowLine(firstRow),
|
|
49
|
+
border("├", "┼", "┤"),
|
|
50
|
+
];
|
|
51
|
+
for (const [index, row] of rows.slice(1).entries()) {
|
|
52
|
+
if (index > 0)
|
|
53
|
+
lines.push(border("├", "┼", "┤"));
|
|
54
|
+
lines.push(rowLine(row));
|
|
55
|
+
}
|
|
56
|
+
lines.push(border("└", "┴", "┘"));
|
|
57
|
+
return { lines, width: stringWidth(lines[0] ?? "") };
|
|
58
|
+
}
|
|
59
|
+
export function tuiMarkdownBlocks(content, availableWidth) {
|
|
60
|
+
if (!content.includes("|"))
|
|
61
|
+
return [{ kind: "markdown", content }];
|
|
62
|
+
const blocks = [];
|
|
63
|
+
let offset = 0;
|
|
64
|
+
for (const node of parse(content).children) {
|
|
65
|
+
if (!isTableNode(node))
|
|
66
|
+
continue;
|
|
67
|
+
if (!node.children.every((row) => row.children.every((cell) => cell.children.every((child) => child.type === "text"))))
|
|
68
|
+
continue;
|
|
69
|
+
const table = tableLines(node);
|
|
70
|
+
const hasWideText = node.children.some((row) => row.children.some((cell) => {
|
|
71
|
+
const text = cell.children.map(terminalCellText).join("");
|
|
72
|
+
return stringWidth(text) > text.length;
|
|
73
|
+
}));
|
|
74
|
+
if (!hasWideText || table.width > availableWidth)
|
|
75
|
+
continue;
|
|
76
|
+
const start = node.position?.start.offset;
|
|
77
|
+
const end = node.position?.end.offset;
|
|
78
|
+
if (start === undefined || end === undefined)
|
|
79
|
+
continue;
|
|
80
|
+
if (start > offset) {
|
|
81
|
+
blocks.push({ kind: "markdown", content: content.slice(offset, start) });
|
|
82
|
+
}
|
|
83
|
+
blocks.push({ kind: "table", lines: table.lines, width: table.width });
|
|
84
|
+
offset = end;
|
|
85
|
+
}
|
|
86
|
+
if (offset < content.length) {
|
|
87
|
+
blocks.push({ kind: "markdown", content: content.slice(offset) });
|
|
88
|
+
}
|
|
89
|
+
return blocks.length === 0 ? [{ kind: "markdown", content }] : blocks;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../../src/foundation/tui/table.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAuB/B,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,QAAQ,CAAC,KAAK,CAAC;WACjB,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;WAC9B,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS;eAC3B,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,cAAc,CAAC,KAAK,CAAC;WACvB,KAAK,CAAC,IAAI,KAAK,OAAO;WACtB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC;WAC7B,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAC9B,QAAQ,CAAC,GAAG,CAAC;eACV,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;eAC3B,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAC7B,QAAQ,CAAC,IAAI,CAAC;mBACX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I,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SpawnSyncOptionsWithStringEncoding, SpawnSyncReturns } from "node:child_process";
|
|
2
|
+
export declare function copyStatusColor(status: {
|
|
3
|
+
kind: unknown;
|
|
4
|
+
} | null): "#9ccb9e" | "#e2b86b" | "#6b6b6b";
|
|
5
|
+
export declare function copyWindowsClipboard(text: string, spawn?: (command: string, args: readonly string[], options: SpawnSyncOptionsWithStringEncoding) => SpawnSyncReturns<string>, systemRoot?: string | undefined): {
|
|
6
|
+
ok: boolean;
|
|
7
|
+
reason: string;
|
|
8
|
+
} | {
|
|
9
|
+
ok: boolean;
|
|
10
|
+
reason?: never;
|
|
11
|
+
};
|
|
12
|
+
interface SelectionRenderer {
|
|
13
|
+
getSelection(): {
|
|
14
|
+
getSelectedText(): string;
|
|
15
|
+
} | null;
|
|
16
|
+
copyToClipboardOSC52(text: string): boolean;
|
|
17
|
+
}
|
|
18
|
+
interface CopyStatus {
|
|
19
|
+
kind: "success" | "warning";
|
|
20
|
+
message: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function copyTuiSelection(renderer: SelectionRenderer, { stdout, platform, windowsClipboard, }?: {
|
|
23
|
+
stdout?: NodeJS.WriteStream | object;
|
|
24
|
+
platform?: NodeJS.Platform;
|
|
25
|
+
windowsClipboard?: typeof copyWindowsClipboard;
|
|
26
|
+
}): CopyStatus;
|
|
27
|
+
export declare function tuiOutputStream(stdout: NodeJS.WriteStream, platform?: NodeJS.Platform): NodeJS.WriteStream;
|
|
28
|
+
export declare function renderTuiMarkdown(content: string, { stdin, stdout }: {
|
|
29
|
+
stdin: NodeJS.ReadStream;
|
|
30
|
+
stdout: NodeJS.WriteStream;
|
|
31
|
+
}): Promise<void>;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=tui.d.ts.map
|
|
@@ -0,0 +1 @@
|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AC;IAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAA;CAAE,iBAiB5E"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { createCliRenderer } from "@opentui/core";
|
|
2
|
+
import { win32 } from "node:path";
|
|
3
|
+
import { createRoot, useKeyboard, useRenderer, useTerminalDimensions, } from "@opentui/react";
|
|
4
|
+
import { createElement, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { Markdown } from "tui-md";
|
|
6
|
+
import { runSubprocess } from "../process/index.js";
|
|
7
|
+
import { tuiMarkdownBlocks } from "./table.js";
|
|
8
|
+
const COPY_STATUS_DURATION_MS = 3000;
|
|
9
|
+
const SHORTCUT_HINT = " [q/Esc] quit [scroll] navigate [drag, y] copy";
|
|
10
|
+
const SUCCESS_COLOR = "#9ccb9e";
|
|
11
|
+
const WARNING_COLOR = "#e2b86b";
|
|
12
|
+
function spawnClipboard(command, args, options) {
|
|
13
|
+
return runSubprocess(command, args, options, {
|
|
14
|
+
attributes: { operation: "windows-clipboard" },
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export function copyStatusColor(status) {
|
|
18
|
+
if (status === null)
|
|
19
|
+
return "#6b6b6b";
|
|
20
|
+
if (status.kind === "success")
|
|
21
|
+
return SUCCESS_COLOR;
|
|
22
|
+
if (status.kind === "warning")
|
|
23
|
+
return WARNING_COLOR;
|
|
24
|
+
throw new Error(`Unsupported copy status kind: ${status.kind}`);
|
|
25
|
+
}
|
|
26
|
+
export function copyWindowsClipboard(text, spawn = spawnClipboard, systemRoot = process.env.SystemRoot) {
|
|
27
|
+
if (!systemRoot)
|
|
28
|
+
return { ok: false, reason: "SystemRoot is unavailable" };
|
|
29
|
+
const script = [
|
|
30
|
+
"$ErrorActionPreference = 'Stop'",
|
|
31
|
+
"[Console]::InputEncoding = New-Object System.Text.UTF8Encoding($false)",
|
|
32
|
+
"$value = [Console]::In.ReadToEnd()",
|
|
33
|
+
"Set-Clipboard -Value $value",
|
|
34
|
+
].join("; ");
|
|
35
|
+
const result = spawn(win32.join(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"), [
|
|
36
|
+
"-NoProfile", "-NonInteractive", "-Command", script,
|
|
37
|
+
], {
|
|
38
|
+
encoding: "utf8",
|
|
39
|
+
input: Buffer.from(text, "utf8"),
|
|
40
|
+
timeout: 5000,
|
|
41
|
+
windowsHide: true,
|
|
42
|
+
});
|
|
43
|
+
if (result.error)
|
|
44
|
+
return { ok: false, reason: result.error.message };
|
|
45
|
+
if (result.status !== 0) {
|
|
46
|
+
return {
|
|
47
|
+
ok: false,
|
|
48
|
+
reason: result.stderr?.trim().split(/\r?\n/, 1)[0]
|
|
49
|
+
|| `PowerShell exited with status ${result.status}`,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return { ok: true };
|
|
53
|
+
}
|
|
54
|
+
export function copyTuiSelection(renderer, { stdout = process.stdout, platform = process.platform, windowsClipboard = copyWindowsClipboard, } = {}) {
|
|
55
|
+
const text = renderer.getSelection()?.getSelectedText();
|
|
56
|
+
if (!text)
|
|
57
|
+
return { message: "Select text first", kind: "warning" };
|
|
58
|
+
if (renderer.copyToClipboardOSC52(text)) {
|
|
59
|
+
return { message: "Copy sent to terminal clipboard", kind: "success" };
|
|
60
|
+
}
|
|
61
|
+
if (platform === "win32" && stdout === process.stdout) {
|
|
62
|
+
const result = windowsClipboard(text);
|
|
63
|
+
return result.ok
|
|
64
|
+
? { message: "Copied to Windows clipboard", kind: "success" }
|
|
65
|
+
: { message: `Copy failed: ${result.reason}`, kind: "warning" };
|
|
66
|
+
}
|
|
67
|
+
return { message: "No clipboard; Shift+drag", kind: "warning" };
|
|
68
|
+
}
|
|
69
|
+
function MarkdownViewer({ content, stdout, }) {
|
|
70
|
+
const renderer = useRenderer();
|
|
71
|
+
const { height, width } = useTerminalDimensions();
|
|
72
|
+
const [copyStatus, setCopyStatus] = useState(null);
|
|
73
|
+
const copyStatusTimeout = useRef(null);
|
|
74
|
+
const contentWidth = Math.max(1, width - 4);
|
|
75
|
+
const blocks = useMemo(() => tuiMarkdownBlocks(content, contentWidth), [content, contentWidth]);
|
|
76
|
+
useEffect(() => () => {
|
|
77
|
+
if (copyStatusTimeout.current !== null)
|
|
78
|
+
clearTimeout(copyStatusTimeout.current);
|
|
79
|
+
}, []);
|
|
80
|
+
useKeyboard((key) => {
|
|
81
|
+
if (key.name === "q" || key.name === "escape")
|
|
82
|
+
renderer.destroy();
|
|
83
|
+
if (key.name === "y") {
|
|
84
|
+
if (copyStatusTimeout.current !== null)
|
|
85
|
+
clearTimeout(copyStatusTimeout.current);
|
|
86
|
+
setCopyStatus(copyTuiSelection(renderer, { stdout }));
|
|
87
|
+
copyStatusTimeout.current = setTimeout(() => {
|
|
88
|
+
setCopyStatus(null);
|
|
89
|
+
copyStatusTimeout.current = null;
|
|
90
|
+
}, COPY_STATUS_DURATION_MS);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return createElement("box", {
|
|
94
|
+
flexDirection: "column",
|
|
95
|
+
height,
|
|
96
|
+
width,
|
|
97
|
+
}, createElement("box", {
|
|
98
|
+
backgroundColor: "#1e1e1e",
|
|
99
|
+
flexShrink: 0,
|
|
100
|
+
paddingX: 1,
|
|
101
|
+
width: "100%",
|
|
102
|
+
}, createElement("text", { fg: "#569cd6" }, "Silvermoon"), createElement("text", {
|
|
103
|
+
fg: copyStatusColor(copyStatus),
|
|
104
|
+
height: 1,
|
|
105
|
+
truncate: true,
|
|
106
|
+
width: "100%",
|
|
107
|
+
wrapMode: "none",
|
|
108
|
+
}, copyStatus ? ` ${copyStatus.message}` : SHORTCUT_HINT)), createElement("scrollbox", {
|
|
109
|
+
flexGrow: 1,
|
|
110
|
+
flexShrink: 1,
|
|
111
|
+
scrollY: true,
|
|
112
|
+
width: "100%",
|
|
113
|
+
}, createElement("box", {
|
|
114
|
+
flexDirection: "column",
|
|
115
|
+
paddingX: 2,
|
|
116
|
+
paddingY: 1,
|
|
117
|
+
width: contentWidth,
|
|
118
|
+
}, ...blocks.map((block, index) => block.kind === "markdown"
|
|
119
|
+
? createElement(Markdown, { key: index, content: block.content })
|
|
120
|
+
: createElement("box", { key: index, flexDirection: "column", marginBottom: 1, width: "100%" }, ...block.lines.map((line, lineIndex) => createElement("text", {
|
|
121
|
+
key: lineIndex,
|
|
122
|
+
fg: lineIndex === 1 ? "#569cd6" : "#d4d4d4",
|
|
123
|
+
width: block.width,
|
|
124
|
+
wrapMode: "none",
|
|
125
|
+
}, line)))))));
|
|
126
|
+
}
|
|
127
|
+
export function tuiOutputStream(stdout, platform = process.platform) {
|
|
128
|
+
if (platform !== "win32")
|
|
129
|
+
return stdout;
|
|
130
|
+
// A distinct stream makes OpenTUI use its byte feed instead of writing UTF-8
|
|
131
|
+
// directly through the native Windows console's legacy output code page.
|
|
132
|
+
return new Proxy(stdout, {
|
|
133
|
+
get(target, property, receiver) {
|
|
134
|
+
const value = Reflect.get(target, property, receiver);
|
|
135
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
export async function renderTuiMarkdown(content, { stdin, stdout }) {
|
|
140
|
+
let renderer;
|
|
141
|
+
try {
|
|
142
|
+
renderer = await createCliRenderer({
|
|
143
|
+
clearOnShutdown: true,
|
|
144
|
+
exitOnCtrlC: true,
|
|
145
|
+
screenMode: "alternate-screen",
|
|
146
|
+
stdin,
|
|
147
|
+
stdout: tuiOutputStream(stdout),
|
|
148
|
+
});
|
|
149
|
+
renderer.setTerminalTitle("Silvermoon");
|
|
150
|
+
createRoot(renderer).render(createElement(MarkdownViewer, { content, stdout }));
|
|
151
|
+
}
|
|
152
|
+
catch (caught) {
|
|
153
|
+
renderer?.destroy();
|
|
154
|
+
throw caught;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=tui.js.map
|