@orqint/cli 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.
- package/AGENTS.md +26 -0
- package/README.md +104 -0
- package/dist/orqint/commands/init.d.ts +6 -0
- package/dist/orqint/commands/init.js +133 -0
- package/dist/orqint/commands/plan.d.ts +7 -0
- package/dist/orqint/commands/plan.js +138 -0
- package/dist/orqint/commands/think.d.ts +8 -0
- package/dist/orqint/commands/think.js +141 -0
- package/dist/orqint/commands/update.d.ts +5 -0
- package/dist/orqint/commands/update.js +64 -0
- package/dist/orqint/engine/confidence.d.ts +10 -0
- package/dist/orqint/engine/confidence.js +29 -0
- package/dist/orqint/engine/context.d.ts +4 -0
- package/dist/orqint/engine/context.js +38 -0
- package/dist/orqint/engine/handoff.d.ts +82 -0
- package/dist/orqint/engine/handoff.js +144 -0
- package/dist/orqint/engine/paths.d.ts +6 -0
- package/dist/orqint/engine/paths.js +60 -0
- package/dist/orqint/index.d.ts +2 -0
- package/dist/orqint/index.js +192 -0
- package/dist/orqint/package-meta.d.ts +8 -0
- package/dist/orqint/package-meta.js +55 -0
- package/dist/orqint/prompts/intent.txt +29 -0
- package/dist/orqint/prompts/plan.txt +27 -0
- package/dist/orqint/types/memory.d.ts +49 -0
- package/dist/orqint/types/memory.js +3 -0
- package/dist/orqint/utils/logger.d.ts +2 -0
- package/dist/orqint/utils/logger.js +12 -0
- package/dist/orqint/utils/memory.d.ts +8 -0
- package/dist/orqint/utils/memory.js +157 -0
- package/dist/orqint/utils/parser.d.ts +4 -0
- package/dist/orqint/utils/parser.js +38 -0
- package/package.json +43 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { OrqintMemory } from "../types/memory";
|
|
2
|
+
/** FR-007: minimal slices for Cursor handoffs (no full memory by default). */
|
|
3
|
+
export declare function sliceForThink(memory: OrqintMemory, userIntent: string): Record<string, unknown>;
|
|
4
|
+
export declare function sliceForPlan(memory: OrqintMemory): Record<string, unknown>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sliceForThink = sliceForThink;
|
|
4
|
+
exports.sliceForPlan = sliceForPlan;
|
|
5
|
+
/** FR-007: minimal slices for Cursor handoffs (no full memory by default). */
|
|
6
|
+
function sliceForThink(memory, userIntent) {
|
|
7
|
+
return {
|
|
8
|
+
user_intent: userIntent,
|
|
9
|
+
project: memory.project,
|
|
10
|
+
goals: memory.goals,
|
|
11
|
+
open_questions: memory.open_questions,
|
|
12
|
+
confidence: memory.confidence,
|
|
13
|
+
unknowns: memory.unknowns,
|
|
14
|
+
requires_input: memory.requires_input,
|
|
15
|
+
override: memory.override,
|
|
16
|
+
rules: memory.rules,
|
|
17
|
+
decisions: memory.decisions,
|
|
18
|
+
tech_stack: memory.tech_stack,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function sliceForPlan(memory) {
|
|
22
|
+
return {
|
|
23
|
+
project: memory.project,
|
|
24
|
+
goals: memory.goals,
|
|
25
|
+
features: memory.features,
|
|
26
|
+
pages: memory.pages,
|
|
27
|
+
flows: memory.flows,
|
|
28
|
+
states: memory.states,
|
|
29
|
+
edge_cases: memory.edge_cases,
|
|
30
|
+
override: memory.override,
|
|
31
|
+
rules: memory.rules,
|
|
32
|
+
decisions: memory.decisions,
|
|
33
|
+
tech_stack: memory.tech_stack,
|
|
34
|
+
design_system: memory.design_system,
|
|
35
|
+
confidence: memory.confidence,
|
|
36
|
+
open_questions: memory.open_questions,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export declare const THINK_RESPONSE_SCHEMA: {
|
|
2
|
+
readonly type: "object";
|
|
3
|
+
readonly required: readonly ["confidence", "open_questions"];
|
|
4
|
+
readonly properties: {
|
|
5
|
+
readonly project: {
|
|
6
|
+
readonly type: "object";
|
|
7
|
+
readonly properties: {
|
|
8
|
+
readonly name: {
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
};
|
|
11
|
+
readonly type: {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
};
|
|
14
|
+
readonly description: {
|
|
15
|
+
readonly type: "string";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
readonly project_type: {
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
readonly description: "If set, merged into project.type when project.type empty or overridden by analysis";
|
|
22
|
+
};
|
|
23
|
+
readonly goals: {
|
|
24
|
+
readonly type: "array";
|
|
25
|
+
readonly items: {
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
readonly open_questions: {
|
|
30
|
+
readonly type: "array";
|
|
31
|
+
readonly maxItems: 5;
|
|
32
|
+
readonly items: {
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
};
|
|
35
|
+
readonly description: "Max 5 high-value questions (PRD §3.1)";
|
|
36
|
+
};
|
|
37
|
+
readonly confidence: {
|
|
38
|
+
readonly type: "number";
|
|
39
|
+
readonly minimum: 0;
|
|
40
|
+
readonly maximum: 1;
|
|
41
|
+
};
|
|
42
|
+
readonly unknowns: {
|
|
43
|
+
readonly type: "array";
|
|
44
|
+
readonly items: {
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
readonly requires_input: {
|
|
49
|
+
readonly type: "boolean";
|
|
50
|
+
};
|
|
51
|
+
readonly tech_stack: {
|
|
52
|
+
readonly type: "object";
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export declare const PLAN_RESPONSE_SCHEMA: {
|
|
57
|
+
readonly type: "object";
|
|
58
|
+
readonly required: readonly ["features", "flows", "pages", "states"];
|
|
59
|
+
readonly properties: {
|
|
60
|
+
readonly features: {
|
|
61
|
+
readonly type: "array";
|
|
62
|
+
};
|
|
63
|
+
readonly flows: {
|
|
64
|
+
readonly type: "array";
|
|
65
|
+
};
|
|
66
|
+
readonly pages: {
|
|
67
|
+
readonly type: "array";
|
|
68
|
+
};
|
|
69
|
+
readonly states: {
|
|
70
|
+
readonly type: "array";
|
|
71
|
+
};
|
|
72
|
+
readonly edge_cases: {
|
|
73
|
+
readonly type: "array";
|
|
74
|
+
readonly items: {
|
|
75
|
+
readonly type: "string";
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
export declare function loadPromptTemplate(cwd: string, name: "intent.txt" | "plan.txt"): Promise<string>;
|
|
81
|
+
export declare function writeThinkHandoff(cwd: string, userIntent: string, slicedMemory: Record<string, unknown>): Promise<string>;
|
|
82
|
+
export declare function writePlanHandoff(cwd: string, slicedMemory: Record<string, unknown>): Promise<string>;
|
|
@@ -0,0 +1,144 @@
|
|
|
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.PLAN_RESPONSE_SCHEMA = exports.THINK_RESPONSE_SCHEMA = void 0;
|
|
37
|
+
exports.loadPromptTemplate = loadPromptTemplate;
|
|
38
|
+
exports.writeThinkHandoff = writeThinkHandoff;
|
|
39
|
+
exports.writePlanHandoff = writePlanHandoff;
|
|
40
|
+
const fs = __importStar(require("fs-extra"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
const paths_1 = require("./paths");
|
|
43
|
+
exports.THINK_RESPONSE_SCHEMA = {
|
|
44
|
+
type: "object",
|
|
45
|
+
required: ["confidence", "open_questions"],
|
|
46
|
+
properties: {
|
|
47
|
+
project: {
|
|
48
|
+
type: "object",
|
|
49
|
+
properties: {
|
|
50
|
+
name: { type: "string" },
|
|
51
|
+
type: { type: "string" },
|
|
52
|
+
description: { type: "string" },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
project_type: {
|
|
56
|
+
type: "string",
|
|
57
|
+
description: "If set, merged into project.type when project.type empty or overridden by analysis",
|
|
58
|
+
},
|
|
59
|
+
goals: { type: "array", items: { type: "string" } },
|
|
60
|
+
open_questions: {
|
|
61
|
+
type: "array",
|
|
62
|
+
maxItems: 5,
|
|
63
|
+
items: { type: "string" },
|
|
64
|
+
description: "Max 5 high-value questions (PRD §3.1)",
|
|
65
|
+
},
|
|
66
|
+
confidence: { type: "number", minimum: 0, maximum: 1 },
|
|
67
|
+
unknowns: { type: "array", items: { type: "string" } },
|
|
68
|
+
requires_input: { type: "boolean" },
|
|
69
|
+
tech_stack: { type: "object" },
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
exports.PLAN_RESPONSE_SCHEMA = {
|
|
73
|
+
type: "object",
|
|
74
|
+
required: ["features", "flows", "pages", "states"],
|
|
75
|
+
properties: {
|
|
76
|
+
features: { type: "array" },
|
|
77
|
+
flows: { type: "array" },
|
|
78
|
+
pages: { type: "array" },
|
|
79
|
+
states: { type: "array" },
|
|
80
|
+
edge_cases: { type: "array", items: { type: "string" } },
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
async function loadPromptTemplate(cwd, name) {
|
|
84
|
+
const p = path.join((0, paths_1.promptsDir)(cwd), name);
|
|
85
|
+
const exists = await fs.pathExists(p);
|
|
86
|
+
if (!exists) {
|
|
87
|
+
throw new Error(`Missing prompt template: ${p}`);
|
|
88
|
+
}
|
|
89
|
+
return fs.readFile(p, "utf8");
|
|
90
|
+
}
|
|
91
|
+
function substitute(template, vars) {
|
|
92
|
+
let out = template;
|
|
93
|
+
for (const [k, v] of Object.entries(vars)) {
|
|
94
|
+
out = out.split(`{{${k}}}`).join(v);
|
|
95
|
+
}
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
async function writeThinkHandoff(cwd, userIntent, slicedMemory) {
|
|
99
|
+
await fs.ensureDir((0, paths_1.handoffDir)(cwd));
|
|
100
|
+
const intentTpl = await loadPromptTemplate(cwd, "intent.txt");
|
|
101
|
+
const body = substitute(intentTpl, {
|
|
102
|
+
input: userIntent,
|
|
103
|
+
sliced_memory: JSON.stringify(slicedMemory, null, 2),
|
|
104
|
+
response_schema: JSON.stringify(exports.THINK_RESPONSE_SCHEMA, null, 2),
|
|
105
|
+
});
|
|
106
|
+
const full = `# Orqint think handoff
|
|
107
|
+
|
|
108
|
+
Save your **final answer** as JSON only to \`orqint/.handoff/think.response.json\`, then run:
|
|
109
|
+
|
|
110
|
+
\`\`\`
|
|
111
|
+
orqint think apply --file orqint/.handoff/think.response.json
|
|
112
|
+
\`\`\`
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
${body}
|
|
117
|
+
`;
|
|
118
|
+
const outPath = path.join((0, paths_1.handoffDir)(cwd), "think.md");
|
|
119
|
+
await fs.writeFile(outPath, full, "utf8");
|
|
120
|
+
return outPath;
|
|
121
|
+
}
|
|
122
|
+
async function writePlanHandoff(cwd, slicedMemory) {
|
|
123
|
+
await fs.ensureDir((0, paths_1.handoffDir)(cwd));
|
|
124
|
+
const planTpl = await loadPromptTemplate(cwd, "plan.txt");
|
|
125
|
+
const body = substitute(planTpl, {
|
|
126
|
+
sliced_memory: JSON.stringify(slicedMemory, null, 2),
|
|
127
|
+
response_schema: JSON.stringify(exports.PLAN_RESPONSE_SCHEMA, null, 2),
|
|
128
|
+
});
|
|
129
|
+
const full = `# Orqint plan handoff
|
|
130
|
+
|
|
131
|
+
Save your **final answer** as JSON only to \`orqint/.handoff/plan.response.json\`, then run:
|
|
132
|
+
|
|
133
|
+
\`\`\`
|
|
134
|
+
orqint plan apply --file orqint/.handoff/plan.response.json
|
|
135
|
+
\`\`\`
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
${body}
|
|
140
|
+
`;
|
|
141
|
+
const outPath = path.join((0, paths_1.handoffDir)(cwd), "plan.md");
|
|
142
|
+
await fs.writeFile(outPath, full, "utf8");
|
|
143
|
+
return outPath;
|
|
144
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function orqintRoot(cwd: string): string;
|
|
2
|
+
export declare function memoryJsonPath(cwd: string): string;
|
|
3
|
+
export declare function handoffDir(cwd: string): string;
|
|
4
|
+
export declare function promptsDir(cwd: string): string;
|
|
5
|
+
export declare function orqintSpecDir(cwd: string): string;
|
|
6
|
+
export declare function orqintArchiveDir(cwd: string): string;
|
|
@@ -0,0 +1,60 @@
|
|
|
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.orqintRoot = orqintRoot;
|
|
37
|
+
exports.memoryJsonPath = memoryJsonPath;
|
|
38
|
+
exports.handoffDir = handoffDir;
|
|
39
|
+
exports.promptsDir = promptsDir;
|
|
40
|
+
exports.orqintSpecDir = orqintSpecDir;
|
|
41
|
+
exports.orqintArchiveDir = orqintArchiveDir;
|
|
42
|
+
const path = __importStar(require("path"));
|
|
43
|
+
function orqintRoot(cwd) {
|
|
44
|
+
return path.join(cwd, "orqint");
|
|
45
|
+
}
|
|
46
|
+
function memoryJsonPath(cwd) {
|
|
47
|
+
return path.join(orqintRoot(cwd), "core", "memory.json");
|
|
48
|
+
}
|
|
49
|
+
function handoffDir(cwd) {
|
|
50
|
+
return path.join(orqintRoot(cwd), ".handoff");
|
|
51
|
+
}
|
|
52
|
+
function promptsDir(cwd) {
|
|
53
|
+
return path.join(orqintRoot(cwd), "prompts");
|
|
54
|
+
}
|
|
55
|
+
function orqintSpecDir(cwd) {
|
|
56
|
+
return path.join(cwd, "orqint-spec");
|
|
57
|
+
}
|
|
58
|
+
function orqintArchiveDir(cwd) {
|
|
59
|
+
return path.join(cwd, "orqint-archive");
|
|
60
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const init_1 = require("./commands/init");
|
|
39
|
+
const think_1 = require("./commands/think");
|
|
40
|
+
const plan_1 = require("./commands/plan");
|
|
41
|
+
const package_meta_1 = require("./package-meta");
|
|
42
|
+
const update_1 = require("./commands/update");
|
|
43
|
+
function printHelp() {
|
|
44
|
+
const { name, version } = (0, package_meta_1.readPackageMeta)();
|
|
45
|
+
console.log(`${name} ${version} — Phase 1 (Cursor-native)
|
|
46
|
+
|
|
47
|
+
No model API keys in this tool: use Cursor on the generated handoff files, then apply JSON.
|
|
48
|
+
|
|
49
|
+
Commands:
|
|
50
|
+
orqint version | --version | -V
|
|
51
|
+
orqint update [--install] [<args>...] check npm; --install runs npx ${name}@latest <args>
|
|
52
|
+
orqint init [--brownfield] [--migrate-legacy] [--force]
|
|
53
|
+
orqint think prepare "<intent>" [--override key=value ...]
|
|
54
|
+
orqint think apply --file <path>
|
|
55
|
+
orqint plan prepare [--force]
|
|
56
|
+
orqint plan apply --file <path> [--force]
|
|
57
|
+
|
|
58
|
+
Examples:
|
|
59
|
+
orqint init --brownfield
|
|
60
|
+
orqint think prepare "Build a task dashboard" --override mobile_first=true
|
|
61
|
+
orqint think apply --file orqint/.handoff/think.response.json
|
|
62
|
+
orqint plan prepare
|
|
63
|
+
orqint plan apply --file orqint/.handoff/plan.response.json
|
|
64
|
+
`);
|
|
65
|
+
}
|
|
66
|
+
function parseOverrideArgs(args) {
|
|
67
|
+
const overrides = {};
|
|
68
|
+
const rest = [];
|
|
69
|
+
for (let i = 0; i < args.length; i++) {
|
|
70
|
+
if (args[i] === "--override" && args[i + 1]) {
|
|
71
|
+
const raw = args[++i];
|
|
72
|
+
const eq = raw.indexOf("=");
|
|
73
|
+
if (eq === -1) {
|
|
74
|
+
throw new Error(`--override expects key=value, got: ${raw}`);
|
|
75
|
+
}
|
|
76
|
+
const key = raw.slice(0, eq).trim();
|
|
77
|
+
const val = raw.slice(eq + 1).trim();
|
|
78
|
+
const low = val.toLowerCase();
|
|
79
|
+
overrides[key] =
|
|
80
|
+
low === "true" ? true : low === "false" ? false : val;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
rest.push(args[i]);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return { rest, overrides };
|
|
87
|
+
}
|
|
88
|
+
function takeFlag(args, name) {
|
|
89
|
+
const i = args.indexOf(name);
|
|
90
|
+
if (i === -1) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
args.splice(i, 1);
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
function takeFileArg(args) {
|
|
97
|
+
const i = args.indexOf("--file");
|
|
98
|
+
if (i === -1 || !args[i + 1]) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
const p = args[i + 1];
|
|
102
|
+
args.splice(i, 2);
|
|
103
|
+
return p;
|
|
104
|
+
}
|
|
105
|
+
async function main() {
|
|
106
|
+
const argv = process.argv.slice(2);
|
|
107
|
+
const cwd = process.cwd();
|
|
108
|
+
if (argv.length === 0 || argv[0] === "help" || argv[0] === "--help") {
|
|
109
|
+
printHelp();
|
|
110
|
+
process.exit(0);
|
|
111
|
+
}
|
|
112
|
+
if (argv[0] === "--version" ||
|
|
113
|
+
argv[0] === "-V" ||
|
|
114
|
+
argv[0] === "version") {
|
|
115
|
+
const m = (0, package_meta_1.readPackageMeta)();
|
|
116
|
+
console.log(`${m.version}`);
|
|
117
|
+
process.exit(0);
|
|
118
|
+
}
|
|
119
|
+
const cmd = argv[0];
|
|
120
|
+
try {
|
|
121
|
+
if (cmd === "update") {
|
|
122
|
+
const rest = argv.slice(1);
|
|
123
|
+
const install = takeFlag(rest, "--install");
|
|
124
|
+
(0, update_1.runUpdate)((0, package_meta_1.readPackageMeta)(), install, rest);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (cmd === "init") {
|
|
128
|
+
const args = argv.slice(1);
|
|
129
|
+
await (0, init_1.runInit)(cwd, {
|
|
130
|
+
force: takeFlag(args, "--force"),
|
|
131
|
+
brownfield: takeFlag(args, "--brownfield"),
|
|
132
|
+
migrateLegacy: takeFlag(args, "--migrate-legacy"),
|
|
133
|
+
});
|
|
134
|
+
console.error("Orqint initialized.");
|
|
135
|
+
process.exit(0);
|
|
136
|
+
}
|
|
137
|
+
if (cmd === "think" && argv[1] === "prepare") {
|
|
138
|
+
const { rest, overrides } = parseOverrideArgs(argv.slice(2));
|
|
139
|
+
const intent = rest.join(" ").trim();
|
|
140
|
+
if (!intent) {
|
|
141
|
+
throw new Error('Missing intent text after "think prepare"');
|
|
142
|
+
}
|
|
143
|
+
const { handoffPath } = await (0, think_1.thinkPrepare)(cwd, intent, overrides);
|
|
144
|
+
console.error(`Handoff written: ${handoffPath}`);
|
|
145
|
+
console.log(handoffPath);
|
|
146
|
+
process.exit(0);
|
|
147
|
+
}
|
|
148
|
+
if (cmd === "think" && argv[1] === "apply") {
|
|
149
|
+
const args = argv.slice(2);
|
|
150
|
+
const file = takeFileArg(args);
|
|
151
|
+
if (!file) {
|
|
152
|
+
throw new Error("think apply requires --file <path>");
|
|
153
|
+
}
|
|
154
|
+
const abs = path.isAbsolute(file) ? file : path.join(cwd, file);
|
|
155
|
+
const { exitCode, messages } = await (0, think_1.thinkApply)(cwd, abs);
|
|
156
|
+
for (const m of messages) {
|
|
157
|
+
console.error(m);
|
|
158
|
+
}
|
|
159
|
+
process.exit(exitCode);
|
|
160
|
+
}
|
|
161
|
+
if (cmd === "plan" && argv[1] === "prepare") {
|
|
162
|
+
const args = argv.slice(2);
|
|
163
|
+
const force = takeFlag(args, "--force");
|
|
164
|
+
const { handoffPath } = force
|
|
165
|
+
? await (0, plan_1.planPrepareAllowLowConfidence)(cwd)
|
|
166
|
+
: await (0, plan_1.planPrepare)(cwd);
|
|
167
|
+
console.error(`Handoff written: ${handoffPath}`);
|
|
168
|
+
console.log(handoffPath);
|
|
169
|
+
process.exit(0);
|
|
170
|
+
}
|
|
171
|
+
if (cmd === "plan" && argv[1] === "apply") {
|
|
172
|
+
const args = argv.slice(2);
|
|
173
|
+
const force = takeFlag(args, "--force");
|
|
174
|
+
const file = takeFileArg(args);
|
|
175
|
+
if (!file) {
|
|
176
|
+
throw new Error("plan apply requires --file <path>");
|
|
177
|
+
}
|
|
178
|
+
const abs = path.isAbsolute(file) ? file : path.join(cwd, file);
|
|
179
|
+
await (0, plan_1.planApply)(cwd, abs, force);
|
|
180
|
+
console.error("Plan merged into memory and orqint-spec/ updated.");
|
|
181
|
+
process.exit(0);
|
|
182
|
+
}
|
|
183
|
+
printHelp();
|
|
184
|
+
process.exit(1);
|
|
185
|
+
}
|
|
186
|
+
catch (e) {
|
|
187
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
188
|
+
console.error(msg);
|
|
189
|
+
process.exit(1);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
void main();
|
|
@@ -0,0 +1,55 @@
|
|
|
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.readPackageMeta = readPackageMeta;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
/**
|
|
40
|
+
* Resolves the published package root (contains package.json next to dist/).
|
|
41
|
+
*/
|
|
42
|
+
function readPackageMeta() {
|
|
43
|
+
const pkgPath = path.join(__dirname, "..", "..", "package.json");
|
|
44
|
+
try {
|
|
45
|
+
const raw = fs.readFileSync(pkgPath, "utf8");
|
|
46
|
+
const pkg = JSON.parse(raw);
|
|
47
|
+
return {
|
|
48
|
+
name: typeof pkg.name === "string" ? pkg.name : "@orqint/cli",
|
|
49
|
+
version: typeof pkg.version === "string" ? pkg.version : "0.0.0",
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return { name: "@orqint/cli", version: "0.0.0-dev" };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
You are an expert product architect. The user runs you inside **Cursor** as the Orqint intent step.
|
|
2
|
+
|
|
3
|
+
## Human overrides (absolute — CGR-012)
|
|
4
|
+
|
|
5
|
+
These constraints from memory override your defaults. If `override` is non-empty in the sliced memory JSON, obey every key (e.g. no_supabase, mobile_first).
|
|
6
|
+
|
|
7
|
+
## Sliced memory (context)
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{{sliced_memory}}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## User intent
|
|
14
|
+
|
|
15
|
+
{{input}}
|
|
16
|
+
|
|
17
|
+
## Your task
|
|
18
|
+
|
|
19
|
+
1. Refine understanding of the product: `project` (name, type, optional description), `goals`.
|
|
20
|
+
2. Propose `tech_stack` patches only when justified by the intent and existing memory; respect overrides.
|
|
21
|
+
3. Set `confidence` between 0 and 1.
|
|
22
|
+
4. List at most **five** focused `open_questions` when confidence is below 0.8 or when critical forks remain; otherwise use an empty array or fewer.
|
|
23
|
+
5. Set `unknowns` (strings) and `requires_input` when the user must answer before planning.
|
|
24
|
+
|
|
25
|
+
## Response schema (return JSON only — no markdown)
|
|
26
|
+
|
|
27
|
+
Match this structure (types as described):
|
|
28
|
+
|
|
29
|
+
{{response_schema}}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
You are an expert product and UX architect. The user runs you inside **Cursor** as the Orqint **plan** step.
|
|
2
|
+
|
|
3
|
+
## Human overrides (absolute — CGR-012)
|
|
4
|
+
|
|
5
|
+
Obey every entry in `override` from the sliced memory below.
|
|
6
|
+
|
|
7
|
+
## Sliced memory
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{{sliced_memory}}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Your task
|
|
14
|
+
|
|
15
|
+
From the memory slice, produce or refresh:
|
|
16
|
+
|
|
17
|
+
- `features` — discrete, verifiable product capabilities
|
|
18
|
+
- `flows` — user or system flows
|
|
19
|
+
- `pages` — page-level or screen-level structure where applicable
|
|
20
|
+
- `states` — notable UI/state-machine notes
|
|
21
|
+
- `edge_cases` — important edge cases (array of strings)
|
|
22
|
+
|
|
23
|
+
Keep outputs structured (objects/strings in arrays) so the CLI can merge them into `memory.json`.
|
|
24
|
+
|
|
25
|
+
## Response schema (return JSON only — no markdown)
|
|
26
|
+
|
|
27
|
+
{{response_schema}}
|