@a-company/paradigm 1.5.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/README.md +142 -0
- package/dist/accept-orchestration-CWZNCGZX.js +188 -0
- package/dist/agents-suggest-35LIQKDH.js +83 -0
- package/dist/aggregate-W7Q6VIM2.js +88 -0
- package/dist/auto-IU7VN55K.js +470 -0
- package/dist/beacon-B47XSTL7.js +251 -0
- package/dist/chunk-2M6OSOIG.js +1302 -0
- package/dist/chunk-4NCFWYGG.js +110 -0
- package/dist/chunk-5C4SGQKH.js +705 -0
- package/dist/chunk-5GOA7WYD.js +1095 -0
- package/dist/chunk-5JGJACDU.js +37 -0
- package/dist/chunk-6QC3YGB6.js +114 -0
- package/dist/chunk-753RICFF.js +325 -0
- package/dist/chunk-AD2LSCHB.js +1595 -0
- package/dist/chunk-CHSHON3O.js +669 -0
- package/dist/chunk-ELLR7WP6.js +3175 -0
- package/dist/chunk-ILOWBJRC.js +12 -0
- package/dist/chunk-IRKUEJVW.js +405 -0
- package/dist/chunk-MC7XC7XQ.js +533 -0
- package/dist/chunk-MO4EEYFW.js +38 -0
- package/dist/chunk-MQWH7PFI.js +13366 -0
- package/dist/chunk-N6PJAPDE.js +364 -0
- package/dist/chunk-PBHIFAL4.js +259 -0
- package/dist/chunk-PMXRGPRQ.js +305 -0
- package/dist/chunk-PW2EXJQT.js +689 -0
- package/dist/chunk-TAP5N3HH.js +245 -0
- package/dist/chunk-THFVK5AE.js +148 -0
- package/dist/chunk-UM54F7G5.js +1533 -0
- package/dist/chunk-UUZ2DMG5.js +185 -0
- package/dist/chunk-WS5KM7OL.js +780 -0
- package/dist/chunk-YDNKXH4Z.js +2316 -0
- package/dist/chunk-YO6DVTL7.js +99 -0
- package/dist/claude-SUYNN72C.js +362 -0
- package/dist/claude-cli-OF43XAO3.js +276 -0
- package/dist/claude-code-PW6SKD2M.js +126 -0
- package/dist/claude-code-teams-JLZ5IXB6.js +199 -0
- package/dist/constellation-K3CIQCHI.js +225 -0
- package/dist/cost-AEK6R7HK.js +174 -0
- package/dist/cost-KYXIQ62X.js +93 -0
- package/dist/cursor-cli-IHJMPRCW.js +269 -0
- package/dist/cursorrules-KI5QWHIX.js +84 -0
- package/dist/diff-AJJ5H6HV.js +125 -0
- package/dist/dist-7MPIRMTZ-IOQOREMZ.js +10866 -0
- package/dist/dist-NHJQVVUW.js +68 -0
- package/dist/dist-ZEMSQV74.js +20 -0
- package/dist/doctor-6Y6L6HEB.js +11 -0
- package/dist/echo-VYZW3OTT.js +248 -0
- package/dist/export-R4FJ5NOH.js +38 -0
- package/dist/history-EVO3L6SC.js +277 -0
- package/dist/hooks-MBWE4ILT.js +12 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +568 -0
- package/dist/lint-HXKTWRNO.js +316 -0
- package/dist/manual-Y3QOXWYA.js +204 -0
- package/dist/mcp.js +14745 -0
- package/dist/orchestrate-4ZH5GUQH.js +323 -0
- package/dist/probe-OYCP4JYG.js +151 -0
- package/dist/promote-Z52ZJTJU.js +181 -0
- package/dist/providers-4PGPZEWP.js +104 -0
- package/dist/remember-6VZ74B7E.js +77 -0
- package/dist/ripple-SBQOSTZD.js +215 -0
- package/dist/sentinel-LCFD56OJ.js +43 -0
- package/dist/server-F5ITNK6T.js +9846 -0
- package/dist/server-T6WIFYRQ.js +16076 -0
- package/dist/setup-DF4F3ICN.js +25 -0
- package/dist/setup-JHBPZAG7.js +296 -0
- package/dist/shift-HKIAP4ZN.js +226 -0
- package/dist/snapshot-GTVPRYZG.js +62 -0
- package/dist/spawn-BJRQA2NR.js +196 -0
- package/dist/summary-H6J6N6PJ.js +140 -0
- package/dist/switch-6EANJ7O6.js +232 -0
- package/dist/sync-BEOCW7TZ.js +11 -0
- package/dist/team-NWP2KJAB.js +32 -0
- package/dist/test-MA5TWJQV.js +934 -0
- package/dist/thread-JCJVRUQR.js +258 -0
- package/dist/triage-ETVXXFMV.js +1880 -0
- package/dist/tutorial-L5Q3ZDHK.js +666 -0
- package/dist/university-R2WDQLSI.js +40 -0
- package/dist/upgrade-5B3YGGC6.js +550 -0
- package/dist/validate-F3YHBCRZ.js +39 -0
- package/dist/validate-QEEY6KFS.js +64 -0
- package/dist/watch-4LT4O6K7.js +123 -0
- package/dist/watch-6IIWPWDN.js +111 -0
- package/dist/wisdom-LRM4FFCH.js +319 -0
- package/package.json +68 -0
- package/templates/paradigm/config.yaml +175 -0
- package/templates/paradigm/docs/commands.md +727 -0
- package/templates/paradigm/docs/decisions/000-template.md +47 -0
- package/templates/paradigm/docs/decisions/README.md +26 -0
- package/templates/paradigm/docs/error-patterns.md +215 -0
- package/templates/paradigm/docs/patterns.md +358 -0
- package/templates/paradigm/docs/queries.md +200 -0
- package/templates/paradigm/docs/troubleshooting.md +477 -0
- package/templates/paradigm/echoes.yaml +25 -0
- package/templates/paradigm/prompts/add-feature.md +152 -0
- package/templates/paradigm/prompts/add-gate.md +117 -0
- package/templates/paradigm/prompts/debug-auth.md +174 -0
- package/templates/paradigm/prompts/implement-ftux.md +722 -0
- package/templates/paradigm/prompts/implement-sandbox.md +651 -0
- package/templates/paradigm/prompts/read-docs.md +84 -0
- package/templates/paradigm/prompts/refactor.md +106 -0
- package/templates/paradigm/prompts/run-e2e-tests.md +340 -0
- package/templates/paradigm/prompts/trace-flow.md +202 -0
- package/templates/paradigm/prompts/validate-portals.md +279 -0
- package/templates/paradigm/specs/context-tracking.md +200 -0
- package/templates/paradigm/specs/context.md +461 -0
- package/templates/paradigm/specs/disciplines.md +413 -0
- package/templates/paradigm/specs/history.md +339 -0
- package/templates/paradigm/specs/logger.md +303 -0
- package/templates/paradigm/specs/navigator.md +236 -0
- package/templates/paradigm/specs/purpose.md +265 -0
- package/templates/paradigm/specs/scan.md +177 -0
- package/templates/paradigm/specs/symbols.md +451 -0
- package/templates/paradigm/specs/wisdom.md +294 -0
|
@@ -0,0 +1,666 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "./chunk-MO4EEYFW.js";
|
|
3
|
+
|
|
4
|
+
// src/commands/tutorial/index.ts
|
|
5
|
+
import * as path from "path";
|
|
6
|
+
import * as fs from "fs";
|
|
7
|
+
import * as yaml from "js-yaml";
|
|
8
|
+
import chalk from "chalk";
|
|
9
|
+
import { execSync } from "child_process";
|
|
10
|
+
var TUTORIAL_STATE_FILE = ".paradigm/tutorial/state.json";
|
|
11
|
+
var CURRICULUM_FILE = ".paradigm/tutorial/curriculum.yaml";
|
|
12
|
+
function loadState(rootDir) {
|
|
13
|
+
const statePath = path.join(rootDir, TUTORIAL_STATE_FILE);
|
|
14
|
+
if (fs.existsSync(statePath)) {
|
|
15
|
+
try {
|
|
16
|
+
return JSON.parse(fs.readFileSync(statePath, "utf8"));
|
|
17
|
+
} catch {
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
currentStep: null,
|
|
22
|
+
completedSteps: [],
|
|
23
|
+
fixedBugs: []
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function saveState(rootDir, state) {
|
|
27
|
+
const statePath = path.join(rootDir, TUTORIAL_STATE_FILE);
|
|
28
|
+
const stateDir = path.dirname(statePath);
|
|
29
|
+
if (!fs.existsSync(stateDir)) {
|
|
30
|
+
fs.mkdirSync(stateDir, { recursive: true });
|
|
31
|
+
}
|
|
32
|
+
fs.writeFileSync(statePath, JSON.stringify(state, null, 2), "utf8");
|
|
33
|
+
}
|
|
34
|
+
function generateDefaultCurriculum(rootDir) {
|
|
35
|
+
const tutorialDir = path.join(rootDir, ".paradigm/tutorial");
|
|
36
|
+
if (!fs.existsSync(tutorialDir)) {
|
|
37
|
+
fs.mkdirSync(tutorialDir, { recursive: true });
|
|
38
|
+
}
|
|
39
|
+
const curriculum = {
|
|
40
|
+
title: "Paradigm Tutorial - ShopFlow Example",
|
|
41
|
+
description: "Learn Paradigm by exploring the ShopFlow e-commerce example",
|
|
42
|
+
steps: [
|
|
43
|
+
{
|
|
44
|
+
id: "step-1-explore-structure",
|
|
45
|
+
title: "Explore Project Structure",
|
|
46
|
+
description: "Understand how Paradigm organizes project knowledge",
|
|
47
|
+
file: "step-1-explore-structure.md",
|
|
48
|
+
checkpoints: [
|
|
49
|
+
{
|
|
50
|
+
type: "file-exists",
|
|
51
|
+
path: ".purpose"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: "file-exists",
|
|
55
|
+
path: "portal.yaml"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: "file-exists",
|
|
59
|
+
path: ".paradigm/config.yaml"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "step-2-understand-purpose",
|
|
65
|
+
title: "Understanding Purpose Files",
|
|
66
|
+
description: "Learn how Purpose files define features and components",
|
|
67
|
+
file: "step-2-understand-purpose.md",
|
|
68
|
+
checkpoints: [
|
|
69
|
+
{
|
|
70
|
+
type: "file-exists",
|
|
71
|
+
path: ".purpose"
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "step-3-understand-gates",
|
|
77
|
+
title: "Understanding Gates",
|
|
78
|
+
description: "Learn how Gates define authorization and access control",
|
|
79
|
+
file: "step-3-understand-gates.md",
|
|
80
|
+
checkpoints: [
|
|
81
|
+
{
|
|
82
|
+
type: "file-exists",
|
|
83
|
+
path: "portal.yaml"
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: "step-4-explore-symbols",
|
|
89
|
+
title: "Exploring Symbols",
|
|
90
|
+
description: "Understand Paradigm's symbol system and how they connect",
|
|
91
|
+
file: "step-4-explore-symbols.md",
|
|
92
|
+
checkpoints: [
|
|
93
|
+
{
|
|
94
|
+
type: "command-success",
|
|
95
|
+
command: "paradigm status"
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "step-5-visualize",
|
|
101
|
+
title: "Visualize in Dreamscape",
|
|
102
|
+
description: "See your project knowledge visualized in the Dreamscape",
|
|
103
|
+
file: "step-5-visualize.md",
|
|
104
|
+
checkpoints: [
|
|
105
|
+
{
|
|
106
|
+
type: "command-success",
|
|
107
|
+
command: "paradigm dream aggregate"
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
bugs: []
|
|
113
|
+
};
|
|
114
|
+
const curriculumPath = path.join(tutorialDir, "curriculum.yaml");
|
|
115
|
+
fs.writeFileSync(curriculumPath, yaml.dump(curriculum), "utf8");
|
|
116
|
+
const stepFiles = [
|
|
117
|
+
{
|
|
118
|
+
file: "step-1-explore-structure.md",
|
|
119
|
+
content: `# Step 1: Explore Project Structure
|
|
120
|
+
|
|
121
|
+
Welcome to the Paradigm tutorial! In this step, you'll explore how Paradigm organizes project knowledge.
|
|
122
|
+
|
|
123
|
+
## What You'll Learn
|
|
124
|
+
|
|
125
|
+
- How Paradigm uses files to structure project knowledge
|
|
126
|
+
- The purpose of different Paradigm files
|
|
127
|
+
- How to navigate a Paradigm project
|
|
128
|
+
|
|
129
|
+
## Tasks
|
|
130
|
+
|
|
131
|
+
1. **Examine the root .purpose file**
|
|
132
|
+
- Open \`.purpose\` in the root directory
|
|
133
|
+
- Notice how it defines features (\`@\`) and components (\`#\`)
|
|
134
|
+
- See how features reference components and gates
|
|
135
|
+
|
|
136
|
+
2. **Check the portal.yaml file**
|
|
137
|
+
- Open \`portal.yaml\`
|
|
138
|
+
- Notice how gates (\`^\`) define authorization rules
|
|
139
|
+
- See how gates have locks, keys, and prizes
|
|
140
|
+
|
|
141
|
+
3. **Explore .paradigm directory**
|
|
142
|
+
- Look at \`.paradigm/config.yaml\` - this is the Paradigm configuration
|
|
143
|
+
- Check \`.paradigm/specs/\` - these define the symbol system
|
|
144
|
+
- Browse \`.paradigm/docs/\` - reference documentation
|
|
145
|
+
|
|
146
|
+
4. **Notice the nested structure**
|
|
147
|
+
- Check \`auth/.purpose\`, \`payments/.purpose\`, etc.
|
|
148
|
+
- See how Purpose files can be organized by domain
|
|
149
|
+
|
|
150
|
+
## Checkpoint
|
|
151
|
+
|
|
152
|
+
When you're ready, run:
|
|
153
|
+
\`\`\`bash
|
|
154
|
+
paradigm tutorial checkpoint
|
|
155
|
+
\`\`\`
|
|
156
|
+
|
|
157
|
+
This will verify you've explored the key files.
|
|
158
|
+
`
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
file: "step-2-understand-purpose.md",
|
|
162
|
+
content: `# Step 2: Understanding Purpose Files
|
|
163
|
+
|
|
164
|
+
Purpose files are the foundation of Paradigm. They define what your project does and how it's structured.
|
|
165
|
+
|
|
166
|
+
## What You'll Learn
|
|
167
|
+
|
|
168
|
+
- How Purpose files define features (\`@\`) and components (\`#\`)
|
|
169
|
+
- How to read and understand Purpose file syntax
|
|
170
|
+
- How features reference other symbols
|
|
171
|
+
|
|
172
|
+
## Tasks
|
|
173
|
+
|
|
174
|
+
1. **Read the root .purpose file**
|
|
175
|
+
- Open \`.purpose\` and read through it
|
|
176
|
+
- Identify all features (lines starting with \`- id: "@\`)
|
|
177
|
+
- Identify all components (lines starting with \`- id: "#\`)
|
|
178
|
+
|
|
179
|
+
2. **Understand feature definitions**
|
|
180
|
+
- Look at \`@product-browse\` - what components does it use?
|
|
181
|
+
- Look at \`@checkout-flow\` - what gates does it require?
|
|
182
|
+
- Notice how features reference other features
|
|
183
|
+
|
|
184
|
+
3. **Explore nested Purpose files**
|
|
185
|
+
- Open \`auth/.purpose\` - what features are defined here?
|
|
186
|
+
- Open \`payments/.purpose\` - how does it relate to checkout?
|
|
187
|
+
- See how domain-specific Purpose files organize knowledge
|
|
188
|
+
|
|
189
|
+
4. **Trace a feature**
|
|
190
|
+
- Pick a feature like \`@checkout-flow\`
|
|
191
|
+
- Follow its references to see what it depends on
|
|
192
|
+
- Understand the relationships between features, components, and gates
|
|
193
|
+
|
|
194
|
+
## Key Concepts
|
|
195
|
+
|
|
196
|
+
- **Features (\`@\`)** - User-facing capabilities
|
|
197
|
+
- **Components (\`#\`)** - Reusable code units
|
|
198
|
+
- **References** - How features connect to components and gates
|
|
199
|
+
|
|
200
|
+
## Checkpoint
|
|
201
|
+
|
|
202
|
+
Run:
|
|
203
|
+
\`\`\`bash
|
|
204
|
+
paradigm tutorial checkpoint
|
|
205
|
+
\`\`\`
|
|
206
|
+
`
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
file: "step-3-understand-gates.md",
|
|
210
|
+
content: `# Step 3: Understanding Gates
|
|
211
|
+
|
|
212
|
+
Gates define authorization and access control in Paradigm. They're like security checkpoints.
|
|
213
|
+
|
|
214
|
+
## What You'll Learn
|
|
215
|
+
|
|
216
|
+
- How gates (\`^\`) define access control
|
|
217
|
+
- The structure of locks, keys, and prizes
|
|
218
|
+
- How gates protect features
|
|
219
|
+
|
|
220
|
+
## Tasks
|
|
221
|
+
|
|
222
|
+
1. **Examine portal.yaml**
|
|
223
|
+
- Open \`portal.yaml\` and read through it
|
|
224
|
+
- Notice the structure: gates \u2192 locks \u2192 keys
|
|
225
|
+
- See how prizes are awarded when gates pass
|
|
226
|
+
|
|
227
|
+
2. **Understand a simple gate**
|
|
228
|
+
- Look at \`^auth-required\`
|
|
229
|
+
- What lock does it have?
|
|
230
|
+
- What key expression checks authentication?
|
|
231
|
+
- What prize is awarded?
|
|
232
|
+
|
|
233
|
+
3. **Explore a complex gate**
|
|
234
|
+
- Look at \`^admin-panel\`
|
|
235
|
+
- How many locks does it have?
|
|
236
|
+
- What conditions must be met?
|
|
237
|
+
- What prizes are available?
|
|
238
|
+
|
|
239
|
+
4. **See gates in action**
|
|
240
|
+
- Go back to \`.purpose\` files
|
|
241
|
+
- Find features that reference gates (like \`^auth-required\`)
|
|
242
|
+
- Understand how gates protect features
|
|
243
|
+
|
|
244
|
+
## Key Concepts
|
|
245
|
+
|
|
246
|
+
- **Gates (\`^\`)** - Access control points
|
|
247
|
+
- **Locks** - Conditions that must be met
|
|
248
|
+
- **Keys** - Expressions that unlock locks
|
|
249
|
+
- **Prizes** - Rewards when gates pass
|
|
250
|
+
|
|
251
|
+
## Checkpoint
|
|
252
|
+
|
|
253
|
+
Run:
|
|
254
|
+
\`\`\`bash
|
|
255
|
+
paradigm tutorial checkpoint
|
|
256
|
+
\`\`\`
|
|
257
|
+
`
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
file: "step-4-explore-symbols.md",
|
|
261
|
+
content: `# Step 4: Exploring Symbols
|
|
262
|
+
|
|
263
|
+
Paradigm uses a symbol system to create a shared language between code, developers, and AI.
|
|
264
|
+
|
|
265
|
+
## What You'll Learn
|
|
266
|
+
|
|
267
|
+
- All the symbol types in Paradigm
|
|
268
|
+
- Concatenated symbols (compound ideas like \`?@\`, \`?#\`, \`?!\`)
|
|
269
|
+
- How symbols reference each other
|
|
270
|
+
- How to use paradigm commands to explore symbols
|
|
271
|
+
|
|
272
|
+
## Tasks
|
|
273
|
+
|
|
274
|
+
1. **Run paradigm status**
|
|
275
|
+
\`\`\`bash
|
|
276
|
+
paradigm status
|
|
277
|
+
\`\`\`
|
|
278
|
+
- See how many features, components, gates, etc. are defined
|
|
279
|
+
- Notice the symbol counts
|
|
280
|
+
|
|
281
|
+
2. **Understand symbol types**
|
|
282
|
+
- \`@\` - Features (user-facing capabilities)
|
|
283
|
+
- \`#\` - Components (reusable code units)
|
|
284
|
+
- \`$\` - Flows (multi-step processes)
|
|
285
|
+
- \`%\` - State (global/user state)
|
|
286
|
+
- \`~\` - Deprecated (marked for removal)
|
|
287
|
+
- \`^\` - Gates (access control)
|
|
288
|
+
- \`!\` - Signals (events/errors)
|
|
289
|
+
- \`?\` - Ideas (exploration)
|
|
290
|
+
|
|
291
|
+
3. **Understand concatenated symbols (compound ideas)**
|
|
292
|
+
Ideas can specify what type of symbol they're exploring by using a compound prefix:
|
|
293
|
+
- \`?@subscription-model\` - Idea for a feature
|
|
294
|
+
- \`?#dark-mode-toggle\` - Idea for a component
|
|
295
|
+
- \`?$express-checkout\` - Idea for a flow
|
|
296
|
+
- \`?%user-preferences\` - Idea for state
|
|
297
|
+
- \`?~old-api-removal\` - Idea for deprecation
|
|
298
|
+
- \`?^premium-access\` - Idea for a gate
|
|
299
|
+
- \`?!payment-webhook\` - Idea for a signal
|
|
300
|
+
|
|
301
|
+
**Why use compound ideas?**
|
|
302
|
+
- **Categorization**: Makes it clear what type of symbol the idea relates to
|
|
303
|
+
- **Discoverability**: In the Dreamscape visualizer, compound ideas connect to their target symbol type
|
|
304
|
+
- **Planning**: Helps organize ideas by what they would become if implemented
|
|
305
|
+
|
|
306
|
+
**Simple vs Compound:**
|
|
307
|
+
- \`?subscription-model\` - General idea, no specific type
|
|
308
|
+
- \`?@subscription-model\` - Idea specifically for a feature
|
|
309
|
+
|
|
310
|
+
4. **Trace symbol relationships**
|
|
311
|
+
- Pick a feature like \`@checkout-flow\`
|
|
312
|
+
- See what gates it requires
|
|
313
|
+
- See what components it uses
|
|
314
|
+
- See what flows it's part of
|
|
315
|
+
- Look for compound ideas in \`.premise\` files
|
|
316
|
+
|
|
317
|
+
5. **Explore with paradigm commands**
|
|
318
|
+
\`\`\`bash
|
|
319
|
+
paradigm purpose validate
|
|
320
|
+
paradigm gate validate
|
|
321
|
+
\`\`\`
|
|
322
|
+
- Validate your Purpose files
|
|
323
|
+
- Validate your gate configuration
|
|
324
|
+
|
|
325
|
+
## Key Concepts
|
|
326
|
+
|
|
327
|
+
- Symbols create a traceable web of relationships
|
|
328
|
+
- Compound ideas (\`?@\`, \`?#\`, etc.) categorize ideas by their target symbol type
|
|
329
|
+
- In the Dreamscape visualizer, compound ideas visually connect to their symbol type
|
|
330
|
+
- AI agents can follow these relationships
|
|
331
|
+
- Symbols make project knowledge discoverable
|
|
332
|
+
|
|
333
|
+
## Checkpoint
|
|
334
|
+
|
|
335
|
+
Run:
|
|
336
|
+
\`\`\`bash
|
|
337
|
+
paradigm tutorial checkpoint
|
|
338
|
+
\`\`\`
|
|
339
|
+
`
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
file: "step-5-visualize.md",
|
|
343
|
+
content: `# Step 5: Visualize in Dreamscape
|
|
344
|
+
|
|
345
|
+
The Dreamscape is Paradigm's infinite canvas where all project knowledge flows together.
|
|
346
|
+
|
|
347
|
+
## What You'll Learn
|
|
348
|
+
|
|
349
|
+
- How to aggregate all symbols into the Dreamscape
|
|
350
|
+
- How to visualize your project knowledge
|
|
351
|
+
- How to explore relationships visually
|
|
352
|
+
|
|
353
|
+
## Tasks
|
|
354
|
+
|
|
355
|
+
1. **Aggregate symbols**
|
|
356
|
+
\`\`\`bash
|
|
357
|
+
paradigm dream aggregate
|
|
358
|
+
\`\`\`
|
|
359
|
+
- This combines all Purpose and Gate files
|
|
360
|
+
- Creates a unified symbol index
|
|
361
|
+
- Prepares data for visualization
|
|
362
|
+
|
|
363
|
+
2. **Open the Dreamscape**
|
|
364
|
+
\`\`\`bash
|
|
365
|
+
paradigm visualize
|
|
366
|
+
\`\`\`
|
|
367
|
+
- This opens the visualizer in your browser
|
|
368
|
+
- You'll see all your symbols as nodes
|
|
369
|
+
- Connections show relationships
|
|
370
|
+
|
|
371
|
+
3. **Explore visually**
|
|
372
|
+
- Click on features to see their connections
|
|
373
|
+
- See how gates protect features
|
|
374
|
+
- Understand the flow of information
|
|
375
|
+
- Notice how everything connects
|
|
376
|
+
|
|
377
|
+
4. **Understand the big picture**
|
|
378
|
+
- See how ShopFlow is structured
|
|
379
|
+
- Understand feature dependencies
|
|
380
|
+
- Visualize authorization topology
|
|
381
|
+
|
|
382
|
+
## Key Concepts
|
|
383
|
+
|
|
384
|
+
- The Dreamscape shows everything at once
|
|
385
|
+
- Visual exploration helps understand relationships
|
|
386
|
+
- Symbols become nodes, references become connections
|
|
387
|
+
|
|
388
|
+
## Checkpoint
|
|
389
|
+
|
|
390
|
+
Run:
|
|
391
|
+
\`\`\`bash
|
|
392
|
+
paradigm tutorial checkpoint
|
|
393
|
+
\`\`\`
|
|
394
|
+
|
|
395
|
+
## Next Steps
|
|
396
|
+
|
|
397
|
+
Congratulations! You've completed the tutorial. You now understand:
|
|
398
|
+
- How Paradigm structures project knowledge
|
|
399
|
+
- How Purpose files define features and components
|
|
400
|
+
- How Gates define authorization
|
|
401
|
+
- How symbols create relationships
|
|
402
|
+
- How to visualize everything in the Dreamscape
|
|
403
|
+
|
|
404
|
+
Continue exploring ShopFlow, or start using Paradigm in your own projects!
|
|
405
|
+
`
|
|
406
|
+
}
|
|
407
|
+
];
|
|
408
|
+
for (const stepFile of stepFiles) {
|
|
409
|
+
const stepPath = path.join(tutorialDir, stepFile.file);
|
|
410
|
+
fs.writeFileSync(stepPath, stepFile.content, "utf8");
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
function loadCurriculum(rootDir) {
|
|
414
|
+
const curriculumPath = path.join(rootDir, CURRICULUM_FILE);
|
|
415
|
+
if (!fs.existsSync(curriculumPath)) {
|
|
416
|
+
generateDefaultCurriculum(rootDir);
|
|
417
|
+
}
|
|
418
|
+
return yaml.load(fs.readFileSync(curriculumPath, "utf8"));
|
|
419
|
+
}
|
|
420
|
+
async function validateCheckpoint(rootDir, stepId, curriculum) {
|
|
421
|
+
const step = curriculum.steps.find((s) => s.id === stepId);
|
|
422
|
+
if (!step) {
|
|
423
|
+
return false;
|
|
424
|
+
}
|
|
425
|
+
for (const checkpoint of step.checkpoints || []) {
|
|
426
|
+
switch (checkpoint.type) {
|
|
427
|
+
case "file-exists": {
|
|
428
|
+
const filePath = path.join(rootDir, checkpoint.path);
|
|
429
|
+
if (!fs.existsSync(filePath)) {
|
|
430
|
+
console.log(chalk.red(`\u274C Missing: ${checkpoint.path}`));
|
|
431
|
+
return false;
|
|
432
|
+
}
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
case "symbol-count": {
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
case "gate-count": {
|
|
439
|
+
break;
|
|
440
|
+
}
|
|
441
|
+
case "command-success": {
|
|
442
|
+
try {
|
|
443
|
+
execSync(checkpoint.command, { cwd: rootDir, stdio: "pipe" });
|
|
444
|
+
} catch {
|
|
445
|
+
console.log(chalk.red(`\u274C Command failed: ${checkpoint.command}`));
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
448
|
+
break;
|
|
449
|
+
}
|
|
450
|
+
case "bug-fixed": {
|
|
451
|
+
const state = loadState(rootDir);
|
|
452
|
+
if (!state.fixedBugs.includes(checkpoint.bug)) {
|
|
453
|
+
console.log(chalk.red(`\u274C Bug not fixed: ${checkpoint.bug}`));
|
|
454
|
+
return false;
|
|
455
|
+
}
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return true;
|
|
461
|
+
}
|
|
462
|
+
async function tutorialStartCommand(targetPath) {
|
|
463
|
+
const rootDir = targetPath ? path.resolve(targetPath) : process.cwd();
|
|
464
|
+
try {
|
|
465
|
+
const curriculumPath = path.join(rootDir, CURRICULUM_FILE);
|
|
466
|
+
if (!fs.existsSync(curriculumPath)) {
|
|
467
|
+
console.log(chalk.blue("\n\u{1F4DA} Generating tutorial curriculum...\n"));
|
|
468
|
+
generateDefaultCurriculum(rootDir);
|
|
469
|
+
console.log(chalk.green("\u2705 Tutorial curriculum generated!\n"));
|
|
470
|
+
}
|
|
471
|
+
const curriculum = loadCurriculum(rootDir);
|
|
472
|
+
const state = loadState(rootDir);
|
|
473
|
+
if (!state.currentStep && curriculum.steps.length > 0) {
|
|
474
|
+
state.currentStep = curriculum.steps[0].id;
|
|
475
|
+
saveState(rootDir, state);
|
|
476
|
+
}
|
|
477
|
+
console.log(chalk.blue("\n\u{1F393} Paradigm Tutorial\n"));
|
|
478
|
+
console.log(`Current Step: ${state.currentStep || "Not started"}`);
|
|
479
|
+
console.log(`Completed Steps: ${state.completedSteps.length}/${curriculum.steps.length}
|
|
480
|
+
`);
|
|
481
|
+
if (state.currentStep) {
|
|
482
|
+
const step = curriculum.steps.find((s) => s.id === state.currentStep);
|
|
483
|
+
if (step) {
|
|
484
|
+
const stepFile = path.join(rootDir, ".paradigm/tutorial", step.file);
|
|
485
|
+
if (fs.existsSync(stepFile)) {
|
|
486
|
+
console.log(chalk.cyan(`\u{1F4D6} ${step.title}`));
|
|
487
|
+
console.log(chalk.gray(step.description));
|
|
488
|
+
console.log(chalk.gray(`
|
|
489
|
+
View full instructions: ${stepFile}
|
|
490
|
+
`));
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
console.log("Commands:");
|
|
495
|
+
console.log(" paradigm tutorial step <n> Show step n");
|
|
496
|
+
console.log(" paradigm tutorial checkpoint Validate current checkpoint");
|
|
497
|
+
console.log(" paradigm tutorial next Move to next step");
|
|
498
|
+
console.log(" paradigm tutorial status Show progress");
|
|
499
|
+
console.log(" paradigm tutorial reset Reset tutorial\n");
|
|
500
|
+
} catch (error) {
|
|
501
|
+
console.error(chalk.red(`\u274C Error: ${error.message}`));
|
|
502
|
+
process.exit(1);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
async function tutorialStepCommand(targetPath, stepNum) {
|
|
506
|
+
const rootDir = targetPath ? path.resolve(targetPath) : process.cwd();
|
|
507
|
+
try {
|
|
508
|
+
const curriculum = loadCurriculum(rootDir);
|
|
509
|
+
const stepIndex = stepNum ? parseInt(stepNum, 10) - 1 : 0;
|
|
510
|
+
if (stepIndex < 0 || stepIndex >= curriculum.steps.length) {
|
|
511
|
+
console.error(chalk.red(`\u274C Invalid step number: ${stepNum}`));
|
|
512
|
+
process.exit(1);
|
|
513
|
+
}
|
|
514
|
+
const step = curriculum.steps[stepIndex];
|
|
515
|
+
const stepFile = path.join(rootDir, ".paradigm/tutorial", step.file);
|
|
516
|
+
if (fs.existsSync(stepFile)) {
|
|
517
|
+
console.log(chalk.blue(`
|
|
518
|
+
\u{1F4D6} Step ${stepIndex + 1}: ${step.title}
|
|
519
|
+
`));
|
|
520
|
+
const content = fs.readFileSync(stepFile, "utf8");
|
|
521
|
+
console.log(content);
|
|
522
|
+
} else {
|
|
523
|
+
console.error(chalk.red(`\u274C Step file not found: ${stepFile}`));
|
|
524
|
+
process.exit(1);
|
|
525
|
+
}
|
|
526
|
+
} catch (error) {
|
|
527
|
+
console.error(chalk.red(`\u274C Error: ${error.message}`));
|
|
528
|
+
process.exit(1);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
async function tutorialCheckpointCommand(targetPath) {
|
|
532
|
+
const rootDir = targetPath ? path.resolve(targetPath) : process.cwd();
|
|
533
|
+
try {
|
|
534
|
+
const curriculum = loadCurriculum(rootDir);
|
|
535
|
+
const state = loadState(rootDir);
|
|
536
|
+
if (!state.currentStep) {
|
|
537
|
+
console.log(chalk.yellow("\u26A0\uFE0F No active step. Run `paradigm tutorial start` first."));
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
console.log(chalk.blue(`
|
|
541
|
+
\u{1F50D} Validating checkpoint for step: ${state.currentStep}
|
|
542
|
+
`));
|
|
543
|
+
const passed = await validateCheckpoint(rootDir, state.currentStep, curriculum);
|
|
544
|
+
if (passed) {
|
|
545
|
+
console.log(chalk.green("\u2705 All checkpoints passed!\n"));
|
|
546
|
+
const currentIndex = curriculum.steps.findIndex((s) => s.id === state.currentStep);
|
|
547
|
+
if (currentIndex < curriculum.steps.length - 1) {
|
|
548
|
+
const nextStep = curriculum.steps[currentIndex + 1];
|
|
549
|
+
const nextStepFile = path.join(rootDir, ".paradigm/tutorial", nextStep.file);
|
|
550
|
+
if (fs.existsSync(nextStepFile)) {
|
|
551
|
+
console.log(chalk.cyan(`
|
|
552
|
+
\u{1F4D6} Next Step: ${nextStep.title}
|
|
553
|
+
`));
|
|
554
|
+
console.log(chalk.gray(nextStep.description));
|
|
555
|
+
console.log(chalk.gray(`
|
|
556
|
+
Run 'paradigm tutorial step ${currentIndex + 2}' to view full instructions.
|
|
557
|
+
`));
|
|
558
|
+
}
|
|
559
|
+
} else {
|
|
560
|
+
console.log(chalk.green("\n\u{1F389} Congratulations! You've completed all steps!\n"));
|
|
561
|
+
console.log(chalk.gray("Run 'paradigm tutorial next' to mark this step as complete.\n"));
|
|
562
|
+
}
|
|
563
|
+
} else {
|
|
564
|
+
console.log(chalk.red("\u274C Some checkpoints failed. Review the errors above.\n"));
|
|
565
|
+
process.exit(1);
|
|
566
|
+
}
|
|
567
|
+
} catch (error) {
|
|
568
|
+
console.error(chalk.red(`\u274C Error: ${error.message}`));
|
|
569
|
+
process.exit(1);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
async function tutorialNextCommand(targetPath) {
|
|
573
|
+
const rootDir = targetPath ? path.resolve(targetPath) : process.cwd();
|
|
574
|
+
try {
|
|
575
|
+
const curriculum = loadCurriculum(rootDir);
|
|
576
|
+
const state = loadState(rootDir);
|
|
577
|
+
if (!state.currentStep) {
|
|
578
|
+
console.log(chalk.yellow("\u26A0\uFE0F No active step. Run `paradigm tutorial start` first."));
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
const passed = await validateCheckpoint(rootDir, state.currentStep, curriculum);
|
|
582
|
+
if (!passed) {
|
|
583
|
+
console.log(chalk.red("\n\u274C Cannot proceed. Please complete current step checkpoints first.\n"));
|
|
584
|
+
process.exit(1);
|
|
585
|
+
}
|
|
586
|
+
if (!state.completedSteps.includes(state.currentStep)) {
|
|
587
|
+
state.completedSteps.push(state.currentStep);
|
|
588
|
+
}
|
|
589
|
+
const currentIndex = curriculum.steps.findIndex((s) => s.id === state.currentStep);
|
|
590
|
+
if (currentIndex < curriculum.steps.length - 1) {
|
|
591
|
+
state.currentStep = curriculum.steps[currentIndex + 1].id;
|
|
592
|
+
saveState(rootDir, state);
|
|
593
|
+
console.log(chalk.green(`
|
|
594
|
+
\u2705 Step completed! Moving to next step.
|
|
595
|
+
`));
|
|
596
|
+
await tutorialStepCommand(targetPath, String(currentIndex + 2));
|
|
597
|
+
} else {
|
|
598
|
+
state.currentStep = null;
|
|
599
|
+
saveState(rootDir, state);
|
|
600
|
+
console.log(chalk.green("\n\u{1F389} Congratulations! You've completed the tutorial!\n"));
|
|
601
|
+
}
|
|
602
|
+
} catch (error) {
|
|
603
|
+
console.error(chalk.red(`\u274C Error: ${error.message}`));
|
|
604
|
+
process.exit(1);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
async function tutorialStatusCommand(targetPath) {
|
|
608
|
+
const rootDir = targetPath ? path.resolve(targetPath) : process.cwd();
|
|
609
|
+
try {
|
|
610
|
+
const curriculum = loadCurriculum(rootDir);
|
|
611
|
+
const state = loadState(rootDir);
|
|
612
|
+
console.log(chalk.blue("\n\u{1F4CA} Tutorial Progress\n"));
|
|
613
|
+
console.log(`Current Step: ${state.currentStep || "Not started"}`);
|
|
614
|
+
console.log(`Completed: ${state.completedSteps.length}/${curriculum.steps.length}`);
|
|
615
|
+
console.log(`Bugs Fixed: ${state.fixedBugs.length}
|
|
616
|
+
`);
|
|
617
|
+
if (state.currentStep) {
|
|
618
|
+
const step = curriculum.steps.find((s) => s.id === state.currentStep);
|
|
619
|
+
if (step) {
|
|
620
|
+
console.log(chalk.cyan(`Current: ${step.title}`));
|
|
621
|
+
console.log(chalk.gray(step.description));
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
console.log("");
|
|
625
|
+
} catch (error) {
|
|
626
|
+
console.error(chalk.red(`\u274C Error: ${error.message}`));
|
|
627
|
+
process.exit(1);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
async function tutorialResetCommand(targetPath) {
|
|
631
|
+
const rootDir = targetPath ? path.resolve(targetPath) : process.cwd();
|
|
632
|
+
const statePath = path.join(rootDir, TUTORIAL_STATE_FILE);
|
|
633
|
+
if (fs.existsSync(statePath)) {
|
|
634
|
+
fs.unlinkSync(statePath);
|
|
635
|
+
}
|
|
636
|
+
console.log(chalk.green("\n\u2705 Tutorial reset. Run `paradigm tutorial start` to begin again.\n"));
|
|
637
|
+
}
|
|
638
|
+
async function tutorialBugsCommand(targetPath) {
|
|
639
|
+
const rootDir = targetPath ? path.resolve(targetPath) : process.cwd();
|
|
640
|
+
try {
|
|
641
|
+
const curriculum = loadCurriculum(rootDir);
|
|
642
|
+
const state = loadState(rootDir);
|
|
643
|
+
console.log(chalk.blue("\n\u{1F41B} Intentional Bugs\n"));
|
|
644
|
+
for (const bug of curriculum.bugs || []) {
|
|
645
|
+
const fixed = state.fixedBugs.includes(bug.id);
|
|
646
|
+
console.log(`${fixed ? chalk.green("\u2705") : chalk.yellow("\u23F3")} ${bug.title}`);
|
|
647
|
+
console.log(chalk.gray(` ${bug.description}`));
|
|
648
|
+
if (bug.hint) {
|
|
649
|
+
console.log(chalk.gray(` Hint: ${bug.hint}`));
|
|
650
|
+
}
|
|
651
|
+
console.log("");
|
|
652
|
+
}
|
|
653
|
+
} catch (error) {
|
|
654
|
+
console.error(chalk.red(`\u274C Error: ${error.message}`));
|
|
655
|
+
process.exit(1);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
export {
|
|
659
|
+
tutorialBugsCommand,
|
|
660
|
+
tutorialCheckpointCommand,
|
|
661
|
+
tutorialNextCommand,
|
|
662
|
+
tutorialResetCommand,
|
|
663
|
+
tutorialStartCommand,
|
|
664
|
+
tutorialStatusCommand,
|
|
665
|
+
tutorialStepCommand
|
|
666
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "./chunk-MO4EEYFW.js";
|
|
3
|
+
|
|
4
|
+
// src/commands/university.ts
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
async function universityCommand(_path, options) {
|
|
7
|
+
const port = parseInt(options.port || "3839", 10);
|
|
8
|
+
const shouldOpen = options.open !== false;
|
|
9
|
+
console.log(chalk.cyan("\nOpening the campus gates...\n"));
|
|
10
|
+
try {
|
|
11
|
+
const { startServer } = await import("./server-F5ITNK6T.js");
|
|
12
|
+
console.log(chalk.gray(`Port: ${port}`));
|
|
13
|
+
console.log();
|
|
14
|
+
await startServer({
|
|
15
|
+
port,
|
|
16
|
+
open: shouldOpen
|
|
17
|
+
});
|
|
18
|
+
console.log(chalk.green(`
|
|
19
|
+
Paradigm University is running at http://localhost:${port}`));
|
|
20
|
+
console.log(chalk.gray("\nPress Ctrl+C to stop\n"));
|
|
21
|
+
await new Promise(() => {
|
|
22
|
+
});
|
|
23
|
+
} catch (error) {
|
|
24
|
+
if (error.code === "ERR_MODULE_NOT_FOUND" || error.code === "MODULE_NOT_FOUND") {
|
|
25
|
+
console.error(chalk.red("\n@a-company/university is not installed."));
|
|
26
|
+
console.log(chalk.gray("Install it with: npm install @a-company/university\n"));
|
|
27
|
+
} else if (error.code === "EADDRINUSE") {
|
|
28
|
+
console.error(chalk.red(`
|
|
29
|
+
Error: Port ${port} is already in use.`));
|
|
30
|
+
console.log(chalk.gray(`Try a different port with: paradigm university --port ${port + 1}
|
|
31
|
+
`));
|
|
32
|
+
} else {
|
|
33
|
+
console.error(chalk.red("\nFailed to start Paradigm University:"), error);
|
|
34
|
+
}
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
universityCommand
|
|
40
|
+
};
|