mikoshi-construct 0.3.0 → 0.4.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
@@ -3,6 +3,8 @@
3
3
  Bootstrap for AI-native software projects. Start with a proven engineering workflow instead of an
4
4
  empty repository.
5
5
 
6
+ **[Documentation](https://e1i.github.io/mikoshi-construct/)** · [Getting started](https://e1i.github.io/mikoshi-construct/guide/getting-started) · [The development cycle](https://e1i.github.io/mikoshi-construct/guide/the-cycle) · [CLI reference](https://e1i.github.io/mikoshi-construct/cli)
7
+
6
8
  ```bash
7
9
  mkdir my-service && cd my-service
8
10
  npx mikoshi-construct init # interactive: preset, agent, project name
@@ -13,10 +15,6 @@ pnpm install && pnpm run quality # green before you write a line
13
15
  > the full lifecycle; Cursor gets the rules, the conventions and the discovery protocol.
14
16
  > `construct sync` moves a repository already carrying a construct onto newer templates.
15
17
 
16
- **Documentation — [e1i.github.io/mikoshi-construct](https://e1i.github.io/mikoshi-construct/)**:
17
- getting started, [the development cycle](https://e1i.github.io/mikoshi-construct/guide/the-cycle),
18
- the reasoning budget, [upgrading](https://e1i.github.io/mikoshi-construct/guide/upgrading) and the
19
- CLI reference.
20
18
 
21
19
  ## What it does
22
20
 
package/dist/cli.js CHANGED
@@ -46,6 +46,7 @@ function claudeProjectsDir() {
46
46
  }
47
47
  function readUsage(file) {
48
48
  const totals = emptyUsage();
49
+ const counted = /* @__PURE__ */ new Set();
49
50
  for (const line of readFileSync(file, "utf8").split("\n")) {
50
51
  if (!line.startsWith("{"))
51
52
  continue;
@@ -58,6 +59,11 @@ function readUsage(file) {
58
59
  const message = entry.message;
59
60
  if (message?.role !== "assistant" || message.usage == null)
60
61
  continue;
62
+ if (entry.requestId != null) {
63
+ if (counted.has(entry.requestId))
64
+ continue;
65
+ counted.add(entry.requestId);
66
+ }
61
67
  totals.calls += 1;
62
68
  totals.input += message.usage.input_tokens ?? 0;
63
69
  totals.cacheWrite += message.usage.cache_creation_input_tokens ?? 0;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mikoshi-construct",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.4.0",
5
5
  "description": "Bootstrap for AI-native software projects. Start with a proven engineering workflow instead of an empty repository.",
6
6
  "author": "Eli Tabrisov",
7
7
  "license": "MIT",
@@ -42,6 +42,7 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@antfu/eslint-config": "^9.5.1",
45
+ "@anthropic-ai/sdk": "^0.127.0",
45
46
  "@changesets/changelog-github": "^1.0.0",
46
47
  "@changesets/cli": "^3.0.0",
47
48
  "@types/node": "^22.18.0",
@@ -54,6 +55,7 @@
54
55
  "yaml": "^2.9.1"
55
56
  },
56
57
  "scripts": {
58
+ "bench:architect": "tsx scripts/bench/run.ts",
57
59
  "build": "tsup",
58
60
  "changeset": "changeset",
59
61
  "ci": "pnpm run quality",
@@ -68,6 +70,7 @@
68
70
  "privacy:check": "tsx scripts/privacy/check.ts",
69
71
  "quality": "pnpm composition:check && pnpm privacy:check && pnpm lint && pnpm typecheck && pnpm test",
70
72
  "release": "pnpm build && changeset publish",
73
+ "release:verify": "tsx scripts/release/verify-published.ts",
71
74
  "test": "vitest run",
72
75
  "test:watch": "vitest",
73
76
  "typecheck": "tsc --noEmit",
@@ -37,7 +37,10 @@ repository's CLAUDE.md and `construct.json`.
37
37
  - `degraded` — a rung passed the harness, but a design step was rejected by the schema and the
38
38
  run continued without it. The result's `effort` is the class that actually executed.
39
39
  - `design incomplete` — a high-effort run whose architect was rejected by the schema. No
40
- implementer ran without a spec; the result carries the validator's text in `validationError`.
40
+ implementer ran without a spec; the result carries the validator's text in `validationError` and
41
+ the way out in `recovery`, which is a measured route rather than advice: re-running one class
42
+ lower with the design written into the brief produced the design on three of the three occasions
43
+ it has been tried on the construct's own repository.
41
44
  - `failed` — every rung ran and the harness stayed red; `lastFailure` carries the excerpt.
42
45
  - `blocked` — the last rung stopped on a question; `question` carries it verbatim.
43
46
  4. Record the run: append one JSON line to `.construct/runs.jsonl` (create the directory if needed)
@@ -66,8 +69,9 @@ repository's CLAUDE.md and `construct.json`.
66
69
  5. Relay the result: status, the effort rung that succeeded and how many attempts it took, the
67
70
  files changed, and the harness tail. When the status is `blocked`, put the architect's or
68
71
  implementer's question to the user verbatim. When `failed`, give the last failure excerpt. When
69
- `design incomplete`, say that the design step did not complete and give `validationError` as the
70
- runtime reported it; when `degraded`, say which design step was rejected and that the reported
72
+ `design incomplete`, say that the design step did not complete, give `validationError` as the
73
+ runtime reported it, and relay `recovery` verbatim a dead end that names no way out is how the
74
+ next person decides the ladder is broken rather than that this run needs re-running lower; when `degraded`, say which design step was rejected and that the reported
71
75
  class is the one that executed, not the one that was requested.
72
76
  Unless `construct.json` sets `report.usage` to `false`, end with one usage line for this run,
73
77
  from the Workflow tool's own accounting: agents, subagent tokens, tool uses, wall time — so the
@@ -52,6 +52,8 @@ const SPEC = {
52
52
  },
53
53
  }
54
54
 
55
+ const DESIGN_RECOVERY = 'Re-run this task one class lower with the design written into the brief. That is the measured route out: three of three such re-runs on the construct\'s own repository produced the design the architect had failed to return. The run does not retry the design step itself, because a second agent entry pays for the exploration again.'
56
+
55
57
  const DEFAULT_RETRY_LIMIT = 0
56
58
  const DESIGN_EFFORT = 'xhigh'
57
59
  const EFFORT_WITHOUT_DESIGN = { high: 'medium', xhigh: 'medium' }
@@ -150,7 +152,7 @@ async function design(rung, reason, label) {
150
152
  designFailed = true
151
153
  designError = lastValidationError ?? ''
152
154
  attempts.push({ rung, effort: DESIGN_EFFORT, outcome: 'design schema invalid', reason: designError })
153
- log(`${label}: the design step did not complete`)
155
+ log(`${label}: the design step did not complete. ${DESIGN_RECOVERY}`)
154
156
  return false
155
157
  }
156
158
  spec = result
@@ -165,6 +167,7 @@ function designIncomplete(effort, question) {
165
167
  effort: performedEffort(effort),
166
168
  attempts,
167
169
  validationError: designError,
170
+ recovery: DESIGN_RECOVERY,
168
171
  question: question ?? '',
169
172
  lastFailure: feedback ?? '',
170
173
  }