@plainconceptsplatform/agent-harness 3.0.2 → 3.1.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/cli/index.js CHANGED
File without changes
@@ -8,11 +8,6 @@
8
8
  "value": "rtk",
9
9
  "checked": true
10
10
  },
11
- {
12
- "name": "opencode-quota plugin (recommended)",
13
- "value": "quota",
14
- "checked": true
15
- },
16
11
  {
17
12
  "name": "Simple English concise mode (recommended)",
18
13
  "value": "simpleEnglish",
@@ -1,95 +1,79 @@
1
- import fse from 'fs-extra'
2
- import path from 'path'
3
- import { fileURLToPath } from 'url'
4
- import { success } from '../../utils/exec.js'
5
-
6
- const __dirname = path.dirname(fileURLToPath(import.meta.url))
7
-
8
- const _archive = {
9
- azure: await fse.readFile(path.resolve(__dirname, '../../fragments/archive/az.md'), 'utf-8'),
10
- github: await fse.readFile(path.resolve(__dirname, '../../fragments/archive/gh.md'), 'utf-8'),
11
- gitlab: await fse.readFile(path.resolve(__dirname, '../../fragments/archive/gl.md'), 'utf-8'),
12
- none: await fse.readFile(path.resolve(__dirname, '../../fragments/archive/none.md'), 'utf-8'),
13
- }
14
-
15
- const _ship = {
16
- github: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-ship/gh.md'), 'utf-8'),
17
- azure: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-ship/az.md'), 'utf-8'),
18
- gitlab: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-ship/gl.md'), 'utf-8'),
19
- }
20
-
21
- const _review = {
22
- github: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-review/gh.md'), 'utf-8'),
23
- azure: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-review/az.md'), 'utf-8'),
24
- gitlab: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-review/gl.md'), 'utf-8'),
25
- }
26
-
27
- const _backlog = {
28
- github: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-backlog/gh.md'), 'utf-8'),
29
- azure: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-backlog/az.md'), 'utf-8'),
30
- jira: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-backlog/jira.md'), 'utf-8'),
31
- }
32
-
33
- // Evidence comments target the backlog platform (where the issue/work-item lives).
34
- const _evidence = {
35
- github: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-evidence/gh.md'), 'utf-8'),
36
- azure: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-evidence/az.md'), 'utf-8'),
37
- jira: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-evidence/jira.md'), 'utf-8'),
38
- }
39
-
40
- // relativePath is POSIX-style relative to the project root; commands live in
41
- // .opencode/commands/, skill-backed procedures (plan-archive, ops-ship) in
42
- // .agents/skills/<name>/SKILL.md.
43
- function patchFile(relativePath, startMarker, endMarker, content, platform, cwd = process.cwd()) {
44
- const targetPath = path.join(cwd, ...relativePath.split('/'))
45
- if (!fse.pathExistsSync(targetPath)) return
46
-
47
- let fileContent = fse.readFileSync(targetPath, 'utf-8')
48
- if (!fileContent.includes(startMarker) || !fileContent.includes(endMarker)) return
49
-
50
- const pattern = new RegExp(`${startMarker.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}[\\s\\S]*?${endMarker.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`)
51
- // Replacer function, not a replacement string: the injected fragments contain
52
- // shell quoting like $'...' and a string replacement expands $' as "everything
53
- // after the match", silently truncating the command. That is how the ops-ship
54
- // screenshot comment lost its entire --body argument.
55
- fileContent = fileContent.replace(pattern, () => `${startMarker}\n${content.trim()}\n${endMarker}`)
56
- fse.writeFileSync(targetPath, `${fileContent.replace(/\s*$/, '')}\n`, 'utf-8')
57
- success(`${relativePath} content injected for platform: ${platform}`)
58
- }
59
-
60
- export async function patchArchiveCommand(platform, cwd = process.cwd()) {
61
- const repoPlatform = typeof platform === 'object' ? (platform.repoPlatform ?? platform.backlogPlatform ?? 'github') : platform
62
- const replacement = _archive[repoPlatform]
63
- if (!replacement) return
64
- patchFile('.agents/skills/pc-plan-archive/SKILL.md', '<!-- PC-PLATFORM-ARCHIVE-START -->', '<!-- PC-PLATFORM-ARCHIVE-END -->', replacement, repoPlatform, cwd)
65
- }
66
-
67
- export async function patchOpsShip(platform, cwd = process.cwd()) {
68
- const repoPlatform = typeof platform === 'object' ? (platform.repoPlatform ?? 'github') : platform
69
- const replacement = _ship[repoPlatform]
70
- if (!replacement) return
71
- patchFile('.agents/skills/pc-ops-ship/SKILL.md', '<!-- PC-PLATFORM-SHIP-START -->', '<!-- PC-PLATFORM-SHIP-END -->', replacement, repoPlatform, cwd)
72
- }
73
-
74
- export async function patchOpsReview(platform, cwd = process.cwd()) {
75
- const repoPlatform = typeof platform === 'object' ? (platform.repoPlatform ?? 'github') : platform
76
- const replacement = _review[repoPlatform]
77
- if (!replacement) return
78
- patchFile('.opencode/commands/ops-review.md', '<!-- PC-PLATFORM-REVIEW-START -->', '<!-- PC-PLATFORM-REVIEW-END -->', replacement, repoPlatform, cwd)
79
- }
80
-
81
- export async function patchOpsBacklog(platform, cwd = process.cwd()) {
82
- const backlogPlatform = typeof platform === 'object' ? (platform.backlogPlatform ?? 'github') : platform
83
- const replacement = _backlog[backlogPlatform]
84
- if (!replacement) return
85
- patchFile('.opencode/commands/ops-backlog.md', '<!-- PC-PLATFORM-BACKLOG-START -->', '<!-- PC-PLATFORM-BACKLOG-END -->', replacement, backlogPlatform, cwd)
86
- }
87
-
88
- export async function patchOpsEvidence(platform, cwd = process.cwd()) {
89
- const backlogPlatform = typeof platform === 'object' ? (platform.backlogPlatform ?? 'github') : platform
90
- const replacement = _evidence[backlogPlatform]
91
- // browser/none have no CLI to post with: leave the markers empty (the skill skips commenting).
92
- if (!replacement) return
93
- patchFile('.agents/skills/pc-ops-evidence/SKILL.md', '<!-- PC-PLATFORM-EVIDENCE-START -->', '<!-- PC-PLATFORM-EVIDENCE-END -->', replacement, backlogPlatform, cwd)
94
- }
95
-
1
+ import fse from 'fs-extra'
2
+ import path from 'path'
3
+ import { fileURLToPath } from 'url'
4
+ import { success } from '../../utils/exec.js'
5
+
6
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
7
+
8
+ const _archive = {
9
+ azure: await fse.readFile(path.resolve(__dirname, '../../fragments/archive/az.md'), 'utf-8'),
10
+ github: await fse.readFile(path.resolve(__dirname, '../../fragments/archive/gh.md'), 'utf-8'),
11
+ gitlab: await fse.readFile(path.resolve(__dirname, '../../fragments/archive/gl.md'), 'utf-8'),
12
+ none: await fse.readFile(path.resolve(__dirname, '../../fragments/archive/none.md'), 'utf-8'),
13
+ }
14
+
15
+ const _ship = {
16
+ github: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-ship/gh.md'), 'utf-8'),
17
+ azure: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-ship/az.md'), 'utf-8'),
18
+ gitlab: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-ship/gl.md'), 'utf-8'),
19
+ }
20
+
21
+ const _review = {
22
+ github: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-review/gh.md'), 'utf-8'),
23
+ azure: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-review/az.md'), 'utf-8'),
24
+ gitlab: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-review/gl.md'), 'utf-8'),
25
+ }
26
+
27
+ const _backlog = {
28
+ github: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-backlog/gh.md'), 'utf-8'),
29
+ azure: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-backlog/az.md'), 'utf-8'),
30
+ jira: await fse.readFile(path.resolve(__dirname, '../../fragments/ops-backlog/jira.md'), 'utf-8'),
31
+ }
32
+
33
+ // relativePath is POSIX-style relative to the project root; commands live in
34
+ // .opencode/commands/, skill-backed procedures (plan-archive, ops-ship) in
35
+ // .agents/skills/<name>/SKILL.md.
36
+ function patchFile(relativePath, startMarker, endMarker, content, platform, cwd = process.cwd()) {
37
+ const targetPath = path.join(cwd, ...relativePath.split('/'))
38
+ if (!fse.pathExistsSync(targetPath)) return
39
+
40
+ let fileContent = fse.readFileSync(targetPath, 'utf-8')
41
+ if (!fileContent.includes(startMarker) || !fileContent.includes(endMarker)) return
42
+
43
+ const pattern = new RegExp(`${startMarker.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}[\\s\\S]*?${endMarker.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`)
44
+ // Replacer function, not a replacement string: the injected fragments contain
45
+ // shell quoting like $'...' and a string replacement expands $' as "everything
46
+ // after the match", silently truncating the command. That is how the ops-ship
47
+ // screenshot comment lost its entire --body argument.
48
+ fileContent = fileContent.replace(pattern, () => `${startMarker}\n${content.trim()}\n${endMarker}`)
49
+ fse.writeFileSync(targetPath, `${fileContent.replace(/\s*$/, '')}\n`, 'utf-8')
50
+ success(`${relativePath} content injected for platform: ${platform}`)
51
+ }
52
+
53
+ export async function patchArchiveCommand(platform, cwd = process.cwd()) {
54
+ const repoPlatform = typeof platform === 'object' ? (platform.repoPlatform ?? platform.backlogPlatform ?? 'github') : platform
55
+ const replacement = _archive[repoPlatform]
56
+ if (!replacement) return
57
+ patchFile('.agents/skills/pc-plan-archive/SKILL.md', '<!-- PC-PLATFORM-ARCHIVE-START -->', '<!-- PC-PLATFORM-ARCHIVE-END -->', replacement, repoPlatform, cwd)
58
+ }
59
+
60
+ export async function patchOpsShip(platform, cwd = process.cwd()) {
61
+ const repoPlatform = typeof platform === 'object' ? (platform.repoPlatform ?? 'github') : platform
62
+ const replacement = _ship[repoPlatform]
63
+ if (!replacement) return
64
+ patchFile('.agents/skills/pc-ops-ship/SKILL.md', '<!-- PC-PLATFORM-SHIP-START -->', '<!-- PC-PLATFORM-SHIP-END -->', replacement, repoPlatform, cwd)
65
+ }
66
+
67
+ export async function patchOpsReview(platform, cwd = process.cwd()) {
68
+ const repoPlatform = typeof platform === 'object' ? (platform.repoPlatform ?? 'github') : platform
69
+ const replacement = _review[repoPlatform]
70
+ if (!replacement) return
71
+ patchFile('.opencode/commands/ops-review.md', '<!-- PC-PLATFORM-REVIEW-START -->', '<!-- PC-PLATFORM-REVIEW-END -->', replacement, repoPlatform, cwd)
72
+ }
73
+
74
+ export async function patchOpsBacklog(platform, cwd = process.cwd()) {
75
+ const backlogPlatform = typeof platform === 'object' ? (platform.backlogPlatform ?? 'github') : platform
76
+ const replacement = _backlog[backlogPlatform]
77
+ if (!replacement) return
78
+ patchFile('.opencode/commands/ops-backlog.md', '<!-- PC-PLATFORM-BACKLOG-START -->', '<!-- PC-PLATFORM-BACKLOG-END -->', replacement, backlogPlatform, cwd)
79
+ }
@@ -1,88 +1,88 @@
1
- import fse from "fs-extra"
2
- import path from "path"
3
- import { fileURLToPath } from "url"
4
- import { copyContent, recordManagedContent } from "../../utils/copy.js"
5
- import { error, header, success } from "../../utils/exec.js"
6
- import { exit } from "../../utils/process.js"
7
- import { patchAgentGuidance, patchAgentsMd } from "./agents.js"
8
- import { patchArchiveCommand, patchOpsShip, patchOpsReview, patchOpsBacklog, patchOpsEvidence } from "./commands.js"
9
- import { installSkills } from "./skills.js"
10
- import { generateFullstackEngineer, removeLegacyStartupDirectives } from "./fullstack-engineer.js"
11
- import { patchOpencodeJson, patchOpencodePackage } from "./opencode-json.js"
12
-
13
- const __dirname = path.dirname(fileURLToPath(import.meta.url))
14
- const CONTENT_DIR = path.resolve(__dirname, "../../../harness")
15
-
16
- export async function copyContentStep(platform, ctx = {}) {
17
- header("Step 5, Copying agent-harness files")
18
-
19
- const dest = process.cwd()
20
-
21
- // Support both old single-string platform and new { backlogPlatform, repoPlatform }
22
- const backlogPlatform = typeof platform === 'object' ? platform.backlogPlatform : platform
23
- const repoPlatform = typeof platform === 'object' ? platform.repoPlatform : platform
24
-
25
- try {
26
- await copyContent(CONTENT_DIR, dest, platform, ctx)
27
-
28
- // .gitignore is stripped by npm during publish, so the source file is _gitignore.
29
- // Also, fse.copy with overwrite:false won't overwrite an existing .gitignore,
30
- // so merge manually to preserve both opencode's defaults and our additions.
31
- const srcGitignore = path.join(CONTENT_DIR, ".opencode", "_gitignore")
32
- const destGitignore = path.join(dest, ".opencode", ".gitignore")
33
- if (await fse.pathExists(srcGitignore)) {
34
- const srcLines = (await fse.readFile(srcGitignore, "utf-8")).split("\n").map(l => l.trim()).filter(Boolean)
35
- const destLines = (await fse.pathExists(destGitignore))
36
- ? (await fse.readFile(destGitignore, "utf-8")).split("\n").map(l => l.trim()).filter(Boolean)
37
- : []
38
- const merged = Array.from(new Set([...destLines, ...srcLines]))
39
- await fse.writeFile(destGitignore, `${merged.join("\n")}\n`, "utf-8")
40
- }
41
-
42
- // Remove the _gitignore template from dest: it was only needed for the merge above.
43
- const destGitignoreTemplate = path.join(dest, ".opencode", "_gitignore")
44
- if (await fse.pathExists(destGitignoreTemplate)) {
45
- await fse.remove(destGitignoreTemplate)
46
- }
47
-
48
- const rootsFile = path.join(dest, ".opencode", "source-roots.json")
49
- if (!ctx.updateMode || !await fse.pathExists(rootsFile)) {
50
- await fse.writeJson(
51
- rootsFile,
52
- {
53
- mode: ctx.sourceMode || "current",
54
- // An empty array is truthy, so `|| [dest]` never kicked in and reruns
55
- // wrote `roots: []`, leaving agents with no source scope.
56
- roots: ctx.sourceRoots?.length ? ctx.sourceRoots : [dest],
57
- },
58
- { spaces: 2 },
59
- )
60
- }
61
-
62
- await patchAgentGuidance(backlogPlatform, repoPlatform)
63
- await patchOpsReview({ backlogPlatform, repoPlatform })
64
- await patchOpsBacklog({ backlogPlatform, repoPlatform })
65
- await patchOpencodeJson()
66
- await patchOpencodePackage()
67
- if (!ctx.updateMode) await patchAgentsMd(ctx)
68
-
69
- if (!ctx.skipSkills) {
70
- await installSkills(backlogPlatform, repoPlatform, {
71
- forceOverwrite: ctx.forceOverwrite,
72
- updateMode: ctx.updateMode,
73
- })
74
- }
75
- // These patch SKILL.md files (pc-plan-archive, pc-ops-ship, pc-ops-evidence),
76
- // so they must run after installSkills has copied the skills into the project.
77
- await patchArchiveCommand({ backlogPlatform, repoPlatform })
78
- await patchOpsShip({ backlogPlatform, repoPlatform })
79
- await patchOpsEvidence({ backlogPlatform, repoPlatform })
80
- await generateFullstackEngineer({ updateMode: ctx.updateMode })
81
- await removeLegacyStartupDirectives()
82
- await recordManagedContent(CONTENT_DIR, dest, { updateMode: ctx.updateMode })
83
- success("Files copied to project root")
84
- } catch (err) {
85
- error(`Failed to copy content: ${err.message}`)
86
- exit(1)
87
- }
88
- }
1
+ import fse from "fs-extra"
2
+ import path from "path"
3
+ import { fileURLToPath } from "url"
4
+ import { copyContent, recordManagedContent } from "../../utils/copy.js"
5
+ import { error, header, success } from "../../utils/exec.js"
6
+ import { exit } from "../../utils/process.js"
7
+ import { patchAgentGuidance, patchAgentsMd } from "./agents.js"
8
+ import { patchArchiveCommand, patchOpsShip, patchOpsReview, patchOpsBacklog } from "./commands.js"
9
+ import { installSkills, removeRetiredFiles } from "./skills.js"
10
+ import { generateFullstackEngineer, removeLegacyStartupDirectives } from "./fullstack-engineer.js"
11
+ import { patchOpencodeJson, patchOpencodePackage } from "./opencode-json.js"
12
+
13
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
14
+ const CONTENT_DIR = path.resolve(__dirname, "../../../harness")
15
+
16
+ export async function copyContentStep(platform, ctx = {}) {
17
+ header("Step 5, Copying agent-harness files")
18
+
19
+ const dest = process.cwd()
20
+
21
+ // Support both old single-string platform and new { backlogPlatform, repoPlatform }
22
+ const backlogPlatform = typeof platform === 'object' ? platform.backlogPlatform : platform
23
+ const repoPlatform = typeof platform === 'object' ? platform.repoPlatform : platform
24
+
25
+ try {
26
+ await copyContent(CONTENT_DIR, dest, platform, ctx)
27
+
28
+ // .gitignore is stripped by npm during publish, so the source file is _gitignore.
29
+ // Also, fse.copy with overwrite:false won't overwrite an existing .gitignore,
30
+ // so merge manually to preserve both opencode's defaults and our additions.
31
+ const srcGitignore = path.join(CONTENT_DIR, ".opencode", "_gitignore")
32
+ const destGitignore = path.join(dest, ".opencode", ".gitignore")
33
+ if (await fse.pathExists(srcGitignore)) {
34
+ const srcLines = (await fse.readFile(srcGitignore, "utf-8")).split("\n").map(l => l.trim()).filter(Boolean)
35
+ const destLines = (await fse.pathExists(destGitignore))
36
+ ? (await fse.readFile(destGitignore, "utf-8")).split("\n").map(l => l.trim()).filter(Boolean)
37
+ : []
38
+ const merged = Array.from(new Set([...destLines, ...srcLines]))
39
+ await fse.writeFile(destGitignore, `${merged.join("\n")}\n`, "utf-8")
40
+ }
41
+
42
+ // Remove the _gitignore template from dest: it was only needed for the merge above.
43
+ const destGitignoreTemplate = path.join(dest, ".opencode", "_gitignore")
44
+ if (await fse.pathExists(destGitignoreTemplate)) {
45
+ await fse.remove(destGitignoreTemplate)
46
+ }
47
+
48
+ const rootsFile = path.join(dest, ".opencode", "source-roots.json")
49
+ if (!ctx.updateMode || !await fse.pathExists(rootsFile)) {
50
+ await fse.writeJson(
51
+ rootsFile,
52
+ {
53
+ mode: ctx.sourceMode || "current",
54
+ // An empty array is truthy, so `|| [dest]` never kicked in and reruns
55
+ // wrote `roots: []`, leaving agents with no source scope.
56
+ roots: ctx.sourceRoots?.length ? ctx.sourceRoots : [dest],
57
+ },
58
+ { spaces: 2 },
59
+ )
60
+ }
61
+
62
+ await patchAgentGuidance(backlogPlatform, repoPlatform)
63
+ await patchOpsReview({ backlogPlatform, repoPlatform })
64
+ await patchOpsBacklog({ backlogPlatform, repoPlatform })
65
+ await patchOpencodeJson()
66
+ await patchOpencodePackage()
67
+ if (!ctx.updateMode) await patchAgentsMd(ctx)
68
+
69
+ if (!ctx.skipSkills) {
70
+ await installSkills(backlogPlatform, repoPlatform, {
71
+ forceOverwrite: ctx.forceOverwrite,
72
+ updateMode: ctx.updateMode,
73
+ })
74
+ }
75
+ // These patch SKILL.md files (pc-plan-archive, pc-ops-ship),
76
+ // so they must run after installSkills has copied the skills into the project.
77
+ await patchArchiveCommand({ backlogPlatform, repoPlatform })
78
+ await patchOpsShip({ backlogPlatform, repoPlatform })
79
+ await removeRetiredFiles()
80
+ await generateFullstackEngineer({ updateMode: ctx.updateMode })
81
+ await removeLegacyStartupDirectives()
82
+ await recordManagedContent(CONTENT_DIR, dest, { updateMode: ctx.updateMode })
83
+ success("Files copied to project root")
84
+ } catch (err) {
85
+ error(`Failed to copy content: ${err.message}`)
86
+ exit(1)
87
+ }
88
+ }
@@ -24,9 +24,12 @@ const CONFIG_SCHEMA = 'https://opencode.ai/config.json'
24
24
 
25
25
  // Third-party plugins the harness configures, and how they move to V2. The
26
26
  // notifier is dropped: V2 has native attention notifications and sounds.
27
- const OPENCODE_QUOTA_PACKAGE = '@slkiser/opencode-quota'
28
- const OPENCODE_QUOTA_VERSION = '5.0.1'
29
- const DROPPED_PLUGIN_PREFIXES = ['@opencode-ai/', '@mohak34/opencode-notifier', '@different-ai/opencode-browser']
27
+ const DROPPED_PLUGIN_PREFIXES = [
28
+ '@opencode-ai/',
29
+ '@mohak34/opencode-notifier',
30
+ '@different-ai/opencode-browser',
31
+ '@slkiser/opencode-quota',
32
+ ]
30
33
 
31
34
  // V1 permission keys -> V2 permission actions.
32
35
  const ACTION_RENAMES = {
@@ -76,10 +79,6 @@ function migratePluginArray(obj) {
76
79
  }
77
80
  const base = basePackageName(entry)
78
81
  if (DROPPED_PLUGIN_PREFIXES.some(prefix => base.startsWith(prefix))) continue
79
- if (base === OPENCODE_QUOTA_PACKAGE) {
80
- plugins.push(`${OPENCODE_QUOTA_PACKAGE}@${OPENCODE_QUOTA_VERSION}`)
81
- continue
82
- }
83
82
  plugins.push(entry)
84
83
  }
85
84
  obj.plugins = plugins