@opensip-cli/fitness 0.1.6 → 0.1.8
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 +2 -2
- package/dist/__tests__/fit-execute-opts.test.js +2 -2
- package/dist/__tests__/fit-execute-opts.test.js.map +1 -1
- package/dist/__tests__/public-api.test.js +2 -1
- package/dist/__tests__/public-api.test.js.map +1 -1
- package/dist/__tests__/tool.test.js +24 -13
- package/dist/__tests__/tool.test.js.map +1 -1
- package/dist/cli/__tests__/fit-gate-mode.test.js +1 -1
- package/dist/cli/__tests__/fit-gate-mode.test.js.map +1 -1
- package/dist/cli/__tests__/fit-modes-live.test.d.ts +1 -1
- package/dist/cli/__tests__/fit-modes-live.test.js +13 -6
- package/dist/cli/__tests__/fit-modes-live.test.js.map +1 -1
- package/dist/cli/__tests__/fit-runner-progress.test.d.ts +2 -0
- package/dist/cli/__tests__/fit-runner-progress.test.d.ts.map +1 -0
- package/dist/cli/__tests__/fit-runner-progress.test.js +30 -0
- package/dist/cli/__tests__/fit-runner-progress.test.js.map +1 -0
- package/dist/cli/__tests__/report-data.test.js +3 -3
- package/dist/cli/__tests__/report-data.test.js.map +1 -1
- package/dist/cli/fit/__tests__/display-fold.test.js +2 -2
- package/dist/cli/fit/__tests__/display-fold.test.js.map +1 -1
- package/dist/cli/fit/__tests__/fit-export-command-spec.test.d.ts +9 -0
- package/dist/cli/fit/__tests__/fit-export-command-spec.test.d.ts.map +1 -0
- package/dist/cli/fit/__tests__/fit-export-command-spec.test.js +75 -0
- package/dist/cli/fit/__tests__/fit-export-command-spec.test.js.map +1 -0
- package/dist/cli/fit/check-loader.d.ts +1 -1
- package/dist/cli/fit/check-loader.js +1 -1
- package/dist/cli/fit/config-loader.d.ts +1 -1
- package/dist/cli/fit/config-loader.js +1 -1
- package/dist/cli/fit/envelope-view.d.ts.map +1 -1
- package/dist/cli/fit/envelope-view.js +2 -14
- package/dist/cli/fit/envelope-view.js.map +1 -1
- package/dist/cli/fit/fit-aux-command-specs.d.ts +27 -17
- package/dist/cli/fit/fit-aux-command-specs.d.ts.map +1 -1
- package/dist/cli/fit/fit-aux-command-specs.js +91 -53
- package/dist/cli/fit/fit-aux-command-specs.js.map +1 -1
- package/dist/cli/fit/recipe-selector.test.js +2 -2
- package/dist/cli/fit/recipe-selector.test.js.map +1 -1
- package/dist/cli/fit/result-builders.d.ts +29 -19
- package/dist/cli/fit/result-builders.d.ts.map +1 -1
- package/dist/cli/fit/result-builders.js +29 -24
- package/dist/cli/fit/result-builders.js.map +1 -1
- package/dist/cli/fit-modes.d.ts.map +1 -1
- package/dist/cli/fit-modes.js +7 -4
- package/dist/cli/fit-modes.js.map +1 -1
- package/dist/cli/fit-runner-progress.d.ts +12 -0
- package/dist/cli/fit-runner-progress.d.ts.map +1 -0
- package/dist/cli/fit-runner-progress.js +25 -0
- package/dist/cli/fit-runner-progress.js.map +1 -0
- package/dist/cli/fit-runner-views.d.ts +1 -1
- package/dist/cli/fit-runner-views.js +1 -1
- package/dist/cli/fit-runner.d.ts.map +1 -1
- package/dist/cli/fit-runner.js +51 -16
- package/dist/cli/fit-runner.js.map +1 -1
- package/dist/cli/fit-worker.d.ts.map +1 -1
- package/dist/cli/fit-worker.js +1 -0
- package/dist/cli/fit-worker.js.map +1 -1
- package/dist/cli/fit.d.ts +5 -3
- package/dist/cli/fit.d.ts.map +1 -1
- package/dist/cli/fit.js +6 -4
- package/dist/cli/fit.js.map +1 -1
- package/dist/framework/__tests__/concurrent-file-cache.test.d.ts +24 -0
- package/dist/framework/__tests__/concurrent-file-cache.test.d.ts.map +1 -0
- package/dist/framework/__tests__/concurrent-file-cache.test.js +151 -0
- package/dist/framework/__tests__/concurrent-file-cache.test.js.map +1 -0
- package/dist/framework/__tests__/define-check.test.js +38 -1
- package/dist/framework/__tests__/define-check.test.js.map +1 -1
- package/dist/framework/__tests__/define-regex-list-check.test.js +5 -1
- package/dist/framework/__tests__/define-regex-list-check.test.js.map +1 -1
- package/dist/framework/__tests__/execution-context.globalexcludes-parity.test.js +3 -1
- package/dist/framework/__tests__/execution-context.globalexcludes-parity.test.js.map +1 -1
- package/dist/framework/__tests__/execution-context.test.js +32 -9
- package/dist/framework/__tests__/execution-context.test.js.map +1 -1
- package/dist/framework/__tests__/file-accessor.test.js +7 -4
- package/dist/framework/__tests__/file-accessor.test.js.map +1 -1
- package/dist/framework/__tests__/file-cache-autoclear.test.d.ts +25 -0
- package/dist/framework/__tests__/file-cache-autoclear.test.d.ts.map +1 -0
- package/dist/framework/__tests__/file-cache-autoclear.test.js +116 -0
- package/dist/framework/__tests__/file-cache-autoclear.test.js.map +1 -0
- package/dist/framework/__tests__/register-helpers.test.js +2 -2
- package/dist/framework/__tests__/register-helpers.test.js.map +1 -1
- package/dist/framework/__tests__/scope-registry.test.js +2 -2
- package/dist/framework/__tests__/scope-registry.test.js.map +1 -1
- package/dist/framework/define-check.d.ts.map +1 -1
- package/dist/framework/define-check.js +9 -0
- package/dist/framework/define-check.js.map +1 -1
- package/dist/framework/execution-context.d.ts +9 -2
- package/dist/framework/execution-context.d.ts.map +1 -1
- package/dist/framework/execution-context.js +20 -6
- package/dist/framework/execution-context.js.map +1 -1
- package/dist/framework/file-accessor.d.ts +12 -0
- package/dist/framework/file-accessor.d.ts.map +1 -1
- package/dist/framework/file-accessor.js +8 -3
- package/dist/framework/file-accessor.js.map +1 -1
- package/dist/framework/file-cache.d.ts +11 -1
- package/dist/framework/file-cache.d.ts.map +1 -1
- package/dist/framework/file-cache.js +11 -1
- package/dist/framework/file-cache.js.map +1 -1
- package/dist/framework/ignore-processing.d.ts.map +1 -1
- package/dist/framework/ignore-processing.js +26 -11
- package/dist/framework/ignore-processing.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/persistence/session-replay.d.ts +8 -3
- package/dist/persistence/session-replay.d.ts.map +1 -1
- package/dist/persistence/session-replay.js +7 -8
- package/dist/persistence/session-replay.js.map +1 -1
- package/dist/persistence/session-replay.test.js +9 -7
- package/dist/persistence/session-replay.test.js.map +1 -1
- package/dist/plugins/__tests__/loader.test.js +2 -2
- package/dist/plugins/__tests__/loader.test.js.map +1 -1
- package/dist/recipes/__tests__/run-one-check.test.js +16 -1
- package/dist/recipes/__tests__/run-one-check.test.js.map +1 -1
- package/dist/recipes/__tests__/service.test.js +46 -3
- package/dist/recipes/__tests__/service.test.js.map +1 -1
- package/dist/recipes/service.d.ts +8 -1
- package/dist/recipes/service.d.ts.map +1 -1
- package/dist/recipes/service.js +33 -4
- package/dist/recipes/service.js.map +1 -1
- package/dist/scope-augmentation.d.ts +26 -1
- package/dist/scope-augmentation.d.ts.map +1 -1
- package/dist/signalers/schema.d.ts +1 -1
- package/dist/tool.d.ts +4 -3
- package/dist/tool.d.ts.map +1 -1
- package/dist/tool.js +67 -85
- package/dist/tool.js.map +1 -1
- package/package.json +14 -14
|
@@ -27,13 +27,14 @@
|
|
|
27
27
|
* scope construction. A run that doesn't load the fitness tool carries
|
|
28
28
|
* no `scope.fitness`, and reads return `undefined`.
|
|
29
29
|
*/
|
|
30
|
+
import type { FileCache } from './framework/file-cache.js';
|
|
30
31
|
import type { CheckRegistry } from './framework/registry.js';
|
|
31
32
|
import type { FitnessRecipeRegistry } from './recipes/registry.js';
|
|
32
33
|
/**
|
|
33
34
|
* Per-RunScope `ensureChecksLoaded` lifecycle state — moved off the
|
|
34
35
|
* `check-loader.ts` module singletons so two concurrent scopes carry
|
|
35
36
|
* independent load state. Mutable: `ensureChecksLoaded` writes it once
|
|
36
|
-
* per run; the phase helpers (`buildFitEnvelope`, `
|
|
37
|
+
* per run; the phase helpers (`buildFitEnvelope`, `buildFitPresentation`)
|
|
37
38
|
* and the public accessors read it back.
|
|
38
39
|
*/
|
|
39
40
|
export interface FitnessLoadState {
|
|
@@ -47,6 +48,21 @@ export interface FitnessLoadState {
|
|
|
47
48
|
* `ensureChecksLoaded` call. */
|
|
48
49
|
loadWarnings: string[];
|
|
49
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Per-run holder for the shared, lazily-built type-checked TypeScript Program
|
|
53
|
+
* (D2). A single `ts.Program` + bound `TypeChecker` is expensive (~1s / ~0.6 GB
|
|
54
|
+
* on a ~900-file corpus) but type-aware checks need it, so it is built ONCE per
|
|
55
|
+
* run and reused by every type-aware TS check, then released on dispose.
|
|
56
|
+
*
|
|
57
|
+
* `value` is intentionally `unknown`: the build logic lives in
|
|
58
|
+
* `@opensip-cli/checks-typescript` (which owns the `lang-typescript`/`typescript`
|
|
59
|
+
* runtime dep), so the fitness engine and core never name lang-typescript's
|
|
60
|
+
* `TypeCheckedProgram` — keeping the heavy `typescript` dep out of the engine
|
|
61
|
+
* and every non-TS check run. The TS pack casts `value` to its concrete type.
|
|
62
|
+
*/
|
|
63
|
+
export interface SharedTsProgramCell {
|
|
64
|
+
value: unknown;
|
|
65
|
+
}
|
|
50
66
|
/**
|
|
51
67
|
* Per-RunScope fitness state. Constructed by the fitness tool's
|
|
52
68
|
* `contributeScope()` hook and attached to `scope.fitness`.
|
|
@@ -60,6 +76,15 @@ export interface FitnessSubscope {
|
|
|
60
76
|
readonly recipes: FitnessRecipeRegistry;
|
|
61
77
|
/** `ensureChecksLoaded` lifecycle state for this run. */
|
|
62
78
|
readonly load: FitnessLoadState;
|
|
79
|
+
/** Per-run file cache — prewarmed by the recipe service, read by every
|
|
80
|
+
* reader site (execution context, file accessor, ignore processing),
|
|
81
|
+
* cleared on scope dispose via the disposer `contributeScope` returns.
|
|
82
|
+
* Replaces the module singleton on every production path. */
|
|
83
|
+
readonly fileCache: FileCache;
|
|
84
|
+
/** Lazily-built shared type-checked TS Program for this run (D2). Built by
|
|
85
|
+
* checks-typescript's `getSharedTypeCheckedProgram` on the first type-aware
|
|
86
|
+
* check, reused by all, and cleared by the dispose hook. */
|
|
87
|
+
readonly tsProgram: SharedTsProgramCell;
|
|
63
88
|
}
|
|
64
89
|
declare module '@opensip-cli/core' {
|
|
65
90
|
interface ScopeContribution {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-augmentation.d.ts","sourceRoot":"","sources":["../src/scope-augmentation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;qDAEiD;IACjD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,2EAA2E;IAC3E,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC;qCACiC;IACjC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;qEACiE;IACjE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B;gDAC4C;IAC5C,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAAC;IACxC,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"scope-augmentation.d.ts","sourceRoot":"","sources":["../src/scope-augmentation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;qDAEiD;IACjD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,2EAA2E;IAC3E,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC;qCACiC;IACjC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;qEACiE;IACjE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B;gDAC4C;IAC5C,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAAC;IACxC,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC;;;kEAG8D;IAC9D,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B;;iEAE6D;IAC7D,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;CACzC;AAED,OAAO,QAAQ,mBAAmB,CAAC;IACjC,UAAU,iBAAiB;QACzB;;;;;;;WAOG;QACH,OAAO,CAAC,EAAE,eAAe,CAAC;KAC3B;CACF"}
|
|
@@ -35,7 +35,7 @@ export declare const SignalersConfigSchema: z.ZodObject<{
|
|
|
35
35
|
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
36
|
verbose: z.ZodOptional<z.ZodBoolean>;
|
|
37
37
|
json: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
-
reportTo: z.ZodOptional<z.
|
|
38
|
+
reportTo: z.ZodOptional<z.ZodString>;
|
|
39
39
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
40
40
|
fileTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
41
41
|
ignore: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
package/dist/tool.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* fitnessTool — fitness as a Tool plugin.
|
|
3
3
|
*
|
|
4
|
-
* Owns the `fit
|
|
5
|
-
* subcommands. Since release 2.11.0 (Phase 4) the Commander wiring is no longer
|
|
4
|
+
* Owns the `fit` primary plus its nested `fit list`, `fit recipes`, and
|
|
5
|
+
* `fit export` subcommands. Since release 2.11.0 (Phase 4) the Commander wiring is no longer
|
|
6
6
|
* hand-rolled: the tool exports declarative {@link CommandSpec}s
|
|
7
7
|
* (`commandSpecs`) and the host's `mountCommandSpec` mounts them
|
|
8
8
|
* (name/description/aliases, the ADR-0021 common flags, each command's options)
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
* -------------
|
|
44
44
|
* - This file owns the command-spec assembly + the tool descriptor.
|
|
45
45
|
* - `cli/fit/fit-command-spec.ts` owns the primary `fit` command spec + handler.
|
|
46
|
-
* - `cli/fit/fit-aux-command-specs.ts` owns the
|
|
46
|
+
* - `cli/fit/fit-aux-command-specs.ts` owns the nested `fit list` / `fit recipes`
|
|
47
|
+
* / `fit export` command specs.
|
|
47
48
|
* - `cli/fit-modes.ts` owns the dispatch branches (gate/list/recipes/json/live).
|
|
48
49
|
*/
|
|
49
50
|
import './scope-augmentation.js';
|
package/dist/tool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AA6BH,OAAO,yBAAyB,CAAC;AAKjC,OAAO,KAAK,EAIV,IAAI,EAEL,MAAM,mBAAmB,CAAC;AAwI3B;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,UAAU,CAAC;AAMhD,eAAO,MAAM,iBAAiB,yCAAyC,CAAC;AAExE,eAAO,MAAM,WAAW,EAAE,IAkCxB,CAAC"}
|
package/dist/tool.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* fitnessTool — fitness as a Tool plugin.
|
|
3
3
|
*
|
|
4
|
-
* Owns the `fit
|
|
5
|
-
* subcommands. Since release 2.11.0 (Phase 4) the Commander wiring is no longer
|
|
4
|
+
* Owns the `fit` primary plus its nested `fit list`, `fit recipes`, and
|
|
5
|
+
* `fit export` subcommands. Since release 2.11.0 (Phase 4) the Commander wiring is no longer
|
|
6
6
|
* hand-rolled: the tool exports declarative {@link CommandSpec}s
|
|
7
7
|
* (`commandSpecs`) and the host's `mountCommandSpec` mounts them
|
|
8
8
|
* (name/description/aliases, the ADR-0021 common flags, each command's options)
|
|
@@ -43,17 +43,19 @@
|
|
|
43
43
|
* -------------
|
|
44
44
|
* - This file owns the command-spec assembly + the tool descriptor.
|
|
45
45
|
* - `cli/fit/fit-command-spec.ts` owns the primary `fit` command spec + handler.
|
|
46
|
-
* - `cli/fit/fit-aux-command-specs.ts` owns the
|
|
46
|
+
* - `cli/fit/fit-aux-command-specs.ts` owns the nested `fit list` / `fit recipes`
|
|
47
|
+
* / `fit export` command specs.
|
|
47
48
|
* - `cli/fit-modes.ts` owns the dispatch branches (gate/list/recipes/json/live).
|
|
48
49
|
*/
|
|
49
|
-
import { readPackageVersion } from '@opensip-cli/core';
|
|
50
|
+
import { defineTool, readPackageVersion } from '@opensip-cli/core';
|
|
50
51
|
import { fitnessFingerprintStrategy } from './baseline-strategy.js';
|
|
51
|
-
import {
|
|
52
|
+
import { fitExportCommandSpec, fitListGroupedCommandSpec, fitRecipesGroupedCommandSpec, } from './cli/fit/fit-aux-command-specs.js';
|
|
52
53
|
import { buildFitCommandSpec, FIT_LIVE_VIEW_KEY } from './cli/fit/fit-command-spec.js';
|
|
53
54
|
import { renderFitLive } from './cli/fit-runner.js';
|
|
54
55
|
import { fitRunWorkerCommandSpec } from './cli/fit-worker.js';
|
|
55
56
|
import { collectFitnessReportData } from './cli/report-data.js';
|
|
56
57
|
import { fitnessConfigDeclaration } from './config/fitness-config-schema.js';
|
|
58
|
+
import { FileCache } from './framework/file-cache.js';
|
|
57
59
|
import { createCheckRegistry, createFitnessLoadState, createRecipeRegistry, currentCheckRegistry, currentRecipeRegistry, } from './framework/scope-registry.js';
|
|
58
60
|
import { fitReplayFromSession } from './persistence/session-replay.js';
|
|
59
61
|
import { FIT_PLUGIN_LAYOUT } from './plugins/loader.js';
|
|
@@ -63,29 +65,6 @@ import { fitScaffoldExamples, fitStableExampleIds } from './scaffold/examples.js
|
|
|
63
65
|
// `scope.fitness` is the correctly-typed slot here.
|
|
64
66
|
import './scope-augmentation.js';
|
|
65
67
|
// =============================================================================
|
|
66
|
-
// COMMAND DESCRIPTORS — used by --help listings and conflict detection.
|
|
67
|
-
// =============================================================================
|
|
68
|
-
const FIT = {
|
|
69
|
-
name: 'fit',
|
|
70
|
-
description: 'Run fitness checks',
|
|
71
|
-
};
|
|
72
|
-
const FIT_LIST = {
|
|
73
|
-
name: 'fit-list',
|
|
74
|
-
description: 'List available fitness checks',
|
|
75
|
-
};
|
|
76
|
-
const FIT_RECIPES = {
|
|
77
|
-
name: 'fit-recipes',
|
|
78
|
-
description: 'List available fitness recipes',
|
|
79
|
-
};
|
|
80
|
-
const FIT_BASELINE_EXPORT = {
|
|
81
|
-
name: 'fit-baseline-export',
|
|
82
|
-
description: 'Export the fit gate baseline (SARIF) from the datastore to a file',
|
|
83
|
-
};
|
|
84
|
-
const FIT_RUN_WORKER = {
|
|
85
|
-
name: 'fit-run-worker',
|
|
86
|
-
description: '[internal] Run fit headless and stream progress + result over IPC (forked by the live view)',
|
|
87
|
-
};
|
|
88
|
-
// =============================================================================
|
|
89
68
|
// LIVE-VIEW SETUP + COMMAND-SPEC ASSEMBLY
|
|
90
69
|
// =============================================================================
|
|
91
70
|
/**
|
|
@@ -138,9 +117,14 @@ function setUpFitLiveView(cli) {
|
|
|
138
117
|
*/
|
|
139
118
|
const fitCommandSpecs = [
|
|
140
119
|
buildFitCommandSpec(setUpFitLiveView),
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
120
|
+
// Grouped Tier-2 children — `fit list` / `fit recipes` nest under the `fit`
|
|
121
|
+
// primary via the nested-mount capability (the canonical `<tool> <verb>`
|
|
122
|
+
// grammar; the legacy flat aliases were removed).
|
|
123
|
+
fitListGroupedCommandSpec,
|
|
124
|
+
fitRecipesGroupedCommandSpec,
|
|
125
|
+
// Canonical nested export — mounts as `fit export` under the `fit` primary via
|
|
126
|
+
// the nested-mount capability.
|
|
127
|
+
fitExportCommandSpec,
|
|
144
128
|
fitRunWorkerCommandSpec,
|
|
145
129
|
];
|
|
146
130
|
/**
|
|
@@ -172,16 +156,36 @@ const registerFitRecipe = (contribution) => {
|
|
|
172
156
|
/**
|
|
173
157
|
* Per-run subscope contribution (D7). Called by the CLI's pre-action-hook
|
|
174
158
|
* after constructing the scope and before entering it; the kernel installs
|
|
175
|
-
* the returned `fitness` slot. Fresh check + recipe registries
|
|
176
|
-
* `ensureChecksLoaded` lifecycle slot
|
|
177
|
-
* independent fitness state.
|
|
159
|
+
* the returned `fitness` slot. Fresh check + recipe registries, an empty
|
|
160
|
+
* `ensureChecksLoaded` lifecycle slot, and a fresh per-run `FileCache` so
|
|
161
|
+
* concurrent scopes carry independent fitness state.
|
|
162
|
+
*
|
|
163
|
+
* Returns the {@link ScopeContributionWithDisposer} wrapper: the SAME
|
|
164
|
+
* `fileCache` instance is placed on `scope.fitness.fileCache` and closed over by
|
|
165
|
+
* the `onDispose` disposer, so `RunScope.dispose()` clears the cache + cancels
|
|
166
|
+
* its auto-clear timer. The kernel install loop registers the disposer via
|
|
167
|
+
* `scope.onDispose(...)`; core never names `FileCache` (layering-clean).
|
|
178
168
|
*/
|
|
179
169
|
function contributeScope() {
|
|
170
|
+
const fileCache = new FileCache();
|
|
171
|
+
// Lazily populated by checks-typescript's getSharedTypeCheckedProgram; held
|
|
172
|
+
// here so one ts.Program is shared by every type-aware check in the run and
|
|
173
|
+
// released on dispose. `value` is opaque (unknown) — the engine never names
|
|
174
|
+
// lang-typescript's TypeCheckedProgram, keeping the typescript dep out of here.
|
|
175
|
+
const tsProgram = { value: undefined };
|
|
180
176
|
return {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
177
|
+
contribution: {
|
|
178
|
+
fitness: {
|
|
179
|
+
checks: createCheckRegistry(),
|
|
180
|
+
recipes: createRecipeRegistry(),
|
|
181
|
+
load: createFitnessLoadState(),
|
|
182
|
+
fileCache,
|
|
183
|
+
tsProgram,
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
onDispose: () => {
|
|
187
|
+
fileCache.clear();
|
|
188
|
+
tsProgram.value = undefined;
|
|
185
189
|
},
|
|
186
190
|
};
|
|
187
191
|
}
|
|
@@ -200,61 +204,39 @@ export const FITNESS_CONTRACT_VERSION = '1.0.0';
|
|
|
200
204
|
// EXPORT
|
|
201
205
|
// =============================================================================
|
|
202
206
|
export const FITNESS_STABLE_ID = 'afd68bd3-ff3c-4935-a5b6-76d8fc7a5224';
|
|
203
|
-
export const fitnessTool = {
|
|
207
|
+
export const fitnessTool = defineTool({
|
|
204
208
|
metadata: {
|
|
205
209
|
id: FITNESS_STABLE_ID, // stable UUID (per ADR-0048; matches Checks `id` naming)
|
|
206
|
-
|
|
210
|
+
// tool-command-surface-taxonomy Task 2.4 (Q1): metadata.name == the command
|
|
211
|
+
// verb (`fit`). The config namespace key stays `fitness:` — it keys off the
|
|
212
|
+
// DECOUPLED `fitnessConfigDeclaration.namespace = 'fitness'` literal, NOT
|
|
213
|
+
// metadata.name, so existing `fitness:` config blocks keep validating. The
|
|
214
|
+
// session `tool` column is already `'fit'` (sessionReplay.tool + the session
|
|
215
|
+
// contributions), so aligning the name REDUCES mismatch. Q6 (flipping the
|
|
216
|
+
// namespace literal to `fit:`) stays open — no `fit:` config alias is added.
|
|
217
|
+
name: 'fit', // command verb + human key (was 'fitness')
|
|
207
218
|
version: readPackageVersion(import.meta.url),
|
|
208
219
|
description: 'Run fitness checks against a codebase',
|
|
209
220
|
},
|
|
210
|
-
commands: [FIT, FIT_LIST, FIT_RECIPES, FIT_BASELINE_EXPORT, FIT_RUN_WORKER],
|
|
211
221
|
pluginLayout: FIT_PLUGIN_LAYOUT,
|
|
212
|
-
// Release 2.11.0 Phase 4: fitness declares its command surface; the host
|
|
213
|
-
// mounts each spec via mountCommandSpec. The deprecated `register()` fallback
|
|
214
|
-
// is gone — fitness no longer touches Commander.
|
|
215
222
|
commandSpecs: fitCommandSpecs,
|
|
216
|
-
contributeScope,
|
|
217
|
-
collectReportData: collectFitnessReportData,
|
|
218
|
-
sessionReplay: {
|
|
219
|
-
tool: 'fit',
|
|
220
|
-
replaySession: fitReplayFromSession,
|
|
221
|
-
},
|
|
222
|
-
// ADR-0023 Phase 4: fitness contributes its namespaced `fitness:` Zod schema
|
|
223
|
-
// (gate thresholds, disabledChecks, recipe) so the host composes +
|
|
224
|
-
// strict-validates the whole config document before dispatch. Shared
|
|
225
|
-
// targeting (targets/globalExcludes/checkOverrides) stays with
|
|
226
|
-
// SignalersConfigSchema because the fit hot path consumes target registries
|
|
227
|
-
// through that loader.
|
|
228
|
-
config: fitnessConfigDeclaration,
|
|
229
|
-
// §5.3 Phase 4: fitness owns the `fit-pack` capability domain (declared in
|
|
230
|
-
// its manifest). It supplies the REAL registrar so the host can replace the
|
|
231
|
-
// manifest-time deferred placeholder once fitness's module loads.
|
|
232
|
-
capabilityRegistrars: { 'fit-pack': registerFitCheck, 'fit-recipe': registerFitRecipe },
|
|
233
|
-
// ADR-0036: fitness's message-hash baseline identity (sha256(filePath\nruleId\n
|
|
234
|
-
// message)), read by the host baseline/ratchet seams when fit stamps its gate
|
|
235
|
-
// envelope. Excludes line/col so unrelated line-shifts don't flap the ratchet.
|
|
236
|
-
fingerprintStrategy: fitnessFingerprintStrategy,
|
|
237
|
-
// ADR-0038: fitness owns its `init` example bytes + the pinned check-id universe.
|
|
238
|
-
// The host writes each returned file under userPluginDir('fit', file.kind).
|
|
239
|
-
scaffoldExamples: fitScaffoldExamples,
|
|
240
|
-
stableExampleIds: fitStableExampleIds,
|
|
241
|
-
// ADR-0038 Decision 2: fitness owns its `fitness:` config block (inline guidance
|
|
242
|
-
// comments the bare ToolConfigDeclaration.defaults can't express → the hook route).
|
|
243
|
-
scaffoldConfigBlock: fitScaffoldConfigBlock,
|
|
244
|
-
initialize: async () => {
|
|
245
|
-
// ensureChecksLoaded() is called inside the executeFit / listChecks
|
|
246
|
-
// / listRecipes paths, so a separate initialize() pass is not
|
|
247
|
-
// strictly needed today. Left as a no-op so fitness has somewhere
|
|
248
|
-
// to hang future tool-startup work (eager check-pack discovery,
|
|
249
|
-
// catalog warming, etc.) without requiring a contract change.
|
|
250
|
-
},
|
|
251
|
-
// ADR-0047: per-tool contract version for the fitness-specific surface
|
|
252
|
-
// (defineCheck, analysis modes, check packs, recipes, etc.). This is
|
|
253
|
-
// independent of the core TOOL_CONTRACT_VERSION (the generic Tool bus).
|
|
254
|
-
// Declared here so agent-catalog, compatibility logic, and external
|
|
255
|
-
// fitness pack authors can see the exact surface this tool was written against.
|
|
256
223
|
extensionPoints: {
|
|
257
224
|
fitnessContractVersion: FITNESS_CONTRACT_VERSION,
|
|
225
|
+
contributeScope,
|
|
226
|
+
collectReportData: collectFitnessReportData,
|
|
227
|
+
sessionReplay: {
|
|
228
|
+
tool: 'fit',
|
|
229
|
+
replaySession: fitReplayFromSession,
|
|
230
|
+
},
|
|
231
|
+
config: fitnessConfigDeclaration,
|
|
232
|
+
capabilityRegistrars: { 'fit-pack': registerFitCheck, 'fit-recipe': registerFitRecipe },
|
|
233
|
+
fingerprintStrategy: fitnessFingerprintStrategy,
|
|
234
|
+
scaffoldExamples: fitScaffoldExamples,
|
|
235
|
+
stableExampleIds: fitStableExampleIds,
|
|
236
|
+
scaffoldConfigBlock: fitScaffoldConfigBlock,
|
|
237
|
+
initialize: async () => {
|
|
238
|
+
// ensureChecksLoaded() runs inside executeFit / listChecks / listRecipes.
|
|
239
|
+
},
|
|
258
240
|
},
|
|
259
|
-
};
|
|
241
|
+
});
|
|
260
242
|
//# sourceMappingURL=tool.js.map
|
package/dist/tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClF,6EAA6E;AAC7E,oDAAoD;AACpD,OAAO,yBAAyB,CAAC;AAajC,gFAAgF;AAChF,0CAA0C;AAC1C,gFAAgF;AAEhF;;;;;;;;;;;;;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AC3E,6EAA6E;QAC7E,0EAA0E;QAC1E,6EAA6E;QAC7E,IAAI,EAAE,KAAK,EAAE,2CAA2C;QACxD,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;QAC5C,WAAW,EAAE,uCAAuC;KACrD;IACD,YAAY,EAAE,iBAAiB;IAC/B,YAAY,EAAE,eAAe;IAC7B,eAAe,EAAE;QACf,sBAAsB,EAAE,wBAAwB;QAChD,eAAe;QACf,iBAAiB,EAAE,wBAAwB;QAC3C,aAAa,EAAE;YACb,IAAI,EAAE,KAAK;YACX,aAAa,EAAE,oBAAoB;SACpC;QACD,MAAM,EAAE,wBAAwB;QAChC,oBAAoB,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,iBAAiB,EAAE;QACvF,mBAAmB,EAAE,0BAA0B;QAC/C,gBAAgB,EAAE,mBAAmB;QACrC,gBAAgB,EAAE,mBAAmB;QACrC,mBAAmB,EAAE,sBAAsB;QAC3C,UAAU,EAAE,KAAK,IAAmB,EAAE;YACpC,0EAA0E;QAC5E,CAAC;KACF;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensip-cli/fitness",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Fitness checks engine for OpenSIP CLI",
|
|
6
6
|
"keywords": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
],
|
|
35
35
|
"opensipTools": {
|
|
36
36
|
"kind": "tool",
|
|
37
|
-
"id": "
|
|
37
|
+
"id": "fit",
|
|
38
38
|
"stableId": "afd68bd3-ff3c-4935-a5b6-76d8fc7a5224",
|
|
39
39
|
"apiVersion": 1,
|
|
40
40
|
"commands": [
|
|
@@ -43,16 +43,16 @@
|
|
|
43
43
|
"description": "Run fitness checks"
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
|
-
"name": "
|
|
46
|
+
"name": "list",
|
|
47
47
|
"description": "List available fitness checks"
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
|
-
"name": "
|
|
50
|
+
"name": "recipes",
|
|
51
51
|
"description": "List available fitness recipes"
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
|
-
"name": "
|
|
55
|
-
"description": "Export
|
|
54
|
+
"name": "export",
|
|
55
|
+
"description": "Export fit artifacts (--format baseline)"
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"name": "fit-run-worker",
|
|
@@ -114,19 +114,19 @@
|
|
|
114
114
|
"react": "^19.2.7",
|
|
115
115
|
"typescript": "~6.0.3",
|
|
116
116
|
"zod": "^4.4.3",
|
|
117
|
-
"@opensip-cli/cli-ui": "0.1.
|
|
118
|
-
"@opensip-cli/config": "0.1.
|
|
119
|
-
"@opensip-cli/
|
|
120
|
-
"@opensip-cli/
|
|
121
|
-
"@opensip-cli/
|
|
122
|
-
"@opensip-cli/
|
|
123
|
-
"@opensip-cli/
|
|
117
|
+
"@opensip-cli/cli-ui": "0.1.8",
|
|
118
|
+
"@opensip-cli/config": "0.1.8",
|
|
119
|
+
"@opensip-cli/datastore": "0.1.8",
|
|
120
|
+
"@opensip-cli/session-store": "0.1.8",
|
|
121
|
+
"@opensip-cli/contracts": "0.1.8",
|
|
122
|
+
"@opensip-cli/core": "0.1.8",
|
|
123
|
+
"@opensip-cli/targeting": "0.1.8"
|
|
124
124
|
},
|
|
125
125
|
"devDependencies": {
|
|
126
126
|
"@types/node": "^24.13.2",
|
|
127
127
|
"@types/react": "^19.2.17",
|
|
128
128
|
"vitest": "^4.1.8",
|
|
129
|
-
"@opensip-cli/lang-typescript": "0.1.
|
|
129
|
+
"@opensip-cli/lang-typescript": "0.1.8"
|
|
130
130
|
},
|
|
131
131
|
"scripts": {
|
|
132
132
|
"build": "tsc",
|