@tmddev/tmd 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 (53) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +424 -0
  3. package/bin/tmd.js +3 -0
  4. package/dist/cli.d.ts +3 -0
  5. package/dist/cli.js +92 -0
  6. package/dist/commands/act.d.ts +3 -0
  7. package/dist/commands/act.js +210 -0
  8. package/dist/commands/check.d.ts +3 -0
  9. package/dist/commands/check.js +183 -0
  10. package/dist/commands/do.d.ts +3 -0
  11. package/dist/commands/do.js +310 -0
  12. package/dist/commands/list.d.ts +3 -0
  13. package/dist/commands/list.js +56 -0
  14. package/dist/commands/plan.d.ts +3 -0
  15. package/dist/commands/plan.js +89 -0
  16. package/dist/commands/show.d.ts +2 -0
  17. package/dist/commands/show.js +69 -0
  18. package/dist/commands/skills.d.ts +3 -0
  19. package/dist/commands/skills.js +243 -0
  20. package/dist/types.d.ts +79 -0
  21. package/dist/types.js +5 -0
  22. package/dist/utils/act-processing.d.ts +64 -0
  23. package/dist/utils/act-processing.js +222 -0
  24. package/dist/utils/analysis.d.ts +34 -0
  25. package/dist/utils/analysis.js +159 -0
  26. package/dist/utils/comparison.d.ts +34 -0
  27. package/dist/utils/comparison.js +217 -0
  28. package/dist/utils/language-validator.d.ts +11 -0
  29. package/dist/utils/language-validator.js +39 -0
  30. package/dist/utils/openspec.d.ts +5 -0
  31. package/dist/utils/openspec.js +91 -0
  32. package/dist/utils/paths.d.ts +10 -0
  33. package/dist/utils/paths.js +33 -0
  34. package/dist/utils/skills.d.ts +3 -0
  35. package/dist/utils/skills.js +248 -0
  36. package/dist/utils/skillssh.d.ts +12 -0
  37. package/dist/utils/skillssh.js +135 -0
  38. package/dist/utils/standardization.d.ts +26 -0
  39. package/dist/utils/standardization.js +106 -0
  40. package/dist/utils/task-chain.d.ts +35 -0
  41. package/dist/utils/task-chain.js +146 -0
  42. package/dist/utils/task-id.d.ts +5 -0
  43. package/dist/utils/task-id.js +15 -0
  44. package/dist/utils/task-status.d.ts +6 -0
  45. package/dist/utils/task-status.js +61 -0
  46. package/dist/utils/task-validator.d.ts +42 -0
  47. package/dist/utils/task-validator.js +178 -0
  48. package/dist/utils/tasks.d.ts +27 -0
  49. package/dist/utils/tasks.js +125 -0
  50. package/dist/utils/templates.d.ts +12 -0
  51. package/dist/utils/templates.js +143 -0
  52. package/package.json +84 -0
  53. package/scripts/postinstall.js +92 -0
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Template generators for PDCA phase documents
3
+ * All templates are in English as per specification
4
+ */
5
+ export const planTemplate = `# Plan: {{description}}
6
+
7
+ ## Why
8
+ <!-- Define the problem or improvement opportunity -->
9
+ <!-- What issue are we solving? What opportunity are we pursuing? -->
10
+
11
+ ## Goals
12
+ <!-- SMART Goals: Specific, Measurable, Achievable, Relevant, Time-bound -->
13
+ <!-- Example: "Reduce image load time by 50% within 2 weeks" -->
14
+ - [ ] Goal 1:
15
+ - [ ] Goal 2:
16
+
17
+ ## What Changes
18
+ <!-- Specific changes to be made -->
19
+ <!-- List concrete deliverables and modifications -->
20
+ -
21
+
22
+ ## Impact
23
+ <!-- Affected systems, files, processes, or stakeholders -->
24
+ - Affected areas:
25
+ - Dependencies:
26
+ - Risks:
27
+
28
+ ## Tasks
29
+ <!-- Implementation steps as checklist -->
30
+ <!--
31
+ Task Size Guidelines: Ten seconds to Ten minutes Task Markdown Driven Development!
32
+ Tasks should be atomic and completable in 10 seconds to 10 minutes (pee-break sized).
33
+ - Each task should be a single, focused action
34
+ - Avoid compound tasks (tasks with "and" or multiple actions)
35
+ - Break down large tasks into smaller atomic tasks
36
+
37
+ Examples of good atomic tasks:
38
+ - "Add import statement"
39
+ - "Update function signature"
40
+ - "Create test file"
41
+ - "Fix typo in documentation"
42
+
43
+ Examples of tasks to break down:
44
+ - "Implement authentication and authorization" → Break into: "Add auth middleware", "Create login endpoint", "Add password validation"
45
+ - "Create API and update frontend" → Break into: "Create API endpoint", "Update frontend component", "Add API integration"
46
+ -->
47
+ - [ ] 1.
48
+ - [ ] 2.
49
+ - [ ] 3.
50
+
51
+ ## OpenSpec Change
52
+ <!-- Link to OpenSpec change proposal if applicable -->
53
+ `;
54
+ export const executionTemplate = `# Execution: {{taskId}}
55
+
56
+ ## Actions Taken
57
+ <!-- Document actions performed -->
58
+
59
+ ## Data Collected
60
+ <!-- Record data collected during execution -->
61
+
62
+ ## Observations
63
+ <!-- Note any observations or insights -->
64
+
65
+ ## Issues Encountered
66
+ <!-- Document any problems or blockers -->
67
+
68
+ ## Time Tracking
69
+ <!-- Track time spent if applicable -->
70
+ `;
71
+ export const evaluationTemplate = `# Evaluation: {{taskId}}
72
+
73
+ ## Results Summary
74
+ <!-- Summarize execution results -->
75
+
76
+ ## Comparison with Plan
77
+ <!-- Compare actual results with planned objectives -->
78
+
79
+ | Objective | Planned | Actual | Status |
80
+ |-----------|---------|--------|--------|
81
+ | | | | |
82
+
83
+ ## Deviations Identified
84
+ <!-- List any deviations from the plan -->
85
+
86
+ ## Root Cause Analysis
87
+ <!-- Analyze causes of deviations -->
88
+
89
+ ## Lessons Learned
90
+ <!-- Document insights and learnings -->
91
+ `;
92
+ export const improvementTemplate = `# Improvement Actions: {{taskId}}
93
+
94
+ ## Corrective Actions
95
+ <!-- Actions to address identified issues -->
96
+
97
+ ## Preventive Measures
98
+ <!-- Measures to prevent similar issues in future -->
99
+
100
+ ## Standardization Opportunities
101
+ <!-- Practices that can be standardized -->
102
+
103
+ ## Next Cycle Planning
104
+ <!-- Plan for next PDCA iteration -->
105
+ `;
106
+ export const resourcesTemplate = `# Resources: {{description}}
107
+
108
+ ## People / Roles
109
+ <!-- Who is needed for this task? -->
110
+ -
111
+
112
+ ## Tools & Systems
113
+ <!-- What tools, systems, or infrastructure is required? -->
114
+ -
115
+
116
+ ## Data Requirements
117
+ <!-- What data or information is needed? -->
118
+ -
119
+
120
+ ## Time Estimate
121
+ <!-- Estimated effort and timeline -->
122
+ - Effort:
123
+ - Timeline:
124
+ `;
125
+ export const standardizationTemplate = `# Standardization: {{taskId}}
126
+
127
+ ## Successful Practices
128
+ <!-- Document practices that worked well -->
129
+
130
+ ## Reusable Patterns
131
+ <!-- Patterns that can be reused -->
132
+
133
+ ## Standard Operating Procedures
134
+ <!-- Document SOPs if applicable -->
135
+ `;
136
+ export function renderTemplate(template, vars) {
137
+ let result = template;
138
+ for (const [key, value] of Object.entries(vars)) {
139
+ result = result.replace(new RegExp(`{{${key}}}`, 'g'), value);
140
+ }
141
+ return result;
142
+ }
143
+ //# sourceMappingURL=templates.js.map
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "@tmddev/tmd",
3
+ "version": "0.1.0",
4
+ "description": "Task Markdown Driven - A lightweight PDCA cycle management framework integrated with OpenSpec",
5
+ "type": "module",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "bin": {
16
+ "tmd": "./bin/tmd.js",
17
+ "tmdp": "./bin/tmd.js",
18
+ "tmdd": "./bin/tmd.js",
19
+ "tmdc": "./bin/tmd.js",
20
+ "tmda": "./bin/tmd.js"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "bin",
25
+ "scripts/postinstall.js",
26
+ "!dist/**/*.test.js",
27
+ "!dist/**/__tests__",
28
+ "!dist/**/*.map"
29
+ ],
30
+ "scripts": {
31
+ "lint": "eslint src/",
32
+ "build": "tsx build.ts",
33
+ "dev": "tsc --watch",
34
+ "dev:cli": "pnpm build && node bin/tmd.js",
35
+ "test": "vitest run",
36
+ "test:watch": "vitest",
37
+ "test:ui": "vitest --ui",
38
+ "test:coverage": "vitest --coverage",
39
+ "prepare": "pnpm run build",
40
+ "prepublishOnly": "pnpm run build",
41
+ "postinstall": "node scripts/postinstall.js",
42
+ "check:pack-version": "node scripts/pack-version-check.mjs",
43
+ "release": "pnpm run release:ci",
44
+ "release:ci": "pnpm run check:pack-version",
45
+ "changeset": "changeset"
46
+ },
47
+ "keywords": [
48
+ "pdca",
49
+ "openspec",
50
+ "documentation",
51
+ "management",
52
+ "cli",
53
+ "task-management",
54
+ "markdown",
55
+ "workflow"
56
+ ],
57
+ "homepage": "https://tmdd.dev",
58
+ "repository": {
59
+ "type": "git",
60
+ "url": "https://github.com/sdd330/tmd.git"
61
+ },
62
+ "author": "TMD Contributors",
63
+ "license": "MIT",
64
+ "dependencies": {
65
+ "commander": "^13.1.0",
66
+ "js-yaml": "^4.1.0",
67
+ "chalk": "^5.4.1"
68
+ },
69
+ "devDependencies": {
70
+ "@changesets/changelog-github": "^0.5.2",
71
+ "@changesets/cli": "^2.27.7",
72
+ "@types/js-yaml": "^4.0.9",
73
+ "@types/node": "^22.12.0",
74
+ "@vitest/ui": "^3.2.4",
75
+ "eslint": "^9.39.2",
76
+ "tsx": "^4.19.2",
77
+ "typescript": "^5.7.3",
78
+ "typescript-eslint": "^8.50.1",
79
+ "vitest": "^3.2.4"
80
+ },
81
+ "engines": {
82
+ "node": ">=20.19.0"
83
+ }
84
+ }
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Postinstall script for TMD
5
+ *
6
+ * This script runs automatically after npm install unless:
7
+ * - CI=true environment variable is set
8
+ * - TMD_NO_POSTINSTALL=1 environment variable is set
9
+ * - dist/ directory doesn't exist (dev setup scenario)
10
+ *
11
+ * The script never fails npm install - all errors are caught and handled gracefully.
12
+ */
13
+
14
+ import { promises as fs } from 'fs';
15
+ import path from 'path';
16
+ import { fileURLToPath } from 'url';
17
+
18
+ const __filename = fileURLToPath(import.meta.url);
19
+ const __dirname = path.dirname(__filename);
20
+
21
+ /**
22
+ * Check if we should skip installation
23
+ */
24
+ function shouldSkipInstallation() {
25
+ // Skip in CI environments
26
+ if (process.env.CI === 'true' || process.env.CI === '1') {
27
+ return { skip: true, reason: 'CI environment detected' };
28
+ }
29
+
30
+ // Skip if user opted out
31
+ if (process.env.TMD_NO_POSTINSTALL === '1') {
32
+ return { skip: true, reason: 'TMD_NO_POSTINSTALL=1 set' };
33
+ }
34
+
35
+ return { skip: false };
36
+ }
37
+
38
+ /**
39
+ * Check if dist/ directory exists
40
+ */
41
+ async function distExists() {
42
+ const distPath = path.join(__dirname, '..', 'dist');
43
+ try {
44
+ const stat = await fs.stat(distPath);
45
+ return stat.isDirectory();
46
+ } catch {
47
+ return false;
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Main function
53
+ */
54
+ async function main() {
55
+ try {
56
+ // Check if we should skip
57
+ const skipCheck = shouldSkipInstallation();
58
+ if (skipCheck.skip) {
59
+ // Silent skip - no output
60
+ return;
61
+ }
62
+
63
+ // Check if dist/ exists (skip silently if not - expected during dev setup)
64
+ if (!(await distExists())) {
65
+ return;
66
+ }
67
+
68
+ // Placeholder for future post-installation tasks
69
+ // Examples:
70
+ // - Initialize default configuration
71
+ // - Set up example templates
72
+ // - Verify installation integrity
73
+
74
+ // For now, just verify the CLI is available
75
+ const binPath = path.join(__dirname, '..', 'bin', 'tmd.js');
76
+ try {
77
+ await fs.access(binPath);
78
+ // CLI is available - installation successful
79
+ } catch {
80
+ // CLI not found - this is OK in dev scenarios
81
+ }
82
+ } catch (error) {
83
+ // Fail gracefully - never break npm install
84
+ // Silent failure
85
+ }
86
+ }
87
+
88
+ // Run main and handle any unhandled errors
89
+ main().catch(() => {
90
+ // Silent failure - never break npm install
91
+ process.exit(0);
92
+ });