self-evolving-workflow 0.0.0-stage → 0.1.4
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/LICENSE +27 -0
- package/README.md +195 -2
- package/dist/agent-memory-prompts.d.ts +13 -0
- package/dist/agent-memory-prompts.js +55 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +6 -0
- package/dist/closeout.d.ts +105 -0
- package/dist/closeout.js +473 -0
- package/dist/code.d.ts +39 -0
- package/dist/code.js +124 -0
- package/dist/codex-memory.d.ts +24 -0
- package/dist/codex-memory.js +217 -0
- package/dist/common.d.ts +16 -0
- package/dist/common.js +52 -0
- package/dist/context-envelope.d.ts +59 -0
- package/dist/context-envelope.js +23 -0
- package/dist/host-adapters.d.ts +34 -0
- package/dist/host-adapters.js +151 -0
- package/dist/http.d.ts +3 -0
- package/dist/http.js +90 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +13 -0
- package/dist/knowledge-cli.d.ts +198 -0
- package/dist/knowledge-cli.js +761 -0
- package/dist/knowledge-reads.d.ts +72 -0
- package/dist/knowledge-reads.js +201 -0
- package/dist/memory-config.d.ts +44 -0
- package/dist/memory-config.js +204 -0
- package/dist/memory-evidence.d.ts +13 -0
- package/dist/memory-evidence.js +40 -0
- package/dist/memory-history.d.ts +46 -0
- package/dist/memory-history.js +432 -0
- package/dist/memory.d.ts +96 -0
- package/dist/memory.js +362 -0
- package/dist/retrospective.d.ts +57 -0
- package/dist/retrospective.js +240 -0
- package/dist/search.d.ts +36 -0
- package/dist/search.js +112 -0
- package/dist/skill-addition.d.ts +25 -0
- package/dist/skill-addition.js +89 -0
- package/dist/skill-design.d.ts +96 -0
- package/dist/skill-design.js +226 -0
- package/dist/skill-replay.d.ts +55 -0
- package/dist/skill-replay.js +448 -0
- package/dist/skill-route.d.ts +30 -0
- package/dist/skill-route.js +75 -0
- package/dist/transcript-evidence.d.ts +3 -0
- package/dist/transcript-evidence.js +58 -0
- package/dist/upstream/chunker.d.ts +24 -0
- package/dist/upstream/chunker.js +96 -0
- package/dist/upstream/file-protocol.d.ts +45 -0
- package/dist/upstream/file-protocol.js +117 -0
- package/dist/upstream/frontmatter.d.ts +47 -0
- package/dist/upstream/frontmatter.js +86 -0
- package/dist/upstream/graph-search.d.ts +33 -0
- package/dist/upstream/graph-search.js +67 -0
- package/dist/upstream/l1-extraction.d.ts +26 -0
- package/dist/upstream/l1-extraction.js +405 -0
- package/dist/upstream/llm.d.ts +8 -0
- package/dist/upstream/llm.js +1 -0
- package/dist/upstream/merge.d.ts +50 -0
- package/dist/upstream/merge.js +153 -0
- package/dist/upstream/prompts.d.ts +53 -0
- package/dist/upstream/prompts.js +181 -0
- package/dist/upstream/search-utils.d.ts +34 -0
- package/dist/upstream/search-utils.js +55 -0
- package/dist/upstream/slug.d.ts +26 -0
- package/dist/upstream/slug.js +103 -0
- package/dist/upstream/template.d.ts +29 -0
- package/dist/upstream/template.js +80 -0
- package/dist/upstream/tokenize.d.ts +4 -0
- package/dist/upstream/tokenize.js +29 -0
- package/dist/wiki-change.d.ts +76 -0
- package/dist/wiki-change.js +299 -0
- package/dist/wiki-entry.d.ts +26 -0
- package/dist/wiki-entry.js +93 -0
- package/dist/wiki-ingest.d.ts +12 -0
- package/dist/wiki-ingest.js +126 -0
- package/dist/wiki-migration.d.ts +16 -0
- package/dist/wiki-migration.js +268 -0
- package/dist/wiki-tokens.d.ts +1 -0
- package/dist/wiki-tokens.js +46 -0
- package/dist/wiki.d.ts +103 -0
- package/dist/wiki.js +330 -0
- package/dist/workflow-cli.d.ts +2 -0
- package/dist/workflow-cli.js +319 -0
- package/dist/workflow-install.d.ts +37 -0
- package/dist/workflow-install.js +148 -0
- package/dist/workflow-knowledge.d.ts +18 -0
- package/dist/workflow-knowledge.js +32 -0
- package/dist/workflow-mcp.d.ts +2 -0
- package/dist/workflow-mcp.js +137 -0
- package/dist/workflow-names.d.ts +4 -0
- package/dist/workflow-names.js +31 -0
- package/dist/workflow-runtime.d.ts +735 -0
- package/dist/workflow-runtime.js +747 -0
- package/dist/workflow-skills.d.ts +48 -0
- package/dist/workflow-skills.js +141 -0
- package/docs/images/impeccable-skill.png +0 -0
- package/docs/images/workflow-overview.png +0 -0
- package/docs/images/workflow-skills.png +0 -0
- package/package.json +77 -4
- package/skills/ew-impeccable/LICENSE +191 -0
- package/skills/ew-impeccable/NOTICE.md +19 -0
- package/skills/ew-impeccable/SKILL.md +91 -0
- package/skills/ew-impeccable/UPSTREAM.md +23 -0
- package/skills/ew-impeccable/reference/adapt.md +314 -0
- package/skills/ew-impeccable/reference/adapt.native.md +60 -0
- package/skills/ew-impeccable/reference/android.md +46 -0
- package/skills/ew-impeccable/reference/animate.md +91 -0
- package/skills/ew-impeccable/reference/audit.md +138 -0
- package/skills/ew-impeccable/reference/audit.native.md +141 -0
- package/skills/ew-impeccable/reference/bolder.md +35 -0
- package/skills/ew-impeccable/reference/clarify.md +96 -0
- package/skills/ew-impeccable/reference/colorize.md +88 -0
- package/skills/ew-impeccable/reference/craft-floor.md +44 -0
- package/skills/ew-impeccable/reference/craft.md +5 -0
- package/skills/ew-impeccable/reference/critique.md +808 -0
- package/skills/ew-impeccable/reference/degraded/asset-producer.md +36 -0
- package/skills/ew-impeccable/reference/degraded/documenter.md +23 -0
- package/skills/ew-impeccable/reference/degraded/finish-reviewer.md +72 -0
- package/skills/ew-impeccable/reference/degraded/manual-edit-applier.md +91 -0
- package/skills/ew-impeccable/reference/delight.md +72 -0
- package/skills/ew-impeccable/reference/distill.md +113 -0
- package/skills/ew-impeccable/reference/doctor.md +56 -0
- package/skills/ew-impeccable/reference/document.md +418 -0
- package/skills/ew-impeccable/reference/extract.md +68 -0
- package/skills/ew-impeccable/reference/harden.md +338 -0
- package/skills/ew-impeccable/reference/hooks.md +113 -0
- package/skills/ew-impeccable/reference/init.md +133 -0
- package/skills/ew-impeccable/reference/ios.md +51 -0
- package/skills/ew-impeccable/reference/layout.md +86 -0
- package/skills/ew-impeccable/reference/live-setup.md +102 -0
- package/skills/ew-impeccable/reference/live.md +326 -0
- package/skills/ew-impeccable/reference/new-work.md +209 -0
- package/skills/ew-impeccable/reference/onboard.md +236 -0
- package/skills/ew-impeccable/reference/operate.md +61 -0
- package/skills/ew-impeccable/reference/optimize.md +260 -0
- package/skills/ew-impeccable/reference/overdrive.md +127 -0
- package/skills/ew-impeccable/reference/polish.md +105 -0
- package/skills/ew-impeccable/reference/quieter.md +101 -0
- package/skills/ew-impeccable/reference/routing.md +20 -0
- package/skills/ew-impeccable/reference/shape.md +59 -0
- package/skills/ew-impeccable/reference/typeset.md +82 -0
- package/skills/ew-impeccable/reference/visualize.md +46 -0
- package/skills/ew-impeccable/scripts/build-phase.mjs +1022 -0
- package/skills/ew-impeccable/scripts/command-metadata.json +94 -0
- package/skills/ew-impeccable/scripts/comp-diff.mjs +391 -0
- package/skills/ew-impeccable/scripts/comp-spec.mjs +513 -0
- package/skills/ew-impeccable/scripts/concept-seed.mjs +814 -0
- package/skills/ew-impeccable/scripts/context-signals.mjs +325 -0
- package/skills/ew-impeccable/scripts/context.mjs +1521 -0
- package/skills/ew-impeccable/scripts/critique-storage.mjs +473 -0
- package/skills/ew-impeccable/scripts/data/font-index-failures.json +121 -0
- package/skills/ew-impeccable/scripts/data/font-index.json +1 -0
- package/skills/ew-impeccable/scripts/detect-csp.mjs +246 -0
- package/skills/ew-impeccable/scripts/detect.mjs +30 -0
- package/skills/ew-impeccable/scripts/detector/browser/injected/index.mjs +2580 -0
- package/skills/ew-impeccable/scripts/detector/cli/main.mjs +498 -0
- package/skills/ew-impeccable/scripts/detector/design-system.mjs +1311 -0
- package/skills/ew-impeccable/scripts/detector/detect-antipatterns-browser.js +9486 -0
- package/skills/ew-impeccable/scripts/detector/detect-antipatterns.mjs +51 -0
- package/skills/ew-impeccable/scripts/detector/engines/browser/detect-url.mjs +434 -0
- package/skills/ew-impeccable/scripts/detector/engines/regex/detect-text.mjs +1439 -0
- package/skills/ew-impeccable/scripts/detector/engines/static-html/css-cascade.mjs +1242 -0
- package/skills/ew-impeccable/scripts/detector/engines/static-html/detect-html.mjs +263 -0
- package/skills/ew-impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +189 -0
- package/skills/ew-impeccable/scripts/detector/findings.mjs +23 -0
- package/skills/ew-impeccable/scripts/detector/node/file-system.mjs +225 -0
- package/skills/ew-impeccable/scripts/detector/profile/profiler.mjs +166 -0
- package/skills/ew-impeccable/scripts/detector/registry/antipatterns.mjs +636 -0
- package/skills/ew-impeccable/scripts/detector/rules/checks.mjs +5750 -0
- package/skills/ew-impeccable/scripts/detector/shared/color.mjs +596 -0
- package/skills/ew-impeccable/scripts/detector/shared/constants.mjs +127 -0
- package/skills/ew-impeccable/scripts/detector/shared/fonts.mjs +30 -0
- package/skills/ew-impeccable/scripts/detector/shared/inline-ignores.mjs +148 -0
- package/skills/ew-impeccable/scripts/detector/shared/page.mjs +7 -0
- package/skills/ew-impeccable/scripts/detector/vendor/MDN-DATA-LICENSE +116 -0
- package/skills/ew-impeccable/scripts/detector/vendor/THIRD_PARTY_LICENSES.md +227 -0
- package/skills/ew-impeccable/scripts/detector/vendor/static-html-parser.build-entry.txt +11 -0
- package/skills/ew-impeccable/scripts/detector/vendor/static-html-parser.bundle.mjs +9121 -0
- package/skills/ew-impeccable/scripts/doctor.mjs +330 -0
- package/skills/ew-impeccable/scripts/embed-prompt.mjs +166 -0
- package/skills/ew-impeccable/scripts/font-match.mjs +457 -0
- package/skills/ew-impeccable/scripts/generate-image.mjs +447 -0
- package/skills/ew-impeccable/scripts/hook-admin.mjs +829 -0
- package/skills/ew-impeccable/scripts/hook-before-edit.mjs +538 -0
- package/skills/ew-impeccable/scripts/hook-lib.mjs +2493 -0
- package/skills/ew-impeccable/scripts/hook.mjs +79 -0
- package/skills/ew-impeccable/scripts/lib/artifact-schema.mjs +93 -0
- package/skills/ew-impeccable/scripts/lib/composition-catalog.mjs +200 -0
- package/skills/ew-impeccable/scripts/lib/concept-catalog.mjs +395 -0
- package/skills/ew-impeccable/scripts/lib/design-parser.mjs +880 -0
- package/skills/ew-impeccable/scripts/lib/font-fingerprint.mjs +564 -0
- package/skills/ew-impeccable/scripts/lib/font-index.mjs +130 -0
- package/skills/ew-impeccable/scripts/lib/hero-checks.mjs +246 -0
- package/skills/ew-impeccable/scripts/lib/image-metrics.mjs +306 -0
- package/skills/ew-impeccable/scripts/lib/impeccable-config.mjs +640 -0
- package/skills/ew-impeccable/scripts/lib/impeccable-paths.mjs +137 -0
- package/skills/ew-impeccable/scripts/lib/is-generated.mjs +72 -0
- package/skills/ew-impeccable/scripts/lib/live-path-globs.mjs +37 -0
- package/skills/ew-impeccable/scripts/lib/open-system-browser.mjs +26 -0
- package/skills/ew-impeccable/scripts/lib/png.mjs +281 -0
- package/skills/ew-impeccable/scripts/lib/provider.mjs +5 -0
- package/skills/ew-impeccable/scripts/lib/raster.mjs +194 -0
- package/skills/ew-impeccable/scripts/lib/roll-selection.mjs +369 -0
- package/skills/ew-impeccable/scripts/lib/staleness-deep.mjs +491 -0
- package/skills/ew-impeccable/scripts/lib/staleness-notice.mjs +169 -0
- package/skills/ew-impeccable/scripts/lib/staleness.mjs +532 -0
- package/skills/ew-impeccable/scripts/lib/surface-briefs.mjs +149 -0
- package/skills/ew-impeccable/scripts/lib/target-args.mjs +42 -0
- package/skills/ew-impeccable/scripts/lib/target-slug.mjs +33 -0
- package/skills/ew-impeccable/scripts/lib/template-extensions.mjs +146 -0
- package/skills/ew-impeccable/scripts/live/accept-css.mjs +617 -0
- package/skills/ew-impeccable/scripts/live/accept-verify.mjs +60 -0
- package/skills/ew-impeccable/scripts/live/browser-script-parts.mjs +84 -0
- package/skills/ew-impeccable/scripts/live/completion.mjs +28 -0
- package/skills/ew-impeccable/scripts/live/event-validation.mjs +199 -0
- package/skills/ew-impeccable/scripts/live/frameworks/astro.mjs +47 -0
- package/skills/ew-impeccable/scripts/live/frameworks/detect-utils.mjs +73 -0
- package/skills/ew-impeccable/scripts/live/frameworks/index.mjs +143 -0
- package/skills/ew-impeccable/scripts/live/frameworks/journal.mjs +197 -0
- package/skills/ew-impeccable/scripts/live/frameworks/nextjs.mjs +49 -0
- package/skills/ew-impeccable/scripts/live/frameworks/nuxt.mjs +161 -0
- package/skills/ew-impeccable/scripts/live/frameworks/script-src.mjs +17 -0
- package/skills/ew-impeccable/scripts/live/frameworks/static-html.mjs +26 -0
- package/skills/ew-impeccable/scripts/live/frameworks/sveltekit.mjs +71 -0
- package/skills/ew-impeccable/scripts/live/frameworks/tag-strategy.mjs +247 -0
- package/skills/ew-impeccable/scripts/live/frameworks/tanstack-start.mjs +70 -0
- package/skills/ew-impeccable/scripts/live/frameworks/vite-generic.mjs +42 -0
- package/skills/ew-impeccable/scripts/live/generation-preflight.mjs +149 -0
- package/skills/ew-impeccable/scripts/live/insert-ui.mjs +458 -0
- package/skills/ew-impeccable/scripts/live/instructions.mjs +142 -0
- package/skills/ew-impeccable/scripts/live/manual-apply.mjs +939 -0
- package/skills/ew-impeccable/scripts/live/manual-edit-routes.mjs +357 -0
- package/skills/ew-impeccable/scripts/live/manual-edits-buffer.mjs +152 -0
- package/skills/ew-impeccable/scripts/live/poll-lanes.mjs +14 -0
- package/skills/ew-impeccable/scripts/live/project-ignores.mjs +139 -0
- package/skills/ew-impeccable/scripts/live/roots.mjs +508 -0
- package/skills/ew-impeccable/scripts/live/session-store.mjs +563 -0
- package/skills/ew-impeccable/scripts/live/source-lock.mjs +105 -0
- package/skills/ew-impeccable/scripts/live/source-search.mjs +105 -0
- package/skills/ew-impeccable/scripts/live/svelte-ast.mjs +969 -0
- package/skills/ew-impeccable/scripts/live/svelte-component.mjs +1366 -0
- package/skills/ew-impeccable/scripts/live/sveltekit-adapter.mjs +304 -0
- package/skills/ew-impeccable/scripts/live/tanstack-adapter.mjs +259 -0
- package/skills/ew-impeccable/scripts/live/ui-surfaces.mjs +75 -0
- package/skills/ew-impeccable/scripts/live/vocabulary.mjs +171 -0
- package/skills/ew-impeccable/scripts/live-accept.mjs +938 -0
- package/skills/ew-impeccable/scripts/live-browser-dom.js +167 -0
- package/skills/ew-impeccable/scripts/live-browser-ignores.js +242 -0
- package/skills/ew-impeccable/scripts/live-browser-session.js +144 -0
- package/skills/ew-impeccable/scripts/live-browser.js +12851 -0
- package/skills/ew-impeccable/scripts/live-commit-manual-edits.mjs +1200 -0
- package/skills/ew-impeccable/scripts/live-complete.mjs +107 -0
- package/skills/ew-impeccable/scripts/live-copy-edit-agent.mjs +800 -0
- package/skills/ew-impeccable/scripts/live-discard-manual-edits.mjs +51 -0
- package/skills/ew-impeccable/scripts/live-inject.mjs +463 -0
- package/skills/ew-impeccable/scripts/live-insert.mjs +292 -0
- package/skills/ew-impeccable/scripts/live-manual-edit-evidence.mjs +368 -0
- package/skills/ew-impeccable/scripts/live-poll.mjs +430 -0
- package/skills/ew-impeccable/scripts/live-resume.mjs +123 -0
- package/skills/ew-impeccable/scripts/live-server.mjs +1698 -0
- package/skills/ew-impeccable/scripts/live-status.mjs +71 -0
- package/skills/ew-impeccable/scripts/live-target.mjs +30 -0
- package/skills/ew-impeccable/scripts/live-wrap.mjs +927 -0
- package/skills/ew-impeccable/scripts/live.mjs +334 -0
- package/skills/ew-impeccable/scripts/modern-screenshot.umd.js +14 -0
- package/skills/ew-impeccable/scripts/palette.mjs +628 -0
- package/skills/ew-impeccable/scripts/pin.mjs +352 -0
- package/skills/ew-impeccable/scripts/serve-question.mjs +1783 -0
- package/skills/ew-impeccable/scripts/surface-brief.mjs +74 -0
- package/skills/ew-knowledge/SKILL.md +35 -0
- package/skills/ew-knowledge/references/closeout-protocol.md +68 -0
- package/skills/ew-knowledge/references/knowledge-route.md +73 -0
- package/skills/ew-knowledge/references/wiki-maintenance.md +27 -0
- package/skills/ew-odyssey/SKILL.md +106 -0
- package/skills/ew-odyssey/references/audit-artifacts.md +7 -0
- package/skills/ew-odyssey/references/odyssey-base.md +104 -0
- package/skills/ew-odyssey/references/odyssey-debug.md +264 -0
- package/skills/ew-odyssey/references/odyssey-defensive.md +351 -0
- package/skills/ew-odyssey/references/odyssey-improve.md +230 -0
- package/skills/ew-odyssey/references/odyssey-planex.md +294 -0
- package/skills/ew-odyssey/references/odyssey-review.md +233 -0
- package/skills/ew-odyssey/references/odyssey-security.md +231 -0
- package/skills/ew-odyssey/references/odyssey-ui.md +232 -0
- package/skills/ew-odyssey/references/prepare/odyssey-debug.md +102 -0
- package/skills/ew-odyssey/references/prepare/odyssey-defensive.md +117 -0
- package/skills/ew-odyssey/references/prepare/odyssey-improve.md +95 -0
- package/skills/ew-odyssey/references/prepare/odyssey-planex.md +105 -0
- package/skills/ew-odyssey/references/prepare/odyssey-review.md +105 -0
- package/skills/ew-odyssey/references/prepare/odyssey-security.md +91 -0
- package/skills/ew-odyssey/references/prepare/odyssey-ui.md +88 -0
- package/skills/ew-odyssey/references/runtime-adapters.md +31 -0
- package/skills/ew-orchestrate/SKILL.md +89 -0
- package/skills/ew-orchestrate/references/auto-policy.md +66 -0
- package/skills/ew-orchestrate/references/boundary-grill.md +51 -0
- package/skills/ew-orchestrate/references/companion-route.md +40 -0
- package/skills/ew-orchestrate/references/ew-orchestrate.md +44 -0
- package/skills/ew-orchestrate/references/goal.md +51 -0
- package/skills/ew-orchestrate/references/orchestrator-run-loop.md +33 -0
- package/skills/ew-orchestrate/references/planning.md +54 -0
- package/skills/ew-orchestrate/steps/ew-analyze/SKILL.md +70 -0
- package/skills/ew-orchestrate/steps/ew-analyze/references/issue-gaps-analyze.md +24 -0
- package/skills/ew-orchestrate/steps/ew-analyze/references/prepare.md +8 -0
- package/skills/ew-orchestrate/steps/ew-analyze/references/workflow.md +138 -0
- package/skills/ew-orchestrate/steps/ew-auto-test/SKILL.md +80 -0
- package/skills/ew-orchestrate/steps/ew-auto-test/references/prepare.md +23 -0
- package/skills/ew-orchestrate/steps/ew-auto-test/references/workflow.md +31 -0
- package/skills/ew-orchestrate/steps/ew-blueprint/SKILL.md +122 -0
- package/skills/ew-orchestrate/steps/ew-blueprint/references/prepare.md +21 -0
- package/skills/ew-orchestrate/steps/ew-blueprint/references/workflow.md +28 -0
- package/skills/ew-orchestrate/steps/ew-brainstorm/SKILL.md +49 -0
- package/skills/ew-orchestrate/steps/ew-companion/SKILL.md +50 -0
- package/skills/ew-orchestrate/steps/ew-debug/SKILL.md +85 -0
- package/skills/ew-orchestrate/steps/ew-debug/references/prepare.md +27 -0
- package/skills/ew-orchestrate/steps/ew-debug/references/workflow.md +31 -0
- package/skills/ew-orchestrate/steps/ew-execute/SKILL.md +74 -0
- package/skills/ew-orchestrate/steps/ew-execute/references/prepare.md +27 -0
- package/skills/ew-orchestrate/steps/ew-execute/references/workflow.md +87 -0
- package/skills/ew-orchestrate/steps/ew-grill/SKILL.md +62 -0
- package/skills/ew-orchestrate/steps/ew-grill/references/prepare.md +26 -0
- package/skills/ew-orchestrate/steps/ew-grill/references/workflow.md +31 -0
- package/skills/ew-orchestrate/steps/ew-init/SKILL.md +56 -0
- package/skills/ew-orchestrate/steps/ew-init/references/prepare.md +25 -0
- package/skills/ew-orchestrate/steps/ew-init/references/workflow.md +28 -0
- package/skills/ew-orchestrate/steps/ew-plan/SKILL.md +131 -0
- package/skills/ew-orchestrate/steps/ew-plan/references/prepare.md +8 -0
- package/skills/ew-orchestrate/steps/ew-plan/references/tdd.md +53 -0
- package/skills/ew-orchestrate/steps/ew-plan/references/workflow.md +100 -0
- package/skills/ew-orchestrate/steps/ew-retrospective/SKILL.md +68 -0
- package/skills/ew-orchestrate/steps/ew-retrospective/references/prepare.md +18 -0
- package/skills/ew-orchestrate/steps/ew-retrospective/references/workflow.md +34 -0
- package/skills/ew-orchestrate/steps/ew-review/SKILL.md +45 -0
- package/skills/ew-orchestrate/steps/ew-review/references/prepare.md +17 -0
- package/skills/ew-orchestrate/steps/ew-review/references/workflow.md +116 -0
- package/skills/ew-orchestrate/steps/ew-roadmap/SKILL.md +62 -0
- package/skills/ew-orchestrate/steps/ew-roadmap/references/prepare.md +27 -0
- package/skills/ew-orchestrate/steps/ew-roadmap/references/workflow.md +28 -0
- package/skills/ew-orchestrate/steps/ew-test/SKILL.md +99 -0
- package/skills/ew-orchestrate/steps/ew-test/references/prepare.md +23 -0
- package/skills/ew-orchestrate/steps/ew-test/references/workflow.md +23 -0
- package/skills/ew-orchestrate/steps/ew-verify/SKILL.md +73 -0
- package/skills/ew-orchestrate/steps/ew-verify/references/prepare.md +21 -0
- package/skills/ew-orchestrate/steps/ew-verify/references/workflow.md +29 -0
- package/skills/ew-skill-design/SKILL.md +30 -0
- package/skills/ew-skill-design/references/package-contract.md +40 -0
- package/skills/ew-skill-design/references/validation.md +21 -0
- package/skills/team-swarm/SKILL.md +68 -0
- package/skills/team-swarm/references/mcp-coordination.md +14 -0
- package/skills/team-swarm/roles/analyst/role.md +181 -0
- package/skills/team-swarm/roles/ant/role.md +149 -0
- package/skills/team-swarm/roles/coordinator/commands/converge.md +112 -0
- package/skills/team-swarm/roles/coordinator/commands/init-swarm.md +136 -0
- package/skills/team-swarm/roles/coordinator/commands/iterate.md +171 -0
- package/skills/team-swarm/roles/coordinator/role.md +170 -0
- package/skills/team-swarm/roles/scorer/role.md +150 -0
- package/skills/team-swarm/scripts/aco.py +646 -0
- package/skills/team-swarm/scripts/pheromone.py +144 -0
- package/skills/team-swarm/scripts/scoring.py +111 -0
- package/skills/team-swarm/scripts/test_aco.py +606 -0
- package/skills/team-swarm/specs/ant-output-schema.md +127 -0
- package/skills/team-swarm/specs/convergence-criteria.md +108 -0
- package/skills/team-swarm/specs/pheromone-schema.md +125 -0
- package/skills/team-swarm/specs/swarm-config-template.json +71 -0
- package/skills/team-swarm/specs/swarm-protocol.md +119 -0
- package/skills/workflow-evolve/SKILL.md +64 -0
- package/skills/workflow-evolve/references/agy-gate.md +27 -0
- package/skills/workflow-evolve/references/auto-loop.md +23 -0
- package/skills/workflow-evolve/references/history-review.md +15 -0
- package/skills/workflow-evolve/scripts/codex-memory-replay.mjs +86 -0
- package/skills/workflow-evolve/scripts/codex-replay.mjs +1 -0
- package/skills/workflow-evolve/scripts/evolve-loop.mjs +260 -0
- package/skills/workflow-evolve/scripts/memory-codex-mcp.mjs +124 -0
- package/workflows/index.json +33 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { lstatSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { basename, join, posix } from 'node:path';
|
|
4
|
+
import { stringify } from 'yaml';
|
|
5
|
+
import { InputError, requireText } from './common.js';
|
|
6
|
+
import { parseFrontmatter } from './upstream/frontmatter.js';
|
|
7
|
+
import { isRepositoryId, isWikiCategory, readWikiEntryMetadata, splitLegacyKeywords } from './wiki-entry.js';
|
|
8
|
+
export function validateWikiMemberUid(uid) {
|
|
9
|
+
if (!uid || !/^[a-z0-9][a-z0-9_.+@-]*$/i.test(uid) || uid.endsWith('.')) {
|
|
10
|
+
throw new InputError('Personal Wiki migration requires a valid member UID');
|
|
11
|
+
}
|
|
12
|
+
return uid;
|
|
13
|
+
}
|
|
14
|
+
const legacySpecFiles = {
|
|
15
|
+
'coding-conventions.md': 'coding', 'architecture-constraints.md': 'arch', 'debug-notes.md': 'debug',
|
|
16
|
+
'test-conventions.md': 'test', 'review-standards.md': 'review', 'quality-rules.md': 'review',
|
|
17
|
+
'learnings.md': 'learning', 'ui-conventions.md': 'ui',
|
|
18
|
+
};
|
|
19
|
+
function legacyRepositories(raw) {
|
|
20
|
+
if (raw === undefined)
|
|
21
|
+
return undefined;
|
|
22
|
+
const list = typeof raw === 'string' ? raw.split(',').map(id => id.trim()).filter(Boolean) : raw;
|
|
23
|
+
if (!Array.isArray(list) || !list.length || !list.every(isRepositoryId))
|
|
24
|
+
return null;
|
|
25
|
+
return [...new Set(list)].sort();
|
|
26
|
+
}
|
|
27
|
+
function parseSpecs(source, origin) {
|
|
28
|
+
const document = parseFrontmatter(source);
|
|
29
|
+
if (source.startsWith('---\n') || source.startsWith('---\r\n')) {
|
|
30
|
+
if (!document.hasFrontmatter)
|
|
31
|
+
throw new InputError(`Invalid Spec frontmatter: ${origin}`);
|
|
32
|
+
}
|
|
33
|
+
const firstLine = source.slice(0, source.length - document.body.length).split('\n').length;
|
|
34
|
+
const matches = [...document.body.matchAll(/<spec-entry\b\s*([^>]*)>([\s\S]*?)<\/spec-entry>/g)];
|
|
35
|
+
const specs = new Map();
|
|
36
|
+
const fileMetadata = document.hasFrontmatter ? document.frontmatter : {};
|
|
37
|
+
const category = legacySpecFiles[basename(origin)] ??
|
|
38
|
+
[fileMetadata.category, basename(origin, '.md')].find(isWikiCategory);
|
|
39
|
+
const fileRepositories = fileMetadata.appliesToRepoIds ?? fileMetadata['applies-to-repo-ids'];
|
|
40
|
+
for (const match of matches) {
|
|
41
|
+
const body = match[2].trim();
|
|
42
|
+
const attributes = Object.fromEntries([...match[1].matchAll(/([\w-]+)="([^"]*)"/g)]
|
|
43
|
+
.map(([, key, value]) => [key, value.replaceAll('"', '"').replaceAll('<', '<').replaceAll('>', '>').replaceAll('&', '&')]));
|
|
44
|
+
const title = attributes.title || body.match(/^#{2,6}\s+(.+)$/m)?.[1] ||
|
|
45
|
+
[...(body.split(/\r?\n/, 1)[0] ?? '')].slice(0, 100).join('');
|
|
46
|
+
if (!title || !body)
|
|
47
|
+
throw new InputError(`Unrecognized Spec entry in ${origin}`);
|
|
48
|
+
const line = firstLine + document.body.slice(0, match.index).split('\n').length - 1;
|
|
49
|
+
const entryRepositories = attributes.appliesToRepoIds ?? attributes['applies-to-repo-ids'];
|
|
50
|
+
specs.set(line, {
|
|
51
|
+
origin: `${origin}#L${line}`, oldId: attributes.sid || '', title, body, mode: 'constraint',
|
|
52
|
+
metadata: { ...fileMetadata, ...attributes },
|
|
53
|
+
category, repositories: entryRepositories?.trim() ? entryRepositories : fileRepositories,
|
|
54
|
+
keywords: splitLegacyKeywords(attributes.keywords),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const remaining = document.body.replace(/<spec-entry\b\s*[^>]*>[\s\S]*?<\/spec-entry>/g, match => match.replace(/[^\r\n]/g, ' '));
|
|
58
|
+
if (/<\/?spec-entry\b/.test(remaining))
|
|
59
|
+
throw new InputError(`Unclosed Spec entry in ${origin}`);
|
|
60
|
+
const headings = [...remaining.matchAll(/^###\s+(?:\[[\w-]+\]\s+)?\[\d{4}-\d{2}-\d{2}(?:[ \t][\d:]+)?\][ \t]*([^\r\n]+)\r?$/gm)];
|
|
61
|
+
for (const [index, heading] of headings.entries()) {
|
|
62
|
+
const line = firstLine + remaining.slice(0, heading.index).split('\n').length - 1;
|
|
63
|
+
const next = headings[index + 1]?.index ?? remaining.length;
|
|
64
|
+
const body = remaining.slice(heading.index, next).trim();
|
|
65
|
+
if (body === heading[0].trim())
|
|
66
|
+
continue;
|
|
67
|
+
specs.set(line, {
|
|
68
|
+
origin: `${origin}#L${line}`, oldId: '', title: heading[1], body, mode: 'constraint', metadata: fileMetadata,
|
|
69
|
+
category, repositories: fileRepositories,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const plainBody = document.body.replace(/^#+\s+.*$/gm, '').replace(/^---+$/gm, '').trim();
|
|
73
|
+
const emptyLearningsSeed = basename(origin) === 'learnings.md' && plainBody === 'Add entries with: `/maestro-spec learning <description>`';
|
|
74
|
+
if (!specs.size && plainBody && !emptyLearningsSeed) {
|
|
75
|
+
const title = typeof document.frontmatter.title === 'string' && document.frontmatter.title.trim()
|
|
76
|
+
? document.frontmatter.title.trim() : document.body.match(/^#\s+(.+)$/m)?.[1]?.trim() || basename(origin, '.md');
|
|
77
|
+
specs.set(firstLine, {
|
|
78
|
+
origin, oldId: '', title, body: document.body, mode: 'constraint', metadata: fileMetadata,
|
|
79
|
+
category, repositories: fileRepositories,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return [...specs.entries()].sort(([left], [right]) => left - right).map(([, entry]) => entry);
|
|
83
|
+
}
|
|
84
|
+
function readLegacySpecFolder(sourceRoot, relative) {
|
|
85
|
+
const directory = join(sourceRoot, relative);
|
|
86
|
+
const info = lstatSync(directory, { throwIfNoEntry: false });
|
|
87
|
+
if (!info)
|
|
88
|
+
return [];
|
|
89
|
+
if (!info.isDirectory())
|
|
90
|
+
throw new InputError(`Invalid legacy Spec directory: ${directory}`);
|
|
91
|
+
return readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name)).flatMap(file => file.isFile() && file.name.endsWith('.md')
|
|
92
|
+
? parseSpecs(readFileSync(join(directory, file.name), 'utf8').replace(/^\uFEFF/, ''), `${relative}/${file.name}`)
|
|
93
|
+
: []);
|
|
94
|
+
}
|
|
95
|
+
function readLegacyKnowhowFolder(sourceRoot, relative) {
|
|
96
|
+
const entries = [];
|
|
97
|
+
const directory = join(sourceRoot, relative);
|
|
98
|
+
const info = lstatSync(directory, { throwIfNoEntry: false });
|
|
99
|
+
if (!info)
|
|
100
|
+
return entries;
|
|
101
|
+
if (!info.isDirectory())
|
|
102
|
+
throw new InputError(`Invalid legacy knowledge directory: ${directory}`);
|
|
103
|
+
for (const file of readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
104
|
+
if (!file.isFile() || !file.name.endsWith('.md'))
|
|
105
|
+
continue;
|
|
106
|
+
const source = readFileSync(join(directory, file.name), 'utf8').replace(/^\uFEFF/, '');
|
|
107
|
+
const origin = `${relative}/${file.name}`;
|
|
108
|
+
const parsed = parseFrontmatter(source);
|
|
109
|
+
if (source.startsWith('---') && !parsed.hasFrontmatter)
|
|
110
|
+
throw new InputError(`Invalid Knowhow frontmatter: ${origin}`);
|
|
111
|
+
const oldId = typeof parsed.frontmatter.id === 'string' ? parsed.frontmatter.id : basename(file.name, '.md');
|
|
112
|
+
const title = parsed.frontmatter.title || parsed.body.match(/^#\s+(.+)$/m)?.[1] || oldId;
|
|
113
|
+
entries.push({ origin, oldId, title, body: parsed.body, mode: 'reference', metadata: parsed.frontmatter,
|
|
114
|
+
repositories: parsed.frontmatter.appliesToRepoIds ?? parsed.frontmatter['applies-to-repo-ids'] });
|
|
115
|
+
}
|
|
116
|
+
return entries;
|
|
117
|
+
}
|
|
118
|
+
function collectLegacy(sourceRoot, layer) {
|
|
119
|
+
const workflow = join(sourceRoot, '.workflow');
|
|
120
|
+
if (layer.scope !== 'global' && !lstatSync(workflow, { throwIfNoEntry: false })?.isDirectory()) {
|
|
121
|
+
throw new InputError(`Legacy project has no regular .workflow directory: ${workflow}`);
|
|
122
|
+
}
|
|
123
|
+
if (layer.scope === 'project' || layer.scope === 'global') {
|
|
124
|
+
const prefix = layer.scope === 'project' ? '.workflow/' : '';
|
|
125
|
+
const specs = layer.knowhowOnly ? [] : readLegacySpecFolder(sourceRoot, `${prefix}specs`);
|
|
126
|
+
return [...specs, ...readLegacyKnowhowFolder(sourceRoot, `${prefix}knowhow`)];
|
|
127
|
+
}
|
|
128
|
+
const collab = lstatSync(join(workflow, 'collab'), { throwIfNoEntry: false });
|
|
129
|
+
if (!collab)
|
|
130
|
+
return [];
|
|
131
|
+
if (!collab.isDirectory())
|
|
132
|
+
throw new InputError('Invalid legacy collaboration directory');
|
|
133
|
+
const shared = '.workflow/collab/specs';
|
|
134
|
+
if (layer.scope === 'team')
|
|
135
|
+
return readLegacySpecFolder(sourceRoot, shared);
|
|
136
|
+
const specs = lstatSync(join(sourceRoot, shared), { throwIfNoEntry: false });
|
|
137
|
+
if (!specs)
|
|
138
|
+
return [];
|
|
139
|
+
if (!specs.isDirectory())
|
|
140
|
+
throw new InputError('Invalid legacy collaboration Spec directory');
|
|
141
|
+
return readLegacySpecFolder(sourceRoot, `${shared}/${layer.uid}`);
|
|
142
|
+
}
|
|
143
|
+
function statusFor(entry) {
|
|
144
|
+
const status = entry.metadata.lifecycleStatus ?? entry.metadata['lifecycle-status'] ?? entry.metadata.status;
|
|
145
|
+
if (status === 'deprecated' || status === 'superseded')
|
|
146
|
+
return 'deprecated';
|
|
147
|
+
if (entry.metadata['conflict-marker'] || entry.metadata.confidence === 'contested' ||
|
|
148
|
+
legacyRepositories(entry.repositories) === null ||
|
|
149
|
+
(status && !['active', 'accepted'].includes(String(status))))
|
|
150
|
+
return 'needs_review';
|
|
151
|
+
return 'active';
|
|
152
|
+
}
|
|
153
|
+
export function migrateLegacyWiki(wiki, sourceRoot, project, apply = false, layer = { scope: 'project' }) {
|
|
154
|
+
project = requireText(project, 'legacy project ID');
|
|
155
|
+
if (!/^[a-z0-9][a-z0-9_.-]*$/i.test(project))
|
|
156
|
+
throw new InputError('Legacy project ID must be a stable slug');
|
|
157
|
+
if (layer.knowhowOnly && (layer.scope === 'team' || layer.scope === 'personal')) {
|
|
158
|
+
throw new InputError('--knowhow-only requires project or global scope');
|
|
159
|
+
}
|
|
160
|
+
if (layer.scope === 'personal')
|
|
161
|
+
validateWikiMemberUid(layer.uid);
|
|
162
|
+
const sources = collectLegacy(sourceRoot, layer);
|
|
163
|
+
const destination = join(wiki.root, 'wiki', 'entries');
|
|
164
|
+
for (const path of [join(wiki.root, 'wiki'), destination]) {
|
|
165
|
+
const info = lstatSync(path, { throwIfNoEntry: false });
|
|
166
|
+
if (info && !info.isDirectory())
|
|
167
|
+
throw new InputError(`Invalid Wiki migration directory: ${path}`);
|
|
168
|
+
}
|
|
169
|
+
const oldIds = new Map();
|
|
170
|
+
const knowhowPaths = new Map();
|
|
171
|
+
const namespace = layer.scope === 'personal' ? `personal:${layer.uid}:` : layer.scope === 'project' ? '' : `${layer.scope}:`;
|
|
172
|
+
const writes = sources.map(entry => {
|
|
173
|
+
const kind = entry.mode === 'constraint' ? 'spec' : 'knowhow';
|
|
174
|
+
const key = `${project}:${kind}:${namespace}${entry.oldId || entry.origin}`;
|
|
175
|
+
const id = `legacy-${createHash('sha256').update(key).digest('hex').slice(0, 24)}`;
|
|
176
|
+
if (entry.oldId) {
|
|
177
|
+
const oldKey = `${kind}:${entry.oldId.toLowerCase()}`;
|
|
178
|
+
if (oldIds.has(oldKey))
|
|
179
|
+
throw new InputError(`Duplicate legacy Wiki ID: ${entry.oldId}`);
|
|
180
|
+
oldIds.set(oldKey, id);
|
|
181
|
+
}
|
|
182
|
+
if (kind === 'knowhow')
|
|
183
|
+
knowhowPaths.set(entry.origin.replace(/^\.workflow\//, '').toLowerCase(), id);
|
|
184
|
+
return { entry, id, key, kind, status: statusFor(entry) };
|
|
185
|
+
});
|
|
186
|
+
const planned = writes.map(({ entry, id, key, kind, status }) => {
|
|
187
|
+
const relations = [];
|
|
188
|
+
const issues = [];
|
|
189
|
+
for (const [field, label] of [
|
|
190
|
+
[entry.metadata.supersededBy ?? entry.metadata['superseded-by'], 'Superseding entry'],
|
|
191
|
+
[entry.metadata.supersedes, 'Earlier entry'],
|
|
192
|
+
]) {
|
|
193
|
+
if (field === undefined)
|
|
194
|
+
continue;
|
|
195
|
+
const targets = new Set();
|
|
196
|
+
let unresolved = false;
|
|
197
|
+
for (const reference of Array.isArray(field) ? field : [field]) {
|
|
198
|
+
const key = typeof reference === 'string' ? reference.trim().toLowerCase() : '';
|
|
199
|
+
const target = oldIds.get(`${kind}:${key}`) ??
|
|
200
|
+
(kind === 'knowhow' ? oldIds.get(`${kind}:${key.replace(/^knowhow-/, '')}`) : undefined);
|
|
201
|
+
if (target && target !== id)
|
|
202
|
+
targets.add(target);
|
|
203
|
+
else
|
|
204
|
+
unresolved = true;
|
|
205
|
+
}
|
|
206
|
+
for (const target of targets)
|
|
207
|
+
relations.push(`[[entries/${target}|${label}]]`);
|
|
208
|
+
if (unresolved)
|
|
209
|
+
issues.push(`Unresolved ${label.toLowerCase()}`);
|
|
210
|
+
}
|
|
211
|
+
const ref = entry.metadata.ref;
|
|
212
|
+
if (kind === 'spec' && ref !== undefined) {
|
|
213
|
+
const refPath = typeof ref === 'string' ? posix.normalize(ref.replaceAll('\\', '/')).toLowerCase() : '';
|
|
214
|
+
const target = knowhowPaths.get(refPath);
|
|
215
|
+
if (target)
|
|
216
|
+
relations.push(`[[entries/${target}|Legacy reference]]`);
|
|
217
|
+
else
|
|
218
|
+
issues.push('Unresolved legacy reference');
|
|
219
|
+
}
|
|
220
|
+
const effectiveStatus = issues.length && status === 'active' ? 'needs_review' : status;
|
|
221
|
+
if (status === 'needs_review')
|
|
222
|
+
issues.push('Review legacy lifecycle, conflict, or repository scope');
|
|
223
|
+
const repositories = legacyRepositories(entry.repositories);
|
|
224
|
+
const sources = [`legacy:${project}:${entry.origin}`];
|
|
225
|
+
for (const source of [
|
|
226
|
+
entry.metadata.sourceRef, entry.metadata['source-ref'], entry.metadata.source,
|
|
227
|
+
...(Array.isArray(entry.metadata.sources) ? entry.metadata.sources : []),
|
|
228
|
+
]) {
|
|
229
|
+
if (typeof source === 'string' && source.trim() && !sources.includes(source))
|
|
230
|
+
sources.push(source);
|
|
231
|
+
}
|
|
232
|
+
const data = {
|
|
233
|
+
title: entry.title,
|
|
234
|
+
mode: kind === 'spec' && typeof ref === 'string' && ref.trim() ? 'reference' : entry.mode,
|
|
235
|
+
status: effectiveStatus,
|
|
236
|
+
scope: ['project'],
|
|
237
|
+
...(kind === 'spec' ? { categories: entry.category ? [entry.category] : [] } : {}),
|
|
238
|
+
...(repositories ? { repositories } : {}),
|
|
239
|
+
sources,
|
|
240
|
+
aliases: [key],
|
|
241
|
+
legacy: entry.metadata,
|
|
242
|
+
...(issues.length ? { migration_issues: issues } : {}),
|
|
243
|
+
};
|
|
244
|
+
const body = entry.body.trim() + (relations.length ? `\n\n${relations.join('\n')}` : '');
|
|
245
|
+
const metadata = entry.keywords === undefined ? data : { ...data, keywords: entry.keywords };
|
|
246
|
+
const content = `---\n${stringify(metadata)}---\n\n${body}\n`;
|
|
247
|
+
readWikiEntryMetadata(`wiki/entries/${id}.md`, { type: 'other', ...metadata }, body);
|
|
248
|
+
const path = join(destination, `${id}.md`);
|
|
249
|
+
const existing = lstatSync(path, { throwIfNoEntry: false });
|
|
250
|
+
const previous = existing?.isFile() ? readFileSync(path, 'utf8') : undefined;
|
|
251
|
+
const unchangedLegacy = entry.keywords !== undefined && previous === `---\n${stringify(data)}---\n\n${body}\n`;
|
|
252
|
+
if (existing && previous !== content && !unchangedLegacy) {
|
|
253
|
+
throw new InputError(`Migration would overwrite an existing entry: ${id}`);
|
|
254
|
+
}
|
|
255
|
+
return { id, origin: entry.origin, alias: key, status: effectiveStatus, path, content, existing: Boolean(existing), issues };
|
|
256
|
+
});
|
|
257
|
+
if (apply && planned.length) {
|
|
258
|
+
mkdirSync(destination, { recursive: true });
|
|
259
|
+
for (const item of planned) {
|
|
260
|
+
if (!item.existing)
|
|
261
|
+
writeFileSync(item.path, item.content, { encoding: 'utf8', flag: 'wx' });
|
|
262
|
+
}
|
|
263
|
+
wiki.build();
|
|
264
|
+
}
|
|
265
|
+
return planned.map(({ id, origin, alias, status, existing, issues }) => ({
|
|
266
|
+
id, origin, alias, status, existing, ...(issues.length ? { issues } : {}),
|
|
267
|
+
}));
|
|
268
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function tokenizeWiki(text: string): string[];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// From TencentDB Agent Memory Wiki manager (MIT).
|
|
2
|
+
const STOP_WORDS = new Set([
|
|
3
|
+
"的", "是", "了", "什么", "在", "有", "和", "与", "对", "从",
|
|
4
|
+
"the", "is", "a", "an", "what", "how", "are", "was", "were",
|
|
5
|
+
"do", "does", "did", "be", "been", "being", "have", "has", "had",
|
|
6
|
+
"it", "its", "in", "on", "at", "to", "for", "of", "with", "by",
|
|
7
|
+
"this", "that", "these", "those",
|
|
8
|
+
]);
|
|
9
|
+
export function tokenizeWiki(text) {
|
|
10
|
+
const rawTokens = text
|
|
11
|
+
.toLowerCase()
|
|
12
|
+
.split(/[\s,,。!?、;:""''()()\-_/\\·~~…\[\]【】{}《》<>]+/)
|
|
13
|
+
.filter((t) => t.length > 0);
|
|
14
|
+
const result = [];
|
|
15
|
+
for (const token of rawTokens) {
|
|
16
|
+
const hasCJK = /[\u4e00-\u9fff\u3400-\u4dbf]/.test(token);
|
|
17
|
+
const hasLatin = /[a-z]/.test(token);
|
|
18
|
+
if (hasCJK && hasLatin) {
|
|
19
|
+
// 混合 token(如 "l0录入"):拆分中英文部分分别处理
|
|
20
|
+
const parts = token.split(/(?<=[a-z0-9])(?=[\u4e00-\u9fff])|(?<=[\u4e00-\u9fff])(?=[a-z0-9])/);
|
|
21
|
+
for (const part of parts) {
|
|
22
|
+
if (/[\u4e00-\u9fff]/.test(part) && part.length > 1) {
|
|
23
|
+
const chars = [...part];
|
|
24
|
+
for (let i = 0; i < chars.length - 1; i++)
|
|
25
|
+
result.push(chars[i] + chars[i + 1]);
|
|
26
|
+
result.push(part);
|
|
27
|
+
}
|
|
28
|
+
else if (part.length > 0 && !STOP_WORDS.has(part)) {
|
|
29
|
+
result.push(part);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else if (hasCJK && token.length > 1) {
|
|
34
|
+
// 纯中文:bigram
|
|
35
|
+
const chars = [...token];
|
|
36
|
+
for (let i = 0; i < chars.length - 1; i++)
|
|
37
|
+
result.push(chars[i] + chars[i + 1]);
|
|
38
|
+
result.push(token);
|
|
39
|
+
}
|
|
40
|
+
else if (!STOP_WORDS.has(token) && token.length > 0) {
|
|
41
|
+
// 纯英文/数字:保留完整 token
|
|
42
|
+
result.push(token);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
}
|
package/dist/wiki.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { type WikiContext, type WikiEntryMetadata } from './wiki-entry.js';
|
|
2
|
+
import type { WikiIngestOptions } from './wiki-ingest.js';
|
|
3
|
+
import type { KnowledgeReads } from './knowledge-reads.js';
|
|
4
|
+
interface Page {
|
|
5
|
+
id: string;
|
|
6
|
+
title: string;
|
|
7
|
+
type: string;
|
|
8
|
+
path: string;
|
|
9
|
+
snippet: string;
|
|
10
|
+
sources: string[];
|
|
11
|
+
entry?: WikiEntryMetadata;
|
|
12
|
+
}
|
|
13
|
+
interface PageFile extends Page {
|
|
14
|
+
body: string;
|
|
15
|
+
links: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface WikiSearchOptions {
|
|
18
|
+
limit?: number;
|
|
19
|
+
hop?: number;
|
|
20
|
+
decay?: number;
|
|
21
|
+
includeHistory?: boolean;
|
|
22
|
+
entryMode?: 'constraint' | 'reference';
|
|
23
|
+
}
|
|
24
|
+
export interface WikiReadOptions {
|
|
25
|
+
knowledgeReads?: KnowledgeReads;
|
|
26
|
+
fromSearchId?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface WikiHit extends Page {
|
|
29
|
+
score: number;
|
|
30
|
+
hop: number;
|
|
31
|
+
via?: string;
|
|
32
|
+
related: Array<{
|
|
33
|
+
id: string;
|
|
34
|
+
title: string;
|
|
35
|
+
path: string;
|
|
36
|
+
direction: 'in' | 'out' | 'both';
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
export declare const structuralPages: Set<string>;
|
|
40
|
+
export declare function readWikiPages(root: string, entriesOnly?: boolean): PageFile[];
|
|
41
|
+
export declare class Wiki {
|
|
42
|
+
readonly root: string;
|
|
43
|
+
readonly indexPath: string;
|
|
44
|
+
constructor(root: string);
|
|
45
|
+
ingest(source: string, options: WikiIngestOptions): Promise<{
|
|
46
|
+
pages: number;
|
|
47
|
+
edges: number;
|
|
48
|
+
written: string[];
|
|
49
|
+
warnings: string[];
|
|
50
|
+
}>;
|
|
51
|
+
constraints(context?: WikiContext): {
|
|
52
|
+
body: string;
|
|
53
|
+
id: string;
|
|
54
|
+
title: string;
|
|
55
|
+
type: string;
|
|
56
|
+
path: string;
|
|
57
|
+
snippet: string;
|
|
58
|
+
sources: string[];
|
|
59
|
+
entry?: WikiEntryMetadata;
|
|
60
|
+
}[];
|
|
61
|
+
getEntry(id: string, options?: WikiReadOptions): {
|
|
62
|
+
body: string;
|
|
63
|
+
id: string;
|
|
64
|
+
title: string;
|
|
65
|
+
type: string;
|
|
66
|
+
path: string;
|
|
67
|
+
snippet: string;
|
|
68
|
+
sources: string[];
|
|
69
|
+
entry?: WikiEntryMetadata;
|
|
70
|
+
} | null;
|
|
71
|
+
private visibleReferences;
|
|
72
|
+
getReference(id: string, context?: WikiContext, options?: WikiReadOptions): {
|
|
73
|
+
body: string;
|
|
74
|
+
id: string;
|
|
75
|
+
title: string;
|
|
76
|
+
type: string;
|
|
77
|
+
path: string;
|
|
78
|
+
snippet: string;
|
|
79
|
+
sources: string[];
|
|
80
|
+
entry?: WikiEntryMetadata;
|
|
81
|
+
} | null;
|
|
82
|
+
references(query: string, context?: WikiContext, options?: WikiSearchOptions): {
|
|
83
|
+
results: WikiHit[];
|
|
84
|
+
links: Array<{
|
|
85
|
+
source: string;
|
|
86
|
+
target: string;
|
|
87
|
+
}>;
|
|
88
|
+
};
|
|
89
|
+
getEntryByExactBody(body: string): PageFile | null;
|
|
90
|
+
getEntriesByExactBody(body: string): PageFile[];
|
|
91
|
+
build(): {
|
|
92
|
+
pages: number;
|
|
93
|
+
edges: number;
|
|
94
|
+
};
|
|
95
|
+
search(query: string, options?: WikiSearchOptions): {
|
|
96
|
+
results: WikiHit[];
|
|
97
|
+
links: Array<{
|
|
98
|
+
source: string;
|
|
99
|
+
target: string;
|
|
100
|
+
}>;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
export {};
|