complexity-cli 1.0.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 (56) hide show
  1. package/Complexity.template.md +38 -0
  2. package/LICENSE +21 -0
  3. package/README.md +173 -0
  4. package/dist/commands/add.d.ts +4 -0
  5. package/dist/commands/add.d.ts.map +1 -0
  6. package/dist/commands/add.js +109 -0
  7. package/dist/commands/add.js.map +1 -0
  8. package/dist/commands/init.d.ts +5 -0
  9. package/dist/commands/init.d.ts.map +1 -0
  10. package/dist/commands/init.js +85 -0
  11. package/dist/commands/init.js.map +1 -0
  12. package/dist/commands/list.d.ts +2 -0
  13. package/dist/commands/list.d.ts.map +1 -0
  14. package/dist/commands/list.js +58 -0
  15. package/dist/commands/list.js.map +1 -0
  16. package/dist/commands/prompt.d.ts +2 -0
  17. package/dist/commands/prompt.d.ts.map +1 -0
  18. package/dist/commands/prompt.js +38 -0
  19. package/dist/commands/prompt.js.map +1 -0
  20. package/dist/commands/remove.d.ts +4 -0
  21. package/dist/commands/remove.d.ts.map +1 -0
  22. package/dist/commands/remove.js +86 -0
  23. package/dist/commands/remove.js.map +1 -0
  24. package/dist/commands/update.d.ts +6 -0
  25. package/dist/commands/update.d.ts.map +1 -0
  26. package/dist/commands/update.js +125 -0
  27. package/dist/commands/update.js.map +1 -0
  28. package/dist/core/generator.d.ts +5 -0
  29. package/dist/core/generator.d.ts.map +1 -0
  30. package/dist/core/generator.js +96 -0
  31. package/dist/core/generator.js.map +1 -0
  32. package/dist/core/parser.d.ts +4 -0
  33. package/dist/core/parser.d.ts.map +1 -0
  34. package/dist/core/parser.js +144 -0
  35. package/dist/core/parser.js.map +1 -0
  36. package/dist/core/validator.d.ts +6 -0
  37. package/dist/core/validator.d.ts.map +1 -0
  38. package/dist/core/validator.js +22 -0
  39. package/dist/core/validator.js.map +1 -0
  40. package/dist/index.d.ts +3 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +48 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/utils/error-helpers.d.ts +4 -0
  45. package/dist/utils/error-helpers.d.ts.map +1 -0
  46. package/dist/utils/error-helpers.js +26 -0
  47. package/dist/utils/error-helpers.js.map +1 -0
  48. package/dist/utils/prompts.d.ts +3 -0
  49. package/dist/utils/prompts.d.ts.map +1 -0
  50. package/dist/utils/prompts.js +37 -0
  51. package/dist/utils/prompts.js.map +1 -0
  52. package/dist/utils/types.d.ts +17 -0
  53. package/dist/utils/types.d.ts.map +1 -0
  54. package/dist/utils/types.js +3 -0
  55. package/dist/utils/types.js.map +1 -0
  56. package/package.json +52 -0
@@ -0,0 +1,38 @@
1
+ # Project Complexity & Knowledge Map
2
+
3
+ <!-- Replace {Project Name} with your project name -->
4
+ A guide to what you need to know to work on {Project Name}, broken into three tiers.
5
+
6
+ > **{X} technologies/concepts** across {Y} areas
7
+ > **{A} critical**
8
+ > **{B} important**
9
+ > **{C} situational**
10
+
11
+ ---
12
+
13
+ ## **What you NEED to know to do any meaningful work**
14
+
15
+ <!-- Criticality 3 items from the table below -->
16
+
17
+ ## **What you SHOULD know to be very helpful**
18
+
19
+ <!-- Everything above, plus Criticality 2 items -->
20
+
21
+ ## **What you should EVENTUALLY learn for specific areas**
22
+
23
+ <!-- Criticality 1 items -->
24
+
25
+ ---
26
+
27
+ ## Full Reference
28
+
29
+ <!--
30
+ Criticality scale:
31
+ 3 = Can't do meaningful work without it
32
+ 2 = Will encounter regularly; gaps will slow you down
33
+ 1 = Comes up occasionally or is abstracted away enough to learn on the job
34
+ -->
35
+
36
+ | Topic | Area | Criticality (1-3) |
37
+ |---|---|---|
38
+ | | | |
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sam Wagner [SSW]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,173 @@
1
+ # complexity-cli
2
+
3
+ A CLI tool for managing project complexity and knowledge maps. Perfect for
4
+ tracking what developers need to know to work on your project, with AI-friendly
5
+ workflows.
6
+
7
+ ## Installation
8
+
9
+ ### Local Development
10
+
11
+ ```bash
12
+ npm install
13
+ npm run build
14
+ npm link
15
+ ```
16
+
17
+ ### From npm (Coming Soon)
18
+
19
+ ```bash
20
+ npm install -g complexity-cli
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ### Initialize a Complexity Map
26
+
27
+ Create a new `COMPLEXITY.md` file in your project:
28
+
29
+ ```bash
30
+ complexity init --name "My Project"
31
+ ```
32
+
33
+ Or run without flags to be prompted for the project name:
34
+
35
+ ```bash
36
+ complexity init
37
+ ```
38
+
39
+ ### Add Concepts
40
+
41
+ Add technologies, frameworks, or concepts to your complexity map:
42
+
43
+ ```bash
44
+ # Basic usage
45
+ complexity add "TypeScript" 3 backend
46
+
47
+ # Without area (will use "___" as placeholder)
48
+ complexity add "TypeScript" 3
49
+
50
+ # Using --level flag
51
+ complexity add "TypeScript" --level 3 backend
52
+ ```
53
+
54
+ **Criticality Levels:**
55
+
56
+ - `3` = Critical: Can't do meaningful work without it
57
+ - `2` = Important: Will encounter regularly; gaps will slow you down
58
+ - `1` = Situational: Comes up occasionally or is abstracted away
59
+
60
+ ### List Concepts
61
+
62
+ View all concepts in your complexity map:
63
+
64
+ ```bash
65
+ complexity list
66
+ ```
67
+
68
+ The `list` command automatically searches upward through directories (stopping
69
+ at git repo root) to find `COMPLEXITY.md`, so you can run it from any
70
+ subdirectory.
71
+
72
+ ### Update Concepts
73
+
74
+ Modify existing concepts:
75
+
76
+ ```bash
77
+ # Update level
78
+ complexity update "TypeScript" --level 2
79
+
80
+ # Update area
81
+ complexity update "TypeScript" --area "frontend"
82
+
83
+ # Update name
84
+ complexity update "TypeScript" --name "TypeScript/JavaScript"
85
+
86
+ # Update multiple properties
87
+ complexity update "TypeScript" --level 3 --area "fullstack"
88
+ ```
89
+
90
+ ### Remove Concepts
91
+
92
+ Remove a concept from the map:
93
+
94
+ ```bash
95
+ complexity remove "TypeScript"
96
+
97
+ # Skip confirmation prompt
98
+ complexity remove "TypeScript" --force
99
+ ```
100
+
101
+ ### Get AI Prompt
102
+
103
+ Generate a prompt for AI tools to help analyze your project:
104
+
105
+ ```bash
106
+ complexity prompt
107
+ ```
108
+
109
+ This outputs a comprehensive prompt that instructs an AI to:
110
+
111
+ - Analyze your project's complexity
112
+ - Use the `complexity` CLI to maintain consistency
113
+ - Consider all relevant technologies and concepts
114
+
115
+ ## Features
116
+
117
+ - **Simple CLI**: Easy-to-use commands for managing complexity documentation
118
+ - **Validation**: Duplicate detection and confirmation for new areas
119
+ - **Auto-formatting**: Automatically updates all sections and statistics
120
+ - **Sorting**: Concepts sorted by criticality (3→1), then alphabetically
121
+ - **Git-aware**: `complexity list` searches upward to git repo root
122
+ - **AI-friendly**: Designed to be used by AI agents for analysis
123
+
124
+ ## File Format
125
+
126
+ The tool generates and maintains a `COMPLEXITY.md` file with:
127
+
128
+ - **Summary Statistics**: Total concepts, areas, and breakdown by criticality
129
+ - **Tiered Sections**: What you NEED, SHOULD, and EVENTUALLY learn
130
+ - **Full Reference Table**: Complete sortable table of all concepts
131
+
132
+ Example output:
133
+
134
+ ```markdown
135
+ # Project Complexity & Knowledge Map
136
+
137
+ A guide to what you need to know to work on My Project, broken into three tiers.
138
+
139
+ > **5 technologies/concepts** across 3 areas **2 critical** **2 important** **1
140
+ > situational**
141
+
142
+ ---
143
+
144
+ ## **What you NEED to know to do any meaningful work**
145
+
146
+ - Node.js
147
+ - TypeScript
148
+
149
+ ## **What you SHOULD know to be very helpful**
150
+
151
+ - React
152
+ - PostgreSQL
153
+
154
+ ## **What you should EVENTUALLY learn for specific areas**
155
+
156
+ - Docker
157
+
158
+ ---
159
+
160
+ ## Full Reference
161
+
162
+ | Topic | Area | Criticality (1-3) |
163
+ | ---------- | -------- | ----------------- |
164
+ | Node.js | backend | 3 |
165
+ | TypeScript | backend | 3 |
166
+ | PostgreSQL | backend | 2 |
167
+ | React | frontend | 2 |
168
+ | Docker | devops | 1 |
169
+ ```
170
+
171
+ ## License
172
+
173
+ MIT
@@ -0,0 +1,4 @@
1
+ export declare function addCommand(concept: string, levelArg: string | undefined, areaArg: string | undefined, options: {
2
+ level?: string;
3
+ }): Promise<void>;
4
+ //# sourceMappingURL=add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AA8EA,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,iBAkB5B"}
@@ -0,0 +1,109 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.addCommand = addCommand;
40
+ const fs = __importStar(require("fs"));
41
+ const chalk_1 = __importDefault(require("chalk"));
42
+ const parser_1 = require("../core/parser");
43
+ const generator_1 = require("../core/generator");
44
+ const validator_1 = require("../core/validator");
45
+ const prompts_1 = require("../utils/prompts");
46
+ const error_helpers_1 = require("../utils/error-helpers");
47
+ const BLANK_AREA = '___';
48
+ function getLevelInput(levelArg, options) {
49
+ const levelInput = options.level || levelArg;
50
+ if (!levelInput) {
51
+ (0, error_helpers_1.exitWithUsageError)('Criticality level is required.', 'complexity add <concept> <level> [area]\n or: complexity add <concept> --level <level> [area]');
52
+ }
53
+ return levelInput;
54
+ }
55
+ function validateLevel(levelInput) {
56
+ if (!(0, validator_1.isValidLevel)(levelInput)) {
57
+ (0, error_helpers_1.exitWithError)('Level must be 1, 2, or 3.');
58
+ }
59
+ return parseInt(levelInput);
60
+ }
61
+ function requireComplexityFile() {
62
+ const filePath = (0, parser_1.findComplexityFile)();
63
+ if (!filePath) {
64
+ (0, error_helpers_1.exitWithError)('COMPLEXITY.md not found.', 'Run "complexity init" to create one.');
65
+ }
66
+ return filePath;
67
+ }
68
+ function validateConceptDoesNotExist(concept, existingConcepts) {
69
+ if ((0, validator_1.isDuplicate)(concept, existingConcepts)) {
70
+ (0, error_helpers_1.exitWithError)(`Concept "${concept}" already exists.`, 'Use "complexity update" to modify it.');
71
+ }
72
+ }
73
+ async function confirmNewAreaIfNeeded(area, existingConcepts) {
74
+ if (area === BLANK_AREA) {
75
+ return;
76
+ }
77
+ if ((0, validator_1.isExistingArea)(area, existingConcepts)) {
78
+ return;
79
+ }
80
+ const confirmed = await (0, prompts_1.confirmAction)(`No pre-existing area "${area}" found. Would you still like to add it?`);
81
+ if (!confirmed) {
82
+ (0, error_helpers_1.exitCancelled)();
83
+ }
84
+ }
85
+ function createConcept(concept, level, area) {
86
+ return {
87
+ topic: concept,
88
+ area,
89
+ criticality: level
90
+ };
91
+ }
92
+ function saveComplexityFile(filePath, projectName, concepts) {
93
+ const markdown = (0, generator_1.generateMarkdown)(projectName, concepts);
94
+ fs.writeFileSync(filePath, markdown, 'utf-8');
95
+ }
96
+ async function addCommand(concept, levelArg, areaArg, options) {
97
+ const levelInput = getLevelInput(levelArg, options);
98
+ const level = validateLevel(levelInput);
99
+ const area = areaArg || BLANK_AREA;
100
+ const filePath = requireComplexityFile();
101
+ const doc = (0, parser_1.parseComplexityFile)(filePath);
102
+ validateConceptDoesNotExist(concept, doc.concepts);
103
+ await confirmNewAreaIfNeeded(area, doc.concepts);
104
+ const newConcept = createConcept(concept, level, area);
105
+ const updatedConcepts = [...doc.concepts, newConcept];
106
+ saveComplexityFile(filePath, doc.projectName, updatedConcepts);
107
+ console.log(chalk_1.default.green(`✓ Added "${concept}" (Level ${level}, Area: ${area})`));
108
+ }
109
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,gCAsBC;AApGD,uCAAyB;AACzB,kDAA0B;AAC1B,2CAAyE;AACzE,iDAAqD;AACrD,iDAA8E;AAC9E,8CAAiD;AACjD,0DAA0F;AAG1F,MAAM,UAAU,GAAG,KAAK,CAAC;AAEzB,SAAS,aAAa,CAAC,QAA4B,EAAE,OAA2B;IAC9E,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,IAAI,QAAQ,CAAC;IAE7C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,IAAA,kCAAkB,EAChB,gCAAgC,EAChC,iGAAiG,CAClG,CAAC;IACJ,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,aAAa,CAAC,UAAkB;IACvC,IAAI,CAAC,IAAA,wBAAY,EAAC,UAAU,CAAC,EAAE,CAAC;QAC9B,IAAA,6BAAa,EAAC,2BAA2B,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,qBAAqB;IAC5B,MAAM,QAAQ,GAAG,IAAA,2BAAkB,GAAE,CAAC;IAEtC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,IAAA,6BAAa,EAAC,0BAA0B,EAAE,sCAAsC,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,2BAA2B,CAAC,OAAe,EAAE,gBAA2B;IAC/E,IAAI,IAAA,uBAAW,EAAC,OAAO,EAAE,gBAAgB,CAAC,EAAE,CAAC;QAC3C,IAAA,6BAAa,EAAC,YAAY,O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C,CAAC;IACnD,MAAM,sBAAsB,CAAC,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IAEjD,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACvD,MAAM,eAAe,GAAG,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAEtD,kBAAkB,CAAC,QAAQ,EAAE,GAAG,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IAE/D,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,YAAY,OAAO,YAAY,KAAK,WAAW,IAAI,GAAG,CAAC,CAAC,CAAC;AACnF,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare function initCommand(options: {
2
+ name?: string;
3
+ force?: boolean;
4
+ }): Promise<void>;
5
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AA2CA,wBAAsB,WAAW,CAAC,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,iBAU5E"}
@@ -0,0 +1,85 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.initCommand = initCommand;
40
+ const fs = __importStar(require("fs"));
41
+ const path = __importStar(require("path"));
42
+ const chalk_1 = __importDefault(require("chalk"));
43
+ const prompts_1 = require("../utils/prompts");
44
+ const error_helpers_1 = require("../utils/error-helpers");
45
+ const TEMPLATE_FILE = path.join(__dirname, '../../Complexity.template.md');
46
+ const OUTPUT_FILE = 'COMPLEXITY.md';
47
+ function getOutputPath() {
48
+ return path.join(process.cwd(), OUTPUT_FILE);
49
+ }
50
+ function validateFileDoesNotExist(outputPath, force) {
51
+ if (fs.existsSync(outputPath) && !force) {
52
+ (0, error_helpers_1.exitWithError)(`${OUTPUT_FILE} already exists in this directory.`, 'Use --force to overwrite it.');
53
+ }
54
+ }
55
+ async function getProjectName(providedName) {
56
+ if (providedName) {
57
+ return providedName;
58
+ }
59
+ return (0, prompts_1.promptForInput)('Enter project name:', path.basename(process.cwd()));
60
+ }
61
+ function readTemplateFile() {
62
+ if (!fs.existsSync(TEMPLATE_FILE)) {
63
+ (0, error_helpers_1.exitWithError)(`Template file not found at ${TEMPLATE_FILE}`);
64
+ }
65
+ return fs.readFileSync(TEMPLATE_FILE, 'utf-8');
66
+ }
67
+ function initializeTemplateContent(template, projectName) {
68
+ return template
69
+ .replace(/\{Project Name\}/g, projectName)
70
+ .replace(/\{X\}/g, '0')
71
+ .replace(/\{Y\}/g, '0')
72
+ .replace(/\{A\}/g, '0')
73
+ .replace(/\{B\}/g, '0')
74
+ .replace(/\{C\}/g, '0');
75
+ }
76
+ async function initCommand(options) {
77
+ const outputPath = getOutputPath();
78
+ validateFileDoesNotExist(outputPath, options.force ?? false);
79
+ const projectName = await getProjectName(options.name);
80
+ const template = readTemplateFile();
81
+ const content = initializeTemplateContent(template, projectName);
82
+ fs.writeFileSync(outputPath, content, 'utf-8');
83
+ console.log(chalk_1.default.green(`✓ Created ${OUTPUT_FILE} for project: ${projectName}`));
84
+ }
85
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,kCAUC;AArDD,uCAAyB;AACzB,2CAA6B;AAC7B,kDAA0B;AAC1B,8CAAkD;AAClD,0DAAuD;AAEvD,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,8BAA8B,CAAC,CAAC;AAC3E,MAAM,WAAW,GAAG,eAAe,CAAC;AAEpC,SAAS,aAAa;IACpB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,wBAAwB,CAAC,UAAkB,EAAE,KAAc;IAClE,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QACxC,IAAA,6BAAa,EAAC,GAAG,WAAW,oCAAoC,EAAE,8BAA8B,CAAC,CAAC;IACpG,CAAC;AACH,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,YAAgC;IAC5D,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,YAA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AC,CAAC,CAAC;AACnF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function listCommand(): void;
2
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAuDA,wBAAgB,WAAW,SAiB1B"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.listCommand = listCommand;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const parser_1 = require("../core/parser");
9
+ const generator_1 = require("../core/generator");
10
+ const error_helpers_1 = require("../utils/error-helpers");
11
+ function requireComplexityFile() {
12
+ const filePath = (0, parser_1.findComplexityFile)();
13
+ if (!filePath) {
14
+ (0, error_helpers_1.exitWithError)('COMPLEXITY.md not found.', 'Run "complexity init" to create one.');
15
+ }
16
+ return filePath;
17
+ }
18
+ function displayEmptyState(filePath) {
19
+ console.log(chalk_1.default.yellow('No concepts found in COMPLEXITY.md'));
20
+ console.log(chalk_1.default.gray(`File location: ${filePath}`));
21
+ }
22
+ function displayHeader(projectName, filePath, totalConcepts) {
23
+ console.log(chalk_1.default.bold(`\nProject: ${projectName}`));
24
+ console.log(chalk_1.default.gray(`File: ${filePath}`));
25
+ console.log(chalk_1.default.gray(`Total concepts: ${totalConcepts}\n`));
26
+ }
27
+ function displayConceptGroup(title, concepts, color) {
28
+ if (concepts.length === 0) {
29
+ return;
30
+ }
31
+ console.log(color(title));
32
+ concepts.forEach(concept => {
33
+ console.log(` ${chalk_1.default.bold(concept.topic)} ${chalk_1.default.gray(`[${concept.area}]`)}`);
34
+ });
35
+ console.log('');
36
+ }
37
+ function groupConceptsByCriticality(concepts) {
38
+ return {
39
+ critical: concepts.filter(c => c.criticality === 3),
40
+ important: concepts.filter(c => c.criticality === 2),
41
+ situational: concepts.filter(c => c.criticality === 1),
42
+ };
43
+ }
44
+ function listCommand() {
45
+ const filePath = requireComplexityFile();
46
+ const doc = (0, parser_1.parseComplexityFile)(filePath);
47
+ const sorted = (0, generator_1.sortConcepts)(doc.concepts);
48
+ if (sorted.length === 0) {
49
+ displayEmptyState(filePath);
50
+ return;
51
+ }
52
+ displayHeader(doc.projectName, filePath, sorted.length);
53
+ const groups = groupConceptsByCriticality(sorted);
54
+ displayConceptGroup('Critical (Level 3):', groups.critical, chalk_1.default.red.bold);
55
+ displayConceptGroup('Important (Level 2):', groups.important, chalk_1.default.yellow.bold);
56
+ displayConceptGroup('Situational (Level 1):', groups.situational, chalk_1.default.green.bold);
57
+ }
58
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":";;;;;AAuDA,kCAiBC;AAxED,kDAA0B;AAC1B,2CAAyE;AACzE,iDAAiD;AACjD,0DAAuD;AAGvD,SAAS,qBAAqB;IAC5B,MAAM,QAAQ,GAAG,IAAA,2BAAkB,GAAE,CAAC;IAEtC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,IAAA,6BAAa,EAAC,0BAA0B,EAAE,sCAAsC,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAgB;IACzC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,oCAAoC,CAAC,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,kBAAkB,QAAQ,EAAE,CAAC,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,aAAa,CAAC,WAAmB,EAAE,QAAgB,EAAE,aAAqB;IACjF,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,cAAc,WAAW,EAAE,CAAC,CAAC,CAAC;IACrD,OAAO,CAAC,G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AC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAE1C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAC5B,OAAO;IACT,CAAC;IAED,aAAa,CAAC,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAExD,MAAM,MAAM,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC;IAElD,mBAAmB,CAAC,qBAAqB,EAAE,MAAM,CAAC,QAAQ,EAAE,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5E,mBAAmB,CAAC,sBAAsB,EAAE,MAAM,CAAC,SAAS,EAAE,eAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjF,mBAAmB,CAAC,wBAAwB,EAAE,MAAM,CAAC,WAAW,EAAE,eAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACtF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function promptCommand(): void;
2
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/commands/prompt.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,SAkC5B"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.promptCommand = promptCommand;
4
+ function promptCommand() {
5
+ const prompt = `
6
+ I'd like you to analyze this project and create a comprehensive complexity map. This map should list everything someone needs to know to take full ownership of this software project.
7
+
8
+ For each technology, concept, or skill:
9
+ - Rate its criticality from 1-3:
10
+ * 3 = Can't do meaningful work without it
11
+ * 2 = Will encounter regularly; gaps will slow you down
12
+ * 1 = Comes up occasionally or is abstracted away
13
+
14
+ - Categorize it by area (e.g., backend, frontend, infrastructure, devops, etc.)
15
+
16
+ Use the following CLI commands to maintain the COMPLEXITY.md file:
17
+ - \`complexity add <concept> <level> [area]\` - Add a new technology
18
+ - \`complexity update <concept> --level <level> --area <area>\` - Update existing entry
19
+ - \`complexity remove <concept>\` - Remove an entry
20
+ - \`complexity list\` - View current entries
21
+
22
+ Be thorough and accurate. Consider:
23
+ - Programming languages and frameworks
24
+ - Databases and data stores
25
+ - DevOps and infrastructure tools
26
+ - Testing frameworks and methodologies
27
+ - Build tools and package managers
28
+ - Domain-specific knowledge
29
+ - Architectural patterns and design principles
30
+ - Third-party services and APIs
31
+
32
+ Start by reviewing the existing entries with \`complexity list\`, then add, update, or remove entries as needed to ensure completeness and accuracy.
33
+
34
+ Do not update the COMPLEXITY.md file manually.
35
+ `.trim();
36
+ console.log(prompt);
37
+ }
38
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/commands/prompt.ts"],"names":[],"mappings":";;AAAA,sCAkCC;AAlCD,SAAgB,aAAa;IAC3B,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BhB,CAAC,IAAI,EAAE,CAAC;IAEP,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function removeCommand(concept: string, options: {
2
+ force?: boolean;
3
+ }): Promise<void>;
4
+ //# sourceMappingURL=remove.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../src/commands/remove.ts"],"names":[],"mappings":"AAoDA,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,iBAWhF"}