@hiiretail/gcp-infra-generators 1.11.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
const BaseGenerator = require('../../../src/BaseGenerator');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
|
|
5
|
+
const MARKETPLACE_KEY = 'hiiretail-toolkit@hiiretail-ai-marketplace';
|
|
6
|
+
|
|
7
|
+
function getToolkitEntry() {
|
|
8
|
+
const installedPluginsPath = path.join(
|
|
9
|
+
process.env.HOME,
|
|
10
|
+
'.claude',
|
|
11
|
+
'plugins',
|
|
12
|
+
'installed_plugins.json',
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
if (!fs.existsSync(installedPluginsPath)) return null;
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
const installed = JSON.parse(fs.readFileSync(installedPluginsPath, 'utf8'));
|
|
19
|
+
return installed?.plugins?.[MARKETPLACE_KEY]?.[0] || null;
|
|
20
|
+
} catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function readBootstrapFile(installPath, filename) {
|
|
26
|
+
const filePath = path.join(installPath, 'bootstrap', filename);
|
|
27
|
+
if (!fs.existsSync(filePath)) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
`Bootstrap file not found: ${filePath}\nTry reinstalling: /plugin install hiiretail-toolkit@hiiretail-ai-marketplace`,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return fs.readFileSync(filePath, 'utf8');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = class extends BaseGenerator {
|
|
36
|
+
initializing() {
|
|
37
|
+
this.toolkit = getToolkitEntry();
|
|
38
|
+
|
|
39
|
+
if (!this.toolkit) {
|
|
40
|
+
this.log('\n✗ hiiretail-toolkit is not installed in Claude Code.');
|
|
41
|
+
this.log('\n Install it by opening Claude Code and running:');
|
|
42
|
+
this.log(' /plugin marketplace add extenda/hiiretail-ai-marketplace');
|
|
43
|
+
this.log(
|
|
44
|
+
' /plugin install hiiretail-toolkit@hiiretail-ai-marketplace',
|
|
45
|
+
);
|
|
46
|
+
this.log('\n Then re-run: gcp-infra init claude-code\n');
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
writing() {
|
|
52
|
+
const { installPath, version } = this.toolkit;
|
|
53
|
+
const hookPath = installPath.replace(process.env.HOME, '~') + '/hooks';
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
// CLAUDE.md + AGENTS.md — sourced from toolkit bootstrap/, single source of truth
|
|
57
|
+
const claudeContent = `<!-- hiiretail-toolkit: ${version} -->\n${readBootstrapFile(installPath, 'CLAUDE.md')}`;
|
|
58
|
+
this.fs.write(this.destinationPath('CLAUDE.md'), claudeContent);
|
|
59
|
+
this.fs.write(this.destinationPath('AGENTS.md'), claudeContent);
|
|
60
|
+
|
|
61
|
+
// settings.json — sourced from toolkit bootstrap/, hook path substituted at init time
|
|
62
|
+
const settingsContent = readBootstrapFile(
|
|
63
|
+
installPath,
|
|
64
|
+
'settings-template.json',
|
|
65
|
+
).replaceAll('{{HOOK_PATH}}', hookPath);
|
|
66
|
+
this.fs.write(
|
|
67
|
+
this.destinationPath('.claude/settings.json'),
|
|
68
|
+
settingsContent,
|
|
69
|
+
);
|
|
70
|
+
} catch (err) {
|
|
71
|
+
this.log(`\n✗ ${err.message}\n`);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Pre-create .agent/ with empty placeholders so the skill overwrites rather than
|
|
76
|
+
// creates — overwriting does not trigger Claude Code's .claude/ protection.
|
|
77
|
+
const agentDir = this.destinationPath('.agent');
|
|
78
|
+
if (!fs.existsSync(agentDir)) {
|
|
79
|
+
fs.mkdirSync(agentDir, { recursive: true });
|
|
80
|
+
}
|
|
81
|
+
for (const file of ['Core.md', 'infrastructure.md', 'conventions.md']) {
|
|
82
|
+
const filePath = path.join(agentDir, file);
|
|
83
|
+
if (!fs.existsSync(filePath)) {
|
|
84
|
+
fs.writeFileSync(filePath, '');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
end() {
|
|
90
|
+
const { version } = this.toolkit;
|
|
91
|
+
this.log(
|
|
92
|
+
`\n✓ Claude Code orchestration files created (hiiretail-toolkit ${version}):`,
|
|
93
|
+
);
|
|
94
|
+
this.log(' CLAUDE.md (sourced from toolkit bootstrap/)');
|
|
95
|
+
this.log(' AGENTS.md (identical copy)');
|
|
96
|
+
this.log(' .claude/settings.json (sourced from toolkit bootstrap/)');
|
|
97
|
+
this.log(
|
|
98
|
+
' .agent/Core.md (placeholder — populated by /orchestrator-setup)',
|
|
99
|
+
);
|
|
100
|
+
this.log(
|
|
101
|
+
' .agent/infrastructure.md (placeholder — populated by /orchestrator-setup)',
|
|
102
|
+
);
|
|
103
|
+
this.log(
|
|
104
|
+
' .agent/conventions.md (placeholder — fill in coding standards)',
|
|
105
|
+
);
|
|
106
|
+
this.log(
|
|
107
|
+
'\nOpen Claude Code and run /orchestrator-setup to populate .agent/ from your clan infrastructure.',
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
@@ -11528,7 +11528,7 @@
|
|
|
11528
11528
|
},
|
|
11529
11529
|
"packages/generators": {
|
|
11530
11530
|
"name": "@hiiretail/gcp-infra-generators",
|
|
11531
|
-
"version": "1.
|
|
11531
|
+
"version": "1.12.0",
|
|
11532
11532
|
"license": "MIT",
|
|
11533
11533
|
"dependencies": {
|
|
11534
11534
|
"@google-cloud/storage": "^7.18.0",
|
package/dist/package.json
CHANGED