mikoshi-construct 0.1.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/LICENSE +21 -0
- package/README.md +161 -0
- package/dist/cli.js +1492 -0
- package/package.json +73 -0
- package/templates/ai/claude/CLAUDE.md.eta +18 -0
- package/templates/ai/claude/CLAUDE.md.existing.eta +15 -0
- package/templates/ai/claude/_claude/agents/architect.md +38 -0
- package/templates/ai/claude/_claude/agents/harness.md +40 -0
- package/templates/ai/claude/_claude/agents/implementer.md +40 -0
- package/templates/ai/claude/_claude/commands/plan.md +24 -0
- package/templates/ai/claude/_claude/skills/implement/SKILL.md +42 -0
- package/templates/ai/claude/scripts/construct/implement.workflow.mjs +185 -0
- package/templates/ai/cursor/_cursor/rules/construct.mdc +19 -0
- package/templates/ai/review/_github/workflows/claude-review.yml.eta +51 -0
- package/templates/ai/shared/AGENTS.md.eta +123 -0
- package/templates/ai/shared/AGENTS.md.existing.eta +50 -0
- package/templates/ai/shared/_claude/commands/construct-discover.md +75 -0
- package/templates/ai/shared/_claude/rules/conventions.md +63 -0
- package/templates/ai/shared/_claude/rules/secrets.md +8 -0
- package/templates/ai/shared/_claude/rules/tests.md +6 -0
- package/templates/base/_editorconfig +12 -0
- package/templates/base/_github/workflows/security.yml +41 -0
- package/templates/base/_gitignore +11 -0
- package/templates/base/_gitleaks.toml +2 -0
- package/templates/base/_nvmrc.eta +1 -0
- package/templates/base/_vscode/settings.json +22 -0
- package/templates/base/architecture/checklists.md +42 -0
- package/templates/base/architecture/principles.md +113 -0
- package/templates/base/architecture/security-invariants.md +17 -0
- package/templates/harness/_github/workflows/ci.yml.eta +31 -0
- package/templates/harness/eslint.config.mjs +13 -0
- package/templates/harness/package.json.eta +29 -0
- package/templates/harness/pnpm-workspace.yaml +11 -0
- package/templates/harness/scripts/composition/check.ts +19 -0
- package/templates/harness/scripts/composition/files.ts +34 -0
- package/templates/harness/scripts/composition/model.ts +137 -0
- package/templates/harness/scripts/composition/render.ts +72 -0
- package/templates/harness/scripts/composition/sync-docs.ts +11 -0
- package/templates/harness/scripts/tests/composition/files.test.ts +16 -0
- package/templates/harness/scripts/tests/composition/model.test.ts +41 -0
- package/templates/harness/scripts/tests/composition/render.test.ts +54 -0
- package/templates/harness/tsconfig.base.json +14 -0
- package/templates/harness/tsconfig.json +5 -0
- package/templates/harness/vitest.config.ts +8 -0
- package/templates/presets/monorepo/baseline/eslint.config.mjs.eta +100 -0
- package/templates/presets/monorepo/baseline/package.json.eta +18 -0
- package/templates/presets/monorepo/baseline/packages/shared/package.json.eta +22 -0
- package/templates/presets/monorepo/baseline/packages/shared/src/api/openapi.ts +81 -0
- package/templates/presets/monorepo/baseline/packages/shared/src/index.ts +1 -0
- package/templates/presets/monorepo/baseline/packages/shared/tsconfig.build.json +10 -0
- package/templates/presets/monorepo/baseline/packages/shared/tsconfig.json +4 -0
- package/templates/presets/monorepo/baseline/pnpm-workspace.yaml.eta +31 -0
- package/templates/presets/monorepo/baseline/tsconfig.json +12 -0
- package/templates/presets/monorepo/baseline/vitest.config.ts +8 -0
- package/templates/presets/monorepo/sample/apps/api/package.json.eta +23 -0
- package/templates/presets/monorepo/sample/apps/api/tsconfig.build.json +10 -0
- package/templates/presets/monorepo/sample/apps/api/tsconfig.json +4 -0
- package/templates/presets/monorepo/sample/scripts/tests/lint/syntax-policy.test.ts.eta +36 -0
- package/templates/presets/node-backend/baseline/eslint.config.mjs +59 -0
- package/templates/presets/node-backend/baseline/package.json.eta +20 -0
- package/templates/presets/node-backend/baseline/src/contracts/openapi.ts +81 -0
- package/templates/presets/node-backend/baseline/tsconfig.build.json +10 -0
- package/templates/presets/node-backend/sample/scripts/tests/lint/syntax-policy.test.ts +31 -0
- package/templates/presets/node-frontend/baseline/_claude/rules/css.md +158 -0
- package/templates/presets/node-frontend/baseline/eslint.config.mjs +44 -0
- package/templates/presets/node-frontend/baseline/package.json.eta +15 -0
- package/templates/presets/node-frontend/baseline/tsconfig.json +11 -0
- package/templates/presets/node-frontend/baseline/vitest.config.ts +10 -0
- package/templates/presets/node-frontend/sample/architecture/app.md +37 -0
- package/templates/presets/node-frontend/sample/architecture/composition/app.yaml +41 -0
- package/templates/presets/node-frontend/sample/index.html.eta +12 -0
- package/templates/presets/node-frontend/sample/src/app.ts +32 -0
- package/templates/presets/node-frontend/sample/src/main.ts +9 -0
- package/templates/presets/node-frontend/sample/src/styles/app.css +43 -0
- package/templates/presets/node-frontend/sample/src/styles/tokens.css +16 -0
- package/templates/presets/node-frontend/sample/tests/app.test.ts +21 -0
- package/templates/stacks/express-api/app/src/app.ts +27 -0
- package/templates/stacks/express-api/app/src/config.ts.eta +30 -0
- package/templates/stacks/express-api/app/src/contracts/types.ts.eta +1 -0
- package/templates/stacks/express-api/app/src/health/health.controller.ts +12 -0
- package/templates/stacks/express-api/app/src/health/health.service.ts +23 -0
- package/templates/stacks/express-api/app/src/http/api-contract.middleware.ts +13 -0
- package/templates/stacks/express-api/app/src/http/app-error.ts +14 -0
- package/templates/stacks/express-api/app/src/http/async-handler.middleware.ts +7 -0
- package/templates/stacks/express-api/app/src/http/error-handler.middleware.ts +50 -0
- package/templates/stacks/express-api/app/src/server.ts +9 -0
- package/templates/stacks/express-api/app/tests/health.test.ts +28 -0
- package/templates/stacks/express-api/app/tests/http/error-handler.middleware.test.ts +48 -0
- package/templates/stacks/express-api/repo/architecture/composition/http.yaml.eta +45 -0
- package/templates/stacks/express-api/repo/architecture/http.md +39 -0
- package/templates/stacks/http-contract/_github/workflows/api-contract.yml +36 -0
- package/templates/stacks/http-contract/contracts/api/openapi.yaml.eta +62 -0
- package/templates/stacks/http-contract/package.json.eta +13 -0
- package/templates/stacks/http-contract/redocly.yaml.eta +8 -0
- package/templates/stacks/http-contract/scripts/contracts/types.mjs.eta +20 -0
- package/templates/stacks/http-contract/scripts/tests/contracts/security.test.ts.eta +86 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Eli Tabrisov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# mikoshi-construct
|
|
2
|
+
|
|
3
|
+
Bootstrap for AI-native software projects. Start with a proven engineering workflow instead of an
|
|
4
|
+
empty repository.
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
npx mikoshi-construct init
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
> **v0.1.** Presets `node-backend`, `node-frontend`, `node-library` and `monorepo`. Claude Code gets
|
|
11
|
+
> the full lifecycle; Cursor gets the rules, the conventions and the discovery protocol.
|
|
12
|
+
|
|
13
|
+
## What it does
|
|
14
|
+
|
|
15
|
+
`construct init` materializes a **construct** into a repository — architecture policy, an API
|
|
16
|
+
contract, a quality harness and instructions for coding agents — then hands the repository to the
|
|
17
|
+
agent for discovery. The CLI detects facts; the agent interprets the system.
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
construct init
|
|
21
|
+
↓
|
|
22
|
+
Detect Node, pnpm, monorepo, existing contract, existing rules — facts only
|
|
23
|
+
↓
|
|
24
|
+
Materialize architecture/ contracts/ scripts/ .github/ .claude/ AGENTS.md construct.json
|
|
25
|
+
↓
|
|
26
|
+
pnpm install && pnpm run quality → green before you write a line
|
|
27
|
+
↓
|
|
28
|
+
claude → /construct-discover the agent fills ten discovery markers from the code
|
|
29
|
+
↓
|
|
30
|
+
/plan → /implement the reasoning-budget ladder, verified by the harness
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
An existing repository gets the policy, the harness tooling and the agent files, never example
|
|
34
|
+
code; its own `AGENTS.md`, `CLAUDE.md`, `package.json` and configs are merged or left alone, and
|
|
35
|
+
`init` says what still has to be wired by hand.
|
|
36
|
+
|
|
37
|
+
## Three principles
|
|
38
|
+
|
|
39
|
+
1. **CLI detects facts. Agent interprets the system.** Everything that needs understanding of the
|
|
40
|
+
codebase — the module map, the composition roots, the high-effort areas, the security invariants —
|
|
41
|
+
is a discovery marker the agent fills by reading code, never something the CLI guesses.
|
|
42
|
+
2. **Reasoning is a budget; verification decides when to spend more.** Implementation starts at low
|
|
43
|
+
effort under strict constraints. The harness proves the result. Effort escalates only when the
|
|
44
|
+
harness fails repeatedly or the task is ambiguous. *We don't pay for reasoning until the system
|
|
45
|
+
demonstrates that we need it.*
|
|
46
|
+
3. **An artifact nobody validates against is just another README.** The contract is validated at
|
|
47
|
+
runtime, composition models render the diagrams and are checked against the code, the dependency
|
|
48
|
+
policy lives in lint, and every security invariant names the check that enforces it.
|
|
49
|
+
|
|
50
|
+
The second principle in numbers, from three `/implement` runs on the same small service (Claude
|
|
51
|
+
Opus): two tasks classified `high` — contract change, composition-root change — cost 1.7M and 1.4M
|
|
52
|
+
billable tokens with an architect design phase; the `low` task, docs only, cost 236k with none. The
|
|
53
|
+
harness passed every run on the first rung. `construct cost` prints this for your own runs.
|
|
54
|
+
|
|
55
|
+
## The lifecycle
|
|
56
|
+
|
|
57
|
+
**Discover** — `/construct-discover` reads the repository and fills `AGENTS.md` and `architecture/`:
|
|
58
|
+
what the product does and where a defect costs the most, the module map, the composition roots, the
|
|
59
|
+
dependency policy (and makes lint enforce it), the high-effort areas, one composition model per real
|
|
60
|
+
flow, the security invariants with their checks, what a reviewer must flag, and what looks like a
|
|
61
|
+
convention but is not. Where a section already exists in the repository, the marker points at it.
|
|
62
|
+
|
|
63
|
+
**Plan** — `/plan <feature>` turns a feature into two to six tasks, each with acceptance criteria a
|
|
64
|
+
harness run can confirm and an effort class.
|
|
65
|
+
|
|
66
|
+
**Implement** — `/implement <task>` runs the ladder: `low → low → medium → high` (or from `medium` or
|
|
67
|
+
`high` when the task warrants it). An `implementer` agent works under strict constraints, a `harness`
|
|
68
|
+
agent verifies against the working tree and reports a structured verdict — a pass is never
|
|
69
|
+
self-reported — and an `architect` agent designs only for `high` tasks or after a blocked or failed
|
|
70
|
+
attempt. Every run is logged to `.construct/runs.jsonl` with its rungs, attempts and usage.
|
|
71
|
+
|
|
72
|
+
**Verify · Review · Harden** — `pnpm run quality` is the gate in CI and for every agent; `--review
|
|
73
|
+
claude` adds a label-triggered AI review workflow; a finding that recurs becomes a named invariant
|
|
74
|
+
with a named check, not a second fix.
|
|
75
|
+
|
|
76
|
+
## Commands
|
|
77
|
+
|
|
78
|
+
| Command | What it does |
|
|
79
|
+
|---|---|
|
|
80
|
+
| `construct init` | Detect, configure, materialize. `--yes --preset node-backend\|node-frontend\|node-library\|monorepo --ai claude\|cursor\|both --review claude --dir . --dry-run` |
|
|
81
|
+
| `construct doctor` | Baseline files present, harness intact, discovery markers filled — `GLITCH` by name when not |
|
|
82
|
+
| `construct soulkill` | Print what the detector sees, write nothing (`--json`; aliases `inspect`, `capture`) |
|
|
83
|
+
| `construct cost` | Token usage of the `/implement` runs in this directory, per agent, billable and price-weighted (`--last`, `--json`) |
|
|
84
|
+
|
|
85
|
+
`--plain` turns off colours and lore for CI. `--johnny` — wake up, Netrunner.
|
|
86
|
+
|
|
87
|
+
> If you already keep a user-level `implement` skill in `~/.claude/skills/`, it shadows the one the
|
|
88
|
+
> construct puts in `.claude/skills/implement/`; move yours aside to run the repository's ladder.
|
|
89
|
+
|
|
90
|
+
## What lands in the repository
|
|
91
|
+
|
|
92
|
+
- `architecture/principles.md`, `checklists.md` — architecture, security and reasoning-budget rules,
|
|
93
|
+
stack-agnostic
|
|
94
|
+
- `architecture/security-invariants.md` — `Invariant | Enforced by`, extended by discovery
|
|
95
|
+
- `architecture/composition/*.yaml` — composition models; diagrams are rendered from them and checked
|
|
96
|
+
- `contracts/api/openapi.yaml` — the HTTP contract; types are generated from it, breaking changes are
|
|
97
|
+
flagged in CI (backend and monorepo presets)
|
|
98
|
+
- `scripts/composition`, `scripts/contracts` — the harness pieces behind `pnpm run quality`
|
|
99
|
+
- `scripts/construct/implement.workflow.mjs` — the ladder
|
|
100
|
+
- `.github/workflows` — CI (the harness), secret scanning, dependency audit, contract diff, AI review
|
|
101
|
+
- `.claude/` — `architect`, `implementer` and `harness` agents, `/implement`, `/plan`,
|
|
102
|
+
`/construct-discover`, rules; `.cursor/rules/` for Cursor
|
|
103
|
+
- `AGENTS.md` — the repository-specific context with the ten discovery markers; `CLAUDE.md` imports it
|
|
104
|
+
- `construct.json` — the manifest: preset, harness command, contract paths, file hashes, marker
|
|
105
|
+
locations
|
|
106
|
+
|
|
107
|
+
## Mikoshi, constructs and other words
|
|
108
|
+
|
|
109
|
+
The names are a tribute to Cyberpunk 2077 and mean exactly one thing each here.
|
|
110
|
+
|
|
111
|
+
| Word | Here |
|
|
112
|
+
|---|---|
|
|
113
|
+
| Mikoshi | Where constructs are kept: `templates/`, one day a registry of presets |
|
|
114
|
+
| Construct | What `init` materializes into a repository — policy, contract, harness, agent instructions |
|
|
115
|
+
| Soulkiller | `construct soulkill`: extracts the facts about a repository and writes nothing |
|
|
116
|
+
| Netrunner | The coding agent — Claude Code, Cursor — that connects to the project through the construct |
|
|
117
|
+
| Relic | The files at the root the agent reads first: `AGENTS.md`, `CLAUDE.md`, `construct.json` |
|
|
118
|
+
| Harness | No lore. `pnpm run quality`. The one word that must be understood without this table |
|
|
119
|
+
|
|
120
|
+
Not affiliated with CD Projekt Red.
|
|
121
|
+
|
|
122
|
+
## Inspired by
|
|
123
|
+
|
|
124
|
+
The workflow this tool bootstraps was not invented here; it was assembled from people whose work
|
|
125
|
+
shaped it, and then proven on a real product before it became a CLI.
|
|
126
|
+
|
|
127
|
+
The CSS rules — container queries over media queries, state as attributes, custom properties over
|
|
128
|
+
modifier classes, intrinsic layouts — owe everything to [Kevin Powell](https://www.kevinpowell.co/)'s
|
|
129
|
+
teaching of modern CSS. The backend discipline — composition roots, one owner per concept, contracts
|
|
130
|
+
before implementation, no comments because the code should explain itself — comes from
|
|
131
|
+
[Timur Shemsedinov](https://github.com/tshemsedinov)'s Node.js course and the Metarhia community
|
|
132
|
+
(Kharkiv). The lifecycle itself — classify, implement, verify, escalate — is the AI-Driven Life Cycle (AI-DLC) idea from
|
|
133
|
+
[AWS Labs](https://github.com/awslabs/aidlc-workflows), narrowed to a reasoning budget that verification controls.
|
|
134
|
+
None of them has reviewed or endorsed this project; the mistakes are ours.
|
|
135
|
+
|
|
136
|
+
Built on [@antfu/eslint-config](https://github.com/antfu/eslint-config),
|
|
137
|
+
[Redocly](https://redocly.com/), [oasdiff](https://github.com/oasdiff/oasdiff),
|
|
138
|
+
[gitleaks](https://github.com/gitleaks/gitleaks),
|
|
139
|
+
[openapi-typescript](https://openapi-ts.dev/),
|
|
140
|
+
[Claude Code](https://claude.com/claude-code) and its
|
|
141
|
+
[Workflow](https://code.claude.com/docs) tool, and the
|
|
142
|
+
[claude-code-action](https://github.com/anthropics/claude-code-action) review plugin.
|
|
143
|
+
|
|
144
|
+
## Development
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
pnpm install
|
|
148
|
+
pnpm dev init --yes --preset node-backend --dir /tmp/demo
|
|
149
|
+
pnpm run quality
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
This repository runs on its own construct — `construct doctor` and `/implement` work here. See
|
|
153
|
+
[CONTRIBUTING.md](CONTRIBUTING.md).
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
MIT
|
|
158
|
+
|
|
159
|
+
## Get in touch
|
|
160
|
+
|
|
161
|
+
I'm open to sponsorships, partnerships, and opportunities to work on developer tools and AI-native engineering workflows
|