@nan0web/core 3.4.0 → 3.5.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 CHANGED
@@ -8,19 +8,16 @@ DB‑backed state container with built‑in internationalisation.
8
8
  ## Installation
9
9
 
10
10
  How to install with npm?
11
-
12
11
  ```bash
13
12
  npm install @nan0web/core
14
13
  ```
15
14
 
16
15
  How to install with pnpm?
17
-
18
16
  ```bash
19
17
  pnpm add @nan0web/core
20
18
  ```
21
19
 
22
20
  How to install with yarn?
23
-
24
21
  ```bash
25
22
  yarn add @nan0web/core
26
23
  ```
@@ -30,7 +27,6 @@ yarn add @nan0web/core
30
27
  Create an `AppCore` instance with a mock DB and inspect its state.
31
28
 
32
29
  How to instantiate AppCore?
33
-
34
30
  ```js
35
31
  import { AppCore } from "@nan0web/core"
36
32
  const db = new DB()
@@ -43,7 +39,6 @@ console.info(core.uri) // ← /demo
43
39
  Load translation JSON from the DB and obtain a translation function.
44
40
 
45
41
  How does bootstrapI18n load translations?
46
-
47
42
  ```js
48
43
  const db = new DB({
49
44
  predefined: [['i18n/uk.json', { hello: 'Вітаю!' }]],
@@ -57,7 +52,6 @@ console.info(result) // ← Вітаю!
57
52
  ## State inspection
58
53
 
59
54
  How to retrieve current state?
60
-
61
55
  ```js
62
56
  const db = new DB()
63
57
  const core = new AppCore({ db })
@@ -66,7 +60,6 @@ const state = core.state()
66
60
  ## AppResult helper
67
61
 
68
62
  How to create an AppResult instance?
69
-
70
63
  ```js
71
64
  import { AppResult } from "@nan0web/core"
72
65
  const res = new AppResult({ content: 'Done', priority: 2, meta: { ok: true } })
@@ -77,7 +70,6 @@ console.info(res.content[0]) // ← Done
77
70
  The base `run` method throws an error – subclasses must implement it.
78
71
 
79
72
  How does run() behave when not overridden?
80
-
81
73
  ```js
82
74
  const db = new DB()
83
75
  const core = new AppCore({ db })
@@ -89,7 +81,6 @@ Core components like `AppCore` and `ProjectModel` implement a `static UI`
89
81
  metadata block defining their semantic display defaults according to the system contract.
90
82
 
91
83
  How to get semantic static UI data?
92
-
93
84
  ```js
94
85
  import { AppCore, ProjectModel } from "@nan0web/core"
95
86
  console.info(`${AppCore.UI.icon} ${AppCore.UI.title}`) // ← ⚙️ Application Core
@@ -101,5 +92,3 @@ How to contribute? - [check here](./CONTRIBUTING.md)
101
92
  ## License
102
93
 
103
94
  How to license ISC? - [check here](./LICENSE)
104
-
105
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nan0web/core",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "Core application framework for nan0web with database handling, internationalization, and interface connectivity",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -8,6 +8,7 @@
8
8
  "files": [
9
9
  "src/**/*.js",
10
10
  "!src/**/*.test.js",
11
+ "!src/**/*.story.js",
11
12
  "!src/README.md.js",
12
13
  "types/**/*.d.ts"
13
14
  ],
@@ -27,7 +28,7 @@
27
28
  "devDependencies": {
28
29
  "husky": "^9.1.7",
29
30
  "knip": "^5.88.1",
30
- "@nan0web/release": "3.4.0",
31
+ "@nan0web/release": "3.8.0",
31
32
  "@nan0web/test": "3.4.0"
32
33
  },
33
34
  "exports": {
@@ -37,9 +38,14 @@
37
38
  }
38
39
  },
39
40
  "dependencies": {
40
- "@nan0web/db": "3.4.0",
41
- "@nan0web/types": "3.4.0",
42
- "@nan0web/i18n": "3.4.0"
41
+ "@nan0web/db": "3.6.0",
42
+ "@nan0web/i18n": "3.4.0",
43
+ "@nan0web/types": "3.4.0"
44
+ },
45
+ "knip": {
46
+ "ignore": [
47
+ "**/*.story.js"
48
+ ]
43
49
  },
44
50
  "scripts": {
45
51
  "build": "rm -rf types && tsc",
@@ -56,6 +62,7 @@
56
62
  "test:coverage": "node --experimental-test-coverage --test-coverage-include=\"src/**/*.js\" --test-coverage-exclude=\"src/**/*.test.js\" --test \"src/**/*.test.js\"",
57
63
  "test:coverage:collect": "nan0test coverage",
58
64
  "test:status": "nan0test status --hide-name",
59
- "test:all": "npm run test && npm run test:docs && npm run build && npm run knip"
65
+ "test:all": "npm run test && npm run test:docs && npm run build && npm run knip",
66
+ "inspect": "nan0inspect domain ."
60
67
  }
61
68
  }
@@ -0,0 +1,42 @@
1
+ import { Model } from '@nan0web/types'
2
+
3
+ /**
4
+ * Agent entry configuration inside nan0web.nan0.
5
+ */
6
+ export default class AgentEntryConfig extends Model {
7
+ static id = {
8
+ help: 'Unique agent identifier',
9
+ default: '',
10
+ required: true,
11
+ }
12
+ static description = {
13
+ help: 'Short description of agent role',
14
+ default: '',
15
+ }
16
+ static workflows = {
17
+ help: 'List of workflow markdown paths',
18
+ type: 'string[]',
19
+ default: [],
20
+ }
21
+ static inspectors = {
22
+ help: 'List of inspector markdown paths',
23
+ type: 'string[]',
24
+ default: [],
25
+ }
26
+
27
+ /**
28
+ * @param {Partial<AgentEntryConfig>} [data]
29
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
30
+ */
31
+ constructor(data = {}, options = {}) {
32
+ super(data, options)
33
+ /** @type {string} Unique agent identifier */
34
+ this.id
35
+ /** @type {string} Short description of agent role */
36
+ this.description
37
+ /** @type {string[]} List of workflow markdown paths */
38
+ this.workflows = Array.isArray(this.workflows) ? this.workflows : []
39
+ /** @type {string[]} List of inspector markdown paths */
40
+ this.inspectors = Array.isArray(this.inspectors) ? this.inspectors : []
41
+ }
42
+ }
@@ -0,0 +1,148 @@
1
+ import { Model } from '@nan0web/types'
2
+ import { Data } from '@nan0web/db'
3
+ import AgentEntryConfig from './AgentEntryConfig.js'
4
+ import StepsConfig from './StepsConfig.js'
5
+
6
+ /**
7
+ * Unified NaN0Web configuration contract (Model-as-Schema) for nan0web.nan0.
8
+ * Combines CoCoDev 7-step config, package agents, and nan0web.app runtime settings.
9
+ */
10
+ export default class NaN0WebConfig extends Model {
11
+ static title = {
12
+ alias: 'name',
13
+ help: 'Package or workspace name',
14
+ default: '',
15
+ }
16
+ static appName = {
17
+ alias: 'name',
18
+ help: 'Project name',
19
+ placeholder: 'my-app',
20
+ default: '',
21
+ }
22
+ static dsn = {
23
+ help: 'Data Source Name (folder or connection string)',
24
+ placeholder: 'data/',
25
+ default: 'data/',
26
+ }
27
+ static locale = {
28
+ help: 'Default locale',
29
+ placeholder: 'en',
30
+ default: 'en',
31
+ }
32
+ static port = {
33
+ help: 'Server port',
34
+ placeholder: '3000',
35
+ default: 3000,
36
+ }
37
+ static theme = {
38
+ help: 'UI theme (light | dark | auto)',
39
+ placeholder: 'auto',
40
+ default: 'auto',
41
+ }
42
+ static aliases = {
43
+ help: 'Virtual URI aliases (source -> target)',
44
+ type: 'Record<string, string>',
45
+ default: {},
46
+ hidden: true,
47
+ }
48
+ static directoryIndex = {
49
+ help: 'Directory index file name (index or README for git repos)',
50
+ placeholder: 'index',
51
+ default: 'index',
52
+ }
53
+ static ui = {
54
+ help: 'UI adapters to load',
55
+ type: 'string[]',
56
+ default: [],
57
+ }
58
+ static ssl = {
59
+ help: 'TLS/SSL config for HTTPS — certificate and key paths',
60
+ type: 'object',
61
+ default: null,
62
+ hidden: true,
63
+ }
64
+ static log = {
65
+ help: 'Configuration for access and error logs',
66
+ type: 'object',
67
+ default: {},
68
+ hidden: true,
69
+ }
70
+ static apps = {
71
+ help: 'Installed domain apps',
72
+ type: 'object[]',
73
+ hidden: true,
74
+ default: [],
75
+ }
76
+ static agents = {
77
+ help: 'Configured AI agents and their workflows/inspectors',
78
+ type: 'AgentEntryConfig[]',
79
+ hint: AgentEntryConfig,
80
+ default: [],
81
+ }
82
+ static steps = {
83
+ help: 'CoCoDev 7-step configuration',
84
+ type: 'StepsConfig',
85
+ hint: StepsConfig,
86
+ default: {},
87
+ }
88
+
89
+ /**
90
+ * @param {Partial<NaN0WebConfig>} [data]
91
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
92
+ */
93
+ constructor(data = {}, options = {}) {
94
+ super(data, options)
95
+ /** @type {string} Package or workspace name */
96
+ this.title
97
+ /** @type {string} Project name */
98
+ this.appName
99
+ /** @type {string} Data Source Name (folder or connection string) */
100
+ this.dsn
101
+ /** @type {string} Default locale */
102
+ this.locale
103
+ /** @type {number} Server port */
104
+ this.port
105
+ /** @type {string} UI theme (light | dark | auto) */
106
+ this.theme
107
+ /** @type {Record<string, string>} Virtual URI aliases (source -> target) */
108
+ this.aliases
109
+ /** @type {string} Directory index file name (index or README for git repos) */
110
+ this.directoryIndex
111
+ /** @type {string[]} UI adapters to load */
112
+ this.ui = Array.isArray(this.ui) ? this.ui : []
113
+ /** @type {object | null} TLS/SSL config for HTTPS — certificate and key paths */
114
+ this.ssl
115
+ /** @type {Record<string, any>} Configuration for access and error logs */
116
+ this.log
117
+ /** @type {Array<Record<string, any>>} Installed domain apps */
118
+ this.apps = Array.isArray(this.apps) ? this.apps : []
119
+ /** @type {AgentEntryConfig[]} Configured AI agents and their workflows/inspectors */
120
+ this.agents = Array.isArray(data.agents)
121
+ ? data.agents.map((a) =>
122
+ a instanceof AgentEntryConfig ? a : new AgentEntryConfig(a, options)
123
+ )
124
+ : []
125
+ /** @type {StepsConfig} CoCoDev 7-step configuration */
126
+ this.steps =
127
+ data.steps instanceof StepsConfig ? data.steps : new StepsConfig(data.steps, options)
128
+ }
129
+
130
+ /**
131
+ * Loads and merges cascading nan0web.nan0 layers from a @nan0web/db instance.
132
+ * @param {import('@nan0web/db').default} db
133
+ * @param {{ layers?: string[] }} [options]
134
+ * @returns {Promise<NaN0WebConfig>}
135
+ */
136
+ static async load(db, options = {}) {
137
+ const layers = options.layers ?? ['@system/nan0web', '@root/nan0web', '@app/nan0web']
138
+ /** @type {Record<string, any>} */
139
+ let merged = {}
140
+ for (const uri of layers) {
141
+ const doc = await db.loadDocument(uri).catch(() => null)
142
+ if (doc && typeof doc === 'object') {
143
+ merged = Data.merge(merged, doc)
144
+ }
145
+ }
146
+ return new NaN0WebConfig(merged, { db })
147
+ }
148
+ }
@@ -0,0 +1,259 @@
1
+ import { Model } from '@nan0web/types'
2
+
3
+ /**
4
+ * Step 1: Intent (I) — goal and acceptance criteria (<= 7).
5
+ */
6
+ export class IntentStep extends Model {
7
+ static maxCriteria = {
8
+ help: 'Maximum number of acceptance criteria per task (<= 7)',
9
+ default: 7,
10
+ }
11
+ static releaseDir = {
12
+ help: 'Directory pattern for release artifacts',
13
+ default: 'releases',
14
+ }
15
+
16
+ /**
17
+ * @param {Partial<IntentStep>} [data]
18
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
19
+ */
20
+ constructor(data = {}, options = {}) {
21
+ super(data, options)
22
+ /** @type {number} Maximum number of acceptance criteria per task (<= 7) */
23
+ this.maxCriteria
24
+ /** @type {string} Directory pattern for release artifacts */
25
+ this.releaseDir
26
+ if (this.maxCriteria > 7 || this.maxCriteria < 1) {
27
+ throw new RangeError('IntentStep.maxCriteria must be between 1 and 7')
28
+ }
29
+ }
30
+ }
31
+
32
+ /**
33
+ * Step 2: Knowledge (K) — MCP-first research & targetFiles whitelist.
34
+ */
35
+ export class KnowledgeStep extends Model {
36
+ static preferMcp = {
37
+ help: 'Prefer active MCP servers before grep/read_file',
38
+ default: true,
39
+ }
40
+ static requireTargetFiles = {
41
+ help: 'Require explicit targetFiles whitelist before code changes',
42
+ default: true,
43
+ }
44
+
45
+ /**
46
+ * @param {Partial<KnowledgeStep>} [data]
47
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
48
+ */
49
+ constructor(data = {}, options = {}) {
50
+ super(data, options)
51
+ /** @type {boolean} Prefer active MCP servers before grep/read_file */
52
+ this.preferMcp
53
+ /** @type {boolean} Require explicit targetFiles whitelist before code changes */
54
+ this.requireTargetFiles
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Step 3: Model (M) — pure Model-as-Schema / ModelAsApp domain design.
60
+ */
61
+ export class ModelStep extends Model {
62
+ static pureDomain = {
63
+ help: 'Enforce pure domain models without OS/UI coupling',
64
+ default: true,
65
+ }
66
+ static dbMount = {
67
+ help: 'Use virtual DB mounts (this.$db) for all I/O',
68
+ default: true,
69
+ }
70
+
71
+ /**
72
+ * @param {Partial<ModelStep>} [data]
73
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
74
+ */
75
+ constructor(data = {}, options = {}) {
76
+ super(data, options)
77
+ /** @type {boolean} Enforce pure domain models without OS/UI coupling */
78
+ this.pureDomain
79
+ /** @type {boolean} Use virtual DB mounts (this.$db) for all I/O */
80
+ this.dbMount
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Step 4: Contract (C) — TDD contract tests on In-Memory @nan0web/db.
86
+ */
87
+ export class ContractStep extends Model {
88
+ static inMemoryDb = {
89
+ help: 'Run scenario/contract tests against In-Memory @nan0web/db',
90
+ default: true,
91
+ }
92
+
93
+ /**
94
+ * @param {Partial<ContractStep>} [data]
95
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
96
+ */
97
+ constructor(data = {}, options = {}) {
98
+ super(data, options)
99
+ /** @type {boolean} Run scenario/contract tests against In-Memory @nan0web/db */
100
+ this.inMemoryDb
101
+ }
102
+ }
103
+
104
+ /**
105
+ * Step 5: Build (B) — minimal clean implementation.
106
+ */
107
+ export class BuildStep extends Model {
108
+ static forbidDirectFs = {
109
+ help: 'Forbid direct fs/path/os/process usage in domain code',
110
+ default: true,
111
+ }
112
+ static forbidDbExtensions = {
113
+ help: 'Forbid explicit file extensions in saveDocument/loadDocument',
114
+ default: true,
115
+ }
116
+
117
+ /**
118
+ * @param {Partial<BuildStep>} [data]
119
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
120
+ */
121
+ constructor(data = {}, options = {}) {
122
+ super(data, options)
123
+ /** @type {boolean} Forbid direct fs/path/os/process usage in domain code */
124
+ this.forbidDirectFs
125
+ /** @type {boolean} Forbid explicit file extensions in saveDocument/loadDocument */
126
+ this.forbidDbExtensions
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Step 6: Inspect (V) — automated verification & scope isolation.
132
+ */
133
+ export class InspectStep extends Model {
134
+ static runTests = {
135
+ help: 'Run test:all before completion',
136
+ default: true,
137
+ }
138
+ static runInspect = {
139
+ help: 'Run nan0inspect domain audit before completion',
140
+ default: true,
141
+ }
142
+ static checkScope = {
143
+ help: 'Verify git diff stays within declared targetFiles',
144
+ default: true,
145
+ }
146
+
147
+ /**
148
+ * @param {Partial<InspectStep>} [data]
149
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
150
+ */
151
+ constructor(data = {}, options = {}) {
152
+ super(data, options)
153
+ /** @type {boolean} Run test:all before completion */
154
+ this.runTests
155
+ /** @type {boolean} Run nan0inspect domain audit before completion */
156
+ this.runInspect
157
+ /** @type {boolean} Verify git diff stays within declared targetFiles */
158
+ this.checkScope
159
+ }
160
+ }
161
+
162
+ /**
163
+ * Step 7: Sync (S) — release cycle, knowledge index & backlog sync.
164
+ */
165
+ export class SyncStep extends Model {
166
+ static updateIndex = {
167
+ help: 'Update nan0web-knowledge index (pnpm run ai:index)',
168
+ default: true,
169
+ }
170
+ static updateBacklog = {
171
+ help: 'Record discovered gaps in releases/backlog.md',
172
+ default: true,
173
+ }
174
+
175
+ /**
176
+ * @param {Partial<SyncStep>} [data]
177
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
178
+ */
179
+ constructor(data = {}, options = {}) {
180
+ super(data, options)
181
+ /** @type {boolean} Update nan0web-knowledge index (pnpm run ai:index) */
182
+ this.updateIndex
183
+ /** @type {boolean} Record discovered gaps in releases/backlog.md */
184
+ this.updateBacklog
185
+ }
186
+ }
187
+
188
+ /**
189
+ * 7-step CoCoDev configuration container.
190
+ */
191
+ export default class StepsConfig extends Model {
192
+ static intent = {
193
+ help: 'Step 1: Intent (I)',
194
+ type: 'IntentStep',
195
+ hint: IntentStep,
196
+ default: {},
197
+ }
198
+ static knowledge = {
199
+ help: 'Step 2: Knowledge (K)',
200
+ type: 'KnowledgeStep',
201
+ hint: KnowledgeStep,
202
+ default: {},
203
+ }
204
+ static model = {
205
+ help: 'Step 3: Model (M)',
206
+ type: 'ModelStep',
207
+ hint: ModelStep,
208
+ default: {},
209
+ }
210
+ static contract = {
211
+ help: 'Step 4: Contract (C)',
212
+ type: 'ContractStep',
213
+ hint: ContractStep,
214
+ default: {},
215
+ }
216
+ static build = {
217
+ help: 'Step 5: Build (B)',
218
+ type: 'BuildStep',
219
+ hint: BuildStep,
220
+ default: {},
221
+ }
222
+ static inspect = {
223
+ help: 'Step 6: Inspect (V)',
224
+ type: 'InspectStep',
225
+ hint: InspectStep,
226
+ default: {},
227
+ }
228
+ static sync = {
229
+ help: 'Step 7: Sync (S)',
230
+ type: 'SyncStep',
231
+ hint: SyncStep,
232
+ default: {},
233
+ }
234
+
235
+ /**
236
+ * @param {Partial<StepsConfig>} [data]
237
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
238
+ */
239
+ constructor(data = {}, options = {}) {
240
+ super(data, options)
241
+ /** @type {IntentStep} Step 1: Intent (I) */
242
+ this.intent = data.intent instanceof IntentStep ? data.intent : new IntentStep(data.intent, options)
243
+ /** @type {KnowledgeStep} Step 2: Knowledge (K) */
244
+ this.knowledge =
245
+ data.knowledge instanceof KnowledgeStep ? data.knowledge : new KnowledgeStep(data.knowledge, options)
246
+ /** @type {ModelStep} Step 3: Model (M) */
247
+ this.model = data.model instanceof ModelStep ? data.model : new ModelStep(data.model, options)
248
+ /** @type {ContractStep} Step 4: Contract (C) */
249
+ this.contract =
250
+ data.contract instanceof ContractStep ? data.contract : new ContractStep(data.contract, options)
251
+ /** @type {BuildStep} Step 5: Build (B) */
252
+ this.build = data.build instanceof BuildStep ? data.build : new BuildStep(data.build, options)
253
+ /** @type {InspectStep} Step 6: Inspect (V) */
254
+ this.inspect =
255
+ data.inspect instanceof InspectStep ? data.inspect : new InspectStep(data.inspect, options)
256
+ /** @type {SyncStep} Step 7: Sync (S) */
257
+ this.sync = data.sync instanceof SyncStep ? data.sync : new SyncStep(data.sync, options)
258
+ }
259
+ }
@@ -0,0 +1,12 @@
1
+ export { default as NaN0WebConfig } from './NaN0WebConfig.js'
2
+ export { default as AgentEntryConfig } from './AgentEntryConfig.js'
3
+ export {
4
+ default as StepsConfig,
5
+ IntentStep,
6
+ KnowledgeStep,
7
+ ModelStep,
8
+ ContractStep,
9
+ BuildStep,
10
+ InspectStep,
11
+ SyncStep,
12
+ } from './StepsConfig.js'
package/src/index.js CHANGED
@@ -2,5 +2,17 @@ export { Model, ModelError } from '@nan0web/types'
2
2
  export { ProjectModel } from './ProjectModel.js'
3
3
  export { default as AppResult } from './AppResult.js'
4
4
  export { default as AppCore, default } from './AppCore.js'
5
+ export {
6
+ NaN0WebConfig,
7
+ AgentEntryConfig,
8
+ StepsConfig,
9
+ IntentStep,
10
+ KnowledgeStep,
11
+ ModelStep,
12
+ ContractStep,
13
+ BuildStep,
14
+ InspectStep,
15
+ SyncStep,
16
+ } from './domain/config/index.js'
5
17
 
6
18
  /** @typedef {import("./AppCore.js").Language} Language */
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Agent entry configuration inside nan0web.nan0.
3
+ */
4
+ export default class AgentEntryConfig extends Model {
5
+ static id: {
6
+ help: string;
7
+ default: string;
8
+ required: boolean;
9
+ };
10
+ static description: {
11
+ help: string;
12
+ default: string;
13
+ };
14
+ static workflows: {
15
+ help: string;
16
+ type: string;
17
+ default: never[];
18
+ };
19
+ static inspectors: {
20
+ help: string;
21
+ type: string;
22
+ default: never[];
23
+ };
24
+ /**
25
+ * @param {Partial<AgentEntryConfig>} [data]
26
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
27
+ */
28
+ constructor(data?: Partial<AgentEntryConfig>, options?: Partial<import("@nan0web/types").ModelOptions>);
29
+ /** @type {string} Unique agent identifier */
30
+ id: string;
31
+ /** @type {string} Short description of agent role */
32
+ description: string;
33
+ /** @type {string[]} List of workflow markdown paths */
34
+ workflows: string[];
35
+ /** @type {string[]} List of inspector markdown paths */
36
+ inspectors: string[];
37
+ }
38
+ import { Model } from '@nan0web/types';
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Unified NaN0Web configuration contract (Model-as-Schema) for nan0web.nan0.
3
+ * Combines CoCoDev 7-step config, package agents, and nan0web.app runtime settings.
4
+ */
5
+ export default class NaN0WebConfig extends Model {
6
+ static title: {
7
+ alias: string;
8
+ help: string;
9
+ default: string;
10
+ };
11
+ static appName: {
12
+ alias: string;
13
+ help: string;
14
+ placeholder: string;
15
+ default: string;
16
+ };
17
+ static dsn: {
18
+ help: string;
19
+ placeholder: string;
20
+ default: string;
21
+ };
22
+ static locale: {
23
+ help: string;
24
+ placeholder: string;
25
+ default: string;
26
+ };
27
+ static port: {
28
+ help: string;
29
+ placeholder: string;
30
+ default: number;
31
+ };
32
+ static theme: {
33
+ help: string;
34
+ placeholder: string;
35
+ default: string;
36
+ };
37
+ static aliases: {
38
+ help: string;
39
+ type: string;
40
+ default: {};
41
+ hidden: boolean;
42
+ };
43
+ static directoryIndex: {
44
+ help: string;
45
+ placeholder: string;
46
+ default: string;
47
+ };
48
+ static ui: {
49
+ help: string;
50
+ type: string;
51
+ default: never[];
52
+ };
53
+ static ssl: {
54
+ help: string;
55
+ type: string;
56
+ default: null;
57
+ hidden: boolean;
58
+ };
59
+ static log: {
60
+ help: string;
61
+ type: string;
62
+ default: {};
63
+ hidden: boolean;
64
+ };
65
+ static apps: {
66
+ help: string;
67
+ type: string;
68
+ hidden: boolean;
69
+ default: never[];
70
+ };
71
+ static agents: {
72
+ help: string;
73
+ type: string;
74
+ hint: typeof AgentEntryConfig;
75
+ default: never[];
76
+ };
77
+ static steps: {
78
+ help: string;
79
+ type: string;
80
+ hint: typeof StepsConfig;
81
+ default: {};
82
+ };
83
+ /**
84
+ * Loads and merges cascading nan0web.nan0 layers from a @nan0web/db instance.
85
+ * @param {import('@nan0web/db').default} db
86
+ * @param {{ layers?: string[] }} [options]
87
+ * @returns {Promise<NaN0WebConfig>}
88
+ */
89
+ static load(db: import("@nan0web/db").default, options?: {
90
+ layers?: string[];
91
+ }): Promise<NaN0WebConfig>;
92
+ /**
93
+ * @param {Partial<NaN0WebConfig>} [data]
94
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
95
+ */
96
+ constructor(data?: Partial<NaN0WebConfig>, options?: Partial<import("@nan0web/types").ModelOptions>);
97
+ /** @type {string} Package or workspace name */
98
+ title: string;
99
+ /** @type {string} Project name */
100
+ appName: string;
101
+ /** @type {string} Data Source Name (folder or connection string) */
102
+ dsn: string;
103
+ /** @type {string} Default locale */
104
+ locale: string;
105
+ /** @type {number} Server port */
106
+ port: number;
107
+ /** @type {string} UI theme (light | dark | auto) */
108
+ theme: string;
109
+ /** @type {Record<string, string>} Virtual URI aliases (source -> target) */
110
+ aliases: Record<string, string>;
111
+ /** @type {string} Directory index file name (index or README for git repos) */
112
+ directoryIndex: string;
113
+ /** @type {string[]} UI adapters to load */
114
+ ui: string[];
115
+ /** @type {object | null} TLS/SSL config for HTTPS — certificate and key paths */
116
+ ssl: object | null;
117
+ /** @type {Record<string, any>} Configuration for access and error logs */
118
+ log: Record<string, any>;
119
+ /** @type {Array<Record<string, any>>} Installed domain apps */
120
+ apps: Array<Record<string, any>>;
121
+ /** @type {AgentEntryConfig[]} Configured AI agents and their workflows/inspectors */
122
+ agents: AgentEntryConfig[];
123
+ /** @type {StepsConfig} CoCoDev 7-step configuration */
124
+ steps: StepsConfig;
125
+ }
126
+ import { Model } from '@nan0web/types';
127
+ import AgentEntryConfig from './AgentEntryConfig.js';
128
+ import StepsConfig from './StepsConfig.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,221 @@
1
+ /**
2
+ * Step 1: Intent (I) — goal and acceptance criteria (<= 7).
3
+ */
4
+ export class IntentStep extends Model {
5
+ static maxCriteria: {
6
+ help: string;
7
+ default: number;
8
+ };
9
+ static releaseDir: {
10
+ help: string;
11
+ default: string;
12
+ };
13
+ /**
14
+ * @param {Partial<IntentStep>} [data]
15
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
16
+ */
17
+ constructor(data?: Partial<IntentStep>, options?: Partial<import("@nan0web/types").ModelOptions>);
18
+ /** @type {number} Maximum number of acceptance criteria per task (<= 7) */
19
+ maxCriteria: number;
20
+ /** @type {string} Directory pattern for release artifacts */
21
+ releaseDir: string;
22
+ }
23
+ /**
24
+ * Step 2: Knowledge (K) — MCP-first research & targetFiles whitelist.
25
+ */
26
+ export class KnowledgeStep extends Model {
27
+ static preferMcp: {
28
+ help: string;
29
+ default: boolean;
30
+ };
31
+ static requireTargetFiles: {
32
+ help: string;
33
+ default: boolean;
34
+ };
35
+ /**
36
+ * @param {Partial<KnowledgeStep>} [data]
37
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
38
+ */
39
+ constructor(data?: Partial<KnowledgeStep>, options?: Partial<import("@nan0web/types").ModelOptions>);
40
+ /** @type {boolean} Prefer active MCP servers before grep/read_file */
41
+ preferMcp: boolean;
42
+ /** @type {boolean} Require explicit targetFiles whitelist before code changes */
43
+ requireTargetFiles: boolean;
44
+ }
45
+ /**
46
+ * Step 3: Model (M) — pure Model-as-Schema / ModelAsApp domain design.
47
+ */
48
+ export class ModelStep extends Model {
49
+ static pureDomain: {
50
+ help: string;
51
+ default: boolean;
52
+ };
53
+ static dbMount: {
54
+ help: string;
55
+ default: boolean;
56
+ };
57
+ /**
58
+ * @param {Partial<ModelStep>} [data]
59
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
60
+ */
61
+ constructor(data?: Partial<ModelStep>, options?: Partial<import("@nan0web/types").ModelOptions>);
62
+ /** @type {boolean} Enforce pure domain models without OS/UI coupling */
63
+ pureDomain: boolean;
64
+ /** @type {boolean} Use virtual DB mounts (this.$db) for all I/O */
65
+ dbMount: boolean;
66
+ }
67
+ /**
68
+ * Step 4: Contract (C) — TDD contract tests on In-Memory @nan0web/db.
69
+ */
70
+ export class ContractStep extends Model {
71
+ static inMemoryDb: {
72
+ help: string;
73
+ default: boolean;
74
+ };
75
+ /**
76
+ * @param {Partial<ContractStep>} [data]
77
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
78
+ */
79
+ constructor(data?: Partial<ContractStep>, options?: Partial<import("@nan0web/types").ModelOptions>);
80
+ /** @type {boolean} Run scenario/contract tests against In-Memory @nan0web/db */
81
+ inMemoryDb: boolean;
82
+ }
83
+ /**
84
+ * Step 5: Build (B) — minimal clean implementation.
85
+ */
86
+ export class BuildStep extends Model {
87
+ static forbidDirectFs: {
88
+ help: string;
89
+ default: boolean;
90
+ };
91
+ static forbidDbExtensions: {
92
+ help: string;
93
+ default: boolean;
94
+ };
95
+ /**
96
+ * @param {Partial<BuildStep>} [data]
97
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
98
+ */
99
+ constructor(data?: Partial<BuildStep>, options?: Partial<import("@nan0web/types").ModelOptions>);
100
+ /** @type {boolean} Forbid direct fs/path/os/process usage in domain code */
101
+ forbidDirectFs: boolean;
102
+ /** @type {boolean} Forbid explicit file extensions in saveDocument/loadDocument */
103
+ forbidDbExtensions: boolean;
104
+ }
105
+ /**
106
+ * Step 6: Inspect (V) — automated verification & scope isolation.
107
+ */
108
+ export class InspectStep extends Model {
109
+ static runTests: {
110
+ help: string;
111
+ default: boolean;
112
+ };
113
+ static runInspect: {
114
+ help: string;
115
+ default: boolean;
116
+ };
117
+ static checkScope: {
118
+ help: string;
119
+ default: boolean;
120
+ };
121
+ /**
122
+ * @param {Partial<InspectStep>} [data]
123
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
124
+ */
125
+ constructor(data?: Partial<InspectStep>, options?: Partial<import("@nan0web/types").ModelOptions>);
126
+ /** @type {boolean} Run test:all before completion */
127
+ runTests: boolean;
128
+ /** @type {boolean} Run nan0inspect domain audit before completion */
129
+ runInspect: boolean;
130
+ /** @type {boolean} Verify git diff stays within declared targetFiles */
131
+ checkScope: boolean;
132
+ }
133
+ /**
134
+ * Step 7: Sync (S) — release cycle, knowledge index & backlog sync.
135
+ */
136
+ export class SyncStep extends Model {
137
+ static updateIndex: {
138
+ help: string;
139
+ default: boolean;
140
+ };
141
+ static updateBacklog: {
142
+ help: string;
143
+ default: boolean;
144
+ };
145
+ /**
146
+ * @param {Partial<SyncStep>} [data]
147
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
148
+ */
149
+ constructor(data?: Partial<SyncStep>, options?: Partial<import("@nan0web/types").ModelOptions>);
150
+ /** @type {boolean} Update nan0web-knowledge index (pnpm run ai:index) */
151
+ updateIndex: boolean;
152
+ /** @type {boolean} Record discovered gaps in releases/backlog.md */
153
+ updateBacklog: boolean;
154
+ }
155
+ /**
156
+ * 7-step CoCoDev configuration container.
157
+ */
158
+ export default class StepsConfig extends Model {
159
+ static intent: {
160
+ help: string;
161
+ type: string;
162
+ hint: typeof IntentStep;
163
+ default: {};
164
+ };
165
+ static knowledge: {
166
+ help: string;
167
+ type: string;
168
+ hint: typeof KnowledgeStep;
169
+ default: {};
170
+ };
171
+ static model: {
172
+ help: string;
173
+ type: string;
174
+ hint: typeof ModelStep;
175
+ default: {};
176
+ };
177
+ static contract: {
178
+ help: string;
179
+ type: string;
180
+ hint: typeof ContractStep;
181
+ default: {};
182
+ };
183
+ static build: {
184
+ help: string;
185
+ type: string;
186
+ hint: typeof BuildStep;
187
+ default: {};
188
+ };
189
+ static inspect: {
190
+ help: string;
191
+ type: string;
192
+ hint: typeof InspectStep;
193
+ default: {};
194
+ };
195
+ static sync: {
196
+ help: string;
197
+ type: string;
198
+ hint: typeof SyncStep;
199
+ default: {};
200
+ };
201
+ /**
202
+ * @param {Partial<StepsConfig>} [data]
203
+ * @param {Partial<import('@nan0web/types').ModelOptions>} [options]
204
+ */
205
+ constructor(data?: Partial<StepsConfig>, options?: Partial<import("@nan0web/types").ModelOptions>);
206
+ /** @type {IntentStep} Step 1: Intent (I) */
207
+ intent: IntentStep;
208
+ /** @type {KnowledgeStep} Step 2: Knowledge (K) */
209
+ knowledge: KnowledgeStep;
210
+ /** @type {ModelStep} Step 3: Model (M) */
211
+ model: ModelStep;
212
+ /** @type {ContractStep} Step 4: Contract (C) */
213
+ contract: ContractStep;
214
+ /** @type {BuildStep} Step 5: Build (B) */
215
+ build: BuildStep;
216
+ /** @type {InspectStep} Step 6: Inspect (V) */
217
+ inspect: InspectStep;
218
+ /** @type {SyncStep} Step 7: Sync (S) */
219
+ sync: SyncStep;
220
+ }
221
+ import { Model } from '@nan0web/types';
@@ -0,0 +1,3 @@
1
+ export { default as NaN0WebConfig } from "./NaN0WebConfig.js";
2
+ export { default as AgentEntryConfig } from "./AgentEntryConfig.js";
3
+ export { default as StepsConfig, IntentStep, KnowledgeStep, ModelStep, ContractStep, BuildStep, InspectStep, SyncStep } from "./StepsConfig.js";
package/types/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export { default as AppResult } from "./AppResult.js";
3
3
  export type Language = import("./AppCore.js").Language;
4
4
  export { Model, ModelError } from "@nan0web/types";
5
5
  export { default as AppCore, default } from "./AppCore.js";
6
+ export { NaN0WebConfig, AgentEntryConfig, StepsConfig, IntentStep, KnowledgeStep, ModelStep, ContractStep, BuildStep, InspectStep, SyncStep } from "./domain/config/index.js";