@productbrain/cli 0.1.0-beta.11522 → 0.1.0-beta.11527
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/README.md +1 -1
- package/dist/commands/scoreboard.d.ts +1 -1
- package/dist/commands/scoreboard.d.ts.map +1 -1
- package/dist/commands/scoreboard.js +3 -2
- package/dist/commands/scoreboard.js.map +1 -1
- package/dist/commands/scoreboard.test.d.ts +2 -0
- package/dist/commands/scoreboard.test.d.ts.map +1 -0
- package/dist/commands/scoreboard.test.js +54 -0
- package/dist/commands/scoreboard.test.js.map +1 -0
- package/dist/formatters/scoreboard.test.js +0 -1
- package/dist/formatters/scoreboard.test.js.map +1 -1
- package/dist/lib/ruleListRender.d.ts +0 -5
- package/dist/lib/ruleListRender.d.ts.map +1 -1
- package/dist/lib/ruleListRender.js +1 -26
- package/dist/lib/ruleListRender.js.map +1 -1
- package/dist/scoreboard/diagnose.d.ts +0 -6
- package/dist/scoreboard/diagnose.d.ts.map +1 -1
- package/dist/scoreboard/diagnose.js +1 -1
- package/dist/scoreboard/diagnose.js.map +1 -1
- package/dist/scoreboard/diagnose.test.js +0 -1
- package/dist/scoreboard/diagnose.test.js.map +1 -1
- package/package.json +1 -1
- package/dist/__tests__/adapters.test.d.ts +0 -2
- package/dist/__tests__/adapters.test.d.ts.map +0 -1
- package/dist/__tests__/adapters.test.js +0 -443
- package/dist/__tests__/adapters.test.js.map +0 -1
- package/dist/__tests__/batch-transformations.test.d.ts +0 -2
- package/dist/__tests__/batch-transformations.test.d.ts.map +0 -1
- package/dist/__tests__/batch-transformations.test.js +0 -239
- package/dist/__tests__/batch-transformations.test.js.map +0 -1
- package/dist/__tests__/hook-intents.test.d.ts +0 -2
- package/dist/__tests__/hook-intents.test.d.ts.map +0 -1
- package/dist/__tests__/hook-intents.test.js +0 -172
- package/dist/__tests__/hook-intents.test.js.map +0 -1
- package/dist/__tests__/manifest.test.d.ts +0 -6
- package/dist/__tests__/manifest.test.d.ts.map +0 -1
- package/dist/__tests__/manifest.test.js +0 -255
- package/dist/__tests__/manifest.test.js.map +0 -1
- package/dist/__tests__/perimeter.test.d.ts +0 -2
- package/dist/__tests__/perimeter.test.d.ts.map +0 -1
- package/dist/__tests__/perimeter.test.js +0 -165
- package/dist/__tests__/perimeter.test.js.map +0 -1
- package/dist/__tests__/personal-layer.test.d.ts +0 -11
- package/dist/__tests__/personal-layer.test.d.ts.map +0 -1
- package/dist/__tests__/personal-layer.test.js +0 -268
- package/dist/__tests__/personal-layer.test.js.map +0 -1
- package/dist/__tests__/surface-profiles.test.d.ts +0 -2
- package/dist/__tests__/surface-profiles.test.d.ts.map +0 -1
- package/dist/__tests__/surface-profiles.test.js +0 -233
- package/dist/__tests__/surface-profiles.test.js.map +0 -1
- package/dist/__tests__/surfaces.test.d.ts +0 -2
- package/dist/__tests__/surfaces.test.d.ts.map +0 -1
- package/dist/__tests__/surfaces.test.js +0 -45
- package/dist/__tests__/surfaces.test.js.map +0 -1
- package/dist/generators/adapters.d.ts +0 -77
- package/dist/generators/adapters.d.ts.map +0 -1
- package/dist/generators/adapters.js +0 -286
- package/dist/generators/adapters.js.map +0 -1
- package/dist/generators/adapters.test.d.ts +0 -2
- package/dist/generators/adapters.test.d.ts.map +0 -1
- package/dist/generators/adapters.test.js +0 -36
- package/dist/generators/adapters.test.js.map +0 -1
- package/dist/generators/boundary-manifest.d.ts +0 -29
- package/dist/generators/boundary-manifest.d.ts.map +0 -1
- package/dist/generators/boundary-manifest.js +0 -183
- package/dist/generators/boundary-manifest.js.map +0 -1
- package/dist/generators/boundary-manifest.test.d.ts +0 -2
- package/dist/generators/boundary-manifest.test.d.ts.map +0 -1
- package/dist/generators/boundary-manifest.test.js +0 -91
- package/dist/generators/boundary-manifest.test.js.map +0 -1
- package/dist/generators/briefing-projections.test.d.ts +0 -2
- package/dist/generators/briefing-projections.test.d.ts.map +0 -1
- package/dist/generators/briefing-projections.test.js +0 -71
- package/dist/generators/briefing-projections.test.js.map +0 -1
- package/dist/generators/manifest.d.ts +0 -115
- package/dist/generators/manifest.d.ts.map +0 -1
- package/dist/generators/manifest.js +0 -277
- package/dist/generators/manifest.js.map +0 -1
- package/dist/generators/noProjectionAssets.d.ts +0 -15
- package/dist/generators/noProjectionAssets.d.ts.map +0 -1
- package/dist/generators/noProjectionAssets.js +0 -6
- package/dist/generators/noProjectionAssets.js.map +0 -1
- package/dist/generators/portable-knowledge.d.ts +0 -142
- package/dist/generators/portable-knowledge.d.ts.map +0 -1
- package/dist/generators/portable-knowledge.js +0 -482
- package/dist/generators/portable-knowledge.js.map +0 -1
- package/dist/generators/portable-knowledge.test.d.ts +0 -2
- package/dist/generators/portable-knowledge.test.d.ts.map +0 -1
- package/dist/generators/portable-knowledge.test.js +0 -742
- package/dist/generators/portable-knowledge.test.js.map +0 -1
- package/dist/generators/region-projections.d.ts +0 -17
- package/dist/generators/region-projections.d.ts.map +0 -1
- package/dist/generators/region-projections.js +0 -51
- package/dist/generators/region-projections.js.map +0 -1
- package/dist/generators/region-projections.test.d.ts +0 -2
- package/dist/generators/region-projections.test.d.ts.map +0 -1
- package/dist/generators/region-projections.test.js +0 -58
- package/dist/generators/region-projections.test.js.map +0 -1
- package/dist/generators/region.d.ts +0 -24
- package/dist/generators/region.d.ts.map +0 -1
- package/dist/generators/region.js +0 -87
- package/dist/generators/region.js.map +0 -1
- package/dist/generators/region.test.d.ts +0 -2
- package/dist/generators/region.test.d.ts.map +0 -1
- package/dist/generators/region.test.js +0 -125
- package/dist/generators/region.test.js.map +0 -1
- package/dist/generators/surface-profiles.d.ts +0 -48
- package/dist/generators/surface-profiles.d.ts.map +0 -1
- package/dist/generators/surface-profiles.js +0 -98
- package/dist/generators/surface-profiles.js.map +0 -1
- package/dist/lib/frontmatter.d.ts +0 -55
- package/dist/lib/frontmatter.d.ts.map +0 -1
- package/dist/lib/frontmatter.js +0 -92
- package/dist/lib/frontmatter.js.map +0 -1
- package/dist/lib/frontmatter.test.d.ts +0 -15
- package/dist/lib/frontmatter.test.d.ts.map +0 -1
- package/dist/lib/frontmatter.test.js +0 -98
- package/dist/lib/frontmatter.test.js.map +0 -1
- package/dist/lib/hook-intents.d.ts +0 -56
- package/dist/lib/hook-intents.d.ts.map +0 -1
- package/dist/lib/hook-intents.js +0 -84
- package/dist/lib/hook-intents.js.map +0 -1
- package/dist/lib/writePerimeter.d.ts +0 -72
- package/dist/lib/writePerimeter.d.ts.map +0 -1
- package/dist/lib/writePerimeter.js +0 -128
- package/dist/lib/writePerimeter.js.map +0 -1
- package/dist/surfaces/__tests__/adapter.test.d.ts +0 -2
- package/dist/surfaces/__tests__/adapter.test.d.ts.map +0 -1
- package/dist/surfaces/__tests__/adapter.test.js +0 -86
- package/dist/surfaces/__tests__/adapter.test.js.map +0 -1
- package/dist/surfaces/__tests__/claude-skill-pointer-drift.test.d.ts +0 -2
- package/dist/surfaces/__tests__/claude-skill-pointer-drift.test.d.ts.map +0 -1
- package/dist/surfaces/__tests__/claude-skill-pointer-drift.test.js +0 -180
- package/dist/surfaces/__tests__/claude-skill-pointer-drift.test.js.map +0 -1
- package/dist/surfaces/__tests__/telemetry.test.d.ts +0 -2
- package/dist/surfaces/__tests__/telemetry.test.d.ts.map +0 -1
- package/dist/surfaces/__tests__/telemetry.test.js +0 -44
- package/dist/surfaces/__tests__/telemetry.test.js.map +0 -1
- package/dist/surfaces/adapter.d.ts +0 -70
- package/dist/surfaces/adapter.d.ts.map +0 -1
- package/dist/surfaces/adapter.js +0 -2
- package/dist/surfaces/adapter.js.map +0 -1
- package/dist/surfaces/adapters/claude.d.ts +0 -3
- package/dist/surfaces/adapters/claude.d.ts.map +0 -1
- package/dist/surfaces/adapters/claude.js +0 -72
- package/dist/surfaces/adapters/claude.js.map +0 -1
- package/dist/surfaces/adapters/codex.d.ts +0 -3
- package/dist/surfaces/adapters/codex.d.ts.map +0 -1
- package/dist/surfaces/adapters/codex.js +0 -61
- package/dist/surfaces/adapters/codex.js.map +0 -1
- package/dist/surfaces/adapters/copilot.d.ts +0 -3
- package/dist/surfaces/adapters/copilot.d.ts.map +0 -1
- package/dist/surfaces/adapters/copilot.js +0 -59
- package/dist/surfaces/adapters/copilot.js.map +0 -1
- package/dist/surfaces/adapters/cursor.d.ts +0 -3
- package/dist/surfaces/adapters/cursor.d.ts.map +0 -1
- package/dist/surfaces/adapters/cursor.js +0 -78
- package/dist/surfaces/adapters/cursor.js.map +0 -1
- package/dist/surfaces/registry.d.ts +0 -76
- package/dist/surfaces/registry.d.ts.map +0 -1
- package/dist/surfaces/registry.js +0 -117
- package/dist/surfaces/registry.js.map +0 -1
- package/dist/surfaces/telemetry.d.ts +0 -24
- package/dist/surfaces/telemetry.d.ts.map +0 -1
- package/dist/surfaces/telemetry.js +0 -25
- package/dist/surfaces/telemetry.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noProjectionAssets.js","sourceRoot":"","sources":["../../src/generators/noProjectionAssets.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,sBAAsB,CACpC,MAAwB,EACxB,KAAsB;IAEtB,OAAO,CAAC,GAAG,MAAM,EAAE,GAAG,KAAK,CAAC;SACzB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC;SAC1G,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAmB,EAAE,CAAC,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Portable knowledge — reads canonical skills/rules from .productbrain/
|
|
3
|
-
* and generates tool-specific copies for Cursor, Claude Code, etc.
|
|
4
|
-
*/
|
|
5
|
-
import type { SurfaceProfile, TargetName } from './surface-profiles.js';
|
|
6
|
-
export type { TargetName };
|
|
7
|
-
export interface WhenConditions {
|
|
8
|
-
when_stack?: string;
|
|
9
|
-
when_minGovernance?: string;
|
|
10
|
-
}
|
|
11
|
-
export interface CanonicalSkill {
|
|
12
|
-
name: string;
|
|
13
|
-
description: string;
|
|
14
|
-
triggers: string[];
|
|
15
|
-
body: string;
|
|
16
|
-
sourcePath: string;
|
|
17
|
-
targets?: string[];
|
|
18
|
-
level?: string;
|
|
19
|
-
conditions?: WhenConditions;
|
|
20
|
-
/** 'team' = default; 'local' = local surface files only, never committed. */
|
|
21
|
-
persist?: 'local' | 'team';
|
|
22
|
-
}
|
|
23
|
-
export interface CanonicalRule {
|
|
24
|
-
name: string;
|
|
25
|
-
description: string;
|
|
26
|
-
scope?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Path-scope glob for path-aware surfaces (e.g. "convex/**\/*.ts"). Drives the
|
|
29
|
-
* GitHub Copilot `.github/instructions/<name>.instructions.md` fan-out (applyTo frontmatter)
|
|
30
|
-
* and, in principle, nested CLAUDE.md/AGENTS.md placement. Absent = repo-wide only.
|
|
31
|
-
*/
|
|
32
|
-
applyTo?: string;
|
|
33
|
-
autoApply: boolean;
|
|
34
|
-
body: string;
|
|
35
|
-
sourcePath: string;
|
|
36
|
-
targets?: string[];
|
|
37
|
-
level?: string;
|
|
38
|
-
conditions?: WhenConditions;
|
|
39
|
-
/** 'team' = default; 'local' = local surface files only, never committed. */
|
|
40
|
-
persist?: 'local' | 'team';
|
|
41
|
-
}
|
|
42
|
-
/** Returns true if the entry should be emitted to the given target. */
|
|
43
|
-
export declare function shouldEmitToTarget(entry: CanonicalRule | CanonicalSkill, target: TargetName): boolean;
|
|
44
|
-
export type HandshakeLevel = 'beginner' | 'intermediate' | 'expert';
|
|
45
|
-
/**
|
|
46
|
-
* Filter items by graduated level.
|
|
47
|
-
* - If requestedLevel is undefined/null: return ALL items (backward compat).
|
|
48
|
-
* - Items with no `level` field: always included (backward compat).
|
|
49
|
-
*/
|
|
50
|
-
export declare function filterByLevel<T extends {
|
|
51
|
-
level?: string;
|
|
52
|
-
}>(items: T[], requestedLevel?: string): T[];
|
|
53
|
-
/**
|
|
54
|
-
* Evaluate when_* conditions against the workspace profile and repo context.
|
|
55
|
-
* Returns { included, reasons }.
|
|
56
|
-
*
|
|
57
|
-
* Fail-open: if profile is null and profile-dependent conditions are present,
|
|
58
|
-
* the item is included (preserves current behavior when Chain is unavailable).
|
|
59
|
-
*/
|
|
60
|
-
export declare function evaluateConditions(conditions: WhenConditions, profile: {
|
|
61
|
-
totalRelations: number;
|
|
62
|
-
} | null, repoContext: {
|
|
63
|
-
detectedStack: string[];
|
|
64
|
-
}): {
|
|
65
|
-
included: boolean;
|
|
66
|
-
reasons: string[];
|
|
67
|
-
};
|
|
68
|
-
export declare function readCanonicalSkills(productbrainDir: string): CanonicalSkill[];
|
|
69
|
-
export declare function readCanonicalRules(productbrainDir: string): CanonicalRule[];
|
|
70
|
-
/**
|
|
71
|
-
* Read machine-local personal rules from .productbrain/.local/rules/.
|
|
72
|
-
* Returns [] when the directory is absent — no-op when personal layer is not set up.
|
|
73
|
-
* Every returned rule has persist: 'local' set, marking it as part of the personal layer.
|
|
74
|
-
*/
|
|
75
|
-
export declare function readPersonalLayer(productbrainDir: string): CanonicalRule[];
|
|
76
|
-
/**
|
|
77
|
-
* Read machine-local personal skills from .productbrain/.local/skills/.
|
|
78
|
-
* Returns [] when the directory is absent — no-op when personal layer is not set up.
|
|
79
|
-
* Every returned skill has persist: 'local' set, marking it as part of the personal layer.
|
|
80
|
-
*/
|
|
81
|
-
export declare function readPersonalSkillsLayer(productbrainDir: string): CanonicalSkill[];
|
|
82
|
-
/**
|
|
83
|
-
* Strip transport-conditional sections from a skill body.
|
|
84
|
-
*
|
|
85
|
-
* Sections are delimited by HTML comments:
|
|
86
|
-
* <!-- transport:TARGET_NAME -->
|
|
87
|
-
* ...content...
|
|
88
|
-
* <!-- /transport -->
|
|
89
|
-
*
|
|
90
|
-
* - Blocks matching the current target: keep the content, remove the delimiter comments.
|
|
91
|
-
* - Blocks for OTHER targets: remove entirely (delimiters + content).
|
|
92
|
-
* - Content outside any transport block: keep as-is (universal content).
|
|
93
|
-
*/
|
|
94
|
-
export declare function stripTransportSections(body: string, target: TargetName): string;
|
|
95
|
-
/**
|
|
96
|
-
* Generate a Cursor SKILL.md from a canonical skill.
|
|
97
|
-
* Cursor expects: name, description (with triggers embedded).
|
|
98
|
-
*/
|
|
99
|
-
export declare function generateCursorSkill(skill: CanonicalSkill, profile?: SurfaceProfile): string;
|
|
100
|
-
/**
|
|
101
|
-
* Generate a Cursor .mdc rule from a canonical rule.
|
|
102
|
-
* Cursor expects: description, globs, alwaysApply.
|
|
103
|
-
*/
|
|
104
|
-
export declare function generateCursorRule(rule: CanonicalRule, profile?: SurfaceProfile): string;
|
|
105
|
-
/**
|
|
106
|
-
* Apply batch-mode transformations to a skill body (DEC-283).
|
|
107
|
-
*
|
|
108
|
-
* Skills describe WHAT (intent). This generator produces HOW (batch-appropriate
|
|
109
|
-
* instructions). We transform interactive patterns without gutting the skill's
|
|
110
|
-
* logical structure and purpose.
|
|
111
|
-
*
|
|
112
|
-
* Transformations applied:
|
|
113
|
-
* 1. Strip sub-agent spawn patterns → inline steps
|
|
114
|
-
* 2. Strip user confirmation gates → autonomous proceed
|
|
115
|
-
* 3. Strip streaming/interactive references
|
|
116
|
-
* 4. Add batch governance header after first `#` heading
|
|
117
|
-
*/
|
|
118
|
-
export declare function applyBatchTransformations(body: string): string;
|
|
119
|
-
/**
|
|
120
|
-
* Generate a Codex skill projection from a canonical skill.
|
|
121
|
-
* This is a repo-local markdown projection, not a separate authoring source.
|
|
122
|
-
*
|
|
123
|
-
* When profile.executionModel === 'batch', batch transformations are applied
|
|
124
|
-
* AFTER transport stripping and path replacement (DEC-283).
|
|
125
|
-
*/
|
|
126
|
-
export declare function generateCodexSkill(skill: CanonicalSkill, profile?: SurfaceProfile): string;
|
|
127
|
-
/**
|
|
128
|
-
* Generate a Codex skill index/router file.
|
|
129
|
-
* AGENTS.md can point here so Codex has one obvious place to find available workflows.
|
|
130
|
-
*/
|
|
131
|
-
export declare function generateCodexSkillIndex(skills: CanonicalSkill[]): string;
|
|
132
|
-
export interface CodexValidationWarning {
|
|
133
|
-
skillName: string;
|
|
134
|
-
pattern: string;
|
|
135
|
-
line: string;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Validate Codex-projected skills for references to capabilities Codex cannot execute.
|
|
139
|
-
* Scans the transport-stripped body (so claude-only blocks don't false-positive).
|
|
140
|
-
*/
|
|
141
|
-
export declare function validateCodexSkills(skills: CanonicalSkill[]): CodexValidationWarning[];
|
|
142
|
-
//# sourceMappingURL=portable-knowledge.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"portable-knowledge.d.ts","sourceRoot":"","sources":["../../src/generators/portable-knowledge.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExE,YAAY,EAAE,UAAU,EAAE,CAAC;AAI3B,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,6EAA6E;IAC7E,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;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3E;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,eAAe,EAAE,MAAM,GAAG,aAAa,EAAE,CA2C1E;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,eAAe,EAAE,MAAM,GAAG,cAAc,EAAE,CAuCjF;AAID;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAa/E;AAID;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,CAyB3F;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,CAcxF;AAID;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAuB9D;AA2BD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,CAsB1F;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAsCxE;AAID,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAUD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,sBAAsB,EAAE,CAkBtF"}
|
|
@@ -1,482 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Portable knowledge — reads canonical skills/rules from .productbrain/
|
|
3
|
-
* and generates tool-specific copies for Cursor, Claude Code, etc.
|
|
4
|
-
*/
|
|
5
|
-
import { readdirSync, readFileSync, existsSync } from 'fs';
|
|
6
|
-
import { join, basename } from 'path';
|
|
7
|
-
import { MARKER } from './adapters.js';
|
|
8
|
-
/** Returns true if the entry should be emitted to the given target. */
|
|
9
|
-
export function shouldEmitToTarget(entry, target) {
|
|
10
|
-
if (!entry.targets)
|
|
11
|
-
return true;
|
|
12
|
-
return entry.targets.includes(target);
|
|
13
|
-
}
|
|
14
|
-
const LEVEL_HIERARCHY = {
|
|
15
|
-
beginner: ['core'],
|
|
16
|
-
intermediate: ['core', 'intermediate'],
|
|
17
|
-
expert: ['core', 'intermediate', 'expert'],
|
|
18
|
-
};
|
|
19
|
-
const VALID_LEVELS = new Set(Object.keys(LEVEL_HIERARCHY));
|
|
20
|
-
/**
|
|
21
|
-
* Filter items by graduated level.
|
|
22
|
-
* - If requestedLevel is undefined/null: return ALL items (backward compat).
|
|
23
|
-
* - Items with no `level` field: always included (backward compat).
|
|
24
|
-
*/
|
|
25
|
-
export function filterByLevel(items, requestedLevel) {
|
|
26
|
-
// Resolve requested level as typed enum (validate if provided)
|
|
27
|
-
let typedRequested;
|
|
28
|
-
if (requestedLevel) {
|
|
29
|
-
if (!VALID_LEVELS.has(requestedLevel)) {
|
|
30
|
-
throw new Error(`Unknown level "${requestedLevel}". Valid levels: ${[...VALID_LEVELS].join(', ')}`);
|
|
31
|
-
}
|
|
32
|
-
typedRequested = requestedLevel;
|
|
33
|
-
}
|
|
34
|
-
// No requested level — return all items (backward compat)
|
|
35
|
-
if (!typedRequested)
|
|
36
|
-
return items;
|
|
37
|
-
const allowedLevels = LEVEL_HIERARCHY[typedRequested];
|
|
38
|
-
return items.filter((item) => !item.level || allowedLevels.includes(item.level));
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Evaluate when_* conditions against the workspace profile and repo context.
|
|
42
|
-
* Returns { included, reasons }.
|
|
43
|
-
*
|
|
44
|
-
* Fail-open: if profile is null and profile-dependent conditions are present,
|
|
45
|
-
* the item is included (preserves current behavior when Chain is unavailable).
|
|
46
|
-
*/
|
|
47
|
-
export function evaluateConditions(conditions, profile, repoContext) {
|
|
48
|
-
const hasProfileConditions = conditions.when_minGovernance !== undefined;
|
|
49
|
-
const hasStackCondition = conditions.when_stack !== undefined;
|
|
50
|
-
// No when_* keys at all — always include
|
|
51
|
-
if (!hasProfileConditions && !hasStackCondition) {
|
|
52
|
-
return { included: true, reasons: ['no conditions'] };
|
|
53
|
-
}
|
|
54
|
-
// Fail-open: profile unavailable but profile-dependent conditions present
|
|
55
|
-
if (profile === null && hasProfileConditions) {
|
|
56
|
-
return { included: true, reasons: ['no workspace profile — fail-open'] };
|
|
57
|
-
}
|
|
58
|
-
const reasons = [];
|
|
59
|
-
let included = true;
|
|
60
|
-
// when_stack: evaluated against repoContext (not profile)
|
|
61
|
-
if (conditions.when_stack !== undefined) {
|
|
62
|
-
const needle = conditions.when_stack.toLowerCase();
|
|
63
|
-
const match = repoContext.detectedStack.some((s) => s.toLowerCase() === needle);
|
|
64
|
-
if (!match) {
|
|
65
|
-
included = false;
|
|
66
|
-
reasons.push(`when_stack=${conditions.when_stack} not in detected stack [${repoContext.detectedStack.join(', ')}]`);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
reasons.push(`when_stack=${conditions.when_stack} matched`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
// when_minGovernance: profile guaranteed non-null here when this condition is present
|
|
73
|
-
if (conditions.when_minGovernance !== undefined && profile !== null) {
|
|
74
|
-
const threshold = parseInt(conditions.when_minGovernance, 10);
|
|
75
|
-
if (isNaN(threshold) || profile.totalRelations < threshold) {
|
|
76
|
-
included = false;
|
|
77
|
-
reasons.push(`when_minGovernance=${conditions.when_minGovernance} but totalRelations=${profile.totalRelations}`);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
reasons.push(`when_minGovernance=${conditions.when_minGovernance} satisfied (totalRelations=${profile.totalRelations})`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return { included, reasons };
|
|
84
|
-
}
|
|
85
|
-
// ── Frontmatter parser ─────────────────────────────────────────────────
|
|
86
|
-
function parseFrontmatter(raw) {
|
|
87
|
-
const match = raw.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);
|
|
88
|
-
if (!match)
|
|
89
|
-
return { fields: new Map(), arrayFields: new Map(), body: raw };
|
|
90
|
-
const yaml = match[1];
|
|
91
|
-
const body = match[2];
|
|
92
|
-
const fields = new Map();
|
|
93
|
-
const arrayFields = new Map();
|
|
94
|
-
const lines = yaml.split('\n');
|
|
95
|
-
let currentKey = null;
|
|
96
|
-
let collectingMultiline = false;
|
|
97
|
-
let collectingArray = false;
|
|
98
|
-
for (const line of lines) {
|
|
99
|
-
// Array item: " - value"
|
|
100
|
-
if (collectingArray && currentKey && /^\s+-\s/.test(line)) {
|
|
101
|
-
const items = arrayFields.get(currentKey) ?? [];
|
|
102
|
-
items.push(line.replace(/^\s+-\s+/, '').trim().replace(/^["']|["']$/g, ''));
|
|
103
|
-
arrayFields.set(currentKey, items);
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
// Multiline continuation: indented text after >- or >
|
|
107
|
-
if (collectingMultiline && currentKey && /^\s+\S/.test(line)) {
|
|
108
|
-
const existing = fields.get(currentKey) ?? '';
|
|
109
|
-
fields.set(currentKey, (existing ? existing + ' ' : '') + line.trim());
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
// New key — reset collection state
|
|
113
|
-
collectingMultiline = false;
|
|
114
|
-
collectingArray = false;
|
|
115
|
-
const kv = line.match(/^([\w-]+):\s*(.*)/);
|
|
116
|
-
if (!kv)
|
|
117
|
-
continue;
|
|
118
|
-
currentKey = kv[1];
|
|
119
|
-
const val = kv[2].trim();
|
|
120
|
-
if (val === '' || val === '>-' || val === '>') {
|
|
121
|
-
// Could be array or multiline — peek ahead via next iterations
|
|
122
|
-
// If next line starts with " -", it's an array; if indented text, it's multiline
|
|
123
|
-
collectingMultiline = val === '>-' || val === '>';
|
|
124
|
-
collectingArray = val === '';
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
fields.set(currentKey, val.replace(/^["']|["']$/g, ''));
|
|
128
|
-
}
|
|
129
|
-
return { fields, arrayFields, body };
|
|
130
|
-
}
|
|
131
|
-
// ── Readers ────────────────────────────────────────────────────────────
|
|
132
|
-
export function readCanonicalSkills(productbrainDir) {
|
|
133
|
-
const skillsDir = join(productbrainDir, 'skills');
|
|
134
|
-
if (!existsSync(skillsDir))
|
|
135
|
-
return [];
|
|
136
|
-
const files = readdirSync(skillsDir).filter((f) => f.endsWith('.md'));
|
|
137
|
-
const skills = [];
|
|
138
|
-
for (const file of files) {
|
|
139
|
-
const filePath = join(skillsDir, file);
|
|
140
|
-
const raw = readFileSync(filePath, 'utf8');
|
|
141
|
-
const { fields, arrayFields, body } = parseFrontmatter(raw);
|
|
142
|
-
const name = fields.get('name') ?? basename(file, '.md');
|
|
143
|
-
const description = fields.get('description') ?? '';
|
|
144
|
-
const triggers = arrayFields.get('triggers') ?? [];
|
|
145
|
-
const targets = arrayFields.get('targets');
|
|
146
|
-
const level = fields.get('level');
|
|
147
|
-
const conditions = {};
|
|
148
|
-
const whenStack = fields.get('when_stack');
|
|
149
|
-
const whenMinGovernance = fields.get('when_minGovernance');
|
|
150
|
-
if (whenStack)
|
|
151
|
-
conditions.when_stack = whenStack;
|
|
152
|
-
if (whenMinGovernance)
|
|
153
|
-
conditions.when_minGovernance = whenMinGovernance;
|
|
154
|
-
const hasConditions = Object.keys(conditions).length > 0;
|
|
155
|
-
skills.push({ name, description, triggers, body, sourcePath: filePath, targets: targets?.length ? targets : undefined, level: level || undefined, conditions: hasConditions ? conditions : undefined });
|
|
156
|
-
}
|
|
157
|
-
return skills.sort((a, b) => a.name.localeCompare(b.name));
|
|
158
|
-
}
|
|
159
|
-
export function readCanonicalRules(productbrainDir) {
|
|
160
|
-
const rulesDir = join(productbrainDir, 'rules');
|
|
161
|
-
if (!existsSync(rulesDir))
|
|
162
|
-
return [];
|
|
163
|
-
const files = readdirSync(rulesDir).filter((f) => f.endsWith('.md'));
|
|
164
|
-
const rules = [];
|
|
165
|
-
for (const file of files) {
|
|
166
|
-
const filePath = join(rulesDir, file);
|
|
167
|
-
const raw = readFileSync(filePath, 'utf8');
|
|
168
|
-
const { fields, arrayFields, body } = parseFrontmatter(raw);
|
|
169
|
-
const name = fields.get('name') ?? basename(file, '.md');
|
|
170
|
-
const description = fields.get('description') ?? '';
|
|
171
|
-
const scope = fields.get('scope');
|
|
172
|
-
const applyTo = fields.get('applyTo');
|
|
173
|
-
const autoApply = fields.get('autoApply') === 'true';
|
|
174
|
-
const targets = arrayFields.get('targets');
|
|
175
|
-
const level = fields.get('level');
|
|
176
|
-
const conditions = {};
|
|
177
|
-
const whenStack = fields.get('when_stack');
|
|
178
|
-
const whenMinGovernance = fields.get('when_minGovernance');
|
|
179
|
-
if (whenStack)
|
|
180
|
-
conditions.when_stack = whenStack;
|
|
181
|
-
if (whenMinGovernance)
|
|
182
|
-
conditions.when_minGovernance = whenMinGovernance;
|
|
183
|
-
const hasConditions = Object.keys(conditions).length > 0;
|
|
184
|
-
rules.push({ name, description, scope, applyTo: applyTo || undefined, autoApply, body, sourcePath: filePath, targets: targets?.length ? targets : undefined, level: level || undefined, conditions: hasConditions ? conditions : undefined });
|
|
185
|
-
}
|
|
186
|
-
return rules.sort((a, b) => a.name.localeCompare(b.name));
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Read machine-local personal rules from .productbrain/.local/rules/.
|
|
190
|
-
* Returns [] when the directory is absent — no-op when personal layer is not set up.
|
|
191
|
-
* Every returned rule has persist: 'local' set, marking it as part of the personal layer.
|
|
192
|
-
*/
|
|
193
|
-
export function readPersonalLayer(productbrainDir) {
|
|
194
|
-
const localRulesDir = join(productbrainDir, '.local', 'rules');
|
|
195
|
-
if (!existsSync(localRulesDir))
|
|
196
|
-
return [];
|
|
197
|
-
const files = readdirSync(localRulesDir).filter((f) => f.endsWith('.md'));
|
|
198
|
-
const rules = [];
|
|
199
|
-
for (const file of files) {
|
|
200
|
-
const filePath = join(localRulesDir, file);
|
|
201
|
-
const raw = readFileSync(filePath, 'utf8');
|
|
202
|
-
const { fields, arrayFields, body } = parseFrontmatter(raw);
|
|
203
|
-
const name = fields.get('name') ?? basename(file, '.md');
|
|
204
|
-
const description = fields.get('description') ?? '';
|
|
205
|
-
const scope = fields.get('scope');
|
|
206
|
-
const applyTo = fields.get('applyTo');
|
|
207
|
-
const autoApply = fields.get('autoApply') === 'true';
|
|
208
|
-
const targets = arrayFields.get('targets');
|
|
209
|
-
const level = fields.get('level');
|
|
210
|
-
const conditions = {};
|
|
211
|
-
const whenStack = fields.get('when_stack');
|
|
212
|
-
const whenMinGovernance = fields.get('when_minGovernance');
|
|
213
|
-
if (whenStack)
|
|
214
|
-
conditions.when_stack = whenStack;
|
|
215
|
-
if (whenMinGovernance)
|
|
216
|
-
conditions.when_minGovernance = whenMinGovernance;
|
|
217
|
-
const hasConditions = Object.keys(conditions).length > 0;
|
|
218
|
-
rules.push({
|
|
219
|
-
name,
|
|
220
|
-
description,
|
|
221
|
-
scope,
|
|
222
|
-
applyTo: applyTo || undefined,
|
|
223
|
-
autoApply,
|
|
224
|
-
body,
|
|
225
|
-
sourcePath: filePath,
|
|
226
|
-
targets: targets?.length ? targets : undefined,
|
|
227
|
-
level: level || undefined,
|
|
228
|
-
conditions: hasConditions ? conditions : undefined,
|
|
229
|
-
persist: 'local',
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
return rules.sort((a, b) => a.name.localeCompare(b.name));
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Read machine-local personal skills from .productbrain/.local/skills/.
|
|
236
|
-
* Returns [] when the directory is absent — no-op when personal layer is not set up.
|
|
237
|
-
* Every returned skill has persist: 'local' set, marking it as part of the personal layer.
|
|
238
|
-
*/
|
|
239
|
-
export function readPersonalSkillsLayer(productbrainDir) {
|
|
240
|
-
const localSkillsDir = join(productbrainDir, '.local', 'skills');
|
|
241
|
-
if (!existsSync(localSkillsDir))
|
|
242
|
-
return [];
|
|
243
|
-
const files = readdirSync(localSkillsDir).filter((f) => f.endsWith('.md'));
|
|
244
|
-
const skills = [];
|
|
245
|
-
for (const file of files) {
|
|
246
|
-
const filePath = join(localSkillsDir, file);
|
|
247
|
-
const raw = readFileSync(filePath, 'utf8');
|
|
248
|
-
const { fields, arrayFields, body } = parseFrontmatter(raw);
|
|
249
|
-
const name = fields.get('name') ?? basename(file, '.md');
|
|
250
|
-
const description = fields.get('description') ?? '';
|
|
251
|
-
const triggers = arrayFields.get('triggers') ?? [];
|
|
252
|
-
const targets = arrayFields.get('targets');
|
|
253
|
-
const level = fields.get('level');
|
|
254
|
-
const conditions = {};
|
|
255
|
-
const whenStack = fields.get('when_stack');
|
|
256
|
-
const whenMinGovernance = fields.get('when_minGovernance');
|
|
257
|
-
if (whenStack)
|
|
258
|
-
conditions.when_stack = whenStack;
|
|
259
|
-
if (whenMinGovernance)
|
|
260
|
-
conditions.when_minGovernance = whenMinGovernance;
|
|
261
|
-
const hasConditions = Object.keys(conditions).length > 0;
|
|
262
|
-
skills.push({
|
|
263
|
-
name,
|
|
264
|
-
description,
|
|
265
|
-
triggers,
|
|
266
|
-
body,
|
|
267
|
-
sourcePath: filePath,
|
|
268
|
-
targets: targets?.length ? targets : undefined,
|
|
269
|
-
level: level || undefined,
|
|
270
|
-
conditions: hasConditions ? conditions : undefined,
|
|
271
|
-
persist: 'local',
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
return skills.sort((a, b) => a.name.localeCompare(b.name));
|
|
275
|
-
}
|
|
276
|
-
// ── Transport section stripping ───────────────────────────────────────
|
|
277
|
-
/**
|
|
278
|
-
* Strip transport-conditional sections from a skill body.
|
|
279
|
-
*
|
|
280
|
-
* Sections are delimited by HTML comments:
|
|
281
|
-
* <!-- transport:TARGET_NAME -->
|
|
282
|
-
* ...content...
|
|
283
|
-
* <!-- /transport -->
|
|
284
|
-
*
|
|
285
|
-
* - Blocks matching the current target: keep the content, remove the delimiter comments.
|
|
286
|
-
* - Blocks for OTHER targets: remove entirely (delimiters + content).
|
|
287
|
-
* - Content outside any transport block: keep as-is (universal content).
|
|
288
|
-
*/
|
|
289
|
-
export function stripTransportSections(body, target) {
|
|
290
|
-
// Match transport blocks: <!-- transport:NAME -->...<!-- /transport -->
|
|
291
|
-
// Using a non-greedy match between the opening and the NEXT closing tag.
|
|
292
|
-
const transportBlockRe = /<!-- transport:(\w+) -->\n?([\s\S]*?)<!-- \/transport -->\n?/g;
|
|
293
|
-
return body.replace(transportBlockRe, (_match, blockTarget, content) => {
|
|
294
|
-
if (blockTarget === target) {
|
|
295
|
-
// Keep the content, remove the delimiter comments
|
|
296
|
-
return content;
|
|
297
|
-
}
|
|
298
|
-
// Remove the entire block for other targets
|
|
299
|
-
return '';
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
// ── Cursor generators ──────────────────────────────────────────────────
|
|
303
|
-
/**
|
|
304
|
-
* Generate a Cursor SKILL.md from a canonical skill.
|
|
305
|
-
* Cursor expects: name, description (with triggers embedded).
|
|
306
|
-
*/
|
|
307
|
-
export function generateCursorSkill(skill, profile) {
|
|
308
|
-
// Cursor puts trigger phrases in the description field
|
|
309
|
-
const triggerLine = skill.triggers.length > 0
|
|
310
|
-
? ` Use when the user says ${skill.triggers.map((t) => `"${t}"`).join(', ')}.`
|
|
311
|
-
: '';
|
|
312
|
-
const description = skill.description + triggerLine;
|
|
313
|
-
// Strip transport sections BEFORE path replacement
|
|
314
|
-
const stripped = stripTransportSections(skill.body, 'cursor');
|
|
315
|
-
// Replace canonical paths with Cursor paths in body
|
|
316
|
-
const body = stripped
|
|
317
|
-
.replace(/\.productbrain\/rules\/(\S+)\.md/g, '.cursor/rules/$1.mdc')
|
|
318
|
-
.replace(/\.productbrain\/skills\/(\S+)\.md/g, '.cursor/skills/$1/SKILL.md');
|
|
319
|
-
return `---
|
|
320
|
-
name: ${skill.name}
|
|
321
|
-
description: >-
|
|
322
|
-
${description.replace(/\n/g, '\n ')}
|
|
323
|
-
---
|
|
324
|
-
<!-- ${MARKER} — source: .productbrain/skills/${skill.name}.md -->
|
|
325
|
-
|
|
326
|
-
${body}`;
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Generate a Cursor .mdc rule from a canonical rule.
|
|
330
|
-
* Cursor expects: description, globs, alwaysApply.
|
|
331
|
-
*/
|
|
332
|
-
export function generateCursorRule(rule, profile) {
|
|
333
|
-
// Replace canonical paths with Cursor paths in body
|
|
334
|
-
const body = rule.body
|
|
335
|
-
.replace(/\.productbrain\/rules\/(\S+)\.md/g, '.cursor/rules/$1.mdc')
|
|
336
|
-
.replace(/\.productbrain\/skills\/(\S+)\.md/g, '.cursor/skills/$1/SKILL.md');
|
|
337
|
-
return `---
|
|
338
|
-
description: ${rule.description}
|
|
339
|
-
globs: ${rule.scope || ''}
|
|
340
|
-
alwaysApply: ${!rule.scope && rule.autoApply}
|
|
341
|
-
---
|
|
342
|
-
<!-- ${MARKER} — source: .productbrain/rules/${rule.name}.md -->
|
|
343
|
-
|
|
344
|
-
${body}`;
|
|
345
|
-
}
|
|
346
|
-
// ── Codex generators ───────────────────────────────────────────────────
|
|
347
|
-
/**
|
|
348
|
-
* Apply batch-mode transformations to a skill body (DEC-283).
|
|
349
|
-
*
|
|
350
|
-
* Skills describe WHAT (intent). This generator produces HOW (batch-appropriate
|
|
351
|
-
* instructions). We transform interactive patterns without gutting the skill's
|
|
352
|
-
* logical structure and purpose.
|
|
353
|
-
*
|
|
354
|
-
* Transformations applied:
|
|
355
|
-
* 1. Strip sub-agent spawn patterns → inline steps
|
|
356
|
-
* 2. Strip user confirmation gates → autonomous proceed
|
|
357
|
-
* 3. Strip streaming/interactive references
|
|
358
|
-
* 4. Add batch governance header after first `#` heading
|
|
359
|
-
*/
|
|
360
|
-
export function applyBatchTransformations(body) {
|
|
361
|
-
// Split into fenced code blocks vs prose so transforms only apply to prose.
|
|
362
|
-
// Fenced blocks (``` or ~~~) may contain examples of interactive patterns
|
|
363
|
-
// that must be preserved verbatim.
|
|
364
|
-
const segments = body.split(/(^```[^\n]*\n[\s\S]*?^```\s*$|^~~~[^\n]*\n[\s\S]*?^~~~\s*$)/m);
|
|
365
|
-
let result = segments
|
|
366
|
-
.map((segment, i) => {
|
|
367
|
-
// Odd indices are fenced code blocks — pass through unchanged
|
|
368
|
-
if (i % 2 === 1)
|
|
369
|
-
return segment;
|
|
370
|
-
return applyProseTransformations(segment);
|
|
371
|
-
})
|
|
372
|
-
.join('');
|
|
373
|
-
// 4. Add batch governance header after the first `#` heading line
|
|
374
|
-
const batchHeader = '> Batch execution mode: This skill runs autonomously without interactive gates. Decisions are logged, not prompted.';
|
|
375
|
-
result = result.replace(/^(#\s+[^\n]+)(\n)/m, `$1$2\n${batchHeader}\n`);
|
|
376
|
-
return result;
|
|
377
|
-
}
|
|
378
|
-
/** Apply interactive-pattern transforms to a prose segment (not inside code fences). */
|
|
379
|
-
function applyProseTransformations(text) {
|
|
380
|
-
let result = text;
|
|
381
|
-
// 1. Sub-agent spawn patterns — lines that dispatch to sub-agents or fresh conversations
|
|
382
|
-
result = result.replace(/^.*\b(spawn\s+(a\s+)?(sub-agent|build\s+sub-agent|review\s+sub-agent|judge|system\s+verification\s+agent)|Agent\s+tool\s+dispatch|fresh\s+conversation\s+handoff|open\s+a\s+(new|fresh)\s+(conversation|chat)|start\s+a\s+(new|fresh)\s+(conversation|chat))\b.*$/gim, 'Execute as inline steps within this session.');
|
|
383
|
-
// 2. User confirmation gates — lines that halt for human input
|
|
384
|
-
result = result.replace(/^.*\b(ask\s+the\s+(user|human)|wait\s+for\s+(user\s+)?input|present\s+gate\s+to\s+(the\s+)?user|stop\s+and\s+ask|pause\s+and\s+ask|get\s+user\s+confirmation|awaiting\s+your\s+feedback|wait\s+for\s+(human|user)\s+(sign-?off|approval|input))\b.*$/gim, 'Proceed autonomously. Log decision rationale.');
|
|
385
|
-
// 3. Streaming / persistent-connection references
|
|
386
|
-
result = result.replace(/^.*\b(real-time\s+feedback|streaming\s+output|interactive\s+mcp\s+tool\s+calls?\s+that\s+assume\s+a\s+persistent\s+connection)\b.*$/gim, '');
|
|
387
|
-
return result;
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* Generate a Codex skill projection from a canonical skill.
|
|
391
|
-
* This is a repo-local markdown projection, not a separate authoring source.
|
|
392
|
-
*
|
|
393
|
-
* When profile.executionModel === 'batch', batch transformations are applied
|
|
394
|
-
* AFTER transport stripping and path replacement (DEC-283).
|
|
395
|
-
*/
|
|
396
|
-
export function generateCodexSkill(skill, profile) {
|
|
397
|
-
const triggerLine = skill.triggers.length > 0
|
|
398
|
-
? `\n\n**Triggers:** ${skill.triggers.map((t) => `\`${t}\``).join(', ')}`
|
|
399
|
-
: '';
|
|
400
|
-
const stripped = stripTransportSections(skill.body, 'codex');
|
|
401
|
-
const pathReplaced = stripped
|
|
402
|
-
.replace(/\.productbrain\/skills\/(\S+)\.md/g, '.codex/skills/$1.md');
|
|
403
|
-
const body = profile?.executionModel === 'batch'
|
|
404
|
-
? applyBatchTransformations(pathReplaced)
|
|
405
|
-
: pathReplaced;
|
|
406
|
-
return `<!-- ${MARKER} — source: .productbrain/skills/${skill.name}.md -->
|
|
407
|
-
|
|
408
|
-
# ${skill.name}
|
|
409
|
-
|
|
410
|
-
${skill.description}${triggerLine}
|
|
411
|
-
|
|
412
|
-
${body}`;
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Generate a Codex skill index/router file.
|
|
416
|
-
* AGENTS.md can point here so Codex has one obvious place to find available workflows.
|
|
417
|
-
*/
|
|
418
|
-
export function generateCodexSkillIndex(skills) {
|
|
419
|
-
const primarySkills = skills.filter((skill) => {
|
|
420
|
-
const lower = skill.name.toLowerCase();
|
|
421
|
-
return lower !== 'learnings-template' && !lower.endsWith('-learnings');
|
|
422
|
-
});
|
|
423
|
-
if (primarySkills.length === 0) {
|
|
424
|
-
return `<!-- ${MARKER} — source: generated from .productbrain/skills/*.md -->
|
|
425
|
-
|
|
426
|
-
# Product Brain Skills for Codex
|
|
427
|
-
|
|
428
|
-
No Product Brain skills are currently projected for Codex in this repo.
|
|
429
|
-
`;
|
|
430
|
-
}
|
|
431
|
-
const blocks = primarySkills.map((skill) => {
|
|
432
|
-
const triggerText = skill.triggers.length > 0
|
|
433
|
-
? `Triggers: ${skill.triggers.map((t) => `\`${t}\``).join(', ')}`
|
|
434
|
-
: 'Triggers: none declared';
|
|
435
|
-
return `## ${skill.name}
|
|
436
|
-
|
|
437
|
-
${skill.description}
|
|
438
|
-
|
|
439
|
-
${triggerText}
|
|
440
|
-
|
|
441
|
-
Read: \`.codex/skills/${skill.name}.md\``;
|
|
442
|
-
});
|
|
443
|
-
return `<!-- ${MARKER} — source: generated from .productbrain/skills/*.md -->
|
|
444
|
-
|
|
445
|
-
# Product Brain Skills for Codex
|
|
446
|
-
|
|
447
|
-
When the task matches one of these workflows, read the linked skill file first and follow its protocol.
|
|
448
|
-
Maintenance companions like \`*-learnings\` and \`LEARNINGS-TEMPLATE\` are still projected on disk, but hidden from this index so the primary workflows stay easy to scan.
|
|
449
|
-
|
|
450
|
-
${blocks.join('\n\n')}`;
|
|
451
|
-
}
|
|
452
|
-
const CODEX_DEAD_REFERENCE_PATTERNS = [
|
|
453
|
-
{ pattern: /\bpb\s+(session|orient|get|capture|search|update|handshake|context|constellation)\b/, label: 'pb CLI command' },
|
|
454
|
-
{ pattern: /\bsub-agent\b/i, label: 'sub-agent reference' },
|
|
455
|
-
{ pattern: /\bAgent\s+tool\b/, label: 'Agent tool reference' },
|
|
456
|
-
{ pattern: /\bkernelCall\b/, label: 'kernelCall reference' },
|
|
457
|
-
{ pattern: /\bpb\s+session\s+(start|close)\b/, label: 'pb session lifecycle' },
|
|
458
|
-
];
|
|
459
|
-
/**
|
|
460
|
-
* Validate Codex-projected skills for references to capabilities Codex cannot execute.
|
|
461
|
-
* Scans the transport-stripped body (so claude-only blocks don't false-positive).
|
|
462
|
-
*/
|
|
463
|
-
export function validateCodexSkills(skills) {
|
|
464
|
-
const warnings = [];
|
|
465
|
-
for (const skill of skills) {
|
|
466
|
-
const stripped = stripTransportSections(skill.body, 'codex');
|
|
467
|
-
const lines = stripped.split('\n');
|
|
468
|
-
for (const line of lines) {
|
|
469
|
-
for (const { pattern, label } of CODEX_DEAD_REFERENCE_PATTERNS) {
|
|
470
|
-
if (pattern.test(line)) {
|
|
471
|
-
warnings.push({
|
|
472
|
-
skillName: skill.name,
|
|
473
|
-
pattern: label,
|
|
474
|
-
line: line.trim().slice(0, 80),
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
return warnings;
|
|
481
|
-
}
|
|
482
|
-
//# sourceMappingURL=portable-knowledge.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"portable-knowledge.js","sourceRoot":"","sources":["../../src/generators/portable-knowledge.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AA6CvC,uEAAuE;AACvE,MAAM,UAAU,kBAAkB,CAAC,KAAqC,EAAE,MAAkB;IAC1F,IAAI,CAAC,KAAK,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACxC,CAAC;AAMD,MAAM,eAAe,GAAqC;IACxD,QAAQ,EAAE,CAAC,MAAM,CAAC;IAClB,YAAY,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC;IACtC,MAAM,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,CAAC;CAC3C,CAAC;AAEF,MAAM,YAAY,GAA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