-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-cognitive-space.sh
More file actions
executable file
·52 lines (41 loc) · 1.28 KB
/
create-cognitive-space.sh
File metadata and controls
executable file
·52 lines (41 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# create-cognitive-space.sh
# Creates a new cognitive modeling space with optional name
# Usage: ./create-cognitive-space.sh [optional-name]
# Returns: Path to the created space.ts file
set -e
# Generate timestamp in the expected format
TIMESTAMP=$(date +%Y-%m-%dT%H-%M-%S-3NZ)
# Determine space ID
if [ -n "$1" ]; then
SPACE_ID="$1-$TIMESTAMP"
else
SPACE_ID="$TIMESTAMP"
fi
# Create space directory
SPACE_DIR="data/spaces/$SPACE_ID"
mkdir -p "$SPACE_DIR"
# Generate space.ts with proper boilerplate
cat > "$SPACE_DIR/space.ts" << 'EOF'
import { Space } from '../../../src/lib/thought-system';
const space = new Space(
'SPACE_ID_PLACEHOLDER',
'Cognitive Space',
'A space for persistent thought modeling'
);
// Example:
// space.thought('ConceptName')
// .means('What this concept represents')
// .hasValue('property', 0.8)
// .supports('OtherConcept', 'supports', 0.9);
//
// TIP: Run `npx tsc --noEmit space.ts` to check syntax before saving
// Always end with serialization for execution
if (require.main === module) {
console.log(JSON.stringify(space.serialize(), null, 2));
}
EOF
# Replace placeholder with actual space ID
sed -i '' "s/SPACE_ID_PLACEHOLDER/$SPACE_ID/g" "$SPACE_DIR/space.ts"
# Return the path to the created file
echo "$PWD/$SPACE_DIR/space.ts"