@mimir-labs/core 0.1.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 +21 -0
- package/README.md +5 -0
- package/dist/implementation/adapters/agents-md/adapter.d.ts +2 -0
- package/dist/implementation/adapters/agents-md/adapter.js +35 -0
- package/dist/implementation/adapters/agents-md/adapter.js.map +1 -0
- package/dist/implementation/adapters/copilot/adapter.d.ts +2 -0
- package/dist/implementation/adapters/copilot/adapter.js +34 -0
- package/dist/implementation/adapters/copilot/adapter.js.map +1 -0
- package/dist/implementation/adapters/cursor/adapter.d.ts +2 -0
- package/dist/implementation/adapters/cursor/adapter.js +33 -0
- package/dist/implementation/adapters/cursor/adapter.js.map +1 -0
- package/dist/implementation/adapters/index.d.ts +5 -0
- package/dist/implementation/adapters/index.js +23 -0
- package/dist/implementation/adapters/index.js.map +1 -0
- package/dist/implementation/adapters/managed-section.d.ts +5 -0
- package/dist/implementation/adapters/managed-section.js +37 -0
- package/dist/implementation/adapters/managed-section.js.map +1 -0
- package/dist/implementation/adapters/registry.d.ts +11 -0
- package/dist/implementation/adapters/registry.js +50 -0
- package/dist/implementation/adapters/registry.js.map +1 -0
- package/dist/implementation/adapters/types.d.ts +19 -0
- package/dist/implementation/adapters/types.js +3 -0
- package/dist/implementation/adapters/types.js.map +1 -0
- package/dist/implementation/configuration/manifest-loader.d.ts +16 -0
- package/dist/implementation/configuration/manifest-loader.js +64 -0
- package/dist/implementation/configuration/manifest-loader.js.map +1 -0
- package/dist/implementation/configuration/package-config.d.ts +12 -0
- package/dist/implementation/configuration/package-config.js +33 -0
- package/dist/implementation/configuration/package-config.js.map +1 -0
- package/dist/implementation/dependency-discovery/discover-providers.d.ts +6 -0
- package/dist/implementation/dependency-discovery/discover-providers.js +39 -0
- package/dist/implementation/dependency-discovery/discover-providers.js.map +1 -0
- package/dist/implementation/doctor/evaluator.d.ts +16 -0
- package/dist/implementation/doctor/evaluator.js +269 -0
- package/dist/implementation/doctor/evaluator.js.map +1 -0
- package/dist/implementation/generation/examples/existing-aps/src/Modal.d.ts +4 -0
- package/dist/implementation/generation/examples/existing-aps/src/Modal.js +7 -0
- package/dist/implementation/generation/examples/existing-aps/src/Modal.js.map +1 -0
- package/dist/implementation/generation/examples/existing-aps/src/index.d.ts +1 -0
- package/dist/implementation/generation/examples/existing-aps/src/index.js +6 -0
- package/dist/implementation/generation/examples/existing-aps/src/index.js.map +1 -0
- package/dist/implementation/generation/examples/missing-metadata/src/Input.d.ts +6 -0
- package/dist/implementation/generation/examples/missing-metadata/src/Input.js +6 -0
- package/dist/implementation/generation/examples/missing-metadata/src/Input.js.map +1 -0
- package/dist/implementation/generation/examples/missing-metadata/src/index.d.ts +1 -0
- package/dist/implementation/generation/examples/missing-metadata/src/index.js +6 -0
- package/dist/implementation/generation/examples/missing-metadata/src/index.js.map +1 -0
- package/dist/implementation/generation/examples/react-exports/src/Button.d.ts +5 -0
- package/dist/implementation/generation/examples/react-exports/src/Button.js +7 -0
- package/dist/implementation/generation/examples/react-exports/src/Button.js.map +1 -0
- package/dist/implementation/generation/examples/react-exports/src/Button.stories.d.ts +16 -0
- package/dist/implementation/generation/examples/react-exports/src/Button.stories.js +20 -0
- package/dist/implementation/generation/examples/react-exports/src/Button.stories.js.map +1 -0
- package/dist/implementation/generation/examples/react-exports/src/index.d.ts +1 -0
- package/dist/implementation/generation/examples/react-exports/src/index.js +6 -0
- package/dist/implementation/generation/examples/react-exports/src/index.js.map +1 -0
- package/dist/implementation/generation/extractors/readme-extractor.d.ts +2 -0
- package/dist/implementation/generation/extractors/readme-extractor.js +58 -0
- package/dist/implementation/generation/extractors/readme-extractor.js.map +1 -0
- package/dist/implementation/generation/extractors/storybook-extractor.d.ts +2 -0
- package/dist/implementation/generation/extractors/storybook-extractor.js +64 -0
- package/dist/implementation/generation/extractors/storybook-extractor.js.map +1 -0
- package/dist/implementation/generation/extractors/typescript-extractor.d.ts +2 -0
- package/dist/implementation/generation/extractors/typescript-extractor.js +138 -0
- package/dist/implementation/generation/extractors/typescript-extractor.js.map +1 -0
- package/dist/implementation/generation/generate-service.d.ts +6 -0
- package/dist/implementation/generation/generate-service.js +121 -0
- package/dist/implementation/generation/generate-service.js.map +1 -0
- package/dist/implementation/generation/provenance/provenance-builder.d.ts +6 -0
- package/dist/implementation/generation/provenance/provenance-builder.js +44 -0
- package/dist/implementation/generation/provenance/provenance-builder.js.map +1 -0
- package/dist/implementation/generation/resource-builders/component-builder.d.ts +2 -0
- package/dist/implementation/generation/resource-builders/component-builder.js +68 -0
- package/dist/implementation/generation/resource-builders/component-builder.js.map +1 -0
- package/dist/implementation/generation/resource-builders/example-builder.d.ts +5 -0
- package/dist/implementation/generation/resource-builders/example-builder.js +10 -0
- package/dist/implementation/generation/resource-builders/example-builder.js.map +1 -0
- package/dist/implementation/generation/types.d.ts +80 -0
- package/dist/implementation/generation/types.js +3 -0
- package/dist/implementation/generation/types.js.map +1 -0
- package/dist/implementation/generators/aps-generator.d.ts +7 -0
- package/dist/implementation/generators/aps-generator.js +11 -0
- package/dist/implementation/generators/aps-generator.js.map +1 -0
- package/dist/implementation/generators/index.d.ts +4 -0
- package/dist/implementation/generators/index.js +15 -0
- package/dist/implementation/generators/index.js.map +1 -0
- package/dist/implementation/generators/registry.d.ts +8 -0
- package/dist/implementation/generators/registry.js +30 -0
- package/dist/implementation/generators/registry.js.map +1 -0
- package/dist/implementation/generators/types.d.ts +4 -0
- package/dist/implementation/generators/types.js +3 -0
- package/dist/implementation/generators/types.js.map +1 -0
- package/dist/implementation/io/fs.d.ts +6 -0
- package/dist/implementation/io/fs.js +47 -0
- package/dist/implementation/io/fs.js.map +1 -0
- package/dist/implementation/io/json.d.ts +1 -0
- package/dist/implementation/io/json.js +7 -0
- package/dist/implementation/io/json.js.map +1 -0
- package/dist/implementation/query/resource-summary.d.ts +4 -0
- package/dist/implementation/query/resource-summary.js +32 -0
- package/dist/implementation/query/resource-summary.js.map +1 -0
- package/dist/implementation/services/context-service.d.ts +4 -0
- package/dist/implementation/services/context-service.js +22 -0
- package/dist/implementation/services/context-service.js.map +1 -0
- package/dist/implementation/services/discovery-service.d.ts +1 -0
- package/dist/implementation/services/discovery-service.js +8 -0
- package/dist/implementation/services/discovery-service.js.map +1 -0
- package/dist/implementation/services/doctor-service.d.ts +1 -0
- package/dist/implementation/services/doctor-service.js +8 -0
- package/dist/implementation/services/doctor-service.js.map +1 -0
- package/dist/implementation/services/generate-service.d.ts +7 -0
- package/dist/implementation/services/generate-service.js +10 -0
- package/dist/implementation/services/generate-service.js.map +1 -0
- package/dist/implementation/services/governance-service.d.ts +1 -0
- package/dist/implementation/services/governance-service.js +28 -0
- package/dist/implementation/services/governance-service.js.map +1 -0
- package/dist/implementation/services/init-service.d.ts +6 -0
- package/dist/implementation/services/init-service.js +49 -0
- package/dist/implementation/services/init-service.js.map +1 -0
- package/dist/implementation/services/sync-service.d.ts +8 -0
- package/dist/implementation/services/sync-service.js +35 -0
- package/dist/implementation/services/sync-service.js.map +1 -0
- package/dist/implementation/services/validate-service.d.ts +1 -0
- package/dist/implementation/services/validate-service.js +8 -0
- package/dist/implementation/services/validate-service.js.map +1 -0
- package/dist/implementation/synchronization/agents-md.d.ts +2 -0
- package/dist/implementation/synchronization/agents-md.js +46 -0
- package/dist/implementation/synchronization/agents-md.js.map +1 -0
- package/dist/implementation/synchronization/context-generator.d.ts +7 -0
- package/dist/implementation/synchronization/context-generator.js +110 -0
- package/dist/implementation/synchronization/context-generator.js.map +1 -0
- package/dist/implementation/validation-engine/validate-package.d.ts +10 -0
- package/dist/implementation/validation-engine/validate-package.js +123 -0
- package/dist/implementation/validation-engine/validate-package.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol/compatibility/aps-component-schema.d.ts +17 -0
- package/dist/protocol/compatibility/aps-component-schema.js +85 -0
- package/dist/protocol/compatibility/aps-component-schema.js.map +1 -0
- package/dist/protocol/compatibility/aps-example-schema.d.ts +14 -0
- package/dist/protocol/compatibility/aps-example-schema.js +63 -0
- package/dist/protocol/compatibility/aps-example-schema.js.map +1 -0
- package/dist/protocol/compatibility/aps-manifest-schema.d.ts +15 -0
- package/dist/protocol/compatibility/aps-manifest-schema.js +115 -0
- package/dist/protocol/compatibility/aps-manifest-schema.js.map +1 -0
- package/dist/protocol/compatibility/aps-migration-schema.d.ts +14 -0
- package/dist/protocol/compatibility/aps-migration-schema.js +65 -0
- package/dist/protocol/compatibility/aps-migration-schema.js.map +1 -0
- package/dist/protocol/compatibility/aps-pattern-schema.d.ts +15 -0
- package/dist/protocol/compatibility/aps-pattern-schema.js +67 -0
- package/dist/protocol/compatibility/aps-pattern-schema.js.map +1 -0
- package/dist/protocol/compatibility/aps-rule-schema.d.ts +13 -0
- package/dist/protocol/compatibility/aps-rule-schema.js +55 -0
- package/dist/protocol/compatibility/aps-rule-schema.js.map +1 -0
- package/dist/protocol/compatibility/index.d.ts +14 -0
- package/dist/protocol/compatibility/index.js +6 -0
- package/dist/protocol/compatibility/index.js.map +1 -0
- package/dist/protocol/governance/applicability-validator.d.ts +2 -0
- package/dist/protocol/governance/applicability-validator.js +108 -0
- package/dist/protocol/governance/applicability-validator.js.map +1 -0
- package/dist/protocol/governance/conflict-validator.d.ts +2 -0
- package/dist/protocol/governance/conflict-validator.js +129 -0
- package/dist/protocol/governance/conflict-validator.js.map +1 -0
- package/dist/protocol/governance/evidence-validator.d.ts +2 -0
- package/dist/protocol/governance/evidence-validator.js +97 -0
- package/dist/protocol/governance/evidence-validator.js.map +1 -0
- package/dist/protocol/governance/identity-validator.d.ts +2 -0
- package/dist/protocol/governance/identity-validator.js +79 -0
- package/dist/protocol/governance/identity-validator.js.map +1 -0
- package/dist/protocol/governance/index.d.ts +79 -0
- package/dist/protocol/governance/index.js +115 -0
- package/dist/protocol/governance/index.js.map +1 -0
- package/dist/protocol/governance/lifecycle-validator.d.ts +2 -0
- package/dist/protocol/governance/lifecycle-validator.js +93 -0
- package/dist/protocol/governance/lifecycle-validator.js.map +1 -0
- package/dist/protocol/governance/provenance-validator.d.ts +2 -0
- package/dist/protocol/governance/provenance-validator.js +170 -0
- package/dist/protocol/governance/provenance-validator.js.map +1 -0
- package/dist/protocol/manifest/api-resource.d.ts +26 -0
- package/dist/protocol/manifest/api-resource.js +3 -0
- package/dist/protocol/manifest/api-resource.js.map +1 -0
- package/dist/protocol/manifest/common.d.ts +44 -0
- package/dist/protocol/manifest/common.js +3 -0
- package/dist/protocol/manifest/common.js.map +1 -0
- package/dist/protocol/manifest/component-resource.d.ts +48 -0
- package/dist/protocol/manifest/component-resource.js +3 -0
- package/dist/protocol/manifest/component-resource.js.map +1 -0
- package/dist/protocol/manifest/event-resource.d.ts +16 -0
- package/dist/protocol/manifest/event-resource.js +3 -0
- package/dist/protocol/manifest/event-resource.js.map +1 -0
- package/dist/protocol/manifest/example-resource.d.ts +17 -0
- package/dist/protocol/manifest/example-resource.js +3 -0
- package/dist/protocol/manifest/example-resource.js.map +1 -0
- package/dist/protocol/manifest/index.d.ts +13 -0
- package/dist/protocol/manifest/index.js +3 -0
- package/dist/protocol/manifest/index.js.map +1 -0
- package/dist/protocol/manifest/legacy-v1.d.ts +47 -0
- package/dist/protocol/manifest/legacy-v1.js +3 -0
- package/dist/protocol/manifest/legacy-v1.js.map +1 -0
- package/dist/protocol/manifest/manifest.d.ts +28 -0
- package/dist/protocol/manifest/manifest.js +3 -0
- package/dist/protocol/manifest/manifest.js.map +1 -0
- package/dist/protocol/manifest/migration-resource.d.ts +22 -0
- package/dist/protocol/manifest/migration-resource.js +3 -0
- package/dist/protocol/manifest/migration-resource.js.map +1 -0
- package/dist/protocol/manifest/model-resource.d.ts +21 -0
- package/dist/protocol/manifest/model-resource.js +3 -0
- package/dist/protocol/manifest/model-resource.js.map +1 -0
- package/dist/protocol/manifest/pattern-resource.d.ts +14 -0
- package/dist/protocol/manifest/pattern-resource.js +3 -0
- package/dist/protocol/manifest/pattern-resource.js.map +1 -0
- package/dist/protocol/manifest/resource.d.ts +24 -0
- package/dist/protocol/manifest/resource.js +3 -0
- package/dist/protocol/manifest/resource.js.map +1 -0
- package/dist/protocol/manifest/rule-resource.d.ts +27 -0
- package/dist/protocol/manifest/rule-resource.js +3 -0
- package/dist/protocol/manifest/rule-resource.js.map +1 -0
- package/dist/protocol/manifest/service-resource.d.ts +14 -0
- package/dist/protocol/manifest/service-resource.js +3 -0
- package/dist/protocol/manifest/service-resource.js.map +1 -0
- package/dist/shared/json.d.ts +2 -0
- package/dist/shared/json.js +14 -0
- package/dist/shared/json.js.map +1 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SeaBassLab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.agentsMdAdapter = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const managed_section_1 = require("../managed-section");
|
|
9
|
+
exports.agentsMdAdapter = {
|
|
10
|
+
name: "agents-md",
|
|
11
|
+
async sync(context) {
|
|
12
|
+
const targetPath = node_path_1.default.join(context.cwd, "AGENTS.md");
|
|
13
|
+
const { changed, created } = await (0, managed_section_1.upsertManagedSection)(targetPath, [
|
|
14
|
+
"## APS Context",
|
|
15
|
+
"",
|
|
16
|
+
"Generated AI package knowledge:",
|
|
17
|
+
"",
|
|
18
|
+
"Read:",
|
|
19
|
+
"- .agents/aps/index.md"
|
|
20
|
+
]);
|
|
21
|
+
return {
|
|
22
|
+
adapter: "agents-md",
|
|
23
|
+
target: targetPath,
|
|
24
|
+
changed,
|
|
25
|
+
created,
|
|
26
|
+
message: created
|
|
27
|
+
? "AGENTS.md created"
|
|
28
|
+
: changed
|
|
29
|
+
? "AGENTS.md APS section updated"
|
|
30
|
+
: "AGENTS.md already synchronized",
|
|
31
|
+
warnings: []
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../../src/implementation/adapters/agents-md/adapter.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,wDAA0D;AAG7C,QAAA,eAAe,GAAiB;IAC3C,IAAI,EAAE,WAAW;IACjB,KAAK,CAAC,IAAI,CAAC,OAAO;QAChB,MAAM,UAAU,GAAG,mBAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;QACvD,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,sCAAoB,EAAC,UAAU,EAAE;YAClE,gBAAgB;YAChB,EAAE;YACF,iCAAiC;YACjC,EAAE;YACF,OAAO;YACP,wBAAwB;SACzB,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE,WAAW;YACpB,MAAM,EAAE,UAAU;YAClB,OAAO;YACP,OAAO;YACP,OAAO,EAAE,OAAO;gBACd,CAAC,CAAC,mBAAmB;gBACrB,CAAC,CAAC,OAAO;oBACP,CAAC,CAAC,+BAA+B;oBACjC,CAAC,CAAC,gCAAgC;YACtC,QAAQ,EAAE,EAAE;SACb,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.copilotAdapter = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const managed_section_1 = require("../managed-section");
|
|
9
|
+
exports.copilotAdapter = {
|
|
10
|
+
name: "copilot",
|
|
11
|
+
async sync(context) {
|
|
12
|
+
const targetPath = node_path_1.default.join(context.cwd, ".github", "copilot-instructions.md");
|
|
13
|
+
const { changed, created } = await (0, managed_section_1.upsertManagedSection)(targetPath, [
|
|
14
|
+
"## APS Context",
|
|
15
|
+
"",
|
|
16
|
+
"Use generated APS knowledge as reference:",
|
|
17
|
+
"",
|
|
18
|
+
"- .agents/aps/index.md"
|
|
19
|
+
]);
|
|
20
|
+
return {
|
|
21
|
+
adapter: "copilot",
|
|
22
|
+
target: targetPath,
|
|
23
|
+
changed,
|
|
24
|
+
created,
|
|
25
|
+
message: created
|
|
26
|
+
? "Copilot instructions created"
|
|
27
|
+
: changed
|
|
28
|
+
? "Copilot instructions APS section updated"
|
|
29
|
+
: "Copilot instructions already synchronized",
|
|
30
|
+
warnings: []
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../../src/implementation/adapters/copilot/adapter.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,wDAA0D;AAG7C,QAAA,cAAc,GAAiB;IAC1C,IAAI,EAAE,SAAS;IACf,KAAK,CAAC,IAAI,CAAC,OAAO;QAChB,MAAM,UAAU,GAAG,mBAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,yBAAyB,CAAC,CAAC;QAChF,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,sCAAoB,EAAC,UAAU,EAAE;YAClE,gBAAgB;YAChB,EAAE;YACF,2CAA2C;YAC3C,EAAE;YACF,wBAAwB;SACzB,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE,SAAS;YAClB,MAAM,EAAE,UAAU;YAClB,OAAO;YACP,OAAO;YACP,OAAO,EAAE,OAAO;gBACd,CAAC,CAAC,8BAA8B;gBAChC,CAAC,CAAC,OAAO;oBACP,CAAC,CAAC,0CAA0C;oBAC5C,CAAC,CAAC,2CAA2C;YACjD,QAAQ,EAAE,EAAE;SACb,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.cursorAdapter = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const managed_section_1 = require("../managed-section");
|
|
9
|
+
exports.cursorAdapter = {
|
|
10
|
+
name: "cursor",
|
|
11
|
+
async sync(context) {
|
|
12
|
+
const targetPath = node_path_1.default.join(context.cwd, ".cursor", "rules", "aps.mdc");
|
|
13
|
+
const { changed, created } = await (0, managed_section_1.upsertManagedSection)(targetPath, [
|
|
14
|
+
"# APS Context",
|
|
15
|
+
"",
|
|
16
|
+
"Read generated APS knowledge:",
|
|
17
|
+
"- .agents/aps/index.md"
|
|
18
|
+
]);
|
|
19
|
+
return {
|
|
20
|
+
adapter: "cursor",
|
|
21
|
+
target: targetPath,
|
|
22
|
+
changed,
|
|
23
|
+
created,
|
|
24
|
+
message: created
|
|
25
|
+
? "Cursor APS rule created"
|
|
26
|
+
: changed
|
|
27
|
+
? "Cursor APS rule updated"
|
|
28
|
+
: "Cursor APS rule already synchronized",
|
|
29
|
+
warnings: []
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../../src/implementation/adapters/cursor/adapter.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,wDAA0D;AAG7C,QAAA,aAAa,GAAiB;IACzC,IAAI,EAAE,QAAQ;IACd,KAAK,CAAC,IAAI,CAAC,OAAO;QAChB,MAAM,UAAU,GAAG,mBAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QACzE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,sCAAoB,EAAC,UAAU,EAAE;YAClE,eAAe;YACf,EAAE;YACF,+BAA+B;YAC/B,wBAAwB;SACzB,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE,QAAQ;YACjB,MAAM,EAAE,UAAU;YAClB,OAAO;YACP,OAAO;YACP,OAAO,EAAE,OAAO;gBACd,CAAC,CAAC,yBAAyB;gBAC3B,CAAC,CAAC,OAAO;oBACP,CAAC,CAAC,yBAAyB;oBAC3B,CAAC,CAAC,sCAAsC;YAC5C,QAAQ,EAAE,EAAE;SACb,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AgentAdapter } from "./types";
|
|
2
|
+
export type { AgentAdapter, AgentContext, SyncResult } from "./types";
|
|
3
|
+
export declare function registerAdapter(adapter: AgentAdapter, aliases?: string[]): void;
|
|
4
|
+
export declare function getAdapter(name: string): AgentAdapter | undefined;
|
|
5
|
+
export declare function getConfiguredAdapters(adapterConfig: unknown): AgentAdapter[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerAdapter = registerAdapter;
|
|
4
|
+
exports.getAdapter = getAdapter;
|
|
5
|
+
exports.getConfiguredAdapters = getConfiguredAdapters;
|
|
6
|
+
const adapter_1 = require("./agents-md/adapter");
|
|
7
|
+
const adapter_2 = require("./copilot/adapter");
|
|
8
|
+
const adapter_3 = require("./cursor/adapter");
|
|
9
|
+
const registry_1 = require("./registry");
|
|
10
|
+
const adapterRegistry = new registry_1.AdapterRegistry();
|
|
11
|
+
adapterRegistry.register(adapter_1.agentsMdAdapter, ["agents"]);
|
|
12
|
+
adapterRegistry.register(adapter_2.copilotAdapter);
|
|
13
|
+
adapterRegistry.register(adapter_3.cursorAdapter);
|
|
14
|
+
function registerAdapter(adapter, aliases = []) {
|
|
15
|
+
adapterRegistry.register(adapter, aliases);
|
|
16
|
+
}
|
|
17
|
+
function getAdapter(name) {
|
|
18
|
+
return adapterRegistry.get(name);
|
|
19
|
+
}
|
|
20
|
+
function getConfiguredAdapters(adapterConfig) {
|
|
21
|
+
return adapterRegistry.resolve(adapterConfig);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/implementation/adapters/index.ts"],"names":[],"mappings":";;AAcA,0CAEC;AAED,gCAEC;AAED,sDAEC;AAxBD,iDAAsD;AACtD,+CAAmD;AACnD,8CAAiD;AAEjD,yCAA6C;AAI7C,MAAM,eAAe,GAAG,IAAI,0BAAe,EAAE,CAAC;AAE9C,eAAe,CAAC,QAAQ,CAAC,yBAAe,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtD,eAAe,CAAC,QAAQ,CAAC,wBAAc,CAAC,CAAC;AACzC,eAAe,CAAC,QAAQ,CAAC,uBAAa,CAAC,CAAC;AAExC,SAAgB,eAAe,CAAC,OAAqB,EAAE,UAAoB,EAAE;IAC3E,eAAe,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC;AAED,SAAgB,UAAU,CAAC,IAAY;IACrC,OAAO,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,SAAgB,qBAAqB,CAAC,aAAsB;IAC1D,OAAO,eAAe,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderManagedBlock = renderManagedBlock;
|
|
4
|
+
exports.upsertManagedSection = upsertManagedSection;
|
|
5
|
+
const fs_1 = require("../io/fs");
|
|
6
|
+
const APS_START_MARKER = "<!-- APS:START -->";
|
|
7
|
+
const APS_END_MARKER = "<!-- APS:END -->";
|
|
8
|
+
function renderManagedBlock(contentLines) {
|
|
9
|
+
return [APS_START_MARKER, "", ...contentLines, "", APS_END_MARKER].join("\n");
|
|
10
|
+
}
|
|
11
|
+
async function upsertManagedSection(filePath, contentLines) {
|
|
12
|
+
const managedSection = renderManagedBlock(contentLines);
|
|
13
|
+
if (!(await (0, fs_1.fileExists)(filePath))) {
|
|
14
|
+
await (0, fs_1.writeText)(filePath, `${managedSection}\n`);
|
|
15
|
+
return { changed: true, created: true };
|
|
16
|
+
}
|
|
17
|
+
const current = await (0, fs_1.readText)(filePath);
|
|
18
|
+
const startIndex = current.indexOf(APS_START_MARKER);
|
|
19
|
+
const endIndex = current.indexOf(APS_END_MARKER);
|
|
20
|
+
if (startIndex >= 0 && endIndex > startIndex) {
|
|
21
|
+
const before = current.slice(0, startIndex).trimEnd();
|
|
22
|
+
const after = current.slice(endIndex + APS_END_MARKER.length).trimStart();
|
|
23
|
+
const next = `${[before, managedSection, after].filter((part) => part.length > 0).join("\n\n")}\n`;
|
|
24
|
+
if (next === current) {
|
|
25
|
+
return { changed: false, created: false };
|
|
26
|
+
}
|
|
27
|
+
await (0, fs_1.writeText)(filePath, next);
|
|
28
|
+
return { changed: true, created: false };
|
|
29
|
+
}
|
|
30
|
+
const next = `${current.trimEnd()}\n\n${managedSection}\n`;
|
|
31
|
+
if (next === current) {
|
|
32
|
+
return { changed: false, created: false };
|
|
33
|
+
}
|
|
34
|
+
await (0, fs_1.writeText)(filePath, next);
|
|
35
|
+
return { changed: true, created: false };
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=managed-section.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-section.js","sourceRoot":"","sources":["../../../src/implementation/adapters/managed-section.ts"],"names":[],"mappings":";;AAKA,gDAEC;AAED,oDAiCC;AA1CD,iCAA2D;AAE3D,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AAC9C,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAE1C,SAAgB,kBAAkB,CAAC,YAAsB;IACvD,OAAO,CAAC,gBAAgB,EAAE,EAAE,EAAE,GAAG,YAAY,EAAE,EAAE,EAAE,cAAc,CAAC,CAA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Q,EAAE,IAAI,CAAC,CAAC;QAChC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC3C,CAAC;IAED,MAAM,IAAI,GAAG,GAAG,OAAO,CAAC,OAAO,EAAE,OAAO,cAAc,IAAI,CAAC;IAC3D,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5C,CAAC;IAED,MAAM,IAAA,cAAS,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAChC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AgentAdapter } from "./types";
|
|
2
|
+
export declare class AdapterRegistry {
|
|
3
|
+
private readonly adaptersByName;
|
|
4
|
+
private readonly aliasToName;
|
|
5
|
+
private readonly defaultOrder;
|
|
6
|
+
register(adapter: AgentAdapter, aliases?: string[]): void;
|
|
7
|
+
get(name: string): AgentAdapter | undefined;
|
|
8
|
+
resolve(config: unknown): AgentAdapter[];
|
|
9
|
+
private resolveCanonical;
|
|
10
|
+
private normalize;
|
|
11
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AdapterRegistry = void 0;
|
|
4
|
+
class AdapterRegistry {
|
|
5
|
+
adaptersByName = new Map();
|
|
6
|
+
aliasToName = new Map();
|
|
7
|
+
defaultOrder = [];
|
|
8
|
+
register(adapter, aliases = []) {
|
|
9
|
+
const canonicalName = this.normalize(adapter.name);
|
|
10
|
+
this.adaptersByName.set(canonicalName, adapter);
|
|
11
|
+
if (!this.defaultOrder.includes(canonicalName)) {
|
|
12
|
+
this.defaultOrder.push(canonicalName);
|
|
13
|
+
}
|
|
14
|
+
this.aliasToName.set(canonicalName, canonicalName);
|
|
15
|
+
for (const alias of aliases) {
|
|
16
|
+
this.aliasToName.set(this.normalize(alias), canonicalName);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
get(name) {
|
|
20
|
+
const canonical = this.resolveCanonical(name);
|
|
21
|
+
return canonical ? this.adaptersByName.get(canonical) : undefined;
|
|
22
|
+
}
|
|
23
|
+
resolve(config) {
|
|
24
|
+
if (!Array.isArray(config)) {
|
|
25
|
+
return this.defaultOrder
|
|
26
|
+
.map((name) => this.adaptersByName.get(name))
|
|
27
|
+
.filter((adapter) => Boolean(adapter));
|
|
28
|
+
}
|
|
29
|
+
const selected = [...new Set(config)]
|
|
30
|
+
.filter((item) => typeof item === "string")
|
|
31
|
+
.map((item) => this.resolveCanonical(item))
|
|
32
|
+
.filter((name) => Boolean(name));
|
|
33
|
+
if (selected.length === 0) {
|
|
34
|
+
return this.defaultOrder
|
|
35
|
+
.map((name) => this.adaptersByName.get(name))
|
|
36
|
+
.filter((adapter) => Boolean(adapter));
|
|
37
|
+
}
|
|
38
|
+
return selected
|
|
39
|
+
.map((name) => this.adaptersByName.get(name))
|
|
40
|
+
.filter((adapter) => Boolean(adapter));
|
|
41
|
+
}
|
|
42
|
+
resolveCanonical(name) {
|
|
43
|
+
return this.aliasToName.get(this.normalize(name));
|
|
44
|
+
}
|
|
45
|
+
normalize(value) {
|
|
46
|
+
return value.trim().toLowerCase();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.AdapterRegistry = AdapterRegistry;
|
|
50
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/implementation/adapters/registry.ts"],"names":[],"mappings":";;;AAEA,MAAa,eAAe;IACT,cAAc,GAAG,IAAI,GAAG,EAAwB,CAAC;IACjD,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,YAAY,GAAa,EAAE,CAAC;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AC,IAAI,EAAkB,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC;aAC1D,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;aAC1C,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAEnD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC,YAAY;iBACrB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;iBAC5C,MAAM,CAAC,CAAC,OAAO,EAA2B,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,QAAQ;aACZ,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;aAC5C,MAAM,CAAC,CAAC,OAAO,EAA2B,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACpE,CAAC;IAEO,gBAAgB,CAAC,IAAY;QACnC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,CAAC;IAEO,SAAS,CAAC,KAAa;QAC7B,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC;CACF;AAtDD,0CAsDC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DiscoveredProvider } from "../configuration/manifest-loader";
|
|
2
|
+
export type AgentContext = {
|
|
3
|
+
cwd: string;
|
|
4
|
+
contextDir: string;
|
|
5
|
+
contextFiles: string[];
|
|
6
|
+
providers: DiscoveredProvider[];
|
|
7
|
+
};
|
|
8
|
+
export type SyncResult = {
|
|
9
|
+
adapter: string;
|
|
10
|
+
target: string;
|
|
11
|
+
changed: boolean;
|
|
12
|
+
created: boolean;
|
|
13
|
+
message: string;
|
|
14
|
+
warnings: string[];
|
|
15
|
+
};
|
|
16
|
+
export interface AgentAdapter {
|
|
17
|
+
name: string;
|
|
18
|
+
sync(context: AgentContext): Promise<SyncResult>;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/implementation/adapters/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ApsPackageConfig } from "./package-config";
|
|
2
|
+
export type DiscoveredProvider = {
|
|
3
|
+
name: string;
|
|
4
|
+
packageRoot: string;
|
|
5
|
+
packageJsonPath: string;
|
|
6
|
+
aps: ApsPackageConfig;
|
|
7
|
+
configSource: "aps" | "ai";
|
|
8
|
+
manifestPath: string;
|
|
9
|
+
manifest: Record<string, unknown> | null;
|
|
10
|
+
resourceCounts: Array<{
|
|
11
|
+
key: string;
|
|
12
|
+
count: number;
|
|
13
|
+
}>;
|
|
14
|
+
warnings: string[];
|
|
15
|
+
};
|
|
16
|
+
export declare function loadApsProvider(packageName: string, fromDirectory: string): Promise<DiscoveredProvider | null>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.loadApsProvider = loadApsProvider;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const node_module_1 = require("node:module");
|
|
9
|
+
const fs_1 = require("../io/fs");
|
|
10
|
+
const json_1 = require("../io/json");
|
|
11
|
+
const resource_summary_1 = require("../query/resource-summary");
|
|
12
|
+
const package_config_1 = require("./package-config");
|
|
13
|
+
const DEFAULT_MANIFEST_PATH = "./dist/aps/manifest.json";
|
|
14
|
+
async function loadApsProvider(packageName, fromDirectory) {
|
|
15
|
+
const requireFromApp = (0, node_module_1.createRequire)(node_path_1.default.join(fromDirectory, "package.json"));
|
|
16
|
+
let packageJsonPath;
|
|
17
|
+
try {
|
|
18
|
+
packageJsonPath = requireFromApp.resolve(`${packageName}/package.json`);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const packageRoot = node_path_1.default.dirname(packageJsonPath);
|
|
24
|
+
const packageJson = await (0, fs_1.readJson)(packageJsonPath);
|
|
25
|
+
const configResolution = (0, package_config_1.resolveApsPackageConfig)(packageJson);
|
|
26
|
+
if (!configResolution.config || !configResolution.source) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const aps = configResolution.config;
|
|
30
|
+
const manifestRelPath = typeof aps.manifest === "string" ? aps.manifest : DEFAULT_MANIFEST_PATH;
|
|
31
|
+
const manifestPath = node_path_1.default.resolve(packageRoot, manifestRelPath);
|
|
32
|
+
const warnings = [...configResolution.warnings];
|
|
33
|
+
let manifest = null;
|
|
34
|
+
if (await (0, fs_1.fileExists)(manifestPath)) {
|
|
35
|
+
try {
|
|
36
|
+
const parsed = await (0, fs_1.readJson)(manifestPath);
|
|
37
|
+
if ((0, json_1.isObject)(parsed)) {
|
|
38
|
+
manifest = parsed;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
warnings.push(`Manifest is not an object: ${manifestPath}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
46
|
+
warnings.push(message);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
warnings.push(`Manifest file missing: ${manifestPath}`);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
name: packageJson.name ?? packageName,
|
|
54
|
+
packageRoot,
|
|
55
|
+
packageJsonPath,
|
|
56
|
+
aps,
|
|
57
|
+
configSource: configResolution.source,
|
|
58
|
+
manifestPath,
|
|
59
|
+
manifest,
|
|
60
|
+
resourceCounts: manifest ? (0, resource_summary_1.extractResourceCounts)(manifest) : [],
|
|
61
|
+
warnings
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=manifest-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-loader.js","sourceRoot":"","sources":["../../../src/implementation/configuration/manifest-loader.ts"],"names":[],"mappings":";;;;;AA4BA,0CA0DC;AAtFD,0DAA6B;AAC7B,6CAA4C;AAC5C,iCAAgD;AAChD,qCAAsC;AACtC,gEAAkE;AAClE,qDAAkF;AAElF,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAqBlD,KAAK,UAAU,eAAe,CACnC,WAAmB,EACnB,aAAqB;IAErB,MAAM,cAAc,GAAG,IAAA,2BAAa,EAAC,mBAAI,CAAC,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC;IAE/E,IAAI,eAAuB,CAAC;IAE5B,IAAI,CAAC;QACH,eAAe,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,WAAW,eAAe,CAAC,CAAC;IAC1E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,WAAW,GAAG,mBAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAClD,MAAM,WAAW,GAAG,MAAM,IAAA,aAAQ,EAAc,eAAe,CAAC,CAAC;IAEjE,MAAM,gBAAgB,GAAG,IAAA,wCAAuB,EAAC,WAAW,CAAC,CAAC;IAE9D,IAAI,CAAC,gBAAgB,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,GAAG,GAAG,gBAAgB,CAAC,MAAM,CAAC;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,EAAE;QAC/D,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ApsPackageConfig = {
|
|
2
|
+
version?: number;
|
|
3
|
+
manifest?: string;
|
|
4
|
+
adapters?: unknown;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
export type ApsPackageConfigResolution = {
|
|
8
|
+
config: ApsPackageConfig | null;
|
|
9
|
+
source: "aps" | "ai" | null;
|
|
10
|
+
warnings: string[];
|
|
11
|
+
};
|
|
12
|
+
export declare function resolveApsPackageConfig(packageJson: Record<string, unknown>): ApsPackageConfigResolution;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveApsPackageConfig = resolveApsPackageConfig;
|
|
4
|
+
const json_1 = require("../io/json");
|
|
5
|
+
function resolveApsPackageConfig(packageJson) {
|
|
6
|
+
const hasAps = (0, json_1.isObject)(packageJson.aps);
|
|
7
|
+
const hasAi = (0, json_1.isObject)(packageJson.ai);
|
|
8
|
+
const warnings = [];
|
|
9
|
+
if (hasAps && hasAi) {
|
|
10
|
+
warnings.push("Both 'aps' and legacy 'ai' configurations are present. Using 'aps'.");
|
|
11
|
+
}
|
|
12
|
+
if (hasAps) {
|
|
13
|
+
return {
|
|
14
|
+
config: packageJson.aps,
|
|
15
|
+
source: "aps",
|
|
16
|
+
warnings
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
if (hasAi) {
|
|
20
|
+
warnings.push("Legacy 'ai' configuration detected. Please migrate to 'aps'.");
|
|
21
|
+
return {
|
|
22
|
+
config: packageJson.ai,
|
|
23
|
+
source: "ai",
|
|
24
|
+
warnings
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
config: null,
|
|
29
|
+
source: null,
|
|
30
|
+
warnings
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=package-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-config.js","sourceRoot":"","sources":["../../../src/implementation/configuration/package-config.ts"],"names":[],"mappings":";;AAeA,0DA+BC;AA9CD,qCAAsC;AAetC,SAAgB,uBAAuB,CAAC,WAAoC;IAC1E,MAAM,MAAM,GAAG,IAAA,eAAQ,EAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,IAAA,eAAQ,EAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACvC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,IAAI,MAAM,IAAI,KAAK,EAAE,CAAC;QACpB,QAAQ,CAAC,IAAI,CAAC,qEAAqE,CAAC,CAAC;IACvF,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACX,OAAO;YACL,MAAM,EAAE,WAAW,CAAC,GAAuB;YAC3C,MAAM,EAAE,KAAK;YACb,QAAQ;SACT,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,EAAE,CAAC;QACV,QAAQ,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;QAC9E,OAAO;YACL,MAAM,EAAE,WAAW,CAAC,EAAsB;YAC1C,MAAM,EAAE,IAAI;YACZ,QAAQ;SACT,CAAC;IACJ,CAAC;IAED,OAAO;QACL,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.discoverProviders = discoverProviders;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const fs_1 = require("../io/fs");
|
|
9
|
+
const json_1 = require("../io/json");
|
|
10
|
+
const manifest_loader_1 = require("../configuration/manifest-loader");
|
|
11
|
+
function readDependencyNames(value) {
|
|
12
|
+
if (!(0, json_1.isObject)(value)) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
return Object.keys(value);
|
|
16
|
+
}
|
|
17
|
+
async function discoverProviders(cwd) {
|
|
18
|
+
const packageJsonPath = node_path_1.default.join(cwd, "package.json");
|
|
19
|
+
const packageJson = await (0, fs_1.readJson)(packageJsonPath);
|
|
20
|
+
const dependencies = readDependencyNames(packageJson.dependencies);
|
|
21
|
+
const devDependencies = readDependencyNames(packageJson.devDependencies);
|
|
22
|
+
const uniqueDependencies = [...new Set([...dependencies, ...devDependencies])].sort((a, b) => a.localeCompare(b));
|
|
23
|
+
const providers = [];
|
|
24
|
+
const unresolvedDependencies = [];
|
|
25
|
+
for (const dependency of uniqueDependencies) {
|
|
26
|
+
const provider = await (0, manifest_loader_1.loadApsProvider)(dependency, cwd);
|
|
27
|
+
if (!provider) {
|
|
28
|
+
unresolvedDependencies.push(dependency);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
providers.push(provider);
|
|
32
|
+
}
|
|
33
|
+
providers.sort((a, b) => a.name.localeCompare(b.name));
|
|
34
|
+
return {
|
|
35
|
+
providers,
|
|
36
|
+
unresolvedDependencies
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=discover-providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover-providers.js","sourceRoot":"","sources":["../../../src/implementation/dependency-discovery/discover-providers.ts"],"names":[],"mappings":";;;;;AAuBA,8CA+BC;AAtDD,0DAA6B;AAC7B,iCAAoC;AACpC,qCAAsC;AACtC,sEAA4F;AAY5F,SAAS,mBAAmB,CAAC,KAAc;IACzC,IAAI,CAAC,IAAA,eAAQ,EAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,M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orCheck = {
|
|
2
|
+
name: string;
|
|
3
|
+
status: "pass" | "fail";
|
|
4
|
+
details: string;
|
|
5
|
+
};
|
|
6
|
+
export type DoctorProviderReport = {
|
|
7
|
+
provider: string;
|
|
8
|
+
level: number;
|
|
9
|
+
maxLevel: number;
|
|
10
|
+
checks: DoctorCheck[];
|
|
11
|
+
recommendations: string[];
|
|
12
|
+
};
|
|
13
|
+
export type DoctorReport = {
|
|
14
|
+
providers: DoctorProviderReport[];
|
|
15
|
+
};
|
|
16
|
+
export declare function runDoctor(cwd: string): Promise<DoctorReport>;
|