@nepopsx/cli 0.0.10 → 0.0.12
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/dist/agents/remote-config.d.ts +9 -0
- package/dist/agents/remote-config.d.ts.map +1 -1
- package/dist/agents/remote-config.js +1 -0
- package/dist/agents/remote-config.js.map +1 -1
- package/dist/commands/install.d.ts +1 -0
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +10 -2
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/push-learnings.d.ts.map +1 -1
- package/dist/commands/push-learnings.js +36 -4
- package/dist/commands/push-learnings.js.map +1 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +71 -19
- package/dist/commands/sync.js.map +1 -1
- package/dist/generator/package-renderer.d.ts +16 -7
- package/dist/generator/package-renderer.d.ts.map +1 -1
- package/dist/generator/package-renderer.js +112 -56
- package/dist/generator/package-renderer.js.map +1 -1
- package/dist/generator/provider-transform.d.ts +15 -0
- package/dist/generator/provider-transform.d.ts.map +1 -0
- package/dist/generator/provider-transform.js +163 -0
- package/dist/generator/provider-transform.js.map +1 -0
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/learnings/yaml-learnings.d.ts +29 -0
- package/dist/learnings/yaml-learnings.d.ts.map +1 -0
- package/dist/learnings/yaml-learnings.js +132 -0
- package/dist/learnings/yaml-learnings.js.map +1 -0
- package/dist/scan/config.d.ts.map +1 -1
- package/dist/scan/config.js +144 -20
- package/dist/scan/config.js.map +1 -1
- package/package.json +2 -2
|
@@ -5,35 +5,53 @@
|
|
|
5
5
|
* renderBundleForInstall — all files land under .github/ (preserves bundle layout)
|
|
6
6
|
* renderAgentBundle — remaps schemas to openspec/ (used by sync)
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* Multi-provider support:
|
|
9
|
+
* Both functions accept an optional `providers` array. For each provider:
|
|
10
|
+
* - github-copilot: agents/ → .github/agents/, prompts/ → .github/prompts/, etc.
|
|
11
|
+
* - claude-code: agents/ → .claude/agents/ (frontmatter transformed, orchestrators skipped),
|
|
12
|
+
* claude-commands/ → .claude/commands/ (purpose-built command files)
|
|
13
|
+
* - Other providers: TBD — currently no output.
|
|
14
|
+
*
|
|
15
|
+
* Backend bundles are already rendered server-side. The CLI remaps paths and
|
|
16
|
+
* transforms agent frontmatter per provider.
|
|
9
17
|
*/
|
|
10
|
-
import { join } from 'node:path';
|
|
18
|
+
import { basename, join } from 'node:path';
|
|
19
|
+
import { DEFAULT_PROVIDERS } from '@nepopsx/core';
|
|
11
20
|
import { isReservedBundleRootPath } from '../agents/configuration.js';
|
|
21
|
+
import { transformAgentForProvider } from './provider-transform.js';
|
|
12
22
|
// ─── Install mode ───────────────────────────────────────────
|
|
13
23
|
/**
|
|
14
24
|
* Render a downloaded agent bundle for `nepopsx install`.
|
|
15
25
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
26
|
+
* For github-copilot: all files land under `.github/<relativePath>` with .hbs stripped.
|
|
27
|
+
* For claude-code: agent files are frontmatter-transformed → `.claude/agents/`,
|
|
28
|
+
* claude-commands/ → `.claude/commands/`.
|
|
19
29
|
*
|
|
20
30
|
* Decrypted .hbs source is kept in memory only — never touches disk.
|
|
21
31
|
*/
|
|
22
|
-
export function renderBundleForInstall(bundle) {
|
|
32
|
+
export function renderBundleForInstall(bundle, providers = DEFAULT_PROVIDERS) {
|
|
23
33
|
const operations = [];
|
|
34
|
+
const providerSet = new Set(providers);
|
|
24
35
|
for (const [relativePath, rawContent] of Object.entries(bundle.templates)) {
|
|
25
36
|
if (isReservedBundleRootPath(relativePath))
|
|
26
37
|
continue;
|
|
27
|
-
|
|
28
|
-
const outputPath = isHbs ? relativePath.replace(/\.hbs$/, '') : relativePath;
|
|
29
|
-
const content = rawContent;
|
|
30
|
-
if (content.trim().length === 0)
|
|
38
|
+
if (rawContent.trim().length === 0)
|
|
31
39
|
continue;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
const isHbs = relativePath.endsWith('.hbs');
|
|
41
|
+
const cleanPath = isHbs ? relativePath.replace(/\.hbs$/, '') : relativePath;
|
|
42
|
+
// GitHub Copilot: everything under .github/
|
|
43
|
+
if (providerSet.has('github-copilot') && !relativePath.startsWith('claude-')) {
|
|
44
|
+
operations.push({
|
|
45
|
+
path: join('.github', cleanPath),
|
|
46
|
+
content: rawContent,
|
|
47
|
+
source: `remote:${bundle.agent}/${relativePath}`,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
// Claude Code: transform agents, map commands
|
|
51
|
+
if (providerSet.has('claude-code')) {
|
|
52
|
+
const claudeOps = renderForClaudeCode(relativePath, rawContent, bundle.agent);
|
|
53
|
+
operations.push(...claudeOps);
|
|
54
|
+
}
|
|
37
55
|
}
|
|
38
56
|
return operations;
|
|
39
57
|
}
|
|
@@ -42,68 +60,106 @@ export function renderBundleForInstall(bundle) {
|
|
|
42
60
|
* Render all templates from an agent bundle for `nepopsx sync`.
|
|
43
61
|
*
|
|
44
62
|
* Uses prefix-based remapping so schemas land in openspec/ and
|
|
45
|
-
* generated agent/prompt files land under .
|
|
63
|
+
* generated agent/prompt files land under provider-specific directories.
|
|
46
64
|
*/
|
|
47
|
-
export function renderAgentBundle(bundle) {
|
|
65
|
+
export function renderAgentBundle(bundle, providers = DEFAULT_PROVIDERS) {
|
|
48
66
|
const operations = [];
|
|
49
67
|
const handledPaths = new Set();
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
const providerSet = new Set(providers);
|
|
69
|
+
// GitHub Copilot prefix mappings
|
|
70
|
+
if (providerSet.has('github-copilot')) {
|
|
71
|
+
const copilotDirs = [
|
|
72
|
+
{ prefix: 'agents/', output: '.github/agents' },
|
|
73
|
+
{ prefix: 'prompts/', output: '.github/prompts' },
|
|
74
|
+
{ prefix: 'instructions/', output: '.github/instructions' },
|
|
75
|
+
{ prefix: 'skills/', output: '.github/skills' },
|
|
76
|
+
{ prefix: 'partials/', output: '.github/partials' },
|
|
77
|
+
];
|
|
78
|
+
for (const { prefix, output } of copilotDirs) {
|
|
79
|
+
for (const [relativePath, templateSource] of Object.entries(bundle.templates)) {
|
|
80
|
+
if (!relativePath.startsWith(prefix))
|
|
81
|
+
continue;
|
|
82
|
+
const outputFileName = relativePath.slice(prefix.length).replace(/\.hbs$/, '');
|
|
83
|
+
if (templateSource.trim().length === 0)
|
|
84
|
+
continue;
|
|
85
|
+
handledPaths.add(relativePath);
|
|
86
|
+
operations.push({
|
|
87
|
+
path: join(output, outputFileName),
|
|
88
|
+
content: templateSource,
|
|
89
|
+
source: `remote:${bundle.agent}/${relativePath}`,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
70
92
|
}
|
|
71
93
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
content,
|
|
84
|
-
source: `remote:${bundle.agent}/${relativePath}`,
|
|
85
|
-
});
|
|
94
|
+
// Claude Code: transform agents + map commands
|
|
95
|
+
if (providerSet.has('claude-code')) {
|
|
96
|
+
for (const [relativePath, rawContent] of Object.entries(bundle.templates)) {
|
|
97
|
+
if (rawContent.trim().length === 0)
|
|
98
|
+
continue;
|
|
99
|
+
const claudeOps = renderForClaudeCode(relativePath, rawContent, bundle.agent);
|
|
100
|
+
if (claudeOps.length > 0) {
|
|
101
|
+
operations.push(...claudeOps);
|
|
102
|
+
handledPaths.add(relativePath);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
86
105
|
}
|
|
106
|
+
// Schema files always go to openspec/ regardless of provider
|
|
87
107
|
copySyncSchemaFiles(bundle.templates, bundle.agent, operations);
|
|
108
|
+
// Remaining unhandled files (excluding schemas and provider-specific prefixes)
|
|
88
109
|
for (const [relativePath, rawContent] of Object.entries(bundle.templates)) {
|
|
89
110
|
if (handledPaths.has(relativePath) || isReservedBundleRootPath(relativePath)) {
|
|
90
111
|
continue;
|
|
91
112
|
}
|
|
92
|
-
if (relativePath.startsWith('schemas/'))
|
|
113
|
+
if (relativePath.startsWith('schemas/'))
|
|
114
|
+
continue;
|
|
115
|
+
if (relativePath.startsWith('claude-'))
|
|
93
116
|
continue;
|
|
94
|
-
}
|
|
95
117
|
const outputPath = relativePath.replace(/\.hbs$/, '');
|
|
96
|
-
|
|
97
|
-
if (content.trim().length === 0)
|
|
118
|
+
if (rawContent.trim().length === 0)
|
|
98
119
|
continue;
|
|
99
120
|
operations.push({
|
|
100
121
|
path: outputPath,
|
|
101
|
-
content,
|
|
122
|
+
content: rawContent,
|
|
102
123
|
source: `remote:${bundle.agent}/${relativePath}`,
|
|
103
124
|
});
|
|
104
125
|
}
|
|
105
126
|
return operations;
|
|
106
127
|
}
|
|
128
|
+
// ─── Claude Code rendering ──────────────────────────────────
|
|
129
|
+
/**
|
|
130
|
+
* Render a single bundle file for Claude Code provider.
|
|
131
|
+
*
|
|
132
|
+
* - agents/ files: frontmatter transformed (model/tools/agents stripped, name/color added).
|
|
133
|
+
* Orchestrator agents (those with `agents:` in frontmatter) are skipped — they become commands.
|
|
134
|
+
* - claude-commands/ files: mapped directly to .claude/commands/
|
|
135
|
+
* - Other prefixes: ignored for Claude Code.
|
|
136
|
+
*/
|
|
137
|
+
function renderForClaudeCode(relativePath, rawContent, agentName) {
|
|
138
|
+
const cleanPath = relativePath.replace(/\.hbs$/, '');
|
|
139
|
+
// Transform agent files
|
|
140
|
+
if (relativePath.startsWith('agents/')) {
|
|
141
|
+
const fileName = basename(cleanPath);
|
|
142
|
+
const transformed = transformAgentForProvider(rawContent, fileName, 'claude-code');
|
|
143
|
+
if (transformed === null)
|
|
144
|
+
return []; // Orchestrator — skipped
|
|
145
|
+
const outputFileName = cleanPath.slice('agents/'.length);
|
|
146
|
+
return [{
|
|
147
|
+
path: join('.claude/agents', outputFileName),
|
|
148
|
+
content: transformed,
|
|
149
|
+
source: `remote:${agentName}/${relativePath}`,
|
|
150
|
+
}];
|
|
151
|
+
}
|
|
152
|
+
// Claude-specific command files
|
|
153
|
+
if (relativePath.startsWith('claude-commands/')) {
|
|
154
|
+
const outputFileName = cleanPath.slice('claude-commands/'.length);
|
|
155
|
+
return [{
|
|
156
|
+
path: join('.claude/commands', outputFileName),
|
|
157
|
+
content: rawContent,
|
|
158
|
+
source: `remote:${agentName}/${relativePath}`,
|
|
159
|
+
}];
|
|
160
|
+
}
|
|
161
|
+
return [];
|
|
162
|
+
}
|
|
107
163
|
// ─── Internals ──────────────────────────────────────────────
|
|
108
164
|
function copySyncSchemaFiles(templateMap, agentName, operations) {
|
|
109
165
|
for (const [relativePath, rawContent] of Object.entries(templateMap)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-renderer.js","sourceRoot":"","sources":["../../src/generator/package-renderer.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"package-renderer.js","sourceRoot":"","sources":["../../src/generator/package-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAuB,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,+DAA+D;AAE/D;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAAs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B,MAAM,EAAE,UAAU,SAAS,IAAI,YAAY,EAAE;aAC9C,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,+DAA+D;AAE/D,SAAS,mBAAmB,CAC1B,WAAmC,EACnC,SAAiB,EACjB,UAA4B;IAE5B,KAAK,MAAM,CAAC,YAAY,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QACrE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,UAAU,CAAC;YAAE,SAAS;QAEnD,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC/E,MAAM,OAAO,GAAG,UAAU,CAAC;QAE3B,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAE1C,UAAU,CAAC,IAAI,CAAC;YACd,IAAI,EAAE,oBAAoB,SAAS,IAAI,UAAU,EAAE;YACnD,OAAO;YACP,MAAM,EAAE,UAAU,SAAS,IAAI,YAAY,EAAE;SAC9C,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transforms agent markdown frontmatter for different AI editor providers.
|
|
3
|
+
*
|
|
4
|
+
* GitHub Copilot agents use full frontmatter (model, tools, agents, handoffs).
|
|
5
|
+
* Claude Code agents use minimal frontmatter (name, description, user-invocable, color).
|
|
6
|
+
* Other providers TBD — fall through with no transformation.
|
|
7
|
+
*/
|
|
8
|
+
import type { OutputProvider } from '@nepopsx/core';
|
|
9
|
+
/**
|
|
10
|
+
* Transform an agent file's content for the target provider.
|
|
11
|
+
* Returns the transformed content, or null if the file should be skipped
|
|
12
|
+
* (e.g., orchestrators in Claude Code — they become commands).
|
|
13
|
+
*/
|
|
14
|
+
export declare function transformAgentForProvider(content: string, fileName: string, provider: OutputProvider): string | null;
|
|
15
|
+
//# sourceMappingURL=provider-transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-transform.d.ts","sourceRoot":"","sources":["../../src/generator/provider-transform.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AA8JpD;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,cAAc,GACvB,MAAM,GAAG,IAAI,CASf"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transforms agent markdown frontmatter for different AI editor providers.
|
|
3
|
+
*
|
|
4
|
+
* GitHub Copilot agents use full frontmatter (model, tools, agents, handoffs).
|
|
5
|
+
* Claude Code agents use minimal frontmatter (name, description, user-invocable, color).
|
|
6
|
+
* Other providers TBD — fall through with no transformation.
|
|
7
|
+
*/
|
|
8
|
+
const FRONTMATTER_RE = /^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;
|
|
9
|
+
/**
|
|
10
|
+
* Parse YAML frontmatter from a markdown file.
|
|
11
|
+
* Returns null if no frontmatter block is found.
|
|
12
|
+
*/
|
|
13
|
+
function parseFrontmatter(content) {
|
|
14
|
+
const match = content.match(FRONTMATTER_RE);
|
|
15
|
+
if (!match)
|
|
16
|
+
return null;
|
|
17
|
+
const [, yamlBlock, body] = match;
|
|
18
|
+
const frontmatter = {};
|
|
19
|
+
// Simple YAML key-value parser (handles strings, booleans, arrays)
|
|
20
|
+
let currentKey = null;
|
|
21
|
+
let currentArray = null;
|
|
22
|
+
for (const line of yamlBlock.split('\n')) {
|
|
23
|
+
const trimmed = line.trim();
|
|
24
|
+
// Array item
|
|
25
|
+
if (trimmed.startsWith('- ') && currentKey && currentArray !== null) {
|
|
26
|
+
currentArray.push(trimmed.slice(2).trim());
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
// Flush previous array
|
|
30
|
+
if (currentKey && currentArray !== null) {
|
|
31
|
+
frontmatter[currentKey] = currentArray;
|
|
32
|
+
currentArray = null;
|
|
33
|
+
currentKey = null;
|
|
34
|
+
}
|
|
35
|
+
// Key-value pair
|
|
36
|
+
const kvMatch = trimmed.match(/^([a-z_-]+):\s*(.*)$/i);
|
|
37
|
+
if (!kvMatch)
|
|
38
|
+
continue;
|
|
39
|
+
const [, key, value] = kvMatch;
|
|
40
|
+
if (value === '' || value === undefined) {
|
|
41
|
+
// Could be start of an array
|
|
42
|
+
currentKey = key;
|
|
43
|
+
currentArray = [];
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
// Scalar value
|
|
47
|
+
let parsed = value;
|
|
48
|
+
if (value === 'true')
|
|
49
|
+
parsed = true;
|
|
50
|
+
else if (value === 'false')
|
|
51
|
+
parsed = false;
|
|
52
|
+
else if (/^\d+$/.test(value))
|
|
53
|
+
parsed = parseInt(value, 10);
|
|
54
|
+
else if (value.startsWith('"') && value.endsWith('"'))
|
|
55
|
+
parsed = value.slice(1, -1);
|
|
56
|
+
frontmatter[key] = parsed;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Flush final array
|
|
60
|
+
if (currentKey && currentArray !== null) {
|
|
61
|
+
frontmatter[currentKey] = currentArray;
|
|
62
|
+
}
|
|
63
|
+
return { frontmatter, body, raw: content };
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Serialize frontmatter back to YAML string.
|
|
67
|
+
*/
|
|
68
|
+
function serializeFrontmatter(fm) {
|
|
69
|
+
const lines = [];
|
|
70
|
+
for (const [key, value] of Object.entries(fm)) {
|
|
71
|
+
if (value === undefined || value === null)
|
|
72
|
+
continue;
|
|
73
|
+
if (Array.isArray(value)) {
|
|
74
|
+
lines.push(`${key}:`);
|
|
75
|
+
for (const item of value) {
|
|
76
|
+
lines.push(` - ${item}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else if (typeof value === 'string' && (value.includes(':') || value.includes('"') || value.includes("'") || value.startsWith('[') || value.startsWith('{'))) {
|
|
80
|
+
lines.push(`${key}: "${value.replace(/"/g, '\\"')}"`);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
lines.push(`${key}: ${value}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return lines.join('\n');
|
|
87
|
+
}
|
|
88
|
+
/** Keys to strip from frontmatter when converting to Claude Code format. */
|
|
89
|
+
const COPILOT_ONLY_KEYS = new Set(['model', 'tools', 'agents', 'handoffs']);
|
|
90
|
+
/** Color assignment based on agent role patterns. */
|
|
91
|
+
function inferColor(name) {
|
|
92
|
+
if (name.includes('orchestrat'))
|
|
93
|
+
return 'green';
|
|
94
|
+
if (name.includes('planner') || name.includes('architect'))
|
|
95
|
+
return 'blue';
|
|
96
|
+
if (name.includes('executor') || name.includes('developer'))
|
|
97
|
+
return 'orange';
|
|
98
|
+
if (name.includes('reflector') || name.includes('reflect'))
|
|
99
|
+
return 'purple';
|
|
100
|
+
if (name.includes('reviewer'))
|
|
101
|
+
return 'yellow';
|
|
102
|
+
if (name.includes('scanner'))
|
|
103
|
+
return 'cyan';
|
|
104
|
+
if (name.includes('writer'))
|
|
105
|
+
return 'orange';
|
|
106
|
+
if (name.includes('qa'))
|
|
107
|
+
return 'red';
|
|
108
|
+
return 'blue';
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Determine if an agent file represents an orchestrator.
|
|
112
|
+
* Orchestrators have `agents:` in their frontmatter (they dispatch to sub-agents).
|
|
113
|
+
* In Claude Code, orchestrators become commands, not agents.
|
|
114
|
+
*/
|
|
115
|
+
function isOrchestratorAgent(fm) {
|
|
116
|
+
return Array.isArray(fm.agents) && fm.agents.length > 0;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Transform an agent markdown file for Claude Code provider.
|
|
120
|
+
*
|
|
121
|
+
* - Strips model, tools, agents, handoffs from frontmatter
|
|
122
|
+
* - Adds name (from filename) and color
|
|
123
|
+
* - Preserves description and user-invocable
|
|
124
|
+
* - Returns null for orchestrator agents (they become commands in Claude)
|
|
125
|
+
*/
|
|
126
|
+
function transformForClaudeCode(content, fileName) {
|
|
127
|
+
const parsed = parseFrontmatter(content);
|
|
128
|
+
if (!parsed)
|
|
129
|
+
return content; // No frontmatter — pass through
|
|
130
|
+
// Orchestrators become commands, not agents
|
|
131
|
+
if (isOrchestratorAgent(parsed.frontmatter))
|
|
132
|
+
return null;
|
|
133
|
+
const agentName = fileName.replace(/\.agent\.md(\.hbs)?$/, '');
|
|
134
|
+
const claudeFm = {
|
|
135
|
+
name: agentName,
|
|
136
|
+
};
|
|
137
|
+
// Preserve description
|
|
138
|
+
if (parsed.frontmatter.description) {
|
|
139
|
+
claudeFm.description = parsed.frontmatter.description;
|
|
140
|
+
}
|
|
141
|
+
// Preserve user-invocable
|
|
142
|
+
if (parsed.frontmatter['user-invocable'] !== undefined) {
|
|
143
|
+
claudeFm['user-invocable'] = parsed.frontmatter['user-invocable'];
|
|
144
|
+
}
|
|
145
|
+
claudeFm.color = inferColor(agentName);
|
|
146
|
+
return `---\n${serializeFrontmatter(claudeFm)}\n---\n${parsed.body}`;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Transform an agent file's content for the target provider.
|
|
150
|
+
* Returns the transformed content, or null if the file should be skipped
|
|
151
|
+
* (e.g., orchestrators in Claude Code — they become commands).
|
|
152
|
+
*/
|
|
153
|
+
export function transformAgentForProvider(content, fileName, provider) {
|
|
154
|
+
switch (provider) {
|
|
155
|
+
case 'claude-code':
|
|
156
|
+
return transformForClaudeCode(content, fileName);
|
|
157
|
+
case 'github-copilot':
|
|
158
|
+
return content; // No transformation needed
|
|
159
|
+
default:
|
|
160
|
+
return content; // Other providers TBD — pass through
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=provider-transform.js.map
|
|
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0BAA0B;IAC1B,IAAI,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,SAAS,EAAE,CAAC;QACvD,QAAQ,CAAC,gBAAgB,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IACpE,CAAC;IAED,QAAQ,CAAC,KAAK,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IAEvC,OAAO,QAAQ,oBAAoB,CAAC,QAAQ,CAAC,UAAU,MAAM,CAAC,IAAI,EAAE,CAAC;AACvE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAe,EACf,QAAgB,EAChB,QAAwB;IAExB,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,aAAa;YAChB,OAAO,sBAAsB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACnD,KAAK,gBAAgB;YACnB,OAAO,OAAO,CAAC,CAAC,2BAA2B;QAC7C;YACE,OAAO,OAAO,CAAC,CAAC,qCAAqC;IACzD,CAAC;AACH,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ const program = new Command();
|
|
|
13
13
|
program
|
|
14
14
|
.name('nepopsx')
|
|
15
15
|
.description('NEPOPSX — AI Agent Platform for Engineering Teams')
|
|
16
|
-
.version('0.0.
|
|
16
|
+
.version('0.0.12');
|
|
17
17
|
program
|
|
18
18
|
.command('init')
|
|
19
19
|
.description('Initialize a new NEPOPSX workspace (interactive setup)')
|
|
@@ -35,6 +35,7 @@ program
|
|
|
35
35
|
.option('--agent', 'Agent-assisted mode (generate prompt files for Copilot/Claude)')
|
|
36
36
|
.option('--apply <path>', 'Apply a JSON response file from agent-assisted install mode')
|
|
37
37
|
.option('-y, --yes', 'Skip confirmations when auto-enriching agent config')
|
|
38
|
+
.option('--providers <providers...>', 'AI editor providers to generate output for (e.g., github-copilot claude-code)')
|
|
38
39
|
.action(installCommand);
|
|
39
40
|
program
|
|
40
41
|
.command('doctor')
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,SAAS,CAAC;KACf,WAAW,CAAC,mDAAmD,CAAC;KAChE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,M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AML learning file parser and writer.
|
|
3
|
+
*
|
|
4
|
+
* Reads/writes learning files from .nepopsx/learnings/*.yaml.
|
|
5
|
+
* These are the canonical local store for reflector-produced learnings.
|
|
6
|
+
*/
|
|
7
|
+
import type { LearningYaml } from '@nepopsx/core';
|
|
8
|
+
/**
|
|
9
|
+
* Load all YAML learning files from a directory.
|
|
10
|
+
* Recursively scans subdirectories (e.g. team/).
|
|
11
|
+
*/
|
|
12
|
+
export declare function loadYamlLearnings(learningsDir: string, agentFilter?: string): LearningYaml[];
|
|
13
|
+
/**
|
|
14
|
+
* Parse a single YAML learning file. Returns null if invalid.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseYamlLearning(filePath: string): LearningYaml | null;
|
|
17
|
+
/**
|
|
18
|
+
* Write a LearningYaml to a .yaml file.
|
|
19
|
+
*/
|
|
20
|
+
export declare function writeYamlLearning(dir: string, learning: LearningYaml): string;
|
|
21
|
+
/**
|
|
22
|
+
* Convert a legacy customs/auto/*.md learning to YAML format.
|
|
23
|
+
*/
|
|
24
|
+
export declare function convertLegacyLearning(slug: string, content: string, agent: string, appliesTo: string[], confidence: string, type: string, extra?: {
|
|
25
|
+
evidence?: string;
|
|
26
|
+
config_path?: string;
|
|
27
|
+
config_value?: unknown;
|
|
28
|
+
}): LearningYaml;
|
|
29
|
+
//# sourceMappingURL=yaml-learnings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-learnings.d.ts","sourceRoot":"","sources":["../../src/learnings/yaml-learnings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAMlD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,YAAY,EAAE,CAM5F;AAkBD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAoCvE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,MAAM,CAuB7E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EAAE,EACnB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1E,YAAY,CAed"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* YAML learning file parser and writer.
|
|
3
|
+
*
|
|
4
|
+
* Reads/writes learning files from .nepopsx/learnings/*.yaml.
|
|
5
|
+
* These are the canonical local store for reflector-produced learnings.
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
|
8
|
+
import { basename, resolve } from 'node:path';
|
|
9
|
+
import { parse, stringify } from 'yaml';
|
|
10
|
+
const VALID_TYPES = new Set(['custom_instruction', 'config_patch', 'skill', 'scope_change']);
|
|
11
|
+
const VALID_CONFIDENCES = new Set(['high', 'medium', 'low']);
|
|
12
|
+
const VALID_STATUSES = new Set(['local', 'pending', 'approved', 'suggested', 'reverted']);
|
|
13
|
+
/**
|
|
14
|
+
* Load all YAML learning files from a directory.
|
|
15
|
+
* Recursively scans subdirectories (e.g. team/).
|
|
16
|
+
*/
|
|
17
|
+
export function loadYamlLearnings(learningsDir, agentFilter) {
|
|
18
|
+
if (!existsSync(learningsDir))
|
|
19
|
+
return [];
|
|
20
|
+
const learnings = [];
|
|
21
|
+
scanDir(learningsDir, learnings, agentFilter);
|
|
22
|
+
return learnings;
|
|
23
|
+
}
|
|
24
|
+
function scanDir(dir, out, agentFilter) {
|
|
25
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
26
|
+
const fullPath = resolve(dir, entry.name);
|
|
27
|
+
if (entry.isDirectory()) {
|
|
28
|
+
scanDir(fullPath, out, agentFilter);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (!entry.name.endsWith('.yaml') && !entry.name.endsWith('.yml'))
|
|
32
|
+
continue;
|
|
33
|
+
const learning = parseYamlLearning(fullPath);
|
|
34
|
+
if (!learning)
|
|
35
|
+
continue;
|
|
36
|
+
if (agentFilter && learning.agent !== agentFilter)
|
|
37
|
+
continue;
|
|
38
|
+
out.push(learning);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Parse a single YAML learning file. Returns null if invalid.
|
|
43
|
+
*/
|
|
44
|
+
export function parseYamlLearning(filePath) {
|
|
45
|
+
try {
|
|
46
|
+
const raw = readFileSync(filePath, 'utf-8');
|
|
47
|
+
const parsed = parse(raw);
|
|
48
|
+
if (!parsed || typeof parsed !== 'object')
|
|
49
|
+
return null;
|
|
50
|
+
const slug = parsed.slug ?? basename(filePath).replace(/\.ya?ml$/, '');
|
|
51
|
+
const type = parsed.type;
|
|
52
|
+
const confidence = parsed.confidence ?? 'medium';
|
|
53
|
+
const agent = parsed.agent ?? '';
|
|
54
|
+
const status = parsed.status ?? 'local';
|
|
55
|
+
if (!VALID_TYPES.has(type))
|
|
56
|
+
return null;
|
|
57
|
+
if (!VALID_CONFIDENCES.has(confidence))
|
|
58
|
+
return null;
|
|
59
|
+
if (!VALID_STATUSES.has(status))
|
|
60
|
+
return null;
|
|
61
|
+
if (typeof parsed.content !== 'string' || parsed.content.trim() === '')
|
|
62
|
+
return null;
|
|
63
|
+
return {
|
|
64
|
+
slug,
|
|
65
|
+
type,
|
|
66
|
+
confidence,
|
|
67
|
+
agent,
|
|
68
|
+
applies_to: Array.isArray(parsed.applies_to) ? parsed.applies_to : [],
|
|
69
|
+
status,
|
|
70
|
+
content: parsed.content.trim(),
|
|
71
|
+
evidence: parsed.evidence ?? undefined,
|
|
72
|
+
created_at: parsed.created_at ?? undefined,
|
|
73
|
+
session_id: parsed.session_id ?? undefined,
|
|
74
|
+
source: parsed.source ?? 'reflector',
|
|
75
|
+
config_path: parsed.config_path ?? undefined,
|
|
76
|
+
config_value: parsed.config_value ?? undefined,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Write a LearningYaml to a .yaml file.
|
|
85
|
+
*/
|
|
86
|
+
export function writeYamlLearning(dir, learning) {
|
|
87
|
+
mkdirSync(dir, { recursive: true });
|
|
88
|
+
const data = {
|
|
89
|
+
slug: learning.slug,
|
|
90
|
+
type: learning.type,
|
|
91
|
+
confidence: learning.confidence,
|
|
92
|
+
agent: learning.agent,
|
|
93
|
+
applies_to: learning.applies_to,
|
|
94
|
+
status: learning.status,
|
|
95
|
+
content: learning.content,
|
|
96
|
+
};
|
|
97
|
+
if (learning.evidence)
|
|
98
|
+
data.evidence = learning.evidence;
|
|
99
|
+
if (learning.created_at)
|
|
100
|
+
data.created_at = learning.created_at;
|
|
101
|
+
if (learning.session_id)
|
|
102
|
+
data.session_id = learning.session_id;
|
|
103
|
+
if (learning.source)
|
|
104
|
+
data.source = learning.source;
|
|
105
|
+
if (learning.config_path)
|
|
106
|
+
data.config_path = learning.config_path;
|
|
107
|
+
if (learning.config_value !== undefined)
|
|
108
|
+
data.config_value = learning.config_value;
|
|
109
|
+
const filePath = resolve(dir, `${learning.slug}.yaml`);
|
|
110
|
+
writeFileSync(filePath, stringify(data, { lineWidth: 120 }), 'utf-8');
|
|
111
|
+
return filePath;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Convert a legacy customs/auto/*.md learning to YAML format.
|
|
115
|
+
*/
|
|
116
|
+
export function convertLegacyLearning(slug, content, agent, appliesTo, confidence, type, extra) {
|
|
117
|
+
return {
|
|
118
|
+
slug,
|
|
119
|
+
type: (VALID_TYPES.has(type) ? type : 'custom_instruction'),
|
|
120
|
+
confidence: (VALID_CONFIDENCES.has(confidence) ? confidence : 'medium'),
|
|
121
|
+
agent,
|
|
122
|
+
applies_to: appliesTo,
|
|
123
|
+
status: 'local',
|
|
124
|
+
content: content.trim(),
|
|
125
|
+
evidence: extra?.evidence,
|
|
126
|
+
source: 'reflector',
|
|
127
|
+
config_path: extra?.config_path,
|
|
128
|
+
config_value: extra?.config_value,
|
|
129
|
+
created_at: new Date().toISOString(),
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=yaml-learnings.js.map
|