documenso/scripts/utils/generate-id.ts
Lucas Smith 34f512bd55
docs: add OpenCode AI-assisted development guide (#2384)
Adds OpenCode support for AI-assisted development, including custom
commands and skills to help contributors maintain consistency and
streamline common workflows.

#### Changes
- Added "AI-Assisted Development with OpenCode" section to
CONTRIBUTING.md with:
  - Installation instructions and provider configuration
- Documentation for 8 custom commands (/implement, /continue,
/interview, /document, /commit, /create-plan, /create-scratch,
/create-justification)
  - Typical workflow guide
- Clear policy that AI-generated code must be reviewed before submission
- Added .agents/ directory for plans, scratches, and justifications
- Added .opencode/ commands and skills for the agent
- Added helper scripts for creating agent files
2026-01-14 10:10:20 +11:00

84 lines
1.4 KiB
TypeScript

/**
* Generates a unique identifier using three simple words.
* Falls back to unix timestamp if word generation fails.
*/
export const generateId = (): string => {
const adjectives = [
'happy',
'bright',
'swift',
'calm',
'bold',
'clever',
'gentle',
'quick',
'sharp',
'warm',
'cool',
'fresh',
'solid',
'clear',
'sweet',
'wild',
'quiet',
'loud',
'smooth',
];
const nouns = [
'moon',
'star',
'ocean',
'river',
'forest',
'mountain',
'cloud',
'wave',
'stone',
'flower',
'bird',
'wind',
'light',
'shadow',
'fire',
'earth',
'sky',
'tree',
'leaf',
'rock',
];
const colors = [
'blue',
'red',
'green',
'yellow',
'purple',
'orange',
'pink',
'cyan',
'amber',
'emerald',
'violet',
'indigo',
'coral',
'teal',
'gold',
'silver',
'copper',
'bronze',
'ivory',
'jade',
];
try {
const randomAdjective = adjectives[Math.floor(Math.random() * adjectives.length)];
const randomColor = colors[Math.floor(Math.random() * colors.length)];
const randomNoun = nouns[Math.floor(Math.random() * nouns.length)];
return `${randomAdjective}-${randomColor}-${randomNoun}`;
} catch {
// Fallback to unix timestamp if something goes wrong
return Date.now().toString();
}
};