wingfoil 0.2.1 → 0.3.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 +88 -42
- package/dist/agent/discovery.d.ts +72 -0
- package/dist/agent/discovery.d.ts.map +1 -0
- package/dist/agent/discovery.js +210 -0
- package/dist/agent/discovery.js.map +1 -0
- package/dist/agent/execute.d.ts +206 -0
- package/dist/agent/execute.d.ts.map +1 -0
- package/dist/agent/execute.js +581 -0
- package/dist/agent/execute.js.map +1 -0
- package/dist/agent/index.d.ts +23 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +85 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/launch.d.ts +133 -0
- package/dist/agent/launch.d.ts.map +1 -0
- package/dist/agent/launch.js +380 -0
- package/dist/agent/launch.js.map +1 -0
- package/dist/agent/manifest.d.ts +30 -0
- package/dist/agent/manifest.d.ts.map +1 -0
- package/dist/agent/manifest.js +93 -0
- package/dist/agent/manifest.js.map +1 -0
- package/dist/agent/placeholders.d.ts +49 -0
- package/dist/agent/placeholders.d.ts.map +1 -0
- package/dist/agent/placeholders.js +177 -0
- package/dist/agent/placeholders.js.map +1 -0
- package/dist/agent/run-log.d.ts +254 -0
- package/dist/agent/run-log.d.ts.map +1 -0
- package/dist/agent/run-log.js +612 -0
- package/dist/agent/run-log.js.map +1 -0
- package/dist/agent/schema.d.ts +100 -0
- package/dist/agent/schema.d.ts.map +1 -0
- package/dist/agent/schema.js +89 -0
- package/dist/agent/schema.js.map +1 -0
- package/dist/agent/step.d.ts +41 -0
- package/dist/agent/step.d.ts.map +1 -0
- package/dist/agent/step.js +95 -0
- package/dist/agent/step.js.map +1 -0
- package/dist/build-info.json +4 -0
- package/dist/cli/error.d.ts +11 -2
- package/dist/cli/error.d.ts.map +1 -1
- package/dist/cli/error.js +27 -6
- package/dist/cli/error.js.map +1 -1
- package/dist/cli/exit.d.ts +33 -3
- package/dist/cli/exit.d.ts.map +1 -1
- package/dist/cli/exit.js +54 -3
- package/dist/cli/exit.js.map +1 -1
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +3 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init-command.d.ts.map +1 -1
- package/dist/cli/init-command.js +6 -3
- package/dist/cli/init-command.js.map +1 -1
- package/dist/cli/mcp-command.d.ts +13 -4
- package/dist/cli/mcp-command.d.ts.map +1 -1
- package/dist/cli/mcp-command.js +25 -8
- package/dist/cli/mcp-command.js.map +1 -1
- package/dist/cli/output.d.ts +12 -4
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +15 -4
- package/dist/cli/output.js.map +1 -1
- package/dist/cli/program.d.ts +1 -1
- package/dist/cli/program.d.ts.map +1 -1
- package/dist/cli/program.js +270 -60
- package/dist/cli/program.js.map +1 -1
- package/dist/cli/registrar.d.ts +16 -7
- package/dist/cli/registrar.d.ts.map +1 -1
- package/dist/cli/registrar.js +71 -6
- package/dist/cli/registrar.js.map +1 -1
- package/dist/cli/suggest.d.ts +20 -0
- package/dist/cli/suggest.d.ts.map +1 -0
- package/dist/cli/suggest.js +49 -0
- package/dist/cli/suggest.js.map +1 -0
- package/dist/cli/warning.d.ts +26 -0
- package/dist/cli/warning.d.ts.map +1 -0
- package/dist/cli/warning.js +66 -0
- package/dist/cli/warning.js.map +1 -0
- package/dist/cli.js +11 -2
- package/dist/cli.js.map +1 -1
- package/dist/core/agent-execute.d.ts +44 -0
- package/dist/core/agent-execute.d.ts.map +1 -0
- package/dist/core/agent-execute.js +71 -0
- package/dist/core/agent-execute.js.map +1 -0
- package/dist/core/agent-list.d.ts +95 -0
- package/dist/core/agent-list.d.ts.map +1 -0
- package/dist/core/agent-list.js +207 -0
- package/dist/core/agent-list.js.map +1 -0
- package/dist/core/agent-show.d.ts +44 -0
- package/dist/core/agent-show.d.ts.map +1 -0
- package/dist/core/agent-show.js +188 -0
- package/dist/core/agent-show.js.map +1 -0
- package/dist/core/approval-authority.d.ts +17 -14
- package/dist/core/approval-authority.d.ts.map +1 -1
- package/dist/core/approval-authority.js +9 -9
- package/dist/core/approval-authority.js.map +1 -1
- package/dist/core/builtin-asset.d.ts +18 -15
- package/dist/core/builtin-asset.d.ts.map +1 -1
- package/dist/core/builtin-asset.js +17 -14
- package/dist/core/builtin-asset.js.map +1 -1
- package/dist/core/builtin-integrity.d.ts +12 -2
- package/dist/core/builtin-integrity.d.ts.map +1 -1
- package/dist/core/builtin-integrity.js +85 -9
- package/dist/core/builtin-integrity.js.map +1 -1
- package/dist/core/confinement.d.ts +3 -1
- package/dist/core/confinement.d.ts.map +1 -1
- package/dist/core/confinement.js +7 -4
- package/dist/core/confinement.js.map +1 -1
- package/dist/core/context.d.ts +150 -98
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/context.js +602 -66
- package/dist/core/context.js.map +1 -1
- package/dist/core/directive-assign.d.ts +33 -7
- package/dist/core/directive-assign.d.ts.map +1 -1
- package/dist/core/directive-assign.js +67 -27
- package/dist/core/directive-assign.js.map +1 -1
- package/dist/core/directive-scope.d.ts +36 -0
- package/dist/core/directive-scope.d.ts.map +1 -0
- package/dist/core/directive-scope.js +34 -0
- package/dist/core/directive-scope.js.map +1 -0
- package/dist/core/directives-list.d.ts +13 -3
- package/dist/core/directives-list.d.ts.map +1 -1
- package/dist/core/directives-list.js +18 -6
- package/dist/core/directives-list.js.map +1 -1
- package/dist/core/dry-run.d.ts +33 -0
- package/dist/core/dry-run.d.ts.map +1 -0
- package/dist/core/dry-run.js +45 -0
- package/dist/core/dry-run.js.map +1 -0
- package/dist/core/element-ref.d.ts +23 -0
- package/dist/core/element-ref.d.ts.map +1 -0
- package/dist/core/element-ref.js +24 -0
- package/dist/core/element-ref.js.map +1 -0
- package/dist/core/error-details.d.ts +20 -0
- package/dist/core/error-details.d.ts.map +1 -0
- package/dist/core/error-details.js +65 -0
- package/dist/core/error-details.js.map +1 -0
- package/dist/core/exit-code.js +6 -6
- package/dist/core/git-identity.d.ts +46 -11
- package/dist/core/git-identity.d.ts.map +1 -1
- package/dist/core/git-identity.js +140 -27
- package/dist/core/git-identity.js.map +1 -1
- package/dist/core/index.d.ts +189 -14
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1241 -238
- package/dist/core/index.js.map +1 -1
- package/dist/core/init.d.ts +50 -8
- package/dist/core/init.d.ts.map +1 -1
- package/dist/core/init.js +139 -27
- package/dist/core/init.js.map +1 -1
- package/dist/core/loaders.d.ts +170 -14
- package/dist/core/loaders.d.ts.map +1 -1
- package/dist/core/loaders.js +570 -89
- package/dist/core/loaders.js.map +1 -1
- package/dist/core/memory-add-link.d.ts +28 -0
- package/dist/core/memory-add-link.d.ts.map +1 -0
- package/dist/core/memory-add-link.js +67 -0
- package/dist/core/memory-add-link.js.map +1 -0
- package/dist/core/memory-add-type.d.ts +25 -1
- package/dist/core/memory-add-type.d.ts.map +1 -1
- package/dist/core/memory-add-type.js +59 -1
- package/dist/core/memory-add-type.js.map +1 -1
- package/dist/core/memory-amend.d.ts +80 -0
- package/dist/core/memory-amend.d.ts.map +1 -0
- package/dist/core/memory-amend.js +160 -0
- package/dist/core/memory-amend.js.map +1 -0
- package/dist/core/memory-supersede.d.ts +28 -0
- package/dist/core/memory-supersede.d.ts.map +1 -0
- package/dist/core/memory-supersede.js +79 -0
- package/dist/core/memory-supersede.js.map +1 -0
- package/dist/core/memory-transition.d.ts +190 -30
- package/dist/core/memory-transition.d.ts.map +1 -1
- package/dist/core/memory-transition.js +480 -59
- package/dist/core/memory-transition.js.map +1 -1
- package/dist/core/registry.d.ts +147 -23
- package/dist/core/registry.d.ts.map +1 -1
- package/dist/core/registry.js +50 -0
- package/dist/core/registry.js.map +1 -1
- package/dist/core/relevance.d.ts +74 -12
- package/dist/core/relevance.d.ts.map +1 -1
- package/dist/core/relevance.js +45 -27
- package/dist/core/relevance.js.map +1 -1
- package/dist/core/require-reason.d.ts.map +1 -1
- package/dist/core/require-reason.js +6 -5
- package/dist/core/require-reason.js.map +1 -1
- package/dist/core/required-fields.d.ts +28 -0
- package/dist/core/required-fields.d.ts.map +1 -0
- package/dist/core/required-fields.js +60 -0
- package/dist/core/required-fields.js.map +1 -0
- package/dist/core/revision.d.ts +82 -0
- package/dist/core/revision.d.ts.map +1 -0
- package/dist/core/revision.js +144 -0
- package/dist/core/revision.js.map +1 -0
- package/dist/core/types.d.ts +28 -2
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +12 -3
- package/dist/core/types.js.map +1 -1
- package/dist/core/workflow-core-checks.d.ts +34 -0
- package/dist/core/workflow-core-checks.d.ts.map +1 -0
- package/dist/core/workflow-core-checks.js +403 -0
- package/dist/core/workflow-core-checks.js.map +1 -0
- package/dist/core/workflow-create-remove.d.ts +65 -0
- package/dist/core/workflow-create-remove.d.ts.map +1 -0
- package/dist/core/workflow-create-remove.js +277 -0
- package/dist/core/workflow-create-remove.js.map +1 -0
- package/dist/core/workflow-deduction.d.ts +48 -0
- package/dist/core/workflow-deduction.d.ts.map +1 -0
- package/dist/core/workflow-deduction.js +523 -0
- package/dist/core/workflow-deduction.js.map +1 -0
- package/dist/core/workflow-diagnostics.d.ts +83 -0
- package/dist/core/workflow-diagnostics.d.ts.map +1 -0
- package/dist/core/workflow-diagnostics.js +375 -0
- package/dist/core/workflow-diagnostics.js.map +1 -0
- package/dist/core/workflow-exit-state.d.ts +125 -0
- package/dist/core/workflow-exit-state.d.ts.map +1 -0
- package/dist/core/workflow-exit-state.js +243 -0
- package/dist/core/workflow-exit-state.js.map +1 -0
- package/dist/core/workflow-finalize.d.ts +37 -0
- package/dist/core/workflow-finalize.d.ts.map +1 -0
- package/dist/core/workflow-finalize.js +153 -0
- package/dist/core/workflow-finalize.js.map +1 -0
- package/dist/core/workflow-list-show.d.ts +176 -0
- package/dist/core/workflow-list-show.d.ts.map +1 -0
- package/dist/core/workflow-list-show.js +268 -0
- package/dist/core/workflow-list-show.js.map +1 -0
- package/dist/core/workflow-next.d.ts +268 -0
- package/dist/core/workflow-next.d.ts.map +1 -0
- package/dist/core/workflow-next.js +503 -0
- package/dist/core/workflow-next.js.map +1 -0
- package/dist/core/workflow-registry.d.ts +52 -0
- package/dist/core/workflow-registry.d.ts.map +1 -0
- package/dist/core/workflow-registry.js +158 -0
- package/dist/core/workflow-registry.js.map +1 -0
- package/dist/core/workflow-start-end.d.ts +71 -0
- package/dist/core/workflow-start-end.d.ts.map +1 -0
- package/dist/core/workflow-start-end.js +298 -0
- package/dist/core/workflow-start-end.js.map +1 -0
- package/dist/core/workflow-status.d.ts +83 -0
- package/dist/core/workflow-status.d.ts.map +1 -0
- package/dist/core/workflow-status.js +125 -0
- package/dist/core/workflow-status.js.map +1 -0
- package/dist/core/write-guard.d.ts +51 -8
- package/dist/core/write-guard.d.ts.map +1 -1
- package/dist/core/write-guard.js +139 -9
- package/dist/core/write-guard.js.map +1 -1
- package/dist/directives/index.d.ts +3 -2
- package/dist/directives/index.d.ts.map +1 -1
- package/dist/directives/index.js +5 -3
- package/dist/directives/index.js.map +1 -1
- package/dist/directives/schema.d.ts +35 -30
- package/dist/directives/schema.d.ts.map +1 -1
- package/dist/directives/schema.js +36 -30
- package/dist/directives/schema.js.map +1 -1
- package/dist/directives/version.d.ts +28 -0
- package/dist/directives/version.d.ts.map +1 -0
- package/dist/directives/version.js +51 -0
- package/dist/directives/version.js.map +1 -0
- package/dist/dna/edit.d.ts +7 -6
- package/dist/dna/edit.d.ts.map +1 -1
- package/dist/dna/edit.js +96 -41
- package/dist/dna/edit.js.map +1 -1
- package/dist/dna/mutate.js +18 -3
- package/dist/dna/mutate.js.map +1 -1
- package/dist/dna/path.d.ts +2 -2
- package/dist/dna/roles.d.ts +1 -1
- package/dist/dna/schema.d.ts +61 -3
- package/dist/dna/schema.d.ts.map +1 -1
- package/dist/dna/schema.js +121 -6
- package/dist/dna/schema.js.map +1 -1
- package/dist/mcp/dna-resource.d.ts.map +1 -1
- package/dist/mcp/dna-resource.js +4 -4
- package/dist/mcp/dna-resource.js.map +1 -1
- package/dist/mcp/index.d.ts +9 -5
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +13 -2
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/memory-resource.d.ts.map +1 -1
- package/dist/mcp/memory-resource.js +30 -19
- package/dist/mcp/memory-resource.js.map +1 -1
- package/dist/mcp/prompt.d.ts +61 -24
- package/dist/mcp/prompt.d.ts.map +1 -1
- package/dist/mcp/prompt.js +176 -47
- package/dist/mcp/prompt.js.map +1 -1
- package/dist/mcp/read-only.d.ts +39 -0
- package/dist/mcp/read-only.d.ts.map +1 -1
- package/dist/mcp/read-only.js +61 -0
- package/dist/mcp/read-only.js.map +1 -1
- package/dist/mcp/registrar.d.ts +10 -0
- package/dist/mcp/registrar.d.ts.map +1 -1
- package/dist/mcp/registrar.js +48 -12
- package/dist/mcp/registrar.js.map +1 -1
- package/dist/mcp/server.d.ts +21 -14
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +41 -15
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session-resource.d.ts +13 -0
- package/dist/mcp/session-resource.d.ts.map +1 -0
- package/dist/mcp/session-resource.js +65 -0
- package/dist/mcp/session-resource.js.map +1 -0
- package/dist/mcp/workflow-resource.d.ts +18 -0
- package/dist/mcp/workflow-resource.d.ts.map +1 -1
- package/dist/mcp/workflow-resource.js +37 -8
- package/dist/mcp/workflow-resource.js.map +1 -1
- package/dist/memory/add.d.ts +160 -17
- package/dist/memory/add.d.ts.map +1 -1
- package/dist/memory/add.js +361 -51
- package/dist/memory/add.js.map +1 -1
- package/dist/memory/audit.d.ts +165 -32
- package/dist/memory/audit.d.ts.map +1 -1
- package/dist/memory/audit.js +267 -97
- package/dist/memory/audit.js.map +1 -1
- package/dist/memory/commit-message.d.ts +60 -38
- package/dist/memory/commit-message.d.ts.map +1 -1
- package/dist/memory/commit-message.js +167 -21
- package/dist/memory/commit-message.js.map +1 -1
- package/dist/memory/entry.d.ts.map +1 -1
- package/dist/memory/entry.js +1 -2
- package/dist/memory/entry.js.map +1 -1
- package/dist/memory/frontmatter-edit.d.ts +16 -4
- package/dist/memory/frontmatter-edit.d.ts.map +1 -1
- package/dist/memory/frontmatter-edit.js +13 -1
- package/dist/memory/frontmatter-edit.js.map +1 -1
- package/dist/memory/git-log.d.ts +18 -6
- package/dist/memory/git-log.d.ts.map +1 -1
- package/dist/memory/git-log.js +40 -13
- package/dist/memory/git-log.js.map +1 -1
- package/dist/memory/history.d.ts +74 -13
- package/dist/memory/history.d.ts.map +1 -1
- package/dist/memory/history.js +129 -45
- package/dist/memory/history.js.map +1 -1
- package/dist/memory/index.d.ts +13 -11
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/index.js +38 -3
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/query.d.ts +161 -19
- package/dist/memory/query.d.ts.map +1 -1
- package/dist/memory/query.js +435 -55
- package/dist/memory/query.js.map +1 -1
- package/dist/memory/schema.d.ts +52 -3
- package/dist/memory/schema.d.ts.map +1 -1
- package/dist/memory/schema.js +132 -8
- package/dist/memory/schema.js.map +1 -1
- package/dist/memory/state-machine.d.ts +65 -10
- package/dist/memory/state-machine.d.ts.map +1 -1
- package/dist/memory/state-machine.js +136 -48
- package/dist/memory/state-machine.js.map +1 -1
- package/dist/memory/submit.d.ts +52 -3
- package/dist/memory/submit.d.ts.map +1 -1
- package/dist/memory/submit.js +118 -11
- package/dist/memory/submit.js.map +1 -1
- package/dist/storage/build-stamp.d.ts +18 -0
- package/dist/storage/build-stamp.d.ts.map +1 -0
- package/dist/storage/build-stamp.js +68 -0
- package/dist/storage/build-stamp.js.map +1 -0
- package/dist/storage/builtin-adapters.d.ts +32 -0
- package/dist/storage/builtin-adapters.d.ts.map +1 -0
- package/dist/storage/builtin-adapters.js +100 -0
- package/dist/storage/builtin-adapters.js.map +1 -0
- package/dist/storage/builtin-directives.d.ts +0 -29
- package/dist/storage/builtin-directives.d.ts.map +1 -1
- package/dist/storage/builtin-directives.js +9 -4
- package/dist/storage/builtin-directives.js.map +1 -1
- package/dist/storage/commit.d.ts +310 -3
- package/dist/storage/commit.d.ts.map +1 -1
- package/dist/storage/commit.js +807 -33
- package/dist/storage/commit.js.map +1 -1
- package/dist/storage/document.d.ts +6 -0
- package/dist/storage/document.d.ts.map +1 -1
- package/dist/storage/document.js +10 -1
- package/dist/storage/document.js.map +1 -1
- package/dist/storage/dry-run.d.ts +65 -0
- package/dist/storage/dry-run.d.ts.map +1 -0
- package/dist/storage/dry-run.js +150 -0
- package/dist/storage/dry-run.js.map +1 -0
- package/dist/storage/errors.d.ts +26 -0
- package/dist/storage/errors.d.ts.map +1 -1
- package/dist/storage/errors.js +27 -1
- package/dist/storage/errors.js.map +1 -1
- package/dist/storage/frontmatter.d.ts +1 -1
- package/dist/storage/frontmatter.js +1 -1
- package/dist/storage/git-read.d.ts +64 -0
- package/dist/storage/git-read.d.ts.map +1 -0
- package/dist/storage/git-read.js +107 -0
- package/dist/storage/git-read.js.map +1 -0
- package/dist/storage/index.d.ts +13 -5
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +39 -2
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/layout.d.ts +2 -2
- package/dist/storage/layout.d.ts.map +1 -1
- package/dist/storage/layout.js +2 -7
- package/dist/storage/layout.js.map +1 -1
- package/dist/storage/memory-path.d.ts +18 -5
- package/dist/storage/memory-path.d.ts.map +1 -1
- package/dist/storage/memory-path.js +41 -5
- package/dist/storage/memory-path.js.map +1 -1
- package/dist/storage/snapshot.js +1 -1
- package/dist/storage/templates.d.ts +33 -6
- package/dist/storage/templates.d.ts.map +1 -1
- package/dist/storage/templates.js +182 -17
- package/dist/storage/templates.js.map +1 -1
- package/dist/validation/config-version.d.ts +19 -0
- package/dist/validation/config-version.d.ts.map +1 -0
- package/dist/validation/config-version.js +53 -0
- package/dist/validation/config-version.js.map +1 -0
- package/dist/validation/diagnostic.d.ts +40 -0
- package/dist/validation/diagnostic.d.ts.map +1 -0
- package/dist/validation/diagnostic.js +41 -0
- package/dist/validation/diagnostic.js.map +1 -0
- package/dist/validation/format.d.ts +74 -0
- package/dist/validation/format.d.ts.map +1 -0
- package/dist/validation/format.js +104 -0
- package/dist/validation/format.js.map +1 -0
- package/dist/validation/id.d.ts +40 -0
- package/dist/validation/id.d.ts.map +1 -1
- package/dist/validation/id.js +99 -12
- package/dist/validation/id.js.map +1 -1
- package/dist/validation/identity.d.ts +40 -0
- package/dist/validation/identity.d.ts.map +1 -0
- package/dist/validation/identity.js +78 -0
- package/dist/validation/identity.js.map +1 -0
- package/dist/validation/index.d.ts +9 -3
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +33 -1
- package/dist/validation/index.js.map +1 -1
- package/dist/validation/secret-scan.d.ts +10 -7
- package/dist/validation/secret-scan.d.ts.map +1 -1
- package/dist/validation/secret-scan.js +39 -16
- package/dist/validation/secret-scan.js.map +1 -1
- package/dist/validation/warning.d.ts +30 -16
- package/dist/validation/warning.d.ts.map +1 -1
- package/dist/validation/warning.js +74 -7
- package/dist/validation/warning.js.map +1 -1
- package/dist/workflow/bindings.d.ts +152 -0
- package/dist/workflow/bindings.d.ts.map +1 -0
- package/dist/workflow/bindings.js +249 -0
- package/dist/workflow/bindings.js.map +1 -0
- package/dist/workflow/create.d.ts +13 -0
- package/dist/workflow/create.d.ts.map +1 -0
- package/dist/workflow/create.js +41 -0
- package/dist/workflow/create.js.map +1 -0
- package/dist/workflow/deduce.d.ts +400 -0
- package/dist/workflow/deduce.d.ts.map +1 -0
- package/dist/workflow/deduce.js +1109 -0
- package/dist/workflow/deduce.js.map +1 -0
- package/dist/workflow/manifest-edit.d.ts +19 -0
- package/dist/workflow/manifest-edit.d.ts.map +1 -0
- package/dist/workflow/manifest-edit.js +124 -0
- package/dist/workflow/manifest-edit.js.map +1 -0
- package/dist/workflow/schema.d.ts +158 -19
- package/dist/workflow/schema.d.ts.map +1 -1
- package/dist/workflow/schema.js +190 -16
- package/dist/workflow/schema.js.map +1 -1
- package/package.json +37 -13
package/dist/memory/git-log.d.ts
CHANGED
|
@@ -21,12 +21,24 @@
|
|
|
21
21
|
* a single leading `\n` on each record's first field after the first, and that is stripped; both call
|
|
22
22
|
* sites put `%H` first, which never legitimately begins with one.
|
|
23
23
|
*
|
|
24
|
-
* Returns `[]`
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
24
|
+
* Returns `[]` when none of `pathspecs` has any matching history — git prints nothing, the split
|
|
25
|
+
* yields one piece, and dropping it leaves nothing to group, at EVERY arity — and when the repository
|
|
26
|
+
* has no commit yet: an unborn `HEAD` makes git exit `128`, and `isUnbornHead` confirms that
|
|
27
|
+
* is the reason. An empty `fields` requests nothing and likewise yields `[]`, rather than looping
|
|
28
|
+
* forever over zero-width groups.
|
|
29
|
+
*
|
|
30
|
+
* `--no-show-signature` is passed so a `log.showSignature` configuration cannot print signature text
|
|
31
|
+
* before a commit's formatted output, where it would land in the record's first field (`task-268`,
|
|
32
|
+
* `bug-291`); and every `%H` field is checked to be a full commit name (`requireCommitName`), so
|
|
33
|
+
* whatever arrives there anyway is refused rather than used.
|
|
34
|
+
*
|
|
35
|
+
* **Every other failure throws** `StorageError` `E_GIT_READ_FAILED` carrying git's own message
|
|
36
|
+
* (`task-142`): a `root` that is not a repository, a tree git cannot read, an output past the read
|
|
37
|
+
* buffer. It used to return `[]` for all of them, so an oversized walk — Node's 1 MiB default buffer,
|
|
38
|
+
* `ENOBUFS` — read as "this document has no history", and an audit over it as a clean pass
|
|
39
|
+
* (`bug-072-oversized-git-log-becomes-empty-history`). git runs through `runGitRead`
|
|
40
|
+
* (`src/storage/git-read.ts`), so its stderr travels inside that error and never reaches the
|
|
41
|
+
* operator's terminal (`bug-093-two-more-git-calls-inherit-the-operator-stderr`).
|
|
30
42
|
*/
|
|
31
43
|
export declare function walkGitLogFields(root: string, fields: readonly string[], pathspecs: readonly string[], extraArgs?: readonly string[]): string[][];
|
|
32
44
|
//# sourceMappingURL=git-log.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-log.d.ts","sourceRoot":"","sources":["../../src/memory/git-log.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"git-log.d.ts","sourceRoot":"","sources":["../../src/memory/git-log.ts"],"names":[],"mappings":"AAwDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,SAAS,GAAE,SAAS,MAAM,EAAO,GAChC,MAAM,EAAE,EAAE,CA4BZ"}
|
package/dist/memory/git-log.js
CHANGED
|
@@ -8,7 +8,18 @@ exports.walkGitLogFields = walkGitLogFields;
|
|
|
8
8
|
* first" plumbing over a different field set/pathspec shape; this is that one shared primitive, so
|
|
9
9
|
* the record-separator convention lives in exactly one place instead of being copy-pasted twice.
|
|
10
10
|
*/
|
|
11
|
-
const
|
|
11
|
+
const storage_1 = require("../storage");
|
|
12
|
+
/** The exit status git uses for `fatal:` — a broken repository, and an unborn `HEAD` alike. */
|
|
13
|
+
const GIT_FATAL = 128;
|
|
14
|
+
/**
|
|
15
|
+
* Whether `root` is a repository with no commit yet — the one `fatal:` of a `git log` that is an
|
|
16
|
+
* answer ("nothing has been recorded") rather than a failure. `rev-parse --verify --quiet` exits `1`,
|
|
17
|
+
* printing nothing, for a `HEAD` that names no commit; outside a repository it exits `128` like the
|
|
18
|
+
* walk did. Asked only after the walk has failed, so a healthy walk costs no extra process.
|
|
19
|
+
*/
|
|
20
|
+
function isUnbornHead(root) {
|
|
21
|
+
return (0, storage_1.runGitRead)(root, ['rev-parse', '--verify', '--quiet', 'HEAD^{commit}'], { accepted: [0, 1, GIT_FATAL] }).status === 1;
|
|
22
|
+
}
|
|
12
23
|
/**
|
|
13
24
|
* The `--format` placeholder git expands to a single NUL byte, used to delimit BOTH the fields of a
|
|
14
25
|
* commit and one commit's record from the next. A literal NUL cannot be written into the format
|
|
@@ -64,24 +75,37 @@ const NUL = String.fromCharCode(0);
|
|
|
64
75
|
* a single leading `\n` on each record's first field after the first, and that is stripped; both call
|
|
65
76
|
* sites put `%H` first, which never legitimately begins with one.
|
|
66
77
|
*
|
|
67
|
-
* Returns `[]`
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
78
|
+
* Returns `[]` when none of `pathspecs` has any matching history — git prints nothing, the split
|
|
79
|
+
* yields one piece, and dropping it leaves nothing to group, at EVERY arity — and when the repository
|
|
80
|
+
* has no commit yet: an unborn `HEAD` makes git exit `128`, and `isUnbornHead` confirms that
|
|
81
|
+
* is the reason. An empty `fields` requests nothing and likewise yields `[]`, rather than looping
|
|
82
|
+
* forever over zero-width groups.
|
|
83
|
+
*
|
|
84
|
+
* `--no-show-signature` is passed so a `log.showSignature` configuration cannot print signature text
|
|
85
|
+
* before a commit's formatted output, where it would land in the record's first field (`task-268`,
|
|
86
|
+
* `bug-291`); and every `%H` field is checked to be a full commit name (`requireCommitName`), so
|
|
87
|
+
* whatever arrives there anyway is refused rather than used.
|
|
88
|
+
*
|
|
89
|
+
* **Every other failure throws** `StorageError` `E_GIT_READ_FAILED` carrying git's own message
|
|
90
|
+
* (`task-142`): a `root` that is not a repository, a tree git cannot read, an output past the read
|
|
91
|
+
* buffer. It used to return `[]` for all of them, so an oversized walk — Node's 1 MiB default buffer,
|
|
92
|
+
* `ENOBUFS` — read as "this document has no history", and an audit over it as a clean pass
|
|
93
|
+
* (`bug-072-oversized-git-log-becomes-empty-history`). git runs through `runGitRead`
|
|
94
|
+
* (`src/storage/git-read.ts`), so its stderr travels inside that error and never reaches the
|
|
95
|
+
* operator's terminal (`bug-093-two-more-git-calls-inherit-the-operator-stderr`).
|
|
73
96
|
*/
|
|
74
97
|
function walkGitLogFields(root, fields, pathspecs, extraArgs = []) {
|
|
75
98
|
if (fields.length === 0)
|
|
76
99
|
return [];
|
|
77
100
|
const format = fields.map((field) => `${field}${NUL_PLACEHOLDER}`).join('');
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
101
|
+
const args = ['log', '--no-show-signature', ...extraArgs, `--format=${format}`, '--', ...pathspecs];
|
|
102
|
+
const run = (0, storage_1.runGitRead)(root, args, { accepted: [0, GIT_FATAL] });
|
|
103
|
+
if (run.status === GIT_FATAL) {
|
|
104
|
+
if (isUnbornHead(root))
|
|
105
|
+
return [];
|
|
106
|
+
throw new storage_1.StorageError(storage_1.E_GIT_READ_FAILED, `git ${args.join(' ')} failed in ${root}: ${run.stderr.trim()}`);
|
|
84
107
|
}
|
|
108
|
+
const stdout = run.stdout;
|
|
85
109
|
// The stream is `<f1>NUL<f2>NUL…<fn>NUL` per commit, each run terminated by git's own newline, so
|
|
86
110
|
// the text after the FINAL NUL is never a field — it is that newline, or the empty string when git
|
|
87
111
|
// printed nothing at all. Drop it before grouping; at `fields.length === 1` it would otherwise be
|
|
@@ -89,10 +113,13 @@ function walkGitLogFields(root, fields, pathspecs, extraArgs = []) {
|
|
|
89
113
|
// are records thereafter.
|
|
90
114
|
const pieces = stdout.split(NUL);
|
|
91
115
|
pieces.pop();
|
|
116
|
+
const commitNameSlots = fields.flatMap((field, index) => (field === '%H' ? [index] : []));
|
|
92
117
|
const records = [];
|
|
93
118
|
for (let index = 0; index + fields.length <= pieces.length; index += fields.length) {
|
|
94
119
|
const record = pieces.slice(index, index + fields.length);
|
|
95
120
|
record[0] = record[0].replace(/^\n+/, '');
|
|
121
|
+
for (const index of commitNameSlots)
|
|
122
|
+
(0, storage_1.requireCommitName)(record[index], 'git log');
|
|
96
123
|
records.push(record);
|
|
97
124
|
}
|
|
98
125
|
return records.reverse();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-log.js","sourceRoot":"","sources":["../../src/memory/git-log.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"git-log.js","sourceRoot":"","sources":["../../src/memory/git-log.ts"],"names":[],"mappings":";;AAkGA,4CAiCC;AAnID;;;;;;GAMG;AACH,wCAA4F;AAE5F,+FAA+F;AAC/F,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB;;;;;GAKG;AACH,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,IAAA,oBAAU,EAAC,IAAI,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AAC/H,CAAC;AAED;;;;;GAKG;AACH,MAAM,eAAe,GAAG,MAAM,CAAC;AAE/B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,SAAgB,gBAAgB,CAC9B,IAAY,EACZ,MAAyB,EACzB,SAA4B,EAC5B,YAA+B,EAAE;IAEjC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACnC,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,GAAG,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5E,MAAM,IAAI,GAAG,CAAC,KAAK,EAAE,qBAAqB,EAAE,GAAG,SAAS,EAAE,YAAY,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC,CAAC;IACpG,MAAM,GAAG,GAAG,IAAA,oBAAU,EAAC,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IAAA,2BAAiB,EAAC,MAAM,CAAC,KAAK,CAAW,EAAE,SAAS,CAAC,CAAC;QAC3F,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAC3B,CAAC"}
|
package/dist/memory/history.d.ts
CHANGED
|
@@ -20,7 +20,29 @@ export interface MemoryHistoryEntry {
|
|
|
20
20
|
* (`task-097-memory-history-reads-each-commit-at-its-historical-path`).
|
|
21
21
|
*/
|
|
22
22
|
readonly path: string;
|
|
23
|
+
/**
|
|
24
|
+
* The root-relative path the document occupied in this commit's **first parent** — where its state
|
|
25
|
+
* before the commit is read (`task-278`, `bug-308`) — or `null` when the commit created it there:
|
|
26
|
+
* an `A` edge, or a `C` edge from the template the element was copied from (which the parent holds,
|
|
27
|
+
* not the element). The source of a rename (`R`), the commit's own path otherwise.
|
|
28
|
+
*
|
|
29
|
+
* Read off the same `--follow --name-status` line as {@link path} ({@link parseParentPaths}), never
|
|
30
|
+
* from the walk's previous entry: the walk is ordered by date, not by ancestry, so on interleaved
|
|
31
|
+
* branches the previous entry is another branch's commit. Set on every entry
|
|
32
|
+
* {@link getMemoryHistory} returns ({@link WalkedHistoryEntry}); optional here only so that the pure
|
|
33
|
+
* helpers' inputs, built before it is known, keep this shape. A commit git printed no diff for
|
|
34
|
+
* (a merge) gets its own {@link path} ({@link attachParentPaths}).
|
|
35
|
+
*/
|
|
36
|
+
readonly parentPath?: string | null;
|
|
23
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* A {@link MemoryHistoryEntry} as {@link getMemoryHistory} returns it: {@link MemoryHistoryEntry.parentPath}
|
|
40
|
+
* is always set (`task-278`), so a reader never has to guess where the commit's first parent held the
|
|
41
|
+
* document.
|
|
42
|
+
*/
|
|
43
|
+
export type WalkedHistoryEntry = MemoryHistoryEntry & {
|
|
44
|
+
readonly parentPath: string | null;
|
|
45
|
+
};
|
|
24
46
|
/**
|
|
25
47
|
* The sha of the commit that introduced `relativePath` as a COPY of a file that outlives it — the
|
|
26
48
|
* element's own creation — or `null` when the followed chain contains no copy edge at all.
|
|
@@ -29,13 +51,13 @@ export interface MemoryHistoryEntry {
|
|
|
29
51
|
* kinds of edge, and they mean opposite things for an audit trail:
|
|
30
52
|
*
|
|
31
53
|
* - **`R` (rename)** — the element continuing under a new name. Keep following. This is not a
|
|
32
|
-
* hypothetical requirement: `
|
|
54
|
+
* hypothetical requirement: the Memory folder's `planning/v1/*` became `planning/rl-v1/*` in
|
|
33
55
|
* one commit in this repository, moving five `release` elements at once, because the `release`
|
|
34
56
|
* type's `path` pattern interpolates the release-line id (`memory.yaml`). For one of them a plain
|
|
35
57
|
* `git log -- <path>` returns a single commit where the followed walk returns seven, so dropping
|
|
36
58
|
* `--follow` would delete five sixths of that element's recorded history.
|
|
37
59
|
* - **`C` (copy)** — the element being born out of a file that still exists. `wingfoil memory add`
|
|
38
|
-
* copies the type's template verbatim (
|
|
60
|
+
* copies the type's template verbatim (AGENTS.md §5.1), and `wingfoil init` has already committed
|
|
39
61
|
* that template, so this edge is how every scaffolded element begins. Everything strictly older
|
|
40
62
|
* than it is the template's history, not the element's.
|
|
41
63
|
*
|
|
@@ -43,10 +65,10 @@ export interface MemoryHistoryEntry {
|
|
|
43
65
|
* whatever the source itself was copied from. `git log` prints newest first, so that is the first
|
|
44
66
|
* line.
|
|
45
67
|
*
|
|
46
|
-
* **Throws** — never returns `null` — when git itself fails
|
|
68
|
+
* **Throws** `StorageError` `E_GIT_READ_FAILED` — never returns `null` — when git itself fails,
|
|
69
|
+
* with git's own message in the error (`readOrExplain`). "git could not answer" and "this
|
|
47
70
|
* element was never copied from anything" are different answers, and collapsing the first into the
|
|
48
|
-
* second would silently restore the phantom entry
|
|
49
|
-
* `walkGitLogFields`, whose `catch` returns `[]` (`bug-072-oversized-git-log-becomes-empty-history`).
|
|
71
|
+
* second would silently restore the phantom entry.
|
|
50
72
|
* {@link getMemoryHistory} calls this only once the main walk has already returned commits, so at
|
|
51
73
|
* that point the repository and the path are both known good and a failure here is genuinely
|
|
52
74
|
* exceptional.
|
|
@@ -74,7 +96,7 @@ export declare function findElementCreationSha(root: string, relativePath: strin
|
|
|
74
96
|
* @param creationSha - The element's creation commit, from {@link findElementCreationSha}.
|
|
75
97
|
* @returns `entries` from the creation commit onward (a new array; `entries` is not mutated).
|
|
76
98
|
*/
|
|
77
|
-
export declare function dropPreCreationAncestry(entries: readonly
|
|
99
|
+
export declare function dropPreCreationAncestry<Entry extends MemoryHistoryEntry>(entries: readonly Entry[], creationSha: string | null): Entry[];
|
|
78
100
|
/**
|
|
79
101
|
* Where `relativePath`'s document lived at each commit of its `--follow` walk, keyed by sha.
|
|
80
102
|
*
|
|
@@ -89,7 +111,8 @@ export declare function dropPreCreationAncestry(entries: readonly MemoryHistoryE
|
|
|
89
111
|
* absent from the map; {@link attachHistoricalPaths} decides what to do about that, so the rule is
|
|
90
112
|
* testable without a repository.
|
|
91
113
|
*
|
|
92
|
-
* **Throws** — never returns an empty map — when git itself
|
|
114
|
+
* **Throws** `StorageError` `E_GIT_READ_FAILED` — never returns an empty map — when git itself
|
|
115
|
+
* fails, with git's own message in the error (`readOrExplain`), for the same reason
|
|
93
116
|
* {@link findElementCreationSha} does: "git could not answer" and "this element was never renamed"
|
|
94
117
|
* are different answers, and folding the first into the second silently reinstates `bug-080` by
|
|
95
118
|
* reading every commit at the current path again. {@link getMemoryHistory} calls this only once the
|
|
@@ -100,6 +123,28 @@ export declare function dropPreCreationAncestry(entries: readonly MemoryHistoryE
|
|
|
100
123
|
* @returns sha → the root-relative path the document occupied at that commit.
|
|
101
124
|
*/
|
|
102
125
|
export declare function collectHistoricalPaths(root: string, relativePath: string): Map<string, string>;
|
|
126
|
+
/**
|
|
127
|
+
* Parse {@link collectHistoricalPaths}' `git log --follow --name-status --format=%H` output into
|
|
128
|
+
* sha → the path at that commit. Pure: no git. Every line without a tab must be a full commit name and
|
|
129
|
+
* a status line must follow one; anything else is refused with `StorageError` `E_GIT_READ_FAILED`
|
|
130
|
+
* (`requireCommitName`) rather than skipped (`task-268`, `bug-291`).
|
|
131
|
+
*
|
|
132
|
+
* @param stdout - The probe's output.
|
|
133
|
+
* @returns sha → the root-relative path the document occupied at that commit (first status line wins).
|
|
134
|
+
*/
|
|
135
|
+
export declare function parseHistoricalPaths(stdout: string): Map<string, string>;
|
|
136
|
+
/**
|
|
137
|
+
* Parse the same probe output into sha → the path the document occupied in that commit's first
|
|
138
|
+
* parent (`task-278`, `bug-308`): the FIRST path of a rename line (`R<score> <old> <new>`), `null` for
|
|
139
|
+
* a creation — `A`, or `C<score> <source> <path>`, whose source is the template the element was copied
|
|
140
|
+
* from and not the element — and the line's single path otherwise (`M`, `D`, `T`). `git log` diffs a
|
|
141
|
+
* non-merge commit against its only parent, so the line describes exactly that edge. Pure: no git;
|
|
142
|
+
* refuses what {@link parseHistoricalPaths} refuses.
|
|
143
|
+
*
|
|
144
|
+
* @param stdout - The probe's output.
|
|
145
|
+
* @returns sha → the first parent's root-relative path, or `null` (first status line wins).
|
|
146
|
+
*/
|
|
147
|
+
export declare function parseParentPaths(stdout: string): Map<string, string | null>;
|
|
103
148
|
/**
|
|
104
149
|
* Stamp each walked commit with the path the element occupied at it, from
|
|
105
150
|
* {@link collectHistoricalPaths}' map.
|
|
@@ -119,6 +164,20 @@ export declare function collectHistoricalPaths(root: string, relativePath: strin
|
|
|
119
164
|
* @returns A new array; `entries` is not mutated.
|
|
120
165
|
*/
|
|
121
166
|
export declare function attachHistoricalPaths(entries: readonly MemoryHistoryEntry[], pathBySha: ReadonlyMap<string, string>, fallbackPath: string): MemoryHistoryEntry[];
|
|
167
|
+
/**
|
|
168
|
+
* Stamp each walked commit with the path the element occupied in its first parent, from
|
|
169
|
+
* {@link parseParentPaths}' map (`task-278`, `bug-308`). Pure, like {@link attachHistoricalPaths},
|
|
170
|
+
* and with the same fallback for a sha the probe printed no line for — git shows no diff for a merge:
|
|
171
|
+
* the entry's own {@link MemoryHistoryEntry.path}, so a merge is read against its first parent at the
|
|
172
|
+
* path it holds itself. (`git log --follow` lists no merge commit in the shapes this repository
|
|
173
|
+
* produces — `bug-308`'s reproduction walked the three non-merge commits only — so the fallback is
|
|
174
|
+
* the rule for one, not a path the walk is known to take.)
|
|
175
|
+
*
|
|
176
|
+
* @param entries - The walk, oldest first, each already carrying its own path.
|
|
177
|
+
* @param parentPathBySha - sha → the first parent's path or `null`, from {@link parseParentPaths}.
|
|
178
|
+
* @returns A new array; `entries` is not mutated.
|
|
179
|
+
*/
|
|
180
|
+
export declare function attachParentPaths(entries: readonly MemoryHistoryEntry[], parentPathBySha: ReadonlyMap<string, string | null>): WalkedHistoryEntry[];
|
|
122
181
|
/**
|
|
123
182
|
* Walk every commit that touched `relativePath`, oldest first (P1.10-memory-history.feature: "lists
|
|
124
183
|
* ... entries in chronological order") — `git log` itself returns newest-first, reversed by
|
|
@@ -126,11 +185,13 @@ export declare function attachHistoricalPaths(entries: readonly MemoryHistoryEnt
|
|
|
126
185
|
* disk keeps its history, but stops at the element's own creation rather than continuing into the
|
|
127
186
|
* template it was copied from ({@link findElementCreationSha}).
|
|
128
187
|
*
|
|
129
|
-
* Returns `[]
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
188
|
+
* Returns `[]` when no commit touches the path, or the repository has none yet — "document not
|
|
189
|
+
* found" is a caller/feature-layer concern (task-021/026-style CLI error rendering), not this
|
|
190
|
+
* primitive's. That is also why the creation probe runs only on a non-empty walk: on an empty one
|
|
191
|
+
* there is nothing to truncate and nothing to conclude from git's silence — and the same for the path
|
|
192
|
+
* probe. **A git failure throws** `StorageError` `E_GIT_READ_FAILED` — a `root` that is not a
|
|
193
|
+
* repository included — rather than reading as an empty history (task-142, `bug-072`; see
|
|
194
|
+
* {@link walkGitLogFields}).
|
|
134
195
|
*
|
|
135
196
|
* Every returned entry carries the path the element occupied at its own commit
|
|
136
197
|
* ({@link MemoryHistoryEntry.path}), not the one the caller named. That is what makes this walk the
|
|
@@ -138,5 +199,5 @@ export declare function attachHistoricalPaths(entries: readonly MemoryHistoryEnt
|
|
|
138
199
|
* commit — `./audit`'s `reconstructMemoryTransitions`, which reads the frontmatter `status:` — must
|
|
139
200
|
* take the path from here rather than re-using its own argument (`bug-080`).
|
|
140
201
|
*/
|
|
141
|
-
export declare function getMemoryHistory(root: string, relativePath: string):
|
|
202
|
+
export declare function getMemoryHistory(root: string, relativePath: string): WalkedHistoryEntry[];
|
|
142
203
|
//# sourceMappingURL=history.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/memory/history.ts"],"names":[],"mappings":"AAiCA,sGAAsG;AACtG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,qFAAqF;IACrF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/memory/history.ts"],"names":[],"mappings":"AAiCA,sGAAsG;AACtG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,qFAAqF;IACrF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;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YG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,SAAS,kBAAkB,EAAE,EACtC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GAClD,kBAAkB,EAAE,CAKtB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,kBAAkB,EAAE,CA8BzF"}
|
package/dist/memory/history.js
CHANGED
|
@@ -3,7 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.findElementCreationSha = findElementCreationSha;
|
|
4
4
|
exports.dropPreCreationAncestry = dropPreCreationAncestry;
|
|
5
5
|
exports.collectHistoricalPaths = collectHistoricalPaths;
|
|
6
|
+
exports.parseHistoricalPaths = parseHistoricalPaths;
|
|
7
|
+
exports.parseParentPaths = parseParentPaths;
|
|
6
8
|
exports.attachHistoricalPaths = attachHistoricalPaths;
|
|
9
|
+
exports.attachParentPaths = attachParentPaths;
|
|
7
10
|
exports.getMemoryHistory = getMemoryHistory;
|
|
8
11
|
/**
|
|
9
12
|
* Memory history primitive (task-008-dna-memory-query-latency, REQ-PERF-02) — the git-log walk
|
|
@@ -15,7 +18,7 @@ exports.getMemoryHistory = getMemoryHistory;
|
|
|
15
18
|
* Scope (see task-008's Execution Notes): this returns *structured commit records* (sha, author
|
|
16
19
|
* name/email, ISO-8601 author date, subject, body) — the walk itself. Deriving a human-facing
|
|
17
20
|
* "state change" (e.g. "pending -> backlog") from the commit body's `Approver:`/`Reason:` lines
|
|
18
|
-
* (
|
|
21
|
+
* (AGENTS.md §5.1) is not this primitive's concern; the raw `body` field carries that text verbatim
|
|
19
22
|
* for a caller to parse, and `./audit`'s `reconstructMemoryTransitions` is the caller that does — the
|
|
20
23
|
* `memoryHistory` operation projects that reconstruction rather than re-reading this walk itself.
|
|
21
24
|
*
|
|
@@ -34,9 +37,24 @@ exports.getMemoryHistory = getMemoryHistory;
|
|
|
34
37
|
* {@link findElementCreationSha} for the distinction that resolves it and why rename-following is
|
|
35
38
|
* kept rather than traded away.
|
|
36
39
|
*/
|
|
37
|
-
const
|
|
40
|
+
const storage_1 = require("../storage");
|
|
38
41
|
const git_log_1 = require("./git-log");
|
|
39
42
|
const LOG_FIELDS = ['%H', '%an', '%ae', '%aI', '%s', '%b'];
|
|
43
|
+
/**
|
|
44
|
+
* Run one of this module's probes through `runGitRead` (`src/storage/git-read.ts`, task-142) and
|
|
45
|
+
* return its stdout, or throw `StorageError` `E_GIT_READ_FAILED` whose message says what the failure
|
|
46
|
+
* leaves unknown (`what`) and then git's own text. stderr is captured, never inherited: git's `fatal:`
|
|
47
|
+
* reaches the caller inside this error, not the operator's terminal on its own
|
|
48
|
+
* (`bug-093-two-more-git-calls-inherit-the-operator-stderr`, `bug-097`).
|
|
49
|
+
*/
|
|
50
|
+
function readOrExplain(root, args, what) {
|
|
51
|
+
try {
|
|
52
|
+
return (0, storage_1.runGitRead)(root, args).stdout;
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
throw new storage_1.StorageError(storage_1.E_GIT_READ_FAILED, `${what}: ${error.message.replace(/^E_GIT_READ_FAILED: /, '')}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
40
58
|
/**
|
|
41
59
|
* The same `--follow` walk as {@link getMemoryHistory}, narrowed by git to the commits whose edge for
|
|
42
60
|
* this path is a **copy**, and printing nothing but the sha. Deliberately a second `git log`
|
|
@@ -44,6 +62,9 @@ const LOG_FIELDS = ['%H', '%an', '%ae', '%aI', '%s', '%b'];
|
|
|
44
62
|
* records by field arity over a stream of `<field>NUL` groups, so anything git appends outside the
|
|
45
63
|
* `--format` string — `--name-status` output, for instance — would be read as the next record's
|
|
46
64
|
* first field (task-086).
|
|
65
|
+
*
|
|
66
|
+
* Like every `git log` reader, it runs with `--no-show-signature` (`task-268`, `bug-291`): under
|
|
67
|
+
* `log.showSignature` git printed "No signature" here as the first line, read as the creation commit.
|
|
47
68
|
*/
|
|
48
69
|
const CREATION_PROBE_ARGS = ['--follow', '--diff-filter=C', '--format=%H'];
|
|
49
70
|
/**
|
|
@@ -54,13 +75,13 @@ const CREATION_PROBE_ARGS = ['--follow', '--diff-filter=C', '--format=%H'];
|
|
|
54
75
|
* kinds of edge, and they mean opposite things for an audit trail:
|
|
55
76
|
*
|
|
56
77
|
* - **`R` (rename)** — the element continuing under a new name. Keep following. This is not a
|
|
57
|
-
* hypothetical requirement: `
|
|
78
|
+
* hypothetical requirement: the Memory folder's `planning/v1/*` became `planning/rl-v1/*` in
|
|
58
79
|
* one commit in this repository, moving five `release` elements at once, because the `release`
|
|
59
80
|
* type's `path` pattern interpolates the release-line id (`memory.yaml`). For one of them a plain
|
|
60
81
|
* `git log -- <path>` returns a single commit where the followed walk returns seven, so dropping
|
|
61
82
|
* `--follow` would delete five sixths of that element's recorded history.
|
|
62
83
|
* - **`C` (copy)** — the element being born out of a file that still exists. `wingfoil memory add`
|
|
63
|
-
* copies the type's template verbatim (
|
|
84
|
+
* copies the type's template verbatim (AGENTS.md §5.1), and `wingfoil init` has already committed
|
|
64
85
|
* that template, so this edge is how every scaffolded element begins. Everything strictly older
|
|
65
86
|
* than it is the template's history, not the element's.
|
|
66
87
|
*
|
|
@@ -68,10 +89,10 @@ const CREATION_PROBE_ARGS = ['--follow', '--diff-filter=C', '--format=%H'];
|
|
|
68
89
|
* whatever the source itself was copied from. `git log` prints newest first, so that is the first
|
|
69
90
|
* line.
|
|
70
91
|
*
|
|
71
|
-
* **Throws** — never returns `null` — when git itself fails
|
|
92
|
+
* **Throws** `StorageError` `E_GIT_READ_FAILED` — never returns `null` — when git itself fails,
|
|
93
|
+
* with git's own message in the error (`readOrExplain`). "git could not answer" and "this
|
|
72
94
|
* element was never copied from anything" are different answers, and collapsing the first into the
|
|
73
|
-
* second would silently restore the phantom entry
|
|
74
|
-
* `walkGitLogFields`, whose `catch` returns `[]` (`bug-072-oversized-git-log-becomes-empty-history`).
|
|
95
|
+
* second would silently restore the phantom entry.
|
|
75
96
|
* {@link getMemoryHistory} calls this only once the main walk has already returned commits, so at
|
|
76
97
|
* that point the repository and the path are both known good and a failure here is genuinely
|
|
77
98
|
* exceptional.
|
|
@@ -81,17 +102,9 @@ const CREATION_PROBE_ARGS = ['--follow', '--diff-filter=C', '--format=%H'];
|
|
|
81
102
|
* @returns The creation commit's full sha, or `null` when the chain has no copy edge.
|
|
82
103
|
*/
|
|
83
104
|
function findElementCreationSha(root, relativePath) {
|
|
84
|
-
|
|
85
|
-
try {
|
|
86
|
-
stdout = (0, child_process_1.execFileSync)('git', ['-C', root, 'log', ...CREATION_PROBE_ARGS, '--', relativePath], {
|
|
87
|
-
encoding: 'utf-8',
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
catch (cause) {
|
|
91
|
-
throw new Error(`git log --follow --diff-filter=C failed for ${relativePath}: cannot establish where the element was created`, { cause });
|
|
92
|
-
}
|
|
105
|
+
const stdout = readOrExplain(root, ['log', '--no-show-signature', ...CREATION_PROBE_ARGS, '--', relativePath], `git log --follow --diff-filter=C failed for ${relativePath}: cannot establish where the element was created`);
|
|
93
106
|
const newestCopy = stdout.split('\n').find((line) => line.trim().length > 0);
|
|
94
|
-
return newestCopy === undefined ? null : newestCopy.trim();
|
|
107
|
+
return newestCopy === undefined ? null : (0, storage_1.requireCommitName)(newestCopy.trim(), 'git log --follow --diff-filter=C');
|
|
95
108
|
}
|
|
96
109
|
/**
|
|
97
110
|
* Drop the part of an oldest-first walk that precedes the element's creation, keeping the creation
|
|
@@ -130,11 +143,12 @@ function dropPreCreationAncestry(entries, creationSha) {
|
|
|
130
143
|
* `core.quotePath=false` is set for the invocation (never written to the repository's config) so a
|
|
131
144
|
* path carrying non-ASCII bytes arrives as its own UTF-8 rather than as git's `"\303\251"` escape
|
|
132
145
|
* form — the parser would otherwise have to un-escape it to hand `git show` something that resolves.
|
|
146
|
+
* Load-bearing, and pinned: `test/memory/history-rename-path.test.ts` (task-142 AC3, `bug-097`) goes
|
|
147
|
+
* red when the flag is removed. `--no-show-signature`, as on every `git log` reader (`task-268`,
|
|
148
|
+
* `bug-291`), keeps signature text out of the lines parsed as names.
|
|
133
149
|
*/
|
|
134
150
|
const PATH_PROBE_ARGS = ['-c', 'core.quotePath=false'];
|
|
135
151
|
const PATH_PROBE_LOG_ARGS = ['--follow', '--name-status', '--format=%H'];
|
|
136
|
-
/** A full sha on a line of its own — git's `--format=%H` output, which carries nothing else. */
|
|
137
|
-
const SHA_LINE_RE = /^[0-9a-f]{40}$/;
|
|
138
152
|
/**
|
|
139
153
|
* Where `relativePath`'s document lived at each commit of its `--follow` walk, keyed by sha.
|
|
140
154
|
*
|
|
@@ -149,7 +163,8 @@ const SHA_LINE_RE = /^[0-9a-f]{40}$/;
|
|
|
149
163
|
* absent from the map; {@link attachHistoricalPaths} decides what to do about that, so the rule is
|
|
150
164
|
* testable without a repository.
|
|
151
165
|
*
|
|
152
|
-
* **Throws** — never returns an empty map — when git itself
|
|
166
|
+
* **Throws** `StorageError` `E_GIT_READ_FAILED` — never returns an empty map — when git itself
|
|
167
|
+
* fails, with git's own message in the error (`readOrExplain`), for the same reason
|
|
153
168
|
* {@link findElementCreationSha} does: "git could not answer" and "this element was never renamed"
|
|
154
169
|
* are different answers, and folding the first into the second silently reinstates `bug-080` by
|
|
155
170
|
* reading every commit at the current path again. {@link getMemoryHistory} calls this only once the
|
|
@@ -160,32 +175,78 @@ const SHA_LINE_RE = /^[0-9a-f]{40}$/;
|
|
|
160
175
|
* @returns sha → the root-relative path the document occupied at that commit.
|
|
161
176
|
*/
|
|
162
177
|
function collectHistoricalPaths(root, relativePath) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
178
|
+
return parseHistoricalPaths(readPathProbe(root, relativePath));
|
|
179
|
+
}
|
|
180
|
+
/** The `--follow --name-status` probe's output, which {@link parseHistoricalPaths} and {@link parseParentPaths} both read. */
|
|
181
|
+
function readPathProbe(root, relativePath) {
|
|
182
|
+
return readOrExplain(root, [...PATH_PROBE_ARGS, 'log', '--no-show-signature', ...PATH_PROBE_LOG_ARGS, '--', relativePath], `git log --follow --name-status failed for ${relativePath}: cannot establish where the element lived at each commit`);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* sha → the tab-separated fields of that commit's first status line in the probe's output (`M`,
|
|
186
|
+
* `<path>`, or `R<score>`, `<old>`, `<new>`). Every line without a tab must be a full commit name and
|
|
187
|
+
* a status line must follow one; anything else is refused with `StorageError` `E_GIT_READ_FAILED`
|
|
188
|
+
* (`requireCommitName`) rather than skipped (`task-268`, `bug-291`).
|
|
189
|
+
*/
|
|
190
|
+
function parseStatusLines(stdout) {
|
|
191
|
+
const fieldsBySha = new Map();
|
|
176
192
|
let currentSha = null;
|
|
177
193
|
for (const line of stdout.split('\n')) {
|
|
178
|
-
if (
|
|
179
|
-
|
|
194
|
+
if (line === '')
|
|
195
|
+
continue;
|
|
196
|
+
// A line with no tab is `--format=%H`'s: a commit name, or refused — never skipped (task-268,
|
|
197
|
+
// `bug-291`: signature text printed under `log.showSignature` was skipped here, silently).
|
|
198
|
+
if (!line.includes('\t')) {
|
|
199
|
+
currentSha = (0, storage_1.requireCommitName)(line, 'git log --follow --name-status');
|
|
180
200
|
continue;
|
|
181
201
|
}
|
|
182
|
-
|
|
202
|
+
// A status line before any name is not what `--format=%H` prints: refused like any other line.
|
|
203
|
+
if (currentSha === null)
|
|
204
|
+
currentSha = (0, storage_1.requireCommitName)(line, 'git log --follow --name-status');
|
|
205
|
+
if (fieldsBySha.has(currentSha))
|
|
183
206
|
continue;
|
|
184
|
-
|
|
185
|
-
pathBySha.set(currentSha, fields[fields.length - 1]);
|
|
207
|
+
fieldsBySha.set(currentSha, line.split('\t'));
|
|
186
208
|
}
|
|
209
|
+
return fieldsBySha;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Parse {@link collectHistoricalPaths}' `git log --follow --name-status --format=%H` output into
|
|
213
|
+
* sha → the path at that commit. Pure: no git. Every line without a tab must be a full commit name and
|
|
214
|
+
* a status line must follow one; anything else is refused with `StorageError` `E_GIT_READ_FAILED`
|
|
215
|
+
* (`requireCommitName`) rather than skipped (`task-268`, `bug-291`).
|
|
216
|
+
*
|
|
217
|
+
* @param stdout - The probe's output.
|
|
218
|
+
* @returns sha → the root-relative path the document occupied at that commit (first status line wins).
|
|
219
|
+
*/
|
|
220
|
+
function parseHistoricalPaths(stdout) {
|
|
221
|
+
const pathBySha = new Map();
|
|
222
|
+
for (const [sha, fields] of parseStatusLines(stdout))
|
|
223
|
+
pathBySha.set(sha, fields[fields.length - 1]);
|
|
187
224
|
return pathBySha;
|
|
188
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Parse the same probe output into sha → the path the document occupied in that commit's first
|
|
228
|
+
* parent (`task-278`, `bug-308`): the FIRST path of a rename line (`R<score> <old> <new>`), `null` for
|
|
229
|
+
* a creation — `A`, or `C<score> <source> <path>`, whose source is the template the element was copied
|
|
230
|
+
* from and not the element — and the line's single path otherwise (`M`, `D`, `T`). `git log` diffs a
|
|
231
|
+
* non-merge commit against its only parent, so the line describes exactly that edge. Pure: no git;
|
|
232
|
+
* refuses what {@link parseHistoricalPaths} refuses.
|
|
233
|
+
*
|
|
234
|
+
* @param stdout - The probe's output.
|
|
235
|
+
* @returns sha → the first parent's root-relative path, or `null` (first status line wins).
|
|
236
|
+
*/
|
|
237
|
+
function parseParentPaths(stdout) {
|
|
238
|
+
const parentPathBySha = new Map();
|
|
239
|
+
for (const [sha, fields] of parseStatusLines(stdout)) {
|
|
240
|
+
const status = fields[0];
|
|
241
|
+
if (status.startsWith('A') || status.startsWith('C'))
|
|
242
|
+
parentPathBySha.set(sha, null);
|
|
243
|
+
else if (status.startsWith('R'))
|
|
244
|
+
parentPathBySha.set(sha, fields[1]);
|
|
245
|
+
else
|
|
246
|
+
parentPathBySha.set(sha, fields[fields.length - 1]);
|
|
247
|
+
}
|
|
248
|
+
return parentPathBySha;
|
|
249
|
+
}
|
|
189
250
|
/**
|
|
190
251
|
* Stamp each walked commit with the path the element occupied at it, from
|
|
191
252
|
* {@link collectHistoricalPaths}' map.
|
|
@@ -207,6 +268,25 @@ function collectHistoricalPaths(root, relativePath) {
|
|
|
207
268
|
function attachHistoricalPaths(entries, pathBySha, fallbackPath) {
|
|
208
269
|
return entries.map((entry) => ({ ...entry, path: pathBySha.get(entry.sha) ?? fallbackPath }));
|
|
209
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* Stamp each walked commit with the path the element occupied in its first parent, from
|
|
273
|
+
* {@link parseParentPaths}' map (`task-278`, `bug-308`). Pure, like {@link attachHistoricalPaths},
|
|
274
|
+
* and with the same fallback for a sha the probe printed no line for — git shows no diff for a merge:
|
|
275
|
+
* the entry's own {@link MemoryHistoryEntry.path}, so a merge is read against its first parent at the
|
|
276
|
+
* path it holds itself. (`git log --follow` lists no merge commit in the shapes this repository
|
|
277
|
+
* produces — `bug-308`'s reproduction walked the three non-merge commits only — so the fallback is
|
|
278
|
+
* the rule for one, not a path the walk is known to take.)
|
|
279
|
+
*
|
|
280
|
+
* @param entries - The walk, oldest first, each already carrying its own path.
|
|
281
|
+
* @param parentPathBySha - sha → the first parent's path or `null`, from {@link parseParentPaths}.
|
|
282
|
+
* @returns A new array; `entries` is not mutated.
|
|
283
|
+
*/
|
|
284
|
+
function attachParentPaths(entries, parentPathBySha) {
|
|
285
|
+
return entries.map((entry) => ({
|
|
286
|
+
...entry,
|
|
287
|
+
parentPath: parentPathBySha.has(entry.sha) ? parentPathBySha.get(entry.sha) : entry.path,
|
|
288
|
+
}));
|
|
289
|
+
}
|
|
210
290
|
/**
|
|
211
291
|
* Walk every commit that touched `relativePath`, oldest first (P1.10-memory-history.feature: "lists
|
|
212
292
|
* ... entries in chronological order") — `git log` itself returns newest-first, reversed by
|
|
@@ -214,11 +294,13 @@ function attachHistoricalPaths(entries, pathBySha, fallbackPath) {
|
|
|
214
294
|
* disk keeps its history, but stops at the element's own creation rather than continuing into the
|
|
215
295
|
* template it was copied from ({@link findElementCreationSha}).
|
|
216
296
|
*
|
|
217
|
-
* Returns `[]
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
297
|
+
* Returns `[]` when no commit touches the path, or the repository has none yet — "document not
|
|
298
|
+
* found" is a caller/feature-layer concern (task-021/026-style CLI error rendering), not this
|
|
299
|
+
* primitive's. That is also why the creation probe runs only on a non-empty walk: on an empty one
|
|
300
|
+
* there is nothing to truncate and nothing to conclude from git's silence — and the same for the path
|
|
301
|
+
* probe. **A git failure throws** `StorageError` `E_GIT_READ_FAILED` — a `root` that is not a
|
|
302
|
+
* repository included — rather than reading as an empty history (task-142, `bug-072`; see
|
|
303
|
+
* {@link walkGitLogFields}).
|
|
222
304
|
*
|
|
223
305
|
* Every returned entry carries the path the element occupied at its own commit
|
|
224
306
|
* ({@link MemoryHistoryEntry.path}), not the one the caller named. That is what makes this walk the
|
|
@@ -243,8 +325,10 @@ function getMemoryHistory(root, relativePath) {
|
|
|
243
325
|
return { sha, authorName, authorEmail, date, subject, body: body.trim(), path: relativePath };
|
|
244
326
|
});
|
|
245
327
|
if (entries.length === 0)
|
|
246
|
-
return
|
|
247
|
-
|
|
328
|
+
return [];
|
|
329
|
+
// One probe answers both questions: where the document was at each commit, and in its first parent.
|
|
330
|
+
const probe = readPathProbe(root, relativePath);
|
|
331
|
+
const located = attachParentPaths(attachHistoricalPaths(entries, parseHistoricalPaths(probe), relativePath), parseParentPaths(probe));
|
|
248
332
|
return dropPreCreationAncestry(located, findElementCreationSha(root, relativePath));
|
|
249
333
|
}
|
|
250
334
|
//# sourceMappingURL=history.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/memory/history.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/memory/history.ts"],"names":[],"mappings":";;AA8IA,wDASC;AAoBD,0DAaC;AA4CD,wDAEC;AA6CD,oDAIC;AAaD,4CASC;AAoBD,sDAMC;AAeD,8CAQC;AAuBD,4CA8BC;AAnZD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wCAA4F;AAE5F,uCAA6C;AA+C7C,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAE3D;;;;;;GAMG;AACH,SAAS,aAAa,CAAC,IAAY,EAAE,IAAuB,EAAE,IAAY;IACxE,IAAI,CAAC;QACH,OAAO,IAAA,oBAAU,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC;IACvC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,sBAAY,CAAC,2BAAiB,EAAE,GAAG,IAAI,KAAM,KAAe,CAAC,OAAO,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;IACxH,CAAC;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE,iBAAiB,EAAE,aAAa,CAAC,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,SAAgB,sBAAsB,CAAC,IAAY,EAAE,YAAoB;IACvE,MAAM,MAAM,GAAG,aAAa,CAC1B,IAAI,EACJ,CAAC,KAAK,EAAE,qBAAqB,EAAE,GAAG,mBAAmB,EAAE,IAAI,EAAE,YAAY,CAAC,EAC1E,+CAA+C,YAAY,kDAAkD,CAC9G,CAAC;IAEF,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CA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