@paraharness/fs 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +80 -2
- package/dist/builders/create-fs-allow-only-guard-builder.d.ts +13 -0
- package/dist/builders/create-fs-allow-only-guard-builder.d.ts.map +1 -0
- package/dist/builders/create-fs-allow-only-guard-builder.js +22 -0
- package/dist/builders/create-fs-allow-only-guard-builder.js.map +1 -0
- package/dist/builders/create-fs-allow-write-globs-lease-delta.d.ts +13 -0
- package/dist/builders/create-fs-allow-write-globs-lease-delta.d.ts.map +1 -0
- package/dist/builders/create-fs-allow-write-globs-lease-delta.js +20 -0
- package/dist/builders/create-fs-allow-write-globs-lease-delta.js.map +1 -0
- package/dist/builders/create-fs-boundary-guard-builder.d.ts +15 -0
- package/dist/builders/create-fs-boundary-guard-builder.d.ts.map +1 -0
- package/dist/builders/create-fs-boundary-guard-builder.js +20 -0
- package/dist/builders/create-fs-boundary-guard-builder.js.map +1 -0
- package/dist/builders/create-fs-coding-tools.d.ts +22 -0
- package/dist/builders/create-fs-coding-tools.d.ts.map +1 -0
- package/dist/builders/create-fs-coding-tools.js +26 -0
- package/dist/builders/create-fs-coding-tools.js.map +1 -0
- package/dist/builders/create-fs-glob-matcher-builder.d.ts +14 -0
- package/dist/builders/create-fs-glob-matcher-builder.d.ts.map +1 -0
- package/dist/builders/create-fs-glob-matcher-builder.js +24 -0
- package/dist/builders/create-fs-glob-matcher-builder.js.map +1 -0
- package/dist/builders/create-fs-glob-source-builder.d.ts +13 -0
- package/dist/builders/create-fs-glob-source-builder.d.ts.map +1 -0
- package/dist/builders/create-fs-glob-source-builder.js +22 -0
- package/dist/builders/create-fs-glob-source-builder.js.map +1 -0
- package/dist/builders/create-fs-in-partition-predicate.d.ts +16 -0
- package/dist/builders/create-fs-in-partition-predicate.d.ts.map +1 -0
- package/dist/builders/create-fs-in-partition-predicate.js +25 -0
- package/dist/builders/create-fs-in-partition-predicate.js.map +1 -0
- package/dist/builders/create-fs-jsonl-lesson-store-builder.d.ts +29 -0
- package/dist/builders/create-fs-jsonl-lesson-store-builder.d.ts.map +1 -0
- package/dist/builders/create-fs-jsonl-lesson-store-builder.js +37 -0
- package/dist/builders/create-fs-jsonl-lesson-store-builder.js.map +1 -0
- package/dist/builders/create-fs-max-files-mutated-builder.d.ts +13 -0
- package/dist/builders/create-fs-max-files-mutated-builder.d.ts.map +1 -0
- package/dist/builders/create-fs-max-files-mutated-builder.js +21 -0
- package/dist/builders/create-fs-max-files-mutated-builder.js.map +1 -0
- package/dist/builders/create-fs-partition-map.d.ts +16 -0
- package/dist/builders/create-fs-partition-map.d.ts.map +1 -0
- package/dist/builders/create-fs-partition-map.js +34 -0
- package/dist/builders/create-fs-partition-map.js.map +1 -0
- package/dist/builders/create-fs-protect-guard-builder.d.ts +13 -0
- package/dist/builders/create-fs-protect-guard-builder.d.ts.map +1 -0
- package/dist/builders/create-fs-protect-guard-builder.js +22 -0
- package/dist/builders/create-fs-protect-guard-builder.js.map +1 -0
- package/dist/builders/create-fs-read-only-guard-builder.d.ts +11 -0
- package/dist/builders/create-fs-read-only-guard-builder.d.ts.map +1 -0
- package/dist/builders/create-fs-read-only-guard-builder.js +15 -0
- package/dist/builders/create-fs-read-only-guard-builder.js.map +1 -0
- package/dist/builders/create-fs-read-only-tools.d.ts +16 -0
- package/dist/builders/create-fs-read-only-tools.d.ts.map +1 -0
- package/dist/builders/create-fs-read-only-tools.js +24 -0
- package/dist/builders/create-fs-read-only-tools.js.map +1 -0
- package/dist/builders/create-fs-regex-check-builder.d.ts +34 -0
- package/dist/builders/create-fs-regex-check-builder.d.ts.map +1 -0
- package/dist/builders/create-fs-regex-check-builder.js +58 -0
- package/dist/builders/create-fs-regex-check-builder.js.map +1 -0
- package/dist/builders/create-fs-require-read-before-write-guard-builder.d.ts +11 -0
- package/dist/builders/create-fs-require-read-before-write-guard-builder.d.ts.map +1 -0
- package/dist/builders/create-fs-require-read-before-write-guard-builder.js +15 -0
- package/dist/builders/create-fs-require-read-before-write-guard-builder.js.map +1 -0
- package/dist/builders/create-fs-scoped-write-guard-builder.d.ts +15 -0
- package/dist/builders/create-fs-scoped-write-guard-builder.d.ts.map +1 -0
- package/dist/builders/create-fs-scoped-write-guard-builder.js +20 -0
- package/dist/builders/create-fs-scoped-write-guard-builder.js.map +1 -0
- package/dist/builders/create-fs-secret-literals-guard-builder.d.ts +13 -0
- package/dist/builders/create-fs-secret-literals-guard-builder.d.ts.map +1 -0
- package/dist/builders/create-fs-secret-literals-guard-builder.js +21 -0
- package/dist/builders/create-fs-secret-literals-guard-builder.js.map +1 -0
- package/dist/builders/create-fs-telemetry-builder.d.ts +11 -0
- package/dist/builders/create-fs-telemetry-builder.d.ts.map +1 -0
- package/dist/builders/create-fs-telemetry-builder.js +17 -0
- package/dist/builders/create-fs-telemetry-builder.js.map +1 -0
- package/dist/builders/create-fs-text-source-builder.d.ts +14 -0
- package/dist/builders/create-fs-text-source-builder.d.ts.map +1 -0
- package/dist/builders/create-fs-text-source-builder.js +23 -0
- package/dist/builders/create-fs-text-source-builder.js.map +1 -0
- package/dist/builders/create-fs-write-guard-builder.d.ts +29 -0
- package/dist/builders/create-fs-write-guard-builder.d.ts.map +1 -0
- package/dist/builders/create-fs-write-guard-builder.js +29 -0
- package/dist/builders/create-fs-write-guard-builder.js.map +1 -0
- package/dist/builders/extract-fs-violated-paths.d.ts +14 -0
- package/dist/builders/extract-fs-violated-paths.d.ts.map +1 -0
- package/dist/builders/extract-fs-violated-paths.js +30 -0
- package/dist/builders/extract-fs-violated-paths.js.map +1 -0
- package/dist/builders/fs-namespace-contract.d.ts +195 -0
- package/dist/builders/fs-namespace-contract.d.ts.map +1 -0
- package/dist/builders/fs-namespace-contract.js +2 -0
- package/dist/builders/fs-namespace-contract.js.map +1 -0
- package/dist/builders/fs-namespace.d.ts +10 -0
- package/dist/builders/fs-namespace.d.ts.map +1 -0
- package/dist/builders/fs-namespace.js +52 -0
- package/dist/builders/fs-namespace.js.map +1 -0
- package/dist/builders/internal/build-fs-tool-nodes.d.ts +62 -0
- package/dist/builders/internal/build-fs-tool-nodes.d.ts.map +1 -0
- package/dist/builders/internal/build-fs-tool-nodes.js +107 -0
- package/dist/builders/internal/build-fs-tool-nodes.js.map +1 -0
- package/dist/builders/internal/fs-tool-input.schema.d.ts +80 -0
- package/dist/builders/internal/fs-tool-input.schema.d.ts.map +1 -0
- package/dist/builders/internal/fs-tool-input.schema.js +56 -0
- package/dist/builders/internal/fs-tool-input.schema.js.map +1 -0
- package/dist/executors/create-fs-executors.d.ts +11 -0
- package/dist/executors/create-fs-executors.d.ts.map +1 -0
- package/dist/executors/create-fs-executors.js +57 -0
- package/dist/executors/create-fs-executors.js.map +1 -0
- package/dist/executors/fs-check-tripwire-and-telemetry.d.ts +45 -0
- package/dist/executors/fs-check-tripwire-and-telemetry.d.ts.map +1 -0
- package/dist/executors/fs-check-tripwire-and-telemetry.js +99 -0
- package/dist/executors/fs-check-tripwire-and-telemetry.js.map +1 -0
- package/dist/executors/fs-executors.constants.d.ts +10 -0
- package/dist/executors/fs-executors.constants.d.ts.map +1 -0
- package/dist/executors/fs-executors.constants.js +10 -0
- package/dist/executors/fs-executors.constants.js.map +1 -0
- package/dist/executors/fs-glob-effect-matcher.d.ts +15 -0
- package/dist/executors/fs-glob-effect-matcher.d.ts.map +1 -0
- package/dist/executors/fs-glob-effect-matcher.js +37 -0
- package/dist/executors/fs-glob-effect-matcher.js.map +1 -0
- package/dist/executors/fs-path-guard-executors.d.ts +51 -0
- package/dist/executors/fs-path-guard-executors.d.ts.map +1 -0
- package/dist/executors/fs-path-guard-executors.js +60 -0
- package/dist/executors/fs-path-guard-executors.js.map +1 -0
- package/dist/executors/fs-read-tool-drivers.d.ts +35 -0
- package/dist/executors/fs-read-tool-drivers.d.ts.map +1 -0
- package/dist/executors/fs-read-tool-drivers.js +73 -0
- package/dist/executors/fs-read-tool-drivers.js.map +1 -0
- package/dist/executors/fs-source-executors.d.ts +31 -0
- package/dist/executors/fs-source-executors.d.ts.map +1 -0
- package/dist/executors/fs-source-executors.js +55 -0
- package/dist/executors/fs-source-executors.js.map +1 -0
- package/dist/executors/fs-tool-effect.d.ts +33 -0
- package/dist/executors/fs-tool-effect.d.ts.map +1 -0
- package/dist/executors/fs-tool-effect.js +2 -0
- package/dist/executors/fs-tool-effect.js.map +1 -0
- package/dist/executors/fs-write-guard-executors.d.ts +55 -0
- package/dist/executors/fs-write-guard-executors.d.ts.map +1 -0
- package/dist/executors/fs-write-guard-executors.js +64 -0
- package/dist/executors/fs-write-guard-executors.js.map +1 -0
- package/dist/executors/fs-write-tool-drivers.d.ts +24 -0
- package/dist/executors/fs-write-tool-drivers.d.ts.map +1 -0
- package/dist/executors/fs-write-tool-drivers.js +44 -0
- package/dist/executors/fs-write-tool-drivers.js.map +1 -0
- package/dist/executors/internal/add-mutated-paths-from-effects.d.ts +9 -0
- package/dist/executors/internal/add-mutated-paths-from-effects.d.ts.map +1 -0
- package/dist/executors/internal/add-mutated-paths-from-effects.js +24 -0
- package/dist/executors/internal/add-mutated-paths-from-effects.js.map +1 -0
- package/dist/executors/internal/check-paths-exist-at-base-ref.d.ts +12 -0
- package/dist/executors/internal/check-paths-exist-at-base-ref.d.ts.map +1 -0
- package/dist/executors/internal/check-paths-exist-at-base-ref.js +59 -0
- package/dist/executors/internal/check-paths-exist-at-base-ref.js.map +1 -0
- package/dist/executors/internal/collect-mutated-paths-since-base-ref.d.ts +13 -0
- package/dist/executors/internal/collect-mutated-paths-since-base-ref.d.ts.map +1 -0
- package/dist/executors/internal/collect-mutated-paths-since-base-ref.js +42 -0
- package/dist/executors/internal/collect-mutated-paths-since-base-ref.js.map +1 -0
- package/dist/executors/internal/collect-read-paths-from-effects.d.ts +12 -0
- package/dist/executors/internal/collect-read-paths-from-effects.d.ts.map +1 -0
- package/dist/executors/internal/collect-read-paths-from-effects.js +26 -0
- package/dist/executors/internal/collect-read-paths-from-effects.js.map +1 -0
- package/dist/executors/internal/compile-active-lease-write-matcher.d.ts +14 -0
- package/dist/executors/internal/compile-active-lease-write-matcher.d.ts.map +1 -0
- package/dist/executors/internal/compile-active-lease-write-matcher.js +50 -0
- package/dist/executors/internal/compile-active-lease-write-matcher.js.map +1 -0
- package/dist/executors/internal/compile-glob-or-exact-matcher.d.ts +12 -0
- package/dist/executors/internal/compile-glob-or-exact-matcher.d.ts.map +1 -0
- package/dist/executors/internal/compile-glob-or-exact-matcher.js +63 -0
- package/dist/executors/internal/compile-glob-or-exact-matcher.js.map +1 -0
- package/dist/executors/internal/compile-secret-patterns.d.ts +12 -0
- package/dist/executors/internal/compile-secret-patterns.d.ts.map +1 -0
- package/dist/executors/internal/compile-secret-patterns.js +27 -0
- package/dist/executors/internal/compile-secret-patterns.js.map +1 -0
- package/dist/executors/internal/create-effect-base-ref-path-lookup.d.ts +13 -0
- package/dist/executors/internal/create-effect-base-ref-path-lookup.d.ts.map +1 -0
- package/dist/executors/internal/create-effect-base-ref-path-lookup.js +33 -0
- package/dist/executors/internal/create-effect-base-ref-path-lookup.js.map +1 -0
- package/dist/executors/internal/create-fs-read-effect.d.ts +12 -0
- package/dist/executors/internal/create-fs-read-effect.d.ts.map +1 -0
- package/dist/executors/internal/create-fs-read-effect.js +22 -0
- package/dist/executors/internal/create-fs-read-effect.js.map +1 -0
- package/dist/executors/internal/create-fs-write-effect.d.ts +14 -0
- package/dist/executors/internal/create-fs-write-effect.d.ts.map +1 -0
- package/dist/executors/internal/create-fs-write-effect.js +24 -0
- package/dist/executors/internal/create-fs-write-effect.js.map +1 -0
- package/dist/executors/internal/describe-fs-edit-effects.d.ts +13 -0
- package/dist/executors/internal/describe-fs-edit-effects.d.ts.map +1 -0
- package/dist/executors/internal/describe-fs-edit-effects.js +31 -0
- package/dist/executors/internal/describe-fs-edit-effects.js.map +1 -0
- package/dist/executors/internal/describe-fs-write-effects.d.ts +13 -0
- package/dist/executors/internal/describe-fs-write-effects.d.ts.map +1 -0
- package/dist/executors/internal/describe-fs-write-effects.js +24 -0
- package/dist/executors/internal/describe-fs-write-effects.js.map +1 -0
- package/dist/executors/internal/enumerate-workspace-files-sync.d.ts +12 -0
- package/dist/executors/internal/enumerate-workspace-files-sync.d.ts.map +1 -0
- package/dist/executors/internal/enumerate-workspace-files-sync.js +52 -0
- package/dist/executors/internal/enumerate-workspace-files-sync.js.map +1 -0
- package/dist/executors/internal/enumerate-workspace-files.d.ts +13 -0
- package/dist/executors/internal/enumerate-workspace-files.d.ts.map +1 -0
- package/dist/executors/internal/enumerate-workspace-files.js +44 -0
- package/dist/executors/internal/enumerate-workspace-files.js.map +1 -0
- package/dist/executors/internal/evaluate-fs-allow-and-protect-guards.d.ts +28 -0
- package/dist/executors/internal/evaluate-fs-allow-and-protect-guards.d.ts.map +1 -0
- package/dist/executors/internal/evaluate-fs-allow-and-protect-guards.js +37 -0
- package/dist/executors/internal/evaluate-fs-allow-and-protect-guards.js.map +1 -0
- package/dist/executors/internal/evaluate-fs-content-and-read-guards.d.ts +20 -0
- package/dist/executors/internal/evaluate-fs-content-and-read-guards.d.ts.map +1 -0
- package/dist/executors/internal/evaluate-fs-content-and-read-guards.js +46 -0
- package/dist/executors/internal/evaluate-fs-content-and-read-guards.js.map +1 -0
- package/dist/executors/internal/evaluate-fs-write-and-boundary-guards.d.ts +31 -0
- package/dist/executors/internal/evaluate-fs-write-and-boundary-guards.d.ts.map +1 -0
- package/dist/executors/internal/evaluate-fs-write-and-boundary-guards.js +100 -0
- package/dist/executors/internal/evaluate-fs-write-and-boundary-guards.js.map +1 -0
- package/dist/executors/internal/execute-fs-edit-operation.d.ts +26 -0
- package/dist/executors/internal/execute-fs-edit-operation.d.ts.map +1 -0
- package/dist/executors/internal/execute-fs-edit-operation.js +25 -0
- package/dist/executors/internal/execute-fs-edit-operation.js.map +1 -0
- package/dist/executors/internal/execute-fs-write-operation.d.ts +22 -0
- package/dist/executors/internal/execute-fs-write-operation.d.ts.map +1 -0
- package/dist/executors/internal/execute-fs-write-operation.js +21 -0
- package/dist/executors/internal/execute-fs-write-operation.js.map +1 -0
- package/dist/executors/internal/extract-worktree-root-and-base-ref.d.ts +15 -0
- package/dist/executors/internal/extract-worktree-root-and-base-ref.d.ts.map +1 -0
- package/dist/executors/internal/extract-worktree-root-and-base-ref.js +24 -0
- package/dist/executors/internal/extract-worktree-root-and-base-ref.js.map +1 -0
- package/dist/executors/internal/filter-jailed-dirents.d.ts +25 -0
- package/dist/executors/internal/filter-jailed-dirents.d.ts.map +1 -0
- package/dist/executors/internal/filter-jailed-dirents.js +54 -0
- package/dist/executors/internal/filter-jailed-dirents.js.map +1 -0
- package/dist/executors/internal/fs-coding-tool-drivers.d.ts +38 -0
- package/dist/executors/internal/fs-coding-tool-drivers.d.ts.map +1 -0
- package/dist/executors/internal/fs-coding-tool-drivers.js +52 -0
- package/dist/executors/internal/fs-coding-tool-drivers.js.map +1 -0
- package/dist/executors/internal/fs-search-tool-drivers.d.ts +26 -0
- package/dist/executors/internal/fs-search-tool-drivers.d.ts.map +1 -0
- package/dist/executors/internal/fs-search-tool-drivers.js +37 -0
- package/dist/executors/internal/fs-search-tool-drivers.js.map +1 -0
- package/dist/executors/internal/glob-matcher-cache.constants.d.ts +20 -0
- package/dist/executors/internal/glob-matcher-cache.constants.d.ts.map +1 -0
- package/dist/executors/internal/glob-matcher-cache.constants.js +19 -0
- package/dist/executors/internal/glob-matcher-cache.constants.js.map +1 -0
- package/dist/executors/internal/grep-workspace-files.d.ts +23 -0
- package/dist/executors/internal/grep-workspace-files.d.ts.map +1 -0
- package/dist/executors/internal/grep-workspace-files.js +33 -0
- package/dist/executors/internal/grep-workspace-files.js.map +1 -0
- package/dist/executors/internal/project-violated-write-effects.d.ts +15 -0
- package/dist/executors/internal/project-violated-write-effects.d.ts.map +1 -0
- package/dist/executors/internal/project-violated-write-effects.js +67 -0
- package/dist/executors/internal/project-violated-write-effects.js.map +1 -0
- package/dist/executors/internal/resolve-jailed-worktree-path.d.ts +19 -0
- package/dist/executors/internal/resolve-jailed-worktree-path.d.ts.map +1 -0
- package/dist/executors/internal/resolve-jailed-worktree-path.js +101 -0
- package/dist/executors/internal/resolve-jailed-worktree-path.js.map +1 -0
- package/dist/executors/internal/secret-patterns.constants.d.ts +16 -0
- package/dist/executors/internal/secret-patterns.constants.d.ts.map +1 -0
- package/dist/executors/internal/secret-patterns.constants.js +30 -0
- package/dist/executors/internal/secret-patterns.constants.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/stores/fs-jsonl-lesson-store.d.ts +135 -0
- package/dist/stores/fs-jsonl-lesson-store.d.ts.map +1 -0
- package/dist/stores/fs-jsonl-lesson-store.js +155 -0
- package/dist/stores/fs-jsonl-lesson-store.js.map +1 -0
- package/dist/stores/internal/fs-jsonl-lesson-file-io.d.ts +129 -0
- package/dist/stores/internal/fs-jsonl-lesson-file-io.d.ts.map +1 -0
- package/dist/stores/internal/fs-jsonl-lesson-file-io.js +197 -0
- package/dist/stores/internal/fs-jsonl-lesson-file-io.js.map +1 -0
- package/dist/stores/internal/fs-lesson-definition-record.d.ts +19 -0
- package/dist/stores/internal/fs-lesson-definition-record.d.ts.map +1 -0
- package/dist/stores/internal/fs-lesson-definition-record.js +2 -0
- package/dist/stores/internal/fs-lesson-definition-record.js.map +1 -0
- package/dist/stores/internal/fs-lesson-lock-and-atomic-io.d.ts +51 -0
- package/dist/stores/internal/fs-lesson-lock-and-atomic-io.d.ts.map +1 -0
- package/dist/stores/internal/fs-lesson-lock-and-atomic-io.js +89 -0
- package/dist/stores/internal/fs-lesson-lock-and-atomic-io.js.map +1 -0
- package/dist/stores/internal/fs-lesson-relevance.d.ts +49 -0
- package/dist/stores/internal/fs-lesson-relevance.d.ts.map +1 -0
- package/dist/stores/internal/fs-lesson-relevance.js +113 -0
- package/dist/stores/internal/fs-lesson-relevance.js.map +1 -0
- package/dist/stores/internal/fs-lesson-stats-entry.d.ts +22 -0
- package/dist/stores/internal/fs-lesson-stats-entry.d.ts.map +1 -0
- package/dist/stores/internal/fs-lesson-stats-entry.js +2 -0
- package/dist/stores/internal/fs-lesson-stats-entry.js.map +1 -0
- package/package.json +72 -3
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { enumerateWorkspaceFiles } from './internal/enumerate-workspace-files.js';
|
|
4
|
+
import { extractWorktreeRootAndBaseRef } from './internal/extract-worktree-root-and-base-ref.js';
|
|
5
|
+
import { resolveJailedWorktreePath } from './internal/resolve-jailed-worktree-path.js';
|
|
6
|
+
/**
|
|
7
|
+
* Loads UTF-8 text and computes a SHA-256 hex digest for an `FsTextSourceNode` (`fs:text-source`).
|
|
8
|
+
*
|
|
9
|
+
* Resolves `node.path` against the immutable host repository root when `ctx.scopeHandle` is
|
|
10
|
+
* omitted, or against `ctx.scopeHandle.worktreePath` when computing in-run grounding diffs (`SPEC.md` §4.3).
|
|
11
|
+
*
|
|
12
|
+
* @param {FsTextSourceNode} node - Passive text source AST node.
|
|
13
|
+
* @param {void} _input - Unused source executor input parameter.
|
|
14
|
+
* @param {ResolutionContext} ctx - Source resolution context with optional `scopeHandle`.
|
|
15
|
+
*
|
|
16
|
+
* @returns {Promise<ResolvedSourceArtifact<string>>} UTF-8 file text paired with its SHA-256 digest.
|
|
17
|
+
*/
|
|
18
|
+
export async function executeFsTextSource(node, _input, ctx) {
|
|
19
|
+
const { absolutePath } = resolveJailedWorktreePath(ctx.scopeHandle, node.path, 'read');
|
|
20
|
+
const content = await readFile(absolutePath, 'utf8');
|
|
21
|
+
const digest = createHash('sha256').update(content, 'utf8').digest('hex');
|
|
22
|
+
return Object.freeze({
|
|
23
|
+
content,
|
|
24
|
+
digest,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Loads all UTF-8 files matching `node.pattern` in lexicographical order for an `FsGlobSourceNode` (`fs:glob-source`).
|
|
29
|
+
*
|
|
30
|
+
* Resolves against the host repository root when `ctx.scopeHandle` is omitted, or against
|
|
31
|
+
* `ctx.scopeHandle.worktreePath` when computing in-run grounding diffs (`SPEC.md` §4.3).
|
|
32
|
+
*
|
|
33
|
+
* @param {FsGlobSourceNode} node - Passive glob source AST node.
|
|
34
|
+
* @param {void} _input - Unused source executor input parameter.
|
|
35
|
+
* @param {ResolutionContext} ctx - Source resolution context with optional `scopeHandle`.
|
|
36
|
+
*
|
|
37
|
+
* @returns {Promise<ResolvedSourceArtifact<ReadonlyArray<{ readonly path: string; readonly content: string }>>>} Matched `{ path, content }` records paired with their combined SHA-256 digest.
|
|
38
|
+
*/
|
|
39
|
+
export async function executeFsGlobSource(node, _input, ctx) {
|
|
40
|
+
const { rootPath } = extractWorktreeRootAndBaseRef(ctx.scopeHandle);
|
|
41
|
+
const matchedRelPaths = await enumerateWorkspaceFiles(rootPath, node.pattern);
|
|
42
|
+
const entries = [];
|
|
43
|
+
const hash = createHash('sha256');
|
|
44
|
+
for (const relPath of matchedRelPaths) {
|
|
45
|
+
const { absolutePath } = resolveJailedWorktreePath(ctx.scopeHandle, relPath, 'read');
|
|
46
|
+
const content = await readFile(absolutePath, 'utf8');
|
|
47
|
+
entries.push(Object.freeze({ path: relPath, content }));
|
|
48
|
+
hash.update(`${relPath}\0${content}\0`, 'utf8');
|
|
49
|
+
}
|
|
50
|
+
return Object.freeze({
|
|
51
|
+
content: Object.freeze(entries),
|
|
52
|
+
digest: hash.digest('hex'),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=fs-source-executors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-source-executors.js","sourceRoot":"","sources":["../../src/executors/fs-source-executors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAO5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAEvF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,IAAsB,EACtB,MAAY,EACZ,GAAsB;IAEtB,MAAM,EAAE,YAAY,EAAE,GAAG,yBAAyB,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACvF,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1E,OAAO,MAAM,CAAC,MAAM,CAAiC;QACnD,OAAO;QACP,MAAM;KACP,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,IAAsB,EACtB,MAAY,EACZ,GAAsB;IAItB,MAAM,EAAE,QAAQ,EAAE,GAAG,6BAA6B,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACpE,MAAM,eAAe,GAAG,MAAM,uBAAuB,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9E,MAAM,OAAO,GAA+D,EAAE,CAAC;IAC/E,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClC,KAAK,MAAM,OAAO,IAAI,eAAe,EAAE,CAAC;QACtC,MAAM,EAAE,YAAY,EAAE,GAAG,yBAAyB,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACrF,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QACrD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,KAAK,OAAO,IAAI,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;QAC/B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;KAC3B,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ToolEffect } from '@paraharness/core';
|
|
2
|
+
/**
|
|
3
|
+
* Structured filesystem attributes attached to an `FsToolEffect` descriptor.
|
|
4
|
+
*
|
|
5
|
+
* Captures the access mode (`'read' | 'write'`), canonicalized worktree-relative POSIX
|
|
6
|
+
* file paths, base-ref path existence (`existingPathsAtBaseRef`), and post-edit UTF-8
|
|
7
|
+
* contents (`proposedContent`).
|
|
8
|
+
*/
|
|
9
|
+
export interface FsToolEffectAttributes extends Readonly<Record<string, unknown>> {
|
|
10
|
+
/** Filesystem access mode (`'read'` for non-mutating reads/searches, `'write'` for edits/writes). */
|
|
11
|
+
readonly mode: 'read' | 'write';
|
|
12
|
+
/** Canonicalized worktree-relative POSIX file paths touched by the tool invocation. */
|
|
13
|
+
readonly paths: readonly string[];
|
|
14
|
+
/** Subset of `paths` that already existed at `scopeHandle.baseRef` prior to mutation. */
|
|
15
|
+
readonly existingPathsAtBaseRef?: readonly string[];
|
|
16
|
+
/** Proposed post-mutation UTF-8 file text keyed by normalized worktree-relative path. */
|
|
17
|
+
readonly proposedContent?: Readonly<Record<string, string>>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Domain-specific `ToolEffect` emitted by `@paraharness/fs` tools and workspace diffs (`SPEC.md` §4.3).
|
|
21
|
+
*
|
|
22
|
+
* Sets `kind: 'fs:effect'` and `mutatesScope: true` on write mutations so `ScopeLockManager`,
|
|
23
|
+
* policy guards, quota tripwires, and telemetry collectors can inspect filesystem operations.
|
|
24
|
+
*/
|
|
25
|
+
export interface FsToolEffect extends ToolEffect {
|
|
26
|
+
/** Discriminant identifying a filesystem tool effect. */
|
|
27
|
+
readonly kind: 'fs:effect';
|
|
28
|
+
/** True when `attributes.mode === 'write'`, acquiring an exclusive scope write lock. */
|
|
29
|
+
readonly mutatesScope: boolean;
|
|
30
|
+
/** Structured filesystem effect attributes. */
|
|
31
|
+
readonly attributes: FsToolEffectAttributes;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=fs-tool-effect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-tool-effect.d.ts","sourceRoot":"","sources":["../../src/executors/fs-tool-effect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,WAAW,sBAAuB,SAAQ,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/E,qGAAqG;IACrG,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,uFAAuF;IACvF,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,yFAAyF;IACzF,QAAQ,CAAC,sBAAsB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpD,yFAAyF;IACzF,QAAQ,CAAC,eAAe,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC7D;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,wFAAwF;IACxF,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,+CAA+C;IAC/C,QAAQ,CAAC,UAAU,EAAE,sBAAsB,CAAC;CAC7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-tool-effect.js","sourceRoot":"","sources":["../../src/executors/fs-tool-effect.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { FsRequireReadBeforeWriteGuardNode, FsScopedWriteGuardNode, FsSecretLiteralsGuardNode, FsWriteGuardNode, PolicyGuardEvaluationInput, PolicyGuardEvaluationResult, StepExecutionContext } from '@paraharness/core';
|
|
2
|
+
/**
|
|
3
|
+
* Evaluates an `FsWriteGuardNode` (`fs:write-guard`) against proposed tool effects (`SPEC.md` §3.5 & §4.3).
|
|
4
|
+
*
|
|
5
|
+
* Blocks paths matching `node.denyGlobs` unless exempted by `node.allowGlobs` or `input.activeLeases`,
|
|
6
|
+
* and when `onlyExistingAtBaseRef: true` is configured, restricts denials strictly to files present
|
|
7
|
+
* in `existingPathsAtBaseRef`.
|
|
8
|
+
*
|
|
9
|
+
* @param {FsWriteGuardNode} node - Write guard AST node.
|
|
10
|
+
* @param {PolicyGuardEvaluationInput} input - Tool name, proposed effects, and active leases.
|
|
11
|
+
* @param {StepExecutionContext<unknown>} ctx - Step execution context.
|
|
12
|
+
*
|
|
13
|
+
* @returns {PolicyGuardEvaluationResult} Guard evaluation result and projected `violatedEffects`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function evaluateFsWriteGuard(node: FsWriteGuardNode, input: PolicyGuardEvaluationInput, ctx: StepExecutionContext<unknown>): PolicyGuardEvaluationResult;
|
|
16
|
+
/**
|
|
17
|
+
* Evaluates an `FsRequireReadBeforeWriteGuardNode` (`fs:require-read-before-write`) (`SPEC.md` §4.3).
|
|
18
|
+
*
|
|
19
|
+
* Rejects mutating any file that existed at `baseRef` unless `ctx.observedEffects` contains a prior
|
|
20
|
+
* read effect for that path in the current session.
|
|
21
|
+
*
|
|
22
|
+
* @param {FsRequireReadBeforeWriteGuardNode} _node - Read-before-write guard AST node.
|
|
23
|
+
* @param {PolicyGuardEvaluationInput} input - Tool name, proposed effects, and active leases.
|
|
24
|
+
* @param {StepExecutionContext<unknown>} ctx - Step execution context providing `observedEffects`.
|
|
25
|
+
*
|
|
26
|
+
* @returns {PolicyGuardEvaluationResult} Guard evaluation result and projected `violatedEffects`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function evaluateFsRequireReadBeforeWriteGuard(_node: FsRequireReadBeforeWriteGuardNode, input: PolicyGuardEvaluationInput, ctx: StepExecutionContext<unknown>): PolicyGuardEvaluationResult;
|
|
29
|
+
/**
|
|
30
|
+
* Evaluates an `FsScopedWriteGuardNode` (`fs:scoped-write`) against `ctx.activePartitions` (`SPEC.md` §4.3).
|
|
31
|
+
*
|
|
32
|
+
* Rejects write mutations to any file path outside the union of member `globs` for the actor's
|
|
33
|
+
* `activePartitions` in `node.partitionMap`.
|
|
34
|
+
*
|
|
35
|
+
* @param {FsScopedWriteGuardNode} node - Scoped write guard AST node.
|
|
36
|
+
* @param {PolicyGuardEvaluationInput} input - Tool name, proposed effects, and active leases.
|
|
37
|
+
* @param {StepExecutionContext<unknown>} ctx - Step execution context providing `activePartitions`.
|
|
38
|
+
*
|
|
39
|
+
* @returns {PolicyGuardEvaluationResult} Guard evaluation result and projected `violatedEffects`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function evaluateFsScopedWriteGuard(node: FsScopedWriteGuardNode, input: PolicyGuardEvaluationInput, ctx: StepExecutionContext<unknown>): PolicyGuardEvaluationResult;
|
|
42
|
+
/**
|
|
43
|
+
* Evaluates an `FsSecretLiteralsGuardNode` (`fs:secret-literals`) against `proposedContent` (`SPEC.md` §4.3).
|
|
44
|
+
*
|
|
45
|
+
* Scans proposed post-mutation file contents against built-in and custom secret regular expressions
|
|
46
|
+
* and blocks writes containing secret literals.
|
|
47
|
+
*
|
|
48
|
+
* @param {FsSecretLiteralsGuardNode} node - Secret literals guard AST node.
|
|
49
|
+
* @param {PolicyGuardEvaluationInput} input - Tool name, proposed effects, and active leases.
|
|
50
|
+
* @param {StepExecutionContext<unknown>} _ctx - Step execution context.
|
|
51
|
+
*
|
|
52
|
+
* @returns {PolicyGuardEvaluationResult} Guard evaluation result and projected `violatedEffects`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function evaluateFsSecretLiteralsGuard(node: FsSecretLiteralsGuardNode, input: PolicyGuardEvaluationInput, _ctx: StepExecutionContext<unknown>): PolicyGuardEvaluationResult;
|
|
55
|
+
//# sourceMappingURL=fs-write-guard-executors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-write-guard-executors.d.ts","sourceRoot":"","sources":["../../src/executors/fs-write-guard-executors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iCAAiC,EACjC,sBAAsB,EACtB,yBAAyB,EACzB,gBAAgB,EAChB,0BAA0B,EAC1B,2BAA2B,EAC3B,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAU3B;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,0BAA0B,EACjC,GAAG,EAAE,oBAAoB,CAAC,OAAO,CAAC,GACjC,2BAA2B,CAE7B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qCAAqC,CACnD,KAAK,EAAE,iCAAiC,EACxC,KAAK,EAAE,0BAA0B,EACjC,GAAG,EAAE,oBAAoB,CAAC,OAAO,CAAC,GACjC,2BAA2B,CAE7B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,sBAAsB,EAC5B,KAAK,EAAE,0BAA0B,EACjC,GAAG,EAAE,oBAAoB,CAAC,OAAO,CAAC,GACjC,2BAA2B,CAE7B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,yBAAyB,EAC/B,KAAK,EAAE,0BAA0B,EACjC,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAClC,2BAA2B,CAE7B"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { evaluateFsReadBeforeWritePaths, evaluateFsSecretLiteralPaths, } from './internal/evaluate-fs-content-and-read-guards.js';
|
|
2
|
+
import { evaluateFsScopedWritePaths, evaluateFsWriteGuardPaths, } from './internal/evaluate-fs-write-and-boundary-guards.js';
|
|
3
|
+
/**
|
|
4
|
+
* Evaluates an `FsWriteGuardNode` (`fs:write-guard`) against proposed tool effects (`SPEC.md` §3.5 & §4.3).
|
|
5
|
+
*
|
|
6
|
+
* Blocks paths matching `node.denyGlobs` unless exempted by `node.allowGlobs` or `input.activeLeases`,
|
|
7
|
+
* and when `onlyExistingAtBaseRef: true` is configured, restricts denials strictly to files present
|
|
8
|
+
* in `existingPathsAtBaseRef`.
|
|
9
|
+
*
|
|
10
|
+
* @param {FsWriteGuardNode} node - Write guard AST node.
|
|
11
|
+
* @param {PolicyGuardEvaluationInput} input - Tool name, proposed effects, and active leases.
|
|
12
|
+
* @param {StepExecutionContext<unknown>} ctx - Step execution context.
|
|
13
|
+
*
|
|
14
|
+
* @returns {PolicyGuardEvaluationResult} Guard evaluation result and projected `violatedEffects`.
|
|
15
|
+
*/
|
|
16
|
+
export function evaluateFsWriteGuard(node, input, ctx) {
|
|
17
|
+
return evaluateFsWriteGuardPaths(node, input, ctx);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Evaluates an `FsRequireReadBeforeWriteGuardNode` (`fs:require-read-before-write`) (`SPEC.md` §4.3).
|
|
21
|
+
*
|
|
22
|
+
* Rejects mutating any file that existed at `baseRef` unless `ctx.observedEffects` contains a prior
|
|
23
|
+
* read effect for that path in the current session.
|
|
24
|
+
*
|
|
25
|
+
* @param {FsRequireReadBeforeWriteGuardNode} _node - Read-before-write guard AST node.
|
|
26
|
+
* @param {PolicyGuardEvaluationInput} input - Tool name, proposed effects, and active leases.
|
|
27
|
+
* @param {StepExecutionContext<unknown>} ctx - Step execution context providing `observedEffects`.
|
|
28
|
+
*
|
|
29
|
+
* @returns {PolicyGuardEvaluationResult} Guard evaluation result and projected `violatedEffects`.
|
|
30
|
+
*/
|
|
31
|
+
export function evaluateFsRequireReadBeforeWriteGuard(_node, input, ctx) {
|
|
32
|
+
return evaluateFsReadBeforeWritePaths(input, ctx);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Evaluates an `FsScopedWriteGuardNode` (`fs:scoped-write`) against `ctx.activePartitions` (`SPEC.md` §4.3).
|
|
36
|
+
*
|
|
37
|
+
* Rejects write mutations to any file path outside the union of member `globs` for the actor's
|
|
38
|
+
* `activePartitions` in `node.partitionMap`.
|
|
39
|
+
*
|
|
40
|
+
* @param {FsScopedWriteGuardNode} node - Scoped write guard AST node.
|
|
41
|
+
* @param {PolicyGuardEvaluationInput} input - Tool name, proposed effects, and active leases.
|
|
42
|
+
* @param {StepExecutionContext<unknown>} ctx - Step execution context providing `activePartitions`.
|
|
43
|
+
*
|
|
44
|
+
* @returns {PolicyGuardEvaluationResult} Guard evaluation result and projected `violatedEffects`.
|
|
45
|
+
*/
|
|
46
|
+
export function evaluateFsScopedWriteGuard(node, input, ctx) {
|
|
47
|
+
return evaluateFsScopedWritePaths(node, input, ctx);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Evaluates an `FsSecretLiteralsGuardNode` (`fs:secret-literals`) against `proposedContent` (`SPEC.md` §4.3).
|
|
51
|
+
*
|
|
52
|
+
* Scans proposed post-mutation file contents against built-in and custom secret regular expressions
|
|
53
|
+
* and blocks writes containing secret literals.
|
|
54
|
+
*
|
|
55
|
+
* @param {FsSecretLiteralsGuardNode} node - Secret literals guard AST node.
|
|
56
|
+
* @param {PolicyGuardEvaluationInput} input - Tool name, proposed effects, and active leases.
|
|
57
|
+
* @param {StepExecutionContext<unknown>} _ctx - Step execution context.
|
|
58
|
+
*
|
|
59
|
+
* @returns {PolicyGuardEvaluationResult} Guard evaluation result and projected `violatedEffects`.
|
|
60
|
+
*/
|
|
61
|
+
export function evaluateFsSecretLiteralsGuard(node, input, _ctx) {
|
|
62
|
+
return evaluateFsSecretLiteralPaths(node, input);
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=fs-write-guard-executors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-write-guard-executors.js","sourceRoot":"","sources":["../../src/executors/fs-write-guard-executors.ts"],"names":[],"mappings":"AASA,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,qDAAqD,CAAC;AAE7D;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAsB,EACtB,KAAiC,EACjC,GAAkC;IAElC,OAAO,yBAAyB,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AACrD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,qCAAqC,CACnD,KAAwC,EACxC,KAAiC,EACjC,GAAkC;IAElC,OAAO,8BAA8B,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACpD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,0BAA0B,CACxC,IAA4B,EAC5B,KAAiC,EACjC,GAAkC;IAElC,OAAO,0BAA0B,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,6BAA6B,CAC3C,IAA+B,EAC/B,KAAiC,EACjC,IAAmC;IAEnC,OAAO,4BAA4B,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FsEditToolNode, FsWriteToolNode, ToolDriver } from '@paraharness/core';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the workspace-jailed `ToolDriver` for `FsEditToolNode` (`fs:edit` / `edit_file`).
|
|
4
|
+
*
|
|
5
|
+
* Emits synchronous `FsToolEffect` write descriptors (`mutatesScope: true`) populated with
|
|
6
|
+
* `existingPathsAtBaseRef` and `proposedContent`, and replaces `oldString` with `newString`.
|
|
7
|
+
*
|
|
8
|
+
* @template THandle Runtime handle type of the active isolation scope.
|
|
9
|
+
*
|
|
10
|
+
* @returns {ToolDriver<FsEditToolNode<THandle>, THandle>} Frozen `fs:edit` tool driver.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createFsEditToolDriver<THandle = unknown>(): ToolDriver<FsEditToolNode<THandle>, THandle>;
|
|
13
|
+
/**
|
|
14
|
+
* Creates the workspace-jailed `ToolDriver` for `FsWriteToolNode` (`fs:write` / `write_file`).
|
|
15
|
+
*
|
|
16
|
+
* Emits synchronous `FsToolEffect` write descriptors (`mutatesScope: true`) populated with
|
|
17
|
+
* `existingPathsAtBaseRef` and `proposedContent`, and writes UTF-8 text to disk.
|
|
18
|
+
*
|
|
19
|
+
* @template THandle Runtime handle type of the active isolation scope.
|
|
20
|
+
*
|
|
21
|
+
* @returns {ToolDriver<FsWriteToolNode<THandle>, THandle>} Frozen `fs:write` tool driver.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createFsWriteToolDriver<THandle = unknown>(): ToolDriver<FsWriteToolNode<THandle>, THandle>;
|
|
24
|
+
//# sourceMappingURL=fs-write-tool-drivers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-write-tool-drivers.d.ts","sourceRoot":"","sources":["../../src/executors/fs-write-tool-drivers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAEf,UAAU,EAGX,MAAM,mBAAmB,CAAC;AAQ3B;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAG,OAAO,KAAK,UAAU,CACrE,cAAc,CAAC,OAAO,CAAC,EACvB,OAAO,CACR,CASA;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,GAAG,OAAO,KAAK,UAAU,CACtE,eAAe,CAAC,OAAO,CAAC,EACxB,OAAO,CACR,CASA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { describeFsEditEffects } from './internal/describe-fs-edit-effects.js';
|
|
2
|
+
import { describeFsWriteEffects } from './internal/describe-fs-write-effects.js';
|
|
3
|
+
import { editFsToolFile, writeFsToolFile, } from './internal/fs-coding-tool-drivers.js';
|
|
4
|
+
/**
|
|
5
|
+
* Creates the workspace-jailed `ToolDriver` for `FsEditToolNode` (`fs:edit` / `edit_file`).
|
|
6
|
+
*
|
|
7
|
+
* Emits synchronous `FsToolEffect` write descriptors (`mutatesScope: true`) populated with
|
|
8
|
+
* `existingPathsAtBaseRef` and `proposedContent`, and replaces `oldString` with `newString`.
|
|
9
|
+
*
|
|
10
|
+
* @template THandle Runtime handle type of the active isolation scope.
|
|
11
|
+
*
|
|
12
|
+
* @returns {ToolDriver<FsEditToolNode<THandle>, THandle>} Frozen `fs:edit` tool driver.
|
|
13
|
+
*/
|
|
14
|
+
export function createFsEditToolDriver() {
|
|
15
|
+
return Object.freeze({
|
|
16
|
+
describeEffects(_node, args, scopeHandle) {
|
|
17
|
+
return describeFsEditEffects(scopeHandle, args);
|
|
18
|
+
},
|
|
19
|
+
execute(node, args, ctx) {
|
|
20
|
+
return editFsToolFile(node, args, ctx);
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates the workspace-jailed `ToolDriver` for `FsWriteToolNode` (`fs:write` / `write_file`).
|
|
26
|
+
*
|
|
27
|
+
* Emits synchronous `FsToolEffect` write descriptors (`mutatesScope: true`) populated with
|
|
28
|
+
* `existingPathsAtBaseRef` and `proposedContent`, and writes UTF-8 text to disk.
|
|
29
|
+
*
|
|
30
|
+
* @template THandle Runtime handle type of the active isolation scope.
|
|
31
|
+
*
|
|
32
|
+
* @returns {ToolDriver<FsWriteToolNode<THandle>, THandle>} Frozen `fs:write` tool driver.
|
|
33
|
+
*/
|
|
34
|
+
export function createFsWriteToolDriver() {
|
|
35
|
+
return Object.freeze({
|
|
36
|
+
describeEffects(_node, args, scopeHandle) {
|
|
37
|
+
return describeFsWriteEffects(scopeHandle, args);
|
|
38
|
+
},
|
|
39
|
+
execute(node, args, ctx) {
|
|
40
|
+
return writeFsToolFile(node, args, ctx);
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=fs-write-tool-drivers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-write-tool-drivers.js","sourceRoot":"","sources":["../../src/executors/fs-write-tool-drivers.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EACL,cAAc,EACd,eAAe,GAChB,MAAM,sCAAsC,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,UAAU,sBAAsB;IAIpC,OAAO,MAAM,CAAC,MAAM,CAA+C;QACjE,eAAe,CAAC,KAA8B,EAAE,IAAa,EAAE,WAAoB;YACjF,OAAO,qBAAqB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,CAAC,IAA6B,EAAE,IAAa,EAAE,GAAkC;YACtF,OAAO,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QACzC,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,uBAAuB;IAIrC,OAAO,MAAM,CAAC,MAAM,CAAgD;QAClE,eAAe,CAAC,KAA+B,EAAE,IAAa,EAAE,WAAoB;YAClF,OAAO,sBAAsB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,CAAC,IAA8B,EAAE,IAAa,EAAE,GAAkC;YACvF,OAAO,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QAC1C,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolEffect } from '@paraharness/core';
|
|
2
|
+
/**
|
|
3
|
+
* Adds normalized mutated file paths from `observedEffects` (`mutatesScope === true` or `mode === 'write'`) into `mutated`.
|
|
4
|
+
*
|
|
5
|
+
* @param {readonly ToolEffect[]} observedEffects - Tool effects recorded in `StepExecutionContext`.
|
|
6
|
+
* @param {Set<string>} mutated - Mutable set of normalized POSIX paths to populate.
|
|
7
|
+
*/
|
|
8
|
+
export declare function addMutatedPathsFromEffects(observedEffects: readonly ToolEffect[], mutated: Set<string>): void;
|
|
9
|
+
//# sourceMappingURL=add-mutated-paths-from-effects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-mutated-paths-from-effects.d.ts","sourceRoot":"","sources":["../../../src/executors/internal/add-mutated-paths-from-effects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,SAAS,UAAU,EAAE,EACtC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,GACnB,IAAI,CAaN"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds normalized mutated file paths from `observedEffects` (`mutatesScope === true` or `mode === 'write'`) into `mutated`.
|
|
3
|
+
*
|
|
4
|
+
* @param {readonly ToolEffect[]} observedEffects - Tool effects recorded in `StepExecutionContext`.
|
|
5
|
+
* @param {Set<string>} mutated - Mutable set of normalized POSIX paths to populate.
|
|
6
|
+
*/
|
|
7
|
+
export function addMutatedPathsFromEffects(observedEffects, mutated) {
|
|
8
|
+
for (const eff of observedEffects) {
|
|
9
|
+
if (eff.kind !== 'fs:effect')
|
|
10
|
+
continue;
|
|
11
|
+
const mode = eff.attributes?.['mode'];
|
|
12
|
+
if (eff.mutatesScope !== true && mode !== 'write')
|
|
13
|
+
continue;
|
|
14
|
+
const paths = eff.attributes?.['paths'];
|
|
15
|
+
if (!Array.isArray(paths))
|
|
16
|
+
continue;
|
|
17
|
+
for (const relPath of paths) {
|
|
18
|
+
if (typeof relPath === 'string') {
|
|
19
|
+
mutated.add(relPath.replace(/\\/g, '/').replace(/^\.\//, ''));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=add-mutated-paths-from-effects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-mutated-paths-from-effects.js","sourceRoot":"","sources":["../../../src/executors/internal/add-mutated-paths-from-effects.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,eAAsC,EACtC,OAAoB;IAEpB,KAAK,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QAClC,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW;YAAE,SAAS;QACvC,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,GAAG,CAAC,YAAY,KAAK,IAAI,IAAI,IAAI,KAAK,OAAO;YAAE,SAAS;QAC5D,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,SAAS;QACpC,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE,CAAC;YAC5B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;gBAChC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;YAChE,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks which paths in `relPaths` existed at `scopeHandle.baseRef` via `git cat-file -e <baseRef>:<path>`.
|
|
3
|
+
*
|
|
4
|
+
* Falls back to checking workspace file existence when `scopeHandle` does not specify a `baseRef`.
|
|
5
|
+
*
|
|
6
|
+
* @param {unknown} scopeHandle - Active isolation scope handle.
|
|
7
|
+
* @param {readonly string[]} relPaths - Normalized worktree-relative POSIX file paths.
|
|
8
|
+
*
|
|
9
|
+
* @returns {readonly string[]} Subset of `relPaths` that existed at `baseRef`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function checkPathsExistAtBaseRef(scopeHandle: unknown, relPaths: readonly string[]): readonly string[];
|
|
12
|
+
//# sourceMappingURL=check-paths-exist-at-base-ref.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-paths-exist-at-base-ref.d.ts","sourceRoot":"","sources":["../../../src/executors/internal/check-paths-exist-at-base-ref.ts"],"names":[],"mappings":"AAyCA;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,OAAO,EACpB,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC1B,SAAS,MAAM,EAAE,CAYnB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { extractWorktreeRootAndBaseRef } from './extract-worktree-root-and-base-ref.js';
|
|
5
|
+
/**
|
|
6
|
+
* Tests whether a single normalized relative file path existed at `gitBaseRef` inside `rootPath`.
|
|
7
|
+
*
|
|
8
|
+
* Invokes `git cat-file -e <gitBaseRef>:<path>` when `gitBaseRef` is defined,
|
|
9
|
+
* falling back to `existsSync` on disk when no git `baseRef` is active.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} rootPath - Worktree or repository root directory path.
|
|
12
|
+
* @param {string | undefined} gitBaseRef - Verified git base commit ref, or `undefined` when git metadata or `baseRef` is absent.
|
|
13
|
+
* @param {string} normalizedPath - Normalized POSIX relative file path.
|
|
14
|
+
*
|
|
15
|
+
* @returns {boolean} True when `normalizedPath` existed at `gitBaseRef`.
|
|
16
|
+
*/
|
|
17
|
+
function doesSinglePathExistAtBaseRef(rootPath, gitBaseRef, normalizedPath) {
|
|
18
|
+
if (gitBaseRef === undefined) {
|
|
19
|
+
return existsSync(path.resolve(rootPath, normalizedPath));
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
execFileSync('git', ['cat-file', '-e', `${gitBaseRef}:${normalizedPath}`], {
|
|
23
|
+
cwd: rootPath,
|
|
24
|
+
stdio: 'ignore',
|
|
25
|
+
env: {
|
|
26
|
+
...process.env,
|
|
27
|
+
GIT_OPTIONAL_LOCKS: '0',
|
|
28
|
+
GIT_CEILING_DIRECTORIES: path.dirname(rootPath),
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Checks which paths in `relPaths` existed at `scopeHandle.baseRef` via `git cat-file -e <baseRef>:<path>`.
|
|
39
|
+
*
|
|
40
|
+
* Falls back to checking workspace file existence when `scopeHandle` does not specify a `baseRef`.
|
|
41
|
+
*
|
|
42
|
+
* @param {unknown} scopeHandle - Active isolation scope handle.
|
|
43
|
+
* @param {readonly string[]} relPaths - Normalized worktree-relative POSIX file paths.
|
|
44
|
+
*
|
|
45
|
+
* @returns {readonly string[]} Subset of `relPaths` that existed at `baseRef`.
|
|
46
|
+
*/
|
|
47
|
+
export function checkPathsExistAtBaseRef(scopeHandle, relPaths) {
|
|
48
|
+
const { rootPath, baseRef } = extractWorktreeRootAndBaseRef(scopeHandle);
|
|
49
|
+
const gitBaseRef = baseRef !== undefined && existsSync(path.join(rootPath, '.git')) ? baseRef : undefined;
|
|
50
|
+
const existing = [];
|
|
51
|
+
for (const relPath of relPaths) {
|
|
52
|
+
const normalizedPath = relPath.replace(/\\/g, '/').replace(/^\.\//, '');
|
|
53
|
+
if (doesSinglePathExistAtBaseRef(rootPath, gitBaseRef, normalizedPath)) {
|
|
54
|
+
existing.push(normalizedPath);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return Object.freeze(existing);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=check-paths-exist-at-base-ref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-paths-exist-at-base-ref.js","sourceRoot":"","sources":["../../../src/executors/internal/check-paths-exist-at-base-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AAExF;;;;;;;;;;;GAWG;AACH,SAAS,4BAA4B,CACnC,QAAgB,EAChB,UAA8B,EAC9B,cAAsB;IAEtB,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC;IAC5D,CAAC;IACD,IAAI,CAAC;QACH,YAAY,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,GAAG,UAAU,IAAI,cAAc,EAAE,CAAC,EAAE;YACzE,GAAG,EAAE,QAAQ;YACb,KAAK,EAAE,QAAQ;YACf,GAAG,EAAE;gBACH,GAAG,OAAO,CAAC,GAAG;gBACd,kBAAkB,EAAE,GAAG;gBACvB,uBAAuB,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;aAChD;SACF,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CACtC,WAAoB,EACpB,QAA2B;IAE3B,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,6BAA6B,CAAC,WAAW,CAAC,CAAC;IACzE,MAAM,UAAU,GACd,OAAO,KAAK,SAAS,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IACzF,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACxE,IAAI,4BAA4B,CAAC,QAAQ,EAAE,UAAU,EAAE,cAAc,CAAC,EAAE,CAAC;YACvE,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ToolEffect } from '@paraharness/core';
|
|
2
|
+
/**
|
|
3
|
+
* Collects distinct mutated file paths from `observedEffects` and git working-tree changes since `baseRef`.
|
|
4
|
+
*
|
|
5
|
+
* Ensures `fs.regexCheck` inspects only files mutated during the session or since `scopeHandle.baseRef` (`SPEC.md` §4.3).
|
|
6
|
+
*
|
|
7
|
+
* @param {readonly ToolEffect[]} observedEffects - Tool effects recorded in `StepExecutionContext`.
|
|
8
|
+
* @param {unknown} scopeHandle - Active isolation scope handle.
|
|
9
|
+
*
|
|
10
|
+
* @returns {readonly string[]} Sorted frozen array of distinct mutated worktree-relative POSIX paths.
|
|
11
|
+
*/
|
|
12
|
+
export declare function collectMutatedPathsSinceBaseRef(observedEffects: readonly ToolEffect[], scopeHandle: unknown): readonly string[];
|
|
13
|
+
//# sourceMappingURL=collect-mutated-paths-since-base-ref.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect-mutated-paths-since-base-ref.d.ts","sourceRoot":"","sources":["../../../src/executors/internal/collect-mutated-paths-since-base-ref.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAIpD;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAC7C,eAAe,EAAE,SAAS,UAAU,EAAE,EACtC,WAAW,EAAE,OAAO,GACnB,SAAS,MAAM,EAAE,CAuBnB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { addMutatedPathsFromEffects } from './add-mutated-paths-from-effects.js';
|
|
5
|
+
import { extractWorktreeRootAndBaseRef } from './extract-worktree-root-and-base-ref.js';
|
|
6
|
+
/**
|
|
7
|
+
* Collects distinct mutated file paths from `observedEffects` and git working-tree changes since `baseRef`.
|
|
8
|
+
*
|
|
9
|
+
* Ensures `fs.regexCheck` inspects only files mutated during the session or since `scopeHandle.baseRef` (`SPEC.md` §4.3).
|
|
10
|
+
*
|
|
11
|
+
* @param {readonly ToolEffect[]} observedEffects - Tool effects recorded in `StepExecutionContext`.
|
|
12
|
+
* @param {unknown} scopeHandle - Active isolation scope handle.
|
|
13
|
+
*
|
|
14
|
+
* @returns {readonly string[]} Sorted frozen array of distinct mutated worktree-relative POSIX paths.
|
|
15
|
+
*/
|
|
16
|
+
export function collectMutatedPathsSinceBaseRef(observedEffects, scopeHandle) {
|
|
17
|
+
const mutated = new Set();
|
|
18
|
+
addMutatedPathsFromEffects(observedEffects, mutated);
|
|
19
|
+
const { rootPath, baseRef } = extractWorktreeRootAndBaseRef(scopeHandle);
|
|
20
|
+
let gitOutput = '';
|
|
21
|
+
if (baseRef !== undefined && existsSync(path.join(rootPath, '.git'))) {
|
|
22
|
+
try {
|
|
23
|
+
const gitEnv = {
|
|
24
|
+
...process.env,
|
|
25
|
+
GIT_OPTIONAL_LOCKS: '0',
|
|
26
|
+
GIT_CEILING_DIRECTORIES: path.dirname(rootPath),
|
|
27
|
+
};
|
|
28
|
+
const gitOpts = { cwd: rootPath, encoding: 'utf8', stdio: 'pipe', env: gitEnv };
|
|
29
|
+
gitOutput = `${execFileSync('git', ['diff', '--name-only', baseRef], gitOpts)}\n${execFileSync('git', ['ls-files', '--others', '--exclude-standard'], gitOpts)}`;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
gitOutput = '';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
for (const line of gitOutput.split(/\r?\n/)) {
|
|
36
|
+
const trimmed = line.trim();
|
|
37
|
+
if (trimmed.length > 0)
|
|
38
|
+
mutated.add(trimmed.replace(/\\/g, '/').replace(/^\.\//, ''));
|
|
39
|
+
}
|
|
40
|
+
return Object.freeze([...mutated].sort((a, b) => a.localeCompare(b)));
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=collect-mutated-paths-since-base-ref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect-mutated-paths-since-base-ref.js","sourceRoot":"","sources":["../../../src/executors/internal/collect-mutated-paths-since-base-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AAExF;;;;;;;;;GASG;AACH,MAAM,UAAU,+BAA+B,CAC7C,eAAsC,EACtC,WAAoB;IAEpB,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,0BAA0B,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IACrD,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,6BAA6B,CAAC,WAAW,CAAC,CAAC;IACzE,IAAI,SAAS,GAAG,EAAE,CAAC;IACnB,IAAI,OAAO,KAAK,SAAS,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;QACrE,IAAI,CAAC;YACH,MAAM,MAAM,GAAG;gBACb,GAAG,OAAO,CAAC,GAAG;gBACd,kBAAkB,EAAE,GAAG;gBACvB,uBAAuB,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;aAChD,CAAC;YACF,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAe,EAAE,KAAK,EAAE,MAAe,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;YAClG,SAAS,GAAG,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,KAAK,YAAY,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC;QACnK,CAAC;QAAC,MAAM,CAAC;YACP,SAAS,GAAG,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IACxF,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ToolEffect } from '@paraharness/core';
|
|
2
|
+
/**
|
|
3
|
+
* Collects the set of normalized file paths read across `observedEffects` (`mode === 'read'`).
|
|
4
|
+
*
|
|
5
|
+
* Used by `fs:require-read-before-write` to verify prior read access in the session.
|
|
6
|
+
*
|
|
7
|
+
* @param {readonly ToolEffect[]} observedEffects - Previously observed tool effects in the session.
|
|
8
|
+
*
|
|
9
|
+
* @returns {ReadonlySet<string>} Set of normalized POSIX paths read so far.
|
|
10
|
+
*/
|
|
11
|
+
export declare function collectReadPathsFromEffects(observedEffects: readonly ToolEffect[]): ReadonlySet<string>;
|
|
12
|
+
//# sourceMappingURL=collect-read-paths-from-effects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect-read-paths-from-effects.d.ts","sourceRoot":"","sources":["../../../src/executors/internal/collect-read-paths-from-effects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,eAAe,EAAE,SAAS,UAAU,EAAE,GACrC,WAAW,CAAC,MAAM,CAAC,CAarB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collects the set of normalized file paths read across `observedEffects` (`mode === 'read'`).
|
|
3
|
+
*
|
|
4
|
+
* Used by `fs:require-read-before-write` to verify prior read access in the session.
|
|
5
|
+
*
|
|
6
|
+
* @param {readonly ToolEffect[]} observedEffects - Previously observed tool effects in the session.
|
|
7
|
+
*
|
|
8
|
+
* @returns {ReadonlySet<string>} Set of normalized POSIX paths read so far.
|
|
9
|
+
*/
|
|
10
|
+
export function collectReadPathsFromEffects(observedEffects) {
|
|
11
|
+
const readPaths = new Set();
|
|
12
|
+
for (const eff of observedEffects) {
|
|
13
|
+
if (eff.kind !== 'fs:effect' || eff.attributes?.['mode'] !== 'read')
|
|
14
|
+
continue;
|
|
15
|
+
const paths = eff.attributes['paths'];
|
|
16
|
+
if (!Array.isArray(paths))
|
|
17
|
+
continue;
|
|
18
|
+
for (const relPath of paths) {
|
|
19
|
+
if (typeof relPath === 'string') {
|
|
20
|
+
readPaths.add(relPath.replace(/\\/g, '/').replace(/^\.\//, ''));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return readPaths;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=collect-read-paths-from-effects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect-read-paths-from-effects.js","sourceRoot":"","sources":["../../../src/executors/internal/collect-read-paths-from-effects.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,UAAU,2BAA2B,CACzC,eAAsC;IAEtC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;IACpC,KAAK,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QAClC,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,KAAK,MAAM;YAAE,SAAS;QAC9E,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,SAAS;QACpC,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE,CAAC;YAC5B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;gBAChC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;YAClE,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LeaseDelta } from '@paraharness/core';
|
|
2
|
+
/**
|
|
3
|
+
* Pre-compiles and memoizes a single write-mode path matcher across all `FsGlobMatcherNode` grants in `activeLeases`.
|
|
4
|
+
*
|
|
5
|
+
* Evaluates both exact normalized file paths and `picomatch` glob patterns across all granted matchers (`Rule 4.4`),
|
|
6
|
+
* caching both per-matcher `matcher.globs` predicates in `CACHED_GLOB_OR_EXACT_MATCHERS` and the composed predicate
|
|
7
|
+
* in `CACHED_ACTIVE_LEASE_WRITE_MATCHERS`.
|
|
8
|
+
*
|
|
9
|
+
* @param {readonly LeaseDelta[]} activeLeases - Active capability leases granted to the actor or loop.
|
|
10
|
+
*
|
|
11
|
+
* @returns {(candidatePath: string) => boolean} Reusable synchronous predicate returning `true` when `candidatePath` is leased.
|
|
12
|
+
*/
|
|
13
|
+
export declare function compileActiveLeaseWriteMatcher(activeLeases: readonly LeaseDelta[]): (candidatePath: string) => boolean;
|
|
14
|
+
//# sourceMappingURL=compile-active-lease-write-matcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-active-lease-write-matcher.d.ts","sourceRoot":"","sources":["../../../src/executors/internal/compile-active-lease-write-matcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAyBpD;;;;;;;;;;GAUG;AACH,wBAAgB,8BAA8B,CAC5C,YAAY,EAAE,SAAS,UAAU,EAAE,GAClC,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAiBpC"}
|