@assistkick/create 1.5.0 → 1.6.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/package.json
CHANGED
|
@@ -7,12 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
import { program } from 'commander';
|
|
9
9
|
import chalk from 'chalk';
|
|
10
|
-
import {
|
|
10
|
+
import { randomBytes } from 'node:crypto';
|
|
11
11
|
import { NODE_TYPES, VALID_FEATURE_KINDS } from '../lib/constants.js';
|
|
12
|
-
import { readGraph, patchNode } from '../lib/graph.js';
|
|
13
12
|
import { getDb } from '../lib/db.js';
|
|
14
13
|
import { nodes } from '../db/schema.js';
|
|
15
|
-
import {
|
|
14
|
+
import { deriveMetadata, templateSections } from '../lib/markdown.js';
|
|
16
15
|
import { assertValidType, assertUniqueName } from '../lib/validator.js';
|
|
17
16
|
|
|
18
17
|
program
|
|
@@ -36,15 +35,9 @@ const opts = program.opts();
|
|
|
36
35
|
throw new Error(`Invalid kind "${opts.kind}". Valid: ${VALID_FEATURE_KINDS.join(', ')}`);
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
// Generate
|
|
38
|
+
// Generate globally unique ID: prefix_hex (e.g. feat_a1b2c3d4)
|
|
40
39
|
const prefix = NODE_TYPES[opts.type];
|
|
41
|
-
const
|
|
42
|
-
const existing = graph.nodes.filter(n => n.type === opts.type);
|
|
43
|
-
const maxNum = existing.reduce((max, n) => {
|
|
44
|
-
const num = parseInt(n.id.split('_').pop(), 10);
|
|
45
|
-
return num > max ? num : max;
|
|
46
|
-
}, 0);
|
|
47
|
-
const id = `${prefix}_${String(maxNum + 1).padStart(3, '0')}`;
|
|
40
|
+
const id = `${prefix}_${randomBytes(4).toString('hex')}`;
|
|
48
41
|
|
|
49
42
|
// Build frontmatter and sections
|
|
50
43
|
const now = new Date().toISOString();
|