@nexo-alpha/core 0.1.0 → 0.1.2

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 ADDED
@@ -0,0 +1,74 @@
1
+ # @nexo-alpha/core
2
+
3
+ Core application runtime for **Nexo** — a lightweight Node.js framework designed to make software projects understandable, navigable, and safely operable by both human developers and AI development tools.
4
+
5
+ `@nexo/core` has **zero runtime dependencies** and never depends on an HTTP framework, a database, or an AI provider. It only defines the application model: applications, modules, services, APIs, lifecycle, and the application-level knowledge (decisions, constraints, development state) that keeps a project's intent alongside its code.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @nexo-alpha/core
11
+ ```
12
+
13
+ ## Why
14
+
15
+ Most frameworks help you build an application but don't give an AI tool (or a new teammate) a structured way to understand it without reading the entire codebase. `@nexo/core` gives an application a place to declare *what it is*, not just *what it does* — module purpose, ownership of APIs/services, dependencies between modules, and the current state of development.
16
+
17
+ ## Usage
18
+
19
+ ```ts
20
+ import { createApplication } from "@nexo-alpha/core";
21
+
22
+ const app = createApplication({
23
+ name: "shop",
24
+ version: "0.1.0",
25
+ description: "A commerce platform"
26
+ });
27
+
28
+ app.module({
29
+ name: "payments",
30
+ purpose: "Handle customer payments",
31
+ status: "in-progress",
32
+ dependencies: ["stripe", "orders"],
33
+ apis: [{ name: "createPayment", method: "POST", path: "/payments" }],
34
+ services: [{ name: "PaymentService" }]
35
+ });
36
+
37
+ app.addDecision({
38
+ title: "Payment records are immutable",
39
+ reason: "Auditability of financial history.",
40
+ status: "accepted"
41
+ });
42
+
43
+ app.setDevelopmentState({
44
+ currentObjective: "Implement payment recovery",
45
+ completed: ["Retry API"],
46
+ inProgress: ["Retry worker"]
47
+ });
48
+
49
+ await app.start();
50
+
51
+ app.getDependents("orders"); // -> ["payments"]
52
+ ```
53
+
54
+ ## What's here
55
+
56
+ - **Application lifecycle** — `createApplication`, `start()`/`stop()`, module `initialize`/`start`/`stop` hooks
57
+ - **Module model** — `purpose`, `status`, `dependencies`, `apis`, `services`, `events`, `jobs`
58
+ - **Dependency graph** — `getDependencies(name)` / `getDependents(name)`
59
+ - **Events** — a plain `NexoEventBus` (wraps `node:events`) via `app.events`
60
+ - **Configuration** — `getConfig(key)` / `getAllConfig()`
61
+ - **Knowledge records** — `addDecision`/`getDecisions`, `addConstraint`/`getConstraints`, `setDevelopmentState`/`getDevelopmentState`
62
+
63
+ ## Related packages
64
+
65
+ - [`@nexo-alpha/context`](https://www.npmjs.com/package/@nexo-alpha/context) — turns a running application into a JSON manifest
66
+ - [`@nexo-alpha/tools`](https://www.npmjs.com/package/@nexo-alpha/tools) — a structured, read-only interface for AI development tools
67
+
68
+ ## Status
69
+
70
+ **v0.1-alpha.** No CLI, no HTTP adapter, and no write/mutation AI operations yet — read-only, declarative model first.
71
+
72
+ ## License
73
+
74
+ MIT
package/dist/api.d.ts CHANGED
@@ -1,4 +1,11 @@
1
1
  export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
2
+ export interface NexoRequestContext {
3
+ readonly params: Readonly<Record<string, string>>;
4
+ readonly query: Readonly<Record<string, unknown>>;
5
+ readonly payload: unknown;
6
+ readonly headers: Readonly<Record<string, string>>;
7
+ }
8
+ export type NexoApiHandler = (context: NexoRequestContext) => unknown | Promise<unknown>;
2
9
  export interface NexoApi {
3
10
  readonly name: string;
4
11
  readonly method: HttpMethod;
@@ -6,5 +13,6 @@ export interface NexoApi {
6
13
  readonly description?: string;
7
14
  readonly purpose?: string;
8
15
  readonly dependencies?: readonly string[];
16
+ readonly handler?: NexoApiHandler;
9
17
  }
10
18
  //# sourceMappingURL=api.d.ts.map
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAClB,KAAK,GACL,MAAM,GACN,KAAK,GACL,OAAO,GACP,QAAQ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,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC;CACnC"}
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { createApplication, NexoApplication } from "./application.js";
2
2
  export type { ApplicationOptions, ApplicationState } from "./application.js";
3
3
  export type { NexoModule } from "./module.js";
4
4
  export type { NexoService } from "./service.js";
5
- export type { NexoApi, HttpMethod } from "./api.js";
5
+ export type { NexoApi, HttpMethod, NexoRequestContext, NexoApiHandler } from "./api.js";
6
6
  export type { NexoJob } from "./job.js";
7
7
  export type { NexoDecision } from "./decision.js";
8
8
  export type { NexoConstraint } from "./constraint.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,UAAU,EACX,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,WAAW,EACZ,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,OAAO,EACP,UAAU,EACX,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,OAAO,EACR,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,YAAY,EACb,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,cAAc,EACf,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,YAAY,EACb,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,SAAS,EACT,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,UAAU,EACX,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,WAAW,EACZ,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,OAAO,EACP,UAAU,EACV,kBAAkB,EAClB,cAAc,EACf,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,OAAO,EACR,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,YAAY,EACb,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,cAAc,EACf,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,YAAY,EACb,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,SAAS,EACT,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,aAAa,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAoC1B,OAAO,EACL,YAAY,EACb,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,SAAS,EACT,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAsC1B,OAAO,EACL,YAAY,EACb,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,SAAS,EACT,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,16 @@
1
1
  {
2
2
  "name": "@nexo-alpha/core",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Core runtime for the Nexo application framework",
5
+ "keywords": [
6
+ "nexo",
7
+ "framework",
8
+ "application-framework",
9
+ "ai-development",
10
+ "typescript",
11
+ "nodejs"
12
+ ],
13
+ "author": "prem1999",
5
14
  "license": "MIT",
6
15
  "type": "module",
7
16
  "main": "./dist/index.js",