@plainconceptsplatform/agent-harness 3.2.0 → 3.3.1
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 -21
- package/README.md +454 -452
- package/cli/commands/join.js +259 -259
- package/cli/commands/migrate.js +310 -310
- package/cli/commands/shared.js +27 -27
- package/cli/commands/single.js +79 -79
- package/cli/commands/update.js +121 -121
- package/cli/commands/wizard.js +134 -134
- package/cli/fragments/archive/az.md +97 -97
- package/cli/fragments/archive/gh.md +96 -96
- package/cli/fragments/archive/gl.md +96 -96
- package/cli/fragments/archive/none.md +75 -75
- package/cli/fragments/guardrails/codegraph.md +5 -5
- package/cli/fragments/guardrails/humanizer.md +4 -4
- package/cli/fragments/guardrails/memory.md +4 -4
- package/cli/fragments/guardrails/rtk.md +3 -3
- package/cli/fragments/guardrails/simple-english.md +4 -4
- package/cli/fragments/ops-backlog/az.md +28 -28
- package/cli/fragments/ops-backlog/gh.md +28 -28
- package/cli/fragments/ops-backlog/jira.md +28 -28
- package/cli/fragments/ops-review/az.md +62 -62
- package/cli/fragments/ops-review/gh.md +51 -51
- package/cli/fragments/ops-review/gl.md +55 -55
- package/cli/fragments/ops-ship/az.md +81 -81
- package/cli/fragments/ops-ship/gh.md +67 -67
- package/cli/fragments/ops-ship/gl.md +84 -84
- package/cli/index.js +116 -116
- package/cli/presets/agents-content.json +34 -34
- package/cli/presets/browser.json +10 -10
- package/cli/presets/clean.json +21 -21
- package/cli/presets/models.json +68 -68
- package/cli/presets/optimization.json +32 -32
- package/cli/presets/platforms.json +76 -76
- package/cli/presets/source.json +23 -23
- package/cli/steps/browser/index.js +48 -48
- package/cli/steps/clean/index.js +120 -120
- package/cli/steps/copy/agents.js +120 -120
- package/cli/steps/copy/commands.js +79 -79
- package/cli/steps/copy/fullstack-engineer.js +89 -89
- package/cli/steps/copy/index.js +88 -88
- package/cli/steps/copy/opencode-json.js +324 -324
- package/cli/steps/copy/skills.js +316 -307
- package/cli/steps/metadata/index.js +115 -115
- package/cli/steps/models/format.js +88 -88
- package/cli/steps/models/index.js +64 -64
- package/cli/steps/models/write.js +38 -38
- package/cli/steps/openspec/index.js +136 -136
- package/cli/steps/optimization/codegraph.js +141 -127
- package/cli/steps/optimization/detect.js +66 -66
- package/cli/steps/optimization/humanizer.js +17 -17
- package/cli/steps/optimization/index.js +158 -158
- package/cli/steps/optimization/memory.js +91 -88
- package/cli/steps/optimization/patch-guardrails.js +111 -111
- package/cli/steps/optimization/simple-english.js +17 -17
- package/cli/steps/optimization/skills-lock.js +30 -30
- package/cli/steps/platform/index.js +109 -109
- package/cli/steps/source/index.js +123 -123
- package/cli/utils/agent-color.js +111 -111
- package/cli/utils/copy.js +134 -134
- package/cli/utils/exec-spinner.js +47 -47
- package/cli/utils/exec.js +134 -134
- package/cli/utils/legacy-check.js +30 -30
- package/cli/utils/models-cache.js +58 -58
- package/cli/utils/models-pricing.js +42 -42
- package/cli/utils/paths.js +80 -80
- package/cli/utils/process.js +3 -3
- package/cli/utils/terminal.js +6 -6
- package/cli/utils/update-manifest.js +75 -75
- package/harness/.opencode/_gitignore +9 -9
- package/harness/.opencode/commands/init.md +5 -5
- package/harness/.opencode/commands/make-architecture.md +5 -5
- package/harness/.opencode/commands/make-design.md +5 -5
- package/harness/.opencode/commands/make-engineer.md +5 -5
- package/harness/.opencode/commands/make-guardrails.md +5 -5
- package/harness/.opencode/commands/make-user-model.md +5 -5
- package/harness/.opencode/commands/ops-backlog.md +10 -10
- package/harness/.opencode/commands/ops-review.md +8 -8
- package/harness/.opencode/commands/ops-ship.md +9 -9
- package/harness/.opencode/commands/plan-apply.md +9 -9
- package/harness/.opencode/commands/plan-archive.md +5 -5
- package/harness/.opencode/commands/plan-explore.md +9 -9
- package/harness/.opencode/commands/plan-goal.md +5 -5
- package/harness/.opencode/commands/plan-propose.md +9 -9
- package/harness/.opencode/commands/plan-quick.md +5 -5
- package/harness/.opencode/commands/plan-story.md +9 -9
- package/harness/.opencode/commands/repo-audit.md +5 -5
- package/harness/.opencode/commands/repo-help.md +5 -5
- package/harness/.opencode/commands/repo-initialize.md +5 -5
- package/harness/.opencode/commands/repo-onboard.md +5 -5
- package/harness/.opencode/commands/repo-verify.md +5 -5
- package/harness/.opencode/package.json +5 -5
- package/harness/.opencode/plugins/pc-subagent-monitor.js +184 -184
- package/harness/.opencode/plugins/pc-subagent-tiers.js +354 -354
- package/harness/.opencode/plugins/pc-system-reminders.js +386 -386
- package/harness/.opencode/scripts/check-diff.mjs +26 -7
- package/harness/.opencode/scripts/code-rules.mjs +288 -280
- package/harness/AGENTS.md +49 -49
- package/harness/ARCHITECTURE.md +13 -13
- package/harness/DESIGN.md +13 -13
- package/harness/opencode.jsonc +36 -36
- package/harness/openspec/config.yaml +20 -20
- package/harness/skills-lock.json +17 -17
- package/package.json +14 -12
- package/skills/README.md +18 -18
- package/skills/agent-harness-cli/SKILL.md +86 -86
- package/skills/browser-automation/SKILL.md +72 -72
- package/skills/pc-guardrails-project/SKILL.md +8 -8
- package/skills/pc-make-architecture/SKILL.md +32 -32
- package/skills/pc-make-architecture/structure-template.md +64 -64
- package/skills/pc-make-design/SKILL.md +45 -45
- package/skills/pc-make-engineer/SKILL.md +59 -59
- package/skills/pc-make-engineer/signal-mapping.md +53 -53
- package/skills/pc-make-engineer/template.md +36 -36
- package/skills/pc-make-guardrails/SKILL.md +44 -44
- package/skills/pc-make-guardrails/category-reference.md +112 -112
- package/skills/pc-make-merge-risk-assess/SKILL.md +70 -70
- package/skills/pc-make-merge-risk-assess/category-reference.md +114 -114
- package/skills/pc-make-user-model/SKILL.md +56 -56
- package/skills/pc-ops-ship/SKILL.md +22 -18
- package/skills/pc-plan-apply/SKILL.md +86 -86
- package/skills/pc-plan-apply/simple-mode.md +21 -21
- package/skills/pc-plan-archive/SKILL.md +66 -66
- package/skills/pc-plan-explore/SKILL.md +21 -21
- package/skills/pc-plan-goal/SKILL.md +91 -91
- package/skills/pc-plan-goal/branching.md +39 -39
- package/skills/pc-plan-goal/failure-policy.md +30 -30
- package/skills/pc-plan-goal/output-mode.md +10 -10
- package/skills/pc-plan-goal/output.md +71 -71
- package/skills/pc-plan-propose/SKILL.md +125 -125
- package/skills/pc-plan-propose/task-annotation.md +39 -39
- package/skills/pc-plan-quick/SKILL.md +46 -46
- package/skills/pc-plan-story/SKILL.md +93 -93
- package/skills/pc-repo-audit/SKILL.md +44 -44
- package/skills/pc-repo-help/SKILL.md +87 -87
- package/skills/pc-repo-initialize/SKILL.md +119 -119
- package/skills/pc-repo-onboard/SKILL.md +32 -32
- package/skills/pc-repo-verify/SKILL.md +150 -150
- package/skills/pc-userstory-az/SKILL.md +71 -71
- package/skills/pc-userstory-browser/SKILL.md +64 -64
- package/skills/pc-userstory-gh/SKILL.md +63 -63
- package/skills/pc-userstory-jira/SKILL.md +74 -74
|
@@ -11,6 +11,7 @@ export const DEFAULT_LIMITS = {
|
|
|
11
11
|
testAllowance: 40,
|
|
12
12
|
casesPerKloc: 40,
|
|
13
13
|
caseAllowance: 3,
|
|
14
|
+
complexityBaseline: 'scripts/complexity-baseline.json',
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
const FIX = {
|
|
@@ -48,10 +49,13 @@ const SUSPICIOUS = {
|
|
|
48
49
|
|
|
49
50
|
const EMPTY_STATS = { cases: 0, skipped: 0, focused: 0, snapshot: 0, noAssertion: 0, mockOnly: 0 }
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
// `tracked` holds the files a complexity gate has methods on record for. Their new lines buy twice
|
|
53
|
+
// the test budget: that gate fails a method whose coverage drops, so a change there needs its new
|
|
54
|
+
// branches tested, and trimming those tests to fit this budget is what broke Pliny-Bot #633.
|
|
55
|
+
export function evaluate(files, limits = DEFAULT_LIMITS, tracked = new Set()) {
|
|
52
56
|
const violations = []
|
|
53
57
|
const add = (rule, file, line, detail) => violations.push({ rule, file, line, detail, fix: FIX[rule] })
|
|
54
|
-
const totals = { sourceCode: 0, testCode: 0, comments: 0, testLines: 0, cases: 0 }
|
|
58
|
+
const totals = { sourceCode: 0, trackedCode: 0, testCode: 0, comments: 0, testLines: 0, cases: 0 }
|
|
55
59
|
const commentsByFile = new Map()
|
|
56
60
|
|
|
57
61
|
for (const file of files) {
|
|
@@ -64,8 +68,11 @@ export function evaluate(files, limits = DEFAULT_LIMITS) {
|
|
|
64
68
|
totals.comments += 1
|
|
65
69
|
commentsByFile.set(file.path, (commentsByFile.get(file.path) ?? 0) + 1)
|
|
66
70
|
} else if (k === 'code') {
|
|
67
|
-
if (kind
|
|
68
|
-
else
|
|
71
|
+
if (kind !== 'source') totals.testCode += 1
|
|
72
|
+
else {
|
|
73
|
+
totals.sourceCode += 1
|
|
74
|
+
if (tracked.has(file.path)) totals.trackedCode += 1
|
|
75
|
+
}
|
|
69
76
|
}
|
|
70
77
|
}
|
|
71
78
|
|
|
@@ -100,8 +107,9 @@ export function evaluate(files, limits = DEFAULT_LIMITS) {
|
|
|
100
107
|
}
|
|
101
108
|
|
|
102
109
|
const commentBudget = Math.max(limits.commentAllowance, Math.floor(limits.commentRatio * (totals.sourceCode + totals.testCode)))
|
|
103
|
-
const
|
|
104
|
-
const
|
|
110
|
+
const testedCode = totals.sourceCode + totals.trackedCode
|
|
111
|
+
const testBudget = Math.max(limits.testAllowance, Math.floor(limits.testRatio * testedCode))
|
|
112
|
+
const caseBudget = Math.max(limits.caseAllowance, Math.floor((limits.casesPerKloc * testedCode) / 1000))
|
|
105
113
|
if (totals.comments > commentBudget) {
|
|
106
114
|
const where = [...commentsByFile].sort((a, b) => b[1] - a[1]).slice(0, 5).map(([f, n]) => `${f} (${n})`).join(', ')
|
|
107
115
|
add('comment-budget', undefined, undefined, `${totals.comments} comment lines added, budget ${commentBudget}: ${where}`)
|
|
@@ -174,6 +182,16 @@ export function collect(root, base) {
|
|
|
174
182
|
return files
|
|
175
183
|
}
|
|
176
184
|
|
|
185
|
+
// Paths of the files a complexity gate tracks, from its baseline keyed `path::method`.
|
|
186
|
+
export function trackedFiles(root, baseline) {
|
|
187
|
+
try {
|
|
188
|
+
const entries = Object.keys(JSON.parse(fs.readFileSync(path.join(root, baseline), 'utf8')))
|
|
189
|
+
return new Set(entries.map(key => key.split('::')[0]))
|
|
190
|
+
} catch {
|
|
191
|
+
return new Set()
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
177
195
|
function readLimits(root) {
|
|
178
196
|
try {
|
|
179
197
|
const config = JSON.parse(fs.readFileSync(path.join(root, '.opencode', 'harness.json'), 'utf8'))
|
|
@@ -217,7 +235,8 @@ function main(argv) {
|
|
|
217
235
|
console.error('check-diff: no base to compare against. Pass --base <ref> or fetch origin.')
|
|
218
236
|
return 2
|
|
219
237
|
}
|
|
220
|
-
const
|
|
238
|
+
const limits = readLimits(root)
|
|
239
|
+
const result = evaluate(collect(root, base.base), limits, trackedFiles(root, limits.complexityBaseline))
|
|
221
240
|
console.log(argv.includes('--json') ? JSON.stringify({ base, ...result }, null, 2) : report(result, base))
|
|
222
241
|
return result.violations.length === 0 ? 0 : 1
|
|
223
242
|
}
|