@a-company/paradigm 3.1.5 → 3.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/dist/{accept-orchestration-CWZNCGZX.js → accept-orchestration-DIGPJVUR.js} +6 -5
- package/dist/{aggregate-W7Q6VIM2.js → aggregate-V4KPR3RW.js} +2 -2
- package/dist/{beacon-B47XSTL7.js → beacon-XRXL5KZB.js} +2 -2
- package/dist/{chunk-4LGLU2LO.js → chunk-2E2RTBSM.js} +533 -182
- package/dist/{chunk-YCLN7WXV.js → chunk-2QNZ6PVD.js} +219 -35
- package/dist/{chunk-UM54F7G5.js → chunk-4N6AYEEA.js} +1 -1
- package/dist/{chunk-MVXJVRFI.js → chunk-5TUAVVIG.js} +65 -1
- package/dist/{chunk-5C4SGQKH.js → chunk-6P4IFIK2.js} +4 -2
- package/dist/{chunk-WS5KM7OL.js → chunk-6RNYVBSG.js} +1 -1
- package/dist/{chunk-N6PJAPDE.js → chunk-AK5M6KJB.js} +18 -0
- package/dist/{chunk-VZ7CXFRZ.js → chunk-CRICL4FQ.js} +1004 -17
- package/dist/{chunk-MC7XC7XQ.js → chunk-GZDFVP2N.js} +20 -13
- package/dist/chunk-HPC3JAUP.js +42 -0
- package/dist/chunk-IRVA7NKV.js +657 -0
- package/dist/{chunk-ZPN7MXRA.js → chunk-KFHK6EBI.js} +184 -1
- package/dist/{chunk-UUZ2DMG5.js → chunk-KWDTBXP2.js} +1 -1
- package/dist/{chunk-DRUDZKIT.js → chunk-M2XMTJHQ.js} +693 -70
- package/dist/{chunk-PW2EXJQT.js → chunk-MRENOFTR.js} +24 -1
- package/dist/{chunk-QS36NGWV.js → chunk-QHJGB5TV.js} +1 -1
- package/dist/chunk-UI3XXVJ6.js +449 -0
- package/dist/{chunk-AD2LSCHB.js → chunk-Y4XZWCHK.js} +40 -74
- package/dist/{constellation-K3CIQCHI.js → constellation-GNK5DIMH.js} +2 -2
- package/dist/{cost-AEK6R7HK.js → cost-AGO5N7DD.js} +1 -1
- package/dist/{cursorrules-KI5QWHIX.js → cursorrules-LQFA7M62.js} +2 -2
- package/dist/{delete-W67IVTLJ.js → delete-3YXAJ5AA.js} +12 -1
- package/dist/{diff-AJJ5H6HV.js → diff-J6C5IHPV.js} +6 -5
- package/dist/{dist-2F7NO4H4-KSL6SJIO.js → dist-AG5JNIZU-XSEZ2LLK.js} +28 -3
- package/dist/dist-JOHRYQUA.js +7294 -0
- package/dist/{dist-NHJQVVUW.js → dist-Q6SAZI7X.js} +2 -2
- package/dist/{dist-GPQ4LAY3.js → dist-YP2CO4TG.js} +24 -6
- package/dist/{doctor-JBIV5PMN.js → doctor-TQYRF7KK.js} +2 -2
- package/dist/{edit-Y7XPYSMK.js → edit-EOMPXOG5.js} +1 -1
- package/dist/flow-7JUH6D4H.js +185 -0
- package/dist/global-AXILUM5X.js +136 -0
- package/dist/{habits-FA65W77Y.js → habits-CHP4EW5H.js} +234 -5
- package/dist/{hooks-JKWO44WH.js → hooks-DLZEYHI3.js} +1 -1
- package/dist/index.js +125 -100
- package/dist/{lint-HXKTWRNO.js → lint-N4LMMEXH.js} +141 -1
- package/dist/{list-R3QWW4SC.js → list-JKBJ7ESH.js} +1 -1
- package/dist/mcp.js +9273 -6515
- package/dist/{orchestrate-4ZH5GUQH.js → orchestrate-FAV64G2R.js} +6 -5
- package/dist/{probe-OYCP4JYG.js → probe-X3J2JX62.js} +18 -3
- package/dist/{promote-E6NBZ3BK.js → promote-HZH5E5CO.js} +1 -1
- package/dist/{providers-4PGPZEWP.js → providers-NQ67LO2Z.js} +1 -1
- package/dist/{record-OHQNWOUP.js → record-EECZ3E4I.js} +1 -1
- package/dist/{remember-6VZ74B7E.js → remember-3KJZGDUG.js} +1 -1
- package/dist/{review-RUHX25A5.js → review-BF26ILZB.js} +1 -1
- package/dist/{ripple-SBQOSTZD.js → ripple-JIUAMBLA.js} +2 -2
- package/dist/sentinel-ZTL224IG.js +63 -0
- package/dist/{server-MV4HNFVF.js → server-MZBYDXJY.js} +4193 -9
- package/dist/{setup-DF4F3ICN.js → setup-363IB6MO.js} +1 -1
- package/dist/{setup-JHBPZAG7.js → setup-UKJ3VGHI.js} +4 -4
- package/dist/{shift-2LQFQP4P.js → shift-KDVYB6CR.js} +16 -13
- package/dist/{show-WTOJXUTN.js → show-SAMTXEHG.js} +1 -1
- package/dist/{snapshot-GTVPRYZG.js → snapshot-KCMONZAO.js} +2 -2
- package/dist/{spawn-BJRQA2NR.js → spawn-EO7B2UM3.js} +2 -2
- package/dist/{summary-5SBFO7QK.js → summary-E2PU4UN2.js} +3 -3
- package/dist/{switch-6EANJ7O6.js → switch-CC2KACXO.js} +1 -1
- package/dist/{sync-5KSTPJ4B.js → sync-5VJPZQNX.js} +2 -2
- package/dist/sync-llms-7QDA3ZWC.js +166 -0
- package/dist/{team-NWP2KJAB.js → team-6CCNANKE.js} +7 -6
- package/dist/{test-MA5TWJQV.js → test-DK2RWLTK.js} +91 -8
- package/dist/{thread-JCJVRUQR.js → thread-RNSLADXN.js} +18 -2
- package/dist/{timeline-P7BARFLI.js → timeline-TJDVVVA3.js} +1 -1
- package/dist/{triage-TBIWJA6R.js → triage-PXMU3RWV.js} +2 -2
- package/dist/university-content/courses/para-101.json +2 -1
- package/dist/university-content/courses/para-201.json +102 -3
- package/dist/university-content/courses/para-301.json +14 -11
- package/dist/university-content/courses/para-401.json +57 -3
- package/dist/university-content/courses/para-501.json +204 -6
- package/dist/university-content/plsat/v3.0.json +808 -3
- package/dist/university-content/reference.json +270 -0
- package/dist/{upgrade-TIYFQYPO.js → upgrade-RBSE4M6I.js} +1 -1
- package/dist/{validate-QEEY6KFS.js → validate-2LTHHORX.js} +1 -1
- package/dist/{watch-4LT4O6K7.js → watch-NBPOMOEX.js} +76 -0
- package/dist/{watch-2XEYUH43.js → watch-PAEH6MOG.js} +1 -1
- package/package.json +1 -1
- package/dist/chunk-GWM2WRXL.js +0 -1095
- package/dist/sentinel-WB7GIK4V.js +0 -43
- /package/dist/{chunk-TAP5N3HH.js → chunk-CCG6KYBT.js} +0 -0
package/dist/chunk-GWM2WRXL.js
DELETED
|
@@ -1,1095 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
detectDiscipline,
|
|
4
|
-
getDisciplineConfig
|
|
5
|
-
} from "./chunk-CHSHON3O.js";
|
|
6
|
-
import {
|
|
7
|
-
generateScanIndex,
|
|
8
|
-
serializeScanIndex
|
|
9
|
-
} from "./chunk-N6PJAPDE.js";
|
|
10
|
-
import {
|
|
11
|
-
aggregateFromDirectory,
|
|
12
|
-
getDefaultPremiseContent
|
|
13
|
-
} from "./chunk-5C4SGQKH.js";
|
|
14
|
-
import {
|
|
15
|
-
getDefaultPurposeContent
|
|
16
|
-
} from "./chunk-PW2EXJQT.js";
|
|
17
|
-
import {
|
|
18
|
-
detectIDE,
|
|
19
|
-
loadParadigmFiles,
|
|
20
|
-
syncToIDE
|
|
21
|
-
} from "./chunk-YCLN7WXV.js";
|
|
22
|
-
import {
|
|
23
|
-
log
|
|
24
|
-
} from "./chunk-4NCFWYGG.js";
|
|
25
|
-
|
|
26
|
-
// src/commands/scan/index.ts
|
|
27
|
-
import * as fs2 from "fs";
|
|
28
|
-
import * as path2 from "path";
|
|
29
|
-
import chalk2 from "chalk";
|
|
30
|
-
import ora2 from "ora";
|
|
31
|
-
import * as yaml3 from "js-yaml";
|
|
32
|
-
|
|
33
|
-
// src/core/legacy-config.ts
|
|
34
|
-
import * as yaml from "js-yaml";
|
|
35
|
-
function parseHorizonConfig(content) {
|
|
36
|
-
return yaml.load(content);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// src/commands/scan/navigator.ts
|
|
40
|
-
import * as fs from "fs";
|
|
41
|
-
import * as path from "path";
|
|
42
|
-
import * as yaml2 from "js-yaml";
|
|
43
|
-
import chalk from "chalk";
|
|
44
|
-
import ora from "ora";
|
|
45
|
-
var SYMBOL_CATEGORIES = {
|
|
46
|
-
"@": { category: "features", prefix: "@" },
|
|
47
|
-
"#": { category: "components", prefix: "#" },
|
|
48
|
-
"^": { category: "gates", prefix: "^" },
|
|
49
|
-
"$": { category: "flows", prefix: "$" },
|
|
50
|
-
"&": { category: "integrations", prefix: "&" },
|
|
51
|
-
"!": { category: "signals", prefix: "!" },
|
|
52
|
-
"%": { category: "state", prefix: "%" }
|
|
53
|
-
};
|
|
54
|
-
var DIRECTORY_PATTERNS = {
|
|
55
|
-
features: ["src/features/", "features/", "app/", "src/app/", "src/modules/", "modules/"],
|
|
56
|
-
components: ["src/components/", "components/", "src/lib/", "lib/", "src/ui/", "ui/"],
|
|
57
|
-
gates: ["middleware/", "src/middleware/", "auth/", "src/auth/", "guards/", "src/guards/"],
|
|
58
|
-
flows: ["flows/", "src/flows/", "workflows/", "src/workflows/", "sagas/", "src/sagas/"],
|
|
59
|
-
integrations: ["integrations/", "src/integrations/", "external/", "src/external/", "vendors/"],
|
|
60
|
-
signals: ["events/", "src/events/", "handlers/", "src/handlers/"],
|
|
61
|
-
state: ["stores/", "src/stores/", "state/", "src/state/", "reducers/", "src/reducers/"]
|
|
62
|
-
};
|
|
63
|
-
var KEY_FILE_PATTERNS = {
|
|
64
|
-
config: [
|
|
65
|
-
".paradigm/config.yaml",
|
|
66
|
-
"package.json",
|
|
67
|
-
"tsconfig.json",
|
|
68
|
-
".env.example"
|
|
69
|
-
],
|
|
70
|
-
entry: [
|
|
71
|
-
"src/index.ts",
|
|
72
|
-
"src/index.tsx",
|
|
73
|
-
"src/main.ts",
|
|
74
|
-
"src/main.tsx",
|
|
75
|
-
"index.ts",
|
|
76
|
-
"main.ts",
|
|
77
|
-
"src/app.ts",
|
|
78
|
-
"src/app.tsx"
|
|
79
|
-
],
|
|
80
|
-
types: [
|
|
81
|
-
"src/types/",
|
|
82
|
-
"types/",
|
|
83
|
-
"src/types.ts",
|
|
84
|
-
"types.ts"
|
|
85
|
-
]
|
|
86
|
-
};
|
|
87
|
-
var DEFAULT_SKIP_PATTERNS = {
|
|
88
|
-
always: [
|
|
89
|
-
"node_modules/",
|
|
90
|
-
"dist/",
|
|
91
|
-
"build/",
|
|
92
|
-
".git/",
|
|
93
|
-
".next/",
|
|
94
|
-
".nuxt/",
|
|
95
|
-
".cache/",
|
|
96
|
-
"*.lock",
|
|
97
|
-
"*.log"
|
|
98
|
-
],
|
|
99
|
-
unless_testing: [
|
|
100
|
-
"**/*.test.ts",
|
|
101
|
-
"**/*.test.tsx",
|
|
102
|
-
"**/*.spec.ts",
|
|
103
|
-
"**/*.spec.tsx",
|
|
104
|
-
"__tests__/",
|
|
105
|
-
"test/",
|
|
106
|
-
"tests/"
|
|
107
|
-
],
|
|
108
|
-
unless_docs: [
|
|
109
|
-
"docs/",
|
|
110
|
-
"*.md",
|
|
111
|
-
"README*",
|
|
112
|
-
"CHANGELOG*"
|
|
113
|
-
]
|
|
114
|
-
};
|
|
115
|
-
async function generateNavigator(rootDir, aggregation, options = {}) {
|
|
116
|
-
const spinner = options.quiet ? null : ora();
|
|
117
|
-
spinner?.start("Generating navigator.yaml...");
|
|
118
|
-
const structure = buildStructure(rootDir);
|
|
119
|
-
const keyFiles = buildKeyFiles(rootDir);
|
|
120
|
-
const skipPatterns = buildSkipPatterns(rootDir);
|
|
121
|
-
const symbols = buildSymbolMap(aggregation.symbols, aggregation.purposeFiles, rootDir);
|
|
122
|
-
const navigatorConfig = {
|
|
123
|
-
version: "1.0",
|
|
124
|
-
generated: (/* @__PURE__ */ new Date()).toISOString(),
|
|
125
|
-
structure,
|
|
126
|
-
key_files: keyFiles,
|
|
127
|
-
skip_patterns: skipPatterns,
|
|
128
|
-
symbols
|
|
129
|
-
};
|
|
130
|
-
const outputDir = path.join(rootDir, ".paradigm");
|
|
131
|
-
const outputPath = path.join(outputDir, "navigator.yaml");
|
|
132
|
-
if (!fs.existsSync(outputDir)) {
|
|
133
|
-
fs.mkdirSync(outputDir, { recursive: true });
|
|
134
|
-
}
|
|
135
|
-
fs.writeFileSync(
|
|
136
|
-
outputPath,
|
|
137
|
-
yaml2.dump(navigatorConfig, {
|
|
138
|
-
indent: 2,
|
|
139
|
-
lineWidth: 120,
|
|
140
|
-
noRefs: true,
|
|
141
|
-
sortKeys: false
|
|
142
|
-
}),
|
|
143
|
-
"utf8"
|
|
144
|
-
);
|
|
145
|
-
spinner?.succeed(chalk.green("Navigator generated"));
|
|
146
|
-
if (!options.quiet) {
|
|
147
|
-
console.log(chalk.gray(` Output: ${outputPath}`));
|
|
148
|
-
console.log(chalk.gray(` Structure categories: ${Object.keys(structure).length}`));
|
|
149
|
-
console.log(chalk.gray(` Symbol mappings: ${Object.keys(symbols).length}`));
|
|
150
|
-
console.log();
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
function buildStructure(rootDir) {
|
|
154
|
-
const structure = {};
|
|
155
|
-
for (const [category, patterns] of Object.entries(DIRECTORY_PATTERNS)) {
|
|
156
|
-
const existingPaths = patterns.filter((p) => {
|
|
157
|
-
const fullPath = path.join(rootDir, p);
|
|
158
|
-
return fs.existsSync(fullPath);
|
|
159
|
-
});
|
|
160
|
-
if (existingPaths.length > 0) {
|
|
161
|
-
const symbolInfo = Object.values(SYMBOL_CATEGORIES).find(
|
|
162
|
-
(s) => s.category === category
|
|
163
|
-
);
|
|
164
|
-
structure[category] = {
|
|
165
|
-
paths: existingPaths,
|
|
166
|
-
symbol: symbolInfo?.prefix || "@"
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return structure;
|
|
171
|
-
}
|
|
172
|
-
function buildKeyFiles(rootDir) {
|
|
173
|
-
const keyFiles = {};
|
|
174
|
-
for (const [category, patterns] of Object.entries(KEY_FILE_PATTERNS)) {
|
|
175
|
-
const existingPaths = patterns.filter((p) => {
|
|
176
|
-
const fullPath = path.join(rootDir, p);
|
|
177
|
-
return fs.existsSync(fullPath);
|
|
178
|
-
});
|
|
179
|
-
if (existingPaths.length > 0) {
|
|
180
|
-
keyFiles[category] = existingPaths;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
if (!keyFiles.config) keyFiles.config = [];
|
|
184
|
-
if (!keyFiles.entry) keyFiles.entry = [];
|
|
185
|
-
if (!keyFiles.types) keyFiles.types = [];
|
|
186
|
-
return keyFiles;
|
|
187
|
-
}
|
|
188
|
-
function buildSkipPatterns(rootDir) {
|
|
189
|
-
const patterns = { ...DEFAULT_SKIP_PATTERNS };
|
|
190
|
-
const gitignorePath = path.join(rootDir, ".gitignore");
|
|
191
|
-
if (fs.existsSync(gitignorePath)) {
|
|
192
|
-
try {
|
|
193
|
-
const content = fs.readFileSync(gitignorePath, "utf8");
|
|
194
|
-
const gitignorePatterns = content.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#")).filter((line) => {
|
|
195
|
-
return line.endsWith("/") || line.includes("*") || ["node_modules", "dist", "build", ".cache"].some(
|
|
196
|
-
(p) => line.includes(p)
|
|
197
|
-
);
|
|
198
|
-
}).slice(0, 20);
|
|
199
|
-
for (const pattern of gitignorePatterns) {
|
|
200
|
-
if (!patterns.always.includes(pattern)) {
|
|
201
|
-
patterns.always.push(pattern);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
} catch {
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
return patterns;
|
|
208
|
-
}
|
|
209
|
-
function buildSymbolMap(symbols, purposeFiles, _rootDir) {
|
|
210
|
-
const symbolMap = {};
|
|
211
|
-
const purposeDirs = /* @__PURE__ */ new Map();
|
|
212
|
-
for (const pf of purposeFiles) {
|
|
213
|
-
const dir = path.dirname(pf);
|
|
214
|
-
purposeDirs.set(pf, dir);
|
|
215
|
-
}
|
|
216
|
-
for (const symbol of symbols) {
|
|
217
|
-
const prefix = getSymbolPrefix(symbol.type);
|
|
218
|
-
const symbolId = `${prefix}${symbol.id}`;
|
|
219
|
-
if (symbol.path) {
|
|
220
|
-
symbolMap[symbolId] = symbol.path;
|
|
221
|
-
} else if (symbol.directory) {
|
|
222
|
-
symbolMap[symbolId] = symbol.directory;
|
|
223
|
-
} else {
|
|
224
|
-
const matchingPurpose = purposeFiles.find((pf) => {
|
|
225
|
-
const dir = path.dirname(pf);
|
|
226
|
-
const symbolLower = symbol.id.toLowerCase();
|
|
227
|
-
return dir.toLowerCase().includes(symbolLower);
|
|
228
|
-
});
|
|
229
|
-
if (matchingPurpose) {
|
|
230
|
-
symbolMap[symbolId] = path.dirname(matchingPurpose) + "/";
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
return symbolMap;
|
|
235
|
-
}
|
|
236
|
-
function getSymbolPrefix(type) {
|
|
237
|
-
switch (type) {
|
|
238
|
-
case "feature":
|
|
239
|
-
return "@";
|
|
240
|
-
case "component":
|
|
241
|
-
return "#";
|
|
242
|
-
case "gate":
|
|
243
|
-
return "^";
|
|
244
|
-
case "flow":
|
|
245
|
-
return "$";
|
|
246
|
-
case "integration":
|
|
247
|
-
return "&";
|
|
248
|
-
case "signal":
|
|
249
|
-
return "!";
|
|
250
|
-
case "state":
|
|
251
|
-
return "%";
|
|
252
|
-
case "idea":
|
|
253
|
-
return "?";
|
|
254
|
-
case "deprecated":
|
|
255
|
-
return "~";
|
|
256
|
-
default:
|
|
257
|
-
return "@";
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// src/commands/scan/index.ts
|
|
262
|
-
async function indexCommand(targetPath, options) {
|
|
263
|
-
const rootDir = targetPath ? path2.resolve(targetPath) : process.cwd();
|
|
264
|
-
const projectName = path2.basename(rootDir);
|
|
265
|
-
const spinner = ora2();
|
|
266
|
-
const paradigmPath = path2.join(rootDir, ".paradigm");
|
|
267
|
-
const paradigmIsFile = fs2.existsSync(paradigmPath) && fs2.statSync(paradigmPath).isFile();
|
|
268
|
-
let outputPath;
|
|
269
|
-
if (options.output) {
|
|
270
|
-
outputPath = path2.resolve(options.output);
|
|
271
|
-
} else if (paradigmIsFile) {
|
|
272
|
-
outputPath = path2.join(rootDir, ".paradigm-scan-index.json");
|
|
273
|
-
} else {
|
|
274
|
-
outputPath = path2.join(rootDir, ".paradigm", "scan-index.json");
|
|
275
|
-
if (!fs2.existsSync(path2.dirname(outputPath))) {
|
|
276
|
-
fs2.mkdirSync(path2.dirname(outputPath), { recursive: true });
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
if (!options.quiet) {
|
|
280
|
-
console.log(chalk2.blue("\n\u{1F52D} Generating Paradigm Scan Index\n"));
|
|
281
|
-
}
|
|
282
|
-
let scanConfig;
|
|
283
|
-
const configPaths = [
|
|
284
|
-
path2.join(rootDir, ".paradigm"),
|
|
285
|
-
path2.join(rootDir, ".paradigm", "config.yaml")
|
|
286
|
-
];
|
|
287
|
-
for (const configPath of configPaths) {
|
|
288
|
-
if (fs2.existsSync(configPath) && fs2.statSync(configPath).isFile()) {
|
|
289
|
-
try {
|
|
290
|
-
const content = fs2.readFileSync(configPath, "utf8");
|
|
291
|
-
const config = parseHorizonConfig(content);
|
|
292
|
-
scanConfig = config.scan;
|
|
293
|
-
break;
|
|
294
|
-
} catch {
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
spinner.start("Aggregating symbols from purpose and portal files...");
|
|
299
|
-
let aggregation;
|
|
300
|
-
try {
|
|
301
|
-
aggregation = await aggregateFromDirectory(rootDir);
|
|
302
|
-
} catch (err) {
|
|
303
|
-
spinner.fail(chalk2.red("Failed to aggregate symbols"));
|
|
304
|
-
console.error(chalk2.gray(err.message));
|
|
305
|
-
process.exit(1);
|
|
306
|
-
}
|
|
307
|
-
spinner.succeed(`Found ${aggregation.symbols.length} symbols`);
|
|
308
|
-
if (!options.quiet) {
|
|
309
|
-
const breakdown = {
|
|
310
|
-
components: aggregation.symbols.filter((s) => s.type === "component").length,
|
|
311
|
-
flows: aggregation.symbols.filter((s) => s.type === "flow").length,
|
|
312
|
-
gates: aggregation.symbols.filter((s) => s.type === "gate").length,
|
|
313
|
-
signals: aggregation.symbols.filter((s) => s.type === "signal").length,
|
|
314
|
-
aspects: aggregation.symbols.filter((s) => s.type === "aspect").length
|
|
315
|
-
};
|
|
316
|
-
console.log(chalk2.gray(" Breakdown:"));
|
|
317
|
-
for (const [type, count] of Object.entries(breakdown)) {
|
|
318
|
-
if (count > 0) {
|
|
319
|
-
console.log(chalk2.gray(` ${type}: ${count}`));
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
console.log();
|
|
323
|
-
}
|
|
324
|
-
spinner.start("Generating scan index...");
|
|
325
|
-
const index = generateScanIndex(
|
|
326
|
-
{
|
|
327
|
-
symbols: aggregation.symbols,
|
|
328
|
-
purposeFiles: aggregation.purposeFiles,
|
|
329
|
-
portalFiles: aggregation.portalFiles
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
projectName,
|
|
333
|
-
visualTagMappings: scanConfig?.visualTagMappings,
|
|
334
|
-
screenDefinitions: scanConfig?.screens
|
|
335
|
-
}
|
|
336
|
-
);
|
|
337
|
-
try {
|
|
338
|
-
fs2.writeFileSync(outputPath, serializeScanIndex(index), "utf8");
|
|
339
|
-
spinner.succeed(chalk2.green("Scan index generated"));
|
|
340
|
-
} catch (err) {
|
|
341
|
-
spinner.fail(chalk2.red("Failed to write scan index"));
|
|
342
|
-
console.error(chalk2.gray(err.message));
|
|
343
|
-
process.exit(1);
|
|
344
|
-
}
|
|
345
|
-
await generateNavigator(rootDir, aggregation, { quiet: options.quiet });
|
|
346
|
-
const flowIndex = await generateFlowIndex(rootDir, aggregation.purposeFiles, { quiet: options.quiet });
|
|
347
|
-
if (flowIndex && Object.keys(flowIndex.flows).length > 0) {
|
|
348
|
-
const flowIndexPath = path2.join(rootDir, ".paradigm", "flow-index.json");
|
|
349
|
-
fs2.writeFileSync(flowIndexPath, JSON.stringify(flowIndex, null, 2), "utf8");
|
|
350
|
-
if (!options.quiet) {
|
|
351
|
-
spinner.succeed(chalk2.green(`Flow index generated (${Object.keys(flowIndex.flows).length} flows)`));
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
if (!options.quiet) {
|
|
355
|
-
console.log(chalk2.gray(`
|
|
356
|
-
Output: ${outputPath}`));
|
|
357
|
-
console.log(chalk2.gray(` Components: ${Object.keys(index.components).length}`));
|
|
358
|
-
console.log(chalk2.gray(` Features: ${Object.keys(index.features).length}`));
|
|
359
|
-
console.log(chalk2.gray(` Flows: ${Object.keys(index.flows).length}`));
|
|
360
|
-
console.log(chalk2.gray(` State: ${Object.keys(index.state).length}`));
|
|
361
|
-
console.log(chalk2.gray(` Gates: ${Object.keys(index.gates).length}`));
|
|
362
|
-
console.log(chalk2.gray(` Signals: ${Object.keys(index.signals).length}`));
|
|
363
|
-
console.log();
|
|
364
|
-
console.log(chalk2.blue('\u2728 Scan index ready for "paradigm probe" queries'));
|
|
365
|
-
console.log(chalk2.gray(' Attach an image and say "paradigm probe" to map UI to code\n'));
|
|
366
|
-
}
|
|
367
|
-
return index;
|
|
368
|
-
}
|
|
369
|
-
async function generateFlowIndex(rootDir, purposeFiles, options) {
|
|
370
|
-
const flows = {};
|
|
371
|
-
const symbolToFlows = {};
|
|
372
|
-
for (const filePath of purposeFiles) {
|
|
373
|
-
try {
|
|
374
|
-
const content = fs2.readFileSync(filePath, "utf8");
|
|
375
|
-
const data = yaml3.load(content);
|
|
376
|
-
if (!data?.flows) continue;
|
|
377
|
-
if (Array.isArray(data.flows)) {
|
|
378
|
-
for (const flowItem of data.flows) {
|
|
379
|
-
const flow = flowItem;
|
|
380
|
-
if (!flow.name) continue;
|
|
381
|
-
const flowId = `$${flow.name}`;
|
|
382
|
-
const steps = parseFlowSteps(flow.steps);
|
|
383
|
-
if (steps.length > 0) {
|
|
384
|
-
const testableFlow = {
|
|
385
|
-
id: flowId,
|
|
386
|
-
description: flow.description || "",
|
|
387
|
-
steps,
|
|
388
|
-
definedIn: path2.relative(rootDir, filePath)
|
|
389
|
-
};
|
|
390
|
-
flows[flowId] = testableFlow;
|
|
391
|
-
indexFlowSymbols(flowId, steps, symbolToFlows);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
} else {
|
|
395
|
-
for (const [name, flowDef] of Object.entries(data.flows)) {
|
|
396
|
-
const flowId = name.startsWith("$") ? name : `$${name}`;
|
|
397
|
-
const steps = parseFlowSteps(flowDef.steps);
|
|
398
|
-
if (steps.length > 0) {
|
|
399
|
-
const testableFlow = {
|
|
400
|
-
id: flowId,
|
|
401
|
-
description: flowDef.description || "",
|
|
402
|
-
trigger: flowDef.trigger,
|
|
403
|
-
steps,
|
|
404
|
-
validation: flowDef.validation,
|
|
405
|
-
definedIn: path2.relative(rootDir, filePath)
|
|
406
|
-
};
|
|
407
|
-
flows[flowId] = testableFlow;
|
|
408
|
-
indexFlowSymbols(flowId, steps, symbolToFlows);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
} catch (err) {
|
|
413
|
-
if (!options.quiet) {
|
|
414
|
-
console.warn(chalk2.yellow(` Warning: Could not parse flows from ${filePath}: ${err.message}`));
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
if (Object.keys(flows).length === 0) {
|
|
419
|
-
return null;
|
|
420
|
-
}
|
|
421
|
-
return {
|
|
422
|
-
version: "1.0",
|
|
423
|
-
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
424
|
-
flows,
|
|
425
|
-
symbolToFlows
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
|
-
function parseFlowSteps(steps) {
|
|
429
|
-
if (!steps || !Array.isArray(steps)) return [];
|
|
430
|
-
const result = [];
|
|
431
|
-
for (let index = 0; index < steps.length; index++) {
|
|
432
|
-
const step = steps[index];
|
|
433
|
-
if (typeof step === "object" && step !== null) {
|
|
434
|
-
const s = step;
|
|
435
|
-
const action = s.action || s.description || s.component || "";
|
|
436
|
-
if (action) {
|
|
437
|
-
result.push({
|
|
438
|
-
id: s.id || `step-${index + 1}`,
|
|
439
|
-
action,
|
|
440
|
-
symbol: s.symbol,
|
|
441
|
-
expect: s.expect
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
return result;
|
|
447
|
-
}
|
|
448
|
-
function indexFlowSymbols(flowId, steps, symbolToFlows) {
|
|
449
|
-
for (const step of steps) {
|
|
450
|
-
if (step.symbol) {
|
|
451
|
-
if (!symbolToFlows[step.symbol]) {
|
|
452
|
-
symbolToFlows[step.symbol] = [];
|
|
453
|
-
}
|
|
454
|
-
if (!symbolToFlows[step.symbol].includes(flowId)) {
|
|
455
|
-
symbolToFlows[step.symbol].push(flowId);
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
// src/commands/init.ts
|
|
462
|
-
import * as fs3 from "fs";
|
|
463
|
-
import * as path3 from "path";
|
|
464
|
-
import { fileURLToPath } from "url";
|
|
465
|
-
import chalk3 from "chalk";
|
|
466
|
-
import ora3 from "ora";
|
|
467
|
-
function countLines(filePath) {
|
|
468
|
-
try {
|
|
469
|
-
const content = fs3.readFileSync(filePath, "utf8");
|
|
470
|
-
return content.split("\n").length;
|
|
471
|
-
} catch {
|
|
472
|
-
return 0;
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
function detectProjectType(rootDir) {
|
|
476
|
-
const packageJsonPath = path3.join(rootDir, "package.json");
|
|
477
|
-
if (fs3.existsSync(packageJsonPath)) {
|
|
478
|
-
try {
|
|
479
|
-
const pkg = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
|
|
480
|
-
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
481
|
-
if (deps["next"]) return "Next.js";
|
|
482
|
-
if (deps["nuxt"]) return "Nuxt";
|
|
483
|
-
if (deps["@angular/core"]) return "Angular";
|
|
484
|
-
if (deps["vue"]) return "Vue";
|
|
485
|
-
if (deps["svelte"]) return "Svelte";
|
|
486
|
-
if (deps["express"]) return "Express";
|
|
487
|
-
if (deps["fastify"]) return "Fastify";
|
|
488
|
-
if (deps["react"] && !deps["next"]) return "React";
|
|
489
|
-
if (deps["typescript"]) return "TypeScript";
|
|
490
|
-
return "Node.js";
|
|
491
|
-
} catch {
|
|
492
|
-
return void 0;
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
if (fs3.existsSync(path3.join(rootDir, "requirements.txt")) || fs3.existsSync(path3.join(rootDir, "pyproject.toml"))) {
|
|
496
|
-
if (fs3.existsSync(path3.join(rootDir, "manage.py"))) return "Django";
|
|
497
|
-
if (fs3.existsSync(path3.join(rootDir, "app.py"))) return "Flask";
|
|
498
|
-
return "Python";
|
|
499
|
-
}
|
|
500
|
-
if (fs3.existsSync(path3.join(rootDir, "go.mod"))) return "Go";
|
|
501
|
-
if (fs3.existsSync(path3.join(rootDir, "Cargo.toml"))) return "Rust";
|
|
502
|
-
return void 0;
|
|
503
|
-
}
|
|
504
|
-
function detectExistingIDEFiles(rootDir) {
|
|
505
|
-
const ides = [];
|
|
506
|
-
let totalLines = 0;
|
|
507
|
-
const cursorIDE = { name: "cursor", displayName: "Cursor" };
|
|
508
|
-
const cursorLegacy = path3.join(rootDir, ".cursorrules");
|
|
509
|
-
const cursorModernDir = path3.join(rootDir, ".cursor", "rules");
|
|
510
|
-
if (fs3.existsSync(cursorLegacy)) {
|
|
511
|
-
const lines = countLines(cursorLegacy);
|
|
512
|
-
cursorIDE.legacy = { path: ".cursorrules", lines, type: "legacy" };
|
|
513
|
-
totalLines += lines;
|
|
514
|
-
}
|
|
515
|
-
if (fs3.existsSync(cursorModernDir)) {
|
|
516
|
-
const files = fs3.readdirSync(cursorModernDir).filter((f) => f.endsWith(".mdc"));
|
|
517
|
-
if (files.length > 0) {
|
|
518
|
-
cursorIDE.modern = files.map((f) => {
|
|
519
|
-
const fullPath = path3.join(cursorModernDir, f);
|
|
520
|
-
const lines = countLines(fullPath);
|
|
521
|
-
totalLines += lines;
|
|
522
|
-
return { path: `.cursor/rules/${f}`, lines, type: "modern" };
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
if (cursorIDE.legacy || cursorIDE.modern) {
|
|
527
|
-
ides.push(cursorIDE);
|
|
528
|
-
}
|
|
529
|
-
const copilotIDE = { name: "copilot", displayName: "GitHub Copilot" };
|
|
530
|
-
const copilotLegacy = path3.join(rootDir, ".github", "copilot-instructions.md");
|
|
531
|
-
const copilotModernDir = path3.join(rootDir, ".github", "instructions");
|
|
532
|
-
if (fs3.existsSync(copilotLegacy)) {
|
|
533
|
-
const lines = countLines(copilotLegacy);
|
|
534
|
-
copilotIDE.legacy = { path: ".github/copilot-instructions.md", lines, type: "legacy" };
|
|
535
|
-
totalLines += lines;
|
|
536
|
-
}
|
|
537
|
-
if (fs3.existsSync(copilotModernDir)) {
|
|
538
|
-
const files = fs3.readdirSync(copilotModernDir).filter((f) => f.endsWith(".md"));
|
|
539
|
-
if (files.length > 0) {
|
|
540
|
-
copilotIDE.modern = files.map((f) => {
|
|
541
|
-
const fullPath = path3.join(copilotModernDir, f);
|
|
542
|
-
const lines = countLines(fullPath);
|
|
543
|
-
totalLines += lines;
|
|
544
|
-
return { path: `.github/instructions/${f}`, lines, type: "modern" };
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
if (copilotIDE.legacy || copilotIDE.modern) {
|
|
549
|
-
ides.push(copilotIDE);
|
|
550
|
-
}
|
|
551
|
-
const windsurfPath = path3.join(rootDir, ".windsurfrules");
|
|
552
|
-
if (fs3.existsSync(windsurfPath)) {
|
|
553
|
-
const lines = countLines(windsurfPath);
|
|
554
|
-
ides.push({
|
|
555
|
-
name: "windsurf",
|
|
556
|
-
displayName: "Windsurf",
|
|
557
|
-
legacy: { path: ".windsurfrules", lines, type: "legacy" }
|
|
558
|
-
});
|
|
559
|
-
totalLines += lines;
|
|
560
|
-
}
|
|
561
|
-
const claudePath = path3.join(rootDir, "CLAUDE.md");
|
|
562
|
-
if (fs3.existsSync(claudePath)) {
|
|
563
|
-
const lines = countLines(claudePath);
|
|
564
|
-
ides.push({
|
|
565
|
-
name: "claude",
|
|
566
|
-
displayName: "Claude",
|
|
567
|
-
legacy: { path: "CLAUDE.md", lines, type: "legacy" }
|
|
568
|
-
});
|
|
569
|
-
totalLines += lines;
|
|
570
|
-
}
|
|
571
|
-
const agentsPath = path3.join(rootDir, "AGENTS.md");
|
|
572
|
-
if (fs3.existsSync(agentsPath)) {
|
|
573
|
-
const lines = countLines(agentsPath);
|
|
574
|
-
ides.push({
|
|
575
|
-
name: "agents",
|
|
576
|
-
displayName: "AGENTS.md",
|
|
577
|
-
legacy: { path: "AGENTS.md", lines, type: "legacy" }
|
|
578
|
-
});
|
|
579
|
-
totalLines += lines;
|
|
580
|
-
}
|
|
581
|
-
const discipline = detectDiscipline(rootDir);
|
|
582
|
-
return {
|
|
583
|
-
ides,
|
|
584
|
-
hasExisting: ides.length > 0,
|
|
585
|
-
totalLines,
|
|
586
|
-
projectType: detectProjectType(rootDir),
|
|
587
|
-
discipline: discipline !== "backend" ? discipline : void 0
|
|
588
|
-
// Only show if non-fallback
|
|
589
|
-
};
|
|
590
|
-
}
|
|
591
|
-
function generateMigrationPrompt(detection, projectName) {
|
|
592
|
-
const lines = [];
|
|
593
|
-
lines.push("# Migrate IDE Instructions to Paradigm Format");
|
|
594
|
-
lines.push("");
|
|
595
|
-
lines.push("## Overview");
|
|
596
|
-
lines.push("");
|
|
597
|
-
lines.push(`Migrate existing IDE instruction files for **${projectName}** to Paradigm's managed, scoped format.`);
|
|
598
|
-
lines.push("");
|
|
599
|
-
lines.push("## Source Files Found");
|
|
600
|
-
lines.push("");
|
|
601
|
-
for (const ide of detection.ides) {
|
|
602
|
-
if (ide.legacy) {
|
|
603
|
-
lines.push(`- \`${ide.legacy.path}\` (${ide.legacy.lines} lines) - ${ide.displayName} ${ide.legacy.type} format`);
|
|
604
|
-
}
|
|
605
|
-
if (ide.modern) {
|
|
606
|
-
for (const file of ide.modern) {
|
|
607
|
-
lines.push(`- \`${file.path}\` (${file.lines} lines) - ${ide.displayName} modern format`);
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
lines.push("");
|
|
612
|
-
if (detection.ides.some((i) => i.name === "cursor")) {
|
|
613
|
-
lines.push("## Cursor Migration \u2192 `.cursor/rules/*.mdc`");
|
|
614
|
-
lines.push("");
|
|
615
|
-
lines.push("Split the existing `.cursorrules` into scoped `.mdc` files with YAML frontmatter:");
|
|
616
|
-
lines.push("");
|
|
617
|
-
lines.push("### File Structure");
|
|
618
|
-
lines.push("");
|
|
619
|
-
lines.push("```");
|
|
620
|
-
lines.push(".cursor/rules/");
|
|
621
|
-
lines.push("\u251C\u2500\u2500 project-core.mdc # Always applies - project overview, architecture");
|
|
622
|
-
lines.push("\u251C\u2500\u2500 code-style.mdc # globs: **/*.{ts,tsx,js,jsx} - naming, formatting");
|
|
623
|
-
lines.push("\u251C\u2500\u2500 components.mdc # globs: **/components/**/* - component patterns");
|
|
624
|
-
lines.push("\u251C\u2500\u2500 api-patterns.mdc # globs: **/api/**/* - API conventions");
|
|
625
|
-
lines.push("\u251C\u2500\u2500 testing.mdc # globs: **/*.test.* - testing guidelines");
|
|
626
|
-
lines.push("\u2514\u2500\u2500 custom.mdc # Any project-specific rules");
|
|
627
|
-
lines.push("```");
|
|
628
|
-
lines.push("");
|
|
629
|
-
lines.push("### Frontmatter Format");
|
|
630
|
-
lines.push("");
|
|
631
|
-
lines.push("```yaml");
|
|
632
|
-
lines.push("---");
|
|
633
|
-
lines.push("description: Brief description of what these rules cover");
|
|
634
|
-
lines.push('globs: "**/*.ts" # File pattern (OR use alwaysApply)');
|
|
635
|
-
lines.push("alwaysApply: true # Apply to all files (OR use globs)");
|
|
636
|
-
lines.push("---");
|
|
637
|
-
lines.push("```");
|
|
638
|
-
lines.push("");
|
|
639
|
-
}
|
|
640
|
-
if (detection.ides.some((i) => i.name === "copilot")) {
|
|
641
|
-
lines.push("## Copilot Migration \u2192 `.github/instructions/*.instructions.md`");
|
|
642
|
-
lines.push("");
|
|
643
|
-
lines.push("Split into scoped instruction files with `applyTo` frontmatter:");
|
|
644
|
-
lines.push("");
|
|
645
|
-
lines.push("### File Structure");
|
|
646
|
-
lines.push("");
|
|
647
|
-
lines.push("```");
|
|
648
|
-
lines.push(".github/");
|
|
649
|
-
lines.push("\u251C\u2500\u2500 copilot-instructions.md # Always applies - core rules");
|
|
650
|
-
lines.push("\u2514\u2500\u2500 instructions/");
|
|
651
|
-
lines.push(" \u251C\u2500\u2500 typescript.instructions.md # applyTo: **/*.ts");
|
|
652
|
-
lines.push(" \u251C\u2500\u2500 react.instructions.md # applyTo: **/*.tsx");
|
|
653
|
-
lines.push(" \u251C\u2500\u2500 api.instructions.md # applyTo: **/api/**");
|
|
654
|
-
lines.push(" \u2514\u2500\u2500 testing.instructions.md # applyTo: **/*.test.*");
|
|
655
|
-
lines.push("```");
|
|
656
|
-
lines.push("");
|
|
657
|
-
lines.push("### Frontmatter Format");
|
|
658
|
-
lines.push("");
|
|
659
|
-
lines.push("```yaml");
|
|
660
|
-
lines.push("---");
|
|
661
|
-
lines.push('applyTo: "**/*.ts"');
|
|
662
|
-
lines.push("---");
|
|
663
|
-
lines.push("```");
|
|
664
|
-
lines.push("");
|
|
665
|
-
}
|
|
666
|
-
lines.push("## Migration Steps");
|
|
667
|
-
lines.push("");
|
|
668
|
-
lines.push("1. **Read each source file** and identify logical sections:");
|
|
669
|
-
lines.push(" - Project overview / architecture");
|
|
670
|
-
lines.push(" - Code style / naming conventions");
|
|
671
|
-
lines.push(" - Language-specific patterns");
|
|
672
|
-
lines.push(" - Framework-specific rules");
|
|
673
|
-
lines.push(" - Testing guidelines");
|
|
674
|
-
lines.push(" - API patterns");
|
|
675
|
-
lines.push("");
|
|
676
|
-
lines.push("2. **Create scoped target files** with appropriate frontmatter");
|
|
677
|
-
lines.push("");
|
|
678
|
-
lines.push("3. **Backup originals** by renaming to `.bak`:");
|
|
679
|
-
lines.push(" - `.cursorrules` \u2192 `.cursorrules.bak`");
|
|
680
|
-
lines.push(" - `.github/copilot-instructions.md` \u2192 `.github/copilot-instructions.md.bak`");
|
|
681
|
-
lines.push("");
|
|
682
|
-
lines.push("4. **Verify** the migration by checking that rules apply correctly");
|
|
683
|
-
lines.push("");
|
|
684
|
-
lines.push("## Tips");
|
|
685
|
-
lines.push("");
|
|
686
|
-
lines.push("- **Prefer specific globs** over `alwaysApply` when possible");
|
|
687
|
-
lines.push("- **Keep files focused** - one concern per file");
|
|
688
|
-
lines.push("- **Use descriptive names** that indicate the scope");
|
|
689
|
-
lines.push("- **Paradigm will generate its own rules** - keep custom rules separate");
|
|
690
|
-
lines.push("- After migration, run `paradigm sync` to add Paradigm-managed rules");
|
|
691
|
-
lines.push("");
|
|
692
|
-
lines.push("---");
|
|
693
|
-
lines.push("");
|
|
694
|
-
lines.push("*Generated by `paradigm init --migrate`*");
|
|
695
|
-
return lines.join("\n");
|
|
696
|
-
}
|
|
697
|
-
function getTemplatesDir() {
|
|
698
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
699
|
-
const __dirname = path3.dirname(__filename);
|
|
700
|
-
const possiblePaths = [
|
|
701
|
-
path3.join(__dirname, "..", "..", "templates", "paradigm"),
|
|
702
|
-
path3.join(__dirname, "..", "templates", "paradigm"),
|
|
703
|
-
path3.join(__dirname, "..", "..", "src", "templates", "paradigm")
|
|
704
|
-
];
|
|
705
|
-
for (const p of possiblePaths) {
|
|
706
|
-
if (fs3.existsSync(p)) {
|
|
707
|
-
return p;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
return path3.join(__dirname, "..", "templates", "paradigm");
|
|
711
|
-
}
|
|
712
|
-
var MCP_SERVED_CONTENT = {
|
|
713
|
-
// Skip entire directories
|
|
714
|
-
directories: ["prompts"],
|
|
715
|
-
// Skip specific files (relative to .paradigm/)
|
|
716
|
-
files: [
|
|
717
|
-
"echoes.yaml",
|
|
718
|
-
"docs/commands.md",
|
|
719
|
-
"docs/queries.md",
|
|
720
|
-
"specs/disciplines.md",
|
|
721
|
-
"specs/scan.md",
|
|
722
|
-
"specs/context-tracking.md"
|
|
723
|
-
]
|
|
724
|
-
};
|
|
725
|
-
function shouldSkipPath(relativePath) {
|
|
726
|
-
for (const dir of MCP_SERVED_CONTENT.directories) {
|
|
727
|
-
if (relativePath === dir || relativePath.startsWith(dir + "/")) {
|
|
728
|
-
return true;
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
if (MCP_SERVED_CONTENT.files.includes(relativePath)) {
|
|
732
|
-
return true;
|
|
733
|
-
}
|
|
734
|
-
return false;
|
|
735
|
-
}
|
|
736
|
-
function copyDir(src, dest, projectName, relativePath = "") {
|
|
737
|
-
if (!fs3.existsSync(dest)) {
|
|
738
|
-
fs3.mkdirSync(dest, { recursive: true });
|
|
739
|
-
}
|
|
740
|
-
const entries = fs3.readdirSync(src, { withFileTypes: true });
|
|
741
|
-
for (const entry of entries) {
|
|
742
|
-
const srcPath = path3.join(src, entry.name);
|
|
743
|
-
const destPath = path3.join(dest, entry.name);
|
|
744
|
-
const entryRelativePath = relativePath ? `${relativePath}/${entry.name}` : entry.name;
|
|
745
|
-
if (shouldSkipPath(entryRelativePath)) {
|
|
746
|
-
continue;
|
|
747
|
-
}
|
|
748
|
-
if (entry.isDirectory()) {
|
|
749
|
-
copyDir(srcPath, destPath, projectName, entryRelativePath);
|
|
750
|
-
} else {
|
|
751
|
-
let content = fs3.readFileSync(srcPath, "utf8");
|
|
752
|
-
content = content.replace(/\{\{PROJECT_NAME\}\}/g, projectName);
|
|
753
|
-
fs3.writeFileSync(destPath, content, "utf8");
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
function displayDetectionResults(detection, projectName) {
|
|
758
|
-
console.log(chalk3.blue("\n\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"));
|
|
759
|
-
console.log(chalk3.blue("\u2502") + chalk3.white.bold(" Welcome to Paradigm ") + chalk3.blue("\u2502"));
|
|
760
|
-
console.log(chalk3.blue("\u2502") + chalk3.gray(" Let's set up your project ") + chalk3.blue("\u2502"));
|
|
761
|
-
console.log(chalk3.blue("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n"));
|
|
762
|
-
console.log(chalk3.white(" \u{1F4C1} Project: ") + chalk3.cyan(projectName) + (detection.projectType ? chalk3.gray(` (${detection.projectType} detected)`) : ""));
|
|
763
|
-
if (detection.discipline) {
|
|
764
|
-
console.log(chalk3.white(" \u{1F3AF} Discipline: ") + chalk3.cyan(detection.discipline));
|
|
765
|
-
}
|
|
766
|
-
console.log("");
|
|
767
|
-
if (detection.hasExisting) {
|
|
768
|
-
console.log(chalk3.white(" \u{1F4C4} Found existing IDE instructions:\n"));
|
|
769
|
-
for (const ide of detection.ides) {
|
|
770
|
-
if (ide.legacy) {
|
|
771
|
-
console.log(chalk3.green(" \u2713 ") + chalk3.white(ide.legacy.path) + chalk3.gray(` (${ide.legacy.lines} lines)`));
|
|
772
|
-
}
|
|
773
|
-
if (ide.modern) {
|
|
774
|
-
for (const file of ide.modern) {
|
|
775
|
-
console.log(chalk3.green(" \u2713 ") + chalk3.white(file.path) + chalk3.gray(` (${file.lines} lines)`));
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
console.log("");
|
|
780
|
-
console.log(chalk3.gray(` Total: ${detection.totalLines} lines of existing instructions`));
|
|
781
|
-
} else {
|
|
782
|
-
console.log(chalk3.gray(" \u{1F4C4} No existing IDE instructions found"));
|
|
783
|
-
}
|
|
784
|
-
console.log("");
|
|
785
|
-
console.log(chalk3.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
786
|
-
console.log("");
|
|
787
|
-
}
|
|
788
|
-
function displaySummary(targetIDE, detection) {
|
|
789
|
-
const outputFileMap = {
|
|
790
|
-
cursor: ".cursor/rules/",
|
|
791
|
-
copilot: ".github/instructions/",
|
|
792
|
-
windsurf: ".windsurfrules",
|
|
793
|
-
claude: "CLAUDE.md"
|
|
794
|
-
};
|
|
795
|
-
const outputFile = outputFileMap[targetIDE] || ".cursor/rules/";
|
|
796
|
-
console.log(chalk3.blue("\n\u2728 Paradigm initialized!\n"));
|
|
797
|
-
console.log(chalk3.white(" Created:"));
|
|
798
|
-
console.log(chalk3.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
799
|
-
console.log(chalk3.white(" \u{1F4C1} .paradigm/"));
|
|
800
|
-
console.log(chalk3.gray(" \u251C\u2500\u2500 config.yaml Configuration"));
|
|
801
|
-
console.log(chalk3.gray(" \u251C\u2500\u2500 specs/ Logger, symbols, context"));
|
|
802
|
-
console.log(chalk3.gray(" \u2514\u2500\u2500 docs/ Patterns, troubleshooting"));
|
|
803
|
-
console.log(chalk3.white(" \u{1F4C4} .premise Project overview"));
|
|
804
|
-
console.log(chalk3.white(" \u{1F4C4} .purpose Feature context"));
|
|
805
|
-
console.log(chalk3.white(` \u{1F4C4} ${outputFile.padEnd(20)} IDE instructions`));
|
|
806
|
-
console.log("");
|
|
807
|
-
console.log(chalk3.gray(" Reference content (prompts, commands, etc.) available via MCP"));
|
|
808
|
-
if (detection.hasExisting) {
|
|
809
|
-
console.log("");
|
|
810
|
-
console.log(chalk3.yellow(" \u26A0 Your existing IDE files were preserved."));
|
|
811
|
-
console.log(chalk3.gray(" Run `paradigm init --migrate` to get a migration prompt."));
|
|
812
|
-
}
|
|
813
|
-
console.log("");
|
|
814
|
-
console.log(chalk3.white(" Next steps:"));
|
|
815
|
-
console.log(chalk3.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
816
|
-
console.log(chalk3.white(" 1. ") + chalk3.gray("Review ") + chalk3.cyan(".paradigm/config.yaml"));
|
|
817
|
-
console.log(chalk3.white(" 2. ") + chalk3.gray("Edit ") + chalk3.cyan(".purpose") + chalk3.gray(" to define your features"));
|
|
818
|
-
console.log(chalk3.white(" 3. ") + chalk3.gray("Run ") + chalk3.cyan("paradigm beacon") + chalk3.gray(" to generate AI context"));
|
|
819
|
-
console.log(chalk3.white(" 4. ") + chalk3.gray("Run ") + chalk3.cyan("paradigm doctor") + chalk3.gray(" to verify setup"));
|
|
820
|
-
console.log(chalk3.white(" 5. ") + chalk3.gray("Run ") + chalk3.cyan("paradigm visualize") + chalk3.gray(" to see your project"));
|
|
821
|
-
console.log("");
|
|
822
|
-
}
|
|
823
|
-
async function initCommand(options) {
|
|
824
|
-
const cwd = process.cwd();
|
|
825
|
-
const projectName = options.name || path3.basename(cwd);
|
|
826
|
-
const spinner = ora3();
|
|
827
|
-
const tracker = log.command("init").start("Initializing Paradigm", { project: projectName, quick: !!options.quick });
|
|
828
|
-
const detection = detectExistingIDEFiles(cwd);
|
|
829
|
-
log.operation("detect-ide").debug("IDE detection complete", { hasExisting: detection.hasExisting });
|
|
830
|
-
if (options.migrate) {
|
|
831
|
-
if (!detection.hasExisting) {
|
|
832
|
-
console.log(chalk3.yellow("\n No existing IDE instruction files found.\n"));
|
|
833
|
-
console.log(chalk3.gray(" Run `paradigm init` to create a fresh setup.\n"));
|
|
834
|
-
return;
|
|
835
|
-
}
|
|
836
|
-
console.log(chalk3.blue("\n Migration Prompt\n"));
|
|
837
|
-
console.log(chalk3.gray(" Copy the following prompt to an AI agent:\n"));
|
|
838
|
-
console.log(chalk3.gray(" \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n"));
|
|
839
|
-
console.log(generateMigrationPrompt(detection, projectName));
|
|
840
|
-
console.log(chalk3.gray("\n \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n"));
|
|
841
|
-
return;
|
|
842
|
-
}
|
|
843
|
-
if (options.dryRun) {
|
|
844
|
-
displayDetectionResults(detection, projectName);
|
|
845
|
-
console.log(chalk3.white(" Would create (dry run):"));
|
|
846
|
-
console.log(chalk3.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
847
|
-
console.log(chalk3.cyan(" \u{1F4C1} .paradigm/"));
|
|
848
|
-
console.log(chalk3.cyan(" \u251C\u2500\u2500 config.yaml"));
|
|
849
|
-
console.log(chalk3.cyan(" \u251C\u2500\u2500 specs/"));
|
|
850
|
-
console.log(chalk3.cyan(" \u2514\u2500\u2500 docs/"));
|
|
851
|
-
console.log(chalk3.cyan(" \u{1F4C4} .premise"));
|
|
852
|
-
console.log(chalk3.cyan(" \u{1F4C4} .purpose"));
|
|
853
|
-
console.log(chalk3.cyan(" \u{1F4C1} .cursor/rules/*.mdc"));
|
|
854
|
-
console.log("");
|
|
855
|
-
console.log(chalk3.gray(" Reference content (prompts, commands, etc.) served via MCP"));
|
|
856
|
-
console.log(chalk3.gray(" Run without --dry-run to create these files.\n"));
|
|
857
|
-
return;
|
|
858
|
-
}
|
|
859
|
-
if (!options.quick) {
|
|
860
|
-
displayDetectionResults(detection, projectName);
|
|
861
|
-
if (detection.hasExisting && !options.force) {
|
|
862
|
-
console.log(chalk3.white(" What would you like to do?\n"));
|
|
863
|
-
console.log(chalk3.cyan(" paradigm init --migrate"));
|
|
864
|
-
console.log(chalk3.gray(" Get an AI-ready prompt to convert your existing rules\n"));
|
|
865
|
-
console.log(chalk3.cyan(" paradigm init --force"));
|
|
866
|
-
console.log(chalk3.gray(" Create .paradigm/ alongside existing files\n"));
|
|
867
|
-
console.log(chalk3.cyan(" paradigm init --dry-run"));
|
|
868
|
-
console.log(chalk3.gray(" Preview what would be created\n"));
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
const templatesDir = getTemplatesDir();
|
|
872
|
-
const paradigmDir = path3.join(cwd, ".paradigm");
|
|
873
|
-
if (fs3.existsSync(paradigmDir)) {
|
|
874
|
-
const stat = fs3.statSync(paradigmDir);
|
|
875
|
-
if (stat.isFile()) {
|
|
876
|
-
if (!options.force) {
|
|
877
|
-
console.log(chalk3.yellow(" \u26A0 Legacy .paradigm file found."));
|
|
878
|
-
console.log(chalk3.gray(" Run `paradigm upgrade --all` to migrate.\n"));
|
|
879
|
-
return;
|
|
880
|
-
}
|
|
881
|
-
fs3.unlinkSync(paradigmDir);
|
|
882
|
-
} else if (stat.isDirectory() && !options.force) {
|
|
883
|
-
console.log(chalk3.yellow(" \u26A0 .paradigm/ already exists (use --force to overwrite)\n"));
|
|
884
|
-
return;
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
spinner.start("Creating .paradigm/ directory...");
|
|
888
|
-
try {
|
|
889
|
-
if (!fs3.existsSync(paradigmDir)) {
|
|
890
|
-
fs3.mkdirSync(paradigmDir, { recursive: true });
|
|
891
|
-
}
|
|
892
|
-
if (fs3.existsSync(templatesDir)) {
|
|
893
|
-
copyDir(templatesDir, paradigmDir, projectName);
|
|
894
|
-
if (!fs3.existsSync(path3.join(paradigmDir, "fixtures.yaml"))) {
|
|
895
|
-
createFixturesTemplate(paradigmDir);
|
|
896
|
-
}
|
|
897
|
-
applyDisciplineToConfig(paradigmDir, cwd);
|
|
898
|
-
spinner.succeed(chalk3.green(".paradigm/ created"));
|
|
899
|
-
} else {
|
|
900
|
-
spinner.warn(chalk3.yellow("Templates not found, creating minimal structure"));
|
|
901
|
-
createMinimalStructure(paradigmDir, projectName);
|
|
902
|
-
}
|
|
903
|
-
} catch (error) {
|
|
904
|
-
spinner.fail(chalk3.red(`Failed: ${error.message}`));
|
|
905
|
-
return;
|
|
906
|
-
}
|
|
907
|
-
const premisePath = path3.join(cwd, ".premise");
|
|
908
|
-
if (!fs3.existsSync(premisePath) || options.force) {
|
|
909
|
-
spinner.start("Creating .premise...");
|
|
910
|
-
fs3.writeFileSync(premisePath, getDefaultPremiseContent(projectName));
|
|
911
|
-
spinner.succeed(chalk3.green(".premise created"));
|
|
912
|
-
}
|
|
913
|
-
const purposePath = path3.join(cwd, ".purpose");
|
|
914
|
-
if (!fs3.existsSync(purposePath) || options.force) {
|
|
915
|
-
spinner.start("Creating .purpose...");
|
|
916
|
-
fs3.writeFileSync(purposePath, getDefaultPurposeContent());
|
|
917
|
-
spinner.succeed(chalk3.green(".purpose created"));
|
|
918
|
-
}
|
|
919
|
-
const portalPath = path3.join(cwd, "portal.yaml");
|
|
920
|
-
if (!fs3.existsSync(portalPath)) {
|
|
921
|
-
console.log(chalk3.gray(" \u25CB No portal.yaml (optional - create manually if you need gate/auth definitions)"));
|
|
922
|
-
console.log(chalk3.gray(" See: https://github.com/a-company/paradigm/blob/main/docs/guides/portals.md"));
|
|
923
|
-
}
|
|
924
|
-
let targetIDE;
|
|
925
|
-
if (options.ide) {
|
|
926
|
-
const validIDEs = ["cursor", "copilot", "windsurf", "claude"];
|
|
927
|
-
targetIDE = validIDEs.includes(options.ide.toLowerCase()) ? options.ide.toLowerCase() : "cursor";
|
|
928
|
-
} else {
|
|
929
|
-
spinner.start("Detecting IDE...");
|
|
930
|
-
const ideDetection = detectIDE(cwd);
|
|
931
|
-
targetIDE = ideDetection.detected || "cursor";
|
|
932
|
-
spinner.succeed(`Using ${chalk3.cyan(targetIDE)}`);
|
|
933
|
-
}
|
|
934
|
-
const files = loadParadigmFiles(cwd);
|
|
935
|
-
if (files) {
|
|
936
|
-
spinner.start("Generating IDE instructions...");
|
|
937
|
-
const result = syncToIDE(cwd, targetIDE, files, true);
|
|
938
|
-
if (result.success) {
|
|
939
|
-
spinner.succeed(chalk3.green(result.message || "IDE instructions generated"));
|
|
940
|
-
} else {
|
|
941
|
-
spinner.warn(chalk3.yellow(result.message));
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
if (!options.quick) {
|
|
945
|
-
spinner.start("Creating scan index for MCP tools...");
|
|
946
|
-
try {
|
|
947
|
-
await indexCommand(cwd, { quiet: true });
|
|
948
|
-
spinner.succeed(chalk3.green("Scan index created"));
|
|
949
|
-
} catch (error) {
|
|
950
|
-
spinner.warn(chalk3.yellow("Could not create scan index: " + error.message));
|
|
951
|
-
console.log(chalk3.gray(" Run `paradigm scan` manually after adding .purpose files"));
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
displaySummary(targetIDE, detection);
|
|
955
|
-
tracker.success("Paradigm initialized", { project: projectName, ide: targetIDE });
|
|
956
|
-
}
|
|
957
|
-
function applyDisciplineToConfig(paradigmDir, rootDir) {
|
|
958
|
-
const configPath = path3.join(paradigmDir, "config.yaml");
|
|
959
|
-
if (!fs3.existsSync(configPath)) return;
|
|
960
|
-
const discipline = detectDiscipline(rootDir);
|
|
961
|
-
if (discipline === "auto") return;
|
|
962
|
-
let content = fs3.readFileSync(configPath, "utf8");
|
|
963
|
-
content = content.replace(
|
|
964
|
-
/^discipline:\s*auto\b.*$/m,
|
|
965
|
-
`discipline: ${discipline}`
|
|
966
|
-
);
|
|
967
|
-
const config = getDisciplineConfig(discipline);
|
|
968
|
-
const mappingLines = Object.entries(config.symbolMapping).map(([pattern, symbol]) => ` "${pattern}": "${symbol}"`).join("\n");
|
|
969
|
-
content = content.replace(
|
|
970
|
-
/ symbol-mapping:\n(?: .*\n)*/,
|
|
971
|
-
` symbol-mapping:
|
|
972
|
-
${mappingLines}
|
|
973
|
-
`
|
|
974
|
-
);
|
|
975
|
-
const purposeLines = config.purposeRequired.map((pr) => ` - pattern: "${pr.pattern}"
|
|
976
|
-
depth: ${pr.depth}`).join("\n");
|
|
977
|
-
content = content.replace(
|
|
978
|
-
/purpose-required:\n(?: - pattern:.*\n depth:.*\n)*/,
|
|
979
|
-
`purpose-required:
|
|
980
|
-
${purposeLines}
|
|
981
|
-
`
|
|
982
|
-
);
|
|
983
|
-
fs3.writeFileSync(configPath, content, "utf8");
|
|
984
|
-
}
|
|
985
|
-
function createMinimalStructure(paradigmDir, projectName) {
|
|
986
|
-
fs3.mkdirSync(path3.join(paradigmDir, "specs"), { recursive: true });
|
|
987
|
-
fs3.mkdirSync(path3.join(paradigmDir, "docs"), { recursive: true });
|
|
988
|
-
const minimalConfig = `# Paradigm Configuration
|
|
989
|
-
version: "1.0"
|
|
990
|
-
project: "${projectName}"
|
|
991
|
-
|
|
992
|
-
agent-guidelines:
|
|
993
|
-
overview: |
|
|
994
|
-
This project uses Paradigm for structured AI-assisted development.
|
|
995
|
-
how-to-use:
|
|
996
|
-
- Check .paradigm/specs/ for philosophy and patterns
|
|
997
|
-
- Use symbol prefixes: @feature #component ^gate !signal %state $flow
|
|
998
|
-
- Run \`paradigm beacon\` for quick context
|
|
999
|
-
- Run \`paradigm ripple @symbol\` before making changes
|
|
1000
|
-
|
|
1001
|
-
symbol-system:
|
|
1002
|
-
"@":
|
|
1003
|
-
name: Feature
|
|
1004
|
-
description: User-facing capabilities
|
|
1005
|
-
examples: ["@login", "@checkout"]
|
|
1006
|
-
"#":
|
|
1007
|
-
name: Component
|
|
1008
|
-
description: Reusable code units
|
|
1009
|
-
examples: ["#Button", "#api-client"]
|
|
1010
|
-
"^":
|
|
1011
|
-
name: Portal
|
|
1012
|
-
description: Authorization gates
|
|
1013
|
-
examples: ["^authenticated", "^admin-only"]
|
|
1014
|
-
"!":
|
|
1015
|
-
name: Signal
|
|
1016
|
-
description: Events and side effects
|
|
1017
|
-
examples: ["!login-success", "!payment-failed"]
|
|
1018
|
-
"%":
|
|
1019
|
-
name: State
|
|
1020
|
-
description: Application state
|
|
1021
|
-
examples: ["%user.authenticated", "%cart.items"]
|
|
1022
|
-
"$":
|
|
1023
|
-
name: Flow
|
|
1024
|
-
description: Multi-step processes
|
|
1025
|
-
examples: ["$checkout-flow", "$onboarding"]
|
|
1026
|
-
|
|
1027
|
-
logging:
|
|
1028
|
-
enforce: true
|
|
1029
|
-
default-level: debug
|
|
1030
|
-
|
|
1031
|
-
scan:
|
|
1032
|
-
enabled: true
|
|
1033
|
-
|
|
1034
|
-
conventions:
|
|
1035
|
-
- Use kebab-case for symbol IDs
|
|
1036
|
-
- ALWAYS use Paradigm logger, NEVER raw console.log/print
|
|
1037
|
-
`;
|
|
1038
|
-
fs3.writeFileSync(path3.join(paradigmDir, "config.yaml"), minimalConfig, "utf8");
|
|
1039
|
-
createFixturesTemplate(paradigmDir);
|
|
1040
|
-
}
|
|
1041
|
-
function createFixturesTemplate(paradigmDir) {
|
|
1042
|
-
const fixturesTemplate = `# Test Fixtures for Flow Validation
|
|
1043
|
-
# Use with paradigm_test_fixtures MCP tool
|
|
1044
|
-
version: "1.0"
|
|
1045
|
-
|
|
1046
|
-
# User fixtures for authentication testing
|
|
1047
|
-
users:
|
|
1048
|
-
admin:
|
|
1049
|
-
id: "user-admin"
|
|
1050
|
-
email: "admin@test.com"
|
|
1051
|
-
role: "admin"
|
|
1052
|
-
token: "Bearer test-admin-token"
|
|
1053
|
-
member:
|
|
1054
|
-
id: "user-member"
|
|
1055
|
-
email: "member@test.com"
|
|
1056
|
-
role: "member"
|
|
1057
|
-
token: "Bearer test-member-token"
|
|
1058
|
-
outsider:
|
|
1059
|
-
id: "user-outsider"
|
|
1060
|
-
email: "outsider@test.com"
|
|
1061
|
-
token: "Bearer test-outsider-token"
|
|
1062
|
-
|
|
1063
|
-
# Resource fixtures for entity testing
|
|
1064
|
-
resources:
|
|
1065
|
-
project:
|
|
1066
|
-
id: "project-1"
|
|
1067
|
-
name: "Test Project"
|
|
1068
|
-
members: ["user-member"]
|
|
1069
|
-
admins: ["user-admin"]
|
|
1070
|
-
task:
|
|
1071
|
-
id: "task-1"
|
|
1072
|
-
projectId: "project-1"
|
|
1073
|
-
title: "Sample Task"
|
|
1074
|
-
assignees: ["user-member"]
|
|
1075
|
-
|
|
1076
|
-
# Payload fixtures for API testing
|
|
1077
|
-
payloads:
|
|
1078
|
-
createProject:
|
|
1079
|
-
name: "New Project"
|
|
1080
|
-
description: "Test project description"
|
|
1081
|
-
createTask:
|
|
1082
|
-
title: "New Task"
|
|
1083
|
-
description: "Task description"
|
|
1084
|
-
assignees: []
|
|
1085
|
-
updateTask:
|
|
1086
|
-
title: "Updated Task"
|
|
1087
|
-
status: "in-progress"
|
|
1088
|
-
`;
|
|
1089
|
-
fs3.writeFileSync(path3.join(paradigmDir, "fixtures.yaml"), fixturesTemplate, "utf8");
|
|
1090
|
-
}
|
|
1091
|
-
|
|
1092
|
-
export {
|
|
1093
|
-
indexCommand,
|
|
1094
|
-
initCommand
|
|
1095
|
-
};
|