@aiwg/cli 2026.10.16 → 2026.10.18
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/src/artifacts/corpus-tools/resolve.js +21 -4
- package/dist/src/artifacts/query-engine-corpus.js +217 -0
- package/dist/src/artifacts/query-engine-discover-output.js +229 -0
- package/dist/src/artifacts/query-engine-discover.js +285 -0
- package/dist/src/artifacts/query-engine-entries.js +188 -0
- package/dist/src/artifacts/query-engine-index.js +249 -0
- package/dist/src/artifacts/query-engine-matching.js +143 -0
- package/dist/src/artifacts/query-engine-options.js +2 -0
- package/dist/src/artifacts/query-engine-rules.js +202 -0
- package/dist/src/artifacts/query-engine-scoring.js +436 -0
- package/dist/src/artifacts/query-engine-show-card.js +194 -0
- package/dist/src/artifacts/query-engine-show-load.js +211 -0
- package/dist/src/artifacts/query-engine-show.js +300 -0
- package/dist/src/artifacts/query-engine.js +7 -2576
- package/dist/src/cli/handlers/mc-agents.js +111 -0
- package/dist/src/cli/handlers/mc-args.js +54 -0
- package/dist/src/cli/handlers/mc-control.js +227 -0
- package/dist/src/cli/handlers/mc-dispatch.js +203 -0
- package/dist/src/cli/handlers/mc-help.js +171 -0
- package/dist/src/cli/handlers/mc-run.js +343 -0
- package/dist/src/cli/handlers/mc-session.js +138 -0
- package/dist/src/cli/handlers/mc-status.js +258 -0
- package/dist/src/cli/handlers/mc-summary.js +43 -0
- package/dist/src/cli/handlers/mc-types.js +3 -0
- package/dist/src/cli/handlers/mc-worker.js +205 -0
- package/dist/src/cli/handlers/mc.js +12 -1665
- package/dist/src/cli/handlers/models-refusal.js +13 -0
- package/dist/src/cli/handlers/models.js +2 -1
- package/dist/src/cli/handlers/remove-bundled.js +133 -0
- package/dist/src/cli/handlers/remove-options.js +31 -0
- package/dist/src/cli/handlers/remove-user.js +174 -0
- package/dist/src/cli/handlers/remove.js +201 -0
- package/dist/src/cli/handlers/subcommands-bundles.js +257 -0
- package/dist/src/cli/handlers/subcommands-discovery.js +165 -0
- package/dist/src/cli/handlers/subcommands-list-format.js +129 -0
- package/dist/src/cli/handlers/subcommands-list.js +250 -0
- package/dist/src/cli/handlers/subcommands-plugins.js +213 -0
- package/dist/src/cli/handlers/subcommands-quickref.js +58 -0
- package/dist/src/cli/handlers/subcommands-rlm.js +113 -0
- package/dist/src/cli/handlers/subcommands-services.js +66 -0
- package/dist/src/cli/handlers/subcommands-storage.js +259 -0
- package/dist/src/cli/handlers/subcommands.js +18 -1984
- package/dist/src/cli/scope-resolver.js +1 -142
- package/dist/src/cli/user-scope-mirror.js +173 -0
- package/dist/src/config/dispatch-host-thresholds.js +2 -0
- package/dist/src/config/dispatch-thresholds-runtime.mjs +4 -0
- package/dist/src/config/host-resource-report.d.mts +5 -0
- package/dist/src/config/host-resource-report.mjs +36 -6
- package/dist/src/config/host-resource-runtime.d.mts +3 -0
- package/dist/src/config/host-resource-runtime.mjs +9 -6
- package/dist/src/decision/ensemble-study/artifacts.js +7 -0
- package/dist/src/decision/ensemble-study/gate-policy.js +58 -0
- package/dist/src/decision/ensemble-study/gates.js +78 -0
- package/dist/src/decision/ensemble-study/protocol.js +18 -21
- package/dist/src/decision/ensemble-study/score.js +3 -2
- package/dist/src/decision/ensemble-study/statistics.js +7 -26
- package/dist/src/decision/sensitivity/comparative-gates.js +135 -0
- package/dist/src/decision/sensitivity/comparative.js +18 -41
- package/dist/src/extensions/claude-hooks-installer.js +18 -0
- package/dist/src/gates/evaluate.js +2 -358
- package/dist/src/gates/observations.js +363 -0
- package/dist/src/gates/pack-composition.js +270 -0
- package/dist/src/gates/pack-tightening.js +197 -0
- package/dist/src/gates/pack-validation.js +262 -0
- package/dist/src/gates/registry-error.js +5 -0
- package/dist/src/gates/registry.js +13 -685
- package/dist/src/mcp/json-document.mjs +29 -0
- package/dist/src/mcp/muse-native-config.mjs +1 -28
- package/dist/src/mission-protocol/worker-review-gate.js +7 -0
- package/dist/src/models/worker-plan.js +5 -5
- package/dist/src/plugin/command-ownership.js +34 -0
- package/dist/src/plugin/skill-command-frontmatter.js +197 -0
- package/dist/src/plugin/skill-command-translator.js +6 -232
- package/dist/src/providers/context-output-ownership.js +26 -0
- package/dist/src/providers/deployment-ownership.d.mts +19 -0
- package/dist/src/providers/deployment-ownership.mjs +226 -0
- package/dist/src/providers/deployment-removal.js +200 -0
- package/dist/src/providers/removal-transaction.js +86 -0
- package/dist/src/providers/settings-document.d.mts +3 -0
- package/dist/src/providers/settings-document.mjs +47 -0
- package/dist/src/providers/settings-removal.js +190 -0
- package/dist/src/providers/skill-ownership.d.mts +19 -2
- package/dist/src/providers/skill-ownership.mjs +12 -4
- package/dist/src/providers/transformation-receipt-integration.js +15 -271
- package/dist/src/providers/transformation-receipt-outputs.js +99 -0
- package/dist/src/providers/transformation-receipt-source.js +194 -0
- package/dist/src/research/identity.js +8 -2
- package/dist/src/research/reference-match.js +42 -7
- package/dist/src/rules/activation.mjs +15 -6
- package/dist/src/rules/core-startup.mjs +2 -2
- package/dist/src/serve/mission-conductor.js +4 -0
- package/dist/src/serve/mission-summary.js +56 -0
- package/dist/src/smiths/context-pipeline/aiwg-md.js +23 -0
- package/dist/src/smiths/context-pipeline/context-file-safety.js +3 -0
- package/dist/src/smiths/context-pipeline/generator.js +1 -1
- package/dist/src/smiths/hook-bridge/index.js +9 -0
- package/package.json +4 -1
- package/schemas/decision/D17StudyProtocol.v1.schema.json +39 -67
- package/tools/agents/deploy-agents.mjs +16 -677
- package/tools/agents/deploy-command-mirrors.mjs +229 -0
- package/tools/agents/deploy-options.mjs +258 -0
- package/tools/agents/deploy-support.mjs +165 -0
- package/tools/agents/providers/base-addon-discovery.mjs +139 -0
- package/tools/agents/providers/base-behaviors.mjs +168 -0
- package/tools/agents/providers/base-context.mjs +205 -0
- package/tools/agents/providers/base-contract.mjs +116 -0
- package/tools/agents/providers/base-files.mjs +252 -0
- package/tools/agents/providers/base-flat-artifacts.mjs +233 -0
- package/tools/agents/providers/base-framework-discovery.mjs +309 -0
- package/tools/agents/providers/base-frontmatter.mjs +196 -0
- package/tools/agents/providers/base-inventory.mjs +269 -0
- package/tools/agents/providers/base-kernel-skills.mjs +354 -0
- package/tools/agents/providers/base-migrations.mjs +258 -0
- package/tools/agents/providers/base-models-platforms.mjs +273 -0
- package/tools/agents/providers/base-rule-index.mjs +450 -0
- package/tools/agents/providers/base-runtime.mjs +60 -0
- package/tools/agents/providers/base-skill-copy.mjs +273 -0
- package/tools/agents/providers/base.mjs +16 -3364
- package/tools/agents/providers/claude-post-deploy.mjs +10 -2
- package/tools/agents/providers/hermes-startup.mjs +0 -5
- package/tools/agents/providers/muse.mjs +7 -2
- package/tools/agents/providers/rule-delivery-surface.mjs +31 -4
- package/tools/agents/providers/rule-deployment-commit.mjs +19 -15
- package/tools/agents/providers/rule-deployment-prepare.mjs +11 -2
- package/tools/agents/providers/rule-projection.mjs +3 -0
- package/tools/ralph-external/lib/worker-invocation-processes.mjs +4 -2
- package/tools/ralph-external/lib/worker-termination.mjs +15 -8
- package/vscode-extension/schemas/aiwg.config.v1.json +2 -4
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
// Shared provider skill copy utilities.
|
|
2
|
+
import { canDeploySkill, extractFrameworkSlug, fs, path, pruneRecordedSkillFiles, releaseSkillOwnership } from './base-runtime.mjs';
|
|
3
|
+
import { contentHash, ensureDir, readSidecarManifest, resolveFrameworkWorkspaceRoot, writeSidecarManifest } from './base-files.mjs';
|
|
4
|
+
import { PROVIDER_TO_PLATFORM, injectPlatformInContent, skillMatchesProvider } from './base-models-platforms.mjs';
|
|
5
|
+
import { injectBoundRules } from './base-contract.mjs';
|
|
6
|
+
import { getFrameworksForMode } from './base-framework-discovery.mjs';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/** Source-scoped cleanup also works when a removed standard skill is absent from this deploy's input. */
|
|
10
|
+
export function pruneMissingStandardSkills(destDir, opts) {
|
|
11
|
+
if (!destDir || !opts?.srcRoot || opts.dryRun || !fs.existsSync(destDir)) return 0;
|
|
12
|
+
const sourceRoot = path.resolve(opts.srcRoot);
|
|
13
|
+
let pruned = 0;
|
|
14
|
+
for (const entry of fs.readdirSync(destDir, { withFileTypes: true })) {
|
|
15
|
+
if (!entry.isDirectory()) continue;
|
|
16
|
+
const skillDir = path.join(destDir, entry.name);
|
|
17
|
+
const receipt = readSidecarManifest(skillDir);
|
|
18
|
+
if (!receipt?.skillSource || !receipt.managed?.['SKILL.md']) continue;
|
|
19
|
+
const relative = path.relative(sourceRoot, receipt.skillSource);
|
|
20
|
+
if (!relative || relative.startsWith('..') || path.isAbsolute(relative)) continue;
|
|
21
|
+
try {
|
|
22
|
+
fs.statSync(path.join(receipt.skillSource, 'SKILL.md'));
|
|
23
|
+
continue;
|
|
24
|
+
} catch (error) {
|
|
25
|
+
if (error.code !== 'ENOENT' && error.code !== 'ENOTDIR') continue;
|
|
26
|
+
}
|
|
27
|
+
if (releaseSkillOwnership(skillDir, {
|
|
28
|
+
frameworkSlug: receipt.managed['SKILL.md'].frameworkSlug,
|
|
29
|
+
skillSource: receipt.skillSource,
|
|
30
|
+
}, opts)) pruned++;
|
|
31
|
+
}
|
|
32
|
+
return pruned;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Deploy a skill directory (copy recursively).
|
|
38
|
+
*
|
|
39
|
+
* Platform handling (controlled by opts.provider):
|
|
40
|
+
* - If the skill's SKILL.md has platforms: [all] → deploy to all, inject [provider] in deployed copy
|
|
41
|
+
* - If no platforms: field → deploy to all, inject [provider] in deployed copy
|
|
42
|
+
* - If explicit restriction list → only deploy if opts.provider is in the list; keep list in deployed copy
|
|
43
|
+
*/
|
|
44
|
+
export function deploySkillDir(skillDir, destDir, opts) {
|
|
45
|
+
const { force = false, dryRun = false, provider, transformSkillMd } = opts;
|
|
46
|
+
const verbose = opts.verbose === true;
|
|
47
|
+
const skillName = opts.skillName || path.basename(skillDir);
|
|
48
|
+
|
|
49
|
+
// Check SKILL.md for explicit platform restriction before deploying anything
|
|
50
|
+
const skillMdPath = path.join(skillDir, 'SKILL.md');
|
|
51
|
+
if (provider && fs.existsSync(skillMdPath)) {
|
|
52
|
+
const skillContent = fs.readFileSync(skillMdPath, 'utf8');
|
|
53
|
+
if (!skillMatchesProvider(skillContent, provider)) {
|
|
54
|
+
if (verbose) console.log(`skip (platform restricted): ${skillName}`);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const destSkillDir = path.join(destDir, skillName);
|
|
60
|
+
const previous = readSidecarManifest(destSkillDir);
|
|
61
|
+
const frameworkSlug = extractFrameworkSlug(opts.logicalInputPath?.(skillMdPath) || skillMdPath);
|
|
62
|
+
if (!canDeploySkill(previous, skillDir, opts)) return false;
|
|
63
|
+
const managed = {};
|
|
64
|
+
if (!dryRun) ensureDir(destSkillDir);
|
|
65
|
+
|
|
66
|
+
function copyRecursive(src, dest) {
|
|
67
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
68
|
+
for (const entry of entries) {
|
|
69
|
+
const srcPath = path.join(src, entry.name);
|
|
70
|
+
const destPath = path.join(dest, entry.name);
|
|
71
|
+
|
|
72
|
+
if (entry.isDirectory()) {
|
|
73
|
+
if (!dryRun) ensureDir(destPath);
|
|
74
|
+
copyRecursive(srcPath, destPath);
|
|
75
|
+
} else {
|
|
76
|
+
let srcContent = fs.readFileSync(srcPath, 'utf8');
|
|
77
|
+
|
|
78
|
+
// Inject target platform into SKILL.md — replaces [all] token with [provider-name]
|
|
79
|
+
if (entry.name === 'SKILL.md' && provider) {
|
|
80
|
+
const platformName = PROVIDER_TO_PLATFORM[provider] || provider;
|
|
81
|
+
srcContent = injectPlatformInContent(srcContent, platformName);
|
|
82
|
+
|
|
83
|
+
// Provider-specific frontmatter transform (e.g. Factory remaps
|
|
84
|
+
// commandHint.allowedTools / commandHint.model). Optional callback —
|
|
85
|
+
// most providers leave SKILL.md alone after platform injection.
|
|
86
|
+
if (typeof transformSkillMd === 'function') {
|
|
87
|
+
srcContent = transformSkillMd(srcContent, opts) || srcContent;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (entry.name === 'SKILL.md') srcContent = injectBoundRules(srcContent, srcPath, opts);
|
|
92
|
+
|
|
93
|
+
const relative = path.relative(destSkillDir, destPath);
|
|
94
|
+
managed[relative] = {
|
|
95
|
+
hash: `sha256:${contentHash(srcContent)}`,
|
|
96
|
+
source: opts.deploySource || 'bundled',
|
|
97
|
+
version: opts.deployVersion || 'unknown',
|
|
98
|
+
...(frameworkSlug ? { frameworkSlug } : {}),
|
|
99
|
+
};
|
|
100
|
+
if (fs.existsSync(destPath)) {
|
|
101
|
+
const destContent = fs.readFileSync(destPath, 'utf8');
|
|
102
|
+
if (destContent === srcContent && !force) {
|
|
103
|
+
if (verbose) console.log(`skip (unchanged): ${path.relative(destDir, destPath)}`);
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (dryRun) {
|
|
109
|
+
console.log(`[dry-run] deploy ${srcPath} -> ${destPath}`);
|
|
110
|
+
} else {
|
|
111
|
+
fs.writeFileSync(destPath, srcContent, 'utf8');
|
|
112
|
+
if (verbose) console.log(`deployed ${entry.name} -> ${path.relative(process.cwd(), destPath)}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
copyRecursive(skillDir, destSkillDir);
|
|
119
|
+
pruneRecordedSkillFiles(destSkillDir, previous?.managed, new Set(Object.keys(managed)), opts);
|
|
120
|
+
writeSidecarManifest(destSkillDir, { managed, skillSource: path.resolve(skillDir) }, dryRun);
|
|
121
|
+
|
|
122
|
+
// Drop a `.aiwg-managed` marker so future cleanup runs can identify
|
|
123
|
+
// AIWG-deployed skills regardless of frontmatter shape (some providers
|
|
124
|
+
// strip `namespace:` during transform). Cleanup keys off this presence
|
|
125
|
+
// to safely prune renamed/removed source skills.
|
|
126
|
+
if (!dryRun) {
|
|
127
|
+
try {
|
|
128
|
+
fs.writeFileSync(path.join(destSkillDir, '.aiwg-managed'), 'aiwg\n', 'utf8');
|
|
129
|
+
} catch { /* non-fatal */ }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (verbose) console.log(`deployed skill: ${skillName}`);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
// ============================================================================
|
|
137
|
+
// Workspace Initialization
|
|
138
|
+
// ============================================================================
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Initialize framework-scoped workspace structure
|
|
142
|
+
* Creates .aiwg/frameworks/{framework-id}/ directories
|
|
143
|
+
*/
|
|
144
|
+
export function initializeFrameworkWorkspace(target, mode, dryRun, srcRoot = null) {
|
|
145
|
+
const aiwgBase = resolveFrameworkWorkspaceRoot(target);
|
|
146
|
+
const frameworksDir = path.join(aiwgBase, 'frameworks');
|
|
147
|
+
const sharedDir = path.join(aiwgBase, 'shared');
|
|
148
|
+
|
|
149
|
+
const frameworkDirs = srcRoot
|
|
150
|
+
? getFrameworksForMode(srcRoot, mode).map(fw => ({
|
|
151
|
+
id: fw.id,
|
|
152
|
+
path: fw.path,
|
|
153
|
+
subdirs: fw.workspaceSubdirs,
|
|
154
|
+
memoryCreates: Array.isArray(fw.manifest?.memory?.creates) ? fw.manifest.memory.creates : []
|
|
155
|
+
}))
|
|
156
|
+
: [];
|
|
157
|
+
|
|
158
|
+
// Backward-compatible fallback when source root isn't provided.
|
|
159
|
+
if (frameworkDirs.length === 0) {
|
|
160
|
+
if (mode === 'sdlc' || mode === 'both' || mode === 'all') {
|
|
161
|
+
frameworkDirs.push({
|
|
162
|
+
id: 'sdlc-complete',
|
|
163
|
+
subdirs: ['repo', 'projects', 'working', 'archive']
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (mode === 'marketing' || mode === 'all') {
|
|
168
|
+
frameworkDirs.push({
|
|
169
|
+
id: 'media-marketing-kit',
|
|
170
|
+
subdirs: ['repo', 'campaigns', 'working', 'archive']
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (mode === 'media-curator' || mode === 'all') {
|
|
175
|
+
frameworkDirs.push({
|
|
176
|
+
id: 'media-curator',
|
|
177
|
+
subdirs: ['repo', 'library', 'working', 'archive']
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (mode === 'research' || mode === 'all') {
|
|
182
|
+
frameworkDirs.push({
|
|
183
|
+
id: 'research-complete',
|
|
184
|
+
subdirs: ['repo', 'corpus', 'working', 'archive']
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (frameworkDirs.length === 0) return;
|
|
190
|
+
|
|
191
|
+
if (dryRun) {
|
|
192
|
+
console.log('\n[dry-run] Would create framework-scoped workspace structure:');
|
|
193
|
+
console.log(`[dry-run] ${aiwgBase}/`);
|
|
194
|
+
console.log(`[dry-run] ${frameworksDir}/`);
|
|
195
|
+
console.log(`[dry-run] ${sharedDir}/`);
|
|
196
|
+
for (const fw of frameworkDirs) {
|
|
197
|
+
for (const subdir of fw.subdirs) {
|
|
198
|
+
console.log(`[dry-run] ${path.join(frameworksDir, fw.id, subdir)}/`);
|
|
199
|
+
}
|
|
200
|
+
for (const entry of fw.memoryCreates || []) {
|
|
201
|
+
if (entry && typeof entry.path === 'string') {
|
|
202
|
+
console.log(`[dry-run] ${path.join(aiwgBase, entry.path.slice('.aiwg/'.length))}${entry.path.endsWith('/') ? '/' : ''}`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
ensureDir(aiwgBase);
|
|
210
|
+
ensureDir(frameworksDir);
|
|
211
|
+
ensureDir(sharedDir);
|
|
212
|
+
|
|
213
|
+
for (const fw of frameworkDirs) {
|
|
214
|
+
const fwBase = path.join(frameworksDir, fw.id);
|
|
215
|
+
ensureDir(fwBase);
|
|
216
|
+
for (const subdir of fw.subdirs) {
|
|
217
|
+
ensureDir(path.join(fwBase, subdir));
|
|
218
|
+
}
|
|
219
|
+
initializeMemoryCreates(aiwgBase, fw.path, fw.memoryCreates);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Initialize registry.json if it doesn't exist
|
|
223
|
+
const registryPath = path.join(frameworksDir, 'registry.json');
|
|
224
|
+
if (!fs.existsSync(registryPath)) {
|
|
225
|
+
const registry = {
|
|
226
|
+
version: '1.0.0',
|
|
227
|
+
created: new Date().toISOString(),
|
|
228
|
+
frameworks: frameworkDirs.map(fw => ({
|
|
229
|
+
id: fw.id,
|
|
230
|
+
installed: new Date().toISOString(),
|
|
231
|
+
version: '1.0.0'
|
|
232
|
+
}))
|
|
233
|
+
};
|
|
234
|
+
fs.writeFileSync(registryPath, JSON.stringify(registry, null, 2), 'utf8');
|
|
235
|
+
console.log('Created framework registry at .aiwg/frameworks/registry.json');
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
export function initializeMemoryCreates(aiwgBase, frameworkPath, creates) {
|
|
242
|
+
for (const entry of creates || []) {
|
|
243
|
+
if (!entry || typeof entry.path !== 'string') continue;
|
|
244
|
+
if (!entry.path.startsWith('.aiwg/')) continue;
|
|
245
|
+
|
|
246
|
+
const targetPath = path.join(aiwgBase, entry.path.slice('.aiwg/'.length));
|
|
247
|
+
const isDirectory = entry.path.endsWith('/') || path.extname(entry.path) === '';
|
|
248
|
+
if (isDirectory) {
|
|
249
|
+
ensureDir(targetPath);
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
ensureDir(path.dirname(targetPath));
|
|
254
|
+
if (fs.existsSync(targetPath)) continue;
|
|
255
|
+
|
|
256
|
+
let content = null;
|
|
257
|
+
if (typeof entry.template === 'string' && frameworkPath) {
|
|
258
|
+
const templatePath = path.join(frameworkPath, entry.template);
|
|
259
|
+
if (fs.existsSync(templatePath)) {
|
|
260
|
+
content = fs.readFileSync(templatePath, 'utf8');
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (content === null) {
|
|
265
|
+
const title = path.basename(entry.path, path.extname(entry.path))
|
|
266
|
+
.replace(/[-_]+/g, ' ')
|
|
267
|
+
.replace(/\b\w/g, c => c.toUpperCase());
|
|
268
|
+
content = '# ' + title + '\n\n';
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
fs.writeFileSync(targetPath, content.endsWith('\n') ? content : content + '\n', 'utf8');
|
|
272
|
+
}
|
|
273
|
+
}
|