@s_s/harmonia 1.1.0 → 1.1.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/build/cli/setup.js +2 -3
- package/build/cli/setup.js.map +1 -1
- package/build/setup/inject.d.ts +11 -3
- package/build/setup/inject.js +19 -12
- package/build/setup/inject.js.map +1 -1
- package/package.json +2 -2
package/build/cli/setup.js
CHANGED
|
@@ -40,12 +40,11 @@ export async function runSetup(opts) {
|
|
|
40
40
|
const projectDir = resolve(process.cwd());
|
|
41
41
|
console.log(`\nHarmonia Setup`);
|
|
42
42
|
console.log(`──────────────────────────────`);
|
|
43
|
-
console.log(` Dir: ${projectDir}`);
|
|
44
43
|
// 1. Detect agent
|
|
45
44
|
const agentType = opts.agent ?? (await detectHostAgent(projectDir));
|
|
46
45
|
console.log(` Agent: ${agentType}`);
|
|
47
|
-
// 2. Inject prompt (project-agnostic
|
|
48
|
-
const result = await injectPrompt(
|
|
46
|
+
// 2. Inject prompt (global scope — project-agnostic)
|
|
47
|
+
const result = await injectPrompt(agentType);
|
|
49
48
|
const action = result.created ? 'Created' : result.replaced ? 'Updated' : 'Appended to';
|
|
50
49
|
console.log(` [done] ${action} ${result.filePath}`);
|
|
51
50
|
// 3. Install hooks
|
package/build/cli/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/cli/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,YAAY,GAAG,CAAC,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,CAAU,CA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nF,CAAC"}
|
package/build/setup/inject.d.ts
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Delegates to @s_s/agent-kit for agent detection, prompt injection, and
|
|
5
5
|
* marker management. Harmonia provides the prompt content via templates.ts.
|
|
6
|
+
*
|
|
7
|
+
* Always uses global scope — PM prompt is project-agnostic and should be
|
|
8
|
+
* written to the agent's global config directory (e.g. ~/.openclaw/workspace/AGENTS.md).
|
|
6
9
|
*/
|
|
7
10
|
import { type AgentType } from '@s_s/agent-kit';
|
|
8
11
|
/** Marker constants for external use (tests, etc.) */
|
|
@@ -17,13 +20,18 @@ export declare const HARMONIA_MARKER_END = "<!-- harmonia:end -->";
|
|
|
17
20
|
*/
|
|
18
21
|
export declare function detectHostAgent(projectDir: string): Promise<AgentType>;
|
|
19
22
|
/**
|
|
20
|
-
* Inject the Harmonia PM guidance block into
|
|
23
|
+
* Inject the Harmonia PM guidance block into the agent's **global** config file.
|
|
21
24
|
* If a harmonia block already exists, it is replaced (idempotent).
|
|
22
25
|
* If the file doesn't exist, it is created.
|
|
23
26
|
*
|
|
24
|
-
* Uses
|
|
27
|
+
* Uses global scope because PM prompt is project-agnostic.
|
|
28
|
+
* This writes to the agent's global config directory:
|
|
29
|
+
* - opencode: ~/.config/opencode/AGENTS.md
|
|
30
|
+
* - claude-code: ~/.claude/CLAUDE.md
|
|
31
|
+
* - openclaw: ~/.openclaw/workspace/AGENTS.md
|
|
32
|
+
* - codex: ~/.codex/AGENTS.md
|
|
25
33
|
*/
|
|
26
|
-
export declare function injectPrompt(
|
|
34
|
+
export declare function injectPrompt(agentType: AgentType): Promise<{
|
|
27
35
|
filePath: string;
|
|
28
36
|
created: boolean;
|
|
29
37
|
replaced: boolean;
|
package/build/setup/inject.js
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Delegates to @s_s/agent-kit for agent detection, prompt injection, and
|
|
5
5
|
* marker management. Harmonia provides the prompt content via templates.ts.
|
|
6
|
+
*
|
|
7
|
+
* Always uses global scope — PM prompt is project-agnostic and should be
|
|
8
|
+
* written to the agent's global config directory (e.g. ~/.openclaw/workspace/AGENTS.md).
|
|
6
9
|
*/
|
|
7
|
-
import { readFile } from 'node:fs/promises';
|
|
8
10
|
import { createKit, detectAgent } from '@s_s/agent-kit';
|
|
11
|
+
import { readFile } from 'node:fs/promises';
|
|
9
12
|
import { generatePmPrompt } from './templates.js';
|
|
10
13
|
/** Shared kit instance — binds all marker tags to "harmonia" */
|
|
11
14
|
const kit = createKit('harmonia');
|
|
@@ -24,32 +27,36 @@ export async function detectHostAgent(projectDir) {
|
|
|
24
27
|
return detected ?? 'opencode';
|
|
25
28
|
}
|
|
26
29
|
/**
|
|
27
|
-
* Inject the Harmonia PM guidance block into
|
|
30
|
+
* Inject the Harmonia PM guidance block into the agent's **global** config file.
|
|
28
31
|
* If a harmonia block already exists, it is replaced (idempotent).
|
|
29
32
|
* If the file doesn't exist, it is created.
|
|
30
33
|
*
|
|
31
|
-
* Uses
|
|
34
|
+
* Uses global scope because PM prompt is project-agnostic.
|
|
35
|
+
* This writes to the agent's global config directory:
|
|
36
|
+
* - opencode: ~/.config/opencode/AGENTS.md
|
|
37
|
+
* - claude-code: ~/.claude/CLAUDE.md
|
|
38
|
+
* - openclaw: ~/.openclaw/workspace/AGENTS.md
|
|
39
|
+
* - codex: ~/.codex/AGENTS.md
|
|
32
40
|
*/
|
|
33
|
-
export async function injectPrompt(
|
|
41
|
+
export async function injectPrompt(agentType) {
|
|
34
42
|
const prompt = generatePmPrompt();
|
|
43
|
+
const globalScope = { scope: 'global' };
|
|
35
44
|
// Check pre-existing state for return value
|
|
36
|
-
const hasExisting = await kit.hasPromptInjected(agentType,
|
|
45
|
+
const hasExisting = await kit.hasPromptInjected(agentType, globalScope);
|
|
46
|
+
// Resolve the actual file path for reporting
|
|
47
|
+
const { configFile: filePath } = kit.resolvePaths(agentType, globalScope);
|
|
37
48
|
// Determine if the config file exists (for created flag)
|
|
38
49
|
let fileExists = true;
|
|
39
50
|
try {
|
|
40
|
-
|
|
41
|
-
// by looking for an existing injection or reading the resolved file
|
|
42
|
-
const configFileName = agentType === 'claude-code' ? 'CLAUDE.md' : 'AGENTS.md';
|
|
43
|
-
await readFile(`${projectDir}/${configFileName}`, 'utf-8');
|
|
51
|
+
await readFile(filePath, 'utf-8');
|
|
44
52
|
}
|
|
45
53
|
catch {
|
|
46
54
|
fileExists = false;
|
|
47
55
|
}
|
|
48
56
|
// Inject via agent-kit (handles create, append, and idempotent replace)
|
|
49
|
-
await kit.injectPrompt(agentType, prompt,
|
|
50
|
-
const configFileName = agentType === 'claude-code' ? 'CLAUDE.md' : 'AGENTS.md';
|
|
57
|
+
await kit.injectPrompt(agentType, prompt, globalScope);
|
|
51
58
|
return {
|
|
52
|
-
filePath
|
|
59
|
+
filePath,
|
|
53
60
|
created: !fileExists,
|
|
54
61
|
replaced: hasExisting,
|
|
55
62
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inject.js","sourceRoot":"","sources":["../../src/setup/inject.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"inject.js","sourceRoot":"","sources":["../../src/setup/inject.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAkB,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,gEAAgE;AAChE,MAAM,GAAG,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;AAElC,sDAAsD;AACtD,MAAM,CAAC,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAC/D,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,UAAkB;IACpD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,UAAU,CAAC,CAAC;IAC/C,OAAO,QAAQ,IAAI,UAAU,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAC9B,SAAoB;IAEpB,MAAM,MAAM,GAAG,gBAAgB,EAAE,CAAC;IAClC,MAAM,WAAW,GAAG,EAAE,KAAK,EAAE,QAAiB,EAAE,CAAC;IAEjD,4CAA4C;IAC5C,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,iBAAiB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAExE,6CAA6C;IAC7C,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC,YAAY,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAE1E,yDAAyD;IACzD,IAAI,UAAU,GAAG,IAAI,CAAC;IACtB,IAAI,CAAC;QACD,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACL,UAAU,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,wEAAwE;IACxE,MAAM,GAAG,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IAEvD,OAAO;QACH,QAAQ;QACR,OAAO,EAAE,CAAC,UAAU;QACpB,QAAQ,EAAE,WAAW;KACxB,CAAC;AACN,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@s_s/harmonia",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Multi-agent orchestration MCP server with pluggable workflows",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./build/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
37
|
-
"@s_s/agent-kit": "^1.1
|
|
37
|
+
"@s_s/agent-kit": "^1.2.1",
|
|
38
38
|
"yaml": "^2.8.2",
|
|
39
39
|
"zod": "^4.3.6"
|
|
40
40
|
},
|