intent-format 1.2.0 → 1.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.
package/CHANGELOG.md CHANGED
@@ -56,6 +56,8 @@ published.
56
56
  - hotfix 2026-11-14: decisions take an optional `## History` section after `Affects`: dated lines added after the decision (`- <date> · <what happened> · <source>`), so a decided Outcome is never edited (spec S-TYPE-12).
57
57
  - hotfix 2026-11-14: `scaffold` reads every inventory table with Type, Name and Core columns; an inventory split into sections is no longer scaffolded only in part. `next` and the template say so.
58
58
  - hotfix 2026-11-15: CONTRIBUTING says what a release that changes the shape of files owes: its step in `intent-format migrate` and a small project of the previous version as a test. A .gitignore for local files.
59
+ - hotfix 2026-11-17: on npm. `npx intent-format@1.2 check ./my-kb` runs the CLI from the package `intent-format` (npm version 1.2.1); `npx github:intentstudiodev/intent-format#v1.2` keeps working.
60
+ - hotfix 2026-11-29: `intent-format init` works on its own: run in a folder, it sets up the knowledge base there, `<root>` defaulting to the current folder and `--name` to the folder's name ("my-product" → "My product"), with a line saying how to rename. Before, `init` alone printed only its usage line, while the website says "run it in any folder". Both arguments work as before.
59
61
 
60
62
  ## 1.0 (2026-10-20) — first public release
61
63
 
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Intent Format 1.2
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/intent-format)](https://www.npmjs.com/package/intent-format) [![downloads](https://img.shields.io/npm/dw/intent-format)](https://www.npmjs.com/package/intent-format)
4
+
3
5
  Intent Format is a format for the knowledge base (KB) of a software product, written as plain
4
6
  Markdown. Every user type, screen, shell, component, user flow, IA map, rule, API, feature, edge case, backend
5
7
  node, technology, decision and comment is one **card** — one file — and cards link to each
@@ -23,9 +25,8 @@ every change is listed in `CHANGELOG.md`.
23
25
 
24
26
  - **Download:** every version is on the [Releases](https://github.com/intentstudiodev/intent-format/releases)
25
27
  page; the newest is marked *Latest*. Older versions stay available.
26
- - **Run the CLI without installing** (Node 18 or later):
27
- `npx github:intentstudiodev/intent-format#v1.2 check ./my-kb` — leave out `#…` for the
28
- latest version.
28
+ - **Run the CLI without installing** (Node 18 or later), from npm:
29
+ `npx intent-format@1.2 check ./my-kb` — leave out `@…` for the latest version.
29
30
  - **Versions:** two numbers. `1.x` for fixes and additions that keep existing KBs valid, `2.0` for
30
31
  changes that need `intent-format migrate`. A KB names the version it follows in its
31
32
  `intent-format.md`: `standard: IntentFormat/1.2`; any later `1.x` reads it. (`package.json` carries a third
@@ -25,10 +25,12 @@ const HELP = `intent-format — Intent Format knowledge-base tool
25
25
  Usage: node <standard>/kit/cli/intent-format.mjs <command> [arguments]
26
26
 
27
27
  Commands
28
- init <root> --name "<Name>" [--kb <slug>] [--version 1.0] [--lifecycle in-progress] [--modules a,b]
28
+ init [<root>] [--name "<Name>"] [--kb <slug>] [--version 1.0] [--lifecycle in-progress] [--modules a,b]
29
29
  Create a project root (_index.md, _ids.md, inputs/links.md), the workspace
30
30
  V<version>/ with intent-format.md, project.md and module folders; then regen.
31
- <root> may already exist (e.g. with inputs/); refuses if it holds a manifest.
31
+ <root> defaults to the current folder; --name defaults to the root folder's name
32
+ ("my-product" → "My product"). <root> may already exist (e.g. with inputs/);
33
+ refuses if it holds a manifest.
32
34
  new <type> "<Name>" --root <root> [--ws V1.0] [--feature FT…] [--state <State>] [--parent FT…]
33
35
  Mint a core and write the card from its template. Prints "<core> <path>".
34
36
  scaffold <root> --inventory <file> [--ws V1.0]
@@ -125,10 +127,18 @@ function regenProject(S, root, log = console.log) {
125
127
 
126
128
  /* ---------------- commands ---------------- */
127
129
 
130
+ // A product name from a folder name: "my-product" → "My product" (owner, 2026-11-29: `npx intent-format init` alone
131
+ // must install into the folder it runs in, the folder the agent was opened in).
132
+ const nameFromFolder = (abs) => {
133
+ const words = path.basename(abs).replace(/[-_.]+/g, ' ').replace(/\s+/g, ' ').trim();
134
+ return words ? words[0].toUpperCase() + words.slice(1) : '';
135
+ };
136
+
128
137
  function cmdInit(S, pos, f) {
129
- const root = pos[0];
130
- if (!root || !f.name) throw new Usage('init <root> --name "<Name>" [--kb <slug>] [--version 1.0] [--lifecycle in-progress] [--modules a,b]');
131
- const name = String(f.name).trim();
138
+ const root = pos[0] || '.';
139
+ const fromFolder = !f.name;
140
+ const name = String(f.name || nameFromFolder(path.resolve(root))).trim();
141
+ if (!name) throw new Usage('init [<root>] --name "<Name>" — this folder has no usable name, so give one with --name');
132
142
  if (!name || /[[\]]/.test(name)) throw new Usage('--name must be non-empty and contain no [ or ]');
133
143
  const kb = f.kb || slugify(name, 'kb');
134
144
  if (!S.R.kbSlug.test(kb)) throw new Usage(`--kb "${kb}" is not a slug (a-z, 0-9, -)`);
@@ -162,6 +172,7 @@ function cmdInit(S, pos, f) {
162
172
  fs.writeFileSync(pfile, renderCard(S, 'project', { id: core, name }));
163
173
  }
164
174
  console.log(`initialised ${abs} (V${version} ${lifecycle}, kb ${kb}, ${ordered.length} modules)`);
175
+ if (fromFolder) console.log(`named "${name}" after the folder; to rename, change name: in V${version}/intent-format.md and project.md`);
165
176
  regenProject(S, abs);
166
177
  }
167
178
 
@@ -323,7 +334,7 @@ export function main(argv) {
323
334
  const table = { init: cmdInit, new: cmdNew, scaffold: cmdScaffold, mint: cmdMint, check: cmdCheck, regen: cmdRegen, branch: cmdBranch, next: cmdNext, frame: cmdFrame, migrate: cmdMigrate, open: cmdOpen, 'build-kit': cmdBuildKit };
324
335
  if (!table[cmd]) { console.error(`unknown command "${cmd}"\n\n${HELP}`); return 2; }
325
336
  // writing commands hold the project lock: parallel agents on one project take turns
326
- const writes = { init: pos[0], new: args.flags.root || '.', scaffold: pos[0] || args.flags.root, mint: args.flags.root || '.', regen: pos[0] || args.flags.root, branch: pos[0], migrate: pos[0] || args.flags.root };
337
+ const writes = { init: pos[0] || '.', new: args.flags.root || '.', scaffold: pos[0] || args.flags.root, mint: args.flags.root || '.', regen: pos[0] || args.flags.root, branch: pos[0], migrate: pos[0] || args.flags.root };
327
338
  try {
328
339
  const run = () => table[cmd](S, pos, args.flags) || 0;
329
340
  return writes[cmd] ? withLock(path.resolve(writes[cmd]), run) : run();
@@ -59,6 +59,15 @@ step('init (existing inputs/ kept)', r.code === 0 && read('inputs/brief.md') ===
59
59
  && fs.existsSync(path.join(R, '_ids.md')) && fs.existsSync(path.join(R, 'V1.0/project.md')), r.err.trim());
60
60
  r = mds('init', R, '--name', 'Example app');
61
61
  step('init refuses an existing manifest', r.code === 1);
62
+ { // `init` alone: the current folder, named after it ("my-product" → "My product")
63
+ const H = path.join(tmp, 'my-product');
64
+ fs.mkdirSync(H);
65
+ const h = spawnSync(process.execPath, [MDS, 'init'], { encoding: 'utf8', cwd: H });
66
+ const manifest = fs.existsSync(path.join(H, 'V1.0/intent-format.md')) ? fs.readFileSync(path.join(H, 'V1.0/intent-format.md'), 'utf8') : '';
67
+ step('init alone uses the current folder and its name', h.status === 0 && /name: "?My product"?/.test(manifest)
68
+ && fs.existsSync(path.join(H, 'V1.0/project.md')) && checkCounts(H).code === 0, (h.stderr || '').trim());
69
+ fs.rmSync(H, { recursive: true, force: true });
70
+ }
62
71
 
63
72
  /* ---------- 2. new cards of every type ---------- */
64
73
  const C = {}; const F = {};
@@ -64,7 +64,7 @@ Don't read the full spec unless a sheet sends you there.
64
64
 
65
65
  | Command | Does |
66
66
  |---|---|
67
- | `intent-format init <root> --name "<Name>" [--lifecycle planned]` | new project root with `V1.0/`, manifest, project card |
67
+ | `intent-format init [<root>] [--name "<Name>"] [--lifecycle planned]` | new project root with `V1.0/`, manifest, project card; root defaults to the current folder, name to its folder name |
68
68
  | `intent-format new <type> "<Name>" --root <root> [--ws V1.0]` | mints a core, creates the card from its template, prints `<core> <path>` |
69
69
  | `intent-format mint <PREFIX> --root <root> [--count n]` | mints cores for flow steps (FS) and variants (SV screen, CV component, HV shell) |
70
70
  | `intent-format scaffold <root> --inventory <file>` | creates every card listed in an inventory table in one call (features first) and writes the cores back |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intent-format",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "A Markdown format for a software product's knowledge base: spec, schema, the intent-format CLI and agent skills.",
5
5
  "type": "module",
6
6
  "bin": {