nimai-cli 0.2.0 → 0.2.2
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.
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve a spec path: use provided path, or auto-discover from cwd.
|
|
3
|
+
* - 1 spec found → use it automatically (print which file)
|
|
4
|
+
* - Multiple found → prompt user to pick (TTY) or error (non-TTY)
|
|
5
|
+
* - 0 found → error
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveSpecPath(provided: string | undefined): Promise<string>;
|
|
8
|
+
//# sourceMappingURL=resolve-spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-spec.d.ts","sourceRoot":"","sources":["../../src/commands/resolve-spec.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CA+BnF"}
|
|
@@ -0,0 +1,88 @@
|
|
|
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.resolveSpecPath = resolveSpecPath;
|
|
37
|
+
const readline = __importStar(require("readline"));
|
|
38
|
+
const nimai_core_1 = require("nimai-core");
|
|
39
|
+
/**
|
|
40
|
+
* Resolve a spec path: use provided path, or auto-discover from cwd.
|
|
41
|
+
* - 1 spec found → use it automatically (print which file)
|
|
42
|
+
* - Multiple found → prompt user to pick (TTY) or error (non-TTY)
|
|
43
|
+
* - 0 found → error
|
|
44
|
+
*/
|
|
45
|
+
async function resolveSpecPath(provided) {
|
|
46
|
+
if (provided)
|
|
47
|
+
return provided;
|
|
48
|
+
const specs = (0, nimai_core_1.findNimaiSpecs)(process.cwd());
|
|
49
|
+
if (specs.length === 0) {
|
|
50
|
+
console.error('Error: no spec file specified and no nimai specs found in this directory.\n' +
|
|
51
|
+
'Pass a spec path directly, or create one with: nimai new <output.md>');
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
if (specs.length === 1) {
|
|
55
|
+
console.error(`Using spec: ${specs[0].filePath}${specs[0].date ? ` (${specs[0].date})` : ''}`);
|
|
56
|
+
return specs[0].filePath;
|
|
57
|
+
}
|
|
58
|
+
// Multiple specs — prompt if TTY, error if not
|
|
59
|
+
if (!process.stdin.isTTY) {
|
|
60
|
+
console.error('Error: multiple nimai specs found — pass a path explicitly:\n' +
|
|
61
|
+
specs.map(s => ` ${s.filePath}${s.date ? ` (${s.date})` : ''}`).join('\n'));
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
return promptPick(specs.map(s => ({
|
|
65
|
+
label: `${s.filePath}${s.date ? ` (${s.date})` : ''}`,
|
|
66
|
+
value: s.filePath,
|
|
67
|
+
})));
|
|
68
|
+
}
|
|
69
|
+
async function promptPick(options) {
|
|
70
|
+
console.error('\nMultiple nimai specs found — pick one:\n');
|
|
71
|
+
options.forEach((o, i) => console.error(` ${i + 1}. ${o.label}`));
|
|
72
|
+
console.error('');
|
|
73
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
|
|
74
|
+
return new Promise(resolve => {
|
|
75
|
+
rl.question('Enter number: ', answer => {
|
|
76
|
+
rl.close();
|
|
77
|
+
const idx = parseInt(answer.trim(), 10) - 1;
|
|
78
|
+
if (idx >= 0 && idx < options.length) {
|
|
79
|
+
resolve(options[idx].value);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
console.error('Invalid selection.');
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=resolve-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-spec.js","sourceRoot":"","sources":["../../src/commands/resolve-spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,0CA+BC;AAxCD,mDAAqC;AACrC,2CAA4C;AAE5C;;;;;GAKG;AACI,KAAK,UAAU,eAAe,CAAC,QAA4B;IAChE,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAE9B,MAAM,KAAK,GA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C,CAAC,QAAQ;KAClB,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,OAA2C;IACnE,OAAO,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAC5D,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACnE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAElB,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACtF,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QAC3B,EAAE,CAAC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC,EAAE;YACrC,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;YAC5C,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;gBACrC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;gBACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,11 +7,14 @@ const validate_1 = require("./commands/validate");
|
|
|
7
7
|
const review_1 = require("./commands/review");
|
|
8
8
|
const new_1 = require("./commands/new");
|
|
9
9
|
const spec_review_1 = require("./commands/spec-review");
|
|
10
|
+
const resolve_spec_1 = require("./commands/resolve-spec");
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
12
|
+
const { version } = require('../package.json');
|
|
10
13
|
const program = new commander_1.Command();
|
|
11
14
|
program
|
|
12
15
|
.name('nimai')
|
|
13
16
|
.description('Nimai — spec ops CLI for AI work\n\nCommands: spec, validate, review, spec-review, new\nPlanned (M3b): nimai run — execute a spec end-to-end (deferred pending usage data)')
|
|
14
|
-
.version(
|
|
17
|
+
.version(version, '-v, --version');
|
|
15
18
|
program
|
|
16
19
|
.command('spec <request>')
|
|
17
20
|
.description('Generate a FORGE spec from a loose request')
|
|
@@ -37,25 +40,28 @@ program
|
|
|
37
40
|
});
|
|
38
41
|
});
|
|
39
42
|
program
|
|
40
|
-
.command('validate
|
|
43
|
+
.command('validate [specPath]')
|
|
41
44
|
.description('Lint a spec file for unresolved fields, NHFI flags, and missing sections')
|
|
42
45
|
.option('--strict-architecture', 'Treat advisory architecture warnings as errors (exits 1)')
|
|
43
|
-
.action((specPath, options) => {
|
|
44
|
-
(0,
|
|
46
|
+
.action(async (specPath, options) => {
|
|
47
|
+
const resolved = await (0, resolve_spec_1.resolveSpecPath)(specPath);
|
|
48
|
+
(0, validate_1.runValidate)(resolved, { strictArchitecture: !!options.strictArchitecture });
|
|
45
49
|
});
|
|
46
50
|
program
|
|
47
|
-
.command('review
|
|
51
|
+
.command('review [specPath]')
|
|
48
52
|
.description('Generate a FORGE reviewer/validator prompt from an approved spec')
|
|
49
53
|
.option('--out <file>', 'Write reviewer prompt to file instead of stdout')
|
|
50
|
-
.action((specPath, options) => {
|
|
51
|
-
(0,
|
|
54
|
+
.action(async (specPath, options) => {
|
|
55
|
+
const resolved = await (0, resolve_spec_1.resolveSpecPath)(specPath);
|
|
56
|
+
(0, review_1.runReview)(resolved, { out: options.out });
|
|
52
57
|
});
|
|
53
58
|
program
|
|
54
|
-
.command('spec-review
|
|
59
|
+
.command('spec-review [specPath]')
|
|
55
60
|
.description('Generate a FORGE Prompt 1.5 (Spec-Quality Reviewer) for a draft spec')
|
|
56
61
|
.option('--out <file>', 'Write reviewer prompt to file instead of stdout')
|
|
57
|
-
.action((specPath, options) => {
|
|
58
|
-
(0,
|
|
62
|
+
.action(async (specPath, options) => {
|
|
63
|
+
const resolved = await (0, resolve_spec_1.resolveSpecPath)(specPath);
|
|
64
|
+
(0, spec_review_1.runSpecReview)(resolved, { out: options.out });
|
|
59
65
|
});
|
|
60
66
|
program
|
|
61
67
|
.command('new <outputPath>')
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,yCAAoC;AACpC,0CAA0C;AAC1C,kDAAkD;AAClD,8CAA8C;AAC9C,wCAAwC;AACxC,wDAAuD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,yCAAoC;AACpC,0CAA0C;AAC1C,kDAAkD;AAClD,8CAA8C;AAC9C,wCAAwC;AACxC,wDAAuD;AACvD,0DAA0D;AAE1D,iEAAiE;AACjE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AAEtE,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,4KAA4K,CAAC;KACzL,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;AAErC,OAAO;KACJ,OAAO,CAAC,gBAAgB,CAAC;KACzB,WAAW,CAAC,4CAA4C,CAAC;KACzD,MAAM,CAAC,UAAU,EAAE,kEAAkE,CAAC;KACtF,MAAM,CAAC,cAAc,EAAE,oDAAoD,CAAC;KAC5E,MAAM,CAAC,eAAe,EAAE,oDAAoD,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;KAC5F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imai spec, review, validate, and new.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nimai",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"js-yaml": "^4.1.1",
|
|
42
42
|
"zod": "^3.25.76",
|
|
43
43
|
"nimai-core": "0.2.0",
|
|
44
|
-
"nimai-mcp": "0.2.
|
|
44
|
+
"nimai-mcp": "0.2.2"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "tsc",
|