@polymorphism-tech/morph-spec 2.1.1 → 2.1.2
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/package.json +1 -1
- package/src/commands/init.js +60 -15
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -52,16 +52,18 @@ export async function initCommand(options) {
|
|
|
52
52
|
}
|
|
53
53
|
await copyFile(claudeMdPath, claudeMdDest);
|
|
54
54
|
|
|
55
|
-
// 2. Create .morph
|
|
56
|
-
spinner.text = 'Creating .morph
|
|
55
|
+
// 2. Create .morph directory structure
|
|
56
|
+
spinner.text = 'Creating .morph structure...';
|
|
57
57
|
const projectPath = join(morphPath, 'project');
|
|
58
|
+
const configDir = join(morphPath, 'config');
|
|
58
59
|
await ensureDir(join(projectPath, 'context'));
|
|
59
60
|
await ensureDir(join(projectPath, 'standards'));
|
|
60
61
|
await ensureDir(join(projectPath, 'outputs'));
|
|
62
|
+
await ensureDir(configDir);
|
|
61
63
|
|
|
62
64
|
// 3. Create config.json
|
|
63
65
|
spinner.text = 'Generating config.json...';
|
|
64
|
-
const configPath = join(
|
|
66
|
+
const configPath = join(configDir, 'config.json');
|
|
65
67
|
const dirName = targetPath.split(/[\\/]/).pop();
|
|
66
68
|
|
|
67
69
|
const config = {
|
|
@@ -99,12 +101,58 @@ Run \`morph-spec detect\` to analyze your project.
|
|
|
99
101
|
`;
|
|
100
102
|
await writeFile(contextReadme, readmeContent);
|
|
101
103
|
|
|
102
|
-
// 5.
|
|
104
|
+
// 5. Copy templates from content
|
|
105
|
+
spinner.text = 'Copying templates...';
|
|
106
|
+
const contentDir = getContentDir();
|
|
107
|
+
const templatesSrc = join(contentDir, '.morph', 'templates');
|
|
108
|
+
const templatesDest = join(morphPath, 'templates');
|
|
109
|
+
if (await pathExists(templatesSrc)) {
|
|
110
|
+
await copyDirectory(templatesSrc, templatesDest);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// 6. Copy standards from content
|
|
114
|
+
spinner.text = 'Copying standards...';
|
|
115
|
+
const standardsSrc = join(contentDir, '.morph', 'standards');
|
|
116
|
+
const standardsDest = join(morphPath, 'standards');
|
|
117
|
+
if (await pathExists(standardsSrc)) {
|
|
118
|
+
await copyDirectory(standardsSrc, standardsDest);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// 7. Copy agents.json
|
|
122
|
+
spinner.text = 'Copying agents configuration...';
|
|
123
|
+
const agentsSrc = join(contentDir, '.morph', 'config', 'agents.json');
|
|
124
|
+
const agentsDest = join(configDir, 'agents.json');
|
|
125
|
+
if (await pathExists(agentsSrc)) {
|
|
126
|
+
await copyFile(agentsSrc, agentsDest);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// 8. Copy azure-pricing files
|
|
130
|
+
spinner.text = 'Copying Azure pricing data...';
|
|
131
|
+
const pricingSrc = join(contentDir, '.morph', 'config', 'azure-pricing.json');
|
|
132
|
+
const pricingDest = join(configDir, 'azure-pricing.json');
|
|
133
|
+
if (await pathExists(pricingSrc)) {
|
|
134
|
+
await copyFile(pricingSrc, pricingDest);
|
|
135
|
+
}
|
|
136
|
+
const pricingSchemaSrc = join(contentDir, '.morph', 'config', 'azure-pricing.schema.json');
|
|
137
|
+
const pricingSchemaDest = join(configDir, 'azure-pricing.schema.json');
|
|
138
|
+
if (await pathExists(pricingSchemaSrc)) {
|
|
139
|
+
await copyFile(pricingSchemaSrc, pricingSchemaDest);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// 9. Copy .claude commands and skills
|
|
143
|
+
spinner.text = 'Copying Claude commands and skills...';
|
|
144
|
+
const claudeSrc = join(contentDir, '.claude');
|
|
145
|
+
const claudeDest = join(targetPath, '.claude');
|
|
146
|
+
if (await pathExists(claudeSrc)) {
|
|
147
|
+
await copyDirectory(claudeSrc, claudeDest);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// 10. Save version info
|
|
103
151
|
spinner.text = 'Saving version info...';
|
|
104
152
|
const cliVersion = getInstalledCLIVersion();
|
|
105
153
|
await saveProjectMorphVersion(targetPath, cliVersion);
|
|
106
154
|
|
|
107
|
-
//
|
|
155
|
+
// 11. Update .gitignore
|
|
108
156
|
spinner.text = 'Updating .gitignore...';
|
|
109
157
|
await updateGitignore(targetPath);
|
|
110
158
|
|
|
@@ -126,16 +174,13 @@ Run \`morph-spec detect\` to analyze your project.
|
|
|
126
174
|
]);
|
|
127
175
|
logger.blank();
|
|
128
176
|
|
|
129
|
-
logger.info('
|
|
130
|
-
logger.dim(`
|
|
131
|
-
logger.dim(
|
|
132
|
-
logger.dim(
|
|
133
|
-
logger.dim(
|
|
134
|
-
logger.dim(
|
|
135
|
-
logger.
|
|
136
|
-
|
|
137
|
-
logger.info('Content (via npm package):');
|
|
138
|
-
logger.dim(`Templates and standards available via morph-spec update`);
|
|
177
|
+
logger.info('Files installed:');
|
|
178
|
+
logger.dim(` ✓ CLAUDE.md`);
|
|
179
|
+
logger.dim(` ✓ .morph/config/ (config.json, agents.json, azure-pricing.json)`);
|
|
180
|
+
logger.dim(` ✓ .morph/standards/ (coding.md, architecture.md, azure.md, ...)`);
|
|
181
|
+
logger.dim(` ✓ .morph/templates/ (Bicep, integrations, saas, ...)`);
|
|
182
|
+
logger.dim(` ✓ .morph/project/ (context, standards, outputs)`);
|
|
183
|
+
logger.dim(` ✓ .claude/ (commands, skills)`);
|
|
139
184
|
logger.blank();
|
|
140
185
|
|
|
141
186
|
} catch (error) {
|