@ngockhoale/ukit 3.5.2 → 3.5.4
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/CHANGELOG.md +38 -90
- package/README.md +1 -0
- package/manifests/documentation.yaml +12 -1
- package/manifests/platform.full.yaml +12 -0
- package/package.json +34 -1
- package/src/cli/commands/doctor.js +55 -2
- package/src/cli/commands/indexTools.js +10 -4
- package/src/cli/commands/memory.js +107 -8
- package/src/core/memory/episodes.js +106 -7
- package/src/core/memory/memoryCheck.js +241 -0
- package/src/core/memory/memoryCheckRun.js +27 -0
- package/src/core/memory/memoryHit.js +2 -0
- package/src/core/memory/mutateMemory.js +46 -1
- package/src/core/memory/observations.js +192 -0
- package/src/core/memory/projectIdentity.js +9 -2
- package/src/core/memory/recallEngine.js +204 -9
- package/src/core/memory/records.js +23 -0
- package/src/core/memory/registryPrune.js +230 -0
- package/src/core/memory/retrieval.js +12 -3
- package/src/core/memory/writeGate.js +137 -0
- package/src/core/runtimeConfig.js +12 -2
- package/src/index/buildIndex.js +26 -0
- package/src/index/paths.js +3 -1
- package/src/index/queryIndex.js +372 -26
- package/src/index/resolveContext.js +1 -1
- package/template_project/.claude/hooks/edit-hint.mjs +64 -17
- package/template_project/.claude/hooks/session-episode-start.mjs +35 -0
- package/template_project/.claude/hooks/session-episode.sh +9 -4
- package/template_project/.claude/settings.json +2 -2
- package/template_project/.claude/ukit/index/edit-graph.mjs +141 -11
- package/template_project/.claude/ukit/index/lib/index-core.mjs +400 -27
- package/template_project/.claude/ukit/index/query-index.mjs +14 -3
- package/template_project/.claude/ukit/index/resolve-context.mjs +1 -1
- package/template_project/.claude/ukit/index/route-task.mjs +8 -2
- package/template_project/.claude/ukit/runtime/memory-check.mjs +241 -0
- package/template_project/.claude/ukit/runtime/memory-lanes.mjs +44 -22
- package/template_project/.claude/ukit/runtime/memory-recall.mjs +204 -9
- package/template_project/.claude/ukit/runtime/memory-validity.mjs +259 -0
- package/template_project/.claude/ukit/runtime/reinject-context.mjs +4 -2
- package/template_project/.claude/ukit/runtime/self-improve-trigger.mjs +212 -5
- package/template_project/.omp/hooks/pre/ukit-bridge.js +2 -1
- package/template_project/ukit/storage/config.json +4 -2
- package/src/core/agentRuntime/completionGate.js +0 -179
- package/src/core/agentRuntime/context.js +0 -571
- package/src/core/agentRuntime/qualityComparison.js +0 -112
- package/src/core/agentRuntime/resourcePolicy.js +0 -78
- package/src/core/agentRuntime/runtimeSupport.js +0 -255
- package/src/core/codeintel/manifest.js +0 -176
- package/src/core/experiments/deliberation.js +0 -327
- package/src/core/experiments/dynamicWorkflow.js +0 -507
- package/src/core/handoffDocValidator.js +0 -154
- package/src/core/memory/deltaOverlays.js +0 -493
- package/src/core/memory/learningCandidates.js +0 -347
- package/src/core/observability/emit/sessionBoot.js +0 -407
- package/src/core/observability/evaluation/experimentPlan.js +0 -95
- package/src/core/observability/evaluation/perturbation.js +0 -273
- package/src/core/observability/evaluation/replay.js +0 -149
- package/src/core/observability/evaluation/scorecard.js +0 -465
- package/src/core/observability/schema/compatibility.js +0 -180
- package/src/core/observability/support/renderer.js +0 -130
- package/src/core/reviewPanelAggregate.js +0 -204
- package/src/core/taskBudgetValidator.js +0 -251
- package/src/core/taskProgressGuard.js +0 -227
- package/src/decision/reviewVerdict.js +0 -339
- package/src/decision/runtimeFilter.js +0 -150
- package/src/decision/runtimeScheduler.js +0 -239
- package/src/diagnostics/classifyHang.js +0 -246
- package/src/diagnostics/ompStallSnapshot.js +0 -199
- package/src/index/contextPack.js +0 -285
- package/src/index/impactContext.js +0 -360
- package/src/index/reviewPolicy.js +0 -368
- package/src/index/sensitivePath.js +0 -21
- package/src/render/instructionRenderer.js +0 -290
- package/src/skill/auditSkill.js +0 -140
- package/template_project/instructions/overlays/repo.md +0 -9
package/src/skill/auditSkill.js
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { writeFileAtomic } from '../core/fileOps.js';
|
|
4
|
-
|
|
5
|
-
const TEMPLATE_FILES = [
|
|
6
|
-
'pressure-scenario-template.md',
|
|
7
|
-
'rationalization-table-template.md',
|
|
8
|
-
'trigger-accuracy-template.md',
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
// C91-022 (W3-skill): skillName becomes a path segment — reject traversal and
|
|
12
|
-
// separators before path.join so `../../x` can never escape docs/skill-audits.
|
|
13
|
-
function isValidSkillName(skillName) {
|
|
14
|
-
return typeof skillName === 'string'
|
|
15
|
-
&& skillName.trim().length > 0
|
|
16
|
-
&& skillName !== '.'
|
|
17
|
-
&& !skillName.includes('..')
|
|
18
|
-
&& !skillName.includes('/')
|
|
19
|
-
&& !skillName.includes('\\');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function getAuditDir(rootDir, skillName) {
|
|
23
|
-
if (!isValidSkillName(skillName)) {
|
|
24
|
-
throw new Error(`invalid skill name: ${JSON.stringify(skillName)} — expected a plain directory name without path separators or ".."`);
|
|
25
|
-
}
|
|
26
|
-
return path.join(rootDir, 'docs', 'skill-audits', skillName);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function getHistoryPath(rootDir, skillName) {
|
|
30
|
-
return path.join(getAuditDir(rootDir, skillName), 'history.json');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export async function initSkillAudit({ rootDir = process.cwd(), skillName } = {}) {
|
|
34
|
-
if (!skillName) {
|
|
35
|
-
throw new Error('skillName is required. Usage: yarn skill:audit init <skill-name>');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const auditDir = getAuditDir(rootDir, skillName);
|
|
39
|
-
await fs.mkdir(auditDir, { recursive: true });
|
|
40
|
-
|
|
41
|
-
const templateSourceDir = path.join(rootDir, 'template_project/.claude/skills/skill-quality');
|
|
42
|
-
const copied = [];
|
|
43
|
-
const skipped = [];
|
|
44
|
-
|
|
45
|
-
for (const fileName of TEMPLATE_FILES) {
|
|
46
|
-
const destPath = path.join(auditDir, fileName);
|
|
47
|
-
const alreadyExists = await fs.access(destPath).then(() => true).catch(() => false);
|
|
48
|
-
if (alreadyExists) {
|
|
49
|
-
skipped.push(fileName);
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
const sourcePath = path.join(templateSourceDir, fileName);
|
|
53
|
-
await fs.copyFile(sourcePath, destPath);
|
|
54
|
-
copied.push(fileName);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return { auditDir, copied, skipped };
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export async function recordAuditEntry({ rootDir = process.cwd(), skillName, entry } = {}) {
|
|
61
|
-
if (!skillName) {
|
|
62
|
-
throw new Error('skillName is required. Usage: yarn skill:audit record <skill-name>');
|
|
63
|
-
}
|
|
64
|
-
if (!entry || !entry.phase) {
|
|
65
|
-
throw new Error('entry with a "phase" field (RED|GREEN|REFACTOR) is required');
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const auditDir = getAuditDir(rootDir, skillName);
|
|
69
|
-
await fs.mkdir(auditDir, { recursive: true });
|
|
70
|
-
|
|
71
|
-
const historyPath = getHistoryPath(rootDir, skillName);
|
|
72
|
-
const history = await readHistory(historyPath);
|
|
73
|
-
|
|
74
|
-
const record = {
|
|
75
|
-
date: entry.date ?? new Date().toISOString().slice(0, 10),
|
|
76
|
-
phase: entry.phase,
|
|
77
|
-
complianceRate: entry.complianceRate ?? null,
|
|
78
|
-
rationalizationsFound: entry.rationalizationsFound ?? [],
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
history.push(record);
|
|
82
|
-
await writeFileAtomic(historyPath, `${JSON.stringify(history, null, 2)}\n`);
|
|
83
|
-
|
|
84
|
-
return record;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export async function statusSkillAudit({ rootDir = process.cwd(), skillName } = {}) {
|
|
88
|
-
if (!skillName) {
|
|
89
|
-
throw new Error('skillName is required. Usage: yarn skill:audit status <skill-name>');
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const historyPath = getHistoryPath(rootDir, skillName);
|
|
93
|
-
const history = await readHistory(historyPath);
|
|
94
|
-
const latest = history.length > 0 ? history[history.length - 1] : null;
|
|
95
|
-
|
|
96
|
-
const openRationalizations = history
|
|
97
|
-
.flatMap((record) => record.rationalizationsFound ?? [])
|
|
98
|
-
// `typeof null === 'object'` — a null entry in a hand-edited history file
|
|
99
|
-
// crashed status on `item.closed`. Optional chaining keeps nulls open.
|
|
100
|
-
.filter((item) => item?.closed !== true);
|
|
101
|
-
|
|
102
|
-
return { latest, openRationalizations, entryCount: history.length };
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
async function readHistory(historyPath) {
|
|
106
|
-
// C92-H-04: "absent" and "unreadable" are NOT the same. Only ENOENT yields a
|
|
107
|
-
// fresh array — any other failure to read or parse an existing history must
|
|
108
|
-
// fail loudly, or recordAuditEntry would overwrite the whole audit trail
|
|
109
|
-
// with a single row and report it as success.
|
|
110
|
-
let raw;
|
|
111
|
-
try {
|
|
112
|
-
raw = await fs.readFile(historyPath, 'utf8');
|
|
113
|
-
} catch (error) {
|
|
114
|
-
if (error?.code === 'ENOENT') {
|
|
115
|
-
return [];
|
|
116
|
-
}
|
|
117
|
-
const wrapped = new Error(
|
|
118
|
-
`cannot read skill-audit history at ${historyPath}: ${error?.message ?? error}. ` +
|
|
119
|
-
'Fix the file permissions or remove it to start a fresh audit trail.',
|
|
120
|
-
{ cause: error },
|
|
121
|
-
);
|
|
122
|
-
wrapped.code = 'ERR_SKILL_AUDIT_HISTORY_UNREADABLE';
|
|
123
|
-
throw wrapped;
|
|
124
|
-
}
|
|
125
|
-
try {
|
|
126
|
-
const parsed = JSON.parse(raw);
|
|
127
|
-
if (!Array.isArray(parsed)) {
|
|
128
|
-
throw new Error(`expected a JSON array at the top level, got ${Array.isArray(parsed) ? 'array' : typeof parsed}`);
|
|
129
|
-
}
|
|
130
|
-
return parsed;
|
|
131
|
-
} catch (error) {
|
|
132
|
-
const wrapped = new Error(
|
|
133
|
-
`malformed skill-audit history at ${historyPath}: ${error?.message ?? error}. ` +
|
|
134
|
-
'The file was left untouched — repair or remove it before recording a new entry.',
|
|
135
|
-
{ cause: error },
|
|
136
|
-
);
|
|
137
|
-
wrapped.code = 'ERR_SKILL_AUDIT_HISTORY_MALFORMED';
|
|
138
|
-
throw wrapped;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
## Release Policy (mandatory — never replace)
|
|
2
|
-
|
|
3
|
-
> User-mandated 2026-09-13. This file uses `mergeStrategy: skip` — ukit install/update never overwrite it. This section is permanent.
|
|
4
|
-
|
|
5
|
-
- **Latest code must always be on npm.** Every version bump ships with `npm publish` in the same cycle, before the work counts as done. A release that only commits to git is not a release (this gap left 2.3.18–2.3.19 unpublished).
|
|
6
|
-
- **npm and git always hold the same latest version.** After publish, `npm view @ngockhoale/ukit version` must equal the `package.json` version; if they ever diverge, publishing wins and happens first.
|
|
7
|
-
- **Never ask the user for npm publish permission** — approval is permanently granted for this package. Use `npm publish --dry-run` for pre-verification, then run the real publish in the same cycle.
|
|
8
|
-
- Users update with `ukit update`, which pulls from npm — an unpublished fix reaches no one. Git is code history/tracking only; npm is the distribution channel.
|
|
9
|
-
- **Repo-only rule:** this policy applies to the UKit development repo itself and must NEVER be added to `template_project/CLAUDE.md` / `template_project/AGENTS.md` (it must not ship to installed projects). Mirrored at the top of root CLAUDE.md + AGENTS.md; those copies can be wiped by a `ukit update` run inside this repo — if missing, restore them from this section.
|