@fluxyr/quill-core 0.1.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.
Files changed (70) hide show
  1. package/dist/config.d.ts +24 -0
  2. package/dist/config.d.ts.map +1 -0
  3. package/dist/config.js +98 -0
  4. package/dist/config.js.map +1 -0
  5. package/dist/conventions.d.ts +4 -0
  6. package/dist/conventions.d.ts.map +1 -0
  7. package/dist/conventions.js +51 -0
  8. package/dist/conventions.js.map +1 -0
  9. package/dist/engine/codemap.d.ts +3 -0
  10. package/dist/engine/codemap.d.ts.map +1 -0
  11. package/dist/engine/codemap.js +113 -0
  12. package/dist/engine/codemap.js.map +1 -0
  13. package/dist/engine/fileops.d.ts +18 -0
  14. package/dist/engine/fileops.d.ts.map +1 -0
  15. package/dist/engine/fileops.js +194 -0
  16. package/dist/engine/fileops.js.map +1 -0
  17. package/dist/engine/generate.d.ts +39 -0
  18. package/dist/engine/generate.d.ts.map +1 -0
  19. package/dist/engine/generate.js +126 -0
  20. package/dist/engine/generate.js.map +1 -0
  21. package/dist/engine/openrouter.d.ts +36 -0
  22. package/dist/engine/openrouter.d.ts.map +1 -0
  23. package/dist/engine/openrouter.js +108 -0
  24. package/dist/engine/openrouter.js.map +1 -0
  25. package/dist/engine/repair.d.ts +22 -0
  26. package/dist/engine/repair.d.ts.map +1 -0
  27. package/dist/engine/repair.js +37 -0
  28. package/dist/engine/repair.js.map +1 -0
  29. package/dist/engine/session.d.ts +26 -0
  30. package/dist/engine/session.d.ts.map +1 -0
  31. package/dist/engine/session.js +66 -0
  32. package/dist/engine/session.js.map +1 -0
  33. package/dist/index.d.ts +17 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +73 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/ledger/hash.d.ts +8 -0
  38. package/dist/ledger/hash.d.ts.map +1 -0
  39. package/dist/ledger/hash.js +95 -0
  40. package/dist/ledger/hash.js.map +1 -0
  41. package/dist/ledger/lockfile.d.ts +16 -0
  42. package/dist/ledger/lockfile.d.ts.map +1 -0
  43. package/dist/ledger/lockfile.js +101 -0
  44. package/dist/ledger/lockfile.js.map +1 -0
  45. package/dist/ledger/snapshot.d.ts +5 -0
  46. package/dist/ledger/snapshot.d.ts.map +1 -0
  47. package/dist/ledger/snapshot.js +61 -0
  48. package/dist/ledger/snapshot.js.map +1 -0
  49. package/dist/prompt/parse.d.ts +21 -0
  50. package/dist/prompt/parse.d.ts.map +1 -0
  51. package/dist/prompt/parse.js +95 -0
  52. package/dist/prompt/parse.js.map +1 -0
  53. package/dist/stack/helpers.d.ts +9 -0
  54. package/dist/stack/helpers.d.ts.map +1 -0
  55. package/dist/stack/helpers.js +84 -0
  56. package/dist/stack/helpers.js.map +1 -0
  57. package/dist/stack/registry.d.ts +10 -0
  58. package/dist/stack/registry.d.ts.map +1 -0
  59. package/dist/stack/registry.js +21 -0
  60. package/dist/stack/registry.js.map +1 -0
  61. package/dist/types.d.ts +126 -0
  62. package/dist/types.d.ts.map +1 -0
  63. package/dist/types.js +10 -0
  64. package/dist/types.js.map +1 -0
  65. package/package.json +39 -0
  66. package/prompts/000-uuid.md +27 -0
  67. package/prompts/010-base-model.md +27 -0
  68. package/prompts/020-routes.md +23 -0
  69. package/prompts/030-auth.md +16 -0
  70. package/prompts/040-errors.md +25 -0
@@ -0,0 +1,24 @@
1
+ import { QuillConfig } from "./types";
2
+ export declare const CONFIG_NAME = "quill.config.json";
3
+ /** Article value-winner: cheap model + one self-review pass ≈ frontier correctness. */
4
+ export declare const DEFAULT_MODEL = "minimax/minimax-m3";
5
+ export declare function defaultConfig(stack: string, model: string): QuillConfig;
6
+ export declare function configPath(projectDir: string): string;
7
+ export declare function readConfig(projectDir: string): QuillConfig;
8
+ export declare function writeConfig(projectDir: string, config: QuillConfig): void;
9
+ /**
10
+ * Resolved absolute paths for a project. Note: core conventions (the shared,
11
+ * framework-agnostic prompts) are NOT here — they are Quill-owned and read from
12
+ * @fluxyr/quill-core via `coreConventions()`. A project's `prompts/` folder holds only
13
+ * its own feature prompts (directly, no subfolder).
14
+ */
15
+ export interface ProjectPaths {
16
+ root: string;
17
+ featurePrompts: string;
18
+ generated: string;
19
+ checkpoints: string;
20
+ }
21
+ export declare function resolvePaths(projectDir: string, config: QuillConfig): ProjectPaths;
22
+ /** Walk up from `start` to find the directory containing quill.config.json. */
23
+ export declare function findProjectRoot(start: string): string | null;
24
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAE/C,uFAAuF;AACvF,eAAO,MAAM,aAAa,uBAAuB,CAAC;AAElD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,CAavE;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,CAQ1D;AAED,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAEzE;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,YAAY,CAQlF;AAED,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAS5D"}
package/dist/config.js ADDED
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.DEFAULT_MODEL = exports.CONFIG_NAME = void 0;
37
+ exports.defaultConfig = defaultConfig;
38
+ exports.configPath = configPath;
39
+ exports.readConfig = readConfig;
40
+ exports.writeConfig = writeConfig;
41
+ exports.resolvePaths = resolvePaths;
42
+ exports.findProjectRoot = findProjectRoot;
43
+ /** Load/save quill.config.json and resolve project paths. */
44
+ const fs = __importStar(require("fs"));
45
+ const path = __importStar(require("path"));
46
+ exports.CONFIG_NAME = "quill.config.json";
47
+ /** Article value-winner: cheap model + one self-review pass ≈ frontier correctness. */
48
+ exports.DEFAULT_MODEL = "minimax/minimax-m3";
49
+ function defaultConfig(stack, model) {
50
+ return {
51
+ stack,
52
+ model: model || exports.DEFAULT_MODEL,
53
+ paths: { prompts: "prompts", generated: "generated" },
54
+ llm: {
55
+ provider: "openrouter",
56
+ baseUrl: "https://openrouter.ai/api/v1",
57
+ maxRepairPasses: 2,
58
+ temperature: 0,
59
+ selfReview: true,
60
+ },
61
+ };
62
+ }
63
+ function configPath(projectDir) {
64
+ return path.join(projectDir, exports.CONFIG_NAME);
65
+ }
66
+ function readConfig(projectDir) {
67
+ const p = configPath(projectDir);
68
+ if (!fs.existsSync(p)) {
69
+ throw new Error(`No ${exports.CONFIG_NAME} found in ${projectDir}. Run 'create-quill-app' first, or cd into a Quill project.`);
70
+ }
71
+ return JSON.parse(fs.readFileSync(p, "utf8"));
72
+ }
73
+ function writeConfig(projectDir, config) {
74
+ fs.writeFileSync(configPath(projectDir), JSON.stringify(config, null, 2) + "\n");
75
+ }
76
+ function resolvePaths(projectDir, config) {
77
+ return {
78
+ root: projectDir,
79
+ // Feature prompts live directly under prompts/ (core prompts are Quill-owned).
80
+ featurePrompts: path.join(projectDir, config.paths.prompts),
81
+ generated: path.join(projectDir, config.paths.generated),
82
+ checkpoints: path.join(projectDir, ".quill", "checkpoints"),
83
+ };
84
+ }
85
+ /** Walk up from `start` to find the directory containing quill.config.json. */
86
+ function findProjectRoot(start) {
87
+ let dir = path.resolve(start);
88
+ // eslint-disable-next-line no-constant-condition
89
+ while (true) {
90
+ if (fs.existsSync(path.join(dir, exports.CONFIG_NAME)))
91
+ return dir;
92
+ const parent = path.dirname(dir);
93
+ if (parent === dir)
94
+ return null;
95
+ dir = parent;
96
+ }
97
+ }
98
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,sCAaC;AAED,gCAEC;AAED,gCAQC;AAED,kCAEC;AAeD,oCAQC;AAGD,0CASC;AA5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AA+E;QAC/E,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;QAC3D,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;QACxD,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,aAAa,CAAC;KAC5D,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,SAAgB,eAAe,CAAC,KAAa;IAC3C,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9B,iDAAiD;IACjD,OAAO,IAAI,EAAE,CAAC;QACZ,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,mBAAW,CAAC,CAAC;YAAE,OAAO,GAAG,CAAC;QAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG;YAAE,OAAO,IAAI,CAAC;QAChC,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { PromptDoc } from "./types";
2
+ /** Read the shared core conventions, ordered like migrations. */
3
+ export declare function coreConventions(): PromptDoc[];
4
+ //# sourceMappingURL=conventions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conventions.d.ts","sourceRoot":"","sources":["../src/conventions.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAKpC,iEAAiE;AACjE,wBAAgB,eAAe,IAAI,SAAS,EAAE,CAE7C"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.coreConventions = coreConventions;
37
+ /**
38
+ * The shared, framework-agnostic **core conventions** — Quill's single source of
39
+ * truth for how an application behaves (identifiers, resources, endpoints,
40
+ * authorization, errors). They live in a fixed folder inside @fluxyr/quill-core and are
41
+ * reused by every stack; a stack contributes only its framework binding, its
42
+ * scaffold templates, and its verify(). Projects never copy these.
43
+ */
44
+ const path = __importStar(require("path"));
45
+ const parse_1 = require("./prompt/parse");
46
+ const CONVENTIONS_DIR = path.resolve(__dirname, "..", "prompts");
47
+ /** Read the shared core conventions, ordered like migrations. */
48
+ function coreConventions() {
49
+ return (0, parse_1.readPromptDir)(CONVENTIONS_DIR, "core");
50
+ }
51
+ //# sourceMappingURL=conventions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conventions.js","sourceRoot":"","sources":["../src/conventions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,0CAEC;AAhBD;;;;;;GAMG;AACH,2CAA6B;AAE7B,0CAA+C;AAE/C,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;AAEjE,iEAAiE;AACjE,SAAgB,eAAe;IAC7B,OAAO,IAAA,qBAAa,EAAC,eAAe,EAAE,MAAM,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Build a text code map: file tree + signatures for models/routes. */
2
+ export declare function buildCodeMap(generatedDir: string): string;
3
+ //# sourceMappingURL=codemap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codemap.d.ts","sourceRoot":"","sources":["../../src/engine/codemap.ts"],"names":[],"mappings":"AAmDA,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAyBzD"}
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.buildCodeMap = buildCodeMap;
37
+ /**
38
+ * A compact map of the current generated app, injected into the feature prompt
39
+ * so the model orients quickly (opencode can still open any file itself).
40
+ */
41
+ const fs = __importStar(require("fs"));
42
+ const path = __importStar(require("path"));
43
+ const IGNORED = new Set([
44
+ "__pycache__",
45
+ ".opencode",
46
+ ".git",
47
+ ".venv",
48
+ "venv",
49
+ "node_modules",
50
+ "vendor",
51
+ ".bundle",
52
+ "dist",
53
+ ".pytest_cache",
54
+ ".ruff_cache",
55
+ "instance",
56
+ ]);
57
+ function walk(root, dir, out) {
58
+ for (const entry of fs
59
+ .readdirSync(dir, { withFileTypes: true })
60
+ .sort((a, b) => a.name.localeCompare(b.name))) {
61
+ if (IGNORED.has(entry.name))
62
+ continue;
63
+ const full = path.join(dir, entry.name);
64
+ const rel = path.relative(root, full).split(path.sep).join("/");
65
+ if (entry.isDirectory()) {
66
+ walk(root, full, out);
67
+ }
68
+ else if (entry.isFile() && !entry.name.endsWith(".pyc")) {
69
+ out.push(rel);
70
+ }
71
+ }
72
+ }
73
+ /** Extract top-level `class`/`def` signatures from a Python file. */
74
+ function pySignatures(file) {
75
+ try {
76
+ const src = fs.readFileSync(file, "utf8");
77
+ return src
78
+ .split(/\r?\n/)
79
+ .filter((l) => /^(class |def |@)/.test(l))
80
+ .map((l) => l.trimEnd())
81
+ .slice(0, 40);
82
+ }
83
+ catch {
84
+ return [];
85
+ }
86
+ }
87
+ /** Build a text code map: file tree + signatures for models/routes. */
88
+ function buildCodeMap(generatedDir) {
89
+ if (!fs.existsSync(generatedDir))
90
+ return "(empty — no code generated yet)";
91
+ const files = [];
92
+ walk(generatedDir, generatedDir, files);
93
+ if (!files.length)
94
+ return "(empty — no code generated yet)";
95
+ const lines = ["Files:"];
96
+ for (const f of files)
97
+ lines.push(` ${f}`);
98
+ const signatureTargets = files.filter((f) => f.endsWith(".py") &&
99
+ (f.includes("/models/") || f.includes("/routes/") || f.endsWith("models.py") || f.endsWith("routes.py")));
100
+ if (signatureTargets.length) {
101
+ lines.push("", "Signatures (models/routes):");
102
+ for (const f of signatureTargets) {
103
+ const sigs = pySignatures(path.join(generatedDir, f));
104
+ if (sigs.length) {
105
+ lines.push(` ${f}:`);
106
+ for (const s of sigs)
107
+ lines.push(` ${s}`);
108
+ }
109
+ }
110
+ }
111
+ return lines.join("\n");
112
+ }
113
+ //# sourceMappingURL=codemap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codemap.js","sourceRoot":"","sources":["../../src/engine/codemap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,oCAyBC;AA7ED;;;GAGG;AACH,uCAAyB;AACzB,2CAA6B;AAE7B,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC;IACtB,aAAa;IACb,WAAW;IACX,MAAM;IACN,OAAO;IACP,MAAM;IACN,cAAc;IACd,QAAQ;IACR,SAAS;IACT,MAAM;IACN,eAAe;IACf,aAAa;IACb,UAAU;CACX,CAAC,CAAC;AAEH,SAAS,IAAI,CAAC,IAAY,EAAE,GAAW,EAAE,GAAa;IACpD,KAAK,MAAM,KAAK,IAAI,EAAE;SACnB,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;SACzC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QAChD,IAAI,OAAO,CAAC,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parseable ops. */
3
+ export declare const FILE_OPS_PROTOCOL: string;
4
+ interface ParsedOps {
5
+ ops: FileOp[];
6
+ notes?: string;
7
+ }
8
+ /** Extract the JSON object from a model reply (tolerant of fences/prose). */
9
+ export declare function parseFileOps(text: string): ParsedOps;
10
+ /** Apply file ops within `dir`, guarding against path traversal. Returns count. */
11
+ export declare function applyFileOps(dir: string, ops: FileOp[]): number;
12
+ /** Collect current source files (path + content) to give the model context. */
13
+ export declare function collectSource(dir: string, maxBytes?: number): {
14
+ path: string;
15
+ content: string;
16
+ }[];
17
+ export {};
18
+ //# sourceMappingURL=fileops.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileops.d.ts","sourceRoot":"","sources":["../../src/engine/fileops.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,mFAAmF;AACnF,eAAO,MAAM,iBAAiB,QAiBlB,CAAC;AAEb,UAAU,SAAS;IACjB,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAkBpD;AAeD,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,CAiB/D;AA2CD,+EAA+E;AAC/E,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,QAAQ,SAAQ,GACf;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,CA2BrC"}
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.FILE_OPS_PROTOCOL = void 0;
37
+ exports.parseFileOps = parseFileOps;
38
+ exports.applyFileOps = applyFileOps;
39
+ exports.collectSource = collectSource;
40
+ /**
41
+ * The file-ops protocol: the model returns a JSON object describing whole-file
42
+ * writes/deletes; Quill parses and applies them. Whole-file writes (no diffs)
43
+ * are the most reliable format across cheap models.
44
+ */
45
+ const fs = __importStar(require("fs"));
46
+ const path = __importStar(require("path"));
47
+ /** The protocol appended to the system prompt so the model emits parseable ops. */
48
+ exports.FILE_OPS_PROTOCOL = [
49
+ "## Output protocol",
50
+ "",
51
+ "Respond with ONE JSON object and nothing else (optionally inside a ```json",
52
+ "fence). Shape:",
53
+ "",
54
+ "```json",
55
+ '{ "files": [ { "path": "app/models/user.py", "action": "write", "content": "<FULL file contents>" } ], "notes": "one line" }',
56
+ "```",
57
+ "",
58
+ "Rules:",
59
+ '- "action" is "write" (create or fully overwrite) or "delete".',
60
+ "- For every file you change, include its COMPLETE new contents. Never use",
61
+ " diffs, patches, ellipses, or `# unchanged` placeholders.",
62
+ "- Only include files you are actually adding, changing, or deleting.",
63
+ "- Paths are relative to the app root. Do not escape the app root.",
64
+ "- Output valid JSON only — no prose before or after the object.",
65
+ ].join("\n");
66
+ /** Extract the JSON object from a model reply (tolerant of fences/prose). */
67
+ function parseFileOps(text) {
68
+ const candidate = extractJson(text);
69
+ if (!candidate)
70
+ return { ops: [] };
71
+ let obj;
72
+ try {
73
+ obj = JSON.parse(candidate);
74
+ }
75
+ catch {
76
+ return { ops: [] };
77
+ }
78
+ const files = Array.isArray(obj?.files) ? obj.files : [];
79
+ const ops = [];
80
+ for (const f of files) {
81
+ if (!f || typeof f.path !== "string")
82
+ continue;
83
+ const action = f.action === "delete" ? "delete" : "write";
84
+ if (action === "write" && typeof f.content !== "string")
85
+ continue;
86
+ ops.push({ path: f.path, action, content: f.content });
87
+ }
88
+ return { ops, notes: typeof obj?.notes === "string" ? obj.notes : undefined };
89
+ }
90
+ /** Find the outermost JSON object, preferring a ```json fenced block. */
91
+ function extractJson(text) {
92
+ const fence = /```(?:json)?\s*([\s\S]*?)```/i.exec(text);
93
+ if (fence) {
94
+ const inner = fence[1].trim();
95
+ if (inner.startsWith("{"))
96
+ return inner;
97
+ }
98
+ const start = text.indexOf("{");
99
+ const end = text.lastIndexOf("}");
100
+ if (start >= 0 && end > start)
101
+ return text.slice(start, end + 1);
102
+ return null;
103
+ }
104
+ /** Apply file ops within `dir`, guarding against path traversal. Returns count. */
105
+ function applyFileOps(dir, ops) {
106
+ const root = path.resolve(dir);
107
+ let applied = 0;
108
+ for (const op of ops) {
109
+ const dest = path.resolve(root, op.path);
110
+ if (dest !== root && !dest.startsWith(root + path.sep)) {
111
+ throw new Error(`refusing to write outside the app root: ${op.path}`);
112
+ }
113
+ if (op.action === "delete") {
114
+ fs.rmSync(dest, { force: true });
115
+ }
116
+ else {
117
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
118
+ fs.writeFileSync(dest, op.content ?? "");
119
+ }
120
+ applied++;
121
+ }
122
+ return applied;
123
+ }
124
+ const SOURCE_EXT = new Set([
125
+ ".py",
126
+ ".ts",
127
+ ".tsx",
128
+ ".js",
129
+ ".jsx",
130
+ ".json",
131
+ ".rb",
132
+ ".ru",
133
+ ".txt",
134
+ ".cfg",
135
+ ".ini",
136
+ ".toml",
137
+ ".md",
138
+ ]);
139
+ // Extensionless files worth including as context (by exact basename).
140
+ const SOURCE_FILES = new Set(["Gemfile", "Rakefile", "Procfile"]);
141
+ const SKIP_DIRS = new Set([
142
+ "__pycache__",
143
+ ".venv",
144
+ "venv",
145
+ ".git",
146
+ ".pytest_cache",
147
+ ".ruff_cache",
148
+ "instance",
149
+ ".quill",
150
+ "node_modules",
151
+ "dist",
152
+ "build",
153
+ "coverage",
154
+ ".next",
155
+ "vendor",
156
+ ".bundle",
157
+ ]);
158
+ const SKIP_FILES = new Set([
159
+ "package-lock.json",
160
+ "yarn.lock",
161
+ "pnpm-lock.yaml",
162
+ "Gemfile.lock",
163
+ ]);
164
+ /** Collect current source files (path + content) to give the model context. */
165
+ function collectSource(dir, maxBytes = 24000) {
166
+ const root = path.resolve(dir);
167
+ const out = [];
168
+ const walk = (cur) => {
169
+ if (!fs.existsSync(cur))
170
+ return;
171
+ for (const entry of fs.readdirSync(cur, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
172
+ if (SKIP_DIRS.has(entry.name))
173
+ continue;
174
+ const full = path.join(cur, entry.name);
175
+ if (entry.isDirectory())
176
+ walk(full);
177
+ else if (entry.isFile() &&
178
+ (SOURCE_EXT.has(path.extname(entry.name)) || SOURCE_FILES.has(entry.name))) {
179
+ if (SKIP_FILES.has(entry.name))
180
+ continue;
181
+ const stat = fs.statSync(full);
182
+ if (stat.size > maxBytes)
183
+ continue;
184
+ out.push({
185
+ path: path.relative(root, full).split(path.sep).join("/"),
186
+ content: fs.readFileSync(full, "utf8"),
187
+ });
188
+ }
189
+ }
190
+ };
191
+ walk(root);
192
+ return out;
193
+ }
194
+ //# sourceMappingURL=fileops.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileops.js","sourceRoot":"","sources":["../../src/engine/fileops.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,oCAkBC;AAgBD,oCAiBC;AA4CD,sCA8BC;AAhKD;;;;GAIG;AACH,uCAAyB;AACzB,2CAA6B;AAG7B,mFAAmF;AACtE,QAAA,iBAAiB,GAAG;IAC/B,oBAAoB;IACpB,EAAE;IACF,4EAA4E;IAC5E,gBAAgB;IAChB,EAAE;IACF,SAAS;IACT,8HAA8H;IAC9H,KAAK;IACL,EAAE;IACF,QAAQ;IACR,gEAAgE;IAChE,2EAA2E;IAC3E,4DAA4D;IAC5D,sEAAsE;IACtE,mEAAmE;IACnE,iEAAiE;CAClE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAOb,6EAA6E;AAC7E,SAAgB,YAAY,CAAC,IAAY;IACvC,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC,SAAS;QAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IACnC,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IACrB,CAAC;IACD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACzD,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,IAAI,C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AC,IAAI,CAAC,CAAC,EAC1E,CAAC;gBACD,IAAI,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;oBAAE,SAAS;gBACzC,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAC/B,IAAI,IAAI,CAAC,IAAI,GAAG,QAAQ;oBAAE,SAAS;gBACnC,GAAG,CAAC,IAAI,CAAC;oBACP,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;oBACzD,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC;iBACvC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IACF,IAAI,CAAC,IAAI,CAAC,CAAC;IACX,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { LlmConfig, PromptDoc, StackAdapter } from "../types";
2
+ export type Logger = (msg: string) => void;
3
+ /** Write the stack's verbatim scaffold templates into the generated app. */
4
+ export declare function scaffoldGenerated(params: {
5
+ stack: StackAdapter;
6
+ generatedDir: string;
7
+ }): void;
8
+ /** Compose the full system prompt: stack conventions + the file-ops protocol. */
9
+ export declare function composeSystemPrompt(stack: StackAdapter, corePrompts: PromptDoc[], generatedDir: string): string;
10
+ export interface ApplyParams {
11
+ prompt: PromptDoc;
12
+ generatedDir: string;
13
+ model: string;
14
+ apiKey: string;
15
+ llm: LlmConfig;
16
+ system: string;
17
+ stack: StackAdapter;
18
+ log: Logger;
19
+ }
20
+ export interface ApplyResult {
21
+ repairPasses: number;
22
+ verified: boolean;
23
+ detail: string;
24
+ }
25
+ /** Apply one feature prompt: initial generation, then the repair loop. */
26
+ export declare function applyPrompt(params: ApplyParams): Promise<ApplyResult>;
27
+ export interface RegenParams {
28
+ stack: StackAdapter;
29
+ generatedDir: string;
30
+ prompts: PromptDoc[];
31
+ model: string;
32
+ apiKey: string;
33
+ llm: LlmConfig;
34
+ corePrompts: PromptDoc[];
35
+ log: Logger;
36
+ }
37
+ /** Full rebuild: reset to scaffold, then apply every feature prompt in order. */
38
+ export declare function regenerate(params: RegenParams): Promise<ApplyResult[]>;
39
+ //# sourceMappingURL=generate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/engine/generate.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAM9D,MAAM,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAE3C,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,KAAK,EAAE,YAAY,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,IAAI,CAQP;AAED,iFAAiF;AACjF,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,YAAY,EACnB,WAAW,EAAE,SAAS,EAAE,EACxB,YAAY,EAAE,MAAM,GACnB,MAAM,CAGR;AA6BD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,SAAS,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,SAAS,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,YAAY,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,0EAA0E;AAC1E,wBAAsB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAa3E;AAED,MA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