@jarkkojs/readseek-api 0.9.13 → 0.9.15
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 +10 -27
- package/dist/argv.d.ts +2 -1
- package/dist/client.d.ts +7 -3
- package/dist/hashline.d.ts +13 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +257 -39
- package/dist/path.d.ts +19 -0
- package/dist/platform.d.ts +10 -6
- package/dist/validation.d.ts +47 -2
- package/package.json +2 -3
- package/LICENSE +0 -176
package/README.md
CHANGED
|
@@ -1,48 +1,31 @@
|
|
|
1
1
|
# @jarkkojs/readseek-api
|
|
2
2
|
|
|
3
|
-
Shared
|
|
4
|
-
|
|
5
|
-
resolution, and bounded Node or Bun process invocation.
|
|
6
|
-
|
|
7
|
-
This package intentionally excludes host permissions, cache management, install
|
|
8
|
-
flows, session state, and TUI rendering.
|
|
9
|
-
|
|
10
|
-
Repository plugins consume this source directly: Pi and OpenCode inline it into
|
|
11
|
-
their published bundles, and the Claude marketplace plugin imports the monorepo
|
|
12
|
-
sibling sources. External consumers install the published package.
|
|
3
|
+
Shared ReadSeek contracts, validation, argument builders, binary resolution, and
|
|
4
|
+
bounded Node/Bun process runners.
|
|
13
5
|
|
|
14
6
|
## Install
|
|
15
7
|
|
|
16
|
-
```
|
|
8
|
+
```sh
|
|
17
9
|
npm install @jarkkojs/readseek-api
|
|
18
10
|
```
|
|
19
11
|
|
|
20
|
-
`@jarkkojs/readseek` arrives as a dependency.
|
|
21
|
-
|
|
22
|
-
## Exports
|
|
23
|
-
|
|
24
|
-
- Contract: tool descriptions, shared parameter text, and enums
|
|
25
|
-
- Policy: host-agnostic tool routing, preference/fallback lead-ins, and compact guidelines
|
|
26
|
-
- Validation: git selection, refs name/scope, vision level/mode, edit variants
|
|
27
|
-
- Argv builders: `digest`, `view`, `search`, `def`, `refs`, `edit`, `rename`, line locations
|
|
28
|
-
- Platform: binary name, platform package map, and default or caller-injected module resolution
|
|
29
|
-
- Process: Node and Bun runners with timeout, cancellation, stdin, cwd, hard
|
|
30
|
-
stdout/stderr caps, no shell, and strict JSON/error cleanup
|
|
31
|
-
|
|
32
12
|
## Example
|
|
33
13
|
|
|
34
14
|
```ts
|
|
35
15
|
import {
|
|
36
16
|
buildDigestArgs,
|
|
37
17
|
resolveReadSeekBinaryFromPackages,
|
|
18
|
+
resolveReadSeekBinaryOverride,
|
|
38
19
|
runReadSeekNodeJson,
|
|
39
20
|
} from "@jarkkojs/readseek-api";
|
|
40
21
|
|
|
41
|
-
const binary =
|
|
22
|
+
const binary =
|
|
23
|
+
resolveReadSeekBinaryOverride() ?? resolveReadSeekBinaryFromPackages();
|
|
42
24
|
const args = buildDigestArgs({ path: "src/index.ts", select: "map" });
|
|
43
|
-
const
|
|
25
|
+
const result = await runReadSeekNodeJson(binary, args);
|
|
44
26
|
```
|
|
45
27
|
|
|
46
|
-
## License
|
|
47
28
|
|
|
48
|
-
|
|
29
|
+
## Licensing
|
|
30
|
+
|
|
31
|
+
[Apache 2.0](../../LICENSE-APACHE-2.0).
|
package/dist/argv.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type ViewArgsInput = {
|
|
|
31
31
|
outline?: boolean;
|
|
32
32
|
visionMode?: VisionAnalysisMode;
|
|
33
33
|
visionLevel?: VisionLevel;
|
|
34
|
-
format?: "json" | "
|
|
34
|
+
format?: "json" | "plain";
|
|
35
35
|
readseekDir?: string;
|
|
36
36
|
};
|
|
37
37
|
export declare function buildViewArgs(input: ViewArgsInput): string[];
|
|
@@ -39,6 +39,7 @@ export type SearchArgsInput = {
|
|
|
39
39
|
path: string;
|
|
40
40
|
pattern: string;
|
|
41
41
|
language?: string;
|
|
42
|
+
limit?: number;
|
|
42
43
|
} & GitSelectionInput;
|
|
43
44
|
export declare function buildSearchArgs(input: SearchArgsInput): string[];
|
|
44
45
|
export type DefArgsInput = {
|
package/dist/client.d.ts
CHANGED
|
@@ -16,11 +16,13 @@ export interface ReadSeekReadOutput {
|
|
|
16
16
|
export interface ReadSeekSymbol {
|
|
17
17
|
kind: string;
|
|
18
18
|
name: string;
|
|
19
|
-
qualified_name
|
|
19
|
+
qualified_name?: string;
|
|
20
20
|
start_line: number;
|
|
21
21
|
end_line: number;
|
|
22
|
-
start_hash
|
|
23
|
-
end_hash
|
|
22
|
+
start_hash?: string;
|
|
23
|
+
end_hash?: string;
|
|
24
|
+
start_anchor?: string;
|
|
25
|
+
end_anchor?: string;
|
|
24
26
|
}
|
|
25
27
|
export interface ReadSeekMapOutput {
|
|
26
28
|
file: string;
|
|
@@ -66,6 +68,7 @@ export interface ReadSeekDiagnostic {
|
|
|
66
68
|
end_line: number;
|
|
67
69
|
}
|
|
68
70
|
export interface ReadSeekCheckOutput {
|
|
71
|
+
file_hash?: string;
|
|
69
72
|
errorCount: number;
|
|
70
73
|
missingCount: number;
|
|
71
74
|
diagnostics: ReadSeekDiagnostic[];
|
|
@@ -259,6 +262,7 @@ export interface ReadSeekRunner {
|
|
|
259
262
|
}
|
|
260
263
|
interface ReadSeekSearchOptions {
|
|
261
264
|
language?: string;
|
|
265
|
+
limit?: number;
|
|
262
266
|
cached?: boolean;
|
|
263
267
|
others?: boolean;
|
|
264
268
|
ignored?: boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const HASH_LEN = 6;
|
|
2
|
+
export type LineAnchor = {
|
|
3
|
+
line: number;
|
|
4
|
+
hash: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function tryParseLineAnchor(anchor: string): {
|
|
7
|
+
ok: true;
|
|
8
|
+
anchor: LineAnchor;
|
|
9
|
+
} | {
|
|
10
|
+
ok: false;
|
|
11
|
+
error: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function parseLineAnchor(anchor: string): LineAnchor;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { DIGEST_FACETS, DOCUMENT_NODE_KINDS, EDIT_VARIANTS, GIT_SELECTION_FLAGS, PARAM_DESCRIPTIONS, TOOL_CONTRACTS, getToolContract, TOOL_DESCRIPTIONS, TOOL_NAMES, renderToolDescription, VISION_ANALYSIS_MODES, VISION_LEVELS, VISION_MODES, type DigestFacet, type DocumentNodeKind, type EditVariant, type GitSelectionFlag, type JsonSchema, type ToolContract, type ToolName, type VisionAnalysisMode, type VisionLevel, type VisionMode, } from "./contract.ts";
|
|
2
2
|
export { BUILTIN_FALLBACKS, REPLACEABLE_TOOLS, TOOL_COMPACT_GUIDELINES, fallbackToolDescriptionMap, preferredToolDescriptionMap, renderCompactGuidelines, renderFallbackToolDescription, renderPreferredToolDescription, renderToolRoutingPolicy, resolveToolName, rewriteBacktickedToolNames, type ReplaceableTool, type ToolAliasMap, type ToolRoutingPolicyOptions, } from "./policy.ts";
|
|
3
|
-
export { validateExactlyOneEditVariant, validateGitSelection, validateRefsNameVsScope, validateVisionLevelVsMode, type EditObject, type GitSelectionInput, type RefsScopeInput, type ValidationResult, type VisionInput, } from "./validation.ts";
|
|
3
|
+
export { coerceBoolean, coerceNonNegativeInt, coerceObviousBase10Int, coerceOptionalString, coercePositiveInt, validateExactlyOneEditVariant, validateGitSelection, validateRefsNameVsScope, validateVisionLevelVsMode, type CoercedIntResult, type EditItem, type EditObject, type GitSelectionInput, type InsertAfterEdit, type RefsScopeInput, type ReplaceEdit, type ReplaceLinesEdit, type ReplaceSymbolEdit, type SetLineEdit, type ValidationResult, type VisionInput, } from "./validation.ts";
|
|
4
|
+
export { HASH_LEN, parseLineAnchor, tryParseLineAnchor, type LineAnchor, } from "./hashline.ts";
|
|
4
5
|
export { appendApplyAndPlanHash, appendGitSelectionArgs, buildDefArgs, buildDigestArgs, buildEditArgs, buildLineLocation, buildRefsArgs, buildRenameArgs, buildSearchArgs, buildViewArgs, type ApplyPlanHashInput, type ApplyPlanHashOrder, type DefArgsInput, type DigestArgsInput, type EditArgsInput, type RefsArgsInput, type RenameArgsInput, type SearchArgsInput, type ViewArgsInput, } from "./argv.ts";
|
|
5
|
-
export { READSEEK_PLATFORM_PACKAGES, readSeekBinaryName, readSeekPlatformKey, resolveReadSeekBinaryFromPackages,
|
|
6
|
+
export { READSEEK_BINARY_ENV, READSEEK_PLATFORM_PACKAGES, readSeekBinaryName, readSeekPlatformKey, resolveReadSeekBinaryFromPackages, resolveReadSeekBinaryOverride, resolveReadSeekCacheDir, type ModuleResolver, type ReadSeekCacheOptions, } from "./platform.ts";
|
|
7
|
+
export { canonicalPathKey, expandUserPath, isSubPath, resolveScopedPath, resolveToCwd, } from "./path.ts";
|
|
6
8
|
export { cleanReadSeekErrorText, parseReadSeekJson, } from "./json.ts";
|
|
7
9
|
export { DEFAULT_MAX_OUTPUT_BYTES, DEFAULT_READSEEK_TIMEOUT_MS, ensureSuccessfulStdout, failureFromProcessResult, parseSuccessfulJson, resolveProcessLimits, type ProcessRunOptions, type ProcessRunResult, } from "./process.ts";
|
|
8
10
|
export { runReadSeekNode, runReadSeekNodeJson, runReadSeekNodeText, } from "./process-node.ts";
|
package/dist/index.js
CHANGED
|
@@ -535,6 +535,31 @@ function fallbackToolDescriptionMap(builtIns = Object.keys(BUILTIN_FALLBACKS), a
|
|
|
535
535
|
return description ? [[builtIn, description]] : [];
|
|
536
536
|
}));
|
|
537
537
|
}
|
|
538
|
+
// src/hashline.ts
|
|
539
|
+
var HASH_LEN = 6;
|
|
540
|
+
var LINE_ANCHOR_RE = /^(\d+):([0-9a-fA-F]{6})$/;
|
|
541
|
+
function tryParseLineAnchor(anchor) {
|
|
542
|
+
const match = LINE_ANCHOR_RE.exec(anchor.trim());
|
|
543
|
+
if (!match) {
|
|
544
|
+
return { ok: false, error: `invalid LINE:HASH anchor: ${anchor}` };
|
|
545
|
+
}
|
|
546
|
+
const digits = match[1];
|
|
547
|
+
const line = Number.parseInt(digits, 10);
|
|
548
|
+
if (!Number.isSafeInteger(line)) {
|
|
549
|
+
return { ok: false, error: `Line number must be a safe integer, got ${digits} in "${anchor}".` };
|
|
550
|
+
}
|
|
551
|
+
if (line < 1) {
|
|
552
|
+
return { ok: false, error: `Line number must be >= 1, got ${line} in "${anchor}".` };
|
|
553
|
+
}
|
|
554
|
+
return { ok: true, anchor: { line, hash: match[2].toLowerCase() } };
|
|
555
|
+
}
|
|
556
|
+
function parseLineAnchor(anchor) {
|
|
557
|
+
const parsed = tryParseLineAnchor(anchor);
|
|
558
|
+
if (!parsed.ok)
|
|
559
|
+
throw new Error(parsed.error);
|
|
560
|
+
return parsed.anchor;
|
|
561
|
+
}
|
|
562
|
+
|
|
538
563
|
// src/validation.ts
|
|
539
564
|
function validateGitSelection(input) {
|
|
540
565
|
if (input.ignored && !input.others) {
|
|
@@ -566,6 +591,54 @@ function validateVisionLevelVsMode(input) {
|
|
|
566
591
|
}
|
|
567
592
|
return { ok: true };
|
|
568
593
|
}
|
|
594
|
+
var VARIANT_FIELDS = {
|
|
595
|
+
set_line: ["anchor", "new_text"],
|
|
596
|
+
replace_lines: ["start_anchor", "end_anchor", "new_text"],
|
|
597
|
+
insert_after: ["anchor", "new_text"],
|
|
598
|
+
replace: ["old_text", "new_text"],
|
|
599
|
+
replace_symbol: ["symbol", "new_body"]
|
|
600
|
+
};
|
|
601
|
+
function isEditVariant(value) {
|
|
602
|
+
return EDIT_VARIANTS.includes(value);
|
|
603
|
+
}
|
|
604
|
+
function parseEditItem(item, index) {
|
|
605
|
+
const keys = Object.keys(item);
|
|
606
|
+
const variant = keys[0];
|
|
607
|
+
if (keys.length !== 1 || variant === undefined || !isEditVariant(variant)) {
|
|
608
|
+
return {
|
|
609
|
+
ok: false,
|
|
610
|
+
error: `edits[${index}] must contain exactly one of: ${EDIT_VARIANTS.join(", ")}. Got: [${keys.join(", ")}]`
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
const payload = item[variant];
|
|
614
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
615
|
+
return { ok: false, error: `edits[${index}].${variant} must be an object` };
|
|
616
|
+
}
|
|
617
|
+
const expected = VARIANT_FIELDS[variant];
|
|
618
|
+
const allowed = variant === "replace" ? [...expected, "all"] : [...expected];
|
|
619
|
+
const actual = Object.keys(payload);
|
|
620
|
+
if (actual.some((field) => !allowed.includes(field)) || expected.some((field) => !actual.includes(field))) {
|
|
621
|
+
return { ok: false, error: `edits[${index}].${variant} contains invalid fields` };
|
|
622
|
+
}
|
|
623
|
+
const values = payload;
|
|
624
|
+
for (const field of expected) {
|
|
625
|
+
if (typeof values[field] !== "string") {
|
|
626
|
+
return { ok: false, error: `edits[${index}].${variant}.${field} must be a string` };
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
if (variant === "replace" && values.all !== undefined && typeof values.all !== "boolean") {
|
|
630
|
+
return { ok: false, error: `edits[${index}].replace.all must be a boolean` };
|
|
631
|
+
}
|
|
632
|
+
for (const field of expected) {
|
|
633
|
+
if (!field.endsWith("anchor"))
|
|
634
|
+
continue;
|
|
635
|
+
const parsed = tryParseLineAnchor(values[field]);
|
|
636
|
+
if (!parsed.ok) {
|
|
637
|
+
return { ok: false, error: `edits[${index}].${variant}.${field}: ${parsed.error}` };
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
return { ok: true, edit: item };
|
|
641
|
+
}
|
|
569
642
|
function validateExactlyOneEditVariant(edits) {
|
|
570
643
|
if (!Array.isArray(edits) || edits.length === 0) {
|
|
571
644
|
return { ok: false, error: "edits must contain at least one edit" };
|
|
@@ -576,17 +649,71 @@ function validateExactlyOneEditVariant(edits) {
|
|
|
576
649
|
if (!item || typeof item !== "object" || Array.isArray(item)) {
|
|
577
650
|
return { ok: false, error: `edits[${index}] must be an edit object` };
|
|
578
651
|
}
|
|
579
|
-
const
|
|
580
|
-
if (
|
|
581
|
-
return
|
|
582
|
-
|
|
583
|
-
error: `edits[${index}] must contain exactly one of: ${EDIT_VARIANTS.join(", ")}`
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
normalized.push(item);
|
|
652
|
+
const parsed = parseEditItem(item, index);
|
|
653
|
+
if (!parsed.ok)
|
|
654
|
+
return parsed;
|
|
655
|
+
normalized.push(parsed.edit);
|
|
587
656
|
}
|
|
588
657
|
return { ok: true, edits: normalized };
|
|
589
658
|
}
|
|
659
|
+
var BASE10_INT_RE = /^-?\d+$/;
|
|
660
|
+
var MIN_SAFE_INTEGER = BigInt(Number.MIN_SAFE_INTEGER);
|
|
661
|
+
var MAX_SAFE_INTEGER = BigInt(Number.MAX_SAFE_INTEGER);
|
|
662
|
+
function formatReceived(value) {
|
|
663
|
+
if (typeof value === "number" || typeof value === "bigint")
|
|
664
|
+
return String(value);
|
|
665
|
+
return JSON.stringify(value) ?? String(value);
|
|
666
|
+
}
|
|
667
|
+
function invalidInteger(value, name) {
|
|
668
|
+
return {
|
|
669
|
+
ok: false,
|
|
670
|
+
message: `Invalid ${name}: expected a safe base-10 integer, received ${formatReceived(value)}.`
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
function coerceObviousBase10Int(value, name) {
|
|
674
|
+
if (value === undefined || typeof value === "string" && value.trim() === "") {
|
|
675
|
+
return { ok: true, value: undefined };
|
|
676
|
+
}
|
|
677
|
+
if (typeof value === "number") {
|
|
678
|
+
if (Number.isSafeInteger(value)) {
|
|
679
|
+
return { ok: true, value };
|
|
680
|
+
}
|
|
681
|
+
return invalidInteger(value, name);
|
|
682
|
+
}
|
|
683
|
+
if (typeof value === "string" && BASE10_INT_RE.test(value)) {
|
|
684
|
+
const parsed = BigInt(value);
|
|
685
|
+
if (parsed >= MIN_SAFE_INTEGER && parsed <= MAX_SAFE_INTEGER) {
|
|
686
|
+
return { ok: true, value: Number(parsed) };
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
return invalidInteger(value, name);
|
|
690
|
+
}
|
|
691
|
+
function coerceOptionalString(value) {
|
|
692
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
693
|
+
}
|
|
694
|
+
function coerceBoolean(value) {
|
|
695
|
+
return value === true;
|
|
696
|
+
}
|
|
697
|
+
function coercePositiveInt(value) {
|
|
698
|
+
if (typeof value === "number" && Number.isSafeInteger(value) && value >= 1)
|
|
699
|
+
return value;
|
|
700
|
+
if (typeof value === "string" && /^\d+$/.test(value)) {
|
|
701
|
+
const n = Number(value);
|
|
702
|
+
if (Number.isSafeInteger(n) && n >= 1)
|
|
703
|
+
return n;
|
|
704
|
+
}
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
function coerceNonNegativeInt(value) {
|
|
708
|
+
if (typeof value === "number" && Number.isSafeInteger(value) && value >= 0)
|
|
709
|
+
return value;
|
|
710
|
+
if (typeof value === "string" && /^\d+$/.test(value)) {
|
|
711
|
+
const n = Number(value);
|
|
712
|
+
if (Number.isSafeInteger(n) && n >= 0)
|
|
713
|
+
return n;
|
|
714
|
+
}
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
590
717
|
// src/argv.ts
|
|
591
718
|
function buildLineLocation(line, column) {
|
|
592
719
|
return column === undefined ? `line:${line}` : `line:${line}:${column}`;
|
|
@@ -596,14 +723,12 @@ function appendGitSelectionArgs(args, input) {
|
|
|
596
723
|
if (!validated.ok) {
|
|
597
724
|
throw new Error(validated.error);
|
|
598
725
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
args.push("--git", selection.join(","));
|
|
606
|
-
}
|
|
726
|
+
if (input.cached)
|
|
727
|
+
args.push("--cached");
|
|
728
|
+
if (input.others)
|
|
729
|
+
args.push("--others");
|
|
730
|
+
if (input.ignored)
|
|
731
|
+
args.push("--ignored");
|
|
607
732
|
return args;
|
|
608
733
|
}
|
|
609
734
|
function pushOptionalString(args, flag, value) {
|
|
@@ -680,15 +805,17 @@ function buildViewArgs(input) {
|
|
|
680
805
|
return args;
|
|
681
806
|
}
|
|
682
807
|
function buildSearchArgs(input) {
|
|
683
|
-
const args = ["search", input.
|
|
808
|
+
const args = ["search", input.pattern];
|
|
809
|
+
pushOptionalString(args, "--path", input.path);
|
|
684
810
|
pushOptionalString(args, "--language", input.language);
|
|
811
|
+
pushOptionalNumber(args, "--limit", input.limit);
|
|
685
812
|
return appendGitSelectionArgs(args, input);
|
|
686
813
|
}
|
|
687
814
|
function buildDefArgs(input) {
|
|
688
|
-
const args = ["def", input.
|
|
815
|
+
const args = ["def", input.name];
|
|
816
|
+
pushOptionalString(args, "--path", input.path);
|
|
689
817
|
if (input.format !== undefined)
|
|
690
818
|
args.push("--format", input.format);
|
|
691
|
-
args.push(input.name);
|
|
692
819
|
pushOptionalString(args, "--language", input.language);
|
|
693
820
|
return appendGitSelectionArgs(args, input);
|
|
694
821
|
}
|
|
@@ -696,11 +823,14 @@ function buildRefsArgs(input) {
|
|
|
696
823
|
const validated = validateRefsNameVsScope(input);
|
|
697
824
|
if (!validated.ok)
|
|
698
825
|
throw new Error(validated.error);
|
|
699
|
-
const args = ["refs"
|
|
700
|
-
if (input.
|
|
701
|
-
args.push("--at", buildLineLocation(input.line, input.column));
|
|
702
|
-
} else if (input.name !== undefined) {
|
|
826
|
+
const args = ["refs"];
|
|
827
|
+
if (input.name !== undefined)
|
|
703
828
|
args.push(input.name);
|
|
829
|
+
pushOptionalString(args, "--path", input.path);
|
|
830
|
+
if (input.scope) {
|
|
831
|
+
args.push("--scope");
|
|
832
|
+
pushOptionalNumber(args, "--line", input.line);
|
|
833
|
+
pushOptionalNumber(args, "--column", input.column);
|
|
704
834
|
}
|
|
705
835
|
if (input.format !== undefined)
|
|
706
836
|
args.push("--format", input.format);
|
|
@@ -716,13 +846,13 @@ function buildEditArgs(input) {
|
|
|
716
846
|
});
|
|
717
847
|
pushOptionalString(args, "--language", input.language);
|
|
718
848
|
if (input.requestFromStdin)
|
|
719
|
-
args.push("--
|
|
849
|
+
args.push("--edits", "-");
|
|
720
850
|
return args;
|
|
721
851
|
}
|
|
722
852
|
function buildRenameArgs(input) {
|
|
723
853
|
const args = ["rename", input.path, "--at", buildLineLocation(input.line, input.column), "--to", input.to];
|
|
724
854
|
if (input.workspace !== undefined)
|
|
725
|
-
args.push(
|
|
855
|
+
args.push(`--workspace=${input.workspace}`);
|
|
726
856
|
appendApplyAndPlanHash(args, {
|
|
727
857
|
apply: input.apply,
|
|
728
858
|
planHash: input.planHash,
|
|
@@ -732,9 +862,11 @@ function buildRenameArgs(input) {
|
|
|
732
862
|
return appendGitSelectionArgs(args, input);
|
|
733
863
|
}
|
|
734
864
|
// src/platform.ts
|
|
735
|
-
import { accessSync, constants as fsConstants } from "node:fs";
|
|
865
|
+
import { accessSync, constants as fsConstants, existsSync, statSync } from "node:fs";
|
|
736
866
|
import { createRequire } from "node:module";
|
|
867
|
+
import { homedir } from "node:os";
|
|
737
868
|
import path from "node:path";
|
|
869
|
+
var READSEEK_BINARY_ENV = "READSEEK_BINARY";
|
|
738
870
|
var READSEEK_PLATFORM_PACKAGES = {
|
|
739
871
|
"darwin-arm64": "@jarkkojs/readseek-darwin-arm64",
|
|
740
872
|
"linux-arm64": "@jarkkojs/readseek-linux-arm64",
|
|
@@ -748,6 +880,24 @@ function readSeekBinaryName(platform = process.platform) {
|
|
|
748
880
|
function readSeekPlatformKey(platform = process.platform, arch = process.arch) {
|
|
749
881
|
return `${platform}-${arch}`;
|
|
750
882
|
}
|
|
883
|
+
function resolveReadSeekBinaryOverride(environment = process.env) {
|
|
884
|
+
const binaryPath = environment[READSEEK_BINARY_ENV];
|
|
885
|
+
if (binaryPath === undefined)
|
|
886
|
+
return null;
|
|
887
|
+
if (!path.isAbsolute(binaryPath)) {
|
|
888
|
+
throw new Error(`${READSEEK_BINARY_ENV} must be an absolute path to the readseek executable`);
|
|
889
|
+
}
|
|
890
|
+
try {
|
|
891
|
+
if (!statSync(binaryPath).isFile())
|
|
892
|
+
throw new Error("not a regular file");
|
|
893
|
+
accessSync(binaryPath, fsConstants.X_OK);
|
|
894
|
+
} catch (error) {
|
|
895
|
+
throw new Error(`${READSEEK_BINARY_ENV} does not point to an executable file: ${binaryPath}`, {
|
|
896
|
+
cause: error
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
return binaryPath;
|
|
900
|
+
}
|
|
751
901
|
function resolveReadSeekBinaryFromPackages(resolver = resolveFromPackage, options = {}) {
|
|
752
902
|
const resolve = typeof resolver === "function" ? resolver : resolver.resolve.bind(resolver);
|
|
753
903
|
const platform = options.platform ?? process.platform;
|
|
@@ -773,18 +923,68 @@ function resolveReadSeekBinaryFromPackages(resolver = resolveFromPackage, option
|
|
|
773
923
|
accessSync(binaryPath, fsConstants.X_OK);
|
|
774
924
|
return binaryPath;
|
|
775
925
|
}
|
|
776
|
-
function
|
|
777
|
-
const
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
926
|
+
function resolveReadSeekCacheDir(subPath, options = {}) {
|
|
927
|
+
const env = options.environment ?? process.env;
|
|
928
|
+
const platform = options.platform ?? process.platform;
|
|
929
|
+
const home = options.homedir ? options.homedir() : homedir();
|
|
930
|
+
const cwd = options.cwd ?? process.cwd();
|
|
931
|
+
const localDirName = options.localDirName ?? ".readseek";
|
|
932
|
+
if (localDirName && localDirName.length > 0) {
|
|
933
|
+
const local = path.join(cwd, localDirName);
|
|
934
|
+
if (existsSync(local))
|
|
935
|
+
return local;
|
|
936
|
+
}
|
|
937
|
+
let base;
|
|
938
|
+
if (platform === "win32") {
|
|
939
|
+
base = env.LOCALAPPDATA ?? path.join(home, "AppData", "Local");
|
|
940
|
+
} else {
|
|
941
|
+
const xdg = env.XDG_CACHE_HOME?.trim();
|
|
942
|
+
base = xdg && path.isAbsolute(xdg) ? xdg : path.join(home, ".cache");
|
|
943
|
+
}
|
|
944
|
+
const pathModule = platform === "win32" ? path.win32 : path;
|
|
945
|
+
if (subPath === undefined) {
|
|
946
|
+
return pathModule.join(base, "readseek");
|
|
947
|
+
}
|
|
948
|
+
const parts = Array.isArray(subPath) ? subPath : [subPath];
|
|
949
|
+
return pathModule.join(base, ...parts);
|
|
950
|
+
}
|
|
951
|
+
// src/path.ts
|
|
952
|
+
import { realpathSync } from "node:fs";
|
|
953
|
+
import { homedir as homedir2 } from "node:os";
|
|
954
|
+
import path2 from "node:path";
|
|
955
|
+
var UNICODE_SPACES = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;
|
|
956
|
+
function canonicalPathKey(cwd, filePath) {
|
|
957
|
+
const resolved = path2.resolve(cwd, filePath);
|
|
958
|
+
try {
|
|
959
|
+
return realpathSync.native(resolved);
|
|
960
|
+
} catch {
|
|
961
|
+
return resolved;
|
|
786
962
|
}
|
|
787
|
-
|
|
963
|
+
}
|
|
964
|
+
function expandUserPath(filePath, homedirFn = homedir2) {
|
|
965
|
+
const withoutAt = filePath.startsWith("@") ? filePath.slice(1) : filePath;
|
|
966
|
+
const normalized = withoutAt.replace(UNICODE_SPACES, " ");
|
|
967
|
+
if (normalized === "~")
|
|
968
|
+
return homedirFn();
|
|
969
|
+
if (normalized.startsWith("~/"))
|
|
970
|
+
return homedirFn() + normalized.slice(1);
|
|
971
|
+
return normalized;
|
|
972
|
+
}
|
|
973
|
+
function resolveToCwd(filePath, cwd, homedirFn = homedir2) {
|
|
974
|
+
const expanded = expandUserPath(filePath, homedirFn);
|
|
975
|
+
return path2.isAbsolute(expanded) ? expanded : path2.resolve(cwd, expanded);
|
|
976
|
+
}
|
|
977
|
+
function isSubPath(parent, candidate) {
|
|
978
|
+
const relative = path2.relative(parent, candidate);
|
|
979
|
+
return relative === "" || !relative.startsWith(`..${path2.sep}`) && relative !== ".." && !path2.isAbsolute(relative);
|
|
980
|
+
}
|
|
981
|
+
function resolveScopedPath(root, rawPath, fallback = ".") {
|
|
982
|
+
const canonicalRoot = canonicalPathKey(root, ".");
|
|
983
|
+
const candidate = canonicalPathKey(canonicalRoot, rawPath ?? fallback);
|
|
984
|
+
if (!isSubPath(canonicalRoot, candidate)) {
|
|
985
|
+
return { ok: false, error: `path escapes project root (${canonicalRoot}): ${rawPath ?? fallback}` };
|
|
986
|
+
}
|
|
987
|
+
return { ok: true, path: candidate };
|
|
788
988
|
}
|
|
789
989
|
// src/json.ts
|
|
790
990
|
var READSEEK_USAGE_HINT = /\n\s*Run readseek(?: [\w-]+)* --help for more information\.?\s*$/;
|
|
@@ -1207,6 +1407,7 @@ function parseCheckOutput(value) {
|
|
|
1207
1407
|
if (!Array.isArray(output.diagnostics))
|
|
1208
1408
|
throw new Error("invalid readseek diagnostics");
|
|
1209
1409
|
return {
|
|
1410
|
+
file_hash: optionalString(output.file_hash, "file_hash"),
|
|
1210
1411
|
errorCount: requireNumber(output.error_count, "error_count"),
|
|
1211
1412
|
missingCount: requireNumber(output.missing_count, "missing_count"),
|
|
1212
1413
|
diagnostics: output.diagnostics.map((diagnostic) => {
|
|
@@ -1611,6 +1812,7 @@ function createReadSeekClient(runner) {
|
|
|
1611
1812
|
path: target,
|
|
1612
1813
|
pattern,
|
|
1613
1814
|
language: options.language,
|
|
1815
|
+
limit: options.limit,
|
|
1614
1816
|
cached: options.cached,
|
|
1615
1817
|
others: options.others,
|
|
1616
1818
|
ignored: options.ignored
|
|
@@ -1676,7 +1878,8 @@ function createReadSeekClient(runner) {
|
|
|
1676
1878
|
path: filePath,
|
|
1677
1879
|
apply: options.apply,
|
|
1678
1880
|
planHash: options.planHash,
|
|
1679
|
-
language: options.language
|
|
1881
|
+
language: options.language,
|
|
1882
|
+
requestFromStdin: true
|
|
1680
1883
|
});
|
|
1681
1884
|
return parseEditOutput(await runner.json(args, {
|
|
1682
1885
|
signal: options.signal,
|
|
@@ -1707,6 +1910,7 @@ export {
|
|
|
1707
1910
|
validateRefsNameVsScope,
|
|
1708
1911
|
validateGitSelection,
|
|
1709
1912
|
validateExactlyOneEditVariant,
|
|
1913
|
+
tryParseLineAnchor,
|
|
1710
1914
|
runReadSeekNodeText,
|
|
1711
1915
|
runReadSeekNodeJson,
|
|
1712
1916
|
runReadSeekNode,
|
|
@@ -1715,7 +1919,10 @@ export {
|
|
|
1715
1919
|
runReadSeekBun,
|
|
1716
1920
|
rewriteBacktickedToolNames,
|
|
1717
1921
|
resolveToolName,
|
|
1718
|
-
|
|
1922
|
+
resolveToCwd,
|
|
1923
|
+
resolveScopedPath,
|
|
1924
|
+
resolveReadSeekCacheDir,
|
|
1925
|
+
resolveReadSeekBinaryOverride,
|
|
1719
1926
|
resolveReadSeekBinaryFromPackages,
|
|
1720
1927
|
resolveProcessLimits,
|
|
1721
1928
|
renderToolRoutingPolicy,
|
|
@@ -1728,13 +1935,22 @@ export {
|
|
|
1728
1935
|
preferredToolDescriptionMap,
|
|
1729
1936
|
parseSuccessfulJson,
|
|
1730
1937
|
parseReadSeekJson,
|
|
1938
|
+
parseLineAnchor,
|
|
1939
|
+
isSubPath,
|
|
1731
1940
|
getToolContract,
|
|
1732
1941
|
fallbackToolDescriptionMap,
|
|
1733
1942
|
failureFromProcessResult,
|
|
1943
|
+
expandUserPath,
|
|
1734
1944
|
ensureSuccessfulStdout,
|
|
1735
1945
|
createReadSeekClient,
|
|
1946
|
+
coercePositiveInt,
|
|
1947
|
+
coerceOptionalString,
|
|
1948
|
+
coerceObviousBase10Int,
|
|
1949
|
+
coerceNonNegativeInt,
|
|
1950
|
+
coerceBoolean,
|
|
1736
1951
|
cleanReadSeekErrorText,
|
|
1737
1952
|
classifyReadSeekFailure,
|
|
1953
|
+
canonicalPathKey,
|
|
1738
1954
|
buildViewArgs,
|
|
1739
1955
|
buildSearchArgs,
|
|
1740
1956
|
buildRenameArgs,
|
|
@@ -1754,7 +1970,9 @@ export {
|
|
|
1754
1970
|
TOOL_COMPACT_GUIDELINES,
|
|
1755
1971
|
REPLACEABLE_TOOLS,
|
|
1756
1972
|
READSEEK_PLATFORM_PACKAGES,
|
|
1973
|
+
READSEEK_BINARY_ENV,
|
|
1757
1974
|
PARAM_DESCRIPTIONS,
|
|
1975
|
+
HASH_LEN,
|
|
1758
1976
|
GIT_SELECTION_FLAGS,
|
|
1759
1977
|
EDIT_VARIANTS,
|
|
1760
1978
|
DOCUMENT_NODE_KINDS,
|
package/dist/path.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical cache key for a file as seen by independent tool producers.
|
|
3
|
+
*
|
|
4
|
+
* Resolve against `cwd`, then collapse symlinks. Falls back to the
|
|
5
|
+
* resolved-but-unresolved-symlink form when the file does not exist —
|
|
6
|
+
* `realpathSync` throws ENOENT, and a lookup for a since-deleted file must
|
|
7
|
+
* not fail.
|
|
8
|
+
*/
|
|
9
|
+
export declare function canonicalPathKey(cwd: string, filePath: string): string;
|
|
10
|
+
export declare function expandUserPath(filePath: string, homedirFn?: () => string): string;
|
|
11
|
+
export declare function resolveToCwd(filePath: string, cwd: string, homedirFn?: () => string): string;
|
|
12
|
+
export declare function isSubPath(parent: string, candidate: string): boolean;
|
|
13
|
+
export declare function resolveScopedPath(root: string, rawPath: string | undefined, fallback?: string): {
|
|
14
|
+
ok: true;
|
|
15
|
+
path: string;
|
|
16
|
+
} | {
|
|
17
|
+
ok: false;
|
|
18
|
+
error: string;
|
|
19
|
+
};
|
package/dist/platform.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const READSEEK_BINARY_ENV = "READSEEK_BINARY";
|
|
1
2
|
export declare const READSEEK_PLATFORM_PACKAGES: Readonly<Record<string, string>>;
|
|
2
3
|
export type ModuleResolver = {
|
|
3
4
|
resolve: (specifier: string, options?: {
|
|
@@ -6,14 +7,17 @@ export type ModuleResolver = {
|
|
|
6
7
|
};
|
|
7
8
|
export declare function readSeekBinaryName(platform?: string): string;
|
|
8
9
|
export declare function readSeekPlatformKey(platform?: string, arch?: string): string;
|
|
10
|
+
export declare function resolveReadSeekBinaryOverride(environment?: Readonly<Record<string, string | undefined>>): string | null;
|
|
9
11
|
export declare function resolveReadSeekBinaryFromPackages(resolver?: ModuleResolver["resolve"] | ModuleResolver, options?: {
|
|
10
12
|
platform?: string;
|
|
11
13
|
arch?: string;
|
|
12
14
|
metaPackage?: string;
|
|
13
15
|
}): string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
export type ReadSeekCacheOptions = {
|
|
17
|
+
cwd?: string;
|
|
18
|
+
localDirName?: string;
|
|
19
|
+
environment?: Readonly<Record<string, string | undefined>>;
|
|
20
|
+
platform?: string;
|
|
21
|
+
homedir?: () => string;
|
|
22
|
+
};
|
|
23
|
+
export declare function resolveReadSeekCacheDir(subPath?: string | readonly string[], options?: ReadSeekCacheOptions): string;
|
package/dist/validation.d.ts
CHANGED
|
@@ -23,11 +23,56 @@ export type VisionInput = {
|
|
|
23
23
|
outline?: boolean;
|
|
24
24
|
};
|
|
25
25
|
export declare function validateVisionLevelVsMode(input: VisionInput): ValidationResult;
|
|
26
|
-
export type
|
|
26
|
+
export type SetLineEdit = {
|
|
27
|
+
set_line: {
|
|
28
|
+
anchor: string;
|
|
29
|
+
new_text: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export type ReplaceLinesEdit = {
|
|
33
|
+
replace_lines: {
|
|
34
|
+
start_anchor: string;
|
|
35
|
+
end_anchor: string;
|
|
36
|
+
new_text: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type InsertAfterEdit = {
|
|
40
|
+
insert_after: {
|
|
41
|
+
anchor: string;
|
|
42
|
+
new_text: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export type ReplaceEdit = {
|
|
46
|
+
replace: {
|
|
47
|
+
old_text: string;
|
|
48
|
+
new_text: string;
|
|
49
|
+
all?: boolean;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export type ReplaceSymbolEdit = {
|
|
53
|
+
replace_symbol: {
|
|
54
|
+
symbol: string;
|
|
55
|
+
new_body: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export type EditItem = SetLineEdit | ReplaceLinesEdit | InsertAfterEdit | ReplaceEdit | ReplaceSymbolEdit;
|
|
59
|
+
export type EditObject = EditItem;
|
|
27
60
|
export declare function validateExactlyOneEditVariant(edits: unknown): {
|
|
28
61
|
ok: true;
|
|
29
|
-
edits:
|
|
62
|
+
edits: EditItem[];
|
|
30
63
|
} | {
|
|
31
64
|
ok: false;
|
|
32
65
|
error: string;
|
|
33
66
|
};
|
|
67
|
+
export type CoercedIntResult = {
|
|
68
|
+
ok: true;
|
|
69
|
+
value: number | undefined;
|
|
70
|
+
} | {
|
|
71
|
+
ok: false;
|
|
72
|
+
message: string;
|
|
73
|
+
};
|
|
74
|
+
export declare function coerceObviousBase10Int(value: unknown, name: string): CoercedIntResult;
|
|
75
|
+
export declare function coerceOptionalString(value: unknown): string | undefined;
|
|
76
|
+
export declare function coerceBoolean(value: unknown): boolean;
|
|
77
|
+
export declare function coercePositiveInt(value: unknown): number | undefined;
|
|
78
|
+
export declare function coerceNonNegativeInt(value: unknown): number | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jarkkojs/readseek-api",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.15",
|
|
4
4
|
"description": "Shared ReadSeek CLI contract, validation, argv builders, and bounded process runners",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"dist/",
|
|
25
|
-
"LICENSE",
|
|
26
25
|
"README.md"
|
|
27
26
|
],
|
|
28
27
|
"scripts": {
|
|
@@ -45,7 +44,7 @@
|
|
|
45
44
|
"hashline"
|
|
46
45
|
],
|
|
47
46
|
"dependencies": {
|
|
48
|
-
"@jarkkojs/readseek": "^0.9.
|
|
47
|
+
"@jarkkojs/readseek": "^0.9.15"
|
|
49
48
|
},
|
|
50
49
|
"devDependencies": {
|
|
51
50
|
"@types/node": "^22.0.0",
|
package/LICENSE
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|