@oisincoveney/pipeline 3.6.1 → 3.7.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.
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Caveman Mode (default ON)
|
|
2
|
+
|
|
3
|
+
Operate in caveman mode by default on every response: terse, smart-caveman phrasing — drop filler, keep ALL technical substance, code, commands, paths, and accuracy. This is active every response and does not drift off over a long session. Defer to the `caveman` skill for the exact compression rules and intensity levels. Turn off only when the user says "stop caveman" or "normal mode".
|
|
4
|
+
|
|
5
|
+
# Global Behavior
|
|
6
|
+
|
|
7
|
+
- Answer fully and stop. Never end with "Want me to do X?" or "Should I implement this?" — if the user wants more, they'll ask.
|
|
8
|
+
- Research before acting — know how components and libraries work before making changes.
|
|
9
|
+
- When uncertain, ask — don't guess.
|
|
10
|
+
- The answer to "Why is X an improvement?" should never be "I'm not sure."
|
|
11
|
+
|
|
12
|
+
## Before writing code
|
|
13
|
+
|
|
14
|
+
- Search for existing implementations before creating new code.
|
|
15
|
+
- Check for existing utilities before adding helpers.
|
|
16
|
+
- Don't add dependencies without checking if functionality already exists in current deps.
|
|
17
|
+
- Reuse patterns from similar files in the codebase.
|
|
18
|
+
|
|
19
|
+
## Problem-solving
|
|
20
|
+
|
|
21
|
+
- Is this a real problem? Reject over-engineering.
|
|
22
|
+
- Is there a simpler way? Always seek the simplest solution.
|
|
23
|
+
- Will it break anything? Backward compatibility matters.
|
|
24
|
+
|
|
25
|
+
# Anti-Patterns
|
|
26
|
+
|
|
27
|
+
## Code quality
|
|
28
|
+
|
|
29
|
+
- NEVER manually edit auto-generated files — regenerate them instead.
|
|
30
|
+
- NEVER suppress type errors (`as any`, `@ts-ignore`, `@ts-expect-error`).
|
|
31
|
+
- NEVER use bandaids or hacks — proper fixes only.
|
|
32
|
+
- NEVER create new Zod schemas when generated ones exist.
|
|
33
|
+
- NEVER use `var` declarations.
|
|
34
|
+
- NEVER add `.unwrap()` calls in Rust code.
|
|
35
|
+
|
|
36
|
+
## Error handling
|
|
37
|
+
|
|
38
|
+
- Silent error handling is NEVER permitted.
|
|
39
|
+
- Every fallback and default value MUST have specific business-logic reasoning.
|
|
40
|
+
- Unexpected errors MUST be logged, not swallowed.
|
|
41
|
+
- Errors affecting user flow MUST surface to the user — never hide failures.
|
|
42
|
+
|
|
43
|
+
## Testing
|
|
44
|
+
|
|
45
|
+
- NEVER commit code without tests for new functionality.
|
|
46
|
+
- NEVER skip tests or mark them skipped to make CI pass.
|
|
47
|
+
- NEVER disable or delete existing tests — fix the code, not the tests.
|
|
48
|
+
- Test both success and error cases.
|
|
49
|
+
|
|
50
|
+
# Verification
|
|
51
|
+
|
|
52
|
+
- Run tests, lint, and typecheck after every change.
|
|
53
|
+
- Self-assessment is unreliable — use external signals (build output, test results) as ground truth.
|
|
54
|
+
- Don't claim something works without running it.
|
|
55
|
+
- If a test suite exists, run it. Don't skip it because "the change is small."
|
|
56
|
+
|
|
57
|
+
# Coding Style
|
|
58
|
+
|
|
59
|
+
- 120 char line width.
|
|
60
|
+
- Trailing commas everywhere.
|
|
61
|
+
|
|
62
|
+
## Git
|
|
63
|
+
|
|
64
|
+
- NEVER commit/push directly to main.
|
|
65
|
+
- NEVER amend commits or rewrite history after pushing.
|
|
66
|
+
- NEVER use `--force` without explicit approval.
|
|
67
|
+
- Always create new commits — never amend, squash, or rebase unless explicitly asked.
|
|
68
|
+
- Conventional commit format: `feat|fix|chore|docs|test|refactor(scope): description`.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { resolvePackageAssetPath } from "../package-assets.js";
|
|
2
|
+
import { GENERATED_MARKER, INSTRUCTIONS_END, INSTRUCTIONS_START, OWNER_MARKER_PREFIX } from "./shared.js";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
//#region src/install-commands/instructions.ts
|
|
5
|
+
/**
|
|
6
|
+
* The canonical global agent instruction body, package-owned so every machine,
|
|
7
|
+
* k8s job, and host renders the same behavior. Shipped in `defaults/` (see
|
|
8
|
+
* package.json `files`).
|
|
9
|
+
*/
|
|
10
|
+
const INSTRUCTION_BODY = readFileSync(resolvePackageAssetPath("defaults/instructions/global.md"), "utf8").trimEnd();
|
|
11
|
+
/**
|
|
12
|
+
* The global instruction memory file each host reads, and the repo-relative
|
|
13
|
+
* path that `resolveHarnessTarget` rebases onto its per-machine config dir.
|
|
14
|
+
* Distinct from the bare `AGENTS.md` project guidance file, so these coexist
|
|
15
|
+
* with (and never trip) the PROJECT_ONLY AGENTS.md handling.
|
|
16
|
+
*/
|
|
17
|
+
const INSTRUCTION_TARGETS = [
|
|
18
|
+
{
|
|
19
|
+
host: "claude-code",
|
|
20
|
+
path: ".claude/CLAUDE.md"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
host: "codex",
|
|
24
|
+
path: ".codex/AGENTS.md"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
host: "gemini",
|
|
28
|
+
path: ".gemini/GEMINI.md"
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
/** Repo-relative paths of every generated instruction file (global scope). */
|
|
32
|
+
const INSTRUCTION_PATHS = INSTRUCTION_TARGETS.map((target) => target.path);
|
|
33
|
+
function instructionContent(host) {
|
|
34
|
+
return `${[
|
|
35
|
+
INSTRUCTIONS_START,
|
|
36
|
+
GENERATED_MARKER,
|
|
37
|
+
`${OWNER_MARKER_PREFIX}host=${host} -->`,
|
|
38
|
+
"",
|
|
39
|
+
INSTRUCTION_BODY,
|
|
40
|
+
"",
|
|
41
|
+
INSTRUCTIONS_END
|
|
42
|
+
].join("\n")}\n`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Per-host global instruction definitions. Each is upserted as a marker block
|
|
46
|
+
* so any user-authored content outside the markers in the target file is
|
|
47
|
+
* preserved. Emitted in global scope only (see GLOBAL_ONLY_PATHS).
|
|
48
|
+
*/
|
|
49
|
+
function globalInstructionDefinitions() {
|
|
50
|
+
return INSTRUCTION_TARGETS.map(({ host, path }) => ({
|
|
51
|
+
block: {
|
|
52
|
+
end: INSTRUCTIONS_END,
|
|
53
|
+
start: INSTRUCTIONS_START
|
|
54
|
+
},
|
|
55
|
+
content: instructionContent(host),
|
|
56
|
+
host,
|
|
57
|
+
invocation: "(global instructions)",
|
|
58
|
+
path
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { INSTRUCTION_PATHS, globalInstructionDefinitions };
|
|
@@ -9,6 +9,8 @@ const OWNER_TS_MARKER_PREFIX = "// @oisincoveney/pipeline:";
|
|
|
9
9
|
const OWNER_YAML_MARKER_PREFIX = "# @oisincoveney/pipeline:";
|
|
10
10
|
const AGENTS_MD_START = "<!-- @oisincoveney/pipeline:agents:start -->";
|
|
11
11
|
const AGENTS_MD_END = "<!-- @oisincoveney/pipeline:agents:end -->";
|
|
12
|
+
const INSTRUCTIONS_START = "<!-- @oisincoveney/pipeline:instructions:start -->";
|
|
13
|
+
const INSTRUCTIONS_END = "<!-- @oisincoveney/pipeline:instructions:end -->";
|
|
12
14
|
const SINGLE_OPENCODE_PLUGIN_ARRAY_RE = /\n {2}"plugin": \[\n {4}("[^"]+")\n {2}\]/;
|
|
13
15
|
const OPENCODE_PROJECT_CONFIG_PATH = ".opencode/opencode.json";
|
|
14
16
|
const CLAUDE_PROJECT_CONFIG_PATH = ".claude/settings.json";
|
|
@@ -34,6 +36,9 @@ function codexGlobalConfigDir() {
|
|
|
34
36
|
function opencodeGlobalConfigDir() {
|
|
35
37
|
return process.env.OPENCODE_CONFIG_DIR ?? join(process.env.XDG_CONFIG_HOME ?? join(homedir(), ".config"), "opencode");
|
|
36
38
|
}
|
|
39
|
+
function geminiGlobalConfigDir() {
|
|
40
|
+
return process.env.GEMINI_CONFIG_DIR ?? join(homedir(), ".gemini");
|
|
41
|
+
}
|
|
37
42
|
function stripPrefix(value, prefix) {
|
|
38
43
|
if (value === prefix) return "";
|
|
39
44
|
return value.startsWith(`${prefix}/`) ? value.slice(prefix.length + 1) : value;
|
|
@@ -55,6 +60,7 @@ function resolveHarnessTarget(scope, cwd, relPath) {
|
|
|
55
60
|
const normalized = relPath.replaceAll("\\", "/");
|
|
56
61
|
if (normalized === ".claude" || normalized.startsWith(".claude/")) return join(claudeGlobalConfigDir(), stripPrefix(normalized, ".claude"));
|
|
57
62
|
if (normalized === ".codex" || normalized.startsWith(".codex/")) return join(codexGlobalConfigDir(), stripPrefix(normalized, ".codex"));
|
|
63
|
+
if (normalized === ".gemini" || normalized.startsWith(".gemini/")) return join(geminiGlobalConfigDir(), stripPrefix(normalized, ".gemini"));
|
|
58
64
|
return join(opencodeGlobalConfigDir(), stripPrefix(normalized, ".opencode"));
|
|
59
65
|
}
|
|
60
66
|
function profileEntries(config) {
|
|
@@ -88,4 +94,4 @@ function commandIdForHost(host, entrypointId) {
|
|
|
88
94
|
return entrypointId;
|
|
89
95
|
}
|
|
90
96
|
//#endregion
|
|
91
|
-
export { AGENTS_MD_END, AGENTS_MD_START, CLAUDE_PROJECT_CONFIG_PATH, COMMAND_HOSTS, DEFAULT_HARNESS_SCOPE, ENTRYPOINT_PATH_PATTERNS, GENERATED_MARKER, GENERATED_TS_MARKER, GENERATED_YAML_MARKER, OPENCODE_PROJECT_CONFIG_PATH, OWNER_MARKER_PREFIX, OWNER_TS_MARKER_PREFIX, OWNER_YAML_MARKER_PREFIX, SINGLE_OPENCODE_PLUGIN_ARRAY_RE, commandIdForHost, compactLines, entrypointDescription, entrypointEntries, instructionsPointer, invocationForHost, profileEntries, resolveHarnessTarget };
|
|
97
|
+
export { AGENTS_MD_END, AGENTS_MD_START, CLAUDE_PROJECT_CONFIG_PATH, COMMAND_HOSTS, DEFAULT_HARNESS_SCOPE, ENTRYPOINT_PATH_PATTERNS, GENERATED_MARKER, GENERATED_TS_MARKER, GENERATED_YAML_MARKER, INSTRUCTIONS_END, INSTRUCTIONS_START, OPENCODE_PROJECT_CONFIG_PATH, OWNER_MARKER_PREFIX, OWNER_TS_MARKER_PREFIX, OWNER_YAML_MARKER_PREFIX, SINGLE_OPENCODE_PLUGIN_ARRAY_RE, commandIdForHost, compactLines, entrypointDescription, entrypointEntries, instructionsPointer, invocationForHost, profileEntries, resolveHarnessTarget };
|
package/dist/install-commands.js
CHANGED
|
@@ -3,6 +3,7 @@ import "./config.js";
|
|
|
3
3
|
import { COMMAND_HOSTS, ENTRYPOINT_PATH_PATTERNS, invocationForHost, resolveHarnessTarget } from "./install-commands/shared.js";
|
|
4
4
|
import { opencodeAdapter } from "./install-commands/opencode.js";
|
|
5
5
|
import { claudeCodeAdapter } from "./install-commands/claude-code.js";
|
|
6
|
+
import { INSTRUCTION_PATHS, globalInstructionDefinitions } from "./install-commands/instructions.js";
|
|
6
7
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
7
8
|
import { dirname, join, relative } from "node:path";
|
|
8
9
|
import { mkdir, readdir, rm, writeFile } from "node:fs/promises";
|
|
@@ -75,7 +76,7 @@ function entrypointIdFromGeneratedPath(host, path) {
|
|
|
75
76
|
}
|
|
76
77
|
function resolveDefinitionContent(definition, target) {
|
|
77
78
|
const adapter = ADAPTERS[definition.host];
|
|
78
|
-
if (!(adapter
|
|
79
|
+
if (!(adapter?.mergeDefinition && existsSync(target))) return {
|
|
79
80
|
conflict: false,
|
|
80
81
|
content: definition.content
|
|
81
82
|
};
|
|
@@ -120,7 +121,7 @@ function upsertGeneratedBlock(current, content, block) {
|
|
|
120
121
|
return `${current.trimEnd()}${separator}${content}`;
|
|
121
122
|
}
|
|
122
123
|
function adapterForcesDefinition(definition) {
|
|
123
|
-
const fn = ADAPTERS[definition.host]
|
|
124
|
+
const fn = ADAPTERS[definition.host]?.isAlwaysForced;
|
|
124
125
|
return fn ? fn(definition) : false;
|
|
125
126
|
}
|
|
126
127
|
function installActionForDefinition(definition, target, resolved, force) {
|
|
@@ -155,15 +156,18 @@ function commandInstallPlanItem(definition, action) {
|
|
|
155
156
|
};
|
|
156
157
|
}
|
|
157
158
|
const PROJECT_ONLY_PATHS = new Set(["AGENTS.md"]);
|
|
159
|
+
const GLOBAL_ONLY_PATHS = new Set(INSTRUCTION_PATHS);
|
|
158
160
|
function scopedDefinitions(definitions, scope) {
|
|
159
|
-
if (scope
|
|
160
|
-
return definitions.filter((definition) => !
|
|
161
|
+
if (scope === "global") return definitions.filter((definition) => !PROJECT_ONLY_PATHS.has(definition.path));
|
|
162
|
+
return definitions.filter((definition) => !GLOBAL_ONLY_PATHS.has(definition.path));
|
|
161
163
|
}
|
|
162
164
|
function installCommandsContext(options) {
|
|
163
165
|
const cwd = options.cwd ?? process.cwd();
|
|
164
166
|
const host = options.host ?? "all";
|
|
165
167
|
const scope = options.scope ?? "global";
|
|
166
|
-
const
|
|
168
|
+
const config = loadPipelineConfig(cwd, { allowMissingLintFileReferences: true });
|
|
169
|
+
const instructionDefinitions = globalInstructionDefinitions().filter((definition) => host === "all" || definition.host === host);
|
|
170
|
+
const definitions = scopedDefinitions([...definitionsFor(host, config, cwd), ...instructionDefinitions], scope);
|
|
167
171
|
return {
|
|
168
172
|
cwd,
|
|
169
173
|
definitions,
|
package/package.json
CHANGED
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"prepack": "bun run build:cli"
|
|
127
127
|
},
|
|
128
128
|
"type": "module",
|
|
129
|
-
"version": "3.
|
|
129
|
+
"version": "3.7.0",
|
|
130
130
|
"description": "Config-driven multi-agent pipeline runner for repository work",
|
|
131
131
|
"main": "./dist/index.js",
|
|
132
132
|
"types": "./dist/index.d.ts",
|