zenkit 0.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/CONTRIBUTING.md +63 -0
- package/LICENSE +21 -0
- package/README.md +242 -0
- package/agents/backend-architect.md +19 -0
- package/agents/frontend-architect.md +19 -0
- package/agents/implementation-auditor.md +19 -0
- package/agents/product-manager.md +19 -0
- package/agents/qa-test-engineer.md +19 -0
- package/agents/security-specialist.md +19 -0
- package/agents/system-architect.md +19 -0
- package/agents/technical-writer.md +19 -0
- package/agents/ux-engineer.md +19 -0
- package/benchmark/feature-specs/cli-tool.json +58 -0
- package/benchmark/feature-specs/handoff-system.json +69 -0
- package/benchmark/feature-specs/protocol-completeness.json +85 -0
- package/benchmark/feature-specs/schema-validator-baseline.json +93 -0
- package/benchmark/feature-specs/schema-validator-playground.json +92 -0
- package/benchmark/feature-specs/self-audit.json +76 -0
- package/benchmark/fixtures/valid-handoff.json +13 -0
- package/benchmark/scripts/compare.ts +172 -0
- package/benchmark/scripts/report.ts +102 -0
- package/benchmark/scripts/run-all.ts +125 -0
- package/benchmark/scripts/run.ts +595 -0
- package/benchmark/scripts/visualize.ts +120 -0
- package/bin/zenkit.js +24 -0
- package/commands/audit.md +28 -0
- package/commands/build.md +26 -0
- package/commands/checkpoint.md +28 -0
- package/commands/handoff.md +28 -0
- package/commands/plan.md +27 -0
- package/commands/refactor.md +27 -0
- package/commands/ship.md +28 -0
- package/commands/spec.md +26 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +174 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +765 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +121 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/audit.schema.json +63 -0
- package/dist/schemas/benchmark.schema.json +118 -0
- package/dist/schemas/checkpoint.schema.json +64 -0
- package/dist/schemas/feature-spec.schema.json +76 -0
- package/dist/schemas/handoff.schema.json +78 -0
- package/dist/schemas/schemas/audit.schema.json +63 -0
- package/dist/schemas/schemas/benchmark.schema.json +118 -0
- package/dist/schemas/schemas/checkpoint.schema.json +64 -0
- package/dist/schemas/schemas/feature-spec.schema.json +76 -0
- package/dist/schemas/schemas/handoff.schema.json +78 -0
- package/dist/schemas/schemas/task.schema.json +69 -0
- package/dist/schemas/task.schema.json +69 -0
- package/docs/agent-contract.md +36 -0
- package/docs/architecture.md +88 -0
- package/docs/benchmarking.md +51 -0
- package/docs/command-model.md +43 -0
- package/docs/philosophy.md +35 -0
- package/docs/roadmap.md +43 -0
- package/docs/self-audit.md +29 -0
- package/hooks/post-change.md +30 -0
- package/hooks/pre-change.md +27 -0
- package/hooks/pre-ship.md +30 -0
- package/package.json +92 -0
- package/rubrics/architectural-alignment.md +26 -0
- package/rubrics/execution-quality.md +26 -0
- package/rubrics/verbosity-score.md +26 -0
- package/schemas/audit.schema.json +63 -0
- package/schemas/benchmark.schema.json +118 -0
- package/schemas/checkpoint.schema.json +64 -0
- package/schemas/feature-spec.schema.json +76 -0
- package/schemas/handoff.schema.json +78 -0
- package/schemas/task.schema.json +69 -0
- package/skills/architecture-review.md +17 -0
- package/skills/backend-change.md +17 -0
- package/skills/bug-triage.md +17 -0
- package/skills/frontend-change.md +17 -0
- package/skills/prompt-pruning.md +17 -0
- package/skills/release-check.md +17 -0
- package/skills/security-review.md +17 -0
- package/templates/agent.template.md +18 -0
- package/templates/command.template.md +21 -0
- package/templates/skill.template.md +15 -0
- package/templates/task.template.md +19 -0
package/bin/zenkit.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ZenKit CLI wrapper
|
|
5
|
+
*
|
|
6
|
+
* When installed from npm, this runs the compiled CLI.
|
|
7
|
+
* During development, use `npx tsx bin/zenkit.ts` directly.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// Try compiled version first (npm install), fall back to tsx (development)
|
|
11
|
+
try {
|
|
12
|
+
require('../dist/cli.js')
|
|
13
|
+
} catch {
|
|
14
|
+
const { execSync } = require('child_process')
|
|
15
|
+
const args = process.argv.slice(2).join(' ')
|
|
16
|
+
try {
|
|
17
|
+
execSync(`npx tsx ${__dirname}/zenkit.ts ${args}`, {
|
|
18
|
+
stdio: 'inherit',
|
|
19
|
+
cwd: process.cwd(),
|
|
20
|
+
})
|
|
21
|
+
} catch (err) {
|
|
22
|
+
process.exit(err.status || 1)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# /audit
|
|
2
|
+
|
|
3
|
+
> Review implemented work for correctness, security, style, and architectural alignment.
|
|
4
|
+
|
|
5
|
+
**Position:** spec → plan → build → **audit** → checkpoint → ship
|
|
6
|
+
**Input:** Code changes (diff or file list) from `/build` or `/refactor`. Original plan/spec for comparison. Project coding standards and architectural guidelines.
|
|
7
|
+
**Output:** Structured per ZenKit contract (context, assumptions, constraints, decision, deliverable, risks, open_questions, next_agent).
|
|
8
|
+
|
|
9
|
+
**When to use:**
|
|
10
|
+
- After `/build` completes and before `/ship`
|
|
11
|
+
- Reviewing a pull request or merge request
|
|
12
|
+
- Verifying a refactor preserved behavior
|
|
13
|
+
- Periodic health check on a module or subsystem
|
|
14
|
+
|
|
15
|
+
**Example:**
|
|
16
|
+
```
|
|
17
|
+
> /audit build:rate-limit-output.json
|
|
18
|
+
|
|
19
|
+
context: Auditing rate-limit middleware implementation...
|
|
20
|
+
decision: pass-with-caveats
|
|
21
|
+
deliverable:
|
|
22
|
+
rubric: { correctness: 9/10, security: 8/10, style: 10/10, coverage: 8/10 }
|
|
23
|
+
findings:
|
|
24
|
+
- [medium/security] Rate limit key from X-Forwarded-For; spoofable behind some proxies.
|
|
25
|
+
- [low/coverage] No test for Redis connection failure path.
|
|
26
|
+
risks: Medium-severity finding should be addressed before production deploy.
|
|
27
|
+
next_agent: /build (to address medium finding), then /ship
|
|
28
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# /build
|
|
2
|
+
|
|
3
|
+
> Implement the planned work — translate tasks and acceptance criteria into working code.
|
|
4
|
+
|
|
5
|
+
**Position:** spec → plan → **build** → audit → checkpoint → ship
|
|
6
|
+
**Input:** A plan (from `/plan`) with ordered tasks and acceptance criteria. Access to relevant codebase and environment. Configuration or environment details needed for implementation.
|
|
7
|
+
**Output:** Structured per ZenKit contract (context, assumptions, constraints, decision, deliverable, risks, open_questions, next_agent).
|
|
8
|
+
|
|
9
|
+
**When to use:**
|
|
10
|
+
- After `/plan` has produced an approved task list
|
|
11
|
+
- Implementing a feature, bug fix, or infrastructure change
|
|
12
|
+
- Scope and acceptance criteria are already defined
|
|
13
|
+
|
|
14
|
+
**Example:**
|
|
15
|
+
```
|
|
16
|
+
> /build plan:rate-limit-plan.json
|
|
17
|
+
|
|
18
|
+
context: Implementing rate limiting per the approved plan...
|
|
19
|
+
decision: Used sliding-window counter instead of token bucket (simpler, meets latency target).
|
|
20
|
+
deliverable:
|
|
21
|
+
- task: Add rate-limit middleware | status: pass
|
|
22
|
+
files_changed: [src/middleware/rate-limit.ts (new), src/middleware/index.ts]
|
|
23
|
+
validation: All 12 new tests pass; p99 latency +2ms.
|
|
24
|
+
risks: Sliding window is approximate; may allow brief bursts above limit.
|
|
25
|
+
next_agent: /audit
|
|
26
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# /checkpoint
|
|
2
|
+
|
|
3
|
+
> Save a snapshot of workflow state for rollback or resumption.
|
|
4
|
+
|
|
5
|
+
**Position:** Inserted between any two stages — does not advance the workflow
|
|
6
|
+
**Input:** Current workflow state and stage identifier. All artifacts produced so far. Git state (branch, commit SHA, dirty files). Optional: label or tag.
|
|
7
|
+
**Output:** Structured per ZenKit contract (context, assumptions, constraints, decision, deliverable, risks, open_questions, next_agent).
|
|
8
|
+
|
|
9
|
+
**When to use:**
|
|
10
|
+
- Between major lifecycle stages (e.g., after `/plan` before `/build`)
|
|
11
|
+
- Before a risky or irreversible operation
|
|
12
|
+
- Pausing work that will be resumed later
|
|
13
|
+
- After a successful `/audit` to lock in a known-good state
|
|
14
|
+
|
|
15
|
+
**Example:**
|
|
16
|
+
```
|
|
17
|
+
> /checkpoint --label "post-plan-approved"
|
|
18
|
+
|
|
19
|
+
context: Plan for rate-limit feature approved. Checkpointing before build.
|
|
20
|
+
decision: Routine pre-build checkpoint.
|
|
21
|
+
deliverable:
|
|
22
|
+
snapshot:
|
|
23
|
+
label: post-plan-approved | git_sha: a1b2c3d | branch: feature/rate-limit
|
|
24
|
+
artifacts: [specs/rate-limit.json, plans/rate-limit.json]
|
|
25
|
+
completed: [spec, plan] | next: build
|
|
26
|
+
risks: If main branch diverges significantly, plan may need revision.
|
|
27
|
+
next_agent: /build
|
|
28
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# /handoff
|
|
2
|
+
|
|
3
|
+
> Transfer work between agents or stages with zero context loss.
|
|
4
|
+
|
|
5
|
+
**Position:** Inserted at any transition in spec → plan → build → audit → ship
|
|
6
|
+
**Input:** Current workflow state and what was produced. All artifacts so far (plans, specs, code, audit reports). Unresolved open questions or blockers. Identity of the next agent or stage.
|
|
7
|
+
**Output:** Structured per ZenKit contract (context, assumptions, constraints, decision, deliverable, risks, open_questions, next_agent).
|
|
8
|
+
|
|
9
|
+
**When to use:**
|
|
10
|
+
- Passing work from one agent to another (e.g., planner to builder)
|
|
11
|
+
- Session ends and work must resume later
|
|
12
|
+
- Crossing a stage boundary in the lifecycle
|
|
13
|
+
- Escalating or delegating a subtask to a specialized agent
|
|
14
|
+
|
|
15
|
+
**Example:**
|
|
16
|
+
```
|
|
17
|
+
> /handoff --from /plan --to /build
|
|
18
|
+
|
|
19
|
+
context: Rate-limit plan complete and approved. Handing off to build agent.
|
|
20
|
+
decision: Sliding window chosen over token bucket; fail-open on Redis failure.
|
|
21
|
+
deliverable:
|
|
22
|
+
handoff_contract:
|
|
23
|
+
source: /plan | target: /build
|
|
24
|
+
artifacts: [.zenkit/plans/rate-limit.json]
|
|
25
|
+
status: ready
|
|
26
|
+
risks: Redis connection pooling config may differ between environments.
|
|
27
|
+
next_agent: /build
|
|
28
|
+
```
|
package/commands/plan.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# /plan
|
|
2
|
+
|
|
3
|
+
> Translate a spec or intent into an actionable, ordered task list with acceptance criteria.
|
|
4
|
+
|
|
5
|
+
**Position:** spec → **plan** → build → audit → checkpoint → ship
|
|
6
|
+
**Input:** A spec (from `/spec`) or clear problem statement. Any existing constraints, deadlines, or architectural decisions. Relevant codebase context.
|
|
7
|
+
**Output:** Structured per ZenKit contract (context, assumptions, constraints, decision, deliverable, risks, open_questions, next_agent).
|
|
8
|
+
|
|
9
|
+
**When to use:**
|
|
10
|
+
- After `/spec` to break it into executable tasks
|
|
11
|
+
- Starting a new feature, fix, or refactoring effort
|
|
12
|
+
- Scope is large enough that jumping straight to `/build` would risk wasted work
|
|
13
|
+
|
|
14
|
+
**Example:**
|
|
15
|
+
```
|
|
16
|
+
> /plan "Add rate limiting to the API gateway"
|
|
17
|
+
|
|
18
|
+
context: API gateway currently has no per-client rate limiting...
|
|
19
|
+
decision: Token-bucket algorithm via Redis, enforced in middleware.
|
|
20
|
+
deliverable:
|
|
21
|
+
- task: Add rate-limit middleware
|
|
22
|
+
acceptance: Returns 429 when limit exceeded; passes existing tests.
|
|
23
|
+
- task: Add configuration endpoint
|
|
24
|
+
acceptance: Operators can set per-client limits via config.
|
|
25
|
+
risks: Redis downtime could block all requests (mitigation: fail-open flag).
|
|
26
|
+
next_agent: /build
|
|
27
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# /refactor
|
|
2
|
+
|
|
3
|
+
> Improve existing code without changing behavior — tests must pass before and after.
|
|
4
|
+
|
|
5
|
+
**Position:** Side-loop from audit → **refactor** → audit → ship
|
|
6
|
+
**Input:** Target files or modules. Passing test suite as behavioral baseline. Specific goals (readability, performance, decoupling). Optional: `/audit` findings motivating the refactor.
|
|
7
|
+
**Output:** Structured per ZenKit contract (context, assumptions, constraints, decision, deliverable, risks, open_questions, next_agent).
|
|
8
|
+
|
|
9
|
+
**When to use:**
|
|
10
|
+
- Code works but is hard to read, maintain, or extend
|
|
11
|
+
- `/audit` flags style or architecture issues that don't require new features
|
|
12
|
+
- Preparing a module for new feature work (clean up before building on top)
|
|
13
|
+
- Reducing tech debt from a previous cycle
|
|
14
|
+
|
|
15
|
+
**Example:**
|
|
16
|
+
```
|
|
17
|
+
> /refactor src/middleware/rate-limit.ts --goal "extract config into separate module"
|
|
18
|
+
|
|
19
|
+
context: Rate-limit middleware mixes config parsing with enforcement logic...
|
|
20
|
+
decision: Extract config into src/config/rate-limit-config.ts; middleware imports config.
|
|
21
|
+
deliverable:
|
|
22
|
+
files_changed: [rate-limit.ts (simplified), rate-limit-config.ts (new), config/index.ts]
|
|
23
|
+
rationale: Single-responsibility; enables config reuse in admin dashboard.
|
|
24
|
+
tests_before: 14 pass | tests_after: 14 pass
|
|
25
|
+
risks: Config module now importable independently; ensure no circular deps.
|
|
26
|
+
next_agent: /audit
|
|
27
|
+
```
|
package/commands/ship.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# /ship
|
|
2
|
+
|
|
3
|
+
> Final validation and release preparation — last line of defense before production.
|
|
4
|
+
|
|
5
|
+
**Position:** spec → plan → build → audit → checkpoint → **ship** (terminal)
|
|
6
|
+
**Input:** Passing `/audit` report. All code changes in merge-ready state. Pre-ship hook configuration (if any). Release metadata: version, changelog, target environment.
|
|
7
|
+
**Output:** Structured per ZenKit contract (context, assumptions, constraints, decision, deliverable, risks, open_questions, next_agent).
|
|
8
|
+
|
|
9
|
+
**When to use:**
|
|
10
|
+
- After `/audit` returns a passing verdict
|
|
11
|
+
- Preparing a pull request for merge
|
|
12
|
+
- Deploying to staging or production
|
|
13
|
+
- Final checklist before tagging a release
|
|
14
|
+
|
|
15
|
+
**Example:**
|
|
16
|
+
```
|
|
17
|
+
> /ship --version 1.4.0
|
|
18
|
+
|
|
19
|
+
context: Shipping rate-limit feature to production.
|
|
20
|
+
decision: ship
|
|
21
|
+
deliverable:
|
|
22
|
+
readiness: green | version: 1.4.0
|
|
23
|
+
gates: { tests: 247/247, lint: pass, type_check: pass, audit: pass-with-caveats }
|
|
24
|
+
pre_ship_hooks: [build: pass, integration_tests: pass, security_scan: pass]
|
|
25
|
+
changelog: "Add per-client rate limiting to API gateway."
|
|
26
|
+
risks: Medium audit finding (X-Forwarded-For spoofing) accepted with monitoring.
|
|
27
|
+
next_agent: null
|
|
28
|
+
```
|
package/commands/spec.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# /spec
|
|
2
|
+
|
|
3
|
+
> Write a feature specification — capture the "what" and "why" as a single source of truth.
|
|
4
|
+
|
|
5
|
+
**Position:** spec → plan → build → audit → checkpoint → ship
|
|
6
|
+
**Input:** User story, feature request, bug report, or high-level description. Optional: existing code references, design docs, constraints.
|
|
7
|
+
**Output:** Structured per ZenKit contract (context, assumptions, constraints, decision, deliverable, risks, open_questions, next_agent).
|
|
8
|
+
|
|
9
|
+
**When to use:**
|
|
10
|
+
- Feature or change is complex enough to need a written definition
|
|
11
|
+
- Multiple agents or team members will collaborate on the same work
|
|
12
|
+
- Before `/plan`, to ensure the plan is grounded in a clear spec
|
|
13
|
+
|
|
14
|
+
**Example:**
|
|
15
|
+
```
|
|
16
|
+
> /spec "User-facing API key rotation"
|
|
17
|
+
|
|
18
|
+
context: Users cannot rotate API keys without contacting support...
|
|
19
|
+
decision: Dual-key model where old and new keys overlap during grace period.
|
|
20
|
+
deliverable:
|
|
21
|
+
scope: [POST /keys/rotate endpoint, grace period config, audit log]
|
|
22
|
+
acceptance_criteria: Rotating returns new key, old key works until grace period expires.
|
|
23
|
+
out_of_scope: Automatic rotation schedules.
|
|
24
|
+
risks: Grace period too short could lock out slow-deploying clients.
|
|
25
|
+
next_agent: /plan
|
|
26
|
+
```
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
/**
|
|
7
|
+
* ZenKit CLI — compilable entry point
|
|
8
|
+
*
|
|
9
|
+
* This is the CLI that gets compiled to dist/cli.js for npm distribution.
|
|
10
|
+
* During development, bin/zenkit.ts is used directly via tsx.
|
|
11
|
+
*/
|
|
12
|
+
const index_1 = require("./index");
|
|
13
|
+
const fs_1 = __importDefault(require("fs"));
|
|
14
|
+
const path_1 = __importDefault(require("path"));
|
|
15
|
+
const child_process_1 = require("child_process");
|
|
16
|
+
const args = process.argv.slice(2);
|
|
17
|
+
const command = args[0];
|
|
18
|
+
function findRoot() {
|
|
19
|
+
let dir = process.cwd();
|
|
20
|
+
while (dir !== '/') {
|
|
21
|
+
if (fs_1.default.existsSync(path_1.default.join(dir, 'schemas')) && fs_1.default.existsSync(path_1.default.join(dir, 'commands'))) {
|
|
22
|
+
return dir;
|
|
23
|
+
}
|
|
24
|
+
dir = path_1.default.dirname(dir);
|
|
25
|
+
}
|
|
26
|
+
return process.cwd();
|
|
27
|
+
}
|
|
28
|
+
const ROOT = findRoot();
|
|
29
|
+
function run(cmd) {
|
|
30
|
+
try {
|
|
31
|
+
(0, child_process_1.execSync)(cmd, { cwd: ROOT, stdio: 'inherit', timeout: 60000 });
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function doValidate() {
|
|
38
|
+
const schemaName = args[1];
|
|
39
|
+
const filePath = args[2];
|
|
40
|
+
if (!schemaName || !filePath) {
|
|
41
|
+
console.error('Usage: zenkit validate <schema> <file>');
|
|
42
|
+
console.error(`Schemas: ${(0, index_1.getSchemaNames)().join(', ')}`);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
if (!(0, index_1.getSchemaNames)().includes(schemaName)) {
|
|
46
|
+
console.error(`Unknown schema: ${schemaName}`);
|
|
47
|
+
console.error(`Available: ${(0, index_1.getSchemaNames)().join(', ')}`);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
const resolved = path_1.default.resolve(filePath);
|
|
51
|
+
if (!fs_1.default.existsSync(resolved)) {
|
|
52
|
+
console.error(`File not found: ${resolved}`);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
const data = JSON.parse(fs_1.default.readFileSync(resolved, 'utf-8'));
|
|
56
|
+
const result = (0, index_1.validate)(schemaName, data);
|
|
57
|
+
if (result.valid) {
|
|
58
|
+
console.log(`PASS — ${filePath} validates against ${schemaName}.schema.json`);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
console.log(`FAIL — ${filePath} has ${result.errors.length} error(s):`);
|
|
62
|
+
for (const err of result.errors) {
|
|
63
|
+
console.log(` ${err.path}: ${err.message}`);
|
|
64
|
+
}
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function status() {
|
|
69
|
+
console.log('ZenKit Project Status');
|
|
70
|
+
console.log('=====================\n');
|
|
71
|
+
const checks = [];
|
|
72
|
+
const dirs = ['commands', 'schemas', 'skills', 'hooks', 'agents', 'rubrics'];
|
|
73
|
+
for (const dir of dirs) {
|
|
74
|
+
const full = path_1.default.join(ROOT, dir);
|
|
75
|
+
const exists = fs_1.default.existsSync(full);
|
|
76
|
+
const count = exists ? fs_1.default.readdirSync(full).filter(f => !f.startsWith('.')).length : 0;
|
|
77
|
+
checks.push([`${dir}/ (${count} files)`, exists && count > 0]);
|
|
78
|
+
}
|
|
79
|
+
const schemasDir = path_1.default.join(ROOT, 'schemas');
|
|
80
|
+
if (fs_1.default.existsSync(schemasDir)) {
|
|
81
|
+
const schemaFiles = fs_1.default.readdirSync(schemasDir).filter(f => f.endsWith('.schema.json'));
|
|
82
|
+
checks.push([`${schemaFiles.length} JSON schemas`, schemaFiles.length > 0]);
|
|
83
|
+
}
|
|
84
|
+
const specsDir = path_1.default.join(ROOT, 'benchmark/feature-specs');
|
|
85
|
+
if (fs_1.default.existsSync(specsDir)) {
|
|
86
|
+
const specs = fs_1.default.readdirSync(specsDir).filter(f => f.endsWith('.json') && !f.includes('baseline'));
|
|
87
|
+
checks.push([`${specs.length} benchmark specs`, specs.length > 0]);
|
|
88
|
+
}
|
|
89
|
+
checks.push(['CI workflow', fs_1.default.existsSync(path_1.default.join(ROOT, '.github/workflows/ci.yml'))]);
|
|
90
|
+
for (const [label, ok] of checks) {
|
|
91
|
+
console.log(` ${ok ? 'OK' : '--'} ${label}`);
|
|
92
|
+
}
|
|
93
|
+
const summary = path_1.default.join(ROOT, 'benchmark/results/summary.json');
|
|
94
|
+
if (fs_1.default.existsSync(summary)) {
|
|
95
|
+
const s = JSON.parse(fs_1.default.readFileSync(summary, 'utf-8'));
|
|
96
|
+
console.log(`\nLast benchmark: ${s.passed}/${s.total} specs passed`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function init() {
|
|
100
|
+
const targetDir = args[1] ? path_1.default.resolve(args[1]) : process.cwd();
|
|
101
|
+
const dirs = ['commands', 'schemas', 'skills', 'hooks', 'agents', 'rubrics', 'templates', 'benchmark/feature-specs', 'benchmark/results'];
|
|
102
|
+
console.log(`Initializing ZenKit in ${targetDir}\n`);
|
|
103
|
+
for (const dir of dirs) {
|
|
104
|
+
const full = path_1.default.join(targetDir, dir);
|
|
105
|
+
if (!fs_1.default.existsSync(full)) {
|
|
106
|
+
fs_1.default.mkdirSync(full, { recursive: true });
|
|
107
|
+
console.log(` created ${dir}/`);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
console.log(` exists ${dir}/`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
console.log('\nZenKit structure initialized.');
|
|
114
|
+
console.log('Next: add schemas, commands, and feature specs.');
|
|
115
|
+
}
|
|
116
|
+
// Dispatch
|
|
117
|
+
switch (command) {
|
|
118
|
+
case 'validate':
|
|
119
|
+
if (args[1] === ':all' || args[1] === 'all') {
|
|
120
|
+
run('npx tsx src/lib/validate-schemas.ts');
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
doValidate();
|
|
124
|
+
}
|
|
125
|
+
break;
|
|
126
|
+
case 'validate:all':
|
|
127
|
+
run('npx tsx src/lib/validate-schemas.ts');
|
|
128
|
+
break;
|
|
129
|
+
case 'benchmark':
|
|
130
|
+
run(`npx tsx benchmark/scripts/run.ts ${args[1] || ''}`);
|
|
131
|
+
break;
|
|
132
|
+
case 'benchmark:all':
|
|
133
|
+
run('npx tsx benchmark/scripts/run-all.ts');
|
|
134
|
+
break;
|
|
135
|
+
case 'benchmark:report':
|
|
136
|
+
run(`npx tsx benchmark/scripts/report.ts ${args[1] || ''}`);
|
|
137
|
+
break;
|
|
138
|
+
case 'benchmark:compare':
|
|
139
|
+
run(`npx tsx benchmark/scripts/compare.ts ${args[1] || ''} ${args[2] || ''}`);
|
|
140
|
+
break;
|
|
141
|
+
case 'audit':
|
|
142
|
+
run('npx tsx benchmark/scripts/run-all.ts');
|
|
143
|
+
break;
|
|
144
|
+
case 'init':
|
|
145
|
+
init();
|
|
146
|
+
break;
|
|
147
|
+
case 'status':
|
|
148
|
+
status();
|
|
149
|
+
break;
|
|
150
|
+
case 'help':
|
|
151
|
+
case '--help':
|
|
152
|
+
case '-h':
|
|
153
|
+
case undefined:
|
|
154
|
+
console.log(`zenkit — Disciplined workflows for coding agents.
|
|
155
|
+
|
|
156
|
+
Commands:
|
|
157
|
+
validate <schema> <file> Validate JSON against a ZenKit schema
|
|
158
|
+
validate:all Check all schemas compile
|
|
159
|
+
benchmark [spec] Run benchmark for a feature spec
|
|
160
|
+
benchmark:all Run all feature specs
|
|
161
|
+
benchmark:report [result] Generate markdown report
|
|
162
|
+
benchmark:compare [z] [b] Compare zenkit vs baseline
|
|
163
|
+
audit Run all benchmarks and produce audit report
|
|
164
|
+
init [dir] Scaffold ZenKit structure
|
|
165
|
+
status Show project ZenKit status
|
|
166
|
+
|
|
167
|
+
Schemas: ${(0, index_1.getSchemaNames)().join(', ')}`);
|
|
168
|
+
break;
|
|
169
|
+
default:
|
|
170
|
+
console.error(`Unknown command: ${command}`);
|
|
171
|
+
console.error('Run "zenkit help" for usage.');
|
|
172
|
+
process.exit(1);
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;AAAA;;;;;GAKG;AACH,mCAAoF;AACpF,4CAAmB;AACnB,gDAAuB;AACvB,iDAAwC;AAExC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAClC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AAEvB,SAAS,QAAQ;IACf,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;IACvB,OAAO,GAAG,KAAK,GAAG,EAAE,CAAC;QACnB,IAAI,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,IAAI,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC;YAC1F,OAAO,GAAG,CAAA;QACZ,CAAC;QACD,GAAG,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACzB,CAAC;I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