@haposoft/cafekit 0.9.7 → 0.10.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.
- package/bin/install.js +93 -1254
- package/bin/lib/backup.js +111 -0
- package/bin/lib/context.js +273 -0
- package/bin/lib/lock.js +86 -0
- package/bin/lib/managed-writer.js +167 -0
- package/bin/lib/manifest.js +182 -0
- package/bin/lib/ui.js +108 -0
- package/bin/phases/claude-runtime.js +132 -0
- package/bin/phases/claude-settings.js +130 -0
- package/bin/phases/copy-payload.js +220 -0
- package/bin/phases/opencode-runtime.js +38 -0
- package/bin/phases/post-install.js +141 -0
- package/bin/phases/report.js +66 -0
- package/bin/phases/root-config.js +49 -0
- package/bin/phases/select-platform.js +94 -0
- package/bin/phases/summary.js +54 -0
- package/bin/phases/write-metadata.js +60 -0
- package/package.json +5 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase: write platform version metadata + install manifest.
|
|
3
|
+
*
|
|
4
|
+
* cafekit.json keeps pure version metadata (schemaVersion, version, platform,
|
|
5
|
+
* timestamps, previousVersion). The ownership baseline is written separately by
|
|
6
|
+
* the run's manifest tracker. Both are skipped in dry-run.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const { PLATFORMS, INSTALL_COMMAND, packageJson } = require('../lib/context');
|
|
12
|
+
const { readJsonFile } = require('../lib/copy-utils');
|
|
13
|
+
|
|
14
|
+
function writePlatformVersionMetadata(ctx, platformKey) {
|
|
15
|
+
const platform = PLATFORMS[platformKey];
|
|
16
|
+
const targetPath = path.join(platform.folder, 'cafekit.json');
|
|
17
|
+
const targetExists = fs.existsSync(targetPath);
|
|
18
|
+
const existingMetadata = readJsonFile(targetPath);
|
|
19
|
+
const now = new Date().toISOString();
|
|
20
|
+
const previousVersion = typeof existingMetadata.version === 'string'
|
|
21
|
+
? existingMetadata.version
|
|
22
|
+
: null;
|
|
23
|
+
|
|
24
|
+
const metadata = {
|
|
25
|
+
schemaVersion: 1,
|
|
26
|
+
packageName: packageJson.name,
|
|
27
|
+
version: packageJson.version,
|
|
28
|
+
platform: platform.id,
|
|
29
|
+
platformName: platform.name,
|
|
30
|
+
installedAt: existingMetadata.installedAt || now,
|
|
31
|
+
lastInstalledAt: now,
|
|
32
|
+
installCommand: INSTALL_COMMAND
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
if (previousVersion && previousVersion !== packageJson.version) {
|
|
36
|
+
metadata.previousVersion = previousVersion;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (!ctx.dryRun) {
|
|
40
|
+
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
41
|
+
fs.writeFileSync(targetPath, `${JSON.stringify(metadata, null, 2)}\n`, 'utf8');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const prefix = ctx.dryRun ? '[dry-run] ' : '';
|
|
45
|
+
if (targetExists) {
|
|
46
|
+
ctx.ui.detail(` ↻ ${prefix}Version metadata updated: ${targetPath}`);
|
|
47
|
+
ctx.results.updated++;
|
|
48
|
+
} else {
|
|
49
|
+
ctx.ui.detail(` ✓ ${prefix}Version metadata installed: ${targetPath}`);
|
|
50
|
+
ctx.results.copied++;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Persist the ownership baseline of everything installed this run.
|
|
54
|
+
const tracker = ctx.trackers[platformKey];
|
|
55
|
+
if (tracker && !ctx.dryRun) {
|
|
56
|
+
tracker.write();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
module.exports = { writePlatformVersionMetadata };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haposoft/cafekit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Claude Code-first spec-driven workflow for AI coding assistants. Bundles CafeKit hapo: skills, runtime hooks, agents, and installer scaffolding.",
|
|
5
5
|
"author": "Haposoft <nghialt@haposoft.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,5 +46,9 @@
|
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@opencode-ai/plugin": "1.15.11"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@clack/prompts": "^1.5.0",
|
|
52
|
+
"picocolors": "^1.1.1"
|
|
49
53
|
}
|
|
50
54
|
}
|