@angular-modernizer/plugin-system 1.2.0 → 2.0.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/CHANGELOG.md +96 -0
- package/README.md +25 -1
- package/dist/contexts.d.ts +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/plugin-interface.d.ts +31 -0
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# @angular-modernizer/plugin-system
|
|
2
|
+
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fe2e7e8: The published tarballs include `CHANGELOG.md`: no package listed it in `files`, so the release notes were missing from every installed package.
|
|
8
|
+
- a1596d6: Docs: the plugin-system README shows how a transform rule checks its transformation type (`transformationType` under the plugin's package name in `context.config`). The plugin-angular README lists the transform options with their defaults (constructor-to-inject, facade-pattern, form-modernization); the two READMEs in its source folders are gone. The api README links the upstream ng-morph docs.
|
|
9
|
+
- 5032186: library-extraction works with the documented `libraryPrefix` forms and leaves a complete, reversible extraction. `@scope` gives the selector prefix `scope` and `@scope/name` gives `name` (the CLI rejected `--prefix=@scope`). `ng generate library` runs asynchronously in a temporary workspace with a timeout (`cliTimeoutMs`, default 300000) and the call's abort signal, ending its process tree on both; before, `execSync` blocked the server for as long as `ng` ran and a cancel had no effect. The artifacts move instead of being copied, their templates and styles move along, every importer (relative, path alias, spec, barrel, `import()`) gets the library's import name, the ng-packagr entry file exports the moved files (the built package exported only the CLI placeholder), and angular.json plus every root tsconfig that declares `paths` get targeted edits instead of a reformatted file. Secondary entry points live in `<library>/<entry>/` with their own `ng-package.json`; the invalid `lib.secondaryEntryPoints` key that broke `ng build` is gone. All created, changed and deleted files, angular.json and the tsconfig files included, are in `changedFiles` and restored by rollback-changes with file-backup and git-stash. Artifacts that import the app, templates outside the artifact's folder and other conflicts change nothing and say why; relative artifact paths resolve against angular.json's folder, not the server's working directory. A second run may name the moved file as `filePath` again: transform-code takes another file of the workspace as context, and the rule reports that the artifacts are already in the library.
|
|
10
|
+
|
|
11
|
+
any-to-interface types the generated members through the type checker (where each member's value goes, the arguments callers pass) instead of `unknown`, so assignments to typed properties no longer fail and roll back; a target whose member types cannot be found keeps `any` with the reason. Interfaces are named like interface-extraction names them.
|
|
12
|
+
|
|
13
|
+
core-shared-modules is deprecated: it never edited a file and spent 25 s and more on a report. It now answers at once with a pointer to `analyze-core-to-shared`; transform-code answers it and container-presentational without loading the project. The report orchestrator behind it is removed.
|
|
14
|
+
|
|
15
|
+
transform-code handles files a rule deletes (backup, `changedFiles`, rollback; core `backupChanges` with `deleted`), passes the call's abort signal to the rules (`TransformContext.signal`, core `TransformationConfig.signal`) and runs no further rule once a rule removed the requested file; the result names the rules it skipped (core `skippedRules` and a line in `message`). core's `RealFileSystemAdapter` throws ts-morph's `FileNotFoundError` for a missing file instead of a plain error, so ts-morph treats the file as absent (`createSourceFile` with `overwrite` failed for a file no longer on disk).
|
|
16
|
+
|
|
17
|
+
- 8cc29ab: Findings of rules that read the whole project no longer depend on scan batches. `AnalysisRule` gets an optional `scope: 'project'`, declared by interface-duplication, inheritance-analysis, library-extraction-opportunity, model-separation and srp-single-responsibility-violation; scan-all, scan-solid and scan-angular run these rules over the whole scan scope in a project of their own and the other rules in batches as before. On a large app interface-duplication gave 288 findings at batch size 100 and 412 in one batch, inheritance-analysis 7 (or 0) instead of 730, library-extraction-opportunity 10 or 17 instead of 57; now every batch size and every warm run gives the whole-scope numbers, within the scan worker's heap limit. The class index of inheritance-analysis and the scan of library-extraction-opportunity are rebuilt when the project holds other files, not only when their number changes. Cache entries written by the batch-local scans become stale once.
|
|
18
|
+
- 26aaa50: transform-code backs up, saves, checks and rolls back files other than TypeScript source files. A transform rule hands their new texts to transform-code in `TransformResult.fileChanges` (plugin-system; core passes them through) instead of writing them; they get the same backup, git snapshot, rollback with file-backup and git-stash, `changedFiles` entry and refusal outside `projectRoot` as source files, and a text equal to the file on disk writes no backup. When a call changes a template, the Angular compiler of the target project (`@angular/compiler-cli`) compares the template errors of the affected components before and after; a new error fails the call and rolls it back (`validation.templateCheck`, `introducedTemplateErrors`; `skipped` with a warning when the project has no compiler-cli). promise-component-to-reactive now converts components with a `templateUrl` file under the same rules as inline templates and keeps one whose template file another class uses too; before, it kept every `templateUrl` component. After a rollback `changedFiles` lists only files that are still changed and `rollback.files` the restored ones; before, a rolled-back single-file call listed every file as changed. api: `findTemplateOwnerClasses` and `ComponentTemplateLoader.owners` list every class using a template file, in all folders.
|
|
19
|
+
|
|
20
|
+
## 1.2.0
|
|
21
|
+
|
|
22
|
+
## 1.1.0
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- 73335c5: Every exported symbol and public member has a doc comment, and each package entry has a package overview, so the declaration files and the API reference at https://eiweiss.github.io/angular-modernizer-docs/ describe the whole public API. Descriptions that sat in file header comments, where tools did not attach them to anything, are now on the exported symbols. Doc comments that contradicted the code are corrected.
|
|
27
|
+
|
|
28
|
+
Types that public signatures already used are now exported (type-only): `I18nLayerGap` and `OutputSubscription` from api, `LegacyRecordShape` from core, `GraphFileSource` from plugin-architecture, `GodSwitchTransformConfig` from plugin-solid, and from adapter-mcp the result types of the MCP tools, the types nested in them, and the server, watcher and cache types (including `ProjectCache`). adapter-mcp is part of the API reference now.
|
|
29
|
+
|
|
30
|
+
The package READMEs match the code: rule IDs, counts, configuration examples that validate against the schema, real script names, and links to existing files only. The plugin-architecture and worker READMEs are rewritten, the orchestration README describes `WorkflowEngine` instead of an API that did not exist.
|
|
31
|
+
|
|
32
|
+
No change in behavior.
|
|
33
|
+
|
|
34
|
+
- 5ecaa3c: The package homepage is the API reference at https://eiweiss.github.io/angular-modernizer-docs/. The `repository` and `bugs` links are removed, since the source repository is not public.
|
|
35
|
+
|
|
36
|
+
## 1.0.0
|
|
37
|
+
|
|
38
|
+
### Major Changes
|
|
39
|
+
|
|
40
|
+
- a9a9d13: Release 1.0.0. The MCP server runs on the official MCP TypeScript SDK, serves the 2025 and the 2026-07-28 protocol eras over one stdio connection, validates every call against the tool's input schema and answers every one of its 41 tools with `structuredContent` that matches the tool's output schema. Long-running tools report progress and can be cancelled through the protocol. The Claude Code plugin is released as 1.0.0 too; its agents and skills read the 1.0 results and need a 1.0 server. The entries below describe each change in detail.
|
|
41
|
+
|
|
42
|
+
Breaking changes since 0.3.0:
|
|
43
|
+
- Node: all packages require `^20.19.0 || ^22.12.0 || >=24.0.0`, the Node versions supported by Angular 21.
|
|
44
|
+
- Packages: the tarballs contain the compiled output only, without `src` folders and source maps. `adapter-mcp`, `plugin-solid` and `plugin-analyzer` declare `exports`, so files inside them other than the entry point and `package.json` can no longer be imported. `adapter-mcp` now shares the version of the platform packages.
|
|
45
|
+
- MCP server: the export `JsonRpcHandler` is removed. An unknown tool is a JSON-RPC error `-32602`, and `initialize` requires `protocolVersion`, `capabilities` and `clientInfo`. The debug log `./mcp-server.log` and the health check on port 9999 start only with `ANGULAR_MODERNIZER_DEBUG=1`.
|
|
46
|
+
- Tool arguments: unknown argument names, wrong types and missing required arguments are rejected with an error result before the tool runs. Results with `success: false` or `status: "failed"` are sent with `isError: true`.
|
|
47
|
+
- Tool results: the text content is a short summary; the full result is in `structuredContent`. The statistics object `summary` is now `counts` with the same keys in `analyze-project`, `scan-architecture`, `scan-solid`, `scan-angular`, `scan-all`, `analyze-core-to-shared`, `extract-libraries`, `list-imports` and `orchestrate-migration`, and `summary` is the text. `orchestrate-migration` returns `workflowId` at the top level.
|
|
48
|
+
- Streaming: `streaming` defaults to `false` in `transform-code` and `scan-architecture`, and together with `get-operation-progress` it is deprecated (still available in 1.x). `get-operation-progress` returns an event's diff as `unifiedDiff` instead of `diff`.
|
|
49
|
+
- `transform-code`: `validateBuild` defaults to `false`; the transformed file is still type-checked and rolled back on new type errors.
|
|
50
|
+
- Feedback: the feedback tools store and read `<projectRoot>/.claude-feedback`. A platform-wide store is used only when `ANGULAR_MODERNIZER_PLATFORM_ROOT` is set, and `storageLocation: "platform"` fails without it.
|
|
51
|
+
- Project component decorators: the investigation tools treat a project's own class decorator as a component only when it is listed in `parser.componentDecorators`.
|
|
52
|
+
- `scan-architecture` scope paths match at folder boundaries: `features/orders` no longer includes `features/orders-shared`.
|
|
53
|
+
- Core API: `ValidationOrchestrator`, `ValidationConfig`, `AggregatedValidationResult`, `FalsePositiveDetector.isFalsePositiveBoolean()` and `StreamingProgressEvent.diff` are removed, as are the transform options `updateValidationPatterns`, `convertNgOnInitForms` and `autoCreateModules`, which had no effect. `validation.eslint` is deprecated.
|
|
54
|
+
- Claude Code plugin: the `ngm-decorator-remover` skill is removed. The skills and agents that move code into a shared layer take the target from the `layers` section of `.angular-modernizer.json` and ask when it is missing.
|
|
55
|
+
|
|
56
|
+
### Minor Changes
|
|
57
|
+
|
|
58
|
+
- 8557b38: Every package ships its MIT license and names its author. `adapter-mcp` is now released together with the platform packages and shares their version.
|
|
59
|
+
|
|
60
|
+
Breaking changes:
|
|
61
|
+
- All packages declare the Node versions supported by Angular 21: `^20.19.0 || ^22.12.0 || >=24.0.0`. Older Node versions are no longer supported.
|
|
62
|
+
- The packages contain the compiled output only: `src` folders and source maps are no longer published.
|
|
63
|
+
- `adapter-mcp`, `plugin-solid` and `plugin-analyzer` declare `exports` and `types` like the other packages. Imports of files inside these packages other than the package entry point and `package.json` are no longer possible.
|
|
64
|
+
- The `ngm-decorator-remover` skill is no longer part of the Claude Code plugin. Skills and agents that move files into a shared layer (`ngm-model-mover`, `ngm-circular-breaker`, `ngm-consumer-updater`, `ngm-fix-layer-violation`, `ngm-provider-wirer`, `ngm-di-token-extractor`) take the target layer from the `layers` section of `.angular-modernizer.json` and ask when it is missing, instead of assuming a fixed folder.
|
|
65
|
+
|
|
66
|
+
- c01f1ce: Service Bag detection and split now work from typed signals instead of method name patterns. `ResponsibilityClassifier` (on `PublicApi` as `analysis.responsibilityClassifier`) gives every public method a concern from resolved call receivers, field and return types: HTTP calls, reactive fields, DOM, files, dialogs and navigation, notifications, reports, validators, storage. Method names only add weak evidence and never decide alone. Reading, writing and mapping the class's own DTOs is one concern, `data-access`. Its backend areas come from the URL of each call: `resolveUrlTemplate` follows concatenation, template strings, constants and single-return prefix helpers. A method that only forwards to an injected service counts as `delegation`. A method without a clear signal is `uncertain` and keeps its evidence.
|
|
67
|
+
|
|
68
|
+
`architecture:service-bag` reports a class with two technical concerns besides data access, one large technical concern next to it, or two substantial backend areas. Focused API clients of one area are no longer reported, and neither are services recognised only by method names. Static helper classes are reported as `kind: 'static-utility'`. Several large name domains in one area become an informational `domain-candidate`. The metadata adds `kind`, `reason`, `concerns`, `areas`, `domains`, `uncertain`, `delegations`, `reactiveProperties` and `dependencies`. The existing fields stay, and `confidence` is now computed. The service gate runs per class.
|
|
69
|
+
|
|
70
|
+
The classifier resolves declarations without the type checker (`SyntacticResolver`: scopes, class members, imports with TypeScript module resolution), so a scan with this rule does not parse every library typing; it is about 25 percent faster than the previous name-based rule.
|
|
71
|
+
|
|
72
|
+
`AnalysisResult` gets an optional `severity`, and the scan tools report `result.severity ?? rule.severity`.
|
|
73
|
+
|
|
74
|
+
The split (`service-bag-transform`, now in the `transform-code` enum) uses the same classification. It creates one service per backend area or one data-access service, plus one service per technical concern. Delegations and uncertain methods stay in the original service, which stays in place as a delegating facade and is not reported again. The option `assignments` (method name to group key) carries the user's decisions. Classes with only static public methods are never split.
|
|
75
|
+
|
|
76
|
+
The split keeps the code compilable on real services. Imports are removed from the original only when no identifier of the file uses them, so decorators and module-level helpers keep theirs. Non-exported module helpers the new services use (URL builder classes) move with their imports to `<file>.shared.ts`. The new services get the imports they miss from the original's imports, and types from the original as `type` imports. Static methods stay in the original, and private static helpers the new services call are copied into them. Moved private helpers are not delegated. Constructor parameters the constructor still uses stay, and constructor initializations are read from the top-level statements only.
|
|
77
|
+
|
|
78
|
+
Fix: `transform-code` on its default path (`apiStyle: 'fluent'`, no streaming) passed the transformation to the plugins under the wrong key, so every requested plugin-angular transformation was skipped there. `FluentKernel.transform` and `TransformStage` take an optional `pluginConfig`, and `transform-code` builds it once for all paths, options included.
|
|
79
|
+
|
|
80
|
+
Fix: the split ran on every `transform-code` call for a service bag file, whatever transformation was requested. It now runs only for `service-bag-transform`.
|
|
81
|
+
|
|
82
|
+
The `ngm-service-bag-splitter` agent reads the finding from `scan-architecture` (it called `scan-angular` with a rule ID that does not exist). It shows uncertain methods with their evidence and passes the user's decisions as `assignments`.
|
|
83
|
+
|
|
84
|
+
## 0.3.0
|
|
85
|
+
|
|
86
|
+
## 0.2.0
|
|
87
|
+
|
|
88
|
+
## 0.1.3
|
|
89
|
+
|
|
90
|
+
## 0.1.2
|
|
91
|
+
|
|
92
|
+
## 0.1.1
|
|
93
|
+
|
|
94
|
+
### Patch Changes
|
|
95
|
+
|
|
96
|
+
- 58851ce: Add a `default` condition to the `exports` field. The previous `import`-only condition made the packages unresolvable for CommonJS-style resolvers (jest, `require`, bundlers resolving with the `require` condition), which failed with `ERR_PACKAGE_PATH_NOT_EXPORTED`.
|
package/README.md
CHANGED
|
@@ -310,6 +310,30 @@ class AddInjectImportRule implements TransformRule {
|
|
|
310
310
|
}
|
|
311
311
|
```
|
|
312
312
|
|
|
313
|
+
### Gate a transform rule on its transformation type
|
|
314
|
+
|
|
315
|
+
The kernel runs every transform rule of every loaded plugin on each call. A rule acts only when its type is
|
|
316
|
+
requested: the caller (transform-code, `FluentKernel.transform`) puts `transformationType` and the call's options
|
|
317
|
+
under the plugin's package name in `context.config`, and the rule returns `modified: false` for any other type.
|
|
318
|
+
|
|
319
|
+
```typescript
|
|
320
|
+
class MyTransformRule implements TransformRule {
|
|
321
|
+
readonly id = 'my-plugin:my-transform';
|
|
322
|
+
readonly name = 'My transform';
|
|
323
|
+
readonly description = 'Example of the transformation type gate';
|
|
324
|
+
readonly category = 'example';
|
|
325
|
+
|
|
326
|
+
async transform(context: TransformContext): Promise<TransformResult> {
|
|
327
|
+
const pluginConfig = context.config['@my-scope/my-plugin'] as Record<string, unknown> | undefined;
|
|
328
|
+
if (pluginConfig?.['transformationType'] !== 'my-transform') {
|
|
329
|
+
return { ruleId: this.id, modified: false, message: 'Transformation type not applicable', filePath: context.filePath };
|
|
330
|
+
}
|
|
331
|
+
// options of the call sit next to transformationType, e.g. pluginConfig['myOption']
|
|
332
|
+
return { ruleId: this.id, modified: false, message: 'Nothing to change', filePath: context.filePath };
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
```
|
|
336
|
+
|
|
313
337
|
### Using Context Factory
|
|
314
338
|
|
|
315
339
|
```typescript
|
|
@@ -321,7 +345,7 @@ const analysisContext = ContextFactory.createAnalysisContext({
|
|
|
321
345
|
project,
|
|
322
346
|
api: createPublicApi(project),
|
|
323
347
|
config: {
|
|
324
|
-
solid:
|
|
348
|
+
'solid:god-switch': { maxCases: 10 },
|
|
325
349
|
},
|
|
326
350
|
});
|
|
327
351
|
|
package/dist/contexts.d.ts
CHANGED
|
@@ -102,6 +102,11 @@ export interface TransformContext<TApi = PublicApiType> extends BaseContext<TApi
|
|
|
102
102
|
*/
|
|
103
103
|
format?: boolean;
|
|
104
104
|
};
|
|
105
|
+
/**
|
|
106
|
+
* Aborted when the client cancels the call. A rule that starts a process
|
|
107
|
+
* or waits (library-extraction runs `ng`) ends it on abort.
|
|
108
|
+
*/
|
|
109
|
+
readonly signal?: AbortSignal;
|
|
105
110
|
}
|
|
106
111
|
/**
|
|
107
112
|
* Context for validation operations.
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @packageDocumentation
|
|
15
15
|
*/
|
|
16
|
-
export type { Plugin, AnalysisRule, AnalysisResult, TransformRule, TransformResult, ValidationRule, ValidationResult, PluginLifecycle, IKernel, } from './plugin-interface.js';
|
|
16
|
+
export type { Plugin, AnalysisRule, AnalysisResult, TransformRule, TransformResult, TransformFileChange, ValidationRule, ValidationResult, PluginLifecycle, IKernel, } from './plugin-interface.js';
|
|
17
17
|
export type { BaseContext, AnalysisContext, TransformContext, ValidationContext, } from './contexts.js';
|
|
18
18
|
export { ContextFactory } from './contexts.js';
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -104,6 +104,14 @@ export interface AnalysisRule {
|
|
|
104
104
|
* Tags for filtering and search.
|
|
105
105
|
*/
|
|
106
106
|
readonly tags?: string[];
|
|
107
|
+
/**
|
|
108
|
+
* What the rule reads besides the analyzed file. `'project'`: other files
|
|
109
|
+
* of the project that the analyzed file does not import (all source files,
|
|
110
|
+
* references, subclasses), so a scan must hold its whole scope in the
|
|
111
|
+
* project when it runs the rule. `'file'` (default): the analyzed file and
|
|
112
|
+
* what the type checker resolves from it, so a batch of files is enough.
|
|
113
|
+
*/
|
|
114
|
+
readonly scope?: 'file' | 'project';
|
|
107
115
|
/**
|
|
108
116
|
* Analyze a source file and return findings.
|
|
109
117
|
*
|
|
@@ -211,11 +219,34 @@ export interface TransformResult {
|
|
|
211
219
|
* Number of changes made.
|
|
212
220
|
*/
|
|
213
221
|
changeCount?: number;
|
|
222
|
+
/**
|
|
223
|
+
* New texts of files that are not source files of the program, e.g. the
|
|
224
|
+
* `templateUrl` template of a component. The rule does not write them:
|
|
225
|
+
* transform-code backs them up, saves, checks and rolls them back with the
|
|
226
|
+
* source files it changed. A source file of the program is changed through
|
|
227
|
+
* ts-morph, never here.
|
|
228
|
+
*/
|
|
229
|
+
fileChanges?: TransformFileChange[];
|
|
214
230
|
/**
|
|
215
231
|
* Additional metadata.
|
|
216
232
|
*/
|
|
217
233
|
metadata?: Record<string, unknown>;
|
|
218
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* New text of a file a transform rule changes outside the ts-morph project
|
|
237
|
+
* (see {@link TransformResult.fileChanges}).
|
|
238
|
+
*/
|
|
239
|
+
export interface TransformFileChange {
|
|
240
|
+
/** Absolute path of the file; a file that does not exist yet is created. */
|
|
241
|
+
filePath: string;
|
|
242
|
+
/** Full new text of the file (ignored when `delete` is set). */
|
|
243
|
+
text: string;
|
|
244
|
+
/**
|
|
245
|
+
* The rule removes the file (e.g. a template it moved); transform-code
|
|
246
|
+
* backs it up and writes it again on a rollback.
|
|
247
|
+
*/
|
|
248
|
+
delete?: boolean;
|
|
249
|
+
}
|
|
219
250
|
/**
|
|
220
251
|
* Validation Rule - verifies that code meets requirements.
|
|
221
252
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-modernizer/plugin-system",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Plugin infrastructure for the Angular Modernization Platform",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
|
+
"CHANGELOG.md",
|
|
27
28
|
"dist",
|
|
28
29
|
"!dist/**/__tests__/**",
|
|
29
30
|
"!dist/**/*.map"
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
"scripts": {
|
|
52
53
|
"build": "tsc --build",
|
|
53
54
|
"test": "jest --passWithNoTests",
|
|
54
|
-
"lint": "eslint src
|
|
55
|
+
"lint": "eslint src",
|
|
55
56
|
"clean": "rimraf dist tsconfig.tsbuildinfo"
|
|
56
57
|
}
|
|
57
58
|
}
|