@nexo-alpha/tools 0.1.0 → 0.2.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/README.md +45 -4
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/metrics-interface.d.ts +22 -0
- package/dist/metrics-interface.d.ts.map +1 -0
- package/dist/metrics-interface.js +73 -0
- package/dist/metrics-interface.js.map +1 -0
- package/dist/read-interface.d.ts +4 -3
- package/dist/read-interface.d.ts.map +1 -1
- package/dist/read-interface.js +18 -9
- package/dist/read-interface.js.map +1 -1
- package/dist/run-interface.d.ts +34 -0
- package/dist/run-interface.d.ts.map +1 -0
- package/dist/run-interface.js +121 -0
- package/dist/run-interface.js.map +1 -0
- package/dist/verification-interface.d.ts +31 -0
- package/dist/verification-interface.d.ts.map +1 -0
- package/dist/verification-interface.js +125 -0
- package/dist/verification-interface.js.map +1 -0
- package/dist/write-interface.d.ts +32 -0
- package/dist/write-interface.d.ts.map +1 -0
- package/dist/write-interface.js +218 -0
- package/dist/write-interface.js.map +1 -0
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @nexo-alpha/tools
|
|
2
2
|
|
|
3
|
-
A structured, provider-neutral **read interface** an AI development tool (or a CLI, or a script) can call to understand a [`@nexo-alpha/core`](https://www.npmjs.com/package/@nexo-alpha/core) application
|
|
3
|
+
A structured, provider-neutral **read and write interface** an AI development tool (or a CLI, or a script) can call to understand — and safely change — a [`@nexo-alpha/core`](https://www.npmjs.com/package/@nexo-alpha/core) application, instead of grepping source code or hand-walking the application object.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -34,19 +34,60 @@ tools.getApplication(); // { name, version, description, state }
|
|
|
34
34
|
tools.getModule("payments"); // full module metadata, or undefined
|
|
35
35
|
tools.getDependents("orders"); // -> ["payments"]
|
|
36
36
|
tools.getStatus(); // { state, developmentState }
|
|
37
|
+
tools.getHistory(); // audit trail of write operations
|
|
38
|
+
|
|
39
|
+
import { createWriteInterface } from "@nexo-alpha/tools";
|
|
40
|
+
|
|
41
|
+
const writes = createWriteInterface(app, {
|
|
42
|
+
scopes: new Set(["modify-source"])
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
writes.createApi("payments", { name: "refundPayment", method: "POST", path: "/payments/:id/refund" });
|
|
46
|
+
// -> { success: true, data: { name: "refundPayment", ... } }
|
|
47
|
+
|
|
48
|
+
writes.updateConfiguration({ debug: true });
|
|
49
|
+
// -> { success: false, error: 'Permission required: "modify-configuration" is not granted...' }
|
|
50
|
+
|
|
51
|
+
import { createVerificationInterface } from "@nexo-alpha/tools";
|
|
52
|
+
|
|
53
|
+
const verify = createVerificationInterface(app);
|
|
54
|
+
|
|
55
|
+
verify.validateArchitecture();
|
|
56
|
+
// -> { valid: true, issues: [] } (or issues for cycles / self-deps / unresolved dependency names)
|
|
57
|
+
verify.checkApplicationHealth();
|
|
58
|
+
// -> { state, moduleCount, apiCount, serviceCount, architecture }
|
|
59
|
+
|
|
60
|
+
import { createMetricsCollector } from "@nexo-alpha/tools";
|
|
61
|
+
|
|
62
|
+
const metrics = createMetricsCollector(app);
|
|
63
|
+
// ... traffic happens via @nexo-alpha/hapi / jobs run via @nexo-alpha/scheduler ...
|
|
64
|
+
metrics.getMetrics();
|
|
65
|
+
// -> { apis: { refundPayment: { calls, errors, averageDurationMs } }, jobs: {...} }
|
|
37
66
|
```
|
|
38
67
|
|
|
39
68
|
## What's here
|
|
40
69
|
|
|
41
70
|
`createReadInterface(app)` returns a `NexoReadInterface` with:
|
|
42
71
|
|
|
43
|
-
`getApplication`, `getModules`, `getModule`, `getApi`, `getService`, `getDependencies`, `getDependents`, `getConfiguration`, `getArchitecture`, `getDecisions`, `getConstraints`, `getCurrentWork`, `getStatus`.
|
|
72
|
+
`getApplication`, `getModules`, `getModule`, `getApi`, `getService`, `getDependencies`, `getDependents`, `getConfiguration`, `getArchitecture`, `getDecisions`, `getConstraints`, `getCurrentWork`, `getStatus`, `getHistory`.
|
|
44
73
|
|
|
45
74
|
Name lookups (`getModule`, `getApi`, `getService`) return `undefined` when nothing matches rather than throwing — a tool probing an unfamiliar application should degrade gracefully, not crash.
|
|
46
75
|
|
|
76
|
+
`createWriteInterface(app, grants)` returns a `NexoWriteInterface` with:
|
|
77
|
+
|
|
78
|
+
`createModule`, `createApi`, `modifyApi`, `createService`, `modifyService`, `createJob`, `modifyJob`, `updateConfiguration`, `addDependency`.
|
|
79
|
+
|
|
80
|
+
Each call is a `{ success, data?, error? }` result — never a throw — and runs through **Permission Check → Validation → Operation → Audit** (PRD section 18/20). `grants` is a `PermissionGrants` (`{ scopes: Set<"modify-source" | "modify-configuration"> }`) the caller constructs explicitly; there is no ambient or default-allow permission. Every call, whether denied, failed validation, or successful, is recorded via `app.addHistoryEntry()` and readable back through `getHistory()`.
|
|
81
|
+
|
|
82
|
+
`createVerificationInterface(app)` returns a `NexoVerificationInterface` with:
|
|
83
|
+
|
|
84
|
+
`validateConfiguration`, `validateArchitecture`, `inspectDependencies`, `checkApplicationHealth` — the in-memory subset of PRD section 19's "Verification Capabilities." `validateArchitecture` detects dependency cycles and self-dependencies (errors) and dependency names that don't resolve to a registered module (a warning, not an error — it may be an external system like `"stripe"`). `validateConfiguration` flags config values that won't survive `JSON.stringify` cleanly (functions, circular references). These are read-only diagnostics and are not audited to history, unlike the write interface. `run_tests`/`run_typecheck`/`run_lint`/`run_build` from PRD section 19 are **not implemented** — they'd need to shell out to an external target application's own toolchain via an explicit project-root argument, and this repo has no lint tooling configured to call yet; left for a future pass once that's needed.
|
|
85
|
+
|
|
86
|
+
`createMetricsCollector(app)` returns a `NexoMetricsCollector` with `getMetrics()`, `reset()`, and `stop()`. Unlike the other three interfaces (stateless — computed fresh from `app` on every call), this one is **stateful**: it subscribes to `app.events` at creation time and accumulates call/run counts, error/failure counts, and average durations per API/job as `@nexo-alpha/hapi` and `@nexo-alpha/scheduler` emit `api.called`/`api.error`/`job.ran`/`job.failed`. `checkApplicationHealth()` stays a separate, static-structure concern — this is the live-runtime counterpart, not a replacement for it. Call `stop()` when you're done with a collector (e.g. between tests) so it unsubscribes rather than leaking listeners on `app.events`.
|
|
87
|
+
|
|
47
88
|
## Design notes
|
|
48
89
|
|
|
49
|
-
- **
|
|
90
|
+
- **Explicit, bounded, auditable.** Per PRD section 20, write operations never bypass a permission check, and every attempt — granted or not — is audited. Actually running tests/lint/build (PRD section 19, "Verification Capabilities") is out of scope here; it's a separate tooling concern layered on top of a successful write.
|
|
50
91
|
- **camelCase**, consistent with the rest of Nexo's API, even though early product docs sketched these as snake_case (`get_application()`) — that was pseudocode-level, not a literal contract.
|
|
51
92
|
|
|
52
93
|
## Related packages
|
|
@@ -56,7 +97,7 @@ Name lookups (`getModule`, `getApi`, `getService`) return `undefined` when nothi
|
|
|
56
97
|
|
|
57
98
|
## Status
|
|
58
99
|
|
|
59
|
-
**v0.1-alpha.** No MCP server or CLI wiring yet — this is the interface those will eventually sit on top of.
|
|
100
|
+
**v0.1-alpha.** No MCP server or CLI wiring yet — this is the interface those will eventually sit on top of. `create_test()` and the verification ops (`run_tests`, `run_lint`, etc.) from the PRD are not implemented yet. No tracing/spans — `createMetricsCollector` is counts and durations only.
|
|
60
101
|
|
|
61
102
|
## License
|
|
62
103
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
export { createReadInterface } from "./read-interface.js";
|
|
2
2
|
export type { NexoReadInterface, ApplicationArchitecture, ApplicationStatus } from "./read-interface.js";
|
|
3
|
+
export { createWriteInterface } from "./write-interface.js";
|
|
4
|
+
export type { NexoWriteInterface, PermissionScope, PermissionGrants, WriteOperationResult } from "./write-interface.js";
|
|
5
|
+
export { createVerificationInterface } from "./verification-interface.js";
|
|
6
|
+
export type { NexoVerificationInterface, ValidationSeverity, ValidationIssue, ValidationResult, DependencyGraphEntry, ApplicationHealth } from "./verification-interface.js";
|
|
7
|
+
export { createMetricsCollector } from "./metrics-interface.js";
|
|
8
|
+
export type { NexoMetricsCollector, NexoMetricsSnapshot, ApiMetrics, JobMetrics } from "./metrics-interface.js";
|
|
9
|
+
export { createRunInterface } from "./run-interface.js";
|
|
10
|
+
export type { NexoRunInterface, RunResult } from "./run-interface.js";
|
|
3
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACV,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,2BAA2B,EAC5B,MAAM,6BAA6B,CAAC;AAErC,YAAY,EACV,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,UAAU,EACV,UAAU,EACX,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,gBAAgB,EAChB,SAAS,EACV,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export { createReadInterface } from "./read-interface.js";
|
|
2
|
+
export { createWriteInterface } from "./write-interface.js";
|
|
3
|
+
export { createVerificationInterface } from "./verification-interface.js";
|
|
4
|
+
export { createMetricsCollector } from "./metrics-interface.js";
|
|
5
|
+
export { createRunInterface } from "./run-interface.js";
|
|
2
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACpB,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,EACL,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAS9B,OAAO,EACL,2BAA2B,EAC5B,MAAM,6BAA6B,CAAC;AAWrC,OAAO,EACL,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAShC,OAAO,EACL,kBAAkB,EACnB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type NexoApplication } from "@nexo-alpha/core";
|
|
2
|
+
export interface ApiMetrics {
|
|
3
|
+
readonly calls: number;
|
|
4
|
+
readonly errors: number;
|
|
5
|
+
readonly averageDurationMs: number;
|
|
6
|
+
}
|
|
7
|
+
export interface JobMetrics {
|
|
8
|
+
readonly runs: number;
|
|
9
|
+
readonly failures: number;
|
|
10
|
+
readonly averageDurationMs: number;
|
|
11
|
+
}
|
|
12
|
+
export interface NexoMetricsSnapshot {
|
|
13
|
+
readonly apis: Readonly<Record<string, ApiMetrics>>;
|
|
14
|
+
readonly jobs: Readonly<Record<string, JobMetrics>>;
|
|
15
|
+
}
|
|
16
|
+
export interface NexoMetricsCollector {
|
|
17
|
+
getMetrics(): NexoMetricsSnapshot;
|
|
18
|
+
reset(): void;
|
|
19
|
+
stop(): void;
|
|
20
|
+
}
|
|
21
|
+
export declare function createMetricsCollector(app: NexoApplication): NexoMetricsCollector;
|
|
22
|
+
//# sourceMappingURL=metrics-interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics-interface.d.ts","sourceRoot":"","sources":["../src/metrics-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,eAAe,EACrB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACpD,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,IAAI,mBAAmB,CAAC;IAClC,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,IAAI,CAAC;CACd;AAsBD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,eAAe,GAAG,oBAAoB,CA0EjF"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { NexoEvent } from "@nexo-alpha/core";
|
|
2
|
+
function toRate(counters) {
|
|
3
|
+
return {
|
|
4
|
+
calls: counters.calls,
|
|
5
|
+
errors: counters.errors,
|
|
6
|
+
averageDurationMs: counters.calls === 0 ? 0 : counters.totalDurationMs / counters.calls
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function createMetricsCollector(app) {
|
|
10
|
+
let apis = new Map();
|
|
11
|
+
let jobs = new Map();
|
|
12
|
+
function bucket(map, key) {
|
|
13
|
+
let counters = map.get(key);
|
|
14
|
+
if (!counters) {
|
|
15
|
+
counters = { calls: 0, errors: 0, totalDurationMs: 0 };
|
|
16
|
+
map.set(key, counters);
|
|
17
|
+
}
|
|
18
|
+
return counters;
|
|
19
|
+
}
|
|
20
|
+
const onApiCalled = (event) => {
|
|
21
|
+
const counters = bucket(apis, event.api);
|
|
22
|
+
counters.calls += 1;
|
|
23
|
+
counters.totalDurationMs += event.durationMs;
|
|
24
|
+
if (event.statusCode >= 400) {
|
|
25
|
+
counters.errors += 1;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const onApiError = (event) => {
|
|
29
|
+
bucket(apis, event.api).errors += 1;
|
|
30
|
+
};
|
|
31
|
+
const onJobRan = (event) => {
|
|
32
|
+
const counters = bucket(jobs, event.job);
|
|
33
|
+
counters.calls += 1;
|
|
34
|
+
counters.totalDurationMs += event.durationMs;
|
|
35
|
+
};
|
|
36
|
+
const onJobFailed = (event) => {
|
|
37
|
+
const counters = bucket(jobs, event.job);
|
|
38
|
+
counters.errors += 1;
|
|
39
|
+
};
|
|
40
|
+
app.events.on(NexoEvent.API_CALLED, onApiCalled);
|
|
41
|
+
app.events.on(NexoEvent.API_ERROR, onApiError);
|
|
42
|
+
app.events.on(NexoEvent.JOB_RAN, onJobRan);
|
|
43
|
+
app.events.on(NexoEvent.JOB_FAILED, onJobFailed);
|
|
44
|
+
return {
|
|
45
|
+
getMetrics() {
|
|
46
|
+
const apiEntries = {};
|
|
47
|
+
for (const [name, counters] of apis) {
|
|
48
|
+
apiEntries[name] = toRate(counters);
|
|
49
|
+
}
|
|
50
|
+
const jobEntries = {};
|
|
51
|
+
for (const [name, counters] of jobs) {
|
|
52
|
+
const rate = toRate(counters);
|
|
53
|
+
jobEntries[name] = {
|
|
54
|
+
runs: rate.calls,
|
|
55
|
+
failures: rate.errors,
|
|
56
|
+
averageDurationMs: rate.averageDurationMs
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return { apis: apiEntries, jobs: jobEntries };
|
|
60
|
+
},
|
|
61
|
+
reset() {
|
|
62
|
+
apis = new Map();
|
|
63
|
+
jobs = new Map();
|
|
64
|
+
},
|
|
65
|
+
stop() {
|
|
66
|
+
app.events.off(NexoEvent.API_CALLED, onApiCalled);
|
|
67
|
+
app.events.off(NexoEvent.API_ERROR, onApiError);
|
|
68
|
+
app.events.off(NexoEvent.JOB_RAN, onJobRan);
|
|
69
|
+
app.events.off(NexoEvent.JOB_FAILED, onJobFailed);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=metrics-interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics-interface.js","sourceRoot":"","sources":["../src/metrics-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAMV,MAAM,kBAAkB,CAAC;AAqC1B,SAAS,MAAM,CAAC,QAAyB;IACvC,OAAO;QACL,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,iBAAiB,EAAE,QAAQ,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,KAAK;KACxF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,GAAoB;IACzD,IAAI,IAAI,GAAG,IAAI,GAAG,EAA2B,CAAC;IAC9C,IAAI,IAAI,GAAG,IAAI,GAAG,EAA2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CAAC,SAAS,CAAC,UAAU,EAAE,WAA2C,CAAC,CAAC;YAClF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,EAAE,UAA0C,CAAC,CAAC;YAChF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,QAAwC,CAAC,CAAC;YAC5E,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,UAAU,EAAE,WAA2C,CAAC,CAAC;QACpF,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/read-interface.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ApplicationState,
|
|
2
|
-
import { type ApplicationContext, type ModuleContext } from "@nexo-alpha/context";
|
|
1
|
+
import type { ApplicationState, NexoApi, NexoApplication, NexoService } from "@nexo-alpha/core";
|
|
2
|
+
import { type ApplicationContext, type ApplicationKnowledge, type DevelopmentState, type ModuleContext, type NexoConstraint, type NexoDecision, type NexoHistoryEntry } from "@nexo-alpha/context";
|
|
3
3
|
export interface ApplicationArchitecture {
|
|
4
4
|
readonly modules: readonly ModuleContext[];
|
|
5
5
|
readonly apis: readonly NexoApi[];
|
|
@@ -23,6 +23,7 @@ export interface NexoReadInterface {
|
|
|
23
23
|
getConstraints(): readonly NexoConstraint[];
|
|
24
24
|
getCurrentWork(): DevelopmentState;
|
|
25
25
|
getStatus(): ApplicationStatus;
|
|
26
|
+
getHistory(): readonly NexoHistoryEntry[];
|
|
26
27
|
}
|
|
27
|
-
export declare function createReadInterface(app: NexoApplication): NexoReadInterface;
|
|
28
|
+
export declare function createReadInterface(app: NexoApplication, knowledge?: ApplicationKnowledge): NexoReadInterface;
|
|
28
29
|
//# sourceMappingURL=read-interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-interface.d.ts","sourceRoot":"","sources":["../src/read-interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EACh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AAuB,CAAC;IAC3C,YAAY,IAAI,SAAS,YAAY,EAAE,CAAC;IACxC,cAAc,IAAI,SAAS,cAAc,EAAE,CAAC;IAC5C,cAAc,IAAI,gBAAgB,CAAC;IACnC,SAAS,IAAI,iBAAiB,CAAC;IAC/B,UAAU,IAAI,SAAS,gBAAgB,EAAE,CAAC;CAC3C;AAED,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,eAAe,EACpB,SAAS,CAAC,EAAE,oBAAoB,GAC/B,iBAAiB,CAiEnB"}
|
package/dist/read-interface.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { buildContext } from "@nexo-alpha/context";
|
|
2
|
-
|
|
2
|
+
const EMPTY_DEVELOPMENT_STATE = {
|
|
3
|
+
completed: [],
|
|
4
|
+
inProgress: [],
|
|
5
|
+
blocked: [],
|
|
6
|
+
knownIssues: []
|
|
7
|
+
};
|
|
8
|
+
export function createReadInterface(app, knowledge) {
|
|
3
9
|
return {
|
|
4
10
|
getApplication() {
|
|
5
|
-
return buildContext(app).application;
|
|
11
|
+
return buildContext(app, knowledge).application;
|
|
6
12
|
},
|
|
7
13
|
getModules() {
|
|
8
|
-
return buildContext(app).modules;
|
|
14
|
+
return buildContext(app, knowledge).modules;
|
|
9
15
|
},
|
|
10
16
|
getModule(name) {
|
|
11
|
-
return buildContext(app).modules.find((module) => module.name === name);
|
|
17
|
+
return buildContext(app, knowledge).modules.find((module) => module.name === name);
|
|
12
18
|
},
|
|
13
19
|
getApi(name) {
|
|
14
20
|
return app.getApis().find((api) => api.name === name);
|
|
@@ -27,25 +33,28 @@ export function createReadInterface(app) {
|
|
|
27
33
|
},
|
|
28
34
|
getArchitecture() {
|
|
29
35
|
return {
|
|
30
|
-
modules: buildContext(app).modules,
|
|
36
|
+
modules: buildContext(app, knowledge).modules,
|
|
31
37
|
apis: app.getApis(),
|
|
32
38
|
services: app.getServices()
|
|
33
39
|
};
|
|
34
40
|
},
|
|
35
41
|
getDecisions() {
|
|
36
|
-
return
|
|
42
|
+
return knowledge?.getDecisions() ?? [];
|
|
37
43
|
},
|
|
38
44
|
getConstraints() {
|
|
39
|
-
return
|
|
45
|
+
return knowledge?.getConstraints() ?? [];
|
|
40
46
|
},
|
|
41
47
|
getCurrentWork() {
|
|
42
|
-
return
|
|
48
|
+
return knowledge?.getDevelopmentState() ?? EMPTY_DEVELOPMENT_STATE;
|
|
43
49
|
},
|
|
44
50
|
getStatus() {
|
|
45
51
|
return {
|
|
46
52
|
state: app.state,
|
|
47
|
-
developmentState:
|
|
53
|
+
developmentState: knowledge?.getDevelopmentState() ?? EMPTY_DEVELOPMENT_STATE
|
|
48
54
|
};
|
|
55
|
+
},
|
|
56
|
+
getHistory() {
|
|
57
|
+
return knowledge?.getHistory() ?? [];
|
|
49
58
|
}
|
|
50
59
|
};
|
|
51
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-interface.js","sourceRoot":"","sources":["../src/read-interface.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"read-interface.js","sourceRoot":"","sources":["../src/read-interface.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,YAAY,EAQb,MAAM,qBAAqB,CAAC;AAa7B,MAAM,uBAAuB,GAAqB;IAChD,SAAS,EAAE,EAAE;IACb,UAAU,EAAE,EAAE;IACd,OAAO,EAAE,EAAE;IACX,WAAW,EAAE,EAAE;CAChB,CAAC;AAmBF,MAAM,UAAU,mBAAmB,CACjC,GAAoB,EACpB,SAAgC;IAEhC,OAAO;QACL,cAAc;YACZ,OAAO,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,WAAW,CAAC;QAClD,CAAC;QAED,UAAU;YACR,OAAO,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC;QAC9C,CAAC;QAED,SAAS,CAAC,IAAI;YACZ,OAAO,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,M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AAU;YACR,OAAO,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;QACvC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface RunResult {
|
|
2
|
+
readonly success: boolean;
|
|
3
|
+
readonly command: string;
|
|
4
|
+
readonly exitCode: number | null;
|
|
5
|
+
readonly stdout: string;
|
|
6
|
+
readonly stderr: string;
|
|
7
|
+
readonly durationMs: number;
|
|
8
|
+
}
|
|
9
|
+
export interface NexoRunInterface {
|
|
10
|
+
runTests(): Promise<RunResult>;
|
|
11
|
+
runTypecheck(): Promise<RunResult>;
|
|
12
|
+
runBuild(): Promise<RunResult>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Shells out to the target application's own toolchain to run its
|
|
16
|
+
* "test"/"typecheck"/"build" npm scripts, closing the process-shelling
|
|
17
|
+
* half of PRD section 19's verification ops (the other half —
|
|
18
|
+
* validateConfiguration/validateArchitecture/inspectDependencies/
|
|
19
|
+
* checkApplicationHealth — are pure in-memory checks in
|
|
20
|
+
* verification-interface.ts and don't need this).
|
|
21
|
+
*
|
|
22
|
+
* `run_lint()` is deliberately not implemented: there is no lint
|
|
23
|
+
* tooling convention to detect against (this repo itself has none
|
|
24
|
+
* configured), so building it now would mean guessing at a convention
|
|
25
|
+
* rather than following an established one.
|
|
26
|
+
*
|
|
27
|
+
* `projectRoot` is supplied by the caller rather than discovered here
|
|
28
|
+
* — @nexo-alpha/tools stays decoupled from the CLI's `nexo.config.json`
|
|
29
|
+
* convention (`packages/cli/src/config.ts`); a caller that already knows
|
|
30
|
+
* the project root (the CLI, or an AI tool given an explicit path) can
|
|
31
|
+
* pass it directly.
|
|
32
|
+
*/
|
|
33
|
+
export declare function createRunInterface(projectRoot: string): NexoRunInterface;
|
|
34
|
+
//# sourceMappingURL=run-interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-interface.d.ts","sourceRoot":"","sources":["../src/run-interface.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/B,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IACnC,QAAQ,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;CAChC;AA4HD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,gBAAgB,CAcxE"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
function detectPackageManager(projectRoot) {
|
|
6
|
+
if (existsSync(join(projectRoot, "pnpm-lock.yaml"))) {
|
|
7
|
+
return "pnpm";
|
|
8
|
+
}
|
|
9
|
+
if (existsSync(join(projectRoot, "yarn.lock"))) {
|
|
10
|
+
return "yarn";
|
|
11
|
+
}
|
|
12
|
+
return "npm";
|
|
13
|
+
}
|
|
14
|
+
async function readScripts(projectRoot) {
|
|
15
|
+
const packageJsonPath = join(projectRoot, "package.json");
|
|
16
|
+
if (!existsSync(packageJsonPath)) {
|
|
17
|
+
throw new Error(`No "package.json" found in project root "${projectRoot}".`);
|
|
18
|
+
}
|
|
19
|
+
const raw = await readFile(packageJsonPath, "utf8");
|
|
20
|
+
const parsed = JSON.parse(raw);
|
|
21
|
+
const scripts = typeof parsed === "object" && parsed !== null
|
|
22
|
+
? parsed.scripts
|
|
23
|
+
: undefined;
|
|
24
|
+
return typeof scripts === "object" && scripts !== null
|
|
25
|
+
? scripts
|
|
26
|
+
: {};
|
|
27
|
+
}
|
|
28
|
+
function runCommand(projectRoot, command, args) {
|
|
29
|
+
const startedAt = Date.now();
|
|
30
|
+
const commandLabel = [command, ...args].join(" ");
|
|
31
|
+
return new Promise((resolvePromise) => {
|
|
32
|
+
const child = spawn(command, args, {
|
|
33
|
+
cwd: projectRoot,
|
|
34
|
+
shell: true
|
|
35
|
+
});
|
|
36
|
+
let stdout = "";
|
|
37
|
+
let stderr = "";
|
|
38
|
+
child.stdout?.on("data", (chunk) => {
|
|
39
|
+
stdout += chunk.toString();
|
|
40
|
+
});
|
|
41
|
+
child.stderr?.on("data", (chunk) => {
|
|
42
|
+
stderr += chunk.toString();
|
|
43
|
+
});
|
|
44
|
+
child.on("error", (error) => {
|
|
45
|
+
resolvePromise({
|
|
46
|
+
success: false,
|
|
47
|
+
command: commandLabel,
|
|
48
|
+
exitCode: null,
|
|
49
|
+
stdout,
|
|
50
|
+
stderr: stderr + (stderr ? "\n" : "") + error.message,
|
|
51
|
+
durationMs: Date.now() - startedAt
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
child.on("close", (exitCode) => {
|
|
55
|
+
resolvePromise({
|
|
56
|
+
success: exitCode === 0,
|
|
57
|
+
command: commandLabel,
|
|
58
|
+
exitCode,
|
|
59
|
+
stdout,
|
|
60
|
+
stderr,
|
|
61
|
+
durationMs: Date.now() - startedAt
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function missingScriptResult(scriptName, projectRoot) {
|
|
67
|
+
return {
|
|
68
|
+
success: false,
|
|
69
|
+
command: `(no "${scriptName}" script)`,
|
|
70
|
+
exitCode: null,
|
|
71
|
+
stdout: "",
|
|
72
|
+
stderr: `"${projectRoot}"'s package.json has no "${scriptName}" script.`,
|
|
73
|
+
durationMs: 0
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
async function runScript(projectRoot, scriptName) {
|
|
77
|
+
const scripts = await readScripts(projectRoot);
|
|
78
|
+
if (typeof scripts[scriptName] !== "string") {
|
|
79
|
+
return missingScriptResult(scriptName, projectRoot);
|
|
80
|
+
}
|
|
81
|
+
const packageManager = detectPackageManager(projectRoot);
|
|
82
|
+
const args = packageManager === "npm"
|
|
83
|
+
? ["run", scriptName]
|
|
84
|
+
: packageManager === "yarn"
|
|
85
|
+
? [scriptName]
|
|
86
|
+
: ["run", scriptName];
|
|
87
|
+
return runCommand(projectRoot, packageManager, args);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Shells out to the target application's own toolchain to run its
|
|
91
|
+
* "test"/"typecheck"/"build" npm scripts, closing the process-shelling
|
|
92
|
+
* half of PRD section 19's verification ops (the other half —
|
|
93
|
+
* validateConfiguration/validateArchitecture/inspectDependencies/
|
|
94
|
+
* checkApplicationHealth — are pure in-memory checks in
|
|
95
|
+
* verification-interface.ts and don't need this).
|
|
96
|
+
*
|
|
97
|
+
* `run_lint()` is deliberately not implemented: there is no lint
|
|
98
|
+
* tooling convention to detect against (this repo itself has none
|
|
99
|
+
* configured), so building it now would mean guessing at a convention
|
|
100
|
+
* rather than following an established one.
|
|
101
|
+
*
|
|
102
|
+
* `projectRoot` is supplied by the caller rather than discovered here
|
|
103
|
+
* — @nexo-alpha/tools stays decoupled from the CLI's `nexo.config.json`
|
|
104
|
+
* convention (`packages/cli/src/config.ts`); a caller that already knows
|
|
105
|
+
* the project root (the CLI, or an AI tool given an explicit path) can
|
|
106
|
+
* pass it directly.
|
|
107
|
+
*/
|
|
108
|
+
export function createRunInterface(projectRoot) {
|
|
109
|
+
return {
|
|
110
|
+
runTests() {
|
|
111
|
+
return runScript(projectRoot, "test");
|
|
112
|
+
},
|
|
113
|
+
runTypecheck() {
|
|
114
|
+
return runScript(projectRoot, "typecheck");
|
|
115
|
+
},
|
|
116
|
+
runBuild() {
|
|
117
|
+
return runScript(projectRoot, "build");
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=run-interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-interface.js","sourceRoot":"","sources":["../src/run-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAmBjC,SAAS,oBAAoB,CAAC,WAAmB;IAC/C,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC;QACpD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC;QAC/C,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,KAAK,UAAU,WAAW,CACxB,WAAmB;IAEnB,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IAE1D,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CACb,4CAA4C,WAAW,IAAI,CAC5D,CAAC;IACJ,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IACpD,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAExC,MAAM,OAAO,GACX,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;QAC3C,CAAC,CAAE,MAAg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cAAc,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAmB;IACpD,OAAO;QACL,QAAQ;YACN,OAAO,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QACxC,CAAC;QAED,YAAY;YACV,OAAO,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QAC7C,CAAC;QAED,QAAQ;YACN,OAAO,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACzC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ApplicationState, NexoApplication } from "@nexo-alpha/core";
|
|
2
|
+
export type ValidationSeverity = "error" | "warning";
|
|
3
|
+
export interface ValidationIssue {
|
|
4
|
+
readonly severity: ValidationSeverity;
|
|
5
|
+
readonly message: string;
|
|
6
|
+
readonly target?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ValidationResult {
|
|
9
|
+
readonly valid: boolean;
|
|
10
|
+
readonly issues: readonly ValidationIssue[];
|
|
11
|
+
}
|
|
12
|
+
export interface DependencyGraphEntry {
|
|
13
|
+
readonly module: string;
|
|
14
|
+
readonly dependencies: readonly string[];
|
|
15
|
+
readonly dependents: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
export interface ApplicationHealth {
|
|
18
|
+
readonly state: ApplicationState;
|
|
19
|
+
readonly moduleCount: number;
|
|
20
|
+
readonly apiCount: number;
|
|
21
|
+
readonly serviceCount: number;
|
|
22
|
+
readonly architecture: ValidationResult;
|
|
23
|
+
}
|
|
24
|
+
export interface NexoVerificationInterface {
|
|
25
|
+
validateConfiguration(): ValidationResult;
|
|
26
|
+
validateArchitecture(): ValidationResult;
|
|
27
|
+
inspectDependencies(): readonly DependencyGraphEntry[];
|
|
28
|
+
checkApplicationHealth(): ApplicationHealth;
|
|
29
|
+
}
|
|
30
|
+
export declare function createVerificationInterface(app: NexoApplication): NexoVerificationInterface;
|
|
31
|
+
//# sourceMappingURL=verification-interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verification-interface.d.ts","sourceRoot":"","sources":["../src/verification-interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE1E,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,CAAC;AAErD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;CAC7C;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAC;CACzC;AAED,MAAM,WAAW,yBAAyB;IACxC,qBAAqB,IAAI,gBAAgB,CAAC;IAC1C,oBAAoB,IAAI,gBAAgB,CAAC;IACzC,mBAAmB,IAAI,SAAS,oBAAoB,EAAE,CAAC;IACvD,sBAAsB,IAAI,iBAAiB,CAAC;CAC7C;AA4CD,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,eAAe,GACnB,yBAAyB,CAmH3B"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
function toValidationResult(issues) {
|
|
2
|
+
return {
|
|
3
|
+
valid: !issues.some((issue) => issue.severity === "error"),
|
|
4
|
+
issues
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
function detectCycle(moduleName, moduleNames, getDependencies, state, path) {
|
|
8
|
+
state.set(moduleName, "visiting");
|
|
9
|
+
path.push(moduleName);
|
|
10
|
+
for (const dependency of getDependencies(moduleName)) {
|
|
11
|
+
if (dependency === moduleName || !moduleNames.has(dependency)) {
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
const dependencyState = state.get(dependency);
|
|
15
|
+
if (dependencyState === "visiting") {
|
|
16
|
+
const cycleStart = path.indexOf(dependency);
|
|
17
|
+
return [...path.slice(cycleStart), dependency];
|
|
18
|
+
}
|
|
19
|
+
if (dependencyState !== "done") {
|
|
20
|
+
const cycle = detectCycle(dependency, moduleNames, getDependencies, state, path);
|
|
21
|
+
if (cycle) {
|
|
22
|
+
return cycle;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
path.pop();
|
|
27
|
+
state.set(moduleName, "done");
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
export function createVerificationInterface(app) {
|
|
31
|
+
return {
|
|
32
|
+
validateConfiguration() {
|
|
33
|
+
const issues = [];
|
|
34
|
+
const config = app.getAllConfig();
|
|
35
|
+
for (const [key, value] of Object.entries(config)) {
|
|
36
|
+
if (typeof value === "function") {
|
|
37
|
+
issues.push({
|
|
38
|
+
severity: "warning",
|
|
39
|
+
message: `Configuration key "${key}" holds a function, which will be silently dropped when serialized to JSON.`,
|
|
40
|
+
target: key
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
JSON.stringify(config);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
issues.push({
|
|
49
|
+
severity: "error",
|
|
50
|
+
message: `Configuration is not JSON-serializable: ${error.message}`
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return toValidationResult(issues);
|
|
54
|
+
},
|
|
55
|
+
validateArchitecture() {
|
|
56
|
+
const issues = [];
|
|
57
|
+
const moduleNames = new Set(app.getModules().map((module) => module.name));
|
|
58
|
+
for (const module of app.getModules()) {
|
|
59
|
+
const dependencies = app.getDependencies(module.name);
|
|
60
|
+
if (dependencies.includes(module.name)) {
|
|
61
|
+
issues.push({
|
|
62
|
+
severity: "error",
|
|
63
|
+
message: `Module "${module.name}" depends on itself.`,
|
|
64
|
+
target: module.name
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
for (const dependency of dependencies) {
|
|
68
|
+
if (dependency !== module.name && !moduleNames.has(dependency)) {
|
|
69
|
+
issues.push({
|
|
70
|
+
severity: "warning",
|
|
71
|
+
message: `Module "${module.name}" depends on "${dependency}", which is not a registered module (may be an external system).`,
|
|
72
|
+
target: module.name
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
for (const api of module.apis ?? []) {
|
|
77
|
+
if (api.service) {
|
|
78
|
+
const serviceExists = app.getServices().some((s) => s.name === api.service);
|
|
79
|
+
if (!serviceExists) {
|
|
80
|
+
issues.push({
|
|
81
|
+
severity: "warning",
|
|
82
|
+
message: `API "${api.name}" on module "${module.name}" references service "${api.service}", which is not registered.`,
|
|
83
|
+
target: `${module.name}.${api.name}`
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const cycleState = new Map();
|
|
90
|
+
for (const moduleName of moduleNames) {
|
|
91
|
+
if (cycleState.get(moduleName) === "done") {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const cycle = detectCycle(moduleName, moduleNames, (name) => app.getDependencies(name), cycleState, []);
|
|
95
|
+
if (cycle) {
|
|
96
|
+
issues.push({
|
|
97
|
+
severity: "error",
|
|
98
|
+
message: `Dependency cycle detected: ${cycle.join(" -> ")}.`
|
|
99
|
+
});
|
|
100
|
+
for (const cycleMember of cycle) {
|
|
101
|
+
cycleState.set(cycleMember, "done");
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return toValidationResult(issues);
|
|
106
|
+
},
|
|
107
|
+
inspectDependencies() {
|
|
108
|
+
return app.getModules().map((module) => ({
|
|
109
|
+
module: module.name,
|
|
110
|
+
dependencies: app.getDependencies(module.name),
|
|
111
|
+
dependents: app.getDependents(module.name)
|
|
112
|
+
}));
|
|
113
|
+
},
|
|
114
|
+
checkApplicationHealth() {
|
|
115
|
+
return {
|
|
116
|
+
state: app.state,
|
|
117
|
+
moduleCount: app.getModules().length,
|
|
118
|
+
apiCount: app.getApis().length,
|
|
119
|
+
serviceCount: app.getServices().length,
|
|
120
|
+
architecture: this.validateArchitecture()
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=verification-interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verification-interface.js","sourceRoot":"","sources":["../src/verification-interface.ts"],"names":[],"mappings":"AAoCA,SAAS,kBAAkB,CAAC,MAAkC;IAC5D,OAAO;QACL,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,OAAO,CAAC;QAC1D,MAAM;KACP,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAClB,UAAkB,EAClB,WAAgC,EAChC,eAAoD,EACpD,KAAuC,EACvC,IAAc;IAEd,KAAK,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAClC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAEtB,KAAK,MAAM,UAAU,IAA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,EAAE,CAAC;wBAChC,UAAU,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;oBACtC,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACpC,CAAC;QAED,mBAAmB;YACjB,OAAO,GAAG,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBACvC,MAAM,EAAE,MAAM,CAAC,IAAI;gBACnB,YAAY,EAAE,GAAG,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC;gBAC9C,UAAU,EAAE,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC;aAC3C,CAAC,CAAC,CAAC;QACN,CAAC;QAED,sBAAsB;YACpB,OAAO;gBACL,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,WAAW,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,MAAM;gBACpC,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,MAAM;gBAC9B,YAAY,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC,MAAM;gBACtC,YAAY,EAAE,IAAI,CAAC,oBAAoB,EAAE;aAC1C,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type NexoApi, type NexoApplication, type NexoJob, type NexoModule, type NexoService } from "@nexo-alpha/core";
|
|
2
|
+
import { type ApplicationKnowledge, type DevelopmentState, type NexoConstraint, type NexoDecision } from "@nexo-alpha/context";
|
|
3
|
+
export type PermissionScope = "modify-source" | "modify-configuration" | "modify-knowledge";
|
|
4
|
+
export interface PermissionGrants {
|
|
5
|
+
readonly scopes: ReadonlySet<PermissionScope>;
|
|
6
|
+
}
|
|
7
|
+
export interface WriteOperationResult<T> {
|
|
8
|
+
readonly success: boolean;
|
|
9
|
+
readonly data?: T;
|
|
10
|
+
readonly error?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface NexoWriteInterface {
|
|
13
|
+
createModule(module: NexoModule, actor?: string): WriteOperationResult<NexoModule>;
|
|
14
|
+
createApi(moduleName: string, api: NexoApi, actor?: string): WriteOperationResult<NexoApi>;
|
|
15
|
+
modifyApi(moduleName: string, apiName: string, patch: Partial<NexoApi>, actor?: string): WriteOperationResult<NexoApi>;
|
|
16
|
+
createService(moduleName: string, service: NexoService, actor?: string): WriteOperationResult<NexoService>;
|
|
17
|
+
modifyService(moduleName: string, serviceName: string, patch: Partial<NexoService>, actor?: string): WriteOperationResult<NexoService>;
|
|
18
|
+
createJob(moduleName: string, job: NexoJob, actor?: string): WriteOperationResult<NexoJob>;
|
|
19
|
+
modifyJob(moduleName: string, jobName: string, patch: Partial<NexoJob>, actor?: string): WriteOperationResult<NexoJob>;
|
|
20
|
+
updateConfiguration(patch: Record<string, unknown>, actor?: string): WriteOperationResult<Readonly<Record<string, unknown>>>;
|
|
21
|
+
addDependency(moduleName: string, dependencyName: string, actor?: string): WriteOperationResult<readonly string[]>;
|
|
22
|
+
recordDecision(decision: NexoDecision, actor?: string): WriteOperationResult<NexoDecision>;
|
|
23
|
+
recordConstraint(constraint: NexoConstraint, actor?: string): WriteOperationResult<NexoConstraint>;
|
|
24
|
+
updateDevelopmentState(patch: Partial<DevelopmentState>, actor?: string): WriteOperationResult<DevelopmentState>;
|
|
25
|
+
createTest(moduleName: string, testName: string, testSpec?: string, actor?: string): WriteOperationResult<{
|
|
26
|
+
module: string;
|
|
27
|
+
test: string;
|
|
28
|
+
spec?: string;
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
31
|
+
export declare function createWriteInterface(app: NexoApplication, knowledge: ApplicationKnowledge, grants: PermissionGrants): NexoWriteInterface;
|
|
32
|
+
//# sourceMappingURL=write-interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-interface.d.ts","sourceRoot":"","sources":["../src/write-interface.ts"],"names":[],"mappings":"AAAA,OAAO,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AAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1E;AA4BD,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,eAAe,EACpB,SAAS,EAAE,oBAAoB,EAC/B,MAAM,EAAE,gBAAgB,GACvB,kBAAkB,CAuQpB"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { NexoError } from "@nexo-alpha/core";
|
|
2
|
+
function hasPermission(grants, scope) {
|
|
3
|
+
return grants.scopes.has(scope);
|
|
4
|
+
}
|
|
5
|
+
function historyEntry(operation, target, actor, result, detail) {
|
|
6
|
+
return {
|
|
7
|
+
operation,
|
|
8
|
+
result,
|
|
9
|
+
...(target !== undefined ? { target } : {}),
|
|
10
|
+
...(actor !== undefined ? { actor } : {}),
|
|
11
|
+
...(detail !== undefined ? { detail } : {})
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function createWriteInterface(app, knowledge, grants) {
|
|
15
|
+
function denied(operation, target, scope, actor) {
|
|
16
|
+
const error = `Permission required: "${scope}" is not granted for operation "${operation}".`;
|
|
17
|
+
knowledge.addHistoryEntry(historyEntry(operation, target, actor, "denied", error));
|
|
18
|
+
return { success: false, error };
|
|
19
|
+
}
|
|
20
|
+
function failed(operation, target, actor, error) {
|
|
21
|
+
knowledge.addHistoryEntry(historyEntry(operation, target, actor, "failed", error));
|
|
22
|
+
return { success: false, error };
|
|
23
|
+
}
|
|
24
|
+
function succeeded(operation, target, actor, data) {
|
|
25
|
+
knowledge.addHistoryEntry(historyEntry(operation, target, actor, "success"));
|
|
26
|
+
return { success: true, data };
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
createModule(module, actor) {
|
|
30
|
+
const operation = "create_module";
|
|
31
|
+
if (!hasPermission(grants, "modify-source")) {
|
|
32
|
+
return denied(operation, module.name, "modify-source", actor);
|
|
33
|
+
}
|
|
34
|
+
if (app.getModule(module.name)) {
|
|
35
|
+
return failed(operation, module.name, actor, `Nexo module "${module.name}" is already registered.`);
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
app.module(module);
|
|
39
|
+
return succeeded(operation, module.name, actor, module);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (error instanceof NexoError) {
|
|
43
|
+
return failed(operation, module.name, actor, error.message);
|
|
44
|
+
}
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
createApi(moduleName, api, actor) {
|
|
49
|
+
const operation = "create_api";
|
|
50
|
+
const target = `${moduleName}.${api.name}`;
|
|
51
|
+
if (!hasPermission(grants, "modify-source")) {
|
|
52
|
+
return denied(operation, target, "modify-source", actor);
|
|
53
|
+
}
|
|
54
|
+
if (!app.getModule(moduleName)) {
|
|
55
|
+
return failed(operation, target, actor, `Nexo module "${moduleName}" is not registered.`);
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
app.addApiToModule(moduleName, api);
|
|
59
|
+
return succeeded(operation, target, actor, api);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
if (error instanceof NexoError) {
|
|
63
|
+
return failed(operation, target, actor, error.message);
|
|
64
|
+
}
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
modifyApi(moduleName, apiName, patch, actor) {
|
|
69
|
+
const operation = "modify_api";
|
|
70
|
+
const target = `${moduleName}.${apiName}`;
|
|
71
|
+
if (!hasPermission(grants, "modify-source")) {
|
|
72
|
+
return denied(operation, target, "modify-source", actor);
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
const updated = app.updateApi(moduleName, apiName, patch);
|
|
76
|
+
return succeeded(operation, target, actor, updated);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
if (error instanceof NexoError) {
|
|
80
|
+
return failed(operation, target, actor, error.message);
|
|
81
|
+
}
|
|
82
|
+
throw error;
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
createService(moduleName, service, actor) {
|
|
86
|
+
const operation = "create_service";
|
|
87
|
+
const target = `${moduleName}.${service.name}`;
|
|
88
|
+
if (!hasPermission(grants, "modify-source")) {
|
|
89
|
+
return denied(operation, target, "modify-source", actor);
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
app.addServiceToModule(moduleName, service);
|
|
93
|
+
return succeeded(operation, target, actor, service);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
if (error instanceof NexoError) {
|
|
97
|
+
return failed(operation, target, actor, error.message);
|
|
98
|
+
}
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
modifyService(moduleName, serviceName, patch, actor) {
|
|
103
|
+
const operation = "modify_service";
|
|
104
|
+
const target = `${moduleName}.${serviceName}`;
|
|
105
|
+
if (!hasPermission(grants, "modify-source")) {
|
|
106
|
+
return denied(operation, target, "modify-source", actor);
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
const updated = app.updateService(moduleName, serviceName, patch);
|
|
110
|
+
return succeeded(operation, target, actor, updated);
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
if (error instanceof NexoError) {
|
|
114
|
+
return failed(operation, target, actor, error.message);
|
|
115
|
+
}
|
|
116
|
+
throw error;
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
createJob(moduleName, job, actor) {
|
|
120
|
+
const operation = "create_job";
|
|
121
|
+
const target = `${moduleName}.${job.name}`;
|
|
122
|
+
if (!hasPermission(grants, "modify-source")) {
|
|
123
|
+
return denied(operation, target, "modify-source", actor);
|
|
124
|
+
}
|
|
125
|
+
try {
|
|
126
|
+
app.addJobToModule(moduleName, job);
|
|
127
|
+
return succeeded(operation, target, actor, job);
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
if (error instanceof NexoError) {
|
|
131
|
+
return failed(operation, target, actor, error.message);
|
|
132
|
+
}
|
|
133
|
+
throw error;
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
modifyJob(moduleName, jobName, patch, actor) {
|
|
137
|
+
const operation = "modify_job";
|
|
138
|
+
const target = `${moduleName}.${jobName}`;
|
|
139
|
+
if (!hasPermission(grants, "modify-source")) {
|
|
140
|
+
return denied(operation, target, "modify-source", actor);
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
const updated = app.updateJob(moduleName, jobName, patch);
|
|
144
|
+
return succeeded(operation, target, actor, updated);
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
if (error instanceof NexoError) {
|
|
148
|
+
return failed(operation, target, actor, error.message);
|
|
149
|
+
}
|
|
150
|
+
throw error;
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
updateConfiguration(patch, actor) {
|
|
154
|
+
const operation = "update_configuration";
|
|
155
|
+
if (!hasPermission(grants, "modify-configuration")) {
|
|
156
|
+
return denied(operation, undefined, "modify-configuration", actor);
|
|
157
|
+
}
|
|
158
|
+
const config = app.updateConfig(patch);
|
|
159
|
+
return succeeded(operation, undefined, actor, config);
|
|
160
|
+
},
|
|
161
|
+
addDependency(moduleName, dependencyName, actor) {
|
|
162
|
+
const operation = "add_dependency";
|
|
163
|
+
const target = `${moduleName} -> ${dependencyName}`;
|
|
164
|
+
if (!hasPermission(grants, "modify-source")) {
|
|
165
|
+
return denied(operation, target, "modify-source", actor);
|
|
166
|
+
}
|
|
167
|
+
try {
|
|
168
|
+
const dependencies = app.addModuleDependency(moduleName, dependencyName);
|
|
169
|
+
return succeeded(operation, target, actor, dependencies);
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
if (error instanceof NexoError) {
|
|
173
|
+
return failed(operation, target, actor, error.message);
|
|
174
|
+
}
|
|
175
|
+
throw error;
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
recordDecision(decision, actor) {
|
|
179
|
+
const operation = "record_decision";
|
|
180
|
+
const target = decision.title;
|
|
181
|
+
if (!hasPermission(grants, "modify-knowledge")) {
|
|
182
|
+
return denied(operation, target, "modify-knowledge", actor);
|
|
183
|
+
}
|
|
184
|
+
knowledge.addDecision(decision);
|
|
185
|
+
return succeeded(operation, target, actor, decision);
|
|
186
|
+
},
|
|
187
|
+
recordConstraint(constraint, actor) {
|
|
188
|
+
const operation = "record_constraint";
|
|
189
|
+
const target = constraint.description;
|
|
190
|
+
if (!hasPermission(grants, "modify-knowledge")) {
|
|
191
|
+
return denied(operation, target, "modify-knowledge", actor);
|
|
192
|
+
}
|
|
193
|
+
knowledge.addConstraint(constraint);
|
|
194
|
+
return succeeded(operation, target, actor, constraint);
|
|
195
|
+
},
|
|
196
|
+
updateDevelopmentState(patch, actor) {
|
|
197
|
+
const operation = "update_development_state";
|
|
198
|
+
if (!hasPermission(grants, "modify-knowledge")) {
|
|
199
|
+
return denied(operation, undefined, "modify-knowledge", actor);
|
|
200
|
+
}
|
|
201
|
+
knowledge.setDevelopmentState(patch);
|
|
202
|
+
return succeeded(operation, undefined, actor, knowledge.getDevelopmentState());
|
|
203
|
+
},
|
|
204
|
+
createTest(moduleName, testName, testSpec, actor) {
|
|
205
|
+
const operation = "create_test";
|
|
206
|
+
const target = `${moduleName}.${testName}`;
|
|
207
|
+
if (!hasPermission(grants, "modify-source")) {
|
|
208
|
+
return denied(operation, target, "modify-source", actor);
|
|
209
|
+
}
|
|
210
|
+
if (!app.getModule(moduleName)) {
|
|
211
|
+
return failed(operation, target, actor, `Nexo module "${moduleName}" is not registered.`);
|
|
212
|
+
}
|
|
213
|
+
const data = { module: moduleName, test: testName, ...(testSpec !== undefined ? { spec: testSpec } : {}) };
|
|
214
|
+
return succeeded(operation, target, actor, data);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=write-interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-interface.js","sourceRoot":"","sources":["../src/write-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,S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AC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;YAC3G,OAAO,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACnD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexo-alpha/tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "AI/tooling read interface for the Nexo framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nexo",
|
|
@@ -20,12 +20,15 @@
|
|
|
20
20
|
"import": "./dist/index.js"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
23
26
|
"files": [
|
|
24
27
|
"dist"
|
|
25
28
|
],
|
|
26
29
|
"dependencies": {
|
|
27
|
-
"@nexo-alpha/core": "0.
|
|
28
|
-
"@nexo-alpha/context": "0.
|
|
30
|
+
"@nexo-alpha/core": "0.2.0",
|
|
31
|
+
"@nexo-alpha/context": "0.2.0"
|
|
29
32
|
},
|
|
30
33
|
"scripts": {
|
|
31
34
|
"build": "tsc -p tsconfig.json",
|