@njeybe/nativ 2.5.1 → 2.6.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +29 -4
  3. package/dist/commands/init.js +2 -10
  4. package/dist/commands/notify.d.ts +2 -0
  5. package/dist/commands/notify.js +25 -0
  6. package/dist/commands/session.d.ts +22 -0
  7. package/dist/commands/session.js +106 -0
  8. package/dist/commands/task/task-add.js +1 -1
  9. package/dist/commands/task/task-common.js +6 -6
  10. package/dist/commands/task/task-escalate.js +8 -10
  11. package/dist/commands/task/task-lifecycle.d.ts +7 -1
  12. package/dist/commands/task/task-lifecycle.js +30 -5
  13. package/dist/commands/task/task-query.d.ts +2 -0
  14. package/dist/commands/task/task-query.js +27 -12
  15. package/dist/commands/task/task-reclaim.d.ts +20 -0
  16. package/dist/commands/task/task-reclaim.js +87 -0
  17. package/dist/commands/task.d.ts +2 -0
  18. package/dist/commands/task.js +1 -0
  19. package/dist/commands/triage.js +3 -3
  20. package/dist/commands/validate.js +1 -0
  21. package/dist/commands/verify.js +21 -5
  22. package/dist/core/enforcement.js +18 -17
  23. package/dist/core/lock-manager.d.ts +6 -0
  24. package/dist/core/lock-manager.js +50 -41
  25. package/dist/core/notify.d.ts +38 -0
  26. package/dist/core/notify.js +133 -0
  27. package/dist/core/profiles.js +7 -16
  28. package/dist/core/session-memory.d.ts +42 -0
  29. package/dist/core/session-memory.js +121 -0
  30. package/dist/core/setup/pm-playbook.d.ts +5 -0
  31. package/dist/core/setup/pm-playbook.js +26 -0
  32. package/dist/core/setup/session-context.js +35 -2
  33. package/dist/core/setup/setup-planner.js +2 -2
  34. package/dist/core/setup/types.d.ts +2 -0
  35. package/dist/core/setup/types.js +5 -1
  36. package/dist/core/task-claims.d.ts +15 -0
  37. package/dist/core/task-claims.js +32 -0
  38. package/dist/core/tier1-liaison.d.ts +1 -0
  39. package/dist/core/tier1-liaison.js +25 -27
  40. package/dist/core/verifier/output-digest.d.ts +19 -0
  41. package/dist/core/verifier/output-digest.js +48 -0
  42. package/dist/db/data-engine.js +33 -32
  43. package/dist/db/introspector.js +61 -60
  44. package/dist/db/sqlite.d.ts +3 -0
  45. package/dist/db/sqlite.js +10 -0
  46. package/dist/governor/circuit-breaker.js +12 -0
  47. package/dist/governor/patch-applier.d.ts +1 -0
  48. package/dist/governor/patch-applier.js +3 -7
  49. package/dist/index.js +29 -6
  50. package/dist/mcp/server.d.ts +1 -1
  51. package/dist/mcp/server.js +53 -14
  52. package/dist/providers/claude-api.js +3 -0
  53. package/dist/providers/gemini.js +4 -1
  54. package/dist/providers/registry.d.ts +6 -2
  55. package/dist/providers/registry.js +28 -16
  56. package/dist/providers/types.d.ts +4 -1
  57. package/dist/runner/agent-supervisor.js +2 -2
  58. package/dist/runner/cli-config.js +1 -1
  59. package/dist/scanner/types.d.ts +5 -1
  60. package/dist/scanner/types.js +7 -0
  61. package/dist/server/routes/task-routes.d.ts +2 -0
  62. package/dist/server/routes/triage-routes.js +3 -18
  63. package/package.json +2 -2
  64. package/plugin/.claude-plugin/plugin.json +1 -1
  65. package/plugin/agents/architect.md +1 -1
  66. package/plugin/agents/explorer.md +1 -1
  67. package/plugin/agents/verifier.md +2 -2
  68. package/plugin/agents/worker.md +5 -7
  69. package/plugin/skills/nativ/SKILL.md +36 -49
  70. package/templates/AGENTS.md +36 -49
  71. package/templates/CLAUDE.md +1 -41
  72. package/templates/claude-agents/architect.md +1 -1
  73. package/templates/claude-agents/explorer.md +1 -1
  74. package/templates/claude-agents/verifier.md +2 -2
  75. package/templates/claude-agents/worker.md +5 -7
  76. package/templates/dot-ai/api_contracts.json +66 -66
  77. package/templates/dot-ai/context.md +38 -38
  78. package/templates/dot-ai/db_schema.json +39 -39
@@ -1,23 +1,22 @@
1
1
  ---
2
2
  name: worker
3
3
  description: Implements exactly one nativ task inside its targetFiles and verifies it. Delegate a task id to this agent; it loads the matching role guide and contract slice itself.
4
- tools: Read, Grep, Glob, Edit, Write, Bash, mcp__nativ
4
+ tools: Read, Grep, Glob, Edit, Write, Bash, mcp__nativ__nativ_task_next, mcp__nativ__nativ_task_start, mcp__nativ__nativ_task_complete, mcp__nativ__nativ_task_block, mcp__nativ__nativ_task_escalate, mcp__nativ__nativ_task_propose_patch, mcp__nativ__nativ_learn_propose
5
5
  model: sonnet
6
6
  effort: low
7
7
  maxTurns: 20
8
8
  ---
9
9
 
10
- You are a **Worker** in a nativ workflow. Read `AGENTS.md` first; it defines every role and the task loop.
10
+ You are a **Worker** in a nativ workflow. `AGENTS.md` defines every role and the task loop. It is already in your context through `CLAUDE.md`; open it only if it is not.
11
11
 
12
12
  You are given one task id. Do that task and nothing else.
13
13
 
14
14
  ## Steps
15
15
 
16
16
  1. `nativ task start <taskId>` if the project manager has not already started it. Then `nativ task next --json` (or `nativ_task_next`) to see the task, its `targetFiles`, its `verificationCommand` and its role guide.
17
- 2. Load only what the task needs: `.ai/subagents/<assignedSubagent>.md` and the contract slice `AGENTS.md` lists for that role. If the task has `specSlices`, read those first. Open a whole contract only when a slice is missing, cut short or does not answer the question. If it has `priorEscalations`, follow how each was settled; do not raise a settled gap again. If it has `learnings`, follow them.
18
- 3. Change **only** the files in `targetFiles`. Match the style of the surrounding code and follow the contracts exactly: table and column names, routes and schemas, design tokens.
19
- Follow the `## Code style` rules in `AGENTS.md`: short lines, small functions, one UI component per file, brief plain comments.
20
- Ensure UI components are pure, props-driven, and reusable. Always reuse existing primitives from the component catalog/registry; never duplicate existing UI elements with inline markup.
17
+ 2. Load only what the task needs, in the order `AGENTS.md` "Orientation" gives. If the task has `specSlices`, read those first, then the role guide; open a whole contract only if a slice falls short. Follow `priorEscalations` and `learnings`.
18
+ 3. Change **only** the files in `targetFiles`. Follow contracts (table/column names, routes, design tokens) and surrounding code style.
19
+ Follow `## Code style` in `AGENTS.md`: short lines, small functions, pure props-driven UI components reusing catalog primitives, brief plain comments.
21
20
  4. Run the `verificationCommand`. If it fails, fix the cause and run it again. You have three fix attempts.
22
21
  5. If it still fails: `git checkout -- <targetFiles>`, then `nativ task block <taskId> --reason "Verification failed after 3 attempts: <short error>"`, then stop and report.
23
22
  6. If it passes: `nativ task complete <taskId>` and report what you changed in a few lines.
@@ -28,4 +27,3 @@ You are given one task id. Do that task and nothing else.
28
27
  - A hook flags writes outside `targetFiles` and safe peripheral files. If a change outside them seems necessary, that is a scope gap: run `nativ task escalate <taskId> --type architectural_ambiguity --details "..."` and stop.
29
28
  - Never edit anything under `.ai/` directly. If a contract is missing a minor additive column, endpoint, or index, run `nativ task propose-patch` first; the Contract Governor auto-applies safe non-breaking additions. Only escalate if the change is destructive or ambiguous.
30
29
  - Never read or write `.env*` files or other secrets. Do not use `nativ task unlock`, `nativ db sync` or `--no-verify`.
31
-
@@ -1,66 +1,66 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "version": "1.0.0",
4
- "projectName": "{{PROJECT_NAME}}",
5
- "updatedAt": "{{TIMESTAMP}}",
6
- "baseUrl": "/api/v1",
7
- "authScheme": "Bearer JWT",
8
- "endpoints": [
9
- {
10
- "id": "health-check",
11
- "path": "/health",
12
- "method": "GET",
13
- "description": "System health and runtime status check",
14
- "auth": false,
15
- "request": {
16
- "headers": {},
17
- "queryParams": {},
18
- "pathParams": {},
19
- "body": null
20
- },
21
- "responses": {
22
- "200": {
23
- "description": "System is healthy and operational",
24
- "body": {
25
- "status": "ok",
26
- "uptime": "number",
27
- "timestamp": "string"
28
- }
29
- }
30
- }
31
- },
32
- {
33
- "id": "example-entity-list",
34
- "path": "/entities",
35
- "method": "GET",
36
- "description": "Demonstration collection endpoint. The architect updates this during Phase 1 API design.",
37
- "auth": true,
38
- "request": {
39
- "headers": {
40
- "Authorization": "Bearer <token>"
41
- },
42
- "queryParams": {
43
- "limit": "integer (optional, default 20)",
44
- "offset": "integer (optional, default 0)"
45
- },
46
- "pathParams": {},
47
- "body": null
48
- },
49
- "responses": {
50
- "200": {
51
- "description": "List of entities matching query filter",
52
- "body": {
53
- "data": "array of example_entity",
54
- "total": "integer"
55
- }
56
- },
57
- "401": {
58
- "description": "Unauthorized access missing or invalid token",
59
- "body": {
60
- "error": "Unauthorized"
61
- }
62
- }
63
- }
64
- }
65
- ]
66
- }
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "version": "1.0.0",
4
+ "projectName": "{{PROJECT_NAME}}",
5
+ "updatedAt": "{{TIMESTAMP}}",
6
+ "baseUrl": "/api/v1",
7
+ "authScheme": "Bearer JWT",
8
+ "endpoints": [
9
+ {
10
+ "id": "health-check",
11
+ "path": "/health",
12
+ "method": "GET",
13
+ "description": "System health and runtime status check",
14
+ "auth": false,
15
+ "request": {
16
+ "headers": {},
17
+ "queryParams": {},
18
+ "pathParams": {},
19
+ "body": null
20
+ },
21
+ "responses": {
22
+ "200": {
23
+ "description": "System is healthy and operational",
24
+ "body": {
25
+ "status": "ok",
26
+ "uptime": "number",
27
+ "timestamp": "string"
28
+ }
29
+ }
30
+ }
31
+ },
32
+ {
33
+ "id": "example-entity-list",
34
+ "path": "/entities",
35
+ "method": "GET",
36
+ "description": "Demonstration collection endpoint. The architect updates this during Phase 1 API design.",
37
+ "auth": true,
38
+ "request": {
39
+ "headers": {
40
+ "Authorization": "Bearer <token>"
41
+ },
42
+ "queryParams": {
43
+ "limit": "integer (optional, default 20)",
44
+ "offset": "integer (optional, default 0)"
45
+ },
46
+ "pathParams": {},
47
+ "body": null
48
+ },
49
+ "responses": {
50
+ "200": {
51
+ "description": "List of entities matching query filter",
52
+ "body": {
53
+ "data": "array of example_entity",
54
+ "total": "integer"
55
+ }
56
+ },
57
+ "401": {
58
+ "description": "Unauthorized access missing or invalid token",
59
+ "body": {
60
+ "error": "Unauthorized"
61
+ }
62
+ }
63
+ }
64
+ }
65
+ ]
66
+ }
@@ -1,38 +1,38 @@
1
- # Project Context & Guardrails
2
-
3
- ## 1. System Overview & Repository Profile
4
- - **Project Name:** {{PROJECT_NAME}}
5
- - **Repository Type:** {{REPOSITORY_TYPE}}
6
- - **Workspace Topology:** {{WORKSPACE_TOPOLOGY}}
7
- - **Primary Goal:** {{PROJECT_GOAL}}
8
-
9
- ## 2. Technology Stack & Ecosystem Manifests
10
- - **Language / Runtime:** {{DETECTED_RUNTIME}}
11
- - **Framework:** {{DETECTED_FRAMEWORK}}
12
- - **Database / ORM:** {{DETECTED_DATABASE_ORM}}
13
- - **ORM / Migration Config:** {{DETECTED_ORM_CONFIG}}
14
- - **Styling / UI Library:** {{DETECTED_STYLING}}
15
- - **Testing Framework:** {{DETECTED_TESTING}}
16
- - **Package Manager:** {{DETECTED_PACKAGE_MANAGER}}
17
- - **Discovered Manifests:** {{ECOSYSTEM_MANIFESTS}}
18
-
19
- ## 3. Architecture & Codebase Layout
20
- - **Source Root:** `{{SOURCE_ROOT}}`
21
- - **Core Pattern:** {{ARCHITECTURE_PATTERN}}
22
- - **Key Directories:**
23
- {{KEY_DIRECTORIES}}
24
-
25
- ## 4. Engineering Guardrails & Constraints
26
- 1. **Strict Role Pipeline (provider-agnostic):** Architect (designs contracts and resolves escalations) -> Project Manager (orchestrates the task loop) -> Workers (specialized sub-agents) -> Verifier (independent checks). Roles are fixed; the model or vendor behind a role is configurable. Claude Code is the default host for every role, and other agents can be plugged in.
27
- 2. **Zero Breaking Changes:** Avoid breaking existing public interfaces, CLI options, or database contracts without explicit migration strategies.
28
- 3. **Schema Authority:** Database modifications must strictly align with `.ai/db_schema.json`.
29
- 4. **UI Fidelity:** User interface components must strictly match `.ai/ui_specs.md`.
30
- 5. **Secrets & Security:** Never hardcode API keys, passwords, or tokens. Use environment variables. Validate all external inputs.
31
- 6. **Testing Requirement:** Every newly introduced endpoint, service, or complex component must include automated tests before marking tasks completed in `.ai/master_plan.json`.
32
-
33
- ## 5. Execution Boundaries (Sub-Agent Allocation)
34
- - **`backend`:** Core services, CLI logic, APIs, server runtime code, and route handlers.
35
- - **`frontend`:** Web application views, client components, or terminal UI presentation.
36
- - **`database`:** Schema definitions, ORM models, migrations, and seed scripts matching `.ai/db_schema.json`.
37
- - **`qa-tester`:** Unit tests, integration tests, and verification scripts.
38
- - **Specialized Units:** `flutter-developer`, `devops-agent`, `security-auditor`, `db-migration` when required.
1
+ # Project Context & Guardrails
2
+
3
+ ## 1. System Overview & Repository Profile
4
+ - **Project Name:** {{PROJECT_NAME}}
5
+ - **Repository Type:** {{REPOSITORY_TYPE}}
6
+ - **Workspace Topology:** {{WORKSPACE_TOPOLOGY}}
7
+ - **Primary Goal:** {{PROJECT_GOAL}}
8
+
9
+ ## 2. Technology Stack & Ecosystem Manifests
10
+ - **Language / Runtime:** {{DETECTED_RUNTIME}}
11
+ - **Framework:** {{DETECTED_FRAMEWORK}}
12
+ - **Database / ORM:** {{DETECTED_DATABASE_ORM}}
13
+ - **ORM / Migration Config:** {{DETECTED_ORM_CONFIG}}
14
+ - **Styling / UI Library:** {{DETECTED_STYLING}}
15
+ - **Testing Framework:** {{DETECTED_TESTING}}
16
+ - **Package Manager:** {{DETECTED_PACKAGE_MANAGER}}
17
+ - **Discovered Manifests:** {{ECOSYSTEM_MANIFESTS}}
18
+
19
+ ## 3. Architecture & Codebase Layout
20
+ - **Source Root:** `{{SOURCE_ROOT}}`
21
+ - **Core Pattern:** {{ARCHITECTURE_PATTERN}}
22
+ - **Key Directories:**
23
+ {{KEY_DIRECTORIES}}
24
+
25
+ ## 4. Engineering Guardrails & Constraints
26
+ 1. **Strict Role Pipeline (provider-agnostic):** Architect (designs contracts and resolves escalations) -> Project Manager (orchestrates the task loop) -> Workers (specialized sub-agents) -> Verifier (independent checks). Roles are fixed; the model or vendor behind a role is configurable. Claude Code is the default host for every role, and other agents can be plugged in.
27
+ 2. **Zero Breaking Changes:** Avoid breaking existing public interfaces, CLI options, or database contracts without explicit migration strategies.
28
+ 3. **Schema Authority:** Database modifications must strictly align with `.ai/db_schema.json`.
29
+ 4. **UI Fidelity:** User interface components must strictly match `.ai/ui_specs.md`.
30
+ 5. **Secrets & Security:** Never hardcode API keys, passwords, or tokens. Use environment variables. Validate all external inputs.
31
+ 6. **Testing Requirement:** Every newly introduced endpoint, service, or complex component must include automated tests before marking tasks completed in `.ai/master_plan.json`.
32
+
33
+ ## 5. Execution Boundaries (Sub-Agent Allocation)
34
+ - **`backend`:** Core services, CLI logic, APIs, server runtime code, and route handlers.
35
+ - **`frontend`:** Web application views, client components, or terminal UI presentation.
36
+ - **`database`:** Schema definitions, ORM models, migrations, and seed scripts matching `.ai/db_schema.json`.
37
+ - **`qa-tester`:** Unit tests, integration tests, and verification scripts.
38
+ - **Specialized Units:** `flutter-developer`, `devops-agent`, `security-auditor`, `db-migration` when required.
@@ -1,39 +1,39 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "version": "1.0.0",
4
- "projectName": "{{PROJECT_NAME}}",
5
- "updatedAt": "{{TIMESTAMP}}",
6
- "engine": "{{DETECTED_DATABASE_ENGINE}}",
7
- "tables": [
8
- {
9
- "name": "example_entity",
10
- "description": "Demonstration table definition. The architect updates this during Phase 1A.",
11
- "columns": [
12
- {
13
- "name": "id",
14
- "type": "UUID",
15
- "primaryKey": true,
16
- "nullable": false,
17
- "default": "gen_random_uuid()"
18
- },
19
- {
20
- "name": "created_at",
21
- "type": "TIMESTAMP",
22
- "primaryKey": false,
23
- "nullable": false,
24
- "default": "NOW()"
25
- },
26
- {
27
- "name": "updated_at",
28
- "type": "TIMESTAMP",
29
- "primaryKey": false,
30
- "nullable": false,
31
- "default": "NOW()"
32
- }
33
- ],
34
- "indexes": [],
35
- "foreignKeys": []
36
- }
37
- ],
38
- "migrations": []
39
- }
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "version": "1.0.0",
4
+ "projectName": "{{PROJECT_NAME}}",
5
+ "updatedAt": "{{TIMESTAMP}}",
6
+ "engine": "{{DETECTED_DATABASE_ENGINE}}",
7
+ "tables": [
8
+ {
9
+ "name": "example_entity",
10
+ "description": "Demonstration table definition. The architect updates this during Phase 1A.",
11
+ "columns": [
12
+ {
13
+ "name": "id",
14
+ "type": "UUID",
15
+ "primaryKey": true,
16
+ "nullable": false,
17
+ "default": "gen_random_uuid()"
18
+ },
19
+ {
20
+ "name": "created_at",
21
+ "type": "TIMESTAMP",
22
+ "primaryKey": false,
23
+ "nullable": false,
24
+ "default": "NOW()"
25
+ },
26
+ {
27
+ "name": "updated_at",
28
+ "type": "TIMESTAMP",
29
+ "primaryKey": false,
30
+ "nullable": false,
31
+ "default": "NOW()"
32
+ }
33
+ ],
34
+ "indexes": [],
35
+ "foreignKeys": []
36
+ }
37
+ ],
38
+ "migrations": []
39
+ }