@plainconceptsplatform/agent-harness 2.0.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 +419 -0
- package/package.json +68 -0
- package/src/commands/join.js +244 -0
- package/src/commands/shared.js +27 -0
- package/src/commands/single.js +79 -0
- package/src/commands/update.js +109 -0
- package/src/commands/wizard.js +134 -0
- package/src/content/.agents/skills/browser-automation/SKILL.md +66 -0
- package/src/content/.agents/skills/pc-guardrails-generic/SKILL.md +68 -0
- package/src/content/.agents/skills/pc-guardrails-project/SKILL.md +8 -0
- package/src/content/.agents/skills/pc-make-architecture/SKILL.md +51 -0
- package/src/content/.agents/skills/pc-make-architecture/structure-template.md +38 -0
- package/src/content/.agents/skills/pc-make-design/SKILL.md +68 -0
- package/src/content/.agents/skills/pc-make-engineer/SKILL.md +219 -0
- package/src/content/.agents/skills/pc-make-engineer/signal-mapping.md +68 -0
- package/src/content/.agents/skills/pc-make-engineer/template.md +81 -0
- package/src/content/.agents/skills/pc-make-evidence-scaffold/SKILL.md +18 -0
- package/src/content/.agents/skills/pc-make-evidence-scaffold/evidence-contract.md +29 -0
- package/src/content/.agents/skills/pc-make-guardrails/SKILL.md +74 -0
- package/src/content/.agents/skills/pc-make-guardrails/category-reference.md +68 -0
- package/src/content/.agents/skills/pc-make-merge-risk-assess/SKILL.md +70 -0
- package/src/content/.agents/skills/pc-make-merge-risk-assess/category-reference.md +98 -0
- package/src/content/.agents/skills/pc-make-user-model/SKILL.md +66 -0
- package/src/content/.agents/skills/pc-ops-evidence/SKILL.md +127 -0
- package/src/content/.agents/skills/pc-ops-ship/SKILL.md +18 -0
- package/src/content/.agents/skills/pc-plan-apply/SKILL.md +83 -0
- package/src/content/.agents/skills/pc-plan-apply/simple-mode.md +21 -0
- package/src/content/.agents/skills/pc-plan-archive/SKILL.md +63 -0
- package/src/content/.agents/skills/pc-plan-explore/SKILL.md +9 -0
- package/src/content/.agents/skills/pc-plan-goal/SKILL.md +94 -0
- package/src/content/.agents/skills/pc-plan-goal/branching.md +30 -0
- package/src/content/.agents/skills/pc-plan-goal/failure-policy.md +30 -0
- package/src/content/.agents/skills/pc-plan-goal/output-mode.md +9 -0
- package/src/content/.agents/skills/pc-plan-goal/output.md +68 -0
- package/src/content/.agents/skills/pc-plan-propose/SKILL.md +125 -0
- package/src/content/.agents/skills/pc-plan-propose/task-annotation.md +39 -0
- package/src/content/.agents/skills/pc-plan-quick/SKILL.md +62 -0
- package/src/content/.agents/skills/pc-plan-story/SKILL.md +146 -0
- package/src/content/.agents/skills/pc-repo-audit/SKILL.md +44 -0
- package/src/content/.agents/skills/pc-repo-help/SKILL.md +91 -0
- package/src/content/.agents/skills/pc-repo-initialize/SKILL.md +130 -0
- package/src/content/.agents/skills/pc-repo-onboard/SKILL.md +87 -0
- package/src/content/.agents/skills/pc-repo-verify/SKILL.md +34 -0
- package/src/content/.agents/skills/pc-userstory-az/SKILL.md +157 -0
- package/src/content/.agents/skills/pc-userstory-browser/SKILL.md +132 -0
- package/src/content/.agents/skills/pc-userstory-gh/SKILL.md +120 -0
- package/src/content/.agents/skills/pc-userstory-jira/SKILL.md +131 -0
- package/src/content/.opencode/_gitignore +7 -0
- package/src/content/.opencode/commands/init.md +5 -0
- package/src/content/.opencode/commands/make-architecture.md +5 -0
- package/src/content/.opencode/commands/make-design.md +5 -0
- package/src/content/.opencode/commands/make-engineer.md +5 -0
- package/src/content/.opencode/commands/make-evidence-scaffold.md +5 -0
- package/src/content/.opencode/commands/make-guardrails.md +5 -0
- package/src/content/.opencode/commands/make-user-model.md +5 -0
- package/src/content/.opencode/commands/ops-backlog.md +10 -0
- package/src/content/.opencode/commands/ops-evidence.md +9 -0
- package/src/content/.opencode/commands/ops-review.md +8 -0
- package/src/content/.opencode/commands/ops-ship.md +9 -0
- package/src/content/.opencode/commands/plan-apply.md +9 -0
- package/src/content/.opencode/commands/plan-archive.md +5 -0
- package/src/content/.opencode/commands/plan-explore.md +9 -0
- package/src/content/.opencode/commands/plan-goal.md +5 -0
- package/src/content/.opencode/commands/plan-propose.md +9 -0
- package/src/content/.opencode/commands/plan-quick.md +5 -0
- package/src/content/.opencode/commands/plan-story.md +9 -0
- package/src/content/.opencode/commands/repo-audit.md +5 -0
- package/src/content/.opencode/commands/repo-help.md +5 -0
- package/src/content/.opencode/commands/repo-initialize.md +5 -0
- package/src/content/.opencode/commands/repo-onboard.md +5 -0
- package/src/content/.opencode/commands/repo-verify.md +5 -0
- package/src/content/.opencode/package.json +10 -0
- package/src/content/.opencode/plugins/pc-subagent-monitor.js +139 -0
- package/src/content/.opencode/plugins/pc-subagent-tiers.js +179 -0
- package/src/content/.opencode/plugins/pc-system-reminders.js +96 -0
- package/src/content/.opencode/plugins/pc-system-reminders.test.js +35 -0
- package/src/content/.opencode/tui/pc-subagents.tsx +98 -0
- package/src/content/.opencode/tui.json +6 -0
- package/src/content/AGENTS.md +71 -0
- package/src/content/ARCHITECTURE.md +16 -0
- package/src/content/DESIGN.md +16 -0
- package/src/content/opencode.jsonc +31 -0
- package/src/content/openspec/changes/archive/.gitkeep +0 -0
- package/src/content/openspec/config.yaml +20 -0
- package/src/content/openspec/specs/.gitkeep +0 -0
- package/src/content/skills-lock.json +17 -0
- package/src/fragments/archive/az.md +95 -0
- package/src/fragments/archive/gh.md +94 -0
- package/src/fragments/archive/gl.md +94 -0
- package/src/fragments/archive/none.md +73 -0
- package/src/fragments/guardrails/codegraph.md +7 -0
- package/src/fragments/guardrails/humanizer.md +4 -0
- package/src/fragments/guardrails/memory.md +4 -0
- package/src/fragments/guardrails/rtk.md +3 -0
- package/src/fragments/guardrails/simple-english.md +4 -0
- package/src/fragments/ops-backlog/az.md +29 -0
- package/src/fragments/ops-backlog/gh.md +30 -0
- package/src/fragments/ops-backlog/jira.md +29 -0
- package/src/fragments/ops-evidence/az.md +41 -0
- package/src/fragments/ops-evidence/gh.md +53 -0
- package/src/fragments/ops-evidence/jira.md +38 -0
- package/src/fragments/ops-review/az.md +63 -0
- package/src/fragments/ops-review/gh.md +53 -0
- package/src/fragments/ops-review/gl.md +57 -0
- package/src/fragments/ops-ship/az.md +81 -0
- package/src/fragments/ops-ship/gh.md +69 -0
- package/src/fragments/ops-ship/gl.md +86 -0
- package/src/index.js +107 -0
- package/src/presets/agents-content.json +53 -0
- package/src/presets/browser.json +22 -0
- package/src/presets/clean.json +21 -0
- package/src/presets/models.json +68 -0
- package/src/presets/openspec.json +1 -0
- package/src/presets/optimization.json +37 -0
- package/src/presets/platforms.json +76 -0
- package/src/presets/quota.json +16 -0
- package/src/presets/source.json +23 -0
- package/src/steps/browser/index.js +91 -0
- package/src/steps/clean/index.js +120 -0
- package/src/steps/copy/agents.js +118 -0
- package/src/steps/copy/commands.js +91 -0
- package/src/steps/copy/fullstack-engineer.js +83 -0
- package/src/steps/copy/index.js +88 -0
- package/src/steps/copy/opencode-json.js +129 -0
- package/src/steps/copy/skills.js +196 -0
- package/src/steps/metadata/index.js +108 -0
- package/src/steps/models/format.js +88 -0
- package/src/steps/models/index.js +64 -0
- package/src/steps/models/write.js +34 -0
- package/src/steps/openspec/index.js +136 -0
- package/src/steps/optimization/codegraph.js +127 -0
- package/src/steps/optimization/humanizer.js +17 -0
- package/src/steps/optimization/index.js +163 -0
- package/src/steps/optimization/memory.js +88 -0
- package/src/steps/optimization/patch-guardrails.js +108 -0
- package/src/steps/optimization/quota.js +119 -0
- package/src/steps/optimization/simple-english.js +17 -0
- package/src/steps/optimization/skills-lock.js +30 -0
- package/src/steps/platform/index.js +109 -0
- package/src/steps/source/index.js +123 -0
- package/src/utils/copy.js +108 -0
- package/src/utils/exec-spinner.js +47 -0
- package/src/utils/exec.js +134 -0
- package/src/utils/legacy-check.js +30 -0
- package/src/utils/models-cache.js +58 -0
- package/src/utils/models-pricing.js +42 -0
- package/src/utils/paths.js +64 -0
- package/src/utils/process.js +3 -0
- package/src/utils/terminal.js +6 -0
- package/src/utils/update-manifest.js +49 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import os from 'node:os'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Every harness path that lands in a consumer repo, in one place.
|
|
6
|
+
*
|
|
7
|
+
* These filenames are a contract with every repo the harness has been
|
|
8
|
+
* installed into: the CLI writes them, and the opencode plugins shipped in
|
|
9
|
+
* src/content/.opencode/plugins/ read them back at runtime. Changing a name
|
|
10
|
+
* here means changing it in that payload too, or the plugins go blind.
|
|
11
|
+
*
|
|
12
|
+
* They are deliberately named for the harness rather than for the CLI, so a
|
|
13
|
+
* future rename of the package does not become a rename of the on-disk state.
|
|
14
|
+
*/
|
|
15
|
+
export const OPENCODE_DIR = '.opencode'
|
|
16
|
+
|
|
17
|
+
/** Project config written by the metadata step. */
|
|
18
|
+
export const CONFIG_FILE = 'harness.json'
|
|
19
|
+
|
|
20
|
+
/** Per-developer model override, gitignored, never committed. */
|
|
21
|
+
export const USER_CONFIG_FILE = 'harness.user.json'
|
|
22
|
+
|
|
23
|
+
/** Hashes of every managed file, so `update` can detect local edits. */
|
|
24
|
+
export const MANIFEST_FILE = 'harness-managed.json'
|
|
25
|
+
|
|
26
|
+
/** Live subagent wave state, owned by the pc-subagent-monitor plugin. */
|
|
27
|
+
export const RUN_STATE_FILE = 'harness-run.json'
|
|
28
|
+
|
|
29
|
+
/** Names `.opencode/.gitignore` must cover. Mirrored in content/.opencode/_gitignore. */
|
|
30
|
+
export const IGNORED_ENTRIES = [
|
|
31
|
+
'node_modules',
|
|
32
|
+
RUN_STATE_FILE,
|
|
33
|
+
USER_CONFIG_FILE,
|
|
34
|
+
MANIFEST_FILE,
|
|
35
|
+
'source-roots.json',
|
|
36
|
+
'*-engineer.*.md',
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
export function configPath(cwd = process.cwd()) {
|
|
40
|
+
return path.join(cwd, OPENCODE_DIR, CONFIG_FILE)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function userConfigPath(cwd = process.cwd()) {
|
|
44
|
+
return path.join(cwd, OPENCODE_DIR, USER_CONFIG_FILE)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function manifestPath(cwd = process.cwd()) {
|
|
48
|
+
return path.join(cwd, OPENCODE_DIR, MANIFEST_FILE)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Cross-run models cache, keyed to the CLI rather than to any one repo. */
|
|
52
|
+
export function modelsCacheDir() {
|
|
53
|
+
return path.join(os.homedir(), '.config', 'agent-harness')
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Filenames written by opencode-onboard v1.x. Only used to detect a v1 repo
|
|
58
|
+
* and refuse to half-patch it: nothing reads their contents.
|
|
59
|
+
*/
|
|
60
|
+
export const LEGACY_CONFIG_FILES = [
|
|
61
|
+
'opencode-onboard.json',
|
|
62
|
+
'opencode-onboard.user.json',
|
|
63
|
+
'opencode-onboard-managed.json',
|
|
64
|
+
]
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import crypto from 'node:crypto'
|
|
2
|
+
import fse from 'fs-extra'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import { MANIFEST_FILE, OPENCODE_DIR } from './paths.js'
|
|
5
|
+
|
|
6
|
+
const MANIFEST_RELATIVE_PATH = path.join(OPENCODE_DIR, MANIFEST_FILE)
|
|
7
|
+
|
|
8
|
+
function normalizeRelativePath(relativePath) {
|
|
9
|
+
return relativePath.split(path.sep).join('/')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function hashContent(content) {
|
|
13
|
+
return crypto.createHash('sha256').update(content).digest('hex')
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function hashFile(filePath) {
|
|
17
|
+
return hashContent(await fse.readFile(filePath))
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function readUpdateManifest(cwd = process.cwd()) {
|
|
21
|
+
const manifestPath = path.join(cwd, MANIFEST_RELATIVE_PATH)
|
|
22
|
+
const manifest = await fse.readJson(manifestPath).catch(() => ({ version: 1, files: {} }))
|
|
23
|
+
if (!manifest.files || typeof manifest.files !== 'object') manifest.files = {}
|
|
24
|
+
return manifest
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function writeUpdateManifest(manifest, cwd = process.cwd()) {
|
|
28
|
+
const manifestPath = path.join(cwd, MANIFEST_RELATIVE_PATH)
|
|
29
|
+
await fse.ensureDir(path.dirname(manifestPath))
|
|
30
|
+
await fse.writeJson(manifestPath, manifest, { spaces: 2 })
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function canUpdateManagedFile(relativePath, cwd, manifest) {
|
|
34
|
+
const normalizedPath = normalizeRelativePath(relativePath)
|
|
35
|
+
const destinationPath = path.join(cwd, relativePath)
|
|
36
|
+
if (!await fse.pathExists(destinationPath)) return true
|
|
37
|
+
const previousHash = manifest.files?.[normalizedPath]
|
|
38
|
+
if (!previousHash) return false
|
|
39
|
+
return previousHash === await hashFile(destinationPath)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export async function recordManagedFile(manifest, relativePath, sourcePath) {
|
|
43
|
+
const files = manifest.files
|
|
44
|
+
files[normalizeRelativePath(relativePath)] = await hashFile(sourcePath)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function manifestPath() {
|
|
48
|
+
return MANIFEST_RELATIVE_PATH
|
|
49
|
+
}
|