@cluesmith/codev 3.0.0-rc.0 → 3.0.0-rc.10
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 +201 -0
- package/bin/af.js +2 -2
- package/bin/afx.js +8 -0
- package/bin/consult.js +2 -1
- package/bin/team.js +8 -0
- package/{dashboard/dist/assets/index-nr0cXxtf.css → dashboard-dist/assets/index-Bs8I7N2s.css} +1 -1
- package/dashboard-dist/assets/index-CkNo2z6t.js +195 -0
- package/dashboard-dist/assets/index-CkNo2z6t.js.map +1 -0
- package/dashboard-dist/dist/assets/index-Bs8I7N2s.css +32 -0
- package/dashboard-dist/dist/assets/index-CkNo2z6t.js +195 -0
- package/dashboard-dist/dist/assets/index-CkNo2z6t.js.map +1 -0
- package/{dashboard → dashboard-dist}/dist/index.html +2 -2
- package/dashboard-dist/index.html +14 -0
- package/dist/agent-farm/cli.d.ts.map +1 -1
- package/dist/agent-farm/cli.js +21 -13
- package/dist/agent-farm/cli.js.map +1 -1
- package/dist/agent-farm/commands/architect.d.ts +4 -4
- package/dist/agent-farm/commands/architect.d.ts.map +1 -1
- package/dist/agent-farm/commands/architect.js +23 -12
- package/dist/agent-farm/commands/architect.js.map +1 -1
- package/dist/agent-farm/commands/attach.js +8 -8
- package/dist/agent-farm/commands/attach.js.map +1 -1
- package/dist/agent-farm/commands/bench.d.ts +1 -1
- package/dist/agent-farm/commands/bench.js +1 -1
- package/dist/agent-farm/commands/cleanup.d.ts.map +1 -1
- package/dist/agent-farm/commands/cleanup.js +10 -5
- package/dist/agent-farm/commands/cleanup.js.map +1 -1
- package/dist/agent-farm/commands/cron.js +1 -1
- package/dist/agent-farm/commands/cron.js.map +1 -1
- package/dist/agent-farm/commands/db.d.ts +3 -3
- package/dist/agent-farm/commands/db.js +4 -4
- package/dist/agent-farm/commands/db.js.map +1 -1
- package/dist/agent-farm/commands/open.js +2 -2
- package/dist/agent-farm/commands/open.js.map +1 -1
- package/dist/agent-farm/commands/rename.js +1 -1
- package/dist/agent-farm/commands/rename.js.map +1 -1
- package/dist/agent-farm/commands/send.d.ts +4 -1
- package/dist/agent-farm/commands/send.d.ts.map +1 -1
- package/dist/agent-farm/commands/send.js +8 -5
- package/dist/agent-farm/commands/send.js.map +1 -1
- package/dist/agent-farm/commands/shell.js +3 -3
- package/dist/agent-farm/commands/shell.js.map +1 -1
- package/dist/agent-farm/commands/spawn-roles.d.ts +2 -1
- package/dist/agent-farm/commands/spawn-roles.d.ts.map +1 -1
- package/dist/agent-farm/commands/spawn-roles.js +1 -1
- package/dist/agent-farm/commands/spawn-roles.js.map +1 -1
- package/dist/agent-farm/commands/spawn-worktree.d.ts +49 -10
- package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -1
- package/dist/agent-farm/commands/spawn-worktree.js +357 -49
- package/dist/agent-farm/commands/spawn-worktree.js.map +1 -1
- package/dist/agent-farm/commands/spawn.d.ts +6 -6
- package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
- package/dist/agent-farm/commands/spawn.js +182 -74
- package/dist/agent-farm/commands/spawn.js.map +1 -1
- package/dist/agent-farm/commands/status.d.ts.map +1 -1
- package/dist/agent-farm/commands/status.js +48 -3
- package/dist/agent-farm/commands/status.js.map +1 -1
- package/dist/agent-farm/commands/team-update.d.ts +1 -1
- package/dist/agent-farm/commands/team-update.d.ts.map +1 -1
- package/dist/agent-farm/commands/team-update.js +8 -5
- package/dist/agent-farm/commands/team-update.js.map +1 -1
- package/dist/agent-farm/commands/team.d.ts +7 -1
- package/dist/agent-farm/commands/team.d.ts.map +1 -1
- package/dist/agent-farm/commands/team.js +36 -4
- package/dist/agent-farm/commands/team.js.map +1 -1
- package/dist/agent-farm/commands/tower-cloud.d.ts +2 -2
- package/dist/agent-farm/commands/tower-cloud.js +3 -3
- package/dist/agent-farm/commands/tower-cloud.js.map +1 -1
- package/dist/agent-farm/commands/tower.d.ts +1 -0
- package/dist/agent-farm/commands/tower.d.ts.map +1 -1
- package/dist/agent-farm/commands/tower.js +54 -3
- package/dist/agent-farm/commands/tower.js.map +1 -1
- package/dist/agent-farm/lib/cloud-config.js +2 -2
- package/dist/agent-farm/lib/cloud-config.js.map +1 -1
- package/dist/agent-farm/lib/tower-client.d.ts +6 -230
- package/dist/agent-farm/lib/tower-client.d.ts.map +1 -1
- package/dist/agent-farm/lib/tower-client.js +6 -293
- package/dist/agent-farm/lib/tower-client.js.map +1 -1
- package/dist/agent-farm/lib/tunnel-client.js +1 -1
- package/dist/agent-farm/lib/tunnel-client.js.map +1 -1
- package/dist/agent-farm/servers/message-write.d.ts +24 -0
- package/dist/agent-farm/servers/message-write.d.ts.map +1 -0
- package/dist/agent-farm/servers/message-write.js +63 -0
- package/dist/agent-farm/servers/message-write.js.map +1 -0
- package/dist/agent-farm/servers/overview.d.ts +10 -8
- package/dist/agent-farm/servers/overview.d.ts.map +1 -1
- package/dist/agent-farm/servers/overview.js +78 -38
- package/dist/agent-farm/servers/overview.js.map +1 -1
- package/dist/agent-farm/servers/send-buffer.d.ts +4 -3
- package/dist/agent-farm/servers/send-buffer.d.ts.map +1 -1
- package/dist/agent-farm/servers/send-buffer.js +7 -4
- package/dist/agent-farm/servers/send-buffer.js.map +1 -1
- package/dist/agent-farm/servers/tower-cron-parser.js +1 -1
- package/dist/agent-farm/servers/tower-cron-parser.js.map +1 -1
- package/dist/agent-farm/servers/tower-cron.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-cron.js +4 -5
- package/dist/agent-farm/servers/tower-cron.js.map +1 -1
- package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-instances.js +24 -15
- package/dist/agent-farm/servers/tower-instances.js.map +1 -1
- package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-routes.js +9 -16
- package/dist/agent-farm/servers/tower-routes.js.map +1 -1
- package/dist/agent-farm/servers/tower-server.js +15 -1
- package/dist/agent-farm/servers/tower-server.js.map +1 -1
- package/dist/agent-farm/servers/tower-terminals.d.ts +2 -2
- package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-terminals.js +64 -36
- package/dist/agent-farm/servers/tower-terminals.js.map +1 -1
- package/dist/agent-farm/servers/tower-tunnel.js +2 -2
- package/dist/agent-farm/servers/tower-tunnel.js.map +1 -1
- package/dist/agent-farm/servers/tower-utils.d.ts +9 -6
- package/dist/agent-farm/servers/tower-utils.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-utils.js +13 -7
- package/dist/agent-farm/servers/tower-utils.js.map +1 -1
- package/dist/agent-farm/types.d.ts +13 -0
- package/dist/agent-farm/types.d.ts.map +1 -1
- package/dist/agent-farm/utils/config.d.ts +11 -0
- package/dist/agent-farm/utils/config.d.ts.map +1 -1
- package/dist/agent-farm/utils/config.js +39 -17
- package/dist/agent-farm/utils/config.js.map +1 -1
- package/dist/agent-farm/utils/harness.d.ts +85 -0
- package/dist/agent-farm/utils/harness.d.ts.map +1 -0
- package/dist/agent-farm/utils/harness.js +212 -0
- package/dist/agent-farm/utils/harness.js.map +1 -0
- package/dist/agent-farm/utils/roles.d.ts +11 -4
- package/dist/agent-farm/utils/roles.d.ts.map +1 -1
- package/dist/agent-farm/utils/roles.js +21 -6
- package/dist/agent-farm/utils/roles.js.map +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +118 -5
- package/dist/cli.js.map +1 -1
- package/dist/commands/adopt.d.ts.map +1 -1
- package/dist/commands/adopt.js +16 -45
- package/dist/commands/adopt.js.map +1 -1
- package/dist/commands/consult/index.d.ts +6 -2
- package/dist/commands/consult/index.d.ts.map +1 -1
- package/dist/commands/consult/index.js +231 -183
- package/dist/commands/consult/index.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +121 -31
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +13 -43
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/porch/artifacts.d.ts +69 -0
- package/dist/commands/porch/artifacts.d.ts.map +1 -0
- package/dist/commands/porch/artifacts.js +368 -0
- package/dist/commands/porch/artifacts.js.map +1 -0
- package/dist/commands/porch/checks.d.ts +14 -3
- package/dist/commands/porch/checks.d.ts.map +1 -1
- package/dist/commands/porch/checks.js +150 -4
- package/dist/commands/porch/checks.js.map +1 -1
- package/dist/commands/porch/config.d.ts +6 -9
- package/dist/commands/porch/config.d.ts.map +1 -1
- package/dist/commands/porch/config.js +12 -37
- package/dist/commands/porch/config.js.map +1 -1
- package/dist/commands/porch/index.d.ts +12 -7
- package/dist/commands/porch/index.d.ts.map +1 -1
- package/dist/commands/porch/index.js +273 -82
- package/dist/commands/porch/index.js.map +1 -1
- package/dist/commands/porch/next.d.ts.map +1 -1
- package/dist/commands/porch/next.js +142 -75
- package/dist/commands/porch/next.js.map +1 -1
- package/dist/commands/porch/notify.d.ts +2 -2
- package/dist/commands/porch/notify.js +5 -5
- package/dist/commands/porch/notify.js.map +1 -1
- package/dist/commands/porch/prompts.d.ts +2 -1
- package/dist/commands/porch/prompts.d.ts.map +1 -1
- package/dist/commands/porch/prompts.js +34 -38
- package/dist/commands/porch/prompts.js.map +1 -1
- package/dist/commands/porch/protocol.d.ts +4 -3
- package/dist/commands/porch/protocol.d.ts.map +1 -1
- package/dist/commands/porch/protocol.js +21 -21
- package/dist/commands/porch/protocol.js.map +1 -1
- package/dist/commands/porch/state.d.ts +27 -2
- package/dist/commands/porch/state.d.ts.map +1 -1
- package/dist/commands/porch/state.js +100 -9
- package/dist/commands/porch/state.js.map +1 -1
- package/dist/commands/porch/types.d.ts +10 -2
- package/dist/commands/porch/types.d.ts.map +1 -1
- package/dist/commands/sync.d.ts +26 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +207 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/update.d.ts +15 -2
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +159 -202
- package/dist/commands/update.js.map +1 -1
- package/dist/lib/config.d.ts +96 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +165 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/forge-contracts.d.ts +100 -0
- package/dist/lib/forge-contracts.d.ts.map +1 -0
- package/dist/lib/forge-contracts.js +35 -0
- package/dist/lib/forge-contracts.js.map +1 -0
- package/dist/lib/forge.d.ts +102 -0
- package/dist/lib/forge.d.ts.map +1 -0
- package/dist/lib/forge.js +376 -0
- package/dist/lib/forge.js.map +1 -0
- package/dist/lib/github.d.ts +68 -60
- package/dist/lib/github.d.ts.map +1 -1
- package/dist/lib/github.js +160 -169
- package/dist/lib/github.js.map +1 -1
- package/dist/lib/skeleton.d.ts +15 -5
- package/dist/lib/skeleton.d.ts.map +1 -1
- package/dist/lib/skeleton.js +82 -7
- package/dist/lib/skeleton.js.map +1 -1
- package/dist/lib/team-github.d.ts +7 -3
- package/dist/lib/team-github.d.ts.map +1 -1
- package/dist/lib/team-github.js +29 -19
- package/dist/lib/team-github.js.map +1 -1
- package/dist/lib/team.d.ts.map +1 -1
- package/dist/lib/team.js +4 -1
- package/dist/lib/team.js.map +1 -1
- package/dist/terminal/pty-manager.d.ts.map +1 -1
- package/dist/terminal/pty-manager.js +2 -0
- package/dist/terminal/pty-manager.js.map +1 -1
- package/dist/terminal/ws-protocol.d.ts +10 -8
- package/dist/terminal/ws-protocol.d.ts.map +1 -1
- package/dist/terminal/ws-protocol.js +3 -0
- package/dist/terminal/ws-protocol.js.map +1 -1
- package/package.json +28 -24
- package/scripts/forge/gitea/auth-status.sh +3 -0
- package/scripts/forge/gitea/issue-comment.sh +3 -0
- package/scripts/forge/gitea/issue-list.sh +3 -0
- package/scripts/forge/gitea/issue-view.sh +3 -0
- package/scripts/forge/gitea/pr-exists.sh +6 -0
- package/scripts/forge/gitea/pr-list.sh +3 -0
- package/scripts/forge/gitea/pr-merge.sh +3 -0
- package/scripts/forge/gitea/pr-view.sh +3 -0
- package/scripts/forge/gitea/recently-closed.sh +3 -0
- package/scripts/forge/gitea/recently-merged.sh +3 -0
- package/scripts/forge/gitea/repo-archive.sh +11 -0
- package/scripts/forge/gitea/user-identity.sh +3 -0
- package/scripts/forge/github/auth-status.sh +4 -0
- package/scripts/forge/github/issue-comment.sh +5 -0
- package/scripts/forge/github/issue-list.sh +4 -0
- package/scripts/forge/github/issue-view.sh +5 -0
- package/scripts/forge/github/on-it-timestamps.sh +8 -0
- package/scripts/forge/github/pr-diff.sh +10 -0
- package/scripts/forge/github/pr-exists.sh +7 -0
- package/scripts/forge/github/pr-list.sh +4 -0
- package/scripts/forge/github/pr-merge.sh +5 -0
- package/scripts/forge/github/pr-search.sh +5 -0
- package/scripts/forge/github/pr-view.sh +11 -0
- package/scripts/forge/github/recently-closed.sh +15 -0
- package/scripts/forge/github/recently-merged.sh +15 -0
- package/scripts/forge/github/repo-archive.sh +10 -0
- package/scripts/forge/github/team-activity.sh +5 -0
- package/scripts/forge/github/user-identity.sh +4 -0
- package/scripts/forge/gitlab/auth-status.sh +3 -0
- package/scripts/forge/gitlab/issue-comment.sh +3 -0
- package/scripts/forge/gitlab/issue-list.sh +3 -0
- package/scripts/forge/gitlab/issue-view.sh +3 -0
- package/scripts/forge/gitlab/pr-diff.sh +3 -0
- package/scripts/forge/gitlab/pr-exists.sh +5 -0
- package/scripts/forge/gitlab/pr-list.sh +3 -0
- package/scripts/forge/gitlab/pr-merge.sh +3 -0
- package/scripts/forge/gitlab/pr-search.sh +3 -0
- package/scripts/forge/gitlab/pr-view.sh +3 -0
- package/scripts/forge/gitlab/recently-closed.sh +3 -0
- package/scripts/forge/gitlab/recently-merged.sh +3 -0
- package/scripts/forge/gitlab/repo-archive.sh +12 -0
- package/scripts/forge/gitlab/user-identity.sh +3 -0
- package/skeleton/.claude/skills/afx/SKILL.md +144 -0
- package/skeleton/.claude/skills/codev/SKILL.md +3 -3
- package/skeleton/.claude/skills/consult/SKILL.md +1 -1
- package/skeleton/.claude/skills/porch/SKILL.md +2 -2
- package/skeleton/DEPENDENCIES.md +1 -1
- package/skeleton/builders.md +4 -4
- package/skeleton/protocol-schema.json +2 -2
- package/skeleton/protocols/air/builder-prompt.md +6 -6
- package/skeleton/protocols/air/prompts/pr.md +2 -2
- package/skeleton/protocols/air/protocol.md +1 -2
- package/skeleton/protocols/aspir/builder-prompt.md +28 -6
- package/skeleton/protocols/aspir/protocol.json +9 -1
- package/skeleton/protocols/aspir/protocol.md +1 -1
- package/skeleton/protocols/aspir/templates/plan.md +0 -20
- package/skeleton/protocols/aspir/templates/spec.md +0 -28
- package/skeleton/protocols/bugfix/builder-prompt.md +6 -6
- package/skeleton/protocols/bugfix/prompts/pr.md +1 -1
- package/skeleton/protocols/experiment/protocol.md +1 -6
- package/skeleton/protocols/maintain/builder-prompt.md +12 -11
- package/skeleton/protocols/maintain/prompts/maintain.md +88 -0
- package/skeleton/protocols/maintain/prompts/review.md +72 -0
- package/skeleton/protocols/maintain/protocol.json +14 -68
- package/skeleton/protocols/maintain/protocol.md +111 -409
- package/skeleton/protocols/maintain/templates/maintenance-run.md +18 -49
- package/skeleton/protocols/protocol-schema.json +1 -1
- package/skeleton/protocols/spike/builder-prompt.md +1 -1
- package/skeleton/protocols/spike/protocol.md +4 -4
- package/skeleton/protocols/spir/builder-prompt.md +28 -5
- package/skeleton/protocols/spir/protocol.json +9 -1
- package/skeleton/protocols/spir/protocol.md +2 -2
- package/skeleton/protocols/spir/templates/plan.md +0 -20
- package/skeleton/protocols/spir/templates/spec.md +0 -28
- package/skeleton/resources/commands/agent-farm.md +84 -84
- package/skeleton/resources/commands/codev.md +1 -1
- package/skeleton/resources/commands/consult.md +16 -7
- package/skeleton/resources/commands/overview.md +14 -15
- package/skeleton/resources/risk-triage.md +1 -1
- package/skeleton/resources/workflow-reference.md +14 -14
- package/skeleton/roles/architect.md +55 -43
- package/skeleton/roles/builder.md +22 -14
- package/skeleton/templates/AGENTS.md +4 -3
- package/skeleton/templates/CLAUDE.md +4 -3
- package/skeleton/templates/cheatsheet.md +11 -12
- package/templates/3d-viewer.html +16 -18
- package/templates/tower.html +1 -1
- package/dashboard/dist/assets/index-CiIBsixF.js +0 -194
- package/dashboard/dist/assets/index-CiIBsixF.js.map +0 -1
- package/skeleton/.claude/skills/af/SKILL.md +0 -146
- package/skeleton/porch/prompts/understand.md +0 -61
- package/skeleton/porch/prompts/verify.md +0 -58
- package/skeleton/protocols/maintain/prompts/audit.md +0 -111
- package/skeleton/protocols/maintain/prompts/clean.md +0 -91
- package/skeleton/protocols/maintain/prompts/sync.md +0 -113
- package/skeleton/protocols/maintain/prompts/verify.md +0 -110
- package/skeleton/protocols/tick/builder-prompt.md +0 -65
- package/skeleton/protocols/tick/consult-types/impl-review.md +0 -72
- package/skeleton/protocols/tick/consult-types/plan-review.md +0 -59
- package/skeleton/protocols/tick/consult-types/pr-review.md +0 -72
- package/skeleton/protocols/tick/consult-types/spec-review.md +0 -55
- package/skeleton/protocols/tick/protocol.json +0 -151
- package/skeleton/protocols/tick/protocol.md +0 -277
- package/skeleton/protocols/tick/templates/plan.md +0 -67
- package/skeleton/protocols/tick/templates/review.md +0 -89
- package/skeleton/protocols/tick/templates/spec.md +0 -61
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified configuration loader for Codev.
|
|
3
|
+
*
|
|
4
|
+
* Loads and merges config from three layers (lowest → highest priority):
|
|
5
|
+
* 1. Hardcoded defaults
|
|
6
|
+
* 2. ~/.codev/config.json (global)
|
|
7
|
+
* 3. .codev/config.json (project)
|
|
8
|
+
*
|
|
9
|
+
* af-config.json is no longer supported — its presence triggers a hard error
|
|
10
|
+
* directing the user to run `codev update` to migrate.
|
|
11
|
+
*/
|
|
12
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
13
|
+
import { resolve } from 'node:path';
|
|
14
|
+
import { homedir } from 'node:os';
|
|
15
|
+
import { getFrameworkCacheDir as _getFrameworkCacheDir } from './skeleton.js';
|
|
16
|
+
import { validateCustomHarnessConfig } from '../agent-farm/utils/harness.js';
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Defaults
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
const DEFAULT_CONFIG = {
|
|
21
|
+
shell: {
|
|
22
|
+
architect: 'claude',
|
|
23
|
+
builder: 'claude',
|
|
24
|
+
shell: 'bash',
|
|
25
|
+
},
|
|
26
|
+
porch: {
|
|
27
|
+
consultation: {
|
|
28
|
+
models: ['gemini', 'codex', 'claude'],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
framework: {
|
|
32
|
+
source: 'local',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
// Deep merge
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
/**
|
|
39
|
+
* Deep-merge `override` into `base`.
|
|
40
|
+
*
|
|
41
|
+
* Semantics (per spec):
|
|
42
|
+
* - Objects: recursively merged.
|
|
43
|
+
* - Arrays: replaced, not concatenated.
|
|
44
|
+
* - null value: deletes the key from the result.
|
|
45
|
+
*/
|
|
46
|
+
export function deepMerge(base, override) {
|
|
47
|
+
const result = { ...base };
|
|
48
|
+
for (const key of Object.keys(override)) {
|
|
49
|
+
const overrideVal = override[key];
|
|
50
|
+
// null means "delete this key"
|
|
51
|
+
if (overrideVal === null) {
|
|
52
|
+
delete result[key];
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const baseVal = result[key];
|
|
56
|
+
// Both objects (and not arrays) → recurse
|
|
57
|
+
if (typeof baseVal === 'object' && baseVal !== null && !Array.isArray(baseVal) &&
|
|
58
|
+
typeof overrideVal === 'object' && overrideVal !== null && !Array.isArray(overrideVal)) {
|
|
59
|
+
result[key] = deepMerge(baseVal, overrideVal);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
// Everything else (arrays, primitives): replace
|
|
63
|
+
result[key] = overrideVal;
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
// ---------------------------------------------------------------------------
|
|
68
|
+
// File reading helpers
|
|
69
|
+
// ---------------------------------------------------------------------------
|
|
70
|
+
function readJsonFile(filePath) {
|
|
71
|
+
if (!existsSync(filePath))
|
|
72
|
+
return null;
|
|
73
|
+
let content;
|
|
74
|
+
try {
|
|
75
|
+
content = readFileSync(filePath, 'utf-8');
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
// Permission errors: warn and fall back to defaults (per spec)
|
|
79
|
+
const code = err.code;
|
|
80
|
+
if (code === 'EACCES' || code === 'EPERM') {
|
|
81
|
+
console.warn(`Warning: Cannot read ${filePath} (${code}). Using defaults.`);
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
throw err;
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const parsed = JSON.parse(content);
|
|
88
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
|
|
89
|
+
throw new Error(`Expected a JSON object, got ${Array.isArray(parsed) ? 'array' : typeof parsed}`);
|
|
90
|
+
}
|
|
91
|
+
return parsed;
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
throw new Error(`Failed to parse ${filePath}: ${err.message}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
// Public API
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
/**
|
|
101
|
+
* Resolve the project-level config path.
|
|
102
|
+
*
|
|
103
|
+
* Returns .codev/config.json if it exists, otherwise null.
|
|
104
|
+
* Hard error if legacy af-config.json is detected — user must run
|
|
105
|
+
* `codev update` to migrate.
|
|
106
|
+
*/
|
|
107
|
+
export function resolveProjectConfigPath(workspaceRoot) {
|
|
108
|
+
const newPath = resolve(workspaceRoot, '.codev', 'config.json');
|
|
109
|
+
const legacyPath = resolve(workspaceRoot, 'af-config.json');
|
|
110
|
+
if (existsSync(legacyPath)) {
|
|
111
|
+
throw new Error(`af-config.json is no longer supported. Run 'codev update' to migrate to .codev/config.json.`);
|
|
112
|
+
}
|
|
113
|
+
if (existsSync(newPath))
|
|
114
|
+
return newPath;
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Load the full merged config for a workspace.
|
|
119
|
+
*
|
|
120
|
+
* Layer order (lowest → highest priority):
|
|
121
|
+
* 1. Hardcoded defaults
|
|
122
|
+
* 2. <cache>/config.json (remote framework base config)
|
|
123
|
+
* 3. ~/.codev/config.json (global)
|
|
124
|
+
* 4. .codev/config.json (project)
|
|
125
|
+
*/
|
|
126
|
+
export function loadConfig(workspaceRoot) {
|
|
127
|
+
let merged = structuredClone(DEFAULT_CONFIG);
|
|
128
|
+
// Layer 2: remote framework base config (if cached)
|
|
129
|
+
const cacheDir = _getFrameworkCacheDir();
|
|
130
|
+
if (cacheDir) {
|
|
131
|
+
const cacheConfigPath = resolve(cacheDir, 'config.json');
|
|
132
|
+
const cacheConfig = readJsonFile(cacheConfigPath);
|
|
133
|
+
if (cacheConfig) {
|
|
134
|
+
merged = deepMerge(merged, cacheConfig);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// Layer 3: global config
|
|
138
|
+
const globalPath = resolve(homedir(), '.codev', 'config.json');
|
|
139
|
+
const globalConfig = readJsonFile(globalPath);
|
|
140
|
+
if (globalConfig) {
|
|
141
|
+
merged = deepMerge(merged, globalConfig);
|
|
142
|
+
}
|
|
143
|
+
// Layer 4: project config (also checks for legacy af-config.json)
|
|
144
|
+
const projectPath = resolveProjectConfigPath(workspaceRoot);
|
|
145
|
+
if (projectPath) {
|
|
146
|
+
const projectConfig = readJsonFile(projectPath);
|
|
147
|
+
if (projectConfig) {
|
|
148
|
+
merged = deepMerge(merged, projectConfig);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// Validate custom harness definitions at load time
|
|
152
|
+
if (merged.harness) {
|
|
153
|
+
for (const [name, def] of Object.entries(merged.harness)) {
|
|
154
|
+
validateCustomHarnessConfig(name, def);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return merged;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Get the default config (useful for init/adopt to write a starter config).
|
|
161
|
+
*/
|
|
162
|
+
export function getDefaultConfig() {
|
|
163
|
+
return structuredClone(DEFAULT_CONFIG);
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,oBAAoB,IAAI,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AA2D7E,8EAA8E;AAC9E,WAAW;AACX,8EAA8E;AAE9E,MAAM,cAAc,GAAgB;IAClC,KAAK,EAAE;QACL,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,QAAQ;QACjB,KAAK,EAAE,MAAM;KACd;IACD,KAAK,EAAE;QACL,YAAY,EAAE;YACZ,MAAM,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC;SACtC;KACF;IACD,SAAS,EAAE;QACT,MAAM,EAAE,OAAO;KAChB;CACF,CAAC;AAEF,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAoC,IAAO,EAAE,QAAiC;IACrG,MAAM,MAAM,GAAG,EAAE,GAAG,IAAI,E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0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript interfaces for forge concept command JSON output contracts.
|
|
3
|
+
*
|
|
4
|
+
* Default `gh`-based commands produce output conforming to these interfaces.
|
|
5
|
+
* Custom commands for other forges should match these shapes where possible.
|
|
6
|
+
*
|
|
7
|
+
* **Provider presets (gitlab, gitea) are best-effort.** Their CLI tools may
|
|
8
|
+
* output different schemas than GitHub's. Consumers that parse concept output
|
|
9
|
+
* must handle `null` returns gracefully — a non-conforming response from a
|
|
10
|
+
* preset command is treated the same as a command failure.
|
|
11
|
+
*
|
|
12
|
+
* @see codev/specs/589-non-github-repository-support.md
|
|
13
|
+
*/
|
|
14
|
+
/** Output of the `issue-view` concept command. */
|
|
15
|
+
export interface IssueViewResult {
|
|
16
|
+
title: string;
|
|
17
|
+
body: string;
|
|
18
|
+
state: string;
|
|
19
|
+
comments: Array<{
|
|
20
|
+
body: string;
|
|
21
|
+
createdAt: string;
|
|
22
|
+
author: {
|
|
23
|
+
login: string;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
/** Single item in `issue-list` concept output. */
|
|
28
|
+
export interface IssueListItem {
|
|
29
|
+
number: number;
|
|
30
|
+
title: string;
|
|
31
|
+
url: string;
|
|
32
|
+
labels: Array<{
|
|
33
|
+
name: string;
|
|
34
|
+
}>;
|
|
35
|
+
createdAt: string;
|
|
36
|
+
closedAt?: string;
|
|
37
|
+
author?: {
|
|
38
|
+
login: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Output of the `issue-list` concept command. */
|
|
42
|
+
export type IssueListResult = IssueListItem[];
|
|
43
|
+
/** Output of the `recently-closed` concept command. */
|
|
44
|
+
export type RecentlyClosedResult = IssueListItem[];
|
|
45
|
+
/** Output of the `issue-comment` concept command: exit code only, no JSON. */
|
|
46
|
+
/** Single item in `pr-list` concept output. */
|
|
47
|
+
export interface PrListItem {
|
|
48
|
+
number: number;
|
|
49
|
+
title: string;
|
|
50
|
+
url: string;
|
|
51
|
+
reviewDecision: string;
|
|
52
|
+
body: string;
|
|
53
|
+
createdAt: string;
|
|
54
|
+
mergedAt?: string;
|
|
55
|
+
author?: {
|
|
56
|
+
login: string;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** Output of the `pr-list` concept command. */
|
|
60
|
+
export type PrListResult = PrListItem[];
|
|
61
|
+
/** Output of the `pr-exists` concept command: JSON boolean on stdout. */
|
|
62
|
+
/** Single item in `recently-merged` concept output. */
|
|
63
|
+
export interface MergedPrItem {
|
|
64
|
+
number: number;
|
|
65
|
+
title: string;
|
|
66
|
+
url?: string;
|
|
67
|
+
body: string;
|
|
68
|
+
createdAt: string;
|
|
69
|
+
mergedAt: string;
|
|
70
|
+
headRefName: string;
|
|
71
|
+
}
|
|
72
|
+
/** Output of the `recently-merged` concept command. */
|
|
73
|
+
export type RecentlyMergedResult = MergedPrItem[];
|
|
74
|
+
/** Single item in `pr-search` concept output. */
|
|
75
|
+
export interface PrSearchItem {
|
|
76
|
+
number: number;
|
|
77
|
+
headRefName: string;
|
|
78
|
+
}
|
|
79
|
+
/** Output of the `pr-search` concept command. */
|
|
80
|
+
export type PrSearchResult = PrSearchItem[];
|
|
81
|
+
/** Output of the `pr-view` concept command. */
|
|
82
|
+
export interface PrViewResult {
|
|
83
|
+
title: string;
|
|
84
|
+
body: string;
|
|
85
|
+
state: string;
|
|
86
|
+
author: {
|
|
87
|
+
login: string;
|
|
88
|
+
};
|
|
89
|
+
baseRefName: string;
|
|
90
|
+
headRefName: string;
|
|
91
|
+
additions: number;
|
|
92
|
+
deletions: number;
|
|
93
|
+
}
|
|
94
|
+
/** Output of the `pr-diff` concept command: raw diff text, not JSON. */
|
|
95
|
+
/** Output of the `pr-merge` concept command: exit code only, no JSON. */
|
|
96
|
+
/** Output of the `user-identity` concept command: plain string (username). */
|
|
97
|
+
/** Output of the `team-activity` concept command: raw GraphQL response. */
|
|
98
|
+
/** Output of the `on-it-timestamps` concept command: raw GraphQL response. */
|
|
99
|
+
/** Output of the `auth-status` concept command: exit code only. */
|
|
100
|
+
//# sourceMappingURL=forge-contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forge-contracts.d.ts","sourceRoot":"","sources":["../../src/lib/forge-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,kDAAkD;AAClD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC;KAC3B,CAAC,CAAC;CACJ;AAED,kDAAkD;AAClD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5B;AAED,kDAAkD;AAClD,MAAM,MAAM,eAAe,GAAG,aAAa,EAAE,CAAC;AAE9C,uDAAuD;AACvD,MAAM,MAAM,oBAAoB,GAAG,aAAa,EAAE,CAAC;AAEnD,8EAA8E;AAO9E,+CAA+C;AAC/C,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5B;AAED,+CAA+C;AAC/C,MAAM,MAAM,YAAY,GAAG,UAAU,EAAE,CAAC;AAExC,yEAAyE;AAGzE,uDAAuD;AACvD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,uDAAuD;AACvD,MAAM,MAAM,oBAAoB,GAAG,YAAY,EAAE,CAAC;AAElD,iDAAiD;AACjD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,iDAAiD;AACjD,MAAM,MAAM,cAAc,GAAG,YAAY,EAAE,CAAC;AAE5C,+CAA+C;AAC/C,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wEAAwE;AAGxE,yEAAyE;AAOzE,8EAA8E;AAG9E,2EAA2E;AAI3E,8EAA8E;AAQ9E,mEAAmE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript interfaces for forge concept command JSON output contracts.
|
|
3
|
+
*
|
|
4
|
+
* Default `gh`-based commands produce output conforming to these interfaces.
|
|
5
|
+
* Custom commands for other forges should match these shapes where possible.
|
|
6
|
+
*
|
|
7
|
+
* **Provider presets (gitlab, gitea) are best-effort.** Their CLI tools may
|
|
8
|
+
* output different schemas than GitHub's. Consumers that parse concept output
|
|
9
|
+
* must handle `null` returns gracefully — a non-conforming response from a
|
|
10
|
+
* preset command is treated the same as a command failure.
|
|
11
|
+
*
|
|
12
|
+
* @see codev/specs/589-non-github-repository-support.md
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
15
|
+
/** Output of the `pr-diff` concept command: raw diff text, not JSON. */
|
|
16
|
+
// Returns diff text on stdout. Use `raw: true` option.
|
|
17
|
+
/** Output of the `pr-merge` concept command: exit code only, no JSON. */
|
|
18
|
+
// No interface needed — success is determined by exit code 0.
|
|
19
|
+
// =============================================================================
|
|
20
|
+
// Identity & team concepts
|
|
21
|
+
// =============================================================================
|
|
22
|
+
/** Output of the `user-identity` concept command: plain string (username). */
|
|
23
|
+
// Returns username string on stdout. Not JSON.
|
|
24
|
+
/** Output of the `team-activity` concept command: raw GraphQL response. */
|
|
25
|
+
// Returns the raw GraphQL JSON response. Codev handles parsing via
|
|
26
|
+
// parseTeamGraphQLResponse in team-github.ts.
|
|
27
|
+
/** Output of the `on-it-timestamps` concept command: raw GraphQL response. */
|
|
28
|
+
// Returns the raw GraphQL JSON response. Codev handles parsing to extract
|
|
29
|
+
// "On it!" comment timestamps per issue.
|
|
30
|
+
// =============================================================================
|
|
31
|
+
// Auth concepts
|
|
32
|
+
// =============================================================================
|
|
33
|
+
/** Output of the `auth-status` concept command: exit code only. */
|
|
34
|
+
// Exit code 0 = authenticated, non-zero = not authenticated.
|
|
35
|
+
//# sourceMappingURL=forge-contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forge-contracts.js","sourceRoot":"","sources":["../../src/lib/forge-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;;AA+FH,wEAAwE;AACxE,uDAAuD;AAEvD,yEAAyE;AACzE,8DAA8D;AAE9D,gFAAgF;AAChF,2BAA2B;AAC3B,gFAAgF;AAEhF,8EAA8E;AAC9E,+CAA+C;AAE/C,2EAA2E;AAC3E,mEAAmE;AACnE,8CAA8C;AAE9C,8EAA8E;AAC9E,0EAA0E;AAC1E,yCAAyC;AAEzC,gFAAgF;AAChF,gBAAgB;AAChB,gFAAgF;AAEhF,mEAAmE;AACnE,6DAA6D"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forge concept command dispatcher.
|
|
3
|
+
*
|
|
4
|
+
* Routes forge operations (issue fetch, PR list, etc.) through configurable
|
|
5
|
+
* external commands. Default commands wrap the `gh` CLI for GitHub repos.
|
|
6
|
+
* Projects override commands via the `forge` section in .codev/config.json.
|
|
7
|
+
*
|
|
8
|
+
* Concept commands are executed via shell (`sh -c`) to support pipes,
|
|
9
|
+
* redirects, and variable expansion in user-configured commands.
|
|
10
|
+
* Environment variables (CODEV_*) are set before invocation.
|
|
11
|
+
*
|
|
12
|
+
* @see codev/specs/589-non-github-repository-support.md
|
|
13
|
+
*/
|
|
14
|
+
/** Forge config from .codev/config.json `forge` section (concept overrides + optional provider). */
|
|
15
|
+
export type ForgeConfig = Record<string, string | null> & {
|
|
16
|
+
provider?: string;
|
|
17
|
+
};
|
|
18
|
+
/** Options for forge command execution. */
|
|
19
|
+
export interface ForgeCommandOptions {
|
|
20
|
+
/** Working directory for command execution. */
|
|
21
|
+
cwd?: string;
|
|
22
|
+
/** Workspace root for loading .codev/config.json (only used if forgeConfig not provided). */
|
|
23
|
+
workspaceRoot?: string;
|
|
24
|
+
/** Pre-loaded forge config. Avoids repeated .codev/config.json reads. */
|
|
25
|
+
forgeConfig?: ForgeConfig | null;
|
|
26
|
+
/** If true, return stdout as raw string instead of parsing as JSON. */
|
|
27
|
+
raw?: boolean;
|
|
28
|
+
/** Maximum stdout buffer size in bytes. Defaults to 10MB. */
|
|
29
|
+
maxBuffer?: number;
|
|
30
|
+
}
|
|
31
|
+
/** Get known provider names. */
|
|
32
|
+
export declare function getKnownProviders(): string[];
|
|
33
|
+
/** Resolution source for a concept command. */
|
|
34
|
+
export type ConceptSource = 'override' | 'preset' | 'default' | 'disabled';
|
|
35
|
+
export interface ConceptResolution {
|
|
36
|
+
concept: string;
|
|
37
|
+
command: string | null;
|
|
38
|
+
source: ConceptSource;
|
|
39
|
+
executable: string | null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Resolve all 15 concepts with their source and executable.
|
|
43
|
+
* Used by `codev doctor` for full concept reporting.
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolveAllConcepts(forgeConfig?: ForgeConfig | null): ConceptResolution[];
|
|
46
|
+
/**
|
|
47
|
+
* Load forge configuration from .codev/config.json (via unified config loader).
|
|
48
|
+
* Returns the forge section or null if not configured.
|
|
49
|
+
*
|
|
50
|
+
* Prefer passing forge config directly via ForgeCommandOptions.forgeConfig
|
|
51
|
+
* when config is already loaded (e.g., from loadConfig in lib/config.ts).
|
|
52
|
+
*/
|
|
53
|
+
export declare function loadForgeConfig(workspaceRoot: string): ForgeConfig | null;
|
|
54
|
+
/**
|
|
55
|
+
* Get the command string for a concept.
|
|
56
|
+
* Resolution order: manual concept override > provider preset > default (github).
|
|
57
|
+
* Returns null if concept is explicitly disabled (set to null in config).
|
|
58
|
+
*/
|
|
59
|
+
export declare function getForgeCommand(concept: string, forgeConfig?: ForgeConfig | null): string | null;
|
|
60
|
+
/**
|
|
61
|
+
* Check if a concept is explicitly disabled (set to null in config).
|
|
62
|
+
*/
|
|
63
|
+
export declare function isConceptDisabled(concept: string, forgeConfig?: ForgeConfig | null): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Execute a forge concept command asynchronously.
|
|
66
|
+
*
|
|
67
|
+
* Sets CODEV_* environment variables, executes the configured command
|
|
68
|
+
* via shell, and parses stdout as JSON. Returns null on failure.
|
|
69
|
+
*
|
|
70
|
+
* @param concept - The concept name (e.g., 'issue-view', 'pr-list')
|
|
71
|
+
* @param env - Additional environment variables to set (CODEV_* prefix recommended)
|
|
72
|
+
* @param options - Execution options
|
|
73
|
+
* @returns Parsed JSON from stdout, raw string for non-JSON concepts, or null on failure
|
|
74
|
+
*/
|
|
75
|
+
export declare function executeForgeCommand(concept: string, env?: Record<string, string>, options?: ForgeCommandOptions): Promise<unknown | null>;
|
|
76
|
+
/**
|
|
77
|
+
* Execute a forge concept command synchronously.
|
|
78
|
+
*
|
|
79
|
+
* Same as executeForgeCommand but blocks until completion.
|
|
80
|
+
* Use sparingly — prefer the async variant.
|
|
81
|
+
*/
|
|
82
|
+
export declare function executeForgeCommandSync(concept: string, env?: Record<string, string>, options?: ForgeCommandOptions): unknown | null;
|
|
83
|
+
/**
|
|
84
|
+
* Get the list of all known concept names.
|
|
85
|
+
*/
|
|
86
|
+
export declare function getKnownConcepts(): string[];
|
|
87
|
+
/**
|
|
88
|
+
* Get the default command for a concept (ignoring user config).
|
|
89
|
+
* Useful for documentation and doctor checks.
|
|
90
|
+
*/
|
|
91
|
+
export declare function getDefaultCommand(concept: string): string | null;
|
|
92
|
+
/**
|
|
93
|
+
* Validate forge configuration.
|
|
94
|
+
* Returns an array of diagnostic messages.
|
|
95
|
+
* Used by `codev doctor`.
|
|
96
|
+
*/
|
|
97
|
+
export declare function validateForgeConfig(forgeConfig: ForgeConfig): {
|
|
98
|
+
concept: string;
|
|
99
|
+
status: 'ok' | 'disabled' | 'unknown_concept' | 'empty_command' | 'provider';
|
|
100
|
+
message: string;
|
|
101
|
+
}[];
|
|
102
|
+
//# sourceMappingURL=forge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forge.d.ts","sourceRoot":"","sources":["../../src/lib/forge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA8BH,oGAAoG;AACpG,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GAA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