@agentxm/workspace-lint 0.28.4-bootstrap.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 +110 -0
- package/dist/src/catalog/index.d.ts +31 -0
- package/dist/src/catalog/index.js +60 -0
- package/dist/src/catalog/workspace/agents-detected-declared.d.ts +23 -0
- package/dist/src/catalog/workspace/agents-detected-declared.js +61 -0
- package/dist/src/catalog/workspace/agents-recognized.d.ts +23 -0
- package/dist/src/catalog/workspace/agents-recognized.js +64 -0
- package/dist/src/catalog/workspace/axm-skill-compatible.d.ts +4 -0
- package/dist/src/catalog/workspace/axm-skill-compatible.js +51 -0
- package/dist/src/catalog/workspace/configured-but-not-installed.d.ts +4 -0
- package/dist/src/catalog/workspace/configured-but-not-installed.js +88 -0
- package/dist/src/catalog/workspace/desired-state-reconcilable.d.ts +4 -0
- package/dist/src/catalog/workspace/desired-state-reconcilable.js +96 -0
- package/dist/src/catalog/workspace/display-paths.d.ts +7 -0
- package/dist/src/catalog/workspace/display-paths.js +4 -0
- package/dist/src/catalog/workspace/helpers/empty.d.ts +18 -0
- package/dist/src/catalog/workspace/helpers/empty.js +16 -0
- package/dist/src/catalog/workspace/helpers/finding.d.ts +10 -0
- package/dist/src/catalog/workspace/helpers/finding.js +11 -0
- package/dist/src/catalog/workspace/helpers/source-categorize.d.ts +16 -0
- package/dist/src/catalog/workspace/helpers/source-categorize.js +51 -0
- package/dist/src/catalog/workspace/hook-ownership-ambiguous.d.ts +4 -0
- package/dist/src/catalog/workspace/hook-ownership-ambiguous.js +25 -0
- package/dist/src/catalog/workspace/initialized.d.ts +22 -0
- package/dist/src/catalog/workspace/initialized.js +58 -0
- package/dist/src/catalog/workspace/instructions-agent-supported.d.ts +4 -0
- package/dist/src/catalog/workspace/instructions-agent-supported.js +38 -0
- package/dist/src/catalog/workspace/instructions-gitignore-current.d.ts +4 -0
- package/dist/src/catalog/workspace/instructions-gitignore-current.js +49 -0
- package/dist/src/catalog/workspace/instructions-source-present.d.ts +4 -0
- package/dist/src/catalog/workspace/instructions-source-present.js +41 -0
- package/dist/src/catalog/workspace/instructions-target-current.d.ts +4 -0
- package/dist/src/catalog/workspace/instructions-target-current.js +51 -0
- package/dist/src/catalog/workspace/instructions-target-stale.d.ts +9 -0
- package/dist/src/catalog/workspace/instructions-target-stale.js +41 -0
- package/dist/src/catalog/workspace/instructions-target-unowned.d.ts +10 -0
- package/dist/src/catalog/workspace/instructions-target-unowned.js +59 -0
- package/dist/src/catalog/workspace/knowledge-state-valid.d.ts +5 -0
- package/dist/src/catalog/workspace/knowledge-state-valid.js +65 -0
- package/dist/src/catalog/workspace/lockfile-valid.d.ts +5 -0
- package/dist/src/catalog/workspace/lockfile-valid.js +63 -0
- package/dist/src/catalog/workspace/managed-file-unowned.d.ts +4 -0
- package/dist/src/catalog/workspace/managed-file-unowned.js +25 -0
- package/dist/src/catalog/workspace/mcps-agent-drift.d.ts +4 -0
- package/dist/src/catalog/workspace/mcps-agent-drift.js +139 -0
- package/dist/src/catalog/workspace/mcps-agent-orphaned.d.ts +4 -0
- package/dist/src/catalog/workspace/mcps-agent-orphaned.js +64 -0
- package/dist/src/catalog/workspace/mcps-no-secret-literal.d.ts +4 -0
- package/dist/src/catalog/workspace/mcps-no-secret-literal.js +67 -0
- package/dist/src/catalog/workspace/mcps-shared-target-compatible.d.ts +4 -0
- package/dist/src/catalog/workspace/mcps-shared-target-compatible.js +58 -0
- package/dist/src/catalog/workspace/mcps-transport-exclusivity.d.ts +4 -0
- package/dist/src/catalog/workspace/mcps-transport-exclusivity.js +67 -0
- package/dist/src/catalog/workspace/packs-declarations-valid.d.ts +19 -0
- package/dist/src/catalog/workspace/packs-declarations-valid.js +110 -0
- package/dist/src/catalog/workspace/packs-dependencies-resolved.d.ts +5 -0
- package/dist/src/catalog/workspace/packs-dependencies-resolved.js +49 -0
- package/dist/src/catalog/workspace/projections-current.d.ts +15 -0
- package/dist/src/catalog/workspace/projections-current.js +35 -0
- package/dist/src/catalog/workspace/settings-keys-recognized.d.ts +17 -0
- package/dist/src/catalog/workspace/settings-keys-recognized.js +90 -0
- package/dist/src/catalog/workspace/settings-schema-valid.d.ts +27 -0
- package/dist/src/catalog/workspace/settings-schema-valid.js +68 -0
- package/dist/src/catalog/workspace/skills-artifacts-correct.d.ts +28 -0
- package/dist/src/catalog/workspace/skills-artifacts-correct.js +143 -0
- package/dist/src/catalog/workspace/skills-declarations-valid.d.ts +27 -0
- package/dist/src/catalog/workspace/skills-declarations-valid.js +102 -0
- package/dist/src/catalog/workspace/skills-integrity-valid.d.ts +28 -0
- package/dist/src/catalog/workspace/skills-integrity-valid.js +95 -0
- package/dist/src/catalog/workspace/skills-lockfile-aligned.d.ts +5 -0
- package/dist/src/catalog/workspace/skills-lockfile-aligned.js +64 -0
- package/dist/src/catalog/workspace/source-endpoints-aligned.d.ts +5 -0
- package/dist/src/catalog/workspace/source-endpoints-aligned.js +75 -0
- package/dist/src/catalog/workspace-fixtures/fixture-state.d.ts +8 -0
- package/dist/src/catalog/workspace-fixtures/fixture-state.js +120 -0
- package/dist/src/catalog/workspace-fixtures/interpret-ops.d.ts +11 -0
- package/dist/src/catalog/workspace-fixtures/interpret-ops.js +9 -0
- package/dist/src/catalog/workspace-read-model/lint-workspace.d.ts +191 -0
- package/dist/src/catalog/workspace-read-model/lint-workspace.js +651 -0
- package/dist/src/catalog/workspace-read-model/manifest-json.d.ts +14 -0
- package/dist/src/catalog/workspace-read-model/manifest-json.js +27 -0
- package/dist/src/catalog/workspace.d.ts +58 -0
- package/dist/src/catalog/workspace.js +164 -0
- package/dist/src/catalog-contexts.d.ts +106 -0
- package/dist/src/catalog-contexts.js +95 -0
- package/dist/src/cli.d.ts +239 -0
- package/dist/src/cli.js +1077 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.js +21 -0
- package/dist/src/json-schema.d.ts +121 -0
- package/dist/src/json-schema.js +99 -0
- package/dist/src/run/errors.d.ts +23 -0
- package/dist/src/run/errors.js +21 -0
- package/dist/src/run/settings.d.ts +63 -0
- package/dist/src/run/settings.js +139 -0
- package/dist/src/run/staged-workspace.d.ts +31 -0
- package/dist/src/run/staged-workspace.js +273 -0
- package/dist/src/workspace-context.d.ts +129 -0
- package/dist/src/workspace-context.js +12 -0
- package/package.json +55 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { WorkspaceRuleContext, WorkspaceSubject } from "./workspace-context.js";
|
|
2
|
+
export { CATALOG_GROUP_ORDER, LIVE_ONLY_LINT_CATALOGS, LINT_CATALOGS, REPOSITORY_LINT_CATALOGS, emptyCatalogRuleContexts, lintCatalogsForView, type CatalogContext, type CatalogGroup, type CatalogRuleContexts, type LintView, } from "./catalog-contexts.js";
|
|
3
|
+
export { LintInputSchema, LintJsonDocumentSchema, LintJsonFindingSchema, type LintInput, type LintJsonDocument, type LintJsonFinding, } from "./json-schema.js";
|
|
4
|
+
export { findingsForProjectionFacts } from "./catalog/workspace/projections-current.js";
|
|
5
|
+
export { collectRenderedFindings, countFindings, detectPublishGateDrift, evaluateAllCatalogs, renderFindingsText, resolveLintExitCategory, summarizeEvaluations, toLintHumanBlocks, toLintJsonDocument, type FindingCounts, type GroupEvaluations, type LintHumanBlock, type LintHumanDiagnostic, type LintHumanReporter, type LintExitCategory, type LintSummary, type RenderFindingsArgs, type RenderedFinding, } from "./cli.js";
|
|
6
|
+
export { allCatalogErrorRuleIds, allCatalogRuleIds, buildAcquiredInstalledSkillInfo, buildInstalledPackInfo, buildLintWorkspace, buildNativeInstalledSkillInfo, acquiredSkillDisplayRoot, registryNativeSkillDisplayRoot, registryPackDisplayRoot, liveOnlyWorkspaceRules, repositoryWorkspaceRules, workspaceRules, type BuildInstalledPackInfoArgs, type BuildAcquiredInstalledSkillInfoArgs, type BuildInstalledSkillInfoNativeArgs, type BuildLintWorkspaceArgs, type LintWorkspace, type LintWorkspaceView, } from "./catalog/index.js";
|
|
7
|
+
export { LintStagingFailed } from "./run/errors.js";
|
|
8
|
+
export { isolatedGitEnvironment, materializeGitIndexWorkspace, type StagedWorkspace, } from "./run/staged-workspace.js";
|
|
9
|
+
export { applyDeterminedRepairs, lintConfigFromSettings, loadSettingsDocument, remapLintSummaryPaths, resolveLintRoot, type PathRemapper, } from "./run/settings.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Catalog table — the exhaustive group -> rules / group -> contexts mapping
|
|
2
|
+
// the runner drives off.
|
|
3
|
+
export { CATALOG_GROUP_ORDER, LIVE_ONLY_LINT_CATALOGS, LINT_CATALOGS, REPOSITORY_LINT_CATALOGS, emptyCatalogRuleContexts, lintCatalogsForView, } from "./catalog-contexts.js";
|
|
4
|
+
// `--json` document schema + derived types
|
|
5
|
+
export { LintInputSchema, LintJsonDocumentSchema, LintJsonFindingSchema, } from "./json-schema.js";
|
|
6
|
+
export { findingsForProjectionFacts } from "./catalog/workspace/projections-current.js";
|
|
7
|
+
// Lint runner (Phase 5) — reusable primitives the `axm lint` CLI composes
|
|
8
|
+
// over. Keeps the CLI command file a thin surface over flag parsing and
|
|
9
|
+
// rendering per task 5.11.
|
|
10
|
+
export { collectRenderedFindings, countFindings, detectPublishGateDrift, evaluateAllCatalogs, renderFindingsText, resolveLintExitCategory, summarizeEvaluations, toLintHumanBlocks, toLintJsonDocument, } from "./cli.js";
|
|
11
|
+
// Rule catalogs (Phase 3a lands `skillRules`; Phase 3b lands `packRules`;
|
|
12
|
+
// Phase 3c lands `workspaceRules`). Importing this index triggers each
|
|
13
|
+
// catalog's module-load `registerLintRuleIds(...)` call so
|
|
14
|
+
// `axm.json` `lint.rules` keys can reference any exported rule id.
|
|
15
|
+
export { allCatalogErrorRuleIds, allCatalogRuleIds, buildAcquiredInstalledSkillInfo, buildInstalledPackInfo, buildLintWorkspace, buildNativeInstalledSkillInfo, acquiredSkillDisplayRoot, registryNativeSkillDisplayRoot, registryPackDisplayRoot, liveOnlyWorkspaceRules, repositoryWorkspaceRules, workspaceRules, } from "./catalog/index.js";
|
|
16
|
+
// Lint-run policy: root resolution, settings-derived configuration,
|
|
17
|
+
// determined repairs, staged Git-index input, and path remapping.
|
|
18
|
+
export { LintStagingFailed } from "./run/errors.js";
|
|
19
|
+
export { isolatedGitEnvironment, materializeGitIndexWorkspace, } from "./run/staged-workspace.js";
|
|
20
|
+
export { applyDeterminedRepairs, lintConfigFromSettings, loadSettingsDocument, remapLintSummaryPaths, resolveLintRoot, } from "./run/settings.js";
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `axm lint --json` document, as a schema.
|
|
3
|
+
*
|
|
4
|
+
* The shape used to exist only as a hand-written interface in `cli.ts` while
|
|
5
|
+
* the CLI emitted it through `Schema.Any` — so nothing checked that what the
|
|
6
|
+
* runner built and what the renderer promised were the same document, and
|
|
7
|
+
* `--json` consumers had no schema to generate against.
|
|
8
|
+
*
|
|
9
|
+
* `LintJsonDocument` and `LintJsonFinding` are now derived from these schemas,
|
|
10
|
+
* so the emitted document and its contract cannot drift.
|
|
11
|
+
*
|
|
12
|
+
* @experimental This API is unstable and may change without notice.
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
*/
|
|
15
|
+
import * as Schema from "effect/Schema";
|
|
16
|
+
/**
|
|
17
|
+
* One finding as emitted under `--json`.
|
|
18
|
+
*
|
|
19
|
+
* @experimental This API is unstable and may change without notice.
|
|
20
|
+
*/
|
|
21
|
+
export declare const LintJsonFindingSchema: Schema.Struct<{
|
|
22
|
+
readonly group: Schema.Literals<readonly ["skill", "pack", "subagent", "mcp-server", "hook", "rule", "knowledge", "workspace"]>;
|
|
23
|
+
readonly kind: Schema.Literal<"advisory">;
|
|
24
|
+
readonly ruleId: Schema.String;
|
|
25
|
+
readonly severity: Schema.Literals<readonly ["error", "warning", "info"]>;
|
|
26
|
+
readonly message: Schema.String;
|
|
27
|
+
readonly displayRoot: Schema.String;
|
|
28
|
+
readonly path: Schema.String;
|
|
29
|
+
readonly subject: Schema.String;
|
|
30
|
+
readonly authority: Schema.String;
|
|
31
|
+
readonly observed: Schema.String;
|
|
32
|
+
readonly expected: Schema.String;
|
|
33
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
34
|
+
readonly file: Schema.String;
|
|
35
|
+
readonly line: Schema.optional<Schema.Number>;
|
|
36
|
+
readonly column: Schema.optional<Schema.Number>;
|
|
37
|
+
}>>;
|
|
38
|
+
}>;
|
|
39
|
+
export declare const LintInputSchema: Schema.Union<readonly [Schema.Struct<{
|
|
40
|
+
readonly view: Schema.Literal<"workspace">;
|
|
41
|
+
}>, Schema.Struct<{
|
|
42
|
+
readonly view: Schema.Literal<"git-index">;
|
|
43
|
+
readonly fingerprint: Schema.String;
|
|
44
|
+
}>]>;
|
|
45
|
+
export type LintInput = typeof LintInputSchema.Type;
|
|
46
|
+
/**
|
|
47
|
+
* JSON envelope shape returned under `axm lint --json`.
|
|
48
|
+
*
|
|
49
|
+
* Matches the registry publish failure envelope structure (`findings[]`,
|
|
50
|
+
* `displayRoot` per entry, per-finding `path` pre-composed).
|
|
51
|
+
*
|
|
52
|
+
* @experimental This API is unstable and may change without notice.
|
|
53
|
+
*/
|
|
54
|
+
export declare const LintJsonDocumentSchema: Schema.Struct<{
|
|
55
|
+
readonly input: Schema.Union<readonly [Schema.Struct<{
|
|
56
|
+
readonly view: Schema.Literal<"workspace">;
|
|
57
|
+
}>, Schema.Struct<{
|
|
58
|
+
readonly view: Schema.Literal<"git-index">;
|
|
59
|
+
readonly fingerprint: Schema.String;
|
|
60
|
+
}>]>;
|
|
61
|
+
readonly axmSkillCompatibility: Schema.optionalKey<Schema.Struct<{
|
|
62
|
+
readonly status: Schema.Literals<readonly ["compatible", "incompatible"]>;
|
|
63
|
+
readonly cliVersion: Schema.NullOr<Schema.String>;
|
|
64
|
+
readonly skillVersion: Schema.NullOr<Schema.String>;
|
|
65
|
+
readonly source: Schema.NullOr<Schema.String>;
|
|
66
|
+
readonly declaredCliVersion: Schema.NullOr<Schema.String>;
|
|
67
|
+
readonly declaredCliVersionRange: Schema.NullOr<Schema.String>;
|
|
68
|
+
readonly reasonCode: Schema.NullOr<Schema.Literals<readonly ["cli-version-unavailable", "axm-skill-missing", "axm-skill-manifest-invalid", "compatibility-metadata-missing", "compatibility-metadata-malformed", "skill-release-mismatch", "skill-release-range-mismatch", "cli-version-incompatible"]>>;
|
|
69
|
+
readonly detail: Schema.NullOr<Schema.String>;
|
|
70
|
+
readonly recovery: Schema.Struct<{
|
|
71
|
+
readonly action: Schema.Literals<readonly ["none", "inspect-cli", "upgrade-cli", "update-registry-skill", "install-bundled-skill", "preserve-authored-skill"]>;
|
|
72
|
+
readonly targetCliVersion: Schema.NullOr<Schema.String>;
|
|
73
|
+
readonly targetSkillVersion: Schema.NullOr<Schema.String>;
|
|
74
|
+
readonly nextAction: Schema.NullOr<Schema.String>;
|
|
75
|
+
readonly steps: Schema.$Array<Schema.Struct<{
|
|
76
|
+
readonly boundary: Schema.Literals<readonly ["executable", "workspace", "verification"]>;
|
|
77
|
+
readonly command: Schema.String;
|
|
78
|
+
readonly preview: Schema.Boolean;
|
|
79
|
+
}>>;
|
|
80
|
+
}>;
|
|
81
|
+
}>>;
|
|
82
|
+
readonly findings: Schema.$Array<Schema.Struct<{
|
|
83
|
+
readonly group: Schema.Literals<readonly ["skill", "pack", "subagent", "mcp-server", "hook", "rule", "knowledge", "workspace"]>;
|
|
84
|
+
readonly kind: Schema.Literal<"advisory">;
|
|
85
|
+
readonly ruleId: Schema.String;
|
|
86
|
+
readonly severity: Schema.Literals<readonly ["error", "warning", "info"]>;
|
|
87
|
+
readonly message: Schema.String;
|
|
88
|
+
readonly displayRoot: Schema.String;
|
|
89
|
+
readonly path: Schema.String;
|
|
90
|
+
readonly subject: Schema.String;
|
|
91
|
+
readonly authority: Schema.String;
|
|
92
|
+
readonly observed: Schema.String;
|
|
93
|
+
readonly expected: Schema.String;
|
|
94
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
95
|
+
readonly file: Schema.String;
|
|
96
|
+
readonly line: Schema.optional<Schema.Number>;
|
|
97
|
+
readonly column: Schema.optional<Schema.Number>;
|
|
98
|
+
}>>;
|
|
99
|
+
}>>;
|
|
100
|
+
readonly summary: Schema.Struct<{
|
|
101
|
+
readonly total: Schema.Number;
|
|
102
|
+
readonly errors: Schema.Number;
|
|
103
|
+
readonly warnings: Schema.Number;
|
|
104
|
+
readonly infos: Schema.Number;
|
|
105
|
+
readonly exitCategory: Schema.Literals<readonly ["clean", "warnings", "errors"]>;
|
|
106
|
+
}>;
|
|
107
|
+
readonly driftBanner: Schema.$Array<Schema.String>;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* One finding as emitted under `--json`.
|
|
111
|
+
*
|
|
112
|
+
* @experimental This API is unstable and may change without notice.
|
|
113
|
+
*/
|
|
114
|
+
export type LintJsonFinding = typeof LintJsonFindingSchema.Type;
|
|
115
|
+
/**
|
|
116
|
+
* The `--json` document.
|
|
117
|
+
*
|
|
118
|
+
* @experimental This API is unstable and may change without notice.
|
|
119
|
+
*/
|
|
120
|
+
export type LintJsonDocument = typeof LintJsonDocumentSchema.Type;
|
|
121
|
+
//# sourceMappingURL=json-schema.d.ts.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `axm lint --json` document, as a schema.
|
|
3
|
+
*
|
|
4
|
+
* The shape used to exist only as a hand-written interface in `cli.ts` while
|
|
5
|
+
* the CLI emitted it through `Schema.Any` — so nothing checked that what the
|
|
6
|
+
* runner built and what the renderer promised were the same document, and
|
|
7
|
+
* `--json` consumers had no schema to generate against.
|
|
8
|
+
*
|
|
9
|
+
* `LintJsonDocument` and `LintJsonFinding` are now derived from these schemas,
|
|
10
|
+
* so the emitted document and its contract cannot drift.
|
|
11
|
+
*
|
|
12
|
+
* @experimental This API is unstable and may change without notice.
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
*/
|
|
15
|
+
import * as Schema from "effect/Schema";
|
|
16
|
+
import { CATALOG_GROUP_ORDER } from "./catalog-contexts.js";
|
|
17
|
+
import { AxmSkillCompatibilitySchema } from "@agentxm/extension-workspace";
|
|
18
|
+
const LintJsonLocationSchema = Schema.Struct({
|
|
19
|
+
file: Schema.String,
|
|
20
|
+
line: Schema.optional(Schema.Number),
|
|
21
|
+
column: Schema.optional(Schema.Number),
|
|
22
|
+
}).annotate({
|
|
23
|
+
identifier: "LintJsonLocation",
|
|
24
|
+
title: "Lint Finding Location",
|
|
25
|
+
description: "Document-relative location a finding points at.",
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* One finding as emitted under `--json`.
|
|
29
|
+
*
|
|
30
|
+
* @experimental This API is unstable and may change without notice.
|
|
31
|
+
*/
|
|
32
|
+
export const LintJsonFindingSchema = Schema.Struct({
|
|
33
|
+
group: Schema.Literals(CATALOG_GROUP_ORDER).annotate({
|
|
34
|
+
identifier: "LintFindingGroup",
|
|
35
|
+
title: "Lint Finding Group",
|
|
36
|
+
description: "Rule catalog the finding came from.",
|
|
37
|
+
}),
|
|
38
|
+
kind: Schema.Literal("advisory"),
|
|
39
|
+
ruleId: Schema.String,
|
|
40
|
+
severity: Schema.Literals(["error", "warning", "info"]),
|
|
41
|
+
message: Schema.String,
|
|
42
|
+
displayRoot: Schema.String,
|
|
43
|
+
path: Schema.String,
|
|
44
|
+
subject: Schema.String,
|
|
45
|
+
authority: Schema.String,
|
|
46
|
+
observed: Schema.String,
|
|
47
|
+
expected: Schema.String,
|
|
48
|
+
location: Schema.optional(LintJsonLocationSchema),
|
|
49
|
+
}).annotate({
|
|
50
|
+
identifier: "LintJsonFinding",
|
|
51
|
+
title: "Lint Finding",
|
|
52
|
+
description: "A single lint finding with its rule, severity, and rendered path.",
|
|
53
|
+
});
|
|
54
|
+
const LintJsonSummarySchema = Schema.Struct({
|
|
55
|
+
total: Schema.Number,
|
|
56
|
+
errors: Schema.Number,
|
|
57
|
+
warnings: Schema.Number,
|
|
58
|
+
infos: Schema.Number,
|
|
59
|
+
exitCategory: Schema.Literals(["clean", "warnings", "errors"]).annotate({
|
|
60
|
+
identifier: "LintExitCategory",
|
|
61
|
+
title: "Lint Exit Category",
|
|
62
|
+
description: "Whether the run was clean, produced warnings, or produced errors.",
|
|
63
|
+
}),
|
|
64
|
+
}).annotate({
|
|
65
|
+
identifier: "LintJsonSummary",
|
|
66
|
+
title: "Lint Summary",
|
|
67
|
+
description: "Finding counts by severity plus the derived exit category.",
|
|
68
|
+
});
|
|
69
|
+
export const LintInputSchema = Schema.Union([
|
|
70
|
+
Schema.Struct({ view: Schema.Literal("workspace") }),
|
|
71
|
+
Schema.Struct({
|
|
72
|
+
view: Schema.Literal("git-index"),
|
|
73
|
+
fingerprint: Schema.String.check(Schema.isPattern(/^sha256:[0-9a-f]{64}$/)),
|
|
74
|
+
}),
|
|
75
|
+
]).annotate({
|
|
76
|
+
identifier: "LintInput",
|
|
77
|
+
title: "Lint Input",
|
|
78
|
+
description: "Filesystem identity evaluated by the lint run.",
|
|
79
|
+
});
|
|
80
|
+
/**
|
|
81
|
+
* JSON envelope shape returned under `axm lint --json`.
|
|
82
|
+
*
|
|
83
|
+
* Matches the registry publish failure envelope structure (`findings[]`,
|
|
84
|
+
* `displayRoot` per entry, per-finding `path` pre-composed).
|
|
85
|
+
*
|
|
86
|
+
* @experimental This API is unstable and may change without notice.
|
|
87
|
+
*/
|
|
88
|
+
export const LintJsonDocumentSchema = Schema.Struct({
|
|
89
|
+
input: LintInputSchema,
|
|
90
|
+
axmSkillCompatibility: Schema.optionalKey(AxmSkillCompatibilitySchema),
|
|
91
|
+
findings: Schema.Array(LintJsonFindingSchema),
|
|
92
|
+
summary: LintJsonSummarySchema,
|
|
93
|
+
driftBanner: Schema.Array(Schema.String),
|
|
94
|
+
}).annotate({
|
|
95
|
+
identifier: "LintJsonDocument",
|
|
96
|
+
title: "Lint Document",
|
|
97
|
+
description: "Machine-readable result of an `axm lint` run.",
|
|
98
|
+
});
|
|
99
|
+
//# sourceMappingURL=json-schema.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed failures for lint-run staging and settings loading. The producer owns
|
|
3
|
+
* the category choice and user-facing wording; the application boundary
|
|
4
|
+
* converts the carried fields into its error envelope verbatim.
|
|
5
|
+
*
|
|
6
|
+
* @experimental This API is unstable and may change without notice.
|
|
7
|
+
*/
|
|
8
|
+
import * as Schema from "effect/Schema";
|
|
9
|
+
declare const LintStagingFailed_base: Schema.Class<LintStagingFailed, Schema.TaggedStruct<"LintStagingFailed", {
|
|
10
|
+
readonly category: Schema.Literals<readonly ["validation", "internal"]>;
|
|
11
|
+
readonly title: Schema.optional<Schema.String>;
|
|
12
|
+
readonly detail: Schema.String;
|
|
13
|
+
readonly cause: Schema.optional<Schema.Unknown>;
|
|
14
|
+
}>, import("effect/Cause").YieldableError>;
|
|
15
|
+
/**
|
|
16
|
+
* A lint input-staging step (such as materializing the Git index snapshot)
|
|
17
|
+
* could not proceed. `category`, `title`, and `detail` carry the boundary
|
|
18
|
+
* rendering 1:1.
|
|
19
|
+
*/
|
|
20
|
+
export declare class LintStagingFailed extends LintStagingFailed_base {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed failures for lint-run staging and settings loading. The producer owns
|
|
3
|
+
* the category choice and user-facing wording; the application boundary
|
|
4
|
+
* converts the carried fields into its error envelope verbatim.
|
|
5
|
+
*
|
|
6
|
+
* @experimental This API is unstable and may change without notice.
|
|
7
|
+
*/
|
|
8
|
+
import * as Schema from "effect/Schema";
|
|
9
|
+
/**
|
|
10
|
+
* A lint input-staging step (such as materializing the Git index snapshot)
|
|
11
|
+
* could not proceed. `category`, `title`, and `detail` carry the boundary
|
|
12
|
+
* rendering 1:1.
|
|
13
|
+
*/
|
|
14
|
+
export class LintStagingFailed extends Schema.TaggedError()("LintStagingFailed", {
|
|
15
|
+
category: Schema.Literals(["validation", "internal"]),
|
|
16
|
+
title: Schema.optional(Schema.String),
|
|
17
|
+
detail: Schema.String,
|
|
18
|
+
cause: Schema.optional(Schema.Unknown),
|
|
19
|
+
}) {
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lint-run policy over workspace settings and roots: where a lint run is
|
|
3
|
+
* anchored, which configured rule overrides apply, which repairs are already
|
|
4
|
+
* determined by authoritative local state, and how staged-snapshot paths map
|
|
5
|
+
* back to the workspace the user named. The CLI keeps argument parsing,
|
|
6
|
+
* rendering, and exit mapping.
|
|
7
|
+
*
|
|
8
|
+
* @experimental This API is unstable and may change without notice.
|
|
9
|
+
*/
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import * as FileSystem from "effect/FileSystem";
|
|
12
|
+
import * as Option from "effect/Option";
|
|
13
|
+
import * as Path from "effect/Path";
|
|
14
|
+
import type { LintConfig } from "@agentxm/registry-protocol/unstable/lint/config";
|
|
15
|
+
import { type Settings } from "@agentxm/workspace-state";
|
|
16
|
+
import { type WorkspaceScope } from "@agentxm/extension-model/unstable/workspace-scope";
|
|
17
|
+
import type { LintSummary } from "../cli.js";
|
|
18
|
+
export type PathRemapper = Pick<Path.Path, "isAbsolute" | "join" | "relative">;
|
|
19
|
+
/** Replace temporary staged-snapshot roots without changing lint semantics. */
|
|
20
|
+
export declare const remapLintSummaryPaths: (summary: LintSummary, sourceRoot: string, displayRoot: string, path: PathRemapper) => LintSummary;
|
|
21
|
+
/**
|
|
22
|
+
* Resolve the workspace root for a lint run.
|
|
23
|
+
*
|
|
24
|
+
* - `--scope=project` (default): use the optional `<path>` argument if
|
|
25
|
+
* provided, otherwise the caller-supplied `cwd`.
|
|
26
|
+
* - `--scope=user`: use the resolved user home; the read model locates its
|
|
27
|
+
* `.axm/workspace/` workspace. Ignores `<path>`.
|
|
28
|
+
*
|
|
29
|
+
* XDG layout: v1 honors `AXM_USER_HOME` as an override; full
|
|
30
|
+
* `XDG_DATA_HOME`/`XDG_CONFIG_HOME` integration is deferred to a follow-up
|
|
31
|
+
* (see design doc §10 Open Items #10).
|
|
32
|
+
*/
|
|
33
|
+
export declare const resolveLintRoot: (args: {
|
|
34
|
+
readonly pathArg: Option.Option<string>;
|
|
35
|
+
readonly scope: WorkspaceScope;
|
|
36
|
+
readonly cwd: string;
|
|
37
|
+
readonly userHome: string;
|
|
38
|
+
}) => string;
|
|
39
|
+
/**
|
|
40
|
+
* Decode the authoritative settings document. Returns `None` when the file is missing, empty,
|
|
41
|
+
* or unparseable, so lint still runs — the relevant
|
|
42
|
+
* `workspace/settings-schema-valid` rule produces the user-facing finding for a
|
|
43
|
+
* bad settings file. Callers derive `lint.rules` and the `--fix` inputs from
|
|
44
|
+
* the one decode.
|
|
45
|
+
*/
|
|
46
|
+
export declare const loadSettingsDocument: (workspaceRoot: string, scope: WorkspaceScope) => Effect.Effect<Option.Option<Settings>, never, FileSystem.FileSystem | Path.Path>;
|
|
47
|
+
export declare const lintConfigFromSettings: (settings: Option.Option<Settings>) => LintConfig;
|
|
48
|
+
/**
|
|
49
|
+
* Apply the repairs whose desired state is already determined by authoritative
|
|
50
|
+
* local state. Instruction targets are content-derived from their canonical
|
|
51
|
+
* source, so regenerating them expresses no preference.
|
|
52
|
+
*
|
|
53
|
+
* This delegates to the same reconciliation `axm sync` performs rather than
|
|
54
|
+
* defining a second desired state. A workspace that has not enabled
|
|
55
|
+
* instruction-file management has nothing determined to restore, so `--fix`
|
|
56
|
+
* leaves it untouched.
|
|
57
|
+
*/
|
|
58
|
+
export declare const applyDeterminedRepairs: (args: {
|
|
59
|
+
readonly workspaceRoot: string;
|
|
60
|
+
readonly scope: WorkspaceScope;
|
|
61
|
+
readonly settings: Option.Option<Settings>;
|
|
62
|
+
}) => Effect.Effect<void, import("@agentxm/extension-workspace").InstructionMaintenanceFailure, FileSystem.FileSystem | Path.Path>;
|
|
63
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lint-run policy over workspace settings and roots: where a lint run is
|
|
3
|
+
* anchored, which configured rule overrides apply, which repairs are already
|
|
4
|
+
* determined by authoritative local state, and how staged-snapshot paths map
|
|
5
|
+
* back to the workspace the user named. The CLI keeps argument parsing,
|
|
6
|
+
* rendering, and exit mapping.
|
|
7
|
+
*
|
|
8
|
+
* @experimental This API is unstable and may change without notice.
|
|
9
|
+
*/
|
|
10
|
+
import * as Data from "effect/Data";
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
|
+
import * as FileSystem from "effect/FileSystem";
|
|
13
|
+
import * as Option from "effect/Option";
|
|
14
|
+
import * as Path from "effect/Path";
|
|
15
|
+
import * as Result from "effect/Result";
|
|
16
|
+
import * as Schema from "effect/Schema";
|
|
17
|
+
import { reconcileInstructionTargets, resolveInstructionsConfig, } from "@agentxm/extension-workspace";
|
|
18
|
+
import { composePath } from "@agentxm/registry-protocol/unstable/lint/compose-path";
|
|
19
|
+
import { AXM_DIR_NAME, SettingsSchema, USER_WORKSPACE_DIRECTORY, } from "@agentxm/workspace-state";
|
|
20
|
+
import {} from "@agentxm/extension-model/unstable/workspace-scope";
|
|
21
|
+
const remapAbsolutePath = (value, sourceRoot, displayRoot, path) => {
|
|
22
|
+
if (!path.isAbsolute(value))
|
|
23
|
+
return value;
|
|
24
|
+
const relative = path.relative(sourceRoot, value);
|
|
25
|
+
if (relative.startsWith("..") || path.isAbsolute(relative))
|
|
26
|
+
return value;
|
|
27
|
+
return relative === "" ? displayRoot : path.join(displayRoot, relative);
|
|
28
|
+
};
|
|
29
|
+
/** Replace temporary staged-snapshot roots without changing lint semantics. */
|
|
30
|
+
export const remapLintSummaryPaths = (summary, sourceRoot, displayRoot, path) => ({
|
|
31
|
+
...summary,
|
|
32
|
+
findings: summary.findings.map((entry) => {
|
|
33
|
+
const remappedDisplayRoot = remapAbsolutePath(entry.displayRoot, sourceRoot, displayRoot, path);
|
|
34
|
+
const location = entry.finding.location;
|
|
35
|
+
const remappedLocation = location === undefined
|
|
36
|
+
? undefined
|
|
37
|
+
: {
|
|
38
|
+
...location,
|
|
39
|
+
file: remapAbsolutePath(location.file, sourceRoot, displayRoot, path),
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
...entry,
|
|
43
|
+
displayRoot: remappedDisplayRoot,
|
|
44
|
+
path: composePath(remappedDisplayRoot, remappedLocation),
|
|
45
|
+
finding: remappedLocation === undefined
|
|
46
|
+
? entry.finding
|
|
47
|
+
: { ...entry.finding, location: remappedLocation },
|
|
48
|
+
};
|
|
49
|
+
}),
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Resolve the workspace root for a lint run.
|
|
53
|
+
*
|
|
54
|
+
* - `--scope=project` (default): use the optional `<path>` argument if
|
|
55
|
+
* provided, otherwise the caller-supplied `cwd`.
|
|
56
|
+
* - `--scope=user`: use the resolved user home; the read model locates its
|
|
57
|
+
* `.axm/workspace/` workspace. Ignores `<path>`.
|
|
58
|
+
*
|
|
59
|
+
* XDG layout: v1 honors `AXM_USER_HOME` as an override; full
|
|
60
|
+
* `XDG_DATA_HOME`/`XDG_CONFIG_HOME` integration is deferred to a follow-up
|
|
61
|
+
* (see design doc §10 Open Items #10).
|
|
62
|
+
*/
|
|
63
|
+
export const resolveLintRoot = (args) => {
|
|
64
|
+
if (args.scope === "user") {
|
|
65
|
+
return args.userHome;
|
|
66
|
+
}
|
|
67
|
+
return Option.match(args.pathArg, {
|
|
68
|
+
onNone: () => args.cwd,
|
|
69
|
+
onSome: (p) => p,
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
const decodeSettings = (input) => {
|
|
73
|
+
const result = Schema.decodeUnknownResult(SettingsSchema)(input, {
|
|
74
|
+
onExcessProperty: "ignore",
|
|
75
|
+
errors: "all",
|
|
76
|
+
});
|
|
77
|
+
return Result.isSuccess(result) ? Option.some(result.success) : Option.none();
|
|
78
|
+
};
|
|
79
|
+
class SettingsUnreadable extends Data.TaggedError("SettingsUnreadable") {
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Decode the authoritative settings document. Returns `None` when the file is missing, empty,
|
|
83
|
+
* or unparseable, so lint still runs — the relevant
|
|
84
|
+
* `workspace/settings-schema-valid` rule produces the user-facing finding for a
|
|
85
|
+
* bad settings file. Callers derive `lint.rules` and the `--fix` inputs from
|
|
86
|
+
* the one decode.
|
|
87
|
+
*/
|
|
88
|
+
export const loadSettingsDocument = (workspaceRoot, scope) => Effect.gen(function* () {
|
|
89
|
+
const fs = yield* FileSystem.FileSystem;
|
|
90
|
+
const path = yield* Path.Path;
|
|
91
|
+
const settingsPath = scope === "user"
|
|
92
|
+
? path.join(workspaceRoot, AXM_DIR_NAME, USER_WORKSPACE_DIRECTORY, "axm.json")
|
|
93
|
+
: path.join(workspaceRoot, "axm.json");
|
|
94
|
+
const exists = yield* fs.exists(settingsPath).pipe(Effect.catch(() => Effect.succeed(false)));
|
|
95
|
+
if (!exists) {
|
|
96
|
+
return Option.none();
|
|
97
|
+
}
|
|
98
|
+
const raw = yield* fs.readFileString(settingsPath).pipe(Effect.catch(() => Effect.succeed("")));
|
|
99
|
+
if (raw.length === 0) {
|
|
100
|
+
return Option.none();
|
|
101
|
+
}
|
|
102
|
+
const parsed = Effect.try({
|
|
103
|
+
try: () => JSON.parse(raw),
|
|
104
|
+
catch: () => new SettingsUnreadable(),
|
|
105
|
+
});
|
|
106
|
+
const parsedOpt = yield* parsed.pipe(Effect.map(Option.some), Effect.catch(() => Effect.succeed(Option.none())));
|
|
107
|
+
if (Option.isNone(parsedOpt)) {
|
|
108
|
+
return Option.none();
|
|
109
|
+
}
|
|
110
|
+
return decodeSettings(parsedOpt.value);
|
|
111
|
+
});
|
|
112
|
+
export const lintConfigFromSettings = (settings) => Option.match(settings, {
|
|
113
|
+
onNone: () => ({}),
|
|
114
|
+
onSome: (s) => s.lint ?? {},
|
|
115
|
+
});
|
|
116
|
+
/**
|
|
117
|
+
* Apply the repairs whose desired state is already determined by authoritative
|
|
118
|
+
* local state. Instruction targets are content-derived from their canonical
|
|
119
|
+
* source, so regenerating them expresses no preference.
|
|
120
|
+
*
|
|
121
|
+
* This delegates to the same reconciliation `axm sync` performs rather than
|
|
122
|
+
* defining a second desired state. A workspace that has not enabled
|
|
123
|
+
* instruction-file management has nothing determined to restore, so `--fix`
|
|
124
|
+
* leaves it untouched.
|
|
125
|
+
*/
|
|
126
|
+
export const applyDeterminedRepairs = (args) => Effect.gen(function* () {
|
|
127
|
+
if (Option.isNone(args.settings))
|
|
128
|
+
return;
|
|
129
|
+
const instructionFiles = args.settings.value.instructionFiles;
|
|
130
|
+
if (instructionFiles === undefined || instructionFiles === false)
|
|
131
|
+
return;
|
|
132
|
+
yield* reconcileInstructionTargets({
|
|
133
|
+
workspaceRoot: args.workspaceRoot,
|
|
134
|
+
scope: args.scope,
|
|
135
|
+
configuredAgents: args.settings.value.agents ?? [],
|
|
136
|
+
config: resolveInstructionsConfig(instructionFiles),
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
//# sourceMappingURL=settings.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Materialize the repository index as an isolated, read-only lint workspace.
|
|
3
|
+
*
|
|
4
|
+
* Git checkout commands apply working-tree filters and line-ending conversion,
|
|
5
|
+
* so they cannot represent the index byte-for-byte. This module enumerates
|
|
6
|
+
* stage-0 entries, reads every unique blob through one `git cat-file --batch`
|
|
7
|
+
* process, and recreates the indexed modes in a scoped temporary directory.
|
|
8
|
+
*/
|
|
9
|
+
import * as Effect from "effect/Effect";
|
|
10
|
+
import * as FileSystem from "effect/FileSystem";
|
|
11
|
+
import * as Path from "effect/Path";
|
|
12
|
+
import { LintStagingFailed } from "./errors.js";
|
|
13
|
+
export interface StagedWorkspace {
|
|
14
|
+
readonly gitRoot: string;
|
|
15
|
+
readonly snapshotRoot: string;
|
|
16
|
+
readonly workspaceRoot: string;
|
|
17
|
+
readonly displayWorkspaceRoot: string;
|
|
18
|
+
readonly fingerprint: string;
|
|
19
|
+
}
|
|
20
|
+
/** Remove repository-local variables inherited from Git hook processes. */
|
|
21
|
+
export declare const isolatedGitEnvironment: () => Record<string, string>;
|
|
22
|
+
export declare const materializeGitIndexWorkspace: (startPath: string, options?: {
|
|
23
|
+
readonly selectRepositoryRoot?: boolean;
|
|
24
|
+
} | undefined) => Effect.Effect<{
|
|
25
|
+
gitRoot: string;
|
|
26
|
+
snapshotRoot: string;
|
|
27
|
+
workspaceRoot: string;
|
|
28
|
+
displayWorkspaceRoot: string;
|
|
29
|
+
fingerprint: string;
|
|
30
|
+
}, LintStagingFailed, FileSystem.FileSystem | Path.Path | import("effect/Scope").Scope | import("effect/unstable/process/ChildProcessSpawner").ChildProcessSpawner>;
|
|
31
|
+
//# sourceMappingURL=staged-workspace.d.ts.map
|