@miphamai/cli 0.48.0 → 0.50.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/package.json +1 -1
- package/skills/mipham/doc-sync.mipham-skill.md +198 -0
- package/skills/mipham/self-audit.mipham-skill.md +1 -1
- package/skills/standard/github-ops.SKILL.md +1 -1
- package/skills/standard/web-access/references/cdp-api.md +132 -0
- package/skills/standard/web-access/references/site-patterns/.gitkeep +0 -0
- package/skills/standard/web-access/scripts/cdp-proxy.mjs +756 -0
- package/skills/standard/web-access/scripts/check-deps.mjs +187 -0
- package/skills/standard/web-access/scripts/find-url.mjs +271 -0
- package/skills/standard/web-access/scripts/match-site.mjs +48 -0
- package/skills/standard/web-access.SKILL.md +77 -158
- package/src/agent/cross-session/discovery.ts +26 -1
- package/src/config/defaults.ts +3 -0
- package/src/core/behavior-tasks.json +101 -0
- package/src/core/behavior-tasks.ts +44 -0
- package/src/core/crsi-producer.ts +214 -0
- package/src/core/crsi-sandbox.ts +5 -0
- package/src/core/eval-harness.ts +7 -0
- package/src/core/instructions.ts +11 -0
- package/src/core/proposal-guard.ts +100 -0
- package/src/core/task-runner-tasks.json +14 -0
- package/src/core/task-runner.ts +163 -0
- package/src/daemon/heartbeat.ts +83 -0
- package/src/daemon/server.ts +34 -2
- package/src/shared/package-info.ts +4 -1
- package/src/skills/bundled-skill-assets.ts +19 -0
- package/src/skills/bundled-skills.ts +4 -3
- package/src/skills/skill-assets.ts +37 -0
- package/src/tools/agent/skill.ts +13 -2
- package/src/tools/file/grep.ts +11 -1
- package/src/ui/app.tsx +21 -1
- package/src/ui/commands.ts +81 -6
package/src/ui/commands.ts
CHANGED
|
@@ -15,12 +15,19 @@ import { runCrsiModification, approvePending, rejectPending, hasPending } from '
|
|
|
15
15
|
import {
|
|
16
16
|
produceCrsiProposal,
|
|
17
17
|
produceRuleProposal,
|
|
18
|
+
produceProseProposal,
|
|
18
19
|
selectCrsiSignal,
|
|
20
|
+
collectSkillFiles,
|
|
21
|
+
proseProposalId,
|
|
22
|
+
hasProposedProse,
|
|
23
|
+
appendProseProposal,
|
|
24
|
+
clearProseProposals,
|
|
19
25
|
LESSONS_FILE,
|
|
20
26
|
MANAGED_RULES_FILE,
|
|
21
27
|
} from '../core/crsi-producer'
|
|
28
|
+
import { prefilterProposal } from '../core/proposal-guard'
|
|
22
29
|
import { runEval, appendEvalScore } from '../core/eval-harness'
|
|
23
|
-
import { NPM_UPDATE_COMMAND, PACKAGE_VERSION } from '../shared/index.ts'
|
|
30
|
+
import { NPM_UPDATE_COMMAND, PACKAGE_VERSION, COAUTHOR_TRAILER } from '../shared/index.ts'
|
|
24
31
|
import { getPreference } from '../config/preferences'
|
|
25
32
|
import { loadCrossSessionConfig } from '../config/loader'
|
|
26
33
|
import { stripIndent } from './strip-indent.js'
|
|
@@ -818,6 +825,62 @@ const crsiProposeCmd: CommandHandler = async (ctx, args) => {
|
|
|
818
825
|
// 非 git 目录 → 回退 cwd
|
|
819
826
|
}
|
|
820
827
|
|
|
828
|
+
// ── 散文提议路径:/crsi propose --prose 用 LLM 生成改 skill 散文提议 ──
|
|
829
|
+
if (args[0] === '--prose') {
|
|
830
|
+
const skillFiles = collectSkillFiles(root)
|
|
831
|
+
if (skillFiles.length === 0) {
|
|
832
|
+
return { content: '没有可改的 skill 文件。' }
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
const signal = selectCrsiSignal(insights, metaRules)
|
|
836
|
+
if (!signal) {
|
|
837
|
+
return { content: '没有足够的失败信号来生成散文提议。' }
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
const id = proseProposalId(signal)
|
|
841
|
+
if (hasProposedProse(id)) {
|
|
842
|
+
return { content: '该失败信号已生成过散文提议(幂等去重,跳过)。' }
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
const llm = ctx.engine.getLlm() ?? ctx.engine.getRegistry()
|
|
846
|
+
const { readFileSync } = await import('node:fs')
|
|
847
|
+
const { join } = await import('node:path')
|
|
848
|
+
const proposal = await produceProseProposal(signal, llm, skillFiles, (p) =>
|
|
849
|
+
readFileSync(join(root, p), 'utf-8'),
|
|
850
|
+
)
|
|
851
|
+
if (!proposal) {
|
|
852
|
+
return { content: '散文提议生成失败(LLM 未返回有效结果)。' }
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
const verdict = prefilterProposal({
|
|
856
|
+
id,
|
|
857
|
+
filePath: proposal.filePath,
|
|
858
|
+
kind: 'skill',
|
|
859
|
+
newContent: proposal.newContent,
|
|
860
|
+
})
|
|
861
|
+
if (!verdict.pass) {
|
|
862
|
+
return { content: `❌ 提议未通过预筛:${verdict.reasons.join('; ')}` }
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
const result = runCrsiModification({
|
|
866
|
+
description: proposal.description,
|
|
867
|
+
filePath: proposal.filePath,
|
|
868
|
+
newContent: proposal.newContent,
|
|
869
|
+
originalContent: proposal.originalContent,
|
|
870
|
+
})
|
|
871
|
+
if (!result.applied || result.phase === 'failed') {
|
|
872
|
+
return { content: `❌ 生成失败(phase: ${result.phase})。\n${result.error ?? ''}` }
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
appendProseProposal({ id, filePath: proposal.filePath, timestamp: new Date().toISOString() })
|
|
876
|
+
|
|
877
|
+
return {
|
|
878
|
+
content:
|
|
879
|
+
`✅ 已生成散文提议并跑过测试。审阅 diff:\n\n${result.diff}\n\n` +
|
|
880
|
+
'/crsi modify --approve 合并 | /crsi modify --reject 丢弃',
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
|
|
821
884
|
// ── 毕业路径:/crsi propose --rule 固化受管理规则(行为) ──
|
|
822
885
|
if (args[0] === '--rule') {
|
|
823
886
|
const signal = selectCrsiSignal(insights, metaRules)
|
|
@@ -900,6 +963,14 @@ const crsiEvalCmd: CommandHandler = async () => {
|
|
|
900
963
|
return { content: lines.join('\n') }
|
|
901
964
|
}
|
|
902
965
|
|
|
966
|
+
const crsiProseClearCmd: CommandHandler = () => {
|
|
967
|
+
const count = clearProseProposals()
|
|
968
|
+
if (count === 0) {
|
|
969
|
+
return { content: '散文提议 ledger 为空(无可清除记录)。' }
|
|
970
|
+
}
|
|
971
|
+
return { content: `已清空散文提议 ledger(移除 ${count} 条记录)。` }
|
|
972
|
+
}
|
|
973
|
+
|
|
903
974
|
const crsiHealthCmd: CommandHandler = async (ctx) => {
|
|
904
975
|
const engine = ctx.engine.getRuleEngine()
|
|
905
976
|
const tracker = ctx.engine.getEffectivenessTracker()
|
|
@@ -4285,10 +4356,10 @@ const forkCmd: CommandHandler = async (ctx, args) => {
|
|
|
4285
4356
|
ex(`git -C ${wtPath} add -A`, { stdio: 'ignore', timeout: 10_000 })
|
|
4286
4357
|
const st = ex(`git -C ${wtPath} status --porcelain`, { encoding: 'utf-8', timeout: 10_000 })
|
|
4287
4358
|
if (st.trim()) {
|
|
4288
|
-
ex(
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
)
|
|
4359
|
+
ex(`git -C ${wtPath} commit -m "feat: ${prompt.slice(0, 60)}\n\n${COAUTHOR_TRAILER}"`, {
|
|
4360
|
+
stdio: 'ignore',
|
|
4361
|
+
timeout: 10_000,
|
|
4362
|
+
})
|
|
4292
4363
|
ex(`git push origin ${branch}`, { stdio: 'ignore', timeout: 30_000 })
|
|
4293
4364
|
}
|
|
4294
4365
|
} catch {
|
|
@@ -4485,6 +4556,7 @@ const commandsListCmd: CommandHandler = () => {
|
|
|
4485
4556
|
'/crsi inventory': 'Tools & Skills',
|
|
4486
4557
|
'/crsi modify': 'Tools & Skills',
|
|
4487
4558
|
'/crsi propose': 'Tools & Skills',
|
|
4559
|
+
'/crsi prose-clear': 'Tools & Skills',
|
|
4488
4560
|
'/crsi eval': 'Tools & Skills',
|
|
4489
4561
|
'/crsi meta': 'Tools & Skills',
|
|
4490
4562
|
'/crsi interpret': 'Tools & Skills',
|
|
@@ -4641,6 +4713,7 @@ registry.set('/crsi health', crsiHealthCmd)
|
|
|
4641
4713
|
registry.set('/crsi inventory', crsiInventoryCmd)
|
|
4642
4714
|
registry.set('/crsi modify', crsiModifyCmd)
|
|
4643
4715
|
registry.set('/crsi propose', crsiProposeCmd)
|
|
4716
|
+
registry.set('/crsi prose-clear', crsiProseClearCmd)
|
|
4644
4717
|
registry.set('/crsi eval', crsiEvalCmd)
|
|
4645
4718
|
registry.set('/crsi meta', crsiMetaCmd)
|
|
4646
4719
|
registry.set('/crsi interpret', crsiInterpretCmd)
|
|
@@ -4819,7 +4892,9 @@ const COMMAND_DESCRIPTIONS: Record<string, string> = {
|
|
|
4819
4892
|
'/crsi health': 'CRSI + SIS unified health dashboard with scoring',
|
|
4820
4893
|
'/crsi inventory': 'Live capability self-report — CRSI/SIS/constitution state',
|
|
4821
4894
|
'/crsi modify': 'Run a code self-modification through the sandbox (worktree → tests → approve)',
|
|
4822
|
-
'/crsi propose':
|
|
4895
|
+
'/crsi propose':
|
|
4896
|
+
'固化 CRSI 失败信号(默认教训 / --rule 受管理规则 / --prose 改 skill 散文),沙箱 + 人批准门控',
|
|
4897
|
+
'/crsi prose-clear': '清空散文提议去重 ledger(~/.mipham/crsi/prose-proposals.jsonl)',
|
|
4823
4898
|
'/crsi eval': 'Run the ground-truth CRSI eval harness and record the score',
|
|
4824
4899
|
'/crsi meta': 'RSI Level 3 meta-rule analysis — rules that improve the rules',
|
|
4825
4900
|
'/crsi interpret': 'Tool-call behavior dashboard — error patterns, usage, health',
|