perttool 0.7.1 → 0.8.1
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/CHANGELOG.md +47 -1
- package/README.md +98 -18
- package/dist/actuals/lifecycle.d.ts +6 -20
- package/dist/actuals/lifecycle.d.ts.map +1 -1
- package/dist/actuals/lifecycle.js +5 -176
- package/dist/actuals/lifecycle.js.map +1 -1
- package/dist/actuals/reduction.d.ts +20 -0
- package/dist/actuals/reduction.d.ts.map +1 -0
- package/dist/actuals/reduction.js +175 -0
- package/dist/actuals/reduction.js.map +1 -0
- package/dist/analysis/service.d.ts +33 -0
- package/dist/analysis/service.d.ts.map +1 -0
- package/dist/analysis/service.js +153 -0
- package/dist/analysis/service.js.map +1 -0
- package/dist/analysis/target-temporal-input.d.ts +88 -0
- package/dist/analysis/target-temporal-input.d.ts.map +1 -0
- package/dist/analysis/target-temporal-input.js +249 -0
- package/dist/analysis/target-temporal-input.js.map +1 -0
- package/dist/analysis/temporal-deadline.d.ts +1 -1
- package/dist/analysis/temporal-deadline.d.ts.map +1 -1
- package/dist/analysis/temporal-precedence.d.ts +1 -1
- package/dist/analysis/temporal-precedence.d.ts.map +1 -1
- package/dist/analysis/temporal-precedence.js +1 -1
- package/dist/analysis/temporal-precedence.js.map +1 -1
- package/dist/analysis/temporal-resource.d.ts +1 -1
- package/dist/analysis/temporal-resource.d.ts.map +1 -1
- package/dist/analysis/temporal-resource.js +1 -1
- package/dist/analysis/temporal-resource.js.map +1 -1
- package/dist/application/advance-history.d.ts +2 -1
- package/dist/application/advance-history.d.ts.map +1 -1
- package/dist/application/advance-history.js +1 -1
- package/dist/application/advance-history.js.map +1 -1
- package/dist/application/analyze.d.ts +1 -32
- package/dist/application/analyze.d.ts.map +1 -1
- package/dist/application/analyze.js +1 -152
- package/dist/application/analyze.js.map +1 -1
- package/dist/application/check.d.ts +1 -42
- package/dist/application/check.d.ts.map +1 -1
- package/dist/application/check.js +1 -109
- package/dist/application/check.js.map +1 -1
- package/dist/application/cli-facade.d.ts +85 -0
- package/dist/application/cli-facade.d.ts.map +1 -0
- package/dist/application/cli-facade.js +108 -0
- package/dist/application/cli-facade.js.map +1 -0
- package/dist/application/contract6-mutation.js +2 -2
- package/dist/application/contract6-mutation.js.map +1 -1
- package/dist/application/contract7-mermaid.d.ts.map +1 -1
- package/dist/application/contract7-mermaid.js +3 -3
- package/dist/application/contract7-mermaid.js.map +1 -1
- package/dist/application/contract7-source.d.ts +1 -7
- package/dist/application/contract7-source.d.ts.map +1 -1
- package/dist/application/contract7-source.js +4 -12
- package/dist/application/contract7-source.js.map +1 -1
- package/dist/application/editor-dag-focus.d.ts +52 -0
- package/dist/application/editor-dag-focus.d.ts.map +1 -0
- package/dist/application/editor-dag-focus.js +132 -0
- package/dist/application/editor-dag-focus.js.map +1 -0
- package/dist/application/format.js +2 -2
- package/dist/application/format.js.map +1 -1
- package/dist/application/mutate.d.ts +1 -26
- package/dist/application/mutate.d.ts.map +1 -1
- package/dist/application/mutate.js +1 -205
- package/dist/application/mutate.js.map +1 -1
- package/dist/application/next.js +2 -2
- package/dist/application/next.js.map +1 -1
- package/dist/application/target-actuals-advance.js +2 -2
- package/dist/application/target-actuals-advance.js.map +1 -1
- package/dist/application/target-actuals-analysis.js +2 -2
- package/dist/application/target-actuals-analysis.js.map +1 -1
- package/dist/application/target-actuals-mutation.d.ts.map +1 -1
- package/dist/application/target-actuals-mutation.js +6 -5
- package/dist/application/target-actuals-mutation.js.map +1 -1
- package/dist/application/target-assurance-analysis.js +2 -2
- package/dist/application/target-assurance-analysis.js.map +1 -1
- package/dist/application/target-assurance-write.d.ts +2 -1
- package/dist/application/target-assurance-write.d.ts.map +1 -1
- package/dist/application/target-assurance-write.js +36 -12
- package/dist/application/target-assurance-write.js.map +1 -1
- package/dist/application/target-governance-mutation.js +2 -2
- package/dist/application/target-governance-mutation.js.map +1 -1
- package/dist/application/target-historical-graph.d.ts +124 -0
- package/dist/application/target-historical-graph.d.ts.map +1 -0
- package/dist/application/target-historical-graph.js +547 -0
- package/dist/application/target-historical-graph.js.map +1 -0
- package/dist/application/target-mutate.d.ts +1 -17
- package/dist/application/target-mutate.d.ts.map +1 -1
- package/dist/application/target-mutate.js +1 -159
- package/dist/application/target-mutate.js.map +1 -1
- package/dist/application/target-project-history.d.ts +2 -1
- package/dist/application/target-project-history.d.ts.map +1 -1
- package/dist/application/target-project-history.js +3 -3
- package/dist/application/target-project-history.js.map +1 -1
- package/dist/application/target-temporal-analysis.js +2 -2
- package/dist/application/target-temporal-analysis.js.map +1 -1
- package/dist/application/target-temporal-input.d.ts +1 -87
- package/dist/application/target-temporal-input.d.ts.map +1 -1
- package/dist/application/target-temporal-input.js +1 -248
- package/dist/application/target-temporal-input.js.map +1 -1
- package/dist/application/target-unit-migration-candidate.js +2 -2
- package/dist/application/target-unit-migration-candidate.js.map +1 -1
- package/dist/assurance/advance.d.ts.map +1 -1
- package/dist/assurance/advance.js +15 -5
- package/dist/assurance/advance.js.map +1 -1
- package/dist/assurance/canonical.js +2 -2
- package/dist/assurance/canonical.js.map +1 -1
- package/dist/assurance/compatibility.js +2 -2
- package/dist/assurance/compatibility.js.map +1 -1
- package/dist/assurance/mermaid.d.ts +4 -2
- package/dist/assurance/mermaid.d.ts.map +1 -1
- package/dist/assurance/mermaid.js +11 -7
- package/dist/assurance/mermaid.js.map +1 -1
- package/dist/assurance/mutation.d.ts.map +1 -1
- package/dist/assurance/mutation.js +9 -23
- package/dist/assurance/mutation.js.map +1 -1
- package/dist/cli.js +66 -26
- package/dist/cli.js.map +1 -1
- package/dist/command/assurance-discovery.d.ts.map +1 -1
- package/dist/command/assurance-discovery.js +62 -2
- package/dist/command/assurance-discovery.js.map +1 -1
- package/dist/command/assurance-usage.d.ts.map +1 -1
- package/dist/command/assurance-usage.js +11 -0
- package/dist/command/assurance-usage.js.map +1 -1
- package/dist/conversion/mermaid-import.js +3 -3
- package/dist/conversion/mermaid-import.js.map +1 -1
- package/dist/conversion/mermaid.d.ts +1 -1
- package/dist/conversion/mermaid.d.ts.map +1 -1
- package/dist/conversion/mermaid.js +4 -4
- package/dist/conversion/mermaid.js.map +1 -1
- package/dist/core/index.d.ts +33 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +13 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/source.d.ts +8 -0
- package/dist/core/source.d.ts.map +1 -0
- package/dist/core/source.js +11 -0
- package/dist/core/source.js.map +1 -0
- package/dist/formatter/source-formatter.d.ts +1 -1
- package/dist/formatter/source-formatter.d.ts.map +1 -1
- package/dist/formatter/source-formatter.js +1 -1
- package/dist/formatter/source-formatter.js.map +1 -1
- package/dist/guidance/validator.js +2 -2
- package/dist/guidance/validator.js.map +1 -1
- package/dist/help/assurance-guide.d.ts.map +1 -1
- package/dist/help/assurance-guide.js +78 -0
- package/dist/help/assurance-guide.js.map +1 -1
- package/dist/history/git-probe.d.ts +71 -0
- package/dist/history/git-probe.d.ts.map +1 -1
- package/dist/history/git-probe.js +517 -0
- package/dist/history/git-probe.js.map +1 -1
- package/dist/history/historical-graph.d.ts +174 -0
- package/dist/history/historical-graph.d.ts.map +1 -0
- package/dist/history/historical-graph.js +870 -0
- package/dist/history/historical-graph.js.map +1 -0
- package/dist/history/historical-transition.d.ts +311 -0
- package/dist/history/historical-transition.d.ts.map +1 -0
- package/dist/history/historical-transition.js +998 -0
- package/dist/history/historical-transition.js.map +1 -0
- package/dist/history/project-history.d.ts.map +1 -1
- package/dist/history/project-history.js +2 -2
- package/dist/history/project-history.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/io/document-file.js +2 -2
- package/dist/io/document-file.js.map +1 -1
- package/dist/io/safe-write.js +1 -1
- package/dist/io/safe-write.js.map +1 -1
- package/dist/model/sha256.d.ts +5 -0
- package/dist/model/sha256.d.ts.map +1 -0
- package/dist/model/sha256.js +105 -0
- package/dist/model/sha256.js.map +1 -0
- package/dist/mutation/advance.js +3 -3
- package/dist/mutation/advance.js.map +1 -1
- package/dist/mutation/diagnostics.d.ts +2 -2
- package/dist/mutation/diagnostics.d.ts.map +1 -1
- package/dist/mutation/diagnostics.js.map +1 -1
- package/dist/mutation/planner.d.ts +27 -0
- package/dist/mutation/planner.d.ts.map +1 -0
- package/dist/mutation/planner.js +206 -0
- package/dist/mutation/planner.js.map +1 -0
- package/dist/mutation/source.d.ts +2 -1
- package/dist/mutation/source.d.ts.map +1 -1
- package/dist/mutation/source.js +14 -0
- package/dist/mutation/source.js.map +1 -1
- package/dist/mutation/target-planner.d.ts +18 -0
- package/dist/mutation/target-planner.d.ts.map +1 -0
- package/dist/mutation/target-planner.js +160 -0
- package/dist/mutation/target-planner.js.map +1 -0
- package/dist/mutation/task.d.ts.map +1 -1
- package/dist/mutation/task.js +19 -11
- package/dist/mutation/task.js.map +1 -1
- package/dist/mutation/types.d.ts +1 -1
- package/dist/mutation/types.d.ts.map +1 -1
- package/dist/node/historical-host.d.ts +6 -0
- package/dist/node/historical-host.d.ts.map +1 -0
- package/dist/node/historical-host.js +8 -0
- package/dist/node/historical-host.js.map +1 -0
- package/dist/node/host.d.ts +3 -0
- package/dist/node/host.d.ts.map +1 -0
- package/dist/node/host.js +48 -0
- package/dist/node/host.js.map +1 -0
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +2 -0
- package/dist/node/index.js.map +1 -0
- package/dist/ports/node-host.d.ts +41 -0
- package/dist/ports/node-host.d.ts.map +1 -0
- package/dist/ports/node-host.js +2 -0
- package/dist/ports/node-host.js.map +1 -0
- package/dist/recommendation/override.d.ts +40 -2
- package/dist/recommendation/override.d.ts.map +1 -1
- package/dist/recommendation/override.js +5 -6
- package/dist/recommendation/override.js.map +1 -1
- package/dist/schema/registry.d.ts.map +1 -1
- package/dist/schema/registry.js +1 -0
- package/dist/schema/registry.js.map +1 -1
- package/dist/semantic/check.d.ts +43 -0
- package/dist/semantic/check.d.ts.map +1 -0
- package/dist/semantic/check.js +110 -0
- package/dist/semantic/check.js.map +1 -0
- package/dist/session/document-session.d.ts +109 -0
- package/dist/session/document-session.d.ts.map +1 -0
- package/dist/session/document-session.js +432 -0
- package/dist/session/document-session.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +18 -4
- package/schemas/Perttool.HistoricalGraphResult.v1.schema.json +654 -0
|
@@ -2,7 +2,7 @@ import { exportPlanAssuranceMermaid, importPlanAssuranceMermaid, } from "../assu
|
|
|
2
2
|
import { exportMermaid as exportRetainedMermaid, } from "../conversion/mermaid.js";
|
|
3
3
|
import { importMermaid as importRetainedMermaid, } from "../conversion/mermaid-import.js";
|
|
4
4
|
import { TARGET_GRAMMAR_6_CAPABILITY } from "../parser/document-parser.js";
|
|
5
|
-
import { checkDocument } from "./contract7-assurance.js";
|
|
5
|
+
import { analyzeDocument, checkDocument, } from "./contract7-assurance.js";
|
|
6
6
|
function grammar6(text, maxDiagnostics) {
|
|
7
7
|
return checkDocument(text, {
|
|
8
8
|
...(maxDiagnostics === undefined ? {} : { maxDiagnostics }),
|
|
@@ -28,7 +28,7 @@ export function exportMermaid(text, options = {}) {
|
|
|
28
28
|
...(options.maxDiagnostics === undefined
|
|
29
29
|
? {}
|
|
30
30
|
: { maxDiagnostics: options.maxDiagnostics }),
|
|
31
|
-
});
|
|
31
|
+
}, analyzeDocument);
|
|
32
32
|
return Object.freeze({
|
|
33
33
|
ok: result.ok,
|
|
34
34
|
document: checked.document,
|
|
@@ -49,7 +49,7 @@ function profile2Detected(text) {
|
|
|
49
49
|
export function importMermaid(text, options = {}) {
|
|
50
50
|
if (!profile2Detected(text))
|
|
51
51
|
return importRetainedMermaid(text, options);
|
|
52
|
-
const result = importPlanAssuranceMermaid(text, TARGET_GRAMMAR_6_CAPABILITY);
|
|
52
|
+
const result = importPlanAssuranceMermaid(text, TARGET_GRAMMAR_6_CAPABILITY, analyzeDocument);
|
|
53
53
|
const checked = checkDocument(result.sourceText ?? "", {
|
|
54
54
|
...(options.maxDiagnostics === undefined
|
|
55
55
|
? {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract7-mermaid.js","sourceRoot":"","sources":["../../src/application/contract7-mermaid.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,aAAa,IAAI,qBAAqB,GAIvC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,aAAa,IAAI,qBAAqB,GAGvC,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,
|
|
1
|
+
{"version":3,"file":"contract7-mermaid.js","sourceRoot":"","sources":["../../src/application/contract7-mermaid.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,aAAa,IAAI,qBAAqB,GAIvC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,aAAa,IAAI,qBAAqB,GAGvC,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EACL,eAAe,EACf,aAAa,GACd,MAAM,0BAA0B,CAAC;AAMlC,SAAS,QAAQ,CAAC,IAAY,EAAE,cAAkC;IAChE,OAAO,aAAa,CAAC,IAAI,EAAE;QACzB,GAAG,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC;KAC5D,CAAC,CAAC,cAAc,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,OAAO,GAAkC,EAAE;IAE3C,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,C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formatDocument, parseDocument, validateDocument, } from "../core/source.js";
|
|
2
2
|
import type { Diagnostic } from "../model/diagnostics.js";
|
|
3
|
-
import type { ParseResult, TargetDeclarationKind } from "../model/syntax.js";
|
|
4
3
|
import type { TextEdit } from "../mutation/text-edits.js";
|
|
5
|
-
import { type ParseOptions } from "../parser/document-parser.js";
|
|
6
|
-
import { validateTargetGrammar6DocumentSemantics } from "../semantic/validator.js";
|
|
7
4
|
import type { FormatPreviewOptions } from "./format.js";
|
|
8
|
-
export declare function parseDocument(text: string, options?: ParseOptions): ParseResult<TargetDeclarationKind>;
|
|
9
|
-
export declare const validateDocument: typeof validateTargetGrammar6DocumentSemantics;
|
|
10
|
-
export declare function formatDocument(text: string, options?: ParseOptions): FormatResult;
|
|
11
5
|
export interface FormatPreviewResultV7 {
|
|
12
6
|
readonly ok: boolean;
|
|
13
7
|
readonly documentId: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract7-source.d.ts","sourceRoot":"","sources":["../../src/application/contract7-source.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contract7-source.d.ts","sourceRoot":"","sources":["../../src/application/contract7-source.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,cAAc,EACd,aAAa,EACb,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;CACxC;AAMD,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,oBAAyB,GACjC,qBAAqB,CAqCvB"}
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sha256DigestUtf8 } from "../model/sha256.js";
|
|
2
|
+
import { formatDocument, } from "../core/source.js";
|
|
3
|
+
export { formatDocument, parseDocument, validateDocument, } from "../core/source.js";
|
|
2
4
|
import { createUnifiedDiff } from "../editing/unified-diff.js";
|
|
3
|
-
import { formatTargetGrammar6Document, } from "../formatter/target-source-formatter.js";
|
|
4
|
-
import { parseTargetGrammar6Document, TARGET_GRAMMAR_6_CAPABILITY, } from "../parser/document-parser.js";
|
|
5
|
-
import { validateTargetGrammar6DocumentSemantics, } from "../semantic/validator.js";
|
|
6
|
-
export function parseDocument(text, options = {}) {
|
|
7
|
-
return parseTargetGrammar6Document(text, TARGET_GRAMMAR_6_CAPABILITY, options);
|
|
8
|
-
}
|
|
9
|
-
export const validateDocument = validateTargetGrammar6DocumentSemantics;
|
|
10
|
-
export function formatDocument(text, options = {}) {
|
|
11
|
-
return formatTargetGrammar6Document(text, TARGET_GRAMMAR_6_CAPABILITY, options);
|
|
12
|
-
}
|
|
13
5
|
function digest(text) {
|
|
14
|
-
return
|
|
6
|
+
return sha256DigestUtf8(text);
|
|
15
7
|
}
|
|
16
8
|
export function planFormat(text, options = {}) {
|
|
17
9
|
const originalDigest = digest(text);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract7-source.js","sourceRoot":"","sources":["../../src/application/contract7-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"contract7-source.js","sourceRoot":"","sources":["../../src/application/contract7-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,cAAc,EACd,aAAa,EACb,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAkB/D,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,IAAY,EACZ,OAAO,GAAyB,EAAE;IAElC,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,SAAS,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC;QACtD,OAAO,MAAM,CAAC,MAAM,CAAC;YACnB,EAAE,EAAE,KAAK;YACT,UAAU,EAAE,SAAS,CAAC,UAAU;YAChC,OAAO,EAAE,KAAK;YACd,cAAc;YACd,aAAa,EAAE,IAAI;YACnB,WAAW,EAAE,IAAI;YACjB,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YACxB,WAAW,EAAE,SAAS,CAAC,WAAW;YAClC,oBAAoB,EAAE,SAAS,CAAC,oBAAoB;SACrD,CAAC,CAAC;IACL,CAAC;IACD,MAAM,WAAW,GAAG,SAAS,CAAC,aAAa,CAAC;IAC5C,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,EAAE,EAAE,IAAI;QACR,UAAU,EAAE,SAAS,CAAC,UAAU;QAChC,OAAO,EAAE,SAAS,CAAC,OAAO;QAC1B,cAAc;QACd,aAAa,EAAE,MAAM,CAAC,WAAW,CAAC;QAClC,WAAW;QACX,IAAI,EAAE,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE;YACzC,GAAG,CAAC,OAAO,CAAC,aAAa,KAAK,SAAS;gBACrC,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC;YAC7C,GAAG,CAAC,OAAO,CAAC,YAAY,KAAK,SAAS;gBACpC,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;SAC5C,CAAC;QACF,KAAK,EAAE,SAAS,CAAC,KAAK;QACtB,WAAW,EAAE,SAAS,CAAC,WAAW;QAClC,oBAAoB,EAAE,SAAS,CAAC,oBAAoB;KACrD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type CalendarUnit, type DurationUnit } from "../model/units.js";
|
|
2
|
+
export interface EditorDagExactValueV1 {
|
|
3
|
+
readonly numerator: string;
|
|
4
|
+
readonly denominator: string;
|
|
5
|
+
readonly unit: DurationUnit;
|
|
6
|
+
readonly display: string;
|
|
7
|
+
}
|
|
8
|
+
export interface EditorDagDisplayEntityV1 {
|
|
9
|
+
readonly kind: "milestone" | "task" | "gate";
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly compactId: string;
|
|
12
|
+
readonly title: string;
|
|
13
|
+
readonly description: string | null;
|
|
14
|
+
}
|
|
15
|
+
export interface EditorDagTaskTimeV1 {
|
|
16
|
+
readonly taskId: string;
|
|
17
|
+
readonly taskTime: EditorDagExactValueV1;
|
|
18
|
+
readonly pointForecast: EditorDagExactValueV1 | null;
|
|
19
|
+
}
|
|
20
|
+
export interface EditorDagTimeSummaryV1 {
|
|
21
|
+
readonly residualTime: EditorDagExactValueV1;
|
|
22
|
+
readonly remainingTime: EditorDagExactValueV1;
|
|
23
|
+
readonly taskTimes: readonly EditorDagTaskTimeV1[];
|
|
24
|
+
readonly pointConversion: {
|
|
25
|
+
readonly status: "available" | "unavailable" | "not_applicable";
|
|
26
|
+
readonly targetUnit: CalendarUnit | null;
|
|
27
|
+
readonly residualTime: EditorDagExactValueV1 | null;
|
|
28
|
+
readonly remainingTime: EditorDagExactValueV1 | null;
|
|
29
|
+
readonly reason: string | null;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface EditorDagFocusProjectionV1 {
|
|
33
|
+
readonly frontierMilestoneIds: readonly string[];
|
|
34
|
+
readonly activeTaskIds: readonly string[];
|
|
35
|
+
readonly readyTaskIds: readonly string[];
|
|
36
|
+
readonly recommendedTaskIds: readonly string[];
|
|
37
|
+
readonly startableTaskIds: readonly string[];
|
|
38
|
+
readonly safeStopReasons: readonly string[];
|
|
39
|
+
readonly entities: readonly EditorDagDisplayEntityV1[];
|
|
40
|
+
readonly timeSummary: EditorDagTimeSummaryV1;
|
|
41
|
+
}
|
|
42
|
+
export interface EditorDagFocusInspectionV1 {
|
|
43
|
+
readonly status: "current" | "unavailable";
|
|
44
|
+
readonly reason: string | null;
|
|
45
|
+
readonly focus: EditorDagFocusProjectionV1 | null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Projects the current planning frontier and exact NextResult.v6 start authority
|
|
49
|
+
* for read-only editor presentation. Layout remains an adapter concern.
|
|
50
|
+
*/
|
|
51
|
+
export declare function inspectEditorDagFocus(text: string, expectedSourceDigest: `sha256:${string}`): EditorDagFocusInspectionV1;
|
|
52
|
+
//# sourceMappingURL=editor-dag-focus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-dag-focus.d.ts","sourceRoot":"","sources":["../../src/application/editor-dag-focus.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK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AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,oBAAoB,EAAE,SAAS,MAAM,EAAE,CAAC;IACjD,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,SAAS,wBAAwB,EAAE,CAAC;IACvD,QAAQ,CAAC,WAAW,EAAE,sBAAsB,CAAC;CAC9C;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,aAAa,CAAC;IAC3C,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,0BAA0B,GAAG,IAAI,CAAC;CACnD;AAqDD;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,oBAAoB,EAAE,UAAU,MAAM,EAAE,GACvC,0BAA0B,CAiH5B"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { buildResidualGraph } from "../analysis/graph.js";
|
|
2
|
+
import { formatDecimal } from "../model/rational.js";
|
|
3
|
+
import { fieldNamed } from "../model/syntax.js";
|
|
4
|
+
import { convertWithVelocity, } from "../model/units.js";
|
|
5
|
+
import { analyzeDocument, selectNextTasks, } from "./contract7-assurance.js";
|
|
6
|
+
function unavailable(reason) {
|
|
7
|
+
return Object.freeze({ status: "unavailable", reason, focus: null });
|
|
8
|
+
}
|
|
9
|
+
function exactValue(value, unit, precision) {
|
|
10
|
+
return Object.freeze({
|
|
11
|
+
numerator: value.numerator.toString(),
|
|
12
|
+
denominator: value.denominator.toString(),
|
|
13
|
+
unit,
|
|
14
|
+
display: formatDecimal(value, precision),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function compactEntities(document, residual) {
|
|
18
|
+
const residualEdgeIds = new Set(residual.edges.map(({ id }) => id));
|
|
19
|
+
const declarations = document.declarations.filter((declaration) => (declaration.kind === "milestone" && residual.vertices.has(declaration.id)) ||
|
|
20
|
+
((declaration.kind === "task" || declaration.kind === "gate") &&
|
|
21
|
+
residualEdgeIds.has(declaration.id)));
|
|
22
|
+
const totals = {
|
|
23
|
+
milestone: declarations.filter(({ kind }) => kind === "milestone").length,
|
|
24
|
+
task: declarations.filter(({ kind }) => kind === "task").length,
|
|
25
|
+
gate: declarations.filter(({ kind }) => kind === "gate").length,
|
|
26
|
+
};
|
|
27
|
+
const ordinals = { milestone: 0, task: 0, gate: 0 };
|
|
28
|
+
const prefixes = { milestone: "M", task: "T", gate: "G" };
|
|
29
|
+
return Object.freeze(declarations.map((declaration) => {
|
|
30
|
+
const kind = declaration.kind;
|
|
31
|
+
const ordinal = ++ordinals[kind];
|
|
32
|
+
const width = Math.max(2, String(totals[kind]).length);
|
|
33
|
+
const title = fieldNamed(declaration, "title")?.value ??
|
|
34
|
+
fieldNamed(declaration, "reason")?.value ?? declaration.id;
|
|
35
|
+
const description = fieldNamed(declaration, "description")?.value;
|
|
36
|
+
return Object.freeze({
|
|
37
|
+
kind,
|
|
38
|
+
id: declaration.id,
|
|
39
|
+
compactId: `${prefixes[kind]}${String(ordinal).padStart(width, "0")}`,
|
|
40
|
+
title: typeof title === "string" ? title : declaration.id,
|
|
41
|
+
description: typeof description === "string" ? description : null,
|
|
42
|
+
});
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Projects the current planning frontier and exact NextResult.v6 start authority
|
|
47
|
+
* for read-only editor presentation. Layout remains an adapter concern.
|
|
48
|
+
*/
|
|
49
|
+
export function inspectEditorDagFocus(text, expectedSourceDigest) {
|
|
50
|
+
const next = selectNextTasks(text, { sourceDigest: expectedSourceDigest });
|
|
51
|
+
const analysis = analyzeDocument(text, { mode: "both" });
|
|
52
|
+
if (!next.ok ||
|
|
53
|
+
next.recommendation === null ||
|
|
54
|
+
next.temporal === null ||
|
|
55
|
+
next.assurance === null ||
|
|
56
|
+
!next.temporal.authority.complete ||
|
|
57
|
+
next.diagnosticsTruncated ||
|
|
58
|
+
!analysis.ok ||
|
|
59
|
+
analysis.precedence === null ||
|
|
60
|
+
analysis.resource === null ||
|
|
61
|
+
analysis.durationUnit === null ||
|
|
62
|
+
analysis.diagnosticsTruncated) {
|
|
63
|
+
return unavailable("Complete NextResult.v6 start authority and exact DAG time summaries are unavailable.");
|
|
64
|
+
}
|
|
65
|
+
const residual = buildResidualGraph(next.document);
|
|
66
|
+
const frontier = residual.topologicalOrder.filter((milestoneId) => residual.effectiveReached.has(milestoneId) &&
|
|
67
|
+
(residual.outgoing.get(milestoneId) ?? []).some((edge) => edge.status !== "done" && !residual.effectiveReached.has(edge.target)));
|
|
68
|
+
if (frontier.length === 0 && residual.effectiveReached.has(residual.finish)) {
|
|
69
|
+
frontier.push(residual.finish);
|
|
70
|
+
}
|
|
71
|
+
const durationUnit = analysis.durationUnit;
|
|
72
|
+
const residualTime = exactValue(analysis.precedence.makespan, durationUnit, analysis.precision);
|
|
73
|
+
const remainingTime = exactValue(analysis.resource.makespan, durationUnit, analysis.precision);
|
|
74
|
+
const pointConversion = durationUnit !== "point"
|
|
75
|
+
? Object.freeze({
|
|
76
|
+
status: "not_applicable",
|
|
77
|
+
targetUnit: null,
|
|
78
|
+
residualTime: null,
|
|
79
|
+
remainingTime: null,
|
|
80
|
+
reason: null,
|
|
81
|
+
})
|
|
82
|
+
: next.velocityForecast === null
|
|
83
|
+
? Object.freeze({
|
|
84
|
+
status: "unavailable",
|
|
85
|
+
targetUnit: null,
|
|
86
|
+
residualTime: null,
|
|
87
|
+
remainingTime: null,
|
|
88
|
+
reason: "Point conversion is unavailable because no exact project velocity is declared.",
|
|
89
|
+
})
|
|
90
|
+
: Object.freeze({
|
|
91
|
+
status: "available",
|
|
92
|
+
targetUnit: next.velocityForecast.targetUnit,
|
|
93
|
+
residualTime: exactValue(convertWithVelocity(analysis.precedence.makespan, next.velocityForecast), next.velocityForecast.targetUnit, analysis.precision),
|
|
94
|
+
remainingTime: exactValue(convertWithVelocity(analysis.resource.makespan, next.velocityForecast), next.velocityForecast.targetUnit, analysis.precision),
|
|
95
|
+
reason: null,
|
|
96
|
+
});
|
|
97
|
+
const taskTimes = Object.freeze(next.tasks.map((task) => Object.freeze({
|
|
98
|
+
taskId: task.id,
|
|
99
|
+
taskTime: exactValue(task.expected, durationUnit, analysis.precision),
|
|
100
|
+
pointForecast: durationUnit === "point" &&
|
|
101
|
+
next.velocityForecast !== null &&
|
|
102
|
+
task.forecastExpected !== null
|
|
103
|
+
? exactValue(task.forecastExpected, next.velocityForecast.targetUnit, analysis.precision)
|
|
104
|
+
: null,
|
|
105
|
+
})));
|
|
106
|
+
return Object.freeze({
|
|
107
|
+
status: "current",
|
|
108
|
+
reason: null,
|
|
109
|
+
focus: Object.freeze({
|
|
110
|
+
frontierMilestoneIds: Object.freeze(frontier),
|
|
111
|
+
activeTaskIds: Object.freeze([...next.groups.active]),
|
|
112
|
+
readyTaskIds: Object.freeze([...next.groups.ready]),
|
|
113
|
+
recommendedTaskIds: Object.freeze([
|
|
114
|
+
...next.recommendation.recommendedTaskIds,
|
|
115
|
+
]),
|
|
116
|
+
startableTaskIds: Object.freeze([
|
|
117
|
+
...next.temporal.authority.startableRecommendedTaskIds,
|
|
118
|
+
]),
|
|
119
|
+
safeStopReasons: Object.freeze([
|
|
120
|
+
...next.temporal.authority.safeStopReasons,
|
|
121
|
+
]),
|
|
122
|
+
entities: compactEntities(next.document, residual),
|
|
123
|
+
timeSummary: Object.freeze({
|
|
124
|
+
residualTime,
|
|
125
|
+
remainingTime,
|
|
126
|
+
taskTimes,
|
|
127
|
+
pointConversion,
|
|
128
|
+
}),
|
|
129
|
+
}),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=editor-dag-focus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-dag-focus.js","sourceRoot":"","sources":["../../src/application/editor-dag-focus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAiB,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAqB,MAAM,oBAAoB,CAAC;AACnE,OAAO,EACL,mBAAmB,GAGpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EACf,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAqDlC,SAAS,WAAW,CAAC,MAAc;IACjC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,UAAU,CACjB,KAAe,EACf,IAAkB,EAClB,SAAiB;IAEjB,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE;QACrC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE;QACzC,IAAI;QACJ,OAAO,EAAE,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC;KACzC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,eAAe,CACtB,QAAsB,EACtB,QAA+C;IAE/C,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACpE,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAChE,CAAC,WAAW,CAAC,IAA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
|
3
3
|
import { formatDocument, } from "../formatter/source-formatter.js";
|
|
4
4
|
function digest(text) {
|
|
5
|
-
return
|
|
5
|
+
return sha256DigestUtf8(text);
|
|
6
6
|
}
|
|
7
7
|
export function planFormat(text, options = {}) {
|
|
8
8
|
const originalDigest = digest(text);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/application/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/application/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EACL,cAAc,GAEf,MAAM,kCAAkC,CAAC;AAsB1C,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,IAAY,EACZ,OAAO,GAAyB,EAAE;IAElC,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,cAAc,CAAC,IAAI,EAAE;QACrC,GAAG,CAAC,OAAO,CAAC,cAAc,KAAK,SAAS;YACtC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC;KAChD,CAAC,CAAC;IACH,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;QAClB,OAAO;YACL,EAAE,EAAE,KAAK;YACT,UAAU,EAAE,SAAS,CAAC,UAAU;YAChC,OAAO,EAAE,KAAK;YACd,cAAc;YACd,aAAa,EAAE,IAAI;YACnB,WAAW,EAAE,IAAI;YACjB,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,EAAE;YACT,WAAW,EAAE,SAAS,CAAC,WAAW;YAClC,oBAAoB,EAAE,SAAS,CAAC,oBAAoB;SACrD,CAAC;IACJ,CAAC;IACD,IAAI,SAAS,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACjF,CAAC;IAED,MAAM,WAAW,GAAG,SAAS,CAAC,aAAa,CAAC;IAC5C,OAAO;QACL,EAAE,EAAE,IAAI;QACR,UAAU,EAAE,SAAS,CAAC,UAAU;QAChC,OAAO,EAAE,SAAS,CAAC,OAAO;QAC1B,cAAc;QACd,aAAa,EAAE,MAAM,CAAC,WAAW,CAAC;QAClC,WAAW;QACX,IAAI,EAAE,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE;YACzC,GAAG,CAAC,OAAO,CAAC,aAAa,KAAK,SAAS;gBACrC,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC;YAC7C,GAAG,CAAC,OAAO,CAAC,YAAY,KAAK,SAAS;gBACpC,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;SAC5C,CAAC;QACF,KAAK,EAAE,SAAS,CAAC,KAAK;QACtB,WAAW,EAAE,SAAS,CAAC,WAAW;QAClC,oBAAoB,EAAE,SAAS,CAAC,oBAAoB;KACrD,CAAC;AACJ,CAAC"}
|
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { DocumentNode } from "../model/syntax.js";
|
|
3
|
-
import type { TextEdit } from "../mutation/text-edits.js";
|
|
4
|
-
import { type MutationEditPlan } from "../mutation/diagnostics.js";
|
|
5
|
-
import { type MilestoneMutationProfile } from "../mutation/milestone.js";
|
|
6
|
-
import { type ProjectMutationProfile } from "../mutation/project.js";
|
|
7
|
-
import { planTaskMutationEdits, type TaskMutationProfile } from "../mutation/task.js";
|
|
8
|
-
import type { Mutation, MutationOptions, MutationResult } from "../mutation/types.js";
|
|
9
|
-
export interface MutationDocumentValidation {
|
|
10
|
-
readonly ok: boolean;
|
|
11
|
-
readonly document: DocumentNode | null;
|
|
12
|
-
readonly documentId: string | null;
|
|
13
|
-
readonly diagnostics: readonly Diagnostic[];
|
|
14
|
-
readonly diagnosticsTruncated: boolean;
|
|
15
|
-
}
|
|
16
|
-
export type MutationDocumentValidator = (text: string, maxDiagnostics: number) => MutationDocumentValidation;
|
|
17
|
-
export interface MutationPlanningProfile {
|
|
18
|
-
readonly project: ProjectMutationProfile;
|
|
19
|
-
readonly task: TaskMutationProfile;
|
|
20
|
-
readonly milestone: MilestoneMutationProfile;
|
|
21
|
-
}
|
|
22
|
-
export declare function planAtomicMutationEdits(text: string, document: Parameters<typeof planTaskMutationEdits>[1], mutation: unknown, profile: MutationPlanningProfile): MutationEditPlan;
|
|
23
|
-
export declare function mergeBatchInsertions(edits: readonly TextEdit[]): readonly TextEdit[];
|
|
24
|
-
export declare function planValidatedMutationRequest(text: string, mutation: unknown, validator: MutationDocumentValidator, profile: MutationPlanningProfile, options?: MutationOptions, batchOnly?: boolean): MutationResult;
|
|
25
|
-
export declare function planMutation(text: string, mutation: Mutation, options?: MutationOptions): MutationResult;
|
|
26
|
-
export declare function planBatchMutation(text: string, mutation: unknown, options?: MutationOptions): MutationResult;
|
|
1
|
+
export * from "../mutation/planner.js";
|
|
27
2
|
//# sourceMappingURL=mutate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutate.d.ts","sourceRoot":"","sources":["../../src/application/mutate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mutate.d.ts","sourceRoot":"","sources":["../../src/application/mutate.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
|
|
@@ -1,206 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { createUnifiedDiff } from "../editing/unified-diff.js";
|
|
3
|
-
import { limitDiagnostics, normalizeMaxDiagnostics, sortDiagnostics, } from "../model/diagnostics.js";
|
|
4
|
-
import { applyTextEdits, normalizeTextEdits } from "../mutation/text-edits.js";
|
|
5
|
-
import { mutationDiagnostic } from "../mutation/diagnostics.js";
|
|
6
|
-
import { planGateMutationEdits } from "../mutation/gate.js";
|
|
7
|
-
import { TARGET_MILESTONE_MUTATION_PROFILE, planMilestoneMutationEdits, } from "../mutation/milestone.js";
|
|
8
|
-
import { TARGET_GRAMMAR_3_PROJECT_MUTATION_PROFILE, planProjectMutationEdits, } from "../mutation/project.js";
|
|
9
|
-
import { planResourceMutationEdits } from "../mutation/resource.js";
|
|
10
|
-
import { TARGET_GRAMMAR_3_TASK_MUTATION_PROFILE, planTaskMutationEdits, } from "../mutation/task.js";
|
|
11
|
-
import { checkDocument } from "./check.js";
|
|
12
|
-
function digest(text) {
|
|
13
|
-
return `sha256:${createHash("sha256").update(text, "utf8").digest("hex")}`;
|
|
14
|
-
}
|
|
15
|
-
function failure(originalDigest, documentId, diagnostics, maximum, alreadyTruncated) {
|
|
16
|
-
const limited = limitDiagnostics(sortDiagnostics(diagnostics), maximum);
|
|
17
|
-
return {
|
|
18
|
-
ok: false,
|
|
19
|
-
documentId,
|
|
20
|
-
changed: false,
|
|
21
|
-
originalDigest,
|
|
22
|
-
updatedDigest: null,
|
|
23
|
-
updatedText: null,
|
|
24
|
-
diff: null,
|
|
25
|
-
edits: [],
|
|
26
|
-
diagnostics: limited.diagnostics,
|
|
27
|
-
diagnosticsTruncated: alreadyTruncated || limited.truncated,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function runtimeKind(value) {
|
|
31
|
-
return value !== null && typeof value === "object"
|
|
32
|
-
? value["kind"]
|
|
33
|
-
: undefined;
|
|
34
|
-
}
|
|
35
|
-
const activeMutationPlanningProfile = Object.freeze({
|
|
36
|
-
project: TARGET_GRAMMAR_3_PROJECT_MUTATION_PROFILE,
|
|
37
|
-
task: TARGET_GRAMMAR_3_TASK_MUTATION_PROFILE,
|
|
38
|
-
milestone: TARGET_MILESTONE_MUTATION_PROFILE,
|
|
39
|
-
});
|
|
40
|
-
function validateActiveDocument(text, maxDiagnostics) {
|
|
41
|
-
const checked = checkDocument(text, { maxDiagnostics });
|
|
42
|
-
return {
|
|
43
|
-
ok: checked.ok,
|
|
44
|
-
document: checked.document,
|
|
45
|
-
documentId: checked.documentId,
|
|
46
|
-
diagnostics: checked.diagnostics,
|
|
47
|
-
diagnosticsTruncated: checked.diagnosticsTruncated,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
export function planAtomicMutationEdits(text, document, mutation, profile) {
|
|
51
|
-
const kind = runtimeKind(mutation);
|
|
52
|
-
if (kind === "project.set") {
|
|
53
|
-
return planProjectMutationEdits(text, document, mutation, profile.project);
|
|
54
|
-
}
|
|
55
|
-
if (typeof kind === "string" && kind.startsWith("milestone.")) {
|
|
56
|
-
return planMilestoneMutationEdits(text, document, mutation, profile.milestone);
|
|
57
|
-
}
|
|
58
|
-
if (typeof kind === "string" && kind.startsWith("gate.")) {
|
|
59
|
-
return planGateMutationEdits(text, document, mutation);
|
|
60
|
-
}
|
|
61
|
-
if (typeof kind === "string" && kind.startsWith("resource.")) {
|
|
62
|
-
return planResourceMutationEdits(text, document, mutation);
|
|
63
|
-
}
|
|
64
|
-
return planTaskMutationEdits(text, document, mutation, profile.task);
|
|
65
|
-
}
|
|
66
|
-
function batchRequestError(value) {
|
|
67
|
-
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
68
|
-
return "batch mutation request is not an object";
|
|
69
|
-
}
|
|
70
|
-
const request = value;
|
|
71
|
-
if (request["kind"] !== "batch")
|
|
72
|
-
return "batch mutation kind is invalid";
|
|
73
|
-
if (Object.keys(request).some((name) => !["kind", "mutations"].includes(name))) {
|
|
74
|
-
return "batch mutation request contains unsupported fields";
|
|
75
|
-
}
|
|
76
|
-
if (!Array.isArray(request["mutations"]) || request["mutations"].length === 0) {
|
|
77
|
-
return "batch mutation requires at least one atomic mutation";
|
|
78
|
-
}
|
|
79
|
-
if (request["mutations"].some((item) => runtimeKind(item) === "batch")) {
|
|
80
|
-
return "batch mutation does not allow nested batches";
|
|
81
|
-
}
|
|
82
|
-
const targets = request["mutations"].map((item) => {
|
|
83
|
-
if (item === null || typeof item !== "object")
|
|
84
|
-
return undefined;
|
|
85
|
-
const record = item;
|
|
86
|
-
if (record["kind"] === "project.set")
|
|
87
|
-
return "project";
|
|
88
|
-
return typeof record["id"] === "string" ? `entity:${record["id"]}` : undefined;
|
|
89
|
-
});
|
|
90
|
-
if (targets.some((target) => target === undefined)) {
|
|
91
|
-
return "atomic mutations in a batch require a project target or string id";
|
|
92
|
-
}
|
|
93
|
-
if (new Set(targets).size !== targets.length) {
|
|
94
|
-
return "the same target cannot be changed more than once in a batch";
|
|
95
|
-
}
|
|
96
|
-
return undefined;
|
|
97
|
-
}
|
|
98
|
-
export function mergeBatchInsertions(edits) {
|
|
99
|
-
const nonInsertions = [];
|
|
100
|
-
const insertions = new Map();
|
|
101
|
-
for (const [requestIndex, edit] of edits.entries()) {
|
|
102
|
-
if (edit.startOffset === edit.endOffset) {
|
|
103
|
-
const group = insertions.get(edit.startOffset) ?? [];
|
|
104
|
-
group.push({ edit, requestIndex });
|
|
105
|
-
insertions.set(edit.startOffset, group);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
nonInsertions.push(edit);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
const mergedInsertions = [...insertions.entries()].map(([offset, group]) => {
|
|
112
|
-
const structuralRank = ({ edit }) => {
|
|
113
|
-
const withoutLeadingEndings = edit.replacement.replace(/^(?:\r?\n)*/, "");
|
|
114
|
-
return withoutLeadingEndings.startsWith(" ") ? 0 : 1;
|
|
115
|
-
};
|
|
116
|
-
group.sort((left, right) => structuralRank(left) - structuralRank(right) || left.requestIndex - right.requestIndex);
|
|
117
|
-
return {
|
|
118
|
-
startOffset: offset,
|
|
119
|
-
endOffset: offset,
|
|
120
|
-
replacement: group.map(({ edit }) => edit.replacement).join(""),
|
|
121
|
-
};
|
|
122
|
-
});
|
|
123
|
-
return [...nonInsertions, ...mergedInsertions];
|
|
124
|
-
}
|
|
125
|
-
function planAllMutationEdits(text, document, mutation, profile) {
|
|
126
|
-
if (runtimeKind(mutation) !== "batch") {
|
|
127
|
-
return planAtomicMutationEdits(text, document, mutation, profile);
|
|
128
|
-
}
|
|
129
|
-
const error = batchRequestError(mutation);
|
|
130
|
-
if (error !== undefined) {
|
|
131
|
-
return { edits: [], diagnostic: mutationDiagnostic("PTMUT-301", error) };
|
|
132
|
-
}
|
|
133
|
-
const batch = mutation;
|
|
134
|
-
const edits = [];
|
|
135
|
-
for (const atomic of batch.mutations) {
|
|
136
|
-
const planned = planAtomicMutationEdits(text, document, atomic, profile);
|
|
137
|
-
if (planned.diagnostic !== undefined)
|
|
138
|
-
return planned;
|
|
139
|
-
edits.push(...planned.edits);
|
|
140
|
-
}
|
|
141
|
-
return { edits: mergeBatchInsertions(edits) };
|
|
142
|
-
}
|
|
143
|
-
export function planValidatedMutationRequest(text, mutation, validator, profile, options = {}, batchOnly = false) {
|
|
144
|
-
const maximum = normalizeMaxDiagnostics(options.maxDiagnostics);
|
|
145
|
-
const originalDigest = digest(text);
|
|
146
|
-
const original = validator(text, maximum);
|
|
147
|
-
if (!original.ok) {
|
|
148
|
-
return failure(originalDigest, original.documentId, original.diagnostics, maximum, original.diagnosticsTruncated);
|
|
149
|
-
}
|
|
150
|
-
if (original.document === null) {
|
|
151
|
-
throw new Error("mutation validator accepted a document without an AST");
|
|
152
|
-
}
|
|
153
|
-
if (batchOnly && runtimeKind(mutation) !== "batch") {
|
|
154
|
-
return failure(originalDigest, original.documentId, [
|
|
155
|
-
...original.diagnostics,
|
|
156
|
-
mutationDiagnostic("PTMUT-301", "mutation apply requires a top-level batch request"),
|
|
157
|
-
], maximum, original.diagnosticsTruncated);
|
|
158
|
-
}
|
|
159
|
-
const planned = planAllMutationEdits(text, original.document, mutation, profile);
|
|
160
|
-
if (planned.diagnostic !== undefined) {
|
|
161
|
-
return failure(originalDigest, original.documentId, [...original.diagnostics, planned.diagnostic], maximum, original.diagnosticsTruncated);
|
|
162
|
-
}
|
|
163
|
-
let edits;
|
|
164
|
-
try {
|
|
165
|
-
edits = normalizeTextEdits(text, planned.edits, "mutation");
|
|
166
|
-
}
|
|
167
|
-
catch (error) {
|
|
168
|
-
if (runtimeKind(mutation) !== "batch")
|
|
169
|
-
throw error;
|
|
170
|
-
return failure(originalDigest, original.documentId, [
|
|
171
|
-
...original.diagnostics,
|
|
172
|
-
mutationDiagnostic("PTMUT-301", "TextEdit ranges in the batch mutation overlap"),
|
|
173
|
-
], maximum, original.diagnosticsTruncated);
|
|
174
|
-
}
|
|
175
|
-
const updatedText = applyTextEdits(text, edits);
|
|
176
|
-
const candidate = validator(updatedText, maximum);
|
|
177
|
-
if (!candidate.ok) {
|
|
178
|
-
return failure(originalDigest, original.documentId, candidate.diagnostics, maximum, candidate.diagnosticsTruncated);
|
|
179
|
-
}
|
|
180
|
-
return {
|
|
181
|
-
ok: true,
|
|
182
|
-
documentId: original.documentId,
|
|
183
|
-
changed: updatedText !== text,
|
|
184
|
-
originalDigest,
|
|
185
|
-
updatedDigest: digest(updatedText),
|
|
186
|
-
updatedText,
|
|
187
|
-
diff: createUnifiedDiff(text, updatedText, {
|
|
188
|
-
...(options.originalLabel === undefined
|
|
189
|
-
? {}
|
|
190
|
-
: { originalLabel: options.originalLabel }),
|
|
191
|
-
...(options.updatedLabel === undefined
|
|
192
|
-
? {}
|
|
193
|
-
: { updatedLabel: options.updatedLabel }),
|
|
194
|
-
}),
|
|
195
|
-
edits,
|
|
196
|
-
diagnostics: candidate.diagnostics,
|
|
197
|
-
diagnosticsTruncated: candidate.diagnosticsTruncated,
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
export function planMutation(text, mutation, options = {}) {
|
|
201
|
-
return planValidatedMutationRequest(text, mutation, validateActiveDocument, activeMutationPlanningProfile, options);
|
|
202
|
-
}
|
|
203
|
-
export function planBatchMutation(text, mutation, options = {}) {
|
|
204
|
-
return planValidatedMutationRequest(text, mutation, validateActiveDocument, activeMutationPlanningProfile, options, true);
|
|
205
|
-
}
|
|
1
|
+
export * from "../mutation/planner.js";
|
|
206
2
|
//# sourceMappingURL=mutate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutate.js","sourceRoot":"","sources":["../../src/application/mutate.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"mutate.js","sourceRoot":"","sources":["../../src/application/mutate.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
|
package/dist/application/next.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sha256DigestUtf8 } from "../model/sha256.js";
|
|
2
2
|
import { analyzeDocument, } from "./analyze.js";
|
|
3
3
|
import { compareStableStrings, hasErrors, sortDiagnostics } from "../model/diagnostics.js";
|
|
4
4
|
import { compare } from "../model/rational.js";
|
|
@@ -142,7 +142,7 @@ export function selectNextTasks(text, options = {}) {
|
|
|
142
142
|
const explainDepth = options.explainDepth ?? 1;
|
|
143
143
|
const capacityOverrides = options.capacityOverrides ?? new Map();
|
|
144
144
|
const sourceDigest = options.sourceDigest ??
|
|
145
|
-
|
|
145
|
+
sha256DigestUtf8(text);
|
|
146
146
|
const analysis = analyzeDocument(text, {
|
|
147
147
|
mode: "both",
|
|
148
148
|
capacityOverrides,
|